@av-pi-studio/web-client 0.0.103 → 0.0.105

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.
Files changed (22) hide show
  1. package/dist/web/assets/{BinaryFallbackViewer-DjnnumnZ.js → BinaryFallbackViewer-B7SkOgUu.js} +1 -1
  2. package/dist/web/assets/{ChatPanel-Dxzk61Ik.js → ChatPanel-CsE1BWwH.js} +1 -1
  3. package/dist/web/assets/{CodeView-BPVY3a-_.js → CodeView-CScb4RiO.js} +1 -1
  4. package/dist/web/assets/{FilePanel-DOuXV6Z-.js → FilePanel-B45F1i2T.js} +1 -1
  5. package/dist/web/assets/{HtmlViewer-DqYmpcSv.js → HtmlViewer-D7-OaZBt.js} +1 -1
  6. package/dist/web/assets/{ImageViewer-DOUaDfwq.js → ImageViewer-mzO6n1j0.js} +1 -1
  7. package/dist/web/assets/{MarkdownFileViewer-qaDHpmfA.js → MarkdownFileViewer-CgGHtlSE.js} +1 -1
  8. package/dist/web/assets/{ModelProvidersPanel-BjVXGAY-.js → ModelProvidersPanel-Dwkt1dOR.js} +1 -1
  9. package/dist/web/assets/{MoleculeViewerPanel-sMXZkwPN.js → MoleculeViewerPanel-Bh95oQnX.js} +1 -1
  10. package/dist/web/assets/{SettingsDialog-B86UWECm.js → SettingsDialog-B_flcAIp.js} +3 -3
  11. package/dist/web/assets/{TerminalPanel-CGF3ajAB.js → TerminalPanel-B4_lbqdl.js} +1 -1
  12. package/dist/web/assets/{TextViewer-kw9si8jK.js → TextViewer-DyTSluDv.js} +1 -1
  13. package/dist/web/assets/{VideoViewer-BAKn-wpc.js → VideoViewer-C2JOZjNR.js} +1 -1
  14. package/dist/web/assets/{href-resolution-BeHu1EJK.js → href-resolution-D4N6Dgc3.js} +1 -1
  15. package/dist/web/assets/index-C9bHyGYI.js +19 -0
  16. package/dist/web/assets/{markdown-chQlVqjI.js → markdown-DfwH9iNG.js} +1 -1
  17. package/dist/web/assets/{use-file-download-CtRGxKJM.js → use-file-download-C8bUEJxW.js} +1 -1
  18. package/dist/web/assets/{use-file-watch-BeWRBxwR.js → use-file-watch-Bhf3nvpb.js} +1 -1
  19. package/dist/web/assets/{use-provider-auth-list-CPSj5VE9.js → use-provider-auth-list-Bb6Y9Gn4.js} +1 -1
  20. package/dist/web/index.html +1 -1
  21. package/package.json +3 -3
  22. package/dist/web/assets/index-0YyDYmrX.js +0 -19
