laplus 0.1.5 → 0.1.7
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/package.json +6 -6
- package/ui/dist/assets/{DiffPanel-CmLwL5Y4.js → DiffPanel-DRLb5V2O.js} +2 -2
- package/ui/dist/assets/{DiffPanel-CmLwL5Y4.js.map → DiffPanel-DRLb5V2O.js.map} +1 -1
- package/ui/dist/assets/{FilePreviewPanel-7UYO5Mra.js → FilePreviewPanel-CNxX4J5k.js} +2 -2
- package/ui/dist/assets/{FilePreviewPanel-7UYO5Mra.js.map → FilePreviewPanel-CNxX4J5k.js.map} +1 -1
- package/ui/dist/assets/{PreviewPanel-VFr5-jjQ.js → PreviewPanel-D1RgBgdC.js} +2 -2
- package/ui/dist/assets/{PreviewPanel-VFr5-jjQ.js.map → PreviewPanel-D1RgBgdC.js.map} +1 -1
- package/ui/dist/assets/{fileCommentAnnotations-3602doIr.js → fileCommentAnnotations-CLPA7umr.js} +2 -2
- package/ui/dist/assets/{fileCommentAnnotations-3602doIr.js.map → fileCommentAnnotations-CLPA7umr.js.map} +1 -1
- package/ui/dist/assets/{index-BIRnPNNR.js → index-c0OLJn1C.js} +4 -4
- package/ui/dist/assets/{index-BIRnPNNR.js.map → index-c0OLJn1C.js.map} +1 -1
- package/ui/dist/index.html +1 -1
- package/ui/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as e,E as t,Ft as n,Gd as r,Ks as i,Ld as a,Lo as o,N as s,O as c,Qo as l,S as u,Ss as d,Xt as f,ar as p,b as m,cf as h,cs as g,df as _,dr as v,ds as y,er as b,fr as ee,gl as x,hs as S,ir as C,jo as w,lr as T,ls as E,ml as D,no as O,or as k,os as A,rr as j,sr as M,ur as te,vs as N,w as ne,x as re,yo as P}from"./textarea-Zwf6kD06.js";import{t as ie}from"./arrow-right-2FD-xj4K.js";import{$n as F,An as I,Ar as ae,Dn as oe,Dr as se,Er as L,Fr as ce,Jn as R,Kn as z,On as B,Qn as V,Sr as le,Tr as ue,Yn as H,_n as U,a as W,ar as G,bn as K,c as q,cr as de,dr as J,er as Y,gn as X,hn as fe,i as pe,ir as me,jn as he,kn as ge,lr as _e,mn as ve,n as ye,nr as be,o as xe,or as Se,r as Ce,rr as we,s as Te,sr as Ee,t as De,tr as Oe,ur as ke,v as Ae,vn as je,wr as Me,xn as Ne,xr as Pe,yn as Fe}from"./index-BIRnPNNR.js";var Ie=P(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Le=P(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Re=P(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ze=P(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Be=P(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),Z=_(h(),1),Q=a(),$=r();function Ve(e){let t=(0,Q.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=n(`relative inline-flex w-full min-w-0 items-center rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-ring has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/36 has-autofill:bg-foreground/4 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid],textarea[aria-invalid]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_-1px_--theme(--color-white/6%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-1px)]`,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,$.jsx)(`div`,{className:a,"data-slot":`input-group`,role:`group`,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}var He=w(`[&_svg]:-mx-0.5 flex h-auto cursor-text select-none items-center justify-center gap-2 leading-none [&>kbd]:rounded-[calc(var(--radius)-5px)] in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80`,{defaultVariants:{align:`inline-start`},variants:{align:{"block-end":`order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]`,"block-start":`order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]`,"inline-end":`has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]`,"inline-start":`has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]`}}});function Ue(e){let t=(0,Q.c)(11),r,i,a;t[0]===e?(r=t[1],i=t[2],a=t[3]):({className:r,align:a,...i}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a);let o=a===void 0?`inline-start`:a,s;t[4]!==o||t[5]!==r?(s=n(He({align:o}),r),t[4]=o,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==i||t[9]!==s?(c=(0,$.jsx)(`div`,{className:s,"data-align":o,"data-slot":`input-group-addon`,onMouseDown:We,...i}),t[7]=o,t[8]=i,t[9]=s,t[10]=c):c=t[10],c}function We(e){if(e.target.closest(`button, a, input, select, textarea, [role='button'], [role='combobox'], [role='listbox'], [data-slot='select-trigger']`))return;e.preventDefault();let t=e.currentTarget.parentElement,n=t?.querySelector(`input, textarea`);n&&!t?.querySelector(`input:focus, textarea:focus`)&&n.focus()}function Ge(e){let t=(0,Q.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,$.jsx)(z,{className:n,unstyled:!0,...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var Ke=()=>{};function qe(e){let t=(0,Q.c)(98),{url:r,displayUrl:i,loading:a,loadProgress:o,canGoBack:s,canGoForward:c,refreshDisabled:l,inputDisabled:d,focusUrlNonce:f,onBack:p,onForward:m,onRefresh:h,onSubmit:g,onOpenInBrowser:_,onCapture:v,captureDisabled:y,recording:b,onPictureInPicture:ee,pictureInPicture:x,pictureInPictureDisabled:S,onPickElement:C,pickActive:w,pickDisabled:T,pickDisabledReason:E,trailingActions:D}=e,k=(0,Z.useRef)(null),[A,j]=(0,Z.useState)(r),[M,te]=(0,Z.useState)(!1),N,P;t[0]===f?(N=t[1],P=t[2]):(N=()=>{if(f==null)return;let e=k.current;e&&e.focus()},P=[f],t[0]=f,t[1]=N,t[2]=P),(0,Z.useEffect)(N,P);let F;t[3]!==A||t[4]!==g?(F=e=>{e?.preventDefault();let t=A.trim();t.length!==0&&(g(t),k.current?.blur())},t[3]=A,t[4]=g,t[5]=F):F=t[5];let I=F,ae=s?p:Ke,oe=!s,se;t[6]!==ae||t[7]!==oe?(se=(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,onClick:ae,disabled:oe,"aria-label":`Back`,type:`button`}),t[6]=ae,t[7]=oe,t[8]=se):se=t[8];let R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(ce,{}),t[9]=R):R=t[9];let z;t[10]===se?z=t[11]:(z=(0,$.jsx)(ne,{render:se,children:R}),t[10]=se,t[11]=z);let B;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(u,{children:`Back`}),t[12]=B):B=t[12];let V;t[13]===z?V=t[14]:(V=(0,$.jsxs)(re,{children:[z,B]}),t[13]=z,t[14]=V);let le=c?m:Ke,H=!c,U;t[15]!==le||t[16]!==H?(U=(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,onClick:le,disabled:H,"aria-label":`Forward`,type:`button`}),t[15]=le,t[16]=H,t[17]=U):U=t[17];let W;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(ie,{}),t[18]=W):W=t[18];let G;t[19]===U?G=t[20]:(G=(0,$.jsx)(ne,{render:U,children:W}),t[19]=U,t[20]=G);let K;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(u,{children:`Forward`}),t[21]=K):K=t[21];let q;t[22]===G?q=t[23]:(q=(0,$.jsxs)(re,{children:[G,K]}),t[22]=G,t[23]=q);let de=l?Ke:h,J=a?`Stop`:`Refresh`,Y;t[24]!==l||t[25]!==de||t[26]!==J?(Y=(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,onClick:de,disabled:l,"aria-label":J,type:`button`}),t[24]=l,t[25]=de,t[26]=J,t[27]=Y):Y=t[27];let X=a&&`animate-spin`,fe;t[28]===X?fe=t[29]:(fe=n(X),t[28]=X,t[29]=fe);let pe;t[30]===fe?pe=t[31]:(pe=(0,$.jsx)(Pe,{className:fe}),t[30]=fe,t[31]=pe);let me;t[32]!==Y||t[33]!==pe?(me=(0,$.jsx)(ne,{render:Y,children:pe}),t[32]=Y,t[33]=pe,t[34]=me):me=t[34];let he=a?`Loading…`:`Refresh`,ge;t[35]===he?ge=t[36]:(ge=(0,$.jsx)(u,{children:he}),t[35]=he,t[36]=ge);let _e;t[37]!==me||t[38]!==ge?(_e=(0,$.jsxs)(re,{children:[me,ge]}),t[37]=me,t[38]=ge,t[39]=_e):_e=t[39];let ve;t[40]!==V||t[41]!==q||t[42]!==_e?(ve=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`Navigation`,children:[V,q,_e]}),t[40]=V,t[41]=q,t[42]=_e,t[43]=ve):ve=t[43];let ye=M?A:i??r,be=_&&!M&&`group-hover/address:pe-7 transition-[padding]`,xe;t[44]===be?xe=t[45]:(xe=n(be),t[44]=be,t[45]=xe);let Se;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Se=e=>j(e.target.value),t[46]=Se):Se=t[46];let Ce;t[47]===r?Ce=t[48]:(Ce=()=>{j(r),te(!0),queueMicrotask(()=>k.current?.select())},t[47]=r,t[48]=Ce);let we;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>{te(!1)},t[49]=we):we=t[49];let Te;t[50]!==I||t[51]!==r?(Te=e=>{e.key===`Enter`&&I(e),e.key===`Escape`&&(e.preventDefault(),j(r),k.current?.blur())},t[50]=I,t[51]=r,t[52]=Te):Te=t[52];let Ee;t[53]!==d||t[54]!==ye||t[55]!==xe||t[56]!==Ce||t[57]!==Te?(Ee=(0,$.jsx)(ne,{render:(0,$.jsx)(Ge,{ref:k,value:ye,className:xe,onChange:Se,onFocus:Ce,onBlur:we,onKeyDown:Te,placeholder:`Search or enter URL`,spellCheck:!1,disabled:d,"data-preview-url-input":!0,size:`sm`})}),t[53]=d,t[54]=ye,t[55]=xe,t[56]=Ce,t[57]=Te,t[58]=Ee):Ee=t[58];let De;t[59]!==i||t[60]!==M||t[61]!==r?(De=!M&&i?(0,$.jsx)(u,{children:r}):null,t[59]=i,t[60]=M,t[61]=r,t[62]=De):De=t[62];let Oe;t[63]!==Ee||t[64]!==De?(Oe=(0,$.jsxs)(re,{children:[Ee,De]}),t[63]=Ee,t[64]=De,t[65]=Oe):Oe=t[65];let ke;t[66]!==M||t[67]!==_?(ke=_&&!M?(0,$.jsx)(Ue,{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)(re,{children:[(0,$.jsx)(ne,{render:(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,onClick:_,"aria-label":`Open in system browser`,type:`button`}),children:(0,$.jsx)(Re,{})}),(0,$.jsx)(u,{children:`Open in system browser`})]})}):null,t[66]=M,t[67]=_,t[68]=ke):ke=t[68];let Ae;t[69]!==Oe||t[70]!==ke?(Ae=(0,$.jsxs)(Ve,{className:`group/address h-7 flex-1 rounded-md border-transparent bg-transparent shadow-none before:shadow-none hover:bg-muted/40 focus-within:bg-background`,children:[Oe,ke]}),t[69]=Oe,t[70]=ke,t[71]=Ae):Ae=t[71];let je;t[72]!==C||t[73]!==w||t[74]!==T||t[75]!==E?(je=C?(0,$.jsxs)(re,{children:[(0,$.jsx)(ne,{render:(0,$.jsx)(O,{variant:w?`secondary`:`ghost`,size:`icon-xs`,onClick:C,disabled:T,"aria-label":w?`Cancel annotation`:`Annotate preview`,"aria-pressed":w?`true`:`false`,type:`button`}),children:(0,$.jsx)(L,{className:n(w&&`text-primary`)})}),(0,$.jsx)(u,{children:T&&E?E:w?`Cancel annotation (Esc)`:`Annotate elements, regions, and drawings`})]}):null,t[72]=C,t[73]=w,t[74]=T,t[75]=E,t[76]=je):je=t[76];let Me;t[77]!==y||t[78]!==v||t[79]!==b?(Me=v?(0,$.jsxs)(re,{children:[(0,$.jsxs)(ne,{render:(0,$.jsx)(O,{variant:b?`secondary`:`ghost`,size:`icon-xs`,onClick:e=>v(e.shiftKey),"aria-label":b?`Stop recording`:`Capture screenshot`,type:`button`,className:`relative`,disabled:y}),children:[(0,$.jsx)(Ie,{className:n(b&&`text-destructive`)}),b?(0,$.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-1.5 animate-status-pulse rounded-full bg-destructive`}):null]}),(0,$.jsx)(u,{children:b?`Stop recording`:`Screenshot · Shift-click to record`})]}):null,t[77]=y,t[78]=v,t[79]=b,t[80]=Me):Me=t[80];let Ne;t[81]!==ee||t[82]!==x||t[83]!==S?(Ne=ee?(0,$.jsxs)(re,{children:[(0,$.jsx)(ne,{render:(0,$.jsx)(O,{variant:x?`secondary`:`ghost`,size:`icon-xs`,onClick:ee,"aria-label":x?`Close floating preview`:`Float preview over chat`,"aria-pressed":x?`true`:`false`,type:`button`,disabled:S}),children:(0,$.jsx)(ue,{className:n(x&&`text-primary`)})}),(0,$.jsx)(u,{children:x?`Close floating preview`:`Float preview over chat`})]}):null,t[81]=ee,t[82]=x,t[83]=S,t[84]=Ne):Ne=t[84];let Fe;t[85]!==I||t[86]!==ve||t[87]!==Ae||t[88]!==je||t[89]!==Me||t[90]!==Ne||t[91]!==D?(Fe=(0,$.jsxs)(`form`,{onSubmit:I,className:`surface-subheader gap-1 px-2`,"data-surface-subheader":!0,children:[ve,Ae,je,Me,Ne,D]}),t[85]=I,t[86]=ve,t[87]=Ae,t[88]=je,t[89]=Me,t[90]=Ne,t[91]=D,t[92]=Fe):Fe=t[92];let Le;t[93]===o?Le=t[94]:(Le=o>0?(0,$.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 rounded-r-full bg-primary transition-all duration-150 ease-out`,style:{width:`${o}%`,boxShadow:`0 0 6px 1px var(--color-ring)`}}):null,t[93]=o,t[94]=Le);let ze;return t[95]!==Fe||t[96]!==Le?(ze=(0,$.jsxs)(`div`,{className:`relative`,children:[Fe,Le]}),t[95]=Fe,t[96]=Le,t[97]=ze):ze=t[97],ze}function Je(e){try{let t=new URL(e.url),n=new URL(e.environmentHttpBaseUrl);if(t.origin===n.origin&&t.pathname.startsWith(`/api/assets/`)){let n=t.pathname.split(`/`).at(-1);if(!n)return null;let r=decodeURIComponent(n);return!r||r===`.`||r===`..`?null:`${e.environmentLabel} · ${r}`}return t.protocol===`http:`||t.protocol===`https:`?t.host:null}catch{return null}}function Ye(e){let t=(0,Q.c)(6),{className:r}=e,i;t[0]===r?i=t[1]:(i=n(`relative flex flex-col gap-0.5 overflow-hidden rounded-[5px] border border-border/60 bg-card p-1 shadow-xs/5`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-destructive/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-warning/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-success/80`})]}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(`div`,{className:`mt-[1px] flex flex-1 flex-col gap-[2px]`,children:[(0,$.jsx)(`span`,{className:`h-[2px] w-full rounded-full bg-muted-foreground/30`}),(0,$.jsx)(`span`,{className:`h-[2px] w-3/5 rounded-full bg-muted-foreground/20`})]}),t[3]=o):o=t[3];let s;return t[4]===i?s=t[5]:(s=(0,$.jsxs)(`div`,{"aria-hidden":!0,className:i,children:[a,o]}),t[4]=i,t[5]=s),s}function Xe(e){let t=(0,Q.c)(17),{server:n,onOpen:r}=e,i;t[0]===n?i=t[1]:(i=Ze(n),t[0]=n,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Ye,{className:`size-7 shrink-0`}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:a}),t[3]=a,t[4]=s);let c;t[5]!==n.host||t[6]!==n.port?(c=(0,$.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[n.host,`:`,n.port]}),t[5]=n.host,t[6]=n.port,t[7]=c):c=t[7];let l;t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10];let u;t[11]===n.listening?u=t[12]:(u=n.listening?(0,$.jsx)(Qe,{}):(0,$.jsx)($e,{}),t[11]=n.listening,t[12]=u);let d;return t[13]!==r||t[14]!==l||t[15]!==u?(d=(0,$.jsxs)(`button`,{type:`button`,onClick:r,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:[o,l,u]}),t[13]=r,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function Ze(e){return e.processName?e.processName:e.listening?`Listening`:e.source===`configured`?`Configured`:`Recently seen`}function Qe(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`span`,{"aria-label":`Listening`,className:`relative inline-flex size-2 shrink-0`,children:[(0,$.jsx)(`span`,{className:`absolute inset-0 animate-status-ping rounded-full bg-success opacity-60`}),(0,$.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-success`})]}),e[0]=t):t=e[0],t}function $e(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`span`,{"aria-label":`Not currently listening`,className:`size-2 shrink-0 rounded-full bg-muted-foreground/40`}),e[0]=t):t=e[0],t}function et(e){let t=(0,Q.c)(7),n=ke(e.environmentId),r;if(t[0]!==e.configuredUrls||t[1]!==e.environmentId||t[2]!==e.recentlySeenUrls||t[3]!==n){let i;t[5]===e.environmentId?i=t[6]:(i=t=>({...t,url:Ee(e.environmentId,t.url)}),t[5]=e.environmentId,t[6]=i),r=tt({scanner:n.map(i),configuredUrls:e.configuredUrls??[],recentlySeenUrls:e.recentlySeenUrls??[]}),t[0]=e.configuredUrls,t[1]=e.environmentId,t[2]=e.recentlySeenUrls,t[3]=n,t[4]=r}else r=t[4];return r}function tt(e){let t=new Map;for(let n of e.configuredUrls){let e=rt(n);if(!e)continue;let r=nt(e.host,e.port);t.has(r)||t.set(r,{host:e.host,port:e.port,url:e.url,processName:null,pid:null,terminal:null,source:`configured`,listening:!1})}for(let n of e.scanner){let e=nt(n.host,n.port),r=t.get(e);if(r){t.set(e,{...r,processName:n.processName??r.processName,pid:n.pid??r.pid,terminal:n.terminal??r.terminal,listening:!0});continue}t.set(e,{...n,source:`scanner`,listening:!0})}for(let n of e.recentlySeenUrls){let e=rt(n);if(!e)continue;let r=nt(e.host,e.port);t.has(r)||t.set(r,{host:e.host,port:e.port,url:e.url,processName:null,pid:null,terminal:null,source:`recent`,listening:!1})}return Array.from(t.values()).toSorted((e,t)=>{let n={configured:0,scanner:1,recent:2};return n[e.source]===n[t.source]?e.port-t.port:n[e.source]-n[t.source]})}function nt(e,t){return`${e.toLowerCase()}:${t}`}function rt(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`||!de(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 it(e){let t=(0,Q.c)(16),{environmentId:n,configuredUrls:r,recentlySeenUrls:i,onOpenUrl:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o={environmentId:n,configuredUrls:r,recentlySeenUrls:i},t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s=et(o);if(s.length===0){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(oe,{children:[(0,$.jsx)(ge,{variant:`icon`,children:(0,$.jsx)(ae,{className:`size-4.5 text-muted-foreground`})}),(0,$.jsx)(I,{children:`No preview yet`}),(0,$.jsx)(B,{children:`Type a URL above, or run a dev script. Listening localhost ports will show up here automatically.`})]}),t[4]=e):e=t[4],e}let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(Be,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Local servers`})]}),t[5]=c):c=t[5];let l;if(t[6]!==a||t[7]!==s){let e;t[9]===a?e=t[10]:(e=e=>(0,$.jsx)(Xe,{server:e,onOpen:()=>a(e.url)},`${e.host}:${e.port}`),t[9]=a,t[10]=e),l=s.map(e),t[6]=a,t[7]=s,t[8]=l}else l=t[8];let u;t[11]===l?u=t[12]:(u=(0,$.jsx)(`div`,{className:`flex flex-col divide-y divide-border/60 overflow-hidden rounded-xl border border-border/70 bg-background`,children:l}),t[11]=l,t[12]=u);let d;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:`Select a listening port to open it in this browser tab.`}),t[13]=d):d=t[13];let f;return t[14]===u?f=t[15]:(f=(0,$.jsx)(`div`,{className:`flex h-full min-h-0 overflow-y-auto px-5 py-8`,children:(0,$.jsxs)(`div`,{className:`m-auto flex w-full max-w-xl flex-col gap-3`,children:[c,u,d]})}),t[14]=u,t[15]=f),f}var at=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}];function ot(e){let t=(0,Q.c)(74),{tabId:n,hasWebContents:r,zoomFactor:i,colorScheme:a,deviceToolbarVisible:o,onToggleDeviceToolbar:s,nativePictureInPicture:c,onNativePictureInPicture:l}=e;if(!X)return null;let d=!n||!r,f;t[0]===n?f=t[1]:(f=e=>()=>{n&&e(n).catch(mt)},t[0]=n,t[1]=f);let m=f,h;t[2]===i?h=t[3]:(h=Math.round(i*100),t[2]=i,t[3]=h);let g=`${h}%`,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsxs)(re,{children:[(0,$.jsx)(ne,{render:(0,$.jsx)(ee,{render:(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":`Preview menu`})}),children:(0,$.jsx)(Le,{})}),(0,$.jsx)(u,{children:`More`})]}),t[4]=_):_=t[4];let y;t[5]===m?y=t[6]:(y=m(X.hardReload),t[5]=m,t[6]=y);let x;t[7]!==y||t[8]!==d?(x=(0,$.jsx)(j,{onClick:y,disabled:d,children:`Hard reload`}),t[7]=y,t[8]=d,t[9]=x):x=t[9];let S;t[10]===m?S=t[11]:(S=m(X.openDevTools),t[10]=m,t[11]=S);let w;t[12]!==S||t[13]!==d?(w=(0,$.jsx)(j,{onClick:S,disabled:d,children:`Open DevTools`}),t[12]=S,t[13]=d,t[14]=w):w=t[14];let E=c?`Close separate preview window`:`Open separate preview window`,D;t[15]!==l||t[16]!==E||t[17]!==d?(D=(0,$.jsx)(j,{onClick:l,disabled:d,children:E}),t[15]=l,t[16]=E,t[17]=d,t[18]=D):D=t[18];let k=o?`Hide device toolbar`:`Show device toolbar`,A;t[19]!==s||t[20]!==k||t[21]!==d?(A=(0,$.jsx)(j,{onClick:s,disabled:d,children:k}),t[19]=s,t[20]=k,t[21]=d,t[22]=A):A=t[22];let N;t[23]===d?N=t[24]:(N=(0,$.jsx)(v,{disabled:d,children:`Appearance`}),t[23]=d,t[24]=N);let P;t[25]===n?P=t[26]:(P=e=>{n&&X.setColorScheme(n,e).catch(pt)},t[25]=n,t[26]=P);let ie;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ie=at.map(ft),t[27]=ie):ie=t[27];let F;t[28]!==a||t[29]!==P?(F=(0,$.jsx)(te,{className:`min-w-32`,children:(0,$.jsx)(p,{value:a,onValueChange:P,children:ie})}),t[28]=a,t[29]=P,t[30]=F):F=t[30];let I;t[31]!==N||t[32]!==F?(I=(0,$.jsxs)(T,{children:[N,F]}),t[31]=N,t[32]=F,t[33]=I):I=t[33];let ae;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(M,{}),t[34]=ae):ae=t[34];let oe;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(`span`,{children:`Zoom`}),t[35]=oe):oe=t[35];let L;t[36]===m?L=t[37]:(L=m(X.zoomOut),t[36]=m,t[37]=L);let ce;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(se,{}),t[38]=ce):ce=t[38];let R;t[39]!==L||t[40]!==d?(R=(0,$.jsx)(O,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:L,"aria-label":`Zoom out`,disabled:d,children:ce}),t[39]=L,t[40]=d,t[41]=R):R=t[41];let z;t[42]===g?z=t[43]:(z=(0,$.jsx)(`span`,{className:`min-w-12 text-center text-xs tabular-nums text-muted-foreground`,children:g}),t[42]=g,t[43]=z);let B;t[44]===m?B=t[45]:(B=m(X.zoomIn),t[44]=m,t[45]=B);let V;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(Me,{}),t[46]=V):V=t[46];let ue;t[47]!==B||t[48]!==d?(ue=(0,$.jsx)(O,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:B,"aria-label":`Zoom in`,disabled:d,children:V}),t[47]=B,t[48]=d,t[49]=ue):ue=t[49];let H;t[50]===m?H=t[51]:(H=m(X.resetZoom),t[50]=m,t[51]=H);let U;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(le,{}),t[52]=U):U=t[52];let W;t[53]!==H||t[54]!==d?(W=(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,type:`button`,onClick:H,"aria-label":`Reset zoom`,disabled:d,children:U}),t[53]=H,t[54]=d,t[55]=W):W=t[55];let G;t[56]!==R||t[57]!==z||t[58]!==ue||t[59]!==W?(G=(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[R,z,ue,W]}),t[56]=R,t[57]=z,t[58]=ue,t[59]=W,t[60]=G):G=t[60];let K;t[61]!==G||t[62]!==d?(K=(0,$.jsxs)(j,{closeOnClick:!1,onClick:dt,className:`justify-between`,disabled:d,children:[oe,G]}),t[61]=G,t[62]=d,t[63]=K):K=t[63];let q,de,J;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(M,{}),de=(0,$.jsx)(j,{onClick:lt,children:`Clear cookies`}),J=(0,$.jsx)(j,{onClick:st,children:`Clear cache`}),t[64]=q,t[65]=de,t[66]=J):(q=t[64],de=t[65],J=t[66]);let Y;return t[67]!==A||t[68]!==I||t[69]!==K||t[70]!==x||t[71]!==w||t[72]!==D?(Y=(0,$.jsxs)(b,{children:[_,(0,$.jsxs)(C,{align:`end`,sideOffset:6,className:`min-w-56`,children:[x,w,D,A,I,ae,K,q,de,J]})]}),t[67]=A,t[68]=I,t[69]=K,t[70]=x,t[71]=w,t[72]=D,t[73]=Y):Y=t[73],Y}function st(){X.clearCache().catch(ct)}function ct(){}function lt(){X.clearCookies().catch(ut)}function ut(){}function dt(e){return e.preventDefault()}function ft(e){return(0,$.jsx)(k,{value:e.value,children:e.label},e.value)}function pt(){}function mt(){}function ht(e){return Se[e]||(e.length>0?e:`Network error`)}function gt(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=ht(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)(vt,{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 g;t[9]===l?g=t[10]:(g=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:l}),t[9]=l,t[10]=g);let _;t[11]!==d||t[12]!==g?(_=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[g,`: `,d,`.`]}),t[11]=d,t[12]=g,t[13]=_):_=t[13];let v;t[14]===o?v=t[15]:(v=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]=v);let y;t[16]===p?y=t[17]:(y=(0,$.jsx)(`div`,{className:`mt-8 text-xs uppercase tracking-wide text-muted-foreground/70`,children:p}),t[16]=p,t[17]=y);let b;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>s(_t),t[18]=b):b=t[18];let ee=o?`Hide details`:`Details`,x;t[19]===ee?x=t[20]:(x=(0,$.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:b,children:ee}),t[19]=ee,t[20]=x);let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`div`,{className:`flex-1`}),t[21]=S):S=t[21];let C;t[22]===a?C=t[23]:(C=(0,$.jsx)(O,{type:`button`,size:`sm`,onClick:a,children:`Reload`}),t[22]=a,t[23]=C);let w;t[24]!==x||t[25]!==C?(w=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[x,S,C]}),t[24]=x,t[25]=C,t[26]=w):w=t[26];let T;return t[27]!==w||t[28]!==_||t[29]!==v||t[30]!==y?(T=(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,w]})}),t[27]=w,t[28]=_,t[29]=v,t[30]=y,t[31]=T):T=t[31],T}function _t(e){return!e}function vt(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}}function bt(e){let t=e.toLowerCase();return t.includes(`mac`)?`Reveal in Finder`:t.includes(`win`)?`Reveal in File Explorer`:`Reveal in Files`}var xt=120,St=220,Ct=4,wt=90,Tt=.08,Et=.5;function Dt(e){let[t,n]=(0,Z.useState)(0),r=(0,Z.useRef)(0);return r.current=t,(0,Z.useEffect)(()=>{if(!e){if(r.current===0)return;n(100);let e=window.setTimeout(()=>n(0),St);return()=>window.clearTimeout(e)}n(e=>e>0&&e<95?e:Ct);let t=window.setInterval(()=>{let e=r.current;if(e>=wt)return;let t=wt-e,i=Math.max(Et,t*Tt);n(Math.min(wt,e+i))},xt);return()=>window.clearInterval(t)},[e]),t}var Ot=class extends x()(`PreviewSessionThreadKeyParseError`,{threadKey:D}){get message(){return`Invalid scoped preview thread key: ${this.threadKey}`}},kt=A(e=>{let t=N(e);if(t===null)throw new Ot({threadKey:e});let n=J.list({environmentId:t.environmentId,input:{threadId:t.threadId}}),r=J.events({environmentId:t.environmentId,input:{}});return g(e=>{let i=!1,a=0,o=e=>{S(e)&&be(t,e.value)},s=r=>{if(!S(r)||r.value.threadId!==t.threadId)return;let i=Oe(t).serverEpoch;if(i!==null&&i!==r.value.serverEpoch){e.refresh(n);return}F(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(E(1e3),y(`preview:session-sync:${e}`))});function At(e){let t=(0,Q.c)(2),n;t[0]===e?n=t[1]:(n=kt(d(e)),t[0]=e,t[1]=n),o(n)}var jt=1500,Mt=.001;function Nt(e){let t=(0,Q.c)(11),{zoomFactor:r}=e,[i,a]=(0,Z.useState)(!1),o=(0,Z.useRef)(r),s=(0,Z.useRef)(null),c,l;t[0]===r?(c=t[1],l=t[2]):(c=()=>{if(!(Math.abs(o.current-r)<Mt))return o.current=r,a(!0),s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{a(!1),s.current=null},jt),()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null)}},l=[r],t[0]=r,t[1]=c,t[2]=l),(0,Z.useEffect)(c,l);let u;t[3]===r?u=t[4]:(u=Math.round(r*100),t[3]=r,t[4]=u);let d=`${u}%`,f=!i,p=i?`opacity-100 translate-y-0`:`opacity-0 -translate-y-1`,m;t[5]===p?m=t[6]:(m=n(`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`,p),t[5]=p,t[6]=m);let h;return t[7]!==d||t[8]!==f||t[9]!==m?(h=(0,$.jsx)(`div`,{"aria-hidden":f,className:m,children:d}),t[7]=d,t[8]=f,t[9]=m,t[10]=h):h=t[10],h}function Pt(e,t){return e?1:t===`human`?.18:.35}var Ft=700;function It(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=q(a),s;t[2]===n?s=t[3]:(s=e=>e.byTabId[n]?.content??null,t[2]=n,t[3]=s);let c=Ne(s);if(!o)return null;let l;return t[4]!==c||t[5]!==i||t[6]!==o||t[7]!==r?(l=(0,$.jsx)(Lt,{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 Lt(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),Ft);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=Pt(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)(ze,{className:`relative size-5 -translate-x-0.5 -translate-y-0.5 fill-background text-primary drop-shadow-sm`,strokeWidth:2}),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 Rt=typeof window>`u`?null:s();function zt({threadRef:n,tabId:r,configuredUrls:a,visible:o}){let[s,u]=(0,Z.useState)(void 0),[p,h]=(0,Z.useState)(!1),g=xe(),_=(0,Z.useRef)(!1),v=(0,Z.useRef)(!0),y=G(n),b=je(e=>U(e.byThreadKey,n)),ee=f(e=>e.addPreviewAnnotation),x=f(e=>e.addImage),S=e(n.environmentId),C=c(n.environmentId),w=t(J.open),T=t(J.resize,`preview viewport resize`);At(n),(0,Z.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);let E=r??y.activeTabId,D=E?Fe(n,y.serverEpoch,E):null,O=E&&D?g.has(D)?D:Ce(n,E):null,k=E?y.sessions[E]??null:null,A=E?y.desktopByTabId[E]??null:null,j=k?.navStatus??{_tag:`Idle`},M=j._tag===`Idle`?``:j.url,te=A?.loading??j._tag===`Loading`,N=A?.canGoBack??k?.canGoBack??!1,ne=A?.canGoForward??k?.canGoForward??!1,re=j._tag===`Idle`,P=j._tag===`LoadFailed`,ie=fe(k),F=A?.controller??`none`,I=Dt(te),ae=M&&S&&C?Je({url:M,environmentLabel:S.label,environmentHttpBaseUrl:C})??void 0:void 0,oe=k?.viewport??i,se=Ne(e=>D?e.byTabId[D]?.rect??null:null),L=(0,Z.useCallback)(async e=>{D&&X?(await X.navigate(D,e),we(n,e)):await V({openPreview:w,threadRef:n,url:e})},[w,D,n]),ce=(0,Z.useCallback)(async e=>{try{await L(_e(e))}catch{}},[L]),z=(0,Z.useCallback)(async e=>{try{await L(Ee(n.environmentId,e))}catch{}},[L,n.environmentId]),B=(0,Z.useCallback)(()=>{X&&D&&X.refresh(D)},[D]),le=(0,Z.useCallback)(()=>{X&&D&&X.zoomIn(D)},[D]),ue=(0,Z.useCallback)(()=>{X&&D&&X.zoomOut(D)},[D]),q=(0,Z.useCallback)(()=>{X&&D&&X.resetZoom(D)},[D]),de=(0,Z.useCallback)(async e=>{if(!E)return;let t=await T({environmentId:n.environmentId,input:{threadId:n.threadId,tabId:E,viewport:e}});if(t._tag===`Failure`){let e=l(t);throw R.add({type:`error`,title:`Unable to resize browser viewport`,description:e instanceof Error?e.message:`An error occurred.`}),e}me(n,t.value)},[T,E,n]),Y=()=>{if(!D)return;if(oe._tag!==`fill`){De(D,i).catch(()=>void 0);return}let e=se?Te(se,A?.zoomFactor):{width:1024,height:768};De(D,{_tag:`freeform`,...e}).catch(()=>void 0)};(0,Z.useEffect)(()=>{if(D)return ye(D,de)},[de,D]);let ge=(0,Z.useCallback)(()=>{X&&D&&X.goBack(D)},[D]),ve=(0,Z.useCallback)(()=>{X&&D&&X.goForward(D)},[D]),be=(0,Z.useCallback)(()=>{!Rt||!M||Rt.shell.openExternal(M).catch(()=>void 0)},[M]),Se=(0,Z.useCallback)(()=>{if(E){if(b?.tabId===E){je.getState().close(n);return}je.getState().open(n,E),m.getState().close(n)}},[b?.tabId,E,n]),Oe=(0,Z.useCallback)(()=>{!X||!D||(A?.pictureInPicture?X.pictureInPicture.close:X.pictureInPicture.open)(D).catch(e=>{R.add({type:`error`,title:`Unable to update popped-out preview`,description:e instanceof Error?e.message:`An error occurred.`})})},[A?.pictureInPicture,D]),ke=(0,Z.useCallback)(e=>{if(!X||!D||!E)return;let t=X;if(O){W(O).then(e=>{if(!e)return;let n=!1,r,i=()=>{if(!navigator.clipboard?.writeText){R.update(r,H({type:`error`,title:`Unable to copy recording path`,description:`Clipboard API unavailable.`,actionProps:a}));return}navigator.clipboard.writeText(e.path).then(()=>{n=!0,o(),window.setTimeout(()=>{n=!1,o()},2e3)},e=>{R.update(r,H({type:`error`,title:`Unable to copy recording path`,description:e instanceof Error?e.message:`An error occurred.`,actionProps:a}))})},a={children:bt(navigator.platform),onClick:()=>void t.revealArtifact(e.path)},o=()=>{R.update(r,H({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:n?`Copied!`:`Copy path`,disabled:n,onClick:i},secondaryActionVariant:`outline`}}))};r=R.add(H({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:`Copy path`,onClick:i},secondaryActionVariant:`outline`}}))},e=>{R.add({type:`error`,title:`Unable to stop recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}if(e){pe(D,n,E).catch(e=>{R.add({type:`error`,title:`Unable to start recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}t.captureScreenshot(D).then(e=>{let n={children:bt(navigator.platform),onClick:()=>void t.revealArtifact(e.path)},r=!1,i=!1,a,o=(e=`success`,t=`Screenshot saved`,o)=>{R.update(a,H({type:e,title:t,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:{...n},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=()=>{t.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=R.add(H({type:`success`,title:`Screenshot saved`,actionProps:{children:`Copy image`,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:`Copy path`,onClick:s}}],secondaryActionProps:{...n},secondaryActionVariant:`outline`}}))},e=>{R.add({type:`error`,title:`Unable to capture screenshot`,description:e instanceof Error?e.message:`An error occurred.`})})},[O,D,E,n]),Me=(0,Z.useCallback)(()=>{if(!X||!D)return;if(_.current){X.cancelPickElement(D).catch(()=>void 0);return}let e=typeof document<`u`?document.activeElement:null;_.current=!0,h(!0),(async()=>{try{let e=await X.pickElement(D);if(!e)return;ee(n,e);let t=await Ae(e);t&&e.screenshot&&x(n,{type:`image`,id:e.id,name:t.name,mimeType:t.type,sizeBytes:t.size,previewUrl:e.screenshot.dataUrl,file:t})}catch{}finally{if(_.current=!1,v.current&&h(!1),e&&e.isConnected&&typeof e.focus==`function`)try{e.focus({preventScroll:!0})}catch{}}})()},[x,ee,D,n]);return(0,Z.useEffect)(()=>()=>{_.current&&(_.current=!1,X&&D&&X.cancelPickElement(D).catch(()=>void 0),v.current&&h(!1))},[D]),(0,Z.useEffect)(()=>{if(o)return he(e=>{switch(e){case`refresh`:B();return;case`focus-url`:u(e=>(e??0)+1);return;case`zoom-in`:le();return;case`zoom-out`:ue();return;case`reset-zoom`:q();return;case`toggle-panel`:return}})},[B,q,le,ue,o]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"data-thread-key":d(n),children:[(0,$.jsx)(qe,{url:M,displayUrl:ae,loading:te,loadProgress:I,canGoBack:N,canGoForward:ne,refreshDisabled:re,focusUrlNonce:s,onBack:ge,onForward:ve,onRefresh:B,onSubmit:e=>void ce(e),onOpenInBrowser:E?be:void 0,onCapture:X&&E?ke:void 0,captureDisabled:!A||P,recording:O!==null,onPictureInPicture:X&&E?Se:void 0,pictureInPicture:b?.tabId===E,pictureInPictureDisabled:!A?.hasWebContents||P,onPickElement:X&&E?Me:void 0,pickActive:p,pickDisabled:!E||P,pickDisabledReason:P?`Page didn't load — pick unavailable until the page renders`:void 0,trailingActions:X?(0,$.jsx)(ot,{tabId:D,hasWebContents:A?.hasWebContents??!1,zoomFactor:A?.zoomFactor??1,colorScheme:A?.colorScheme??`system`,deviceToolbarVisible:oe._tag!==`fill`,onToggleDeviceToolbar:Y,nativePictureInPicture:A?.pictureInPicture??!1,onNativePictureInPicture:Oe}):null}),(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[D&&k&&!ie?(0,$.jsx)(K,{tabId:D,visible:o&&!P,className:`absolute inset-0 h-full w-full`},D):null,ie?(0,$.jsx)(it,{environmentId:n.environmentId,configuredUrls:a,recentlySeenUrls:y.recentlySeenUrls,onOpenUrl:e=>void z(e)}):null,k&&A?(0,$.jsx)(Nt,{zoomFactor:A.zoomFactor}):null,D&&A&&!ie&&!P?(0,$.jsx)(It,{tabId:D,zoomFactor:A.zoomFactor,controller:F}):null,F===`none`?null:(0,$.jsx)(`div`,{className:`pointer-events-none absolute left-3 top-3 z-40 rounded-full border border-border/70 bg-background/90 px-2.5 py-1 text-[11px] font-medium shadow-sm backdrop-blur`,children:F===`agent`?`Agent controlling browser`:`Human control`}),j._tag===`LoadFailed`?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(gt,{url:j.url,code:j.code,description:j.description,onReload:B})}):null]})]})}function Bt(e){let t=(0,Q.c)(13),{mode:n,threadRef:r,tabId:i,configuredUrls:a,visible:o}=e;if(!Y()){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 laplus desktop app.`})}),t[0]=e):e=t[0];let r;return t[1]===n?r=t[2]:(r=(0,$.jsx)(ve,{mode:n,children:e}),t[1]=n,t[2]=r),r}let s;t[3]===i?s=t[4]:(s=i===void 0?{}:{tabId:i},t[3]=i,t[4]=s);let c;t[5]!==a||t[6]!==s||t[7]!==r||t[8]!==o?(c=(0,$.jsx)(zt,{threadRef:r,...s,configuredUrls:a,visible:o}),t[5]=a,t[6]=s,t[7]=r,t[8]=o,t[9]=c):c=t[9];let l;return t[10]!==n||t[11]!==c?(l=(0,$.jsx)(ve,{mode:n,children:c}),t[10]=n,t[11]=c,t[12]=l):l=t[12],l}export{Bt as PreviewPanel};
|
|
2
|
-
//# sourceMappingURL=PreviewPanel-
|
|
1
|
+
import{D as e,E as t,Ft as n,Gd as r,Ks as i,Ld as a,Lo as o,N as s,O as c,Qo as l,S as u,Ss as d,Xt as f,ar as p,b as m,cf as h,cs as g,df as _,dr as v,ds as y,er as b,fr as ee,gl as x,hs as S,ir as C,jo as w,lr as T,ls as E,ml as D,no as O,or as k,os as A,rr as j,sr as M,ur as te,vs as N,w as ne,x as re,yo as P}from"./textarea-Zwf6kD06.js";import{t as ie}from"./arrow-right-2FD-xj4K.js";import{$n as F,An as I,Ar as ae,Dn as oe,Dr as se,Er as L,Fr as ce,Jn as R,Kn as z,On as B,Qn as V,Sr as le,Tr as ue,Yn as H,_n as U,a as W,ar as G,bn as K,c as q,cr as de,dr as J,er as Y,gn as X,hn as fe,i as pe,ir as me,jn as he,kn as ge,lr as _e,mn as ve,n as ye,nr as be,o as xe,or as Se,r as Ce,rr as we,s as Te,sr as Ee,t as De,tr as Oe,ur as ke,v as Ae,vn as je,wr as Me,xn as Ne,xr as Pe,yn as Fe}from"./index-c0OLJn1C.js";var Ie=P(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Le=P(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Re=P(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ze=P(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Be=P(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),Z=_(h(),1),Q=a(),$=r();function Ve(e){let t=(0,Q.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=n(`relative inline-flex w-full min-w-0 items-center rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-ring has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/36 has-autofill:bg-foreground/4 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid],textarea[aria-invalid]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_-1px_--theme(--color-white/6%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-1px)]`,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,$.jsx)(`div`,{className:a,"data-slot":`input-group`,role:`group`,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}var He=w(`[&_svg]:-mx-0.5 flex h-auto cursor-text select-none items-center justify-center gap-2 leading-none [&>kbd]:rounded-[calc(var(--radius)-5px)] in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80`,{defaultVariants:{align:`inline-start`},variants:{align:{"block-end":`order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]`,"block-start":`order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]`,"inline-end":`has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]`,"inline-start":`has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]`}}});function Ue(e){let t=(0,Q.c)(11),r,i,a;t[0]===e?(r=t[1],i=t[2],a=t[3]):({className:r,align:a,...i}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a);let o=a===void 0?`inline-start`:a,s;t[4]!==o||t[5]!==r?(s=n(He({align:o}),r),t[4]=o,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==i||t[9]!==s?(c=(0,$.jsx)(`div`,{className:s,"data-align":o,"data-slot":`input-group-addon`,onMouseDown:We,...i}),t[7]=o,t[8]=i,t[9]=s,t[10]=c):c=t[10],c}function We(e){if(e.target.closest(`button, a, input, select, textarea, [role='button'], [role='combobox'], [role='listbox'], [data-slot='select-trigger']`))return;e.preventDefault();let t=e.currentTarget.parentElement,n=t?.querySelector(`input, textarea`);n&&!t?.querySelector(`input:focus, textarea:focus`)&&n.focus()}function Ge(e){let t=(0,Q.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,$.jsx)(z,{className:n,unstyled:!0,...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var Ke=()=>{};function qe(e){let t=(0,Q.c)(98),{url:r,displayUrl:i,loading:a,loadProgress:o,canGoBack:s,canGoForward:c,refreshDisabled:l,inputDisabled:d,focusUrlNonce:f,onBack:p,onForward:m,onRefresh:h,onSubmit:g,onOpenInBrowser:_,onCapture:v,captureDisabled:y,recording:b,onPictureInPicture:ee,pictureInPicture:x,pictureInPictureDisabled:S,onPickElement:C,pickActive:w,pickDisabled:T,pickDisabledReason:E,trailingActions:D}=e,k=(0,Z.useRef)(null),[A,j]=(0,Z.useState)(r),[M,te]=(0,Z.useState)(!1),N,P;t[0]===f?(N=t[1],P=t[2]):(N=()=>{if(f==null)return;let e=k.current;e&&e.focus()},P=[f],t[0]=f,t[1]=N,t[2]=P),(0,Z.useEffect)(N,P);let F;t[3]!==A||t[4]!==g?(F=e=>{e?.preventDefault();let t=A.trim();t.length!==0&&(g(t),k.current?.blur())},t[3]=A,t[4]=g,t[5]=F):F=t[5];let I=F,ae=s?p:Ke,oe=!s,se;t[6]!==ae||t[7]!==oe?(se=(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,onClick:ae,disabled:oe,"aria-label":`Back`,type:`button`}),t[6]=ae,t[7]=oe,t[8]=se):se=t[8];let R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(ce,{}),t[9]=R):R=t[9];let z;t[10]===se?z=t[11]:(z=(0,$.jsx)(ne,{render:se,children:R}),t[10]=se,t[11]=z);let B;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(u,{children:`Back`}),t[12]=B):B=t[12];let V;t[13]===z?V=t[14]:(V=(0,$.jsxs)(re,{children:[z,B]}),t[13]=z,t[14]=V);let le=c?m:Ke,H=!c,U;t[15]!==le||t[16]!==H?(U=(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,onClick:le,disabled:H,"aria-label":`Forward`,type:`button`}),t[15]=le,t[16]=H,t[17]=U):U=t[17];let W;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(ie,{}),t[18]=W):W=t[18];let G;t[19]===U?G=t[20]:(G=(0,$.jsx)(ne,{render:U,children:W}),t[19]=U,t[20]=G);let K;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(u,{children:`Forward`}),t[21]=K):K=t[21];let q;t[22]===G?q=t[23]:(q=(0,$.jsxs)(re,{children:[G,K]}),t[22]=G,t[23]=q);let de=l?Ke:h,J=a?`Stop`:`Refresh`,Y;t[24]!==l||t[25]!==de||t[26]!==J?(Y=(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,onClick:de,disabled:l,"aria-label":J,type:`button`}),t[24]=l,t[25]=de,t[26]=J,t[27]=Y):Y=t[27];let X=a&&`animate-spin`,fe;t[28]===X?fe=t[29]:(fe=n(X),t[28]=X,t[29]=fe);let pe;t[30]===fe?pe=t[31]:(pe=(0,$.jsx)(Pe,{className:fe}),t[30]=fe,t[31]=pe);let me;t[32]!==Y||t[33]!==pe?(me=(0,$.jsx)(ne,{render:Y,children:pe}),t[32]=Y,t[33]=pe,t[34]=me):me=t[34];let he=a?`Loading…`:`Refresh`,ge;t[35]===he?ge=t[36]:(ge=(0,$.jsx)(u,{children:he}),t[35]=he,t[36]=ge);let _e;t[37]!==me||t[38]!==ge?(_e=(0,$.jsxs)(re,{children:[me,ge]}),t[37]=me,t[38]=ge,t[39]=_e):_e=t[39];let ve;t[40]!==V||t[41]!==q||t[42]!==_e?(ve=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`Navigation`,children:[V,q,_e]}),t[40]=V,t[41]=q,t[42]=_e,t[43]=ve):ve=t[43];let ye=M?A:i??r,be=_&&!M&&`group-hover/address:pe-7 transition-[padding]`,xe;t[44]===be?xe=t[45]:(xe=n(be),t[44]=be,t[45]=xe);let Se;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Se=e=>j(e.target.value),t[46]=Se):Se=t[46];let Ce;t[47]===r?Ce=t[48]:(Ce=()=>{j(r),te(!0),queueMicrotask(()=>k.current?.select())},t[47]=r,t[48]=Ce);let we;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>{te(!1)},t[49]=we):we=t[49];let Te;t[50]!==I||t[51]!==r?(Te=e=>{e.key===`Enter`&&I(e),e.key===`Escape`&&(e.preventDefault(),j(r),k.current?.blur())},t[50]=I,t[51]=r,t[52]=Te):Te=t[52];let Ee;t[53]!==d||t[54]!==ye||t[55]!==xe||t[56]!==Ce||t[57]!==Te?(Ee=(0,$.jsx)(ne,{render:(0,$.jsx)(Ge,{ref:k,value:ye,className:xe,onChange:Se,onFocus:Ce,onBlur:we,onKeyDown:Te,placeholder:`Search or enter URL`,spellCheck:!1,disabled:d,"data-preview-url-input":!0,size:`sm`})}),t[53]=d,t[54]=ye,t[55]=xe,t[56]=Ce,t[57]=Te,t[58]=Ee):Ee=t[58];let De;t[59]!==i||t[60]!==M||t[61]!==r?(De=!M&&i?(0,$.jsx)(u,{children:r}):null,t[59]=i,t[60]=M,t[61]=r,t[62]=De):De=t[62];let Oe;t[63]!==Ee||t[64]!==De?(Oe=(0,$.jsxs)(re,{children:[Ee,De]}),t[63]=Ee,t[64]=De,t[65]=Oe):Oe=t[65];let ke;t[66]!==M||t[67]!==_?(ke=_&&!M?(0,$.jsx)(Ue,{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)(re,{children:[(0,$.jsx)(ne,{render:(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,onClick:_,"aria-label":`Open in system browser`,type:`button`}),children:(0,$.jsx)(Re,{})}),(0,$.jsx)(u,{children:`Open in system browser`})]})}):null,t[66]=M,t[67]=_,t[68]=ke):ke=t[68];let Ae;t[69]!==Oe||t[70]!==ke?(Ae=(0,$.jsxs)(Ve,{className:`group/address h-7 flex-1 rounded-md border-transparent bg-transparent shadow-none before:shadow-none hover:bg-muted/40 focus-within:bg-background`,children:[Oe,ke]}),t[69]=Oe,t[70]=ke,t[71]=Ae):Ae=t[71];let je;t[72]!==C||t[73]!==w||t[74]!==T||t[75]!==E?(je=C?(0,$.jsxs)(re,{children:[(0,$.jsx)(ne,{render:(0,$.jsx)(O,{variant:w?`secondary`:`ghost`,size:`icon-xs`,onClick:C,disabled:T,"aria-label":w?`Cancel annotation`:`Annotate preview`,"aria-pressed":w?`true`:`false`,type:`button`}),children:(0,$.jsx)(L,{className:n(w&&`text-primary`)})}),(0,$.jsx)(u,{children:T&&E?E:w?`Cancel annotation (Esc)`:`Annotate elements, regions, and drawings`})]}):null,t[72]=C,t[73]=w,t[74]=T,t[75]=E,t[76]=je):je=t[76];let Me;t[77]!==y||t[78]!==v||t[79]!==b?(Me=v?(0,$.jsxs)(re,{children:[(0,$.jsxs)(ne,{render:(0,$.jsx)(O,{variant:b?`secondary`:`ghost`,size:`icon-xs`,onClick:e=>v(e.shiftKey),"aria-label":b?`Stop recording`:`Capture screenshot`,type:`button`,className:`relative`,disabled:y}),children:[(0,$.jsx)(Ie,{className:n(b&&`text-destructive`)}),b?(0,$.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-1.5 animate-status-pulse rounded-full bg-destructive`}):null]}),(0,$.jsx)(u,{children:b?`Stop recording`:`Screenshot · Shift-click to record`})]}):null,t[77]=y,t[78]=v,t[79]=b,t[80]=Me):Me=t[80];let Ne;t[81]!==ee||t[82]!==x||t[83]!==S?(Ne=ee?(0,$.jsxs)(re,{children:[(0,$.jsx)(ne,{render:(0,$.jsx)(O,{variant:x?`secondary`:`ghost`,size:`icon-xs`,onClick:ee,"aria-label":x?`Close floating preview`:`Float preview over chat`,"aria-pressed":x?`true`:`false`,type:`button`,disabled:S}),children:(0,$.jsx)(ue,{className:n(x&&`text-primary`)})}),(0,$.jsx)(u,{children:x?`Close floating preview`:`Float preview over chat`})]}):null,t[81]=ee,t[82]=x,t[83]=S,t[84]=Ne):Ne=t[84];let Fe;t[85]!==I||t[86]!==ve||t[87]!==Ae||t[88]!==je||t[89]!==Me||t[90]!==Ne||t[91]!==D?(Fe=(0,$.jsxs)(`form`,{onSubmit:I,className:`surface-subheader gap-1 px-2`,"data-surface-subheader":!0,children:[ve,Ae,je,Me,Ne,D]}),t[85]=I,t[86]=ve,t[87]=Ae,t[88]=je,t[89]=Me,t[90]=Ne,t[91]=D,t[92]=Fe):Fe=t[92];let Le;t[93]===o?Le=t[94]:(Le=o>0?(0,$.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 rounded-r-full bg-primary transition-all duration-150 ease-out`,style:{width:`${o}%`,boxShadow:`0 0 6px 1px var(--color-ring)`}}):null,t[93]=o,t[94]=Le);let ze;return t[95]!==Fe||t[96]!==Le?(ze=(0,$.jsxs)(`div`,{className:`relative`,children:[Fe,Le]}),t[95]=Fe,t[96]=Le,t[97]=ze):ze=t[97],ze}function Je(e){try{let t=new URL(e.url),n=new URL(e.environmentHttpBaseUrl);if(t.origin===n.origin&&t.pathname.startsWith(`/api/assets/`)){let n=t.pathname.split(`/`).at(-1);if(!n)return null;let r=decodeURIComponent(n);return!r||r===`.`||r===`..`?null:`${e.environmentLabel} · ${r}`}return t.protocol===`http:`||t.protocol===`https:`?t.host:null}catch{return null}}function Ye(e){let t=(0,Q.c)(6),{className:r}=e,i;t[0]===r?i=t[1]:(i=n(`relative flex flex-col gap-0.5 overflow-hidden rounded-[5px] border border-border/60 bg-card p-1 shadow-xs/5`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-destructive/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-warning/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-success/80`})]}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(`div`,{className:`mt-[1px] flex flex-1 flex-col gap-[2px]`,children:[(0,$.jsx)(`span`,{className:`h-[2px] w-full rounded-full bg-muted-foreground/30`}),(0,$.jsx)(`span`,{className:`h-[2px] w-3/5 rounded-full bg-muted-foreground/20`})]}),t[3]=o):o=t[3];let s;return t[4]===i?s=t[5]:(s=(0,$.jsxs)(`div`,{"aria-hidden":!0,className:i,children:[a,o]}),t[4]=i,t[5]=s),s}function Xe(e){let t=(0,Q.c)(17),{server:n,onOpen:r}=e,i;t[0]===n?i=t[1]:(i=Ze(n),t[0]=n,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Ye,{className:`size-7 shrink-0`}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:a}),t[3]=a,t[4]=s);let c;t[5]!==n.host||t[6]!==n.port?(c=(0,$.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[n.host,`:`,n.port]}),t[5]=n.host,t[6]=n.port,t[7]=c):c=t[7];let l;t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10];let u;t[11]===n.listening?u=t[12]:(u=n.listening?(0,$.jsx)(Qe,{}):(0,$.jsx)($e,{}),t[11]=n.listening,t[12]=u);let d;return t[13]!==r||t[14]!==l||t[15]!==u?(d=(0,$.jsxs)(`button`,{type:`button`,onClick:r,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:[o,l,u]}),t[13]=r,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function Ze(e){return e.processName?e.processName:e.listening?`Listening`:e.source===`configured`?`Configured`:`Recently seen`}function Qe(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`span`,{"aria-label":`Listening`,className:`relative inline-flex size-2 shrink-0`,children:[(0,$.jsx)(`span`,{className:`absolute inset-0 animate-status-ping rounded-full bg-success opacity-60`}),(0,$.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-success`})]}),e[0]=t):t=e[0],t}function $e(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`span`,{"aria-label":`Not currently listening`,className:`size-2 shrink-0 rounded-full bg-muted-foreground/40`}),e[0]=t):t=e[0],t}function et(e){let t=(0,Q.c)(7),n=ke(e.environmentId),r;if(t[0]!==e.configuredUrls||t[1]!==e.environmentId||t[2]!==e.recentlySeenUrls||t[3]!==n){let i;t[5]===e.environmentId?i=t[6]:(i=t=>({...t,url:Ee(e.environmentId,t.url)}),t[5]=e.environmentId,t[6]=i),r=tt({scanner:n.map(i),configuredUrls:e.configuredUrls??[],recentlySeenUrls:e.recentlySeenUrls??[]}),t[0]=e.configuredUrls,t[1]=e.environmentId,t[2]=e.recentlySeenUrls,t[3]=n,t[4]=r}else r=t[4];return r}function tt(e){let t=new Map;for(let n of e.configuredUrls){let e=rt(n);if(!e)continue;let r=nt(e.host,e.port);t.has(r)||t.set(r,{host:e.host,port:e.port,url:e.url,processName:null,pid:null,terminal:null,source:`configured`,listening:!1})}for(let n of e.scanner){let e=nt(n.host,n.port),r=t.get(e);if(r){t.set(e,{...r,processName:n.processName??r.processName,pid:n.pid??r.pid,terminal:n.terminal??r.terminal,listening:!0});continue}t.set(e,{...n,source:`scanner`,listening:!0})}for(let n of e.recentlySeenUrls){let e=rt(n);if(!e)continue;let r=nt(e.host,e.port);t.has(r)||t.set(r,{host:e.host,port:e.port,url:e.url,processName:null,pid:null,terminal:null,source:`recent`,listening:!1})}return Array.from(t.values()).toSorted((e,t)=>{let n={configured:0,scanner:1,recent:2};return n[e.source]===n[t.source]?e.port-t.port:n[e.source]-n[t.source]})}function nt(e,t){return`${e.toLowerCase()}:${t}`}function rt(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`||!de(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 it(e){let t=(0,Q.c)(16),{environmentId:n,configuredUrls:r,recentlySeenUrls:i,onOpenUrl:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o={environmentId:n,configuredUrls:r,recentlySeenUrls:i},t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s=et(o);if(s.length===0){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(oe,{children:[(0,$.jsx)(ge,{variant:`icon`,children:(0,$.jsx)(ae,{className:`size-4.5 text-muted-foreground`})}),(0,$.jsx)(I,{children:`No preview yet`}),(0,$.jsx)(B,{children:`Type a URL above, or run a dev script. Listening localhost ports will show up here automatically.`})]}),t[4]=e):e=t[4],e}let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(Be,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Local servers`})]}),t[5]=c):c=t[5];let l;if(t[6]!==a||t[7]!==s){let e;t[9]===a?e=t[10]:(e=e=>(0,$.jsx)(Xe,{server:e,onOpen:()=>a(e.url)},`${e.host}:${e.port}`),t[9]=a,t[10]=e),l=s.map(e),t[6]=a,t[7]=s,t[8]=l}else l=t[8];let u;t[11]===l?u=t[12]:(u=(0,$.jsx)(`div`,{className:`flex flex-col divide-y divide-border/60 overflow-hidden rounded-xl border border-border/70 bg-background`,children:l}),t[11]=l,t[12]=u);let d;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:`Select a listening port to open it in this browser tab.`}),t[13]=d):d=t[13];let f;return t[14]===u?f=t[15]:(f=(0,$.jsx)(`div`,{className:`flex h-full min-h-0 overflow-y-auto px-5 py-8`,children:(0,$.jsxs)(`div`,{className:`m-auto flex w-full max-w-xl flex-col gap-3`,children:[c,u,d]})}),t[14]=u,t[15]=f),f}var at=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}];function ot(e){let t=(0,Q.c)(74),{tabId:n,hasWebContents:r,zoomFactor:i,colorScheme:a,deviceToolbarVisible:o,onToggleDeviceToolbar:s,nativePictureInPicture:c,onNativePictureInPicture:l}=e;if(!X)return null;let d=!n||!r,f;t[0]===n?f=t[1]:(f=e=>()=>{n&&e(n).catch(mt)},t[0]=n,t[1]=f);let m=f,h;t[2]===i?h=t[3]:(h=Math.round(i*100),t[2]=i,t[3]=h);let g=`${h}%`,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsxs)(re,{children:[(0,$.jsx)(ne,{render:(0,$.jsx)(ee,{render:(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":`Preview menu`})}),children:(0,$.jsx)(Le,{})}),(0,$.jsx)(u,{children:`More`})]}),t[4]=_):_=t[4];let y;t[5]===m?y=t[6]:(y=m(X.hardReload),t[5]=m,t[6]=y);let x;t[7]!==y||t[8]!==d?(x=(0,$.jsx)(j,{onClick:y,disabled:d,children:`Hard reload`}),t[7]=y,t[8]=d,t[9]=x):x=t[9];let S;t[10]===m?S=t[11]:(S=m(X.openDevTools),t[10]=m,t[11]=S);let w;t[12]!==S||t[13]!==d?(w=(0,$.jsx)(j,{onClick:S,disabled:d,children:`Open DevTools`}),t[12]=S,t[13]=d,t[14]=w):w=t[14];let E=c?`Close separate preview window`:`Open separate preview window`,D;t[15]!==l||t[16]!==E||t[17]!==d?(D=(0,$.jsx)(j,{onClick:l,disabled:d,children:E}),t[15]=l,t[16]=E,t[17]=d,t[18]=D):D=t[18];let k=o?`Hide device toolbar`:`Show device toolbar`,A;t[19]!==s||t[20]!==k||t[21]!==d?(A=(0,$.jsx)(j,{onClick:s,disabled:d,children:k}),t[19]=s,t[20]=k,t[21]=d,t[22]=A):A=t[22];let N;t[23]===d?N=t[24]:(N=(0,$.jsx)(v,{disabled:d,children:`Appearance`}),t[23]=d,t[24]=N);let P;t[25]===n?P=t[26]:(P=e=>{n&&X.setColorScheme(n,e).catch(pt)},t[25]=n,t[26]=P);let ie;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ie=at.map(ft),t[27]=ie):ie=t[27];let F;t[28]!==a||t[29]!==P?(F=(0,$.jsx)(te,{className:`min-w-32`,children:(0,$.jsx)(p,{value:a,onValueChange:P,children:ie})}),t[28]=a,t[29]=P,t[30]=F):F=t[30];let I;t[31]!==N||t[32]!==F?(I=(0,$.jsxs)(T,{children:[N,F]}),t[31]=N,t[32]=F,t[33]=I):I=t[33];let ae;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(M,{}),t[34]=ae):ae=t[34];let oe;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(`span`,{children:`Zoom`}),t[35]=oe):oe=t[35];let L;t[36]===m?L=t[37]:(L=m(X.zoomOut),t[36]=m,t[37]=L);let ce;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(se,{}),t[38]=ce):ce=t[38];let R;t[39]!==L||t[40]!==d?(R=(0,$.jsx)(O,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:L,"aria-label":`Zoom out`,disabled:d,children:ce}),t[39]=L,t[40]=d,t[41]=R):R=t[41];let z;t[42]===g?z=t[43]:(z=(0,$.jsx)(`span`,{className:`min-w-12 text-center text-xs tabular-nums text-muted-foreground`,children:g}),t[42]=g,t[43]=z);let B;t[44]===m?B=t[45]:(B=m(X.zoomIn),t[44]=m,t[45]=B);let V;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(Me,{}),t[46]=V):V=t[46];let ue;t[47]!==B||t[48]!==d?(ue=(0,$.jsx)(O,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:B,"aria-label":`Zoom in`,disabled:d,children:V}),t[47]=B,t[48]=d,t[49]=ue):ue=t[49];let H;t[50]===m?H=t[51]:(H=m(X.resetZoom),t[50]=m,t[51]=H);let U;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(le,{}),t[52]=U):U=t[52];let W;t[53]!==H||t[54]!==d?(W=(0,$.jsx)(O,{variant:`ghost`,size:`icon-xs`,type:`button`,onClick:H,"aria-label":`Reset zoom`,disabled:d,children:U}),t[53]=H,t[54]=d,t[55]=W):W=t[55];let G;t[56]!==R||t[57]!==z||t[58]!==ue||t[59]!==W?(G=(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[R,z,ue,W]}),t[56]=R,t[57]=z,t[58]=ue,t[59]=W,t[60]=G):G=t[60];let K;t[61]!==G||t[62]!==d?(K=(0,$.jsxs)(j,{closeOnClick:!1,onClick:dt,className:`justify-between`,disabled:d,children:[oe,G]}),t[61]=G,t[62]=d,t[63]=K):K=t[63];let q,de,J;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(M,{}),de=(0,$.jsx)(j,{onClick:lt,children:`Clear cookies`}),J=(0,$.jsx)(j,{onClick:st,children:`Clear cache`}),t[64]=q,t[65]=de,t[66]=J):(q=t[64],de=t[65],J=t[66]);let Y;return t[67]!==A||t[68]!==I||t[69]!==K||t[70]!==x||t[71]!==w||t[72]!==D?(Y=(0,$.jsxs)(b,{children:[_,(0,$.jsxs)(C,{align:`end`,sideOffset:6,className:`min-w-56`,children:[x,w,D,A,I,ae,K,q,de,J]})]}),t[67]=A,t[68]=I,t[69]=K,t[70]=x,t[71]=w,t[72]=D,t[73]=Y):Y=t[73],Y}function st(){X.clearCache().catch(ct)}function ct(){}function lt(){X.clearCookies().catch(ut)}function ut(){}function dt(e){return e.preventDefault()}function ft(e){return(0,$.jsx)(k,{value:e.value,children:e.label},e.value)}function pt(){}function mt(){}function ht(e){return Se[e]||(e.length>0?e:`Network error`)}function gt(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=ht(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)(vt,{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 g;t[9]===l?g=t[10]:(g=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:l}),t[9]=l,t[10]=g);let _;t[11]!==d||t[12]!==g?(_=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[g,`: `,d,`.`]}),t[11]=d,t[12]=g,t[13]=_):_=t[13];let v;t[14]===o?v=t[15]:(v=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]=v);let y;t[16]===p?y=t[17]:(y=(0,$.jsx)(`div`,{className:`mt-8 text-xs uppercase tracking-wide text-muted-foreground/70`,children:p}),t[16]=p,t[17]=y);let b;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>s(_t),t[18]=b):b=t[18];let ee=o?`Hide details`:`Details`,x;t[19]===ee?x=t[20]:(x=(0,$.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:b,children:ee}),t[19]=ee,t[20]=x);let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`div`,{className:`flex-1`}),t[21]=S):S=t[21];let C;t[22]===a?C=t[23]:(C=(0,$.jsx)(O,{type:`button`,size:`sm`,onClick:a,children:`Reload`}),t[22]=a,t[23]=C);let w;t[24]!==x||t[25]!==C?(w=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[x,S,C]}),t[24]=x,t[25]=C,t[26]=w):w=t[26];let T;return t[27]!==w||t[28]!==_||t[29]!==v||t[30]!==y?(T=(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,w]})}),t[27]=w,t[28]=_,t[29]=v,t[30]=y,t[31]=T):T=t[31],T}function _t(e){return!e}function vt(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}}function bt(e){let t=e.toLowerCase();return t.includes(`mac`)?`Reveal in Finder`:t.includes(`win`)?`Reveal in File Explorer`:`Reveal in Files`}var xt=120,St=220,Ct=4,wt=90,Tt=.08,Et=.5;function Dt(e){let[t,n]=(0,Z.useState)(0),r=(0,Z.useRef)(0);return r.current=t,(0,Z.useEffect)(()=>{if(!e){if(r.current===0)return;n(100);let e=window.setTimeout(()=>n(0),St);return()=>window.clearTimeout(e)}n(e=>e>0&&e<95?e:Ct);let t=window.setInterval(()=>{let e=r.current;if(e>=wt)return;let t=wt-e,i=Math.max(Et,t*Tt);n(Math.min(wt,e+i))},xt);return()=>window.clearInterval(t)},[e]),t}var Ot=class extends x()(`PreviewSessionThreadKeyParseError`,{threadKey:D}){get message(){return`Invalid scoped preview thread key: ${this.threadKey}`}},kt=A(e=>{let t=N(e);if(t===null)throw new Ot({threadKey:e});let n=J.list({environmentId:t.environmentId,input:{threadId:t.threadId}}),r=J.events({environmentId:t.environmentId,input:{}});return g(e=>{let i=!1,a=0,o=e=>{S(e)&&be(t,e.value)},s=r=>{if(!S(r)||r.value.threadId!==t.threadId)return;let i=Oe(t).serverEpoch;if(i!==null&&i!==r.value.serverEpoch){e.refresh(n);return}F(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(E(1e3),y(`preview:session-sync:${e}`))});function At(e){let t=(0,Q.c)(2),n;t[0]===e?n=t[1]:(n=kt(d(e)),t[0]=e,t[1]=n),o(n)}var jt=1500,Mt=.001;function Nt(e){let t=(0,Q.c)(11),{zoomFactor:r}=e,[i,a]=(0,Z.useState)(!1),o=(0,Z.useRef)(r),s=(0,Z.useRef)(null),c,l;t[0]===r?(c=t[1],l=t[2]):(c=()=>{if(!(Math.abs(o.current-r)<Mt))return o.current=r,a(!0),s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{a(!1),s.current=null},jt),()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null)}},l=[r],t[0]=r,t[1]=c,t[2]=l),(0,Z.useEffect)(c,l);let u;t[3]===r?u=t[4]:(u=Math.round(r*100),t[3]=r,t[4]=u);let d=`${u}%`,f=!i,p=i?`opacity-100 translate-y-0`:`opacity-0 -translate-y-1`,m;t[5]===p?m=t[6]:(m=n(`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`,p),t[5]=p,t[6]=m);let h;return t[7]!==d||t[8]!==f||t[9]!==m?(h=(0,$.jsx)(`div`,{"aria-hidden":f,className:m,children:d}),t[7]=d,t[8]=f,t[9]=m,t[10]=h):h=t[10],h}function Pt(e,t){return e?1:t===`human`?.18:.35}var Ft=700;function It(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=q(a),s;t[2]===n?s=t[3]:(s=e=>e.byTabId[n]?.content??null,t[2]=n,t[3]=s);let c=Ne(s);if(!o)return null;let l;return t[4]!==c||t[5]!==i||t[6]!==o||t[7]!==r?(l=(0,$.jsx)(Lt,{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 Lt(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),Ft);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=Pt(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)(ze,{className:`relative size-5 -translate-x-0.5 -translate-y-0.5 fill-background text-primary drop-shadow-sm`,strokeWidth:2}),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 Rt=typeof window>`u`?null:s();function zt({threadRef:n,tabId:r,configuredUrls:a,visible:o}){let[s,u]=(0,Z.useState)(void 0),[p,h]=(0,Z.useState)(!1),g=xe(),_=(0,Z.useRef)(!1),v=(0,Z.useRef)(!0),y=G(n),b=je(e=>U(e.byThreadKey,n)),ee=f(e=>e.addPreviewAnnotation),x=f(e=>e.addImage),S=e(n.environmentId),C=c(n.environmentId),w=t(J.open),T=t(J.resize,`preview viewport resize`);At(n),(0,Z.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);let E=r??y.activeTabId,D=E?Fe(n,y.serverEpoch,E):null,O=E&&D?g.has(D)?D:Ce(n,E):null,k=E?y.sessions[E]??null:null,A=E?y.desktopByTabId[E]??null:null,j=k?.navStatus??{_tag:`Idle`},M=j._tag===`Idle`?``:j.url,te=A?.loading??j._tag===`Loading`,N=A?.canGoBack??k?.canGoBack??!1,ne=A?.canGoForward??k?.canGoForward??!1,re=j._tag===`Idle`,P=j._tag===`LoadFailed`,ie=fe(k),F=A?.controller??`none`,I=Dt(te),ae=M&&S&&C?Je({url:M,environmentLabel:S.label,environmentHttpBaseUrl:C})??void 0:void 0,oe=k?.viewport??i,se=Ne(e=>D?e.byTabId[D]?.rect??null:null),L=(0,Z.useCallback)(async e=>{D&&X?(await X.navigate(D,e),we(n,e)):await V({openPreview:w,threadRef:n,url:e})},[w,D,n]),ce=(0,Z.useCallback)(async e=>{try{await L(_e(e))}catch{}},[L]),z=(0,Z.useCallback)(async e=>{try{await L(Ee(n.environmentId,e))}catch{}},[L,n.environmentId]),B=(0,Z.useCallback)(()=>{X&&D&&X.refresh(D)},[D]),le=(0,Z.useCallback)(()=>{X&&D&&X.zoomIn(D)},[D]),ue=(0,Z.useCallback)(()=>{X&&D&&X.zoomOut(D)},[D]),q=(0,Z.useCallback)(()=>{X&&D&&X.resetZoom(D)},[D]),de=(0,Z.useCallback)(async e=>{if(!E)return;let t=await T({environmentId:n.environmentId,input:{threadId:n.threadId,tabId:E,viewport:e}});if(t._tag===`Failure`){let e=l(t);throw R.add({type:`error`,title:`Unable to resize browser viewport`,description:e instanceof Error?e.message:`An error occurred.`}),e}me(n,t.value)},[T,E,n]),Y=()=>{if(!D)return;if(oe._tag!==`fill`){De(D,i).catch(()=>void 0);return}let e=se?Te(se,A?.zoomFactor):{width:1024,height:768};De(D,{_tag:`freeform`,...e}).catch(()=>void 0)};(0,Z.useEffect)(()=>{if(D)return ye(D,de)},[de,D]);let ge=(0,Z.useCallback)(()=>{X&&D&&X.goBack(D)},[D]),ve=(0,Z.useCallback)(()=>{X&&D&&X.goForward(D)},[D]),be=(0,Z.useCallback)(()=>{!Rt||!M||Rt.shell.openExternal(M).catch(()=>void 0)},[M]),Se=(0,Z.useCallback)(()=>{if(E){if(b?.tabId===E){je.getState().close(n);return}je.getState().open(n,E),m.getState().close(n)}},[b?.tabId,E,n]),Oe=(0,Z.useCallback)(()=>{!X||!D||(A?.pictureInPicture?X.pictureInPicture.close:X.pictureInPicture.open)(D).catch(e=>{R.add({type:`error`,title:`Unable to update popped-out preview`,description:e instanceof Error?e.message:`An error occurred.`})})},[A?.pictureInPicture,D]),ke=(0,Z.useCallback)(e=>{if(!X||!D||!E)return;let t=X;if(O){W(O).then(e=>{if(!e)return;let n=!1,r,i=()=>{if(!navigator.clipboard?.writeText){R.update(r,H({type:`error`,title:`Unable to copy recording path`,description:`Clipboard API unavailable.`,actionProps:a}));return}navigator.clipboard.writeText(e.path).then(()=>{n=!0,o(),window.setTimeout(()=>{n=!1,o()},2e3)},e=>{R.update(r,H({type:`error`,title:`Unable to copy recording path`,description:e instanceof Error?e.message:`An error occurred.`,actionProps:a}))})},a={children:bt(navigator.platform),onClick:()=>void t.revealArtifact(e.path)},o=()=>{R.update(r,H({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:n?`Copied!`:`Copy path`,disabled:n,onClick:i},secondaryActionVariant:`outline`}}))};r=R.add(H({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:`Copy path`,onClick:i},secondaryActionVariant:`outline`}}))},e=>{R.add({type:`error`,title:`Unable to stop recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}if(e){pe(D,n,E).catch(e=>{R.add({type:`error`,title:`Unable to start recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}t.captureScreenshot(D).then(e=>{let n={children:bt(navigator.platform),onClick:()=>void t.revealArtifact(e.path)},r=!1,i=!1,a,o=(e=`success`,t=`Screenshot saved`,o)=>{R.update(a,H({type:e,title:t,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:{...n},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=()=>{t.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=R.add(H({type:`success`,title:`Screenshot saved`,actionProps:{children:`Copy image`,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:`Copy path`,onClick:s}}],secondaryActionProps:{...n},secondaryActionVariant:`outline`}}))},e=>{R.add({type:`error`,title:`Unable to capture screenshot`,description:e instanceof Error?e.message:`An error occurred.`})})},[O,D,E,n]),Me=(0,Z.useCallback)(()=>{if(!X||!D)return;if(_.current){X.cancelPickElement(D).catch(()=>void 0);return}let e=typeof document<`u`?document.activeElement:null;_.current=!0,h(!0),(async()=>{try{let e=await X.pickElement(D);if(!e)return;ee(n,e);let t=await Ae(e);t&&e.screenshot&&x(n,{type:`image`,id:e.id,name:t.name,mimeType:t.type,sizeBytes:t.size,previewUrl:e.screenshot.dataUrl,file:t})}catch{}finally{if(_.current=!1,v.current&&h(!1),e&&e.isConnected&&typeof e.focus==`function`)try{e.focus({preventScroll:!0})}catch{}}})()},[x,ee,D,n]);return(0,Z.useEffect)(()=>()=>{_.current&&(_.current=!1,X&&D&&X.cancelPickElement(D).catch(()=>void 0),v.current&&h(!1))},[D]),(0,Z.useEffect)(()=>{if(o)return he(e=>{switch(e){case`refresh`:B();return;case`focus-url`:u(e=>(e??0)+1);return;case`zoom-in`:le();return;case`zoom-out`:ue();return;case`reset-zoom`:q();return;case`toggle-panel`:return}})},[B,q,le,ue,o]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"data-thread-key":d(n),children:[(0,$.jsx)(qe,{url:M,displayUrl:ae,loading:te,loadProgress:I,canGoBack:N,canGoForward:ne,refreshDisabled:re,focusUrlNonce:s,onBack:ge,onForward:ve,onRefresh:B,onSubmit:e=>void ce(e),onOpenInBrowser:E?be:void 0,onCapture:X&&E?ke:void 0,captureDisabled:!A||P,recording:O!==null,onPictureInPicture:X&&E?Se:void 0,pictureInPicture:b?.tabId===E,pictureInPictureDisabled:!A?.hasWebContents||P,onPickElement:X&&E?Me:void 0,pickActive:p,pickDisabled:!E||P,pickDisabledReason:P?`Page didn't load — pick unavailable until the page renders`:void 0,trailingActions:X?(0,$.jsx)(ot,{tabId:D,hasWebContents:A?.hasWebContents??!1,zoomFactor:A?.zoomFactor??1,colorScheme:A?.colorScheme??`system`,deviceToolbarVisible:oe._tag!==`fill`,onToggleDeviceToolbar:Y,nativePictureInPicture:A?.pictureInPicture??!1,onNativePictureInPicture:Oe}):null}),(0,$.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[D&&k&&!ie?(0,$.jsx)(K,{tabId:D,visible:o&&!P,className:`absolute inset-0 h-full w-full`},D):null,ie?(0,$.jsx)(it,{environmentId:n.environmentId,configuredUrls:a,recentlySeenUrls:y.recentlySeenUrls,onOpenUrl:e=>void z(e)}):null,k&&A?(0,$.jsx)(Nt,{zoomFactor:A.zoomFactor}):null,D&&A&&!ie&&!P?(0,$.jsx)(It,{tabId:D,zoomFactor:A.zoomFactor,controller:F}):null,F===`none`?null:(0,$.jsx)(`div`,{className:`pointer-events-none absolute left-3 top-3 z-40 rounded-full border border-border/70 bg-background/90 px-2.5 py-1 text-[11px] font-medium shadow-sm backdrop-blur`,children:F===`agent`?`Agent controlling browser`:`Human control`}),j._tag===`LoadFailed`?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(gt,{url:j.url,code:j.code,description:j.description,onReload:B})}):null]})]})}function Bt(e){let t=(0,Q.c)(13),{mode:n,threadRef:r,tabId:i,configuredUrls:a,visible:o}=e;if(!Y()){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 laplus desktop app.`})}),t[0]=e):e=t[0];let r;return t[1]===n?r=t[2]:(r=(0,$.jsx)(ve,{mode:n,children:e}),t[1]=n,t[2]=r),r}let s;t[3]===i?s=t[4]:(s=i===void 0?{}:{tabId:i},t[3]=i,t[4]=s);let c;t[5]!==a||t[6]!==s||t[7]!==r||t[8]!==o?(c=(0,$.jsx)(zt,{threadRef:r,...s,configuredUrls:a,visible:o}),t[5]=a,t[6]=s,t[7]=r,t[8]=o,t[9]=c):c=t[9];let l;return t[10]!==n||t[11]!==c?(l=(0,$.jsx)(ve,{mode:n,children:c}),t[10]=n,t[11]=c,t[12]=l):l=t[12],l}export{Bt as PreviewPanel};
|
|
2
|
+
//# sourceMappingURL=PreviewPanel-D1RgBgdC.js.map
|