@soba-so/react 0.0.29 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use client"
2
- var wr={ready:{arc:!0},serving:{arc:!0,slot:"stream"},paused:{arc:!1,slot:"zzz"},thinking:{arc:!1,slot:"dots"},connecting:{arc:!1,slot:"orbit"},attention:{arc:!1,slot:"bang"},gone:{arc:!1,slot:"cross"},snap:{arc:!1,slot:"snap"},listening:{arc:!1,slot:"bars"},permission:{arc:!1,slot:"ring"},ai:{arc:!1,slot:"sparks"}};var vr="105 162 420 420",kr="M407.1 308.9 A158 158 0 1 0 407.1 491.1 A116 116 0 0 1 407.1 308.9 Z",Pn="M448.5 320 A110 110 0 0 1 448.5 480";import{Fragment as mt,jsx as F,jsxs as fn}from"react/jsx-runtime";function mn({kind:e,size:n=44,className:t}){let r=wr[e];return fn("svg",{className:`bx${t?` ${t}`:""}`,"data-expression":e,viewBox:vr,overflow:"visible",width:n,height:n,"aria-hidden":"true",children:[F("path",{d:kr,fill:"currentColor"}),F("path",{className:"bx-arc",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"}),r.slot==="stream"&&F(Ma,{}),r.slot==="zzz"&&F(Na,{}),r.slot==="dots"&&F(xa,{}),r.slot==="bang"&&F(Sa,{}),r.slot==="orbit"&&F(Ra,{}),r.slot==="cross"&&F(Pa,{}),r.slot==="snap"&&F(Ea,{}),r.slot==="bars"&&F(Ia,{}),r.slot==="ring"&&F(La,{}),r.slot==="sparks"&&F(Oa,{})]})}function Ma(){return F("path",{className:"bx-st",d:"M475.3 290.3 A150 150 0 0 1 475.3 509.7",fill:"none",stroke:"currentColor",strokeWidth:"15",strokeLinecap:"round",strokeDasharray:"0.1 31"})}function Na(){return fn(mt,{children:[F("g",{className:"bx-z1",children:F("path",{d:"M444 372 H496 L444 436 H496",fill:"none",stroke:"currentColor",strokeWidth:"20",strokeLinecap:"round",strokeLinejoin:"round"})}),F("g",{className:"bx-z2",children:F("path",{d:"M492 300 H522 L492 338 H522",fill:"none",stroke:"currentColor",strokeWidth:"15",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function xa(){return fn(mt,{children:[F("circle",{className:"bx-th",cx:"463.1",cy:"336.9",r:"21",fill:"currentColor"}),F("circle",{className:"bx-th bx-th2",cx:"483",cy:"400",r:"21",fill:"currentColor"}),F("circle",{className:"bx-th bx-th3",cx:"463.1",cy:"463.1",r:"21",fill:"currentColor"})]})}function Sa(){return fn("g",{className:"bx-at",children:[F("line",{x1:"490",y1:"312",x2:"490",y2:"414",stroke:"currentColor",strokeWidth:"46",strokeLinecap:"round"}),F("circle",{cx:"490",cy:"484",r:"28",fill:"currentColor"})]})}function Ra(){return fn("g",{className:"bx-ob",children:[F("path",{d:Pn,fill:"none",stroke:"var(--tile-bg, transparent)",strokeWidth:41,strokeLinecap:"round"}),F("path",{d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"})]})}function Pa(){return fn(mt,{children:[F("path",{className:"bx-xa",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"}),F("g",{className:"bx-xx",children:F("path",{d:"M442 364 L514 436 M514 364 L442 436",fill:"none",stroke:"currentColor",strokeWidth:"24",strokeLinecap:"round"})})]})}function Ea(){return F("path",{className:"bx-snap",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"})}function Ia(){return fn("g",{stroke:"currentColor",strokeWidth:"17",strokeLinecap:"round",children:[F("line",{className:"bx-vb",x1:"452",y1:"370",x2:"452",y2:"430"}),F("line",{className:"bx-vb bx-vb2",x1:"482",y1:"330",x2:"482",y2:"470"}),F("line",{className:"bx-vb bx-vb3",x1:"512",y1:"355",x2:"512",y2:"445"})]})}function La(){return F(mt,{children:[[450,366],[474,376],[484,400],[474,424],[450,434],[426,424],[416,400],[426,376]].map(([n,t],r)=>F("circle",{className:"bx-w",cx:n,cy:t,r:"11",fill:"currentColor",style:{animationDelay:`${-1.2+r*.15}s`}},r))})}function Oa(){return fn(mt,{children:[F("g",{className:"bx-sp",children:F("path",{d:"M460 300 Q465.4 324.6 490 330 Q465.4 335.4 460 360 Q454.6 335.4 430 330 Q454.6 324.6 460 300 Z",fill:"currentColor"})}),F("g",{className:"bx-sp bx-sp2",children:F("path",{d:"M486 356 Q493.92 392.08 530 400 Q493.92 407.92 486 444 Q478.08 407.92 442 400 Q478.08 392.08 486 356 Z",fill:"currentColor"})}),F("g",{className:"bx-sp bx-sp3",children:F("path",{d:"M460 440 Q465.4 464.6 490 470 Q465.4 475.4 460 500 Q454.6 475.4 430 470 Q454.6 464.6 460 440 Z",fill:"currentColor"})})]})}var is={"claude-code":{small:"haiku",large:"opus"}};function ls(e){return e==="small"||e==="large"}function cs(e,n){return is[e]?.[n]}function Zt(e){let n=is[e];return!!(n?.small||n?.large)}var nu=512*1024;import{useEffect as ks,useRef as ui,useState as $n}from"react";var Zn=class extends Error{status;constructor(n,t){super(n),this.name="ConnectError",this.status=t}},Ta=5*6e4,ft=class{session;baseUrl;doFetch;lastMachines=null;lastModelOptions=null;machinesUrl=null;gatewayBackUntil=0;constructor(n){this.session=n.session,this.baseUrl=(n.baseUrl??"").replace(/\/+$/,""),this.doFetch=n.fetchImpl??fetch.bind(globalThis)}async context(){let n=await this.request("GET","/v1/connect");return this.setMachinesUrl(n.machines_url),n}setMachinesUrl(n){typeof n=="string"&&/^https?:\/\//.test(n)&&(this.machinesUrl=n)}async machines(){let n=this.lastMachines,t=n?`?v=${encodeURIComponent(n.version)}`:"",r;if(this.machinesUrl&&Date.now()>=this.gatewayBackUntil)try{r=await this.request("GET",`${this.machinesUrl}${t}`)}catch(a){if(a instanceof Zn&&a.status===401)throw a;this.gatewayBackUntil=Date.now()+Ta}if(r??=await this.request("GET",`/v1/machines${t}`),r.unchanged&&n)return n.machines;let o=Array.isArray(r.machines)?r.machines:[];return this.lastMachines=typeof r.version=="string"?{version:r.version,machines:o}:null,o}async modelOptions(){let n=this.machinesUrl?.replace(/\/v1\/machines$/,"");if(!n)return null;let t=this.lastModelOptions,r=t?`?v=${encodeURIComponent(t.version)}`:"",o=await this.request("GET",`${n}/v1/model-options${r}`);if(o.unchanged&&t)return t.options;let a={route:o.route??{allow:[],prefer:[]},providers:Array.isArray(o.providers)?o.providers:[],names:Array.isArray(o.names)?o.names:[],layout:o.layout??"providers"};return this.lastModelOptions=typeof o.version=="string"?{version:o.version,options:a}:null,a}async runs(){let n=await this.request("GET","/v1/machines/runs");return Array.isArray(n.runs)?n.runs:[]}async stopRun(n){let t=this.machinesUrl?.replace(/\/v1\/machines$/,"");if(!t)throw new Zn("This page can't stop runs yet: it hasn't been told where Soba's gateway is.",501);await this.request("POST",`${t}/v1/runs/${encodeURIComponent(n)}/stop`,{})}lookup(n){return this.request("GET",`/v1/device/lookup?code=${encodeURIComponent(n)}`)}approve(n){return this.request("POST","/v1/device/approve",{user_code:n})}claim(n){return this.request("POST","/v1/device/claim",{pairing_nonce:n})}deny(n){return this.request("POST","/v1/device/deny",{user_code:n})}plans(){return this.request("GET","/v1/plans")}selectPlan(n){return this.request("POST","/v1/plans/select",{plan:n})}checkoutPlan(n,t){return this.request("POST","/v1/plans/checkout",{plan:n,...t?.successUrl?{success_url:t.successUrl}:{},...t?.cancelUrl?{cancel_url:t.cancelUrl}:{}})}redeemCode(n){return this.request("POST","/v1/rewards/redeem",{code:n})}leavePlan(){return this.request("DELETE","/v1/plans/select")}hosted(){return this.request("GET","/v1/hosted")}startHosted(){return this.request("POST","/v1/hosted/start")}disconnectHosted(n){return this.request("DELETE",n?`/v1/hosted?provider=${encodeURIComponent(n)}`:"/v1/hosted")}approveRuntime(n,t){return this.request("POST","/v1/runtimes/approve",{machine_id:n,runtime_id:t})}preferRuntime(n,t){return this.request("POST","/v1/runtimes/prefer",{machine_id:n,runtime_id:t})}async request(n,t,r){let o=await this.doFetch(/^https?:\/\//.test(t)?t:`${this.baseUrl}${t}`,{method:n,headers:{authorization:`Bearer ${this.session}`,...r?{"content-type":"application/json"}:{}},...r?{body:JSON.stringify(r)}:{}}),a={};try{a=await o.json()}catch{}if(!o.ok){let s=typeof a.error=="string"?a.error:`Request failed (${o.status})`;throw new Zn(s,o.status)}return a}};function ht(e){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n?.[1])return"#ffffff";let t=n[1].length===3?[...n[1]].map(a=>a+a).join(""):n[1],r=a=>{let s=Number.parseInt(t.slice(a*2,a*2+2),16)/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(1)+.0722*r(2)>.45?"#101012":"#ffffff"}function Cr(e){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n?.[1])return null;let t=n[1].length===3?[...n[1]].map(r=>r+r).join(""):n[1];return[0,1,2].map(r=>Number.parseInt(t.slice(r*2,r*2+2),16))}function qn(e,n,t){let r=Cr(e),o=Cr(n);return!r||!o?e:`#${r.map((s,c)=>Math.round(s+(o[c]-s)*t)).map(s=>s.toString(16).padStart(2,"0")).join("")}`}function En(e,n){if(!Cr(e))return{};let t=ht(e),r=n?.trim();return{"--sc-ground":e,"--sc-shell":e,"--sc-sheet":qn(e,t,.07),"--sc-raised":qn(e,t,.13),"--sc-line":qn(e,t,.18),"--sc-line-2":qn(e,t,.28),"--sc-text":t,"--sc-text-2":qn(t,e,.15),"--sc-muted":qn(t,e,.38),...r?{"--sc-accent":r,"--sc-accent-fg":ht(r)}:{"--sc-accent":t,"--sc-accent-fg":e}}}function Ke(e){return e.authenticated===!0?{tone:"ok",text:"signed in"}:e.authenticated===!1?{tone:"warn",text:e.auth_hint??"signed out on that machine"}:{tone:"unknown",text:"could not tell"}}function gt(e){let{platform:n,arch:t}=e;if(!n)return null;let r=n==="darwin"||n==="macos",o=r?"Mac":n==="win32"||n==="windows"?"Windows PC":"Linux machine";return r?`${t==="aarch64"||t==="arm64"?"Apple silicon ":""}${o}`:o}function In(e){return e.find(n=>n.state==="offline")??null}function Mr(e){return e.state==="busy"?{tone:"busy",text:`serving ${e.active} of ${e.capacity}`}:e.state==="online"?{tone:"ok",text:"connected"}:{tone:"off",text:"asleep or offline"}}function le(e){let n=e.label?.trim(),t=e.name?.trim();return n&&(!t||n!==t)?n:(t??n??"").replace(/\.(local|lan|home|internal)$/i,"").replace(/[-_]+/g," ").trim()||n||"This machine"}function Xn(e,n){let t=o=>o.state==="busy"?0:o.state==="online"?1:2,r=o=>o.last_seen_at?Date.parse(o.last_seen_at):0;return t(e)-t(n)||r(n)-r(e)}function _e(e){return[...e].sort(Xn)[0]??null}function Ln(e){return e?e.state==="busy"?{tone:"busy",word:"Serving"}:e.state==="online"?{tone:"ok",word:"Connected"}:e.pairing_lost?{tone:"off",word:"Not connected"}:{tone:"off",word:"Asleep"}:{tone:"off",word:"No compute"}}function Kn(e){let n=Ln(e);return{label:e?n.word:"Connect compute",ariaLabel:e?e.pairing_lost?`${le(e)} is not connected`:`${n.word} on ${le(e)}`:"Connect compute",connected:e!==null,state:n}}function on(e){return e.state==="online"||e.state==="busy"}function bt(e){if(!e)return"never seen";let n=Date.parse(e);if(Number.isNaN(n))return"never seen";let t=Date.now()-n,r=6e4;return t<2*r?"just now":t<60*r?`${Math.floor(t/r)} min ago`:t<24*60*r?`${Math.floor(t/(60*r))} hr ago`:`${Math.floor(t/(24*60*r))} days ago`}function Nr(e){return e.runtimes.filter(n=>n.id!=="shell")}function we(e){return e.runtimes.filter(n=>n.id!=="shell"&&!n.quarantined&&!n.absent)}function Fe(e){let n=s=>s?e.runtimes.find(c=>c.id===s)??null:null;if(e.requested_runtime)return{by:"app",runtimeId:e.requested_runtime,runtime:n(e.requested_runtime)};let t=we(e),r=t.find(s=>s.id===e.preferred_runtime);if(r)return{by:"you",runtimeId:r.id,runtime:r};let o=s=>s.id==="claude-code"?0:s.id==="codex"?1:2,a=[...t].sort((s,c)=>o(s)-o(c))[0]??null;return{by:"default",runtimeId:a?.id??null,runtime:a}}var xr="soba";function On(){return`${xr}://show`}function At(e,n,t){let r=`${xr}://connect?url=${encodeURIComponent(e)}`;return n&&(r+=`&nonce=${encodeURIComponent(n)}`),t&&(r+=`&want=${encodeURIComponent(t)}`),r}function yt(){let e=globalThis.crypto;if(!e?.getRandomValues)return null;let n=e.getRandomValues(new Uint8Array(32)),t="";for(let r of n)t+=String.fromCharCode(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Ba=1600;function Sr(e={}){return Pr(e)}async function Rr(e,n={}){if(typeof window>"u"||typeof document>"u")return"unknown";let t=Pr(n);try{window.location.href=At(e,n.nonce,n.want)}catch{return"absent"}return t}async function Tn(e={}){if(typeof window>"u"||typeof document>"u")return"unknown";let n=Pr(e);try{window.location.href=On()}catch{return"absent"}return n}async function Pr(e){if(typeof window>"u"||typeof document>"u")return"unknown";let n=e.graceMs??Ba,t=document.visibilityState==="visible"&&document.hasFocus(),r=!1,o=()=>{r=!0},a=()=>{document.visibilityState==="hidden"&&(r=!0)};return window.addEventListener("blur",o),window.addEventListener("pagehide",o),document.addEventListener("visibilitychange",a),await new Promise(s=>setTimeout(s,n)),window.removeEventListener("blur",o),window.removeEventListener("pagehide",o),document.removeEventListener("visibilitychange",a),t?r?"opened":"absent":"unknown"}var $e={"claude-code":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAARGVYSWZNTQAqAAAACAABh2kABAAAAAEAAAAaAAAAAAADoAEAAwAAAAEAAQAAoAIABAAAAAEAAABAoAMABAAAAAEAAABAAAAAAEZRQrAAAAHLaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJYTV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mtjG4qej4OQ90YuRN/rYcWzMU8ZPuWbyCHPgbYT3vQ4Pp0/OM7QYx6VGXgMbdGN/AVNIT3cAadkl50K7+QtmgFGBskwuuGBL+EfnaxNQFH3ihDqM12j6lTyyVn4H4E6hAx4NkYwy1G0DlAmsUN8ESX6/+H/GpiUBv4FSyLhydRRp0cAAAAASUVORK5CYII="};import{useEffect as us,useRef as Ga}from"react";import{Fragment as Da,jsx as Ge,jsxs as Er}from"react/jsx-runtime";function Ir({anchor:e,label:n,options:t,current:r,onClose:o,onPick:a}){let s=Ga(null);return us(()=>{let i=s.current,l=e.current;if(!i||!l)return;try{typeof i.showPopover=="function"&&i.showPopover()}catch{}let d=l.getBoundingClientRect();d.width>i.offsetWidth&&(i.style.width=`${Math.round(d.width)}px`);let h=i.offsetWidth,b=i.offsetHeight,y=d.width>248?d.left:d.right-h,m=Math.max(8,Math.min(y,window.innerWidth-h-8)),v=d.bottom+6,A=v+b>window.innerHeight-8&&d.top-6-b>8?d.top-6-b:v;i.style.left=`${Math.round(m)}px`,i.style.top=`${Math.round(A)}px`,i.querySelector('[aria-checked="true"]')?.focus()},[e]),us(()=>{let i=l=>{let d=l.target;!d||s.current?.contains(d)||e.current?.contains(d)||o()};return document.addEventListener("pointerdown",i,!0),()=>document.removeEventListener("pointerdown",i,!0)},[e,o]),Ge("div",{ref:s,role:"menu","aria-label":n,className:"sc-menu",popover:"manual",onKeyDown:i=>{let l=[...s.current?.querySelectorAll("[role=menuitemradio]")??[]],d=l.indexOf(document.activeElement);if(i.key==="Escape")i.stopPropagation(),i.nativeEvent.stopImmediatePropagation(),o(),e.current?.focus();else if(i.key==="ArrowDown"||i.key==="ArrowUp"){i.preventDefault();let h=i.key==="ArrowDown"?1:-1;l[(d+h+l.length)%l.length]?.focus()}else i.key==="Tab"&&o()},children:t.map(i=>Ge(Wa,{option:i,checked:r===i.id,onClose:o,onPick:a},i.id??""))})}function Wa({option:e,checked:n,onClose:t,onPick:r}){return Er(Da,{children:[e.heading?Ge("div",{className:"sc-menu-head",role:"presentation",children:e.heading}):e.rule?Ge("div",{className:"sc-menu-sep"}):null,Er("button",{type:"button",role:"menuitemradio","aria-checked":n,className:"sc-menu-item",onClick:()=>{e.onChoose?(e.onChoose(),t()):n?t():r(e.id)},children:[e.glyph,Er("span",{className:"sc-menu-text",children:[Ge("span",{className:"sc-menu-label",children:e.label}),e.note&&Ge("span",{className:"sc-menu-note",children:e.note})]}),e.trailing?Ge("span",{className:"sc-menu-act",children:e.trailing}):n&&Ge(Lr,{})]})]})}function Lr(){return Ge("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-menu-check",children:Ge("path",{d:"M5 12.5l4.5 4.5L19 7.5",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function hn({open:e}){return Ge("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e?"sc-chev sc-chev-open":"sc-chev",children:Ge("path",{d:"M9 6l6 6-6 6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}import{useEffect as Xt,useId as Fa,useLayoutEffect as za,useMemo as Kt,useRef as kt,useState as Ct}from"react";var ds={haiku:"Haiku",sonnet:"Sonnet",opus:"Opus",fable:"Fable"};function en(e){return ds[e]??e}function wt(e,n=[],t=[],r){let o=A=>!r||r.includes(A.cost_class),a=[...e].sort(Xn),s=_e([...e]),c=s?Fe(s):null,l=[{id:"auto",kind:"auto",label:"Automatic",model:"auto",...c?.runtime?{note:c.runtime.default_model?`Uses ${en(c.runtime.default_model)}`:`Uses ${c.runtime.display_name}`}:{}}];a.some(A=>we(A).some(k=>o(k)&&Zt(k.id)))&&l.push({id:"small",kind:"size",label:"Fast",note:"quick and cheap",model:"small"},{id:"large",kind:"size",label:"Best",note:"the most capable",model:"large"});let h=new Map,y=new Set(a.flatMap(A=>we(A).filter(o).map(k=>k.id))).size>1||n.some(A=>A.models.length>0);for(let A of a)for(let k of we(A))if(o(k)){!k.models.some(Boolean)&&y&&!h.has(`${k.id}/auto`)?h.set(`${k.id}/auto`,{option:{id:`${k.id}/auto`,kind:"named",label:k.display_name,note:k.default_model?`Uses ${en(k.default_model)}`:"its default model",model:"auto",runtime:k.id,runtimeName:k.display_name,costClass:k.cost_class},machines:new Set([le(A)])}):h.has(`${k.id}/auto`)&&h.get(`${k.id}/auto`)?.machines.add(le(A));for(let S of k.models){if(!S)continue;let W=`${k.id}/${S}`,L=h.get(W);if(L){L.machines.add(le(A));continue}h.set(W,{option:{id:W,kind:"named",label:en(S),model:S,runtime:k.id,runtimeName:k.display_name,costClass:k.cost_class},machines:new Set([le(A)])})}}let m=new Set;for(let{machines:A}of h.values())for(let k of A)m.add(k);let v=m.size>1;for(let{option:A,machines:k}of h.values()){let S=v&&k.size===1?[...k][0]:void 0;l.push(S?{...A,machine:S}:A)}for(let A of n)for(let{model:k}of A.models)k&&l.push({id:`@${A.id}/${k}`,kind:"provider",label:k,model:k,costClass:A.cost_class,providerId:A.id,providerName:A.name,...A.provider?{providerMark:A.provider}:{},...A.locked?{locked:A.locked}:{}});for(let A of t)!A.alias||!A.cost_classes.length||l.push({id:`alias:${A.alias}`,kind:"provider",label:A.label,...A.note?{note:A.note}:{},...A.icon?{icon:A.icon}:{},model:A.alias,costClass:A.cost_classes[0],costClasses:A.cost_classes,...A.provider?{providerMark:A.provider}:{},...A.locked?{locked:A.locked}:{},choice:A.alias});return l}function ps(e,n){let t=[];for(let r of n){let o=r.provider?.toLowerCase(),a=e.filter(l=>l.model!==r.model?!1:r.runtime?l.kind==="named"&&l.runtime===r.runtime:l.kind!=="provider"?!1:!o||l.providerMark===o||l.providerId?.toLowerCase()===o||l.providerName?.toLowerCase()===o),s=a.find(l=>!l.locked)??a[0];if(!s)continue;let{machine:c,...i}=s;t.push({...i,id:`choice:${r.id}`,label:r.label,...r.note?{note:r.note}:{},choice:r.id})}return t}function Or(e,n,t=[]){if(n==="automatic")return e.filter(c=>c.kind==="auto"||c.kind==="size");if(n!=="choices")return[...e];let r=e.filter(c=>c.choice),o=ps(e.filter(c=>!c.choice),t),a=e.filter(c=>c.kind!=="provider");return[...a.filter(c=>c.kind==="auto"||c.kind==="size"),...r,...o,...a.filter(c=>c.kind==="named")]}function Tr(e,n){return e.filter(t=>t.kind!=="size"||(t.model==="small"?n?.fast!==!1:n?.best!==!1))}function Br(e,n,t){return t?.auto!==!1||n==="automatic"?[...e]:e.filter(r=>r.kind!=="auto")}function vt(e,n="providers",t=!1){let r=[],o=[],a=new Map;for(let s of e){if(s.kind!=="named"&&s.kind!=="provider"||s.choice){r.push(s);continue}if(n==="models"&&(s.kind==="provider"||t)){let l=a.get("@models");if(l)l.options.push(s);else{let d={heading:"Models",options:[s]};a.set("@models",d),o.push(d)}continue}let c=s.runtime??`@${s.providerId}`,i=a.get(c);if(i)i.options.push(s);else{let l={heading:s.runtimeName??s.providerName??s.runtime??"",options:[s]};a.set(c,l),o.push(l)}}for(let s of o)s.options.some(c=>c.model in ds)||s!==a.get("@models")&&s.options.sort((c,i)=>c.label.localeCompare(i.label,void 0,{numeric:!0,sensitivity:"base"}));return r.length?[{heading:null,options:r},...o]:o}function Gr(e,n){let t=e.find(o=>o.kind==="auto")??{id:"auto",kind:"auto",label:"Automatic",model:"auto"};if(!n||n==="auto")return{selected:t,unavailable:null};let r=e.find(o=>o.id===n);return r&&!r.locked?{selected:r,unavailable:null}:{selected:t,unavailable:n}}function Wr(e){return e.kind==="provider"&&e.costClass?{model:e.model,route:{allow:e.costClasses??[e.costClass]}}:e.runtime?{model:e.model,runtime:e.runtime}:{model:e.model}}function gn(e){return e.length>1}var Ha={opus:"Most capable. Best for hard, multi-step work.",sonnet:"Balanced speed and quality for everyday runs.",haiku:"Fastest. Best for quick, simple runs."};function Dr(e){if(e.kind==="auto"){let t=e.note?.replace(/^Uses /,"");return t?`Soba picks the model for each run. Currently using ${t}.`:"Soba picks the model for each run."}if(e.kind==="size")return e.id==="small"?"Quick and cheap. Whichever small model the agent serving has.":"The most capable model the agent serving has.";if(e.kind==="provider")return e.locked==="plan"?"Not included in your plan.":e.locked==="allowance"?"Your plan's allowance is used up.":e.providerName?`Through ${e.providerName}. Counts toward your plan.`:void 0;let n=Ha[e.model];return n?e.machine?`${n} On ${e.machine}.`:n:e.machine?`On ${e.machine}.`:void 0}var Hr={openai:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"></path>'},anthropic:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path>'},gemini:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="#3186FF"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-0)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-1)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-2)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-0" x1="7" x2="11" y1="15.5" y2="12"><stop stop-color="#08B962"></stop><stop offset="1" stop-color="#08B962" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-1" x1="8" x2="11.5" y1="5.5" y2="11"><stop stop-color="#F94543"></stop><stop offset="1" stop-color="#F94543" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-2" x1="3.5" x2="17.5" y1="13.5" y2="12"><stop stop-color="#FABC12"></stop><stop offset=".46" stop-color="#FABC12" stop-opacity="0"></stop></linearGradient></defs>'},azure:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M7.242 1.613A1.11 1.11 0 018.295.857h6.977L8.03 22.316a1.11 1.11 0 01-1.052.755h-5.43a1.11 1.11 0 01-1.053-1.466L7.242 1.613z" fill="url(#azure-soba-pm-azure-0)"></path><path d="M18.397 15.296H7.4a.51.51 0 00-.347.882l7.066 6.595c.206.192.477.298.758.298h6.226l-2.706-7.775z" fill="#0078D4"></path><path d="M15.272.857H7.497L0 23.071h7.775l1.596-4.73 5.068 4.73h6.665l-2.707-7.775h-7.998L15.272.857z" fill="url(#azure-soba-pm-azure-1)"></path><path d="M17.193 1.613a1.11 1.11 0 00-1.052-.756h-7.81.035c.477 0 .9.304 1.052.756l6.748 19.992a1.11 1.11 0 01-1.052 1.466h-.12 7.895a1.11 1.11 0 001.052-1.466L17.193 1.613z" fill="url(#azure-soba-pm-azure-2)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-0" x1="8.247" x2="1.002" y1="1.626" y2="23.03"><stop stop-color="#114A8B"></stop><stop offset="1" stop-color="#0669BC"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-1" x1="14.042" x2="12.324" y1="15.302" y2="15.888"><stop stop-opacity=".3"></stop><stop offset=".071" stop-opacity=".2"></stop><stop offset=".321" stop-opacity=".1"></stop><stop offset=".623" stop-opacity=".05"></stop><stop offset="1" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-2" x1="12.841" x2="20.793" y1="1.626" y2="22.814"><stop stop-color="#3CCBF4"></stop><stop offset="1" stop-color="#2892DF"></stop></linearGradient></defs>'},openrouter:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M18.654 3.87a5.087 5.087 0 110 10.174L23.7 19.09c.64.641.187 1.737-.72 1.737H8.48a8.479 8.479 0 010-16.958h10.175zM8.479 7.26a5.087 5.087 0 100 10.176 5.087 5.087 0 000-10.175z"></path>'},groq:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M12.036 2c-3.853-.035-7 3-7.036 6.781-.035 3.782 3.055 6.872 6.908 6.907h2.42v-2.566h-2.292c-2.407.028-4.38-1.866-4.408-4.23-.029-2.362 1.901-4.298 4.308-4.326h.1c2.407 0 4.358 1.915 4.365 4.278v6.305c0 2.342-1.944 4.25-4.323 4.279a4.375 4.375 0 01-3.033-1.252l-1.851 1.818A7 7 0 0012.029 22h.092c3.803-.056 6.858-3.083 6.879-6.816v-6.5C18.907 4.963 15.817 2 12.036 2z"></path>'},together:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M23.197 4.503A6 6 0 0015 2.307a5.973 5.973 0 00-2.995 4.933l5.996.008v.515h-5.996c.039.937.298 1.87.8 2.74a6 6 0 1010.39-6z" fill="#EF2CC1"></path><path d="M.805 4.5A6 6 0 003 12.697a5.972 5.972 0 005.77.127L5.779 7.627l.446-.257 2.997 5.192A6 6 0 10.804 4.5z" fill="#CAAEF5"></path><path d="M12 23.894a6 6 0 005.999-6c0-2.13-1.1-3.996-2.775-5.06l-3.005 5.189-.444-.258 2.997-5.192A6 6 0 1012 23.894z" fill="#FC4C02"></path>'},fireworks:{viewBox:"0 0 24 24",mono:!1,svg:'<path clip-rule="evenodd" d="M14.8 5l-2.801 6.795L9.195 5H7.397l3.072 7.428a1.64 1.64 0 003.038.002L16.598 5H14.8zm1.196 10.352l5.124-5.244-.699-1.669-5.596 5.739a1.664 1.664 0 00-.343 1.807 1.642 1.642 0 001.516 1.012L16 17l8-.02-.699-1.669-7.303.041h-.002zM2.88 10.104l.699-1.669 5.596 5.739c.468.479.603 1.189.343 1.807a1.643 1.643 0 01-1.516 1.012l-8-.018-.002.002.699-1.669 7.303.042-5.122-5.246z" fill="#5019C5" fill-rule="evenodd"></path>'}};import{jsx as Ua}from"react/jsx-runtime";function Bn({provider:e,className:n}){let t=Hr[e];return t?Ua("svg",{className:n,viewBox:t.viewBox,fill:t.mono?"currentColor":void 0,fillRule:"evenodd","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:t.svg}}):null}import{Fragment as gs,jsx as z,jsxs as We}from"react/jsx-runtime";function Mt({options:e,layout:n="providers",ownInList:t=!1,search:r=!0,selected:o,appName:a,onPick:s,caption:c,onOpen:i,disabled:l,className:d}){let[h,b]=Ct(!1),y=kt(null);if(!gn(e))return null;let m=d?`sc-mp ${d}`:"sc-mp";return We("span",{className:m,children:[c&&z("span",{className:"sc-mp-cap",children:c}),We("button",{ref:y,type:"button",className:"sc-mp-btn",...i?{}:{"aria-haspopup":"dialog","aria-expanded":h},"aria-label":`Model: ${o.label}. Change`,title:o.label,disabled:l,onClick:i??(()=>b(v=>!v)),children:[z("span",{className:"sc-mp-label",children:o.label}),z(hn,{open:!i})]}),h&&!i&&z(Qa,{anchor:y,options:e,layout:n,ownInList:t,search:r,appName:a,current:o.id,onClose:()=>b(!1),onPick:v=>{b(!1),v!==o.id&&s(v)}})]})}var Va=9,_t=6,bn=8,ms=380;var Ur=220;function Qa({anchor:e,options:n,layout:t,ownInList:r,search:o,current:a,inline:s=!1,appName:c,onClose:i,onPick:l}){let d=kt(null),h=kt(null),b=kt(null),y=Fa(),[m,v]=Ct(""),A=m.trim().length>0,k=kt(!1),S=o&&n.length>=Va,W=Kt(()=>vt(n,t,r),[n,t,r]),L=Kt(()=>{let u=[];for(let R of W){let I=Fr(R),J=R.options.length===1&&R.options[0]?.model==="auto";if(I==="head"||I==="@models"||J||t==="models"&&I.startsWith("@"))for(let B of R.options)u.push({kind:"option",key:B.id,option:B});else u.push({kind:"group",key:`g:${I}`,group:R,section:I.startsWith("@")?"providers":"agents"})}return u},[W,t]),D=Kt(()=>qa(W,m),[W,m]),O=Kt(()=>D.flatMap(u=>u.options),[D]),U=u=>u.kind==="group"&&u.group.options.some(R=>R.id===a),[w,$]=Ct(()=>L.find(u=>u.kind==="option"?u.option.id===a:U(u))?.key??"auto"),[j,ee]=Ct(null),[ae,me]=Ct(null);Xt(()=>{A&&O.length&&!O.some(u=>u.id===w)&&$(O[0]?.id??a)},[O,w,a,A]),za(()=>{let u=d.current,R=e.current;if(!u||!R||s)return;try{typeof u.showPopover=="function"&&u.showPopover()}catch{}let I=R.getBoundingClientRect(),J=window.innerHeight-I.bottom-_t-bn,B=I.top-_t-bn,te=J<Math.min(ms,u.scrollHeight)&&B>J,N=Math.min(ms,te?B:J);u.style.maxHeight=`${Math.max(160,Math.round(N))}px`;let H=u.offsetWidth,ie=Math.max(bn,Math.min(I.left,window.innerWidth-H-bn));u.style.left=`${Math.round(ie)}px`,te?(u.style.top="auto",u.style.bottom=`${Math.round(window.innerHeight-I.top+_t)}px`):(u.style.bottom="auto",u.style.top=`${Math.round(I.bottom+_t)}px`),(b.current??u).focus({preventScroll:!0})},[e,s]),Xt(()=>{k.current&&(k.current=!1,h.current?.querySelector(`[data-id="${CSS.escape(w)}"]`)?.scrollIntoView({block:"nearest"}))},[w]),Xt(()=>{if(s)return;let u=R=>{let I=R.target;!I||d.current?.contains(I)||e.current?.contains(I)||i()};return document.addEventListener("pointerdown",u,!0),()=>document.removeEventListener("pointerdown",u,!0)},[e,i,s]),Xt(()=>{if(!j)return;let u=R=>{R.target instanceof Element&&R.target.closest(".sc-mm-flyout")||ee(null)};return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[j]);let fe=(u,R=!1)=>{let I=h.current?.querySelector(`[data-id="${CSS.escape(u)}"]`),J=d.current;if(!I||!J)return;let B=I.getBoundingClientRect(),te=J.getBoundingClientRect(),N=te.right+4+Ur<=window.innerWidth-bn,H=Math.max(bn,Math.min(B.top-5,window.innerHeight-bn-160));ee({key:u,top:H,left:N?te.right+4:te.left-4-Ur,maxHeight:Math.min(320,window.innerHeight-H-bn)});let ie=L.find(Ee=>Ee.key===u);ie?.kind==="group"&&me(R?ie.group.options.find(Ee=>Ee.id===a)?.id??ie.group.options[0]?.id??null:null)},P=j?L.find(u=>u.key===j.key):void 0,q=P?.kind==="group"?P.group.options:[],V=u=>{let R=L[(u+L.length)%L.length];R&&(k.current=!0,$(R.key),ee(null))},Z=u=>{let R=O[(u+O.length)%O.length];R&&(k.current=!0,$(R.id))},be=u=>{if(u.key==="Escape"){if(u.preventDefault(),u.stopPropagation(),u.nativeEvent.stopImmediatePropagation(),j){ee(null);return}i(),e.current?.focus();return}if(u.key==="Tab"){i();return}if(j&&ae!==null){let J=q.findIndex(B=>B.id===ae);if(u.key==="ArrowDown"||u.key==="ArrowUp"){u.preventDefault();let B=u.key==="ArrowDown"?1:-1;me(q[(J+B+q.length)%q.length]?.id??null)}else if(u.key==="ArrowLeft")u.preventDefault(),ee(null);else if(u.key==="Enter"){u.preventDefault();let B=q[J];B&&!B.locked&&l(B.id)}return}if(A){let J=O.findIndex(B=>B.id===w);u.key==="ArrowDown"||u.key==="ArrowUp"?(u.preventDefault(),Z(J+(u.key==="ArrowDown"?1:-1))):u.key==="Enter"&&(u.preventDefault(),O.some(B=>B.id===w&&!B.locked)&&l(w));return}let R=L.findIndex(J=>J.key===w),I=L[R];switch(u.key){case"ArrowDown":u.preventDefault(),V(R+1);return;case"ArrowUp":u.preventDefault(),V(R-1);return;case"ArrowRight":I?.kind==="group"&&(u.preventDefault(),fe(I.key,!0));return;case"Enter":u.preventDefault(),I?.kind==="group"?fe(I.key,!0):I&&!I.option.locked&&l(I.option.id);return;default:if(!S&&u.key.length===1&&!u.metaKey&&!u.ctrlKey){let J=u.key.toLowerCase(),B=ie=>(ie.kind==="option"?ie.option.label:ie.group.heading??"").toLowerCase(),te=L.findIndex((ie,Ee)=>Ee>R&&B(ie).startsWith(J)),N=L.findIndex(ie=>B(ie).startsWith(J)),H=te>=0?te:N;H>=0&&V(H)}}},Y=u=>`${y}-${u}`,he=L.filter(u=>u.kind==="group"&&u.section==="agents"||u.kind==="option"&&u.option.kind==="named"),Ae=L.filter(u=>u.kind==="group"&&u.section==="providers"),Te=L.filter(u=>u.kind==="group"||!(u.option.choice||u.option.kind==="auto"||u.option.kind==="size")),Pe=L.some(u=>u.kind==="option"&&u.option.kind==="provider"&&!u.option.choice),ne=(u,R,I,J=!1)=>We("div",{id:Y(u.id),"data-id":u.id,role:"option","aria-selected":u.id===a,...u.locked?{"aria-disabled":!0}:{},"data-active":u.id===R||void 0,"data-locked":u.locked,className:"sc-mm-item",onPointerMove:I,onPointerDown:B=>B.preventDefault(),onClick:()=>!u.locked&&l(u.id),children:[z(Ya,{option:u,bare:J}),z("span",{className:"sc-mm-label",children:u.label}),u.locked?!J&&z("span",{className:"sc-mm-pill",children:fs[u.locked]}):hs(u)&&u.id!==a&&z("span",{className:"sc-mm-note",children:hs(u)}),u.id===a&&z(Lr,{})]},u.id),de=u=>{let R=u.group.options[0],I=u.group.options.every(B=>B.locked)?R?.locked:void 0,J=R?.runtime?$e[R.runtime]:void 0;return We("div",{id:Y(u.key),"data-id":u.key,role:"option","aria-selected":!1,"data-active":u.key===w||void 0,"data-locked":I,className:"sc-mm-item sc-mm-sub",onPointerMove:()=>{w!==u.key&&$(u.key),j?.key!==u.key&&fe(u.key)},onPointerDown:B=>B.preventDefault(),onClick:()=>fe(u.key),children:[J?z("img",{className:"sc-mm-tile",src:J,alt:"","aria-hidden":"true"}):z("span",{className:"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:R?.providerMark&&z(Bn,{provider:R.providerMark,className:"sc-mm-tile-glyph"})}),z("span",{className:"sc-mm-label",children:u.group.heading}),I&&z("span",{className:"sc-mm-pill",children:fs[I]}),U(u)&&z("span",{className:"sc-mm-dot","aria-hidden":"true",title:"In use"}),z(hn,{open:!1})]},u.key)};return We("div",{ref:d,role:"dialog","aria-label":"Choose a model",className:s?"sc-mm sc-mm-inline":"sc-mm",...s?{}:{popover:"manual"},tabIndex:-1,onKeyDown:be,onPointerLeave:()=>!s&&ee(null),...S?{}:{"aria-activedescendant":Y(w)},children:[S&&We("div",{className:"sc-mm-search",children:[z(Za,{}),z("input",{ref:b,type:"text",role:"combobox","aria-expanded":"true","aria-controls":`${y}-list`,"aria-activedescendant":Y(w),"aria-autocomplete":"list",placeholder:"Search models",autoComplete:"off",spellCheck:!1,value:m,onChange:u=>{v(u.target.value),ee(null)}})]}),z("div",{ref:h,id:`${y}-list`,role:"listbox","aria-label":"Models",className:"sc-mm-list",onScroll:()=>ee(null),children:A?We(gs,{children:[D.map((u,R)=>We("div",{role:"group",...u.heading?{"aria-labelledby":`${y}-g${R}`}:{},className:"sc-mm-group",children:[u.heading&&z(ja,{id:`${y}-g${R}`,group:u}),u.options.map(I=>ne(I,w,()=>I.id!==w&&$(I.id),!!u.heading))]},Fr(u))),!O.length&&We("div",{className:"sc-mm-empty",children:["No models match \u201C",m.trim(),"\u201D"]})]}):We(gs,{children:[L.filter(u=>u.kind==="option"&&(u.option.choice||u.option.kind==="auto"||u.option.kind==="size")).map(u=>u.kind==="option"?ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)}):null),r&&Te.length>0&&z("div",{className:"sc-mm-rule",role:"presentation"}),r&&Te.map(u=>u.kind==="group"?de(u):ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)})),!r&&he.length>0&&z("div",{className:"sc-mm-rule",role:"presentation"}),!r&&he.length>0&&z("div",{className:"sc-mm-label-row",role:"presentation",children:"Your own AI"}),(r?[]:he).map(u=>u.kind==="group"?de(u):ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)})),!r&&(Ae.length>0||Pe)&&z("div",{className:"sc-mm-rule",role:"presentation"}),!r&&(Ae.length>0||Pe)&&z("div",{className:"sc-mm-label-row",role:"presentation",children:c?`${c} models`:"Included models"}),(r?[]:Ae).map(u=>u.kind==="group"?de(u):null),(r?[]:L).filter(u=>u.kind==="option"&&u.option.kind==="provider"&&!u.option.choice).map(u=>u.kind==="option"?ne(u.option,w,()=>{w!==u.key&&$(u.key),ee(null)}):null)]})}),j&&q.length>0&&z("div",{role:"listbox","aria-label":P?.kind==="group"?P.group.heading??"Models":"Models",className:"sc-mm-flyout",style:{top:j.top,left:j.left,width:Ur,maxHeight:j.maxHeight},children:q.map(u=>ne(u,ae,()=>u.id!==ae&&me(u.id),!0))})]})}var fs={plan:"Upgrade",allowance:"Limit reached"},Ja={auto:"M8 1c.5 3.6 2 5 7 7-5 2-6.5 3.4-7 7-.5-3.6-2-5-7-7 5-2 6.5-3.4 7-7Z",fast:"M9.4.5 2.6 9.1c-.3.4 0 .9.4.9H7l-.9 5.1c-.1.5.5.8.8.4l6.8-8.6c.3-.4 0-.9-.4-.9H9.3l.9-5.1c.1-.5-.5-.8-.8-.4Z",best:"M4.5 2h7l3.5 4.2L8 14.5 1 6.2Z"};function Ya({option:e,bare:n=!1}){if(e.icon)return/^https?:\/\//.test(e.icon)?z("img",{className:"sc-mm-tile",src:e.icon,alt:"","aria-hidden":"true"}):z("span",{className:"sc-mm-tile sc-mm-tile-box sc-mm-emoji","aria-hidden":"true",children:e.icon});if(e.kind==="named"&&e.runtime&&!n){let t=$e[e.runtime];return t?z("img",{className:"sc-mm-tile",src:t,alt:"","aria-hidden":"true"}):null}return e.kind==="auto"||e.kind==="size"?z("span",{className:"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:z("svg",{viewBox:"0 0 16 16",className:"sc-mm-tile-glyph",fill:"currentColor","aria-hidden":"true",focusable:"false",children:z("path",{d:Ja[e.kind==="auto"?"auto":e.id==="small"?"fast":"best"]})})}):e.kind==="provider"&&e.providerMark&&!n?z("span",{className:e.locked?"sc-mm-tile sc-mm-tile-box sc-mm-tile-dim":"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:z(Bn,{provider:e.providerMark,className:"sc-mm-tile-glyph"})}):null}function Fr(e){let n=e.options[0];return!n||n.choice||n.kind==="auto"||n.kind==="size"?"head":n.runtime&&e.options.every(t=>t.runtime===n.runtime)?n.runtime:!n.runtime&&e.options.every(t=>t.providerId===n.providerId)?`@${n.providerId}`:"@models"}function ja({id:e,group:n}){let t=n.options[0],r=Fr(n),o=t?.runtime&&r===t.runtime?$e[t.runtime]:void 0,a=r.startsWith("@")&&r!=="@models"?t?.providerMark:void 0;return We("div",{id:e,className:"sc-mm-head",role:"presentation",children:[o&&z("img",{className:"sc-mm-logo",src:o,alt:"","aria-hidden":"true"}),a&&z(Bn,{provider:a,className:"sc-mm-logo"}),n.heading]})}function qa(e,n){let t=n.trim().toLowerCase();if(!t)return e;let r=[];for(let o of e){let s=o.heading?.toLowerCase().includes(t)?o.options:o.options.filter(c=>[c.label,c.model,c.note??""].some(i=>i.toLowerCase().includes(t)));s.length&&r.push({...o,options:s})}return r}function hs(e){return e.kind==="provider"?e.locked==="plan"?"Upgrade":e.locked==="allowance"?"Limit reached":e.choice?e.note:void 0:e.kind!=="named"?e.note:e.machine?`on ${e.machine}`:e.model==="auto"?e.note:void 0}function Za(){return We("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-mm-find",children:[z("circle",{cx:"11",cy:"11",r:"6.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),z("path",{d:"M16 16l4 4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}import{useEffect as Xa,useRef as Ka}from"react";import{jsx as Re,jsxs as $t}from"react/jsx-runtime";function zr({options:e,selected:n,onPick:t,onClose:r,busy:o}){let a=Ka(null);return Xa(()=>{(a.current?.querySelector('[aria-checked="true"]')??a.current?.querySelector("[role=radio]"))?.focus()},[]),$t("div",{className:"sc-tray sc-screen",onKeyDown:i=>{i.key==="Escape"&&(i.stopPropagation(),r())},children:[$t("div",{className:"sc-screen-head",children:[Re("button",{type:"button",className:"sc-back","aria-label":"Back",onClick:r,disabled:o,children:Re(_a,{})}),Re("h2",{className:"sc-screen-title",children:"Model"})]}),Re("div",{ref:a,role:"radiogroup","aria-label":"Model",className:"sc-group-card sc-mopts",onKeyDown:i=>{if(!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft"].includes(i.key)||o)return;i.preventDefault();let d=e.findIndex(y=>y.id===n),h=i.key==="ArrowDown"||i.key==="ArrowRight"?1:-1,b=e[((d<0?0:d)+h+e.length)%e.length];b&&t(b.id)},children:e.map(i=>{let l=i.id===n,d=Dr(i);return $t("button",{type:"button",role:"radio","aria-checked":l,tabIndex:l?0:-1,className:"sc-mopt",disabled:o,onClick:()=>t(i.id),children:[$t("span",{className:"sc-mopt-say",children:[Re("span",{className:"sc-mopt-name",children:i.label}),d&&Re("span",{className:"sc-mopt-desc",children:d})]}),Re("span",{className:l?"sc-ring sc-ring-on":"sc-ring","aria-hidden":"true",children:l&&Re($a,{})})]},i.id)})}),Re("p",{className:"sc-screen-foot",children:"Applies to new runs. Runs already in progress keep the model they started with."}),Re("button",{type:"button",className:"sc-act-go",onClick:r,disabled:o,children:"Done"})]})}function _a(){return Re("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-back-glyph",children:Re("path",{d:"M15 6l-6 6 6 6",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function $a(){return Re("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-ring-tick",children:Re("path",{d:"M5 10.5l3.2 3.2L15 6.5",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as De,jsxs as ni}from"react/jsx-runtime";function Me({className:e}){return ni("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:[De("path",{d:"M18.125 7.039A8.6 8.6 0 1 0 18.125 16.961A6 6 0 0 1 18.125 7.039Z",fill:"currentColor"}),De("path",{d:"M19.925 7.039A8.6 8.6 0 0 1 19.925 16.961A6 6 0 0 0 19.925 7.039Z",fill:"currentColor"})]})}function bs({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{fill:"currentColor",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function Gn({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{fill:"currentColor",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function er({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{d:"M4 5h16v11H4zM9 20h6M12 16v4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ei({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{d:"M5 7l5 5-5 5M12 18h7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vr({className:e}){return De("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:De("path",{d:"M5 6h14v10H5zM2.5 19.5h19",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var An={claude:bs,chatgpt:Gn,local:er},As={shell:ei};function ws(e,n){return n<2*6e4?e:n<10*6e4?Math.max(e,6e4):n<30*6e4?Math.max(e,3*6e4):Math.max(e,10*6e4)}var ti=3e3,ri=2*6e4,nr=Date.now(),tr=new Set,ys=!1;function oi(){if(ys||typeof window>"u")return;ys=!0;let e=()=>{let t=nr;if(nr=Date.now(),nr-t>ri)for(let r of tr)r()};for(let t of["pointerdown","keydown","wheel","touchstart"])window.addEventListener(t,e,{capture:!0,passive:!0});let n=()=>{if(!document.hidden)for(let t of tr)t()};window.addEventListener("focus",n),document.addEventListener("visibilitychange",n)}function He(e,n,t={}){oi();let r,o=t.immediate===!1?Date.now():0,a=!1,s=!1,c=()=>{s||(r=setTimeout(i,t.idle===!1?n:ws(n,Date.now()-nr)))},i=async()=>{if(clearTimeout(r),!(s||a)){if(typeof document>"u"||!document.hidden){a=!0,o=Date.now();try{await e()}catch{}finally{a=!1}}c()}},l=()=>{Date.now()-o>Math.min(n,ti)&&i()};return tr.add(l),t.immediate===!1?c():i(),()=>{s=!0,clearTimeout(r),tr.delete(l)}}import{useEffect as si,useRef as ai,useState as ii}from"react";function _n(e){if(e.label)return e.label;if(e.task){let n=e.task.replace(/[_-]+/g," ").trim();return n.charAt(0).toUpperCase()+n.slice(1)}return"A run"}function rr(e){if(e.status==="queued")return"Waiting for a free slot";if(e.step)return e.step;switch(e.phase?.kind){case"thinking":return"Thinking";case"writing":return"Writing";case"tool":return e.phase.tool?`Using ${e.phase.tool}`:"Using a tool";case"approval":return e.phase.tool?`Waiting for you to allow ${e.phase.tool}`:"Waiting for your approval";default:return e.first_output_at?"Working":"Starting"}}function Nt(e){let n=Math.max(0,Math.round((Date.now()-new Date(e).getTime())/1e3));if(n<60)return`${n}s`;let t=Math.floor(n/60);return t<60?`${t}m ${String(n%60).padStart(2,"0")}s`:`${Math.floor(t/60)}h ${String(t%60).padStart(2,"0")}m`}function Qr(e){let n=new Date(e);return Number.isNaN(n.getTime())?"\u2014":n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}import{jsx as X,jsxs as ve}from"react/jsx-runtime";function Yr({run:e,machine:n,appName:t,onClose:r,onStop:o,busy:a}){let s=ai(null),[c,i]=ii(!1);si(()=>{s.current?.focus()},[]);let l=v=>{v.key==="Escape"&&(v.stopPropagation(),r())},d=async()=>{i(!0);try{await o?.(e.id)}catch{i(!1)}},h=_n(e),b=e.status==="running"&&!c,m=[n?.runtimes.find(v=>v.id===e.runtime_id)?.display_name??e.runtime_id,n?le(n):null].filter(Boolean).join(", ");return ve("div",{className:"sc-tray sc-screen",onKeyDown:l,children:[ve("div",{className:"sc-screen-head",children:[X("button",{ref:s,type:"button",className:"sc-back","aria-label":"Back to active runs",onClick:r,children:X(ci,{})}),X("span",{className:"sc-screen-from",children:"Active runs"})]}),ve("div",{className:"sc-rd-head",children:[X("h2",{className:"sc-rd-name",children:h}),ve("p",{className:"sc-rd-state",children:[X("span",{className:b?"sc-rd-dot sc-rd-dot-live":"sc-rd-dot","aria-hidden":"true"}),c?"Stopping\u2026":e.status==="queued"?`Queued for ${Nt(e.started_at)}`:`Running for ${Nt(e.started_at)}`]})]}),ve("div",{className:"sc-group-card sc-rd-facts",children:[t&&ve("p",{className:"sc-rd-fact",children:[X("span",{className:"sc-rd-key",children:"Source"}),X("span",{className:"sc-rd-val",children:t})]}),ve("p",{className:"sc-rd-fact",children:[X("span",{className:"sc-rd-key",children:"Model"}),X("span",{className:"sc-rd-val",children:li(e.model)})]}),m&&ve("p",{className:"sc-rd-fact",children:[X("span",{className:"sc-rd-key",children:"Runs on"}),X("span",{className:"sc-rd-val",children:m})]})]}),ve("section",{className:"sc-group",children:[X("div",{className:"sc-group-cap",children:X("p",{className:"sc-group-title",children:"Activity"})}),ve("div",{className:"sc-group-card sc-rd-steps",children:[ve("p",{className:"sc-rd-step",children:[X(Jr,{state:"done"}),X("span",{className:"sc-rd-say",children:"Started"}),X("span",{className:"sc-rd-when",children:Qr(e.started_at)})]}),ve("p",{className:"sc-rd-step",children:[X(Jr,{state:e.first_output_at?"done":"todo"}),X("span",{className:e.first_output_at?"sc-rd-say":"sc-rd-say sc-rd-wait",children:"First output"}),X("span",{className:"sc-rd-when",children:e.first_output_at?Qr(e.first_output_at):"Not yet"})]}),ve("p",{className:"sc-rd-step",children:[X(Jr,{state:b?"now":"todo"}),X("span",{className:"sc-rd-say",children:c?"Stopping":rr(e)})]})]})]}),ve("div",{className:"sc-acts",children:[o&&X("button",{type:"button",className:"sc-act-stop",onClick:()=>void d(),disabled:a||c,children:c?"Stopping\u2026":"Stop run"}),X("a",{className:"sc-act-quiet",href:On(),children:"Open Soba"})]})]})}function li(e){return!e||e==="auto"?"Automatic":e==="small"?"Fast":e==="large"?"Best":en(e)}function Jr({state:e}){return e==="done"?ve("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark sc-rd-mark-done",children:[X("circle",{cx:"10",cy:"10",r:"9",fill:"currentColor"}),X("path",{d:"M5.8 10.3l2.8 2.8 5.6-5.8",fill:"none",stroke:"var(--sc-tray-card, #ffffff)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):e==="now"?ve("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark sc-rd-mark-now",children:[X("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:"var(--sc-line-2, #dcdce0)",strokeWidth:"2.4"}),X("path",{d:"M10 2a8 8 0 018 8",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round"})]}):X("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark",children:X("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}function ci(){return X("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-back-glyph",children:X("path",{d:"M15 6l-6 6 6 6",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Ie=[{id:"claude",costClass:"user-subscription",short:"Claude Code",label:"Continue with Claude",title:"The Claude plan you already pay for",cost:"Nothing beyond the plan",prerequisite:"Claude Code installed and signed in",hint:"Install it from claude.ai/code, then run `claude` once and sign in.",install:"https://claude.com/product/claude-code",expects:["claude-code"]},{id:"chatgpt",costClass:"user-subscription",short:"Codex",label:"Continue with ChatGPT",title:"The ChatGPT plan you already pay for",cost:"Nothing beyond the plan",prerequisite:"Codex installed and signed in",hint:"Install Codex, then run `codex` once and sign in.",install:"https://learn.chatgpt.com/codex/cli",expects:["codex"]},{id:"local",costClass:"user-hardware",short:"Local models",label:"Use a model on this machine",title:"A model on your own machine",cost:"Free. You bought the hardware",prerequisite:"Ollama running, with a model pulled",hint:"Install Ollama, then `ollama pull` a model before pairing.",install:"https://ollama.com",expects:["ollama","openai-api"]}],vs=["claude","chatgpt"];function jr(){return Ie.filter(e=>vs.includes(e.id))}function qr(e){return Ie.filter(n=>n.costClass===e)}function Zr(e){return Ie.find(n=>n.expects.includes(e))??null}import{Fragment as et,jsx as f,jsxs as x}from"react/jsx-runtime";function Wn({machines:e,hosted:n=[],onApproveRuntime:t,onPreferRuntime:r,onDisconnectHosted:o,onPair:a,onWake:s,onOpenApp:c,onRefresh:i,refreshing:l,busy:d,appName:h,model:b,onPickModel:y,error:m,runs:v,loadRuns:A,loading:k,machineMenu:S,machineNote:W,onReconnect:L,openApp:D=!0,children:O,onStopRun:U}){let w=_e(e),$=e.filter(E=>E.id!==w?.id),j=w?.state==="online",[ee,ae]=$n(()=>j?[]:null),[me,fe]=$n("no"),[P,q]=$n(!1),[V,Z]=$n(null),be=v===void 0&&!!A,Y=be?ee:v??(j?[]:null),he=v!==void 0||!!A;ks(()=>{V&&Y&&!Y.some(E=>E.id===V)&&Z(null)},[V,Y]);let Ae=!!(w&&on(w));ks(()=>{if(!be||!A||!Ae)return;let E=!0,Cn=He(async()=>{let G=await A();E&&ae(G)},3e3);return()=>{E=!1,Cn()}},[be,A,Ae]);let Pe=(w?Nr(w):[]).filter(E=>E.quarantined&&!E.absent),ne=sr(w,b).runtime,de=ne?.cost_class==="user-hardware"?ne:null,u=de?Ni(Mi(de,b)):null,R=!!w&&!on(w),I=(()=>{if(!w||R||!ne||Ke(ne).tone!=="warn")return null;let Cn=le(w);return{title:`${ne.display_name} is signed out`,detail:`Sign in on ${Cn} so Soba can start runs.`}})(),J=()=>{c?.(),fe("going"),Tn().then(E=>fe(E==="absent"?"absent":"no"))},B=()=>{J(),s?.()},te={label:me==="going"?"Opening Soba\u2026":"Open Soba",onPress:J,spin:me==="going"},N=w?te:a?{label:"Connect to Soba",onPress:a}:null,H=!!w&&N===te,ie=H&&!!i,Ee=i&&f("button",{type:"button",className:"sc-disc",onClick:i,disabled:l,"aria-label":"Refresh",title:"Refresh",children:f(Pi,{spinning:!!l})});if(!w&&n.length===0&&!a)return f("p",{className:"sc-note",children:"Nothing connected yet."});if(P&&w&&b&&y){let E=Ns(w,b);if(gn(E.options))return f(zr,{options:E.options,selected:b.id,onPick:y,onClose:()=>q(!1),...d?{busy:d}:{}})}let je=V?Y?.find(E=>E.id===V):void 0;return je?f(Yr,{run:je,onClose:()=>Z(null),...w?{machine:w}:{},...h?{appName:h}:{},...U?{onStop:U}:{},...d?{busy:d}:{}}):x("div",{className:"sc-tray",children:[w&&x(ze,{title:"This machine",action:(i&&!ie||D||S)&&x("span",{className:"sc-cap-acts",children:[!ie&&Ee,D&&f(Ai,{}),S]}),children:[f(di,{machine:w}),W]}),w&&R&&!w.pairing_lost&&f(ze,{title:"Soba",children:x("div",{className:"sc-away",children:[f("span",{className:"sc-away-mark","aria-hidden":"true",children:f(mn,{kind:"paused",size:30})}),x("span",{className:"sc-away-say",children:[f("span",{className:"sc-away-title",children:"Wake it up"}),x("span",{className:"sc-away-body",children:["Soba on ",le(w)," is not answering. Waking it opens the app there."]})]}),f("button",{type:"button",className:"sc-away-go",onClick:B,disabled:d||me==="going",children:me==="going"?"Waking\u2026":"Wake"})]})}),w?.pairing_lost&&!on(w)&&f(ze,{title:"Soba",children:x("div",{className:"sc-away",children:[f("span",{className:"sc-away-mark","aria-hidden":"true",children:f(mn,{kind:"gone",size:30})}),x("span",{className:"sc-away-say",children:[f("span",{className:"sc-away-title",children:"Connect it again"}),f("span",{className:"sc-away-body",children:"Its pairing has ended, so it cannot take runs until it is connected again."})]}),L&&f("button",{type:"button",className:"sc-away-go",onClick:L,disabled:d,children:"Connect"})]})}),w&&!R&&f(ze,{title:"Runs on",children:ne?f(vi,{machine:w,appName:h,busy:d,...b?{model:b}:{},...y?{onPickModel:y,onOpenModels:()=>q(!0)}:{},...r?{onPick:E=>r(w.id,E)}:{},...t?{onApprove:E=>t(w.id,E)}:{}}):x("div",{className:"sc-blank",children:[f("span",{className:"sc-blank-mark","aria-hidden":"true",children:f(fi,{})}),x("span",{className:"sc-blank-say",children:[f("span",{className:"sc-blank-title",children:k?"Looking\u2026":"No agent on this machine"}),f("span",{className:"sc-blank-body",children:k?"Reading what it can run.":"Install Claude Code, Codex or Ollama there and it will appear here."})]}),!k&&D&&x("a",{className:"sc-blank-act",href:On(),children:[f("span",{children:"Add agents"}),f(Xr,{})]})]})}),w&&(I||u)&&x(ze,{title:"Needs attention",children:[I&&x("div",{className:"sc-alarm",children:[f("span",{className:"sc-alarm-mark","aria-hidden":"true",children:f(Cs,{})}),x("span",{className:"sc-alarm-say",children:[f("span",{className:"sc-alarm-title",children:I.title}),f("span",{className:"sc-alarm-body",children:I.detail})]})]}),u&&x("div",{className:"sc-alarm sc-alarm-warn",children:[f("span",{className:"sc-alarm-mark","aria-hidden":"true",children:f(Cs,{})}),x("span",{className:"sc-alarm-say",children:[f("span",{className:"sc-alarm-title",children:"A large model on this computer"}),x("span",{className:"sc-alarm-body",children:["Your ",u," model can take all this computer's memory while it answers."]})]})]})]}),w&&he&&!R&&f(mi,{machine:w,runs:Y,onOpen:E=>Z(E),...U?{onStop:U}:{}}),w&&f(et,{children:Pe.length>0&&!R&&!(r&&t&&!["app","model"].includes(sr(w,b).by))&&f(ze,{title:"New on this machine",children:Pe.map(E=>f(wi,{runtime:E,...t?{onApprove:()=>t(w.id,E.id)}:{}},E.id))})}),n.length>0&&f(ze,{title:n.length>1?"Connected plans":"Connected plan",children:n.map(E=>f(Si,{credential:E,appName:h,busy:d,...o?{onDisconnect:()=>o(E.provider)}:{}},E.provider))}),$.length>0&&f(ze,{title:"Your other machines",children:$.map(E=>f(yi,{machine:E},E.id))}),!w&&a&&f(ze,{title:"Your machines",children:x("button",{type:"button",className:"sc-pair",onClick:a,children:[f("span",{className:"sc-otile","aria-hidden":"true",children:f(Ri,{})}),f("span",{className:"sc-oname",children:"Connect a machine"})]})}),N&&x("div",{className:"sc-acts",children:[H&&N?x("div",{className:"sc-acts-row",children:[ie?Ee:f("span",{}),x("button",{type:"button",className:"sc-act-small",onClick:N.onPress,disabled:d||N.spin,"data-spin":N.spin?"true":void 0,children:[N.spin&&f(Ms,{}),N.label,!N.spin&&f(Xr,{})]})]}):N&&x("button",{type:"button",className:"sc-act-go",onClick:N.onPress,disabled:d||N.spin,"data-spin":N.spin?"true":void 0,children:[N.spin&&f(Ms,{}),N.label]}),me==="absent"&&x("p",{className:"sc-act-miss",children:["Nothing opened here. ",w?le(w):"That machine"," may be a different computer, or the Soba app is not installed on this one."]})]}),O,m&&f("p",{className:"sc-error sc-tray-error",children:m})]})}function ze({title:e,action:n,children:t}){return x("section",{className:"sc-group",children:[x("div",{className:"sc-group-cap",children:[f("p",{className:"sc-group-title",children:e}),n]}),f("div",{className:"sc-group-card",children:t})]})}function di({machine:e,onToggle:n,open:t}){let r=on(e),o=[r?null:e.pairing_lost?"Not connected to Soba":"Soba is asleep",r?gt(e):null,e.always_on?"always on":null].filter(Boolean),a=r&&e.capacity>0?e.active>0?`${e.active} of ${e.capacity} running`:null:bt(e.last_seen_at),s=x(et,{children:[x("span",{className:"sc-mtile","aria-hidden":"true",children:[f(xs,{}),f("span",{className:`sc-mbadge sc-mbadge-${r?Ln(e).tone:e.pairing_lost?"off":"away"}`})]}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-mname",children:le(e)}),x("span",{className:"sc-mmeta",children:[f("span",{className:"sc-mmeta-is",children:o.map((c,i)=>x("span",{children:[i>0&&f("span",{className:"sc-mmeta-sep",children:"\xB7"}),c]},c))}),a&&f("span",{className:"sc-mmeta-now",children:a})]})]})]});return!n||!r?f("div",{className:"sc-mrow",children:s}):x("button",{type:"button",className:"sc-mrow sc-mrow-btn",onClick:n,"aria-expanded":!!t,title:t?"Hide what it is running":"See what it is running",children:[s,f(hn,{open:!!t})]})}function pi(e,n){return e.filter(t=>t.machine_id===n.id||t.machine_id===null)}function mi({machine:e,runs:n,onStop:t,onOpen:r}){let o=n?pi(n,e):[],[a,s]=$n(new Set),c=async l=>{s(d=>new Set(d).add(l));try{await t?.(l)}catch{s(d=>{let h=new Set(d);return h.delete(l),h})}},i=()=>{for(let l of o)c(l.id)};return f(ze,{title:"Active runs",...t&&o.length>1?{action:f("button",{type:"button",className:"sc-cap-link",onClick:i,children:"Stop all"})}:{},children:n===null?f("p",{className:"sc-row-note",children:"Looking\u2026"}):o.length===0?x("p",{className:"sc-nilrow",children:[f("span",{className:"sc-nilrow-mark","aria-hidden":"true",children:f(hi,{})}),"Nothing running"]}):o.map(l=>f(gi,{run:l,stopping:a.has(l.id),...t?{onStop:()=>void c(l.id)}:{},...r?{onOpen:()=>r(l.id)}:{}},l.id))})}function fi(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-blank-glyph",children:[f("rect",{x:"3",y:"4.5",width:"18",height:"15",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),f("path",{d:"M7.5 10l2.5 2.2-2.5 2.2M12.5 14.6h4",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function hi(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-blank-glyph",children:[f("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),f("path",{d:"M9 12.5l2.2 2.2L15.5 9.8",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function gi({run:e,stopping:n,onStop:t,onOpen:r}){let o=x(et,{children:[f("span",{className:n?"sc-rdot":"sc-rdot sc-rdot-live","aria-hidden":"true"}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-rtitle",children:_n(e)}),f("span",{className:"sc-rstep",children:n?"Stopping\u2026":`${rr(e)} \xB7 ${Nt(e.started_at)}`})]})]});return x("div",{className:"sc-rrow",children:[r?x("button",{type:"button",className:"sc-rgo",onClick:r,"aria-label":`${_n(e)} \u2014 open this run`,children:[o,f(hn,{open:!1})]}):o,t&&f("button",{type:"button",className:"sc-rstop",onClick:t,disabled:n,"aria-label":`Stop ${_n(e)}`,children:f("span",{className:"sc-rstop-ring",children:f(Ei,{})})})]})}function bi(e){let n=Zr(e);return(n?An[n.id]:null)??As[e]??null}function Ai(){return f("a",{className:"sc-disc sc-open-app",href:On(),"aria-label":"Open Soba",title:"Open Soba",children:f(Xr,{})})}function Xr(){return f("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-dglyph",children:f("path",{d:"M14 4h6v6M20 4l-8.5 8.5M18 14.5V19a1 1 0 01-1 1H5a1 1 0 01-1-1V7a1 1 0 011-1h4.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function yi({machine:e}){let n=Ln(e);return x("div",{className:"sc-orow",children:[f("span",{className:"sc-otile","aria-hidden":"true",children:f(xs,{})}),f("span",{className:"sc-oname",children:le(e)}),f("span",{className:"sc-oword",children:n.word}),f("span",{className:`sc-dot sc-dot-${n.tone}`,"aria-hidden":"true"})]})}function wi({runtime:e,onApprove:n}){return x("div",{className:"sc-mrow",children:[f("span",{className:"sc-mtile sc-atile","aria-hidden":"true",children:f(or,{id:e.id,name:e.display_name})}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-mname",children:e.display_name}),f("span",{className:"sc-mmeta",children:e.version??"waiting to be let in"})]}),n?f("button",{type:"button",className:"sc-row-act",onClick:n,children:"Let it serve"}):f("span",{className:"sc-averdict sc-tone-warn",children:"not serving yet"})]})}function Kr({id:e,name:n}){return f("span",{className:"sc-runtime-tile","aria-hidden":"true",children:f(or,{id:e,...n?{name:n}:{}})})}function or({id:e,name:n}){if(!e)return null;let t=$e[e];if(t)return f("img",{src:t,alt:"",className:"sc-runtime-logo"});let r=bi(e);return r?f(r,{className:"sc-runtime-mark"}):n?f("span",{className:"sc-runtime-letter",children:n.slice(0,1).toUpperCase()}):null}function Ns(e,n){if(!n)return{options:[]};let t=sr(e,n),r=t.runtime?.id??t.runtimeId,o=wt([e]).filter(c=>c.kind==="named"?c.runtime===r:c.kind==="size"?!!r&&Zt(r):!0),a=t.runtime?.default_model;if(n.kind!=="auto"||!a)return{options:o,shown:n};let s=en(a);return{options:o,shown:{...n,label:s.length>16?s:`${n.label} \xB7 ${s}`}}}function vi({machine:e,appName:n,busy:t,onPick:r,model:o,onPickModel:a,onOpenModels:s,onApprove:c}){let i=sr(e,o),l=we(e),d=c?e.runtimes.filter(U=>U.quarantined&&!U.absent):[],[h,b]=$n(!1),y=ui(null);if(i.by!=="app"&&l.length===0)return null;let m=U=>U?f(Kr,{id:U.id,name:U.display_name}):null,v=i.runtime?.display_name??i.runtimeId??"\u2014",A=i.by!=="app"&&i.by!=="model"&&!!r&&(l.length>=2||d.length>0),k=i.runtime?.id??i.runtimeId,S=!on(e),W=i.runtime&&Ke(i.runtime).tone==="warn"?"Signed out":null,{options:L,shown:D}=Ns(e,o),O=i.by==="app"?`Set by ${n??"the app"}`:i.runtime?Ci(i.runtime):null;return x(et,{children:[A?x("button",{ref:y,type:"button",className:S?"sc-runs-agent sc-runs-dim":"sc-runs-agent","aria-haspopup":"menu","aria-expanded":h,"aria-label":`Runs go to ${v}. Change`,disabled:t,onClick:()=>b(U=>!U),children:[f("span",{className:"sc-runs-tile","aria-hidden":"true",children:f(or,{id:k??null,name:v})}),x("span",{className:"sc-runs-said-name",children:[f("span",{className:"sc-runs-name",children:v}),W&&f("span",{className:"sc-runs-ill",children:W})]}),f(hn,{open:!1})]}):x("span",{className:S?"sc-runs-agent sc-runs-fixed sc-runs-dim":"sc-runs-agent sc-runs-fixed",children:[f("span",{className:"sc-runs-tile","aria-hidden":"true",children:f(or,{id:k??null,name:v})}),x("span",{className:"sc-runs-said-name",children:[f("span",{className:"sc-runs-name",children:v}),W&&f("span",{className:"sc-runs-ill",children:W})]}),i.by==="app"&&x("span",{className:"sc-runs-told",children:["set by ",n??"the app"]}),i.by==="model"&&f("span",{className:"sc-runs-told",children:"set by the model"})]}),D&&a&&gn(L)?x(et,{children:[f("span",{className:"sc-runs-rule","aria-hidden":"true"}),f(Mt,{options:L,selected:D,onPick:a,caption:"Model",...s?{onOpen:s}:{},className:S?"sc-runs-model sc-runs-dim":"sc-runs-model",...t?{disabled:t}:{}})]}):O&&x(et,{children:[f("span",{className:"sc-runs-rule","aria-hidden":"true"}),x("span",{className:"sc-runs-said",children:[f("span",{className:"sc-runs-key",children:"Model"}),f("span",{className:"sc-runs-val",children:O})]})]}),h&&r&&f(ki,{anchor:y,machine:e,tile:m,waiting:d,...c?{onApprove:c}:{},onClose:()=>b(!1),onPick:U=>{b(!1),r(U)}})]})}function ki({anchor:e,machine:n,tile:t,waiting:r,onApprove:o,onClose:a,onPick:s}){let c={...n,requested_runtime:null},i=Fe(c),l=Fe({...c,preferred_runtime:null}).runtime,d=i.by==="you"?i.runtimeId:null,h=[{id:null,label:"Automatic",...l?{note:`Uses ${l.display_name}`}:{},glyph:t(l)},...we(n).map((b,y)=>{let m=xi(b);return{id:b.id,label:b.display_name,glyph:t(b),...m?{note:m}:{},...y===0?{rule:!0}:{}}}),...o?r.map((b,y)=>({id:`waiting:${b.id}`,label:b.display_name,glyph:t(b),...b.version?{note:b.version}:{},trailing:"Let it serve",onChoose:()=>o(b.id),...y===0?{heading:"New on this machine"}:{}})):[]];return f(Ir,{anchor:e,label:"Which agent runs go to",options:h,current:d,onClose:a,onPick:s})}function Ci(e){let n=Ke(e);return n.tone==="warn"?n.text:e.default_model?en(e.default_model):"Automatic"}function sr(e,n){if(!e)return{by:"default",runtimeId:null,runtime:null};let t=Fe(n?{...e,requested_runtime:null}:e);if(t.by==="app"||n?.kind!=="named"||!n.runtime)return t;let r=we(e).find(o=>o.id===n.runtime);return!r||r.id===t.runtimeId?t:{by:"model",runtimeId:r.id,runtime:r}}function Mi(e,n){return!n||n.kind==="auto"?e.default_model:n.kind==="size"?(ls(n.model)?cs(e.id,n.model):void 0)??e.default_model:n.runtime===e.id?n.model:e.default_model}function Ni(e){if(!e)return null;let n=/(\d+(?:\.\d+)?)\s*b\b/i.exec(e),t=n?.[1]?Number(n[1]):Number.NaN;return!Number.isFinite(t)||t<20?null:`${n?.[1]}B`}function xi(e){let n=Ke(e);return n.tone==="warn"?n.text:e.default_model?en(e.default_model):e.cost_class==="user-hardware"?"In this machine's memory":n.tone!=="ok"?n.text:e.version??void 0}function Si({credential:e,appName:n,busy:t,onDisconnect:r}){return x("div",{className:"sc-hrow",children:[x("div",{className:"sc-orow",children:[f("span",{className:"sc-otile","aria-hidden":"true",children:f(Gn,{className:"sc-omark"})}),x("span",{className:"sc-mid",children:[f("span",{className:"sc-oname",children:e.provider==="openai-chatgpt"?"ChatGPT plan":e.provider}),f("span",{className:"sc-mmeta",children:e.account_label??"signed in"})]}),r&&f("button",{type:"button",className:"sc-row-act",onClick:r,disabled:t,children:"Disconnect"})]}),r&&x("p",{className:"sc-row-note",children:[n??"This app"," stops using it. To withdraw the grant entirely, remove it in your OpenAI settings."]})]})}function xs(){return x("svg",{viewBox:"0 0 32 24","aria-hidden":"true",focusable:"false",className:"sc-mglyph",children:[f("rect",{x:"4",y:"1.5",width:"24",height:"15",rx:"2.5",fill:"var(--sc-sheet, #ffffff)",stroke:"currentColor",strokeWidth:"2"}),f("rect",{x:"1",y:"19.5",width:"30",height:"2.5",rx:"1.25",fill:"currentColor"})]})}function Ri(){return f("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-oglyph",children:f("path",{d:"M12 5v14M5 12h14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function Cs(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-hglyph",children:[f("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"2"}),f("path",{d:"M12 7.5v5.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),f("circle",{cx:"12",cy:"16.5",r:"1.15",fill:"currentColor"})]})}function Ms(){return x("svg",{className:"sc-act-glyph sc-spin",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[f("circle",{cx:"8",cy:"8",r:"6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",opacity:"0.3"}),f("path",{d:"M8 1.8a6.2 6.2 0 0 1 6.2 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function Pi({spinning:e}){return f("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e?"sc-dglyph sc-spin":"sc-dglyph",children:f("path",{d:"M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ei(){return f("svg",{className:"sc-dglyph",viewBox:"0 0 14 14","aria-hidden":"true",children:f("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"})})}import{jsx as Ii}from"react/jsx-runtime";function _r({machines:e,onApproveRuntime:n,model:t,onPickModel:r}){return Ii(Wn,{machines:e,...n?{onApproveRuntime:n}:{},...t?{model:t}:{},...r?{onPickModel:r}:{}})}import{useCallback as Ne,useEffect as Le,useId as Bi,useMemo as yn,useRef as nt,useState as ce}from"react";var xt=[{slug:"mac-arm",label:"macOS, Apple silicon"},{slug:"mac-intel",label:"macOS, Intel"},{slug:"windows",label:"Windows"},{slug:"linux",label:"Linux"}];function St(e){if(!e)return"";try{return new URL(e).origin}catch{return""}}var Ss="soba.connect.choice",Li=180*24*60*60*1e3;function $r(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function eo(e,n){return e?n?`${Ss}.${e}.${$r(n)}`:`${Ss}.${e}`:null}function no(e){if(!e||typeof localStorage>"u")return null;try{let n=localStorage.getItem(e);if(!n)return null;let t=JSON.parse(n);if(Date.now()-Date.parse(t.at)>Li)return null;let r=Ie.find(o=>o.id===t.choice);return r?r.id:null}catch{return null}}function to(e,n){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({choice:n,at:new Date().toISOString()}))}catch{}}var Rs="soba.connect.model",Oi=180*24*60*60*1e3;function ro(e,n){return e?n?`${Rs}.${e}.${$r(n)}`:`${Rs}.${e}`:null}function ar(e){if(!e||typeof localStorage>"u")return null;try{let n=localStorage.getItem(e);if(!n)return null;let t=JSON.parse(n);if(Date.now()-Date.parse(t.at)>Oi)return null;let r=t.choice;return typeof r!="string"||!r||r.length>120?null:/^[\w.:@+-]+(\/[\w.:@+-]+)?$/.test(r)?r:null}catch{return null}}function oo(e,n){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({choice:n,at:new Date().toISOString()}))}catch{}}var Ps="soba.connect.dismissed",Ti=30*24*60*60*1e3;function so(e,n){return e?n?`${Ps}.${e}.${$r(n)}`:`${Ps}.${e}`:null}function ao(e){if(!e||typeof localStorage>"u")return!1;try{let n=localStorage.getItem(e);if(!n)return!1;let t=JSON.parse(n);return Date.now()-Date.parse(t.at)<Ti}catch{return!1}}function io(e){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({at:new Date().toISOString()}))}catch{}}import{Fragment as rt,jsx as g,jsxs as T}from"react/jsx-runtime";var lo=2e3,Gi=1e4,Wi=9e4,Di=6e4;function co(e,n,t,r=[],o){return e?"code":n&&(t.length>0||r.length>0)?"manage":o?"launch":"choose"}function Es(e){return on(e)&&!e.pairing_lost}function ir(e){return new Map(e.map(n=>[n.id,Es(n)]))}function Hi(e){let n=Math.max(0,Math.round(e/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function mo({client:e,initialCode:n,initialChoice:t,onConnected:r,showStatus:o=!0,initialContext:a=null,initialMachines:s,onClose:c,headingId:i,theme:l,reason:d,active:h=!0}){let b=!!a&&s!==void 0,[y,m]=ce(b?co(n,o,s??[],[],t):"loading"),[v,A]=ce(a),[k,S]=ce(s??[]),[W,L]=ce(n??""),[D,O]=ce(null),[U,w]=ce(null),[$,j]=ce(!1),[ee,ae]=ce(0),[me,fe]=ce("app"),[P,q]=ce(()=>Date.now()),[V,Z]=ce(null),[be,Y]=ce(!1),[he,Ae]=ce(!1),[Te,Pe]=ce("browser"),[ne,de]=ce(null),[u,R]=ce([]),[I,J]=ce(0),[B,te]=ce(null),N=nt(null),[H,ie]=ce(t??null),[Ee,je]=ce(null),E=yn(()=>{let p=v?.accent?.trim(),M=v?.background?.trim();if(!(!p&&!M))return M?{...En(M,p),background:M,borderRadius:"inherit"}:{"--sc-accent":p,"--sc-accent-fg":ht(p)}},[v?.accent,v?.background]),Cn=Bi(),G=i??Cn,cn=nt(null);Le(()=>{if(!e||b)return;let p=!0;return Promise.all([e.context(),e.machines()]).then(([M,Q])=>{p&&(A(M),S(Q),m(co(n,o,Q)))}).catch(M=>{p&&(w(M.message),m("choose"))}),()=>{p=!1}},[e,n,o,b]),Le(()=>{y!=="loading"||!b||m(co(n,o,s??[]))},[y,b,n,o,s]),Le(()=>{s&&S(s)},[s]),Le(()=>{a&&A(a)},[a]);let tn=nt(!1),ke=nt(y);ke.current=y;let Mn=nt(u);Mn.current=u;let Nn=!!v?.hosted_available;Le(()=>{!o&&ke.current==="manage"&&m("choose")},[o]),Le(()=>{if(!e||!h||y!=="manage")return;let p=!0,M=He(async()=>{try{let Q=await e.machines();if(!p)return;S(Q);let oe=!Nn||tn.current;Q.length===0&&Mn.current.length===0&&oe&&ke.current==="manage"&&m("choose")}catch{}},Gi,{immediate:!1});return()=>{p=!1,M()}},[y,e,Nn,h]);let xn=eo(v?.publishable_key??null);Le(()=>{je(no(xn))},[xn]),Le(()=>{if(!e||!Nn)return;let p=!0;return e.hosted().then(M=>{p&&(R(M.credentials),!tn.current&&(tn.current=!0,M.credentials.length>0&&o&&ke.current==="choose"&&m("manage")))}).catch(()=>{}),()=>{p=!1}},[e,Nn,o]),Le(()=>{if(!e||!h||y!=="hosted")return;let p=!0,M=async()=>{try{let pe=await e.hosted();if(!p)return!1;if(R(pe.credentials),pe.credentials.length>0)return m("hosted_connected"),te(null),!0}catch{}return!1},Q=async()=>{N.current?.closed&&(N.current=null,!await M()&&p&&m("choose"))},oe=He(M,lo,{immediate:!1}),ye=setInterval(Q,400),rn=pe=>{let Xe=pe.data;Xe?.source==="soba"&&Xe.type==="hosted_result"&&M()};return window.addEventListener("message",rn),()=>{p=!1,oe(),clearInterval(ye),window.removeEventListener("message",rn),N.current=null}},[e,y,h]);let ss=Ne(()=>{if(!e)return;let p=window.open("","soba-connect-plan","width=520,height=760,noopener=no");N.current=p,m("hosted"),J(Date.now()),te(null),w(null),e.startHosted().then(({url:M})=>{if(p&&!p.closed){p.location.href=M;return}te(M)}).catch(M=>{p?.close(),N.current=null,w(M.message),m("choose")})},[e]),un=Ne(async p=>{if(e){j(!0);try{await e.disconnectHosted(p),R((await e.hosted()).credentials)}catch(M){w(M.message)}finally{j(!1)}}},[e]);Le(()=>{if(!e||!h||y!=="waiting")return;let p=!0,M=He(async()=>{try{let Q=await e.machines();if(!p)return;S(Q);let oe=cn.current;if(!oe)return;let ye=Q.filter(pe=>!oe.has(pe.id)||oe.get(pe.id)===!1&&Es(pe)),rn=ye.find(pe=>pe.state!=="offline")??ye[0];if(rn){de(rn.id),H&&to(xn,H);let pe=Ie.find(dt=>dt.id===H)?.expects??[],Xe=we(rn).find(dt=>pe.includes(dt.id));Xe&&e.preferRuntime(rn.id,Xe.id).catch(()=>{}),m("connected"),r?.(Q)}}catch{}},lo,{immediate:!1});return()=>{p=!1,M()}},[y,e,r,H,xn,h]);let Vt=Ne(async()=>{if(e){w(null),j(!0);try{let p=await e.lookup(W);O(p),m("confirm")}catch(p){w(p.message)}finally{j(!1)}}},[e,W]),dn=Ne(async()=>{if(e){w(null),j(!0);try{try{cn.current=ir(await e.machines())}catch{cn.current=ir(k)}await e.approve(W),fe("code"),m("waiting"),ae(Date.now())}catch(p){w(p.message)}finally{j(!1)}}},[e,W,k]),Jn=Ne(async()=>{if(e){j(!0);try{await e.deny(W),Pe("browser"),m("denied")}catch(p){w(p.message)}finally{j(!1)}}},[e,W]),ge=yn(()=>v?.connect_url??null,[v]),[qe,ut]=ce(()=>yt()),Yn=yn(()=>ge?At(ge,qe??void 0,H??void 0):null,[ge,qe,H]),Qt=yn(()=>St(ge),[ge]),Jt=Ne(p=>{if(k.length===0)return null;let M=Ie.find(oe=>oe.id===p);if(!M)return null;let Q=k.flatMap(oe=>oe.runtimes??[]).filter(oe=>M.expects.includes(oe.id));return Q.length===0?{tone:"dim",text:"not installed"}:Q.some(oe=>oe.authenticated===!0)?{tone:"ok",text:"ready"}:Q.every(oe=>oe.authenticated===!1)?{tone:"warn",text:"needs signing in"}:{tone:"dim",text:"installed"}},[k]),Yt=Ne((p=null)=>{ie(p),w(null),Z(null),Y(!1),Ae(!1),jn.current=!1,ut(yt()),m("launch")},[]),jn=nt(!!t);Le(()=>{y!=="launch"||!ge||jn.current||(jn.current=!0,Y(!0),Rr(ge,{...qe?{nonce:qe}:{},...H?{want:H}:{}}).then(Z))},[y,ge,qe,H]);let Sn=Ne(()=>{Y(!0),Sr().then(Z)},[]),jt=Ne(p=>{if(he){let M=yt();Ae(!1),ut(M),ge&&(p.preventDefault(),window.location.href=At(ge,M??void 0,H??void 0))}Sn()},[he,Sn,ge,H]),Rn=yn(()=>{let p=v?.runtimes;return p?Ie.filter(M=>p.includes(M.id)):jr()},[v?.runtimes]),Be=yn(()=>{let p=Ie.find(M=>M.id===H);return p?{choice:p,Mark:An[p.id]??null}:null},[H]),Ce=yn(()=>k.find(p=>p.id===ne),[k,ne]),pn=Ne(()=>{m("manage"),c?.()},[c]);Le(()=>{let p=qe;if(!e||!h||y!=="launch"||!p)return;let M=!1,Q=Date.now()+15e4,oe=()=>{};return oe=He(async()=>{if(Date.now()>Q){oe(),Ae(!0);return}try{let ye=await e.claim(p);if(M)return;if(ye.declined){oe(),Z(null),Pe("machine"),m("denied");return}if(!ye.claimed)return;oe();try{cn.current=ir(await e.machines())}catch{cn.current=ir(k)}fe("app"),m("waiting"),ae(Date.now())}catch{}},lo,{immediate:!1,idle:!1}),()=>{M=!0,oe()}},[e,y,k,qe,h]);let Ze=yn(()=>{if(!D)return null;if(D.approved||D.denied)return"answered";let p=D.expires_at?Date.parse(D.expires_at):Number.NaN;return Number.isFinite(p)&&p<=P?"expired":"live"},[D,P]);Le(()=>{if(!(y==="confirm"&&Ze==="live"||y==="waiting"||y==="hosted"))return;let M=setInterval(()=>q(Date.now()),1e3);return()=>clearInterval(M)},[y,Ze]);let qt=Ne(async(p,M)=>{if(e)try{await e.approveRuntime(p,M),S(await e.machines())}catch(Q){w(Q.message)}},[e]),yr=Ne(async(p,M)=>{if(e)try{await e.preferRuntime(p,M),S(await e.machines())}catch(Q){w(Q.message)}},[e]);return y==="loading"?g("div",{className:"soba-connect",...l?{"data-theme":l}:{},style:E,children:g("div",{className:"sc-card",children:g("p",{className:"sc-note",children:"Loading\u2026"})})}):T("div",{className:"soba-connect",...l?{"data-theme":l}:{},style:E,children:[c&&g("button",{type:"button",className:"sc-modal-close",onClick:c,"aria-label":"Close",children:"\xD7"}),y==="manage"&&T("div",{className:"sc-card",children:[g("h2",{className:"sc-title",id:G,children:"Your compute"}),T("p",{className:"sc-sub",children:[g(lr,{context:v})," ",k.length>0&&u.length>0?"runs on your connected plan, and on these machines while they are awake.":u.length>0?"runs on the plan you connected. Nothing here is charged to you.":"runs on these machines, while they are awake."]}),g(Wn,{machines:k,hosted:u,onApproveRuntime:qt,onPreferRuntime:(p,M)=>void yr(p,M),onDisconnectHosted:p=>void un(p),onPair:()=>m("choose"),busy:$,...v?.app.name?{appName:v.app.name}:{}}),U&&g("p",{className:"sc-error",children:U})]}),y==="choose"&&T("div",{className:"sc-card",children:[g(Fi,{context:v}),g("h2",{className:"sc-h",id:G,children:d==="payment_required"?"Carry on with your own AI":d==="no_compute"?"This run needs a machine":"Connect your AI"}),g("p",{className:"sc-p",children:"Use compute you already have."}),ge&&Rn.length>0&&T(rt,{children:[g("div",{className:"sc-opts",children:Rn.map(p=>{let M=An[p.id];return T("button",{type:"button",className:"sc-opt",onClick:()=>Yt(p.id),children:[g("span",{className:"sc-opt-tile","aria-hidden":"true",children:M&&g(M,{className:"sc-opt-mark"})}),g("span",{className:"sc-opt-text",children:g("span",{className:"sc-opt-label",children:p.label})}),(()=>{let Q=Jt(p.id);return Q?g("span",{className:`sc-opt-has sc-opt-has-${Q.tone}`,children:Q.text}):Ee===p.id?g("span",{className:"sc-opt-last",children:"last used"}):g(uo,{className:"sc-opt-go"})})()]},p.id)})}),T("p",{className:"sc-opt-note",children:["Your accounts stay there. ",Is(v)," never sees them."]})]}),(!ge||Rn.length===0)&&g("p",{className:"sc-error",style:{marginTop:16},children:"This app has no publishable key yet, so there is nothing to pair against."}),U&&g("p",{className:"sc-error",children:U}),ge&&v?.show_code===!0&&g("div",{className:"sc-opt-alt",children:g("button",{type:"button",className:"sc-alt-link",onClick:()=>m("code"),children:"I have a code"})})]}),y==="launch"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("choose")}),g("p",{className:"sc-head-title",children:"Soba"})]}),g(cr,{mark:Be?.Mark??Me,still:he||!be&&V===null}),g("h2",{className:"sc-h",id:G,children:he?"No answer from this machine":V==="absent"?"Nothing opened":V===null?"Opening Soba\u2026":"Approve it on this machine"}),he?g("p",{className:"sc-p",children:"The Soba app did not answer. It may not be open, or nobody was there. Try again when you are ready."}):V==="absent"?g("p",{className:"sc-p",children:"Nothing opened on this machine. Open it yourself below, or install it if it is not here yet."}):g("p",{className:"sc-p",children:V===null?"Approve it there and this page does the rest.":"This page finishes on its own."}),Be&&T("p",{className:"sc-prereq",children:[Be.Mark&&g(Be.Mark,{className:"sc-rt-mark"}),"Needs ",Be.choice.prerequisite]}),T("div",{className:"sc-stack",style:{marginTop:18},children:[g("a",{className:V==="absent"||he?"sc-btn sc-btn-primary":"sc-btn",href:Yn??"#",onClick:jt,children:he?"Try again":V==="absent"?"Open Soba":"Open it again"}),g("p",{className:"sc-note",children:V===null?"Your browser will ask permission first.":"Your browser asks permission the first time."}),Be&&V==="absent"&&g("p",{className:"sc-note",children:g(Vi,{text:Be.choice.hint})}),T("div",{className:"sc-foot-strip",children:[g("span",{children:"Not installed on this machine?"}),T("button",{type:"button",className:"sc-foot-go",onClick:()=>m("get"),children:["Get it",g(uo,{})]})]})]})]}),y==="get"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("launch")}),g("p",{className:"sc-head-title",children:"Get Soba"})]}),g("div",{className:"sc-opts",children:xt.map(p=>T("a",{className:"sc-opt",href:`${Qt}/download/${p.slug}`,target:"_blank",rel:"noreferrer noopener",children:[g("span",{className:"sc-opt-tile","aria-hidden":"true",children:g(Vr,{className:"sc-opt-mark"})}),g("span",{className:"sc-opt-text",children:g("span",{className:"sc-opt-label",children:p.label})}),g(uo,{className:"sc-opt-go"})]},p.slug))}),g("p",{className:"sc-opt-note",children:"Install it, then come back here and press the row you started with."})]}),y==="code"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("choose")}),g("p",{className:"sc-head-title",children:"Soba"})]}),g("h2",{className:"sc-h",id:G,children:"Enter the code from that machine"}),g("p",{className:"sc-p",children:"Eight characters, shown by the Soba app once you paste the link."}),T("form",{className:"sc-stack",style:{marginTop:16},onSubmit:p=>{p.preventDefault(),Vt()},children:[g("input",{className:"sc-input",value:W,onChange:p=>L(p.target.value),placeholder:"ACDE-F234",autoComplete:"off",autoFocus:!0,"aria-label":"Pairing code"}),U&&g("p",{className:"sc-error",children:U}),g("button",{type:"submit",className:"sc-btn sc-btn-primary",disabled:$||W.length<8,children:$?"Checking\u2026":"Continue"})]})]}),y==="confirm"&&D&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("code")}),g("p",{className:"sc-head-title",children:"Soba"})]}),g("h2",{className:"sc-title",children:"Attach this machine to your account?"}),T("p",{className:"sc-sub",children:[g(lr,{context:v})," may send your runs to it once you approve. It can never see the account or the keys on it."]}),T("ul",{className:"sc-facts",children:[g(Rt,{k:"Code",v:D.user_code}),g(Rt,{k:"Machine",v:D.hostname??"not stated"}),g(Rt,{k:"System",v:[D.platform,D.arch].filter(Boolean).join(" / ")||"not stated"}),g(Rt,{k:"Asked by",v:D.client??"not stated"}),D.labels.length>0&&g(Rt,{k:"Labels",v:D.labels.join(", ")})]}),g("p",{className:"sc-note",style:{marginTop:12},children:"Every line above is what that machine said about itself. If none of it looks like a computer of yours, say no."}),Ze==="expired"&&g("p",{className:"sc-error",children:"That code has expired. Ask the machine for a new one. It prints a fresh code each time it starts."}),Ze==="answered"&&g("p",{className:"sc-error",children:"That code has already been answered. If it was not you, deny the next one."}),U&&g("p",{className:"sc-error",children:U}),T("div",{className:"sc-row",style:{marginTop:16},children:[g("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>void dn(),disabled:$||Ze!=="live",children:"Approve"}),g("button",{type:"button",className:"sc-btn",onClick:()=>void Jn(),disabled:$||Ze==="answered",children:"No, deny it"})]}),Ze==="live"&&D.expires_at&&T("p",{className:"sc-note",style:{marginTop:10},children:["This code expires in ",Hi(Date.parse(D.expires_at)-P),"."]})]}),y==="waiting"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("choose")}),g("p",{className:"sc-head-title",children:Be?.choice.short??"Soba"})]}),g(cr,{mark:Be?.Mark??Me}),g("h2",{className:"sc-h",id:G,children:"Approved. Waiting for it to connect"}),g("p",{className:"sc-p",children:"Nothing more to do here. This page changes when it arrives."}),ee>0&&P-ee>Wi&&T("ol",{className:"sc-stall",children:[me==="app"?T(rt,{children:[g(ur,{done:!0,title:"Soba Connect opened",line:"On this machine"}),g(ur,{done:!0,title:"You approved it",line:"In Soba Connect"})]}):g(ur,{done:!0,title:"You approved the code",line:"On this page"}),g(ur,{title:`Still nothing from ${D?.hostname??"that machine"}`,line:"Look at Soba Connect on that machine: it says what it is doing. This keeps watching either way.",children:g("button",{type:"button",className:"sc-btn sc-stall-act",onClick:()=>void Tn(),children:"Open Soba Connect"})})]})]}),y==="connected"&&T("div",{className:"sc-card",children:[g(po,{tone:"ok"}),g("h2",{className:"sc-h",id:G,children:Ce?.label?`${Ce.label} is connected`:"Connected"}),T("p",{className:"sc-p",children:[g(lr,{context:v})," will use ",Ce?.label?"it":"this machine"," from now on, while it is awake."]}),o&&T(rt,{children:[Ce&&g(zi,{machine:Ce}),g("button",{type:"button",className:"sc-btn sc-btn-primary sc-btn-wide",style:{marginTop:14},onClick:pn,children:"Done"})]})]}),y==="hosted"&&T("div",{className:"sc-card",children:[T("div",{className:"sc-head",children:[g(tt,{onClick:()=>m("choose")}),g("p",{className:"sc-head-title",children:"ChatGPT"})]}),B?g(cr,{mark:Gn,still:!0}):g(cr,{mark:Gn}),g("h2",{className:"sc-h",id:G,children:B?"Your browser blocked the window":"Finish signing in to ChatGPT"}),g("p",{className:"sc-p",children:B?"Nothing opened. Open the sign-in yourself below. A link you click is allowed where a window we open is not.":"Approve it in the window that opened."}),T("div",{className:"sc-stack",style:{marginTop:18},children:[B&&g("a",{className:"sc-btn sc-btn-primary",href:B,target:"soba-connect-plan",rel:"noreferrer",children:"Open the ChatGPT sign-in"}),U&&g("p",{className:"sc-error",children:U}),I>0&&P-I>Di&&g("p",{className:"sc-note sc-tone-warn",children:"Still nothing. The window may have been closed before it finished, or the sign-in may have been declined. This keeps watching either way."})]})]}),y==="hosted_connected"&&T("div",{className:"sc-card",children:[g(po,{tone:"ok"}),g("h2",{className:"sc-h",id:G,children:"ChatGPT is connected"}),T("p",{className:"sc-p",children:[g(lr,{context:v})," will run on your ChatGPT plan",u[0]?.account_label?` (${u[0].account_label})`:"",". Nothing more to pay, nothing to install."]}),g("p",{className:"sc-opt-note",style:{textAlign:"center"},children:"It runs on our side, so it has no access to your files or your terminal."}),o&&T(rt,{children:[g("button",{type:"button",className:"sc-btn sc-btn-wide",style:{marginTop:16},onClick:pn,children:"Done"}),g("div",{className:"sc-opt-alt",children:g("button",{type:"button",className:"sc-alt-link",onClick:()=>m("choose"),children:"Connect a machine too"})})]})]}),y==="denied"&&T("div",{className:"sc-card",children:[g(po,{tone:"off"}),g("h2",{className:"sc-h",id:G,children:"Declined"}),g("p",{className:"sc-p",children:Te==="machine"?"Nothing was connected. You can ask again whenever you like.":"That machine was not attached to your account, and the terminal has been told so."}),g("button",{type:"button",className:"sc-btn sc-btn-wide",style:{marginTop:16},onClick:()=>m("choose"),children:"Back to the start"})]})]})}function Is(e){return e?.app.name??"this app"}function Ui(e){let n=e?.app.icon_urls;if(n?.length)return n;let t=e?.app.icon_url;return t?[t]:[]}function Ls(e){let n=Ui(e),[t,r]=ce([]),o=Ne(c=>{c&&r(i=>i.includes(c)?i:[...i,c])},[]),a=Ne(c=>o(c.currentTarget.getAttribute("src")),[o]),s=Ne(c=>{c?.complete&&c.naturalWidth===0&&o(c.getAttribute("src"))},[o]);return{icon:n.find(c=>!t.includes(c)),onError:a,ref:s}}function Fi({context:e}){let{icon:n,onError:t,ref:r}=Ls(e);return e?.app.mark==="soba"?g(Me,{className:"sc-app-mark"}):n?g("img",{className:"sc-app-mark",src:n,alt:"","aria-hidden":"true",ref:r,onError:t}):null}function lr({context:e}){let{icon:n,onError:t,ref:r}=Ls(e),o=e?.app.mark==="soba";return T("span",{className:"sc-app",children:[o&&g(Me,{className:"sc-app-icon"}),!o&&n&&g("img",{className:"sc-app-icon",src:n,alt:"",ref:r,onError:t}),Is(e)]})}function tt({onClick:e}){return g("button",{type:"button",className:"sc-head-back",onClick:e,"aria-label":"Back",children:g("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:g("path",{d:"M15 5 8 12l7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}function uo({className:e}){return g("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:g("path",{d:"M9 5l7 7-7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function cr({mark:e,still:n}){return T("span",{className:"sc-waiting","aria-hidden":"true",children:[!n&&g("svg",{className:"sc-waiting-orbit",viewBox:"0 0 100 100","aria-hidden":"true",focusable:"false",children:g("circle",{className:"sc-waiting-arc",cx:"50",cy:"50",r:"46"})}),g(e,{className:"sc-waiting-mark"})]})}function po({tone:e}){return g("span",{className:`sc-result sc-result-${e}`,"aria-hidden":"true",children:g(mn,{kind:e==="ok"?"snap":"gone",size:84})})}function zi({machine:e}){let{runtime:n}=Fe(e);if(!n)return null;let t=Ke(n);return T("div",{className:"sc-arrived",children:[g(Kr,{id:n.id,name:n.display_name}),g("span",{className:"sc-arrived-name",children:n.display_name}),T("span",{className:`sc-arrived-auth${t.tone==="warn"?" sc-tone-warn":""}`,children:[t.tone==="ok"&&g("i",{className:"sc-arrived-dot","aria-hidden":"true"}),t.tone==="ok"?"Signed in":t.tone==="warn"?"Signed out":"Could not tell"]})]})}function ur({done:e,title:n,line:t,children:r}){return T("li",{className:"sc-stall-step",children:[T("svg",{viewBox:"0 0 20 20",className:e?"sc-stall-ok":"sc-stall-open","aria-hidden":"true",children:[g("circle",{cx:"10",cy:"10",r:"9"}),e?g("path",{d:"M6 10.3 8.7 13 14 7.5"}):T(rt,{children:[g("path",{d:"M10 5.5v5.5"}),g("circle",{className:"sc-stall-pt",cx:"10",cy:"14.3",r:"1.2"})]})]}),g("span",{className:"sc-stall-title",children:n}),g("span",{className:"sc-stall-line",children:t}),r&&g("span",{className:"sc-stall-more",children:r})]})}function Vi({text:e}){return g(rt,{children:e.split("`").map((n,t)=>t%2===1?g("code",{className:"sc-inline-code",children:n},t):n)})}function Rt({k:e,v:n}){return T("li",{className:"sc-fact",children:[g("span",{className:"sc-fact-key",children:e}),g("span",{children:n})]})}import{forwardRef as Qi}from"react";import{jsx as fo,jsxs as ho}from"react/jsx-runtime";var go=Qi(function({machine:n,className:t,...r},o){if(!n)return null;let{ariaLabel:a,state:s}=Kn(n);return ho("button",{ref:o,type:"button","aria-label":a,className:["sc-btn","sc-btn-connected",t].filter(Boolean).join(" "),...r,children:[fo("span",{className:"sc-pill-tile","aria-hidden":"true",children:fo(mn,{kind:s.tone==="busy"?"serving":s.tone==="ok"?"ready":n.pairing_lost?"gone":"paused",size:16,className:"sc-pill-mark"})}),ho("span",{className:"sc-btn-connected-text",children:[s.word,!n.pairing_lost&&ho("span",{className:"sc-btn-connected-where",children:[" on ",le(n)]})]}),fo("i",{className:`sc-dot sc-dot-${s.tone}`,"aria-hidden":"true"})]})});function Os(e){if(e.type==="boolean")return e.name;if(e.type==="text")return`${e.name}: ${String(e.value??"").trim()}`;let n=e.unit?.trim()||e.name.toLowerCase();if(e.price){let r=Ji(e.price.amountMicros),o=n.endsWith("s")?n.slice(0,-1):n,a=e.price.included>0?`${e.price.included.toLocaleString("en-US")} ${n} included, then ${r} per ${o}`:`${r} per ${o}`;return e.value===null?a:`${a}, up to ${e.value.toLocaleString("en-US")}`}let t=e.resets==="month"?" a month":"";return e.value===null?`Unlimited ${n}${t}`:`${e.value.toLocaleString("en-US")} ${n}${t}`}var Ji=e=>(e/1e6).toLocaleString("en-US",{style:"currency",currency:"USD"});function dr(e){let n=[];for(let t of e??[])!t.name?.trim()&&!t.unit?.trim()||n.push({text:Os(t),included:!(t.type==="boolean"&&t.value!==!0)});return n}function bo(e,n,t=1){let r=e.quantities?.[n]??0,o=(i,l=null)=>({feature:n,allowed:!1,reason:i,limit:l,used:r,remaining:l===null?null:Math.max(0,l-r),unlimited:!1});if(e.features===null)return o("no_plan");if(e.ended)return o("plan_ended",0);if(!(n in e.features))return o("not_included");let a=e.features[n];if(typeof a=="string")return a.trim()?{feature:n,allowed:!0,reason:null,limit:null,used:0,remaining:null,unlimited:!1}:o("not_included");if(typeof a=="boolean")return a?{feature:n,allowed:!0,reason:null,limit:null,used:0,remaining:null,unlimited:!1}:o("not_included");if(a==null)return{feature:n,allowed:!0,reason:null,limit:null,used:r,remaining:null,unlimited:!0};let s=Math.max(0,t),c=Math.max(0,a-r);return a===0?o("not_included",0):r+s>a?o("limit_reached",a):{feature:n,allowed:!0,reason:null,limit:a,used:r,remaining:c,unlimited:!1}}import{useEffect as Yi,useRef as yo}from"react";var pr=0,Ao=null;function Ts(){if(typeof document>"u")return()=>{};pr===0&&(Ao=document.body.style.overflow,document.body.style.overflow="hidden"),pr+=1;let e=!1;return()=>{e||(e=!0,pr-=1,pr===0&&(document.body.style.overflow=Ao??"",Ao=null))}}import{jsx as Bs}from"react/jsx-runtime";function Pt({open:e,onClose:n,labelledBy:t,theme:r,style:o,children:a}){let s=yo(null),c=yo(null),i=yo(null);return Yi(()=>{let l=s.current;if(l){if(!e){l.open&&l.close();return}return l.open||l.showModal(),document.activeElement===l&&c.current?.focus(),Ts()}},[e]),Bs("dialog",{ref:s,className:"soba-connect sc-modal","aria-labelledby":t,...r?{"data-theme":r}:{},style:o,onCancel:l=>{l.preventDefault(),n()},onPointerDown:l=>{i.current=l.target},onClick:l=>{l.target===l.currentTarget&&i.current===l.currentTarget&&n()},children:Bs("div",{className:"sc-modal-sheet",ref:c,tabIndex:-1,children:a})})}import{useEffect as wo,useRef as ji}from"react";import{jsx as qi}from"react/jsx-runtime";var Dn=8;function vo({open:e,onClose:n,anchor:t,label:r,theme:o,style:a,children:s}){let c=ji(null);return wo(()=>{let i=c.current;if(!(!i||!(typeof i.showPopover=="function")))try{e?i.showPopover():i.hidePopover()}catch{}},[e]),wo(()=>{if(!e)return;let i=()=>{let d=c.current,h=t.current;if(!d||!h)return;let b=h.getBoundingClientRect(),y=d.offsetWidth,m=d.offsetHeight,v=window.innerWidth-y-Dn,A=Math.max(Dn,Math.min(b.right-y,Math.max(Dn,v))),k=b.bottom+Dn,S=b.top-Dn-m,W=k+m>window.innerHeight-Dn&&S>Dn?S:k;d.style.left=`${Math.round(A)}px`,d.style.top=`${Math.round(W)}px`};i();let l=requestAnimationFrame(i);return window.addEventListener("scroll",i,!0),window.addEventListener("resize",i),()=>{cancelAnimationFrame(l),window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i)}},[e,t]),wo(()=>{if(!e)return;let i=d=>{d.key==="Escape"&&n()},l=d=>{let h=d.target;h&&(c.current?.contains(h)||t.current?.contains(h)||n())};return document.addEventListener("keydown",i),document.addEventListener("pointerdown",l,!0),()=>{document.removeEventListener("keydown",i),document.removeEventListener("pointerdown",l,!0)}},[e,n,t]),qi("div",{ref:c,role:"dialog","aria-label":r,className:"soba-connect sc-pop",...o?{"data-theme":o}:{},popover:"manual",hidden:!e,style:a,children:s})}var Et=new Map,ot=new Map,Gs=!1;function Zi(){Gs||typeof window>"u"||(Gs=!0,window.addEventListener("storage",e=>{!e.key||!Et.has(e.key)||(ot.set(e.key,ar(e.key)),ko(e.key))}))}function ko(e){for(let n of Et.get(e)??[])n()}function It(e){return e??""}function Co(e,n){let t=It(e);Zi();let r=Et.get(t)??new Set;return r.add(n),Et.set(t,r),()=>{r.delete(n),r.size===0&&Et.delete(t)}}function mr(e){let n=It(e),t=ot.get(n);if(t!==void 0)return t;let r=e?ar(e):null;return ot.set(n,r),r}function Mo(){return null}function No(e,n){mr(e)===null&&(ot.set(It(e),n),ko(It(e)))}function xo(e,n){let t=It(e);ot.get(t)!==n&&(ot.set(t,n),oo(e,n),ko(t))}var Xi=e=>e.toLocaleString("en-US");function Oe(e,n){if(e==="cost")return`${(n/1e4).toLocaleString("en-US",{style:"currency",currency:"USD"})} of usage`;let t=e==="token"?"token":e;return`${Xi(n)} ${t}${n===1?"":"s"}`}function Hn(e){return e==="token"?"1M tokens":e==="cost"?"$1 of usage":e==="credit"?"1,000 credits":e}function Lt(e){return e==="cost"?"usage":`${e}s`}function Ot(e,n,t){let r=t?.trim();if(!r||e!=="run"&&e!=="task"&&e!=="message")return Oe(e,n);let o=r.endsWith("s")?r.slice(0,-1):r;return`${n.toLocaleString("en-US")} ${n===1?o:r}`}function sn(e){return e.reward==="included"&&e.includedUnits!==null?`${Oe(e.unit,e.includedUnits)} a month once you connect`:e.reward==="credit"&&e.creditMicros>0?`${Ki(e.creditMicros)} back each month you stay connected`:null}function an(e){return e==="included"}function Un(e){if(!e.routePrefer.some(t=>So.has(t)||t==="user-api-key"))return null;let n=e.ownUnit??e.unit;return e.ownIncludedUnits===null?e.includedUnits!==null?`Unlimited ${n==="cost"?"usage":(n==="run"||n==="task")&&e.taskNoun?.trim()?e.taskNoun.trim():`${n}s`} on your own AI`:null:`${Ot(n,e.ownIncludedUnits,e.taskNoun)} a month on your own AI`}var So=new Set(["user-hardware","user-subscription"]),Ws=new Set(["open-weights","frontier"]);function Ve(e){return e===null||e.length===0?!1:e.every(n=>So.has(n))}var Ki=e=>(e/1e6).toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2});function Ro(e,n){if(!(n===null||n.some(a=>Ws.has(a))))return!1;let r=e.findIndex(a=>So.has(a));if(r===-1)return!1;let o=e.findIndex(a=>Ws.has(a));return o===-1||r<o}import{createContext as Ds,useContext as Hs}from"react";var Po=Ds(null);function wn(){return Hs(Po)}var Eo=Ds({context:null,machines:void 0,theme:"light"});function _(){return Hs(Eo)}import{useMemo as el}from"react";import{createContext as _i,useContext as $i}from"react";var Io=_i(null);function K(){let e=$i(Io);if(!e)throw new Error("useSoba() must be used inside a <SobaProvider>.");return e}function Tt(){let{compute:e}=K();return el(()=>{let n=e.machines,t=[...n].sort((a,s)=>_e([a,s])===a?-1:1).map(nl),r=_e([...n]),o=In(n);return{view:t.length?"machines":e.loading?"loading":e.error?"error":"empty",machines:t,primary:r?t.find(a=>a.machine.id===r.id)??null:null,connected:e.connected,online:e.online,stalled:e.connected&&!e.online&&o?t.find(a=>a.machine.id===o.id)??null:null,loading:e.loading,error:e.error,refresh:e.refresh}},[e])}function nl(e){let n=Fe(e);return{machine:e,name:le(e),state:Ln(e),status:Mr(e),hardware:gt(e),lastSeen:e.state==="offline"?bt(e.last_seen_at):null,runtimes:we(e).map(t=>({runtime:t,name:t.display_name,auth:Ke(t),quarantined:!!t.quarantined})),runsOn:{by:n.by,name:n.runtime?.display_name??null}}}import{useCallback as Lo,useEffect as tl,useMemo as Qe,useSyncExternalStore as rl}from"react";function Fn(e={}){let{compute:n,connect:t,models:r}=K(),{value:o,onChange:a,defaultValue:s,remember:c=!0,user:i}=e,l=e.layout??(e.choices?.length?"choices":r.layout??"providers"),d=JSON.stringify(e.choices??[]),h=o!==void 0,b=c&&!h?ro(t.publishableKey,i):null,y=Lo(P=>Co(b,P),[b]),m=rl(y,Lo(()=>mr(b),[b]),Mo),v=Qe(()=>r.rowsByLayout[l]??(r.sizes===!1?{auto:!0,fast:!1,best:!1}:void 0),[r.rowsByLayout,r.sizes,l]),A=Qe(()=>Tr(wt(n.machines,r.providers,r.names,r.route?.allow),v),[n.machines,r.providers,r.names,r.route,v]),k=Qe(()=>Or(A,l,JSON.parse(d)),[A,l,d]),S=Qe(()=>Br(k,l,v),[k,l,v]),W=l==="models"&&v?.own===!0,L=Qe(()=>vt(S,l,W),[S,l,W]),D=Qe(()=>[...A,...k.filter(P=>!A.some(q=>q.id===P.id))],[A,k]),O=Qe(()=>{let P=[];for(let V of[...n.machines].sort(Xn))for(let Z of we(V)){if(P.some(Y=>Y.id===Z.id)||r.route&&!r.route.allow.includes(Z.cost_class))continue;let be=$e[Z.id];P.push({id:Z.id,name:Z.display_name,...be?{logo:be}:{},options:S.filter(Y=>Y.kind==="named"&&Y.runtime===Z.id)})}let q=L.flatMap(V=>V.options.map(Z=>Z.id));for(let V of P)V.options.sort((Z,be)=>q.indexOf(Z.id)-q.indexOf(be.id));return P},[n.machines,S,L,r.route]),U=Qe(()=>r.providers.map(P=>{let q=`@${P.id}/`;return{id:P.id,name:P.name,...P.provider?{mark:P.provider}:{},costClass:P.cost_class,...P.locked?{locked:P.locked}:{},options:A.filter(V=>V.id.startsWith(q))}}),[r.providers,A]);tl(()=>{h||!s||No(b,s)},[h,s,b]);let w=Qe(()=>{let P=r.names.find(q=>q.default);if(P&&l==="choices")return`alias:${P.alias}`;for(let q of r.providers){let V=q.models.find(Z=>Z.default);if(V&&l!=="choices")return`@${q.id}/${V.model}`}return null},[r.names,r.providers,l]),$=h?o:l==="automatic"?s??null:m??s??w,j=Qe(()=>S.some(P=>P.kind==="auto")?null:L.flatMap(P=>P.options).find(P=>!P.locked)?.id??null,[S,L]),ee=!$||$==="auto"?j??$:$,{selected:ae,unavailable:me}=Qe(()=>Gr(D,ee??null),[D,ee]),fe=Lo(P=>{h||xo(b,P),a?.(P)},[h,b,a]);return{options:S,groups:L,selected:ae,select:fe,agents:O,providers:U,models:A.filter(P=>P.kind==="provider"),choices:S.filter(P=>P.choice!==void 0),layout:l,ownInList:W,search:v?.search!==!1,run:Wr(ae),unavailable:me,pickable:gn(S),loading:n.loading&&!n.machines.length||r.loading&&!r.providers.length&&!n.machines.length}}function ol(e){return e.runtime?$e[e.runtime]:void 0}import{jsx as Bt}from"react/jsx-runtime";function sl({className:e}){let{theme:n}=_(),t=e?`soba-connect ${e}`:"soba-connect";return Bt("div",{className:t,"data-theme":n,children:Bt(Oo,{})})}function Oo(){let e=Tt(),n=Fn();return e.view==="loading"?Bt("p",{className:"sc-note",children:"Loading\u2026"}):e.view==="error"?Bt("p",{className:"sc-error",children:e.error?.message}):Bt(_r,{machines:e.machines.map(t=>t.machine),model:n.selected,onPickModel:n.select})}import{useCallback as Wt,useEffect as Wo,useMemo as ml,useRef as Do,useState as at}from"react";import{useId as al}from"react";import{jsx as st,jsxs as fr}from"react/jsx-runtime";function Gt({open:e,onOpenChange:n,initialCode:t,onConnected:r,showStatus:o,reason:a}){let{error:s}=K(),c=wn(),i=_(),l=()=>n(!1),d=al(),h=i.context?.background?.trim(),b=h?En(h,i.context?.accent):void 0;return fr(Pt,{open:e,onClose:l,labelledBy:d,theme:i.theme,style:b,children:[s?fr("div",{className:"sc-card",children:[st("h2",{className:"sc-title",id:d,children:"Could not start"}),st("p",{className:"sc-error",children:s.message})]}):!c&&!i.context?fr("div",{className:"sc-card",children:[st("h2",{className:"sc-title",id:d,children:"One moment"}),st("p",{className:"sc-note",children:"Getting your compute\u2026"})]}):st(mo,{client:c,active:e,onClose:l,headingId:d,theme:i.theme,initialContext:i.context,...i.machines!==void 0?{initialMachines:i.machines}:{},...t?{initialCode:t}:{},...r?{onConnected:r}:{},...o===void 0?{}:{showStatus:o},...a?{reason:a}:{}}),fr("p",{className:"sc-modal-foot",children:[st(Me,{className:"sc-foot-mark"}),"Secured by Soba"]})]})}import{forwardRef as il}from"react";import{jsx as ll}from"react/jsx-runtime";var To=il(function(n,t){let{theme:r}=_();return ll(go,{ref:t,"data-theme":r,...n})});import{useCallback as cl}from"react";function ul(){let{connect:e}=K(),n=Tt(),t=cl(()=>e.open("manual"),[e]);return{...Kn(n.primary?.machine??null),machine:n.primary,open:t,canOpen:e.hasModal,loading:n.view==="loading"}}function Bo(e){return Kn(e)}import{useCallback as Us,useEffect as dl,useState as pl}from"react";function Go({enabled:e=!0,intervalMs:n=3e3}={}){let t=wn(),[r,o]=pl(null),a=Us(async()=>{t&&o(await t.runs())},[t]);dl(()=>{if(!e||!t)return;let c=!0,i=He(async()=>{let l=await t.runs();c&&o(l)},n);return()=>{c=!1,i()}},[e,t,n]);let s=Us(async c=>{if(!t)throw new Error("Stopping a run needs <SobaProvider>.");await t.stopRun(c),await a().catch(()=>{})},[t,a]);return{runs:r,refresh:a,stop:s}}import{Fragment as Fs,jsx as it,jsxs as zs}from"react/jsx-runtime";function zn({children:e,variant:n,className:t,initialCode:r,onConnected:o,defaultOpen:a,open:s,onOpenChange:c,showConnected:i=!0}){let{compute:l,connect:d}=K(),h=_(),{theme:b}=h,y=wn(),[m,v]=at(a??!!r),A=Do(null),k=s!==void 0,S=!k&&!a&&!r&&d.hasModal,W=k?s:S?d.isOpen:m,L=N=>{S?N?d.open("manual"):d.close():k||v(N),c?.(N)},D=Do(W);Wo(()=>{D.current&&!W&&A.current?.focus(),D.current=W},[W]);let[O,U]=at(!1),{runs:w,stop:$}=Go({enabled:O}),j=Fn(),ee=ml(()=>O&&w?fl(l.machines,w):l.machines,[l.machines,O,w]),ae=_e(ee),me=i&&Bo(ae).connected,fe=Wt(()=>U(!1),[]),[P,q]=at(!1),V=Wt(async()=>{q(!0);try{await l.refresh()}finally{q(!1)}},[l]),Z=Do(V);Z.current=V,Wo(()=>{O&&Z.current()},[O]);let[be,Y]=at(!1),[he,Ae]=at([]),Te=!!h.context?.hosted_available;Wo(()=>{if(!O||!y||!Te)return;let N=!0;return y.hosted().then(H=>{N&&Ae(H.credentials)}).catch(()=>{}),()=>{N=!1}},[O,y,Te]);let[Pe,ne]=at(null),de=Wt(async(N,H)=>{if(y){ne(null);try{await y.approveRuntime(N,H),await l.refresh()}catch(ie){ne(ie.message)}}},[y,l]),u=Wt(async(N,H)=>{if(y){ne(null);try{await y.preferRuntime(N,H),await l.refresh()}catch(ie){ne(ie.message)}}},[y,l]),R=Wt(async N=>{if(y){ne(null);try{await y.disconnectHosted(N),Ae((await y.hosted()).credentials)}catch(H){ne(H.message)}}},[y]),I=h.context?.background?.trim(),J=I?En(I,h.context?.accent):void 0,B=me&&!e,te=()=>{if(B&&!k&&!a&&!r){U(N=>!N);return}L(!0)};return zs(Fs,{children:[B?it(To,{ref:A,machine:ae,"aria-haspopup":"dialog","aria-expanded":O,onClick:te,...t?{className:t}:{}}):it("button",{ref:A,type:"button","data-theme":b,className:["sc-btn","sc-btn-icon",n==="primary"?"sc-btn-primary":"",t].filter(Boolean).join(" "),onClick:te,children:e??zs(Fs,{children:[it(Me,{className:"sc-btn-mark"}),"Connect compute"]})}),it(vo,{open:O,onClose:fe,anchor:A,label:"Your compute",theme:b,...J?{style:J}:{},children:it(Wn,{machines:ee,hosted:he,onApproveRuntime:(N,H)=>void de(N,H),onPreferRuntime:(N,H)=>void u(N,H),onDisconnectHosted:N=>void R(N),onRefresh:()=>void V(),refreshing:P,model:j.selected,onPickModel:j.select,error:Pe,runs:w,onStopRun:async N=>{ne(null);try{await $(N)}catch(H){throw ne(H.message),H}},onPair:()=>{U(!1),S?d.open("pair"):(Y(!0),L(!0))},...h.context?.app.name?{appName:h.context.app.name}:{}})}),!S&&it(Gt,{open:W,onOpenChange:N=>{N||Y(!1),L(N)},...be?{showStatus:!1}:{},...r?{initialCode:r}:{},...o?{onConnected:o}:{}})]})}function fl(e,n){return e.map(t=>{if(t.state==="offline")return t;let r=n.filter(o=>o.machine_id===t.id).length;return{...t,active:r,state:r>0?"busy":"online"}})}import{jsx as Ho,jsxs as gl}from"react/jsx-runtime";function hl({initialCode:e,onConnected:n,className:t,showStatus:r=!0}){let{theme:o}=_();return gl("div",{className:t?`soba-connect ${t}`:"soba-connect","data-theme":o,children:[r&&Ho(Oo,{}),Ho("div",{className:"sc-compute-act",children:Ho(zn,{...e?{initialCode:e}:{},...n?{onConnected:n}:{}})})]})}import{useId as Rl,useState as Pl}from"react";import{useCallback as Fo,useEffect as js,useState as qs}from"react";import{useCallback as bl,useState as Al}from"react";function Dt(){let[e,n]=Al(null);return{open:bl(()=>{n(null),Tn().then(n)},[]),launch:e,note:e==="absent"?"Nothing opened here. That machine may be a different computer, or asleep.":null}}import{useCallback as Vs,useMemo as Qs}from"react";function Vn(e){if(!e)return null;if(typeof e=="string")return e;if(typeof Response<"u"&&e instanceof Response)return Js(e.status);let n=e,t=n.error;return typeof t?.code=="string"?t.code:typeof t?.type=="string"?t.type:typeof n.code=="string"?n.code:typeof n.status=="number"?Js(n.status):n.cause&&n.cause!==e?Vn(n.cause):null}function Js(e){return e===402?"payment_required":e===409?"no_compute":null}function Uo(...e){let[n,t]=e,{plan:r,compute:o,connect:a}=K(),s=t?.predict??e.length===0,c=wl(yl(n),o)??(s?vl(r,o):null),i=r.plan,l=r.plans,d=Qs(()=>{if(c!=="payment_required")return null;let m=i?.price??0,v=i?.included_units??0;return l.find(A=>A.id!==i?.id&&A.price>m&&(A.included_units===null||A.included_units>v))??null},[c,l,i]),h=Vs(async()=>{if(!d)return;if(d.selectable){await r.select(d.id);return}let m=await r.checkout(d.id);window.location.assign(m)},[d,r]),b=a.open,y=Vs(()=>{c&&b(c)},[b,c]);return Qs(()=>{if(!c)return null;let m=i?sn({unit:i.unit,reward:i.connected_reward,includedUnits:i.connected_included_units,creditMicros:i.connected_credit*1e6}):null,v=i?an(i.connected_reward)?m:Un({unit:i.unit,ownUnit:i.own_unit??null,includedUnits:i.included_units,ownIncludedUnits:i.own_included_units??null,routePrefer:i.route_prefer}):null;return{reason:c,...kl(c,{connectOffer:v,connected:o.connected,online:o.online,machine:In(o.machines)?.label??null,unit:i?.unit??"message",interval:i?.interval??"month",upgrade:d!==null,resets:r.current?.period_end??null}),connectOffer:v,upgradeTo:d,connect:y,upgrade:h}},[c,i,o,d,y,h,r.current?.period_end])}function yl(e){let n=Vn(e);return n==="payment_required"||n==="no_compute"?n:null}function wl(e,n){return e==="no_compute"&&n.connected&&n.online?null:e}function vl(e,n){let t=e.plan;return!t||n.loading?null:Ve(t.route_allow)&&!n.online?"no_compute":e.remaining===0&&t.overage==="stop"?"payment_required":null}function kl(e,n){if(e==="payment_required"){let t=`No ${Lt(n.unit)} left this ${n.interval}`;return n.connectOffer&&!n.connected?{title:t,body:`${n.connectOffer}. Connecting takes a minute and costs nothing.`}:n.connectOffer&&!n.online?{title:t,body:`${n.connectOffer}. Waking ${n.machine??"your machine"} is enough.`}:n.upgrade?{title:t,body:n.resets?`A larger plan carries on now. This one comes back on ${Ys(n.resets)}.`:"A larger plan carries on now, or wait for this one to renew."}:{title:t,body:n.resets?`Your allowance comes back on ${Ys(n.resets)}.`:"Your allowance comes back at the start of the next period."}}return n.connected&&!n.online?{title:`${n.machine??"Your machine"} can't be reached`,body:"This run needs it awake and connected. Open Soba on that machine, or connect another one."}:{title:"Nothing connected yet",body:"This app runs on AI you already pay for, on a machine of your own. Connect one and this run has somewhere to go."}}function Ys(e){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function Cl(e){let{plan:n,allowance:t,connected:r,online:o,quiet:a,error:s,predict:c,at:i,waved:l}=e;if(!n)return null;let d=e.allow!==void 0?e.allow:n.route_allow;if(r){if(o)return null;let v=Ve(d);return{reason:"stalled",title:`${a??"Your machine"} can\u2019t be reached`,detail:v?"The Soba app there has stopped reporting in, so runs have nowhere to go until it is back.":"The Soba app there has stopped reporting in, so nothing will run on your own AI until it is back.",meter:null,dismissible:!1,atTheWall:!1,ownCompute:v}}let h=Vn(s),b=h==="payment_required"||h==="no_compute",y=n.ask_to_connect!==!1&&Ro(n.route_prefer,d);if(!c&&!b&&!y)return null;let m=Ve(d)?Ml(n.unit,Ve(n.route_allow)):an(n.connected_reward)||Zs(n,t.included)!==null?xl(t,n,i):y?Nl(n.unit):null;return!m||m.dismissible&&l?null:{...m,dismissible:!!m.dismissible,ownCompute:!1,atTheWall:!m.dismissible&&(!c||m.meter!==null&&m.meter.left===0)}}function zo(e={}){let{at:n=.25,error:t,allow:r}=e,o=e.predict??!(e.errorGiven??t!==void 0),{plan:a,compute:s,connect:c}=K(),i=so(c.publishableKey),[l,d]=qs(!1);js(()=>{d(ao(i))},[i]);let h=Fo(()=>{d(!0),io(i)},[i]),b=Fo(()=>c.open("manual"),[c]),y=Fo(()=>c.open("no_compute"),[c]),m=Dt(),[v,A]=qs(!1),{refresh:k}=s,{launch:S}=m;js(()=>{if(S===null||S==="absent")return;A(!1);let U=setInterval(()=>void k(),3e3),w=setTimeout(()=>{clearInterval(U),A(!0)},2e4);return()=>{clearInterval(U),clearTimeout(w)}},[S,k]);let W=Sl(c.app?.name,St(c.connectUrl)),L=a.loading||s.loading,D=In(s.machines),O=L?null:Cl({plan:a.plan,allowance:{remaining:a.remaining,included:a.included},connected:s.connected,online:s.online,quiet:D?le(D):null,error:t,predict:o,...r!==void 0?{allow:r}:{},at:n,waved:l});return{reason:O?.reason??null,visible:O!==null,title:O?.title??null,detail:O?.detail??null,meter:O?.meter??null,dismissible:O?.dismissible??!1,dismissed:l,dismiss:h,open:b,atTheWall:O?.atTheWall??!1,steps:W,stalled:O?.reason==="stalled"?{machine:D?le(D):null,ownCompute:O.ownCompute,wake:m.open,launch:m.launch,note:m.note,stuck:v,connectAnother:y}:null,loading:L}}function Ml(e,n){return{reason:"needed",title:n?"This plan runs on your own AI.":`These ${e}s run on your own AI.`,detail:`Connect a machine and your ${e}s run there, free, on access you already have.`,meter:null}}function Nl(e){return{reason:"preferred",title:"This plan prefers your own AI.",detail:`Connect a machine and your ${e}s run there instead, on access you already have.`,meter:null,dismissible:!0}}function Zs(e,n){return Un({unit:e.unit,ownUnit:e.own_unit??null,includedUnits:n,ownIncludedUnits:e.own_included_units??null,routePrefer:e.route_prefer})}function xl(e,n,t){let{remaining:r,included:o}=e;if(r===null||o===null||o===0||r>Math.ceil(o*t))return null;let a=sn({unit:n.unit,reward:n.connected_reward,includedUnits:n.connected_included_units,creditMicros:n.connected_credit*1e6})??Zs(n,o);return a?{reason:"running",title:r===0?`No ${Lt(n.unit)} left this month.`:`${Oe(n.unit,r)} left this month.`,detail:`${a}.`,meter:{left:r,of:o}}:null}function Sl(e,n){return[{lead:"Download Soba",detail:"",...n?{linksLead:"Get it for"}:{},links:n?xt.map(t=>({label:t.label,href:`${n}/download/${t.slug}`})):[]},{lead:"Connect compute",detail:"Press this, then approve the pairing when the app asks.",opens:!0,links:[]},{lead:"Let your AIs serve",detail:`It finds what is installed on that machine. Allow one, and ${e??"this app"} sends every run there.`,linksLead:"Nothing on it yet?",links:Ie.map(t=>({label:t.short,href:t.install}))}]}import{Fragment as Ks,jsx as re,jsxs as vn}from"react/jsx-runtime";function El(e){let{className:n,fallback:t=null}=e,r=zo({...e.at===void 0?{}:{at:e.at},...e.predict===void 0?{}:{predict:e.predict},...e.allow===void 0?{}:{allow:e.allow},error:e.error,errorGiven:"error"in e}),{connect:o}=K(),{theme:a}=_(),[s,c]=Pl(null),i=Rl(),l=re(Ks,{children:t});if(!r.visible)return l;if(r.stalled)return re(Xs,{className:n,theme:a,stalled:!0,children:re(Il,{title:r.title??"",detail:r.detail??"",stalled:r.stalled})});let d=s??r.atTheWall;return vn(Xs,{className:n,theme:a,children:[vn("div",{className:"sc-nudge-top",children:[vn("div",{className:"sc-nudge-say",children:[re("p",{className:"sc-nudge-title",children:r.title}),re("p",{className:"sc-nudge-detail",children:r.detail}),vn("button",{type:"button",className:"sc-btn sc-btn-quiet sc-nudge-more","aria-expanded":d,"aria-controls":i,onClick:()=>c(!d),children:[d?"Hide the details":"How it works",re(Ol,{})]})]}),r.dismissible?re("button",{type:"button",className:"sc-nudge-dismiss","aria-label":"Dismiss",title:"Dismiss",onClick:r.dismiss,children:re(Ll,{})}):null]}),d?re("ol",{className:"sc-nudge-steps",id:i,children:r.steps.map(h=>vn("li",{children:[h.opens?re("button",{type:"button",className:"sc-step-lead",onClick:()=>o.open("manual"),children:h.lead}):re("strong",{children:h.lead}),h.detail?re("span",{children:h.detail}):null,h.links.length>0?vn("span",{className:"sc-step-links",children:[h.linksLead,h.links.map(b=>re("a",{href:b.href,target:"_blank",rel:"noreferrer noopener",children:b.label},b.href))]}):null]},h.lead))}):null,re(zn,{variant:"primary"})]})}function Xs({className:e,theme:n,stalled:t,children:r}){return re("div",{className:e?`soba-connect sc-fill ${e}`:"soba-connect sc-fill","data-theme":n,children:re("div",{className:t?"sc-nudge sc-nudge-stalled":"sc-nudge",children:r})})}function Il({title:e,detail:n,stalled:t}){return vn(Ks,{children:[re("div",{className:"sc-nudge-top",children:vn("div",{className:"sc-nudge-say",children:[re("p",{className:"sc-nudge-title",children:e}),re("p",{className:"sc-nudge-detail",children:n}),t.note&&re("p",{className:"sc-nudge-note",children:t.note}),t.stuck&&re("p",{className:"sc-nudge-note",children:"The Soba app is open, but this machine still isn\u2019t reporting in. It may no longer be connected to this app."}),(t.launch==="absent"||t.stuck)&&re("button",{type:"button",className:"sc-btn sc-btn-quiet sc-nudge-more",onClick:t.connectAnother,children:t.stuck?"Connect it again":"Connect another machine"})]})}),re("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:t.wake,children:"Open Soba"})]})}function Ll(){return re("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",className:"sc-nudge-x",children:re("path",{d:"m4.8 4.8 6.4 6.4M11.2 4.8l-6.4 6.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})}function Ol(){return re("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",className:"sc-nudge-chev",children:re("path",{d:"M4.5 6.5 8 10l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}var Tl=new Set(["delta","thinking","status","done","error"]);function lt(e){let n;try{n=JSON.parse(e)}catch{return null}if(!n||typeof n!="object")return null;let t=n,r=t.type==="event"?t.event:t;if(!r||typeof r!="object")return null;let o=r;if(typeof o.type!="string"||!Tl.has(o.type))return null;let a={type:o.type};return typeof o.text=="string"&&(a.text=o.text),typeof o.message=="string"&&(a.message=o.message),typeof o.tool=="string"&&(a.tool=o.tool),typeof o.tier=="string"&&(a.tier=o.tier),o.usage&&typeof o.usage=="object"&&(a.usage=o.usage),typeof o.session=="string"&&(a.session=o.session),typeof o.toolInput=="string"&&(a.toolInput=o.toolInput),o.git&&typeof o.git=="object"&&(a.git=o.git),o.turn&&typeof o.turn=="object"&&typeof o.turn.text=="string"&&(a.turn={text:o.turn.text}),typeof o.reason=="string"&&(a.reason=o.reason),typeof o.retryable=="boolean"&&(a.retryable=o.retryable),(o.state==="interrupted"||o.state==="resumed")&&(a.state=o.state),a}async function*Vo(e){let n=e.body;if(!n)throw new Error("That run response had no body to stream.");let t=(e.headers.get("content-type")??"").includes("ndjson"),r=n.getReader(),o=new TextDecoder,a="",s=[];try{for(;;){let i=await r.read();if(i.done)break;for(a+=o.decode(i.value,{stream:!0});;){let l=a.indexOf(`
3
- `);if(l===-1)break;let d=$s(a.slice(0,l));if(a=a.slice(l+1),t){let h=d.trim()?lt(d):null;h&&(yield h);continue}if(d===""){let h=s.join(`
4
- `);if(s=[],h==="[DONE]")return;let b=h?lt(h):null;b&&(yield b);continue}_s(d,s)}}!t&&a&&_s($s(a),s);let c=t?a.trim():s.join(`
5
- `);if(c&&c!=="[DONE]"){let i=lt(c);i&&(yield i)}}finally{r.cancel().catch(()=>{})}}function _s(e,n){if(!e||e.startsWith(":"))return;let t=e.indexOf(":");if(t===-1||e.slice(0,t)!=="data")return;let r=e.slice(t+1);n.push(r.startsWith(" ")?r.slice(1):r)}function $s(e){return e.endsWith("\r")?e.slice(0,-1):e}async function Bl(e){let n="";for await(let t of e)if(t.type==="delta"&&t.text&&(n+=t.text),t.type==="error")throw new Error(t.message??"The run ended with an error.");return n}import{jsx as ea}from"react/jsx-runtime";function Gl({caption:e,disabled:n,className:t,...r}){let{theme:o}=_(),{options:a,selected:s,select:c,pickable:i,layout:l,ownInList:d,search:h}=Fn(r),b=K().connect.app;return i?ea("span",{className:"soba-connect sc-inline","data-theme":o,children:ea(Mt,{options:a,layout:l,ownInList:d,search:h,selected:s,onPick:c,...b?.name?{appName:b.name}:{},...e?{caption:e}:{},...n?{disabled:n}:{},...t?{className:t}:{}})}):null}import{jsx as Dl}from"react/jsx-runtime";function Wl(e){return Dl(Bn,{...e})}import{useState as Ul}from"react";import{useCallback as Hl,useState as Qo}from"react";function Jo(){let e=wn(),{plan:n}=K(),[t,r]=Qo(!1),[o,a]=Qo(null),[s,c]=Qo(null);return{redeem:Hl(async l=>{if(!e)return a("No session yet."),null;r(!0),a(null);try{let{reward:d}=await e.redeemCode(l);return c(d),await n.refresh(),d}catch(d){return a(d.message),null}finally{r(!1)}},[e,n]),busy:t,error:o,reward:s}}import{jsx as hr,jsxs as na}from"react/jsx-runtime";function Fl(e){return e.kind==="discount"?`${e.name} applied. It comes off at checkout.`:e.kind==="grant"?`${e.name} applied. The extra usage is yours now.`:`${e.name} applied. You're on it now.`}function zl({label:e="Apply",placeholder:n="Promo code",onRedeemed:t,className:r}){let{theme:o}=_(),{redeem:a,busy:s,error:c,reward:i}=Jo(),[l,d]=Ul(""),h=async()=>{if(!l.trim()||s)return;let b=await a(l);b&&(d(""),t?.(b))};return na("div",{className:r?`soba-connect ${r}`:"soba-connect","data-theme":o,children:[na("form",{className:"sc-redeem",onSubmit:b=>{b.preventDefault(),h()},children:[hr("input",{className:"sc-input",value:l,onChange:b=>d(b.target.value),placeholder:n,"aria-label":n,autoComplete:"off",spellCheck:!1}),hr("button",{type:"submit",className:"sc-btn sc-btn-primary",disabled:s||!l.trim(),children:s?"Checking\u2026":e})]}),c&&hr("p",{className:"sc-error",children:c}),!c&&i&&hr("p",{className:"sc-note",children:Fl(i)})]})}import{useEffect as Vl}from"react";var ta="data-soba-react",ra=!1;function Ht(){if(ra||typeof document>"u"||(ra=!0,document.querySelector(`style[${ta}]`)))return;let e=document.createElement("style");e.setAttribute(ta,""),e.textContent=`.soba-connect {
2
+ var kr={ready:{arc:!0},serving:{arc:!0,slot:"stream"},paused:{arc:!1,slot:"zzz"},thinking:{arc:!1,slot:"dots"},connecting:{arc:!1,slot:"orbit"},attention:{arc:!1,slot:"bang"},gone:{arc:!1,slot:"cross"},snap:{arc:!1,slot:"snap"},listening:{arc:!1,slot:"bars"},permission:{arc:!1,slot:"ring"},ai:{arc:!1,slot:"sparks"}};var Cr="105 162 420 420",Mr="M407.1 308.9 A158 158 0 1 0 407.1 491.1 A116 116 0 0 1 407.1 308.9 Z",Pn="M448.5 320 A110 110 0 0 1 448.5 480";import{Fragment as pt,jsx as z,jsxs as gn}from"react/jsx-runtime";function fn({kind:e,size:n=44,className:t}){let r=kr[e];return gn("svg",{className:`bx${t?` ${t}`:""}`,"data-expression":e,viewBox:Cr,overflow:"visible",width:n,height:n,"aria-hidden":"true",children:[z("path",{d:Mr,fill:"currentColor"}),z("path",{className:"bx-arc",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"}),r.slot==="stream"&&z(Oa,{}),r.slot==="zzz"&&z(Ta,{}),r.slot==="dots"&&z(Ba,{}),r.slot==="bang"&&z(Ga,{}),r.slot==="orbit"&&z(Wa,{}),r.slot==="cross"&&z(Da,{}),r.slot==="snap"&&z(Ha,{}),r.slot==="bars"&&z(Ua,{}),r.slot==="ring"&&z(Fa,{}),r.slot==="sparks"&&z(za,{})]})}function Oa(){return z("path",{className:"bx-st",d:"M475.3 290.3 A150 150 0 0 1 475.3 509.7",fill:"none",stroke:"currentColor",strokeWidth:"15",strokeLinecap:"round",strokeDasharray:"0.1 31"})}function Ta(){return gn(pt,{children:[z("g",{className:"bx-z1",children:z("path",{d:"M444 372 H496 L444 436 H496",fill:"none",stroke:"currentColor",strokeWidth:"20",strokeLinecap:"round",strokeLinejoin:"round"})}),z("g",{className:"bx-z2",children:z("path",{d:"M492 300 H522 L492 338 H522",fill:"none",stroke:"currentColor",strokeWidth:"15",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function Ba(){return gn(pt,{children:[z("circle",{className:"bx-th",cx:"463.1",cy:"336.9",r:"21",fill:"currentColor"}),z("circle",{className:"bx-th bx-th2",cx:"483",cy:"400",r:"21",fill:"currentColor"}),z("circle",{className:"bx-th bx-th3",cx:"463.1",cy:"463.1",r:"21",fill:"currentColor"})]})}function Ga(){return gn("g",{className:"bx-at",children:[z("line",{x1:"490",y1:"312",x2:"490",y2:"414",stroke:"currentColor",strokeWidth:"46",strokeLinecap:"round"}),z("circle",{cx:"490",cy:"484",r:"28",fill:"currentColor"})]})}function Wa(){return gn("g",{className:"bx-ob",children:[z("path",{d:Pn,fill:"none",stroke:"var(--tile-bg, transparent)",strokeWidth:41,strokeLinecap:"round"}),z("path",{d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"})]})}function Da(){return gn(pt,{children:[z("path",{className:"bx-xa",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"}),z("g",{className:"bx-xx",children:z("path",{d:"M442 364 L514 436 M514 364 L442 436",fill:"none",stroke:"currentColor",strokeWidth:"24",strokeLinecap:"round"})})]})}function Ha(){return z("path",{className:"bx-snap",d:Pn,fill:"none",stroke:"currentColor",strokeWidth:17,strokeLinecap:"round"})}function Ua(){return gn("g",{stroke:"currentColor",strokeWidth:"17",strokeLinecap:"round",children:[z("line",{className:"bx-vb",x1:"452",y1:"370",x2:"452",y2:"430"}),z("line",{className:"bx-vb bx-vb2",x1:"482",y1:"330",x2:"482",y2:"470"}),z("line",{className:"bx-vb bx-vb3",x1:"512",y1:"355",x2:"512",y2:"445"})]})}function Fa(){return z(pt,{children:[[450,366],[474,376],[484,400],[474,424],[450,434],[426,424],[416,400],[426,376]].map(([n,t],r)=>z("circle",{className:"bx-w",cx:n,cy:t,r:"11",fill:"currentColor",style:{animationDelay:`${-1.2+r*.15}s`}},r))})}function za(){return gn(pt,{children:[z("g",{className:"bx-sp",children:z("path",{d:"M460 300 Q465.4 324.6 490 330 Q465.4 335.4 460 360 Q454.6 335.4 430 330 Q454.6 324.6 460 300 Z",fill:"currentColor"})}),z("g",{className:"bx-sp bx-sp2",children:z("path",{d:"M486 356 Q493.92 392.08 530 400 Q493.92 407.92 486 444 Q478.08 407.92 442 400 Q478.08 392.08 486 356 Z",fill:"currentColor"})}),z("g",{className:"bx-sp bx-sp3",children:z("path",{d:"M460 440 Q465.4 464.6 490 470 Q465.4 475.4 460 500 Q454.6 475.4 430 470 Q454.6 464.6 460 440 Z",fill:"currentColor"})})]})}var cs={"claude-code":{small:"haiku",large:"opus"}};function us(e){return e==="small"||e==="large"}function ds(e,n){return cs[e]?.[n]}function Xt(e){let n=cs[e];return!!(n?.small||n?.large)}var mu=512*1024;import{useEffect as Ms,useRef as yi,useState as Kn}from"react";var jn=class extends Error{status;constructor(n,t){super(n),this.name="ConnectError",this.status=t}},Va=5*6e4,mt=class{session;baseUrl;doFetch;lastMachines=null;lastModelOptions=null;machinesUrl=null;gatewayBackUntil=0;constructor(n){this.session=n.session,this.baseUrl=(n.baseUrl??"").replace(/\/+$/,""),this.doFetch=n.fetchImpl??fetch.bind(globalThis)}async context(){let n=await this.request("GET","/v1/connect");return this.setMachinesUrl(n.machines_url),n}setMachinesUrl(n){typeof n=="string"&&/^https?:\/\//.test(n)&&(this.machinesUrl=n)}async machines(){let n=this.lastMachines,t=n?`?v=${encodeURIComponent(n.version)}`:"",r;if(this.machinesUrl&&Date.now()>=this.gatewayBackUntil)try{r=await this.request("GET",`${this.machinesUrl}${t}`)}catch(a){if(a instanceof jn&&a.status===401)throw a;this.gatewayBackUntil=Date.now()+Va}if(r??=await this.request("GET",`/v1/machines${t}`),r.unchanged&&n)return n.machines;let o=Array.isArray(r.machines)?r.machines:[];return this.lastMachines=typeof r.version=="string"?{version:r.version,machines:o}:null,o}async modelOptions(){let n=this.machinesUrl?.replace(/\/v1\/machines$/,"");if(!n)return null;let t=this.lastModelOptions,r=t?`?v=${encodeURIComponent(t.version)}`:"",o=await this.request("GET",`${n}/v1/model-options${r}`);if(o.unchanged&&t)return t.options;let a={route:o.route??{allow:[],prefer:[]},providers:Array.isArray(o.providers)?o.providers:[],names:Array.isArray(o.names)?o.names:[],layout:o.layout??"providers"};return this.lastModelOptions=typeof o.version=="string"?{version:o.version,options:a}:null,a}async runs(){let n=await this.request("GET","/v1/machines/runs");return Array.isArray(n.runs)?n.runs:[]}async stopRun(n){let t=this.machinesUrl?.replace(/\/v1\/machines$/,"");if(!t)throw new jn("This page can't stop runs yet: it hasn't been told where Soba's gateway is.",501);await this.request("POST",`${t}/v1/runs/${encodeURIComponent(n)}/stop`,{})}lookup(n){return this.request("GET",`/v1/device/lookup?code=${encodeURIComponent(n)}`)}approve(n){return this.request("POST","/v1/device/approve",{user_code:n})}claim(n){return this.request("POST","/v1/device/claim",{pairing_nonce:n})}deny(n){return this.request("POST","/v1/device/deny",{user_code:n})}plans(){return this.request("GET","/v1/plans")}selectPlan(n){return this.request("POST","/v1/plans/select",{plan:n})}checkoutPlan(n,t){return this.request("POST","/v1/plans/checkout",{plan:n,...t?.successUrl?{success_url:t.successUrl}:{},...t?.cancelUrl?{cancel_url:t.cancelUrl}:{}})}redeemCode(n){return this.request("POST","/v1/rewards/redeem",{code:n})}leavePlan(){return this.request("DELETE","/v1/plans/select")}hosted(){return this.request("GET","/v1/hosted")}startHosted(){return this.request("POST","/v1/hosted/start")}disconnectHosted(n){return this.request("DELETE",n?`/v1/hosted?provider=${encodeURIComponent(n)}`:"/v1/hosted")}approveRuntime(n,t){return this.request("POST","/v1/runtimes/approve",{machine_id:n,runtime_id:t})}preferRuntime(n,t){return this.request("POST","/v1/runtimes/prefer",{machine_id:n,runtime_id:t})}async request(n,t,r){let o=await this.doFetch(/^https?:\/\//.test(t)?t:`${this.baseUrl}${t}`,{method:n,headers:{authorization:`Bearer ${this.session}`,...r?{"content-type":"application/json"}:{}},...r?{body:JSON.stringify(r)}:{}}),a={};try{a=await o.json()}catch{}if(!o.ok){let s=typeof a.error=="string"?a.error:`Request failed (${o.status})`;throw new jn(s,o.status)}return a}};function ft(e){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n?.[1])return"#ffffff";let t=n[1].length===3?[...n[1]].map(a=>a+a).join(""):n[1],r=a=>{let s=Number.parseInt(t.slice(a*2,a*2+2),16)/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(1)+.0722*r(2)>.45?"#101012":"#ffffff"}function Nr(e){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!n?.[1])return null;let t=n[1].length===3?[...n[1]].map(r=>r+r).join(""):n[1];return[0,1,2].map(r=>Number.parseInt(t.slice(r*2,r*2+2),16))}function Yn(e,n,t){let r=Nr(e),o=Nr(n);return!r||!o?e:`#${r.map((s,c)=>Math.round(s+(o[c]-s)*t)).map(s=>s.toString(16).padStart(2,"0")).join("")}`}function En(e,n){if(!Nr(e))return{};let t=ft(e),r=n?.trim();return{"--sc-ground":e,"--sc-shell":e,"--sc-sheet":Yn(e,t,.07),"--sc-raised":Yn(e,t,.13),"--sc-line":Yn(e,t,.18),"--sc-line-2":Yn(e,t,.28),"--sc-text":t,"--sc-text-2":Yn(t,e,.15),"--sc-muted":Yn(t,e,.38),...r?{"--sc-accent":r,"--sc-accent-fg":ft(r)}:{"--sc-accent":t,"--sc-accent-fg":e}}}function _e(e){return e.authenticated===!0?{tone:"ok",text:"signed in"}:e.authenticated===!1?{tone:"warn",text:e.auth_hint??"signed out on that machine"}:{tone:"unknown",text:"could not tell"}}function gt(e){let{platform:n,arch:t}=e;if(!n)return null;let r=n==="darwin"||n==="macos",o=r?"Mac":n==="win32"||n==="windows"?"Windows PC":"Linux machine";return r?`${t==="aarch64"||t==="arm64"?"Apple silicon ":""}${o}`:o}function In(e){return e.find(n=>n.state==="offline")??null}function xr(e){return e.state==="busy"?{tone:"busy",text:`serving ${e.active} of ${e.capacity}`}:e.state==="online"?{tone:"ok",text:"connected"}:{tone:"off",text:"asleep or offline"}}function ce(e){let n=e.label?.trim(),t=e.name?.trim();return n&&(!t||n!==t)?n:(t??n??"").replace(/\.(local|lan|home|internal)$/i,"").replace(/[-_]+/g," ").trim()||n||"This machine"}function qn(e,n){let t=o=>o.state==="busy"?0:o.state==="online"?1:2,r=o=>o.last_seen_at?Date.parse(o.last_seen_at):0;return t(e)-t(n)||r(n)-r(e)}function $e(e){return[...e].sort(qn)[0]??null}function Ln(e){return e?e.state==="busy"?{tone:"busy",word:"Serving"}:e.state==="online"?{tone:"ok",word:"Connected"}:e.pairing_lost?{tone:"off",word:"Not connected"}:{tone:"off",word:"Asleep"}:{tone:"off",word:"No compute"}}function Zn(e){let n=Ln(e);return{label:e?n.word:"Connect compute",ariaLabel:e?e.pairing_lost?`${ce(e)} is not connected`:`${n.word} on ${ce(e)}`:"Connect compute",connected:e!==null,state:n}}function an(e){return e.state==="online"||e.state==="busy"}function ht(e){if(!e)return"never seen";let n=Date.parse(e);if(Number.isNaN(n))return"never seen";let t=Date.now()-n,r=6e4;return t<2*r?"just now":t<60*r?`${Math.floor(t/r)} min ago`:t<24*60*r?`${Math.floor(t/(60*r))} hr ago`:`${Math.floor(t/(24*60*r))} days ago`}function Sr(e){return e.runtimes.filter(n=>n.id!=="shell")}function ve(e){return e.runtimes.filter(n=>n.id!=="shell"&&!n.quarantined&&!n.absent)}function Je(e){let n=s=>s?e.runtimes.find(c=>c.id===s)??null:null;if(e.requested_runtime)return{by:"app",runtimeId:e.requested_runtime,runtime:n(e.requested_runtime)};let t=ve(e),r=t.find(s=>s.id===e.preferred_runtime);if(r)return{by:"you",runtimeId:r.id,runtime:r};let o=s=>s.id==="claude-code"?0:s.id==="codex"?1:2,a=[...t].sort((s,c)=>o(s)-o(c))[0]??null;return{by:"default",runtimeId:a?.id??null,runtime:a}}var Rr="soba";function On(){return`${Rr}://show`}function bt(e,n,t){let r=`${Rr}://connect?url=${encodeURIComponent(e)}`;return n&&(r+=`&nonce=${encodeURIComponent(n)}`),t&&(r+=`&want=${encodeURIComponent(t)}`),r}function At(){let e=globalThis.crypto;if(!e?.getRandomValues)return null;let n=e.getRandomValues(new Uint8Array(32)),t="";for(let r of n)t+=String.fromCharCode(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Qa=1600;function Pr(e={}){return Ir(e)}async function Er(e,n={}){if(typeof window>"u"||typeof document>"u")return"unknown";let t=Ir(n);try{window.location.href=bt(e,n.nonce,n.want)}catch{return"absent"}return t}async function Tn(e={}){if(typeof window>"u"||typeof document>"u")return"unknown";let n=Ir(e);try{window.location.href=On()}catch{return"absent"}return n}async function Ir(e){if(typeof window>"u"||typeof document>"u")return"unknown";let n=e.graceMs??Qa,t=document.visibilityState==="visible"&&document.hasFocus(),r=!1,o=()=>{r=!0},a=()=>{document.visibilityState==="hidden"&&(r=!0)};return window.addEventListener("blur",o),window.addEventListener("pagehide",o),document.addEventListener("visibilitychange",a),await new Promise(s=>setTimeout(s,n)),window.removeEventListener("blur",o),window.removeEventListener("pagehide",o),document.removeEventListener("visibilitychange",a),t?r?"opened":"absent":"unknown"}var en={"claude-code":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAg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MJ6ktMo+EciiobYAFJqDE4zPhtDRKVwF5DSuQcnOKR2AP8Cui93e4Bz9uMXV0/FBGGZ/BaqmGMFGWMFNw7QyOZML4XaHNc3OnIDZkE7cOUzf5QfCGN8C6GkgqwSeXP8HIxHP4MmOI/a321n07gV9IjNBy7QnyZrED37ivv4/PQyO8w10e8KcphEWKSNuIPY8QfKrR4Ye+yCnB3kPeGZiJkLwBzq+EZK2GxGe7nRW12PSGeADM/EmtjG4qej4OQ90YuRN/rYcWzMU8ZPuWbyCHPgbYT3vQ4Pp0/OM7QYx6VGXgMbdGN/AVNIT3cAadkl50K7+QtmgFGBskwuuGBL+EfnaxNQFH3ihDqM12j6lTyyVn4H4E6hAx4NkYwy1G0DlAmsUN8ESX6/+H/GpiUBv4FSyLhydRRp0cAAAAASUVORK5CYII="};import{useEffect as ps,useRef as Ja}from"react";import{Fragment as ja,jsx as He,jsxs as Lr}from"react/jsx-runtime";function Or({anchor:e,label:n,options:t,current:r,onClose:o,onPick:a}){let s=Ja(null);return ps(()=>{let i=s.current,l=e.current;if(!i||!l)return;try{typeof i.showPopover=="function"&&i.showPopover()}catch{}let d=l.getBoundingClientRect();d.width>i.offsetWidth&&(i.style.width=`${Math.round(d.width)}px`);let f=i.offsetWidth,h=i.offsetHeight,A=d.width>248?d.left:d.right-f,p=Math.max(8,Math.min(A,window.innerWidth-f-8)),w=d.bottom+6,b=w+h>window.innerHeight-8&&d.top-6-h>8?d.top-6-h:w;i.style.left=`${Math.round(p)}px`,i.style.top=`${Math.round(b)}px`,i.querySelector('[aria-checked="true"]')?.focus()},[e]),ps(()=>{let i=l=>{let d=l.target;!d||s.current?.contains(d)||e.current?.contains(d)||o()};return document.addEventListener("pointerdown",i,!0),()=>document.removeEventListener("pointerdown",i,!0)},[e,o]),He("div",{ref:s,role:"menu","aria-label":n,className:"sc-menu",popover:"manual",onKeyDown:i=>{let l=[...s.current?.querySelectorAll("[role=menuitemradio]")??[]],d=l.indexOf(document.activeElement);if(i.key==="Escape")i.stopPropagation(),i.nativeEvent.stopImmediatePropagation(),o(),e.current?.focus();else if(i.key==="ArrowDown"||i.key==="ArrowUp"){i.preventDefault();let f=i.key==="ArrowDown"?1:-1;l[(d+f+l.length)%l.length]?.focus()}else i.key==="Tab"&&o()},children:t.map(i=>He(Ya,{option:i,checked:r===i.id,onClose:o,onPick:a},i.id??""))})}function Ya({option:e,checked:n,onClose:t,onPick:r}){return Lr(ja,{children:[e.heading?He("div",{className:"sc-menu-head",role:"presentation",children:e.heading}):e.rule?He("div",{className:"sc-menu-sep"}):null,Lr("button",{type:"button",role:"menuitemradio","aria-checked":n,className:"sc-menu-item",onClick:()=>{e.onChoose?(e.onChoose(),t()):n?t():r(e.id)},children:[e.glyph,Lr("span",{className:"sc-menu-text",children:[He("span",{className:"sc-menu-label",children:e.label}),e.note&&He("span",{className:"sc-menu-note",children:e.note})]}),e.trailing?He("span",{className:"sc-menu-act",children:e.trailing}):n&&He(Tr,{})]})]})}function Tr(){return He("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-menu-check",children:He("path",{d:"M5 12.5l4.5 4.5L19 7.5",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function hn({open:e}){return He("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e?"sc-chev sc-chev-open":"sc-chev",children:He("path",{d:"M9 6l6 6-6 6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}import{useEffect as Kt,useId as Xa,useLayoutEffect as Ka,useMemo as _t,useRef as vt,useState as kt}from"react";var ms={haiku:"Haiku",sonnet:"Sonnet",opus:"Opus",fable:"Fable"};function nn(e){return ms[e]??e}function yt(e,n=[],t=[],r){let o=b=>!r||r.includes(b.cost_class),a=[...e].sort(qn),s=$e([...e]),c=s?Je(s):null,l=[{id:"auto",kind:"auto",label:"Automatic",model:"auto",...c?.runtime?{note:c.runtime.default_model?`Uses ${nn(c.runtime.default_model)}`:`Uses ${c.runtime.display_name}`}:{}}];a.some(b=>ve(b).some(C=>o(C)&&Xt(C.id)))&&l.push({id:"small",kind:"size",label:"Fast",note:"quick and cheap",model:"small"},{id:"large",kind:"size",label:"Best",note:"the most capable",model:"large"});let f=new Map,A=new Set(a.flatMap(b=>ve(b).filter(o).map(C=>C.id))).size>1||n.some(b=>b.models.length>0);for(let b of a)for(let C of ve(b))if(o(C)){!C.models.some(Boolean)&&A&&!f.has(`${C.id}/auto`)?f.set(`${C.id}/auto`,{option:{id:`${C.id}/auto`,kind:"named",label:C.display_name,note:C.default_model?`Uses ${nn(C.default_model)}`:"its default model",model:"auto",runtime:C.id,runtimeName:C.display_name,costClass:C.cost_class},machines:new Set([ce(b)])}):f.has(`${C.id}/auto`)&&f.get(`${C.id}/auto`)?.machines.add(ce(b));for(let S of C.models){if(!S)continue;let W=`${C.id}/${S}`,O=f.get(W);if(O){O.machines.add(ce(b));continue}f.set(W,{option:{id:W,kind:"named",label:nn(S),model:S,runtime:C.id,runtimeName:C.display_name,costClass:C.cost_class},machines:new Set([ce(b)])})}}let p=new Set;for(let{machines:b}of f.values())for(let C of b)p.add(C);let w=p.size>1;for(let{option:b,machines:C}of f.values()){let S=w&&C.size===1?[...C][0]:void 0;l.push(S?{...b,machine:S}:b)}for(let b of n)for(let{model:C}of b.models)C&&l.push({id:`@${b.id}/${C}`,kind:"provider",label:C,model:C,costClass:b.cost_class,providerId:b.id,providerName:b.name,...b.provider?{providerMark:b.provider}:{},...b.locked?{locked:b.locked}:{}});for(let b of t)!b.alias||!b.cost_classes.length||l.push({id:`alias:${b.alias}`,kind:"provider",label:b.label,...b.note?{note:b.note}:{},...b.icon?{icon:b.icon}:{},model:b.alias,costClass:b.cost_classes[0],costClasses:b.cost_classes,...b.provider?{providerMark:b.provider}:{},...b.locked?{locked:b.locked}:{},choice:b.alias});return l}function fs(e,n){let t=[];for(let r of n){let o=r.provider?.toLowerCase(),a=e.filter(l=>l.model!==r.model?!1:r.runtime?l.kind==="named"&&l.runtime===r.runtime:l.kind!=="provider"?!1:!o||l.providerMark===o||l.providerId?.toLowerCase()===o||l.providerName?.toLowerCase()===o),s=a.find(l=>!l.locked)??a[0];if(!s)continue;let{machine:c,...i}=s;t.push({...i,id:`choice:${r.id}`,label:r.label,...r.note?{note:r.note}:{},choice:r.id})}return t}function Br(e,n,t=[]){if(n==="automatic")return e.filter(c=>c.kind==="auto"||c.kind==="size");if(n!=="choices")return[...e];let r=e.filter(c=>c.choice),o=fs(e.filter(c=>!c.choice),t),a=e.filter(c=>c.kind!=="provider");return[...a.filter(c=>c.kind==="auto"||c.kind==="size"),...r,...o,...a.filter(c=>c.kind==="named")]}function Gr(e,n){return e.filter(t=>t.kind!=="size"||(t.model==="small"?n?.fast!==!1:n?.best!==!1))}function Wr(e,n,t){return t?.auto!==!1||n==="automatic"?[...e]:e.filter(r=>r.kind!=="auto")}function wt(e,n="providers",t=!1){let r=[],o=[],a=new Map;for(let s of e){if(s.kind!=="named"&&s.kind!=="provider"||s.choice){r.push(s);continue}if(n==="models"&&(s.kind==="provider"||t)){let l=a.get("@models");if(l)l.options.push(s);else{let d={heading:"Models",options:[s]};a.set("@models",d),o.push(d)}continue}let c=s.runtime??`@${s.providerId}`,i=a.get(c);if(i)i.options.push(s);else{let l={heading:s.runtimeName??s.providerName??s.runtime??"",options:[s]};a.set(c,l),o.push(l)}}for(let s of o)s.options.some(c=>c.model in ms)||s!==a.get("@models")&&s.options.sort((c,i)=>c.label.localeCompare(i.label,void 0,{numeric:!0,sensitivity:"base"}));return r.length?[{heading:null,options:r},...o]:o}function Dr(e,n){let t=e.find(o=>o.kind==="auto")??{id:"auto",kind:"auto",label:"Automatic",model:"auto"};if(!n||n==="auto")return{selected:t,unavailable:null};let r=e.find(o=>o.id===n);return r&&!r.locked?{selected:r,unavailable:null}:{selected:t,unavailable:n}}function Hr(e){return e.kind==="provider"&&e.costClass?{model:e.model,route:{allow:e.costClasses??[e.costClass]}}:e.runtime?{model:e.model,runtime:e.runtime}:{model:e.model}}function bn(e){return e.length>1}var qa={opus:"Most capable. Best for hard, multi-step work.",sonnet:"Balanced speed and quality for everyday runs.",haiku:"Fastest. Best for quick, simple runs."};function Ur(e){if(e.kind==="auto"){let t=e.note?.replace(/^Uses /,"");return t?`Soba picks the model for each run. Currently using ${t}.`:"Soba picks the model for each run."}if(e.kind==="size")return e.id==="small"?"Quick and cheap. Whichever small model the agent serving has.":"The most capable model the agent serving has.";if(e.kind==="provider")return e.locked==="plan"?"Not included in your plan.":e.locked==="allowance"?"Your plan's allowance is used up.":e.providerName?`Through ${e.providerName}. Counts toward your plan.`:void 0;let n=qa[e.model];return n?e.machine?`${n} On ${e.machine}.`:n:e.machine?`On ${e.machine}.`:void 0}var Fr={openai:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"></path>'},anthropic:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path>'},gemini:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="#3186FF"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-0)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-1)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#gemini-soba-pm-gemini-2)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-0" x1="7" x2="11" y1="15.5" y2="12"><stop stop-color="#08B962"></stop><stop offset="1" stop-color="#08B962" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-1" x1="8" x2="11.5" y1="5.5" y2="11"><stop stop-color="#F94543"></stop><stop offset="1" stop-color="#F94543" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="gemini-soba-pm-gemini-2" x1="3.5" x2="17.5" y1="13.5" y2="12"><stop stop-color="#FABC12"></stop><stop offset=".46" stop-color="#FABC12" stop-opacity="0"></stop></linearGradient></defs>'},azure:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M7.242 1.613A1.11 1.11 0 018.295.857h6.977L8.03 22.316a1.11 1.11 0 01-1.052.755h-5.43a1.11 1.11 0 01-1.053-1.466L7.242 1.613z" fill="url(#azure-soba-pm-azure-0)"></path><path d="M18.397 15.296H7.4a.51.51 0 00-.347.882l7.066 6.595c.206.192.477.298.758.298h6.226l-2.706-7.775z" fill="#0078D4"></path><path d="M15.272.857H7.497L0 23.071h7.775l1.596-4.73 5.068 4.73h6.665l-2.707-7.775h-7.998L15.272.857z" fill="url(#azure-soba-pm-azure-1)"></path><path d="M17.193 1.613a1.11 1.11 0 00-1.052-.756h-7.81.035c.477 0 .9.304 1.052.756l6.748 19.992a1.11 1.11 0 01-1.052 1.466h-.12 7.895a1.11 1.11 0 001.052-1.466L17.193 1.613z" fill="url(#azure-soba-pm-azure-2)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-0" x1="8.247" x2="1.002" y1="1.626" y2="23.03"><stop stop-color="#114A8B"></stop><stop offset="1" stop-color="#0669BC"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-1" x1="14.042" x2="12.324" y1="15.302" y2="15.888"><stop stop-opacity=".3"></stop><stop offset=".071" stop-opacity=".2"></stop><stop offset=".321" stop-opacity=".1"></stop><stop offset=".623" stop-opacity=".05"></stop><stop offset="1" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="azure-soba-pm-azure-2" x1="12.841" x2="20.793" y1="1.626" y2="22.814"><stop stop-color="#3CCBF4"></stop><stop offset="1" stop-color="#2892DF"></stop></linearGradient></defs>'},openrouter:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M18.654 3.87a5.087 5.087 0 110 10.174L23.7 19.09c.64.641.187 1.737-.72 1.737H8.48a8.479 8.479 0 010-16.958h10.175zM8.479 7.26a5.087 5.087 0 100 10.176 5.087 5.087 0 000-10.175z"></path>'},groq:{viewBox:"0 0 24 24",mono:!0,svg:'<path d="M12.036 2c-3.853-.035-7 3-7.036 6.781-.035 3.782 3.055 6.872 6.908 6.907h2.42v-2.566h-2.292c-2.407.028-4.38-1.866-4.408-4.23-.029-2.362 1.901-4.298 4.308-4.326h.1c2.407 0 4.358 1.915 4.365 4.278v6.305c0 2.342-1.944 4.25-4.323 4.279a4.375 4.375 0 01-3.033-1.252l-1.851 1.818A7 7 0 0012.029 22h.092c3.803-.056 6.858-3.083 6.879-6.816v-6.5C18.907 4.963 15.817 2 12.036 2z"></path>'},together:{viewBox:"0 0 24 24",mono:!1,svg:'<path d="M23.197 4.503A6 6 0 0015 2.307a5.973 5.973 0 00-2.995 4.933l5.996.008v.515h-5.996c.039.937.298 1.87.8 2.74a6 6 0 1010.39-6z" fill="#EF2CC1"></path><path d="M.805 4.5A6 6 0 003 12.697a5.972 5.972 0 005.77.127L5.779 7.627l.446-.257 2.997 5.192A6 6 0 10.804 4.5z" fill="#CAAEF5"></path><path d="M12 23.894a6 6 0 005.999-6c0-2.13-1.1-3.996-2.775-5.06l-3.005 5.189-.444-.258 2.997-5.192A6 6 0 1012 23.894z" fill="#FC4C02"></path>'},fireworks:{viewBox:"0 0 24 24",mono:!1,svg:'<path clip-rule="evenodd" d="M14.8 5l-2.801 6.795L9.195 5H7.397l3.072 7.428a1.64 1.64 0 003.038.002L16.598 5H14.8zm1.196 10.352l5.124-5.244-.699-1.669-5.596 5.739a1.664 1.664 0 00-.343 1.807 1.642 1.642 0 001.516 1.012L16 17l8-.02-.699-1.669-7.303.041h-.002zM2.88 10.104l.699-1.669 5.596 5.739c.468.479.603 1.189.343 1.807a1.643 1.643 0 01-1.516 1.012l-8-.018-.002.002.699-1.669 7.303.042-5.122-5.246z" fill="#5019C5" fill-rule="evenodd"></path>'}};import{jsx as Za}from"react/jsx-runtime";function Bn({provider:e,className:n}){let t=Fr[e];return t?Za("svg",{className:n,viewBox:t.viewBox,fill:t.mono?"currentColor":void 0,fillRule:"evenodd","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:t.svg}}):null}import{Fragment as As,jsx as Q,jsxs as Ue}from"react/jsx-runtime";function Ct({options:e,layout:n="providers",ownInList:t=!1,search:r=!0,selected:o,appName:a,onPick:s,caption:c,onOpen:i,disabled:l,className:d}){let[f,h]=kt(!1),A=vt(null);if(!bn(e))return null;let p=d?`sc-mp ${d}`:"sc-mp";return Ue("span",{className:p,children:[c&&Q("span",{className:"sc-mp-cap",children:c}),Ue("button",{ref:A,type:"button",className:"sc-mp-btn",...i?{}:{"aria-haspopup":"dialog","aria-expanded":f},"aria-label":`Model: ${o.label}. Change`,title:o.label,disabled:l,onClick:i??(()=>h(w=>!w)),children:[Q("span",{className:"sc-mp-label",children:o.label}),Q(hn,{open:!i})]}),f&&!i&&Q($a,{anchor:A,options:e,layout:n,ownInList:t,search:r,appName:a,current:o.id,onClose:()=>h(!1),onPick:w=>{h(!1),w!==o.id&&s(w)}})]})}var _a=9,$t=6,An=8,gs=380;var zr=220;function $a({anchor:e,options:n,layout:t,ownInList:r,search:o,current:a,inline:s=!1,appName:c,onClose:i,onPick:l}){let d=vt(null),f=vt(null),h=vt(null),A=Xa(),[p,w]=kt(""),b=p.trim().length>0,C=vt(!1),S=o&&n.length>=_a,W=_t(()=>wt(n,t,r),[n,t,r]),O=_t(()=>{let u=[];for(let R of W){let L=Vr(R),J=R.options.length===1&&R.options[0]?.model==="auto";if(L==="head"||L==="@models"||J||t==="models"&&L.startsWith("@"))for(let G of R.options)u.push({kind:"option",key:G.id,option:G});else u.push({kind:"group",key:`g:${L}`,group:R,section:L.startsWith("@")?"providers":"agents"})}return u},[W,t]),D=_t(()=>ri(W,p),[W,p]),T=_t(()=>D.flatMap(u=>u.options),[D]),U=u=>u.kind==="group"&&u.group.options.some(R=>R.id===a),[y,ee]=kt(()=>O.find(u=>u.kind==="option"?u.option.id===a:U(u))?.key??"auto"),[q,ne]=kt(null),[ae,fe]=kt(null);Kt(()=>{b&&T.length&&!T.some(u=>u.id===y)&&ee(T[0]?.id??a)},[T,y,a,b]),Ka(()=>{let u=d.current,R=e.current;if(!u||!R||s)return;try{typeof u.showPopover=="function"&&u.showPopover()}catch{}let L=R.getBoundingClientRect(),J=window.innerHeight-L.bottom-$t-An,G=L.top-$t-An,re=J<Math.min(gs,u.scrollHeight)&&G>J,N=Math.min(gs,re?G:J);u.style.maxHeight=`${Math.max(160,Math.round(N))}px`;let H=u.offsetWidth,ie=Math.max(An,Math.min(L.left,window.innerWidth-H-An));u.style.left=`${Math.round(ie)}px`,re?(u.style.top="auto",u.style.bottom=`${Math.round(window.innerHeight-L.top+$t)}px`):(u.style.bottom="auto",u.style.top=`${Math.round(L.bottom+$t)}px`),(h.current??u).focus({preventScroll:!0})},[e,s]),Kt(()=>{C.current&&(C.current=!1,f.current?.querySelector(`[data-id="${CSS.escape(y)}"]`)?.scrollIntoView({block:"nearest"}))},[y]),Kt(()=>{if(s)return;let u=R=>{let L=R.target;!L||d.current?.contains(L)||e.current?.contains(L)||i()};return document.addEventListener("pointerdown",u,!0),()=>document.removeEventListener("pointerdown",u,!0)},[e,i,s]),Kt(()=>{if(!q)return;let u=R=>{R.target instanceof Element&&R.target.closest(".sc-mm-flyout")||ne(null)};return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[q]);let he=(u,R=!1)=>{let L=f.current?.querySelector(`[data-id="${CSS.escape(u)}"]`),J=d.current;if(!L||!J)return;let G=L.getBoundingClientRect(),re=J.getBoundingClientRect(),N=re.right+4+zr<=window.innerWidth-An,H=Math.max(An,Math.min(G.top-5,window.innerHeight-An-160));ne({key:u,top:H,left:N?re.right+4:re.left-4-zr,maxHeight:Math.min(320,window.innerHeight-H-An)});let ie=O.find(Ie=>Ie.key===u);ie?.kind==="group"&&fe(R?ie.group.options.find(Ie=>Ie.id===a)?.id??ie.group.options[0]?.id??null:null)},P=q?O.find(u=>u.key===q.key):void 0,Z=P?.kind==="group"?P.group.options:[],V=u=>{let R=O[(u+O.length)%O.length];R&&(C.current=!0,ee(R.key),ne(null))},X=u=>{let R=T[(u+T.length)%T.length];R&&(C.current=!0,ee(R.id))},ye=u=>{if(u.key==="Escape"){if(u.preventDefault(),u.stopPropagation(),u.nativeEvent.stopImmediatePropagation(),q){ne(null);return}i(),e.current?.focus();return}if(u.key==="Tab"){i();return}if(q&&ae!==null){let J=Z.findIndex(G=>G.id===ae);if(u.key==="ArrowDown"||u.key==="ArrowUp"){u.preventDefault();let G=u.key==="ArrowDown"?1:-1;fe(Z[(J+G+Z.length)%Z.length]?.id??null)}else if(u.key==="ArrowLeft")u.preventDefault(),ne(null);else if(u.key==="Enter"){u.preventDefault();let G=Z[J];G&&!G.locked&&l(G.id)}return}if(b){let J=T.findIndex(G=>G.id===y);u.key==="ArrowDown"||u.key==="ArrowUp"?(u.preventDefault(),X(J+(u.key==="ArrowDown"?1:-1))):u.key==="Enter"&&(u.preventDefault(),T.some(G=>G.id===y&&!G.locked)&&l(y));return}let R=O.findIndex(J=>J.key===y),L=O[R];switch(u.key){case"ArrowDown":u.preventDefault(),V(R+1);return;case"ArrowUp":u.preventDefault(),V(R-1);return;case"ArrowRight":L?.kind==="group"&&(u.preventDefault(),he(L.key,!0));return;case"Enter":u.preventDefault(),L?.kind==="group"?he(L.key,!0):L&&!L.option.locked&&l(L.option.id);return;default:if(!S&&u.key.length===1&&!u.metaKey&&!u.ctrlKey){let J=u.key.toLowerCase(),G=ie=>(ie.kind==="option"?ie.option.label:ie.group.heading??"").toLowerCase(),re=O.findIndex((ie,Ie)=>Ie>R&&G(ie).startsWith(J)),N=O.findIndex(ie=>G(ie).startsWith(J)),H=re>=0?re:N;H>=0&&V(H)}}},j=u=>`${A}-${u}`,be=O.filter(u=>u.kind==="group"&&u.section==="agents"||u.kind==="option"&&u.option.kind==="named"),we=O.filter(u=>u.kind==="group"&&u.section==="providers"),Ge=O.filter(u=>u.kind==="group"||!(u.option.choice||u.option.kind==="auto"||u.option.kind==="size")),Ee=O.some(u=>u.kind==="option"&&u.option.kind==="provider"&&!u.option.choice),te=(u,R,L,J=!1)=>Ue("div",{id:j(u.id),"data-id":u.id,role:"option","aria-selected":u.id===a,...u.locked?{"aria-disabled":!0}:{},"data-active":u.id===R||void 0,"data-locked":u.locked,className:"sc-mm-item",onPointerMove:L,onPointerDown:G=>G.preventDefault(),onClick:()=>!u.locked&&l(u.id),children:[Q(ni,{option:u,bare:J}),Q("span",{className:"sc-mm-label",children:u.label}),u.locked?!J&&Q("span",{className:"sc-mm-pill",children:hs[u.locked]}):bs(u)&&u.id!==a&&Q("span",{className:"sc-mm-note",children:bs(u)}),u.id===a&&Q(Tr,{})]},u.id),ge=u=>{let R=u.group.options[0],L=u.group.options.every(G=>G.locked)?R?.locked:void 0,J=R?.runtime?en[R.runtime]:void 0;return Ue("div",{id:j(u.key),"data-id":u.key,role:"option","aria-selected":!1,"data-active":u.key===y||void 0,"data-locked":L,className:"sc-mm-item sc-mm-sub",onPointerMove:()=>{y!==u.key&&ee(u.key),q?.key!==u.key&&he(u.key)},onPointerDown:G=>G.preventDefault(),onClick:()=>he(u.key),children:[J?Q("img",{className:"sc-mm-tile",src:J,alt:"","aria-hidden":"true"}):Q("span",{className:"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:R?.providerMark&&Q(Bn,{provider:R.providerMark,className:"sc-mm-tile-glyph"})}),Q("span",{className:"sc-mm-label",children:u.group.heading}),L&&Q("span",{className:"sc-mm-pill",children:hs[L]}),U(u)&&Q("span",{className:"sc-mm-dot","aria-hidden":"true",title:"In use"}),Q(hn,{open:!1})]},u.key)};return Ue("div",{ref:d,role:"dialog","aria-label":"Choose a model",className:s?"sc-mm sc-mm-inline":"sc-mm",...s?{}:{popover:"manual"},tabIndex:-1,onKeyDown:ye,onPointerLeave:()=>!s&&ne(null),...S?{}:{"aria-activedescendant":j(y)},children:[S&&Ue("div",{className:"sc-mm-search",children:[Q(oi,{}),Q("input",{ref:h,type:"text",role:"combobox","aria-expanded":"true","aria-controls":`${A}-list`,"aria-activedescendant":j(y),"aria-autocomplete":"list",placeholder:"Search models",autoComplete:"off",spellCheck:!1,value:p,onChange:u=>{w(u.target.value),ne(null)}})]}),Q("div",{ref:f,id:`${A}-list`,role:"listbox","aria-label":"Models",className:"sc-mm-list",onScroll:()=>ne(null),children:b?Ue(As,{children:[D.map((u,R)=>Ue("div",{role:"group",...u.heading?{"aria-labelledby":`${A}-g${R}`}:{},className:"sc-mm-group",children:[u.heading&&Q(ti,{id:`${A}-g${R}`,group:u}),u.options.map(L=>te(L,y,()=>L.id!==y&&ee(L.id),!!u.heading))]},Vr(u))),!T.length&&Ue("div",{className:"sc-mm-empty",children:["No models match \u201C",p.trim(),"\u201D"]})]}):Ue(As,{children:[O.filter(u=>u.kind==="option"&&(u.option.choice||u.option.kind==="auto"||u.option.kind==="size")).map(u=>u.kind==="option"?te(u.option,y,()=>{y!==u.key&&ee(u.key),ne(null)}):null),r&&Ge.length>0&&Q("div",{className:"sc-mm-rule",role:"presentation"}),r&&Ge.map(u=>u.kind==="group"?ge(u):te(u.option,y,()=>{y!==u.key&&ee(u.key),ne(null)})),!r&&be.length>0&&Q("div",{className:"sc-mm-rule",role:"presentation"}),!r&&be.length>0&&Q("div",{className:"sc-mm-label-row",role:"presentation",children:"Your own AI"}),(r?[]:be).map(u=>u.kind==="group"?ge(u):te(u.option,y,()=>{y!==u.key&&ee(u.key),ne(null)})),!r&&(we.length>0||Ee)&&Q("div",{className:"sc-mm-rule",role:"presentation"}),!r&&(we.length>0||Ee)&&Q("div",{className:"sc-mm-label-row",role:"presentation",children:c?`${c} models`:"Included models"}),(r?[]:we).map(u=>u.kind==="group"?ge(u):null),(r?[]:O).filter(u=>u.kind==="option"&&u.option.kind==="provider"&&!u.option.choice).map(u=>u.kind==="option"?te(u.option,y,()=>{y!==u.key&&ee(u.key),ne(null)}):null)]})}),q&&Z.length>0&&Q("div",{role:"listbox","aria-label":P?.kind==="group"?P.group.heading??"Models":"Models",className:"sc-mm-flyout",style:{top:q.top,left:q.left,width:zr,maxHeight:q.maxHeight},children:Z.map(u=>te(u,ae,()=>u.id!==ae&&fe(u.id),!0))})]})}var hs={plan:"Upgrade",allowance:"Limit reached"},ei={auto:"M8 1c.5 3.6 2 5 7 7-5 2-6.5 3.4-7 7-.5-3.6-2-5-7-7 5-2 6.5-3.4 7-7Z",fast:"M9.4.5 2.6 9.1c-.3.4 0 .9.4.9H7l-.9 5.1c-.1.5.5.8.8.4l6.8-8.6c.3-.4 0-.9-.4-.9H9.3l.9-5.1c.1-.5-.5-.8-.8-.4Z",best:"M4.5 2h7l3.5 4.2L8 14.5 1 6.2Z"};function ni({option:e,bare:n=!1}){if(e.icon)return/^https?:\/\//.test(e.icon)?Q("img",{className:"sc-mm-tile",src:e.icon,alt:"","aria-hidden":"true"}):Q("span",{className:"sc-mm-tile sc-mm-tile-box sc-mm-emoji","aria-hidden":"true",children:e.icon});if(e.kind==="named"&&e.runtime&&!n){let t=en[e.runtime];return t?Q("img",{className:"sc-mm-tile",src:t,alt:"","aria-hidden":"true"}):null}return e.kind==="auto"||e.kind==="size"?Q("span",{className:"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:Q("svg",{viewBox:"0 0 16 16",className:"sc-mm-tile-glyph",fill:"currentColor","aria-hidden":"true",focusable:"false",children:Q("path",{d:ei[e.kind==="auto"?"auto":e.id==="small"?"fast":"best"]})})}):e.kind==="provider"&&e.providerMark&&!n?Q("span",{className:e.locked?"sc-mm-tile sc-mm-tile-box sc-mm-tile-dim":"sc-mm-tile sc-mm-tile-box","aria-hidden":"true",children:Q(Bn,{provider:e.providerMark,className:"sc-mm-tile-glyph"})}):null}function Vr(e){let n=e.options[0];return!n||n.choice||n.kind==="auto"||n.kind==="size"?"head":n.runtime&&e.options.every(t=>t.runtime===n.runtime)?n.runtime:!n.runtime&&e.options.every(t=>t.providerId===n.providerId)?`@${n.providerId}`:"@models"}function ti({id:e,group:n}){let t=n.options[0],r=Vr(n),o=t?.runtime&&r===t.runtime?en[t.runtime]:void 0,a=r.startsWith("@")&&r!=="@models"?t?.providerMark:void 0;return Ue("div",{id:e,className:"sc-mm-head",role:"presentation",children:[o&&Q("img",{className:"sc-mm-logo",src:o,alt:"","aria-hidden":"true"}),a&&Q(Bn,{provider:a,className:"sc-mm-logo"}),n.heading]})}function ri(e,n){let t=n.trim().toLowerCase();if(!t)return e;let r=[];for(let o of e){let s=o.heading?.toLowerCase().includes(t)?o.options:o.options.filter(c=>[c.label,c.model,c.note??""].some(i=>i.toLowerCase().includes(t)));s.length&&r.push({...o,options:s})}return r}function bs(e){return e.kind==="provider"?e.locked==="plan"?"Upgrade":e.locked==="allowance"?"Limit reached":e.choice?e.note:void 0:e.kind!=="named"?e.note:e.machine?`on ${e.machine}`:e.model==="auto"?e.note:void 0}function oi(){return Ue("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-mm-find",children:[Q("circle",{cx:"11",cy:"11",r:"6.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),Q("path",{d:"M16 16l4 4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}import{useEffect as si,useRef as ai}from"react";import{jsx as Pe,jsxs as er}from"react/jsx-runtime";function Qr({options:e,selected:n,onPick:t,onClose:r,busy:o}){let a=ai(null);return si(()=>{(a.current?.querySelector('[aria-checked="true"]')??a.current?.querySelector("[role=radio]"))?.focus()},[]),er("div",{className:"sc-tray sc-screen",onKeyDown:i=>{i.key==="Escape"&&(i.stopPropagation(),r())},children:[er("div",{className:"sc-screen-head",children:[Pe("button",{type:"button",className:"sc-back","aria-label":"Back",onClick:r,disabled:o,children:Pe(ii,{})}),Pe("h2",{className:"sc-screen-title",children:"Model"})]}),Pe("div",{ref:a,role:"radiogroup","aria-label":"Model",className:"sc-group-card sc-mopts",onKeyDown:i=>{if(!["ArrowDown","ArrowRight","ArrowUp","ArrowLeft"].includes(i.key)||o)return;i.preventDefault();let d=e.findIndex(A=>A.id===n),f=i.key==="ArrowDown"||i.key==="ArrowRight"?1:-1,h=e[((d<0?0:d)+f+e.length)%e.length];h&&t(h.id)},children:e.map(i=>{let l=i.id===n,d=Ur(i);return er("button",{type:"button",role:"radio","aria-checked":l,tabIndex:l?0:-1,className:"sc-mopt",disabled:o,onClick:()=>t(i.id),children:[er("span",{className:"sc-mopt-say",children:[Pe("span",{className:"sc-mopt-name",children:i.label}),d&&Pe("span",{className:"sc-mopt-desc",children:d})]}),Pe("span",{className:l?"sc-ring sc-ring-on":"sc-ring","aria-hidden":"true",children:l&&Pe(li,{})})]},i.id)})}),Pe("p",{className:"sc-screen-foot",children:"Applies to new runs. Runs already in progress keep the model they started with."}),Pe("button",{type:"button",className:"sc-act-go",onClick:r,disabled:o,children:"Done"})]})}function ii(){return Pe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-back-glyph",children:Pe("path",{d:"M15 6l-6 6 6 6",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function li(){return Pe("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-ring-tick",children:Pe("path",{d:"M5 10.5l3.2 3.2L15 6.5",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round"})})}import{jsx as Fe,jsxs as ui}from"react/jsx-runtime";function Me({className:e}){return ui("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:[Fe("path",{d:"M18.125 7.039A8.6 8.6 0 1 0 18.125 16.961A6 6 0 0 1 18.125 7.039Z",fill:"currentColor"}),Fe("path",{d:"M19.925 7.039A8.6 8.6 0 0 1 19.925 16.961A6 6 0 0 0 19.925 7.039Z",fill:"currentColor"})]})}function ys({className:e}){return Fe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:Fe("path",{fill:"currentColor",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})})}function Gn({className:e}){return Fe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:Fe("path",{fill:"currentColor",d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function nr({className:e}){return Fe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:Fe("path",{d:"M4 5h16v11H4zM9 20h6M12 16v4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ci({className:e}){return Fe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:Fe("path",{d:"M5 7l5 5-5 5M12 18h7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Jr({className:e}){return Fe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e,children:Fe("path",{d:"M5 6h14v10H5zM2.5 19.5h19",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var yn={claude:ys,chatgpt:Gn,local:nr},ws={shell:ci};function ks(e,n){return n<2*6e4?e:n<10*6e4?Math.max(e,6e4):n<30*6e4?Math.max(e,3*6e4):Math.max(e,10*6e4)}var di=3e3,pi=2*6e4,tr=Date.now(),rr=new Set,vs=!1;function mi(){if(vs||typeof window>"u")return;vs=!0;let e=()=>{let t=tr;if(tr=Date.now(),tr-t>pi)for(let r of rr)r()};for(let t of["pointerdown","keydown","wheel","touchstart"])window.addEventListener(t,e,{capture:!0,passive:!0});let n=()=>{if(!document.hidden)for(let t of rr)t()};window.addEventListener("focus",n),document.addEventListener("visibilitychange",n)}function ze(e,n,t={}){mi();let r,o=t.immediate===!1?Date.now():0,a=!1,s=!1,c=()=>{s||(r=setTimeout(i,t.idle===!1?n:ks(n,Date.now()-tr)))},i=async()=>{if(clearTimeout(r),!(s||a)){if(typeof document>"u"||!document.hidden){a=!0,o=Date.now();try{await e()}catch{}finally{a=!1}}c()}},l=()=>{Date.now()-o>Math.min(n,di)&&i()};return rr.add(l),t.immediate===!1?c():i(),()=>{s=!0,clearTimeout(r),rr.delete(l)}}import{useEffect as fi,useRef as gi,useState as hi}from"react";function Xn(e){if(e.label)return e.label;if(e.task){let n=e.task.replace(/[_-]+/g," ").trim();return n.charAt(0).toUpperCase()+n.slice(1)}return"A run"}function or(e){if(e.status==="queued")return"Waiting for a free slot";if(e.step)return e.step;switch(e.phase?.kind){case"thinking":return"Thinking";case"writing":return"Writing";case"tool":return e.phase.tool?`Using ${e.phase.tool}`:"Using a tool";case"approval":return e.phase.tool?`Waiting for you to allow ${e.phase.tool}`:"Waiting for your approval";default:return e.first_output_at?"Working":"Starting"}}function Mt(e){let n=Math.max(0,Math.round((Date.now()-new Date(e).getTime())/1e3));if(n<60)return`${n}s`;let t=Math.floor(n/60);return t<60?`${t}m ${String(n%60).padStart(2,"0")}s`:`${Math.floor(t/60)}h ${String(t%60).padStart(2,"0")}m`}function Yr(e){let n=new Date(e);return Number.isNaN(n.getTime())?"\u2014":n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}import{jsx as K,jsxs as ke}from"react/jsx-runtime";function qr({run:e,machine:n,appName:t,onClose:r,onStop:o,busy:a}){let s=gi(null),[c,i]=hi(!1);fi(()=>{s.current?.focus()},[]);let l=w=>{w.key==="Escape"&&(w.stopPropagation(),r())},d=async()=>{i(!0);try{await o?.(e.id)}catch{i(!1)}},f=Xn(e),h=e.status==="running"&&!c,p=[n?.runtimes.find(w=>w.id===e.runtime_id)?.display_name??e.runtime_id,n?ce(n):null].filter(Boolean).join(", ");return ke("div",{className:"sc-tray sc-screen",onKeyDown:l,children:[ke("div",{className:"sc-screen-head",children:[K("button",{ref:s,type:"button",className:"sc-back","aria-label":"Back to active runs",onClick:r,children:K(Ai,{})}),K("span",{className:"sc-screen-from",children:"Active runs"})]}),ke("div",{className:"sc-rd-head",children:[K("h2",{className:"sc-rd-name",children:f}),ke("p",{className:"sc-rd-state",children:[K("span",{className:h?"sc-rd-dot sc-rd-dot-live":"sc-rd-dot","aria-hidden":"true"}),c?"Stopping\u2026":e.status==="queued"?`Queued for ${Mt(e.started_at)}`:`Running for ${Mt(e.started_at)}`]})]}),ke("div",{className:"sc-group-card sc-rd-facts",children:[t&&ke("p",{className:"sc-rd-fact",children:[K("span",{className:"sc-rd-key",children:"Source"}),K("span",{className:"sc-rd-val",children:t})]}),ke("p",{className:"sc-rd-fact",children:[K("span",{className:"sc-rd-key",children:"Model"}),K("span",{className:"sc-rd-val",children:bi(e.model)})]}),p&&ke("p",{className:"sc-rd-fact",children:[K("span",{className:"sc-rd-key",children:"Runs on"}),K("span",{className:"sc-rd-val",children:p})]})]}),ke("section",{className:"sc-group",children:[K("div",{className:"sc-group-cap",children:K("p",{className:"sc-group-title",children:"Activity"})}),ke("div",{className:"sc-group-card sc-rd-steps",children:[ke("p",{className:"sc-rd-step",children:[K(jr,{state:"done"}),K("span",{className:"sc-rd-say",children:"Started"}),K("span",{className:"sc-rd-when",children:Yr(e.started_at)})]}),ke("p",{className:"sc-rd-step",children:[K(jr,{state:e.first_output_at?"done":"todo"}),K("span",{className:e.first_output_at?"sc-rd-say":"sc-rd-say sc-rd-wait",children:"First output"}),K("span",{className:"sc-rd-when",children:e.first_output_at?Yr(e.first_output_at):"Not yet"})]}),ke("p",{className:"sc-rd-step",children:[K(jr,{state:h?"now":"todo"}),K("span",{className:"sc-rd-say",children:c?"Stopping":or(e)})]})]})]}),ke("div",{className:"sc-acts",children:[o&&K("button",{type:"button",className:"sc-act-stop",onClick:()=>void d(),disabled:a||c,children:c?"Stopping\u2026":"Stop run"}),K("a",{className:"sc-act-quiet",href:On(),children:"Open Soba"})]})]})}function bi(e){return!e||e==="auto"?"Automatic":e==="small"?"Fast":e==="large"?"Best":nn(e)}function jr({state:e}){return e==="done"?ke("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark sc-rd-mark-done",children:[K("circle",{cx:"10",cy:"10",r:"9",fill:"currentColor"}),K("path",{d:"M5.8 10.3l2.8 2.8 5.6-5.8",fill:"none",stroke:"var(--sc-tray-card, #ffffff)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):e==="now"?ke("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark sc-rd-mark-now",children:[K("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:"var(--sc-line-2, #dcdce0)",strokeWidth:"2.4"}),K("path",{d:"M10 2a8 8 0 018 8",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round"})]}):K("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:"sc-rd-mark",children:K("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}function Ai(){return K("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-back-glyph",children:K("path",{d:"M15 6l-6 6 6 6",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Oe=[{id:"claude",costClass:"user-subscription",short:"Claude Code",label:"Continue with Claude",title:"The Claude plan you already pay for",cost:"Nothing beyond the plan",prerequisite:"Claude Code installed and signed in",hint:"Install it from claude.ai/code, then run `claude` once and sign in.",install:"https://claude.com/product/claude-code",expects:["claude-code"]},{id:"chatgpt",costClass:"user-subscription",short:"Codex",label:"Continue with ChatGPT",title:"The ChatGPT plan you already pay for",cost:"Nothing beyond the plan",prerequisite:"Codex installed and signed in",hint:"Install Codex, then run `codex` once and sign in.",install:"https://learn.chatgpt.com/codex/cli",expects:["codex"]},{id:"local",costClass:"user-hardware",short:"Local models",label:"Use a model on this machine",title:"A model on your own machine",cost:"Free. You bought the hardware",prerequisite:"Ollama running, with a model pulled",hint:"Install Ollama, then `ollama pull` a model before pairing.",install:"https://ollama.com",expects:["ollama","openai-api"]}],Cs=["claude","chatgpt"];function Zr(){return Oe.filter(e=>Cs.includes(e.id))}function Xr(e){return Oe.filter(n=>n.costClass===e)}function Kr(e){return Oe.find(n=>n.expects.includes(e))??null}import{Fragment as _n,jsx as m,jsxs as x}from"react/jsx-runtime";function Wn({machines:e,hosted:n=[],onApproveRuntime:t,onPreferRuntime:r,onDisconnectHosted:o,onPair:a,onWake:s,onOpenApp:c,onRefresh:i,refreshing:l,busy:d,appName:f,model:h,onPickModel:A,error:p,runs:w,loadRuns:b,loading:C,machineMenu:S,machineNote:W,onReconnect:O,openApp:D=!0,children:T,onStopRun:U}){let y=$e(e),ee=e.filter(E=>E.id!==y?.id),q=y?.state==="online",[ne,ae]=Kn(()=>q?[]:null),[fe,he]=Kn("no"),[P,Z]=Kn(!1),[V,X]=Kn(null),ye=w===void 0&&!!b,j=ye?ne:w??(q?[]:null),be=w!==void 0||!!b;Ms(()=>{V&&j&&!j.some(E=>E.id===V)&&X(null)},[V,j]);let we=!!(y&&an(y));Ms(()=>{if(!ye||!b||!we)return;let E=!0,Le=ze(async()=>{let Re=await b();E&&ae(Re)},3e3);return()=>{E=!1,Le()}},[ye,b,we]);let Ee=(y?Sr(y):[]).filter(E=>E.quarantined&&!E.absent),te=ar(y,h).runtime,ge=te?.cost_class==="user-hardware"?te:null,u=ge?Ti(Oi(ge,h)):null,R=!!y&&!an(y),L=(()=>{if(!y||R||!te||_e(te).tone!=="warn")return null;let Le=ce(y);return{title:`${te.display_name} is signed out`,detail:`Sign in on ${Le} so Soba can start runs.`}})(),J=()=>{c?.(),he("going"),Tn().then(E=>he(E==="absent"?"absent":"no"))},G=()=>{J(),s?.()},re={label:fe==="going"?"Opening Soba\u2026":"Open Soba",onPress:J,spin:fe==="going"},N=y?re:a?{label:"Connect to Soba",onPress:a}:null,H=!!y&&N===re,ie=H&&!!i,Ie=i&&m("button",{type:"button",className:"sc-disc",onClick:i,disabled:l,"aria-label":"Refresh",title:"Refresh",children:m(Di,{spinning:!!l})});if(!y&&n.length===0&&!a)return m("p",{className:"sc-note",children:"Nothing connected yet."});if(P&&y&&h&&A){let E=Ss(y,h);if(bn(E.options))return m(Qr,{options:E.options,selected:h.id,onPick:A,onClose:()=>Z(!1),...d?{busy:d}:{}})}let Xe=V?j?.find(E=>E.id===V):void 0;return Xe?m(qr,{run:Xe,onClose:()=>X(null),...y?{machine:y}:{},...f?{appName:f}:{},...U?{onStop:U}:{},...d?{busy:d}:{}}):x("div",{className:"sc-tray",children:[y&&x(Ye,{title:"This machine",action:(i&&!ie||D||S)&&x("span",{className:"sc-cap-acts",children:[!ie&&Ie,D&&m(Si,{}),S]}),children:[m(wi,{machine:y}),W]}),y&&R&&!y.pairing_lost&&m(Ye,{title:"Soba",children:x("div",{className:"sc-away",children:[m("span",{className:"sc-away-mark","aria-hidden":"true",children:m(fn,{kind:"paused",size:30})}),x("span",{className:"sc-away-say",children:[m("span",{className:"sc-away-title",children:"Wake it up"}),x("span",{className:"sc-away-body",children:["Soba on ",ce(y)," is not answering. Waking it opens the app there."]})]}),m("button",{type:"button",className:"sc-away-go",onClick:G,disabled:d||fe==="going",children:fe==="going"?"Waking\u2026":"Wake"})]})}),y?.pairing_lost&&!an(y)&&m(Ye,{title:"Soba",children:x("div",{className:"sc-away",children:[m("span",{className:"sc-away-mark","aria-hidden":"true",children:m(fn,{kind:"gone",size:30})}),x("span",{className:"sc-away-say",children:[m("span",{className:"sc-away-title",children:"Connect it again"}),m("span",{className:"sc-away-body",children:"Its pairing has ended, so it cannot take runs until it is connected again."})]}),O&&m("button",{type:"button",className:"sc-away-go",onClick:O,disabled:d,children:"Connect"})]})}),y&&!R&&m(Ye,{title:"Runs on",children:te?m(Ei,{machine:y,appName:f,busy:d,...h?{model:h}:{},...A?{onPickModel:A,onOpenModels:()=>Z(!0)}:{},...r?{onPick:E=>r(y.id,E)}:{},...t?{onApprove:E=>t(y.id,E)}:{}}):x("div",{className:"sc-blank",children:[m("span",{className:"sc-blank-mark","aria-hidden":"true",children:m(Ci,{})}),x("span",{className:"sc-blank-say",children:[m("span",{className:"sc-blank-title",children:C?"Looking\u2026":"No agent on this machine"}),m("span",{className:"sc-blank-body",children:C?"Reading what it can run.":"Install Claude Code, Codex or Ollama there and it will appear here."})]}),!C&&D&&x("a",{className:"sc-blank-act",href:On(),children:[m("span",{children:"Add agents"}),m(_r,{})]})]})}),y&&(L||u)&&x(Ye,{title:"Needs attention",children:[L&&x("div",{className:"sc-alarm",children:[m("span",{className:"sc-alarm-mark","aria-hidden":"true",children:m(Ns,{})}),x("span",{className:"sc-alarm-say",children:[m("span",{className:"sc-alarm-title",children:L.title}),m("span",{className:"sc-alarm-body",children:L.detail})]})]}),u&&x("div",{className:"sc-alarm sc-alarm-warn",children:[m("span",{className:"sc-alarm-mark","aria-hidden":"true",children:m(Ns,{})}),x("span",{className:"sc-alarm-say",children:[m("span",{className:"sc-alarm-title",children:"A large model on this computer"}),x("span",{className:"sc-alarm-body",children:["Your ",u," model can take all this computer's memory while it answers."]})]})]})]}),y&&be&&!R&&m(ki,{machine:y,runs:j,onOpen:E=>X(E),...U?{onStop:U}:{}}),y&&m(_n,{children:Ee.length>0&&!R&&!(r&&t&&!["app","model"].includes(ar(y,h).by))&&m(Ye,{title:"New on this machine",children:Ee.map(E=>m(Pi,{runtime:E,...t?{onApprove:()=>t(y.id,E.id)}:{}},E.id))})}),n.length>0&&m(Ye,{title:n.length>1?"Connected plans":"Connected plan",children:n.map(E=>m(Gi,{credential:E,appName:f,busy:d,...o?{onDisconnect:()=>o(E.provider)}:{}},E.provider))}),ee.length>0&&m(Ye,{title:"Your other machines",children:ee.map(E=>m(Ri,{machine:E},E.id))}),!y&&a&&m(Ye,{title:"Your machines",children:x("button",{type:"button",className:"sc-pair",onClick:a,children:[m("span",{className:"sc-otile","aria-hidden":"true",children:m(Wi,{})}),m("span",{className:"sc-oname",children:"Connect a machine"})]})}),N&&x("div",{className:"sc-acts",children:[H&&N?x("div",{className:"sc-acts-row",children:[ie?Ie:m("span",{}),x("button",{type:"button",className:"sc-act-small",onClick:N.onPress,disabled:d||N.spin,"data-spin":N.spin?"true":void 0,children:[N.spin&&m(xs,{}),N.label,!N.spin&&m(_r,{})]})]}):N&&x("button",{type:"button",className:"sc-act-go",onClick:N.onPress,disabled:d||N.spin,"data-spin":N.spin?"true":void 0,children:[N.spin&&m(xs,{}),N.label]}),fe==="absent"&&x("p",{className:"sc-act-miss",children:["Nothing opened here. ",y?ce(y):"That machine"," may be a different computer, or the Soba app is not installed on this one."]})]}),T,p&&m("p",{className:"sc-error sc-tray-error",children:p})]})}function Ye({title:e,action:n,children:t}){return x("section",{className:"sc-group",children:[x("div",{className:"sc-group-cap",children:[m("p",{className:"sc-group-title",children:e}),n]}),m("div",{className:"sc-group-card",children:t})]})}function wi({machine:e,onToggle:n,open:t}){let r=an(e),o=[r?null:e.pairing_lost?"Not connected to Soba":"Soba is asleep",r?gt(e):null,e.always_on?"always on":null].filter(Boolean),a=r&&e.capacity>0?e.active>0?`${e.active} of ${e.capacity} running`:null:ht(e.last_seen_at),s=x(_n,{children:[x("span",{className:"sc-mtile","aria-hidden":"true",children:[m(Rs,{}),m("span",{className:`sc-mbadge sc-mbadge-${r?Ln(e).tone:e.pairing_lost?"off":"away"}`})]}),x("span",{className:"sc-mid",children:[m("span",{className:"sc-mname",children:ce(e)}),x("span",{className:"sc-mmeta",children:[m("span",{className:"sc-mmeta-is",children:o.map((c,i)=>x("span",{children:[i>0&&m("span",{className:"sc-mmeta-sep",children:"\xB7"}),c]},c))}),a&&m("span",{className:"sc-mmeta-now",children:a})]})]})]});return!n||!r?m("div",{className:"sc-mrow",children:s}):x("button",{type:"button",className:"sc-mrow sc-mrow-btn",onClick:n,"aria-expanded":!!t,title:t?"Hide what it is running":"See what it is running",children:[s,m(hn,{open:!!t})]})}function vi(e,n){return e.filter(t=>t.machine_id===n.id||t.machine_id===null)}function ki({machine:e,runs:n,onStop:t,onOpen:r}){let o=n?vi(n,e):[],[a,s]=Kn(new Set),c=async l=>{s(d=>new Set(d).add(l));try{await t?.(l)}catch{s(d=>{let f=new Set(d);return f.delete(l),f})}},i=()=>{for(let l of o)c(l.id)};return m(Ye,{title:"Active runs",...t&&o.length>1?{action:m("button",{type:"button",className:"sc-cap-link",onClick:i,children:"Stop all"})}:{},children:n===null?m("p",{className:"sc-row-note",children:"Looking\u2026"}):o.length===0?x("p",{className:"sc-nilrow",children:[m("span",{className:"sc-nilrow-mark","aria-hidden":"true",children:m(Mi,{})}),"Nothing running"]}):o.map(l=>m(Ni,{run:l,stopping:a.has(l.id),...t?{onStop:()=>void c(l.id)}:{},...r?{onOpen:()=>r(l.id)}:{}},l.id))})}function Ci(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-blank-glyph",children:[m("rect",{x:"3",y:"4.5",width:"18",height:"15",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),m("path",{d:"M7.5 10l2.5 2.2-2.5 2.2M12.5 14.6h4",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mi(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-blank-glyph",children:[m("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),m("path",{d:"M9 12.5l2.2 2.2L15.5 9.8",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ni({run:e,stopping:n,onStop:t,onOpen:r}){let o=x(_n,{children:[m("span",{className:n?"sc-rdot":"sc-rdot sc-rdot-live","aria-hidden":"true"}),x("span",{className:"sc-mid",children:[m("span",{className:"sc-rtitle",children:Xn(e)}),m("span",{className:"sc-rstep",children:n?"Stopping\u2026":`${or(e)} \xB7 ${Mt(e.started_at)}`})]})]});return x("div",{className:"sc-rrow",children:[r?x("button",{type:"button",className:"sc-rgo",onClick:r,"aria-label":`${Xn(e)} \u2014 open this run`,children:[o,m(hn,{open:!1})]}):o,t&&m("button",{type:"button",className:"sc-rstop",onClick:t,disabled:n,"aria-label":`Stop ${Xn(e)}`,children:m("span",{className:"sc-rstop-ring",children:m(Hi,{})})})]})}function xi(e){let n=Kr(e);return(n?yn[n.id]:null)??ws[e]??null}function Si(){return m("a",{className:"sc-disc sc-open-app",href:On(),"aria-label":"Open Soba",title:"Open Soba",children:m(_r,{})})}function _r(){return m("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-dglyph",children:m("path",{d:"M14 4h6v6M20 4l-8.5 8.5M18 14.5V19a1 1 0 01-1 1H5a1 1 0 01-1-1V7a1 1 0 011-1h4.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ri({machine:e}){let n=Ln(e);return x("div",{className:"sc-orow",children:[m("span",{className:"sc-otile","aria-hidden":"true",children:m(Rs,{})}),m("span",{className:"sc-oname",children:ce(e)}),m("span",{className:"sc-oword",children:n.word}),m("span",{className:`sc-dot sc-dot-${n.tone}`,"aria-hidden":"true"})]})}function Pi({runtime:e,onApprove:n}){return x("div",{className:"sc-mrow",children:[m("span",{className:"sc-mtile sc-atile","aria-hidden":"true",children:m(sr,{id:e.id,name:e.display_name})}),x("span",{className:"sc-mid",children:[m("span",{className:"sc-mname",children:e.display_name}),m("span",{className:"sc-mmeta",children:e.version??"waiting to be let in"})]}),n?m("button",{type:"button",className:"sc-row-act",onClick:n,children:"Let it serve"}):m("span",{className:"sc-averdict sc-tone-warn",children:"not serving yet"})]})}function $r({id:e,name:n}){return m("span",{className:"sc-runtime-tile","aria-hidden":"true",children:m(sr,{id:e,...n?{name:n}:{}})})}function sr({id:e,name:n}){if(!e)return null;let t=en[e];if(t)return m("img",{src:t,alt:"",className:"sc-runtime-logo"});let r=xi(e);return r?m(r,{className:"sc-runtime-mark"}):n?m("span",{className:"sc-runtime-letter",children:n.slice(0,1).toUpperCase()}):null}function Ss(e,n){if(!n)return{options:[]};let t=ar(e,n),r=t.runtime?.id??t.runtimeId,o=yt([e]).filter(c=>c.kind==="named"?c.runtime===r:c.kind==="size"?!!r&&Xt(r):!0),a=t.runtime?.default_model;if(n.kind!=="auto"||!a)return{options:o,shown:n};let s=nn(a);return{options:o,shown:{...n,label:s.length>16?s:`${n.label} \xB7 ${s}`}}}function Ei({machine:e,appName:n,busy:t,onPick:r,model:o,onPickModel:a,onOpenModels:s,onApprove:c}){let i=ar(e,o),l=ve(e),d=c?e.runtimes.filter(U=>U.quarantined&&!U.absent):[],[f,h]=Kn(!1),A=yi(null);if(i.by!=="app"&&l.length===0)return null;let p=U=>U?m($r,{id:U.id,name:U.display_name}):null,w=i.runtime?.display_name??i.runtimeId??"\u2014",b=i.by!=="app"&&i.by!=="model"&&!!r&&(l.length>=2||d.length>0),C=i.runtime?.id??i.runtimeId,S=!an(e),W=i.runtime&&_e(i.runtime).tone==="warn"?"Signed out":null,{options:O,shown:D}=Ss(e,o),T=i.by==="app"?`Set by ${n??"the app"}`:i.runtime?Li(i.runtime):null;return x(_n,{children:[b?x("button",{ref:A,type:"button",className:S?"sc-runs-agent sc-runs-dim":"sc-runs-agent","aria-haspopup":"menu","aria-expanded":f,"aria-label":`Runs go to ${w}. Change`,disabled:t,onClick:()=>h(U=>!U),children:[m("span",{className:"sc-runs-tile","aria-hidden":"true",children:m(sr,{id:C??null,name:w})}),x("span",{className:"sc-runs-said-name",children:[m("span",{className:"sc-runs-name",children:w}),W&&m("span",{className:"sc-runs-ill",children:W})]}),m(hn,{open:!1})]}):x("span",{className:S?"sc-runs-agent sc-runs-fixed sc-runs-dim":"sc-runs-agent sc-runs-fixed",children:[m("span",{className:"sc-runs-tile","aria-hidden":"true",children:m(sr,{id:C??null,name:w})}),x("span",{className:"sc-runs-said-name",children:[m("span",{className:"sc-runs-name",children:w}),W&&m("span",{className:"sc-runs-ill",children:W})]}),i.by==="app"&&x("span",{className:"sc-runs-told",children:["set by ",n??"the app"]}),i.by==="model"&&m("span",{className:"sc-runs-told",children:"set by the model"})]}),D&&a&&bn(O)?x(_n,{children:[m("span",{className:"sc-runs-rule","aria-hidden":"true"}),m(Ct,{options:O,selected:D,onPick:a,caption:"Model",...s?{onOpen:s}:{},className:S?"sc-runs-model sc-runs-dim":"sc-runs-model",...t?{disabled:t}:{}})]}):T&&x(_n,{children:[m("span",{className:"sc-runs-rule","aria-hidden":"true"}),x("span",{className:"sc-runs-said",children:[m("span",{className:"sc-runs-key",children:"Model"}),m("span",{className:"sc-runs-val",children:T})]})]}),f&&r&&m(Ii,{anchor:A,machine:e,tile:p,waiting:d,...c?{onApprove:c}:{},onClose:()=>h(!1),onPick:U=>{h(!1),r(U)}})]})}function Ii({anchor:e,machine:n,tile:t,waiting:r,onApprove:o,onClose:a,onPick:s}){let c={...n,requested_runtime:null},i=Je(c),l=Je({...c,preferred_runtime:null}).runtime,d=i.by==="you"?i.runtimeId:null,f=[{id:null,label:"Automatic",...l?{note:`Uses ${l.display_name}`}:{},glyph:t(l)},...ve(n).map((h,A)=>{let p=Bi(h);return{id:h.id,label:h.display_name,glyph:t(h),...p?{note:p}:{},...A===0?{rule:!0}:{}}}),...o?r.map((h,A)=>({id:`waiting:${h.id}`,label:h.display_name,glyph:t(h),...h.version?{note:h.version}:{},trailing:"Let it serve",onChoose:()=>o(h.id),...A===0?{heading:"New on this machine"}:{}})):[]];return m(Or,{anchor:e,label:"Which agent runs go to",options:f,current:d,onClose:a,onPick:s})}function Li(e){let n=_e(e);return n.tone==="warn"?n.text:e.default_model?nn(e.default_model):"Automatic"}function ar(e,n){if(!e)return{by:"default",runtimeId:null,runtime:null};let t=Je(n?{...e,requested_runtime:null}:e);if(t.by==="app"||n?.kind!=="named"||!n.runtime)return t;let r=ve(e).find(o=>o.id===n.runtime);return!r||r.id===t.runtimeId?t:{by:"model",runtimeId:r.id,runtime:r}}function Oi(e,n){return!n||n.kind==="auto"?e.default_model:n.kind==="size"?(us(n.model)?ds(e.id,n.model):void 0)??e.default_model:n.runtime===e.id?n.model:e.default_model}function Ti(e){if(!e)return null;let n=/(\d+(?:\.\d+)?)\s*b\b/i.exec(e),t=n?.[1]?Number(n[1]):Number.NaN;return!Number.isFinite(t)||t<20?null:`${n?.[1]}B`}function Bi(e){let n=_e(e);return n.tone==="warn"?n.text:e.default_model?nn(e.default_model):e.cost_class==="user-hardware"?"In this machine's memory":n.tone!=="ok"?n.text:e.version??void 0}function Gi({credential:e,appName:n,busy:t,onDisconnect:r}){return x("div",{className:"sc-hrow",children:[x("div",{className:"sc-orow",children:[m("span",{className:"sc-otile","aria-hidden":"true",children:m(Gn,{className:"sc-omark"})}),x("span",{className:"sc-mid",children:[m("span",{className:"sc-oname",children:e.provider==="openai-chatgpt"?"ChatGPT plan":e.provider}),m("span",{className:"sc-mmeta",children:e.account_label??"signed in"})]}),r&&m("button",{type:"button",className:"sc-row-act",onClick:r,disabled:t,children:"Disconnect"})]}),r&&x("p",{className:"sc-row-note",children:[n??"This app"," stops using it. To withdraw the grant entirely, remove it in your OpenAI settings."]})]})}function Rs(){return x("svg",{viewBox:"0 0 32 24","aria-hidden":"true",focusable:"false",className:"sc-mglyph",children:[m("rect",{x:"4",y:"1.5",width:"24",height:"15",rx:"2.5",fill:"var(--sc-sheet, #ffffff)",stroke:"currentColor",strokeWidth:"2"}),m("rect",{x:"1",y:"19.5",width:"30",height:"2.5",rx:"1.25",fill:"currentColor"})]})}function Wi(){return m("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-oglyph",children:m("path",{d:"M12 5v14M5 12h14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function Ns(){return x("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:"sc-hglyph",children:[m("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"2"}),m("path",{d:"M12 7.5v5.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),m("circle",{cx:"12",cy:"16.5",r:"1.15",fill:"currentColor"})]})}function xs(){return x("svg",{className:"sc-act-glyph sc-spin",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[m("circle",{cx:"8",cy:"8",r:"6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",opacity:"0.3"}),m("path",{d:"M8 1.8a6.2 6.2 0 0 1 6.2 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function Di({spinning:e}){return m("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",className:e?"sc-dglyph sc-spin":"sc-dglyph",children:m("path",{d:"M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Hi(){return m("svg",{className:"sc-dglyph",viewBox:"0 0 14 14","aria-hidden":"true",children:m("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"})})}import{jsx as Ui}from"react/jsx-runtime";function eo({machines:e,onApproveRuntime:n,model:t,onPickModel:r}){return Ui(Wn,{machines:e,...n?{onApproveRuntime:n}:{},...t?{model:t}:{},...r?{onPickModel:r}:{}})}import{useCallback as Ne,useEffect as Te,useId as Qi,useMemo as wn,useRef as $n,useState as ue}from"react";var Nt=[{slug:"mac-arm",label:"macOS, Apple silicon"},{slug:"mac-intel",label:"macOS, Intel"},{slug:"windows",label:"Windows"},{slug:"linux",label:"Linux"}];function xt(e){if(!e)return"";try{return new URL(e).origin}catch{return""}}var Ps="soba.connect.choice",Fi=180*24*60*60*1e3;function no(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function to(e,n){return e?n?`${Ps}.${e}.${no(n)}`:`${Ps}.${e}`:null}function ro(e){if(!e||typeof localStorage>"u")return null;try{let n=localStorage.getItem(e);if(!n)return null;let t=JSON.parse(n);if(Date.now()-Date.parse(t.at)>Fi)return null;let r=Oe.find(o=>o.id===t.choice);return r?r.id:null}catch{return null}}function oo(e,n){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({choice:n,at:new Date().toISOString()}))}catch{}}var Es="soba.connect.model",zi=180*24*60*60*1e3;function so(e,n){return e?n?`${Es}.${e}.${no(n)}`:`${Es}.${e}`:null}function ir(e){if(!e||typeof localStorage>"u")return null;try{let n=localStorage.getItem(e);if(!n)return null;let t=JSON.parse(n);if(Date.now()-Date.parse(t.at)>zi)return null;let r=t.choice;return typeof r!="string"||!r||r.length>120?null:/^[\w.:@+-]+(\/[\w.:@+-]+)?$/.test(r)?r:null}catch{return null}}function ao(e,n){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({choice:n,at:new Date().toISOString()}))}catch{}}var Is="soba.connect.dismissed",Vi=30*24*60*60*1e3;function io(e,n){return e?n?`${Is}.${e}.${no(n)}`:`${Is}.${e}`:null}function lo(e){if(!e||typeof localStorage>"u")return!1;try{let n=localStorage.getItem(e);if(!n)return!1;let t=JSON.parse(n);return Date.now()-Date.parse(t.at)<Vi}catch{return!1}}function co(e){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(e,JSON.stringify({at:new Date().toISOString()}))}catch{}}import{Fragment as nt,jsx as g,jsxs as B}from"react/jsx-runtime";var uo=2e3,Ji=1e4,Yi=9e4,ji=6e4;function po(e,n,t,r=[],o){return e?"code":n&&(t.length>0||r.length>0)?"manage":o?"launch":"choose"}function Ls(e){return an(e)&&!e.pairing_lost}function lr(e){return new Map(e.map(n=>[n.id,Ls(n)]))}function qi(e){let n=Math.max(0,Math.round(e/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function go({client:e,initialCode:n,initialChoice:t,onConnected:r,showStatus:o=!0,initialContext:a=null,initialMachines:s,onClose:c,headingId:i,theme:l,reason:d,active:f=!0}){let h=!!a&&s!==void 0,[A,p]=ue(h?po(n,o,s??[],[],t):"loading"),[w,b]=ue(a),[C,S]=ue(s??[]),[W,O]=ue(n??""),[D,T]=ue(null),[U,y]=ue(null),[ee,q]=ue(!1),[ne,ae]=ue(0),[fe,he]=ue("app"),[P,Z]=ue(()=>Date.now()),[V,X]=ue(null),[ye,j]=ue(!1),[be,we]=ue(!1),[Ge,Ee]=ue("browser"),[te,ge]=ue(null),[u,R]=ue([]),[L,J]=ue(0),[G,re]=ue(null),N=$n(null),[H,ie]=ue(t??null),[Ie,Xe]=ue(null),E=wn(()=>{let k=w?.accent?.trim(),I=w?.background?.trim();if(!(!k&&!I))return I?{...En(I,k),background:I,borderRadius:"inherit"}:{"--sc-accent":k,"--sc-accent-fg":ft(k)}},[w?.accent,w?.background]),Le=Qi(),Re=i??Le,Nn=$n(null);Te(()=>{if(!e||h)return;let k=!0;return Promise.all([e.context(),e.machines()]).then(([I,v])=>{k&&(b(I),S(v),p(po(n,o,v)))}).catch(I=>{k&&(y(I.message),p("choose"))}),()=>{k=!1}},[e,n,o,h]),Te(()=>{A!=="loading"||!h||p(po(n,o,s??[]))},[A,h,n,o,s]),Te(()=>{s&&S(s)},[s]),Te(()=>{a&&b(a)},[a]);let Y=$n(!1),xn=$n(A);xn.current=A;let dn=$n(u);dn.current=u;let Ce=!!w?.hosted_available;Te(()=>{!o&&xn.current==="manage"&&p("choose")},[o]),Te(()=>{if(!e||!f||A!=="manage")return;let k=!0,I=ze(async()=>{try{let v=await e.machines();if(!k)return;S(v);let F=!Ce||Y.current;v.length===0&&dn.current.length===0&&F&&xn.current==="manage"&&p("choose")}catch{}},Ji,{immediate:!1});return()=>{k=!1,I()}},[A,e,Ce,f]);let rn=to(w?.publishable_key??null);Te(()=>{Xe(ro(rn))},[rn]),Te(()=>{if(!e||!Ce)return;let k=!0;return e.hosted().then(I=>{k&&(R(I.credentials),!Y.current&&(Y.current=!0,I.credentials.length>0&&o&&xn.current==="choose"&&p("manage")))}).catch(()=>{}),()=>{k=!1}},[e,Ce,o]),Te(()=>{if(!e||!f||A!=="hosted")return;let k=!0,I=async()=>{try{let pe=await e.hosted();if(!k)return!1;if(R(pe.credentials),pe.credentials.length>0)return p("hosted_connected"),re(null),!0}catch{}return!1},v=async()=>{N.current?.closed&&(N.current=null,!await I()&&k&&p("choose"))},F=ze(I,uo,{immediate:!1}),le=setInterval(v,400),Ke=pe=>{let Rn=pe.data;Rn?.source==="soba"&&Rn.type==="hosted_result"&&I()};return window.addEventListener("message",Ke),()=>{k=!1,F(),clearInterval(le),window.removeEventListener("message",Ke),N.current=null}},[e,A,f]);let wr=Ne(()=>{if(!e)return;let k=window.open("","soba-connect-plan","width=520,height=760,noopener=no");N.current=k,p("hosted"),J(Date.now()),re(null),y(null),e.startHosted().then(({url:I})=>{if(k&&!k.closed){k.location.href=I;return}re(I)}).catch(I=>{k?.close(),N.current=null,y(I.message),p("choose")})},[e]),zt=Ne(async k=>{if(e){q(!0);try{await e.disconnectHosted(k),R((await e.hosted()).credentials)}catch(I){y(I.message)}finally{q(!1)}}},[e]);Te(()=>{if(!e||!f||A!=="waiting")return;let k=!0,I=ze(async()=>{try{let v=await e.machines();if(!k)return;S(v);let F=Nn.current;if(!F)return;let le=v.filter(pe=>!F.has(pe.id)||F.get(pe.id)===!1&&Ls(pe)),Ke=le.find(pe=>pe.state!=="offline")??le[0];if(Ke){ge(Ke.id),H&&oo(rn,H);let pe=Oe.find(sn=>sn.id===H)?.expects??[],Rn=ve(Ke).find(sn=>pe.includes(sn.id));Rn&&e.preferRuntime(Ke.id,Rn.id).catch(()=>{}),p("connected"),r?.(v)}}catch{}},uo,{immediate:!1});return()=>{k=!1,I()}},[A,e,r,H,rn,f]);let vr=Ne(async()=>{if(e){y(null),q(!0);try{let k=await e.lookup(W);T(k),p("confirm")}catch(k){y(k.message)}finally{q(!1)}}},[e,W]),pn=Ne(async()=>{if(e){y(null),q(!0);try{try{Nn.current=lr(await e.machines())}catch{Nn.current=lr(C)}await e.approve(W),he("code"),p("waiting"),ae(Date.now())}catch(k){y(k.message)}finally{q(!1)}}},[e,W,C]),Vt=Ne(async()=>{if(e){q(!0);try{await e.deny(W),Ee("browser"),p("denied")}catch(k){y(k.message)}finally{q(!1)}}},[e,W]),de=wn(()=>w?.connect_url??null,[w]),[We,lt]=ue(()=>At()),Qt=wn(()=>de?bt(de,We??void 0,H??void 0):null,[de,We,H]),Jt=wn(()=>xt(de),[de]),Qn=Ne(k=>{if(C.length===0)return null;let I=Oe.find(F=>F.id===k);if(!I)return null;let v=C.flatMap(F=>F.runtimes??[]).filter(F=>I.expects.includes(F.id));return v.length===0?{tone:"dim",text:"not installed"}:v.some(F=>F.authenticated===!0)?{tone:"ok",text:"ready"}:v.every(F=>F.authenticated===!1)?{tone:"warn",text:"needs signing in"}:{tone:"dim",text:"installed"}},[C]),Yt=Ne((k=null)=>{ie(k),y(null),X(null),j(!1),we(!1),Jn.current=!1,lt(At()),p("launch")},[]),Jn=$n(!!t);Te(()=>{A!=="launch"||!de||Jn.current||(Jn.current=!0,j(!0),Er(de,{...We?{nonce:We}:{},...H?{want:H}:{}}).then(X))},[A,de,We,H]);let ct=Ne(()=>{j(!0),Pr().then(X)},[]),jt=Ne(k=>{if(be){let I=At();we(!1),lt(I),de&&(k.preventDefault(),window.location.href=bt(de,I??void 0,H??void 0))}ct()},[be,ct,de,H]),mn=wn(()=>{let k=w?.runtimes;return k?Oe.filter(I=>k.includes(I.id)):Zr()},[w?.runtimes]),De=wn(()=>{let k=Oe.find(I=>I.id===H);return k?{choice:k,Mark:yn[k.id]??null}:null},[H]),on=wn(()=>C.find(k=>k.id===te),[C,te]),ut=Ne(()=>{p("manage"),c?.()},[c]);Te(()=>{let k=We;if(!e||!f||A!=="launch"||!k)return;let I=!1,v=Date.now()+15e4,F=()=>{};return F=ze(async()=>{if(Date.now()>v){F(),we(!0);return}try{let le=await e.claim(k);if(I)return;if(le.declined){F(),X(null),Ee("machine"),p("denied");return}if(!le.claimed)return;F();try{Nn.current=lr(await e.machines())}catch{Nn.current=lr(C)}he("app"),p("waiting"),ae(Date.now())}catch{}},uo,{immediate:!1,idle:!1}),()=>{I=!0,F()}},[e,A,C,We,f]);let Ae=wn(()=>{if(!D)return null;if(D.approved||D.denied)return"answered";let k=D.expires_at?Date.parse(D.expires_at):Number.NaN;return Number.isFinite(k)&&k<=P?"expired":"live"},[D,P]);Te(()=>{if(!(A==="confirm"&&Ae==="live"||A==="waiting"||A==="hosted"))return;let I=setInterval(()=>Z(Date.now()),1e3);return()=>clearInterval(I)},[A,Ae]);let Sn=Ne(async(k,I)=>{if(e)try{await e.approveRuntime(k,I),S(await e.machines())}catch(v){y(v.message)}},[e]),qt=Ne(async(k,I)=>{if(e)try{await e.preferRuntime(k,I),S(await e.machines())}catch(v){y(v.message)}},[e]);return A==="loading"?g("div",{className:"soba-connect",...l?{"data-theme":l}:{},style:E,children:g("div",{className:"sc-card",children:g("p",{className:"sc-note",children:"Loading\u2026"})})}):B("div",{className:"soba-connect",...l?{"data-theme":l}:{},style:E,children:[c&&g("button",{type:"button",className:"sc-modal-close",onClick:c,"aria-label":"Close",children:"\xD7"}),A==="manage"&&B("div",{className:"sc-card",children:[g("h2",{className:"sc-title",id:Re,children:"Your compute"}),B("p",{className:"sc-sub",children:[g(cr,{context:w})," ",C.length>0&&u.length>0?"runs on your connected plan, and on these machines while they are awake.":u.length>0?"runs on the plan you connected. Nothing here is charged to you.":"runs on these machines, while they are awake."]}),g(Wn,{machines:C,hosted:u,onApproveRuntime:Sn,onPreferRuntime:(k,I)=>void qt(k,I),onDisconnectHosted:k=>void zt(k),onPair:()=>p("choose"),busy:ee,...w?.app.name?{appName:w.app.name}:{}}),U&&g("p",{className:"sc-error",children:U})]}),A==="choose"&&B("div",{className:"sc-card",children:[g(Xi,{context:w}),g("h2",{className:"sc-h",id:Re,children:d==="payment_required"?"Carry on with your own AI":d==="no_compute"?"This run needs a machine":"Connect your AI"}),g("p",{className:"sc-p",children:"Use compute you already have."}),de&&mn.length>0&&B(nt,{children:[g("div",{className:"sc-opts",children:mn.map(k=>{let I=yn[k.id];return B("button",{type:"button",className:"sc-opt",onClick:()=>Yt(k.id),children:[g("span",{className:"sc-opt-tile","aria-hidden":"true",children:I&&g(I,{className:"sc-opt-mark"})}),g("span",{className:"sc-opt-text",children:g("span",{className:"sc-opt-label",children:k.label})}),(()=>{let v=Qn(k.id);return v?g("span",{className:`sc-opt-has sc-opt-has-${v.tone}`,children:v.text}):Ie===k.id?g("span",{className:"sc-opt-last",children:"last used"}):g(mo,{className:"sc-opt-go"})})()]},k.id)})}),B("p",{className:"sc-opt-note",children:["Your accounts stay there. ",Os(w)," never sees them."]})]}),(!de||mn.length===0)&&g("p",{className:"sc-error",style:{marginTop:16},children:"This app has no publishable key yet, so there is nothing to pair against."}),U&&g("p",{className:"sc-error",children:U}),de&&w?.show_code===!0&&g("div",{className:"sc-opt-alt",children:g("button",{type:"button",className:"sc-alt-link",onClick:()=>p("code"),children:"I have a code"})})]}),A==="launch"&&B("div",{className:"sc-card",children:[B("div",{className:"sc-head",children:[g(et,{onClick:()=>p("choose")}),g("p",{className:"sc-head-title",children:"Soba"})]}),g(ur,{mark:De?.Mark??Me,still:be||!ye&&V===null}),g("h2",{className:"sc-h",id:Re,children:be?"No answer from this machine":V==="absent"?"Nothing opened":V===null?"Opening Soba\u2026":"Approve it on this machine"}),be?g("p",{className:"sc-p",children:"The Soba app did not answer. It may not be open, or nobody was there. Try again when you are ready."}):V==="absent"?g("p",{className:"sc-p",children:"Nothing opened on this machine. Open it yourself below, or install it if it is not here yet."}):g("p",{className:"sc-p",children:V===null?"Approve it there and this page does the rest.":"This page finishes on its own."}),De&&B("p",{className:"sc-prereq",children:[De.Mark&&g(De.Mark,{className:"sc-rt-mark"}),"Needs ",De.choice.prerequisite]}),B("div",{className:"sc-stack",style:{marginTop:18},children:[g("a",{className:V==="absent"||be?"sc-btn sc-btn-primary":"sc-btn",href:Qt??"#",onClick:jt,children:be?"Try again":V==="absent"?"Open Soba":"Open it again"}),g("p",{className:"sc-note",children:V===null?"Your browser will ask permission first.":"Your browser asks permission the first time."}),De&&V==="absent"&&g("p",{className:"sc-note",children:g(_i,{text:De.choice.hint})}),B("div",{className:"sc-foot-strip",children:[g("span",{children:"Not installed on this machine?"}),B("button",{type:"button",className:"sc-foot-go",onClick:()=>p("get"),children:["Get it",g(mo,{})]})]})]})]}),A==="get"&&B("div",{className:"sc-card",children:[B("div",{className:"sc-head",children:[g(et,{onClick:()=>p("launch")}),g("p",{className:"sc-head-title",children:"Get Soba"})]}),g("div",{className:"sc-opts",children:Nt.map(k=>B("a",{className:"sc-opt",href:`${Jt}/download/${k.slug}`,target:"_blank",rel:"noreferrer noopener",children:[g("span",{className:"sc-opt-tile","aria-hidden":"true",children:g(Jr,{className:"sc-opt-mark"})}),g("span",{className:"sc-opt-text",children:g("span",{className:"sc-opt-label",children:k.label})}),g(mo,{className:"sc-opt-go"})]},k.slug))}),g("p",{className:"sc-opt-note",children:"Install it, then come back here and press the row you started with."})]}),A==="code"&&B("div",{className:"sc-card",children:[B("div",{className:"sc-head",children:[g(et,{onClick:()=>p("choose")}),g("p",{className:"sc-head-title",children:"Soba"})]}),g("h2",{className:"sc-h",id:Re,children:"Enter the code from that machine"}),g("p",{className:"sc-p",children:"Eight characters, shown by the Soba app once you paste the link."}),B("form",{className:"sc-stack",style:{marginTop:16},onSubmit:k=>{k.preventDefault(),vr()},children:[g("input",{className:"sc-input",value:W,onChange:k=>O(k.target.value),placeholder:"ACDE-F234",autoComplete:"off",autoFocus:!0,"aria-label":"Pairing code"}),U&&g("p",{className:"sc-error",children:U}),g("button",{type:"submit",className:"sc-btn sc-btn-primary",disabled:ee||W.length<8,children:ee?"Checking\u2026":"Continue"})]})]}),A==="confirm"&&D&&B("div",{className:"sc-card",children:[B("div",{className:"sc-head",children:[g(et,{onClick:()=>p("code")}),g("p",{className:"sc-head-title",children:"Soba"})]}),g("h2",{className:"sc-title",children:"Attach this machine to your account?"}),B("p",{className:"sc-sub",children:[g(cr,{context:w})," may send your runs to it once you approve. It can never see the account or the keys on it."]}),B("ul",{className:"sc-facts",children:[g(St,{k:"Code",v:D.user_code}),g(St,{k:"Machine",v:D.hostname??"not stated"}),g(St,{k:"System",v:[D.platform,D.arch].filter(Boolean).join(" / ")||"not stated"}),g(St,{k:"Asked by",v:D.client??"not stated"}),D.labels.length>0&&g(St,{k:"Labels",v:D.labels.join(", ")})]}),g("p",{className:"sc-note",style:{marginTop:12},children:"Every line above is what that machine said about itself. If none of it looks like a computer of yours, say no."}),Ae==="expired"&&g("p",{className:"sc-error",children:"That code has expired. Ask the machine for a new one. It prints a fresh code each time it starts."}),Ae==="answered"&&g("p",{className:"sc-error",children:"That code has already been answered. If it was not you, deny the next one."}),U&&g("p",{className:"sc-error",children:U}),B("div",{className:"sc-row",style:{marginTop:16},children:[g("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>void pn(),disabled:ee||Ae!=="live",children:"Approve"}),g("button",{type:"button",className:"sc-btn",onClick:()=>void Vt(),disabled:ee||Ae==="answered",children:"No, deny it"})]}),Ae==="live"&&D.expires_at&&B("p",{className:"sc-note",style:{marginTop:10},children:["This code expires in ",qi(Date.parse(D.expires_at)-P),"."]})]}),A==="waiting"&&B("div",{className:"sc-card",children:[B("div",{className:"sc-head",children:[g(et,{onClick:()=>p("choose")}),g("p",{className:"sc-head-title",children:De?.choice.short??"Soba"})]}),g(ur,{mark:De?.Mark??Me}),g("h2",{className:"sc-h",id:Re,children:"Approved. Waiting for it to connect"}),g("p",{className:"sc-p",children:"Nothing more to do here. This page changes when it arrives."}),ne>0&&P-ne>Yi&&B("ol",{className:"sc-stall",children:[fe==="app"?B(nt,{children:[g(dr,{done:!0,title:"Soba Connect opened",line:"On this machine"}),g(dr,{done:!0,title:"You approved it",line:"In Soba Connect"})]}):g(dr,{done:!0,title:"You approved the code",line:"On this page"}),g(dr,{title:`Still nothing from ${D?.hostname??"that machine"}`,line:"Look at Soba Connect on that machine: it says what it is doing. This keeps watching either way.",children:g("button",{type:"button",className:"sc-btn sc-stall-act",onClick:()=>void Tn(),children:"Open Soba Connect"})})]})]}),A==="connected"&&B("div",{className:"sc-card",children:[g(fo,{tone:"ok"}),g("h2",{className:"sc-h",id:Re,children:on?.label?`${on.label} is connected`:"Connected"}),B("p",{className:"sc-p",children:[g(cr,{context:w})," will use ",on?.label?"it":"this machine"," from now on, while it is awake."]}),o&&B(nt,{children:[on&&g(Ki,{machine:on}),g("button",{type:"button",className:"sc-btn sc-btn-primary sc-btn-wide",style:{marginTop:14},onClick:ut,children:"Done"})]})]}),A==="hosted"&&B("div",{className:"sc-card",children:[B("div",{className:"sc-head",children:[g(et,{onClick:()=>p("choose")}),g("p",{className:"sc-head-title",children:"ChatGPT"})]}),G?g(ur,{mark:Gn,still:!0}):g(ur,{mark:Gn}),g("h2",{className:"sc-h",id:Re,children:G?"Your browser blocked the window":"Finish signing in to ChatGPT"}),g("p",{className:"sc-p",children:G?"Nothing opened. Open the sign-in yourself below. A link you click is allowed where a window we open is not.":"Approve it in the window that opened."}),B("div",{className:"sc-stack",style:{marginTop:18},children:[G&&g("a",{className:"sc-btn sc-btn-primary",href:G,target:"soba-connect-plan",rel:"noreferrer",children:"Open the ChatGPT sign-in"}),U&&g("p",{className:"sc-error",children:U}),L>0&&P-L>ji&&g("p",{className:"sc-note sc-tone-warn",children:"Still nothing. The window may have been closed before it finished, or the sign-in may have been declined. This keeps watching either way."})]})]}),A==="hosted_connected"&&B("div",{className:"sc-card",children:[g(fo,{tone:"ok"}),g("h2",{className:"sc-h",id:Re,children:"ChatGPT is connected"}),B("p",{className:"sc-p",children:[g(cr,{context:w})," will run on your ChatGPT plan",u[0]?.account_label?` (${u[0].account_label})`:"",". Nothing more to pay, nothing to install."]}),g("p",{className:"sc-opt-note",style:{textAlign:"center"},children:"It runs on our side, so it has no access to your files or your terminal."}),o&&B(nt,{children:[g("button",{type:"button",className:"sc-btn sc-btn-wide",style:{marginTop:16},onClick:ut,children:"Done"}),g("div",{className:"sc-opt-alt",children:g("button",{type:"button",className:"sc-alt-link",onClick:()=>p("choose"),children:"Connect a machine too"})})]})]}),A==="denied"&&B("div",{className:"sc-card",children:[g(fo,{tone:"off"}),g("h2",{className:"sc-h",id:Re,children:"Declined"}),g("p",{className:"sc-p",children:Ge==="machine"?"Nothing was connected. You can ask again whenever you like.":"That machine was not attached to your account, and the terminal has been told so."}),g("button",{type:"button",className:"sc-btn sc-btn-wide",style:{marginTop:16},onClick:()=>p("choose"),children:"Back to the start"})]})]})}function Os(e){return e?.app.name??"this app"}function Zi(e){let n=e?.app.icon_urls;if(n?.length)return n;let t=e?.app.icon_url;return t?[t]:[]}function Ts(e){let n=Zi(e),[t,r]=ue([]),o=Ne(c=>{c&&r(i=>i.includes(c)?i:[...i,c])},[]),a=Ne(c=>o(c.currentTarget.getAttribute("src")),[o]),s=Ne(c=>{c?.complete&&c.naturalWidth===0&&o(c.getAttribute("src"))},[o]);return{icon:n.find(c=>!t.includes(c)),onError:a,ref:s}}function Xi({context:e}){let{icon:n,onError:t,ref:r}=Ts(e);return e?.app.mark==="soba"?g(Me,{className:"sc-app-mark"}):n?g("img",{className:"sc-app-mark",src:n,alt:"","aria-hidden":"true",ref:r,onError:t}):null}function cr({context:e}){let{icon:n,onError:t,ref:r}=Ts(e),o=e?.app.mark==="soba";return B("span",{className:"sc-app",children:[o&&g(Me,{className:"sc-app-icon"}),!o&&n&&g("img",{className:"sc-app-icon",src:n,alt:"",ref:r,onError:t}),Os(e)]})}function et({onClick:e}){return g("button",{type:"button",className:"sc-head-back",onClick:e,"aria-label":"Back",children:g("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:g("path",{d:"M15 5 8 12l7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}function mo({className:e}){return g("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:g("path",{d:"M9 5l7 7-7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ur({mark:e,still:n}){return B("span",{className:"sc-waiting","aria-hidden":"true",children:[!n&&g("svg",{className:"sc-waiting-orbit",viewBox:"0 0 100 100","aria-hidden":"true",focusable:"false",children:g("circle",{className:"sc-waiting-arc",cx:"50",cy:"50",r:"46"})}),g(e,{className:"sc-waiting-mark"})]})}function fo({tone:e}){return g("span",{className:`sc-result sc-result-${e}`,"aria-hidden":"true",children:g(fn,{kind:e==="ok"?"snap":"gone",size:84})})}function Ki({machine:e}){let{runtime:n}=Je(e);if(!n)return null;let t=_e(n);return B("div",{className:"sc-arrived",children:[g($r,{id:n.id,name:n.display_name}),g("span",{className:"sc-arrived-name",children:n.display_name}),B("span",{className:`sc-arrived-auth${t.tone==="warn"?" sc-tone-warn":""}`,children:[t.tone==="ok"&&g("i",{className:"sc-arrived-dot","aria-hidden":"true"}),t.tone==="ok"?"Signed in":t.tone==="warn"?"Signed out":"Could not tell"]})]})}function dr({done:e,title:n,line:t,children:r}){return B("li",{className:"sc-stall-step",children:[B("svg",{viewBox:"0 0 20 20",className:e?"sc-stall-ok":"sc-stall-open","aria-hidden":"true",children:[g("circle",{cx:"10",cy:"10",r:"9"}),e?g("path",{d:"M6 10.3 8.7 13 14 7.5"}):B(nt,{children:[g("path",{d:"M10 5.5v5.5"}),g("circle",{className:"sc-stall-pt",cx:"10",cy:"14.3",r:"1.2"})]})]}),g("span",{className:"sc-stall-title",children:n}),g("span",{className:"sc-stall-line",children:t}),r&&g("span",{className:"sc-stall-more",children:r})]})}function _i({text:e}){return g(nt,{children:e.split("`").map((n,t)=>t%2===1?g("code",{className:"sc-inline-code",children:n},t):n)})}function St({k:e,v:n}){return B("li",{className:"sc-fact",children:[g("span",{className:"sc-fact-key",children:e}),g("span",{children:n})]})}import{forwardRef as $i}from"react";import{jsx as ho,jsxs as bo}from"react/jsx-runtime";var Ao=$i(function({machine:n,className:t,...r},o){if(!n)return null;let{ariaLabel:a,state:s}=Zn(n);return bo("button",{ref:o,type:"button","aria-label":a,className:["sc-btn","sc-btn-connected",t].filter(Boolean).join(" "),...r,children:[ho("span",{className:"sc-pill-tile","aria-hidden":"true",children:ho(fn,{kind:s.tone==="busy"?"serving":s.tone==="ok"?"ready":n.pairing_lost?"gone":"paused",size:16,className:"sc-pill-mark"})}),bo("span",{className:"sc-btn-connected-text",children:[s.word,!n.pairing_lost&&bo("span",{className:"sc-btn-connected-where",children:[" on ",ce(n)]})]}),ho("i",{className:`sc-dot sc-dot-${s.tone}`,"aria-hidden":"true"})]})});function Bs(e){if(e.type==="boolean")return e.name;if(e.type==="text")return`${e.name}: ${String(e.value??"").trim()}`;let n=e.unit?.trim()||e.name.toLowerCase();if(e.price){let r=el(e.price.amountMicros),o=n.endsWith("s")?n.slice(0,-1):n,a=e.price.included>0?`${e.price.included.toLocaleString("en-US")} ${n} included, then ${r} per ${o}`:`${r} per ${o}`;return e.value===null?a:`${a}, up to ${e.value.toLocaleString("en-US")}`}let t=e.resets==="month"?" a month":"";return e.value===null?`Unlimited ${n}${t}`:`${e.value.toLocaleString("en-US")} ${n}${t}`}var el=e=>(e/1e6).toLocaleString("en-US",{style:"currency",currency:"USD"});function pr(e){let n=[];for(let t of e??[])!t.name?.trim()&&!t.unit?.trim()||n.push({text:Bs(t),included:!(t.type==="boolean"&&t.value!==!0)});return n}function yo(e,n,t=1){let r=e.quantities?.[n]??0,o=(i,l=null)=>({feature:n,allowed:!1,reason:i,limit:l,used:r,remaining:l===null?null:Math.max(0,l-r),unlimited:!1});if(e.features===null)return o("no_plan");if(e.ended)return o("plan_ended",0);if(!(n in e.features))return o("not_included");let a=e.features[n];if(typeof a=="string")return a.trim()?{feature:n,allowed:!0,reason:null,limit:null,used:0,remaining:null,unlimited:!1}:o("not_included");if(typeof a=="boolean")return a?{feature:n,allowed:!0,reason:null,limit:null,used:0,remaining:null,unlimited:!1}:o("not_included");if(a==null)return{feature:n,allowed:!0,reason:null,limit:null,used:r,remaining:null,unlimited:!0};let s=Math.max(0,t),c=Math.max(0,a-r);return a===0?o("not_included",0):r+s>a?o("limit_reached",a):{feature:n,allowed:!0,reason:null,limit:a,used:r,remaining:c,unlimited:!1}}import{useEffect as nl,useRef as vo}from"react";var mr=0,wo=null;function Gs(){if(typeof document>"u")return()=>{};mr===0&&(wo=document.body.style.overflow,document.body.style.overflow="hidden"),mr+=1;let e=!1;return()=>{e||(e=!0,mr-=1,mr===0&&(document.body.style.overflow=wo??"",wo=null))}}import{jsx as Ws}from"react/jsx-runtime";function Rt({open:e,onClose:n,labelledBy:t,theme:r,style:o,children:a}){let s=vo(null),c=vo(null),i=vo(null);return nl(()=>{let l=s.current;if(l){if(!e){l.open&&l.close();return}return l.open||l.showModal(),document.activeElement===l&&c.current?.focus(),Gs()}},[e]),Ws("dialog",{ref:s,className:"soba-connect sc-modal","aria-labelledby":t,...r?{"data-theme":r}:{},style:o,onCancel:l=>{l.preventDefault(),n()},onPointerDown:l=>{i.current=l.target},onClick:l=>{l.target===l.currentTarget&&i.current===l.currentTarget&&n()},children:Ws("div",{className:"sc-modal-sheet",ref:c,tabIndex:-1,children:a})})}import{useEffect as ko,useRef as tl}from"react";import{jsx as rl}from"react/jsx-runtime";var Dn=8;function Co({open:e,onClose:n,anchor:t,label:r,theme:o,style:a,children:s}){let c=tl(null);return ko(()=>{let i=c.current;if(!(!i||!(typeof i.showPopover=="function")))try{e?i.showPopover():i.hidePopover()}catch{}},[e]),ko(()=>{if(!e)return;let i=()=>{let d=c.current,f=t.current;if(!d||!f)return;let h=f.getBoundingClientRect(),A=d.offsetWidth,p=d.offsetHeight,w=window.innerWidth-A-Dn,b=Math.max(Dn,Math.min(h.right-A,Math.max(Dn,w))),C=h.bottom+Dn,S=h.top-Dn-p,W=C+p>window.innerHeight-Dn&&S>Dn?S:C;d.style.left=`${Math.round(b)}px`,d.style.top=`${Math.round(W)}px`};i();let l=requestAnimationFrame(i);return window.addEventListener("scroll",i,!0),window.addEventListener("resize",i),()=>{cancelAnimationFrame(l),window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i)}},[e,t]),ko(()=>{if(!e)return;let i=d=>{d.key==="Escape"&&n()},l=d=>{let f=d.target;f&&(c.current?.contains(f)||t.current?.contains(f)||n())};return document.addEventListener("keydown",i),document.addEventListener("pointerdown",l,!0),()=>{document.removeEventListener("keydown",i),document.removeEventListener("pointerdown",l,!0)}},[e,n,t]),rl("div",{ref:c,role:"dialog","aria-label":r,className:"soba-connect sc-pop",...o?{"data-theme":o}:{},popover:"manual",hidden:!e,style:a,children:s})}var Pt=new Map,tt=new Map,Ds=!1;function ol(){Ds||typeof window>"u"||(Ds=!0,window.addEventListener("storage",e=>{!e.key||!Pt.has(e.key)||(tt.set(e.key,ir(e.key)),Mo(e.key))}))}function Mo(e){for(let n of Pt.get(e)??[])n()}function Et(e){return e??""}function No(e,n){let t=Et(e);ol();let r=Pt.get(t)??new Set;return r.add(n),Pt.set(t,r),()=>{r.delete(n),r.size===0&&Pt.delete(t)}}function fr(e){let n=Et(e),t=tt.get(n);if(t!==void 0)return t;let r=e?ir(e):null;return tt.set(n,r),r}function xo(){return null}function So(e,n){fr(e)===null&&(tt.set(Et(e),n),Mo(Et(e)))}function Ro(e,n){let t=Et(e);tt.get(t)!==n&&(tt.set(t,n),ao(e,n),Mo(t))}var sl=e=>e.toLocaleString("en-US");function Be(e,n){if(e==="cost")return`${(n/1e4).toLocaleString("en-US",{style:"currency",currency:"USD"})} of usage`;let t=e==="token"?"token":e;return`${sl(n)} ${t}${n===1?"":"s"}`}function Hn(e){return e==="token"?"1M tokens":e==="cost"?"$1 of usage":e==="credit"?"1,000 credits":e}function It(e){return e==="cost"?"usage":`${e}s`}function Lt(e,n,t){let r=t?.trim();if(!r||e!=="run"&&e!=="task"&&e!=="message")return Be(e,n);let o=r.endsWith("s")?r.slice(0,-1):r;return`${n.toLocaleString("en-US")} ${n===1?o:r}`}function ln(e){return e.reward==="included"&&e.includedUnits!==null?`${Be(e.unit,e.includedUnits)} a month once you connect`:e.reward==="credit"&&e.creditMicros>0?`${al(e.creditMicros)} back each month you stay connected`:null}function cn(e){return e==="included"}function Un(e){if(!e.routePrefer.some(t=>Po.has(t)||t==="user-api-key"))return null;let n=e.ownUnit??e.unit;return e.ownIncludedUnits===null?e.includedUnits!==null?`Unlimited ${n==="cost"?"usage":(n==="run"||n==="task")&&e.taskNoun?.trim()?e.taskNoun.trim():`${n}s`} on your own AI`:null:`${Lt(n,e.ownIncludedUnits,e.taskNoun)} a month on your own AI`}var Po=new Set(["user-hardware","user-subscription"]),Hs=new Set(["open-weights","frontier"]);function je(e){return e===null||e.length===0?!1:e.every(n=>Po.has(n))}var al=e=>(e/1e6).toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2});function Eo(e,n){if(!(n===null||n.some(a=>Hs.has(a))))return!1;let r=e.findIndex(a=>Po.has(a));if(r===-1)return!1;let o=e.findIndex(a=>Hs.has(a));return o===-1||r<o}import{createContext as Us,useContext as Fs}from"react";var Io=Us(null);function vn(){return Fs(Io)}var Lo=Us({context:null,machines:void 0,theme:"light"});function $(){return Fs(Lo)}import{useMemo as cl}from"react";import{createContext as il,useContext as ll}from"react";var Oo=il(null);function _(){let e=ll(Oo);if(!e)throw new Error("useSoba() must be used inside a <SobaProvider>.");return e}function Ot(){let{compute:e}=_();return cl(()=>{let n=e.machines,t=[...n].sort((a,s)=>$e([a,s])===a?-1:1).map(ul),r=$e([...n]),o=In(n);return{view:t.length?"machines":e.loading?"loading":e.error?"error":"empty",machines:t,primary:r?t.find(a=>a.machine.id===r.id)??null:null,connected:e.connected,online:e.online,stalled:e.connected&&!e.online&&o?t.find(a=>a.machine.id===o.id)??null:null,loading:e.loading,error:e.error,refresh:e.refresh}},[e])}function ul(e){let n=Je(e);return{machine:e,name:ce(e),state:Ln(e),status:xr(e),hardware:gt(e),lastSeen:e.state==="offline"?ht(e.last_seen_at):null,runtimes:ve(e).map(t=>({runtime:t,name:t.display_name,auth:_e(t),quarantined:!!t.quarantined})),runsOn:{by:n.by,name:n.runtime?.display_name??null}}}import{useCallback as To,useEffect as dl,useMemo as qe,useSyncExternalStore as pl}from"react";function Fn(e={}){let{compute:n,connect:t,models:r}=_(),{value:o,onChange:a,defaultValue:s,remember:c=!0,user:i}=e,l=e.layout??(e.choices?.length?"choices":r.layout??"providers"),d=JSON.stringify(e.choices??[]),f=o!==void 0,h=c&&!f?so(t.publishableKey,i):null,A=To(P=>No(h,P),[h]),p=pl(A,To(()=>fr(h),[h]),xo),w=qe(()=>r.rowsByLayout[l]??(r.sizes===!1?{auto:!0,fast:!1,best:!1}:void 0),[r.rowsByLayout,r.sizes,l]),b=qe(()=>Gr(yt(n.machines,r.providers,r.names,r.route?.allow),w),[n.machines,r.providers,r.names,r.route,w]),C=qe(()=>Br(b,l,JSON.parse(d)),[b,l,d]),S=qe(()=>Wr(C,l,w),[C,l,w]),W=l==="models"&&w?.own===!0,O=qe(()=>wt(S,l,W),[S,l,W]),D=qe(()=>[...b,...C.filter(P=>!b.some(Z=>Z.id===P.id))],[b,C]),T=qe(()=>{let P=[];for(let V of[...n.machines].sort(qn))for(let X of ve(V)){if(P.some(j=>j.id===X.id)||r.route&&!r.route.allow.includes(X.cost_class))continue;let ye=en[X.id];P.push({id:X.id,name:X.display_name,...ye?{logo:ye}:{},options:S.filter(j=>j.kind==="named"&&j.runtime===X.id)})}let Z=O.flatMap(V=>V.options.map(X=>X.id));for(let V of P)V.options.sort((X,ye)=>Z.indexOf(X.id)-Z.indexOf(ye.id));return P},[n.machines,S,O,r.route]),U=qe(()=>r.providers.map(P=>{let Z=`@${P.id}/`;return{id:P.id,name:P.name,...P.provider?{mark:P.provider}:{},costClass:P.cost_class,...P.locked?{locked:P.locked}:{},options:b.filter(V=>V.id.startsWith(Z))}}),[r.providers,b]);dl(()=>{f||!s||So(h,s)},[f,s,h]);let y=qe(()=>{let P=r.names.find(Z=>Z.default);if(P&&l==="choices")return`alias:${P.alias}`;for(let Z of r.providers){let V=Z.models.find(X=>X.default);if(V&&l!=="choices")return`@${Z.id}/${V.model}`}return null},[r.names,r.providers,l]),ee=f?o:l==="automatic"?s??null:p??s??y,q=qe(()=>S.some(P=>P.kind==="auto")?null:O.flatMap(P=>P.options).find(P=>!P.locked)?.id??null,[S,O]),ne=!ee||ee==="auto"?q??ee:ee,{selected:ae,unavailable:fe}=qe(()=>Dr(D,ne??null),[D,ne]),he=To(P=>{f||Ro(h,P),a?.(P)},[f,h,a]);return{options:S,groups:O,selected:ae,select:he,agents:T,providers:U,models:b.filter(P=>P.kind==="provider"),choices:S.filter(P=>P.choice!==void 0),layout:l,ownInList:W,search:w?.search!==!1,run:Hr(ae),unavailable:fe,pickable:bn(S),loading:n.loading&&!n.machines.length||r.loading&&!r.providers.length&&!n.machines.length}}function ml(e){return e.runtime?en[e.runtime]:void 0}import{jsx as Tt}from"react/jsx-runtime";function fl({className:e}){let{theme:n}=$(),t=e?`soba-connect ${e}`:"soba-connect";return Tt("div",{className:t,"data-theme":n,children:Tt(Bo,{})})}function Bo(){let e=Ot(),n=Fn();return e.view==="loading"?Tt("p",{className:"sc-note",children:"Loading\u2026"}):e.view==="error"?Tt("p",{className:"sc-error",children:e.error?.message}):Tt(eo,{machines:e.machines.map(t=>t.machine),model:n.selected,onPickModel:n.select})}import{useCallback as Gt,useEffect as Ho,useMemo as kl,useRef as Uo,useState as ot}from"react";import{useId as gl}from"react";import{jsx as rt,jsxs as gr}from"react/jsx-runtime";function Bt({open:e,onOpenChange:n,initialCode:t,onConnected:r,showStatus:o,reason:a}){let{error:s}=_(),c=vn(),i=$(),l=()=>n(!1),d=gl(),f=i.context?.background?.trim(),h=f?En(f,i.context?.accent):void 0;return gr(Rt,{open:e,onClose:l,labelledBy:d,theme:i.theme,style:h,children:[s?gr("div",{className:"sc-card",children:[rt("h2",{className:"sc-title",id:d,children:"Could not start"}),rt("p",{className:"sc-error",children:s.message})]}):!c&&!i.context?gr("div",{className:"sc-card",children:[rt("h2",{className:"sc-title",id:d,children:"One moment"}),rt("p",{className:"sc-note",children:"Getting your compute\u2026"})]}):rt(go,{client:c,active:e,onClose:l,headingId:d,theme:i.theme,initialContext:i.context,...i.machines!==void 0?{initialMachines:i.machines}:{},...t?{initialCode:t}:{},...r?{onConnected:r}:{},...o===void 0?{}:{showStatus:o},...a?{reason:a}:{}}),gr("p",{className:"sc-modal-foot",children:[rt(Me,{className:"sc-foot-mark"}),"Secured by Soba"]})]})}import{forwardRef as hl}from"react";import{jsx as bl}from"react/jsx-runtime";var Go=hl(function(n,t){let{theme:r}=$();return bl(Ao,{ref:t,"data-theme":r,...n})});import{useCallback as Al}from"react";function yl(){let{connect:e}=_(),n=Ot(),t=Al(()=>e.open("manual"),[e]);return{...Zn(n.primary?.machine??null),machine:n.primary,open:t,canOpen:e.hasModal,loading:n.view==="loading"}}function Wo(e){return Zn(e)}import{useCallback as zs,useEffect as wl,useState as vl}from"react";function Do({enabled:e=!0,intervalMs:n=3e3}={}){let t=vn(),[r,o]=vl(null),a=zs(async()=>{t&&o(await t.runs())},[t]);wl(()=>{if(!e||!t)return;let c=!0,i=ze(async()=>{let l=await t.runs();c&&o(l)},n);return()=>{c=!1,i()}},[e,t,n]);let s=zs(async c=>{if(!t)throw new Error("Stopping a run needs <SobaProvider>.");await t.stopRun(c),await a().catch(()=>{})},[t,a]);return{runs:r,refresh:a,stop:s}}import{Fragment as Vs,jsx as st,jsxs as Qs}from"react/jsx-runtime";function zn({children:e,variant:n,className:t,initialCode:r,onConnected:o,defaultOpen:a,open:s,onOpenChange:c,showConnected:i=!0}){let{compute:l,connect:d}=_(),f=$(),{theme:h}=f,A=vn(),[p,w]=ot(a??!!r),b=Uo(null),C=s!==void 0,S=!C&&!a&&!r&&d.hasModal,W=C?s:S?d.isOpen:p,O=N=>{S?N?d.open("manual"):d.close():C||w(N),c?.(N)},D=Uo(W);Ho(()=>{D.current&&!W&&b.current?.focus(),D.current=W},[W]);let[T,U]=ot(!1),{runs:y,stop:ee}=Do({enabled:T}),q=Fn(),ne=kl(()=>T&&y?Cl(l.machines,y):l.machines,[l.machines,T,y]),ae=$e(ne),fe=i&&Wo(ae).connected,he=Gt(()=>U(!1),[]),[P,Z]=ot(!1),V=Gt(async()=>{Z(!0);try{await l.refresh()}finally{Z(!1)}},[l]),X=Uo(V);X.current=V,Ho(()=>{T&&X.current()},[T]);let[ye,j]=ot(!1),[be,we]=ot([]),Ge=!!f.context?.hosted_available;Ho(()=>{if(!T||!A||!Ge)return;let N=!0;return A.hosted().then(H=>{N&&we(H.credentials)}).catch(()=>{}),()=>{N=!1}},[T,A,Ge]);let[Ee,te]=ot(null),ge=Gt(async(N,H)=>{if(A){te(null);try{await A.approveRuntime(N,H),await l.refresh()}catch(ie){te(ie.message)}}},[A,l]),u=Gt(async(N,H)=>{if(A){te(null);try{await A.preferRuntime(N,H),await l.refresh()}catch(ie){te(ie.message)}}},[A,l]),R=Gt(async N=>{if(A){te(null);try{await A.disconnectHosted(N),we((await A.hosted()).credentials)}catch(H){te(H.message)}}},[A]),L=f.context?.background?.trim(),J=L?En(L,f.context?.accent):void 0,G=fe&&!e,re=()=>{if(G&&!C&&!a&&!r){U(N=>!N);return}O(!0)};return Qs(Vs,{children:[G?st(Go,{ref:b,machine:ae,"aria-haspopup":"dialog","aria-expanded":T,onClick:re,...t?{className:t}:{}}):st("button",{ref:b,type:"button","data-theme":h,className:["sc-btn","sc-btn-icon",n==="primary"?"sc-btn-primary":"",t].filter(Boolean).join(" "),onClick:re,children:e??Qs(Vs,{children:[st(Me,{className:"sc-btn-mark"}),"Connect compute"]})}),st(Co,{open:T,onClose:he,anchor:b,label:"Your compute",theme:h,...J?{style:J}:{},children:st(Wn,{machines:ne,hosted:be,onApproveRuntime:(N,H)=>void ge(N,H),onPreferRuntime:(N,H)=>void u(N,H),onDisconnectHosted:N=>void R(N),onRefresh:()=>void V(),refreshing:P,model:q.selected,onPickModel:q.select,error:Ee,runs:y,onStopRun:async N=>{te(null);try{await ee(N)}catch(H){throw te(H.message),H}},onPair:()=>{U(!1),S?d.open("pair"):(j(!0),O(!0))},...f.context?.app.name?{appName:f.context.app.name}:{}})}),!S&&st(Bt,{open:W,onOpenChange:N=>{N||j(!1),O(N)},...ye?{showStatus:!1}:{},...r?{initialCode:r}:{},...o?{onConnected:o}:{}})]})}function Cl(e,n){return e.map(t=>{if(t.state==="offline")return t;let r=n.filter(o=>o.machine_id===t.id).length;return{...t,active:r,state:r>0?"busy":"online"}})}import{jsx as Fo,jsxs as Nl}from"react/jsx-runtime";function Ml({initialCode:e,onConnected:n,className:t,showStatus:r=!0}){let{theme:o}=$();return Nl("div",{className:t?`soba-connect ${t}`:"soba-connect","data-theme":o,children:[r&&Fo(Bo,{}),Fo("div",{className:"sc-compute-act",children:Fo(zn,{...e?{initialCode:e}:{},...n?{onConnected:n}:{}})})]})}import{useId as Wl,useState as Dl}from"react";import{useCallback as Vo,useEffect as Zs,useState as Xs}from"react";import{useCallback as xl,useState as Sl}from"react";function Wt(){let[e,n]=Sl(null);return{open:xl(()=>{n(null),Tn().then(n)},[]),launch:e,note:e==="absent"?"Nothing opened here. That machine may be a different computer, or asleep.":null}}import{useCallback as Js,useMemo as Ys}from"react";function Vn(e){if(!e)return null;if(typeof e=="string")return e;if(typeof Response<"u"&&e instanceof Response)return js(e.status);let n=e,t=n.error;return typeof t?.code=="string"?t.code:typeof t?.type=="string"?t.type:typeof n.code=="string"?n.code:typeof n.status=="number"?js(n.status):n.cause&&n.cause!==e?Vn(n.cause):null}function js(e){return e===402?"payment_required":e===409?"no_compute":null}function zo(...e){let[n,t]=e,{plan:r,compute:o,connect:a}=_(),s=t?.predict??e.length===0,c=Pl(Rl(n),o)??(s?El(r,o):null),i=r.plan,l=r.plans,d=Ys(()=>{if(c!=="payment_required")return null;let p=i?.price??0,w=i?.included_units??0;return l.find(b=>b.id!==i?.id&&b.price>p&&(b.included_units===null||b.included_units>w))??null},[c,l,i]),f=Js(async()=>{if(!d)return;if(d.selectable){await r.select(d.id);return}let p=await r.checkout(d.id);window.location.assign(p)},[d,r]),h=a.open,A=Js(()=>{c&&h(c)},[h,c]);return Ys(()=>{if(!c)return null;let p=i?ln({unit:i.unit,reward:i.connected_reward,includedUnits:i.connected_included_units,creditMicros:i.connected_credit*1e6}):null,w=i?cn(i.connected_reward)?p:Un({unit:i.unit,ownUnit:i.own_unit??null,includedUnits:i.included_units,ownIncludedUnits:i.own_included_units??null,routePrefer:i.route_prefer}):null;return{reason:c,...Il(c,{connectOffer:w,connected:o.connected,online:o.online,machine:In(o.machines)?.label??null,unit:i?.unit??"message",interval:i?.interval??"month",upgrade:d!==null,resets:r.current?.period_end??null}),connectOffer:w,upgradeTo:d,connect:A,upgrade:f}},[c,i,o,d,A,f,r.current?.period_end])}function Rl(e){let n=Vn(e);return n==="payment_required"||n==="no_compute"?n:null}function Pl(e,n){return e==="no_compute"&&n.connected&&n.online?null:e}function El(e,n){let t=e.plan;return!t||n.loading?null:je(t.route_allow)&&!n.online?"no_compute":e.remaining===0&&t.overage==="stop"?"payment_required":null}function Il(e,n){if(e==="payment_required"){let t=`No ${It(n.unit)} left this ${n.interval}`;return n.connectOffer&&!n.connected?{title:t,body:`${n.connectOffer}. Connecting takes a minute and costs nothing.`}:n.connectOffer&&!n.online?{title:t,body:`${n.connectOffer}. Waking ${n.machine??"your machine"} is enough.`}:n.upgrade?{title:t,body:n.resets?`A larger plan carries on now. This one comes back on ${qs(n.resets)}.`:"A larger plan carries on now, or wait for this one to renew."}:{title:t,body:n.resets?`Your allowance comes back on ${qs(n.resets)}.`:"Your allowance comes back at the start of the next period."}}return n.connected&&!n.online?{title:`${n.machine??"Your machine"} can't be reached`,body:"This run needs it awake and connected. Open Soba on that machine, or connect another one."}:{title:"Nothing connected yet",body:"This app runs on AI you already pay for, on a machine of your own. Connect one and this run has somewhere to go."}}function qs(e){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function Ll(e){let{plan:n,allowance:t,connected:r,online:o,quiet:a,error:s,predict:c,at:i,waved:l}=e;if(!n)return null;let d=e.allow!==void 0?e.allow:n.route_allow;if(r){if(o)return null;let w=je(d);return{reason:"stalled",title:`${a??"Your machine"} can\u2019t be reached`,detail:w?"The Soba app there has stopped reporting in, so runs have nowhere to go until it is back.":"The Soba app there has stopped reporting in, so nothing will run on your own AI until it is back.",meter:null,dismissible:!1,atTheWall:!1,ownCompute:w}}let f=Vn(s),h=f==="payment_required"||f==="no_compute",A=n.ask_to_connect!==!1&&Eo(n.route_prefer,d);if(!c&&!h&&!A)return null;let p=je(d)?Ol(n.unit,je(n.route_allow)):cn(n.connected_reward)||Ks(n,t.included)!==null?Bl(t,n,i):A?Tl(n.unit):null;return!p||p.dismissible&&l?null:{...p,dismissible:!!p.dismissible,ownCompute:!1,atTheWall:!p.dismissible&&(!c||p.meter!==null&&p.meter.left===0)}}function Qo(e={}){let{at:n=.25,error:t,allow:r}=e,o=e.predict??!(e.errorGiven??t!==void 0),{plan:a,compute:s,connect:c}=_(),i=io(c.publishableKey),[l,d]=Xs(!1);Zs(()=>{d(lo(i))},[i]);let f=Vo(()=>{d(!0),co(i)},[i]),h=Vo(()=>c.open("manual"),[c]),A=Vo(()=>c.open("no_compute"),[c]),p=Wt(),[w,b]=Xs(!1),{refresh:C}=s,{launch:S}=p;Zs(()=>{if(S===null||S==="absent")return;b(!1);let U=setInterval(()=>void C(),3e3),y=setTimeout(()=>{clearInterval(U),b(!0)},2e4);return()=>{clearInterval(U),clearTimeout(y)}},[S,C]);let W=Gl(c.app?.name,xt(c.connectUrl)),O=a.loading||s.loading,D=In(s.machines),T=O?null:Ll({plan:a.plan,allowance:{remaining:a.remaining,included:a.included},connected:s.connected,online:s.online,quiet:D?ce(D):null,error:t,predict:o,...r!==void 0?{allow:r}:{},at:n,waved:l});return{reason:T?.reason??null,visible:T!==null,title:T?.title??null,detail:T?.detail??null,meter:T?.meter??null,dismissible:T?.dismissible??!1,dismissed:l,dismiss:f,open:h,atTheWall:T?.atTheWall??!1,steps:W,stalled:T?.reason==="stalled"?{machine:D?ce(D):null,ownCompute:T.ownCompute,wake:p.open,launch:p.launch,note:p.note,stuck:w,connectAnother:A}:null,loading:O}}function Ol(e,n){return{reason:"needed",title:n?"This plan runs on your own AI.":`These ${e}s run on your own AI.`,detail:`Connect a machine and your ${e}s run there, free, on access you already have.`,meter:null}}function Tl(e){return{reason:"preferred",title:"This plan prefers your own AI.",detail:`Connect a machine and your ${e}s run there instead, on access you already have.`,meter:null,dismissible:!0}}function Ks(e,n){return Un({unit:e.unit,ownUnit:e.own_unit??null,includedUnits:n,ownIncludedUnits:e.own_included_units??null,routePrefer:e.route_prefer})}function Bl(e,n,t){let{remaining:r,included:o}=e;if(r===null||o===null||o===0||r>Math.ceil(o*t))return null;let a=ln({unit:n.unit,reward:n.connected_reward,includedUnits:n.connected_included_units,creditMicros:n.connected_credit*1e6})??Ks(n,o);return a?{reason:"running",title:r===0?`No ${It(n.unit)} left this month.`:`${Be(n.unit,r)} left this month.`,detail:`${a}.`,meter:{left:r,of:o}}:null}function Gl(e,n){return[{lead:"Download Soba",detail:"",...n?{linksLead:"Get it for"}:{},links:n?Nt.map(t=>({label:t.label,href:`${n}/download/${t.slug}`})):[]},{lead:"Connect compute",detail:"Press this, then approve the pairing when the app asks.",opens:!0,links:[]},{lead:"Let your AIs serve",detail:`It finds what is installed on that machine. Allow one, and ${e??"this app"} sends every run there.`,linksLead:"Nothing on it yet?",links:Oe.map(t=>({label:t.short,href:t.install}))}]}import{Fragment as $s,jsx as oe,jsxs as kn}from"react/jsx-runtime";function Hl(e){let{className:n,fallback:t=null}=e,r=Qo({...e.at===void 0?{}:{at:e.at},...e.predict===void 0?{}:{predict:e.predict},...e.allow===void 0?{}:{allow:e.allow},error:e.error,errorGiven:"error"in e}),{connect:o}=_(),{theme:a}=$(),[s,c]=Dl(null),i=Wl(),l=oe($s,{children:t});if(!r.visible)return l;if(r.stalled)return oe(_s,{className:n,theme:a,stalled:!0,children:oe(Ul,{title:r.title??"",detail:r.detail??"",stalled:r.stalled})});let d=s??r.atTheWall;return kn(_s,{className:n,theme:a,children:[kn("div",{className:"sc-nudge-top",children:[kn("div",{className:"sc-nudge-say",children:[oe("p",{className:"sc-nudge-title",children:r.title}),oe("p",{className:"sc-nudge-detail",children:r.detail}),kn("button",{type:"button",className:"sc-btn sc-btn-quiet sc-nudge-more","aria-expanded":d,"aria-controls":i,onClick:()=>c(!d),children:[d?"Hide the details":"How it works",oe(zl,{})]})]}),r.dismissible?oe("button",{type:"button",className:"sc-nudge-dismiss","aria-label":"Dismiss",title:"Dismiss",onClick:r.dismiss,children:oe(Fl,{})}):null]}),d?oe("ol",{className:"sc-nudge-steps",id:i,children:r.steps.map(f=>kn("li",{children:[f.opens?oe("button",{type:"button",className:"sc-step-lead",onClick:()=>o.open("manual"),children:f.lead}):oe("strong",{children:f.lead}),f.detail?oe("span",{children:f.detail}):null,f.links.length>0?kn("span",{className:"sc-step-links",children:[f.linksLead,f.links.map(h=>oe("a",{href:h.href,target:"_blank",rel:"noreferrer noopener",children:h.label},h.href))]}):null]},f.lead))}):null,oe(zn,{variant:"primary"})]})}function _s({className:e,theme:n,stalled:t,children:r}){return oe("div",{className:e?`soba-connect sc-fill ${e}`:"soba-connect sc-fill","data-theme":n,children:oe("div",{className:t?"sc-nudge sc-nudge-stalled":"sc-nudge",children:r})})}function Ul({title:e,detail:n,stalled:t}){return kn($s,{children:[oe("div",{className:"sc-nudge-top",children:kn("div",{className:"sc-nudge-say",children:[oe("p",{className:"sc-nudge-title",children:e}),oe("p",{className:"sc-nudge-detail",children:n}),t.note&&oe("p",{className:"sc-nudge-note",children:t.note}),t.stuck&&oe("p",{className:"sc-nudge-note",children:"The Soba app is open, but this machine still isn\u2019t reporting in. It may no longer be connected to this app."}),(t.launch==="absent"||t.stuck)&&oe("button",{type:"button",className:"sc-btn sc-btn-quiet sc-nudge-more",onClick:t.connectAnother,children:t.stuck?"Connect it again":"Connect another machine"})]})}),oe("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:t.wake,children:"Open Soba"})]})}function Fl(){return oe("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",className:"sc-nudge-x",children:oe("path",{d:"m4.8 4.8 6.4 6.4M11.2 4.8l-6.4 6.4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})}function zl(){return oe("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",className:"sc-nudge-chev",children:oe("path",{d:"M4.5 6.5 8 10l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}var Vl=new Set(["delta","thinking","status","done","error"]);function at(e){let n;try{n=JSON.parse(e)}catch{return null}if(!n||typeof n!="object")return null;let t=n,r=t.type==="event"?t.event:t;if(!r||typeof r!="object")return null;let o=r;if(typeof o.type!="string"||!Vl.has(o.type))return null;let a={type:o.type};return typeof o.text=="string"&&(a.text=o.text),typeof o.message=="string"&&(a.message=o.message),typeof o.tool=="string"&&(a.tool=o.tool),typeof o.tier=="string"&&(a.tier=o.tier),o.usage&&typeof o.usage=="object"&&(a.usage=o.usage),typeof o.session=="string"&&(a.session=o.session),typeof o.toolInput=="string"&&(a.toolInput=o.toolInput),o.git&&typeof o.git=="object"&&(a.git=o.git),o.turn&&typeof o.turn=="object"&&typeof o.turn.text=="string"&&(a.turn={text:o.turn.text}),typeof o.reason=="string"&&(a.reason=o.reason),typeof o.retryable=="boolean"&&(a.retryable=o.retryable),(o.state==="interrupted"||o.state==="resumed")&&(a.state=o.state),a}async function*Jo(e){let n=e.body;if(!n)throw new Error("That run response had no body to stream.");let t=(e.headers.get("content-type")??"").includes("ndjson"),r=n.getReader(),o=new TextDecoder,a="",s=[];try{for(;;){let i=await r.read();if(i.done)break;for(a+=o.decode(i.value,{stream:!0});;){let l=a.indexOf(`
3
+ `);if(l===-1)break;let d=na(a.slice(0,l));if(a=a.slice(l+1),t){let f=d.trim()?at(d):null;f&&(yield f);continue}if(d===""){let f=s.join(`
4
+ `);if(s=[],f==="[DONE]")return;let h=f?at(f):null;h&&(yield h);continue}ea(d,s)}}!t&&a&&ea(na(a),s);let c=t?a.trim():s.join(`
5
+ `);if(c&&c!=="[DONE]"){let i=at(c);i&&(yield i)}}finally{r.cancel().catch(()=>{})}}function ea(e,n){if(!e||e.startsWith(":"))return;let t=e.indexOf(":");if(t===-1||e.slice(0,t)!=="data")return;let r=e.slice(t+1);n.push(r.startsWith(" ")?r.slice(1):r)}function na(e){return e.endsWith("\r")?e.slice(0,-1):e}async function Ql(e){let n="";for await(let t of e)if(t.type==="delta"&&t.text&&(n+=t.text),t.type==="error")throw new Error(t.message??"The run ended with an error.");return n}import{jsx as ta}from"react/jsx-runtime";function Jl({caption:e,disabled:n,className:t,...r}){let{theme:o}=$(),{options:a,selected:s,select:c,pickable:i,layout:l,ownInList:d,search:f}=Fn(r),h=_().connect.app;return i?ta("span",{className:"soba-connect sc-inline","data-theme":o,children:ta(Ct,{options:a,layout:l,ownInList:d,search:f,selected:s,onPick:c,...h?.name?{appName:h.name}:{},...e?{caption:e}:{},...n?{disabled:n}:{},...t?{className:t}:{}})}):null}import{jsx as jl}from"react/jsx-runtime";function Yl(e){return jl(Bn,{...e})}import{useState as Zl}from"react";import{useCallback as ql,useState as Yo}from"react";function jo(){let e=vn(),{plan:n}=_(),[t,r]=Yo(!1),[o,a]=Yo(null),[s,c]=Yo(null);return{redeem:ql(async l=>{if(!e)return a("No session yet."),null;r(!0),a(null);try{let{reward:d}=await e.redeemCode(l);return c(d),await n.refresh(),d}catch(d){return a(d.message),null}finally{r(!1)}},[e,n]),busy:t,error:o,reward:s}}import{jsx as hr,jsxs as ra}from"react/jsx-runtime";function Xl(e){return e.kind==="discount"?`${e.name} applied. It comes off at checkout.`:e.kind==="grant"?`${e.name} applied. The extra usage is yours now.`:`${e.name} applied. You're on it now.`}function Kl({label:e="Apply",placeholder:n="Promo code",onRedeemed:t,className:r}){let{theme:o}=$(),{redeem:a,busy:s,error:c,reward:i}=jo(),[l,d]=Zl(""),f=async()=>{if(!l.trim()||s)return;let h=await a(l);h&&(d(""),t?.(h))};return ra("div",{className:r?`soba-connect ${r}`:"soba-connect","data-theme":o,children:[ra("form",{className:"sc-redeem",onSubmit:h=>{h.preventDefault(),f()},children:[hr("input",{className:"sc-input",value:l,onChange:h=>d(h.target.value),placeholder:n,"aria-label":n,autoComplete:"off",spellCheck:!1}),hr("button",{type:"submit",className:"sc-btn sc-btn-primary",disabled:s||!l.trim(),children:s?"Checking\u2026":e})]}),c&&hr("p",{className:"sc-error",children:c}),!c&&i&&hr("p",{className:"sc-note",children:Xl(i)})]})}import{useEffect as _l}from"react";var oa="data-soba-react",sa=!1;function Dt(){if(sa||typeof document>"u"||(sa=!0,document.querySelector(`style[${oa}]`)))return;let e=document.createElement("style");e.setAttribute(oa,""),e.textContent=`.soba-connect {
6
6
  --sc-ground: #ffffff;
7
7
  --sc-sheet: #ffffff;
8
8
  --sc-raised: #f6f6f7;
@@ -4486,7 +4486,7 @@ li.sc-plan-row.sc-plan-current {
4486
4486
  .sc-redeem + .sc-note {
4487
4487
  margin-top: 8px;
4488
4488
  }
4489
- `,document.head.appendChild(e)}import{jsx as nn,jsxs as Ut}from"react/jsx-runtime";function oa(e){if(!e)return null;let n=Vn(e);if(n==="payment_required"||n==="no_compute")return null;if(typeof e=="string")return e||null;let t=e,r=t.error?.message;return typeof r=="string"&&r?r:typeof t.message=="string"&&t.message?t.message:"The run ended with an error."}function Ql(){return Ut("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[nn("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),nn("circle",{cx:"8",cy:"11.6",r:"0.9",fill:"currentColor"}),nn("circle",{cx:"8",cy:"8",r:"6.4",stroke:"currentColor",strokeWidth:"1.3"})]})}function Jl({error:e,onRetry:n,onDismiss:t,title:r,className:o}){let a=oa(e),s=_();return Vl(()=>Ht(),[]),a?nn("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":s.theme,role:"alert",children:Ut("div",{className:"sc-card sc-limit sc-run-error",children:[Ut("div",{className:"sc-limit-head",children:[nn("span",{className:"sc-limit-mark sc-run-error-mark","aria-hidden":"true",children:nn(Ql,{})}),Ut("div",{children:[nn("h2",{className:"sc-limit-title",children:r??"That run did not finish"}),nn("p",{className:"sc-limit-body sc-run-error-message",children:a})]})]}),(t||n)&&Ut("div",{className:"sc-limit-actions",children:[t&&nn("button",{type:"button",className:"sc-btn sc-btn-quiet",onClick:t,children:"Dismiss"}),n&&nn("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:n,children:"Try again"})]})]})}):null}import{useId as Yl,useState as sa}from"react";import{jsx as xe,jsxs as gr}from"react/jsx-runtime";function jl({reason:e}){return xe("span",{className:"sc-limit-mark","aria-hidden":"true",children:e==="no_compute"?xe(er,{}):xe(Me,{})})}function ql(e){let{error:n,variant:t="card",onDismiss:r,className:o}=e,a=Uo(n,{predict:e.predict??!("error"in e)}),s=Yl(),c=_();if(!a)return null;let i=xe(Zl,{offer:a,headingId:s,onDismiss:r});return t==="dialog"?xe(Pt,{open:!0,onClose:()=>r?.(),labelledBy:s,theme:c.theme,children:i}):xe("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":c.theme,children:i})}function Zl({offer:e,headingId:n,onDismiss:t}){let{compute:r}=K(),[o,a]=sa(!1),[s,c]=sa(null),i=e.reason==="no_compute"&&r.connected&&!r.online,l=i||e.connectOffer!==null||!r.connected,d=Dt();async function h(){a(!0),c(null);try{await e.upgrade()}catch(b){c(b.message)}finally{a(!1)}}return gr("div",{className:"sc-card sc-limit",children:[gr("div",{className:"sc-limit-head",children:[xe(jl,{reason:e.reason}),gr("div",{children:[xe("h2",{className:"sc-limit-title",id:n,children:e.title}),xe("p",{className:"sc-limit-body",children:e.body})]})]}),s&&xe("p",{className:"sc-error",children:s}),i&&d.note&&xe("p",{className:"sc-limit-note",children:d.note}),gr("div",{className:"sc-limit-actions",children:[t&&xe("button",{type:"button",className:"sc-btn sc-btn-quiet",onClick:t,disabled:o,children:"Not now"}),e.upgradeTo&&xe("button",{type:"button",className:l?"sc-btn":"sc-btn sc-btn-primary",onClick:()=>void h(),disabled:o,children:o?"Opening\u2026":e.upgradeTo.selectable?`Switch to ${e.upgradeTo.name}`:`${e.upgradeTo.name} for $${e.upgradeTo.price.toLocaleString()}/${e.upgradeTo.interval}`}),l&&xe("button",{type:"button",className:i?"sc-btn":"sc-btn sc-btn-primary",onClick:e.connect,disabled:o,children:i?"Connect another machine":"Connect compute"}),i&&xe("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:d.open,disabled:o,children:"Open Soba"})]})]})}import{useMemo as Xl}from"react";function Kl(e){let n={};for(let t of e??[])n[t.id]=t.value;return n}function Ft(){let{plan:e,compute:n,connect:t}=K();return Xl(()=>{let r=e.plan,o=e.current,a={plan:r,assignment:o,loading:e.loading,error:e.error,periodEnd:o?.period_end?new Date(o.period_end):null,features:o?.features??Kl(r?.features)};if(!r)return{...a,state:"none",trialDaysLeft:null,ceiling:null,raised:!1,uncounted:!1,used:0,remaining:null,percent:null,unlimited:!1,reward:null,summary:"Nothing is assigned to this account, so runs are bounded by whatever the app allows."};let s=ec(o?.trial_ends_at??null),c=r.connected_reward==="included"&&n.connected&&r.connected_included_units!==null,i=c?r.connected_included_units:r.included_units,l=n.connected,d=i===null,h=e.used??0,b=i===null?null:Math.max(0,i-h),y=i&&i>0?Math.min(100,Math.round(h/i*100)):null,m=i!==null&&h>=i,v=s!==null?"trial":d?"unlimited":m?r.overage==="meter"?"metered":"spent":"within";return{...a,state:v,trialDaysLeft:s,ceiling:i,raised:c,uncounted:l,used:h,remaining:b,percent:y,unlimited:d,reward:_l(r,c,n.connected,()=>t.open("manual")),summary:$l({plan:r,assignment:o,used:h,ceiling:i,trialDaysLeft:s,raised:c,uncounted:l,state:v})}},[e,n.connected,t])}function _l(e,n,t,r){let o=sn({unit:e.unit,reward:e.connected_reward,includedUnits:e.connected_included_units,creditMicros:e.connected_credit*1e6});return o?{line:o,inForce:n,required:!1,connected:t,actionable:an(e.connected_reward)&&!t,open:r}:Ve(e.route_allow)&&!t?{line:"Nothing connected yet, so nothing can run.",inForce:!1,required:!0,connected:t,actionable:!0,open:r}:null}function $l(e){let{plan:n,assignment:t,used:r,ceiling:o,trialDaysLeft:a,raised:s,uncounted:c,state:i}=e,l=c?" Runs your own AI serves do not count toward it.":"";if(i==="trial"&&a!==null){let b=n.price===0?"it continues free":`it is $${n.price.toLocaleString()} a ${n.interval}`;return`${a} ${a===1?"day":"days"} left of your trial, then ${b}.`}if(i==="unlimited")return`${Oe(n.unit,r)} this period. No ceiling on this plan.`;if(i==="metered"){let b=r-(o??0);return n.overage_per_unit>0?`${Oe(n.unit,b)} past the allowance, billed at $${n.overage_per_unit} per ${Hn(n.unit)}.${l}`:`${Oe(n.unit,b)} past the allowance.${l}`}if(i==="spent")return t?.period_end?`Allowance spent. It comes back on ${aa(t.period_end)}.${l}`:`Allowance spent. It comes back at the start of the next period.${l}`;let d=Math.max(0,(o??0)-r),h=s?` Raised from ${Oe(n.unit,n.included_units??0)} while your own AI is connected.`:t?.period_end?` Resets ${aa(t.period_end)}.`:"";return`${Oe(n.unit,d)} of ${Oe(n.unit,o??0)} left.${h}${l}`}function ec(e){if(!e)return null;let n=new Date(e).getTime()-Date.now();return Number.isNaN(n)||n<=0?null:Math.max(1,Math.ceil(n/864e5))}function aa(e){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{day:"numeric",month:"long"})}import{Fragment as tc,jsx as Se,jsxs as Je}from"react/jsx-runtime";function Yo({heading:e="Current plan",showUsage:n=!0,showName:t=!0,className:r}){let o=Ft(),{theme:a}=_(),s=b=>Se("section",{className:r?`soba-connect sc-fill ${r}`:"soba-connect sc-fill","data-theme":a,children:Je("div",{className:"sc-card sc-current",children:[e&&Se("h2",{className:"sc-section-title",children:e}),b]})});if(o.error)return s(Se("p",{className:"sc-error",children:o.error.message}));if(o.loading)return s(Se("p",{className:"sc-note",children:"Loading\u2026"}));if(!o.plan)return s(Je("div",{className:"sc-current-main",children:[Se("p",{className:"sc-current-name",children:"No plan"}),Se("p",{className:"sc-sub",children:o.summary})]}));let{plan:c,trialDaysLeft:i,percent:l,unlimited:d,reward:h}=o;return s(Je(tc,{children:[Je("div",{className:"sc-current-grid",children:[(t||i!==null)&&Je("div",{className:"sc-current-main",children:[t?Je("p",{className:"sc-current-name",children:[c.name,i!==null&&Je("span",{className:"sc-trial-badge",children:[i," ",i===1?"day":"days"," left"]})]}):i!==null&&Se("p",{className:"sc-current-trial",children:Je("span",{className:"sc-trial-badge",children:[i," ",i===1?"day":"days"," left"]})}),t&&c.description&&Se("p",{className:"sc-sub",children:c.description})]}),n&&Je("div",{className:"sc-usage",children:[Je("div",{className:"sc-row-between",children:[Se("span",{className:"sc-fact-key",children:"Usage"}),Se("span",{className:l!==null&&l>=100?"sc-usage-figure sc-usage-over":"sc-usage-figure",children:d?"Unlimited":l===null?"Metered":`${l}% used`})]}),l!==null&&Se("div",{className:"sc-meter",role:"presentation",children:l>0&&Se("span",{className:l>=100?"sc-meter-fill sc-meter-full":"sc-meter-fill",style:{width:`${l}%`}})}),Se("p",{className:"sc-usage-line",children:o.summary})]})]}),h&&Je("div",{className:"sc-current-foot",children:[Se("p",{className:h.required?"sc-plan-reward-line sc-plan-reward-need":h.inForce?"sc-plan-reward-line":"sc-plan-reward-line sc-plan-reward-open",children:h.required?h.line:h.inForce?`In force: ${nc(h.line)}.`:h.line}),(h.actionable||h.connected)&&Se(zn,{})]})]}))}var nc=e=>e.charAt(0).toLowerCase()+e.slice(1);import{useCallback as rc,useMemo as oc,useState as ia}from"react";var sc={"user-hardware":"your own machine","user-subscription":"your own AI subscription","open-weights":"open models we host",frontier:"frontier models"},ac=new Set(["user-hardware","user-subscription"]);function jo(e={}){let{plan:n,compute:t,connect:r}=K(),[o,a]=ia(null),[s,c]=ia(null),{featured:i,onSelect:l,successUrl:d,cancelUrl:h}=e,b=rc(async m=>{a(m.id),c(null);try{if(m.contact_url)m.contact_url.startsWith("mailto:")?window.location.assign(m.contact_url):window.open(m.contact_url,"_blank","noopener");else if(m.selectable)await n.select(m.id);else if(l)l(m);else{let v=await n.checkout(m.id,{...d?{successUrl:d}:{},...h?{cancelUrl:h}:{}});window.location.assign(v);return}}catch(v){throw c(v.message),v}finally{(m.selectable||l||m.contact_url)&&a(null)}},[n,l,d,h]),y=oc(()=>n.plans.map(m=>{let v=n.current?.plan_id===m.id;return{plan:m,current:v,featured:i===m.id&&!v,price:ic(m),allowance:m.included_units===null?`Unlimited ${m.unit==="cost"?"usage":(m.unit==="run"||m.unit==="task")&&m.task_noun?m.task_noun:`${m.unit}s`}`:Ot(m.unit,m.included_units,m.task_noun),allowanceNote:lc(m),features:(()=>{let A=m.features_from?n.plans.find(k=>k.id===m.features_from):void 0;return A&&m.features_own?[{text:`Everything in ${A.name}`,included:!0},...dr(m.features_own)]:dr(m.features)})(),ownAllowance:Un({unit:m.unit,ownUnit:m.own_unit??null,includedUnits:m.included_units,ownIncludedUnits:m.own_included_units??null,routePrefer:m.route_prefer,taskNoun:m.task_noun}),computeLabel:m.route_allow===null?"any compute":m.route_allow.length===0?"no compute":null,compute:(m.route_allow??[]).map(A=>({costClass:A,label:sc[A]??A,owned:ac.has(A),runtimes:qr(A).map(k=>k.id)})),connect:cc(m,v,t.connected,()=>r.open("manual")),cta:{label:uc(m,v,o===m.id),disabled:v||o!==null,busy:o===m.id,take:()=>b(m)}}}),[n.plans,n.current,i,t.connected,r,o,b]);return{offers:y,current:y.find(m=>m.current)??null,loading:n.loading,error:n.error,failed:s}}function ic(e){return e.contact_url?{amount:"Talk to us",interval:null,free:!1}:{amount:`$${e.price.toLocaleString()}`,interval:e.interval,free:e.price===0}}function lc(e){let n=[];return e.included_units===null?n.push("No ceiling on this plan"):(n.push(`Included each ${e.interval}`),e.estimated_tasks&&n.push(`about ${e.estimated_tasks.toLocaleString("en-US")} ${e.task_noun??"runs"}`),e.overage==="meter"&&e.overage_per_unit>0?n.push(`then $${e.overage_per_unit} per ${Hn(e.unit)}`):e.included_units>0&&n.push("then it stops")),e.trial_days>0&&n.push(`${e.trial_days}-day trial`),n.join(" \xB7 ")}function cc(e,n,t,r){let o=sn({unit:e.unit,reward:e.connected_reward,includedUnits:e.connected_included_units,creditMicros:e.connected_credit*1e6}),a=Ve(e.route_allow)&&!t;if(!o&&!a)return null;let s=an(e.connected_reward);return{key:o?"Connect your own":"To use this",line:o??(n?"Nothing connected yet, so nothing can run.":"Runs only on compute you connect."),reward:o!==null,actionable:n&&(s||a)&&!t,open:r}}function uc(e,n,t){return n?"Your plan":e.contact_url?"Talk to us":t?e.selectable?"Switching\u2026":"Opening\u2026":e.selectable?"Choose":`Subscribe for $${e.price.toLocaleString()}/${e.interval}`}import{jsx as C,jsxs as se}from"react/jsx-runtime";function br(e){return e?`soba-connect sc-fill ${e}`:"soba-connect sc-fill"}function zt({onSelect:e,successUrl:n,cancelUrl:t,showCompute:r=!0,showConnect:o=!1,variant:a="cards",featured:s,className:c}){let{offers:i,loading:l,error:d,failed:h}=jo({...s?{featured:s}:{},...e?{onSelect:e}:{},...n?{successUrl:n}:{},...t?{cancelUrl:t}:{}}),{theme:b}=_();if(d)return C("div",{className:br(c),"data-theme":b,children:C("div",{className:"sc-card",children:C("p",{className:"sc-error",children:d.message})})});if(l)return C("div",{className:br(c),"data-theme":b,children:C("div",{className:"sc-card",children:C("p",{className:"sc-note",children:"Loading plans\u2026"})})});if(i.length===0)return C("div",{className:br(c),"data-theme":b,children:C("div",{className:"sc-card",children:C("p",{className:"sc-note",children:"This app has no plans yet."})})});let y={showCompute:r,showConnect:o};return se("div",{className:br(c),"data-theme":b,"data-variant":a,children:[a==="rows"?C(pc,{offers:i,shelf:y}):a==="table"?C(mc,{offers:i,shelf:y}):C(dc,{offers:i,shelf:y}),h&&C("p",{className:"sc-error",children:h})]})}function dc({offers:e,shelf:n}){return C("div",{className:"sc-plans",children:e.map(t=>se("div",{className:la("sc-plan",t),children:[se("div",{className:"sc-row-between",children:[C("span",{className:"sc-title",children:t.plan.name}),C(qo,{offer:t})]}),C("p",{className:"sc-sub",children:t.plan.description}),C(Zo,{price:t.price,free:"forever"}),C(_o,{offer:t,shelf:n}),C(ca,{offer:t}),C("div",{className:"sc-plan-band",children:n.showCompute&&C(Ko,{offer:t})}),C("div",{className:"sc-plan-band",children:C(Xo,{offer:t})})]},t.plan.id))})}function pc({offers:e,shelf:n}){return C("ul",{className:"sc-plan-rows",children:e.map(t=>se("li",{className:la("sc-plan-row",t),children:[se("div",{className:"sc-row-main",children:[se("span",{className:"sc-row-name",children:[C("span",{className:"sc-title",children:t.plan.name}),C(qo,{offer:t})]}),t.plan.description&&C("p",{className:"sc-sub",children:t.plan.description}),C(ca,{offer:t}),n.showCompute&&C(Ko,{offer:t,inline:!0}),C(Xo,{offer:t,inline:!0})]}),se("div",{className:"sc-row-side",children:[C(Zo,{price:t.price,free:"forever",small:!0}),C(_o,{offer:t,shelf:n})]})]},t.plan.id))})}function mc({offers:e,shelf:n}){let t=e.some(s=>s.plan.overage_per_unit>0),r=e.some(s=>s.plan.trial_days>0),o=e.some(s=>s.connect!==null),a=s=>[s.current?"sc-col-current":"",s.featured?"sc-col-featured":""].filter(Boolean).join(" ")||void 0;return C("div",{className:"sc-table-scroll",children:se("table",{className:"sc-plan-table",children:[C("thead",{children:se("tr",{children:[C("td",{}),e.map(s=>se("th",{scope:"col",className:a(s),children:[se("span",{className:"sc-row-name",children:[C("span",{className:"sc-title",children:s.plan.name}),C(qo,{offer:s})]}),C(Zo,{price:s.price,small:!0})]},s.plan.id))]})}),se("tbody",{children:[se("tr",{children:[C("th",{scope:"row",children:"Included"}),e.map(s=>C("td",{className:a(s),children:s.allowance},s.plan.id))]}),t&&se("tr",{children:[C("th",{scope:"row",children:"Then"}),e.map(s=>C("td",{className:a(s),children:s.plan.overage_per_unit>0?`$${s.plan.overage_per_unit} / ${Hn(s.plan.unit)}`:C("span",{className:"sc-muted-cell",children:"Stops"})},s.plan.id))]}),r&&se("tr",{children:[C("th",{scope:"row",children:"Trial"}),e.map(s=>C("td",{className:a(s),children:s.plan.trial_days>0?`${s.plan.trial_days} days`:C("span",{className:"sc-muted-cell",children:"None"})},s.plan.id))]}),n.showCompute&&se("tr",{children:[C("th",{scope:"row",children:"Runs on"}),e.map(s=>C("td",{className:a(s),children:C(Ko,{offer:s,bare:!0})},s.plan.id))]}),o&&se("tr",{children:[C("th",{scope:"row",children:"Connect your own"}),e.map(s=>C("td",{className:a(s),children:C(Xo,{offer:s,bare:!0})},s.plan.id))]}),se("tr",{className:"sc-table-buy",children:[C("td",{}),e.map(s=>C("td",{className:a(s),children:C(_o,{offer:s,shelf:n})},s.plan.id))]})]})]})})}function la(e,n){return[e,n.current?"sc-plan-current":"",n.featured?"sc-plan-featured":""].filter(Boolean).join(" ")}function qo({offer:e}){return e.current?C("span",{className:"sc-plan-badge",children:"Current"}):e.featured?C("span",{className:"sc-plan-badge-soft",children:"Recommended"}):null}function Zo({price:e,small:n,free:t}){return se("p",{className:n?"sc-plan-price sc-plan-price-sm":"sc-plan-price",children:[C("span",{className:"sc-plan-amount",children:e.amount}),e.interval?se("span",{className:"sc-plan-interval",children:["/",e.interval]}):t&&C("span",{className:"sc-plan-interval sc-plan-after",children:t})]})}function ca({offer:e}){return se("p",{className:"sc-plan-allowance",children:[C("span",{className:"sc-plan-figure",children:e.allowance}),C("span",{className:"sc-plan-qualifier",children:e.allowanceNote}),e.ownAllowance&&C("span",{className:"sc-plan-qualifier",children:e.ownAllowance}),e.features.map(n=>C("span",{className:n.included?"sc-plan-qualifier sc-plan-feature":"sc-plan-qualifier sc-plan-feature sc-plan-feature-absent",children:n.text},n.text))]})}function Xo({offer:e,inline:n,bare:t}){let r=e.connect;if(!r)return t?C("span",{className:"sc-muted-cell",children:"None"}):null;let o=r.reward?"sc-plan-reward-line":"sc-plan-reward-line sc-plan-reward-need",a=r.actionable?se("button",{type:"button",className:`${o} sc-plan-reward-act`,"aria-label":"Connect compute",onClick:r.open,children:[C("span",{className:"sc-reward-said",children:r.line}),se("span",{className:"sc-reward-do","aria-hidden":!0,children:[C(Me,{className:"sc-reward-mark"}),"Connect compute"]})]}):C("p",{className:o,children:r.line});return t?a:C("div",{className:n?"sc-plan-reward sc-plan-reward-inline":"sc-plan-reward",children:a})}function Ko({offer:e,inline:n,bare:t}){let r=e.computeLabel?C("ul",{className:n?"sc-compute sc-compute-inline":"sc-compute",children:C("li",{children:e.computeLabel})}):C("ul",{className:n?"sc-compute sc-compute-inline":"sc-compute",children:e.compute.map(o=>se("li",{className:o.owned?"sc-compute-own":void 0,children:[o.label,C(fc,{runtimes:o.runtimes})]},o.costClass))});return t?r:se("div",{className:n?"sc-plan-compute sc-plan-compute-inline":"sc-plan-compute",children:[C("span",{className:"sc-fact-key",children:"Runs on"}),r]})}function _o({offer:e,shelf:n}){let t=e.connect;return n.showConnect&&t?.actionable?se("button",{type:"button",className:"sc-btn sc-btn-primary sc-btn-icon",onClick:t.open,children:[C(Me,{className:"sc-btn-mark"}),"Connect compute"]}):C("button",{type:"button",className:e.current?"sc-btn":"sc-btn sc-btn-primary",disabled:e.cta.disabled,onClick:()=>void e.cta.take().catch(()=>{}),children:e.cta.label})}function fc({runtimes:e}){return e.length===0?null:C("span",{className:"sc-compute-marks",children:e.map(n=>{let t=An[n];return t?C(t,{className:"sc-rt-mark"},n):null})})}import{jsx as $o,jsxs as ua}from"react/jsx-runtime";function hc({heading:e,plansHeading:n,showUsage:t=!0,showName:r=!0,className:o,...a}){let{plan:s,loading:c}=Ft(),{theme:i}=_(),l=n??(c?"Plans":s?"Change plan":"Choose a plan");return ua("div",{className:o?`soba-connect sc-fill sc-billing ${o}`:"soba-connect sc-fill sc-billing","data-theme":i,children:[$o(Yo,{...e===void 0?{}:{heading:e},showUsage:t,showName:r}),ua("section",{className:"sc-billing-plans",children:[l&&$o("h2",{className:"sc-section-title",children:l}),$o(zt,{...a})]})]})}import{useCallback as da,useState as pa}from"react";function es({plan:e,successUrl:n,cancelUrl:t,label:r}){let{plan:o}=K(),[a,s]=pa(!1),[c,i]=pa(null),l=da(()=>o.checkout(e.id,{...n?{successUrl:n}:{},...t?{cancelUrl:t}:{}}),[o,e.id,n,t]),d=da(async()=>{s(!0),i(null);try{window.location.assign(await l())}catch(h){i(h.message),s(!1)}},[l]);return{label:a?"Opening\u2026":r??`Subscribe for $${e.price.toLocaleString()}/${e.interval}`,busy:a,error:c,buy:d,session:l}}import{jsx as ma,jsxs as bc}from"react/jsx-runtime";function gc({plan:e,successUrl:n,cancelUrl:t,label:r,className:o}){let{theme:a}=_(),s=es({plan:e,...n?{successUrl:n}:{},...t?{cancelUrl:t}:{},...r?{label:r}:{}});return bc("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":a,children:[ma("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:s.busy,onClick:()=>void s.buy(),children:s.label}),s.error&&ma("p",{className:"sc-error",children:s.error})]})}import{useState as yc}from"react";import{useMemo as Ac}from"react";function ns(e,n={}){let{plan:t}=K(),r=n.use??1;return Ac(()=>{let o=t.current,a=t.plan?.features?.find(i=>i.id===e),s=o?o.features??Object.fromEntries((t.plan?.features??[]).map(i=>[i.id,i.value])):null,c=bo({features:s,quantities:o?.quantities??{},ended:o?.ended??!1},e,r);return{...c,allowed:t.loading?!1:c.allowed,name:a?.name??e,unit:a?.unit??null,loading:t.loading,error:t.error,refresh:t.refresh}},[t.current,t.plan,t.loading,t.error,t.refresh,e,r])}import{Fragment as ts,jsx as kn,jsxs as fa}from"react/jsx-runtime";function wc({feature:e,use:n=1,children:t,fallback:r,loading:o=null,className:a}){let s=ns(e,{use:n});return s.loading?kn(ts,{children:o}):s.allowed?kn(ts,{children:t}):r!==void 0?kn(ts,{children:typeof r=="function"?r(s):r}):kn(vc,{view:s,className:a})}function ha(e){let n=e.unit||e.name.toLowerCase();switch(e.reason){case"no_plan":return`Pick a plan to use ${e.name.toLowerCase()}.`;case"plan_ended":return"Your plan has ended. Pick a plan to keep going.";case"limit_reached":return`Your plan includes ${e.limit} ${n}, and all ${e.limit} are in use.`;default:return`${e.name} isn't included in your plan.`}}function vc({view:e,className:n}){let{theme:t}=_(),[r,o]=yc(!1);return fa("section",{className:n?`soba-connect sc-fill ${n}`:"soba-connect sc-fill","data-theme":t,children:[fa("div",{className:"sc-card",children:[kn("p",{className:"sc-title",children:e.reason==="plan_ended"?"Plan ended":"Upgrade to continue"}),kn("p",{className:"sc-sub",children:ha(e)}),!r&&kn("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>o(!0),children:"See plans"})]}),r&&kn(zt,{})]})}import{useCallback as Ue,useEffect as Ye,useMemo as Qn,useRef as ln,useState as ue}from"react";var kc="soba.session:";function ga(e){return!e.cacheKey||!e.endpoint?null:kc+JSON.stringify([e.endpoint,e.user??null,e.cacheKey])}function Cc(e){try{let n=globalThis.localStorage?.getItem(e);if(!n)return null;let t=JSON.parse(n);return typeof t.token!="string"||typeof t.expiresAt!="number"?null:{token:t.token,expiresAt:t.expiresAt}}catch{return null}}function Mc(e,n){try{n?globalThis.localStorage?.setItem(e,JSON.stringify(n)):globalThis.localStorage?.removeItem(e)}catch{}}var ba=6e4,Nc=1e4,Ar=class{#e;#n=null;#r=null;#t;#o=new Set;constructor(n){this.#t=n,this.#e=n.token??null;let t=ga(n),r=t&&!this.#e?Cc(t):null;r&&r.expiresAt-ba>Date.now()&&(this.#e=r.token,this.#n=r.expiresAt)}get token(){return this.#e}get expiresAt(){return this.#n}get canRefresh(){return!!this.#t.endpoint}get refreshAt(){return!this.canRefresh||this.#n===null?null:Math.max(Date.now()+Nc,this.#n-ba)}subscribe(n){return this.#o.add(n),()=>this.#o.delete(n)}async ensure(){return this.#e?this.#e:this.refresh()}async refresh(){if(this.#r)return this.#r;let n=this.#t.endpoint;if(!n)throw new Error("This Soba session cannot be refreshed. Pass `sessionEndpoint` so the provider can mint a new one.");let t=this.#t.fetchImpl??fetch.bind(globalThis);this.#r=(async()=>{let r=await t(n,{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(this.#t.user?{user:this.#t.user}:{})});if(!r.ok)throw new Error(`Could not start a Soba session (${r.status} from ${n}).`);let o=await r.json(),a=o.session??o.token;if(!a)throw new Error(`${n} answered without a \`session\`. See @soba-so/react's README.`);let s=o.expires_in??o.expiresIn;this.#e=a,this.#n=typeof s=="number"?Date.now()+s*1e3:null;let c=ga(this.#t);c&&Mc(c,this.#n===null?null:{token:a,expiresAt:this.#n});for(let i of this.#o)i();return a})();try{return await this.#r}finally{this.#r=null}}},ct=new Map,Aa=new WeakMap,xc=1;function Sc(e){if(e.token||!e.endpoint)return null;let n=0;return e.fetchImpl&&(n=Aa.get(e.fetchImpl)??xc++,Aa.set(e.fetchImpl,n)),JSON.stringify([e.endpoint,e.user??null,n,e.cacheKey??null])}function ya(e){let n=Sc(e);if(!n)return new Ar(e);let t=ct.get(n)??{holder:new Ar(e),users:0};return ct.set(n,t),t.holder}function wa(e){for(let n of ct.values())n.holder===e&&n.users++}function va(e){for(let[n,t]of ct)if(t.holder===e){setTimeout(()=>{--t.users<=0&&ct.get(n)===t&&ct.delete(n)},0);return}}function ka(e,n=fetch.bind(globalThis)){return async(t,r)=>{let o=await n(t,r);if(o.status!==401||!e.canRefresh)return o;let a;try{a=await e.refresh()}catch{return o}return n(t,Rc(r,a))}}function Rc(e,n){let t=new Headers(e?.headers);return t.set("authorization",`Bearer ${n}`),{...e,headers:t}}import{jsx as rs,jsxs as Lc}from"react/jsx-runtime";var Pc="https://soba.so",Ec=3e4;function Ic(e){let{children:n,session:t,sessionEndpoint:r,user:o,sessionCacheKey:a,runEndpoint:s,theme:c,initialMachines:i,initialConnect:l=null,initialPlans:d,initialCurrentPlan:h=null,baseUrl:b=Pc,pollMs:y=Ec,injectStyles:m=!0,modal:v=!0,fetchImpl:A,onError:k}=e,[S,W]=ue(t??null),[L,D]=ue(null),[O,U]=ue(l),[w,$]=ue(null),[j,ee]=ue(l===null),[ae,me]=ue(i??[]),[fe,P]=ue(null),[q,V]=ue(i===void 0),[Z,be]=ue(d??[]),[Y,he]=ue(h),[Ae,Te]=ue(null),[Pe,ne]=ue(d===void 0),[de,u]=ue(null),[R,I]=ue(null),[J,B]=ue(!0),[te,N]=ue(null),[H,ie]=ue(!1),Ee=ln(k);Ee.current=k;let je=Ue(p=>{D(p),Ee.current?.(p)},[]);Ye(()=>{m&&Ht()},[m]);let E=Qn(()=>ya({...t?{token:t}:{},...r?{endpoint:r}:{},...o?{user:o}:{},...A?{fetchImpl:A}:{},...a?{cacheKey:a}:{}}),[t,r,o,A,a]);Ye(()=>{let p=!0;wa(E);let M=E.subscribe(()=>{p&&W(E.token)});return!E.token&&!E.canRefresh?je(new Error("<SobaProvider> needs a `session` or a `sessionEndpoint`. A browser cannot mint one: that takes your secret key.")):E.ensure().then(()=>p&&W(E.token),Q=>p&&je(Q)),()=>{p=!1,M(),va(E)}},[E,je]),Ye(()=>{L&&(ee(!1),V(!1),ne(!1),B(!1),$(p=>p??L),P(p=>p??L),Te(p=>p??L))},[L]),Ye(()=>{let p=E.refreshAt;if(p===null)return;let M=()=>{E.refresh().catch(ye=>je(ye))},Q=()=>{document.hidden||(document.removeEventListener("visibilitychange",Q),M())},oe=setTimeout(()=>{typeof document<"u"&&document.hidden?document.addEventListener("visibilitychange",Q):M()},Math.max(0,p-Date.now()));return()=>{clearTimeout(oe),typeof document<"u"&&document.removeEventListener("visibilitychange",Q)}},[E,je,S]);let Cn=ln(l?.machines_url??null),G=Qn(()=>{if(!S)return null;let p=new ft({session:S,baseUrl:b,fetchImpl:ka(E,A??fetch.bind(globalThis))});return p.setMachinesUrl(Cn.current),p},[S,b,E,A]),cn=ln(l!==null);Ye(()=>{if(!G||cn.current)return;let p=!0;return ee(!0),G.context().then(M=>{p&&(U(M),$(null),ee(!1))},M=>{p&&($(M),ee(!1))}),()=>{p=!1}},[G]);let tn=Ue(async()=>{if(G)try{let p=await G.machines();me(Array.isArray(p)?p:[]),P(null)}catch(p){P(p)}finally{V(!1)}},[G]),ke=Ue(async()=>{if(G)try{let p=await G.plans();be(p.plans),he(p.current),Te(null)}catch(p){Te(p)}finally{ne(!1)}},[G]),Mn=ln(!1),[Nn,xn]=ue(!1),ss=ln(d!==void 0),un=ln(!1),Vt=Ue(()=>{Mn.current||(Mn.current=!0,un.current&&queueMicrotask(()=>{un.current&&xn(!0)}))},[]);Ye(()=>(un.current=!0,Mn.current&&xn(!0),()=>{un.current=!1}),[]),Ye(()=>{!G||!Nn||ss.current||ke()},[G,Nn,ke]);let dn=Ue(async()=>{if(G)try{u(await G.modelOptions()),I(null)}catch(p){I(p)}finally{B(!1)}},[G]),Jn=ln(!1),[ge,qe]=ue(!1),ut=Ue(()=>{Jn.current||(Jn.current=!0,un.current&&queueMicrotask(()=>{un.current&&qe(!0)}))},[]);Ye(()=>{Jn.current&&qe(!0)},[]);let Yn=cn.current||O!==null;Ye(()=>{w&&!Yn&&B(!1)},[w,Yn]),Ye(()=>{!G||!ge||!Yn||dn()},[G,ge,Yn,dn,Y?.plan_id]);let Qt=Ue(async p=>{if(!G)throw new Error("No session yet.");await G.selectPlan(p),await ke()},[G,ke]),Jt=Ue(async(p,M)=>{if(!G)throw new Error("No session yet.");let Q=await G.checkoutPlan(p,M);if(!Q.url)throw new Error("Checkout could not be started.");return Q.url},[G]),Yt=Ue(async()=>{if(!G)throw new Error("No session yet.");await G.leavePlan(),await ke()},[G,ke]),jn=ln(i!==void 0);Ye(()=>{if(!G)return;let p=He(tn,y,{immediate:!jn.current});return jn.current=!1,p},[G,tn,y]);let Sn=Ue((p="manual")=>{v&&(ie(!0),N(p))},[v]),jt=Ue(()=>N(null),[]),Rn=ln(ae);Rn.current=ae;let Be=Ue(async p=>{if(!s)throw new Error("Pass `runEndpoint` to <SobaProvider> to start runs from the browser. It is your own route: it holds your secret key, calls soba.run(), and forwards the stream.");let{signal:M,...Q}=p,ye=await(A??fetch.bind(globalThis))(s,{method:"POST",headers:{"content-type":"application/json",accept:"text/event-stream"},credentials:"same-origin",body:JSON.stringify(Q),...M?{signal:M}:{}});if(!ye.ok){let pe=await ye.json().catch(()=>null),Xe=new Error(pe?.error?.message??`${s} answered ${ye.status}.`);Xe.status=ye.status,pe?.error?.code&&(Xe.code=pe.error.code),pe?.error&&(Xe.error=pe.error);let dt=Rn.current.length>0&&!Rn.current.some(Ca=>Ca.state!=="offline");throw ye.status===409&&dt&&Sn("no_compute"),Xe}let rn=Vo(ye);return async function*(){try{yield*rn}finally{Mn.current&&ke(),Jn.current&&dn()}}()},[s,A,ke,dn,Sn]),Ce=Qn(()=>Y?Z.find(p=>p.id===Y.plan_id)??null:null,[Z,Y]),pn=Qn(()=>Ce?Ce.connected_reward==="included"&&ae.length>0&&Ce.connected_included_units!==null?Ce.connected_included_units:Ce.included_units:null,[Ce,ae]),Ze=Qn(()=>({plans:Z,current:Y,plan:Ce,used:Y?.units_used??null,included:pn,remaining:pn!==null&&Y?Math.max(0,pn-Y.units_used):null,unlimited:Ce!==null&&pn===null,loading:Pe,error:Ae,select:Qt,checkout:Jt,leave:Yt,refresh:ke}),[Z,Y,Ce,pn,Pe,Ae,Qt,Jt,Yt,ke]),qt=Qn(()=>({providers:de?.providers??[],names:de?.names??[],layout:de?.layout??null,sizes:de?.sizes!==!1,rowsByLayout:de?.rowsByLayout??{},route:de?.route??null,loading:J,error:R,refresh:dn}),[de,J,R,dn]),yr=Qn(()=>({session:S,client:G,error:L,get plan(){return Vt(),Ze},get models(){return ut(),qt},compute:{machines:ae,connected:ae.length>0,online:ae.some(p=>p.state!=="offline"),loading:q,error:fe,refresh:tn},connect:{app:O?.app??null,command:O?.command??null,connectUrl:O?.connect_url??null,publishableKey:O?.publishable_key??null,loading:j,error:w,open:Sn,close:jt,isOpen:te!==null,hasModal:v},run:Be}),[S,G,L,Ze,Vt,qt,ut,te,Sn,jt,v,ae,q,fe,tn,O,j,w,Be]);return rs(Po.Provider,{value:G,children:rs(Eo.Provider,{value:{context:O,machines:q?void 0:ae,theme:c??O?.theme??"light"},children:Lc(Io.Provider,{value:yr,children:[n,v&&H&&rs(Gt,{open:te!==null,onOpenChange:p=>N(p?te??"manual":null),onConnected:()=>{tn()},...te==="payment_required"||te==="no_compute"?{reason:te}:{},...te==="pair"?{showStatus:!1}:{}})]})})})}function Oc(e){return e?Tc[e]??e:null}var Tc={"user-hardware":"your own computer","user-subscription":"your own AI plan","user-api-key":"your own API key","open-weights":"open models we host",frontier:"a frontier model we pay for"};async function Bc(e,n,t){let r=n.local;if(!r?.session||n.after)return null;let o=/\/v1\/runs\/([^/]+)\/events/.exec(e.url)?.[1];if(!o)return null;let a=`http://127.0.0.1:${r.port??47321}/v1/runs/${o}/events`,s=new AbortController,c=()=>s.abort();n.signal?.addEventListener("abort",c);let i=setTimeout(()=>s.abort(),r.timeoutMs??3e3);try{let l=await t(a,{headers:{authorization:`Bearer ${r.session}`,accept:"text/event-stream"},signal:s.signal});return l.ok?{url:a,bearer:r.session,open:l}:null}catch{return null}finally{clearTimeout(i),n.signal?.removeEventListener("abort",c)}}async function*Gc(e){let n=e.body;if(!n)return;let t=n.getReader(),r=new TextDecoder,o="",a=null,s=[];try{for(;;){let c=await t.read();if(c.done)return;o+=r.decode(c.value,{stream:!0});for(let i=o.indexOf(`
4489
+ `,document.head.appendChild(e)}import{jsx as tn,jsxs as Ht}from"react/jsx-runtime";function aa(e){if(!e)return null;let n=Vn(e);if(n==="payment_required"||n==="no_compute")return null;if(typeof e=="string")return e||null;let t=e,r=t.error?.message;return typeof r=="string"&&r?r:typeof t.message=="string"&&t.message?t.message:"The run ended with an error."}function $l(){return Ht("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[tn("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),tn("circle",{cx:"8",cy:"11.6",r:"0.9",fill:"currentColor"}),tn("circle",{cx:"8",cy:"8",r:"6.4",stroke:"currentColor",strokeWidth:"1.3"})]})}function ec({error:e,onRetry:n,onDismiss:t,title:r,className:o}){let a=aa(e),s=$();return _l(()=>Dt(),[]),a?tn("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":s.theme,role:"alert",children:Ht("div",{className:"sc-card sc-limit sc-run-error",children:[Ht("div",{className:"sc-limit-head",children:[tn("span",{className:"sc-limit-mark sc-run-error-mark","aria-hidden":"true",children:tn($l,{})}),Ht("div",{children:[tn("h2",{className:"sc-limit-title",children:r??"That run did not finish"}),tn("p",{className:"sc-limit-body sc-run-error-message",children:a})]})]}),(t||n)&&Ht("div",{className:"sc-limit-actions",children:[t&&tn("button",{type:"button",className:"sc-btn sc-btn-quiet",onClick:t,children:"Dismiss"}),n&&tn("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:n,children:"Try again"})]})]})}):null}import{useId as nc,useState as ia}from"react";import{jsx as xe,jsxs as br}from"react/jsx-runtime";function tc({reason:e}){return xe("span",{className:"sc-limit-mark","aria-hidden":"true",children:e==="no_compute"?xe(nr,{}):xe(Me,{})})}function rc(e){let{error:n,variant:t="card",onDismiss:r,className:o}=e,a=zo(n,{predict:e.predict??!("error"in e)}),s=nc(),c=$();if(!a)return null;let i=xe(oc,{offer:a,headingId:s,onDismiss:r});return t==="dialog"?xe(Rt,{open:!0,onClose:()=>r?.(),labelledBy:s,theme:c.theme,children:i}):xe("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":c.theme,children:i})}function oc({offer:e,headingId:n,onDismiss:t}){let{compute:r}=_(),[o,a]=ia(!1),[s,c]=ia(null),i=e.reason==="no_compute"&&r.connected&&!r.online,l=i||e.connectOffer!==null||!r.connected,d=Wt();async function f(){a(!0),c(null);try{await e.upgrade()}catch(h){c(h.message)}finally{a(!1)}}return br("div",{className:"sc-card sc-limit",children:[br("div",{className:"sc-limit-head",children:[xe(tc,{reason:e.reason}),br("div",{children:[xe("h2",{className:"sc-limit-title",id:n,children:e.title}),xe("p",{className:"sc-limit-body",children:e.body})]})]}),s&&xe("p",{className:"sc-error",children:s}),i&&d.note&&xe("p",{className:"sc-limit-note",children:d.note}),br("div",{className:"sc-limit-actions",children:[t&&xe("button",{type:"button",className:"sc-btn sc-btn-quiet",onClick:t,disabled:o,children:"Not now"}),e.upgradeTo&&xe("button",{type:"button",className:l?"sc-btn":"sc-btn sc-btn-primary",onClick:()=>void f(),disabled:o,children:o?"Opening\u2026":e.upgradeTo.selectable?`Switch to ${e.upgradeTo.name}`:`${e.upgradeTo.name} for $${e.upgradeTo.price.toLocaleString()}/${e.upgradeTo.interval}`}),l&&xe("button",{type:"button",className:i?"sc-btn":"sc-btn sc-btn-primary",onClick:e.connect,disabled:o,children:i?"Connect another machine":"Connect compute"}),i&&xe("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:d.open,disabled:o,children:"Open Soba"})]})]})}import{useMemo as sc}from"react";function ac(e){let n={};for(let t of e??[])n[t.id]=t.value;return n}function Ut(){let{plan:e,compute:n,connect:t}=_();return sc(()=>{let r=e.plan,o=e.current,a={plan:r,assignment:o,loading:e.loading,error:e.error,periodEnd:o?.period_end?new Date(o.period_end):null,features:o?.features??ac(r?.features)};if(!r)return{...a,state:"none",trialDaysLeft:null,ceiling:null,raised:!1,uncounted:!1,used:0,remaining:null,percent:null,unlimited:!1,reward:null,summary:"Nothing is assigned to this account, so runs are bounded by whatever the app allows."};let s=cc(o?.trial_ends_at??null),c=r.connected_reward==="included"&&n.connected&&r.connected_included_units!==null,i=c?r.connected_included_units:r.included_units,l=n.connected,d=i===null,f=e.used??0,h=i===null?null:Math.max(0,i-f),A=i&&i>0?Math.min(100,Math.round(f/i*100)):null,p=i!==null&&f>=i,w=s!==null?"trial":d?"unlimited":p?r.overage==="meter"?"metered":"spent":"within";return{...a,state:w,trialDaysLeft:s,ceiling:i,raised:c,uncounted:l,used:f,remaining:h,percent:A,unlimited:d,reward:ic(r,c,n.connected,()=>t.open("manual")),summary:lc({plan:r,assignment:o,used:f,ceiling:i,trialDaysLeft:s,raised:c,uncounted:l,state:w})}},[e,n.connected,t])}function ic(e,n,t,r){let o=ln({unit:e.unit,reward:e.connected_reward,includedUnits:e.connected_included_units,creditMicros:e.connected_credit*1e6});return o?{line:o,inForce:n,required:!1,connected:t,actionable:cn(e.connected_reward)&&!t,open:r}:je(e.route_allow)&&!t?{line:"Nothing connected yet, so nothing can run.",inForce:!1,required:!0,connected:t,actionable:!0,open:r}:null}function lc(e){let{plan:n,assignment:t,used:r,ceiling:o,trialDaysLeft:a,raised:s,uncounted:c,state:i}=e,l=c?" Runs your own AI serves do not count toward it.":"";if(i==="trial"&&a!==null){let h=n.price===0?"it continues free":`it is $${n.price.toLocaleString()} a ${n.interval}`;return`${a} ${a===1?"day":"days"} left of your trial, then ${h}.`}if(i==="unlimited")return`${Be(n.unit,r)} this period. No ceiling on this plan.`;if(i==="metered"){let h=r-(o??0);return n.overage_per_unit>0?`${Be(n.unit,h)} past the allowance, billed at $${n.overage_per_unit} per ${Hn(n.unit)}.${l}`:`${Be(n.unit,h)} past the allowance, billed by usage.${l}`}if(i==="spent")return t?.period_end?`Allowance spent. It comes back on ${la(t.period_end)}.${l}`:`Allowance spent. It comes back at the start of the next period.${l}`;let d=Math.max(0,(o??0)-r),f=s?` Raised from ${Be(n.unit,n.included_units??0)} while your own AI is connected.`:t?.period_end?` Resets ${la(t.period_end)}.`:"";return`${Be(n.unit,d)} of ${Be(n.unit,o??0)} left.${f}${l}`}function cc(e){if(!e)return null;let n=new Date(e).getTime()-Date.now();return Number.isNaN(n)||n<=0?null:Math.max(1,Math.ceil(n/864e5))}function la(e){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{day:"numeric",month:"long"})}import{Fragment as dc,jsx as Se,jsxs as Ze}from"react/jsx-runtime";function qo({heading:e="Current plan",showUsage:n=!0,showName:t=!0,className:r}){let o=Ut(),{theme:a}=$(),s=h=>Se("section",{className:r?`soba-connect sc-fill ${r}`:"soba-connect sc-fill","data-theme":a,children:Ze("div",{className:"sc-card sc-current",children:[e&&Se("h2",{className:"sc-section-title",children:e}),h]})});if(o.error)return s(Se("p",{className:"sc-error",children:o.error.message}));if(o.loading)return s(Se("p",{className:"sc-note",children:"Loading\u2026"}));if(!o.plan)return s(Ze("div",{className:"sc-current-main",children:[Se("p",{className:"sc-current-name",children:"No plan"}),Se("p",{className:"sc-sub",children:o.summary})]}));let{plan:c,trialDaysLeft:i,percent:l,unlimited:d,reward:f}=o;return s(Ze(dc,{children:[Ze("div",{className:"sc-current-grid",children:[(t||i!==null)&&Ze("div",{className:"sc-current-main",children:[t?Ze("p",{className:"sc-current-name",children:[c.name,i!==null&&Ze("span",{className:"sc-trial-badge",children:[i," ",i===1?"day":"days"," left"]})]}):i!==null&&Se("p",{className:"sc-current-trial",children:Ze("span",{className:"sc-trial-badge",children:[i," ",i===1?"day":"days"," left"]})}),t&&c.description&&Se("p",{className:"sc-sub",children:c.description})]}),n&&Ze("div",{className:"sc-usage",children:[Ze("div",{className:"sc-row-between",children:[Se("span",{className:"sc-fact-key",children:"Usage"}),Se("span",{className:l!==null&&l>=100?"sc-usage-figure sc-usage-over":"sc-usage-figure",children:d?"Unlimited":l===null?"Metered":`${l}% used`})]}),l!==null&&Se("div",{className:"sc-meter",role:"presentation",children:l>0&&Se("span",{className:l>=100?"sc-meter-fill sc-meter-full":"sc-meter-fill",style:{width:`${l}%`}})}),Se("p",{className:"sc-usage-line",children:o.summary})]})]}),f&&Ze("div",{className:"sc-current-foot",children:[Se("p",{className:f.required?"sc-plan-reward-line sc-plan-reward-need":f.inForce?"sc-plan-reward-line":"sc-plan-reward-line sc-plan-reward-open",children:f.required?f.line:f.inForce?`In force: ${uc(f.line)}.`:f.line}),(f.actionable||f.connected)&&Se(zn,{})]})]}))}var uc=e=>e.charAt(0).toLowerCase()+e.slice(1);import{useCallback as pc,useMemo as mc,useState as ca}from"react";var fc={"user-hardware":"your own machine","user-subscription":"your own AI subscription","open-weights":"open models we host",frontier:"frontier models"},gc=new Set(["user-hardware","user-subscription"]);function Zo(e={}){let{plan:n,compute:t,connect:r}=_(),[o,a]=ca(null),[s,c]=ca(null),{featured:i,onSelect:l,successUrl:d,cancelUrl:f}=e,h=pc(async p=>{a(p.id),c(null);try{if(p.contact_url)p.contact_url.startsWith("mailto:")?window.location.assign(p.contact_url):window.open(p.contact_url,"_blank","noopener");else if(p.selectable)await n.select(p.id);else if(l)l(p);else{let w=await n.checkout(p.id,{...d?{successUrl:d}:{},...f?{cancelUrl:f}:{}});window.location.assign(w);return}}catch(w){throw c(w.message),w}finally{(p.selectable||l||p.contact_url)&&a(null)}},[n,l,d,f]),A=mc(()=>n.plans.map(p=>{let w=n.current?.plan_id===p.id;return{plan:p,current:w,featured:i===p.id&&!w,price:hc(p),allowance:p.included_units===null?`Unlimited ${p.unit==="cost"?"usage":(p.unit==="run"||p.unit==="task")&&p.task_noun?p.task_noun:`${p.unit}s`}`:Lt(p.unit,p.included_units,p.task_noun),allowanceNote:bc(p),features:(()=>{let b=p.features_from?n.plans.find(C=>C.id===p.features_from):void 0;return b&&p.features_own?[{text:`Everything in ${b.name}`,included:!0},...pr(p.features_own)]:pr(p.features)})(),ownAllowance:Un({unit:p.unit,ownUnit:p.own_unit??null,includedUnits:p.included_units,ownIncludedUnits:p.own_included_units??null,routePrefer:p.route_prefer,taskNoun:p.task_noun}),computeLabel:p.route_allow===null?"any compute":p.route_allow.length===0?"no compute":null,compute:(p.route_allow??[]).map(b=>({costClass:b,label:fc[b]??b,owned:gc.has(b),runtimes:Xr(b).map(C=>C.id)})),connect:Ac(p,w,t.connected,()=>r.open("manual")),cta:{label:yc(p,w,o===p.id),disabled:w||o!==null,busy:o===p.id,take:()=>h(p)}}}),[n.plans,n.current,i,t.connected,r,o,h]);return{offers:A,current:A.find(p=>p.current)??null,loading:n.loading,error:n.error,failed:s}}function hc(e){return e.contact_url?{amount:"Talk to us",interval:null,free:!1}:{amount:`$${e.price.toLocaleString()}`,interval:e.interval,free:e.price===0}}function bc(e){let n=[];return e.included_units===null?n.push("No ceiling on this plan"):(n.push(`Included each ${e.interval}`),e.estimated_tasks&&n.push(`about ${e.estimated_tasks.toLocaleString("en-US")} ${e.task_noun??"runs"}`),e.overage==="meter"?n.push(e.overage_per_unit>0?`then $${e.overage_per_unit} per ${Hn(e.unit)}`:"then billed by usage"):e.included_units>0&&n.push("then it stops")),e.trial_days>0&&n.push(`${e.trial_days}-day trial`),n.join(" \xB7 ")}function Ac(e,n,t,r){let o=ln({unit:e.unit,reward:e.connected_reward,includedUnits:e.connected_included_units,creditMicros:e.connected_credit*1e6}),a=je(e.route_allow)&&!t;if(!o&&!a)return null;let s=cn(e.connected_reward);return{key:o?"Connect your own":"To use this",line:o??(n?"Nothing connected yet, so nothing can run.":"Runs only on compute you connect."),reward:o!==null,actionable:n&&(s||a)&&!t,open:r}}function yc(e,n,t){return n?"Your plan":e.contact_url?"Talk to us":t?e.selectable?"Switching\u2026":"Opening\u2026":e.selectable?"Choose":`Subscribe for $${e.price.toLocaleString()}/${e.interval}`}import{jsx as M,jsxs as se}from"react/jsx-runtime";function Ar(e){return e?`soba-connect sc-fill ${e}`:"soba-connect sc-fill"}function Ft({onSelect:e,successUrl:n,cancelUrl:t,showCompute:r=!0,showConnect:o=!1,variant:a="cards",featured:s,className:c}){let{offers:i,loading:l,error:d,failed:f}=Zo({...s?{featured:s}:{},...e?{onSelect:e}:{},...n?{successUrl:n}:{},...t?{cancelUrl:t}:{}}),{theme:h}=$();if(d)return M("div",{className:Ar(c),"data-theme":h,children:M("div",{className:"sc-card",children:M("p",{className:"sc-error",children:d.message})})});if(l)return M("div",{className:Ar(c),"data-theme":h,children:M("div",{className:"sc-card",children:M("p",{className:"sc-note",children:"Loading plans\u2026"})})});if(i.length===0)return M("div",{className:Ar(c),"data-theme":h,children:M("div",{className:"sc-card",children:M("p",{className:"sc-note",children:"This app has no plans yet."})})});let A={showCompute:r,showConnect:o};return se("div",{className:Ar(c),"data-theme":h,"data-variant":a,children:[a==="rows"?M(vc,{offers:i,shelf:A}):a==="table"?M(kc,{offers:i,shelf:A}):M(wc,{offers:i,shelf:A}),f&&M("p",{className:"sc-error",children:f})]})}function wc({offers:e,shelf:n}){return M("div",{className:"sc-plans",children:e.map(t=>se("div",{className:ua("sc-plan",t),children:[se("div",{className:"sc-row-between",children:[M("span",{className:"sc-title",children:t.plan.name}),M(Xo,{offer:t})]}),M("p",{className:"sc-sub",children:t.plan.description}),M(Ko,{price:t.price,free:"forever"}),M(es,{offer:t,shelf:n}),M(da,{offer:t}),M("div",{className:"sc-plan-band",children:n.showCompute&&M($o,{offer:t})}),M("div",{className:"sc-plan-band",children:M(_o,{offer:t})})]},t.plan.id))})}function vc({offers:e,shelf:n}){return M("ul",{className:"sc-plan-rows",children:e.map(t=>se("li",{className:ua("sc-plan-row",t),children:[se("div",{className:"sc-row-main",children:[se("span",{className:"sc-row-name",children:[M("span",{className:"sc-title",children:t.plan.name}),M(Xo,{offer:t})]}),t.plan.description&&M("p",{className:"sc-sub",children:t.plan.description}),M(da,{offer:t}),n.showCompute&&M($o,{offer:t,inline:!0}),M(_o,{offer:t,inline:!0})]}),se("div",{className:"sc-row-side",children:[M(Ko,{price:t.price,free:"forever",small:!0}),M(es,{offer:t,shelf:n})]})]},t.plan.id))})}function kc({offers:e,shelf:n}){let t=e.some(s=>s.plan.overage==="meter"),r=e.some(s=>s.plan.trial_days>0),o=e.some(s=>s.connect!==null),a=s=>[s.current?"sc-col-current":"",s.featured?"sc-col-featured":""].filter(Boolean).join(" ")||void 0;return M("div",{className:"sc-table-scroll",children:se("table",{className:"sc-plan-table",children:[M("thead",{children:se("tr",{children:[M("td",{}),e.map(s=>se("th",{scope:"col",className:a(s),children:[se("span",{className:"sc-row-name",children:[M("span",{className:"sc-title",children:s.plan.name}),M(Xo,{offer:s})]}),M(Ko,{price:s.price,small:!0})]},s.plan.id))]})}),se("tbody",{children:[se("tr",{children:[M("th",{scope:"row",children:"Included"}),e.map(s=>M("td",{className:a(s),children:s.allowance},s.plan.id))]}),t&&se("tr",{children:[M("th",{scope:"row",children:"Then"}),e.map(s=>M("td",{className:a(s),children:s.plan.overage_per_unit>0?`$${s.plan.overage_per_unit} / ${Hn(s.plan.unit)}`:s.plan.overage==="meter"?"By usage":M("span",{className:"sc-muted-cell",children:"Stops"})},s.plan.id))]}),r&&se("tr",{children:[M("th",{scope:"row",children:"Trial"}),e.map(s=>M("td",{className:a(s),children:s.plan.trial_days>0?`${s.plan.trial_days} days`:M("span",{className:"sc-muted-cell",children:"None"})},s.plan.id))]}),n.showCompute&&se("tr",{children:[M("th",{scope:"row",children:"Runs on"}),e.map(s=>M("td",{className:a(s),children:M($o,{offer:s,bare:!0})},s.plan.id))]}),o&&se("tr",{children:[M("th",{scope:"row",children:"Connect your own"}),e.map(s=>M("td",{className:a(s),children:M(_o,{offer:s,bare:!0})},s.plan.id))]}),se("tr",{className:"sc-table-buy",children:[M("td",{}),e.map(s=>M("td",{className:a(s),children:M(es,{offer:s,shelf:n})},s.plan.id))]})]})]})})}function ua(e,n){return[e,n.current?"sc-plan-current":"",n.featured?"sc-plan-featured":""].filter(Boolean).join(" ")}function Xo({offer:e}){return e.current?M("span",{className:"sc-plan-badge",children:"Current"}):e.featured?M("span",{className:"sc-plan-badge-soft",children:"Recommended"}):null}function Ko({price:e,small:n,free:t}){return se("p",{className:n?"sc-plan-price sc-plan-price-sm":"sc-plan-price",children:[M("span",{className:"sc-plan-amount",children:e.amount}),e.interval?se("span",{className:"sc-plan-interval",children:["/",e.interval]}):t&&M("span",{className:"sc-plan-interval sc-plan-after",children:t})]})}function da({offer:e}){return se("p",{className:"sc-plan-allowance",children:[M("span",{className:"sc-plan-figure",children:e.allowance}),M("span",{className:"sc-plan-qualifier",children:e.allowanceNote}),e.ownAllowance&&M("span",{className:"sc-plan-qualifier",children:e.ownAllowance}),e.features.map(n=>M("span",{className:n.included?"sc-plan-qualifier sc-plan-feature":"sc-plan-qualifier sc-plan-feature sc-plan-feature-absent",children:n.text},n.text))]})}function _o({offer:e,inline:n,bare:t}){let r=e.connect;if(!r)return t?M("span",{className:"sc-muted-cell",children:"None"}):null;let o=r.reward?"sc-plan-reward-line":"sc-plan-reward-line sc-plan-reward-need",a=r.actionable?se("button",{type:"button",className:`${o} sc-plan-reward-act`,"aria-label":"Connect compute",onClick:r.open,children:[M("span",{className:"sc-reward-said",children:r.line}),se("span",{className:"sc-reward-do","aria-hidden":!0,children:[M(Me,{className:"sc-reward-mark"}),"Connect compute"]})]}):M("p",{className:o,children:r.line});return t?a:M("div",{className:n?"sc-plan-reward sc-plan-reward-inline":"sc-plan-reward",children:a})}function $o({offer:e,inline:n,bare:t}){let r=e.computeLabel?M("ul",{className:n?"sc-compute sc-compute-inline":"sc-compute",children:M("li",{children:e.computeLabel})}):M("ul",{className:n?"sc-compute sc-compute-inline":"sc-compute",children:e.compute.map(o=>se("li",{className:o.owned?"sc-compute-own":void 0,children:[o.label,M(Cc,{runtimes:o.runtimes})]},o.costClass))});return t?r:se("div",{className:n?"sc-plan-compute sc-plan-compute-inline":"sc-plan-compute",children:[M("span",{className:"sc-fact-key",children:"Runs on"}),r]})}function es({offer:e,shelf:n}){let t=e.connect;return n.showConnect&&t?.actionable?se("button",{type:"button",className:"sc-btn sc-btn-primary sc-btn-icon",onClick:t.open,children:[M(Me,{className:"sc-btn-mark"}),"Connect compute"]}):M("button",{type:"button",className:e.current?"sc-btn":"sc-btn sc-btn-primary",disabled:e.cta.disabled,onClick:()=>void e.cta.take().catch(()=>{}),children:e.cta.label})}function Cc({runtimes:e}){return e.length===0?null:M("span",{className:"sc-compute-marks",children:e.map(n=>{let t=yn[n];return t?M(t,{className:"sc-rt-mark"},n):null})})}import{jsx as ns,jsxs as pa}from"react/jsx-runtime";function Mc({heading:e,plansHeading:n,showUsage:t=!0,showName:r=!0,className:o,...a}){let{plan:s,loading:c}=Ut(),{theme:i}=$(),l=n??(c?"Plans":s?"Change plan":"Choose a plan");return pa("div",{className:o?`soba-connect sc-fill sc-billing ${o}`:"soba-connect sc-fill sc-billing","data-theme":i,children:[ns(qo,{...e===void 0?{}:{heading:e},showUsage:t,showName:r}),pa("section",{className:"sc-billing-plans",children:[l&&ns("h2",{className:"sc-section-title",children:l}),ns(Ft,{...a})]})]})}import{useCallback as ma,useState as fa}from"react";function ts({plan:e,successUrl:n,cancelUrl:t,label:r}){let{plan:o}=_(),[a,s]=fa(!1),[c,i]=fa(null),l=ma(()=>o.checkout(e.id,{...n?{successUrl:n}:{},...t?{cancelUrl:t}:{}}),[o,e.id,n,t]),d=ma(async()=>{s(!0),i(null);try{window.location.assign(await l())}catch(f){i(f.message),s(!1)}},[l]);return{label:a?"Opening\u2026":r??`Subscribe for $${e.price.toLocaleString()}/${e.interval}`,busy:a,error:c,buy:d,session:l}}import{jsx as ga,jsxs as xc}from"react/jsx-runtime";function Nc({plan:e,successUrl:n,cancelUrl:t,label:r,className:o}){let{theme:a}=$(),s=ts({plan:e,...n?{successUrl:n}:{},...t?{cancelUrl:t}:{},...r?{label:r}:{}});return xc("div",{className:o?`soba-connect ${o}`:"soba-connect","data-theme":a,children:[ga("button",{type:"button",className:"sc-btn sc-btn-primary",disabled:s.busy,onClick:()=>void s.buy(),children:s.label}),s.error&&ga("p",{className:"sc-error",children:s.error})]})}import{useState as Rc}from"react";import{useMemo as Sc}from"react";function rs(e,n={}){let{plan:t}=_(),r=n.use??1;return Sc(()=>{let o=t.current,a=t.plan?.features?.find(i=>i.id===e),s=o?o.features??Object.fromEntries((t.plan?.features??[]).map(i=>[i.id,i.value])):null,c=yo({features:s,quantities:o?.quantities??{},ended:o?.ended??!1},e,r);return{...c,allowed:t.loading?!1:c.allowed,name:a?.name??e,unit:a?.unit??null,loading:t.loading,error:t.error,refresh:t.refresh}},[t.current,t.plan,t.loading,t.error,t.refresh,e,r])}import{Fragment as os,jsx as Cn,jsxs as ha}from"react/jsx-runtime";function Pc({feature:e,use:n=1,children:t,fallback:r,loading:o=null,className:a}){let s=rs(e,{use:n});return s.loading?Cn(os,{children:o}):s.allowed?Cn(os,{children:t}):r!==void 0?Cn(os,{children:typeof r=="function"?r(s):r}):Cn(Ec,{view:s,className:a})}function ba(e){let n=e.unit||e.name.toLowerCase();switch(e.reason){case"no_plan":return`Pick a plan to use ${e.name.toLowerCase()}.`;case"plan_ended":return"Your plan has ended. Pick a plan to keep going.";case"limit_reached":return`Your plan includes ${e.limit} ${n}, and all ${e.limit} are in use.`;default:return`${e.name} isn't included in your plan.`}}function Ec({view:e,className:n}){let{theme:t}=$(),[r,o]=Rc(!1);return ha("section",{className:n?`soba-connect sc-fill ${n}`:"soba-connect sc-fill","data-theme":t,children:[ha("div",{className:"sc-card",children:[Cn("p",{className:"sc-title",children:e.reason==="plan_ended"?"Plan ended":"Upgrade to continue"}),Cn("p",{className:"sc-sub",children:ba(e)}),!r&&Cn("button",{type:"button",className:"sc-btn sc-btn-primary",onClick:()=>o(!0),children:"See plans"})]}),r&&Cn(Ft,{})]})}import{useCallback as Ve,useEffect as Qe,useLayoutEffect as Hc,useMemo as Mn,useRef as un,useState as me}from"react";var Ic="soba.lastseen:";function Aa(e){return!e.user&&!e.cacheKey?null:Ic+JSON.stringify([e.endpoint??null,e.user??null,e.cacheKey??null])}function ss(e){try{let n=globalThis.localStorage?.getItem(e);return n?JSON.parse(n):{}}catch{return{}}}function ya(e,n){try{globalThis.localStorage?.setItem(e,JSON.stringify({...ss(e),...n}))}catch{}}function wa(e){if(!e)return null;let{machines:n}=ss(e);return Array.isArray(n)&&n.length?n:null}function va(e){return e?ss(e).models??null:null}function ka(e,n){e&&ya(e,{machines:n})}function Ca(e,n){e&&ya(e,{models:n})}var Lc="soba.session:";function Ma(e){return!e.cacheKey||!e.endpoint?null:Lc+JSON.stringify([e.endpoint,e.user??null,e.cacheKey])}function Oc(e){try{let n=globalThis.localStorage?.getItem(e);if(!n)return null;let t=JSON.parse(n);return typeof t.token!="string"||typeof t.expiresAt!="number"?null:{token:t.token,expiresAt:t.expiresAt}}catch{return null}}function Tc(e,n){try{n?globalThis.localStorage?.setItem(e,JSON.stringify(n)):globalThis.localStorage?.removeItem(e)}catch{}}var Na=6e4,Bc=1e4,yr=class{#e;#n=null;#r=null;#t;#o=new Set;constructor(n){this.#t=n,this.#e=n.token??null;let t=Ma(n),r=t&&!this.#e?Oc(t):null;r&&r.expiresAt-Na>Date.now()&&(this.#e=r.token,this.#n=r.expiresAt)}get token(){return this.#e}get expiresAt(){return this.#n}get canRefresh(){return!!this.#t.endpoint}get refreshAt(){return!this.canRefresh||this.#n===null?null:Math.max(Date.now()+Bc,this.#n-Na)}subscribe(n){return this.#o.add(n),()=>this.#o.delete(n)}async ensure(){return this.#e?this.#e:this.refresh()}async refresh(){if(this.#r)return this.#r;let n=this.#t.endpoint;if(!n)throw new Error("This Soba session cannot be refreshed. Pass `sessionEndpoint` so the provider can mint a new one.");let t=this.#t.fetchImpl??fetch.bind(globalThis);this.#r=(async()=>{let r=await t(n,{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(this.#t.user?{user:this.#t.user}:{})});if(!r.ok)throw new Error(`Could not start a Soba session (${r.status} from ${n}).`);let o=await r.json(),a=o.session??o.token;if(!a)throw new Error(`${n} answered without a \`session\`. See @soba-so/react's README.`);let s=o.expires_in??o.expiresIn;this.#e=a,this.#n=typeof s=="number"?Date.now()+s*1e3:null;let c=Ma(this.#t);c&&Tc(c,this.#n===null?null:{token:a,expiresAt:this.#n});for(let i of this.#o)i();return a})();try{return await this.#r}finally{this.#r=null}}},it=new Map,xa=new WeakMap,Gc=1;function Wc(e){if(e.token||!e.endpoint)return null;let n=0;return e.fetchImpl&&(n=xa.get(e.fetchImpl)??Gc++,xa.set(e.fetchImpl,n)),JSON.stringify([e.endpoint,e.user??null,n,e.cacheKey??null])}function Sa(e){let n=Wc(e);if(!n)return new yr(e);let t=it.get(n)??{holder:new yr(e),users:0};return it.set(n,t),t.holder}function Ra(e){for(let n of it.values())n.holder===e&&n.users++}function Pa(e){for(let[n,t]of it)if(t.holder===e){setTimeout(()=>{--t.users<=0&&it.get(n)===t&&it.delete(n)},0);return}}function Ea(e,n=fetch.bind(globalThis)){return async(t,r)=>{let o=await n(t,r);if(o.status!==401||!e.canRefresh)return o;let a;try{a=await e.refresh()}catch{return o}return n(t,Dc(r,a))}}function Dc(e,n){let t=new Headers(e?.headers);return t.set("authorization",`Bearer ${n}`),{...e,headers:t}}import{jsx as as,jsxs as Qc}from"react/jsx-runtime";var Uc="https://soba.so",Fc=3e4,zc=typeof window>"u"?Qe:Hc;function Vc(e){let{children:n,session:t,sessionEndpoint:r,user:o,sessionCacheKey:a,runEndpoint:s,theme:c,initialMachines:i,initialConnect:l=null,initialPlans:d,initialCurrentPlan:f=null,baseUrl:h=Uc,pollMs:A=Fc,injectStyles:p=!0,modal:w=!0,fetchImpl:b,onError:C}=e,[S,W]=me(t??null),[O,D]=me(null),[T,U]=me(l),[y,ee]=me(null),[q,ne]=me(l===null),[ae,fe]=me(i??[]),[he,P]=me(null),[Z,V]=me(i===void 0),[X,ye]=me(d??[]),[j,be]=me(f),[we,Ge]=me(null),[Ee,te]=me(d===void 0),[ge,u]=me(null),[R,L]=me(null),[J,G]=me(!0),[re,N]=me(null),[H,ie]=me(!1),Ie=un(C);Ie.current=C;let Xe=Ve(v=>{D(v),Ie.current?.(v)},[]);Qe(()=>{p&&Dt()},[p]);let E=Mn(()=>Sa({...t?{token:t}:{},...r?{endpoint:r}:{},...o?{user:o}:{},...b?{fetchImpl:b}:{},...a?{cacheKey:a}:{}}),[t,r,o,b,a]);Qe(()=>{let v=!0;Ra(E);let F=E.subscribe(()=>{v&&W(E.token)});return!E.token&&!E.canRefresh?Xe(new Error("<SobaProvider> needs a `session` or a `sessionEndpoint`. A browser cannot mint one: that takes your secret key.")):E.ensure().then(()=>v&&W(E.token),le=>v&&Xe(le)),()=>{v=!1,F(),Pa(E)}},[E,Xe]),Qe(()=>{O&&(ne(!1),V(!1),te(!1),G(!1),ee(v=>v??O),P(v=>v??O),Ge(v=>v??O))},[O]),Qe(()=>{let v=E.refreshAt;if(v===null)return;let F=()=>{E.refresh().catch(pe=>Xe(pe))},le=()=>{document.hidden||(document.removeEventListener("visibilitychange",le),F())},Ke=setTimeout(()=>{typeof document<"u"&&document.hidden?document.addEventListener("visibilitychange",le):F()},Math.max(0,v-Date.now()));return()=>{clearTimeout(Ke),typeof document<"u"&&document.removeEventListener("visibilitychange",le)}},[E,Xe,S]);let Le=Mn(()=>Aa({endpoint:r,user:o,cacheKey:a}),[r,o,a]),Re=i!==void 0;zc(()=>{let v=Re?null:wa(Le);v&&(fe(le=>le.length?le:v),V(!1));let F=va(Le);F&&(u(le=>le??F),G(!1))},[Le,Re]);let Nn=un(l?.machines_url??null),Y=Mn(()=>{if(!S)return null;let v=new mt({session:S,baseUrl:h,fetchImpl:Ea(E,b??fetch.bind(globalThis))});return v.setMachinesUrl(Nn.current),v},[S,h,E,b]),xn=un(l!==null);Qe(()=>{if(!Y||xn.current)return;let v=!0;return ne(!0),Y.context().then(F=>{v&&(U(F),ee(null),ne(!1))},F=>{v&&(ee(F),ne(!1))}),()=>{v=!1}},[Y]);let dn=Ve(async()=>{if(Y)try{let v=await Y.machines();fe(Array.isArray(v)?v:[]),Array.isArray(v)&&ka(Le,v),P(null)}catch(v){P(v)}finally{V(!1)}},[Y,Le]),Ce=Ve(async()=>{if(Y)try{let v=await Y.plans();ye(v.plans),be(v.current),Ge(null)}catch(v){Ge(v)}finally{te(!1)}},[Y]),rn=un(!1),[wr,zt]=me(!1),vr=un(d!==void 0),pn=un(!1),Vt=Ve(()=>{rn.current||(rn.current=!0,pn.current&&queueMicrotask(()=>{pn.current&&zt(!0)}))},[]);Qe(()=>(pn.current=!0,rn.current&&zt(!0),()=>{pn.current=!1}),[]),Qe(()=>{!Y||!wr||vr.current||Ce()},[Y,wr,Ce]);let de=Ve(async()=>{if(Y)try{let v=await Y.modelOptions();u(v),v&&Ca(Le,v),L(null)}catch(v){L(v)}finally{G(!1)}},[Y,Le]),We=un(!1),[lt,Qt]=me(!1),Jt=Ve(()=>{We.current||(We.current=!0,pn.current&&queueMicrotask(()=>{pn.current&&Qt(!0)}))},[]);Qe(()=>{We.current&&Qt(!0)},[]);let Qn=xn.current||T!==null;Qe(()=>{y&&!Qn&&G(!1)},[y,Qn]),Qe(()=>{!Y||!lt||!Qn||de()},[Y,lt,Qn,de,j?.plan_id]);let Yt=Ve(async v=>{if(!Y)throw new Error("No session yet.");await Y.selectPlan(v),await Ce()},[Y,Ce]),Jn=Ve(async(v,F)=>{if(!Y)throw new Error("No session yet.");let le=await Y.checkoutPlan(v,F);if(!le.url)throw new Error("Checkout could not be started.");return le.url},[Y]),ct=Ve(async()=>{if(!Y)throw new Error("No session yet.");await Y.leavePlan(),await Ce()},[Y,Ce]),jt=un(i!==void 0);Qe(()=>{if(!Y)return;let v=ze(dn,A,{immediate:!jt.current});return jt.current=!1,v},[Y,dn,A]);let mn=Ve((v="manual")=>{w&&(ie(!0),N(v))},[w]),De=Ve(()=>N(null),[]),on=un(ae);on.current=ae;let ut=Ve(async v=>{if(!s)throw new Error("Pass `runEndpoint` to <SobaProvider> to start runs from the browser. It is your own route: it holds your secret key, calls soba.run(), and forwards the stream.");let{signal:F,...le}=v,pe=await(b??fetch.bind(globalThis))(s,{method:"POST",headers:{"content-type":"application/json",accept:"text/event-stream"},credentials:"same-origin",body:JSON.stringify(le),...F?{signal:F}:{}});if(!pe.ok){let sn=await pe.json().catch(()=>null),Zt=new Error(sn?.error?.message??`${s} answered ${pe.status}.`);Zt.status=pe.status,sn?.error?.code&&(Zt.code=sn.error.code),sn?.error&&(Zt.error=sn.error);let Ia=on.current.length>0&&!on.current.some(La=>La.state!=="offline");throw pe.status===409&&Ia&&mn("no_compute"),Zt}let Rn=Jo(pe);return async function*(){try{yield*Rn}finally{rn.current&&Ce(),We.current&&de()}}()},[s,b,Ce,de,mn]),Ae=Mn(()=>j?X.find(v=>v.id===j.plan_id)??null:null,[X,j]),Sn=Mn(()=>Ae?Ae.connected_reward==="included"&&ae.length>0&&Ae.connected_included_units!==null?Ae.connected_included_units:Ae.included_units:null,[Ae,ae]),qt=Mn(()=>({plans:X,current:j,plan:Ae,used:j?.units_used??null,included:Sn,remaining:Sn!==null&&j?Math.max(0,Sn-j.units_used):null,unlimited:Ae!==null&&Sn===null,loading:Ee,error:we,select:Yt,checkout:Jn,leave:ct,refresh:Ce}),[X,j,Ae,Sn,Ee,we,Yt,Jn,ct,Ce]),k=Mn(()=>({providers:ge?.providers??[],names:ge?.names??[],layout:ge?.layout??null,sizes:ge?.sizes!==!1,rowsByLayout:ge?.rowsByLayout??{},route:ge?.route??null,loading:J,error:R,refresh:de}),[ge,J,R,de]),I=Mn(()=>({session:S,client:Y,error:O,get plan(){return Vt(),qt},get models(){return Jt(),k},compute:{machines:ae,connected:ae.length>0,online:ae.some(v=>v.state!=="offline"),loading:Z,error:he,refresh:dn},connect:{app:T?.app??null,command:T?.command??null,connectUrl:T?.connect_url??null,publishableKey:T?.publishable_key??null,loading:q,error:y,open:mn,close:De,isOpen:re!==null,hasModal:w},run:ut}),[S,Y,O,qt,Vt,k,Jt,re,mn,De,w,ae,Z,he,dn,T,q,y,ut]);return as(Io.Provider,{value:Y,children:as(Lo.Provider,{value:{context:T,machines:Z?void 0:ae,theme:c??T?.theme??"light"},children:Qc(Oo.Provider,{value:I,children:[n,w&&H&&as(Bt,{open:re!==null,onOpenChange:v=>N(v?re??"manual":null),onConnected:()=>{dn()},...re==="payment_required"||re==="no_compute"?{reason:re}:{},...re==="pair"?{showStatus:!1}:{}})]})})})}function Jc(e){return e?Yc[e]??e:null}var Yc={"user-hardware":"your own local model","user-subscription":"your own AI plan","user-api-key":"your own API key","open-weights":"open models we host",frontier:"a frontier model we pay for"};async function jc(e,n,t){let r=n.local;if(!r?.session||n.after)return null;let o=/\/v1\/runs\/([^/]+)\/events/.exec(e.url)?.[1];if(!o)return null;let a=`http://127.0.0.1:${r.port??47321}/v1/runs/${o}/events`,s=new AbortController,c=()=>s.abort();n.signal?.addEventListener("abort",c);let i=setTimeout(()=>s.abort(),r.timeoutMs??3e3);try{let l=await t(a,{headers:{authorization:`Bearer ${r.session}`,accept:"text/event-stream"},signal:s.signal});return l.ok?{url:a,bearer:r.session,open:l}:null}catch{return null}finally{clearTimeout(i),n.signal?.removeEventListener("abort",c)}}async function*qc(e){let n=e.body;if(!n)return;let t=n.getReader(),r=new TextDecoder,o="",a=null,s=[];try{for(;;){let c=await t.read();if(c.done)return;o+=r.decode(c.value,{stream:!0});for(let i=o.indexOf(`
4490
4490
  `);i!==-1;i=o.indexOf(`
4491
4491
  `)){let l=o.slice(0,i).replace(/\r$/,"");if(o=o.slice(i+1),l==="")s.length&&(yield{id:a,data:s.join(`
4492
- `)}),a=null,s=[];else if(l.startsWith("id:")){let d=Number(l.slice(3).trim());a=Number.isFinite(d)?d:null}else if(l.startsWith("data:")){let d=l.slice(5);s.push(d.startsWith(" ")?d.slice(1):d)}}}}finally{t.cancel().catch(()=>{})}}var os=(e,n)=>new Promise(t=>{let r=setTimeout(t,e);n?.addEventListener("abort",()=>{clearTimeout(r),t()})});async function*Wc(e,n={}){let t=n.fetchImpl??fetch.bind(globalThis),r=await Bc(e,n,t)??{url:e.url,bearer:e.token,open:null},o=n.maxRetries??6,a=n.after??0,s=0;for(;;){if(n.signal?.aborted)return;let c;try{c=r.open??await t(r.url,{headers:{authorization:`Bearer ${r.bearer}`,accept:"text/event-stream",...a?{"last-event-id":String(a)}:{}},...n.signal?{signal:n.signal}:{}}),r.open=null}catch(i){if(n.signal?.aborted)return;if(++s>o)throw i;await os(1e3*s,n.signal);continue}if(c.status===503&&s<o){s++,await os(Number(c.headers.get("retry-after")??3)*1e3,n.signal);continue}if(!c.ok){let i=`Could not read this run (${c.status}).`;try{let l=await c.json();l.error?.message&&(i=l.error.message)}catch{}throw new Error(i)}for await(let i of Gc(c)){i.id!==null&&(a=i.id),s=0;let l=lt(i.data);if(l&&(yield l,l.type==="done"||l.type==="error"))return}if(n.signal?.aborted)return;if(++s>o)throw new Error("Lost this run's stream and could not get it back.");await os(1e3*s,n.signal)}}export{sl as ComputeStatus,zn as ConnectButton,hl as ConnectCompute,Gt as ConnectModal,El as ConnectNudge,To as ConnectPill,Gl as ModelPicker,Wl as ProviderMark,zl as RedeemCode,Jl as RunError,ql as RunLimit,hc as SobaBilling,gc as SobaCheckout,Yo as SobaCurrentPlan,wc as SobaGate,zt as SobaPlans,Ic as SobaProvider,Bl as collectText,Bo as connectSays,ha as gateMessage,Ht as injectStyles,ol as modelLogo,lt as parseEvent,Vo as readEvents,oa as runErrorMessage,Vn as sobaErrorCode,Oc as tierLabel,es as useCheckout,Tt as useCompute,ul as useConnectButton,zo as useConnectNudge,Ft as useCurrentPlan,ns as useFeature,Go as useMachineRuns,Fn as useModel,Dt as useOpenSobaConnect,jo as usePlans,Jo as useRedeemCode,Uo as useRunLimit,K as useSoba,Wc as watchRun};
4492
+ `)}),a=null,s=[];else if(l.startsWith("id:")){let d=Number(l.slice(3).trim());a=Number.isFinite(d)?d:null}else if(l.startsWith("data:")){let d=l.slice(5);s.push(d.startsWith(" ")?d.slice(1):d)}}}}finally{t.cancel().catch(()=>{})}}var is=(e,n)=>new Promise(t=>{let r=setTimeout(t,e);n?.addEventListener("abort",()=>{clearTimeout(r),t()})});async function*Zc(e,n={}){let t=n.fetchImpl??fetch.bind(globalThis),r=await jc(e,n,t)??{url:e.url,bearer:e.token,open:null},o=n.maxRetries??6,a=n.after??0,s=0;for(;;){if(n.signal?.aborted)return;let c;try{c=r.open??await t(r.url,{headers:{authorization:`Bearer ${r.bearer}`,accept:"text/event-stream",...a?{"last-event-id":String(a)}:{}},...n.signal?{signal:n.signal}:{}}),r.open=null}catch(i){if(n.signal?.aborted)return;if(++s>o)throw i;await is(1e3*s,n.signal);continue}if(c.status===503&&s<o){s++,await is(Number(c.headers.get("retry-after")??3)*1e3,n.signal);continue}if(!c.ok){let i=`Could not read this run (${c.status}).`;try{let l=await c.json();l.error?.message&&(i=l.error.message)}catch{}throw new Error(i)}for await(let i of qc(c)){i.id!==null&&(a=i.id),s=0;let l=at(i.data);if(l&&(yield l,l.type==="done"||l.type==="error"))return}if(n.signal?.aborted)return;if(++s>o)throw new Error("Lost this run's stream and could not get it back.");await is(1e3*s,n.signal)}}export{fl as ComputeStatus,zn as ConnectButton,Ml as ConnectCompute,Bt as ConnectModal,Hl as ConnectNudge,Go as ConnectPill,Jl as ModelPicker,Yl as ProviderMark,Kl as RedeemCode,ec as RunError,rc as RunLimit,Mc as SobaBilling,Nc as SobaCheckout,qo as SobaCurrentPlan,Pc as SobaGate,Ft as SobaPlans,Vc as SobaProvider,Ql as collectText,Wo as connectSays,ba as gateMessage,Dt as injectStyles,ml as modelLogo,at as parseEvent,Jo as readEvents,aa as runErrorMessage,Vn as sobaErrorCode,Jc as tierLabel,ts as useCheckout,Ot as useCompute,yl as useConnectButton,Qo as useConnectNudge,Ut as useCurrentPlan,rs as useFeature,Do as useMachineRuns,Fn as useModel,Wt as useOpenSobaConnect,Zo as usePlans,jo as useRedeemCode,zo as useRunLimit,_ as useSoba,Zc as watchRun};
@@ -0,0 +1,12 @@
1
+ import type { Machine, ModelOptionsWire } from "./types.js";
2
+ /** Null without someone to key on: one person's machines are not another's. */
3
+ export declare function lastSeenSlot(options: {
4
+ endpoint?: string | undefined;
5
+ user?: string | undefined;
6
+ cacheKey?: string | undefined;
7
+ }): string | null;
8
+ export declare function lastMachines(slot: string | null): Machine[] | null;
9
+ export declare function lastModels(slot: string | null): ModelOptionsWire | null;
10
+ /** Only answers that arrived: an empty list that did is nothing connected. */
11
+ export declare function rememberMachines(slot: string | null, machines: Machine[]): void;
12
+ export declare function rememberModels(slot: string | null, models: ModelOptionsWire): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soba-so/react",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "Connect the AI your users already pay for, from your own React app.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://soba.so/docs/components",