@@ -1 +1 @@
1
- import{r as l,j as e}from"./vendor-react-DQUAl2K8.js";import{S as d,B as a}from"./index-0YyDYmrX.js";import{u as m}from"./use-file-download-CtRGxKJM.js";import{F as c}from"./vendor-icons-BA_PiM8g.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";const p="_wrap_inn1j_1",j="_name_inn1j_12",n={wrap:p,name:j};function z({path:s,workspaceCwd:f}){const[i,t]=l.useState(!1),r=m(s,i),o=s.split("/").pop()||s;return e.jsxs("div",{className:n.wrap,children:[e.jsx(c,{size:32}),e.jsx("div",{className:n.name,children:o}),e.jsx("div",{children:"No preview available for this file type."}),r.isError&&e.jsxs("div",{children:["Error: ",r.error instanceof Error?r.error.message:"download failed"]}),i&&r.isLoading?e.jsx(d,{size:"sm"}):r.data?e.jsx("a",{href:r.data.objectUrl,download:r.data.fileName||o,children:e.jsx(a,{size:"sm",children:"Save file"})}):e.jsx(a,{size:"sm",onClick:()=>t(!0),children:"Download"})]})}export{z as BinaryFallbackViewer};
1
+ import{r as l,j as e}from"./vendor-react-DQUAl2K8.js";import{S as d,B as a}from"./index-C9bHyGYI.js";import{u as m}from"./use-file-download-C8bUEJxW.js";import{F as c}from"./vendor-icons-BA_PiM8g.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";const p="_wrap_inn1j_1",j="_name_inn1j_12",n={wrap:p,name:j};function z({path:s,workspaceCwd:f}){const[i,t]=l.useState(!1),r=m(s,i),o=s.split("/").pop()||s;return e.jsxs("div",{className:n.wrap,children:[e.jsx(c,{size:32}),e.jsx("div",{className:n.name,children:o}),e.jsx("div",{children:"No preview available for this file type."}),r.isError&&e.jsxs("div",{children:["Error: ",r.error instanceof Error?r.error.message:"download failed"]}),i&&r.isLoading?e.jsx(d,{size:"sm"}):r.data?e.jsx("a",{href:r.data.objectUrl,download:r.data.fileName||o,children:e.jsx(a,{size:"sm",children:"Save file"})}):e.jsx(a,{size:"sm",onClick:()=>t(!0),children:"Download"})]})}export{z as BinaryFallbackViewer};
@@ -1,4 +1,4 @@
1
- import{r as h,j as t}from"./vendor-react-DQUAl2K8.js";import{a as jt,b as bt,m as yt,u as ve}from"./vendor-query-i7fr__Xm.js";import{A as xe,D as L,u as W,F as Nt,I as q,G as St,H as Ct,B as E,J as wt,K as Ge,S as je,y as Dt,M as Bt,N as Tt,m as Et,n as At,O as Rt,Q as It,R as Lt,l as Ot,U as Pt,E as Mt,W as de,a as be,X as ye,Y as Ft,Z as ce,g as qt,_ as Kt,z as zt,P as Fe}from"./index-0YyDYmrX.js";import{L as Ht,G as $t,S as Wt,a as Ut,P as Gt,E as Vt,T as Ve,C as me,b as Ne,B as Yt,c as Ye,d as Jt,A as Qt,e as Xt,f as Zt,U as en,g as tn,h as nn,i as sn,j as on,k as rn,l as qe,m as an,N as cn,n as ln}from"./vendor-icons-BA_PiM8g.js";import{u as dn}from"./use-provider-auth-list-CPSj5VE9.js";import{M as C}from"./vendor-2vclEyEB.js";import{S as Je,M as Qe,r as un}from"./markdown-chQlVqjI.js";import{D as mn,p as fn}from"./DiffView-5YpzV9Ql.js";import{R as Se,T as Ce,I as Xe}from"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";import"./vendor-highlight-BXktnWW2.js";import"./vendor-markdown-BEocceDg.js";import"./href-resolution-BeHu1EJK.js";function Ze(e,s){if(s.trim()==="")return e;const n=s.toLowerCase();return e.filter(o=>o.label.toLowerCase().includes(n)||o.description!==void 0&&o.description.toLowerCase().includes(n))}const pn={shell:Ve,read:Vt,edit:Gt,write:Ut,search:Wt,fetch:$t,task:Ht};function hn(e){return pn[e.kind]??Ve}function et(e){switch(e.kind){case"read":case"write":case"edit":return e.path??null;default:return null}}function gn(e){return e.kind==="write"||e.kind==="edit"||e.kind==="shell"}function _n(e){const s=[];if(e.kind==="edit"&&e.diff)s.push({kind:"diff",patch:e.diff});else{const n=xe(e);n&&s.push({kind:"code",text:n})}return e.output&&s.push({kind:"code",text:e.output}),s}const Ke={shell:{label:"SHELL",token:"statusInfo"},read:{label:"READ",token:"statusInfo"},write:{label:"WRITE",token:"statusSuccess"},edit:{label:"EDIT",token:"statusWarning"},search:{label:"SEARCH",token:"statusInfo"},fetch:{label:"FETCH",token:"statusInfo"},task:{label:"TASK",token:"foregroundMuted"}};function xn(e){return Ke[e.kind]??Ke.task}function kn(e){if(!e)return{added:0,removed:0};let s=0,n=0;for(const o of e.split(`
1
+ import{r as h,j as t}from"./vendor-react-DQUAl2K8.js";import{a as jt,b as bt,m as yt,u as ve}from"./vendor-query-i7fr__Xm.js";import{A as xe,D as L,u as W,F as Nt,I as q,G as St,H as Ct,B as E,J as wt,K as Ge,S as je,y as Dt,M as Bt,N as Tt,m as Et,n as At,O as Rt,Q as It,R as Lt,l as Ot,U as Pt,E as Mt,W as de,a as be,X as ye,Y as Ft,Z as ce,g as qt,_ as Kt,z as zt,P as Fe}from"./index-C9bHyGYI.js";import{L as Ht,G as $t,S as Wt,a as Ut,P as Gt,E as Vt,T as Ve,C as me,b as Ne,B as Yt,c as Ye,d as Jt,A as Qt,e as Xt,f as Zt,U as en,g as tn,h as nn,i as sn,j as on,k as rn,l as qe,m as an,N as cn,n as ln}from"./vendor-icons-BA_PiM8g.js";import{u as dn}from"./use-provider-auth-list-Bb6Y9Gn4.js";import{M as C}from"./vendor-2vclEyEB.js";import{S as Je,M as Qe,r as un}from"./markdown-DfwH9iNG.js";import{D as mn,p as fn}from"./DiffView-5YpzV9Ql.js";import{R as Se,T as Ce,I as Xe}from"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";import"./vendor-highlight-BXktnWW2.js";import"./vendor-markdown-BEocceDg.js";import"./href-resolution-D4N6Dgc3.js";function Ze(e,s){if(s.trim()==="")return e;const n=s.toLowerCase();return e.filter(o=>o.label.toLowerCase().includes(n)||o.description!==void 0&&o.description.toLowerCase().includes(n))}const pn={shell:Ve,read:Vt,edit:Gt,write:Ut,search:Wt,fetch:$t,task:Ht};function hn(e){return pn[e.kind]??Ve}function et(e){switch(e.kind){case"read":case"write":case"edit":return e.path??null;default:return null}}function gn(e){return e.kind==="write"||e.kind==="edit"||e.kind==="shell"}function _n(e){const s=[];if(e.kind==="edit"&&e.diff)s.push({kind:"diff",patch:e.diff});else{const n=xe(e);n&&s.push({kind:"code",text:n})}return e.output&&s.push({kind:"code",text:e.output}),s}const Ke={shell:{label:"SHELL",token:"statusInfo"},read:{label:"READ",token:"statusInfo"},write:{label:"WRITE",token:"statusSuccess"},edit:{label:"EDIT",token:"statusWarning"},search:{label:"SEARCH",token:"statusInfo"},fetch:{label:"FETCH",token:"statusInfo"},task:{label:"TASK",token:"foregroundMuted"}};function xn(e){return Ke[e.kind]??Ke.task}function kn(e){if(!e)return{added:0,removed:0};let s=0,n=0;for(const o of e.split(`
2
2
  `))o.startsWith("+++")||o.startsWith("---")||(o.startsWith("+")?s++:o.startsWith("-")&&n++);return{added:s,removed:n}}function vn(e){return e?(e.endsWith(`
3
3
  `)?e.slice(0,-1):e).split(`
4
4
  `).length:0}const jn=500;let pe;function bn(e,s,n,o){clearTimeout(pe),pe=setTimeout(()=>{pe=void 0,e.invalidateQueries({queryKey:["file"]}),e.invalidateQueries({queryKey:["explorer"]}),s&&n&&s.connection.request("checkout_refresh_request",{cwd:n}).catch(()=>{})},jn)}function yn({sessionId:e,event:s,timestamp:n,client:o,queryClient:r}){const a=L.getState();switch(a.applyStreamEvent(e,s,n),s.kind){case"turn_started":a.setStatus(e,"running");break;case"turn_completed":a.setStatus(e,"idle");break;case"turn_failed":a.setStatus(e,"error");break;case"turn_canceled":a.setStatus(e,"idle");break;case"tool_call":{if(s.status==="completed"&&gn(s.tool)){const c=a.sessions[e],l=(c==null?void 0:c.cwd)||null;bn(r,o,l,et(s.tool))}break}}}function Nn(e){const s=W(r=>r.client),n=L(r=>{var a;return((a=r.sessions[e])==null?void 0:a.agentId)??null}),o=jt();h.useEffect(()=>!s||!n?void 0:s.agent(n).timeline.subscribe((a,c)=>{const l=typeof c.timestamp=="number"?new Date(c.timestamp).toISOString():c.timestamp;yn({sessionId:e,event:a,timestamp:l,client:s,queryClient:o})}),[s,n,e,o])}const tt=64;function he(e){return e.clientHeight>0}function Sn(e,s,n,o=tt){switch(s.kind){case"scroll":return he(n)?n.scrollHeight-n.scrollTop-n.clientHeight<=o?{pinned:!0,stick:!1}:{pinned:s.gesture?!1:e,stick:!1}:{pinned:e,stick:!1};case"tail":return{pinned:e,stick:e&&he(n)};case"shown":return{pinned:e,stick:e};case"pin":return{pinned:!0,stick:he(n)}}}function Cn(e){const s=e[e.length-1];return(s==null?void 0:s.kind)==="user"?s.id:null}const wn="_shellRow_1kabp_2",Dn="_rail_1kabp_10",Bn="_disc_1kabp_18",Tn="_connector_1kabp_28",En="_content_1kabp_2",An="_metaLine_1kabp_40",Rn="_metaTime_1kabp_52",In="_forkButton_1kabp_66",O={shellRow:wn,rail:Dn,disc:Bn,connector:Tn,content:En,metaLine:An,metaTime:Rn,forkButton:In};function K({disc:e,discClassName:s,connector:n,meta:o,metaTrailing:r,className:a,children:c}){return t.jsxs("div",{className:O.shellRow,children:[t.jsxs("div",{className:O.rail,children:[t.jsx("span",{className:C(O.disc,s),children:e}),n&&t.jsx("span",{className:O.connector})]}),t.jsxs("div",{className:C(O.content,a),children:[o&&t.jsxs("div",{className:O.metaLine,children:[o,r]}),c]})]})}function ze(e){return typeof e=="number"?e:Date.parse(e)}function Ln(e,s){const n=ze(e.entry.createdAt),o=ze(s.entry.createdAt);return n!==o?n-o:e.entry.requestId<s.entry.requestId?-1:e.entry.requestId>s.entry.requestId?1:0}function On(e,s){return[...e.map(o=>({kind:"pending",entry:o})),...s.map(o=>({kind:"resolved",entry:o}))].toSorted(Ln)}function Pn(e){return e.entry.requestId}function nt(e){return e.receivedAt===void 0}const Mn=4;function Fn(e,s){let n=0;const o=e.map(l=>l.kind!=="pending"?{item:l,collapsed:!1}:(n++,{item:l,collapsed:!s&&n>Mn})),r=o.filter(l=>l.collapsed).length,a=o.findIndex(l=>l.collapsed),c=[];return o.forEach((l,m)=>{m===a&&c.push({kind:"more",count:r}),c.push({kind:"card",item:l.item,collapsed:l.collapsed})}),c}function qn(e,s){if(e.timeoutMs===void 0)return{show:!1,fraction:0,approximate:!1};const n=Nt(e,s)??0;return{show:!0,fraction:Math.max(0,Math.min(1,n/e.timeoutMs)),approximate:e.receivedAt===void 0}}function st(e){return e==="editor"}const Kn="Esc again to dismiss — the extension gets an empty answer";function zn(e,s){return s?{kind:"warning",text:Kn}:{kind:"keys",segments:[{key:st(e)?"⇧↵":"↵",label:"submit"},{key:"Esc",label:"dismiss"}]}}function Hn(e){return e?{armed:!1,resolve:!0}:{armed:!0,resolve:!1}}const $n=5,Wn=40,Un=6;function Gn(e){return{mode:e.length>=$n||e.some(n=>n.length>Wn)?"stack":"row",scrolls:e.length>Un}}function ke(e){const s=e.split(`
@@ -1 +1 @@
1
- var j=Object.defineProperty;var q=(r,n,e)=>n in r?j(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var d=(r,n,e)=>q(r,typeof n!="symbol"?n+"":n,e);import{r as u,j as w}from"./vendor-react-DQUAl2K8.js";import{u as y}from"./vendor-query-i7fr__Xm.js";import{u as F,a as p}from"./index-0YyDYmrX.js";import{u as x}from"./use-file-download-CtRGxKJM.js";import{P as S,Q as _,S as b,T as B,U as z,V as U}from"./vendor-2vclEyEB.js";function D(r){const{maxDisplayBytes:n,inline:e,streamed:o,download:a}=r;if(e.isLoading)return{kind:"loading"};if(e.tooLarge){const{size:t}=e.tooLarge;return t>n?{kind:"too-large",size:t,maxDisplayBytes:n,downloading:a.requested&&a.isLoading,downloadUrl:a.objectUrl,downloadName:a.fileName}:o.isLoading?{kind:"streaming",size:t}:o.isError?{kind:"stream-error",size:t,message:o.errorMessage??"stream failed"}:o.content!==null?{kind:"streamed",size:t,content:o.content}:{kind:"loading"}}return e.isError?{kind:"error",message:e.errorMessage??"unknown error"}:e.content!==null?{kind:"inline",content:e.content}:{kind:"loading"}}class h extends Error{constructor(e,o){super("file_too_large");d(this,"size");d(this,"maxBytes");this.name="FileTooLargeError",this.size=e,this.maxBytes=o}}function R(r){if(!r.ok)throw r.error==="file_too_large"?new h(r.size??0,r.maxBytes):new Error(r.error??"file read failed");return{content:r.content??"",size:r.size??0}}function T(r,n=!0){const e=F(o=>o.client);return y({queryKey:p.fileRead(r),queryFn:async()=>{if(!e)throw new Error("not connected");const o=await e.connection.request("file_read_request",{path:r});return R(o)},enabled:!!e&&!!r&&n})}function M(r){const{enabled:n,download:e,decode:o}=r;return{isLoading:n&&(e.isLoading||e.hasObjectUrl&&o.isLoading),isError:e.isError||o.isError,error:e.isError?e.error:o.error,data:o.data}}function C(r,n=!0){var t;const e=x(r,n),o=(t=e.data)==null?void 0:t.objectUrl,a=y({queryKey:p.fileText(r,o??null),queryFn:async()=>({content:await(await fetch(o)).text()}),enabled:n&&!!o});return M({enabled:n,download:{isLoading:e.isLoading,isError:e.isError,error:e.error,hasObjectUrl:!!o},decode:{isLoading:a.isLoading,isError:a.isError,error:a.error,data:a.data}})}const E=30*1024*1024;function Y(r,n=!0){var c,f,g,m;const e=T(r,n),o=e.error instanceof h?e.error:null,a=o!==null&&o.size<=E,t=C(r,n&&a),[i,k]=u.useState(!1),s=x(r,n&&i),l=D({maxDisplayBytes:E,inline:{isLoading:e.isLoading,isError:e.isError,tooLarge:o?{size:o.size}:null,errorMessage:e.error instanceof Error?e.error.message:null,content:((c=e.data)==null?void 0:c.content)??null},streamed:{isLoading:t.isLoading,isError:t.isError,errorMessage:t.error instanceof Error?t.error.message:null,content:((f=t.data)==null?void 0:f.content)??null},download:{requested:i,isLoading:s.isLoading,objectUrl:((g=s.data)==null?void 0:g.objectUrl)??null,fileName:((m=s.data)==null?void 0:m.fileName)??null}});return l.kind==="too-large"?{...l,requestDownload:()=>k(!0)}:l}const N="_wrap_1feu3_1",v={wrap:N},L=new Map;function K(r){const[n,e]=u.useState(null);return u.useEffect(()=>{const o=z.matchFilename(U,r);if(!o){e(null);return}const a=L.get(o.name);if(a){e(a);return}let t=!1;return e(null),o.load().then(i=>{L.set(o.name,i),t||e(i)}),()=>{t=!0}},[r]),n?[n]:[]}function I({path:r,content:n}){const e=K(r),o=[S.lineWrapping,_(),...e];return w.jsx("div",{className:v.wrap,children:w.jsx(b,{value:n,theme:B,extensions:o,editable:!1,readOnly:!0,basicSetup:{highlightActiveLine:!1,foldGutter:!1,searchKeymap:!1},height:"100%"})})}export{I as C,Y as u};
1
+ var j=Object.defineProperty;var q=(r,n,e)=>n in r?j(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var d=(r,n,e)=>q(r,typeof n!="symbol"?n+"":n,e);import{r as u,j as w}from"./vendor-react-DQUAl2K8.js";import{u as y}from"./vendor-query-i7fr__Xm.js";import{u as F,a as p}from"./index-C9bHyGYI.js";import{u as x}from"./use-file-download-C8bUEJxW.js";import{P as S,Q as _,S as b,T as B,U as z,V as U}from"./vendor-2vclEyEB.js";function D(r){const{maxDisplayBytes:n,inline:e,streamed:o,download:a}=r;if(e.isLoading)return{kind:"loading"};if(e.tooLarge){const{size:t}=e.tooLarge;return t>n?{kind:"too-large",size:t,maxDisplayBytes:n,downloading:a.requested&&a.isLoading,downloadUrl:a.objectUrl,downloadName:a.fileName}:o.isLoading?{kind:"streaming",size:t}:o.isError?{kind:"stream-error",size:t,message:o.errorMessage??"stream failed"}:o.content!==null?{kind:"streamed",size:t,content:o.content}:{kind:"loading"}}return e.isError?{kind:"error",message:e.errorMessage??"unknown error"}:e.content!==null?{kind:"inline",content:e.content}:{kind:"loading"}}class h extends Error{constructor(e,o){super("file_too_large");d(this,"size");d(this,"maxBytes");this.name="FileTooLargeError",this.size=e,this.maxBytes=o}}function R(r){if(!r.ok)throw r.error==="file_too_large"?new h(r.size??0,r.maxBytes):new Error(r.error??"file read failed");return{content:r.content??"",size:r.size??0}}function T(r,n=!0){const e=F(o=>o.client);return y({queryKey:p.fileRead(r),queryFn:async()=>{if(!e)throw new Error("not connected");const o=await e.connection.request("file_read_request",{path:r});return R(o)},enabled:!!e&&!!r&&n})}function M(r){const{enabled:n,download:e,decode:o}=r;return{isLoading:n&&(e.isLoading||e.hasObjectUrl&&o.isLoading),isError:e.isError||o.isError,error:e.isError?e.error:o.error,data:o.data}}function C(r,n=!0){var t;const e=x(r,n),o=(t=e.data)==null?void 0:t.objectUrl,a=y({queryKey:p.fileText(r,o??null),queryFn:async()=>({content:await(await fetch(o)).text()}),enabled:n&&!!o});return M({enabled:n,download:{isLoading:e.isLoading,isError:e.isError,error:e.error,hasObjectUrl:!!o},decode:{isLoading:a.isLoading,isError:a.isError,error:a.error,data:a.data}})}const E=30*1024*1024;function Y(r,n=!0){var c,f,g,m;const e=T(r,n),o=e.error instanceof h?e.error:null,a=o!==null&&o.size<=E,t=C(r,n&&a),[i,k]=u.useState(!1),s=x(r,n&&i),l=D({maxDisplayBytes:E,inline:{isLoading:e.isLoading,isError:e.isError,tooLarge:o?{size:o.size}:null,errorMessage:e.error instanceof Error?e.error.message:null,content:((c=e.data)==null?void 0:c.content)??null},streamed:{isLoading:t.isLoading,isError:t.isError,errorMessage:t.error instanceof Error?t.error.message:null,content:((f=t.data)==null?void 0:f.content)??null},download:{requested:i,isLoading:s.isLoading,objectUrl:((g=s.data)==null?void 0:g.objectUrl)??null,fileName:((m=s.data)==null?void 0:m.fileName)??null}});return l.kind==="too-large"?{...l,requestDownload:()=>k(!0)}:l}const N="_wrap_1feu3_1",v={wrap:N},L=new Map;function K(r){const[n,e]=u.useState(null);return u.useEffect(()=>{const o=z.matchFilename(U,r);if(!o){e(null);return}const a=L.get(o.name);if(a){e(a);return}let t=!1;return e(null),o.load().then(i=>{L.set(o.name,i),t||e(i)}),()=>{t=!0}},[r]),n?[n]:[]}function I({path:r,content:n}){const e=K(r),o=[S.lineWrapping,_(),...e];return w.jsx("div",{className:v.wrap,children:w.jsx(b,{value:n,theme:B,extensions:o,editable:!1,readOnly:!0,basicSetup:{highlightActiveLine:!1,foldGutter:!1,searchKeymap:!1},height:"100%"})})}export{I as C,Y as u};
@@ -1 +1 @@
1
- import{r as u,j as s}from"./vendor-react-DQUAl2K8.js";import{M as v}from"./vendor-2vclEyEB.js";import{u as j,a as d,L as w,r as E,b as D,V as K,P as b,B as x,E as l,S as y}from"./index-0YyDYmrX.js";import{u as k,a as q}from"./vendor-query-i7fr__Xm.js";import{u as z}from"./use-file-watch-BeWRBxwR.js";import{D as N}from"./DiffView-5YpzV9Ql.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";function S(e,t,r,i=!0){const a=j(n=>n.client);return k({queryKey:d.fileDiff(e,t,r),queryFn:async()=>{if(!a)throw new Error("not connected");return{patch:(await a.connection.request("file_diff_request",{path:e,cwd:t,staged:r})).patch??""}},enabled:!!a&&!!e&&!!t&&i})}function B(e,t,r){const i=q(),a=w.has(r)?E(e,t):null,{changedAt:n}=z(a);u.useEffect(()=>{n!==null&&(i.invalidateQueries({queryKey:d.fileRead(e)}),i.invalidateQueries({queryKey:d.fileDownload(e)}),i.invalidateQueries({queryKey:d.fileDiffByPath(e)}))},[n,e,i])}const C="_header_10rse_1",F="_path_10rse_11",V="_size_10rse_18",L="_viewToggle_10rse_23",P="_body_10rse_28",c={header:C,path:F,size:V,viewToggle:L,body:P};function g(e){return"path"in e}function Q(e){return"staged"in e}function J({tab:e}){var m;const t=e.kind==="diff",r=e.data,i=g(r)?r.path:"",a=g(r)&&Q(r)?r.staged:!1,[n,h]=u.useState(t?"diff":"file"),f=e.workspaceCwd||"~",p=D(i);B(i,f,p);const o=S(i,f,a,n==="diff"),_=K[p];return s.jsxs(b,{children:[s.jsxs("div",{className:c.header,children:[s.jsx("span",{className:c.path,children:i}),s.jsx("span",{className:c.size,children:n==="diff"?a?"staged":"unstaged":null}),s.jsxs("div",{className:c.viewToggle,children:[s.jsx(x,{size:"xs",variant:n==="file"?"default":"ghost",onClick:()=>h("file"),children:"File"}),s.jsx(x,{size:"xs",variant:n==="diff"?"default":"ghost",onClick:()=>h("diff"),children:"Diff"})]})]}),s.jsx("div",{className:v(c.body,"file-body"),children:n==="file"?s.jsx(u.Suspense,{fallback:s.jsxs(l,{children:[s.jsx(y,{size:"sm"})," Loading..."]}),children:s.jsx(_,{path:i,workspaceCwd:f})}):o.isLoading?s.jsxs(l,{children:[s.jsx(y,{size:"sm"})," Loading diff..."]}):o.isError?s.jsxs(l,{children:["Error: ",o.error instanceof Error?o.error.message:"unknown error"]}):(m=o.data)!=null&&m.patch?s.jsx(N,{patch:o.data.patch}):s.jsx(l,{style:{padding:"var(--pi-spacing-30)"},children:"No changes (file matches HEAD)"})})]})}export{J as FilePanel};
1
+ import{r as u,j as s}from"./vendor-react-DQUAl2K8.js";import{M as v}from"./vendor-2vclEyEB.js";import{u as j,a as d,L as w,r as E,b as D,V as K,P as b,B as x,E as l,S as y}from"./index-C9bHyGYI.js";import{u as k,a as q}from"./vendor-query-i7fr__Xm.js";import{u as z}from"./use-file-watch-Bhf3nvpb.js";import{D as N}from"./DiffView-5YpzV9Ql.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";function S(e,t,r,i=!0){const a=j(n=>n.client);return k({queryKey:d.fileDiff(e,t,r),queryFn:async()=>{if(!a)throw new Error("not connected");return{patch:(await a.connection.request("file_diff_request",{path:e,cwd:t,staged:r})).patch??""}},enabled:!!a&&!!e&&!!t&&i})}function B(e,t,r){const i=q(),a=w.has(r)?E(e,t):null,{changedAt:n}=z(a);u.useEffect(()=>{n!==null&&(i.invalidateQueries({queryKey:d.fileRead(e)}),i.invalidateQueries({queryKey:d.fileDownload(e)}),i.invalidateQueries({queryKey:d.fileDiffByPath(e)}))},[n,e,i])}const C="_header_10rse_1",F="_path_10rse_11",V="_size_10rse_18",L="_viewToggle_10rse_23",P="_body_10rse_28",c={header:C,path:F,size:V,viewToggle:L,body:P};function g(e){return"path"in e}function Q(e){return"staged"in e}function J({tab:e}){var m;const t=e.kind==="diff",r=e.data,i=g(r)?r.path:"",a=g(r)&&Q(r)?r.staged:!1,[n,h]=u.useState(t?"diff":"file"),f=e.workspaceCwd||"~",p=D(i);B(i,f,p);const o=S(i,f,a,n==="diff"),_=K[p];return s.jsxs(b,{children:[s.jsxs("div",{className:c.header,children:[s.jsx("span",{className:c.path,children:i}),s.jsx("span",{className:c.size,children:n==="diff"?a?"staged":"unstaged":null}),s.jsxs("div",{className:c.viewToggle,children:[s.jsx(x,{size:"xs",variant:n==="file"?"default":"ghost",onClick:()=>h("file"),children:"File"}),s.jsx(x,{size:"xs",variant:n==="diff"?"default":"ghost",onClick:()=>h("diff"),children:"Diff"})]})]}),s.jsx("div",{className:v(c.body,"file-body"),children:n==="file"?s.jsx(u.Suspense,{fallback:s.jsxs(l,{children:[s.jsx(y,{size:"sm"})," Loading..."]}),children:s.jsx(_,{path:i,workspaceCwd:f})}):o.isLoading?s.jsxs(l,{children:[s.jsx(y,{size:"sm"})," Loading diff..."]}):o.isError?s.jsxs(l,{children:["Error: ",o.error instanceof Error?o.error.message:"unknown error"]}):(m=o.data)!=null&&m.patch?s.jsx(N,{patch:o.data.patch}):s.jsx(l,{style:{padding:"var(--pi-spacing-30)"},children:"No changes (file matches HEAD)"})})]})}export{J as FilePanel};
@@ -1 +1 @@
1
- import{j as r,r as v}from"./vendor-react-DQUAl2K8.js";import{a as ie,u as ce}from"./vendor-query-i7fr__Xm.js";import{n as le,r as X,c as ue,d as Y,u as K,m as de,E as N,S as R,B as A,a as M,t as fe}from"./index-0YyDYmrX.js";import{M as me}from"./vendor-2vclEyEB.js";import{u as pe,C as he}from"./CodeView-BPVY3a-_.js";import{p as ge,S as xe}from"./href-resolution-BeHu1EJK.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-CtRGxKJM.js";const we="_track_841zp_3",_e="_checked_841zp_23",ve="_disabled_841zp_27",ke="_thumb_841zp_32",z={track:we,checked:_e,disabled:ve,thumb:ke};function ye({checked:s,onCheckedChange:t,disabled:e=!1,id:n,"aria-label":a,className:o}){return r.jsx("button",{id:n,role:"switch","aria-checked":s,"aria-label":a,disabled:e,className:me(z.track,s&&z.checked,e&&z.disabled,o),onClick:()=>!e&&t(!s),type:"button",children:r.jsx("span",{className:z.thumb})})}const O={maxCount:64,maxBytesPerAsset:2*1024*1024,maxBytesTotal:16*1024*1024};function q(s,t,e){return!(s>=O.maxCount||e>O.maxBytesPerAsset||t+e>O.maxBytesTotal)}function J(s){return s===""||s.startsWith("#")?"unsupported":s.startsWith("//")||xe.test(s)?"external":null}function be(s,t,e){return e!==null&&t===e?s:t}function ee(s,t,e,n,a=null){const o=s.trim(),u=J(o);if(u)return{kind:"skip",raw:s,reason:u};const i=ge(o);let p;if(i.startsWith("/")?p=i:i==="~"||i.startsWith("~/")?p=a!==null?le(i,a):null:p=X(i,t),!p)return{kind:"skip",raw:s,reason:"unsupported"};const h=ue(p);return h!==e&&!h.startsWith(`${e}/`)?{kind:"skip",raw:s,reason:"outside-workspace"}:{kind:"local",raw:s,path:h,context:n}}const je={css:"text/css",js:"text/javascript",mjs:"text/javascript",html:"text/html",htm:"text/html",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",ico:"image/x-icon",bmp:"image/bmp",avif:"image/avif",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",m4v:"video/x-m4v",ogv:"video/ogg",mp3:"audio/mpeg",wav:"audio/wav",oga:"audio/ogg",ogg:"audio/ogg",m4a:"audio/mp4",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject"};function Ee(s){const t=s.lastIndexOf("/"),e=s.lastIndexOf(".");return e<=t?"application/octet-stream":je[s.slice(e+1).toLowerCase()]??"application/octet-stream"}function Se(s){let t="";for(let n=0;n<s.length;n+=32768)t+=String.fromCharCode(...s.subarray(n,n+32768));return btoa(t)}function U(s,t){return`data:${s};base64,${Se(t)}`}const P=/<([a-zA-Z][a-zA-Z0-9]*)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*)(\s*\/?>)/g,$=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/g;function te(s){const t=new Map;$.lastIndex=0;let e;for(;e=$.exec(s);){const n=e[1].toLowerCase();t.has(n)||t.set(n,e[2]??e[3]??e[4]??"")}return t}function se(s,t){switch(s){case"link":{const e=t.get("rel")??"";return/(^|\s)stylesheet(\s|$)/i.test(e)?t.has("href")?[{name:"href",context:"style",multi:!1}]:[]:[]}case"script":return t.has("src")?[{name:"src",context:"script",multi:!1}]:[];case"img":{const e=[];return t.has("src")&&e.push({name:"src",context:"image",multi:!1}),t.has("srcset")&&e.push({name:"srcset",context:"image",multi:!0}),e}case"source":{const e=[];return t.has("src")&&e.push({name:"src",context:"media",multi:!1}),t.has("srcset")&&e.push({name:"srcset",context:"media",multi:!0}),e}case"video":{const e=[];return t.has("src")&&e.push({name:"src",context:"media",multi:!1}),t.has("poster")&&e.push({name:"poster",context:"media",multi:!1}),e}case"audio":return t.has("src")?[{name:"src",context:"media",multi:!1}]:[];default:return[]}}function ne(s){return s.split(",").map(t=>t.trim()).filter(t=>t!=="").map(t=>{const e=t.search(/\s/);return e===-1?{url:t,descriptor:""}:{url:t.slice(0,e),descriptor:t.slice(e).trim()}})}function Le(s){return s.map(t=>t.descriptor?`${t.url} ${t.descriptor}`:t.url).join(", ")}function D(s,t,e){J(t.trim())||s.has(t)||s.set(t,{raw:t,context:e})}function Ne(s){const t=new Map;P.lastIndex=0;let e;for(;e=P.exec(s);){const n=e[1].toLowerCase(),a=te(e[2]??"");for(const o of se(n,a)){const u=a.get(o.name)??"";if(o.multi)for(const i of ne(u))D(t,i.url,o.context);else D(t,u,o.context)}}return[...t.values()]}function Ae(s,t){let e=!1;const n=ne(s).map(a=>{const o=t[a.url];return o===void 0?a:(e=!0,{url:o,descriptor:a.descriptor})});return e?Le(n):null}function Ce(s,t){return Object.keys(t).length===0?s:(P.lastIndex=0,s.replace(P,(e,n,a,o)=>{const u=te(a),i=se(n.toLowerCase(),u);if(i.length===0)return e;const p=new Map(i.map(d=>[d.name,d]));let h=!1;const S=a.replace($,(d,f,l,w,k)=>{const _=p.get(f.toLowerCase());if(!_)return d;const g=l??w??k??"",j=_.multi?Ae(g,t):t[g]??null;return j===null?d:(h=!0,`${f}="${j}"`)});return h?`<${n}${S}${o}`:e}))}const I=/url\(\s*(?:"([^"]*)"|'([^']*)'|([^'")\s]*))\s*\)/gi,V=/@font-face\s*\{[^}]*\}/gi;function oe(s,t,e){return s??t??e??""}function Te(s){const t=[];V.lastIndex=0;let e;for(;e=V.exec(s);)t.push([e.index,e.index+e[0].length]);return t}function Re(s){const t=Te(s),e=new Map;I.lastIndex=0;let n;for(;n=I.exec(s);){const a=oe(n[1],n[2],n[3]),o=t.some(([u,i])=>n.index>=u&&n.index<i)?"font":"image";D(e,a,o)}return[...e.values()]}function Me(s,t){return Object.keys(t).length===0?s:(I.lastIndex=0,s.replace(I,(e,n,a,o)=>{const u=t[oe(n,a,o)];return u===void 0?e:`url("${u}")`}))}const ze=Object.freeze(["allow-scripts"]),Be="https://pi-studio-preview.invalid/",Pe="default-src 'none'; img-src data:; style-src 'unsafe-inline' data:; script-src 'unsafe-inline' data:; font-src data:; media-src data:",Ie=`<script>(function(){document.addEventListener("click",function(e){var a=e.target&&e.target.closest&&e.target.closest('a[href^="#"]');if(!a)return;var frag=a.getAttribute("href").slice(1);e.preventDefault();if(!frag){window.scrollTo(0,0);return;}var el=document.getElementById(frag)||document.getElementsByName(frag)[0];if(el)el.scrollIntoView();},true);})();<\/script>`,Oe=/<head(\s[^>]*)?>/i,$e=/<html(\s[^>]*)?>/i,De=/<base[\s/>]/i;function He(s,t){const e=Ce(s,t.assets??{}),n=[];t.blockRemote&&n.push(`<meta http-equiv="Content-Security-Policy" content="${Pe}">`),De.test(e)||(n.push(`<base href="${Be}">`),n.push(Ie));const a=n.join("");if(a==="")return e;const o=Oe.exec(e);if(o){const i=o.index+o[0].length;return e.slice(0,i)+a+e.slice(i)}const u=$e.exec(e);if(u){const i=u.index+u[0].length;return e.slice(0,i)+`<head>${a}</head>`+e.slice(i)}return`<head>${a}</head>`+e}const W=6;async function Q(s,t,e){let n=0;async function a(){for(;n<s.length;){const o=s[n];n+=1,await e(o)}}await Promise.all(Array.from({length:Math.min(t,s.length)},a))}function Z(s){const t=new Map;for(const e of s){const n=t.get(e.path);n?n.push(e):t.set(e.path,[e])}return t}async function Fe(s,t){const e={},n=[];let a=0,o=0,u=!1;const i=[];for(const d of s)d.kind==="skip"?n.push({raw:d.raw,reason:d.reason}):i.push(d);function p(d,f){for(const l of d)n.push({raw:l.raw,reason:f})}async function h(d,f){if(u){p(f,"over-cap");return}let l;try{l=await t.fetchBytes(d)}catch{p(f,"fetch-failed");return}if(!q(a,o,l.byteLength)){u=!0,p(f,"over-cap");return}if(a+=1,o+=l.byteLength,f[0].context!=="style"){const m=U(Ee(d),l);for(const b of f)e[b.raw]=m;return}const w=new TextDecoder().decode(l),k=Y(d),_=Re(w).map(m=>ee(m.raw,k,t.root,m.context,t.homeDir)),g=[];for(const m of _)m.kind==="skip"?n.push({raw:m.raw,reason:m.reason}):g.push(m);const j=Z(g);await Q([...j.entries()],W,([m,b])=>h(m,b));const C={};for(const m of g){const b=e[m.raw];b!==void 0&&(C[m.raw]=b)}const L=Me(w,C),E=new TextEncoder().encode(L),y=E.byteLength-l.byteLength;if(y>0&&!q(a-1,o-l.byteLength,E.byteLength)){u=!0,p(f,"over-cap");return}o+=y;const T=U("text/css",E);for(const m of f)e[m.raw]=T}const S=Z(i);return await Q([...S.entries()],W,([d,f])=>h(d,f)),{assets:e,skipped:n}}const Ke="_wrap_1et27_1",qe="_toolbar_1et27_7",Ue="_modeToggle_1et27_20",Ve="_controls_1et27_24",We="_switchLabel_1et27_29",Qe="_streamedNote_1et27_37",Ze="_skippedNote_1et27_45",Ge="_skippedToggle_1et27_52",Xe="_skippedList_1et27_64",Ye="_body_1et27_69",Je="_frame_1et27_73",et="_tooLarge_1et27_79",x={wrap:Ke,toolbar:qe,modeToggle:Ue,controls:Ve,switchLabel:We,streamedNote:Qe,skippedNote:Ze,skippedToggle:Ge,skippedList:Xe,body:Ye,frame:Je,tooLarge:et},tt=ze.join(" "),G=Object.freeze({}),st=Object.freeze([]),re={external:"external","outside-workspace":"outside workspace",unsupported:"unsupported","over-cap":"over cap","fetch-failed":"not found"};function nt(s){const t=new Map;for(const e of s){const n=re[e.reason];t.set(n,(t.get(n)??0)+1)}return[...t.entries()].map(([e,n])=>`${n} ${e}`).join(", ")}function ot(s){let t=2166136261;for(let e=0;e<s.length;e++)t^=s.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(16)}function B(s){return`${(s/(1024*1024)).toFixed(1)} MB`}function gt({path:s,workspaceCwd:t}){var H,F;const e=pe(s),[n,a]=v.useState("preview"),[o,u]=v.useState(!1),[i,p]=v.useState(!1),h=ie(),S=K(c=>c.client),d=K(c=>c.daemon),f=de(),l=e.kind==="inline"||e.kind==="streamed"?e.content:null,w=v.useMemo(()=>{const c=X(s,t);return c?Y(c):null},[s,t]),k=v.useMemo(()=>w!==null?be(w,t,f):null,[w,t,f]),_=v.useMemo(()=>l===null||w===null||k===null?[]:Ne(l).map(c=>ee(c.raw,w,k,c.context,f)),[l,w,k,f]),g=v.useMemo(()=>_.some(c=>c.kind==="local"),[_]),j=v.useMemo(()=>_.flatMap(c=>c.kind==="skip"?[{raw:c.raw,reason:c.reason}]:[]),[_]),C=v.useMemo(()=>g&&l!==null?ot(l):"",[l,g]),L=ce({queryKey:M.htmlAssetBundle(s,C),queryFn:()=>k===null?Promise.resolve({assets:{},skipped:[]}):Fe(_,{root:k,homeDir:f,fetchBytes:async ae=>{if(!S||!d)throw new Error("not connected");return(await fe(d).download(ae)).bytes}}),enabled:g,staleTime:1/0}),E=g?((H=L.data)==null?void 0:H.assets)??G:G,y=g?((F=L.data)==null?void 0:F.skipped)??st:j,T=v.useMemo(()=>l===null?null:He(l,{assets:E,blockRemote:o}),[l,E,o]);function m(){h.invalidateQueries({queryKey:M.fileRead(s)}),h.invalidateQueries({queryKey:M.fileDownload(s)}),h.invalidateQueries({queryKey:M.htmlAssetBundleByPath(s)})}switch(e.kind){case"loading":return r.jsxs(N,{children:[r.jsx(R,{size:"sm"})," Loading..."]});case"streaming":return r.jsxs(N,{children:[r.jsx(R,{size:"sm"})," Streaming ",B(e.size)," file..."]});case"stream-error":case"error":return r.jsxs(N,{children:["Error: ",e.message]});case"too-large":{const c=s.split("/").pop()||s;return r.jsx(N,{children:r.jsxs("div",{className:x.tooLarge,children:[r.jsxs("div",{children:[B(e.size)," — too large to display (display ceiling is"," ",B(e.maxDisplayBytes),")."]}),e.downloading?r.jsx(R,{size:"sm"}):e.downloadUrl?r.jsx("a",{href:e.downloadUrl,download:e.downloadName||c,children:r.jsx(A,{size:"sm",children:"Save file"})}):r.jsx(A,{size:"sm",onClick:()=>e.requestDownload(),children:"Download"})]})})}}if(l===null||T===null)return null;if(g&&L.data===void 0)return r.jsxs(N,{children:[r.jsx(R,{size:"sm"})," Loading assets..."]});const b=s.split("/").pop()||s;return r.jsxs("div",{className:x.wrap,children:[r.jsxs("div",{className:x.toolbar,children:[r.jsxs("div",{className:x.modeToggle,children:[r.jsx(A,{size:"xs",variant:n==="preview"?"default":"ghost",onClick:()=>a("preview"),children:"Preview"}),r.jsx(A,{size:"xs",variant:n==="source"?"default":"ghost",onClick:()=>a("source"),children:"Source"})]}),r.jsxs("div",{className:x.controls,children:[r.jsxs("label",{className:x.switchLabel,children:[r.jsx(ye,{checked:o,onCheckedChange:u,"aria-label":"Block remote resources"}),"Block remote resources"]}),r.jsx(A,{size:"xs",variant:"ghost",onClick:m,children:"Reload"})]})]}),e.kind==="streamed"?r.jsxs("div",{className:x.streamedNote,children:[B(e.size)," file streamed"]}):null,y.length>0?r.jsxs("div",{className:x.skippedNote,children:[r.jsxs("button",{type:"button",className:x.skippedToggle,onClick:()=>p(c=>!c),children:[y.length," reference",y.length===1?"":"s"," not inlined (",nt(y),")"]}),i?r.jsx("ul",{className:x.skippedList,children:y.map(c=>r.jsxs("li",{children:[c.raw," — ",re[c.reason]]},c.raw))}):null]}):null,r.jsxs("div",{className:x.body,children:[r.jsx("iframe",{sandbox:tt,srcDoc:T,referrerPolicy:"no-referrer",allow:"",className:x.frame,style:n==="preview"?void 0:{display:"none"},title:b}),n==="source"?r.jsx(he,{path:s,content:l}):null]})]})}export{gt as HtmlViewer};
1
+ import{j as r,r as v}from"./vendor-react-DQUAl2K8.js";import{a as ie,u as ce}from"./vendor-query-i7fr__Xm.js";import{n as le,r as X,c as ue,d as Y,u as K,m as de,E as N,S as R,B as A,a as M,t as fe}from"./index-C9bHyGYI.js";import{M as me}from"./vendor-2vclEyEB.js";import{u as pe,C as he}from"./CodeView-CScb4RiO.js";import{p as ge,S as xe}from"./href-resolution-D4N6Dgc3.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-C8bUEJxW.js";const we="_track_841zp_3",_e="_checked_841zp_23",ve="_disabled_841zp_27",ke="_thumb_841zp_32",z={track:we,checked:_e,disabled:ve,thumb:ke};function ye({checked:s,onCheckedChange:t,disabled:e=!1,id:n,"aria-label":a,className:o}){return r.jsx("button",{id:n,role:"switch","aria-checked":s,"aria-label":a,disabled:e,className:me(z.track,s&&z.checked,e&&z.disabled,o),onClick:()=>!e&&t(!s),type:"button",children:r.jsx("span",{className:z.thumb})})}const O={maxCount:64,maxBytesPerAsset:2*1024*1024,maxBytesTotal:16*1024*1024};function q(s,t,e){return!(s>=O.maxCount||e>O.maxBytesPerAsset||t+e>O.maxBytesTotal)}function J(s){return s===""||s.startsWith("#")?"unsupported":s.startsWith("//")||xe.test(s)?"external":null}function be(s,t,e){return e!==null&&t===e?s:t}function ee(s,t,e,n,a=null){const o=s.trim(),u=J(o);if(u)return{kind:"skip",raw:s,reason:u};const i=ge(o);let p;if(i.startsWith("/")?p=i:i==="~"||i.startsWith("~/")?p=a!==null?le(i,a):null:p=X(i,t),!p)return{kind:"skip",raw:s,reason:"unsupported"};const h=ue(p);return h!==e&&!h.startsWith(`${e}/`)?{kind:"skip",raw:s,reason:"outside-workspace"}:{kind:"local",raw:s,path:h,context:n}}const je={css:"text/css",js:"text/javascript",mjs:"text/javascript",html:"text/html",htm:"text/html",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",ico:"image/x-icon",bmp:"image/bmp",avif:"image/avif",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",m4v:"video/x-m4v",ogv:"video/ogg",mp3:"audio/mpeg",wav:"audio/wav",oga:"audio/ogg",ogg:"audio/ogg",m4a:"audio/mp4",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf",eot:"application/vnd.ms-fontobject"};function Ee(s){const t=s.lastIndexOf("/"),e=s.lastIndexOf(".");return e<=t?"application/octet-stream":je[s.slice(e+1).toLowerCase()]??"application/octet-stream"}function Se(s){let t="";for(let n=0;n<s.length;n+=32768)t+=String.fromCharCode(...s.subarray(n,n+32768));return btoa(t)}function U(s,t){return`data:${s};base64,${Se(t)}`}const P=/<([a-zA-Z][a-zA-Z0-9]*)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*)(\s*\/?>)/g,$=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/g;function te(s){const t=new Map;$.lastIndex=0;let e;for(;e=$.exec(s);){const n=e[1].toLowerCase();t.has(n)||t.set(n,e[2]??e[3]??e[4]??"")}return t}function se(s,t){switch(s){case"link":{const e=t.get("rel")??"";return/(^|\s)stylesheet(\s|$)/i.test(e)?t.has("href")?[{name:"href",context:"style",multi:!1}]:[]:[]}case"script":return t.has("src")?[{name:"src",context:"script",multi:!1}]:[];case"img":{const e=[];return t.has("src")&&e.push({name:"src",context:"image",multi:!1}),t.has("srcset")&&e.push({name:"srcset",context:"image",multi:!0}),e}case"source":{const e=[];return t.has("src")&&e.push({name:"src",context:"media",multi:!1}),t.has("srcset")&&e.push({name:"srcset",context:"media",multi:!0}),e}case"video":{const e=[];return t.has("src")&&e.push({name:"src",context:"media",multi:!1}),t.has("poster")&&e.push({name:"poster",context:"media",multi:!1}),e}case"audio":return t.has("src")?[{name:"src",context:"media",multi:!1}]:[];default:return[]}}function ne(s){return s.split(",").map(t=>t.trim()).filter(t=>t!=="").map(t=>{const e=t.search(/\s/);return e===-1?{url:t,descriptor:""}:{url:t.slice(0,e),descriptor:t.slice(e).trim()}})}function Le(s){return s.map(t=>t.descriptor?`${t.url} ${t.descriptor}`:t.url).join(", ")}function D(s,t,e){J(t.trim())||s.has(t)||s.set(t,{raw:t,context:e})}function Ne(s){const t=new Map;P.lastIndex=0;let e;for(;e=P.exec(s);){const n=e[1].toLowerCase(),a=te(e[2]??"");for(const o of se(n,a)){const u=a.get(o.name)??"";if(o.multi)for(const i of ne(u))D(t,i.url,o.context);else D(t,u,o.context)}}return[...t.values()]}function Ae(s,t){let e=!1;const n=ne(s).map(a=>{const o=t[a.url];return o===void 0?a:(e=!0,{url:o,descriptor:a.descriptor})});return e?Le(n):null}function Ce(s,t){return Object.keys(t).length===0?s:(P.lastIndex=0,s.replace(P,(e,n,a,o)=>{const u=te(a),i=se(n.toLowerCase(),u);if(i.length===0)return e;const p=new Map(i.map(d=>[d.name,d]));let h=!1;const S=a.replace($,(d,f,l,w,k)=>{const _=p.get(f.toLowerCase());if(!_)return d;const g=l??w??k??"",j=_.multi?Ae(g,t):t[g]??null;return j===null?d:(h=!0,`${f}="${j}"`)});return h?`<${n}${S}${o}`:e}))}const I=/url\(\s*(?:"([^"]*)"|'([^']*)'|([^'")\s]*))\s*\)/gi,V=/@font-face\s*\{[^}]*\}/gi;function oe(s,t,e){return s??t??e??""}function Te(s){const t=[];V.lastIndex=0;let e;for(;e=V.exec(s);)t.push([e.index,e.index+e[0].length]);return t}function Re(s){const t=Te(s),e=new Map;I.lastIndex=0;let n;for(;n=I.exec(s);){const a=oe(n[1],n[2],n[3]),o=t.some(([u,i])=>n.index>=u&&n.index<i)?"font":"image";D(e,a,o)}return[...e.values()]}function Me(s,t){return Object.keys(t).length===0?s:(I.lastIndex=0,s.replace(I,(e,n,a,o)=>{const u=t[oe(n,a,o)];return u===void 0?e:`url("${u}")`}))}const ze=Object.freeze(["allow-scripts"]),Be="https://pi-studio-preview.invalid/",Pe="default-src 'none'; img-src data:; style-src 'unsafe-inline' data:; script-src 'unsafe-inline' data:; font-src data:; media-src data:",Ie=`<script>(function(){document.addEventListener("click",function(e){var a=e.target&&e.target.closest&&e.target.closest('a[href^="#"]');if(!a)return;var frag=a.getAttribute("href").slice(1);e.preventDefault();if(!frag){window.scrollTo(0,0);return;}var el=document.getElementById(frag)||document.getElementsByName(frag)[0];if(el)el.scrollIntoView();},true);})();<\/script>`,Oe=/<head(\s[^>]*)?>/i,$e=/<html(\s[^>]*)?>/i,De=/<base[\s/>]/i;function He(s,t){const e=Ce(s,t.assets??{}),n=[];t.blockRemote&&n.push(`<meta http-equiv="Content-Security-Policy" content="${Pe}">`),De.test(e)||(n.push(`<base href="${Be}">`),n.push(Ie));const a=n.join("");if(a==="")return e;const o=Oe.exec(e);if(o){const i=o.index+o[0].length;return e.slice(0,i)+a+e.slice(i)}const u=$e.exec(e);if(u){const i=u.index+u[0].length;return e.slice(0,i)+`<head>${a}</head>`+e.slice(i)}return`<head>${a}</head>`+e}const W=6;async function Q(s,t,e){let n=0;async function a(){for(;n<s.length;){const o=s[n];n+=1,await e(o)}}await Promise.all(Array.from({length:Math.min(t,s.length)},a))}function Z(s){const t=new Map;for(const e of s){const n=t.get(e.path);n?n.push(e):t.set(e.path,[e])}return t}async function Fe(s,t){const e={},n=[];let a=0,o=0,u=!1;const i=[];for(const d of s)d.kind==="skip"?n.push({raw:d.raw,reason:d.reason}):i.push(d);function p(d,f){for(const l of d)n.push({raw:l.raw,reason:f})}async function h(d,f){if(u){p(f,"over-cap");return}let l;try{l=await t.fetchBytes(d)}catch{p(f,"fetch-failed");return}if(!q(a,o,l.byteLength)){u=!0,p(f,"over-cap");return}if(a+=1,o+=l.byteLength,f[0].context!=="style"){const m=U(Ee(d),l);for(const b of f)e[b.raw]=m;return}const w=new TextDecoder().decode(l),k=Y(d),_=Re(w).map(m=>ee(m.raw,k,t.root,m.context,t.homeDir)),g=[];for(const m of _)m.kind==="skip"?n.push({raw:m.raw,reason:m.reason}):g.push(m);const j=Z(g);await Q([...j.entries()],W,([m,b])=>h(m,b));const C={};for(const m of g){const b=e[m.raw];b!==void 0&&(C[m.raw]=b)}const L=Me(w,C),E=new TextEncoder().encode(L),y=E.byteLength-l.byteLength;if(y>0&&!q(a-1,o-l.byteLength,E.byteLength)){u=!0,p(f,"over-cap");return}o+=y;const T=U("text/css",E);for(const m of f)e[m.raw]=T}const S=Z(i);return await Q([...S.entries()],W,([d,f])=>h(d,f)),{assets:e,skipped:n}}const Ke="_wrap_1et27_1",qe="_toolbar_1et27_7",Ue="_modeToggle_1et27_20",Ve="_controls_1et27_24",We="_switchLabel_1et27_29",Qe="_streamedNote_1et27_37",Ze="_skippedNote_1et27_45",Ge="_skippedToggle_1et27_52",Xe="_skippedList_1et27_64",Ye="_body_1et27_69",Je="_frame_1et27_73",et="_tooLarge_1et27_79",x={wrap:Ke,toolbar:qe,modeToggle:Ue,controls:Ve,switchLabel:We,streamedNote:Qe,skippedNote:Ze,skippedToggle:Ge,skippedList:Xe,body:Ye,frame:Je,tooLarge:et},tt=ze.join(" "),G=Object.freeze({}),st=Object.freeze([]),re={external:"external","outside-workspace":"outside workspace",unsupported:"unsupported","over-cap":"over cap","fetch-failed":"not found"};function nt(s){const t=new Map;for(const e of s){const n=re[e.reason];t.set(n,(t.get(n)??0)+1)}return[...t.entries()].map(([e,n])=>`${n} ${e}`).join(", ")}function ot(s){let t=2166136261;for(let e=0;e<s.length;e++)t^=s.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(16)}function B(s){return`${(s/(1024*1024)).toFixed(1)} MB`}function gt({path:s,workspaceCwd:t}){var H,F;const e=pe(s),[n,a]=v.useState("preview"),[o,u]=v.useState(!1),[i,p]=v.useState(!1),h=ie(),S=K(c=>c.client),d=K(c=>c.daemon),f=de(),l=e.kind==="inline"||e.kind==="streamed"?e.content:null,w=v.useMemo(()=>{const c=X(s,t);return c?Y(c):null},[s,t]),k=v.useMemo(()=>w!==null?be(w,t,f):null,[w,t,f]),_=v.useMemo(()=>l===null||w===null||k===null?[]:Ne(l).map(c=>ee(c.raw,w,k,c.context,f)),[l,w,k,f]),g=v.useMemo(()=>_.some(c=>c.kind==="local"),[_]),j=v.useMemo(()=>_.flatMap(c=>c.kind==="skip"?[{raw:c.raw,reason:c.reason}]:[]),[_]),C=v.useMemo(()=>g&&l!==null?ot(l):"",[l,g]),L=ce({queryKey:M.htmlAssetBundle(s,C),queryFn:()=>k===null?Promise.resolve({assets:{},skipped:[]}):Fe(_,{root:k,homeDir:f,fetchBytes:async ae=>{if(!S||!d)throw new Error("not connected");return(await fe(d).download(ae)).bytes}}),enabled:g,staleTime:1/0}),E=g?((H=L.data)==null?void 0:H.assets)??G:G,y=g?((F=L.data)==null?void 0:F.skipped)??st:j,T=v.useMemo(()=>l===null?null:He(l,{assets:E,blockRemote:o}),[l,E,o]);function m(){h.invalidateQueries({queryKey:M.fileRead(s)}),h.invalidateQueries({queryKey:M.fileDownload(s)}),h.invalidateQueries({queryKey:M.htmlAssetBundleByPath(s)})}switch(e.kind){case"loading":return r.jsxs(N,{children:[r.jsx(R,{size:"sm"})," Loading..."]});case"streaming":return r.jsxs(N,{children:[r.jsx(R,{size:"sm"})," Streaming ",B(e.size)," file..."]});case"stream-error":case"error":return r.jsxs(N,{children:["Error: ",e.message]});case"too-large":{const c=s.split("/").pop()||s;return r.jsx(N,{children:r.jsxs("div",{className:x.tooLarge,children:[r.jsxs("div",{children:[B(e.size)," — too large to display (display ceiling is"," ",B(e.maxDisplayBytes),")."]}),e.downloading?r.jsx(R,{size:"sm"}):e.downloadUrl?r.jsx("a",{href:e.downloadUrl,download:e.downloadName||c,children:r.jsx(A,{size:"sm",children:"Save file"})}):r.jsx(A,{size:"sm",onClick:()=>e.requestDownload(),children:"Download"})]})})}}if(l===null||T===null)return null;if(g&&L.data===void 0)return r.jsxs(N,{children:[r.jsx(R,{size:"sm"})," Loading assets..."]});const b=s.split("/").pop()||s;return r.jsxs("div",{className:x.wrap,children:[r.jsxs("div",{className:x.toolbar,children:[r.jsxs("div",{className:x.modeToggle,children:[r.jsx(A,{size:"xs",variant:n==="preview"?"default":"ghost",onClick:()=>a("preview"),children:"Preview"}),r.jsx(A,{size:"xs",variant:n==="source"?"default":"ghost",onClick:()=>a("source"),children:"Source"})]}),r.jsxs("div",{className:x.controls,children:[r.jsxs("label",{className:x.switchLabel,children:[r.jsx(ye,{checked:o,onCheckedChange:u,"aria-label":"Block remote resources"}),"Block remote resources"]}),r.jsx(A,{size:"xs",variant:"ghost",onClick:m,children:"Reload"})]})]}),e.kind==="streamed"?r.jsxs("div",{className:x.streamedNote,children:[B(e.size)," file streamed"]}):null,y.length>0?r.jsxs("div",{className:x.skippedNote,children:[r.jsxs("button",{type:"button",className:x.skippedToggle,onClick:()=>p(c=>!c),children:[y.length," reference",y.length===1?"":"s"," not inlined (",nt(y),")"]}),i?r.jsx("ul",{className:x.skippedList,children:y.map(c=>r.jsxs("li",{children:[c.raw," — ",re[c.reason]]},c.raw))}):null]}):null,r.jsxs("div",{className:x.body,children:[r.jsx("iframe",{sandbox:tt,srcDoc:T,referrerPolicy:"no-referrer",allow:"",className:x.frame,style:n==="preview"?void 0:{display:"none"},title:b}),n==="source"?r.jsx(he,{path:s,content:l}):null]})]})}export{gt as HtmlViewer};
@@ -1 +1 @@
1
- import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as s,S as a}from"./index-0YyDYmrX.js";import{u as t}from"./use-file-download-CtRGxKJM.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";const n="_wrap_1vzo5_1",m="_image_1vzo5_15",i={wrap:n,image:m};function x({path:e,workspaceCwd:p}){const r=t(e);return r.isLoading?o.jsxs(s,{children:[o.jsx(a,{size:"sm"})," Loading image..."]}):r.isError?o.jsxs(s,{children:["Error: ",r.error instanceof Error?r.error.message:"unknown error"]}):r.data?o.jsx("div",{className:i.wrap,children:o.jsx("img",{className:i.image,src:r.data.objectUrl,alt:e.split("/").pop()||e})}):null}export{x as ImageViewer};
1
+ import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as s,S as a}from"./index-C9bHyGYI.js";import{u as t}from"./use-file-download-C8bUEJxW.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";const n="_wrap_1vzo5_1",m="_image_1vzo5_15",i={wrap:n,image:m};function x({path:e,workspaceCwd:p}){const r=t(e);return r.isLoading?o.jsxs(s,{children:[o.jsx(a,{size:"sm"})," Loading image..."]}):r.isError?o.jsxs(s,{children:["Error: ",r.error instanceof Error?r.error.message:"unknown error"]}):r.data?o.jsx("div",{className:i.wrap,children:o.jsx("img",{className:i.image,src:r.data.objectUrl,alt:e.split("/").pop()||e})}):null}export{x as ImageViewer};
@@ -1 +1 @@
1
- import{r as x,j as e}from"./vendor-react-DQUAl2K8.js";import{r as j,d as g,B as i,E as a,S as c}from"./index-0YyDYmrX.js";import{u as w,C as h}from"./CodeView-BPVY3a-_.js";import{M as v}from"./markdown-chQlVqjI.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-CtRGxKJM.js";import"./vendor-highlight-BXktnWW2.js";import"./vendor-markdown-BEocceDg.js";import"./href-resolution-BeHu1EJK.js";const _="_wrap_g5iym_1",f="_toolbar_g5iym_6",y="_rendered_g5iym_17",z="_streamedNote_g5iym_21",N="_tooLarge_g5iym_29",t={wrap:_,toolbar:f,rendered:y,streamedNote:z,tooLarge:N};function n(r){return`${(r/(1024*1024)).toFixed(1)} MB`}function q({path:r,workspaceCwd:d}){const s=w(r),[l,m]=x.useState("preview"),p=x.useMemo(()=>{const o=j(r,d);return o?g(o):null},[r,d]);switch(s.kind){case"loading":return e.jsxs(a,{children:[e.jsx(c,{size:"sm"})," Loading..."]});case"streaming":return e.jsxs(a,{children:[e.jsx(c,{size:"sm"})," Streaming ",n(s.size)," file..."]});case"stream-error":case"error":return e.jsxs(a,{children:["Error: ",s.message]});case"too-large":{const o=r.split("/").pop()||r;return e.jsx(a,{children:e.jsxs("div",{className:t.tooLarge,children:[e.jsxs("div",{children:[n(s.size)," — too large to display (display ceiling is"," ",n(s.maxDisplayBytes),")."]}),s.downloading?e.jsx(c,{size:"sm"}):s.downloadUrl?e.jsx("a",{href:s.downloadUrl,download:s.downloadName||o,children:e.jsx(i,{size:"sm",children:"Save file"})}):e.jsx(i,{size:"sm",onClick:()=>s.requestDownload(),children:"Download"})]})})}case"inline":case"streamed":{const o=s.content,u=s.kind==="streamed";return e.jsxs("div",{className:t.wrap,children:[e.jsxs("div",{className:t.toolbar,children:[e.jsx(i,{size:"xs",variant:l==="preview"?"default":"ghost",onClick:()=>m("preview"),children:"Preview"}),e.jsx(i,{size:"xs",variant:l==="source"?"default":"ghost",onClick:()=>m("source"),children:"Source"})]}),u?e.jsxs("div",{className:t.streamedNote,children:[n(s.size)," file streamed"]}):null,l==="preview"?e.jsx("div",{className:t.rendered,children:e.jsx(v,{text:o,assetBase:p,workspaceCwd:d})}):e.jsx(h,{path:r,content:o})]})}}}export{q as MarkdownFileViewer};
1
+ import{r as x,j as e}from"./vendor-react-DQUAl2K8.js";import{r as j,d as g,B as i,E as a,S as c}from"./index-C9bHyGYI.js";import{u as w,C as h}from"./CodeView-CScb4RiO.js";import{M as v}from"./markdown-DfwH9iNG.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-C8bUEJxW.js";import"./vendor-highlight-BXktnWW2.js";import"./vendor-markdown-BEocceDg.js";import"./href-resolution-D4N6Dgc3.js";const _="_wrap_g5iym_1",f="_toolbar_g5iym_6",y="_rendered_g5iym_17",z="_streamedNote_g5iym_21",N="_tooLarge_g5iym_29",t={wrap:_,toolbar:f,rendered:y,streamedNote:z,tooLarge:N};function n(r){return`${(r/(1024*1024)).toFixed(1)} MB`}function q({path:r,workspaceCwd:d}){const s=w(r),[l,m]=x.useState("preview"),p=x.useMemo(()=>{const o=j(r,d);return o?g(o):null},[r,d]);switch(s.kind){case"loading":return e.jsxs(a,{children:[e.jsx(c,{size:"sm"})," Loading..."]});case"streaming":return e.jsxs(a,{children:[e.jsx(c,{size:"sm"})," Streaming ",n(s.size)," file..."]});case"stream-error":case"error":return e.jsxs(a,{children:["Error: ",s.message]});case"too-large":{const o=r.split("/").pop()||r;return e.jsx(a,{children:e.jsxs("div",{className:t.tooLarge,children:[e.jsxs("div",{children:[n(s.size)," — too large to display (display ceiling is"," ",n(s.maxDisplayBytes),")."]}),s.downloading?e.jsx(c,{size:"sm"}):s.downloadUrl?e.jsx("a",{href:s.downloadUrl,download:s.downloadName||o,children:e.jsx(i,{size:"sm",children:"Save file"})}):e.jsx(i,{size:"sm",onClick:()=>s.requestDownload(),children:"Download"})]})})}case"inline":case"streamed":{const o=s.content,u=s.kind==="streamed";return e.jsxs("div",{className:t.wrap,children:[e.jsxs("div",{className:t.toolbar,children:[e.jsx(i,{size:"xs",variant:l==="preview"?"default":"ghost",onClick:()=>m("preview"),children:"Preview"}),e.jsx(i,{size:"xs",variant:l==="source"?"default":"ghost",onClick:()=>m("source"),children:"Source"})]}),u?e.jsxs("div",{className:t.streamedNote,children:[n(s.size)," file streamed"]}):null,l==="preview"?e.jsx("div",{className:t.rendered,children:e.jsx(v,{text:o,assetBase:p,workspaceCwd:d})}):e.jsx(h,{path:r,content:o})]})}}}export{q as MarkdownFileViewer};
@@ -1 +1 @@
1
- import{r as b,j as t}from"./vendor-react-DQUAl2K8.js";import{a as A}from"./vendor-query-i7fr__Xm.js";import{u as E,E as u,S as P,B as x,a as C}from"./index-0YyDYmrX.js";import{S as v}from"./StatusBadge-BMKAPA9O.js";import{u as R}from"./use-provider-auth-list-CPSj5VE9.js";import{u as y}from"./SettingsDialog-B86UWECm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";const N="env:";function I(e){var i;return e.configured==="unknown"?{label:"Unknown",variant:"warning"}:e.configured===!1?{label:"Not configured",variant:"muted"}:(i=e.configuredSource)!=null&&i.startsWith(N)?{label:`env: ${e.configuredSource.slice(N.length)}`,variant:"success"}:e.configuredType==="oauth"?{label:"OAuth",variant:"success"}:{label:"API key",variant:"success"}}function M(e){const i=e.configured===!0?"Re-login":"Log in";if(e.authTypes.length<=1){const s=e.authTypes[0]??"api_key";return[{authType:s,label:s==="oauth"?e.oauthLoginLabel??i:i}]}return e.authTypes.map(s=>s==="oauth"?{authType:s,label:e.oauthLoginLabel??"Log in with OAuth"}:{authType:s,label:"API key"})}const O="_list_vm1k7_1",T="_row_vm1k7_7",q="_rowMain_vm1k7_18",B="_name_vm1k7_25",z="_tag_vm1k7_33",F="_rowActions_vm1k7_37",U="_pendingNote_vm1k7_44",K="_note_vm1k7_49",Q="_errorState_vm1k7_55",a={list:O,row:T,rowMain:q,name:B,tag:z,rowActions:F,pendingNote:U,note:K,errorState:Q};function nn(){const e=E(n=>n.client),i=A(),s=y(n=>n.pendingLogin),j=y(n=>n.requestLogin),[d,g]=b.useState(null),[k,m]=b.useState({}),{data:r,isLoading:L,isError:S,error:h}=R();async function p(n){if(e&&window.confirm(`Log out of ${n.name}? Running agents keep working until their current credential use fails.`)){m(o=>({...o,[n.id]:""})),g(n.id);try{const o=await e.logoutProvider(n.id);m(l=>({...l,[n.id]:o.stillConfigured?"Removed the stored credential — still configured via an environment variable.":""})),await i.invalidateQueries({queryKey:C.providerAuthList()})}finally{g(null)}}}return L?t.jsxs(u,{children:[t.jsx(P,{size:"sm"})," Loading providers…"]}):S?t.jsx(u,{className:a.errorState,children:h instanceof Error?h.message:"Failed to load providers."}):!r||r.length===0?t.jsx(u,{children:"No providers available."}):t.jsx("div",{className:a.list,children:r.map(n=>{const o=I(n),l=M(n),f=(s==null?void 0:s.provider)===n.id,_=s!==null&&!f,w=k[n.id];return t.jsxs("div",{className:a.row,children:[t.jsxs("div",{className:a.rowMain,children:[t.jsx("span",{className:a.name,children:n.name}),n.oauthIsSubscription&&t.jsx(v,{label:"Subscription",variant:"muted",className:a.tag}),t.jsx(v,{label:o.label,variant:o.variant,className:a.tag})]}),t.jsx("div",{className:a.rowActions,children:f?t.jsx("span",{className:a.pendingNote,children:"Logging in…"}):t.jsxs(t.Fragment,{children:[l.map(c=>t.jsx(x,{size:"xs",variant:"secondary",disabled:_,onClick:()=>j(n.id,n.name,c.authType),children:c.label},c.authType)),n.configured!==!1&&t.jsx(x,{size:"xs",variant:"ghost",disabled:_||d===n.id,loading:d===n.id,onClick:()=>void p(n),children:"Log out"})]})}),w&&t.jsx("div",{className:a.note,children:w})]},n.id)})})}export{nn as ModelProvidersPanel};
1
+ import{r as b,j as t}from"./vendor-react-DQUAl2K8.js";import{a as A}from"./vendor-query-i7fr__Xm.js";import{u as E,E as u,S as P,B as x,a as C}from"./index-C9bHyGYI.js";import{S as v}from"./StatusBadge-BMKAPA9O.js";import{u as R}from"./use-provider-auth-list-Bb6Y9Gn4.js";import{u as y}from"./SettingsDialog-B_flcAIp.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";const N="env:";function I(e){var i;return e.configured==="unknown"?{label:"Unknown",variant:"warning"}:e.configured===!1?{label:"Not configured",variant:"muted"}:(i=e.configuredSource)!=null&&i.startsWith(N)?{label:`env: ${e.configuredSource.slice(N.length)}`,variant:"success"}:e.configuredType==="oauth"?{label:"OAuth",variant:"success"}:{label:"API key",variant:"success"}}function M(e){const i=e.configured===!0?"Re-login":"Log in";if(e.authTypes.length<=1){const s=e.authTypes[0]??"api_key";return[{authType:s,label:s==="oauth"?e.oauthLoginLabel??i:i}]}return e.authTypes.map(s=>s==="oauth"?{authType:s,label:e.oauthLoginLabel??"Log in with OAuth"}:{authType:s,label:"API key"})}const O="_list_vm1k7_1",T="_row_vm1k7_7",q="_rowMain_vm1k7_18",B="_name_vm1k7_25",z="_tag_vm1k7_33",F="_rowActions_vm1k7_37",U="_pendingNote_vm1k7_44",K="_note_vm1k7_49",Q="_errorState_vm1k7_55",a={list:O,row:T,rowMain:q,name:B,tag:z,rowActions:F,pendingNote:U,note:K,errorState:Q};function nn(){const e=E(n=>n.client),i=A(),s=y(n=>n.pendingLogin),j=y(n=>n.requestLogin),[d,g]=b.useState(null),[k,m]=b.useState({}),{data:r,isLoading:L,isError:S,error:h}=R();async function p(n){if(e&&window.confirm(`Log out of ${n.name}? Running agents keep working until their current credential use fails.`)){m(o=>({...o,[n.id]:""})),g(n.id);try{const o=await e.logoutProvider(n.id);m(l=>({...l,[n.id]:o.stillConfigured?"Removed the stored credential — still configured via an environment variable.":""})),await i.invalidateQueries({queryKey:C.providerAuthList()})}finally{g(null)}}}return L?t.jsxs(u,{children:[t.jsx(P,{size:"sm"})," Loading providers…"]}):S?t.jsx(u,{className:a.errorState,children:h instanceof Error?h.message:"Failed to load providers."}):!r||r.length===0?t.jsx(u,{children:"No providers available."}):t.jsx("div",{className:a.list,children:r.map(n=>{const o=I(n),l=M(n),f=(s==null?void 0:s.provider)===n.id,_=s!==null&&!f,w=k[n.id];return t.jsxs("div",{className:a.row,children:[t.jsxs("div",{className:a.rowMain,children:[t.jsx("span",{className:a.name,children:n.name}),n.oauthIsSubscription&&t.jsx(v,{label:"Subscription",variant:"muted",className:a.tag}),t.jsx(v,{label:o.label,variant:o.variant,className:a.tag})]}),t.jsx("div",{className:a.rowActions,children:f?t.jsx("span",{className:a.pendingNote,children:"Logging in…"}):t.jsxs(t.Fragment,{children:[l.map(c=>t.jsx(x,{size:"xs",variant:"secondary",disabled:_,onClick:()=>j(n.id,n.name,c.authType),children:c.label},c.authType)),n.configured!==!1&&t.jsx(x,{size:"xs",variant:"ghost",disabled:_||d===n.id,loading:d===n.id,onClick:()=>void p(n),children:"Log out"})]})}),w&&t.jsx("div",{className:a.note,children:w})]},n.id)})})}export{nn as ModelProvidersPanel};
@@ -1 +1 @@
1
- import{r as c,j as t}from"./vendor-react-DQUAl2K8.js";import{u as I,o as W,P as w,E as N,S as k,l as q,p as C,d as U,q as X,C as Y,s as z,g as D}from"./index-0YyDYmrX.js";import{F as G}from"./vendor-molviewer-DeAF8d5d.js";import{S as v}from"./StatusBadge-BMKAPA9O.js";import{u as H}from"./use-file-download-CtRGxKJM.js";import{u as K}from"./use-file-watch-BeWRBxwR.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";function J(e,r){return!e||!r?null:{url:r,name:e.split("/").pop()||e}}function Q({changedAt:e,lastAppliedAt:r,modified:n}){return!(e===null||n||e===r)}const Z={empty_path:"Nothing to save.",too_large:"File is too large to save (over 5 MiB).",not_found:"The file no longer exists.",unreadable:"The file could not be read.",not_a_file:"That path is not a file."};async function ee(e,r,n){const a=await e.connection.request("file_write_request",{path:r,content:n});if(!a.ok){const l=a.error??"";throw new Error(Z[l]??l??"Failed to save")}}const re="mol2";function oe(e){const{sourcePath:r,monomers:n,attempt:a}=e,l=a>0?`_${a+1}`:"";return`${te(r)}_polymer_${n}${l}.${re}`}function te(e){return(e.split("/").pop()??"").replace(/\.[^.]+$/,"").trim()||"polymer"}const se={"--canvas":"var(--pi-color-surface0)","--well":"var(--pi-color-surface0)","--recess":"var(--pi-color-surface1)","--chrome":"var(--pi-color-surface1)","--control":"var(--pi-color-surface2)","--control-hover":"var(--pi-color-surface3)","--control-strong-hover":"var(--pi-color-surface4)","--border-control":"var(--pi-color-border)","--border-input":"var(--pi-color-border)","--popover":"var(--pi-color-surface1)","--popover-item-hover":"var(--pi-color-surface2)","--row-hover":"var(--pi-color-surface2)","--border-popover":"var(--pi-color-border)","--text-primary":"var(--pi-color-foreground)","--text-on-control":"var(--pi-color-foreground)"},ne="_wrap_tixu9_1",ae="_molViewer_tixu9_4",le="_badges_tixu9_8",b={wrap:ne,molViewer:ae,badges:le},ie=50;async function ce(e){const{client:r,upload:n,sourcePath:a,monomers:l,text:f}=e,p=U(a);let s=null,i="";for(let u=0;u<ie&&s===null;u+=1){i=oe({sourcePath:a,monomers:l,attempt:u});try{s=await X(r,p,i,"file")}catch(m){if(m instanceof Y&&m.code==="exists")continue;throw m}}if(s===null)throw new Error(`No free name for ${i} — too many builds in this folder.`);try{await n(p,new File([f],i,{type:"chemical/x-mol2"}))}catch(u){throw await z(r,s).catch(()=>{}),u}return s}function ue({path:e,workspaceCwd:r,tabId:n,isActive:a,onModifiedChange:l}){var T;const f=I(o=>o.client),{upload:p}=W(),s=H(e??"",!!e),{changedAt:i}=K(e),u=c.useRef(null),m=c.useRef(!1),[E,_]=c.useState(null),[h,A]=c.useState(!1),[S,x]=c.useState(null),[j,y]=c.useState(null),[M,P]=c.useState(null),g=c.useRef(null),R=((T=s.data)==null?void 0:T.objectUrl)??null,$=c.useMemo(()=>J(e,R),[e,R]);c.useEffect(()=>{Q({changedAt:i,lastAppliedAt:g.current,modified:h})&&(g.current=i,s.refetch())},[i,h,s.refetch]);const L=i!==null&&i!==g.current&&h;async function V(o){if(e){if(!f){x("Not connected — cannot save.");return}x(null);try{await ee(f,e,o.text()),o.saved()}catch(d){x(d instanceof Error?d.message:"Failed to save")}}}async function B(o){if(e){if(!f){y("Not connected — cannot save the polymer.");return}y(null),P(null);try{const d=await ce({client:f,upload:p,sourcePath:e,monomers:o.monomers,text:o.text()});o.report.clashes>0&&P(`${o.report.clashes} close contacts — relax the geometry before simulating`);const O=q.getState().paneOfTab(r,n);C(d,r,O??void 0)}catch(d){y(d instanceof Error?d.message:"Failed to save the polymer")}}}const F=(s.isError?s.error instanceof Error?s.error.message:"download failed":null)??(E==null?void 0:E.message)??null;return e&&s.isPending?t.jsx(w,{children:t.jsxs(N,{children:[t.jsx(k,{size:"sm"})," Loading..."]})}):F?t.jsx(w,{children:t.jsxs(N,{children:["Error: ",F]})}):t.jsxs(w,{className:b.wrap,"data-molecule-active":a?"true":"false",children:[t.jsxs("div",{className:b.badges,children:[L&&t.jsx(v,{label:"File changed on disk",variant:"muted"}),S&&t.jsx(v,{label:`Save failed: ${S}`,variant:"error"}),j&&t.jsx(v,{label:`Polymer build: ${j}`,variant:"error"}),M&&t.jsx(v,{label:M,variant:"warning"})]}),t.jsx(G,{ref:u,className:b.molViewer,theme:se,source:$,sourceMode:m.current?"update":"replace",onLoad:()=>{m.current=!0,_(null)},onLoadError:o=>_(o.error),onModifiedChange:o=>{A(o),l==null||l(o)},onSave:e?V:void 0,onPolymerBuild:e?B:void 0})]})}function _e({tab:e}){const{path:r}=e.data,n=D(e.id);return t.jsx(w,{children:t.jsx(ue,{path:r,workspaceCwd:e.workspaceCwd,tabId:e.id,isActive:n})})}export{_e as MoleculeViewerPanel};
1
+ import{r as c,j as t}from"./vendor-react-DQUAl2K8.js";import{u as I,o as W,P as w,E as N,S as k,l as q,p as C,d as U,q as X,C as Y,s as z,g as D}from"./index-C9bHyGYI.js";import{F as G}from"./vendor-molviewer-DeAF8d5d.js";import{S as v}from"./StatusBadge-BMKAPA9O.js";import{u as H}from"./use-file-download-C8bUEJxW.js";import{u as K}from"./use-file-watch-Bhf3nvpb.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";function J(e,r){return!e||!r?null:{url:r,name:e.split("/").pop()||e}}function Q({changedAt:e,lastAppliedAt:r,modified:n}){return!(e===null||n||e===r)}const Z={empty_path:"Nothing to save.",too_large:"File is too large to save (over 5 MiB).",not_found:"The file no longer exists.",unreadable:"The file could not be read.",not_a_file:"That path is not a file."};async function ee(e,r,n){const a=await e.connection.request("file_write_request",{path:r,content:n});if(!a.ok){const l=a.error??"";throw new Error(Z[l]??l??"Failed to save")}}const re="mol2";function oe(e){const{sourcePath:r,monomers:n,attempt:a}=e,l=a>0?`_${a+1}`:"";return`${te(r)}_polymer_${n}${l}.${re}`}function te(e){return(e.split("/").pop()??"").replace(/\.[^.]+$/,"").trim()||"polymer"}const se={"--canvas":"var(--pi-color-surface0)","--well":"var(--pi-color-surface0)","--recess":"var(--pi-color-surface1)","--chrome":"var(--pi-color-surface1)","--control":"var(--pi-color-surface2)","--control-hover":"var(--pi-color-surface3)","--control-strong-hover":"var(--pi-color-surface4)","--border-control":"var(--pi-color-border)","--border-input":"var(--pi-color-border)","--popover":"var(--pi-color-surface1)","--popover-item-hover":"var(--pi-color-surface2)","--row-hover":"var(--pi-color-surface2)","--border-popover":"var(--pi-color-border)","--text-primary":"var(--pi-color-foreground)","--text-on-control":"var(--pi-color-foreground)"},ne="_wrap_tixu9_1",ae="_molViewer_tixu9_4",le="_badges_tixu9_8",b={wrap:ne,molViewer:ae,badges:le},ie=50;async function ce(e){const{client:r,upload:n,sourcePath:a,monomers:l,text:f}=e,p=U(a);let s=null,i="";for(let u=0;u<ie&&s===null;u+=1){i=oe({sourcePath:a,monomers:l,attempt:u});try{s=await X(r,p,i,"file")}catch(m){if(m instanceof Y&&m.code==="exists")continue;throw m}}if(s===null)throw new Error(`No free name for ${i} — too many builds in this folder.`);try{await n(p,new File([f],i,{type:"chemical/x-mol2"}))}catch(u){throw await z(r,s).catch(()=>{}),u}return s}function ue({path:e,workspaceCwd:r,tabId:n,isActive:a,onModifiedChange:l}){var T;const f=I(o=>o.client),{upload:p}=W(),s=H(e??"",!!e),{changedAt:i}=K(e),u=c.useRef(null),m=c.useRef(!1),[E,_]=c.useState(null),[h,A]=c.useState(!1),[S,x]=c.useState(null),[j,y]=c.useState(null),[M,P]=c.useState(null),g=c.useRef(null),R=((T=s.data)==null?void 0:T.objectUrl)??null,$=c.useMemo(()=>J(e,R),[e,R]);c.useEffect(()=>{Q({changedAt:i,lastAppliedAt:g.current,modified:h})&&(g.current=i,s.refetch())},[i,h,s.refetch]);const L=i!==null&&i!==g.current&&h;async function V(o){if(e){if(!f){x("Not connected — cannot save.");return}x(null);try{await ee(f,e,o.text()),o.saved()}catch(d){x(d instanceof Error?d.message:"Failed to save")}}}async function B(o){if(e){if(!f){y("Not connected — cannot save the polymer.");return}y(null),P(null);try{const d=await ce({client:f,upload:p,sourcePath:e,monomers:o.monomers,text:o.text()});o.report.clashes>0&&P(`${o.report.clashes} close contacts — relax the geometry before simulating`);const O=q.getState().paneOfTab(r,n);C(d,r,O??void 0)}catch(d){y(d instanceof Error?d.message:"Failed to save the polymer")}}}const F=(s.isError?s.error instanceof Error?s.error.message:"download failed":null)??(E==null?void 0:E.message)??null;return e&&s.isPending?t.jsx(w,{children:t.jsxs(N,{children:[t.jsx(k,{size:"sm"})," Loading..."]})}):F?t.jsx(w,{children:t.jsxs(N,{children:["Error: ",F]})}):t.jsxs(w,{className:b.wrap,"data-molecule-active":a?"true":"false",children:[t.jsxs("div",{className:b.badges,children:[L&&t.jsx(v,{label:"File changed on disk",variant:"muted"}),S&&t.jsx(v,{label:`Save failed: ${S}`,variant:"error"}),j&&t.jsx(v,{label:`Polymer build: ${j}`,variant:"error"}),M&&t.jsx(v,{label:M,variant:"warning"})]}),t.jsx(G,{ref:u,className:b.molViewer,theme:se,source:$,sourceMode:m.current?"update":"replace",onLoad:()=>{m.current=!0,_(null)},onLoadError:o=>_(o.error),onModifiedChange:o=>{A(o),l==null||l(o)},onSave:e?V:void 0,onPolymerBuild:e?B:void 0})]})}function _e({tab:e}){const{path:r}=e.data,n=D(e.id);return t.jsx(w,{children:t.jsx(ue,{path:r,workspaceCwd:e.workspaceCwd,tabId:e.id,isActive:n})})}export{_e as MoleculeViewerPanel};
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelProvidersPanel-BjVXGAY-.js","assets/vendor-react-DQUAl2K8.js","assets/vendor-query-i7fr__Xm.js","assets/index-0YyDYmrX.js","assets/vendor-2vclEyEB.js","assets/vendor-CEK31ho9.css","assets/vendor-icons-BA_PiM8g.js","assets/vendor-overlays-wWoMzb65.js","assets/vendor-dnd-CayJj8TC.js","assets/index-C_17Gn7C.css","assets/StatusBadge-BMKAPA9O.js","assets/StatusBadge-DmrnYEhp.css","assets/use-provider-auth-list-CPSj5VE9.js","assets/ModelProvidersPanel-BP1zIT6I.css"])))=>i.map(i=>d[i]);
2
- import{ae as me,af as we,_ as ye,M as Ce}from"./vendor-2vclEyEB.js";import{b as Ee,r as P,j as l}from"./vendor-react-DQUAl2K8.js";import{u as re,a as Ne,M as oe,B as G,S as It,J as Be,N as Se,$ as Ie,I as _e,E as At}from"./index-0YyDYmrX.js";import{a as be}from"./vendor-query-i7fr__Xm.js";import{o as ie,b as Re,p as Ae,K as Le}from"./vendor-icons-BA_PiM8g.js";function ve(t,n){return{provider:t,authType:n,phase:"starting",statusLines:[]}}function Te(t,n,i){return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...t.statusLines,{kind:"info",message:n,links:i}]}}function Me(t,n){const i=t.statusLines.filter(r=>r.kind!=="progress");return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...i,{kind:"progress",message:n}]}}function Pe(t,n,i){return{...t,authUrl:{url:n,instructions:i}}}function je(t,n,i,r,e){return{...t,deviceCode:{userCode:n,verificationUri:i,intervalSeconds:r,expiresInSeconds:e}}}function De(t,n){return{...t,phase:"prompt",prompt:n}}function xe(t,n){var i;return((i=t.prompt)==null?void 0:i.promptId)!==n?t:{...t,phase:"waiting",prompt:void 0}}function ke(t,n,i){return{...t,phase:"done",result:{ok:n,error:i}}}function Ue(t,n){if(t.phase==="done")return t;switch(n.kind){case"info":return Te(t,n.message,n.links);case"progress":return Me(t,n.message);case"auth_url":return Pe(t,n.url,n.instructions);case"device_code":return je(t,n.userCode,n.verificationUri,n.intervalSeconds,n.expiresInSeconds);case"prompt":return De(t,n);case"prompt_cancelled":return xe(t,n.promptId);case"done":return ke(t,n.ok,n.error)}}var V={},nt,Lt;function qe(){return Lt||(Lt=1,nt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),nt}var rt={},U={},vt;function F(){if(vt)return U;vt=1;let t;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return U.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},U.getSymbolTotalCodewords=function(r){return n[r]},U.getBCHDigit=function(i){let r=0;for(;i!==0;)r++,i>>>=1;return r},U.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');t=r},U.isKanjiModeEnabled=function(){return typeof t<"u"},U.toSJIS=function(r){return t(r)},U}var ot={},Tt;function _t(){return Tt||(Tt=1,(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+i)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,e){if(t.isValid(r))return r;try{return n(r)}catch{return e}}})(ot)),ot}var it,Mt;function Fe(){if(Mt)return it;Mt=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(n){const i=Math.floor(n/8);return(this.buffer[i]>>>7-n%8&1)===1},put:function(n,i){for(let r=0;r<i;r++)this.putBit((n>>>i-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),n&&(this.buffer[i]|=128>>>this.length%8),this.length++}},it=t,it}var st,Pt;function ze(){if(Pt)return st;Pt=1;function t(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return t.prototype.set=function(n,i,r,e){const o=n*this.size+i;this.data[o]=r,e&&(this.reservedBit[o]=!0)},t.prototype.get=function(n,i){return this.data[n*this.size+i]},t.prototype.xor=function(n,i,r){this.data[n*this.size+i]^=r},t.prototype.isReserved=function(n,i){return this.reservedBit[n*this.size+i]},st=t,st}var at={},jt;function Ke(){return jt||(jt=1,(function(t){const n=F().getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const e=Math.floor(r/7)+2,o=n(r),s=o===145?26:Math.ceil((o-13)/(2*e-2))*2,a=[o-7];for(let u=1;u<e-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},t.getPositions=function(r){const e=[],o=t.getRowColCoords(r),s=o.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||e.push([o[a],o[u]]);return e}})(at)),at}var ut={},Dt;function Ve(){if(Dt)return ut;Dt=1;const t=F().getSymbolSize,n=7;return ut.getPositions=function(r){const e=t(r);return[[0,0],[e-n,0],[0,e-n]]},ut}var ct={},xt;function Oe(){return xt||(xt=1,(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};t.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const o=e.size;let s=0,a=0,u=0,c=null,p=null;for(let C=0;C<o;C++){a=u=0,c=p=null;for(let B=0;B<o;B++){let f=e.get(C,B);f===c?a++:(a>=5&&(s+=n.N1+(a-5)),c=f,a=1),f=e.get(B,C),f===p?u++:(u>=5&&(s+=n.N1+(u-5)),p=f,u=1)}a>=5&&(s+=n.N1+(a-5)),u>=5&&(s+=n.N1+(u-5))}return s},t.getPenaltyN2=function(e){const o=e.size;let s=0;for(let a=0;a<o-1;a++)for(let u=0;u<o-1;u++){const c=e.get(a,u)+e.get(a,u+1)+e.get(a+1,u)+e.get(a+1,u+1);(c===4||c===0)&&s++}return s*n.N2},t.getPenaltyN3=function(e){const o=e.size;let s=0,a=0,u=0;for(let c=0;c<o;c++){a=u=0;for(let p=0;p<o;p++)a=a<<1&2047|e.get(c,p),p>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|e.get(p,c),p>=10&&(u===1488||u===93)&&s++}return s*n.N3},t.getPenaltyN4=function(e){let o=0;const s=e.data.length;for(let u=0;u<s;u++)o+=e.data[u];return Math.abs(Math.ceil(o*100/s/5)-10)*n.N4};function i(r,e,o){switch(r){case t.Patterns.PATTERN000:return(e+o)%2===0;case t.Patterns.PATTERN001:return e%2===0;case t.Patterns.PATTERN010:return o%3===0;case t.Patterns.PATTERN011:return(e+o)%3===0;case t.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(o/3))%2===0;case t.Patterns.PATTERN101:return e*o%2+e*o%3===0;case t.Patterns.PATTERN110:return(e*o%2+e*o%3)%2===0;case t.Patterns.PATTERN111:return(e*o%3+(e+o)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}t.applyMask=function(e,o){const s=o.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)o.isReserved(u,a)||o.xor(u,a,i(e,u,a))},t.getBestMask=function(e,o){const s=Object.keys(t.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){o(c),t.applyMask(c,e);const p=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(c,e),p<u&&(u=p,a=c)}return a}})(ct)),ct}var W={},kt;function se(){if(kt)return W;kt=1;const t=_t(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return W.getBlocksCount=function(e,o){switch(o){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},W.getTotalCodewordsCount=function(e,o){switch(o){case t.L:return i[(e-1)*4+0];case t.M:return i[(e-1)*4+1];case t.Q:return i[(e-1)*4+2];case t.H:return i[(e-1)*4+3];default:return}},W}var lt={},Q={},Ut;function He(){if(Ut)return Q;Ut=1;const t=new Uint8Array(512),n=new Uint8Array(256);return(function(){let r=1;for(let e=0;e<255;e++)t[e]=r,n[r]=e,r<<=1,r&256&&(r^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),Q.log=function(r){if(r<1)throw new Error("log("+r+")");return n[r]},Q.exp=function(r){return t[r]},Q.mul=function(r,e){return r===0||e===0?0:t[n[r]+n[e]]},Q}var qt;function Qe(){return qt||(qt=1,(function(t){const n=He();t.mul=function(r,e){const o=new Uint8Array(r.length+e.length-1);for(let s=0;s<r.length;s++)for(let a=0;a<e.length;a++)o[s+a]^=n.mul(r[s],e[a]);return o},t.mod=function(r,e){let o=new Uint8Array(r);for(;o.length-e.length>=0;){const s=o[0];for(let u=0;u<e.length;u++)o[u]^=n.mul(e[u],s);let a=0;for(;a<o.length&&o[a]===0;)a++;o=o.slice(a)}return o},t.generateECPolynomial=function(r){let e=new Uint8Array([1]);for(let o=0;o<r;o++)e=t.mul(e,new Uint8Array([1,n.exp(o)]));return e}})(lt)),lt}var dt,Ft;function Je(){if(Ft)return dt;Ft=1;const t=Qe();function n(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(r){this.degree=r,this.genPoly=t.generateECPolynomial(this.degree)},n.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(r.length+this.degree);e.set(r);const o=t.mod(e,this.genPoly),s=this.degree-o.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(o,s),a}return o},dt=n,dt}var ft={},gt={},ht={},zt;function ae(){return zt||(zt=1,ht.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),ht}var D={},Kt;function ue(){if(Kt)return D;Kt=1;const t="[0-9]+",n="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelProvidersPanel-Dwkt1dOR.js","assets/vendor-react-DQUAl2K8.js","assets/vendor-query-i7fr__Xm.js","assets/index-C9bHyGYI.js","assets/vendor-2vclEyEB.js","assets/vendor-CEK31ho9.css","assets/vendor-icons-BA_PiM8g.js","assets/vendor-overlays-wWoMzb65.js","assets/vendor-dnd-CayJj8TC.js","assets/index-C_17Gn7C.css","assets/StatusBadge-BMKAPA9O.js","assets/StatusBadge-DmrnYEhp.css","assets/use-provider-auth-list-Bb6Y9Gn4.js","assets/ModelProvidersPanel-BP1zIT6I.css"])))=>i.map(i=>d[i]);
2
+ import{ae as me,af as we,_ as ye,M as Ce}from"./vendor-2vclEyEB.js";import{b as Ee,r as P,j as l}from"./vendor-react-DQUAl2K8.js";import{u as re,a as Ne,M as oe,B as G,S as It,J as Be,N as Se,$ as Ie,I as _e,E as At}from"./index-C9bHyGYI.js";import{a as be}from"./vendor-query-i7fr__Xm.js";import{o as ie,b as Re,p as Ae,K as Le}from"./vendor-icons-BA_PiM8g.js";function ve(t,n){return{provider:t,authType:n,phase:"starting",statusLines:[]}}function Te(t,n,i){return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...t.statusLines,{kind:"info",message:n,links:i}]}}function Me(t,n){const i=t.statusLines.filter(r=>r.kind!=="progress");return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...i,{kind:"progress",message:n}]}}function Pe(t,n,i){return{...t,authUrl:{url:n,instructions:i}}}function je(t,n,i,r,e){return{...t,deviceCode:{userCode:n,verificationUri:i,intervalSeconds:r,expiresInSeconds:e}}}function De(t,n){return{...t,phase:"prompt",prompt:n}}function xe(t,n){var i;return((i=t.prompt)==null?void 0:i.promptId)!==n?t:{...t,phase:"waiting",prompt:void 0}}function ke(t,n,i){return{...t,phase:"done",result:{ok:n,error:i}}}function Ue(t,n){if(t.phase==="done")return t;switch(n.kind){case"info":return Te(t,n.message,n.links);case"progress":return Me(t,n.message);case"auth_url":return Pe(t,n.url,n.instructions);case"device_code":return je(t,n.userCode,n.verificationUri,n.intervalSeconds,n.expiresInSeconds);case"prompt":return De(t,n);case"prompt_cancelled":return xe(t,n.promptId);case"done":return ke(t,n.ok,n.error)}}var V={},nt,Lt;function qe(){return Lt||(Lt=1,nt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),nt}var rt={},U={},vt;function F(){if(vt)return U;vt=1;let t;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return U.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},U.getSymbolTotalCodewords=function(r){return n[r]},U.getBCHDigit=function(i){let r=0;for(;i!==0;)r++,i>>>=1;return r},U.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');t=r},U.isKanjiModeEnabled=function(){return typeof t<"u"},U.toSJIS=function(r){return t(r)},U}var ot={},Tt;function _t(){return Tt||(Tt=1,(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+i)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,e){if(t.isValid(r))return r;try{return n(r)}catch{return e}}})(ot)),ot}var it,Mt;function Fe(){if(Mt)return it;Mt=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(n){const i=Math.floor(n/8);return(this.buffer[i]>>>7-n%8&1)===1},put:function(n,i){for(let r=0;r<i;r++)this.putBit((n>>>i-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),n&&(this.buffer[i]|=128>>>this.length%8),this.length++}},it=t,it}var st,Pt;function ze(){if(Pt)return st;Pt=1;function t(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return t.prototype.set=function(n,i,r,e){const o=n*this.size+i;this.data[o]=r,e&&(this.reservedBit[o]=!0)},t.prototype.get=function(n,i){return this.data[n*this.size+i]},t.prototype.xor=function(n,i,r){this.data[n*this.size+i]^=r},t.prototype.isReserved=function(n,i){return this.reservedBit[n*this.size+i]},st=t,st}var at={},jt;function Ke(){return jt||(jt=1,(function(t){const n=F().getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const e=Math.floor(r/7)+2,o=n(r),s=o===145?26:Math.ceil((o-13)/(2*e-2))*2,a=[o-7];for(let u=1;u<e-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},t.getPositions=function(r){const e=[],o=t.getRowColCoords(r),s=o.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||e.push([o[a],o[u]]);return e}})(at)),at}var ut={},Dt;function Ve(){if(Dt)return ut;Dt=1;const t=F().getSymbolSize,n=7;return ut.getPositions=function(r){const e=t(r);return[[0,0],[e-n,0],[0,e-n]]},ut}var ct={},xt;function Oe(){return xt||(xt=1,(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};t.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const o=e.size;let s=0,a=0,u=0,c=null,p=null;for(let C=0;C<o;C++){a=u=0,c=p=null;for(let B=0;B<o;B++){let f=e.get(C,B);f===c?a++:(a>=5&&(s+=n.N1+(a-5)),c=f,a=1),f=e.get(B,C),f===p?u++:(u>=5&&(s+=n.N1+(u-5)),p=f,u=1)}a>=5&&(s+=n.N1+(a-5)),u>=5&&(s+=n.N1+(u-5))}return s},t.getPenaltyN2=function(e){const o=e.size;let s=0;for(let a=0;a<o-1;a++)for(let u=0;u<o-1;u++){const c=e.get(a,u)+e.get(a,u+1)+e.get(a+1,u)+e.get(a+1,u+1);(c===4||c===0)&&s++}return s*n.N2},t.getPenaltyN3=function(e){const o=e.size;let s=0,a=0,u=0;for(let c=0;c<o;c++){a=u=0;for(let p=0;p<o;p++)a=a<<1&2047|e.get(c,p),p>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|e.get(p,c),p>=10&&(u===1488||u===93)&&s++}return s*n.N3},t.getPenaltyN4=function(e){let o=0;const s=e.data.length;for(let u=0;u<s;u++)o+=e.data[u];return Math.abs(Math.ceil(o*100/s/5)-10)*n.N4};function i(r,e,o){switch(r){case t.Patterns.PATTERN000:return(e+o)%2===0;case t.Patterns.PATTERN001:return e%2===0;case t.Patterns.PATTERN010:return o%3===0;case t.Patterns.PATTERN011:return(e+o)%3===0;case t.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(o/3))%2===0;case t.Patterns.PATTERN101:return e*o%2+e*o%3===0;case t.Patterns.PATTERN110:return(e*o%2+e*o%3)%2===0;case t.Patterns.PATTERN111:return(e*o%3+(e+o)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}t.applyMask=function(e,o){const s=o.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)o.isReserved(u,a)||o.xor(u,a,i(e,u,a))},t.getBestMask=function(e,o){const s=Object.keys(t.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){o(c),t.applyMask(c,e);const p=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(c,e),p<u&&(u=p,a=c)}return a}})(ct)),ct}var W={},kt;function se(){if(kt)return W;kt=1;const t=_t(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return W.getBlocksCount=function(e,o){switch(o){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},W.getTotalCodewordsCount=function(e,o){switch(o){case t.L:return i[(e-1)*4+0];case t.M:return i[(e-1)*4+1];case t.Q:return i[(e-1)*4+2];case t.H:return i[(e-1)*4+3];default:return}},W}var lt={},Q={},Ut;function He(){if(Ut)return Q;Ut=1;const t=new Uint8Array(512),n=new Uint8Array(256);return(function(){let r=1;for(let e=0;e<255;e++)t[e]=r,n[r]=e,r<<=1,r&256&&(r^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),Q.log=function(r){if(r<1)throw new Error("log("+r+")");return n[r]},Q.exp=function(r){return t[r]},Q.mul=function(r,e){return r===0||e===0?0:t[n[r]+n[e]]},Q}var qt;function Qe(){return qt||(qt=1,(function(t){const n=He();t.mul=function(r,e){const o=new Uint8Array(r.length+e.length-1);for(let s=0;s<r.length;s++)for(let a=0;a<e.length;a++)o[s+a]^=n.mul(r[s],e[a]);return o},t.mod=function(r,e){let o=new Uint8Array(r);for(;o.length-e.length>=0;){const s=o[0];for(let u=0;u<e.length;u++)o[u]^=n.mul(e[u],s);let a=0;for(;a<o.length&&o[a]===0;)a++;o=o.slice(a)}return o},t.generateECPolynomial=function(r){let e=new Uint8Array([1]);for(let o=0;o<r;o++)e=t.mul(e,new Uint8Array([1,n.exp(o)]));return e}})(lt)),lt}var dt,Ft;function Je(){if(Ft)return dt;Ft=1;const t=Qe();function n(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(r){this.degree=r,this.genPoly=t.generateECPolynomial(this.degree)},n.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(r.length+this.degree);e.set(r);const o=t.mod(e,this.genPoly),s=this.degree-o.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(o,s),a}return o},dt=n,dt}var ft={},gt={},ht={},zt;function ae(){return zt||(zt=1,ht.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),ht}var D={},Kt;function ue(){if(Kt)return D;Kt=1;const t="[0-9]+",n="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r
3
3
  ]))+`;D.KANJI=new RegExp(i,"g"),D.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),D.BYTE=new RegExp(r,"g"),D.NUMERIC=new RegExp(t,"g"),D.ALPHANUMERIC=new RegExp(n,"g");const e=new RegExp("^"+i+"$"),o=new RegExp("^"+t+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return D.testKanji=function(u){return e.test(u)},D.testNumeric=function(u){return o.test(u)},D.testAlphanumeric=function(u){return s.test(u)},D}var Vt;function z(){return Vt||(Vt=1,(function(t){const n=ae(),i=ue();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(o,s){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!n.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?o.ccBits[0]:s<27?o.ccBits[1]:o.ccBits[2]},t.getBestModeForData=function(o){return i.testNumeric(o)?t.NUMERIC:i.testAlphanumeric(o)?t.ALPHANUMERIC:i.testKanji(o)?t.KANJI:t.BYTE},t.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},t.isValid=function(o){return o&&o.bit&&o.ccBits};function r(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}t.from=function(o,s){if(t.isValid(o))return o;try{return r(o)}catch{return s}}})(gt)),gt}var Ot;function Ye(){return Ot||(Ot=1,(function(t){const n=F(),i=se(),r=_t(),e=z(),o=ae(),s=7973,a=n.getBCHDigit(s);function u(B,f,L){for(let A=1;A<=40;A++)if(f<=t.getCapacity(A,L,B))return A}function c(B,f){return e.getCharCountIndicator(B,f)+4}function p(B,f){let L=0;return B.forEach(function(A){const S=c(A.mode,f);L+=S+A.getBitsLength()}),L}function C(B,f){for(let L=1;L<=40;L++)if(p(B,L)<=t.getCapacity(L,f,e.MIXED))return L}t.from=function(f,L){return o.isValid(f)?parseInt(f,10):L},t.getCapacity=function(f,L,A){if(!o.isValid(f))throw new Error("Invalid QR Code version");typeof A>"u"&&(A=e.BYTE);const S=n.getSymbolTotalCodewords(f),I=i.getTotalCodewordsCount(f,L),v=(S-I)*8;if(A===e.MIXED)return v;const R=v-c(A,f);switch(A){case e.NUMERIC:return Math.floor(R/10*3);case e.ALPHANUMERIC:return Math.floor(R/11*2);case e.KANJI:return Math.floor(R/13);case e.BYTE:default:return Math.floor(R/8)}},t.getBestVersionForData=function(f,L){let A;const S=r.from(L,r.M);if(Array.isArray(f)){if(f.length>1)return C(f,S);if(f.length===0)return 1;A=f[0]}else A=f;return u(A.mode,A.getLength(),S)},t.getEncodedBits=function(f){if(!o.isValid(f)||f<7)throw new Error("Invalid QR Code version");let L=f<<12;for(;n.getBCHDigit(L)-a>=0;)L^=s<<n.getBCHDigit(L)-a;return f<<12|L}})(ft)),ft}var pt={},Ht;function $e(){if(Ht)return pt;Ht=1;const t=F(),n=1335,i=21522,r=t.getBCHDigit(n);return pt.getEncodedBits=function(o,s){const a=o.bit<<3|s;let u=a<<10;for(;t.getBCHDigit(u)-r>=0;)u^=n<<t.getBCHDigit(u)-r;return(a<<10|u)^i},pt}var mt={},wt,Qt;function Ge(){if(Qt)return wt;Qt=1;const t=z();function n(i){this.mode=t.NUMERIC,this.data=i.toString()}return n.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let e,o,s;for(e=0;e+3<=this.data.length;e+=3)o=this.data.substr(e,3),s=parseInt(o,10),r.put(s,10);const a=this.data.length-e;a>0&&(o=this.data.substr(e),s=parseInt(o,10),r.put(s,a*3+1))},wt=n,wt}var yt,Jt;function We(){if(Jt)return yt;Jt=1;const t=z(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(r){this.mode=t.ALPHANUMERIC,this.data=r}return i.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let o;for(o=0;o+2<=this.data.length;o+=2){let s=n.indexOf(this.data[o])*45;s+=n.indexOf(this.data[o+1]),e.put(s,11)}this.data.length%2&&e.put(n.indexOf(this.data[o]),6)},yt=i,yt}var Ct,Yt;function Xe(){if(Yt)return Ct;Yt=1;const t=z();function n(i){this.mode=t.BYTE,typeof i=="string"?this.data=new TextEncoder().encode(i):this.data=new Uint8Array(i)}return n.getBitsLength=function(r){return r*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){for(let r=0,e=this.data.length;r<e;r++)i.put(this.data[r],8)},Ct=n,Ct}var Et,$t;function Ze(){if($t)return Et;$t=1;const t=z(),n=F();function i(r){this.mode=t.KANJI,this.data=r}return i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(r){let e;for(e=0;e<this.data.length;e++){let o=n.toSJIS(this.data[e]);if(o>=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
4
4
  Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),r.put(o,13)}},Et=i,Et}var Gt;function tn(){return Gt||(Gt=1,(function(t){const n=z(),i=Ge(),r=We(),e=Xe(),o=Ze(),s=ue(),a=F(),u=me();function c(I){return unescape(encodeURIComponent(I)).length}function p(I,v,R){const b=[];let M;for(;(M=I.exec(R))!==null;)b.push({data:M[0],index:M.index,mode:v,length:M[0].length});return b}function C(I){const v=p(s.NUMERIC,n.NUMERIC,I),R=p(s.ALPHANUMERIC,n.ALPHANUMERIC,I);let b,M;return a.isKanjiModeEnabled()?(b=p(s.BYTE,n.BYTE,I),M=p(s.KANJI,n.KANJI,I)):(b=p(s.BYTE_KANJI,n.BYTE,I),M=[]),v.concat(R,b,M).sort(function(E,m){return E.index-m.index}).map(function(E){return{data:E.data,mode:E.mode,length:E.length}})}function B(I,v){switch(v){case n.NUMERIC:return i.getBitsLength(I);case n.ALPHANUMERIC:return r.getBitsLength(I);case n.KANJI:return o.getBitsLength(I);case n.BYTE:return e.getBitsLength(I)}}function f(I){return I.reduce(function(v,R){const b=v.length-1>=0?v[v.length-1]:null;return b&&b.mode===R.mode?(v[v.length-1].data+=R.data,v):(v.push(R),v)},[])}function L(I){const v=[];for(let R=0;R<I.length;R++){const b=I[R];switch(b.mode){case n.NUMERIC:v.push([b,{data:b.data,mode:n.ALPHANUMERIC,length:b.length},{data:b.data,mode:n.BYTE,length:b.length}]);break;case n.ALPHANUMERIC:v.push([b,{data:b.data,mode:n.BYTE,length:b.length}]);break;case n.KANJI:v.push([b,{data:b.data,mode:n.BYTE,length:c(b.data)}]);break;case n.BYTE:v.push([{data:b.data,mode:n.BYTE,length:c(b.data)}])}}return v}function A(I,v){const R={},b={start:{}};let M=["start"];for(let h=0;h<I.length;h++){const E=I[h],m=[];for(let g=0;g<E.length;g++){const _=E[g],w=""+h+g;m.push(w),R[w]={node:_,lastCount:0},b[w]={};for(let N=0;N<M.length;N++){const y=M[N];R[y]&&R[y].node.mode===_.mode?(b[y][w]=B(R[y].lastCount+_.length,_.mode)-B(R[y].lastCount,_.mode),R[y].lastCount+=_.length):(R[y]&&(R[y].lastCount=_.length),b[y][w]=B(_.length,_.mode)+4+n.getCharCountIndicator(_.mode,v))}}M=m}for(let h=0;h<M.length;h++)b[M[h]].end=0;return{map:b,table:R}}function S(I,v){let R;const b=n.getBestModeForData(I);if(R=n.from(v,b),R!==n.BYTE&&R.bit<b.bit)throw new Error('"'+I+'" cannot be encoded with mode '+n.toString(R)+`.
