@av-pi-studio/web-client 0.0.110 → 0.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{BinaryFallbackViewer-DpOfwwlU.js → BinaryFallbackViewer-CSbPntox.js} +1 -1
- package/dist/web/assets/{ChatPanel-8dn4l9xC.js → ChatPanel-BKlvAZdq.js} +1 -1
- package/dist/web/assets/{CodeView-LdafEiaJ.js → CodeView-BtHrI9KP.js} +1 -1
- package/dist/web/assets/{FilePanel-D94WKsxH.js → FilePanel-ywlcSAmX.js} +1 -1
- package/dist/web/assets/{HtmlViewer-CRFlnCxG.js → HtmlViewer-Ct935Cm7.js} +1 -1
- package/dist/web/assets/{ImageViewer-lKcoFTgn.js → ImageViewer-B3Li_xtG.js} +1 -1
- package/dist/web/assets/{MarkdownFileViewer-D6LqyXG0.js → MarkdownFileViewer-CaG8FaWX.js} +1 -1
- package/dist/web/assets/{ModelProvidersPanel-CNeSw_fU.js → ModelProvidersPanel-DTXVCt2J.js} +1 -1
- package/dist/web/assets/{MoleculeViewerPanel-BytUdaiR.js → MoleculeViewerPanel-CsyoepbO.js} +1 -1
- package/dist/web/assets/{SettingsDialog-B1J5u_Ns.js → SettingsDialog-C6TA5tSk.js} +1 -1
- package/dist/web/assets/{TerminalPanel-BWwDblXt.js → TerminalPanel-Dl_Qe91o.js} +1 -1
- package/dist/web/assets/{TextViewer-DsQWUVeF.js → TextViewer-DxhiKUe5.js} +1 -1
- package/dist/web/assets/{VideoViewer-lRbB3YI1.js → VideoViewer-Ctu1uw95.js} +1 -1
- package/dist/web/assets/{ViewersPanel-DEMFfqRy.js → ViewersPanel-B3DJPFi0.js} +1 -1
- package/dist/web/assets/{href-resolution-CfEJwBz3.js → href-resolution-bgv3HgGq.js} +1 -1
- package/dist/web/assets/{index-UMN9kelm.js → index-DawGVQic.js} +4 -4
- package/dist/web/assets/{markdown-CB3yWTpJ.js → markdown-CRfVs-Rh.js} +1 -1
- package/dist/web/assets/{use-file-download-uF5qOkxO.js → use-file-download-TjW4POi1.js} +1 -1
- package/dist/web/assets/{use-file-watch-Ct-kCO-0.js → use-file-watch-Cm5eDhih.js} +1 -1
- package/dist/web/assets/{use-provider-auth-list-4Hw9XtBB.js → use-provider-auth-list-B7wM3n-2.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +3 -3
package/dist/web/assets/{BinaryFallbackViewer-DpOfwwlU.js → BinaryFallbackViewer-CSbPntox.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as e}from"./vendor-react-DQUAl2K8.js";import{S as d,B as a}from"./index-
|
|
1
|
+
import{r as l,j as e}from"./vendor-react-DQUAl2K8.js";import{S as d,B as a}from"./index-DawGVQic.js";import{u as m}from"./use-file-download-TjW4POi1.js";import{F as c}from"./vendor-icons-K8oF_80Q.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DaF96HbP.js";import"./vendor-overlays-3MkedLFU.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 p,j as t}from"./vendor-react-DQUAl2K8.js";import{a as Pt,b as Ft,m as Kt,u as Te}from"./vendor-query-i7fr__Xm.js";import{D as Ce,F as O,G as zt,u as X,H as Ht,I as H,J as $t,K as Wt,B as L,M as Ut,N as at,S as oe,z as Gt,O as Vt,Q as Yt,R as rt,o as Jt,n as Qt,U as Xt,W as Zt,X as en,m as tn,Y as nn,E as sn,Z as ge,r as Be,_ as Ee,$ as on,a0 as me,h as an,a1 as rn,a2 as pe,a3 as cn,a4 as ln,A as dn,P as Qe}from"./index-
|
|
1
|
+
import{r as p,j as t}from"./vendor-react-DQUAl2K8.js";import{a as Pt,b as Ft,m as Kt,u as Te}from"./vendor-query-i7fr__Xm.js";import{D as Ce,F as O,G as zt,u as X,H as Ht,I as H,J as $t,K as Wt,B as L,M as Ut,N as at,S as oe,z as Gt,O as Vt,Q as Yt,R as rt,o as Jt,n as Qt,U as Xt,W as Zt,X as en,m as tn,Y as nn,E as sn,Z as ge,r as Be,_ as Ee,$ as on,a0 as me,h as an,a1 as rn,a2 as pe,a3 as cn,a4 as ln,A as dn,P as Qe}from"./index-DawGVQic.js";import{L as un,G as mn,S as fn,a as hn,P as pn,E as gn,T as it,C as xe,b as qe,B as _n,c as ct,d as lt,A as xn,e as vn,f as kn,U as jn,g as dt,h as yn,i as bn,j as Nn,k as Sn,l as Xe,m as Cn,N as wn,n as Dn}from"./vendor-icons-K8oF_80Q.js";import{u as Tn}from"./use-provider-auth-list-B7wM3n-2.js";import{N as w}from"./vendor-DaF96HbP.js";import{S as ut,M as Re,r as Bn}from"./markdown-CRfVs-Rh.js";import{D as En,p as qn}from"./DiffView-D1TsZBGe.js";import{R as Ae,T as Le,I as mt}from"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";import"./vendor-highlight-Ddi_n-Jh.js";import"./vendor-markdown-DJUOT8ep.js";import"./href-resolution-bgv3HgGq.js";function ft(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 Rn={shell:it,read:gn,edit:pn,write:hn,search:fn,fetch:mn,task:un};function An(e){return Rn[e.kind]??it}function ht(e){switch(e.kind){case"read":case"write":case"edit":return e.path??null;default:return null}}function Ln(e){return e.kind==="write"||e.kind==="edit"||e.kind==="shell"}function In(e){const s=[];if(e.kind==="edit"&&e.diff)s.push({kind:"diff",patch:e.diff});else{const n=Ce(e);n&&s.push({kind:"code",text:n})}return e.output&&s.push({kind:"code",text:e.output}),s}const Ze={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 On(e){return Ze[e.kind]??Ze.task}function Mn(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 Pn(e){return e?(e.endsWith(`
|
|
3
3
|
`)?e.slice(0,-1):e).split(`
|
|
4
4
|
`).length:0}const Fn=500;let ye;function Kn(e,s,n,o){clearTimeout(ye),ye=setTimeout(()=>{ye=void 0,e.invalidateQueries({queryKey:["file"]}),e.invalidateQueries({queryKey:["explorer"]}),s&&n&&s.connection.request("checkout_refresh_request",{cwd:n}).catch(()=>{})},Fn)}function zn({sessionId:e,event:s,timestamp:n,client:o,queryClient:r}){const a=O.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"compaction":s.phase==="completed"&&s.estimatedTokensAfter!==void 0&&zt(e,s.estimatedTokensAfter);break;case"tool_call":{if(s.status==="completed"&&Ln(s.tool)){const c=a.sessions[e],l=(c==null?void 0:c.cwd)||null;Kn(r,o,l,ht(s.tool))}break}}}function Hn(e){const s=X(r=>r.client),n=O(r=>{var a;return((a=r.sessions[e])==null?void 0:a.agentId)??null}),o=Pt();p.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;zn({sessionId:e,event:a,timestamp:l,client:s,queryClient:o})}),[s,n,e,o])}const pt=64;function be(e){return e.clientHeight>0}function $n(e,s,n,o=pt){switch(s.kind){case"scroll":return be(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&&be(n)};case"shown":return{pinned:e,stick:e};case"pin":return{pinned:!0,stick:be(n)}}}function Wn(e){const s=e[e.length-1];return(s==null?void 0:s.kind)==="user"?s.id:null}const Un="_shellRow_1kabp_2",Gn="_rail_1kabp_10",Vn="_disc_1kabp_18",Yn="_connector_1kabp_28",Jn="_content_1kabp_2",Qn="_metaLine_1kabp_40",Xn="_metaTime_1kabp_52",Zn="_forkButton_1kabp_66",z={shellRow:Un,rail:Gn,disc:Vn,connector:Yn,content:Jn,metaLine:Qn,metaTime:Xn,forkButton:Zn};function U({disc:e,discClassName:s,connector:n,meta:o,metaTrailing:r,className:a,children:c}){return t.jsxs("div",{className:z.shellRow,children:[t.jsxs("div",{className:z.rail,children:[t.jsx("span",{className:w(z.disc,s),children:e}),n&&t.jsx("span",{className:z.connector})]}),t.jsxs("div",{className:w(z.content,a),children:[o&&t.jsxs("div",{className:z.metaLine,children:[o,r]}),c]})]})}function et(e){return typeof e=="number"?e:Date.parse(e)}function es(e,s){const n=et(e.entry.createdAt),o=et(s.entry.createdAt);return n!==o?n-o:e.entry.requestId<s.entry.requestId?-1:e.entry.requestId>s.entry.requestId?1:0}function ts(e,s){return[...e.map(o=>({kind:"pending",entry:o})),...s.map(o=>({kind:"resolved",entry:o}))].toSorted(es)}function ns(e){return e.entry.requestId}function gt(e){return e.receivedAt===void 0}const ss=4;function os(e,s){let n=0;const o=e.map(l=>l.kind!=="pending"?{item:l,collapsed:!1}:(n++,{item:l,collapsed:!s&&n>ss})),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 as(e,s){if(e.timeoutMs===void 0)return{show:!1,fraction:0,approximate:!1};const n=Ht(e,s)??0;return{show:!0,fraction:Math.max(0,Math.min(1,n/e.timeoutMs)),approximate:e.receivedAt===void 0}}function _t(e){return e==="editor"}const rs="Esc again to dismiss — the extension gets an empty answer";function is(e,s){return s?{kind:"warning",text:rs}:{kind:"keys",segments:[{key:_t(e)?"⇧↵":"↵",label:"submit"},{key:"Esc",label:"dismiss"}]}}function cs(e){return e?{armed:!1,resolve:!0}:{armed:!0,resolve:!1}}const ls=5,ds=40,us=6;function ms(e){return{mode:e.length>=ls||e.some(n=>n.length>ds)?"stack":"row",scrolls:e.length>us}}function we(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,r as p}from"./index-
|
|
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,r as p}from"./index-DawGVQic.js";import{u as x}from"./use-file-download-TjW4POi1.js";import{Q as S,S as _,T as b,U as B,V as z,W as U}from"./vendor-DaF96HbP.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{N as v}from"./vendor-DaF96HbP.js";import{u as j,r as d,L as w,a as E,e as D,V as K,P as N,B as x,E as l,S as y}from"./index-
|
|
1
|
+
import{r as u,j as s}from"./vendor-react-DQUAl2K8.js";import{N as v}from"./vendor-DaF96HbP.js";import{u as j,r as d,L as w,a as E,e as D,V as K,P as N,B as x,E as l,S as y}from"./index-DawGVQic.js";import{u as k,a as q}from"./vendor-query-i7fr__Xm.js";import{u as z}from"./use-file-watch-Cm5eDhih.js";import{D as S}from"./DiffView-D1TsZBGe.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";function b(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=b(i,f,a,n==="diff"),_=K[p];return s.jsxs(N,{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(S,{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{r as v,j as r}from"./vendor-react-DQUAl2K8.js";import{a as ie,u as ae}from"./vendor-query-i7fr__Xm.js";import{n as ce,a as G,c as le,d as X,u as F,o as ue,E as A,S as R,B as C,r as B,t as de}from"./index-UMN9kelm.js";import{S as fe}from"./Switch-1I6AMAC7.js";import{u as me,C as pe}from"./CodeView-LdafEiaJ.js";import{p as he,S as ge}from"./href-resolution-CfEJwBz3.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-uF5qOkxO.js";const I={maxCount:64,maxBytesPerAsset:2*1024*1024,maxBytesTotal:16*1024*1024};function K(s,t,e){return!(s>=I.maxCount||e>I.maxBytesPerAsset||t+e>I.maxBytesTotal)}function Y(s){return s===""||s.startsWith("#")?"unsupported":s.startsWith("//")||ge.test(s)?"external":null}function xe(s,t,e){return e!==null&&t===e?s:t}function J(s,t,e,n,i=null){const o=s.trim(),u=Y(o);if(u)return{kind:"skip",raw:s,reason:u};const a=he(o);let p;if(a.startsWith("/")?p=a:a==="~"||a.startsWith("~/")?p=i!==null?ce(a,i):null:p=G(a,t),!p)return{kind:"skip",raw:s,reason:"unsupported"};const h=le(p);return h!==e&&!h.startsWith(`${e}/`)?{kind:"skip",raw:s,reason:"outside-workspace"}:{kind:"local",raw:s,path:h,context:n}}const we={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 _e(s){const t=s.lastIndexOf("/"),e=s.lastIndexOf(".");return e<=t?"application/octet-stream":we[s.slice(e+1).toLowerCase()]??"application/octet-stream"}function ve(s){let t="";for(let n=0;n<s.length;n+=32768)t+=String.fromCharCode(...s.subarray(n,n+32768));return btoa(t)}function q(s,t){return`data:${s};base64,${ve(t)}`}const z=/<([a-zA-Z][a-zA-Z0-9]*)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*)(\s*\/?>)/g,O=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/g;function ee(s){const t=new Map;O.lastIndex=0;let e;for(;e=O.exec(s);){const n=e[1].toLowerCase();t.has(n)||t.set(n,e[2]??e[3]??e[4]??"")}return t}function te(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 se(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 ye(s){return s.map(t=>t.descriptor?`${t.url} ${t.descriptor}`:t.url).join(", ")}function $(s,t,e){Y(t.trim())||s.has(t)||s.set(t,{raw:t,context:e})}function ke(s){const t=new Map;z.lastIndex=0;let e;for(;e=z.exec(s);){const n=e[1].toLowerCase(),i=ee(e[2]??"");for(const o of te(n,i)){const u=i.get(o.name)??"";if(o.multi)for(const a of se(u))$(t,a.url,o.context);else $(t,u,o.context)}}return[...t.values()]}function je(s,t){let e=!1;const n=se(s).map(i=>{const o=t[i.url];return o===void 0?i:(e=!0,{url:o,descriptor:i.descriptor})});return e?ye(n):null}function be(s,t){return Object.keys(t).length===0?s:(z.lastIndex=0,s.replace(z,(e,n,i,o)=>{const u=ee(i),a=te(n.toLowerCase(),u);if(a.length===0)return e;const p=new Map(a.map(d=>[d.name,d]));let h=!1;const E=i.replace(O,(d,f,l,w,y)=>{const _=p.get(f.toLowerCase());if(!_)return d;const g=l??w??y??"",b=_.multi?je(g,t):t[g]??null;return b===null?d:(h=!0,`${f}="${b}"`)});return h?`<${n}${E}${o}`:e}))}const P=/url\(\s*(?:"([^"]*)"|'([^']*)'|([^'")\s]*))\s*\)/gi,U=/@font-face\s*\{[^}]*\}/gi;function ne(s,t,e){return s??t??e??""}function Se(s){const t=[];U.lastIndex=0;let e;for(;e=U.exec(s);)t.push([e.index,e.index+e[0].length]);return t}function Ee(s){const t=Se(s),e=new Map;P.lastIndex=0;let n;for(;n=P.exec(s);){const i=ne(n[1],n[2],n[3]),o=t.some(([u,a])=>n.index>=u&&n.index<a)?"font":"image";$(e,i,o)}return[...e.values()]}function Le(s,t){return Object.keys(t).length===0?s:(P.lastIndex=0,s.replace(P,(e,n,i,o)=>{const u=t[ne(n,i,o)];return u===void 0?e:`url("${u}")`}))}const Ae=Object.freeze(["allow-scripts"]),Ce="https://pi-studio-preview.invalid/",Ne="default-src 'none'; img-src data:; style-src 'unsafe-inline' data:; script-src 'unsafe-inline' data:; font-src data:; media-src data:",Te=`<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>`,Re=/<head(\s[^>]*)?>/i,Be=/<html(\s[^>]*)?>/i,Me=/<base[\s/>]/i;function ze(s,t){const e=be(s,t.assets??{}),n=[];t.blockRemote&&n.push(`<meta http-equiv="Content-Security-Policy" content="${Ne}">`),Me.test(e)||(n.push(`<base href="${Ce}">`),n.push(Te));const i=n.join("");if(i==="")return e;const o=Re.exec(e);if(o){const a=o.index+o[0].length;return e.slice(0,a)+i+e.slice(a)}const u=Be.exec(e);if(u){const a=u.index+u[0].length;return e.slice(0,a)+`<head>${i}</head>`+e.slice(a)}return`<head>${i}</head>`+e}const V=6;async function W(s,t,e){let n=0;async function i(){for(;n<s.length;){const o=s[n];n+=1,await e(o)}}await Promise.all(Array.from({length:Math.min(t,s.length)},i))}function Q(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 Pe(s,t){const e={},n=[];let i=0,o=0,u=!1;const a=[];for(const d of s)d.kind==="skip"?n.push({raw:d.raw,reason:d.reason}):a.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(!K(i,o,l.byteLength)){u=!0,p(f,"over-cap");return}if(i+=1,o+=l.byteLength,f[0].context!=="style"){const m=q(_e(d),l);for(const j of f)e[j.raw]=m;return}const w=new TextDecoder().decode(l),y=X(d),_=Ee(w).map(m=>J(m.raw,y,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 b=Q(g);await W([...b.entries()],V,([m,j])=>h(m,j));const N={};for(const m of g){const j=e[m.raw];j!==void 0&&(N[m.raw]=j)}const L=Le(w,N),S=new TextEncoder().encode(L),k=S.byteLength-l.byteLength;if(k>0&&!K(i-1,o-l.byteLength,S.byteLength)){u=!0,p(f,"over-cap");return}o+=k;const T=q("text/css",S);for(const m of f)e[m.raw]=T}const E=Q(a);return await W([...E.entries()],V,([d,f])=>h(d,f)),{assets:e,skipped:n}}const Ie="_wrap_1et27_1",Oe="_toolbar_1et27_7",$e="_modeToggle_1et27_20",De="_controls_1et27_24",He="_switchLabel_1et27_29",Fe="_streamedNote_1et27_37",Ke="_skippedNote_1et27_45",qe="_skippedToggle_1et27_52",Ue="_skippedList_1et27_64",Ve="_body_1et27_69",We="_frame_1et27_73",Qe="_tooLarge_1et27_79",x={wrap:Ie,toolbar:Oe,modeToggle:$e,controls:De,switchLabel:He,streamedNote:Fe,skippedNote:Ke,skippedToggle:qe,skippedList:Ue,body:Ve,frame:We,tooLarge:Qe},Ze=Ae.join(" "),Z=Object.freeze({}),Ge=Object.freeze([]),oe={external:"external","outside-workspace":"outside workspace",unsupported:"unsupported","over-cap":"over cap","fetch-failed":"not found"};function Xe(s){const t=new Map;for(const e of s){const n=oe[e.reason];t.set(n,(t.get(n)??0)+1)}return[...t.entries()].map(([e,n])=>`${n} ${e}`).join(", ")}function Ye(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 M(s){return`${(s/(1024*1024)).toFixed(1)} MB`}function dt({path:s,workspaceCwd:t}){var D,H;const e=me(s),[n,i]=v.useState("preview"),[o,u]=v.useState(!1),[a,p]=v.useState(!1),h=ie(),E=F(c=>c.client),d=F(c=>c.daemon),f=ue(),l=e.kind==="inline"||e.kind==="streamed"?e.content:null,w=v.useMemo(()=>{const c=G(s,t);return c?X(c):null},[s,t]),y=v.useMemo(()=>w!==null?xe(w,t,f):null,[w,t,f]),_=v.useMemo(()=>l===null||w===null||y===null?[]:ke(l).map(c=>J(c.raw,w,y,c.context,f)),[l,w,y,f]),g=v.useMemo(()=>_.some(c=>c.kind==="local"),[_]),b=v.useMemo(()=>_.flatMap(c=>c.kind==="skip"?[{raw:c.raw,reason:c.reason}]:[]),[_]),N=v.useMemo(()=>g&&l!==null?Ye(l):"",[l,g]),L=ae({queryKey:B.htmlAssetBundle(s,N),queryFn:()=>y===null?Promise.resolve({assets:{},skipped:[]}):Pe(_,{root:y,homeDir:f,fetchBytes:async re=>{if(!E||!d)throw new Error("not connected");return(await de(d).download(re)).bytes}}),enabled:g,staleTime:1/0}),S=g?((D=L.data)==null?void 0:D.assets)??Z:Z,k=g?((H=L.data)==null?void 0:H.skipped)??Ge:b,T=v.useMemo(()=>l===null?null:ze(l,{assets:S,blockRemote:o}),[l,S,o]);function m(){h.invalidateQueries({queryKey:B.fileRead(s)}),h.invalidateQueries({queryKey:B.fileDownload(s)}),h.invalidateQueries({queryKey:B.htmlAssetBundleByPath(s)})}switch(e.kind){case"loading":return r.jsxs(A,{children:[r.jsx(R,{size:"sm"})," Loading..."]});case"streaming":return r.jsxs(A,{children:[r.jsx(R,{size:"sm"})," Streaming ",M(e.size)," file..."]});case"stream-error":case"error":return r.jsxs(A,{children:["Error: ",e.message]});case"too-large":{const c=s.split("/").pop()||s;return r.jsx(A,{children:r.jsxs("div",{className:x.tooLarge,children:[r.jsxs("div",{children:[M(e.size)," — too large to display (display ceiling is"," ",M(e.maxDisplayBytes),")."]}),e.downloading?r.jsx(R,{size:"sm"}):e.downloadUrl?r.jsx("a",{href:e.downloadUrl,download:e.downloadName||c,children:r.jsx(C,{size:"sm",children:"Save file"})}):r.jsx(C,{size:"sm",onClick:()=>e.requestDownload(),children:"Download"})]})})}}if(l===null||T===null)return null;if(g&&L.data===void 0)return r.jsxs(A,{children:[r.jsx(R,{size:"sm"})," Loading assets..."]});const j=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(C,{size:"xs",variant:n==="preview"?"default":"ghost",onClick:()=>i("preview"),children:"Preview"}),r.jsx(C,{size:"xs",variant:n==="source"?"default":"ghost",onClick:()=>i("source"),children:"Source"})]}),r.jsxs("div",{className:x.controls,children:[r.jsxs("label",{className:x.switchLabel,children:[r.jsx(fe,{checked:o,onCheckedChange:u,"aria-label":"Block remote resources"}),"Block remote resources"]}),r.jsx(C,{size:"xs",variant:"ghost",onClick:m,children:"Reload"})]})]}),e.kind==="streamed"?r.jsxs("div",{className:x.streamedNote,children:[M(e.size)," file streamed"]}):null,k.length>0?r.jsxs("div",{className:x.skippedNote,children:[r.jsxs("button",{type:"button",className:x.skippedToggle,onClick:()=>p(c=>!c),children:[k.length," reference",k.length===1?"":"s"," not inlined (",Xe(k),")"]}),a?r.jsx("ul",{className:x.skippedList,children:k.map(c=>r.jsxs("li",{children:[c.raw," — ",oe[c.reason]]},c.raw))}):null]}):null,r.jsxs("div",{className:x.body,children:[r.jsx("iframe",{sandbox:Ze,srcDoc:T,referrerPolicy:"no-referrer",allow:"",className:x.frame,style:n==="preview"?void 0:{display:"none"},title:j}),n==="source"?r.jsx(pe,{path:s,content:l}):null]})]})}export{dt as HtmlViewer};
|
|
1
|
+
import{r as v,j as r}from"./vendor-react-DQUAl2K8.js";import{a as ie,u as ae}from"./vendor-query-i7fr__Xm.js";import{n as ce,a as G,c as le,d as X,u as F,o as ue,E as A,S as R,B as C,r as B,t as de}from"./index-DawGVQic.js";import{S as fe}from"./Switch-1I6AMAC7.js";import{u as me,C as pe}from"./CodeView-BtHrI9KP.js";import{p as he,S as ge}from"./href-resolution-bgv3HgGq.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-TjW4POi1.js";const I={maxCount:64,maxBytesPerAsset:2*1024*1024,maxBytesTotal:16*1024*1024};function K(s,t,e){return!(s>=I.maxCount||e>I.maxBytesPerAsset||t+e>I.maxBytesTotal)}function Y(s){return s===""||s.startsWith("#")?"unsupported":s.startsWith("//")||ge.test(s)?"external":null}function xe(s,t,e){return e!==null&&t===e?s:t}function J(s,t,e,n,i=null){const o=s.trim(),u=Y(o);if(u)return{kind:"skip",raw:s,reason:u};const a=he(o);let p;if(a.startsWith("/")?p=a:a==="~"||a.startsWith("~/")?p=i!==null?ce(a,i):null:p=G(a,t),!p)return{kind:"skip",raw:s,reason:"unsupported"};const h=le(p);return h!==e&&!h.startsWith(`${e}/`)?{kind:"skip",raw:s,reason:"outside-workspace"}:{kind:"local",raw:s,path:h,context:n}}const we={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 _e(s){const t=s.lastIndexOf("/"),e=s.lastIndexOf(".");return e<=t?"application/octet-stream":we[s.slice(e+1).toLowerCase()]??"application/octet-stream"}function ve(s){let t="";for(let n=0;n<s.length;n+=32768)t+=String.fromCharCode(...s.subarray(n,n+32768));return btoa(t)}function q(s,t){return`data:${s};base64,${ve(t)}`}const z=/<([a-zA-Z][a-zA-Z0-9]*)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*)(\s*\/?>)/g,O=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/g;function ee(s){const t=new Map;O.lastIndex=0;let e;for(;e=O.exec(s);){const n=e[1].toLowerCase();t.has(n)||t.set(n,e[2]??e[3]??e[4]??"")}return t}function te(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 se(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 ye(s){return s.map(t=>t.descriptor?`${t.url} ${t.descriptor}`:t.url).join(", ")}function $(s,t,e){Y(t.trim())||s.has(t)||s.set(t,{raw:t,context:e})}function ke(s){const t=new Map;z.lastIndex=0;let e;for(;e=z.exec(s);){const n=e[1].toLowerCase(),i=ee(e[2]??"");for(const o of te(n,i)){const u=i.get(o.name)??"";if(o.multi)for(const a of se(u))$(t,a.url,o.context);else $(t,u,o.context)}}return[...t.values()]}function je(s,t){let e=!1;const n=se(s).map(i=>{const o=t[i.url];return o===void 0?i:(e=!0,{url:o,descriptor:i.descriptor})});return e?ye(n):null}function be(s,t){return Object.keys(t).length===0?s:(z.lastIndex=0,s.replace(z,(e,n,i,o)=>{const u=ee(i),a=te(n.toLowerCase(),u);if(a.length===0)return e;const p=new Map(a.map(d=>[d.name,d]));let h=!1;const E=i.replace(O,(d,f,l,w,y)=>{const _=p.get(f.toLowerCase());if(!_)return d;const g=l??w??y??"",b=_.multi?je(g,t):t[g]??null;return b===null?d:(h=!0,`${f}="${b}"`)});return h?`<${n}${E}${o}`:e}))}const P=/url\(\s*(?:"([^"]*)"|'([^']*)'|([^'")\s]*))\s*\)/gi,U=/@font-face\s*\{[^}]*\}/gi;function ne(s,t,e){return s??t??e??""}function Se(s){const t=[];U.lastIndex=0;let e;for(;e=U.exec(s);)t.push([e.index,e.index+e[0].length]);return t}function Ee(s){const t=Se(s),e=new Map;P.lastIndex=0;let n;for(;n=P.exec(s);){const i=ne(n[1],n[2],n[3]),o=t.some(([u,a])=>n.index>=u&&n.index<a)?"font":"image";$(e,i,o)}return[...e.values()]}function Le(s,t){return Object.keys(t).length===0?s:(P.lastIndex=0,s.replace(P,(e,n,i,o)=>{const u=t[ne(n,i,o)];return u===void 0?e:`url("${u}")`}))}const Ae=Object.freeze(["allow-scripts"]),Ce="https://pi-studio-preview.invalid/",Ne="default-src 'none'; img-src data:; style-src 'unsafe-inline' data:; script-src 'unsafe-inline' data:; font-src data:; media-src data:",Te=`<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>`,Re=/<head(\s[^>]*)?>/i,Be=/<html(\s[^>]*)?>/i,Me=/<base[\s/>]/i;function ze(s,t){const e=be(s,t.assets??{}),n=[];t.blockRemote&&n.push(`<meta http-equiv="Content-Security-Policy" content="${Ne}">`),Me.test(e)||(n.push(`<base href="${Ce}">`),n.push(Te));const i=n.join("");if(i==="")return e;const o=Re.exec(e);if(o){const a=o.index+o[0].length;return e.slice(0,a)+i+e.slice(a)}const u=Be.exec(e);if(u){const a=u.index+u[0].length;return e.slice(0,a)+`<head>${i}</head>`+e.slice(a)}return`<head>${i}</head>`+e}const V=6;async function W(s,t,e){let n=0;async function i(){for(;n<s.length;){const o=s[n];n+=1,await e(o)}}await Promise.all(Array.from({length:Math.min(t,s.length)},i))}function Q(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 Pe(s,t){const e={},n=[];let i=0,o=0,u=!1;const a=[];for(const d of s)d.kind==="skip"?n.push({raw:d.raw,reason:d.reason}):a.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(!K(i,o,l.byteLength)){u=!0,p(f,"over-cap");return}if(i+=1,o+=l.byteLength,f[0].context!=="style"){const m=q(_e(d),l);for(const j of f)e[j.raw]=m;return}const w=new TextDecoder().decode(l),y=X(d),_=Ee(w).map(m=>J(m.raw,y,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 b=Q(g);await W([...b.entries()],V,([m,j])=>h(m,j));const N={};for(const m of g){const j=e[m.raw];j!==void 0&&(N[m.raw]=j)}const L=Le(w,N),S=new TextEncoder().encode(L),k=S.byteLength-l.byteLength;if(k>0&&!K(i-1,o-l.byteLength,S.byteLength)){u=!0,p(f,"over-cap");return}o+=k;const T=q("text/css",S);for(const m of f)e[m.raw]=T}const E=Q(a);return await W([...E.entries()],V,([d,f])=>h(d,f)),{assets:e,skipped:n}}const Ie="_wrap_1et27_1",Oe="_toolbar_1et27_7",$e="_modeToggle_1et27_20",De="_controls_1et27_24",He="_switchLabel_1et27_29",Fe="_streamedNote_1et27_37",Ke="_skippedNote_1et27_45",qe="_skippedToggle_1et27_52",Ue="_skippedList_1et27_64",Ve="_body_1et27_69",We="_frame_1et27_73",Qe="_tooLarge_1et27_79",x={wrap:Ie,toolbar:Oe,modeToggle:$e,controls:De,switchLabel:He,streamedNote:Fe,skippedNote:Ke,skippedToggle:qe,skippedList:Ue,body:Ve,frame:We,tooLarge:Qe},Ze=Ae.join(" "),Z=Object.freeze({}),Ge=Object.freeze([]),oe={external:"external","outside-workspace":"outside workspace",unsupported:"unsupported","over-cap":"over cap","fetch-failed":"not found"};function Xe(s){const t=new Map;for(const e of s){const n=oe[e.reason];t.set(n,(t.get(n)??0)+1)}return[...t.entries()].map(([e,n])=>`${n} ${e}`).join(", ")}function Ye(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 M(s){return`${(s/(1024*1024)).toFixed(1)} MB`}function dt({path:s,workspaceCwd:t}){var D,H;const e=me(s),[n,i]=v.useState("preview"),[o,u]=v.useState(!1),[a,p]=v.useState(!1),h=ie(),E=F(c=>c.client),d=F(c=>c.daemon),f=ue(),l=e.kind==="inline"||e.kind==="streamed"?e.content:null,w=v.useMemo(()=>{const c=G(s,t);return c?X(c):null},[s,t]),y=v.useMemo(()=>w!==null?xe(w,t,f):null,[w,t,f]),_=v.useMemo(()=>l===null||w===null||y===null?[]:ke(l).map(c=>J(c.raw,w,y,c.context,f)),[l,w,y,f]),g=v.useMemo(()=>_.some(c=>c.kind==="local"),[_]),b=v.useMemo(()=>_.flatMap(c=>c.kind==="skip"?[{raw:c.raw,reason:c.reason}]:[]),[_]),N=v.useMemo(()=>g&&l!==null?Ye(l):"",[l,g]),L=ae({queryKey:B.htmlAssetBundle(s,N),queryFn:()=>y===null?Promise.resolve({assets:{},skipped:[]}):Pe(_,{root:y,homeDir:f,fetchBytes:async re=>{if(!E||!d)throw new Error("not connected");return(await de(d).download(re)).bytes}}),enabled:g,staleTime:1/0}),S=g?((D=L.data)==null?void 0:D.assets)??Z:Z,k=g?((H=L.data)==null?void 0:H.skipped)??Ge:b,T=v.useMemo(()=>l===null?null:ze(l,{assets:S,blockRemote:o}),[l,S,o]);function m(){h.invalidateQueries({queryKey:B.fileRead(s)}),h.invalidateQueries({queryKey:B.fileDownload(s)}),h.invalidateQueries({queryKey:B.htmlAssetBundleByPath(s)})}switch(e.kind){case"loading":return r.jsxs(A,{children:[r.jsx(R,{size:"sm"})," Loading..."]});case"streaming":return r.jsxs(A,{children:[r.jsx(R,{size:"sm"})," Streaming ",M(e.size)," file..."]});case"stream-error":case"error":return r.jsxs(A,{children:["Error: ",e.message]});case"too-large":{const c=s.split("/").pop()||s;return r.jsx(A,{children:r.jsxs("div",{className:x.tooLarge,children:[r.jsxs("div",{children:[M(e.size)," — too large to display (display ceiling is"," ",M(e.maxDisplayBytes),")."]}),e.downloading?r.jsx(R,{size:"sm"}):e.downloadUrl?r.jsx("a",{href:e.downloadUrl,download:e.downloadName||c,children:r.jsx(C,{size:"sm",children:"Save file"})}):r.jsx(C,{size:"sm",onClick:()=>e.requestDownload(),children:"Download"})]})})}}if(l===null||T===null)return null;if(g&&L.data===void 0)return r.jsxs(A,{children:[r.jsx(R,{size:"sm"})," Loading assets..."]});const j=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(C,{size:"xs",variant:n==="preview"?"default":"ghost",onClick:()=>i("preview"),children:"Preview"}),r.jsx(C,{size:"xs",variant:n==="source"?"default":"ghost",onClick:()=>i("source"),children:"Source"})]}),r.jsxs("div",{className:x.controls,children:[r.jsxs("label",{className:x.switchLabel,children:[r.jsx(fe,{checked:o,onCheckedChange:u,"aria-label":"Block remote resources"}),"Block remote resources"]}),r.jsx(C,{size:"xs",variant:"ghost",onClick:m,children:"Reload"})]})]}),e.kind==="streamed"?r.jsxs("div",{className:x.streamedNote,children:[M(e.size)," file streamed"]}):null,k.length>0?r.jsxs("div",{className:x.skippedNote,children:[r.jsxs("button",{type:"button",className:x.skippedToggle,onClick:()=>p(c=>!c),children:[k.length," reference",k.length===1?"":"s"," not inlined (",Xe(k),")"]}),a?r.jsx("ul",{className:x.skippedList,children:k.map(c=>r.jsxs("li",{children:[c.raw," — ",oe[c.reason]]},c.raw))}):null]}):null,r.jsxs("div",{className:x.body,children:[r.jsx("iframe",{sandbox:Ze,srcDoc:T,referrerPolicy:"no-referrer",allow:"",className:x.frame,style:n==="preview"?void 0:{display:"none"},title:j}),n==="source"?r.jsx(pe,{path:s,content:l}):null]})]})}export{dt as HtmlViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as s,S as a}from"./index-
|
|
1
|
+
import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as s,S as a}from"./index-DawGVQic.js";import{u as t}from"./use-file-download-TjW4POi1.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.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{a as j,d as g,B as i,E as a,S as c}from"./index-
|
|
1
|
+
import{r as x,j as e}from"./vendor-react-DQUAl2K8.js";import{a as j,d as g,B as i,E as a,S as c}from"./index-DawGVQic.js";import{u as w,C as h}from"./CodeView-BtHrI9KP.js";import{M as v}from"./markdown-CRfVs-Rh.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-TjW4POi1.js";import"./vendor-highlight-Ddi_n-Jh.js";import"./vendor-markdown-DJUOT8ep.js";import"./href-resolution-bgv3HgGq.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 w,j as n}from"./vendor-react-DQUAl2K8.js";import{a as E}from"./vendor-query-i7fr__Xm.js";import{u as P,E as u,S as C,B as b,r as x}from"./index-
|
|
1
|
+
import{r as w,j as n}from"./vendor-react-DQUAl2K8.js";import{a as E}from"./vendor-query-i7fr__Xm.js";import{u as P,E as u,S as C,B as b,r as x}from"./index-DawGVQic.js";import{S as y}from"./StatusBadge-BMKAPA9O.js";import{u as R}from"./use-provider-auth-list-B7wM3n-2.js";import{u as N}from"./provider-auth-store-9hsJ07X1.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";const j="env:";function I(t){var i;return t.configured==="unknown"?{label:"Unknown",variant:"warning"}:t.configured===!1?{label:"Not configured",variant:"muted"}:(i=t.configuredSource)!=null&&i.startsWith(j)?{label:`env: ${t.configuredSource.slice(j.length)}`,variant:"success"}:t.configuredType==="oauth"?{label:"OAuth",variant:"success"}:{label:"API key",variant:"success"}}function M(t){const i=t.configured===!0?"Re-login":"Log in";if(t.authTypes.length<=1){const s=t.authTypes[0]??"api_key";return[{authType:s,label:s==="oauth"?t.oauthLoginLabel??i:i}]}return t.authTypes.map(s=>s==="oauth"?{authType:s,label:t.oauthLoginLabel??"Log in with OAuth"}:{authType:s,label:"API key"})}const q="_list_vm1k7_1",O="_row_vm1k7_7",T="_rowMain_vm1k7_18",B="_name_vm1k7_25",z="_tag_vm1k7_33",F="_rowActions_vm1k7_37",K="_pendingNote_vm1k7_44",Q="_note_vm1k7_49",U="_errorState_vm1k7_55",a={list:q,row:O,rowMain:T,name:B,tag:z,rowActions:F,pendingNote:K,note:Q,errorState:U};function ee(){const t=P(e=>e.client),i=E(),s=N(e=>e.pendingLogin),k=N(e=>e.requestLogin),[d,g]=w.useState(null),[p,m]=w.useState({}),{data:r,isLoading:L,isError:S,error:h}=R();async function A(e){if(t&&window.confirm(`Log out of ${e.name}? Running agents keep working until their current credential use fails.`)){m(o=>({...o,[e.id]:""})),g(e.id);try{const o=await t.logoutProvider(e.id);m(l=>({...l,[e.id]:o.stillConfigured?"Removed the stored credential — still configured via an environment variable.":""})),await i.invalidateQueries({queryKey:x.providerAuthList()}),i.invalidateQueries({queryKey:x.providerModelsAll()})}finally{g(null)}}}return L?n.jsxs(u,{children:[n.jsx(C,{size:"sm"})," Loading providers…"]}):S?n.jsx(u,{className:a.errorState,children:h instanceof Error?h.message:"Failed to load providers."}):!r||r.length===0?n.jsx(u,{children:"No providers available."}):n.jsx("div",{className:a.list,children:r.map(e=>{const o=I(e),l=M(e),f=(s==null?void 0:s.provider)===e.id,_=s!==null&&!f,v=p[e.id];return n.jsxs("div",{className:a.row,children:[n.jsxs("div",{className:a.rowMain,children:[n.jsx("span",{className:a.name,children:e.name}),e.oauthIsSubscription&&n.jsx(y,{label:"Subscription",variant:"muted",className:a.tag}),n.jsx(y,{label:o.label,variant:o.variant,className:a.tag})]}),n.jsx("div",{className:a.rowActions,children:f?n.jsx("span",{className:a.pendingNote,children:"Logging in…"}):n.jsxs(n.Fragment,{children:[l.map(c=>n.jsx(b,{size:"xs",variant:"secondary",disabled:_,onClick:()=>k(e.id,e.name,c.authType),children:c.label},c.authType)),e.configured!==!1&&n.jsx(b,{size:"xs",variant:"ghost",disabled:_||d===e.id,loading:d===e.id,onClick:()=>void A(e),children:"Log out"})]})}),v&&n.jsx("div",{className:a.note,children:v})]},e.id)})})}export{ee as ModelProvidersPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as t}from"./vendor-react-DQUAl2K8.js";import{u as I,p as W,P as h,E as N,S as k,m as q,q as C,d as U,s as X,C as Y,v as z,h as D}from"./index-
|
|
1
|
+
import{r as c,j as t}from"./vendor-react-DQUAl2K8.js";import{u as I,p as W,P as h,E as N,S as k,m as q,q as C,d as U,s as X,C as Y,v as z,h as D}from"./index-DawGVQic.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-TjW4POi1.js";import{u as K}from"./use-file-watch-Cm5eDhih.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.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",g={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),[w,_]=c.useState(null),[E,A]=c.useState(!1),[S,x]=c.useState(null),[j,y]=c.useState(null),[M,P]=c.useState(null),b=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:b.current,modified:E})&&(b.current=i,s.refetch())},[i,E,s.refetch]);const L=i!==null&&i!==b.current&&E;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)??(w==null?void 0:w.message)??null;return e&&s.isPending?t.jsx(h,{children:t.jsxs(N,{children:[t.jsx(k,{size:"sm"})," Loading..."]})}):F?t.jsx(h,{children:t.jsxs(N,{children:["Error: ",F]})}):t.jsxs(h,{className:g.wrap,"data-molecule-active":a?"true":"false",children:[t.jsxs("div",{className:g.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:g.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(h,{children:t.jsx(ue,{path:r,workspaceCwd:e.workspaceCwd,tabId:e.id,isActive:n})})}export{_e as MoleculeViewerPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as me,r as v,j as l}from"./vendor-react-DQUAl2K8.js";import{af as we,N as ye}from"./vendor-DaF96HbP.js";import{u as oe,r as _t,O as ie,B as G,S as It,M as Ce,Q as Ee,a5 as Be,a6 as Ne,a7 as Se,I as Ie,E as Lt}from"./index-UMN9kelm.js";import{a as Re}from"./vendor-query-i7fr__Xm.js";import{u as O}from"./provider-auth-store-9hsJ07X1.js";import{o as se,b as be,p as Ae}from"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";function _e(t,n){return{provider:t,authType:n,phase:"starting",statusLines:[]}}function Le(t,n,i){return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...t.statusLines,{kind:"info",message:n,links:i}]}}function Te(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 Me(t,n,i){return{...t,authUrl:{url:n,instructions:i}}}function Pe(t,n,i,r,e){return{...t,deviceCode:{userCode:n,verificationUri:i,intervalSeconds:r,expiresInSeconds:e}}}function ve(t,n){return{...t,phase:"prompt",prompt:n}}function je(t,n){var i;return((i=t.prompt)==null?void 0:i.promptId)!==n?t:{...t,phase:"waiting",prompt:void 0}}function De(t,n,i){return{...t,phase:"done",result:{ok:n,error:i}}}function xe(t,n){if(t.phase==="done")return t;switch(n.kind){case"info":return Le(t,n.message,n.links);case"progress":return Te(t,n.message);case"auth_url":return Me(t,n.url,n.instructions);case"device_code":return Pe(t,n.userCode,n.verificationUri,n.intervalSeconds,n.expiresInSeconds);case"prompt":return ve(t,n);case"prompt_cancelled":return je(t,n.promptId);case"done":return De(t,n.ok,n.error)}}var V={},nt,Tt;function ke(){return Tt||(Tt=1,nt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),nt}var rt={},U={},Mt;function F(){if(Mt)return U;Mt=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={},Pt;function Rt(){return Pt||(Pt=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,vt;function Ue(){if(vt)return it;vt=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,jt;function qe(){if(jt)return st;jt=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={},Dt;function Fe(){return Dt||(Dt=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={},xt;function ze(){if(xt)return ut;xt=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={},kt;function Ke(){return kt||(kt=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,m=null;for(let E=0;E<o;E++){a=u=0,c=m=null;for(let S=0;S<o;S++){let h=e.get(E,S);h===c?a++:(a>=5&&(s+=n.N1+(a-5)),c=h,a=1),h=e.get(S,E),h===m?u++:(u>=5&&(s+=n.N1+(u-5)),m=h,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 m=0;m<o;m++)a=a<<1&2047|e.get(c,m),m>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|e.get(m,c),m>=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 m=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(c,e),m<u&&(u=m,a=c)}return a}})(ct)),ct}var W={},Ut;function ae(){if(Ut)return W;Ut=1;const t=Rt(),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={},H={},qt;function Ve(){if(qt)return H;qt=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]})(),H.log=function(r){if(r<1)throw new Error("log("+r+")");return n[r]},H.exp=function(r){return t[r]},H.mul=function(r,e){return r===0||e===0?0:t[n[r]+n[e]]},H}var Ft;function Oe(){return Ft||(Ft=1,(function(t){const n=Ve();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,zt;function Qe(){if(zt)return dt;zt=1;const t=Oe();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={},ht={},gt={},Kt;function ue(){return Kt||(Kt=1,gt.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),gt}var D={},Vt;function ce(){if(Vt)return D;Vt=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
|
+
import{b as me,r as v,j as l}from"./vendor-react-DQUAl2K8.js";import{af as we,N as ye}from"./vendor-DaF96HbP.js";import{u as oe,r as _t,O as ie,B as G,S as It,M as Ce,Q as Ee,a5 as Be,a6 as Ne,a7 as Se,I as Ie,E as Lt}from"./index-DawGVQic.js";import{a as Re}from"./vendor-query-i7fr__Xm.js";import{u as O}from"./provider-auth-store-9hsJ07X1.js";import{o as se,b as be,p as Ae}from"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";function _e(t,n){return{provider:t,authType:n,phase:"starting",statusLines:[]}}function Le(t,n,i){return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...t.statusLines,{kind:"info",message:n,links:i}]}}function Te(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 Me(t,n,i){return{...t,authUrl:{url:n,instructions:i}}}function Pe(t,n,i,r,e){return{...t,deviceCode:{userCode:n,verificationUri:i,intervalSeconds:r,expiresInSeconds:e}}}function ve(t,n){return{...t,phase:"prompt",prompt:n}}function je(t,n){var i;return((i=t.prompt)==null?void 0:i.promptId)!==n?t:{...t,phase:"waiting",prompt:void 0}}function De(t,n,i){return{...t,phase:"done",result:{ok:n,error:i}}}function xe(t,n){if(t.phase==="done")return t;switch(n.kind){case"info":return Le(t,n.message,n.links);case"progress":return Te(t,n.message);case"auth_url":return Me(t,n.url,n.instructions);case"device_code":return Pe(t,n.userCode,n.verificationUri,n.intervalSeconds,n.expiresInSeconds);case"prompt":return ve(t,n);case"prompt_cancelled":return je(t,n.promptId);case"done":return De(t,n.ok,n.error)}}var V={},nt,Tt;function ke(){return Tt||(Tt=1,nt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),nt}var rt={},U={},Mt;function F(){if(Mt)return U;Mt=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={},Pt;function Rt(){return Pt||(Pt=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,vt;function Ue(){if(vt)return it;vt=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,jt;function qe(){if(jt)return st;jt=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={},Dt;function Fe(){return Dt||(Dt=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={},xt;function ze(){if(xt)return ut;xt=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={},kt;function Ke(){return kt||(kt=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,m=null;for(let E=0;E<o;E++){a=u=0,c=m=null;for(let S=0;S<o;S++){let h=e.get(E,S);h===c?a++:(a>=5&&(s+=n.N1+(a-5)),c=h,a=1),h=e.get(S,E),h===m?u++:(u>=5&&(s+=n.N1+(u-5)),m=h,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 m=0;m<o;m++)a=a<<1&2047|e.get(c,m),m>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|e.get(m,c),m>=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 m=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(c,e),m<u&&(u=m,a=c)}return a}})(ct)),ct}var W={},Ut;function ae(){if(Ut)return W;Ut=1;const t=Rt(),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={},H={},qt;function Ve(){if(qt)return H;qt=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]})(),H.log=function(r){if(r<1)throw new Error("log("+r+")");return n[r]},H.exp=function(r){return t[r]},H.mul=function(r,e){return r===0||e===0?0:t[n[r]+n[e]]},H}var Ft;function Oe(){return Ft||(Ft=1,(function(t){const n=Ve();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,zt;function Qe(){if(zt)return dt;zt=1;const t=Oe();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={},ht={},gt={},Kt;function ue(){return Kt||(Kt=1,gt.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),gt}var D={},Vt;function ce(){if(Vt)return D;Vt=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
|
|
2
2
|
]))+`;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 Ot;function z(){return Ot||(Ot=1,(function(t){const n=ue(),i=ce();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}}})(ht)),ht}var Qt;function He(){return Qt||(Qt=1,(function(t){const n=F(),i=ae(),r=Rt(),e=z(),o=ue(),s=7973,a=n.getBCHDigit(s);function u(S,h,_){for(let d=1;d<=40;d++)if(h<=t.getCapacity(d,_,S))return d}function c(S,h){return e.getCharCountIndicator(S,h)+4}function m(S,h){let _=0;return S.forEach(function(d){const P=c(d.mode,h);_+=P+d.getBitsLength()}),_}function E(S,h){for(let _=1;_<=40;_++)if(m(S,_)<=t.getCapacity(_,h,e.MIXED))return _}t.from=function(h,_){return o.isValid(h)?parseInt(h,10):_},t.getCapacity=function(h,_,d){if(!o.isValid(h))throw new Error("Invalid QR Code version");typeof d>"u"&&(d=e.BYTE);const P=n.getSymbolTotalCodewords(h),A=i.getTotalCodewordsCount(h,_),L=(P-A)*8;if(d===e.MIXED)return L;const b=L-c(d,h);switch(d){case e.NUMERIC:return Math.floor(b/10*3);case e.ALPHANUMERIC:return Math.floor(b/11*2);case e.KANJI:return Math.floor(b/13);case e.BYTE:default:return Math.floor(b/8)}},t.getBestVersionForData=function(h,_){let d;const P=r.from(_,r.M);if(Array.isArray(h)){if(h.length>1)return E(h,P);if(h.length===0)return 1;d=h[0]}else d=h;return u(d.mode,d.getLength(),P)},t.getEncodedBits=function(h){if(!o.isValid(h)||h<7)throw new Error("Invalid QR Code version");let _=h<<12;for(;n.getBCHDigit(_)-a>=0;)_^=s<<n.getBCHDigit(_)-a;return h<<12|_}})(ft)),ft}var pt={},Ht;function Je(){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,Jt;function Ye(){if(Jt)return wt;Jt=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,Yt;function $e(){if(Yt)return yt;Yt=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,$t;function Ge(){if($t)return Ct;$t=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,Gt;function We(){if(Gt)return Et;Gt=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]+`
|
|
3
3
|
Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),r.put(o,13)}},Et=i,Et}var Wt;function Xe(){return Wt||(Wt=1,(function(t){const n=z(),i=Ye(),r=$e(),e=Ge(),o=We(),s=ce(),a=F(),u=we();function c(A){return unescape(encodeURIComponent(A)).length}function m(A,L,b){const R=[];let M;for(;(M=A.exec(b))!==null;)R.push({data:M[0],index:M.index,mode:L,length:M[0].length});return R}function E(A){const L=m(s.NUMERIC,n.NUMERIC,A),b=m(s.ALPHANUMERIC,n.ALPHANUMERIC,A);let R,M;return a.isKanjiModeEnabled()?(R=m(s.BYTE,n.BYTE,A),M=m(s.KANJI,n.KANJI,A)):(R=m(s.BYTE_KANJI,n.BYTE,A),M=[]),L.concat(b,R,M).sort(function(B,w){return B.index-w.index}).map(function(B){return{data:B.data,mode:B.mode,length:B.length}})}function S(A,L){switch(L){case n.NUMERIC:return i.getBitsLength(A);case n.ALPHANUMERIC:return r.getBitsLength(A);case n.KANJI:return o.getBitsLength(A);case n.BYTE:return e.getBitsLength(A)}}function h(A){return A.reduce(function(L,b){const R=L.length-1>=0?L[L.length-1]:null;return R&&R.mode===b.mode?(L[L.length-1].data+=b.data,L):(L.push(b),L)},[])}function _(A){const L=[];for(let b=0;b<A.length;b++){const R=A[b];switch(R.mode){case n.NUMERIC:L.push([R,{data:R.data,mode:n.ALPHANUMERIC,length:R.length},{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.ALPHANUMERIC:L.push([R,{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.KANJI:L.push([R,{data:R.data,mode:n.BYTE,length:c(R.data)}]);break;case n.BYTE:L.push([{data:R.data,mode:n.BYTE,length:c(R.data)}])}}return L}function d(A,L){const b={},R={start:{}};let M=["start"];for(let p=0;p<A.length;p++){const B=A[p],w=[];for(let g=0;g<B.length;g++){const I=B[g],y=""+p+g;w.push(y),b[y]={node:I,lastCount:0},R[y]={};for(let N=0;N<M.length;N++){const C=M[N];b[C]&&b[C].node.mode===I.mode?(R[C][y]=S(b[C].lastCount+I.length,I.mode)-S(b[C].lastCount,I.mode),b[C].lastCount+=I.length):(b[C]&&(b[C].lastCount=I.length),R[C][y]=S(I.length,I.mode)+4+n.getCharCountIndicator(I.mode,L))}}M=w}for(let p=0;p<M.length;p++)R[M[p]].end=0;return{map:R,table:b}}function P(A,L){let b;const R=n.getBestModeForData(A);if(b=n.from(L,R),b!==n.BYTE&&b.bit<R.bit)throw new Error('"'+A+'" cannot be encoded with mode '+n.toString(b)+`.
|
|
4
4
|
Suggested mode is: `+n.toString(R));switch(b===n.KANJI&&!a.isKanjiModeEnabled()&&(b=n.BYTE),b){case n.NUMERIC:return new i(A);case n.ALPHANUMERIC:return new r(A);case n.KANJI:return new o(A);case n.BYTE:return new e(A)}}t.fromArray=function(L){return L.reduce(function(b,R){return typeof R=="string"?b.push(P(R,null)):R.data&&b.push(P(R.data,R.mode)),b},[])},t.fromString=function(L,b){const R=E(L,a.isKanjiModeEnabled()),M=_(R),p=d(M,b),B=u.find_path(p.map,"start","end"),w=[];for(let g=1;g<B.length-1;g++)w.push(p.table[B[g]].node);return t.fromArray(h(w))},t.rawSplit=function(L){return t.fromArray(E(L,a.isKanjiModeEnabled()))}})(mt)),mt}var Xt;function Ze(){if(Xt)return rt;Xt=1;const t=F(),n=Rt(),i=Ue(),r=qe(),e=Fe(),o=ze(),s=Ke(),a=ae(),u=Qe(),c=He(),m=Je(),E=z(),S=Xe();function h(p,B){const w=p.size,g=o.getPositions(B);for(let I=0;I<g.length;I++){const y=g[I][0],N=g[I][1];for(let C=-1;C<=7;C++)if(!(y+C<=-1||w<=y+C))for(let f=-1;f<=7;f++)N+f<=-1||w<=N+f||(C>=0&&C<=6&&(f===0||f===6)||f>=0&&f<=6&&(C===0||C===6)||C>=2&&C<=4&&f>=2&&f<=4?p.set(y+C,N+f,!0,!0):p.set(y+C,N+f,!1,!0))}}function _(p){const B=p.size;for(let w=8;w<B-8;w++){const g=w%2===0;p.set(w,6,g,!0),p.set(6,w,g,!0)}}function d(p,B){const w=e.getPositions(B);for(let g=0;g<w.length;g++){const I=w[g][0],y=w[g][1];for(let N=-2;N<=2;N++)for(let C=-2;C<=2;C++)N===-2||N===2||C===-2||C===2||N===0&&C===0?p.set(I+N,y+C,!0,!0):p.set(I+N,y+C,!1,!0)}}function P(p,B){const w=p.size,g=c.getEncodedBits(B);let I,y,N;for(let C=0;C<18;C++)I=Math.floor(C/3),y=C%3+w-8-3,N=(g>>C&1)===1,p.set(I,y,N,!0),p.set(y,I,N,!0)}function A(p,B,w){const g=p.size,I=m.getEncodedBits(B,w);let y,N;for(y=0;y<15;y++)N=(I>>y&1)===1,y<6?p.set(y,8,N,!0):y<8?p.set(y+1,8,N,!0):p.set(g-15+y,8,N,!0),y<8?p.set(8,g-y-1,N,!0):y<9?p.set(8,15-y-1+1,N,!0):p.set(8,15-y-1,N,!0);p.set(g-8,8,1,!0)}function L(p,B){const w=p.size;let g=-1,I=w-1,y=7,N=0;for(let C=w-1;C>0;C-=2)for(C===6&&C--;;){for(let f=0;f<2;f++)if(!p.isReserved(I,C-f)){let j=!1;N<B.length&&(j=(B[N]>>>y&1)===1),p.set(I,C-f,j),y--,y===-1&&(N++,y=7)}if(I+=g,I<0||w<=I){I-=g,g=-g;break}}}function b(p,B,w){const g=new i;w.forEach(function(f){g.put(f.mode.bit,4),g.put(f.getLength(),E.getCharCountIndicator(f.mode,p)),f.write(g)});const I=t.getSymbolTotalCodewords(p),y=a.getTotalCodewordsCount(p,B),N=(I-y)*8;for(g.getLengthInBits()+4<=N&&g.put(0,4);g.getLengthInBits()%8!==0;)g.putBit(0);const C=(N-g.getLengthInBits())/8;for(let f=0;f<C;f++)g.put(f%2?17:236,8);return R(g,p,B)}function R(p,B,w){const g=t.getSymbolTotalCodewords(B),I=a.getTotalCodewordsCount(B,w),y=g-I,N=a.getBlocksCount(B,w),C=g%N,f=N-C,j=Math.floor(g/N),q=Math.floor(y/N),Y=q+1,Q=j-q,ge=new u(Q);let X=0;const $=new Array(N),bt=new Array(N);let Z=0;const pe=new Uint8Array(p.buffer);for(let K=0;K<N;K++){const et=K<f?q:Y;$[K]=pe.slice(X,X+et),bt[K]=ge.encode($[K]),X+=et,Z=Math.max(Z,et)}const tt=new Uint8Array(g);let At=0,x,k;for(x=0;x<Z;x++)for(k=0;k<N;k++)x<$[k].length&&(tt[At++]=$[k][x]);for(x=0;x<Q;x++)for(k=0;k<N;k++)tt[At++]=bt[k][x];return tt}function M(p,B,w,g){let I;if(Array.isArray(p))I=S.fromArray(p);else if(typeof p=="string"){let j=B;if(!j){const q=S.rawSplit(p);j=c.getBestVersionForData(q,w)}I=S.fromString(p,j||40)}else throw new Error("Invalid data");const y=c.getBestVersionForData(I,w);if(!y)throw new Error("The amount of data is too big to be stored in a QR Code");if(!B)B=y;else if(B<y)throw new Error(`
|
|
@@ -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{f as X,g as ae,T as J,u as fe,h as de,i as me,j as pe,k as Q,S as he,l as Re,m as we}from"./index-
|
|
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{f as X,g as ae,T as J,u as fe,h as de,i as me,j as pe,k as Q,S as he,l as Re,m as we}from"./index-DawGVQic.js";import"./vendor-DaF96HbP.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.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-
|
|
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-DawGVQic.js";import{u as m,C as d}from"./CodeView-BtHrI9KP.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-TjW4POi1.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-
|
|
1
|
+
import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as e,S as t}from"./index-DawGVQic.js";import{u as n}from"./use-file-download-TjW4POi1.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.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{j as s}from"./vendor-react-DQUAl2K8.js";import{S as a}from"./Switch-1I6AMAC7.js";import{b as n}from"./index-
|
|
1
|
+
import{j as s}from"./vendor-react-DQUAl2K8.js";import{S as a}from"./Switch-1I6AMAC7.js";import{b as n}from"./index-DawGVQic.js";import"./vendor-DaF96HbP.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-icons-K8oF_80Q.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";const c="_list_x2x5z_1",l="_row_x2x5z_7",m="_rowMain_x2x5z_17",d="_name_x2x5z_24",x="_description_x2x5z_29",p="_note_x2x5z_34",i={list:c,row:l,rowMain:m,name:d,description:x,note:p};function z(){const o=n(e=>e.capable),r=n(e=>e.isViewerEnabled("molviewer")),t=n(e=>e.setEnabled);return s.jsxs("div",{className:i.list,children:[s.jsxs("div",{className:i.row,children:[s.jsxs("div",{className:i.rowMain,children:[s.jsx("span",{className:i.name,children:"Molecule Viewer"}),s.jsx("span",{className:i.description,children:"Open molecular structure files (.cif, .pdb, .xyz, and similar) in the 3D viewer instead of as plain text."})]}),s.jsx(a,{checked:r,disabled:!o,onCheckedChange:e=>void t("molviewer",e),"aria-label":"Molecule Viewer"})]}),!o&&s.jsx("p",{className:i.note,children:"Requires a newer daemon."})]})}export{z as ViewersPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as l,a as o,c as i}from"./index-
|
|
1
|
+
import{n as l,a as o,c as i}from"./index-DawGVQic.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};
|