getborg 0.0.109 → 0.0.117
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/{BunPtyAdapter-B8CZTUkK.mjs → BunPtyAdapter-kPTUT2mb.mjs} +3 -3
- package/dist/{Config-DFbx48ty.mjs → Config-DvH5tPG0.mjs} +2 -2
- package/dist/{FetchHttpClient-DEMRQKIB.mjs → FetchHttpClient-C-jciW95.mjs} +3 -3
- package/dist/{FileSystem-41Cezpd1.mjs → FileSystem-NX0EtGtm.mjs} +109 -3
- package/dist/{Mime-D2854Tqo.mjs → Mime-C6O17O_3.mjs} +5 -5
- package/dist/{NodeHttpIncomingMessage-BqU9AHA2.mjs → NodeHttpIncomingMessage-CylGKvlB.mjs} +4 -4
- package/dist/{NodeHttpServer-C-eqvdR4.mjs → NodeHttpServer-EarHJJzn.mjs} +9 -9
- package/dist/{NodePtyAdapter-BdtcaYPg.mjs → NodePtyAdapter-C6ioPYk6.mjs} +5 -5
- package/dist/{NodeServices-pD4zkANr.mjs → NodeServices-C18DO3cx.mjs} +6 -6
- package/dist/{NodeSqliteClient-BIVa5aFu.mjs → NodeSqliteClient-CWkKfsSo.mjs} +5 -5
- package/dist/{NodeStream-BjNgA5_1.mjs → NodeStream-1N7oXzTp.mjs} +3 -3
- package/dist/{Path-D8BPsRhh.mjs → Path-ZDpyUmZ1.mjs} +2 -2
- package/dist/{PtyAdapter-B9zQDp9u.mjs → PtyAdapter-DSEyRij4.mjs} +2 -2
- package/dist/{Schema-DkAVclKk.mjs → Schema-CA_wFfhH.mjs} +141 -4
- package/dist/{SqlClient-JflyUX7a.mjs → SqlClient-Cusaqpaw.mjs} +3 -3
- package/dist/bin.mjs +7894 -2484
- package/dist/{borgTelemetryNode-B0vVayda.mjs → borgTelemetryNode-CHLcRFOW.mjs} +6 -6
- package/dist/client/.vite/manifest.json +330 -330
- package/dist/client/assets/ArrowRight-CgvCTAzu.js +2 -0
- package/dist/client/assets/ArrowSquareOut-C1CwJQ7R.js +2 -0
- package/dist/client/assets/ArrowsClockwise-CBwAQTtQ.js +2 -0
- package/dist/client/assets/CaretLeft-Bk0n02vc.js +2 -0
- package/dist/client/assets/ChatMarkdown-BGNgYyxf.js +249 -0
- package/dist/client/assets/DesignWorkspace-Ddz8UJXt.js +3 -0
- package/dist/client/assets/DiffPanel-mzb-LNBg.js +2 -0
- package/dist/client/assets/DiffWorkerPoolProvider-iCAF4Ogc.js +10 -0
- package/dist/client/assets/DocxPreview-BKhbQZ7C.js +17 -0
- package/dist/client/assets/{FilePreviewPanel-CeAwd87I.js → FilePreviewPanel-DuxNlIRO.js} +19 -19
- package/dist/client/assets/HtmlPreview-DaZHfcMP.js +2 -0
- package/dist/client/assets/PdfPreview-BoUaG-ol.js +3 -0
- package/dist/client/assets/PptxPreview-BQU4yUZZ.js +3 -0
- package/dist/client/assets/PreviewPanel-CnjyoM26.js +2 -0
- package/dist/client/assets/PullRequestCodeTab-DM_H15J2.js +6 -0
- package/dist/client/assets/{PullRequestReactions-BWjOU4KY.js → PullRequestReactions-CHoFc7lq.js} +4 -4
- package/dist/client/assets/{RightPanelResizeHandle-DZdzK7y3.js → RightPanelResizeHandle-DBci-Ee2.js} +2 -2
- package/dist/client/assets/VirtualizedFile-CZoHsBen.js +2 -0
- package/dist/client/assets/XlsxPreview-DjwlT8cY.js +3 -0
- package/dist/client/assets/accountData-C4ZvicpJ.js +16 -0
- package/dist/client/assets/assetUrls-CrfozqHH.js +2 -0
- package/dist/client/assets/browserHistoryStore-7Le_ew5p.js +4 -0
- package/dist/client/assets/browserRecording-CSyywxgr.js +2 -0
- package/dist/client/assets/clientPersistenceStorage-BlYjZvCd.js +2 -0
- package/dist/client/assets/combobox-CiD-v9Ce.js +2 -0
- package/dist/client/assets/composerMentionDrag-DqJ92Sd8.js +2 -0
- package/dist/client/assets/designCanvas.logic-HpJw8lAO.js +8 -0
- package/dist/client/assets/designOpenFileContext-BP2f7uoG.js +2 -0
- package/dist/client/assets/diffFileContents-CpXvVerb.js +248 -0
- package/dist/client/assets/empty-BoorOwgr.js +2 -0
- package/dist/client/assets/entities-CYOkudic.js +2 -0
- package/dist/client/assets/env-71Gq9H0m.js +2 -0
- package/dist/client/assets/{index-BKWzfr1Y.js → index-xOiIIEJO.js} +3 -3
- package/dist/client/assets/input-Dm20FTNt.js +2 -0
- package/dist/client/assets/{lib-DyhHMOev.js → lib-CP-ex6Vc.js} +2 -2
- package/dist/client/assets/main-SyzcWFeO.js +161 -0
- package/dist/client/assets/main-YscGsfgO.css +2 -0
- package/dist/client/assets/{pdf-C_AIVI51.js → pdf-DcYZLBb4.js} +2 -2
- package/dist/client/assets/popover-ivgAAZ7Z.js +2 -0
- package/dist/client/assets/{pptxDocument-CHL8asXA.js → pptxDocument-DtL8fmW3.js} +2 -2
- package/dist/client/assets/projectFilesQueryState-BwZ_KRI1.js +2 -0
- package/dist/client/assets/queries-DIo5yBTp.js +2 -0
- package/dist/client/assets/scroll-area-DKsvPvOo.js +1634 -0
- package/dist/client/assets/session-CgVsO0DD.js +67 -0
- package/dist/client/assets/spinner-DHhZaoFg.js +2 -0
- package/dist/client/assets/textarea-DprGKUyt.js +5 -0
- package/dist/client/assets/toggle-DwBa6pBo.js +2 -0
- package/dist/client/assets/toggle-group-BU7-0DcW.js +2 -0
- package/dist/client/assets/useWorkspaceMutationRefresh-DLI4brDf.js +2 -0
- package/dist/client/assets/utils-DgzD4MA_.js +30 -0
- package/dist/client/assets/{xlsxDocument-ANMZ6ewU.js → xlsxDocument-iqdkqQBZ.js} +2 -2
- package/dist/client/index.html +1 -1
- package/dist/service-launcher.mjs +1 -1
- package/package.json +1 -1
- package/dist/client/assets/ArrowRight-BOicMyF9.js +0 -2
- package/dist/client/assets/ArrowSquareOut-D7Y2Tt3L.js +0 -2
- package/dist/client/assets/ArrowsClockwise-DycxhEkt.js +0 -2
- package/dist/client/assets/CaretLeft-CDMA3Uas.js +0 -2
- package/dist/client/assets/ChatMarkdown-Cl8M9HCx.js +0 -247
- package/dist/client/assets/DesignWorkspace-DBL7AxwS.js +0 -3
- package/dist/client/assets/DiffPanel-BJ-Ix_7K.js +0 -2
- package/dist/client/assets/DiffWorkerPoolProvider-_R9JGgmp.js +0 -10
- package/dist/client/assets/DocxPreview-BFCC5VXn.js +0 -17
- package/dist/client/assets/HtmlPreview-BpBdu9_j.js +0 -2
- package/dist/client/assets/PdfPreview-CeECoD5z.js +0 -3
- package/dist/client/assets/PptxPreview-u6gN3x3Z.js +0 -3
- package/dist/client/assets/PreviewPanel-BVJp3UI5.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-Bxx0Vkdn.js +0 -6
- package/dist/client/assets/VirtualizedFile-CyAKSbzc.js +0 -2
- package/dist/client/assets/XlsxPreview-CaykIFrZ.js +0 -3
- package/dist/client/assets/assetUrls-BBFxUocf.js +0 -2
- package/dist/client/assets/browserHistoryStore-K9gWOOUq.js +0 -2
- package/dist/client/assets/browserRecording-DrMz1iOt.js +0 -4
- package/dist/client/assets/clientPersistenceStorage-DSC61yLx.js +0 -2
- package/dist/client/assets/combobox-C4C8XR-w.js +0 -6
- package/dist/client/assets/composerMentionDrag-D06cCeGC.js +0 -2
- package/dist/client/assets/designCanvas.logic-DuuhotDy.js +0 -8
- package/dist/client/assets/designOpenFileContext-CCQs4ovB.js +0 -2
- package/dist/client/assets/diffFileContents-Bj3q_jc2.js +0 -248
- package/dist/client/assets/empty-DynqTxIR.js +0 -2
- package/dist/client/assets/entities-dwE_i4XM.js +0 -2
- package/dist/client/assets/env-DgM3kOA4.js +0 -2
- package/dist/client/assets/input-Q4KA45-f.js +0 -2
- package/dist/client/assets/main-CI0aXqkB.css +0 -2
- package/dist/client/assets/main-DFDCV-Ns.js +0 -145
- package/dist/client/assets/popover-CXGEm4M0.js +0 -2
- package/dist/client/assets/projectFilesQueryState-7mFyaRdj.js +0 -2
- package/dist/client/assets/queries-x5LGu_Fy.js +0 -2
- package/dist/client/assets/scroll-area-D8MfzXjN.js +0 -1630
- package/dist/client/assets/session-DIGL5_Nm.js +0 -67
- package/dist/client/assets/spinner-CwxxMzkd.js +0 -2
- package/dist/client/assets/textarea-DdNchuIO.js +0 -5
- package/dist/client/assets/toggle-CmeCFqd7.js +0 -2
- package/dist/client/assets/toggle-group-iEMUfMdW.js +0 -2
- package/dist/client/assets/useLocalStorage-2W_I13tQ.js +0 -16
- package/dist/client/assets/useWorkspaceMutationRefresh-YuIxWftk.js +0 -2
- package/dist/client/assets/utils-D0kLIGeh.js +0 -30
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{v as e}from"./accountData-C4ZvicpJ.js";import{Bo as t,dn as n}from"./utils-DgzD4MA_.js";import{fn as r}from"./session-CgVsO0DD.js";import{o as i,r as a}from"./assetUrls-CrfozqHH.js";import{t as o}from"./spinner-DHhZaoFg.js";var s=e(),c=t();function l(e){let t=(0,s.c)(15),l;t[0]!==e.filePath||t[1]!==e.projectId||t[2]!==e.threadRef.threadId?(l=e.projectId?{_tag:`project-design-preview`,projectId:e.projectId,path:e.filePath}:{_tag:`design-preview`,threadId:e.threadRef.threadId,path:e.filePath},t[0]=e.filePath,t[1]=e.projectId,t[2]=e.threadRef.threadId,t[3]=l):l=t[3];let u=l,d=a(e.threadRef.environmentId,u),f;t[4]!==e.threadRef.environmentId||t[5]!==u?(f=i.createUrl({environmentId:e.threadRef.environmentId,input:{resource:u}}),t[4]=e.threadRef.environmentId,t[5]=u,t[6]=f):f=t[6];let p=r(f);if(d._tag===`Failure`){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,c.jsx)(`p`,{children:`Couldn’t load this preview.`}),t[7]=e):e=t[7];let r;return t[8]===p?r=t[9]:(r=(0,c.jsxs)(`div`,{role:`alert`,className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-sm text-muted-foreground`,children:[e,(0,c.jsx)(n,{size:`sm`,variant:`outline`,onClick:()=>p(),children:`Retry`})]}),t[8]=p,t[9]=r),r}if(d._tag!==`Success`){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,c.jsx)(`div`,{className:`grid flex-1 place-items-center text-muted-foreground`,children:(0,c.jsx)(o,{className:`size-5`})}),t[10]=e):e=t[10],e}let m;return t[11]!==d.url||t[12]!==e.fileName||t[13]!==e.version?(m=(0,c.jsx)(`iframe`,{src:d.url,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,title:e.fileName,className:`min-h-0 w-full flex-1 border-0 bg-white`},e.version),t[11]=d.url,t[12]=e.fileName,t[13]=e.version,t[14]=m):m=t[14],m}export{l as HtmlPreview,l as default};
|
|
2
|
+
//# sourceMappingURL=HtmlPreview-DaZHfcMP.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-DcYZLBb4.js","assets/index-xOiIIEJO.js","assets/index-DZprGaeP.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./index-xOiIIEJO.js";import{y as n}from"./accountData-C4ZvicpJ.js";import{Bo as r,So as i}from"./utils-DgzD4MA_.js";import{t as a}from"./CaretLeft-Bk0n02vc.js";import{t as o}from"./spinner-DHhZaoFg.js";var s=e(n(),1),c=r(),l=100*1024*1024;function u(e,t){let n=t.getViewport({scale:1.5}),r=window.document.createElement(`canvas`);r.className=`mx-auto max-w-full shadow-sm`,r.height=n.height,r.width=n.width;let i=r.getContext(`2d`);return i?(e.replaceChildren(r),t.render({canvas:r,canvasContext:i,viewport:n}).promise):Promise.resolve()}function d(e){let n=(0,s.useRef)(null),[r,d]=(0,s.useState)({status:`loading`}),[f,p]=(0,s.useState)(1),[m,h]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let n=new AbortController,r=null;return(async()=>{d({status:`loading`}),p(1);let i=await t(()=>import(`./pdf-DcYZLBb4.js`),__vite__mapDeps([0,1,2]));i.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker-TGcf_-kp.mjs`,``+import.meta.url).toString();let a=await fetch(e.url,{signal:n.signal});if(!a.ok)throw Error(`The server returned ${a.status}.`);let o=Number(a.headers.get(`Content-Length`)??NaN);if(Number.isFinite(o)&&o>l)throw Error(`This PDF is too large to preview.`);let s=await a.arrayBuffer();if(n.signal.aborted)return;if(s.byteLength>l)throw Error(`This PDF is too large to preview.`);let c=i.getDocument({data:new Uint8Array(s)});r=c;let u=await c.promise;n.signal.aborted||d({status:`ready`,pageCount:u.numPages,pdf:u})})().catch(e=>{n.signal.aborted||d({status:`failed`,message:e instanceof Error?e.message:`This PDF could not be opened.`})}),()=>{n.abort(),r?.destroy()}},[e.url]),(0,s.useEffect)(()=>{if(r.status!==`ready`)return;let e=n.current;if(!e)return;let t=!1;return h(!0),r.pdf.getPage(f).then(n=>{if(!t)return u(e,n)}).catch(()=>{t||e.replaceChildren()}).finally(()=>{t||h(!1)}),()=>{t=!0}},[f,r]),r.status===`failed`?(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:r.message}):r.status===`loading`?(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,c.jsx)(o,{className:`size-5`})}):(0,c.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/30`,children:[(0,c.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-2`,children:[(0,c.jsx)(`button`,{"aria-label":`Previous PDF page`,className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40`,disabled:f===1,onClick:()=>p(e=>Math.max(1,e-1)),type:`button`,children:(0,c.jsx)(a,{className:`size-4`})}),(0,c.jsxs)(`span`,{className:`text-xs font-medium text-foreground`,children:[`Page `,f,` of `,r.pageCount]}),(0,c.jsx)(`button`,{"aria-label":`Next PDF page`,className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40`,disabled:f===r.pageCount,onClick:()=>p(e=>Math.min(r.pageCount,e+1)),type:`button`,children:(0,c.jsx)(i,{className:`size-4`})})]}),(0,c.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-auto p-4`,children:[m?(0,c.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center text-muted-foreground`,children:(0,c.jsx)(o,{className:`size-5`})}):null,(0,c.jsx)(`div`,{"aria-label":`${e.fileName} page ${f}`,ref:n,role:`document`})]})]})}export{d as PdfPreview,d as default};
|
|
3
|
+
//# sourceMappingURL=PdfPreview-BoUaG-ol.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pptxDocument-DtL8fmW3.js","assets/rolldown-runtime-DAXXjFlN.js","assets/main-SyzcWFeO.js","assets/index-xOiIIEJO.js","assets/index-DZprGaeP.css","assets/accountData-C4ZvicpJ.js","assets/utils-DgzD4MA_.js","assets/session-CgVsO0DD.js","assets/queries-DIo5yBTp.js","assets/textarea-DprGKUyt.js","assets/clientPersistenceStorage-BlYjZvCd.js","assets/designOpenFileContext-BP2f7uoG.js","assets/empty-BoorOwgr.js","assets/input-Dm20FTNt.js","assets/browserRecording-CSyywxgr.js","assets/RightPanelResizeHandle-DBci-Ee2.js","assets/browserHistoryStore-7Le_ew5p.js","assets/entities-CYOkudic.js","assets/env-71Gq9H0m.js","assets/ArrowRight-CgvCTAzu.js","assets/ArrowSquareOut-C1CwJQ7R.js","assets/scroll-area-DKsvPvOo.js","assets/lib-BpnzBIoA.js","assets/ArrowsClockwise-CBwAQTtQ.js","assets/ChatMarkdown-BGNgYyxf.js","assets/assetUrls-CrfozqHH.js","assets/lib-CCiVGdun.js","assets/designCanvas.logic-HpJw8lAO.js","assets/designCanvas-CfWhq9nr.css","assets/CaretLeft-Bk0n02vc.js","assets/toggle-DwBa6pBo.js","assets/PullRequestReactions-CHoFc7lq.js","assets/popover-ivgAAZ7Z.js","assets/composerMentionDrag-DqJ92Sd8.js","assets/combobox-CiD-v9Ce.js","assets/useWorkspaceMutationRefresh-DLI4brDf.js","assets/DiffWorkerPoolProvider-iCAF4Ogc.js","assets/toggle-group-BU7-0DcW.js","assets/projectFilesQueryState-BwZ_KRI1.js","assets/spinner-DHhZaoFg.js","assets/zipGuard-BHHl8sLU.js","assets/main-YscGsfgO.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./index-xOiIIEJO.js";import{y as n}from"./accountData-C4ZvicpJ.js";import{Bo as r,So as i}from"./utils-DgzD4MA_.js";import{t as a}from"./CaretLeft-Bk0n02vc.js";import{t as o}from"./spinner-DHhZaoFg.js";import{t as s}from"./documentBytes-CS3KpytE.js";var c=e(n(),1),l=r();function u(e){let[n,r]=(0,c.useState)({status:`loading`}),[u,d]=(0,c.useState)(0);if((0,c.useEffect)(()=>{let n=new AbortController;return(async()=>{r({status:`loading`}),d(0);let i=await s(e.url,n.signal);if(n.signal.aborted)return;let{readSlides:a}=await t(async()=>{let{readSlides:e}=await import(`./pptxDocument-DtL8fmW3.js`);return{readSlides:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41])),o=await a(i);if(!n.signal.aborted){if(o.length===0)throw Error(`This presentation has no readable slides.`);r({status:`ready`,slides:o})}})().catch(e=>{n.signal.aborted||r({status:`failed`,message:e instanceof Error?e.message:`This presentation could not be opened.`})}),()=>n.abort()},[e.url]),n.status===`failed`)return(0,l.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:n.message});if(n.status===`loading`)return(0,l.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,l.jsx)(o,{className:`size-5`})});let f=n.slides[u];return f?(0,l.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,l.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-2`,children:[(0,l.jsx)(`button`,{"aria-label":`Previous slide`,className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40`,disabled:u===0,onClick:()=>d(e=>Math.max(0,e-1)),type:`button`,children:(0,l.jsx)(a,{className:`size-4`})}),(0,l.jsxs)(`span`,{className:`text-xs font-medium text-foreground`,children:[`Slide `,u+1,` of `,n.slides.length]}),(0,l.jsx)(`button`,{"aria-label":`Next slide`,className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40`,disabled:u===n.slides.length-1,onClick:()=>d(e=>Math.min(n.slides.length-1,e+1)),type:`button`,children:(0,l.jsx)(i,{className:`size-4`})})]}),(0,l.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,l.jsxs)(`article`,{className:`mx-auto max-w-3xl rounded-lg border border-border/60 bg-card p-4`,children:[f.paragraphs.length===0&&f.images.length===0?(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`This slide has no text.`}):null,f.paragraphs.map(e=>(0,l.jsx)(`p`,{className:`mb-1 text-sm leading-relaxed`,children:e},`${f.slideNumber}:${e}`)),f.images.length>0?(0,l.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:f.images.map(e=>(0,l.jsx)(`img`,{alt:``,className:`max-h-40 max-w-full rounded border border-border/60`,src:e},e.slice(0,64)))}):null,f.notes===``?null:(0,l.jsxs)(`details`,{className:`mt-3`,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-muted-foreground`,children:`Speaker notes`}),(0,l.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed whitespace-pre-line text-muted-foreground`,children:f.notes})]})]})})]}):null}export{u as PptxPreview,u as default};
|
|
3
|
+
//# sourceMappingURL=PptxPreview-BQU4yUZZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{Ct as t,ao as n,to as r,v as i,y as a}from"./accountData-C4ZvicpJ.js";import{Bn as o,Bo as s,Fn as c,Hn as l,In as u,Ln as d,Nn as f,P as p,Pn as m,Vn as h,dn as g,fo as _,go as v,kn as y,t as b,wo as x,zn as S}from"./utils-DgzD4MA_.js";import{On as C,Sn as w,Zt as T,_n as E,bn as D,mn as O,yn as k}from"./session-CgVsO0DD.js";import{B as A,P as ee,c as j,f as M,fr as N,ir as P,l as F,o as I,u as te,w as ne,zn as re}from"./textarea-DprGKUyt.js";import{a as L,c as ie,l as ae,o as R,r as z,s as oe,t as B,u as V}from"./empty-BoorOwgr.js";import{B as H,E as se,G as ce,H as U,J as W,K as le,U as G,V as K,W as q,X as J,Y,Z as ue,a as de,c as X,d as fe,g as pe,h as me,i as he,j as ge,k as _e,n as ve,o as ye,p as be,q as xe,s as Se,t as Ce,v as we,x as Te,y as Ee}from"./browserRecording-CSyywxgr.js";import{t as De}from"./ArrowRight-CgvCTAzu.js";import{t as Oe}from"./ArrowSquareOut-C1CwJQ7R.js";import{i as ke,r as Ae}from"./RightPanelResizeHandle-DBci-Ee2.js";import{A as je,C as Me,D as Ne,F as Pe,I as Fe,L as Ie,N as Le,O as Re,b as ze,d as Be,f as Ve,h as He,i as Ue,k as We,m as Ge,n as Ke,o as qe,r as Je,t as Ye,x as Xe}from"./browserHistoryStore-7Le_ew5p.js";import{j as Ze}from"./entities-CYOkudic.js";import{c as Qe}from"./env-71Gq9H0m.js";var Z=e(a(),1),$e=new Map([[`bold`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M208,52H182.42L170,33.34A12,12,0,0,0,160,28H96a12,12,0,0,0-10,5.34L73.57,52H48A28,28,0,0,0,20,80V192a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V80A28,28,0,0,0,208,52Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4H80a12,12,0,0,0,10-5.34L102.42,52h51.15L166,70.66A12,12,0,0,0,176,76h32a4,4,0,0,1,4,4ZM128,84a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,84Zm0,72a24,24,0,1,1,24-24A24,24,0,0,1,128,156Z`}))],[`duotone`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M208,64H176L160,40H96L80,64H48A16,16,0,0,0,32,80V192a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V80A16,16,0,0,0,208,64ZM128,168a36,36,0,1,1,36-36A36,36,0,0,1,128,168Z`,opacity:`0.2`}),Z.createElement(`path`,{d:`M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z`}))],[`fill`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm-44,76a36,36,0,1,1-36-36A36,36,0,0,1,164,132Z`}))],[`light`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M208,58H179.21L165,36.67A6,6,0,0,0,160,34H96a6,6,0,0,0-5,2.67L76.78,58H48A22,22,0,0,0,26,80V192a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V80A22,22,0,0,0,208,58Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V80A10,10,0,0,1,48,70H80a6,6,0,0,0,5-2.67L99.21,46h57.57L171,67.33A6,6,0,0,0,176,70h32a10,10,0,0,1,10,10ZM128,90a42,42,0,1,0,42,42A42,42,0,0,0,128,90Zm0,72a30,30,0,1,1,30-30A30,30,0,0,1,128,162Z`}))],[`regular`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z`}))],[`thin`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M208,60H178.13L163.32,37.78A4,4,0,0,0,160,36H96a4,4,0,0,0-3.32,1.78L77.85,60H48A20,20,0,0,0,28,80V192a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V80A20,20,0,0,0,208,60Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V80A12,12,0,0,1,48,68H80a4,4,0,0,0,3.33-1.78L98.13,44h59.72l14.82,22.22A4,4,0,0,0,176,68h32a12,12,0,0,1,12,12ZM128,92a40,40,0,1,0,40,40A40,40,0,0,0,128,92Zm0,72a32,32,0,1,1,32-32A32,32,0,0,1,128,164Z`}))]]),et=new Map([[`bold`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z`}))],[`duotone`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M176,32V224a16,16,0,0,1-16,16H96a16,16,0,0,1-16-16V32A16,16,0,0,1,96,16h64A16,16,0,0,1,176,32Z`,opacity:`0.2`}),Z.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z`}))],[`fill`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M160,16H96A16,16,0,0,0,80,32V224a16,16,0,0,0,16,16h64a16,16,0,0,0,16-16V32A16,16,0,0,0,160,16ZM128,208a12,12,0,1,1,12-12A12,12,0,0,1,128,208Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,72Z`}))],[`light`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M118,60a10,10,0,1,1,10,10A10,10,0,0,1,118,60Zm10,58a10,10,0,1,0,10,10A10,10,0,0,0,128,118Zm0,68a10,10,0,1,0,10,10A10,10,0,0,0,128,186Z`}))],[`regular`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z`}))],[`thin`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M120,60a8,8,0,1,1,8,8A8,8,0,0,1,120,60Zm8,60a8,8,0,1,0,8,8A8,8,0,0,0,128,120Zm0,68a8,8,0,1,0,8,8A8,8,0,0,0,128,188Z`}))]]),tt=Object.defineProperty,nt=Object.defineProperties,rt=Object.getOwnPropertyDescriptors,it=Object.getOwnPropertySymbols,at=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,st=(e,t,n)=>t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ct=(e,t)=>{for(var n in t||={})at.call(t,n)&&st(e,n,t[n]);if(it)for(var n of it(t))ot.call(t,n)&&st(e,n,t[n]);return e},lt=(e,t)=>nt(e,rt(t)),ut=(0,Z.forwardRef)((e,t)=>Z.createElement(x,lt(ct({ref:t},e),{weights:$e})));ut.displayName=`Camera`;var dt=Object.defineProperty,ft=Object.defineProperties,pt=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable,_t=(e,t,n)=>t in e?dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vt=(e,t)=>{for(var n in t||={})ht.call(t,n)&&_t(e,n,t[n]);if(mt)for(var n of mt(t))gt.call(t,n)&&_t(e,n,t[n]);return e},yt=(e,t)=>ft(e,pt(t)),bt=(0,Z.forwardRef)((e,t)=>Z.createElement(x,yt(vt({ref:t},e),{weights:et})));bt.displayName=`DotsThreeVertical`;var Q=i(),$=s(),xt=()=>{};function St(e){let t=(0,Q.c)(92),{url:n,loading:r,canGoBack:i,canGoForward:a,refreshDisabled:o,inputDisabled:s,focusUrlNonce:c,onBack:l,onForward:u,onRefresh:d,onSubmit:f,onOpenInBrowser:p,onCapture:m,captureDisabled:h,recording:_,onPictureInPicture:v,pictureInPicture:y,pictureInPictureDisabled:x,onPickElement:S,pickActive:C,pickDisabled:w,pickDisabledReason:T,trailingActions:E}=e,D=(0,Z.useRef)(null),[O,k]=(0,Z.useState)(n),[A,ee]=(0,Z.useState)(!1),j,N;t[0]===c?(j=t[1],N=t[2]):(j=()=>{if(c==null)return;let e=D.current;e&&e.focus()},N=[c],t[0]=c,t[1]=j,t[2]=N),(0,Z.useEffect)(j,N);let P;t[3]!==O||t[4]!==f?(P=e=>{e?.preventDefault();let t=O.trim();t.length!==0&&(f(t),D.current?.blur())},t[3]=O,t[4]=f,t[5]=P):P=t[5];let I=P,ne=i?l:xt,re=!i,L;t[6]!==ne||t[7]!==re?(L=(0,$.jsx)(g,{variant:`ghost`,size:`icon-xs`,onClick:ne,disabled:re,"aria-label":`Back`,type:`button`}),t[6]=ne,t[7]=re,t[8]=L):L=t[8];let R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(J,{}),t[9]=R):R=t[9];let z;t[10]===L?z=t[11]:(z=(0,$.jsx)(M,{render:L,children:R}),t[10]=L,t[11]=z);let B;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(te,{children:`Back`}),t[12]=B):B=t[12];let H;t[13]===z?H=t[14]:(H=(0,$.jsxs)(F,{children:[z,B]}),t[13]=z,t[14]=H);let se=a?u:xt,ce=!a,U;t[15]!==se||t[16]!==ce?(U=(0,$.jsx)(g,{variant:`ghost`,size:`icon-xs`,onClick:se,disabled:ce,"aria-label":`Forward`,type:`button`}),t[15]=se,t[16]=ce,t[17]=U):U=t[17];let G;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(De,{}),t[18]=G):G=t[18];let K;t[19]===U?K=t[20]:(K=(0,$.jsx)(M,{render:U,children:G}),t[19]=U,t[20]=K);let q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(te,{children:`Forward`}),t[21]=q):q=t[21];let Y;t[22]===K?Y=t[23]:(Y=(0,$.jsxs)(F,{children:[K,q]}),t[22]=K,t[23]=Y);let ue=o?xt:d,de=r?`Stop`:`Refresh`,X;t[24]!==o||t[25]!==ue||t[26]!==de?(X=(0,$.jsx)(g,{variant:`ghost`,size:`icon-xs`,onClick:ue,disabled:o,"aria-label":de,type:`button`}),t[24]=o,t[25]=ue,t[26]=de,t[27]=X):X=t[27];let fe=r&&`animate-spin`,pe;t[28]===fe?pe=t[29]:(pe=b(fe),t[28]=fe,t[29]=pe);let me;t[30]===pe?me=t[31]:(me=(0,$.jsx)(V,{className:pe}),t[30]=pe,t[31]=me);let he;t[32]!==X||t[33]!==me?(he=(0,$.jsx)(M,{render:X,children:me}),t[32]=X,t[33]=me,t[34]=he):he=t[34];let ge=r?`Loading…`:`Refresh`,_e;t[35]===ge?_e=t[36]:(_e=(0,$.jsx)(te,{children:ge}),t[35]=ge,t[36]=_e);let ve;t[37]!==he||t[38]!==_e?(ve=(0,$.jsxs)(F,{children:[he,_e]}),t[37]=he,t[38]=_e,t[39]=ve):ve=t[39];let ye;t[40]!==H||t[41]!==Y||t[42]!==ve?(ye=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`Navigation`,children:[H,Y,ve]}),t[40]=H,t[41]=Y,t[42]=ve,t[43]=ye):ye=t[43];let be=A?O:n,xe=p&&!A&&`group-hover/address:pe-7 transition-[padding]`,Se;t[44]===xe?Se=t[45]:(Se=b(xe),t[44]=xe,t[45]=Se);let Ce;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=e=>k(e.target.value),t[46]=Ce):Ce=t[46];let we;t[47]===n?we=t[48]:(we=()=>{k(n),ee(!0),queueMicrotask(()=>D.current?.select())},t[47]=n,t[48]=we);let Te;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Te=()=>{ee(!1)},t[49]=Te):Te=t[49];let Ee;t[50]!==I||t[51]!==n?(Ee=e=>{e.key===`Enter`&&I(e),e.key===`Escape`&&(e.preventDefault(),k(n),D.current?.blur())},t[50]=I,t[51]=n,t[52]=Ee):Ee=t[52];let ke;t[53]!==s||t[54]!==be||t[55]!==Se||t[56]!==we||t[57]!==Ee?(ke=(0,$.jsx)(F,{children:(0,$.jsx)(M,{render:(0,$.jsx)(ae,{ref:D,value:be,className:Se,onChange:Ce,onFocus:we,onBlur:Te,onKeyDown:Ee,placeholder:`Search or enter URL`,spellCheck:!1,disabled:s,"data-preview-url-input":!0,size:`sm`})})}),t[53]=s,t[54]=be,t[55]=Se,t[56]=we,t[57]=Ee,t[58]=ke):ke=t[58];let Ae;t[59]!==A||t[60]!==p?(Ae=p&&!A?(0,$.jsx)(ie,{align:`inline-end`,className:`pointer-events-none absolute inset-y-0 right-0 opacity-0 transition-opacity group-hover/address:pointer-events-auto group-hover/address:opacity-100`,children:(0,$.jsxs)(F,{children:[(0,$.jsx)(M,{render:(0,$.jsx)(g,{variant:`ghost`,size:`icon-xs`,onClick:p,"aria-label":`Open in system browser`,type:`button`}),children:(0,$.jsx)(Oe,{})}),(0,$.jsx)(te,{children:`Open in system browser`})]})}):null,t[59]=A,t[60]=p,t[61]=Ae):Ae=t[61];let je;t[62]!==ke||t[63]!==Ae?(je=(0,$.jsxs)(oe,{variant:`ghost`,className:`group/address h-7 flex-1`,children:[ke,Ae]}),t[62]=ke,t[63]=Ae,t[64]=je):je=t[64];let Me;t[65]!==S||t[66]!==C||t[67]!==w||t[68]!==T?(Me=S?(0,$.jsxs)(F,{children:[(0,$.jsx)(M,{render:(0,$.jsx)(g,{variant:C?`secondary`:`ghost`,size:`icon-xs`,onClick:S,disabled:w,"aria-label":C?`Cancel annotation`:`Annotate preview`,"aria-pressed":C?`true`:`false`,type:`button`}),children:(0,$.jsx)(W,{className:b(C&&`text-primary`)})}),(0,$.jsx)(te,{children:w&&T?T:C?`Cancel annotation (Esc)`:`Annotate elements, regions, and drawings`})]}):null,t[65]=S,t[66]=C,t[67]=w,t[68]=T,t[69]=Me):Me=t[69];let Ne;t[70]!==h||t[71]!==m||t[72]!==_?(Ne=m?(0,$.jsxs)(F,{children:[(0,$.jsxs)(M,{render:(0,$.jsx)(g,{variant:_?`secondary`:`ghost`,size:`icon-xs`,onClick:e=>m(e.shiftKey),"aria-label":_?`Stop recording`:`Capture screenshot`,type:`button`,className:`relative`,disabled:h}),children:[(0,$.jsx)(ut,{className:b(_&&`text-destructive`)}),_?(0,$.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-1.5 animate-status-pulse rounded-full bg-destructive`}):null]}),(0,$.jsx)(te,{children:_?`Stop recording`:`Screenshot · Shift-click to record`})]}):null,t[70]=h,t[71]=m,t[72]=_,t[73]=Ne):Ne=t[73];let Pe;t[74]!==v||t[75]!==y||t[76]!==x?(Pe=v?(0,$.jsxs)(F,{children:[(0,$.jsx)(M,{render:(0,$.jsx)(g,{variant:y?`secondary`:`ghost`,size:`icon-xs`,onClick:v,"aria-label":y?`Close floating preview`:`Float preview over chat`,"aria-pressed":y?`true`:`false`,type:`button`,disabled:x}),children:(0,$.jsx)(le,{className:b(y&&`text-primary`)})}),(0,$.jsx)(te,{children:y?`Close floating preview`:`Float preview over chat`})]}):null,t[74]=v,t[75]=y,t[76]=x,t[77]=Pe):Pe=t[77];let Fe;t[78]!==I||t[79]!==ye||t[80]!==je||t[81]!==Me||t[82]!==Ne||t[83]!==Pe||t[84]!==E?(Fe=(0,$.jsxs)(`form`,{onSubmit:I,className:`flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2 in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[ye,je,Me,Ne,Pe,E]}),t[78]=I,t[79]=ye,t[80]=je,t[81]=Me,t[82]=Ne,t[83]=Pe,t[84]=E,t[85]=Fe):Fe=t[85];let Ie;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Ie={boxShadow:`0 0 6px 1px var(--color-ring)`},t[86]=Ie):Ie=t[86];let Le;t[87]===r?Le=t[88]:(Le=(0,$.jsx)(`div`,{"aria-hidden":!0,"data-loading":r,className:`preview-loading-progress pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 w-full origin-left rounded-r-full bg-primary`,style:Ie}),t[87]=r,t[88]=Le);let Re;return t[89]!==Fe||t[90]!==Le?(Re=(0,$.jsxs)(`div`,{className:`relative`,children:[Fe,Le]}),t[89]=Fe,t[90]=Le,t[91]=Re):Re=t[91],Re}function Ct(e){let t=(0,Q.c)(17),{threadRef:n,server:r,onOpen:i}=e,a;t[0]===r?a=t[1]:(a=wt(r),t[0]=r,t[1]=a);let o=a,s;t[2]!==r.requestedUrl||t[3]!==n?(s=(0,$.jsx)(Te,{threadRef:n,url:r.requestedUrl}),t[2]=r.requestedUrl,t[3]=n,t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]!==r.host||t[8]!==r.port?(l=(0,$.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[r.host,`:`,r.port]}),t[7]=r.host,t[8]=r.port,t[9]=l):l=t[9];let u;t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12];let d;return t[13]!==i||t[14]!==s||t[15]!==u?(d=(0,$.jsxs)(`button`,{type:`button`,onClick:i,className:`group flex w-full items-center gap-3 px-3 py-3 text-left hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[s,u]}),t[13]=i,t[14]=s,t[15]=u,t[16]=d):d=t[16],d}function wt(e){return e.processName?e.processName:`Listening`}function Tt(e){let t=(0,Q.c)(26),{threadRef:n,entry:r,onOpen:i,onRemove:a}=e,o;t[0]===r.url?o=t[1]:(o=new URL(r.url),t[0]=r.url,t[1]=o);let s=o,c=s.pathname===`/`?``:s.pathname,l=`${s.host}${c}${s.search}${s.hash}`,u;t[2]===r.lastVisitedAt?u=t[3]:(u=Ye(r.lastVisitedAt)?Qe(new Date(r.lastVisitedAt).toISOString()):``,t[2]=r.lastVisitedAt,t[3]=u);let d=u;Ee();let f;t[4]!==r.url||t[5]!==n?(f=(0,$.jsx)(Te,{threadRef:n,url:r.url}),t[4]=r.url,t[5]=n,t[6]=f):f=t[6];let p=r.title??l,m;t[7]===p?m=t[8]:(m=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:p}),t[7]=p,t[8]=m);let h=r.title?`${l} · `:``,g;t[9]!==h||t[10]!==d?(g=(0,$.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[h,d]}),t[9]=h,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==m||t[13]!==g?(_=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[m,g]}),t[12]=m,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==i||t[16]!==f||t[17]!==_?(v=(0,$.jsxs)(`button`,{type:`button`,onClick:i,className:`flex w-full items-center gap-3 px-3 py-3 pr-10 text-left hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[f,_]}),t[15]=i,t[16]=f,t[17]=_,t[18]=v):v=t[18];let y=`Remove ${l} from history`,b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(N,{className:`size-3.5`}),t[19]=b):b=t[19];let x;t[20]!==a||t[21]!==y?(x=(0,$.jsx)(`button`,{type:`button`,"aria-label":y,onClick:a,className:`absolute right-3 rounded p-1 text-muted-foreground opacity-0 hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:opacity-100`,children:b}),t[20]=a,t[21]=y,t[22]=x):x=t[22];let S;return t[23]!==x||t[24]!==v?(S=(0,$.jsxs)(`div`,{className:`group relative flex w-full items-center`,children:[v,x]}),t[23]=x,t[24]=v,t[25]=S):S=t[25],S}var Et=Object.freeze([]);function Dt(e){let t=[],n=new Set;for(let r of e??[])if(!(r.length===0||r.length>2048||r.trim().length!==r.length))try{let e=new URL(r);if(e.protocol!==`http:`&&e.protocol!==`https:`||!Ve(e.hostname)||e.href.length>2048)continue;let i=new URL(e.href);if(i.hash=``,n.has(i.href))continue;if(n.add(i.href),t.push(e.href),t.length>=32)break}catch{}return t}function Ot(e,t){let n=(0,Q.c)(7),r,i;if(n[0]!==t||n[1]!==e){let a=Dt(t);r=re,i=e===null?null:Xe.discoveredServers({environmentId:e,input:a.length?{configuredUrls:a}:{}}),n[0]=t,n[1]=e,n[2]=r,n[3]=i}else r=n[2],i=n[3];let a=r(i);a.data?.configuredUrlProbing,a.data?.servers;let o=a.data?.servers??Et,s=a.data?.configuredUrlProbing===!0,c;return n[4]!==o||n[5]!==s?(c={servers:o,configuredUrlProbing:s},n[4]=o,n[5]=s,n[6]=c):c=n[6],c}function kt(e){let t=(0,Q.c)(7),n=Ot(e.environmentId,e.configuredUrls),r;if(t[0]!==e.configuredUrls||t[1]!==e.environmentId||t[2]!==n.configuredUrlProbing||t[3]!==n.servers){let i;t[5]===e.environmentId?i=t[6]:(i=t=>({...t,url:Be(e.environmentId,t.url),requestedUrl:t.url}),t[5]=e.environmentId,t[6]=i),r=At({scanner:n.servers.map(i),configuredUrls:e.configuredUrls??[],configuredUrlProbing:n.configuredUrlProbing}),t[0]=e.configuredUrls,t[1]=e.environmentId,t[2]=n.configuredUrlProbing,t[3]=n.servers,t[4]=r}else r=t[4];return r}function At(e){let t=new Map;for(let n of e.configuredUrls){let e=Mt(n);if(!e)continue;let r=jt(e.host,e.port);t.has(r)||t.set(r,e)}let n=[];for(let r of e.scanner){let i=jt(r.host,r.port),a=t.get(i);n.push({...r,requestedUrl:a&&e.configuredUrlProbing===!1?a.url:r.requestedUrl,source:a?`configured`:`scanner`})}return n.toSorted((e,t)=>{let n={configured:0,scanner:1};return n[e.source]===n[t.source]?e.port-t.port:n[e.source]-n[t.source]})}function jt(e,t){let n=e.toLowerCase();return`${Ve(n)?`loopback`:n}:${t}`}function Mt(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`||!Ve(t.hostname))return null;let n=t.port?Number.parseInt(t.port,10):t.protocol===`http:`?80:443;return!Number.isFinite(n)||n<=0?null:{host:t.hostname,port:n,url:t.href}}catch{return null}}function Nt(e){let t=(0,Q.c)(24),{threadRef:n,environmentId:r,configuredUrls:i,recentEntries:a,onRemoveRecent:o,onOpenUrl:s}=e,c;t[0]!==i||t[1]!==r?(c={environmentId:r,configuredUrls:i},t[0]=i,t[1]=r,t[2]=c):c=t[2];let l=kt(c),u,d,f,p;if(t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==l.length||t[7]!==n){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=a.filter(Pt).slice(0,8);if(l.length===0&&e.length===0){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(B,{children:[(0,$.jsx)(L,{variant:`icon`,children:(0,$.jsx)(Ie,{className:`size-4.5 text-muted-foreground`})}),(0,$.jsx)(R,{children:`No preview yet`}),(0,$.jsx)(z,{children:`Type a URL above, or run a dev script. Browser-ready localhost servers will show up here automatically.`})]}),t[12]=e):e=t[12],p=e;break bb0}f=`flex h-full min-h-0 overflow-y-auto px-5 py-8`,u=`mx-auto flex w-full max-w-xl flex-col gap-6`,d=e.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(ke,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Recently used`})]}),(0,$.jsx)(`div`,{className:`flex flex-col divide-y divide-line overflow-hidden rounded-tile bg-canvas-quiet`,children:e.map(e=>(0,$.jsx)(Tt,{threadRef:n,entry:e,onOpen:()=>s(e.url),onRemove:()=>o(e.url)},e.url))})]}):null}t[3]=s,t[4]=o,t[5]=a,t[6]=l.length,t[7]=n,t[8]=u,t[9]=d,t[10]=f,t[11]=p}else u=t[8],d=t[9],f=t[10],p=t[11];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[13]!==s||t[14]!==l||t[15]!==n?(m=l.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(Y,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Local servers`})]}),(0,$.jsx)(`div`,{className:`flex flex-col divide-y divide-line overflow-hidden rounded-tile bg-canvas-quiet`,children:l.map(e=>(0,$.jsx)(Ct,{threadRef:n,server:e,onOpen:()=>s(e.requestedUrl)},`${e.host}:${e.port}`))}),(0,$.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:`Select a live local server to open it in this browser tab.`})]}):null,t[13]=s,t[14]=l,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==u||t[18]!==d||t[19]!==m?(h=(0,$.jsxs)(`div`,{className:u,children:[d,m]}),t[17]=u,t[18]=d,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==f||t[22]!==h?(g=(0,$.jsx)(`div`,{className:f,children:h}),t[21]=f,t[22]=h,t[23]=g):g=t[23],g}function Pt(e){return URL.canParse(e.url)}var Ft=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}];function It(e){let t=(0,Q.c)(73),{tabId:n,hasWebContents:r,zoomFactor:i,colorScheme:a,deviceToolbarVisible:s,onToggleDeviceToolbar:u,nativePictureInPicture:p,onNativePictureInPicture:_}=e,v=ne();if(!K)return null;let b=!n||!r,x;t[0]===n?x=t[1]:(x=e=>()=>{n&&e(n).catch(Wt)},t[0]=n,t[1]=x);let C=x,w;t[2]===i?w=t[3]:(w=Math.round(i*100),t[2]=i,t[3]=w);let T=`${w}%`,E;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsxs)(F,{children:[(0,$.jsx)(M,{render:(0,$.jsx)(l,{render:(0,$.jsx)(g,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":`Preview menu`})}),children:(0,$.jsx)(bt,{})}),(0,$.jsx)(te,{children:`More`})]}),t[4]=E):E=t[4];let D;t[5]===C?D=t[6]:(D=C(K.hardReload),t[5]=C,t[6]=D);let O;t[7]!==D||t[8]!==b?(O=(0,$.jsx)(f,{onClick:D,disabled:b,children:`Hard reload`}),t[7]=D,t[8]=b,t[9]=O):O=t[9];let k;t[10]!==C||t[11]!==v||t[12]!==b?(k=v?(0,$.jsx)(f,{onClick:C(K.openDevTools),disabled:b,children:`Open DevTools`}):null,t[10]=C,t[11]=v,t[12]=b,t[13]=k):k=t[13];let A=p?`Close separate preview window`:`Open separate preview window`,ee;t[14]!==_||t[15]!==A||t[16]!==b?(ee=(0,$.jsx)(f,{onClick:_,disabled:b,children:A}),t[14]=_,t[15]=A,t[16]=b,t[17]=ee):ee=t[17];let j=s?`Hide device toolbar`:`Show device toolbar`,N;t[18]!==u||t[19]!==j||t[20]!==b?(N=(0,$.jsx)(f,{onClick:u,disabled:b,children:j}),t[18]=u,t[19]=j,t[20]=b,t[21]=N):N=t[21];let P;t[22]===b?P=t[23]:(P=(0,$.jsx)(h,{disabled:b,children:`Appearance`}),t[22]=b,t[23]=P);let I;t[24]===n?I=t[25]:(I=e=>{n&&K.setColorScheme(n,e).catch(Ut)},t[24]=n,t[25]=I);let re;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(re=Ft.map(Ht),t[26]=re):re=t[26];let L;t[27]!==a||t[28]!==I?(L=(0,$.jsx)(o,{className:`min-w-32`,children:(0,$.jsx)(c,{value:a,onValueChange:I,children:re})}),t[27]=a,t[28]=I,t[29]=L):L=t[29];let ie;t[30]!==P||t[31]!==L?(ie=(0,$.jsxs)(S,{children:[P,L]}),t[30]=P,t[31]=L,t[32]=ie):ie=t[32];let ae;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(d,{}),t[33]=ae):ae=t[33];let R;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(`span`,{children:`Zoom`}),t[34]=R):R=t[34];let z;t[35]===C?z=t[36]:(z=C(K.zoomOut),t[35]=C,t[36]=z);let oe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(xe,{}),t[37]=oe):oe=t[37];let B;t[38]!==z||t[39]!==b?(B=(0,$.jsx)(g,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:z,"aria-label":`Zoom out`,disabled:b,children:oe}),t[38]=z,t[39]=b,t[40]=B):B=t[40];let V;t[41]===T?V=t[42]:(V=(0,$.jsx)(`span`,{className:`min-w-12 text-center text-xs tabular-nums text-muted-foreground`,children:T}),t[41]=T,t[42]=V);let H;t[43]===C?H=t[44]:(H=C(K.zoomIn),t[43]=C,t[44]=H);let se;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(ce,{}),t[45]=se):se=t[45];let U;t[46]!==H||t[47]!==b?(U=(0,$.jsx)(g,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:H,"aria-label":`Zoom in`,disabled:b,children:se}),t[46]=H,t[47]=b,t[48]=U):U=t[48];let W;t[49]===C?W=t[50]:(W=C(K.resetZoom),t[49]=C,t[50]=W);let le;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(ue,{}),t[51]=le):le=t[51];let G;t[52]!==W||t[53]!==b?(G=(0,$.jsx)(g,{variant:`ghost`,size:`icon-xs`,type:`button`,onClick:W,"aria-label":`Reset zoom`,className:`[:hover,[data-pressed]]:bg-foreground/10`,disabled:b,children:le}),t[52]=W,t[53]=b,t[54]=G):G=t[54];let q;t[55]!==B||t[56]!==V||t[57]!==U||t[58]!==G?(q=(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[B,V,U,G]}),t[55]=B,t[56]=V,t[57]=U,t[58]=G,t[59]=q):q=t[59];let J;t[60]!==q||t[61]!==b?(J=(0,$.jsxs)(f,{closeOnClick:!1,onClick:Vt,className:`justify-between`,disabled:b,children:[R,q]}),t[60]=q,t[61]=b,t[62]=J):J=t[62];let Y,de,X;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,$.jsx)(d,{}),de=(0,$.jsx)(f,{onClick:zt,children:`Clear cookies`}),X=(0,$.jsx)(f,{onClick:Lt,children:`Clear cache`}),t[63]=Y,t[64]=de,t[65]=X):(Y=t[63],de=t[64],X=t[65]);let fe;return t[66]!==N||t[67]!==ie||t[68]!==J||t[69]!==O||t[70]!==k||t[71]!==ee?(fe=(0,$.jsxs)(y,{children:[E,(0,$.jsxs)(m,{align:`end`,sideOffset:6,className:`min-w-56`,children:[O,k,ee,N,ie,ae,J,Y,de,X]})]}),t[66]=N,t[67]=ie,t[68]=J,t[69]=O,t[70]=k,t[71]=ee,t[72]=fe):fe=t[72],fe}function Lt(){K.clearCache().catch(Rt)}function Rt(){}function zt(){K.clearCookies().catch(Bt)}function Bt(){}function Vt(e){return e.preventDefault()}function Ht(e){return(0,$.jsx)(u,{value:e.value,children:e.label},e.value)}function Ut(){}function Wt(){}function Gt(e){return Fe[e]||(e.length>0?e:`Network error`)}function Kt(e){let t=(0,Q.c)(32),{url:n,code:r,description:i,onReload:a}=e,[o,s]=(0,Z.useState)(!1),c;t[0]===n?c=t[1]:(c=Yt(n)??n,t[0]=n,t[1]=c);let l=c,u;t[2]===i?u=t[3]:(u=Gt(i),t[2]=i,t[3]=u);let d=u,f;t[4]!==r||t[5]!==i?(f=i.length>0?i:`ERR_${Math.abs(r)||`FAILED`}`,t[4]=r,t[5]=i,t[6]=f):f=t[6];let p=f,m,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(Jt,{className:`mb-6 size-12 text-muted-foreground/70`}),h=(0,$.jsx)(`h1`,{className:`mb-3 text-2xl font-semibold leading-tight text-foreground`,children:`This site can’t be reached`}),t[7]=m,t[8]=h):(m=t[7],h=t[8]);let _;t[9]===l?_=t[10]:(_=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:l}),t[9]=l,t[10]=_);let v;t[11]!==d||t[12]!==_?(v=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[_,`: `,d,`.`]}),t[11]=d,t[12]=_,t[13]=v):v=t[13];let y;t[14]===o?y=t[15]:(y=o?(0,$.jsxs)(`div`,{className:`mt-6 rounded-lg border border-border bg-muted/40 p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`mb-2 font-medium text-foreground`,children:`Try:`}),(0,$.jsxs)(`ul`,{className:`list-disc space-y-1 pl-5 text-muted-foreground`,children:[(0,$.jsx)(`li`,{children:`Checking your connection`}),(0,$.jsx)(`li`,{children:`Confirming the dev server is running`}),(0,$.jsx)(`li`,{children:`Checking the proxy and the firewall`})]})]}):null,t[14]=o,t[15]=y);let b;t[16]===p?b=t[17]:(b=(0,$.jsx)(`div`,{className:`mt-8 text-xs uppercase tracking-wide text-muted-foreground/70`,children:p}),t[16]=p,t[17]=b);let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>s(qt),t[18]=x):x=t[18];let S=o?`Hide details`:`Details`,C;t[19]===S?C=t[20]:(C=(0,$.jsx)(g,{type:`button`,variant:`outline`,size:`sm`,onClick:x,children:S}),t[19]=S,t[20]=C);let w;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(`div`,{className:`flex-1`}),t[21]=w):w=t[21];let T;t[22]===a?T=t[23]:(T=(0,$.jsx)(g,{type:`button`,size:`sm`,onClick:a,children:`Reload`}),t[22]=a,t[23]=T);let E;t[24]!==C||t[25]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[C,w,T]}),t[24]=C,t[25]=T,t[26]=E):E=t[26];let D;return t[27]!==E||t[28]!==v||t[29]!==y||t[30]!==b?(D=(0,$.jsx)(`div`,{className:`relative flex h-full min-h-0 w-full overflow-y-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-1 flex-col px-8 py-12 sm:py-16`,children:[m,h,v,y,b,E]})}),t[27]=E,t[28]=v,t[29]=y,t[30]=b,t[31]=D):D=t[31],D}function qt(e){return!e}function Jt(e){let t=(0,Q.c)(5),{className:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`path`,{d:`M16 12 L48 12 L48 52 L16 52 Z`}),i=(0,$.jsx)(`path`,{d:`M22 22 L42 22 M22 30 L36 30 M22 38 L40 38`,strokeLinecap:`round`}),a=(0,$.jsx)(`path`,{d:`M52 8 L12 56`,strokeLinecap:`round`}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,$.jsxs)(`svg`,{viewBox:`0 0 64 64`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,className:n,children:[r,i,a]}),t[3]=n,t[4]=o),o}function Yt(e){try{return new URL(e).host}catch{return null}}var Xt=class extends n()(`PreviewSessionThreadKeyParseError`,{threadKey:r}){get message(){return`Invalid scoped preview thread key: ${this.threadKey}`}},Zt=E(e=>{let t=_(e);if(t===null)throw new Xt({threadKey:e});let n=Xe.list({environmentId:t.environmentId,input:{threadId:t.threadId}}),r=Xe.events({environmentId:t.environmentId,input:{}});return k(e=>{let i=!1,a=0,o=e=>{C(e)&&We(t,e.value)},s=r=>{if(!C(r)||r.value.threadId!==t.threadId)return;let i=Re(t).serverEpoch;if(i!==null&&i!==r.value.serverEpoch){e.refresh(n);return}Me(t,r.value)};e.addFinalizer(()=>{i=!0});let c=e.once(r);e.subscribe(n,e=>{o(e)}),e.subscribe(r,e=>{a+=1,s(e)}),queueMicrotask(()=>{i||(e.refresh(n),a===0&&s(c))})}).pipe(D(1e3),w(`preview:session-sync:${e}`))});function Qt(e){let t=(0,Q.c)(2),n;t[0]===e?n=t[1]:(n=Zt(v(e)),t[0]=e,t[1]=n),O(n)}var $t=1500,en=.001;function tn(e){let t=(0,Q.c)(11),{zoomFactor:n}=e,[r,i]=(0,Z.useState)(!1),a=(0,Z.useRef)(n),o=(0,Z.useRef)(null),s,c;t[0]===n?(s=t[1],c=t[2]):(s=()=>{if(!(Math.abs(a.current-n)<en))return a.current=n,i(!0),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{i(!1),o.current=null},$t),()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null)}},c=[n],t[0]=n,t[1]=s,t[2]=c),(0,Z.useEffect)(s,c);let l;t[3]===n?l=t[4]:(l=Math.round(n*100),t[3]=n,t[4]=l);let u=`${l}%`,d=!r,f=r?`opacity-100 translate-y-0`:`opacity-0 -translate-y-1`,p;t[5]===f?p=t[6]:(p=b(`pointer-events-none absolute top-3 right-3 z-20 select-none rounded-full border border-border/70 bg-popover/95 px-2.5 py-1 text-xs font-medium text-foreground shadow-md/10 backdrop-blur transition-all duration-200 ease-out`,f),t[5]=f,t[6]=p);let m;return t[7]!==u||t[8]!==d||t[9]!==p?(m=(0,$.jsx)(`div`,{"aria-hidden":d,className:p,children:u}),t[7]=u,t[8]=d,t[9]=p,t[10]=m):m=t[10],m}function nn(e,t){return e?1:t===`human`?.18:.35}var rn=700;function an(e){let t=(0,Q.c)(9),{tabId:n,zoomFactor:r,controller:i}=e,a;t[0]===n?a=t[1]:(a=e=>e.byTabId[n]??null,t[0]=n,t[1]=a);let o=Se(a),s;t[2]===n?s=t[3]:(s=e=>e.byTabId[n]?.content??null,t[2]=n,t[3]=s);let c=fe(s);if(!o)return null;let l;return t[4]!==c||t[5]!==i||t[6]!==o||t[7]!==r?(l=(0,$.jsx)(on,{event:o,content:c,zoomFactor:r,controller:i},o.sequence),t[4]=c,t[5]=i,t[6]=o,t[7]=r,t[8]=l):l=t[8],l}function on(e){let t=(0,Q.c)(15),{event:n,content:r,zoomFactor:i,controller:a}=e,[o,s]=(0,Z.useState)(!0),c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=window.setTimeout(()=>s(!1),rn);return()=>window.clearTimeout(e)},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Z.useEffect)(c,l);let u;t[2]!==o||t[3]!==a?(u=nn(o,a),t[2]=o,t[3]=a,t[4]=u):u=t[4];let d=`translate3d(${n.x*i*(r?.scale??1)+(r?.x??0)-(r?.scrollLeft??0)}px, ${n.y*i*(r?.scale??1)+(r?.y??0)-(r?.scrollTop??0)}px, 0)`,f;t[5]!==u||t[6]!==d?(f={opacity:u,transform:d},t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;t[8]!==n.phase||t[9]!==n.sequence?(p=n.phase===`click`?(0,$.jsx)(`span`,{className:`absolute left-0.5 top-0.5 size-4 animate-status-ping rounded-full bg-primary/25 motion-reduce:animate-none`},n.sequence):null,t[8]=n.phase,t[9]=n.sequence,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(Ae,{className:`relative size-5 -translate-x-0.5 -translate-y-0.5 text-primary drop-shadow-sm`,weight:`fill`}),t[11]=m):m=t[11];let h;return t[12]!==f||t[13]!==p?(h=(0,$.jsxs)(`div`,{className:`pointer-events-none absolute left-0 top-0 z-40 transition-[transform,opacity] duration-150 ease-out motion-reduce:transition-none`,style:f,"aria-hidden":`true`,"data-agent-browser-cursor":!0,children:[p,m]}),t[12]=f,t[13]=p,t[14]=h):h=t[14],h}var sn=typeof window>`u`?null:A();function cn({threadRef:e,tabId:n,configuredUrls:r,visible:i,onSendAnnotation:a}){let[o,s]=(0,Z.useState)(void 0),[c,l]=(0,Z.useState)(!1),u=ye(),d=(0,Z.useRef)(!1),f=(0,Z.useRef)(!0),m=(0,Z.useRef)(e);m.current=e;let h=Pe(e),g=qe(e,50),_=G(t=>U(t.byThreadKey,e)),y=p(e=>e.addPreviewAnnotation),b=p(e=>e.addImage),x=ee(e.environmentId),S=x?new URL(x).hostname:null,C=P(Xe.open),w=P(Xe.resize,`preview viewport resize`);Qt(e),(0,Z.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let E=n??h.activeTabId,D=E?me(e,h.serverEpoch,E):null,O=E&&D?u.has(D)?D:Ce(e,E):null,k=E?h.sessions[E]??null:null,A=E?h.desktopByTabId[E]??null:null,M=k?.navStatus??{_tag:`Idle`},N=M._tag===`Idle`?``:M.url,F=A?.loading??M._tag===`Loading`,te=A?.canGoBack??k?.canGoBack??!1,ne=A?.canGoForward??k?.canGoForward??!1,re=M._tag===`Idle`,L=M._tag===`LoadFailed`,ie=be(k),ae=A?.controller??`none`,R=k?.viewport??t,z=ge(),oe=fe(e=>D?e.byTabId[D]?.rect??null:null),B=M._tag===`Success`?M.url:null,V=M._tag===`Success`?M.title:null,ce=g[0]?.url;(0,Z.useEffect)(()=>{!B||!V||!ce||Ue(m.current,B,V,S)},[S,ce,V,B,v(e)]);let W=(0,Z.useCallback)(async t=>D&&K?(await K.navigate(D,t),je(e,t),!0):(await se({openPreview:C,threadRef:e,url:t}))._tag===`Success`,[C,D,e]),le=(0,Z.useCallback)(async t=>{try{let n=Ge(t);await W(n)&&Ke(e,n)}catch{}},[W,e]),q=(0,Z.useCallback)(async t=>{try{let n=Be(e.environmentId,t);await W(n)&&Ke(e,t)}catch{}},[W,e]),J=(0,Z.useCallback)(()=>{K&&D&&K.refresh(D)},[D]),Y=(0,Z.useCallback)(()=>{K&&D&&K.zoomIn(D)},[D]),ue=(0,Z.useCallback)(()=>{K&&D&&K.zoomOut(D)},[D]),xe=(0,Z.useCallback)(()=>{K&&D&&K.resetZoom(D)},[D]),Se=(0,Z.useCallback)(async t=>{if(!E)return;let n=await w({environmentId:e.environmentId,input:{threadId:e.threadId,tabId:E,viewport:t}});if(n._tag===`Failure`){let e=T(n);throw I.add({type:`error`,title:`Unable to resize browser viewport`,description:e instanceof Error?e.message:`An error occurred.`}),e}Le(e,n.value)},[w,E,e]),Te=()=>{if(D){if(R._tag!==`fill`){pe(D,t).catch(()=>void 0);return}pe(D,_e({defaults:z,panelRect:oe,zoomFactor:A?.zoomFactor})).catch(()=>void 0)}};(0,Z.useEffect)(()=>{if(D)return we(D,Se)},[Se,D]);let Ee=(0,Z.useCallback)(()=>{K&&D&&K.goBack(D)},[D]),De=(0,Z.useCallback)(()=>{K&&D&&K.goForward(D)},[D]),Oe=(0,Z.useCallback)(()=>{!sn||!N||sn.shell.openExternal(N).catch(()=>void 0)},[N]),ke=(0,Z.useCallback)(()=>{if(E){if(_?.tabId===E){G.getState().close(e);return}G.getState().open(e,E),Ze.getState().close(e)}},[_?.tabId,E,e]),Ae=(0,Z.useCallback)(()=>{!K||!D||(A?.pictureInPicture?K.pictureInPicture.close:K.pictureInPicture.open)(D).catch(e=>{I.add({type:`error`,title:`Unable to update popped-out preview`,description:e instanceof Error?e.message:`An error occurred.`})})},[A?.pictureInPicture,D]),Me=(0,Z.useCallback)(t=>{if(!K||!D||!E)return;let n=K;if(O){de(O).then(e=>{if(!e)return;let t=!1,r,i=()=>{if(!navigator.clipboard?.writeText){I.update(r,j({type:`error`,title:`Unable to copy recording path`,description:`Clipboard API unavailable.`,actionProps:a}));return}navigator.clipboard.writeText(e.path).then(()=>{t=!0,o(),window.setTimeout(()=>{t=!1,o()},2e3)},e=>{I.update(r,j({type:`error`,title:`Unable to copy recording path`,description:e instanceof Error?e.message:`An error occurred.`,actionProps:a}))})},a={children:He(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},o=()=>{I.update(r,j({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:t?`Copied!`:`Copy path`,disabled:t,onClick:i},secondaryActionVariant:`outline`}}))};r=I.add(j({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:`Copy path`,onClick:i},secondaryActionVariant:`outline`}}))},e=>{I.add({type:`error`,title:`Unable to stop recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}if(t){he(D,e,E).catch(e=>{let t=e instanceof Error?e.message:`An error occurred.`;ve(e)||I.add({type:`error`,title:`Unable to start recording`,description:t})});return}n.captureScreenshot(D).then(e=>{let t={children:He(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},r=!1,i=!1,a,o=(e=`success`,n=`Screenshot saved`,o)=>{I.update(a,j({type:e,title:n,description:o,actionProps:{children:i?`Copied!`:`Copy image`,disabled:i,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:r?`Copied!`:`Copy path`,disabled:r,onClick:s}}],secondaryActionProps:{...t},secondaryActionVariant:`outline`}}))},s=()=>{if(!navigator.clipboard?.writeText){o(`error`,`Unable to copy screenshot path`,`Clipboard API unavailable.`);return}navigator.clipboard.writeText(e.path).then(()=>{r=!0,o(),window.setTimeout(()=>{r=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot path`,e instanceof Error?e.message:`An error occurred.`)})},c=()=>{n.copyArtifactToClipboard(e.path).then(()=>{i=!0,o(),window.setTimeout(()=>{i=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot`,e instanceof Error?e.message:`An error occurred.`)})};a=I.add(j({type:`success`,title:`Screenshot saved`,actionProps:{children:`Copy image`,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:`Copy path`,onClick:s}}],secondaryActionProps:{...t},secondaryActionVariant:`outline`}}))},e=>{I.add({type:`error`,title:`Unable to capture screenshot`,description:e instanceof Error?e.message:`An error occurred.`})})},[O,D,E,e]),Ne=(0,Z.useCallback)(()=>{if(!K||!D)return;if(d.current){K.cancelPickElement(D).catch(()=>void 0);return}let t=typeof document<`u`?document.activeElement:null;d.current=!0,l(!0),(async()=>{try{let t=await K.pickElement(D);if(!t)return;let{annotation:n,submission:r}=t;y(e,n);let i=null;try{i=await ze(n)}catch{}let o=i&&n.screenshot?{type:`image`,id:n.id,name:i.name,mimeType:i.type,sizeBytes:i.size,previewUrl:n.screenshot.dataUrl,file:i}:null;o&&b(e,o),r===`send`&&a?.(n,o)}catch{}finally{if(d.current=!1,f.current&&l(!1),t&&t.isConnected&&typeof t.focus==`function`)try{t.focus({preventScroll:!0})}catch{}}})()},[b,y,a,D,e]);return(0,Z.useEffect)(()=>()=>{d.current&&(d.current=!1,K&&D&&K.cancelPickElement(D).catch(()=>void 0),f.current&&l(!1))},[D]),(0,Z.useEffect)(()=>{if(i)return H(e=>{switch(e){case`refresh`:J();return;case`focus-url`:s(e=>(e??0)+1);return;case`zoom-in`:Y();return;case`zoom-out`:ue();return;case`reset-zoom`:xe();return;case`toggle-panel`:return}})},[J,xe,Y,ue,i]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"data-thread-key":v(e),children:[(0,$.jsx)(St,{url:N,loading:F,canGoBack:te,canGoForward:ne,refreshDisabled:re,focusUrlNonce:o,onBack:Ee,onForward:De,onRefresh:J,onSubmit:e=>void le(e),onOpenInBrowser:E?Oe:void 0,onCapture:K&&E?Me:void 0,captureDisabled:!A||L,recording:O!==null,onPictureInPicture:K&&E?ke:void 0,pictureInPicture:_?.tabId===E,pictureInPictureDisabled:!A?.hasWebContents||L,onPickElement:K&&E?Ne:void 0,pickActive:c,pickDisabled:!E||L,pickDisabledReason:L?`Page didn't load — pick unavailable until the page renders`:void 0,trailingActions:K?(0,$.jsx)(It,{tabId:D,hasWebContents:A?.hasWebContents??!1,zoomFactor:A?.zoomFactor??1,colorScheme:A?.colorScheme??`system`,deviceToolbarVisible:R._tag!==`fill`,onToggleDeviceToolbar:Te,nativePictureInPicture:A?.pictureInPicture??!1,onNativePictureInPicture:Ae}):null}),(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[D&&k&&!ie?(0,$.jsx)(X,{tabId:D,visible:i&&!L,className:`absolute inset-0 h-full w-full`},D):null,ie?(0,$.jsx)(Nt,{threadRef:e,environmentId:e.environmentId,configuredUrls:r,recentEntries:g,onRemoveRecent:t=>Je(e,t),onOpenUrl:e=>void q(e)}):null,k&&A?(0,$.jsx)(tn,{zoomFactor:A.zoomFactor}):null,D&&A&&!ie&&!L?(0,$.jsx)(an,{tabId:D,zoomFactor:A.zoomFactor,controller:ae}):null,ae===`none`?null:(0,$.jsx)(`div`,{className:`surface-glass pointer-events-none absolute left-3 top-3 z-40 rounded-full px-2.5 py-1 text-[11px] font-medium shadow-glass`,children:ae===`agent`?`Agent controlling browser`:`Human control`}),M._tag===`LoadFailed`?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(Kt,{url:M.url,code:M.code,description:M.description,onReload:J})}):null]})]})}function ln(e){let t=(0,Q.c)(16),{mode:n,threadRef:r,tabId:i,configuredUrls:a,visible:o,onSendAnnotation:s}=e;if(!Ne()){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:`Preview is only available in the Borg desktop app.`})}),t[0]=e):e=t[0];let r;return t[1]===n?r=t[2]:(r=(0,$.jsx)(q,{mode:n,children:e}),t[1]=n,t[2]=r),r}let c;t[3]===i?c=t[4]:(c=i===void 0?{}:{tabId:i},t[3]=i,t[4]=c);let l;t[5]===s?l=t[6]:(l=s?{onSendAnnotation:s}:{},t[5]=s,t[6]=l);let u;t[7]!==a||t[8]!==c||t[9]!==l||t[10]!==r||t[11]!==o?(u=(0,$.jsx)(cn,{threadRef:r,...c,configuredUrls:a,visible:o,...l}),t[7]=a,t[8]=c,t[9]=l,t[10]=r,t[11]=o,t[12]=u):u=t[12];let d;return t[13]!==n||t[14]!==u?(d=(0,$.jsx)(q,{mode:n,children:u}),t[13]=n,t[14]=u,t[15]=d):d=t[15],d}export{ln as PreviewPanel};
|
|
2
|
+
//# sourceMappingURL=PreviewPanel-CnjyoM26.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{Do as t,Ft as n,v as r,y as i}from"./accountData-C4ZvicpJ.js";import{Bo as a,Co as o,G as s,Hn as c,Nn as l,Pn as u,So as d,dn as f,kn as ee,mt as te,t as ne,wo as p,z as m}from"./utils-DgzD4MA_.js";import{Zt as h,fn as re}from"./session-CgVsO0DD.js";import{Ct as g,_r as _,f as v,fr as y,ir as b,l as x,mr as S,o as C,t as w,u as T,vr as E,x as D,zn as O}from"./textarea-DprGKUyt.js";import{Fr as k,Jn as ie,Mr as ae,Nr as oe,Pr as se,Un as ce,Wn as le,Xn as ue,Yn as A,qn as de}from"./scroll-area-DKsvPvOo.js";import{Xt as fe,_ as pe,g as me,v as he}from"./ChatMarkdown-BGNgYyxf.js";import{$ as ge,C as j,Mt as _e,Ot as ve,Pt as ye,c as be,ht as xe,l as Se,n as Ce,o as we,r as Te,st as Ee,t as M,xt as De}from"./PullRequestReactions-CHoFc7lq.js";import{i as Oe,n as ke,o as Ae,r as je,s as Me}from"./diffFileContents-CpXvVerb.js";import{c as Ne}from"./env-71Gq9H0m.js";import{l as Pe,t as Fe}from"./DiffWorkerPoolProvider-iCAF4Ogc.js";import{a as Ie,i as Le}from"./VirtualizedFile-CZoHsBen.js";import{n as Re,t as ze}from"./toggle-group-BU7-0DcW.js";var N=e(i(),1),P=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M56.88,31.93a12,12,0,0,0-20.29,4.38A20,20,0,0,0,20,56V184a20,20,0,0,0,20,20H98.11l12.52,21.92a20,20,0,0,0,34.73,0L157.89,204h23l18.25,20.07a12,12,0,0,0,17.76-16.14ZM150.93,180a12,12,0,0,0-10.42,6.05L128,207.94l-12.51-21.89A12,12,0,0,0,105.07,180H44V60h6l109.1,120ZM236,56V174.14a12,12,0,0,1-24,0V60H109.33a12,12,0,1,1,0-24H216A20,20,0,0,1,236,56Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,56V184a8,8,0,0,1-8,8H150.93l-16,28a8,8,0,0,1-13.9,0l-16-28H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M53.92,34.62A8,8,0,0,0,40,40h0A16,16,0,0,0,24,56V184a16,16,0,0,0,16,16h60.43l13.68,23.94a16,16,0,0,0,27.78,0L155.57,200h27.07l19.44,21.38a8,8,0,1,0,11.84-10.76Zm97,149.38a8,8,0,0,0-7,4l-16,28-16-28a8,8,0,0,0-7-4H40V56H51.73L168.1,184ZM232,56V186a8,8,0,0,1-16,0V56H98.52a8,8,0,1,1,0-16H216A16,16,0,0,1,232,56Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,56V184a15.93,15.93,0,0,1-4.82,11.42,4,4,0,0,1-5.68-.25L86.52,46.69a4,4,0,0,1,3-6.69H216A16,16,0,0,1,232,56ZM53.92,34.62A8,8,0,0,0,40,40h0A16,16,0,0,0,24,56V184a16,16,0,0,0,16,16h60.43l13.68,23.94a16,16,0,0,0,27.78,0L155.57,200h27.07l19.44,21.38a8,8,0,1,0,11.84-10.76Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M52.44,36a6,6,0,0,0-10.1,6H40A14,14,0,0,0,26,56V184a14,14,0,0,0,14,14h61.59L115.84,223a14,14,0,0,0,24.32,0L154.41,198h29.12l20,22a6,6,0,0,0,8.88-8.08Zm98.49,150a6,6,0,0,0-5.21,3l-16,28a2,2,0,0,1-3.48,0l-16-28a6,6,0,0,0-5.21-3H40a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H52.62l120,132ZM230,56V186a6,6,0,0,1-12,0V56a2,2,0,0,0-2-2H98.52a6,6,0,1,1,0-12H216A14,14,0,0,1,230,56Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M53.92,34.62A8,8,0,0,0,40,40h0A16,16,0,0,0,24,56V184a16,16,0,0,0,16,16h60.43l13.68,23.94a16,16,0,0,0,27.78,0L155.57,200h27.07l19.44,21.38a8,8,0,1,0,11.84-10.76Zm97,149.38a8,8,0,0,0-7,4l-16,28-16-28a8,8,0,0,0-7-4H40V56H51.73L168.1,184ZM232,56V186a8,8,0,0,1-16,0V56H98.52a8,8,0,1,1,0-16H216A16,16,0,0,1,232,56Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M51,37.31A4,4,0,0,0,45,42.69L46.23,44H40A12,12,0,0,0,28,56V184a12,12,0,0,0,12,12h62.75L117.58,222a12,12,0,0,0,20.84,0L153.25,196h31.16L205,218.69a4,4,0,1,0,5.92-5.38ZM150.93,188a4,4,0,0,0-3.47,2l-16,28a4,4,0,0,1-6.94,0l-16-28a4,4,0,0,0-3.47-2H40a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H53.5L177.14,188ZM228,56V186a4,4,0,0,1-8,0V56a4,4,0,0,0-4-4H98.52a4,4,0,1,1,0-8H216A12,12,0,0,1,228,56Z`}))]]),F=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,128A104,104,0,1,1,128,24,104.13,104.13,0,0,1,232,128Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Z`}))]]),I=Object.defineProperty,L=Object.defineProperties,Be=Object.getOwnPropertyDescriptors,Ve=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,We=(e,t,n)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ge=(e,t)=>{for(var n in t||={})He.call(t,n)&&We(e,n,t[n]);if(Ve)for(var n of Ve(t))Ue.call(t,n)&&We(e,n,t[n]);return e},Ke=(e,t)=>L(e,Be(t)),qe=(0,N.forwardRef)((e,t)=>N.createElement(p,Ke(Ge({ref:t},e),{weights:P})));qe.displayName=`ChatCenteredSlash`;var Je=Object.defineProperty,R=Object.defineProperties,z=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,U=(e,t,n)=>t in e?Je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ye=(e,t)=>{for(var n in t||={})V.call(t,n)&&U(e,n,t[n]);if(B)for(var n of B(t))H.call(t,n)&&U(e,n,t[n]);return e},Xe=(e,t)=>R(e,z(t)),Ze=(0,N.forwardRef)((e,t)=>N.createElement(p,Xe(Ye({ref:t},e),{weights:F})));Ze.displayName=`Circle`;var Qe=new Set([`pnpm-lock.yaml`,`yarn.lock`,`package-lock.json`,`bun.lockb`,`Cargo.lock`,`go.sum`,`composer.lock`,`Gemfile.lock`]),$e=new Set([`__snapshots__`,`__generated__`,`dist`,`build`,`vendor`]),et=new Set([`__tests__`,`tests`,`test`]),tt=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`];function nt(e){let t=e.split(`/`),n=t.at(-1)??``;return Qe.has(n)||n.endsWith(`.snap`)||n.endsWith(`.min.js`)||n.endsWith(`.min.css`)||/\.generated\./.test(n)||t.slice(0,-1).some(e=>$e.has(e))?`generated`:/\.(?:test|spec)\./.test(n)||t.slice(0,-1).some(e=>et.has(e))?`test`:`source`}function rt(e){let t=e.lastIndexOf(`.`);return t>e.lastIndexOf(`/`)?e.slice(0,t):e}function it(e){return rt(e.split(`/`).at(-1)??``)}function at(e,t){let n=e.split(`/`).slice(0,-1);for(let e of t.split(`/`))e===`.`||e===``||(e===`..`?n.pop():n.push(e));return n.join(`/`)}var ot=/(?:\bfrom|\bimport|\brequire\s*\()\s*\(?\s*["']([^"']+)["']/g;function W(e,t,n,r){let i=new Set;for(let a of t){ot.lastIndex=0;let t=ot.exec(a);for(;t!==null;){let o=t[1]??``,s=o.startsWith(`.`)?at(e,o):o,c=tt.find(e=>s.endsWith(e)),l=c===void 0?s:s.slice(0,-c.length),u=n.get(l)??n.get(`${l}/index`)??r.get(it(l));u!==void 0&&u!==e&&i.add(u),t=ot.exec(a)}}return i}function G(e,t){let n=new Set(e),r=[],i=[...e].sort((e,t)=>e.localeCompare(t));for(;n.size>0;){let e=i.filter(e=>n.has(e)),a=e.find(e=>[...t.get(e)??[]].every(e=>!n.has(e)))??e[0];n.delete(a),r.push(a)}return r}function K(e){return(e.split(`/`).at(-1)??``).replace(/\.(?:test|spec)\..*$/,``).replace(/\.[^.]+$/,``)}function st(e){let t=new Map;for(let n of e)t.set(A(n),n);let n=new Map;for(let e of t.keys())n.set(e,nt(e));let r=[...t.keys()].filter(e=>n.get(e)===`source`),i=new Map,a=new Set,o=new Map;for(let e of r){i.set(rt(e),e);let t=it(e);o.has(t)&&a.add(t),o.set(t,e)}for(let e of a)o.delete(e);let s=new Map;for(let e of r){let n=t.get(e);s.set(e,W(e,[...n.additionLines,...n.deletionLines],i,o))}let c=G(r,s),l=new Map;c.forEach((e,t)=>{let n=it(e);l.has(n)||l.set(n,t)});let u=[...t.keys()].filter(e=>n.get(e)===`test`).sort((e,t)=>(l.get(K(e))??2**53-1)-(l.get(K(t))??2**53-1)||e.localeCompare(t)),d=[...t.keys()].filter(e=>n.get(e)===`generated`).sort((e,t)=>e.localeCompare(t));return[...c,...u,...d].map(e=>t.get(e))}var q=r(),J=a(),Y=`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm`;function ct(e){return t=>{t.key===`Escape`&&e.onCancel&&(t.preventDefault(),e.onCancel()),Ie(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function lt(e){let t=(0,q.c)(11),{comment:n,onRemove:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=ne(Y,`border-dashed`),t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(fe,{className:`size-3.5`}),o=(0,J.jsx)(`span`,{children:`Pending — sent when you submit the review`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsx)(ae,{className:`size-3.5`}),t[3]=s):s=t[3];let c;t[4]===r?c=t[5]:(c=(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[a,o,(0,J.jsx)(f,{size:`icon-xs`,variant:`ghost`,className:`ml-auto`,"aria-label":`Discard this comment`,onClick:r,children:s})]}),t[4]=r,t[5]=c);let l;t[6]===n.body?l=t[7]:(l=(0,J.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap leading-relaxed`,children:n.body}),t[6]=n.body,t[7]=l);let u;return t[8]!==c||t[9]!==l?(u=(0,J.jsxs)(`div`,{className:i,contentEditable:!1,onPointerDown:ut,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function ut(e){return e.stopPropagation()}function dt({thread:e,workspaceRoot:t,canReply:n,canResolve:r,canReact:i,environmentId:a,reference:o,pending:s,fixPending:c,fixLabel:l=`Fix in a thread`,onFix:u,onReply:d,onLoadMore:ee,canEditComment:te,onEditComment:ne,onToggleResolved:p,onReacted:m}){let[h,re]=(0,N.useState)(!e.isResolved),[g,v]=(0,N.useState)(!1),[y,b]=(0,N.useState)(``),[x,S]=(0,N.useState)(null),[C,T]=(0,N.useState)(!1),E=(0,N.useRef)(!1),[D,O]=(0,N.useState)(null),[k,ie]=(0,N.useState)(!1),ae=D?.threadId===e.id?D:null,oe=xe(e.comments,ae?.comments??[]),se=ae===null?e.nextCommentsCursor??null:ae.nextCursor,ce=e.commentCount??oe.length,le=async(t,n)=>{if(C)return;T(!0);let r=await ne(t,n);T(!1),r&&(O(r=>r?.threadId===e.id?{...r,comments:Ee(r.comments,t,n)}:r),S(null))},ue=async()=>{let t=y.trim();if(!(t.length===0||s||E.current)){E.current=!0;try{await d(t)&&(O(t=>t?.threadId===e.id?{...t,nextCursor:t.nextCursor??e.nextCommentsCursor??null}:t),b(``),v(!1))}finally{E.current=!1}}},A=async()=>{if(!(se===null||k)){ie(!0);try{let t=await ee(se);if(t===null)return;O(n=>({threadId:e.id,comments:xe(n?.threadId===e.id?n.comments:[],t.comments),nextCursor:t.nextCursor}))}finally{ie(!1)}}};return(0,J.jsxs)(`div`,{className:Y,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.isResolved?(0,J.jsx)(_,{className:`size-3.5 text-emerald-600 dark:text-emerald-500`}):(0,J.jsx)(Ze,{className:`size-3.5`}),(0,J.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":h,onClick:()=>re(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,ce,` `,ce===1?`comment`:`comments`]}),e.isOutdated?(0,J.jsx)(`span`,{children:`outdated`}):null,u?(0,J.jsxs)(f,{size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:s||c,onClick:u,children:[(0,J.jsx)(ye,{className:`size-3`}),c?`Preparing...`:l]}):null,r?(0,J.jsx)(f,{size:`xs`,variant:`ghost`,className:u?void 0:`ml-auto`,disabled:s,onClick:p,children:e.isResolved?`Unresolve`:`Resolve`}):null]}),h?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`mt-2 space-y-3`,children:oe.map(e=>(0,J.jsxs)(`article`,{className:`group min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(we,{actor:e.author,className:`text-foreground`}),(0,J.jsx)(`span`,{children:Ne(e.createdAt)})]}),x===e.id?(0,J.jsx)(Ce,{className:`mt-1`,value:e.body,cwd:t,environmentId:a,label:`Edit comment`,saving:C,onSave:t=>void le(e.id,t),onCancel:()=>S(null)}):(0,J.jsxs)(`div`,{className:`mt-1 flex items-start gap-1`,children:[(0,J.jsx)(Te,{className:`min-w-0 flex-1 text-sm`,text:e.body,cwd:t,environmentId:a}),te(e)?(0,J.jsx)(f,{size:`icon-xs`,variant:`ghost`,className:`shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100`,"aria-label":`Edit comment`,onClick:()=>S(e.id),children:(0,J.jsx)(_e,{className:`size-3`})}):null]}),(0,J.jsx)(M,{className:`mt-1.5`,reactions:e.reactions??[],canReact:i,subjectId:e.id,environmentId:a,reference:o,onRefresh:m})]},e.id))}),se===null?null:(0,J.jsx)(`div`,{className:`mt-2`,children:(0,J.jsx)(f,{size:`xs`,variant:`ghost`,className:`px-1`,disabled:k,onClick:()=>void A(),children:k?`Loading...`:`Load more comments`})}),n?g?(0,J.jsxs)(`div`,{className:`mt-2`,children:[(0,J.jsx)(w,{autoFocus:!0,size:`sm`,value:y,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>b(e.target.value),onKeyDown:ct({value:y,pending:s,onSubmit:()=>void ue(),onCancel:()=>v(!1)})}),(0,J.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,J.jsx)(f,{size:`xs`,variant:`ghost`,onClick:()=>v(!1),children:`Cancel`}),(0,J.jsx)(f,{size:`xs`,disabled:s||y.trim().length===0,onClick:()=>void ue(),children:`Reply`})]})]}):(0,J.jsx)(f,{size:`xs`,variant:`ghost`,className:`mt-2 px-1`,onClick:()=>v(!0),children:`Reply`}):null]}):null]})}var X=0;function ft(){return X+=1,`pending-review-comment-${X}`}function pt(e){return`${e.projectId}/${e.repository}#${e.number}`}var Z=[],Q=te()(e=>({drafts:{},summaries:{},addComment:(t,n)=>e(e=>({drafts:{...e.drafts,[t]:[...e.drafts[t]??Z,n]}})),removeComment:(t,n)=>e(e=>{let r=(e.drafts[t]??Z).filter(e=>e.id!==n);if(r.length>0)return{drafts:{...e.drafts,[t]:r}};let{[t]:i,...a}=e.drafts;return{drafts:a}}),removeComments:(t,n)=>e(e=>{let r=new Set(n),i=(e.drafts[t]??Z).filter(e=>!r.has(e.id));if(i.length>0)return{drafts:{...e.drafts,[t]:i}};let{[t]:a,...o}=e.drafts;return{drafts:o}}),clear:t=>e(e=>{let{[t]:n,...r}=e.drafts;return{drafts:r}}),setSummary:(t,n)=>e(e=>({summaries:{...e.summaries,[t]:n}})),clearSummary:(t,n)=>e(e=>{if(e.summaries[t]!==n)return e;let{[t]:r,...i}=e.summaries;return{summaries:i}})}));function mt(e){let t=(0,q.c)(2),n;return t[0]===e?n=t[1]:(n=t=>t.drafts[pt(e)]??Z,t[0]=e,t[1]=n),Q(n)}var ht=[{value:`comment`,label:`Comment`,sent:`Review submitted`,icon:(0,J.jsx)(fe,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,J.jsx)(E,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,J.jsx)(ve,{className:`size-3`})}],gt=t(n);function _t(e){let t=(0,q.c)(13),{environmentId:n,reference:r,verdicts:i,headSha:a,onSubmitted:o}=e,[s,c]=(0,N.useState)(!1),l=mt(r),u=pt(r),d=Q(e=>e.summaries[u]??``),ee=Q($),te=Q(St),ne=Q(xt),p=Q(bt),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={reportFailure:!1},t[0]=m):m=t[0];let re=b(j.submitReview,m),g;t[1]===i?g=t[2]:(g=e=>i.includes(e.value),t[1]=i,t[2]=g);let _=ht.filter(g);if(_.length===0)return null;let v=async e=>{if(s)return;let t=d,i=l,f=i.find(yt)?.headSha??a;c(!0);let ee=await re({environmentId:n,input:{...r,verdict:e.value,body:t,comments:i,...f===void 0?{}:{headSha:f}}});if(c(!1),ee._tag===`Failure`){let e=h(ee);C.add({type:`error`,title:`The review could not be submitted`,...gt(e)?{description:e.detail}:{}});return}te(u,i.map(vt)),p(u,t),C.add({type:`success`,title:e.sent}),o()},y;t[3]!==d||t[4]!==l.length?(y=e=>e===`approve`||d.trim().length>0||l.length>0,t[3]=d,t[4]=l.length,t[5]=y):y=t[5];let x=y,S=l.length===0?`No line comments yet`:`${l.length} ${l.length===1?`comment`:`comments`} pending`,T;t[6]===S?T=t[7]:(T=(0,J.jsx)(`span`,{children:S}),t[6]=S,t[7]=T);let E=l.length>0?(0,J.jsx)(f,{size:`xs`,variant:`ghost`,disabled:s,onClick:()=>ee(u),children:`Discard`}):null,D;t[8]!==T||t[9]!==E?(D=(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[T,E]}),t[8]=T,t[9]=E,t[10]=D):D=t[10];let O=_.map(e=>(0,J.jsx)(f,{size:`xs`,variant:e.value===`comment`?`outline`:`default`,disabled:s||!x(e.value),onClick:()=>void v(e),children:(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.icon,e.label]})},e.value)),k;return t[11]===O?k=t[12]:(k=(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-2`,children:O}),t[11]=O,t[12]=k),(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[D,(0,J.jsx)(w,{size:`sm`,className:`mt-2`,value:d,placeholder:`Summarize your review (optional)`,"aria-label":`Review summary`,onChange:e=>ne(u,e.target.value)}),k]})}function vt(e){return e.id}function yt(e){return e.headSha}function bt(e){return e.clearSummary}function xt(e){return e.setSummary}function St(e){return e.removeComments}function $(e){return e.clear}function Ct(e,t,n){return e.hunks.some(e=>t===`left`?n>=e.deletionStart&&n<e.deletionStart+e.deletionCount:n>=e.additionStart&&n<e.additionStart+e.additionCount)}function wt(e,t,n){let r=t===`folded`;return n.has(e)?!r:r}var Tt=10,Et=`
|
|
2
|
+
[data-diffs-header] [data-additions-count],
|
|
3
|
+
[data-diffs-header] [data-deletions-count] {
|
|
4
|
+
display: none !important;
|
|
5
|
+
}`,Dt=[];function Ot(e){return e===`left`?`deletions`:`additions`}function kt(e){switch(e.kind){case`added`:return{line:e.newLine,side:`right`};case`deleted`:return{line:e.oldLine,side:`left`};case`context`:return{line:e.side===`left`?e.oldLine:e.newLine,side:e.side}}}function At({environmentId:e,reference:t,detail:n,selectedCommitOid:r,onSelectedCommitChange:i,pendingFinding:a,fixFindingLabel:te=`Fix in a thread`,onFixFinding:p,onAddToAgentSelection:h,onRefresh:_,refreshToken:w=0}){let{resolvedTheme:E}=g(),ae=D(),[_e,ve]=(0,N.useState)(()=>new Set),[ye,xe]=(0,N.useState)(Tt),[Ce,we]=(0,N.useState)(null),[Te,Ee]=(0,N.useState)(`stacked`),[M,Ne]=(0,N.useState)(ae.wordWrap),[Ie,P]=(0,N.useState)(null),[F,I]=(0,N.useState)(null),[L,Be]=(0,N.useState)(!1),[Ve,He]=(0,N.useState)(!1),[Ue,We]=(0,N.useState)(!1),[Ge,Ke]=(0,N.useState)({key:``,cursor:null,slices:Dt}),Je=(0,N.useRef)(new Map),R=pt(t),z=r,B=z===null?R:`${R}@${z}`;(0,N.useEffect)(()=>{I(null),P(null),ve(new Set),we(null),xe(Tt),He(!1),Ke({key:B,cursor:null,slices:Dt}),Je.current.clear()},[B]);let V=Ge.key===B?Ge.slices:Dt,H=Ge.key===B?Ge.cursor:null,U=O(j.diff({environmentId:e,input:{...t,...H===null?{}:{cursor:H},...z===null?{}:{commit:z}}}));(0,N.useEffect)(()=>{let e=U.data;e!==null&&Ke(t=>{let n=t.key===B?t.slices:Dt,r={cursor:H,patch:e.patch,truncated:e.truncated,nextCursor:e.nextCursor,omittedFileStats:e.omittedFileStats??[]},i=n.findIndex(e=>e.cursor===H);if(i===-1)return{key:B,cursor:H,slices:[...n,r]};let a=n[i];return a!==void 0&&a.patch===r.patch&&a.truncated===r.truncated&&a.nextCursor===r.nextCursor&&a.omittedFileStats.length===r.omittedFileStats.length&&a.omittedFileStats.every((e,t)=>{let n=r.omittedFileStats[t];return n!==void 0&&n.path===e.path&&n.additions===e.additions&&n.deletions===e.deletions})?t:{key:B,cursor:H,slices:[...n.slice(0,i),r]}})},[H,U.data,B]);let Ye=re(j.diff({environmentId:e,input:{...t,...z===null?{}:{commit:z}}})),Xe=(0,N.useRef)(w);(0,N.useEffect)(()=>{Xe.current!==w&&(Xe.current=w,Ke({key:B,cursor:null,slices:Dt}),Ye())},[w,B,Ye]);let Ze=R,Qe=mt(t),$e=Q(e=>e.addComment),et=Q(e=>e.removeComment),tt=b(j.replyToThread,{reportFailure:!1}),nt=b(j.setThreadResolution,{reportFailure:!1}),rt=b(j.updateComment,{reportFailure:!1}),it=b(j.threadComments,{reportFailure:!1}),at=b(j.diffFileContents),ot=(0,N.useMemo)(()=>ke(at,{environmentId:e,reference:t,commit:z,cacheKey:`pull-request:${R}:${n.updatedAt}:${z??`all`}`}),[z,n.updatedAt,e,at,t,R]),W=(0,N.useMemo)(()=>{let e=n.capabilities.review,t=n.viewerPermissions;return{inlineComment:e.inlineComment&&t.comment,reply:e.reply&&t.comment,resolve:e.resolve&&t.resolve,verdicts:e.verdicts.filter(e=>t.verdicts.includes(e))}},[n.capabilities.review,n.viewerPermissions]),G=W.inlineComment&&z===null,K=(0,N.useMemo)(()=>V.map(e=>{let t=`pull-request:${B}:${E}:${e.cursor??`first`}:${le(e.patch)}`,n=Je.current.get(t);if(n)return n;let r=de(e.patch,t,{compactPartialHunkOffsets:!0});return r&&Je.current.set(t,r),r}),[V,E,B]),q=(0,N.useMemo)(()=>K.flatMap(e=>e?.kind===`files`?st(e.files):[]),[K]),Y=V.at(-1)?.nextCursor??null,ct=V.some(e=>e.truncated)||K.some(e=>e?.kind===`raw`),ut=(0,N.useMemo)(()=>{let e=new Set;if(z!==null)return e;for(let t of q){let r=A(t);for(let i of n.reviewThreads)i.path===r&&i.line!==null&&Ct(t,i.side,i.line)&&e.add(i.id)}return e},[z,n.reviewThreads,q]),X=(0,N.useMemo)(()=>q.map(e=>{let t=ce(e),r=A(e),i=new Map,a=(e,t)=>{let n=`${e}:${t}`,r=i.get(n);if(r)return r;let a={side:e,line:t,threads:[],pending:[],draft:!1};return i.set(n,a),a};for(let e of n.reviewThreads)e.path!==r||e.line===null||ut.has(e.id)&&a(e.side,e.line).threads.push(e);if(z===null)for(let e of Qe){if(e.path!==r)continue;let t=kt(e.position);a(t.side,t.line).pending.push(e)}if(F?.fileKey===t){let e=kt(F.position);a(e.side,e.line).draft=!0}let o=wt(t,Ce,_e),s=[...i.values()].map(e=>({side:Ot(e.side),lineNumber:e.line,metadata:{threads:e.threads,pending:e.pending,draft:e.draft}}));return{id:t,type:`diff`,fileDiff:e,annotations:s,collapsed:o,version:le(`${o?`1`:`0`}:${s.map(({side:e,lineNumber:t,metadata:n})=>`${e}:${t}:${n.draft?`d`:``}:${n.pending.map(e=>`${e.id}:${e.body}`).join(`,`)}:${n.threads.map(e=>`${e.id}:${e.isResolved?`r`:``}:${e.isOutdated?`o`:``}:${e.comments.map(e=>`${e.id}:${e.author?.login??``}:${e.createdAt}:${e.body}:${(e.reactions??[]).map(e=>`${e.content}:${e.count}:${e.viewerHasReacted?`v`:``}`).join(`,`)}`).join(`;`)}`).join(`,`)}`).join(`|`)}`)}}),[z,n.reviewThreads,F,q,Ce,Qe,ut,_e]),Z=(0,N.useMemo)(()=>new Map(V.flatMap(e=>e.omittedFileStats.map(e=>[e.path,e]))),[V]),ht=(0,N.useMemo)(()=>X.map(e=>e.id),[X]),gt=(0,N.useMemo)(()=>new Set(X.filter(e=>e.collapsed===!0).map(e=>e.id)),[X]),vt=Oe(ht,gt),[yt,bt]=(0,N.useState)(null);(0,N.useEffect)(()=>{if(yt===null||Y===null||Y===H||U.isPending||U.error!==null)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&Ke(e=>({...e,cursor:Y}))},{rootMargin:`240px`});return e.observe(yt),()=>e.disconnect()},[H,U.error,U.isPending,Y,yt]);let xt=(0,N.useCallback)(e=>ve(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),St=()=>{we(Oe(ht,gt)?`expanded`:`folded`),ve(new Set)},$=(0,N.useMemo)(()=>n.commits.toSorted((e,t)=>Date.parse(t.committedDate)-Date.parse(e.committedDate)),[n.commits]),At=(0,N.useCallback)((e,t)=>{if(!e||!G)return;let n=t.item;if(n.type!==`diff`)return;let r=q.find(e=>ce(e)===n.id);if(!r)return;let i=A(r),a=ue(r),o=s(r,e.end,e.endSide??e.side);o!==null&&I({fileKey:n.id,path:i,oldPath:a===i?null:a,position:o,range:e})},[G,q]),jt=(0,N.useCallback)((e,t,r)=>{let i=q.find(t=>ce(t)===e.fileKey),a=i===void 0?null:m({id:`pull-request-selection:${e.fileKey}:${e.range.start}:${e.range.end}`,sectionId:`pull-request:${n.number}`,sectionTitle:`PR #${n.number} review`,filePath:e.path,fileDiff:i,range:e.range,text:t});I(null),P(null),a!==null&&r(a)},[n.number,q]),Mt=(0,N.useCallback)(()=>Y===null?null:(0,J.jsx)(`div`,{ref:bt,className:`flex items-center justify-center gap-2 py-2 text-xs text-muted-foreground`,children:U.error===null?U.isPending?`Loading more files...`:null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:`The rest of this diff could not be loaded.`}),(0,J.jsx)(f,{size:`xs`,variant:`outline`,onClick:()=>U.refresh(),children:`Retry`})]})}),[Y,U.error,U.isPending,U.refresh]),Nt=(0,N.useCallback)(e=>{let t=e.collapsed===!0;return(0,J.jsx)(f,{size:`icon-micro`,variant:`ghost-muted`,"aria-expanded":!t,"aria-label":t?`Expand diff`:`Collapse diff`,className:`mr-1 rounded hover:bg-transparent`,onClick:t=>{t.stopPropagation(),xt(e.id)},children:t?(0,J.jsx)(d,{className:`size-4`}):(0,J.jsx)(o,{className:`size-4`})})},[xt]),Pt=(0,N.useCallback)(e=>{if(e.type!==`diff`)return null;let t=0,n=0;for(let r of e.fileDiff.hunks)t+=r.additionLines,n+=r.deletionLines;if(t===0&&n===0){let r=Z.get(A(e.fileDiff));r&&({additions:t,deletions:n}=r)}return(0,J.jsx)(be,{additions:t,deletions:n,className:`font-mono text-[11px]`})},[Z]),Ft=(0,N.useMemo)(()=>({diffStyle:Te===`split`?`split`:`unified`,lineDiffType:`none`,overflow:M?`wrap`:`scroll`,theme:ie(E),themeType:E,stickyHeaders:!0,loadDiffFiles:ot,enableGutterUtility:G&&F===null,enableLineSelection:G&&F===null,onGutterUtilityClick:At,onLineSelectionEnd:At}),[Te,M,E,ot,G,F,At]),It=(0,N.useCallback)(async(e,t)=>{if(L)return!1;Be(!0);let n=await t();return Be(!1),n._tag===`Failure`?(C.add({type:`error`,title:e}),!1):(_(),!0)},[_,L]),Lt=(0,N.useCallback)(r=>(0,J.jsx)(dt,{thread:r,workspaceRoot:n.workspaceRoot,canReply:W.reply,canResolve:W.resolve,canReact:n.capabilities.reactions===!0,environmentId:e,reference:t,pending:L,fixPending:a===De({kind:`thread`,thread:r}),fixLabel:te,...p?{onFix:()=>p({kind:`thread`,thread:r})}:{},onLoadMore:async n=>{let i=await it({environmentId:e,input:{...t,threadId:r.id,cursor:n}});return i._tag===`Failure`?(C.add({type:`error`,title:`More comments could not be loaded`}),null):i.value},onReply:n=>It(`Reply could not be posted`,()=>tt({environmentId:e,input:{...t,threadId:r.id,body:n}})),canEditComment:e=>ge(n,{author:e.author,kind:`review-comment`}),onEditComment:(n,r)=>It(`The comment could not be saved`,()=>rt({environmentId:e,input:{...t,commentId:n,kind:`review-comment`,body:r}})),onToggleResolved:()=>void It(`The conversation could not be updated`,()=>nt({environmentId:e,input:{...t,threadId:r.id,resolved:!r.isResolved}})),onReacted:_},`${t.projectId}#${t.number}:${r.id}`),[n,e,te,it,_,p,a,t,tt,W.reply,W.resolve,It,nt,L,rt]),Rt=(0,N.useCallback)(e=>(0,J.jsxs)(`div`,{className:`py-1 font-sans text-foreground`,children:[e.metadata.threads.map(Lt),e.metadata.pending.map(e=>(0,J.jsx)(lt,{comment:e,onRemove:()=>et(Ze,e.id)},e.id)),e.metadata.draft&&F?(0,J.jsx)(Le,{kind:`draft`,rangeLabel:`${F.path}:${kt(F.position).line}`,text:``,submitLabel:`Add to review`,...h?{secondaryAction:{label:`Add to agent`,onAction:e=>jt(F,e,t=>h({comment:t,request:e}))}}:{},onCancel:()=>{I(null),P(null)},onComment:e=>{$e(Ze,{id:ft(),path:F.path,...F.oldPath===null?{}:{oldPath:F.oldPath},position:F.position,body:e,...n.headSha===void 0?{}:{headSha:n.headSha}}),I(null),P(null)}}):null]}),[$e,n.headSha,F,jt,h,et,Lt,Ze]),zt=W.verdicts.length===0?null:(0,J.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10`,children:Ue?(0,J.jsxs)(`div`,{className:`surface-glass pointer-events-auto absolute inset-x-3 bottom-3 rounded-xl border border-border/60 shadow-lg`,children:[(0,J.jsx)(f,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":`Close review`,className:`absolute right-2 top-2`,onClick:()=>We(!1),children:(0,J.jsx)(y,{className:`size-3.5`})}),(0,J.jsx)(_t,{environmentId:e,reference:t,verdicts:W.verdicts,headSha:n.headSha,onSubmitted:()=>{_(),We(!1)}})]}):(0,J.jsxs)(f,{className:`pointer-events-auto absolute right-4 bottom-3 rounded-full shadow-lg`,onClick:()=>We(!0),size:`compact`,variant:`glass`,children:[(0,J.jsx)(fe,{className:`size-3.5`}),`Review`,Qe.length>0?(0,J.jsx)(`span`,{className:`flex size-4 items-center justify-center rounded-full bg-accent text-[10px] tabular-nums text-accent-foreground`,children:Qe.length}):null]})}),Bt=$.find(e=>e.oid===z);(0,N.useEffect)(()=>{z!==null&&Bt===void 0&&i(null)},[z,i,Bt]);let Vt=Bt?Bt.messageHeadline:`All commits`,Ht=(0,J.jsxs)(`div`,{className:`flex h-10 min-h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 bg-background px-4 text-xs text-muted-foreground`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[$.length>0?(0,J.jsxs)(ee,{children:[(0,J.jsxs)(c,{className:`inline-flex h-6 min-w-0 max-w-64 items-center gap-1 rounded-md bg-accent px-2 text-xs font-medium text-accent-foreground outline-none transition-colors hover:bg-accent/80 focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${Vt}`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:Vt}),(0,J.jsx)(o,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,J.jsxs)(u,{align:`start`,className:`w-80`,children:[(0,J.jsx)(l,{className:z===null?`bg-foreground/[0.08]`:void 0,onClick:()=>i(null),children:(0,J.jsx)(`span`,{children:`All commits`})}),$.slice(0,ye).map(e=>(0,J.jsxs)(l,{className:e.oid===z?`bg-foreground/[0.08]`:void 0,onClick:()=>i(e.oid),children:[(0,J.jsxs)(x,{children:[(0,J.jsx)(v,{render:(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.messageHeadline})}),(0,J.jsx)(T,{side:`top`,children:e.messageHeadline})]}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-xs text-muted-foreground`,children:e.oid.slice(0,7)})]},e.oid)),$.length>ye?(0,J.jsx)(l,{closeOnClick:!1,onClick:()=>xe(e=>e+Tt),children:(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Show more (`,$.length-ye,` left)`]})}):null]})]}):null,(0,J.jsxs)(Se,{className:`shrink-0`,children:[(0,J.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[q.length,` `,q.length===1?`file`:`files`,Y===null?``:`+`]}),ct?(0,J.jsxs)(x,{children:[(0,J.jsx)(v,{render:(0,J.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,J.jsx)(S,{"aria-label":`Some of this diff was not shown`,className:`size-3.5 text-amber-600 dark:text-amber-500`})}),(0,J.jsx)(T,{side:`bottom`,children:`The host withheld part of this diff — a binary file, or a change too large to inline.`})]}):null,z!==null&&W.inlineComment?(0,J.jsxs)(x,{children:[(0,J.jsx)(v,{render:(0,J.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,J.jsx)(qe,{"aria-label":`Line comments are written from the whole change`,className:`size-3.5`})}),(0,J.jsx)(T,{side:`bottom`,children:`A comment is anchored to the whole change, so switch to All commits to write one.`})]}):null]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[ht.length>0?(0,J.jsxs)(x,{children:[(0,J.jsx)(v,{render:(0,J.jsx)(f,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":vt?`Expand all files`:`Collapse all files`,onClick:St}),children:vt?(0,J.jsx)(oe,{className:`size-3.5`}):(0,J.jsx)(se,{className:`size-3.5`})}),(0,J.jsx)(T,{side:`top`,children:vt?`Expand all files`:`Collapse all files`})]}):null,(0,J.jsxs)(Re,{className:`shrink-0 gap-1`,size:`sm`,value:[Te],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&Ee(t)},children:[(0,J.jsx)(ze,{"aria-label":`Stacked diff view`,value:`stacked`,variant:`ghost`,children:(0,J.jsx)(Ae,{className:`size-3.5`})}),(0,J.jsx)(ze,{"aria-label":`Split diff view`,value:`split`,variant:`ghost`,children:(0,J.jsx)(Me,{className:`size-3.5`})})]}),(0,J.jsxs)(x,{children:[(0,J.jsx)(v,{render:(0,J.jsx)(ze,{"aria-label":M?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:M,onPressedChange:e=>{Ne(!!e)}}),children:(0,J.jsx)(k,{className:`size-3.5`})}),(0,J.jsx)(T,{side:`top`,children:M?`Disable line wrapping`:`Enable line wrapping`})]})]})]}),Ut=e=>(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ht,(0,J.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`h-full overflow-auto`,children:e}),zt]})]});if(U.isPending&&V.length===0)return Ut((0,J.jsx)(Pe,{label:`Loading pull request diff...`}));if(U.error&&V.length===0)return Ut((0,J.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:U.error}));let Wt=Y===null?K.flatMap(e=>e?.kind===`raw`?[e]:[]):[];if(q.length===0&&Wt.length>0)return Ut((0,J.jsx)(`div`,{className:`space-y-4 px-4 py-5`,children:Wt.map(e=>(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,J.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))}));if(X.length===0&&Y===null)return Ut((0,J.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:z===null?`This pull request has no file changes.`:`This commit has no file changes.`}));let Gt=n.reviewThreads.filter(e=>!ut.has(e.id)),Kt=new Map;for(let e of Gt){let t=Kt.get(e.path);t?t.push(e):Kt.set(e.path,[e])}let qt=Wt.length===0?null:(0,J.jsx)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-5`,children:Wt.map(e=>(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,J.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))});return(0,J.jsx)(Fe,{children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ht,Kt.size>0?(0,J.jsxs)(me,{className:`shrink-0 border-b border-border/60`,open:Ve,onOpenChange:He,children:[(0,J.jsx)(`h2`,{children:(0,J.jsxs)(he,{className:`flex w-full items-center gap-1.5 px-4 py-2 text-left text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:Y===null?`Conversations not on the current diff`:`Conversations not on the diff loaded so far`}),(0,J.jsx)(d,{"aria-hidden":!0,className:ne(`size-3.5 transition-transform`,Ve&&`rotate-90`)}),(0,J.jsx)(`span`,{"aria-hidden":!0,className:`tabular-nums`,children:Gt.length}),(0,J.jsx)(`span`,{className:`sr-only`,children:Gt.length===1?`1 conversation`:`${Gt.length} conversations`})]})}),(0,J.jsx)(pe,{children:(0,J.jsx)(`div`,{className:`max-h-64 space-y-3 overflow-auto px-4 pb-3`,children:[...Kt].map(([e,t])=>(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(x,{children:[(0,J.jsx)(v,{render:(0,J.jsx)(`p`,{className:`truncate px-3 text-xs text-muted-foreground`,children:e})}),(0,J.jsx)(T,{side:`top`,children:e})]}),(0,J.jsx)(`div`,{className:`mt-1 space-y-2`,children:t.map(e=>(0,J.jsxs)(`div`,{children:[e.line===null?null:(0,J.jsxs)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:[`Line `,e.line]}),Lt(e)]},e.id))})]},e))})})]}):null,(0,J.jsxs)(`div`,{className:`relative min-h-0 flex-1`,onClickCapture:e=>{let t=e.nativeEvent.composedPath?.()??[];for(let e of t)if(e instanceof HTMLElement){if(e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement)return;if(e.hasAttribute(`data-diffs-header`)){let t=e.querySelector(`[data-title]`)?.textContent?.trim();if(t===void 0||t===``)return;let n=X.find(e=>A(e.fileDiff)===t);n!==void 0&&xt(n.id);return}}},children:[(0,J.jsx)(je,{className:`h-full overflow-auto [scrollbar-gutter:stable]`,items:X,selectedLines:Ie,onSelectedLinesChange:P,options:Ft,renderCodeViewFooter:Mt,renderHeaderPrefix:Nt,renderHeaderMetadata:Pt,renderAnnotation:Rt,unsafeCSSExtra:Et}),zt]}),qt]})})}export{At as PullRequestCodeTab,At as default};
|
|
6
|
+
//# sourceMappingURL=PullRequestCodeTab-DM_H15J2.js.map
|