5
5
  Suggested mode is: `+n.toString(b));switch(R===n.KANJI&&!a.isKanjiModeEnabled()&&(R=n.BYTE),R){case n.NUMERIC:return new i(I);case n.ALPHANUMERIC:return new r(I);case n.KANJI:return new o(I);case n.BYTE:return new e(I)}}t.fromArray=function(v){return v.reduce(function(R,b){return typeof b=="string"?R.push(S(b,null)):b.data&&R.push(S(b.data,b.mode)),R},[])},t.fromString=function(v,R){const b=C(v,a.isKanjiModeEnabled()),M=L(b),h=A(M,R),E=u.find_path(h.map,"start","end"),m=[];for(let g=1;g<E.length-1;g++)m.push(h.table[E[g]].node);return t.fromArray(f(m))},t.rawSplit=function(v){return t.fromArray(C(v,a.isKanjiModeEnabled()))}})(mt)),mt}var Wt;function en(){if(Wt)return rt;Wt=1;const t=F(),n=_t(),i=Fe(),r=ze(),e=Ke(),o=Ve(),s=Oe(),a=se(),u=Je(),c=Ye(),p=$e(),C=z(),B=tn();function f(h,E){const m=h.size,g=o.getPositions(E);for(let _=0;_<g.length;_++){const w=g[_][0],N=g[_][1];for(let y=-1;y<=7;y++)if(!(w+y<=-1||m<=w+y))for(let d=-1;d<=7;d++)N+d<=-1||m<=N+d||(y>=0&&y<=6&&(d===0||d===6)||d>=0&&d<=6&&(y===0||y===6)||y>=2&&y<=4&&d>=2&&d<=4?h.set(w+y,N+d,!0,!0):h.set(w+y,N+d,!1,!0))}}function L(h){const E=h.size;for(let m=8;m<E-8;m++){const g=m%2===0;h.set(m,6,g,!0),h.set(6,m,g,!0)}}function A(h,E){const m=e.getPositions(E);for(let g=0;g<m.length;g++){const _=m[g][0],w=m[g][1];for(let N=-2;N<=2;N++)for(let y=-2;y<=2;y++)N===-2||N===2||y===-2||y===2||N===0&&y===0?h.set(_+N,w+y,!0,!0):h.set(_+N,w+y,!1,!0)}}function S(h,E){const m=h.size,g=c.getEncodedBits(E);let _,w,N;for(let y=0;y<18;y++)_=Math.floor(y/3),w=y%3+m-8-3,N=(g>>y&1)===1,h.set(_,w,N,!0),h.set(w,_,N,!0)}function I(h,E,m){const g=h.size,_=p.getEncodedBits(E,m);let w,N;for(w=0;w<15;w++)N=(_>>w&1)===1,w<6?h.set(w,8,N,!0):w<8?h.set(w+1,8,N,!0):h.set(g-15+w,8,N,!0),w<8?h.set(8,g-w-1,N,!0):w<9?h.set(8,15-w-1+1,N,!0):h.set(8,15-w-1,N,!0);h.set(g-8,8,1,!0)}function v(h,E){const m=h.size;let g=-1,_=m-1,w=7,N=0;for(let y=m-1;y>0;y-=2)for(y===6&&y--;;){for(let d=0;d<2;d++)if(!h.isReserved(_,y-d)){let j=!1;N<E.length&&(j=(E[N]>>>w&1)===1),h.set(_,y-d,j),w--,w===-1&&(N++,w=7)}if(_+=g,_<0||m<=_){_-=g,g=-g;break}}}function R(h,E,m){const g=new i;m.forEach(function(d){g.put(d.mode.bit,4),g.put(d.getLength(),C.getCharCountIndicator(d.mode,h)),d.write(g)});const _=t.getSymbolTotalCodewords(h),w=a.getTotalCodewordsCount(h,E),N=(_-w)*8;for(g.getLengthInBits()+4<=N&&g.put(0,4);g.getLengthInBits()%8!==0;)g.putBit(0);const y=(N-g.getLengthInBits())/8;for(let d=0;d<y;d++)g.put(d%2?17:236,8);return b(g,h,E)}function b(h,E,m){const g=t.getSymbolTotalCodewords(E),_=a.getTotalCodewordsCount(E,m),w=g-_,N=a.getBlocksCount(E,m),y=g%N,d=N-y,j=Math.floor(g/N),q=Math.floor(w/N),Y=q+1,H=j-q,he=new u(H);let X=0;const $=new Array(N),bt=new Array(N);let Z=0;const pe=new Uint8Array(h.buffer);for(let K=0;K<N;K++){const et=K<d?q:Y;$[K]=pe.slice(X,X+et),bt[K]=he.encode($[K]),X+=et,Z=Math.max(Z,et)}const tt=new Uint8Array(g);let Rt=0,x,k;for(x=0;x<Z;x++)for(k=0;k<N;k++)x<$[k].length&&(tt[Rt++]=$[k][x]);for(x=0;x<H;x++)for(k=0;k<N;k++)tt[Rt++]=bt[k][x];return tt}function M(h,E,m,g){let _;if(Array.isArray(h))_=B.fromArray(h);else if(typeof h=="string"){let j=E;if(!j){const q=B.rawSplit(h);j=c.getBestVersionForData(q,m)}_=B.fromString(h,j||40)}else throw new Error("Invalid data");const w=c.getBestVersionForData(_,m);if(!w)throw new Error("The amount of data is too big to be stored in a QR Code");if(!E)E=w;else if(E<w)throw new Error(`
6
6
  The chosen QR Code version cannot contain this amount of data.
7
7
  Minimum version required to store current data is: `+w+`.
8
8
  `);const N=R(E,m,_),y=t.getSymbolSize(E),d=new r(y);return f(d,E),L(d),A(d,E),I(d,m,0),E>=7&&S(d,E),v(d,N),isNaN(g)&&(g=s.getBestMask(d,I.bind(null,d,m))),s.applyMask(g,d),I(d,m,g),{modules:d,version:E,errorCorrectionLevel:m,maskPattern:g,segments:_}}return rt.create=function(E,m){if(typeof E>"u"||E==="")throw new Error("No input text");let g=n.M,_,w;return typeof m<"u"&&(g=n.from(m.errorCorrectionLevel,n.M),_=c.from(m.version),w=s.from(m.maskPattern),m.toSJISFunc&&t.setToSJISFunction(m.toSJISFunc)),M(E,_,g,w)},rt}var Nt={},Bt={},Xt;function ce(){return Xt||(Xt=1,(function(t){function n(i){if(typeof i=="number"&&(i=i.toString()),typeof i!="string")throw new Error("Color should be defined as hex string");let r=i.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+i);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(o){return[o,o]}))),r.length===6&&r.push("F","F");const e=parseInt(r.join(""),16);return{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:e&255,hex:"#"+r.slice(0,6).join("")}}t.getOptions=function(r){r||(r={}),r.color||(r.color={});const e=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,o=r.width&&r.width>=21?r.width:void 0,s=r.scale||4;return{width:o,scale:o?4:s,margin:e,color:{dark:n(r.color.dark||"#000000ff"),light:n(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},t.getScale=function(r,e){return e.width&&e.width>=r+e.margin*2?e.width/(r+e.margin*2):e.scale},t.getImageWidth=function(r,e){const o=t.getScale(r,e);return Math.floor((r+e.margin*2)*o)},t.qrToImageData=function(r,e,o){const s=e.modules.size,a=e.modules.data,u=t.getScale(s,o),c=Math.floor((s+o.margin*2)*u),p=o.margin*u,C=[o.color.light,o.color.dark];for(let B=0;B<c;B++)for(let f=0;f<c;f++){let L=(B*c+f)*4,A=o.color.light;if(B>=p&&f>=p&&B<c-p&&f<c-p){const S=Math.floor((B-p)/u),I=Math.floor((f-p)/u);A=C[a[S*s+I]?1:0]}r[L++]=A.r,r[L++]=A.g,r[L++]=A.b,r[L]=A.a}}})(Bt)),Bt}var Zt;function nn(){return Zt||(Zt=1,(function(t){const n=ce();function i(e,o,s){e.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=s,o.width=s,o.style.height=s+"px",o.style.width=s+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(o,s,a){let u=a,c=s;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),s||(c=r()),u=n.getOptions(u);const p=n.getImageWidth(o.modules.size,u),C=c.getContext("2d"),B=C.createImageData(p,p);return n.qrToImageData(B.data,o,u),i(C,c,p),C.putImageData(B,0,0),c},t.renderToDataURL=function(o,s,a){let u=a;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),u||(u={});const c=t.render(o,s,u),p=u.type||"image/png",C=u.rendererOpts||{};return c.toDataURL(p,C.quality)}})(Nt)),Nt}var St={},te;function rn(){if(te)return St;te=1;const t=ce();function n(e,o){const s=e.a/255,a=o+'="'+e.hex+'"';return s<1?a+" "+o+'-opacity="'+s.toFixed(2).slice(1)+'"':a}function i(e,o,s){let a=e+o;return typeof s<"u"&&(a+=" "+s),a}function r(e,o,s){let a="",u=0,c=!1,p=0;for(let C=0;C<e.length;C++){const B=Math.floor(C%o),f=Math.floor(C/o);!B&&!c&&(c=!0),e[C]?(p++,C>0&&B>0&&e[C-1]||(a+=c?i("M",B+s,.5+f+s):i("m",u,0),u=0,c=!1),B+1<o&&e[C+1]||(a+=i("h",p),p=0)):u++}return a}return St.render=function(o,s,a){const u=t.getOptions(s),c=o.modules.size,p=o.modules.data,C=c+u.margin*2,B=u.color.light.a?"<path "+n(u.color.light,"fill")+' d="M0 0h'+C+"v"+C+'H0z"/>':"",f="<path "+n(u.color.dark,"stroke")+' d="'+r(p,c,u.margin)+'"/>',L='viewBox="0 0 '+C+" "+C+'"',S='<svg xmlns="http://www.w3.org/2000/svg" '+(u.width?'width="'+u.width+'" height="'+u.width+'" ':"")+L+' shape-rendering="crispEdges">'+B+f+`</svg>
9
- `;return typeof a=="function"&&a(null,S),S},St}var ee;function on(){if(ee)return V;ee=1;const t=qe(),n=en(),i=nn(),r=rn();function e(o,s,a,u,c){const p=[].slice.call(arguments,1),C=p.length,B=typeof p[C-1]=="function";if(!B&&!t())throw new Error("Callback required as last argument");if(B){if(C<2)throw new Error("Too few arguments provided");C===2?(c=a,a=s,s=u=void 0):C===3&&(s.getContext&&typeof c>"u"?(c=u,u=void 0):(c=u,u=a,a=s,s=void 0))}else{if(C<1)throw new Error("Too few arguments provided");return C===1?(a=s,s=u=void 0):C===2&&!s.getContext&&(u=a,a=s,s=void 0),new Promise(function(f,L){try{const A=n.create(a,u);f(o(A,s,u))}catch(A){L(A)}})}try{const f=n.create(a,u);c(null,o(f,s,u))}catch(f){c(f)}}return V.create=n.create,V.toCanvas=e.bind(null,i.render),V.toDataURL=e.bind(null,i.renderToDataURL),V.toString=e.bind(null,function(o,s,a){return r.render(o,a)}),V}var sn=on();const an=Ee(sn),un="_qr_lnaw6_1",cn="_placeholder_lnaw6_2",ne={qr:un,placeholder:cn},ln=320;function le({value:t,label:n}){const[i,r]=P.useState(null),[e,o]=P.useState(!1);return P.useEffect(()=>{let s=!0;return r(null),o(!1),an.toDataURL(t,{width:ln,margin:1,errorCorrectionLevel:"M"}).then(a=>{s&&r(a)}).catch(()=>{s&&o(!0)}),()=>{s=!1}},[t]),e?null:i?l.jsx("img",{className:ne.qr,src:i,alt:n}):l.jsx("div",{className:ne.placeholder,"aria-hidden":"true"})}const O=we()((t,n)=>({pendingLogin:null,requestLogin:(i,r,e)=>{n().pendingLogin||t({pendingLogin:{provider:i,providerName:r,authType:e,controller:new AbortController,attempt:0}})},cancelLogin:()=>{var i;(i=n().pendingLogin)==null||i.controller.abort(),t({pendingLogin:null})},clearLogin:()=>t({pendingLogin:null}),retryLogin:()=>{const i=n().pendingLogin;i&&t({pendingLogin:{provider:i.provider,providerName:i.providerName,authType:i.authType,controller:new AbortController,attempt:i.attempt+1}})}})),dn="_body_1yyw5_1",fn="_status_1yyw5_11",gn="_statusLine_1yyw5_17",hn="_statusLineProgress_1yyw5_18",pn="_statusText_1yyw5_28",mn="_prompt_1yyw5_40",wn="_promptMessage_1yyw5_46",yn="_options_1yyw5_51",Cn="_option_1yyw5_51",En="_optionLabel_1yyw5_76",Nn="_optionDescription_1yyw5_81",Bn="_success_1yyw5_86",Sn="_error_1yyw5_91",In="_oauth_1yyw5_98",_n="_oauthInstructions_1yyw5_107",bn="_oauthMain_1yyw5_115",Rn="_oauthActions_1yyw5_123",An="_openButton_1yyw5_135",Ln="_urlRow_1yyw5_156",vn="_oauthUrl_1yyw5_164",Tn="_oauthQr_1yyw5_175",Mn="_oauthQrCaption_1yyw5_184",Pn="_deviceCode_1yyw5_191",jn="_countdown_1yyw5_198",T={body:dn,status:fn,statusLine:gn,statusLineProgress:hn,statusText:pn,prompt:mn,promptMessage:wn,options:yn,option:Cn,optionLabel:En,optionDescription:Nn,success:Bn,error:Sn,oauth:In,oauthInstructions:_n,oauthMain:bn,oauthActions:Rn,openButton:An,urlRow:Ln,oauthUrl:vn,oauthQr:Tn,oauthQrCaption:Mn,deviceCode:Pn,countdown:jn},Dn=1200,de="provider-auth-prompt-form";function xn(){const t=O(a=>a.pendingLogin),n=O(a=>a.cancelLogin),i=O(a=>a.clearLogin),r=O(a=>a.retryLogin),e=re(a=>a.client),o=be(),s=P.useCallback(()=>{o.invalidateQueries({queryKey:Ne.providerAuthList()})},[o]);return!t||!e?null:l.jsx(kn,{provider:t.provider,providerName:t.providerName,authType:t.authType,controller:t.controller,client:e,onCancel:n,onClear:i,onRetry:r,onSuccess:s},`${t.provider}:${t.authType}:${t.attempt}`)}function kn({provider:t,providerName:n,authType:i,controller:r,client:e,onCancel:o,onClear:s,onRetry:a,onSuccess:u}){var _,w,N,y;const[c,p]=P.useReducer(Ue,ve(t,i)),C=P.useRef(null),B=P.useRef(!1),f=P.useRef(!1),[L,A]=P.useState(""),[S,I]=P.useState(null);P.useEffect(()=>(f.current=!0,B.current||(B.current=!0,e.loginProvider(t,i,{prompt:d=>new Promise((j,q)=>{var Y;C.current={promptId:d.promptId,resolve:j,reject:q},p({kind:"prompt",...d}),(Y=d.signal)==null||Y.addEventListener("abort",()=>{var H;((H=C.current)==null?void 0:H.promptId)===d.promptId&&(C.current=null),A(""),p({kind:"prompt_cancelled",promptId:d.promptId})},{once:!0})}),onEvent:d=>p(d)},{signal:r.signal}).then(d=>{f.current&&p({kind:"done",ok:d.ok,error:d.error})}).catch(d=>{f.current&&p({kind:"done",ok:!1,error:d instanceof Error?d.message:String(d)})})),()=>{var d;f.current=!1,(d=C.current)==null||d.reject(new Error("login dialog closed")),C.current=null}),[]),P.useEffect(()=>{var j;if(c.phase!=="done"||!((j=c.result)!=null&&j.ok))return;u();const d=setTimeout(s,Dn);return()=>clearTimeout(d)},[c.phase,(_=c.result)==null?void 0:_.ok,u,s]);function v(d){const j=C.current;j&&(C.current=null,I(j.promptId),A(""),j.resolve(d))}function R(d){d.preventDefault(),v(L)}function b(d){d||(c.phase==="done"?s():o())}const M=c.phase==="done",h=M&&((w=c.result)==null?void 0:w.ok)===!0,E=M&&((N=c.result)==null?void 0:N.ok)===!1,m=c.phase==="prompt"&&c.prompt&&c.prompt.promptId!==S?c.prompt:void 0,g=m&&m.promptKind!=="select"?m:void 0;return l.jsx(oe,{open:!0,onOpenChange:b,title:`Log in to ${n}`,width:480,footer:M?l.jsxs(l.Fragment,{children:[l.jsx(G,{variant:"ghost",onClick:s,children:"Close"}),E&&l.jsx(G,{onClick:a,children:"Try again"})]}):l.jsxs(l.Fragment,{children:[l.jsx(G,{variant:"ghost",onClick:o,children:"Cancel"}),g&&l.jsx(G,{type:"submit",form:de,children:"Submit"})]}),children:l.jsxs("div",{className:T.body,children:[l.jsx(Un,{state:c}),!M&&c.authUrl&&l.jsx(zn,{authUrl:c.authUrl,showInstructions:!g}),!M&&c.deviceCode&&l.jsx(Vn,{deviceCode:c.deviceCode,stopped:M}),m&&l.jsx(qn,{prompt:m,inputValue:L,onInputChange:A,onTextSubmit:R,onSelect:v}),h&&l.jsx("p",{className:T.success,children:"Signed in. Closing…"}),E&&l.jsx("p",{className:T.error,children:((y=c.result)==null?void 0:y.error)??"Login failed."})]})})}function Un({state:t}){return t.statusLines.length===0&&t.phase!=="starting"?null:l.jsxs("div",{className:T.status,children:[t.phase==="starting"&&l.jsxs("div",{className:T.statusLine,children:[l.jsx(It,{size:"sm"})," Starting…"]}),t.statusLines.map((n,i)=>{var r;return l.jsxs("div",{className:n.kind==="progress"?T.statusLineProgress:T.statusLine,children:[n.kind==="progress"&&l.jsx(It,{size:"sm"}),l.jsxs("span",{className:T.statusText,children:[l.jsx("span",{children:n.message}),(r=n.links)==null?void 0:r.map(e=>l.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:e.label??e.url},e.url))]})]},i)})]})}function qn({prompt:t,inputValue:n,onInputChange:i,onTextSubmit:r,onSelect:e}){var o;return t.promptKind==="select"?l.jsxs("div",{className:T.prompt,children:[l.jsx("p",{className:T.promptMessage,children:t.message}),l.jsx("div",{className:T.options,children:(o=t.options)==null?void 0:o.map(s=>l.jsxs("button",{type:"button",className:T.option,onClick:()=>e(s.id),children:[l.jsx("span",{className:T.optionLabel,children:s.label}),s.description&&l.jsx("span",{className:T.optionDescription,children:s.description})]},s.id))})]}):l.jsxs("form",{id:de,className:T.prompt,onSubmit:r,children:[l.jsx("label",{className:T.promptMessage,htmlFor:"login-prompt-input",children:t.message}),l.jsx(Be,{id:"login-prompt-input",autoFocus:!0,type:t.promptKind==="secret"?"password":"text",autoComplete:t.promptKind==="secret"?"off":void 0,"data-1p-ignore":t.promptKind==="secret"?"true":void 0,"data-lpignore":t.promptKind==="secret"?"true":void 0,"data-bwignore":t.promptKind==="secret"?"true":void 0,placeholder:t.placeholder,value:n,onChange:s=>i(s.target.value)})]})}const Fn=1800;function fe({value:t,label:n}){const[i,r]=P.useState(!1);return P.useEffect(()=>{if(!i)return;const e=setTimeout(()=>r(!1),Fn);return()=>clearTimeout(e)},[i]),l.jsx(Se,{size:"sm","aria-label":i?"Copied":n,title:i?"Copied":n,onClick:()=>{Ie(t).then(()=>r(!0),()=>r(!1))},children:i?l.jsx(Re,{size:14}):l.jsx(Ae,{size:14})})}function zn({authUrl:t,showInstructions:n}){return l.jsxs("div",{className:T.oauth,children:[n&&t.instructions&&l.jsx("p",{className:T.oauthInstructions,children:t.instructions}),l.jsxs("div",{className:T.oauthMain,children:[l.jsxs("div",{className:T.oauthActions,children:[l.jsxs("a",{className:T.openButton,href:t.url,target:"_blank",rel:"noreferrer",children:[l.jsx(ie,{size:14}),"Open login page"]}),l.jsxs("div",{className:T.urlRow,children:[l.jsx("span",{className:T.oauthUrl,children:t.url}),l.jsx(fe,{value:t.url,label:"Copy link"})]})]}),l.jsxs("div",{className:T.oauthQr,children:[l.jsx(le,{value:t.url,label:"QR code for the provider's login page"}),l.jsx("span",{className:T.oauthQrCaption,children:"Scan on another device"})]})]})]})}function Kn(t){const n=Math.max(0,t),i=Math.floor(n/60),r=n%60;return`${i}:${String(r).padStart(2,"0")}`}function Vn({deviceCode:t,stopped:n}){const[i,r]=P.useState(t.expiresInSeconds);return P.useEffect(()=>{if(n||t.expiresInSeconds===void 0)return;r(t.expiresInSeconds);const e=setInterval(()=>{r(o=>o===void 0?void 0:Math.max(0,o-1))},1e3);return()=>clearInterval(e)},[t.expiresInSeconds,n]),l.jsx("div",{className:T.oauth,children:l.jsxs("div",{className:T.oauthMain,children:[l.jsxs("div",{className:T.oauthActions,children:[l.jsx("span",{className:T.oauthInstructions,children:"Enter this code at the verification page"}),l.jsxs("div",{className:T.urlRow,children:[l.jsx("span",{className:T.deviceCode,children:t.userCode}),l.jsx(fe,{value:t.userCode,label:"Copy code"})]}),l.jsxs("a",{className:T.openButton,href:t.verificationUri,target:"_blank",rel:"noreferrer",children:[l.jsx(ie,{size:14}),"Open verification page"]}),i!==void 0&&l.jsx("span",{className:T.countdown,children:i>0?`Expires in ${Kn(i)}`:"Code expired"})]}),l.jsxs("div",{className:T.oauthQr,children:[l.jsx(le,{value:t.verificationUri,label:"QR code for the verification page"}),l.jsx("span",{className:T.oauthQrCaption,children:"Scan on another device"})]})]})})}const On="_shell_13hat_7",Hn="_sidebar_13hat_14",Qn="_category_13hat_24",Jn="_categoryActive_13hat_44",Yn="_content_13hat_2",J={shell:On,sidebar:Hn,category:Qn,categoryActive:Jn,content:Yn},$n=P.lazy(()=>ye(()=>import("./ModelProvidersPanel-BjVXGAY-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.ModelProvidersPanel}))),ge=[{id:"providers",label:"Model Providers",icon:Le,component:$n,available:t=>t.providerAuth}];function Gn({open:t,onOpenChange:n}){var L,A;const i=re(S=>S.serverInfo),r=O(S=>S.pendingLogin),e=O(S=>S.cancelLogin),o={providerAuth:!!((L=i==null?void 0:i.features)!=null&&L.providerAuth)},s=ge.filter(S=>S.available(o)),[a,u]=P.useState((A=s[0])==null?void 0:A.id);P.useEffect(()=>{var S;s.some(I=>I.id===a)||u((S=s[0])==null?void 0:S.id)},[s.map(S=>S.id).join(",")]);const c=s.find(S=>S.id===a)??s[0],p=c==null?void 0:c.component;function C(S){!S&&r&&e(),n(S)}function B(S){if(r){S.preventDefault();return}const I=S.detail.originalEvent.target;I instanceof Node&&!I.isConnected&&S.preventDefault()}function f(S){r&&S.preventDefault()}return l.jsxs(l.Fragment,{children:[l.jsx(oe,{open:t,onOpenChange:C,title:"Settings",width:900,onInteractOutside:B,onEscapeKeyDown:f,children:l.jsxs("div",{className:J.shell,children:[l.jsx("nav",{className:J.sidebar,children:s.map(S=>l.jsxs("button",{type:"button",className:Ce(J.category,S.id===(c==null?void 0:c.id)&&J.categoryActive),onClick:()=>u(S.id),children:[l.jsx(_e,{icon:S.icon,size:"sm"}),S.label]},S.id))}),l.jsx("div",{className:J.content,children:p?l.jsx(P.Suspense,{fallback:l.jsxs(At,{children:[l.jsx(It,{size:"sm"})," Loading…"]}),children:l.jsx(p,{})}):l.jsx(At,{children:"No settings categories available."})})]})}),l.jsx(xn,{})]})}const nr=Object.freeze(Object.defineProperty({__proto__:null,SETTINGS_CATEGORIES:ge,SettingsDialog:Gn},Symbol.toStringTag,{value:"Module"}));export{nr as S,O as u};
9
+ `;return typeof a=="function"&&a(null,S),S},St}var ee;function on(){if(ee)return V;ee=1;const t=qe(),n=en(),i=nn(),r=rn();function e(o,s,a,u,c){const p=[].slice.call(arguments,1),C=p.length,B=typeof p[C-1]=="function";if(!B&&!t())throw new Error("Callback required as last argument");if(B){if(C<2)throw new Error("Too few arguments provided");C===2?(c=a,a=s,s=u=void 0):C===3&&(s.getContext&&typeof c>"u"?(c=u,u=void 0):(c=u,u=a,a=s,s=void 0))}else{if(C<1)throw new Error("Too few arguments provided");return C===1?(a=s,s=u=void 0):C===2&&!s.getContext&&(u=a,a=s,s=void 0),new Promise(function(f,L){try{const A=n.create(a,u);f(o(A,s,u))}catch(A){L(A)}})}try{const f=n.create(a,u);c(null,o(f,s,u))}catch(f){c(f)}}return V.create=n.create,V.toCanvas=e.bind(null,i.render),V.toDataURL=e.bind(null,i.renderToDataURL),V.toString=e.bind(null,function(o,s,a){return r.render(o,a)}),V}var sn=on();const an=Ee(sn),un="_qr_lnaw6_1",cn="_placeholder_lnaw6_2",ne={qr:un,placeholder:cn},ln=320;function le({value:t,label:n}){const[i,r]=P.useState(null),[e,o]=P.useState(!1);return P.useEffect(()=>{let s=!0;return r(null),o(!1),an.toDataURL(t,{width:ln,margin:1,errorCorrectionLevel:"M"}).then(a=>{s&&r(a)}).catch(()=>{s&&o(!0)}),()=>{s=!1}},[t]),e?null:i?l.jsx("img",{className:ne.qr,src:i,alt:n}):l.jsx("div",{className:ne.placeholder,"aria-hidden":"true"})}const O=we()((t,n)=>({pendingLogin:null,requestLogin:(i,r,e)=>{n().pendingLogin||t({pendingLogin:{provider:i,providerName:r,authType:e,controller:new AbortController,attempt:0}})},cancelLogin:()=>{var i;(i=n().pendingLogin)==null||i.controller.abort(),t({pendingLogin:null})},clearLogin:()=>t({pendingLogin:null}),retryLogin:()=>{const i=n().pendingLogin;i&&t({pendingLogin:{provider:i.provider,providerName:i.providerName,authType:i.authType,controller:new AbortController,attempt:i.attempt+1}})}})),dn="_body_1yyw5_1",fn="_status_1yyw5_11",gn="_statusLine_1yyw5_17",hn="_statusLineProgress_1yyw5_18",pn="_statusText_1yyw5_28",mn="_prompt_1yyw5_40",wn="_promptMessage_1yyw5_46",yn="_options_1yyw5_51",Cn="_option_1yyw5_51",En="_optionLabel_1yyw5_76",Nn="_optionDescription_1yyw5_81",Bn="_success_1yyw5_86",Sn="_error_1yyw5_91",In="_oauth_1yyw5_98",_n="_oauthInstructions_1yyw5_107",bn="_oauthMain_1yyw5_115",Rn="_oauthActions_1yyw5_123",An="_openButton_1yyw5_135",Ln="_urlRow_1yyw5_156",vn="_oauthUrl_1yyw5_164",Tn="_oauthQr_1yyw5_175",Mn="_oauthQrCaption_1yyw5_184",Pn="_deviceCode_1yyw5_191",jn="_countdown_1yyw5_198",T={body:dn,status:fn,statusLine:gn,statusLineProgress:hn,statusText:pn,prompt:mn,promptMessage:wn,options:yn,option:Cn,optionLabel:En,optionDescription:Nn,success:Bn,error:Sn,oauth:In,oauthInstructions:_n,oauthMain:bn,oauthActions:Rn,openButton:An,urlRow:Ln,oauthUrl:vn,oauthQr:Tn,oauthQrCaption:Mn,deviceCode:Pn,countdown:jn},Dn=1200,de="provider-auth-prompt-form";function xn(){const t=O(a=>a.pendingLogin),n=O(a=>a.cancelLogin),i=O(a=>a.clearLogin),r=O(a=>a.retryLogin),e=re(a=>a.client),o=be(),s=P.useCallback(()=>{o.invalidateQueries({queryKey:Ne.providerAuthList()})},[o]);return!t||!e?null:l.jsx(kn,{provider:t.provider,providerName:t.providerName,authType:t.authType,controller:t.controller,client:e,onCancel:n,onClear:i,onRetry:r,onSuccess:s},`${t.provider}:${t.authType}:${t.attempt}`)}function kn({provider:t,providerName:n,authType:i,controller:r,client:e,onCancel:o,onClear:s,onRetry:a,onSuccess:u}){var _,w,N,y;const[c,p]=P.useReducer(Ue,ve(t,i)),C=P.useRef(null),B=P.useRef(!1),f=P.useRef(!1),[L,A]=P.useState(""),[S,I]=P.useState(null);P.useEffect(()=>(f.current=!0,B.current||(B.current=!0,e.loginProvider(t,i,{prompt:d=>new Promise((j,q)=>{var Y;C.current={promptId:d.promptId,resolve:j,reject:q},p({kind:"prompt",...d}),(Y=d.signal)==null||Y.addEventListener("abort",()=>{var H;((H=C.current)==null?void 0:H.promptId)===d.promptId&&(C.current=null),A(""),p({kind:"prompt_cancelled",promptId:d.promptId})},{once:!0})}),onEvent:d=>p(d)},{signal:r.signal}).then(d=>{f.current&&p({kind:"done",ok:d.ok,error:d.error})}).catch(d=>{f.current&&p({kind:"done",ok:!1,error:d instanceof Error?d.message:String(d)})})),()=>{var d;f.current=!1,(d=C.current)==null||d.reject(new Error("login dialog closed")),C.current=null}),[]),P.useEffect(()=>{var j;if(c.phase!=="done"||!((j=c.result)!=null&&j.ok))return;u();const d=setTimeout(s,Dn);return()=>clearTimeout(d)},[c.phase,(_=c.result)==null?void 0:_.ok,u,s]);function v(d){const j=C.current;j&&(C.current=null,I(j.promptId),A(""),j.resolve(d))}function R(d){d.preventDefault(),v(L)}function b(d){d||(c.phase==="done"?s():o())}const M=c.phase==="done",h=M&&((w=c.result)==null?void 0:w.ok)===!0,E=M&&((N=c.result)==null?void 0:N.ok)===!1,m=c.phase==="prompt"&&c.prompt&&c.prompt.promptId!==S?c.prompt:void 0,g=m&&m.promptKind!=="select"?m:void 0;return l.jsx(oe,{open:!0,onOpenChange:b,title:`Log in to ${n}`,width:480,footer:M?l.jsxs(l.Fragment,{children:[l.jsx(G,{variant:"ghost",onClick:s,children:"Close"}),E&&l.jsx(G,{onClick:a,children:"Try again"})]}):l.jsxs(l.Fragment,{children:[l.jsx(G,{variant:"ghost",onClick:o,children:"Cancel"}),g&&l.jsx(G,{type:"submit",form:de,children:"Submit"})]}),children:l.jsxs("div",{className:T.body,children:[l.jsx(Un,{state:c}),!M&&c.authUrl&&l.jsx(zn,{authUrl:c.authUrl,showInstructions:!g}),!M&&c.deviceCode&&l.jsx(Vn,{deviceCode:c.deviceCode,stopped:M}),m&&l.jsx(qn,{prompt:m,inputValue:L,onInputChange:A,onTextSubmit:R,onSelect:v}),h&&l.jsx("p",{className:T.success,children:"Signed in. Closing…"}),E&&l.jsx("p",{className:T.error,children:((y=c.result)==null?void 0:y.error)??"Login failed."})]})})}function Un({state:t}){return t.statusLines.length===0&&t.phase!=="starting"?null:l.jsxs("div",{className:T.status,children:[t.phase==="starting"&&l.jsxs("div",{className:T.statusLine,children:[l.jsx(It,{size:"sm"})," Starting…"]}),t.statusLines.map((n,i)=>{var r;return l.jsxs("div",{className:n.kind==="progress"?T.statusLineProgress:T.statusLine,children:[n.kind==="progress"&&l.jsx(It,{size:"sm"}),l.jsxs("span",{className:T.statusText,children:[l.jsx("span",{children:n.message}),(r=n.links)==null?void 0:r.map(e=>l.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:e.label??e.url},e.url))]})]},i)})]})}function qn({prompt:t,inputValue:n,onInputChange:i,onTextSubmit:r,onSelect:e}){var o;return t.promptKind==="select"?l.jsxs("div",{className:T.prompt,children:[l.jsx("p",{className:T.promptMessage,children:t.message}),l.jsx("div",{className:T.options,children:(o=t.options)==null?void 0:o.map(s=>l.jsxs("button",{type:"button",className:T.option,onClick:()=>e(s.id),children:[l.jsx("span",{className:T.optionLabel,children:s.label}),s.description&&l.jsx("span",{className:T.optionDescription,children:s.description})]},s.id))})]}):l.jsxs("form",{id:de,className:T.prompt,onSubmit:r,children:[l.jsx("label",{className:T.promptMessage,htmlFor:"login-prompt-input",children:t.message}),l.jsx(Be,{id:"login-prompt-input",autoFocus:!0,type:t.promptKind==="secret"?"password":"text",autoComplete:t.promptKind==="secret"?"off":void 0,"data-1p-ignore":t.promptKind==="secret"?"true":void 0,"data-lpignore":t.promptKind==="secret"?"true":void 0,"data-bwignore":t.promptKind==="secret"?"true":void 0,placeholder:t.placeholder,value:n,onChange:s=>i(s.target.value)})]})}const Fn=1800;function fe({value:t,label:n}){const[i,r]=P.useState(!1);return P.useEffect(()=>{if(!i)return;const e=setTimeout(()=>r(!1),Fn);return()=>clearTimeout(e)},[i]),l.jsx(Se,{size:"sm","aria-label":i?"Copied":n,title:i?"Copied":n,onClick:()=>{Ie(t).then(()=>r(!0),()=>r(!1))},children:i?l.jsx(Re,{size:14}):l.jsx(Ae,{size:14})})}function zn({authUrl:t,showInstructions:n}){return l.jsxs("div",{className:T.oauth,children:[n&&t.instructions&&l.jsx("p",{className:T.oauthInstructions,children:t.instructions}),l.jsxs("div",{className:T.oauthMain,children:[l.jsxs("div",{className:T.oauthActions,children:[l.jsxs("a",{className:T.openButton,href:t.url,target:"_blank",rel:"noreferrer",children:[l.jsx(ie,{size:14}),"Open login page"]}),l.jsxs("div",{className:T.urlRow,children:[l.jsx("span",{className:T.oauthUrl,children:t.url}),l.jsx(fe,{value:t.url,label:"Copy link"})]})]}),l.jsxs("div",{className:T.oauthQr,children:[l.jsx(le,{value:t.url,label:"QR code for the provider's login page"}),l.jsx("span",{className:T.oauthQrCaption,children:"Scan on another device"})]})]})]})}function Kn(t){const n=Math.max(0,t),i=Math.floor(n/60),r=n%60;return`${i}:${String(r).padStart(2,"0")}`}function Vn({deviceCode:t,stopped:n}){const[i,r]=P.useState(t.expiresInSeconds);return P.useEffect(()=>{if(n||t.expiresInSeconds===void 0)return;r(t.expiresInSeconds);const e=setInterval(()=>{r(o=>o===void 0?void 0:Math.max(0,o-1))},1e3);return()=>clearInterval(e)},[t.expiresInSeconds,n]),l.jsx("div",{className:T.oauth,children:l.jsxs("div",{className:T.oauthMain,children:[l.jsxs("div",{className:T.oauthActions,children:[l.jsx("span",{className:T.oauthInstructions,children:"Enter this code at the verification page"}),l.jsxs("div",{className:T.urlRow,children:[l.jsx("span",{className:T.deviceCode,children:t.userCode}),l.jsx(fe,{value:t.userCode,label:"Copy code"})]}),l.jsxs("a",{className:T.openButton,href:t.verificationUri,target:"_blank",rel:"noreferrer",children:[l.jsx(ie,{size:14}),"Open verification page"]}),i!==void 0&&l.jsx("span",{className:T.countdown,children:i>0?`Expires in ${Kn(i)}`:"Code expired"})]}),l.jsxs("div",{className:T.oauthQr,children:[l.jsx(le,{value:t.verificationUri,label:"QR code for the verification page"}),l.jsx("span",{className:T.oauthQrCaption,children:"Scan on another device"})]})]})})}const On="_shell_13hat_7",Hn="_sidebar_13hat_14",Qn="_category_13hat_24",Jn="_categoryActive_13hat_44",Yn="_content_13hat_2",J={shell:On,sidebar:Hn,category:Qn,categoryActive:Jn,content:Yn},$n=P.lazy(()=>ye(()=>import("./ModelProvidersPanel-Dwkt1dOR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.ModelProvidersPanel}))),ge=[{id:"providers",label:"Model Providers",icon:Le,component:$n,available:t=>t.providerAuth}];function Gn({open:t,onOpenChange:n}){var L,A;const i=re(S=>S.serverInfo),r=O(S=>S.pendingLogin),e=O(S=>S.cancelLogin),o={providerAuth:!!((L=i==null?void 0:i.features)!=null&&L.providerAuth)},s=ge.filter(S=>S.available(o)),[a,u]=P.useState((A=s[0])==null?void 0:A.id);P.useEffect(()=>{var S;s.some(I=>I.id===a)||u((S=s[0])==null?void 0:S.id)},[s.map(S=>S.id).join(",")]);const c=s.find(S=>S.id===a)??s[0],p=c==null?void 0:c.component;function C(S){!S&&r&&e(),n(S)}function B(S){if(r){S.preventDefault();return}const I=S.detail.originalEvent.target;I instanceof Node&&!I.isConnected&&S.preventDefault()}function f(S){r&&S.preventDefault()}return l.jsxs(l.Fragment,{children:[l.jsx(oe,{open:t,onOpenChange:C,title:"Settings",width:900,onInteractOutside:B,onEscapeKeyDown:f,children:l.jsxs("div",{className:J.shell,children:[l.jsx("nav",{className:J.sidebar,children:s.map(S=>l.jsxs("button",{type:"button",className:Ce(J.category,S.id===(c==null?void 0:c.id)&&J.categoryActive),onClick:()=>u(S.id),children:[l.jsx(_e,{icon:S.icon,size:"sm"}),S.label]},S.id))}),l.jsx("div",{className:J.content,children:p?l.jsx(P.Suspense,{fallback:l.jsxs(At,{children:[l.jsx(It,{size:"sm"})," Loading…"]}),children:l.jsx(p,{})}):l.jsx(At,{children:"No settings categories available."})})]})}),l.jsx(xn,{})]})}const nr=Object.freeze(Object.defineProperty({__proto__:null,SETTINGS_CATEGORIES:ge,SettingsDialog:Gn},Symbol.toStringTag,{value:"Module"}));export{nr as S,O as u};
@@ -1 +1 @@
1
- var ce=Object.defineProperty;var ie=(n,e,t)=>e in n?ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var U=(n,e,t)=>ie(n,typeof e!="symbol"?e+"":e,t);import{r as s,j as b}from"./vendor-react-DQUAl2K8.js";import{x as ue,a as le}from"./vendor-terminal-BhzX2_ts.js";import{e as X,f as ae,T as J,u as fe,g as de,h as me,i as pe,j as Q,S as he,k as Re,l as we}from"./index-0YyDYmrX.js";import"./vendor-2vclEyEB.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";class Se{constructor(e){U(this,"subscribers",new Map);U(this,"detach",null);this.daemon=e}start(){this.detach||(this.detach=this.daemon.onTerminalFrame(e=>this.dispatch(e)))}stop(){var e;(e=this.detach)==null||e.call(this),this.detach=null}subscribeSlot(e,t){return this.subscribers.set(e,t),()=>{this.subscribers.get(e)===t&&this.subscribers.delete(e)}}hasSlot(e){return this.subscribers.has(e)}sendInput(e,t){this.daemon.sendBinary(X({opcode:"Input",slot:e,data:t}))}sendResize(e,t,d){this.daemon.sendBinary(X({opcode:"Resize",slot:e,rows:t,cols:d}))}dispatch(e){var d,R,p;const t=this.subscribers.get(e.slot);if(t)switch(e.opcode){case"Output":(d=t.onOutput)==null||d.call(t,e.data);return;case"Snapshot":(R=t.onSnapshot)==null||R.call(t,e.data);return;case"Restore":(p=t.onRestore)==null||p.call(t,e.data);return;default:return}}}const ye=3e3,Z=`${ae.sm}px ${J}`,ee="M";function te(){if(typeof document>"u"||!document.fonts)return!0;try{return document.fonts.check(Z,ee)}catch{return!0}}const Te=(async()=>{if(typeof document>"u"||!document.fonts||te())return;let n;try{await Promise.race([document.fonts.load(Z,ee),new Promise(e=>{n=window.setTimeout(e,ye)})])}catch{}finally{window.clearTimeout(n)}})(),_e=2,ve=1;function y(n){if(n==null)return!1;const{cols:e,rows:t}=n;return typeof e=="number"&&Number.isInteger(e)&&e>=_e&&typeof t=="number"&&Number.isInteger(t)&&t>=ve}function ge(n,e){return n===null||e===null?n===e:n.cols===e.cols&&n.rows===e.rows}function xe(n,e){return y(n)?!ge(n,e):!1}function be(n,e){if(e===null)return;const t=n.find(R=>R.slot===e);if(!t)return;const d={cols:t.cols,rows:t.rows};return y(d)?d:void 0}const Fe="_wrap_1fx2h_1",Ee="_terminal_1fx2h_12",Ae="_statusOverlay_1fx2h_19",ze="_exitedBanner_1fx2h_30",z={wrap:Fe,terminal:Ee,statusOverlay:Ae,exitedBanner:ze},Oe=64*1024,$=new TextEncoder,K=new WeakMap;function Ne(n){let e=K.get(n);return e||(e=new Se(n),e.start(),K.set(n,e)),e}function Y(n){const e=Q.getState(),t=e.tabs.find(d=>d.id===n);return!t||t.workspaceCwd!==e.activeWorkspaceCwd?!1:Re(we.getState().layouts[t.workspaceCwd],n)}function Le({tab:n}){const e=n.data,t=fe(r=>r.client),d=de(n.id),{settings:R,resolvedTheme:p}=me(),B=R.monoFont&&R.monoFont.trim()!==""?p.fontFamily.mono:J,W=s.useRef(null),w=s.useRef(null),T=s.useRef(null),_=s.useRef(e.slot),O=s.useRef(null),N=s.useRef([]),I=s.useRef(0),F=s.useRef(null),ne=s.useRef(null),E=s.useRef(null),v=s.useRef(null),A=s.useRef(null),k=s.useRef(!1),H=s.useRef(null),V=s.useRef(t);V.current=t;const D=s.useRef(e.exited??!1);D.current=e.exited??!1;const[g,re]=s.useState(e.slot),[j,M]=s.useState({isAttaching:!0,error:null}),[q,se]=s.useState(te);s.useEffect(()=>{if(q)return;let r=!1;return Te.then(()=>{r||se(!0)}),()=>{r=!0}},[q]);const C=()=>{var o,c;const r=(o=T.current)==null?void 0:o.proposeDimensions();(c=E.current)==null||c.call(E,y(r)?r:null)},oe=()=>{var r;A.current=null,k.current=!0,(r=T.current)==null||r.fit(),C(),requestAnimationFrame(()=>{k.current=!1})},P=()=>{v.current!==null&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>{v.current=null,A.current===null&&(A.current=requestAnimationFrame(oe))},60)};s.useEffect(()=>{const r=W.current;if(!r||!q)return;const o=new ue.Terminal({cursorBlink:!0,fontFamily:B,fontSize:p.fontSize.code,scrollback:5e3,theme:p.colors.terminal,allowProposedApi:!0}),c=new le.FitAddon;o.loadAddon(c),o.open(r);const f=u=>{if(!Y(n.id))return;const l=_.current,S=O.current;l===null||!S||xe(u,F.current)&&(F.current=u,S.sendResize(l,u.rows,u.cols))},a=o.onData(u=>{if(D.current)return;const l=_.current,S=O.current;if(l===null||!S){const G=$.encode(u);I.current+G.length<=Oe&&(N.current.push(G),I.current+=G.length);return}S.sendInput(l,$.encode(u))}),m=o.onResize(({cols:u,rows:l})=>{f({cols:u,rows:l})}),h=()=>{c.fit(),C()};r.addEventListener("focusin",h),c.fit(),w.current=o,T.current=c,E.current=f;const i=new ResizeObserver(u=>{if(k.current)return;const l=u[0];l&&(l.contentRect.width===0||l.contentRect.height===0)||P()});return i.observe(r),()=>{i.disconnect(),v.current!==null&&window.clearTimeout(v.current),A.current!==null&&cancelAnimationFrame(A.current),r.removeEventListener("focusin",h),a.dispose(),m.dispose(),o.dispose(),w.current=null,T.current=null,E.current=null}},[q]),s.useEffect(()=>{const r=w.current;if(!r)return;r.options.theme=p.colors.terminal;const o=p.fontSize.code,c=B,f=H.current,a=f!==null&&(f.size!==o||f.family!==c);r.options.fontSize=o,r.options.fontFamily=c,H.current={size:o,family:c},a&&P()},[p,B]),s.useEffect(()=>{if(!e.exited)return;const r=w.current;r&&(r.options.cursorBlink=!1,r.blur())},[e.exited]),s.useEffect(()=>{if(t)return t.connection.onSessionMessage(r=>{const o=r;if(!pe(o))return;const c=be(o.terminals,_.current);c!==void 0&&(F.current=c)})},[t]);const x=s.useRef(!1),L=s.useRef(!1);return s.useEffect(()=>{var f;if(x.current=!0,!t||_.current!==null||L.current)return()=>{x.current=!1};L.current=!0;const r=e.cwd||"~",o=(f=T.current)==null?void 0:f.proposeDimensions(),c=y(o)?o:null;return t.connection.request("create_terminal_request",{workspaceId:"",cwd:r,...c?{cols:c.cols,rows:c.rows}:{}}).then(a=>{const m=a.terminal.slot;if(!x.current){t.connection.request("kill_terminal_request",{slot:m}).catch(()=>{});return}_.current=m,re(m),Q.getState().updateData(n.id,{slot:m});const h={cols:a.terminal.cols,rows:a.terminal.rows};F.current=y(h)?h:null}).catch(a=>{x.current&&M({isAttaching:!1,error:a instanceof Error?a.message:String(a)})}).finally(()=>{L.current=!1}),()=>{x.current=!1}},[t,n.id]),s.useEffect(()=>()=>{const r=_.current;r!==null&&setTimeout(()=>{var o;x.current||D.current||(o=V.current)==null||o.connection.request("kill_terminal_request",{slot:r}).catch(()=>{})},0)},[]),s.useEffect(()=>{var h;if(!t||g===null)return;M({isAttaching:!0,error:null});const r=Ne(t.connection);O.current=r;const o=i=>{var u,l;(u=w.current)==null||u.reset(),(l=w.current)==null||l.write(i)},c=r.subscribeSlot(g,{onOutput:i=>{var u;return(u=w.current)==null?void 0:u.write(i)},onSnapshot:o,onRestore:o});let f=!1;const a=(h=T.current)==null?void 0:h.proposeDimensions(),m=y(a)&&Y(n.id)?a:null;return t.connection.request("subscribe_terminal_request",{slot:g,restoreMode:"reflowable",...m?{cols:m.cols,rows:m.rows}:{}}).then(i=>{if(f)return;M({isAttaching:!1,error:null}),ne.current=(i==null?void 0:i.restoreMode)??"basic";const u=N.current;N.current=[],I.current=0;for(const S of u)r.sendInput(g,S);const l={cols:i==null?void 0:i.cols,rows:i==null?void 0:i.rows};F.current=y(l)?l:m,C()}).catch(i=>{f||(N.current=[],I.current=0,M({isAttaching:!1,error:i instanceof Error?i.message:String(i)}))}),()=>{f=!0,c(),O.current=null,t.connection.request("unsubscribe_terminal_request",{slot:g}).catch(()=>{})}},[t,g]),s.useEffect(()=>{d&&P()},[d]),b.jsxs("div",{className:z.wrap,children:[b.jsx("div",{ref:W,className:z.terminal}),j.error?b.jsxs("div",{className:z.statusOverlay,children:["Terminal error: ",j.error]}):j.isAttaching?b.jsxs("div",{className:z.statusOverlay,children:[b.jsx(he,{size:"sm"})," Starting terminal…"]}):null,e.exited?b.jsx("div",{className:z.exitedBanner,children:"Terminal exited"}):null]})}export{Le as TerminalPanel};
1
+ var ce=Object.defineProperty;var ie=(n,e,t)=>e in n?ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var U=(n,e,t)=>ie(n,typeof e!="symbol"?e+"":e,t);import{r as s,j as b}from"./vendor-react-DQUAl2K8.js";import{x as ue,a as le}from"./vendor-terminal-BhzX2_ts.js";import{e as X,f as ae,T as J,u as fe,g as de,h as me,i as pe,j as Q,S as he,k as Re,l as we}from"./index-C9bHyGYI.js";import"./vendor-2vclEyEB.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";class Se{constructor(e){U(this,"subscribers",new Map);U(this,"detach",null);this.daemon=e}start(){this.detach||(this.detach=this.daemon.onTerminalFrame(e=>this.dispatch(e)))}stop(){var e;(e=this.detach)==null||e.call(this),this.detach=null}subscribeSlot(e,t){return this.subscribers.set(e,t),()=>{this.subscribers.get(e)===t&&this.subscribers.delete(e)}}hasSlot(e){return this.subscribers.has(e)}sendInput(e,t){this.daemon.sendBinary(X({opcode:"Input",slot:e,data:t}))}sendResize(e,t,d){this.daemon.sendBinary(X({opcode:"Resize",slot:e,rows:t,cols:d}))}dispatch(e){var d,R,p;const t=this.subscribers.get(e.slot);if(t)switch(e.opcode){case"Output":(d=t.onOutput)==null||d.call(t,e.data);return;case"Snapshot":(R=t.onSnapshot)==null||R.call(t,e.data);return;case"Restore":(p=t.onRestore)==null||p.call(t,e.data);return;default:return}}}const ye=3e3,Z=`${ae.sm}px ${J}`,ee="M";function te(){if(typeof document>"u"||!document.fonts)return!0;try{return document.fonts.check(Z,ee)}catch{return!0}}const Te=(async()=>{if(typeof document>"u"||!document.fonts||te())return;let n;try{await Promise.race([document.fonts.load(Z,ee),new Promise(e=>{n=window.setTimeout(e,ye)})])}catch{}finally{window.clearTimeout(n)}})(),_e=2,ve=1;function y(n){if(n==null)return!1;const{cols:e,rows:t}=n;return typeof e=="number"&&Number.isInteger(e)&&e>=_e&&typeof t=="number"&&Number.isInteger(t)&&t>=ve}function ge(n,e){return n===null||e===null?n===e:n.cols===e.cols&&n.rows===e.rows}function xe(n,e){return y(n)?!ge(n,e):!1}function be(n,e){if(e===null)return;const t=n.find(R=>R.slot===e);if(!t)return;const d={cols:t.cols,rows:t.rows};return y(d)?d:void 0}const Fe="_wrap_1fx2h_1",Ee="_terminal_1fx2h_12",Ae="_statusOverlay_1fx2h_19",ze="_exitedBanner_1fx2h_30",z={wrap:Fe,terminal:Ee,statusOverlay:Ae,exitedBanner:ze},Oe=64*1024,$=new TextEncoder,K=new WeakMap;function Ne(n){let e=K.get(n);return e||(e=new Se(n),e.start(),K.set(n,e)),e}function Y(n){const e=Q.getState(),t=e.tabs.find(d=>d.id===n);return!t||t.workspaceCwd!==e.activeWorkspaceCwd?!1:Re(we.getState().layouts[t.workspaceCwd],n)}function Le({tab:n}){const e=n.data,t=fe(r=>r.client),d=de(n.id),{settings:R,resolvedTheme:p}=me(),B=R.monoFont&&R.monoFont.trim()!==""?p.fontFamily.mono:J,W=s.useRef(null),w=s.useRef(null),T=s.useRef(null),_=s.useRef(e.slot),O=s.useRef(null),N=s.useRef([]),I=s.useRef(0),F=s.useRef(null),ne=s.useRef(null),E=s.useRef(null),v=s.useRef(null),A=s.useRef(null),k=s.useRef(!1),H=s.useRef(null),V=s.useRef(t);V.current=t;const D=s.useRef(e.exited??!1);D.current=e.exited??!1;const[g,re]=s.useState(e.slot),[j,M]=s.useState({isAttaching:!0,error:null}),[q,se]=s.useState(te);s.useEffect(()=>{if(q)return;let r=!1;return Te.then(()=>{r||se(!0)}),()=>{r=!0}},[q]);const C=()=>{var o,c;const r=(o=T.current)==null?void 0:o.proposeDimensions();(c=E.current)==null||c.call(E,y(r)?r:null)},oe=()=>{var r;A.current=null,k.current=!0,(r=T.current)==null||r.fit(),C(),requestAnimationFrame(()=>{k.current=!1})},P=()=>{v.current!==null&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>{v.current=null,A.current===null&&(A.current=requestAnimationFrame(oe))},60)};s.useEffect(()=>{const r=W.current;if(!r||!q)return;const o=new ue.Terminal({cursorBlink:!0,fontFamily:B,fontSize:p.fontSize.code,scrollback:5e3,theme:p.colors.terminal,allowProposedApi:!0}),c=new le.FitAddon;o.loadAddon(c),o.open(r);const f=u=>{if(!Y(n.id))return;const l=_.current,S=O.current;l===null||!S||xe(u,F.current)&&(F.current=u,S.sendResize(l,u.rows,u.cols))},a=o.onData(u=>{if(D.current)return;const l=_.current,S=O.current;if(l===null||!S){const G=$.encode(u);I.current+G.length<=Oe&&(N.current.push(G),I.current+=G.length);return}S.sendInput(l,$.encode(u))}),m=o.onResize(({cols:u,rows:l})=>{f({cols:u,rows:l})}),h=()=>{c.fit(),C()};r.addEventListener("focusin",h),c.fit(),w.current=o,T.current=c,E.current=f;const i=new ResizeObserver(u=>{if(k.current)return;const l=u[0];l&&(l.contentRect.width===0||l.contentRect.height===0)||P()});return i.observe(r),()=>{i.disconnect(),v.current!==null&&window.clearTimeout(v.current),A.current!==null&&cancelAnimationFrame(A.current),r.removeEventListener("focusin",h),a.dispose(),m.dispose(),o.dispose(),w.current=null,T.current=null,E.current=null}},[q]),s.useEffect(()=>{const r=w.current;if(!r)return;r.options.theme=p.colors.terminal;const o=p.fontSize.code,c=B,f=H.current,a=f!==null&&(f.size!==o||f.family!==c);r.options.fontSize=o,r.options.fontFamily=c,H.current={size:o,family:c},a&&P()},[p,B]),s.useEffect(()=>{if(!e.exited)return;const r=w.current;r&&(r.options.cursorBlink=!1,r.blur())},[e.exited]),s.useEffect(()=>{if(t)return t.connection.onSessionMessage(r=>{const o=r;if(!pe(o))return;const c=be(o.terminals,_.current);c!==void 0&&(F.current=c)})},[t]);const x=s.useRef(!1),L=s.useRef(!1);return s.useEffect(()=>{var f;if(x.current=!0,!t||_.current!==null||L.current)return()=>{x.current=!1};L.current=!0;const r=e.cwd||"~",o=(f=T.current)==null?void 0:f.proposeDimensions(),c=y(o)?o:null;return t.connection.request("create_terminal_request",{workspaceId:"",cwd:r,...c?{cols:c.cols,rows:c.rows}:{}}).then(a=>{const m=a.terminal.slot;if(!x.current){t.connection.request("kill_terminal_request",{slot:m}).catch(()=>{});return}_.current=m,re(m),Q.getState().updateData(n.id,{slot:m});const h={cols:a.terminal.cols,rows:a.terminal.rows};F.current=y(h)?h:null}).catch(a=>{x.current&&M({isAttaching:!1,error:a instanceof Error?a.message:String(a)})}).finally(()=>{L.current=!1}),()=>{x.current=!1}},[t,n.id]),s.useEffect(()=>()=>{const r=_.current;r!==null&&setTimeout(()=>{var o;x.current||D.current||(o=V.current)==null||o.connection.request("kill_terminal_request",{slot:r}).catch(()=>{})},0)},[]),s.useEffect(()=>{var h;if(!t||g===null)return;M({isAttaching:!0,error:null});const r=Ne(t.connection);O.current=r;const o=i=>{var u,l;(u=w.current)==null||u.reset(),(l=w.current)==null||l.write(i)},c=r.subscribeSlot(g,{onOutput:i=>{var u;return(u=w.current)==null?void 0:u.write(i)},onSnapshot:o,onRestore:o});let f=!1;const a=(h=T.current)==null?void 0:h.proposeDimensions(),m=y(a)&&Y(n.id)?a:null;return t.connection.request("subscribe_terminal_request",{slot:g,restoreMode:"reflowable",...m?{cols:m.cols,rows:m.rows}:{}}).then(i=>{if(f)return;M({isAttaching:!1,error:null}),ne.current=(i==null?void 0:i.restoreMode)??"basic";const u=N.current;N.current=[],I.current=0;for(const S of u)r.sendInput(g,S);const l={cols:i==null?void 0:i.cols,rows:i==null?void 0:i.rows};F.current=y(l)?l:m,C()}).catch(i=>{f||(N.current=[],I.current=0,M({isAttaching:!1,error:i instanceof Error?i.message:String(i)}))}),()=>{f=!0,c(),O.current=null,t.connection.request("unsubscribe_terminal_request",{slot:g}).catch(()=>{})}},[t,g]),s.useEffect(()=>{d&&P()},[d]),b.jsxs("div",{className:z.wrap,children:[b.jsx("div",{ref:W,className:z.terminal}),j.error?b.jsxs("div",{className:z.statusOverlay,children:["Terminal error: ",j.error]}):j.isAttaching?b.jsxs("div",{className:z.statusOverlay,children:[b.jsx(he,{size:"sm"})," Starting terminal…"]}):null,e.exited?b.jsx("div",{className:z.exitedBanner,children:"Terminal exited"}):null]})}export{Le as TerminalPanel};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-DQUAl2K8.js";import{E as r,S as t,B as a,P as c}from"./index-0YyDYmrX.js";import{u as m,C as d}from"./CodeView-BPVY3a-_.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-CtRGxKJM.js";const x="_note_1g5yz_1",j="_body_1g5yz_9",g="_tooLarge_1g5yz_13",i={note:x,body:j,tooLarge:g};function n(o){return`${(o/(1024*1024)).toFixed(1)} MB`}function b({path:o}){const s=m(o);switch(s.kind){case"loading":return e.jsxs(r,{children:[e.jsx(t,{size:"sm"})," Loading..."]});case"inline":return e.jsx(d,{path:o,content:s.content});case"streaming":return e.jsxs(r,{children:[e.jsx(t,{size:"sm"})," Streaming ",n(s.size)," file..."]});case"stream-error":return e.jsxs(r,{children:["Error: ",s.message]});case"streamed":return e.jsxs(c,{children:[e.jsxs("div",{className:i.note,children:[n(s.size)," file streamed"]}),e.jsx("div",{className:i.body,children:e.jsx(d,{path:o,content:s.content})})]});case"too-large":{const l=o.split("/").pop()||o;return e.jsx(r,{children:e.jsxs("div",{className:i.tooLarge,children:[e.jsxs("div",{children:[n(s.size)," — too large to display (display ceiling is"," ",n(s.maxDisplayBytes),")."]}),s.downloading?e.jsx(t,{size:"sm"}):s.downloadUrl?e.jsx("a",{href:s.downloadUrl,download:s.downloadName||l,children:e.jsx(a,{size:"sm",children:"Save file"})}):e.jsx(a,{size:"sm",onClick:()=>s.requestDownload(),children:"Download"})]})})}case"error":return e.jsxs(r,{children:["Error: ",s.message]})}}export{b as TextViewer};
1
+ import{j as e}from"./vendor-react-DQUAl2K8.js";import{E as r,S as t,B as a,P as c}from"./index-C9bHyGYI.js";import{u as m,C as d}from"./CodeView-CScb4RiO.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-C8bUEJxW.js";const x="_note_1g5yz_1",j="_body_1g5yz_9",g="_tooLarge_1g5yz_13",i={note:x,body:j,tooLarge:g};function n(o){return`${(o/(1024*1024)).toFixed(1)} MB`}function b({path:o}){const s=m(o);switch(s.kind){case"loading":return e.jsxs(r,{children:[e.jsx(t,{size:"sm"})," Loading..."]});case"inline":return e.jsx(d,{path:o,content:s.content});case"streaming":return e.jsxs(r,{children:[e.jsx(t,{size:"sm"})," Streaming ",n(s.size)," file..."]});case"stream-error":return e.jsxs(r,{children:["Error: ",s.message]});case"streamed":return e.jsxs(c,{children:[e.jsxs("div",{className:i.note,children:[n(s.size)," file streamed"]}),e.jsx("div",{className:i.body,children:e.jsx(d,{path:o,content:s.content})})]});case"too-large":{const l=o.split("/").pop()||o;return e.jsx(r,{children:e.jsxs("div",{className:i.tooLarge,children:[e.jsxs("div",{children:[n(s.size)," — too large to display (display ceiling is"," ",n(s.maxDisplayBytes),")."]}),s.downloading?e.jsx(t,{size:"sm"}):s.downloadUrl?e.jsx("a",{href:s.downloadUrl,download:s.downloadName||l,children:e.jsx(a,{size:"sm",children:"Save file"})}):e.jsx(a,{size:"sm",onClick:()=>s.requestDownload(),children:"Download"})]})})}case"error":return e.jsxs(r,{children:["Error: ",s.message]})}}export{b as TextViewer};
@@ -1 +1 @@
1
- import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as e,S as t}from"./index-0YyDYmrX.js";import{u as n}from"./use-file-download-CtRGxKJM.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";const a="_wrap_gy3e6_1",d="_video_gy3e6_10",s={wrap:a,video:d};function v({path:i,workspaceCwd:m}){const r=n(i);return r.isLoading?o.jsxs(e,{children:[o.jsx(t,{size:"sm"})," Loading video..."]}):r.isError?o.jsxs(e,{children:["Error: ",r.error instanceof Error?r.error.message:"unknown error"]}):r.data?o.jsx("div",{className:s.wrap,children:o.jsx("video",{className:s.video,src:r.data.objectUrl,controls:!0})}):null}export{v as VideoViewer};
1
+ import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as e,S as t}from"./index-C9bHyGYI.js";import{u as n}from"./use-file-download-C8bUEJxW.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-2vclEyEB.js";import"./vendor-icons-BA_PiM8g.js";import"./vendor-overlays-wWoMzb65.js";import"./vendor-dnd-CayJj8TC.js";const a="_wrap_gy3e6_1",d="_video_gy3e6_10",s={wrap:a,video:d};function v({path:i,workspaceCwd:m}){const r=n(i);return r.isLoading?o.jsxs(e,{children:[o.jsx(t,{size:"sm"})," Loading video..."]}):r.isError?o.jsxs(e,{children:["Error: ",r.error instanceof Error?r.error.message:"unknown error"]}):r.data?o.jsx("div",{className:s.wrap,children:o.jsx("video",{className:s.video,src:r.data.objectUrl,controls:!0})}):null}export{v as VideoViewer};
@@ -1 +1 @@
1
- import{n as l,r as o,c as i}from"./index-0YyDYmrX.js";const u=/^([a-zA-Z][a-zA-Z0-9+.-]*):/;function d(n){try{return decodeURIComponent(n)}catch{return n}}function p(n,a,r){const s=n.trim();if(!s)return null;const e=s.split(/[?#]/,1)[0];if(!e||u.exec(e))return null;let t;if(e.startsWith("/")?t=e:e==="~"||e.startsWith("~/")?t=r?l(e,r):null:t=o(e,a??""),!t)return null;const c=i(t);return d(c)}export{u as S,d as p,p as r};
1
+ import{n as l,r as o,c as i}from"./index-C9bHyGYI.js";const u=/^([a-zA-Z][a-zA-Z0-9+.-]*):/;function d(n){try{return decodeURIComponent(n)}catch{return n}}function p(n,a,r){const s=n.trim();if(!s)return null;const e=s.split(/[?#]/,1)[0];if(!e||u.exec(e))return null;let t;if(e.startsWith("/")?t=e:e==="~"||e.startsWith("~/")?t=r?l(e,r):null:t=o(e,a??""),!t)return null;const c=i(t);return d(c)}export{u as S,d as p,p as r};