@popmelt.com/core 0.33.0 → 0.34.0
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/README.md +24 -1
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/ExploreAttachment-BG7ZOQSA.mjs +1 -0
- package/dist/PagePreviewLayer-CBDGPMJQ.mjs +1 -0
- package/dist/ParticipantRuntime-FSZX2PUQ.mjs +1 -0
- package/dist/PhoneHostGate-OM7FLOJ2.mjs +1 -0
- package/dist/PopmeltTasteConnectedPane-KJSBPJQR.mjs +1 -0
- package/dist/PreviewRuntime-EYKB7MG5.mjs +1 -0
- package/dist/QueuedReplies-ZYUDSTS2.mjs +1 -46
- package/dist/SuppliedContext-7THB2WZY.mjs +1 -0
- package/dist/ThreadErrorCard-J2VTA5JW.mjs +1 -0
- package/dist/ThreadPanel-PNVMIIYJ.mjs +1 -0
- package/dist/adapter-react-three-fiber.mjs +1 -2
- package/dist/bridge-entry.mjs +1 -1
- package/dist/bridge-recovery-3IQN3U6D.mjs +1 -2
- package/dist/bridgeSSEStream-K3UIMBTC.mjs +1 -0
- package/dist/bridgeWebSocketStream-2SUZUBE3.mjs +1 -0
- package/dist/browser-runtime-FFT5NH66.mjs +1 -0
- package/dist/browser.mjs +1 -2
- package/dist/canvas-chat-note-MGAEUYJO.mjs +1 -0
- package/dist/checkFixture-AMLLLJNS.mjs +1 -0
- package/dist/chunk-2ETPREWQ.mjs +1 -0
- package/dist/chunk-2P2NUZW7.mjs +1 -2
- package/dist/chunk-3GXLNBXU.mjs +1 -0
- package/dist/chunk-3WSTAV5B.mjs +1 -0
- package/dist/chunk-4LHTPRFY.mjs +1 -2
- package/dist/chunk-53SKVMWR.mjs +1 -0
- package/dist/chunk-57FM7XQV.mjs +1 -0
- package/dist/chunk-5D2ADU7H.mjs +1 -0
- package/dist/chunk-5K7SACPW.mjs +1 -2
- package/dist/chunk-67OWRNU3.mjs +30 -0
- package/dist/chunk-67QNAAUC.mjs +1 -0
- package/dist/chunk-BACXPVHP.mjs +1 -0
- package/dist/chunk-BFVLMSG5.mjs +1 -0
- package/dist/chunk-BJ25TGJN.mjs +1 -0
- package/dist/chunk-DOCRI237.mjs +1 -0
- package/dist/{chunk-C5WXW6VL.mjs → chunk-E5WNW4WE.mjs} +1 -1
- package/dist/chunk-EX63NVDN.mjs +1 -2
- package/dist/chunk-F5XSNRGT.mjs +1 -2
- package/dist/chunk-FMI4VQDZ.mjs +1 -0
- package/dist/chunk-G2ZHJXHZ.mjs +1 -0
- package/dist/chunk-G6RYESYI.mjs +1 -0
- package/dist/chunk-G7JR5Z3P.mjs +1 -0
- package/dist/chunk-GRPDZGPP.mjs +1 -0
- package/dist/chunk-GSEMSZDB.mjs +1 -0
- package/dist/chunk-H2RLTCUJ.mjs +1 -0
- package/dist/chunk-HAE5LUJX.mjs +1 -0
- package/dist/{chunk-IKCHOC3U.mjs → chunk-HV7HRQ2S.mjs} +0 -1
- package/dist/chunk-J3UIBBU2.mjs +1 -2
- package/dist/chunk-J4WDYITA.mjs +1 -2
- package/dist/chunk-JRP5XFYN.mjs +1 -0
- package/dist/chunk-LD3532UC.mjs +1 -0
- package/dist/chunk-LVEMYZOA.mjs +1 -2
- package/dist/chunk-MJ2PFKF3.mjs +1 -0
- package/dist/chunk-MP6ZV2DN.mjs +1 -0
- package/dist/chunk-N2ZEZCHO.mjs +1 -2
- package/dist/chunk-N66ZZG3L.mjs +1 -0
- package/dist/chunk-NSCO633B.mjs +1 -0
- package/dist/chunk-O4HZP3RP.mjs +1 -2
- package/dist/chunk-P4KM3K5M.mjs +1 -0
- package/dist/chunk-PH2MLB3T.mjs +1 -0
- package/dist/chunk-PQT5FYN5.mjs +1 -2
- package/dist/chunk-Q6C7ZA3H.mjs +1 -0
- package/dist/chunk-Q6N77LIS.mjs +1 -0
- package/dist/chunk-Q74FBX2I.mjs +1 -0
- package/dist/chunk-QQB5G3VB.mjs +1 -0
- package/dist/chunk-R3FPXDQS.mjs +1 -0
- package/dist/chunk-RK6UROPO.mjs +1 -0
- package/dist/chunk-RR4SHK7O.mjs +1 -0
- package/dist/chunk-RSUMSUAW.mjs +1 -0
- package/dist/{chunk-GL4I4MI6.mjs → chunk-RUJC32MA.mjs} +1 -1
- package/dist/chunk-RUTWU5W2.mjs +1 -0
- package/dist/chunk-TRHC7WBO.mjs +1 -0
- package/dist/chunk-V2I7PSJW.mjs +1 -2
- package/dist/chunk-WHJEKDNP.mjs +1 -2
- package/dist/chunk-XSMCZUDR.mjs +1 -0
- package/dist/chunk-XT6PHPPG.mjs +1 -0
- package/dist/chunk-XTOCFTVW.mjs +1 -2
- package/dist/chunk-Y6WD56SO.mjs +1 -0
- package/dist/chunk-YC5CUNRU.mjs +1 -0
- package/dist/chunk-YFDD7HGT.mjs +1 -0
- package/dist/chunk-YTUQYKLM.mjs +1 -0
- package/dist/chunk-YXPRWW6B.mjs +1 -0
- package/dist/chunk-ZVDKW7TO.mjs +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/codex-note-context-NUKGR2WT.mjs +1 -0
- package/dist/codex-project-KE7ZZ6YX.mjs +1 -0
- package/dist/{codex-session-registry-SPRWY2WW.mjs → codex-session-registry-ONODFWFD.mjs} +1 -2
- package/dist/focus-inspection-BPPRCMNN.mjs +1 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.mjs +1 -2
- package/dist/media.mjs +1 -2
- package/dist/memory-store.mjs +1 -1
- package/dist/peer-client-UQDASAO7.mjs +1 -0
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-next.mjs +1 -1
- package/dist/plugin-nuxt.mjs +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/steerStyles-VKQD57KC.mjs +1 -0
- package/dist/taste-proposal-session-XU4N7RUV.mjs +1 -2
- package/dist/workspace-snapshot-RTTXNNUX.mjs +1 -2
- package/package.json +1 -1
- package/dist/ExploreAttachment-CLFSAWKM.mjs +0 -260
- package/dist/ParticipantRuntime-HW3MOZI5.mjs +0 -139
- package/dist/PopmeltTasteConnectedPane-FKIJM3C7.mjs +0 -215
- package/dist/PreviewRuntime-LFPK56NW.mjs +0 -2
- package/dist/SuppliedContext-RWN6UR3K.mjs +0 -2
- package/dist/ThreadErrorCard-7J62GD5W.mjs +0 -2
- package/dist/ThreadPanel-RJIHV3P6.mjs +0 -197
- package/dist/bridgeSSEStream-NEYI73TC.mjs +0 -4
- package/dist/bridgeWebSocketStream-H3DCP4T3.mjs +0 -2
- package/dist/browser-runtime-JJHSKIKD.mjs +0 -2
- package/dist/canvas-chat-note-NHYL3T6J.mjs +0 -2
- package/dist/checkFixture-TJDFGPQI.mjs +0 -2
- package/dist/chunk-27ADDVGC.mjs +0 -3
- package/dist/chunk-2IASPT6L.mjs +0 -2
- package/dist/chunk-2VCHBI7Y.mjs +0 -11
- package/dist/chunk-2ZJ4FBTG.mjs +0 -2
- package/dist/chunk-6V2VCKPG.mjs +0 -53
- package/dist/chunk-6VXFTT5U.mjs +0 -2
- package/dist/chunk-75PQGTKX.mjs +0 -2
- package/dist/chunk-7IJGE5AK.mjs +0 -31
- package/dist/chunk-BVTLSUQT.mjs +0 -2
- package/dist/chunk-CPOYMGYY.mjs +0 -2
- package/dist/chunk-DMWB3IRD.mjs +0 -1
- package/dist/chunk-DNOKP3JS.mjs +0 -2
- package/dist/chunk-EAV2VV2V.mjs +0 -2
- package/dist/chunk-GASEZICN.mjs +0 -2
- package/dist/chunk-H2UYAUX3.mjs +0 -2
- package/dist/chunk-HNCV37XO.mjs +0 -2
- package/dist/chunk-I63OQTCF.mjs +0 -347
- package/dist/chunk-J5SC3R5L.mjs +0 -2
- package/dist/chunk-JMMP5JSP.mjs +0 -2
- package/dist/chunk-ODIGT4YJ.mjs +0 -17
- package/dist/chunk-PHKDIU3X.mjs +0 -30
- package/dist/chunk-PSSHCTJ2.mjs +0 -8
- package/dist/chunk-W5NIRROD.mjs +0 -7
- package/dist/chunk-XKD2ABCO.mjs +0 -7
- package/dist/chunk-XMKYGH62.mjs +0 -142
- package/dist/chunk-ZHJZPC7U.mjs +0 -2
- package/dist/codex-note-context-YHKPQ4WP.mjs +0 -2
- package/dist/codex-project-7VYHYTWO.mjs +0 -2
- package/dist/focus-inspection-VBS5656D.mjs +0 -2
- package/dist/peer-client-MTWZG2FB.mjs +0 -2
package/dist/chunk-PQT5FYN5.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{useRef as F,useId as Y,useLayoutEffect as J}from"react";import{jsxs as R,Fragment as _,jsx as H}from"react/jsx-runtime";var z=Array.from({length:16},(a,h)=>{let d=2.75+h*5;return`M${d} 0L${d-40} 40`}).join(" "),S="M20.25 8.00293H20.249C21.5098 8.0286 22.7219 8.25094 23.8584 8.63672L23.8604 8.63574C23.8961 8.64787 23.9312 8.66145 23.9668 8.67383C24.0611 8.70686 24.1548 8.74106 24.248 8.77637C24.2915 8.79273 24.3357 8.80727 24.3789 8.82422L24.376 8.82617C27.6145 10.0955 30.1646 12.7301 31.3213 16.0234L31.3232 16.0225C31.3327 16.0493 31.3404 16.0766 31.3496 16.1035C31.7691 17.3256 32 18.6356 32 20C32 20.8726 31.9366 21.6706 31.7598 22.4902L31.7197 22.6328C31.6412 23.0066 31.5136 23.6108 31.3408 24.2217L31.3398 24.2246C31.2967 24.377 31.251 24.5299 31.2021 24.6797C30.9215 25.5403 30.5473 26.2998 30.0879 26.2998C29.7613 26.2996 29.5995 25.9674 29.4316 25.6221C29.2501 25.2487 29.0614 24.8605 28.6484 24.8604C27.8532 24.8604 27.2081 25.5046 27.208 26.2998V27.0771C27.2079 27.6079 26.9661 28.112 26.5205 28.4004C25.9146 28.7925 25.2357 28.6462 24.7959 28.2061L24.7949 28.208C24.7897 28.2028 24.7854 28.1967 24.7803 28.1914C24.7654 28.1761 24.7507 28.1606 24.7363 28.1445C24.7105 28.1156 24.6858 28.0857 24.6621 28.0547C24.6461 28.0339 24.6302 28.013 24.6152 27.9912C24.5931 27.9591 24.5726 27.9257 24.5527 27.8916C24.5392 27.8685 24.5261 27.8452 24.5137 27.8213C24.5093 27.8128 24.5043 27.8045 24.5 27.7959L24.501 27.7939C24.3932 27.5763 24.3282 27.3276 24.3281 27.0576V26.2998C24.328 25.5993 23.8278 25.0158 23.165 24.8867V24.8877C23.0752 24.8702 22.9826 24.8604 22.8877 24.8604C22.8446 24.8604 22.8019 24.8624 22.7598 24.8662C22.0247 24.9312 21.4483 25.5479 21.4482 26.2998C21.4482 26.9127 21.4608 27.5305 21.4736 28.1494L21.4951 29.3135C21.5 29.7013 21.5015 30.089 21.4971 30.4756C21.4874 31.3103 20.8426 32 20.0078 32C19.1732 31.9998 18.5292 31.3102 18.5195 30.4756C18.5159 30.1613 18.5176 29.8464 18.5205 29.5312V29.5322C18.5212 29.4593 18.5206 29.3864 18.5215 29.3135L18.5303 28.8154V28.8145C18.5343 28.5927 18.5384 28.371 18.543 28.1494C18.5558 27.5305 18.5684 28.1129 18.5684 27.5C18.5684 26.7047 17.9232 26.0596 17.1279 26.0596C16.907 26.0596 16.6978 26.1103 16.5107 26.1992C16.2161 26.3393 15.9767 26.5769 15.834 26.8701C15.8269 26.8846 15.8201 26.8993 15.8135 26.9141C15.7821 26.9845 15.7562 27.0579 15.7363 27.1338C15.7243 27.1798 15.7155 27.2267 15.708 27.2744C15.7012 27.3175 15.6953 27.361 15.6924 27.4053C15.6903 27.4366 15.6885 27.4681 15.6885 27.5V28.7383C15.6883 29.9234 14.4911 30.7248 13.4961 30.0811C13.0505 29.7926 12.8086 29.2886 12.8086 28.7578V26.2998C12.8086 25.9737 12.6984 25.674 12.5156 25.4326C12.4437 25.3381 12.3612 25.2521 12.2686 25.1777V25.1768C12.0219 24.9788 11.709 24.8604 11.3682 24.8604C10.9892 24.8604 10.8622 24.8872 10.7295 25.2295C10.5837 25.6055 10.4302 26 9.92773 26C9.33081 25.9996 8.95963 25.2403 8.71484 24.3799C8.5591 23.8325 8.45907 23.571 8.3623 23.0107C8.3501 22.9401 8.33284 22.8403 8.31738 22.7529C8.12812 21.9466 8.02043 21.1089 8.00293 20.249V20.25L8 20C8 19.8617 8.00317 19.724 8.00781 19.5869C8.00837 19.5703 8.00816 19.5537 8.00879 19.5371L8.00977 19.5352C8.0998 17.1716 8.87444 14.9844 10.1396 13.1631C10.1488 13.1499 10.1587 13.1372 10.168 13.124C12.255 10.1453 15.6582 8.15745 19.5352 8.00977L19.5371 8.00879C19.5537 8.00816 19.5703 8.00837 19.5869 8.00781C19.724 8.00317 19.8617 8 20 8L20.25 8.00293Z";function B(){let a=[],h=0,d=0;for(let[,n,o]of S.matchAll(/([A-Z])([^A-Z]*)/g)){let r=(o.match(/-?\d*\.?\d+/g)??[]).map(Number),e=h,t=d;if(n!=="Z")if(n==="H"?h=r[0]:n==="V"?d=r[0]:(h=r[r.length-2],d=r[r.length-1]),n==="C")for(let l=1;l<=24;l++){let s=l/24,u=1-s;a.push({x:u**3*e+3*u**2*s*r[0]+3*u*s**2*r[2]+s**3*h,y:u**3*t+3*u**2*s*r[1]+3*u*s**2*r[3]+s**3*d})}else a.push({x:h,y:d})}let C=24,M=a.findIndex(n=>n.y>=C),m=M;for(;m+1<a.length&&a[m+1].y>=C;)m++;let y=(n,o)=>({x:n.x+(o.x-n.x)*(C-n.y)/(o.y-n.y),y:C}),I=y(a[M-1],a[M]),P=y(a[m],a[m+1]),c=(I.x+P.x)/2,$=(I.x-P.x)/2,Z=[I,...a.slice(M,m+1),P].map(n=>{let o=Math.asin(Math.max(-1,Math.min(1,(n.x-c)/$))),r=Math.cos(o);return{longitude:o,height:r>1e-5?(n.y-C)/r:0}}),x=[],v=[8,6.2,8.6,6.5,8],L=[0,1.4,.8,1.8,1.1,0],k=(n,o,r,e)=>{for(let t=0;t<=24;t++){let l=t/24,s=1-l;x.push({longitude:s**3*n[0]+3*s**2*l*o[0]+3*s*l**2*r[0]+l**3*e[0],height:s**3*n[1]+3*s**2*l*o[1]+3*s*l**2*r[1]+l**3*e[1]})}};for(let[n,o]of v.entries()){let r=Math.PI/2+n/v.length*Math.PI,e=r+Math.PI/v.length,t=(r+e)/2,l=.145,s=L[n],u=L[n+1];k([r,s],[t-l,s],[t-l,s+.7],[t-l,o-1.4]);for(let E=0;E<=32;E++){let X=Math.PI*(1-E/32);x.push({longitude:t+l*Math.cos(X),height:o-1.4+1.4*Math.sin(X)})}k([t+l,o-1.4],[t+l,u+.7],[t+l,u],[e,u])}let j=[...Z,...x],b=n=>`L${n.x} ${n.y}`,p=`M${a[0].x} ${a[0].y}`+a.slice(1,M).map(b).join("")+b(I),w=b(P)+a.slice(m+1).map(b).join("")+"Z";return n=>{let o=Math.atan2(Math.sin(n),Math.cos(n));if(Math.abs(o)<1e-9)return S;let r=j.map(e=>({longitude:Math.atan2(Math.sin(e.longitude+o),Math.cos(e.longitude+o)),height:e.height})).filter(e=>Math.abs(e.longitude)<Math.PI/2).sort((e,t)=>t.longitude-e.longitude).map(e=>{let t=c+$*Math.sin(e.longitude),l=C+e.height*Math.cos(e.longitude);return`L${t} ${l}`}).join("");return p+r+w}}function D({active:a,interactive:h=!1,hatched:d=!1,onSettlingChange:C,...M}){let m=F(null),y=F(null),I=F(null),P=Y(),c=F(0),$=F(!1),Z=F(null);return J(()=>{a&&(y.current?.setAttribute("fill",M.fill??"currentColor"),y.current?.setAttribute("stroke","none"))},[a,M.fill]),J(()=>{let x=m.current;if(!x)return;x.style.removeProperty("fill"),x.style.removeProperty("stroke");let v=window.matchMedia("(prefers-reduced-motion: reduce)"),L=0,k=null,j=0,b=!1,p=c.current,w=Math.ceil(p),n=!a&&w-p>1e-9,o=!1,r=0,e=null,t=x,l=t.style.cursor,s=t.style.touchAction,u=i=>{y.current?.setAttribute("d",i),I.current?.setAttribute("d",i)},E=()=>{Z.current??(Z.current=B()),u(Z.current(-c.current*Math.PI*2))},X=()=>{b=!0,c.current=0,u(S),y.current?.removeAttribute("fill"),y.current?.removeAttribute("stroke"),C?.(!1)},U=i=>{let A=k===null?0:i-k;if(k=i,o){let f=Math.min(A/1e3,.05),g=a?1/15:0,N=Math.exp(-1.8*f);c.current+=g*f+(r-g)*(1-N)/1.8,r=g+(r-g)*N,Math.abs(r-g)<.005&&(o=!1,p=c.current,w=Math.round(p),j=0)}else if(a)c.current+=A/15e3;else{j+=A;let f=Math.min(1,j/250);if(f===1){X();return}let g=1-(1-f)**3;c.current=p+(w-p)*g}E(),L=requestAnimationFrame(U)},V=()=>{cancelAnimationFrame(L),k=null,!(e||b)&&(!a&&(v.matches||!$.current||document.hidden)?X():v.matches?(c.current=0,u(S)):$.current&&!document.hidden&&(L=requestAnimationFrame(U)))},K=i=>{e||!i.isPrimary||i.button!==0||(t.setPointerCapture(i.pointerId),e={id:i.pointerId,startX:i.clientX,x:i.clientX,time:i.timeStamp,moved:!1},r=0,cancelAnimationFrame(L),t.style.cursor="grabbing")},T=i=>{if(!e||e.id!==i.pointerId||!e.moved&&Math.abs(i.clientX-e.startX)<3)return;e.moved=!0;let A=-(i.clientX-e.x)/160,f=Math.max((i.timeStamp-e.time)/1e3,.001),g=24/(Math.PI*2);r+=(Math.max(-g,Math.min(g,A/f))-r)*(1-Math.exp(-f/.035)),c.current+=A,e.x=i.clientX,e.time=i.timeStamp,E()},O=i=>{!e||e.id!==i.pointerId||(e.moved&&(r*=Math.exp(-Math.max(0,i.timeStamp-e.time-40)/60),o=i.type==="pointerup"&&!v.matches,b=!1,p=c.current,w=Math.round(p),j=0),e=null,t.style.cursor="grab",t.hasPointerCapture(i.pointerId)&&t.releasePointerCapture(i.pointerId),V())};if(!a&&!n&&(X(),!h))return;let W=i=>{for(let[A,f]of Object.entries({pointerdown:K,pointermove:T,pointerup:O,pointercancel:O,lostpointercapture:O}))t[i](A,f)};h&&(t.style.cursor="grab",t.style.touchAction="pan-y",W("addEventListener")),C?.(n);let q=new IntersectionObserver(([i])=>{$.current=i?.isIntersecting??!1,V()});return q.observe(x),v.addEventListener("change",V),document.addEventListener("visibilitychange",V),V(),()=>{cancelAnimationFrame(L),q.disconnect(),h&&(W("removeEventListener"),t.style.cursor=l,t.style.touchAction=s,e&&t.hasPointerCapture(e.id)&&t.releasePointerCapture(e.id)),v.removeEventListener("change",V),document.removeEventListener("visibilitychange",V)}},[a,h,C]),R("svg",{...M,ref:m,children:[d&&R(_,{children:[H("defs",{children:R("mask",{id:P,x:"0",y:"0",width:"40",height:"40",maskUnits:"userSpaceOnUse",style:{maskType:"luminance"},children:[H("rect",{width:"40",height:"40",fill:"white"}),H("path",{ref:I,d:S,fill:"black",stroke:"black",strokeWidth:"5",strokeLinejoin:"round"})]})}),H("path",{d:z,fill:"none",stroke:"currentColor",strokeWidth:"0.65",mask:`url(#${P})`})]}),H("path",{ref:y,d:S})]})}export{D as a};
|
|
1
|
+
"use client";import{useRef as e,useId as t,useLayoutEffect as r}from"react";import{jsxs as n,Fragment as i,jsx as a}from"react/jsx-runtime";var l=Array.from({length:16},(e,t)=>{let r=2.75+5*t;return`M${r} 0L${r-40} 40`}).join(" "),o="M20.25 8.00293H20.249C21.5098 8.0286 22.7219 8.25094 23.8584 8.63672L23.8604 8.63574C23.8961 8.64787 23.9312 8.66145 23.9668 8.67383C24.0611 8.70686 24.1548 8.74106 24.248 8.77637C24.2915 8.79273 24.3357 8.80727 24.3789 8.82422L24.376 8.82617C27.6145 10.0955 30.1646 12.7301 31.3213 16.0234L31.3232 16.0225C31.3327 16.0493 31.3404 16.0766 31.3496 16.1035C31.7691 17.3256 32 18.6356 32 20C32 20.8726 31.9366 21.6706 31.7598 22.4902L31.7197 22.6328C31.6412 23.0066 31.5136 23.6108 31.3408 24.2217L31.3398 24.2246C31.2967 24.377 31.251 24.5299 31.2021 24.6797C30.9215 25.5403 30.5473 26.2998 30.0879 26.2998C29.7613 26.2996 29.5995 25.9674 29.4316 25.6221C29.2501 25.2487 29.0614 24.8605 28.6484 24.8604C27.8532 24.8604 27.2081 25.5046 27.208 26.2998V27.0771C27.2079 27.6079 26.9661 28.112 26.5205 28.4004C25.9146 28.7925 25.2357 28.6462 24.7959 28.2061L24.7949 28.208C24.7897 28.2028 24.7854 28.1967 24.7803 28.1914C24.7654 28.1761 24.7507 28.1606 24.7363 28.1445C24.7105 28.1156 24.6858 28.0857 24.6621 28.0547C24.6461 28.0339 24.6302 28.013 24.6152 27.9912C24.5931 27.9591 24.5726 27.9257 24.5527 27.8916C24.5392 27.8685 24.5261 27.8452 24.5137 27.8213C24.5093 27.8128 24.5043 27.8045 24.5 27.7959L24.501 27.7939C24.3932 27.5763 24.3282 27.3276 24.3281 27.0576V26.2998C24.328 25.5993 23.8278 25.0158 23.165 24.8867V24.8877C23.0752 24.8702 22.9826 24.8604 22.8877 24.8604C22.8446 24.8604 22.8019 24.8624 22.7598 24.8662C22.0247 24.9312 21.4483 25.5479 21.4482 26.2998C21.4482 26.9127 21.4608 27.5305 21.4736 28.1494L21.4951 29.3135C21.5 29.7013 21.5015 30.089 21.4971 30.4756C21.4874 31.3103 20.8426 32 20.0078 32C19.1732 31.9998 18.5292 31.3102 18.5195 30.4756C18.5159 30.1613 18.5176 29.8464 18.5205 29.5312V29.5322C18.5212 29.4593 18.5206 29.3864 18.5215 29.3135L18.5303 28.8154V28.8145C18.5343 28.5927 18.5384 28.371 18.543 28.1494C18.5558 27.5305 18.5684 28.1129 18.5684 27.5C18.5684 26.7047 17.9232 26.0596 17.1279 26.0596C16.907 26.0596 16.6978 26.1103 16.5107 26.1992C16.2161 26.3393 15.9767 26.5769 15.834 26.8701C15.8269 26.8846 15.8201 26.8993 15.8135 26.9141C15.7821 26.9845 15.7562 27.0579 15.7363 27.1338C15.7243 27.1798 15.7155 27.2267 15.708 27.2744C15.7012 27.3175 15.6953 27.361 15.6924 27.4053C15.6903 27.4366 15.6885 27.4681 15.6885 27.5V28.7383C15.6883 29.9234 14.4911 30.7248 13.4961 30.0811C13.0505 29.7926 12.8086 29.2886 12.8086 28.7578V26.2998C12.8086 25.9737 12.6984 25.674 12.5156 25.4326C12.4437 25.3381 12.3612 25.2521 12.2686 25.1777V25.1768C12.0219 24.9788 11.709 24.8604 11.3682 24.8604C10.9892 24.8604 10.8622 24.8872 10.7295 25.2295C10.5837 25.6055 10.4302 26 9.92773 26C9.33081 25.9996 8.95963 25.2403 8.71484 24.3799C8.5591 23.8325 8.45907 23.571 8.3623 23.0107C8.3501 22.9401 8.33284 22.8403 8.31738 22.7529C8.12812 21.9466 8.02043 21.1089 8.00293 20.249V20.25L8 20C8 19.8617 8.00317 19.724 8.00781 19.5869C8.00837 19.5703 8.00816 19.5537 8.00879 19.5371L8.00977 19.5352C8.0998 17.1716 8.87444 14.9844 10.1396 13.1631C10.1488 13.1499 10.1587 13.1372 10.168 13.124C12.255 10.1453 15.6582 8.15745 19.5352 8.00977L19.5371 8.00879C19.5537 8.00816 19.5703 8.00837 19.5869 8.00781C19.724 8.00317 19.8617 8 20 8L20.25 8.00293Z";function u({active:u,interactive:c=!1,hatched:h=!1,onSettlingChange:s,...m}){let d=e(null),C=e(null),p=e(null),M=t(),f=e(0),g=e(!1),y=e(null);return r(()=>{u&&(C.current?.setAttribute("fill",m.fill??"currentColor"),C.current?.setAttribute("stroke","none"))},[u,m.fill]),r(()=>{let e=d.current;if(!e)return;e.style.removeProperty("fill"),e.style.removeProperty("stroke");let t=window.matchMedia("(prefers-reduced-motion: reduce)"),r=0,n=null,i=0,a=!1,l=f.current,h=Math.ceil(l),m=!u&&h-l>1e-9,M=!1,v=0,x=null,b=e,L=b.style.cursor,A=b.style.touchAction,I=e=>{C.current?.setAttribute("d",e),p.current?.setAttribute("d",e)},P=()=>{y.current??(y.current=function(){let e=[],t=0,r=0;for(let[,n,i]of o.matchAll(/([A-Z])([^A-Z]*)/g)){let a=(i.match(/-?\d*\.?\d+/g)??[]).map(Number),l=t,o=r;if("Z"!==n)if("H"===n?t=a[0]:"V"===n?r=a[0]:(t=a[a.length-2],r=a[a.length-1]),"C"===n)for(let n=1;n<=24;n++){let i=n/24,u=1-i;e.push({x:u**3*l+3*u**2*i*a[0]+3*u*i**2*a[2]+i**3*t,y:u**3*o+3*u**2*i*a[1]+3*u*i**2*a[3]+i**3*r})}else e.push({x:t,y:r})}let n=24,i=e.findIndex(e=>e.y>=n),a=i;for(;a+1<e.length&&e[a+1].y>=n;)a++;let l=(e,t)=>({x:e.x+(t.x-e.x)*(n-e.y)/(t.y-e.y),y:n}),u=l(e[i-1],e[i]),c=l(e[a],e[a+1]),h=(u.x+c.x)/2,s=(u.x-c.x)/2,m=[u,...e.slice(i,a+1),c].map(e=>{let t=Math.asin(Math.max(-1,Math.min(1,(e.x-h)/s))),r=Math.cos(t);return{longitude:t,height:r>1e-5?(e.y-n)/r:0}}),d=[],C=[8,6.2,8.6,6.5,8],p=[0,1.4,.8,1.8,1.1,0],M=(e,t,r,n)=>{for(let i=0;i<=24;i++){let a=i/24,l=1-a;d.push({longitude:l**3*e[0]+3*l**2*a*t[0]+3*l*a**2*r[0]+a**3*n[0],height:l**3*e[1]+3*l**2*a*t[1]+3*l*a**2*r[1]+a**3*n[1]})}};for(let[e,t]of C.entries()){let r=Math.PI/2+e/C.length*Math.PI,n=r+Math.PI/C.length,i=(r+n)/2,a=.145,l=p[e],o=p[e+1];M([r,l],[i-a,l],[i-a,l+.7],[i-a,t-1.4]);for(let e=0;e<=32;e++){let r=Math.PI*(1-e/32);d.push({longitude:i+a*Math.cos(r),height:t-1.4+1.4*Math.sin(r)})}M([i+a,t-1.4],[i+a,o+.7],[i+a,o],[n,o])}let f=[...m,...d],g=e=>`L${e.x} ${e.y}`,y=`M${e[0].x} ${e[0].y}`+e.slice(1,i).map(g).join("")+g(u),v=g(c)+e.slice(a+1).map(g).join("")+"Z";return e=>{let t=Math.atan2(Math.sin(e),Math.cos(e));if(Math.abs(t)<1e-9)return o;let r=f.map(e=>({longitude:Math.atan2(Math.sin(e.longitude+t),Math.cos(e.longitude+t)),height:e.height})).filter(e=>Math.abs(e.longitude)<Math.PI/2).sort((e,t)=>t.longitude-e.longitude).map(e=>`L${h+s*Math.sin(e.longitude)} ${n+e.height*Math.cos(e.longitude)}`).join("");return y+r+v}}()),I(y.current(-f.current*Math.PI*2))},k=()=>{a=!0,f.current=0,I(o),C.current?.removeAttribute("fill"),C.current?.removeAttribute("stroke"),s?.(!1)},V=e=>{let t=null===n?0:e-n;if(n=e,M){let e=Math.min(t/1e3,.05),r=u?1/15:0,n=Math.exp(-1.8*e);f.current+=r*e+(v-r)*(1-n)/1.8,v=r+(v-r)*n,Math.abs(v-r)<.005&&(M=!1,l=f.current,h=Math.round(l),i=0)}else if(u)f.current+=t/15e3;else{i+=t;let e=Math.min(1,i/250);if(1===e)return void k();let r=1-(1-e)**3;f.current=l+(h-l)*r}P(),r=requestAnimationFrame(V)},$=()=>{cancelAnimationFrame(r),n=null,!x&&!a&&(u||!t.matches&&g.current&&!document.hidden?t.matches?(f.current=0,I(o)):g.current&&!document.hidden&&(r=requestAnimationFrame(V)):k())},j=e=>{x||!e.isPrimary||0!==e.button||(b.setPointerCapture(e.pointerId),x={id:e.pointerId,startX:e.clientX,x:e.clientX,time:e.timeStamp,moved:!1},v=0,cancelAnimationFrame(r),b.style.cursor="grabbing")},w=e=>{if(!x||x.id!==e.pointerId||!x.moved&&Math.abs(e.clientX-x.startX)<3)return;x.moved=!0;let t=-(e.clientX-x.x)/160,r=Math.max((e.timeStamp-x.time)/1e3,.001),n=24/(2*Math.PI);v+=(Math.max(-n,Math.min(n,t/r))-v)*(1-Math.exp(-r/.035)),f.current+=t,x.x=e.clientX,x.time=e.timeStamp,P()},X=e=>{!x||x.id!==e.pointerId||(x.moved&&(v*=Math.exp(-Math.max(0,e.timeStamp-x.time-40)/60),M="pointerup"===e.type&&!t.matches,a=!1,l=f.current,h=Math.round(l),i=0),x=null,b.style.cursor="grab",b.hasPointerCapture(e.pointerId)&&b.releasePointerCapture(e.pointerId),$())};if(!u&&!m&&(k(),!c))return;let E=e=>{for(let[t,r]of Object.entries({pointerdown:j,pointermove:w,pointerup:X,pointercancel:X,lostpointercapture:X}))b[e](t,r)};c&&(b.style.cursor="grab",b.style.touchAction="pan-y",E("addEventListener")),s?.(m);let S=new IntersectionObserver(([e])=>{g.current=e?.isIntersecting??!1,$()});return S.observe(e),t.addEventListener("change",$),document.addEventListener("visibilitychange",$),$(),()=>{cancelAnimationFrame(r),S.disconnect(),c&&(E("removeEventListener"),b.style.cursor=L,b.style.touchAction=A,x&&b.hasPointerCapture(x.id)&&b.releasePointerCapture(x.id)),t.removeEventListener("change",$),document.removeEventListener("visibilitychange",$)}},[u,c,s]),n("svg",{...m,ref:d,children:[h&&n(i,{children:[a("defs",{children:n("mask",{id:M,x:"0",y:"0",width:"40",height:"40",maskUnits:"userSpaceOnUse",style:{maskType:"luminance"},children:[a("rect",{width:"40",height:"40",fill:"white"}),a("path",{ref:p,d:o,fill:"black",stroke:"black",strokeWidth:"5",strokeLinejoin:"round"})]})}),a("path",{d:l,fill:"none",stroke:"currentColor",strokeWidth:"0.65",mask:`url(#${M})`})]}),a("path",{ref:C,d:o})]})}export{u as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";function t(t){return t<=480}function n(n){return t(n)?8:16}function a(t){let a=n(t);return t<=480?Math.max(0,t-2*a):Math.min(360,Math.max(0,t-2*a))}export{t as a,n as b,a as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";function t(t){let e=t.map(t=>{let e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4});return.2126*e[0]+.7152*e[1]+.0722*e[2]}function e(e,n){let l=t(e),a=t(n);return(Math.max(l,a)+.05)/(Math.min(l,a)+.05)}function n(){if(typeof CanvasRenderingContext2D>"u")return;let t=document.createElement("canvas");t.width=t.height=1;let e=t.getContext("2d",{willReadFrequently:!0});return e?(t,n)=>{e.fillStyle=n,e.fillRect(0,0,1,1),e.fillStyle=t,e.fillRect(0,0,1,1);let l=e.getImageData(0,0,1,1).data;return[l[0],l[1],l[2]]}:void 0}export{t as a,e as b,n as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";function e(t,r,a){if(null===t||"string"==typeof t||"boolean"==typeof t)return;if("number"==typeof t){if(!Number.isFinite(t))throw new TypeError(`Comment metadata at ${r} must be finite.`);return}if("object"!=typeof t)throw new TypeError(`Comment metadata at ${r} must be JSON-serializable.`);if(a.has(t))throw new TypeError(`Comment metadata at ${r} contains a cycle.`);let o=Object.getPrototypeOf(t);if(!Array.isArray(t)&&o!==Object.prototype&&null!==o)throw new TypeError(`Comment metadata at ${r} must use plain objects and arrays.`);if(a.add(t),Array.isArray(t))t.forEach((t,o)=>e(t,`${r}[${o}]`,a));else for(let[o,n]of Object.entries(t))e(n,`${r}.${o}`,a);a.delete(t)}function t(t){if(void 0===t)return;if(null===t||Array.isArray(t)||"object"!=typeof t)throw new TypeError("Comment metadata must be a JSON object.");e(t,"meta",new Set);let r=JSON.stringify(t);if((new TextEncoder).encode(r).byteLength>65536)throw new RangeError("Comment metadata exceeds the 65536 byte limit.");return JSON.parse(r)}export{t as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e}from"./chunk-RSUMSUAW.mjs";import{F as t,G as a,i as r,t as o}from"./chunk-67OWRNU3.mjs";import{readFile as s,readdir as n,realpath as i,stat as c}from"fs/promises";import{dirname as p,join as l,parse as m,relative as u,resolve as d,sep as f}from"path";async function w(e){return c(e).then(()=>!0,()=>!1)}async function y(e){try{let t=JSON.parse(await s(e,"utf8"));return"@popmelt.com/core"===t.name||["dependencies","devDependencies","peerDependencies"].some(e=>{let a=t[e];return!(!a||"object"!=typeof a||!Object.prototype.hasOwnProperty.call(a,"@popmelt.com/core"))})}catch{return!1}}async function h(e){return i(e).catch(()=>d(e))}async function k(e){let t=new Set;try{let a=await s(l(e,"pnpm-workspace.yaml"),"utf8");for(let r of a.matchAll(/^\s*-\s*['"]?([^'"\r\n]+)['"]?\s*$/gm)){let a=r[1].trim().split(/[*{[]/,1)[0].replace(/\/$/,"");a&&t.add(d(e,a))}}catch{}try{let a=JSON.parse(await s(l(e,"package.json"),"utf8")),r=Array.isArray(a.workspaces)?a.workspaces:a.workspaces?.packages??[];for(let a of r){let r=a.split(/[*{[]/,1)[0].replace(/\/$/,"");r&&t.add(d(e,r))}}catch{}return[...t]}var g=new Set([".git",".next",".turbo","build","coverage","dist","node_modules","vendor"]);async function j(e,t=5){let a=[],r=async(e,o)=>{if(o>t)return;let s;try{s=await n(e,{withFileTypes:!0})}catch{return}s.some(e=>e.isDirectory()&&".popmelt"===e.name)&&a.push(e),await Promise.all(s.flatMap(t=>!t.isDirectory()||".popmelt"===t.name||g.has(t.name)?[]:[r(l(e,t.name),o+1)]))};return await r(e,0),a}function b(e,t){let a=u(e,t);return a?a.split(f).filter(Boolean).length:0}async function v(e=process.cwd()){let a=await h(e),o=a,s=m(o).root,n=new Map,i=(e,t)=>{let a=n.get(e)??new Set;a.add(t),n.set(e,a)},c=[];for(;await w(l(o,".popmelt"))&&i(o,"store"),await w(l(o,".popmelt","ambient.json"))&&i(o,"marker"),await y(l(o,"package.json"))&&i(o,"package"),await y(l(o,"packages","popmelt","package.json"))&&i(o,"workspace_package"),(await k(o)).length&&c.push(o),o!==s;)o=p(o);for(let e of c){let t=await k(e),a=await Promise.all(t.map(e=>j(e)));for(let e of a.flat())i(await h(e),"store")}return(await Promise.all([...n].map(async([e,a])=>{let o=await h(e),s=await t(o),n=[...a].sort();return{root:o,storeId:s.storeId,projectId:r(o),reason:n[0],reasons:n,initialized:a.has("store")}}))).sort((e,t)=>e.initialized!==t.initialized?e.initialized?-1:1:b(a,e.root)-b(a,t.root)||e.root.localeCompare(t.root))}async function I(e=process.cwd()){return(await v(e))[0]??null}function O(){return process.env.POPMELT_EXECUTION_OWNER}function P(){return O()===o}async function S(t){let r=await a(t.root);return{...await e({projectRoot:t.root,detached:!0,backgroundDiscovery:!0,manageLease:!1}),storeId:r.storeId}}async function D(e,t,a={}){let r=await fetch(`http://127.0.0.1:${e.port}${t}`,{...a,headers:{"Content-Type":"application/json","X-Popmelt-Project-Id":e.projectId,...a.headers}}),o=await r.json().catch(()=>null);return{response:r,body:o}}export{v as a,I as b,O as c,P as d,S as e,D as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{c as e}from"./chunk-RK6UROPO.mjs";import{a as t}from"./chunk-G2ZHJXHZ.mjs";import{b as n}from"./chunk-G6RYESYI.mjs";import{c as o,b as i}from"./chunk-4LHTPRFY.mjs";import{a}from"./chunk-JRP5XFYN.mjs";import{g as r,a as l,f as d}from"./chunk-XT6PHPPG.mjs";import{n as s,h as c,i as p,o as u}from"./chunk-RR4SHK7O.mjs";import{a as f,c as h}from"./chunk-53SKVMWR.mjs";import{c as m,a as g}from"./chunk-57FM7XQV.mjs";import{a as y,b as v,c as x}from"./chunk-5K7SACPW.mjs";import{a as w,b}from"./chunk-LVEMYZOA.mjs";import{a as I,d as S,v as T,h as M,i as k,c as E,f as A,b as C,e as R,g as N}from"./chunk-WHJEKDNP.mjs";import{Eye as L,Clock as O,OctagonAlert as D,MessageCircleQuestionMark as $,TriangleAlert as P,Reply as _,SendHorizontal as F,CornerDownLeft as z}from"lucide-react";import{createContext as W,useContext as H,useState as B,useEffect as j,useLayoutEffect as Y,useId as K,useRef as q,useMemo as X,useCallback as V,useReducer as U,useSyncExternalStore as G}from"react";import{jsxs as Q,jsx as J,Fragment as Z}from"react/jsx-runtime";var ee,te=new Set;function ne(e){if(te.add(e),!ee){let e=new Map,t=new Map,n="",o=!0,i=!0,a=!1,r=!0,l=0,d=()=>{let n=new Set,a=new Map,r=t=>{if(n.add(t),!e.has(t)){let n=new MutationObserver(e=>{let t=e.filter(e=>!(1===e.target.nodeType?e.target:e.target.parentElement)?.closest("[data-devtools]"));t.length&&(o=!0),t.some(e=>"childList"===e.type)&&(i=!0)});n.observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0});let a=()=>{o=!0};t.addEventListener("scroll",a,!0),t.addEventListener("load",a,!0),e.set(t,()=>{n.disconnect(),t.removeEventListener("scroll",a,!0),t.removeEventListener("load",a,!0)})}for(let e of t.querySelectorAll("*")){if(e.shadowRoot&&!e.closest("[data-devtools]")&&r(e.shadowRoot),"iframe"!==e.localName||e.closest("[data-devtools],[data-popmelt-peer-surface]"))continue;let t=C(e);a.set(e,t),t&&r(t)}};r(document);for(let[t,o]of e)n.has(t)||(o(),e.delete(t));t=a,i=!1,o=!0},s=()=>{if(!r)return;(i||[...t].some(([e,t])=>C(e)!==t))&&d();let e=[];for(let[n,o]of t){let t=n.getBoundingClientRect();e.push(o?.URL,t.x,t.y,t.width,t.height,o?.defaultView?.scrollX,o?.defaultView?.scrollY)}let c=JSON.stringify(e);if((o||c!==n)&&(o=!1,n=c,a))for(let e of te)e();a=!0,r&&(l=requestAnimationFrame(s))};s(),ee=()=>{r=!1,cancelAnimationFrame(l);for(let t of e.values())t()}}return()=>{te.delete(e),te.size||(ee?.(),ee=void 0)}}var oe=W(!0);function ie(e,t){let n=e.match(/^oklch\(([^)]+)\)$/i);if(n)return`oklch(${n[1]} / ${t})`;let o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(o){return`rgba(${parseInt(o[1],16)}, ${parseInt(o[2],16)}, ${parseInt(o[3],16)}, ${t})`}return`color-mix(in srgb, ${e} ${Math.round(100*t)}%, transparent)`}function ae(e,t){let n=v(e),o=t.toLowerCase(),i=-1;for(let a=n.length-1;a>=0;a--){let r=n[a].name;if(r===t){let o=x(n[a].fiber)??e;return{name:t,path:n.map(e=>e.name),depthIndex:a,rootElement:o}}if(-1===i){let e=r.toLowerCase();(e.length>=4&&o.includes(e)||o.length>=4&&e.includes(o))&&(i=a)}}if(i>=0){let o=x(n[i].fiber)??e;return{name:t,path:n.map(e=>e.name),depthIndex:i,rootElement:o}}return null}function re(e){let t=de(),n=[],o=new Set,i=t.currentNode;for(;i=t.nextNode();){let t=ae(i,e);t&&!o.has(t.rootElement)&&(o.add(t.rootElement),n.push(t))}return n}function le(e){let t=new Map;if(0===e.size)return t;let n=new Set(e),o=de(),i=new Set,a=o.currentNode;for(;(a=o.nextNode())&&n.size>0;)for(let e of n){let o=ae(a,e);if(!o||i.has(o.rootElement))continue;i.add(o.rootElement);let r=o.rootElement.getBoundingClientRect();t.set(e,r.top+window.scrollY),n.delete(e);break}for(let e of n)t.set(e,1/0);return t}function de(){return document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.closest("#devtools-toolbar, #devtools-canvas, #devtools-scrim, [data-popmelt-panel]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT})}function se(e,t){return""!==e.style.getPropertyValue(t)}function ce(e){return"string"==typeof e?{value:e}:e}var pe={gap:["gap","row-gap","column-gap"],padding:["padding-top","padding-bottom","padding-left","padding-right"],margin:["margin-top","margin-bottom","margin-left","margin-right"]};function ue(e,t){let n=pe[t];return!!n&&n.includes(e)}function fe(e,t){let n=e.split(/\s+/);for(let e of n){if(e===t)return!0;let n=e.lastIndexOf(":");if(n>=0&&e.slice(n+1)===t)return!0}return!1}function he(e){let t=e.lastIndexOf(":"),n=t>=0?e.slice(t+1):e,o=n.indexOf("-");if(o<0)return null;let i=n.slice(0,o),a={gap:"gap","gap-x":"column-gap","gap-y":"row-gap",p:"padding",pt:"padding-top",pb:"padding-bottom",pl:"padding-left",pr:"padding-right",px:"padding-left",py:"padding-top",m:"margin",mt:"margin-top",mb:"margin-bottom",ml:"margin-left",mr:"margin-right",mx:"margin-left",my:"margin-top"};return a[n.slice(0,n.indexOf("-",o+1)>0?n.indexOf("-",o+1):o)]??a[i]??null}function me(e,t=30){let n=parseFloat(e.value);if(isNaN(n)||n<=0)return[];if(e.bindings&&e.bindings.length>0){let n=[],o=de(),i=o.currentNode;for(;(i=o.nextNode())&&n.length<t;){let t=i,o=t.getBoundingClientRect();if(o.bottom<-50||o.top>window.innerHeight+50||o.right<-50||o.left>window.innerWidth+50||o.width<1||o.height<1)continue;let a=t.className;if("string"==typeof a)for(let o of e.bindings){if(!fe(a,o))continue;let i=he(o);if(i&&(!e.property||ue(i,e.property))){n.push({element:t,property:i});break}}}return n}let o=function(e,t=30){if(e<=0)return[];let n=[],o=de(),i=.5,a=o.currentNode;for(;(a=o.nextNode())&&n.length<t;){let o=a,r=o.getBoundingClientRect();if(r.bottom<-50||r.top>window.innerHeight+50||r.right<-50||r.left>window.innerWidth+50||r.width<1||r.height<1)continue;let l=getComputedStyle(o);!se(o,"padding-top")&&Math.abs((parseFloat(l.paddingTop)||0)-e)<i&&n.push({element:o,property:"padding-top"}),!se(o,"padding-bottom")&&Math.abs((parseFloat(l.paddingBottom)||0)-e)<i&&n.length<t&&n.push({element:o,property:"padding-bottom"}),!se(o,"padding-left")&&Math.abs((parseFloat(l.paddingLeft)||0)-e)<i&&n.length<t&&n.push({element:o,property:"padding-left"}),!se(o,"padding-right")&&Math.abs((parseFloat(l.paddingRight)||0)-e)<i&&n.length<t&&n.push({element:o,property:"padding-right"}),!se(o,"margin-top")&&Math.abs((parseFloat(l.marginTop)||0)-e)<i&&n.length<t&&n.push({element:o,property:"margin-top"}),!se(o,"margin-bottom")&&Math.abs((parseFloat(l.marginBottom)||0)-e)<i&&n.length<t&&n.push({element:o,property:"margin-bottom"}),!se(o,"margin-left")&&Math.abs((parseFloat(l.marginLeft)||0)-e)<i&&n.length<t&&n.push({element:o,property:"margin-left"}),!se(o,"margin-right")&&Math.abs((parseFloat(l.marginRight)||0)-e)<i&&n.length<t&&n.push({element:o,property:"margin-right"});let d=l.display;if((d.includes("flex")||d.includes("grid"))&&n.length<t){let t=se(o,"gap"),a=parseFloat(l.gap)||0,r=parseFloat(l.rowGap)||0,d=parseFloat(l.columnGap)||0;!t&&Math.abs(a-e)<i?n.push({element:o,property:"gap"}):!se(o,"row-gap")&&Math.abs(r-e)<i?n.push({element:o,property:"row-gap"}):!se(o,"column-gap")&&Math.abs(d-e)<i&&n.push({element:o,property:"column-gap"})}}return n}(n,2*t);return e.property?o.filter(t=>ue(t.property,e.property)).slice(0,t):o.slice(0,t)}function ge(e,t){let n=new Set,o=we(t);for(let t of e){let e=be[t.property];if(!e)continue;let i=t.element.className;if("string"==typeof i)for(let t of e){let e=`${t}-${o}`;for(let t of i.split(/\s+/)){let o=t.lastIndexOf(":"),i=o>=0?t.slice(o+1):t;if(i===e){n.add(i);break}}}}return[...n]}function ye(e){let t=new Set;for(let n of e)for(let[e,o]of Object.entries(pe))if(o.includes(n.property)){t.add(e);break}if(1===t.size)return[...t][0]}function ve(e,t,n){if(t===n)return e;let o=we(t),i=we(n);return e.map(e=>{let n=e.lastIndexOf("-");if(n<0)return e;let a=e.slice(0,n),r=e.slice(n+1);return r===o||r===`[${t}px]`?`${a}-${i}`:e})}var xe={0:"0",1:"px",2:"0.5",4:"1",6:"1.5",8:"2",12:"3",16:"4",20:"5",24:"6",28:"7",32:"8",40:"10",48:"12",64:"16",80:"20",96:"24"};function we(e){return xe[e]??`[${e}px]`}var be={"padding-top":["pt","py","p"],"padding-bottom":["pb","py","p"],"padding-left":["pl","px","p"],"padding-right":["pr","px","p"],"margin-top":["mt","my","m"],"margin-bottom":["mb","my","m"],"margin-left":["ml","mx","m"],"margin-right":["mr","mx","m"],gap:["gap"],"row-gap":["gap-y","gap"],"column-gap":["gap-x","gap"]};function Ie(e,t,n,o){let i=be[t];if(!i)return null;let a=we(n);for(let t of i){let i=new RegExp("(?:^|\\s)((?:[\\w-]+:)*"+t+"-(?:"+Se(a)+"|\\["+n+"px\\]))(?:\\s|$)"),r=e.match(i);if(r?.[1]){let e=we(o),n=r[1].lastIndexOf(":"),i=n>=0?r[1].slice(0,n+1):"";return{matched:r[1],suggested:`${i}${t}-${e}`}}}return null}function Se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Te(e,t,n){let o=new Set,i=[];for(let a of e){let e=l(a.element),r=`${e}::${a.property}`;if(o.has(r))continue;o.add(r);let d=y(a.element),s=a.element.className||"",c=Ie(s,a.property,t,n);i.push({selector:e,reactComponent:d?.name,className:s,property:a.property,matchedClass:c?.matched,suggestedClass:c?.suggested})}return i}function Me(e){let t=e.startsWith("top-");return{top:t?4:12,right:4,bottom:t?12:4,left:4}}function ke({hasCommentEntry:e,stagedChangeCount:t}){return e&&0===t?2:6}function Ee({annotationNumber:e,stickerCount:t,interactionEpisodeStepCount:n,hasStatus:o,hasSend:i,controlGap:a}){let r=16+7.2*Math.max(1,void 0===e?0:String(e).length),l=28*t-2*Math.max(0,t-1),d=n>0?32+7.2*String(n).length:0,s=[t>0?t>0?l+(d>0?d-2:0)+(i?26:0):0:0,0===t?d:0,0===t&&i?28:0,o?28:0].filter(e=>e>0);return r+s.reduce((e,t)=>e+t,0)+s.length*a}function Ae(e,t,n){let o="right"===e.horizontalAlignment?e.left-t:e.left;return{left:o,top:e.top,right:o+t,bottom:e.top+n}}function Ce(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function Re(e,t,n,o,i=0,a=Number.POSITIVE_INFINITY){if(e.height>=o)return{anchor:"top-left",horizontalAlignment:"left",left:e.left+8,top:e.top+8};let r=function(e,t,n){let o=Math.max(0,e.left+t-n);return Math.max(0,t-e.right)<o?"right":"left"}(e,i,a);return e.top>=t+n?{anchor:"right"===r?"top-right":"top-left",horizontalAlignment:r,left:"right"===r?e.right:e.left,top:e.top-t-n}:{anchor:"right"===r?"bottom-right":"bottom-left",horizontalAlignment:r,left:"right"===r?e.right:e.left,top:e.bottom+n}}function Ne(e){return e.left+e.width}function Le(e){return e.top+e.height}function Oe(e,t){if(0===e.length)return t;let n=Math.min(...e.map(e=>e.left)),o=Math.min(...e.map(e=>e.top));return{left:n,top:o,width:Math.max(...e.map(Ne))-n,height:Math.max(...e.map(Le))-o}}function De(e){let t=[...e].sort((e,t)=>e.top-t.top||e.left-t.left),n=[];for(let e of t){let t=e.top+e.height/2,o=n.find(n=>{let o=n.top+n.height/2;return Math.abs(t-o)<=.4*Math.max(n.height,e.height)});if(!o){n.push({...e});continue}let i=Math.min(o.left,e.left),a=Math.min(o.top,e.top),r=Math.max(Ne(o),Ne(e)),l=Math.max(Le(o),Le(e));o.left=i,o.top=a,o.width=r-i,o.height=l-a}return n.sort((e,t)=>e.top-t.top||e.left-t.left)}var $e={topLeft:"0px",topRight:"0px",bottomRight:"0px",bottomLeft:"0px"};function Pe(e,t){return e.radii.topLeft===t.radii.topLeft&&e.radii.topRight===t.radii.topRight&&e.radii.bottomRight===t.radii.bottomRight&&e.radii.bottomLeft===t.radii.bottomLeft&&e.outline===t.outline&&e.fragments.length===t.fragments.length&&e.fragments.every((e,n)=>{let o=t.fragments[n];return!!o&&e.left===o.left&&e.top===o.top&&e.width===o.width&&e.height===o.height})}function _e(e){if(!(e=u(e)??e).isConnected||!M(e.ownerDocument))return{fragments:[],radii:$e};let t=k(S(e),e.ownerDocument);if(I(e.ownerDocument)&&(!t.width||!t.height))return{fragments:[],radii:$e};if("true"===e.getAttribute("data-popmelt-subject-projection"))return{fragments:[{left:t.left,top:t.top,width:t.width,height:t.height}],radii:$e,outline:e.getAttribute("data-popmelt-subject-outline")??void 0};let n=Array.from(e.getClientRects()).map(t=>k(E(t,e.ownerDocument),e.ownerDocument)).filter(e=>e.width>0&&e.height>0).map(e=>({left:e.left,top:e.top,width:e.width,height:e.height}));return{fragments:De(n.length>0?n:[{left:t.left,top:t.top,width:t.width,height:t.height}]),radii:c(e)}}function Fe({element:t,projectedRect:o,isSelected:i=!1,elementInfo:a,color:r="#3b82f6",annotationNumber:l,changeCount:d,hideTooltip:c=!1,hideOutline:p=!1,hideFill:u=!1,fillOpacity:f=.05,subjectRegistry:h,railGap:m=2,railHeight:g=22,railWidth:y=0,renderRail:v,refreshKey:x,outlineZIndex:b=9996,onActivate:S,onRemove:T}){let M=H(oe),[k,E]=B({fragments:[],radii:$e});j(()=>{if(!M)return;if(!t)return void E({fragments:[],radii:$e});let n=null,o=()=>{let e=_e(t);E(t=>Pe(t,e)?t:e)},i=()=>{null===n&&(n=requestAnimationFrame(()=>{n=null,o()}))};o();let a=s(o),r="true"===t.getAttribute("data-popmelt-subject-projection")&&!!h,l=r?h.subscribeFrame(o):void 0,d=r||typeof ResizeObserver>"u"?null:new ResizeObserver(i);d?.observe(t);let c=r?null:new MutationObserver(i);c?.observe(t,{attributes:!0,attributeFilter:["style","class"]});let p=e(o,t.ownerDocument.defaultView??window),u=I(t.ownerDocument)?ne(o):void 0;return()=>{a(),p(),u?.(),l?.(),d?.disconnect(),c?.disconnect(),null!==n&&cancelAnimationFrame(n)}},[M,t,h]),Y(()=>{if(!M||!t||void 0===x)return;let e=_e(t);E(t=>Pe(t,e)?t:e)},[M,t,x]);let{fragments:A,radii:C}=o?{fragments:[o],radii:$e}:k;if(0===A.length||!t&&!o)return null;let R=Oe(A,A[0]),N=t?.tagName.toLowerCase()??"",L=t?.id?`#${t.id}`:"",O=t&&t.classList.length>0?"."+Array.from(t.classList).slice(0,2).join("."):"",D=a?.reactComponent,$=t?.getAttribute("data-popmelt-label")?.trim(),P=t?.getAttribute("data-popmelt-subject-adapter"),_=t?.getAttribute("data-popmelt-subject-label"),F=P&&_?`<${_}>`:$||(D?`<${D}> ${N}${L}${O}`:`${N}${L}${O}`),z=Re({left:R.left,right:R.left+R.width,top:R.top,bottom:R.top+R.height,height:R.height},g,m,window.innerHeight,y,window.innerWidth),W={zIndex:9997,display:"flex",alignItems:"center",gap:6,backgroundColor:r,color:"#fff",fontSize:12,fontFamily:n,lineHeight:"14px",padding:"4px 8px",borderRadius:8,pointerEvents:"none",whiteSpace:"nowrap",maxWidth:400,position:"fixed",top:z.top,left:z.left},K=!c&&Q("div",{ref:e=>{t&&w(t,e)},"data-devtools":"tooltip",style:W,children:[void 0!==l&&Q("span",{children:[l,"."]}),J("span",{style:{overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},children:F}),void 0!==d&&d>0&&Q("span",{style:{opacity:.8},children:["(",d," ",1===d?"change":"changes",")"]})]});return Q(Z,{children:[!p&&A.map((e,t)=>J("div",{"data-devtools":"highlight",onContextMenu:T?e=>{e.preventDefault(),e.stopPropagation(),T()}:void 0,role:S?"button":void 0,tabIndex:S?0:void 0,"aria-label":S?"Open annotation thread":void 0,onPointerDown:S?e=>{e.preventDefault(),e.stopPropagation()}:void 0,onClick:S?e=>{e.preventDefault(),e.stopPropagation(),S()}:void 0,onKeyDown:S?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),e.stopPropagation(),S())}:void 0,style:{position:"fixed",top:e.top,left:e.left,width:e.width,height:e.height,pointerEvents:S||T?"auto":"none",cursor:S?"pointer":void 0,zIndex:b,overflow:"visible"},children:J("div",{style:k.outline?{position:"absolute",inset:0,pointerEvents:"none"}:{position:"absolute",inset:0,boxSizing:"border-box",backgroundColor:u?"transparent":ie(r,f),borderColor:r,borderStyle:i?"solid":"dashed",borderWidth:1,borderTopLeftRadius:C.topLeft,borderTopRightRadius:C.topRight,borderBottomRightRadius:C.bottomRight,borderBottomLeftRadius:C.bottomLeft,pointerEvents:"none"},children:k.outline?J("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",style:{display:"block",overflow:"visible"},"aria-hidden":"true",children:J("polygon",{points:k.outline,fill:u?"transparent":ie(r,f),stroke:r,strokeWidth:1,strokeDasharray:i?void 0:"4 3",vectorEffect:"non-scaling-stroke"})}):null})},`${e.left}:${e.top}:${t}`)),v?v(z,R):K]})}function ze(e=22){return{height:e,minHeight:e,maxHeight:e,boxSizing:"border-box",flexShrink:0}}var We=28;function He({threadId:e,color:n,size:o}){let i=H(t);if(!e||i?.preview?.threadId!==e)return null;let a=i.preview.enabled;return J("button",{type:"button","data-devtools":"explore-preview-badge","aria-label":"Preview option on page","aria-pressed":a,title:a?"Turn off page preview":"Preview option on page",onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onKeyDown:e=>e.stopPropagation(),onClick:t=>{t.preventDefault(),t.stopPropagation(),i.setPreview(t=>t&&t.threadId===e?{...t,enabled:!t.enabled,revealOnPage:!1}:t)},style:{...ze(o),appearance:"none",width:28,minWidth:28,padding:0,margin:0,border:0,display:"grid",placeItems:"center",cursor:"pointer",backgroundColor:n,color:"#fff",borderRadius:8,opacity:a?1:.5},children:J(L,{size:12,strokeWidth:2.25})})}function Be(e){return"bottom-left"===e?[2,8,8,8]:"bottom-right"===e?[8,2,8,8]:"top-right"===e?[8,8,2,8]:[8,8,8,2]}function je(e){return Be(e).map(e=>`${e}px`).join(" ")}var Ye=1.1666666666666667;function Ke(e){return e.length>2048?`${e.slice(0,2048)}…`:e}function qe(e,t,n){return t.flatMap(t=>function(e,t,n){let o=Ke(t);if(!o||e.measureText(o).width<=n)return[o];let i=o.split(/\s+/),a=[],r="";for(let t of i){let o=r?`${r} ${t}`:t;r&&e.measureText(o).width>n?(a.push(r),r=t):r=o}return r&&a.push(r),a.length>0?a:[o]}(e,t,n))}var Xe=n,Ve=16;function Ue(e){let t=window.innerWidth-e-16;return Math.max(60,Math.min(400,t))}function Ge(e,t,n){let o=Ke(t);if(o===t&&e.measureText(o).width<=n)return o;let i="…",a=0,r=o.endsWith(i)?o.length-1:o.length;for(;a<r;){let t=Math.ceil((a+r)/2);e.measureText(o.slice(0,t)+i).width<=n?a=t:r=t-1}return a>0?o.slice(0,a)+i:i}function Qe(e,t,n,o,i){let a=0,r=typeof window<"u"?window.innerHeight:9999;n&&function(e,t,n){if(void 0===e||void 0===t||void 0===n.avoidLeft&&void 0===n.avoidRight)return!0;let o=typeof window<"u"?window.innerWidth:9999,i=n.avoidLeft??0,a=n.avoidRight??o;return e+t>i&&e<a}(o,i,n)&&(a=n.avoidTop??a,r=n.avoidBottom??r);let l=Math.max(a,r-t);return Math.max(a,Math.min(e,l))}function Je(e,t=12,n,o){let i=t*Ye+8,a=e.y-4,r=Qe(a,i,n,e.x-8,o);return r===a?e:{...e,y:r+4}}function Ze(e,t,n,o,i=12,a,r,l,d="#dddddd",s,c=!1){if(!n)return;let p=i*Ye,u=n.replace(/\n/g," "),f=void 0!==a?a+". "+u:u;e.font=`${i}px ${Xe}`,e.textBaseline="middle";let h=void 0!==r?Math.min(400,Math.max(60,window.innerWidth-r-16)):400,m=c?16:0,g=Ge(e,f,Math.max(60,h-m)),y=m+e.measureText(g).width,v=Je(t,i,l,y+16);e.fillStyle=o;let x=v.x-8,w=v.y-4,b=y+16,I=p+8;e.beginPath(),e.roundRect(x,w,b,I,Be(s)),e.fill();let S=v.y+p/2;if(c){let t=v.x,n=S-6;e.strokeStyle=d,e.lineWidth=1.5,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(t+7.5,n+4),e.lineTo(t+10.5,n+6.5),e.lineTo(t+7.5,n+9),e.moveTo(t+1.5,n+1.5),e.lineTo(t+1.5,n+4.5),e.quadraticCurveTo(t+1.5,n+6.5,t+3.5,n+6.5),e.lineTo(t+10.5,n+6.5),e.stroke()}e.fillStyle=d,e.fillText(g,v.x+m,S)}function et(e,t,n){let o=e.filter(e=>!(e.captured||e.selector!==t||e.pathname&&e.pathname!==n));return o.length?{type:"MODIFY_TEXT_CONTENTS",payload:o.map(e=>({...e,modified:e.original}))}:null}function tt(e,t){return"text"===e.type&&(e.groupId?t.filter(t=>t.groupId===e.groupId):[e]).every(e=>"pending"===(e.status??"pending")&&!e.threadId)}var nt=W(0),ot="\n 0%, 100% { translate: 0 0; }\n 20% { translate: -4px 0; }\n 45% { translate: 4px 0; }\n 70% { translate: -2px 0; }\n 88% { translate: 1px 0; }\n";function it(e,t,n,o=.5){let i=Math.max(0,e-2*o),a=Math.max(0,t-2*o),r=function(e,t,n){let o=Math.max(0,n.topLeft),i=Math.max(0,n.topRight),a=Math.max(0,n.bottomRight),r=Math.max(0,n.bottomLeft),l=Math.min(1,e/Math.max(1,o+i),e/Math.max(1,r+a),t/Math.max(1,o+r),t/Math.max(1,i+a));return{topLeft:o*l,topRight:i*l,bottomRight:a*l,bottomLeft:r*l}}(e,t,n),l=Math.max(0,r.topLeft-o),d=Math.max(0,r.topRight-o),s=Math.max(0,r.bottomRight-o),c=Math.max(0,r.bottomLeft-o),p=o+i,u=o+a;return[`M ${o+l} ${o}`,"H "+(p-d),`A ${d} ${d} 0 0 1 ${p} ${o+d}`,"V "+(u-s),`A ${s} ${s} 0 0 1 ${p-s} ${u}`,`H ${o+c}`,`A ${c} ${c} 0 0 1 ${o} ${u-c}`,`V ${o+l}`,`A ${l} ${l} 0 0 1 ${o+l} ${o}`,"Z"].join(" ")}var at=12,rt=8;function lt(e){return e>0?16+7.2*String(e).length+16:0}function dt({stepCount:e,onClear:t,layered:n=!1,submitted:o=!1,style:i}){let[a]=m(),r=g[a];return e<1?null:Q("span",{"data-devtools":"interaction-episode-badge","data-popmelt-submitted":o?"true":void 0,"aria-label":`${e} recorded ${1===e?"action":"actions"}${o?", sent":""}`,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t?.()},style:{height:22,display:"inline-flex",alignItems:"center",boxSizing:"border-box",backgroundColor:o?"#8c8c8c":r.surface,border:`1px solid ${o?"#8c8c8c":r.border}`,borderRadius:8,color:o?"#dddddd":r.primary,fontFamily:Xe,fontSize:12,fontWeight:600,padding:n?`0 8px 0 ${.7*h}px`:"0 8px 0 5.6px",gap:4,pointerEvents:t?"auto":"none",WebkitMaskImage:n?f:void 0,maskImage:n?f:void 0,...i},children:[Q("svg",{"aria-hidden":!0,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[J("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),J("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})]}),J("span",{children:e})]})}function st(e,t,n){return function(e,t,n){if(void 0===n.avoidLeft&&void 0===n.avoidRight)return!0;let o=typeof window<"u"?window.innerWidth:9999,i=n.avoidLeft??0,a=n.avoidRight??o;return e+t>i&&e<a}(t,n,e)?e:{}}function ct(e,t,n){return`translate(min(0px, calc(100vw - ${e} - 100%)), min(max(0px, calc(${void 0!==n.avoidTop?`${n.avoidTop}px`:"0px"} - ${t})), calc(${void 0!==n.avoidBottom?`${n.avoidBottom}px`:"100dvh"} - ${t} - 100%)))`}function pt(e,t,n){if(void 0===n.avoidTop&&void 0===n.avoidBottom)return e;let o=typeof window<"u"?window.innerHeight:9999,i=n.avoidTop??0,a=n.avoidBottom??o,r=Math.max(i,a-t);return Math.max(i,Math.min(e,r))}function ut({left:e,top:t,scrollX:n,scrollY:o,avoidTop:i,avoidBottom:a,style:r,children:l,...d}){return J("div",{"data-devtools":"badge-hit-area",...d,style:{position:"fixed",left:0,top:0,padding:at,...r,transform:`translate3d(${`calc(${e}px - var(--popmelt-scroll-x, ${n}px))`}, ${`calc(${t}px - var(--popmelt-scroll-y, ${o}px))`}, 0)`,willChange:"transform"},children:J("div",{style:{transform:ct(`calc(${e+at}px - var(--popmelt-scroll-x, ${n}px))`,`calc(${t+at}px - var(--popmelt-scroll-y, ${o}px))`,{avoidTop:i,avoidBottom:a})},children:l})})}function ft({bundleCount:e,style:t,layered:n=!1,compact:o=!1,description:i,replacementText:a,onHoverChange:r,onSend:l}){let[d,s]=B(!1),[c]=m(),p=g[c],u=H(nt),y=K(),v=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"⌘":"Ctrl",x=Math.max(1,e),w=o&&!d,b=e=>w?J(F,{size:12,strokeWidth:2,"aria-hidden":!0}):Q(Z,e?{children:[J("span",{style:{color:"inherit",fontWeight:600},children:x>1?`Send all ${x}`:"Send"}),J(F,{size:12,strokeWidth:2,"aria-hidden":!0})]}:{children:[Q("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"inherit",fontWeight:600},children:[J("span",{children:v}),J("span",{children:"+"}),J(z,{size:12,strokeWidth:2,"aria-hidden":!0})]}),J("span",{style:{color:p.secondary,fontWeight:600},children:"to"}),J(F,{size:12,strokeWidth:2,"aria-hidden":!0}),x>1&&J("span",{style:{color:"inherit",fontWeight:600},children:x})]}),I=e=>Q(Z,{children:[J("span",{className:"popmelt-send-hint-desktop",style:{alignItems:"center",gap:4},children:b(e)}),Q("span",{className:"popmelt-send-hint-mobile",style:{alignItems:"center",gap:4},children:[!w&&J("span",{style:{color:"inherit",fontWeight:600},children:"Send"}),J(F,{size:12,strokeWidth:2,"aria-hidden":!0})]})]}),S=a?J("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:a}):null,T={...ze(),lineHeight:"14px",display:"flex",alignItems:"center",boxSizing:"border-box",backgroundColor:p.surface,border:`1px solid ${p.border}`,fontFamily:Xe,fontSize:12,color:p.primary,userSelect:"none",padding:n?`0 8px 0 ${h}px`:"0 8px",gap:4,whiteSpace:"nowrap",borderRadius:8,letterSpacing:"0.24px",WebkitMaskImage:n?f:void 0,maskImage:n?f:void 0},M=x>1?`Send all ${x} pending annotations`:"Send pending annotation";return Q("div",{"data-devtools":"send-hint-hit-area","data-popmelt-send-rejection":u?u%2?"odd":"even":void 0,onMouseEnter:()=>{s(!0),r?.(!0)},onMouseLeave:()=>{s(!1),r?.(!1)},style:{display:"grid",width:"max-content",...t},children:[J("style",{children:`\n@keyframes popmelt-send-rejection-odd { ${ot} }\n@keyframes popmelt-send-rejection-even { ${ot} }\n[data-popmelt-send-rejection="odd"] { animation: popmelt-send-rejection-odd 220ms ease-out; }\n[data-popmelt-send-rejection="even"] { animation: popmelt-send-rejection-even 220ms ease-out; }\n@media (prefers-reduced-motion: reduce) {\n [data-popmelt-send-rejection] { animation: none; }\n}\n.popmelt-send-hint-desktop { display: inline-flex; }\n.popmelt-send-hint-mobile { display: none; }\n@media (max-width: 767px) {\n .popmelt-send-hint-desktop { display: none; }\n .popmelt-send-hint-mobile { display: inline-flex; }\n}\n `}),J("div",{"aria-hidden":!0,style:{...T,gridArea:"1 / 1",visibility:"hidden"},children:I(!1)}),Q("button",{type:"button","data-devtools":"annotation-badge","aria-label":M,"aria-describedby":i?y:void 0,disabled:!l,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),l?.()},style:{...T,gridArea:"1 / 1",justifySelf:"start",maxWidth:a?"min(320px, calc(100vw - 16px))":void 0,overflow:a?"hidden":void 0,appearance:"none",margin:0,opacity:1,cursor:l?"pointer":"default",touchAction:"manipulation"},children:[i&&J("span",{id:y,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:i}),S??I(d)]})]})}function ht({count:e,color:t,size:n=22,onHoverChange:o}){return Q("div",{"data-devtools":"nested-annotation-count-badge",onMouseEnter:()=>o?.(!0),onMouseLeave:()=>o?.(!1),style:{height:n,display:"flex",alignItems:"center",backgroundColor:t,color:"#8c8c8c"===t?"#dddddd":"#ffffff",fontFamily:Xe,fontSize:12,fontWeight:600,lineHeight:1,padding:"0 8px",borderRadius:8,userSelect:"none",whiteSpace:"nowrap"},children:["+",e]})}function mt({annotations:e,supersededAnnotations:n,inFlightIds:o,orientationLabels:i,activeIds:a,queuePositions:r,scrollX:l,scrollY:d,annotationGroupMap:s,onViewThread:c,onSelectAnnotation:p,onDeleteDraftAnnotation:u,onClearInteractionEpisode:f,onHoverAnnotation:h,canvasRef:m,toolbarRef:g,activeBundleAnnotationIds:y,inactiveBundleOpacity:v=.5,animateBundleOpacity:x=!0,hoverRestoredAnnotationIds:w,nestedAnnotationCountById:b,nestedAnnotationIdsById:I,onHoverNestedAnnotations:S,onHoverSendBundle:T,onSend:M,sendHintAnchorId:k,pendingBundleCount:E=1,parentPinnedAnnotationIds:A,parentPinnedLocationLabels:C,parentPinnedTooltipAnnotationId:R,onActivateAnnotation:N,hiddenAnnotationIds:L,displayAnnotations:F}){let z=H(t),W=H(oe),Y=q(null),[K,X]=B(0),V=!!(o&&o.size>0&&(void 0===a||a.size>0));j(()=>{if(!V||!W)return;let e=setInterval(()=>{X(e=>(e+1)%3)},250);return()=>{clearInterval(e)}},[V,W]),j(()=>{if(!W)return;let e=Y.current;if(!e)return;let t=()=>{e.style.setProperty("--popmelt-scroll-x",`${window.scrollX}px`),e.style.setProperty("--popmelt-scroll-y",`${window.scrollY}px`)};return t(),window.addEventListener("scroll",t,{passive:!0,capture:!0}),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}},[W]);let U=[],G=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)?"⌘":"Ctrl";for(let t of e){if("text"!==t.type||!t.text||!t.points[0]||n.has(t)||L?.has(t.id))continue;let r=t.groupId?e.filter(e=>e.groupId===t.groupId):[t],d=t.status??"pending",c=E>0&&t.id===k,p=t.interactionEpisode?.steps.length??0,u=b?.get(t.id)??0,f=I?.get(t.id)??[],h=r.reduce((e,t)=>Math.max(e,t.replyCount??0),0),g="sending"===d||r.some(e=>"sending"===e.status),v="awaiting_review"===d,x=!g&&(!(!o||!o.has(t.id)&&!r.some(e=>o.has(e.id)))||"in_flight"===t.status||r.some(e=>"in_flight"===e.status)),S=r.some(e=>"resolved"===e.status&&(e.replyCount??0)>0||"needs_review"===e.status),T=r.some(e=>e.threadId),M=!y||r.some(e=>y.has(e.id)||w?.has(e.id));if(!(c||g||v||x||"resolved"===d||"failed"===d||"needs_review"===d||S||T||p>0)&&0===u)continue;let C=t.threadId||r.find(e=>e.threadId)?.threadId,R="needs_review"===d||r.some(e=>"needs_review"===e.status),N="waiting_input"===d||r.some(e=>"waiting_input"===e.status),O="failed"===d||r.some(e=>"failed"===e.status),D=c||g||v||x||R||N||O||h>0||"resolved"===d&&T||p>0;if(!D&&0===u)continue;let $=t.points[0],P=t.fontSize||12,_=P*Ye,z=s.get(t.id),W=((F?.find(e=>e.id===t.id)??t).text??t.text).replace(/\n/g," "),H=void 0!==z?z+". "+W:W,B=m?.current?.getContext("2d")??document.createElement("canvas").getContext("2d");if(!B)continue;B.font=`${P}px ${Xe}`;let j=$.x-l,Y=A?.has(t.id)?16:0,K=Ge(B,H,Math.max(60,Ue(j)-Y)),q=B.measureText(K).width,X=x&&!!a&&!a.has(t.id)&&!r.some(e=>a.has(e.id));U.push({id:t.id,threadId:C,linkedSelector:t.linkedSelector||r.find(e=>e.linkedSelector)?.linkedSelector,x:$.x+q+Y+8+2,y:$.y-4,size:_+8,color:c?"#000000":t.color,isSending:g,isAwaitingReview:v,isInFlight:x,orientationLabel:i?.get(t.id)??r.map(e=>i?.get(e.id)).find(Boolean),isQueued:X,queuePosition:void 0,isNeedsReview:R,isQuestion:N,isFailed:O,replyCount:h>0?h:"resolved"===d&&T?1:0,isInActiveBundle:M,isSendHint:c,interactionEpisodeStepCount:p,interactionEpisodeSubmitted:"pending"!==d,nestedCount:u,nestedAnnotationIds:f,nestedColor:"pending"===d?t.color:"#8c8c8c",showActionBadge:D,canDeleteDraft:tt(t,e)})}let ee=U.filter(e=>e.isQueued);if(ee.length>0&&ee.forEach((e,t)=>{e.queuePosition=r?.get(e.id)??`(${t+1}/${ee.length})`}),0===U.length)return null;let te=m?.current?.getContext("2d")??document.createElement("canvas").getContext("2d"),ne=U.map(e=>{te&&(te.font=`12px ${Xe}`);let t=e.nestedCount>0?(te?.measureText(`+${e.nestedCount}`).width??7.2*String(e.nestedCount).length+7.2)+16:0,n=lt(e.interactionEpisodeStepCount),o=e.threadId&&z?.preview?.threadId===e.threadId?30:0;if(!e.showActionBadge)return t+n+o;let i,a=R===e.id?C?.get(e.id):void 0;i=a||(e.isSendHint?G:e.isSending?"Sending":e.isAwaitingReview?"Awaiting review":e.isInFlight?e.isQueued?"Queued"+(e.queuePosition?` ${e.queuePosition}`:""):e.orientationLabel??"Thinking":e.isQuestion?"Question":e.isFailed?"Failed":e.replyCount>0?"Replied":"Needs decision");let r=e.isSendHint||a?0:12,l=7.2*i.length;te&&(l=te.measureText(i).width);let d=e.isSendHint&&te?te.measureText("to").width:e.isSendHint?14.4:0,s=e.isSendHint&&te?te.measureText("+").width:e.isSendHint?7.2:0,c=e.isSendHint&&E>1&&te?te.measureText(String(E)).width:e.isSendHint&&E>1?7.2:0;return n+t+(a?Math.min(l+16,320):e.isSendHint?l+s+d+c+16+12+12+4+4*(E>1?3:2):6+r+4+l+8)+2*(+(n>0)+ +(t>0)+1-1)+o}),ie=function(e){let t=e?.current?.getBoundingClientRect();return!t||typeof window>"u"?{}:t.top<window.innerHeight/2?{avoidTop:t.bottom+8,avoidLeft:t.left-8,avoidRight:t.right+8}:{avoidBottom:t.top-8,avoidLeft:t.left-8,avoidRight:t.right+8}}(g),ae=[];for(let e=0;e<U.length;e++){let t=U[e].y-d,n=U[e].x-l,o=st(ie,n,ne[e]),i=pt(t,U[e].size,o),a=i+U[e].size,r=n;for(let t=0;t<e;t++){let e=U[t].y-d,n=st(ie,ae[t],ne[t]),o=pt(e,U[t].size,n);if(!(i<o+U[t].size&&a>o))continue;let l=ae[t]+ne[t];r<l+2&&(r=l+2)}ae.push(r)}return Q("div",{ref:Y,"data-devtools":"annotation-badge-layer",style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:9999,"--popmelt-scroll-x":`${l}px`,"--popmelt-scroll-y":`${d}px`},children:[J("style",{dangerouslySetInnerHTML:{__html:'\n[data-devtools="annotation-badge-layer"] [data-devtools="annotation-badge"]::selection,\n[data-devtools="annotation-badge-layer"] [data-devtools="annotation-badge"] *::selection {\n background: #000000;\n color: #ffffff;\n}\n'}}),U.map((e,t)=>{let n=!!e.threadId,o=C?.get(e.id),i=!!o&&R===e.id,a=n||!!o,r=!!e.threadId&&z?.preview?.threadId===e.threadId,s=e.showActionBadge&&e.isSendHint||r,m=a&&!s,g=()=>{N?N(e.id,e.threadId):(p?.(e.id),e.threadId&&c?.(e.threadId))},y=st(ie,ae[t],ne[t]);return J(ut,{left:ae[t]+l-at,top:e.y-at,scrollX:l,scrollY:d,avoidTop:y.avoidTop,avoidBottom:y.avoidBottom,onMouseDown:e=>e.stopPropagation(),onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),e.canDeleteDraft&&u&&u(e.id)},onClick:a?e=>{e.stopPropagation(),g()}:void 0,onMouseEnter:()=>{h?.(e.id)},onMouseLeave:()=>{h?.(null)},onFocus:()=>h?.(e.id),onBlur:()=>h?.(null),onKeyDown:m?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),g())}:void 0,role:m?"button":void 0,tabIndex:m?0:void 0,"aria-label":m&&o?`${o}. Activate to reveal the annotation source${n?" and open its thread":""}`:void 0,style:{pointerEvents:"auto",cursor:a?"pointer":void 0,zIndex:9999,minWidth:e.isSendHint?ne[t]:void 0},children:Q("div",{style:{position:"relative",display:"flex",alignItems:"center",gap:2},children:[J(dt,{stepCount:e.interactionEpisodeStepCount,submitted:e.interactionEpisodeSubmitted,onClear:e.canDeleteDraft&&f?()=>f(e.id):void 0}),e.nestedCount>0&&J(ht,{count:e.nestedCount,color:e.nestedColor,size:e.size,onHoverChange:t=>S?.(e.id,t?e.nestedAnnotationIds:null)}),J(He,{threadId:e.threadId,color:e.color,size:e.size}),e.showActionBadge&&(e.isSendHint?J(ft,{bundleCount:E,description:o?`${o}. Activate the annotation label to reveal its source.`:void 0,replacementText:i?o:void 0,onHoverChange:T,onSend:M}):J("div",{"data-devtools":"annotation-badge",style:{...ze(e.size),display:"flex",alignItems:"center",backgroundColor:e.color,fontFamily:Xe,fontSize:12,color:"#ffffff",userSelect:"none",padding:"0 8px 0 6px",gap:4,whiteSpace:"nowrap",maxWidth:i?"min(320px, calc(100vw - 16px))":void 0,overflow:i?"hidden":void 0,borderRadius:8,opacity:e.isInActiveBundle?1:v,transition:x?"opacity 120ms ease-out":"none"},children:i?J("span",{role:"tooltip","data-devtools":"parent-pinned-location-tooltip",style:{overflow:"hidden",textOverflow:"ellipsis"},children:o}):e.isAwaitingReview?Q(Z,{children:[J(O,{size:12,strokeWidth:2.25}),"Awaiting review"]}):e.isQueued?Q("span",{style:{opacity:.6,color:"inherit",display:"inline-flex",alignItems:"center",gap:4},children:[J(O,{size:12,strokeWidth:2.25}),"Queued",e.queuePosition?` ${e.queuePosition}`:""]}):e.isSending||e.isInFlight?Q(Z,{children:["Approval needed"===e.orientationLabel?J(D,{size:12,"aria-label":"Approval needed"}):J("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle",opacity:.6},children:Q(Z,1===K?{children:[J("circle",{cx:"7",cy:"7",r:"2"}),J("circle",{cx:"17",cy:"7",r:"2"}),J("circle",{cx:"7",cy:"17",r:"2"}),J("circle",{cx:"17",cy:"17",r:"2"})]}:{children:[J("circle",{cx:"12",cy:"6",r:"2"}),J("circle",{cx:"6",cy:"12",r:"2"}),J("circle",{cx:"18",cy:"12",r:"2"}),J("circle",{cx:"12",cy:"18",r:"2"})]})}),J("span",{style:{opacity:.6,color:"inherit"},children:e.isSending?"Sending":e.isQueued?"Queued"+(e.queuePosition?` ${e.queuePosition}`:""):e.orientationLabel??"Thinking"})]}):Q(Z,{children:[e.isQuestion?J($,{size:12,strokeWidth:2.25}):e.isFailed?J(P,{size:12,strokeWidth:2.25}):e.replyCount>0?J(_,{size:12,strokeWidth:2.25}):Q("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[J("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9"}),J("path",{d:"M10 21h4"})]}),J("span",{style:{color:"inherit"},children:e.isQuestion?"Question":e.isFailed?"Failed":e.replyCount>0?"Replied":"Needs decision"})]})}))]})},e.id)})]})}function gt({d:e,color:t,animated:n}){let a=q(null);return Y(()=>{let e=a.current;if(!e||"function"!=typeof e.getTotalLength)return;let t=function(e){if(Number.isFinite(e)&&!(e<=0))return Math.max(1,Math.round(e/o))*o}(e.getTotalLength());void 0===t?e.removeAttribute("pathLength"):e.setAttribute("pathLength",String(t))},[e]),J("path",{ref:a,d:e,fill:"none",stroke:t,strokeWidth:1,strokeDasharray:n?i:void 0,"data-popmelt-marching-stroke":n||void 0,style:n?{animation:"popmelt-march 0.6s linear infinite"}:void 0})}function yt(){return J("style",{children:`\n @keyframes popmelt-march {\n from { stroke-dashoffset: 0; }\n to { stroke-dashoffset: -${o}; }\n }\n @media (prefers-reduced-motion: reduce) {\n [data-popmelt-marching-stroke="true"] { animation: none !important; }\n }\n `})}function vt({annotations:e,activeIds:t,scrollX:n,scrollY:o,spotlightIds:i,emphasizedIds:a,hoverRestoredIds:r,inactiveOpacity:l=.5}){if(!H(oe))return null;let d=e.filter(e=>e.region&&e.region.points.length>=3&&t?.has(e.id));return d.length?Q(Z,{children:[J(yt,{}),J("svg",{"data-devtools":"marching-lasso","aria-hidden":!0,style:{position:"fixed",inset:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:9995,overflow:"visible"},children:J("g",{transform:`translate(${-n} ${-o})`,children:d.map(e=>{let t=i?.size?i.has(e.id)?1:.2:!a||a.has(e.id)||r?.has(e.id)?1:l;return J("g",{"data-popmelt-region-id":e.id,opacity:t,children:J(gt,{d:`${e.region.points.map((e,t)=>`${t?"L":"M"}${e.x} ${e.y}`).join(" ")} Z`,color:e.color,animated:!0})},e.id)})})})]}):null}function xt({inFlightSelectorColors:e,animated:t=!0,subjectRegistry:n,selectorElementInfo:o}){let i=H(oe),[a,r]=B([]);return j(()=>{if(!i)return;if(0===e.size)return void r([]);let t=null,a=()=>{let t=[];for(let[n,i]of e){let e=T(n,o?.get(n));if(!e)continue;let a=S(e);t.push({selector:n,top:a.top,left:a.left,width:a.width,height:a.height,color:i,radius:p(e),radiusStyle:c(e)})}r(t)},l=()=>{t&&cancelAnimationFrame(t),t=requestAnimationFrame(a)};a(),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l,!0);let d=new MutationObserver(l);d.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["style","class"]});let s=n?.subscribeFrame(a),u=[...e.keys()].some(e=>e.startsWith("@frame("))?ne(a):void 0;return()=>{window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l,!0),d.disconnect(),s?.(),u?.(),t&&cancelAnimationFrame(t)}},[e,n,o,i]),0===a.length?null:Q(Z,{children:[t&&J(yt,{}),a.map(e=>J("div",{"data-devtools":"marching-ants",style:{position:"fixed",top:e.top,left:e.left,width:e.width,height:e.height,pointerEvents:"none",zIndex:9995,overflow:"visible",borderTopLeftRadius:e.radiusStyle.topLeft,borderTopRightRadius:e.radiusStyle.topRight,borderBottomRightRadius:e.radiusStyle.bottomRight,borderBottomLeftRadius:e.radiusStyle.bottomLeft},children:J("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",overflow:"visible"},children:J(gt,{d:it(e.width,e.height,{topLeft:e.radius["top-left"],topRight:e.radius["top-right"],bottomRight:e.radius["bottom-right"],bottomLeft:e.radius["bottom-left"]}),color:e.color,animated:t})})},e.selector))]})}function wt({element:e,elements:t,registry:n,label:o="Looking",engaged:i=!0,outlineColor:a,inverse:r=!1}){let l=q(0),d=X(()=>t??(e?[e]:[]),[t,e]),[s,c]=B(()=>d.map(e=>({target:e,id:++l.current,animateEntrance:!0,exiting:!1}))),p=V(e=>{c(t=>t.filter(t=>t.id!==e))},[]);return j(()=>{d.length&&c(e=>{let t=e.some(({target:e})=>e.isConnected),n=d.map(n=>e.find(e=>e.target===n&&!e.exiting)??{target:n,id:++l.current,animateEntrance:!t,exiting:!1});return[...e.filter(e=>!e.exiting&&!d.includes(e.target)).map(e=>({...e,exiting:!0})),...n]})},[d]),J(Z,{children:s.map(({target:e,id:t,animateEntrance:l,exiting:s})=>J(bt,{id:t,element:i&&d.includes(e)?e:null,target:e,animateEntrance:l,exiting:s,registry:n,label:o,outlineColor:a,inverse:r,onDone:p},t))})}function bt({id:e,element:t,target:o,animateEntrance:i,exiting:a,registry:r,label:l,outlineColor:d,inverse:s,onDone:c}){let[p]=m(),u=g[p],f=o,[h,y]=B(!1),v=q(Date.now()),[x,w]=B(null);return j(()=>{if(!f)return;let e,t=()=>{let n=b(f);w(e=>n?e?.left===n.left&&e.top===n.top?e:{left:n.left,top:n.top}:null),e=requestAnimationFrame(t)};return t(),()=>cancelAnimationFrame(e)},[f]),j(()=>{let n,o;return a?o=setTimeout(()=>c(e),200):t?(v.current=Date.now(),y(!1)):n=setTimeout(()=>{y(!0),o=setTimeout(()=>c(e),300)},Math.max(0,v.current+1700-Date.now())),()=>{clearTimeout(n),clearTimeout(o)}},[t,a,e,c]),f?.isConnected?Q(Z,{children:[J("style",{children:'\n @keyframes popmelt-looking-in-left { from { opacity: 0; transform: translateX(26px); clip-path: inset(0 100% 0 0); } to { opacity: 1; transform: translateX(0); clip-path: inset(0); } }\n @keyframes popmelt-looking-out-left { from { opacity: 1; } to { opacity: 0; } }\n @keyframes popmelt-looking-in-up { from { opacity: 0; transform: translateY(26px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: translateY(0); clip-path: inset(0); } }\n @keyframes popmelt-looking-in-alone-up-left { from { opacity: 0; transform: translate(8px, 8px); } to { opacity: 1; transform: translate(0, 0); } }\n @keyframes popmelt-looking-in-alone-down-left { from { opacity: 0; transform: translate(8px, -8px); } to { opacity: 1; transform: translate(0, 0); } }\n @keyframes popmelt-looking-in-alone-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }\n @keyframes popmelt-looking-in-alone-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }\n @keyframes popmelt-looking-out-up { from { opacity: 1; } to { opacity: 0; } }\n @keyframes popmelt-looking-fade-in { from { opacity: 0; } to { opacity: 1; } }\n @keyframes popmelt-looking-fade-out { from { opacity: 1; } to { opacity: 0; } }\n @keyframes popmelt-looking-blink { 0%, 40%, 72.5%, 100% { transform: scaleY(1); } 50%, 62.5% { transform: scaleY(0.1); } }\n .popmelt-looking-eye { animation: popmelt-looking-blink 1000ms 200ms both; transform-origin: center; }\n @media (prefers-reduced-motion: reduce) {\n [data-devtools="focus-inspection"], .popmelt-looking-eye { animation: none !important; }\n [data-popmelt-looking-exiting] { opacity: 0 !important; }\n }\n '}),J(Fe,{element:f,subjectRegistry:r,hideOutline:!d||h||a,color:d,outlineZIndex:d?10002:void 0,hideFill:!0,hideTooltip:!0,railHeight:22,renderRail:(e,t)=>{let o=x??e,r=o.left>=28,d=!x&&e.anchor.startsWith("bottom-"),c=x?r?"left":"up":`${d?"down":"up"}${r?"-left":""}`,p=x&&!r?Math.max(4,o.top-22-2):o.top,m=r?o.left-22-2:o.left,g=t.left+t.width/2>=m+11,y=t.top+t.height/2>=p+11?g?"borderBottomRightRadius":"borderBottomLeftRadius":g?"borderTopRightRadius":"borderTopLeftRadius";return J("div",{"data-devtools":"focus-inspection","data-popmelt-looking-exiting":a?"true":void 0,"data-popmelt-canvas-block":!0,role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"aria-label":l,title:l,style:{position:"fixed",animation:a?"popmelt-looking-fade-out 200ms ease both":h||i?`popmelt-looking-${h?"out":x?"in":"in-alone"}-${h?r?"left":"up":c} ${h?300:200}ms ease both`:"popmelt-looking-fade-in 200ms ease both",left:m,top:p,height:22,width:22,boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:s?u.actionSurface:u.surface,color:s?u.actionForeground:u.primary,border:`1px solid ${s?u.actionHover:u.border}`,borderTopLeftRadius:8,borderTopRightRadius:8,borderBottomLeftRadius:8,borderBottomRightRadius:8,...x?{}:{[y]:2},fontFamily:n,fontSize:12,letterSpacing:"0.24px",whiteSpace:"nowrap",pointerEvents:a?"none":"auto",zIndex:f.hasAttribute("data-popmelt-thread-header")?10006:10002},children:J(L,{className:i&&!a?"popmelt-looking-eye":void 0,size:12,"aria-hidden":!0})})}})]}):null}var It={toolbar:{toggleKey:["Meta","Control"],toggleTaps:2,toggleWindowMs:300},tools:{imprint:{key:"i",tool:"model"},steer:{key:"s",tool:"sticker"},comment:{key:"c",tool:"inspector"}},actions:{send:{key:"Enter",commandOrControl:!0},screenshot:{key:"c",commandOrControl:!0},clear:{keys:["Backspace","Delete"],commandOrControl:!0},undo:{key:"z",commandOrControl:!0},redo:{key:"z",commandOrControl:!0,shift:!0}},omnidial:{previous:["a","ArrowLeft"],next:["d","ArrowRight"],previousFacet:["q"],nextFacet:["e"],descendOrApply:["w","Enter"],ascend:["s","Escape"],query:[" "]}},St=[{type:"model",label:"Imprint",shortcut:"I"},{type:"sticker",label:"Steer",shortcut:"S"},{type:"inspector",label:"Chat",shortcut:"C"}];function Tt(e){let t=e.toLowerCase();return Object.values(It.tools).find(e=>e.key===t)?.tool??null}function Mt(e){let t=1===e.length?e.toLowerCase():e,n=It.omnidial;return[...n.previous,...n.next,...n.previousFacet,...n.nextFacet,...n.descendOrApply,...n.ascend,...n.query].includes(t)||/^[a-z0-9]$/i.test(e)}var kt=W(null),Et=()=>()=>{},At=()=>null;function Ct(){return Math.random().toString(36).substring(2,9)}function Rt(e){return"text"===e.type&&"lasso"===e.region?.kind&&(e={...e,fontSize:12,linkedAnchor:e.linkedAnchor??"bottom-left"}),e.status?e:e.captured?{...e,status:"in_flight"}:{...e,status:"pending"}}function Nt(e){return{annotations:e.annotations,styleModifications:e.styleModifications,textModifications:e.textModifications,domModifications:e.domModifications,spacingTokenChanges:e.spacingTokenChanges,spacingTokenMods:e.spacingTokenMods}}function Lt(e){return{...e,undoStack:[...e.undoStack,Nt(e)],redoStack:[]}}function Ot(e,t,n,o){return e.selector===t&&(!e.pathname||e.pathname===o)&&e.textNodePath.length===n.length&&e.textNodePath.every((e,t)=>e===n[t])}function Dt(e,t,n=!0){let{selector:o,durableSelector:i,element:a,textNodePath:r,original:l,modified:d}=t,s=typeof window<"u"?window.location.pathname:"/",c=e.textModifications.findIndex(e=>Ot(e,o,r,s));if(l===d&&c<0)return e;if(c>=0){let t=e.textModifications[c],o=t.captured&&n?Lt(e):e,r=t.captured?l:t.original;return d===r?{...o,textModifications:o.textModifications.filter((e,t)=>t!==c)}:{...o,textModifications:o.textModifications.map((e,t)=>t===c?{...e,durableSelector:i,element:a,original:r,modified:d,createdAt:e.createdAt??Date.now(),captured:!1,pathname:s}:e)}}let p=n?Lt(e):e;return{...p,textModifications:[...p.textModifications,{selector:o,durableSelector:i,element:a,textNodePath:r,original:l,modified:d,createdAt:Date.now(),pathname:s}]}}function $t(e,t){switch(t.type){case"SET_ANNOTATING":return function(e,t){return{...e,isAnnotating:t}}(e,t.payload);case"SET_TOOL":return function(e,t){return{...e,activeTool:t}}(e,t.payload);case"SET_COLOR":return function(e,t){return{...e,activeColor:t}}(e,t.payload);case"SET_STROKE_WIDTH":return function(e,t){return{...e,strokeWidth:t}}(e,t.payload);case"ADD_TEXT":return function(e,t){let n={id:t.id??Ct(),type:"text",points:[t.point],text:t.text,fontSize:t.fontSize||12,color:e.activeColor,strokeWidth:e.strokeWidth,timestamp:Date.now(),status:"pending",pathname:typeof window<"u"?window.location.pathname:"/",groupId:t.groupId,linkedSelector:t.linkedSelector,target:t.target,linkedAnchor:t.linkedAnchor,elements:t.elements,...t.region?{region:t.region}:{},...t.imageCount?{imageCount:t.imageCount}:{},...t.attachments?.length?{attachments:t.attachments}:{},...t.interactionEpisode?{interactionEpisode:t.interactionEpisode}:{}};return{...t.groupId?e:Lt(e),annotations:[...e.annotations,n]}}(e,t.payload);case"UPDATE_TEXT":return function(e,t){return{...Lt(e),annotations:e.annotations.map(e=>e.id===t.id?{...e,text:t.text,...null!=t.imageCount?{imageCount:t.imageCount}:{},...t.attachments?{attachments:t.attachments}:{},...t.interactionEpisode?{interactionEpisode:t.interactionEpisode}:{}}:e)}}(e,t.payload);case"CLEAR_INTERACTION_EPISODE":return function(e,t){return{...Lt(e),annotations:e.annotations.map(e=>{if(e.id!==t.id)return e;let n=e.interactionEpisode?.frames?.length??0,{interactionEpisode:o,...i}=e;if(0===n)return i;let a=Math.max(0,(e.imageCount??0)-n);if(0===a){let{imageCount:e,...t}=i;return t}return{...i,imageCount:a}})}}(e,t.payload);case"DELETE_ANNOTATION":return function(e,t){let n=Lt(e),o=e.annotations.find(e=>e.id===t.id)?.groupId,i=new Set(e.annotations.filter(e=>e.id===t.id||o&&e.groupId===o).map(e=>e.id));return{...n,annotations:e.annotations.filter(e=>e.id!==t.id&&!(o&&e.groupId===o)),selectedAnnotationIds:e.selectedAnnotationIds.filter(e=>!i.has(e)),lastSelectedId:e.lastSelectedId&&i.has(e.lastSelectedId)?null:e.lastSelectedId}}(e,t.payload);case"MOVE_ANNOTATION":return function(e,t){let n=t.saveUndo?Lt(e):e,o=e.annotations.find(e=>e.id===t.id)?.groupId;return{...n,annotations:e.annotations.map(e=>{if(!(e.id===t.id||o&&e.groupId===o))return e;let n=t.delta.x,i=t.delta.y;return{...e,points:e.points.map(e=>({x:e.x+n,y:e.y+i}))}})}}(e,t.payload);case"RESIZE_ANNOTATION":return function(e,t){let n=t.saveUndo?Lt(e):e,o=e.annotations.find(e=>e.id===t.id);if(!o||"text"===o.type||o.points.length<2)return e;let i=0,a=0;if("rectangle"===o.type&&o.groupId){let e=t.points,n=Math.min(e[0].x,e[1].x),r=Math.max(e[0].y,e[1].y),l=o.points[0],d=o.points[o.points.length-1],s=Math.min(l.x,d.x),c=Math.max(l.y,d.y);i=n-s,a=r-c}return{...n,annotations:e.annotations.map(e=>e.id===t.id?{...e,points:t.points}:o.groupId&&e.groupId===o.groupId&&"text"===e.type?{...e,points:e.points.map(e=>({x:e.x+i,y:e.y+a}))}:e)}}(e,t.payload);case"PASTE_ANNOTATIONS":return function(e,t){return{...Lt(e),annotations:[...e.annotations,...t.annotations.map(Rt)]}}(e,t.payload);case"RESTORE_ANNOTATIONS":return function(e,t){let n=new Set,o=[];for(let e of t.annotations)n.has(e.id)||(n.add(e.id),o.push(Rt(e)));return{...e,annotations:o}}(e,t.payload);case"SYNC_ANNOTATIONS":return function(e,t){let n=new Map(e.annotations.map(e=>[e.id,e])),o=t.annotations.map(e=>{let t=Rt(e),o=n.get(t.id);return o&&t.linkedSelector&&o.linkedSelector===t.linkedSelector?{...t,points:o.points,linkedAnchor:o.linkedAnchor}:t});return{...e,annotations:o}}(e,t.payload);case"MERGE_ANNOTATIONS":return function(e,t){let n=new Set(e.annotations.map(e=>e.id)),o=t.annotations.filter(e=>!n.has(e.id)).map(Rt);return o.length>0?{...e,annotations:[...e.annotations,...o]}:e}(e,t.payload);case"UNDO":return function(e){if(0===e.undoStack.length)return e;let t=e.undoStack[e.undoStack.length-1];return{...e,annotations:t?.annotations||[],styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],undoStack:e.undoStack.slice(0,-1),redoStack:[...e.redoStack,Nt(e)]}}(e);case"REDO":return function(e){if(0===e.redoStack.length)return e;let t=e.redoStack[e.redoStack.length-1];return{...e,annotations:t?.annotations||[],styleModifications:t?.styleModifications||[],textModifications:t?.textModifications||[],domModifications:t?.domModifications||[],spacingTokenChanges:t?.spacingTokenChanges||[],spacingTokenMods:t?.spacingTokenMods||[],redoStack:e.redoStack.slice(0,-1),undoStack:[...e.undoStack,Nt(e)]}}(e);case"SELECT_ANNOTATION":return function(e,t){let{id:n,addToSelection:o}=t;if(null===n)return{...e,selectedAnnotationIds:[],lastSelectedId:null};if(o){if(e.selectedAnnotationIds.includes(n)){let t=e.selectedAnnotationIds.filter(e=>e!==n);return{...e,selectedAnnotationIds:t,lastSelectedId:t.length>0?t[t.length-1]:null}}return{...e,selectedAnnotationIds:[...e.selectedAnnotationIds,n],lastSelectedId:n}}return{...e,selectedAnnotationIds:[n],lastSelectedId:n}}(e,t.payload);case"UPDATE_ANNOTATION_COLOR":return function(e,t){let n=e.annotations.find(e=>e.id===t.id)?.groupId,o=new Set;for(let t of e.selectedAnnotationIds){let n=e.annotations.find(e=>e.id===t);n?.groupId&&o.add(n.groupId)}return{...e,annotations:e.annotations.map(i=>i.id===t.id||e.selectedAnnotationIds.includes(i.id)||i.groupId&&(i.groupId===n||o.has(i.groupId))?{...i,color:t.color}:i)}}(e,t.payload);case"MARK_CAPTURED":return function(e,t,n){let o=typeof window<"u"?window.location.pathname:"/",i=t?new Set(t):void 0,a=n??e.textModifications.filter(e=>!e.pathname||e.pathname===o),r=e=>e.filter(e=>!a.some(t=>e.pathname===t.pathname&&Ot(e,t.selector,t.textNodePath,t.pathname??"")&&e.createdAt===t.createdAt&&e.original===t.original&&e.modified===t.modified)),l=e=>({...e,textModifications:r(e.textModifications)});return{...e,undoStack:e.undoStack.map(l),redoStack:e.redoStack.map(l),annotations:e.annotations.map(e=>i&&!i.has(e.id)?e:{...e,captured:!0,status:"pending"!==e.status&&"sending"!==e.status&&e.status?e.status:"in_flight"}),styleModifications:e.styleModifications.map(e=>e.pathname&&e.pathname!==o?e:{...e,captured:!0}),textModifications:r(e.textModifications),domModifications:e.domModifications.map(e=>e.pathname&&e.pathname!==o?e:{...e,captured:!0}),spacingTokenChanges:e.spacingTokenChanges.map(e=>({...e,captured:!0})),spacingTokenMods:e.spacingTokenMods.map(e=>({...e,captured:!0}))}}(e,t.payload?.annotationIds,t.payload?.textModifications);case"CLEAR":return function(e){return{...e,annotations:[],undoStack:[],redoStack:[],selectedAnnotationIds:[],lastSelectedId:null,textModifications:[],domModifications:[],spacingTokenChanges:[],spacingTokenMods:[]}}(e);case"DISCARD_DRAFT":return function(e){return e.annotations.some(e=>"pending"===(e.status??"pending"))||e.styleModifications.some(e=>!e.captured)||e.textModifications.some(e=>!e.captured)||e.domModifications.some(e=>!e.captured)||e.spacingTokenChanges.some(e=>!e.captured)||e.spacingTokenMods.some(e=>!e.captured)?{...Lt(e),annotations:e.annotations.filter(e=>"pending"!==(e.status??"pending")),styleModifications:e.styleModifications.filter(e=>e.captured),textModifications:e.textModifications.filter(e=>e.captured),domModifications:e.domModifications.filter(e=>e.captured),spacingTokenChanges:e.spacingTokenChanges.filter(e=>e.captured),spacingTokenMods:e.spacingTokenMods.filter(e=>e.captured),selectedAnnotationIds:[],lastSelectedId:null}:e}(e);case"MODIFY_STYLE":return function(e,t){let{selector:n,element:o,property:i,original:a,modified:r}=t,l=typeof window<"u"?window.location.pathname:"/",d=e.styleModifications.findIndex(e=>e.selector===n&&(!e.pathname||e.pathname===l));if(a===r&&d<0)return e;if(d>=0){let t=e.styleModifications[d];if(t.captured){let t=Lt(e),n=t.styleModifications.map((e,t)=>t===d?{...e,changes:[{property:i,original:a,modified:r}],createdAt:e.createdAt??Date.now(),captured:!1,pathname:l}:e);return{...t,styleModifications:n}}let n,o=t.changes.findIndex(e=>e.property===i),s=e;if(o>=0){let e=t.changes[o];n=r===e.original?t.changes.filter((e,t)=>t!==o):t.changes.map((e,t)=>t===o?{...e,modified:r}:e)}else{if(a===r)return e;s=Lt(e),n=[...t.changes,{property:i,original:a,modified:r}]}if(0===n.length)return{...s,styleModifications:s.styleModifications.filter((e,t)=>t!==d)};let c=s.styleModifications.map((e,t)=>t===d?{...e,changes:n,createdAt:e.createdAt??Date.now()}:e);return{...s,styleModifications:c}}{let t=Lt(e),d={selector:n,element:o,changes:[{property:i,original:a,modified:r}],createdAt:Date.now(),pathname:l};return{...t,styleModifications:[...t.styleModifications,d]}}}(e,t.payload);case"MODIFY_STYLES_BATCH":return function(e,t){let{selector:n,durableSelector:o,element:i,changes:a}=t,r=typeof window<"u"?window.location.pathname:"/",l=a.filter(e=>e.original!==e.modified);if(0===l.length)return e;let d=Lt(e),s=d.styleModifications.findIndex(e=>e.selector===n&&(!e.pathname||e.pathname===r));if(s>=0){let e=d.styleModifications[s],t=e.captured?[]:[...e.changes];for(let e of l){let n=t.findIndex(t=>t.property===e.property);n>=0?t=e.modified===t[n].original?t.filter((e,t)=>t!==n):t.map((t,o)=>o===n?{...t,modified:e.modified,token:e.token,sticker:e.sticker}:t):t.push(e)}return 0===t.length?{...d,styleModifications:d.styleModifications.filter((e,t)=>t!==s)}:{...d,styleModifications:d.styleModifications.map((e,n)=>n===s?{...e,changes:t,createdAt:e.createdAt??Date.now(),captured:!1,pathname:r}:e)}}return{...d,styleModifications:[...d.styleModifications,{selector:n,durableSelector:o,element:i,changes:l,createdAt:Date.now(),pathname:r}]}}(e,t.payload);case"CLEAR_STYLE":return function(e,t){let{selector:n,property:o}=t,i=typeof window<"u"?window.location.pathname:"/",a=Lt(e),r=a.styleModifications.map(e=>e.selector!==n||e.pathname&&e.pathname!==i?e:{...e,changes:e.changes.filter(e=>e.property!==o)}).filter(e=>e.changes.length>0);return{...a,styleModifications:r}}(e,t.payload);case"CLEAR_STICKER":return function(e,t){let{selector:n,sticker:o}=t,i=typeof window<"u"?window.location.pathname:"/";if(!e.styleModifications.find(e=>e.selector===n&&(!e.pathname||e.pathname===i)&&!e.captured&&e.changes.some(e=>e.sticker?.family===o.family&&e.sticker.subproperty===o.subproperty)))return e;let a=Lt(e),r=a.styleModifications.map(e=>e.selector!==n||e.pathname&&e.pathname!==i||e.captured?e:{...e,changes:e.changes.filter(e=>e.sticker?.family!==o.family||e.sticker.subproperty!==o.subproperty)}).filter(e=>e.changes.length>0);return{...a,styleModifications:r}}(e,t.payload);case"CLEAR_ALL_STYLES":return function(e){return 0===e.styleModifications.length?e:{...Lt(e),styleModifications:[]}}(e);case"SETTLE_CAPTURED_STYLES":return function(e,t){let n=new Set(t.selectors);if(0===n.size)return e;let o=e.styleModifications.filter(e=>!(e.captured&&(n.has(e.selector)||e.durableSelector&&n.has(e.durableSelector))));return o.length===e.styleModifications.length?e:{...e,styleModifications:o}}(e,t.payload);case"RESTORE_STYLE_MODIFICATIONS":return function(e,t){let n=Date.now();return{...e,styleModifications:t.map((e,t)=>({...e,createdAt:e.createdAt??n+t}))}}(e,t.payload);case"MODIFY_TEXT_CONTENT":return Dt(e,t.payload);case"MODIFY_TEXT_CONTENTS":return function(e,t,n=!0){return 0===t.length?e:t.reduce((e,t)=>Dt(e,t,!1),n?Lt(e):e)}(e,t.payload,t.saveUndo??!0);case"RESTORE_TEXT_MODIFICATIONS":return function(e,t){let n=Date.now();return{...e,textModifications:t.filter(e=>!e.captured).map((e,t)=>({...e,createdAt:e.createdAt??n+t}))}}(e,t.payload);case"MODIFY_DOM_STRUCTURE":return function(e,t){let n=Lt(e),o=n.domModifications.findIndex(e=>e.id===t.id);return o>=0?{...n,domModifications:n.domModifications.map((e,n)=>n===o?{...t,captured:!1}:e)}:{...n,domModifications:[...n.domModifications,t]}}(e,t.payload);case"RESTORE_DOM_MODIFICATIONS":return function(e,t){return{...e,domModifications:t}}(e,t.payload);case"UPDATE_LINKED_POSITIONS":return function(e,t){let{updates:n}=t,o=new Map(n.map(e=>[e.id,e]));return{...e,annotations:e.annotations.map(e=>{let t=o.get(e.id);return t?{...e,points:[t.point,...e.points.slice(1)],...t.linkedAnchor?{linkedAnchor:t.linkedAnchor}:{}}:e})}}(e,t.payload);case"CLEANUP_ORPHANED":return function(e,t){let{linkedSelectors:n,styleSelectors:o}=t,i=new Set(n),a=new Set(o),r=typeof window<"u"?window.location.pathname:"/",l=new Set,d=new Set;for(let t of e.annotations)t.linkedSelector&&i.has(t.linkedSelector)&&(l.add(t.id),t.groupId&&d.add(t.groupId));for(let t of e.annotations)t.groupId&&d.has(t.groupId)&&l.add(t.id);let s=e.annotations.filter(e=>!l.has(e.id)),c=e.styleModifications.filter(e=>!a.has(e.selector)||e.pathname&&e.pathname!==r),p=e.domModifications.filter(e=>!a.has(e.selector)||e.pathname&&e.pathname!==r);if(s.length===e.annotations.length&&c.length===e.styleModifications.length&&p.length===e.domModifications.length)return e;let u=e.selectedAnnotationIds.filter(e=>!l.has(e));return{...e,annotations:s,styleModifications:c,domModifications:p,selectedAnnotationIds:u,lastSelectedId:u.length>0?u[u.length-1]:null}}(e,t.payload);case"SET_ANNOTATION_STATUS":return function(e,t){let n=new Set(t.ids);return{...e,annotations:e.annotations.map(e=>n.has(e.id)?{...e,status:t.status}:e)}}(e,t.payload);case"MARK_ANNOTATIONS_REPLIED":return function(e,t){let n=new Set(t.ids),o=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&o.add(t.groupId);return{...e,annotations:e.annotations.map(e=>{if(!(n.has(e.id)||e.groupId&&o.has(e.groupId)))return e;let i=!!t.jobId&&e.replyJobIds?.includes(t.jobId),a="waiting_input"===e.status;return{...e,status:a?"waiting_input":"resolved",replyCount:(e.replyCount??0)+(i?0:1),replyJobIds:t.jobId&&!i?[...e.replyJobIds??[],t.jobId]:e.replyJobIds,threadId:e.threadId||t.threadId,question:a?e.question:void 0}})}}(e,t.payload);case"MARK_ANNOTATIONS_FAILED":return function(e,t){let n=new Set(t.ids),o=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&o.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&o.has(e.groupId)?{...e,status:"failed",threadId:e.threadId||t.threadId,question:void 0}:e)}}(e,t.payload);case"SET_ANNOTATION_THREAD":return function(e,t){let n=new Set(t.ids),o=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&o.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&o.has(e.groupId)?{...e,threadId:t.threadId,targetBindingId:t.targetBindingId}:e)}}(e,t.payload);case"SET_ANNOTATION_QUESTION":return function(e,t){let n=new Set(t.ids),o=new Set;for(let t of e.annotations)n.has(t.id)&&t.groupId&&o.add(t.groupId);return{...e,annotations:e.annotations.map(e=>n.has(e.id)||e.groupId&&o.has(e.groupId)?{...e,status:"waiting_input",question:t.question,threadId:t.threadId}:e)}}(e,t.payload);case"APPLY_RESOLUTIONS":return function(e,t){let n=new Map(t.resolutions.map(e=>[e.annotationId,e])),o=new Map;for(let t of e.annotations){let e=n.get(t.id);e&&t.groupId&&o.set(t.groupId,e)}return{...e,annotations:e.annotations.map(e=>{let i=n.get(e.id)||(e.groupId?o.get(e.groupId):void 0);if(!i)return e;let a=!!t.jobId&&e.replyJobIds?.includes(t.jobId);return{...e,status:i.status,resolutionSummary:i.summary,scope:i.finalScope??i.inferredScope??null,replyCount:(e.replyCount??0)+(a?0:1),replyJobIds:t.jobId&&!a?[...e.replyJobIds??[],t.jobId]:e.replyJobIds,question:void 0,threadId:e.threadId||t.threadId}})}}(e,t.payload);case"ADD_SPACING_TOKEN_CHANGE":return function(e,t){let n=e.spacingTokenChanges.findIndex(e=>e.tokenPath===t.tokenPath);return n>=0?{...e,spacingTokenChanges:e.spacingTokenChanges.map((e,o)=>o===n?t:e)}:{...e,spacingTokenChanges:[...e.spacingTokenChanges,t]}}(e,t.payload);case"RESTORE_SPACING_TOKEN_CHANGES":return function(e,t){return{...e,spacingTokenChanges:t}}(e,t.payload);case"MODIFY_SPACING_TOKEN":return function(e,t){let n,o=Lt(e),i=e.spacingTokenMods.findIndex(e=>e.tokenPath===t.tokenPath);if(i>=0){let o=e.spacingTokenMods[i],a={...t,originalValue:o.captured?o.currentValue:o.originalValue,originalPx:o.captured?o.currentPx:o.originalPx,captured:!1};n=e.spacingTokenMods.map((e,t)=>t===i?a:e)}else n=[...e.spacingTokenMods,{...t,captured:!1}];return{...o,spacingTokenMods:n}}(e,t.payload);case"DELETE_SPACING_TOKEN":return function(e,t){let n,o=Lt(e),i=e.spacingTokenMods.findIndex(e=>e.tokenPath===t.tokenPath),a=i>=0?e.spacingTokenMods[i]:null,r=i>=0?a.captured?a.currentValue:a.originalValue:t.originalValue,l=i>=0?a.captured?a.currentPx:a.originalPx:parseFloat(t.originalValue)||0,d={tokenPath:t.tokenPath,originalValue:r,currentValue:"__deleted__",targets:a?.targets??[],originalPx:l,currentPx:0,captured:!1};return n=i>=0?e.spacingTokenMods.map((e,t)=>t===i?d:e):[...e.spacingTokenMods,d],{...o,spacingTokenMods:n}}(e,t.payload);default:return t}}function Pt(e,t){let n=H(kt),[o,i]=U($t,a),r=G(n?.subscribe??Et,n?.getSnapshot??At,n?.getSnapshot??At)??o,l=n?.dispatch??i;j(()=>{if(!r.isAnnotating)return;let n=n=>{t?.current||n.defaultPrevented||n.isComposing||n.altKey||n.composedPath().some(e=>e instanceof Element&&(e.matches('input, textarea, select, [role="textbox"]')||e instanceof HTMLElement&&e.isContentEditable||e.hasAttribute("contenteditable")&&"false"!==e.getAttribute("contenteditable")))||(n.metaKey||n.ctrlKey)&&n.key.toLowerCase()===It.actions.undo.key&&(n.preventDefault(),n.shiftKey?l({type:"REDO"}):e?.current?.()||l({type:"UNDO"}))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[l,r.isAnnotating,e,t]);let d=n?.getUndoHead?n.getUndoHead():r.undoStack.at(-1);return[r,l,d]}function _t(e){return!!e&&!!e.closest("#devtools-toolbar, #devtools-scrim, #devtools-text-input, [data-devtools], [data-popmelt-panel], [data-popmelt-shadow-host]")}function Ft(e,t,n,o=!1){return function(e,t){if(!e)return t();let n=e.style.pointerEvents;e.style.pointerEvents="none";try{return t()}finally{e.style.pointerEvents=n}}(n,()=>{let n=r(e,t);if(!n||_t(n))return null;let i=n?.ownerDocument??document,a=R(e,t,i),l=function(e,t,n=document){let o=n,i=o.caretPositionFromPoint?.(e,t);if(i?.offsetNode?.nodeType===Node.TEXT_NODE)return i.offsetNode;let a=o.caretRangeFromPoint?.(e,t);return a?.startContainer?.nodeType===Node.TEXT_NODE?a.startContainer:null}(a.x,a.y,i);if(l&&!n.contains(l)&&(l=null),!l){let e=n;e&&!_t(e)&&(l=function(e,t,n){let o=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:e=>e.textContent?.trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),i=o.nextNode();for(;i;){let a=i,r=e.ownerDocument.createRange();r.selectNodeContents(a);let l=Array.from(r.getClientRects());if(r.detach?.(),l.some(e=>t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom))return a;i=o.nextNode()}return null}(e,a.x,a.y))}if(!l||!N(l.parentElement))return null;let d=l.parentElement;if(_t(d))return null;for(;!o&&d.parentElement&&d!==i.body;){let e=A(d).getComputedStyle(d).display,t="inline-block"===e&&1===d.childNodes.length&&d.firstChild?.nodeType===Node.ELEMENT_NODE;if("inline"!==e&&"contents"!==e&&!t)break;let n=d.parentElement;if(_t(n))break;if(Array.from(n.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&!!e.nodeValue?.trim())){d=n;continue}let o=A(n).getComputedStyle(n).display,i="inline-block"===o&&1===n.childNodes.length&&n.firstChild?.nodeType===Node.ELEMENT_NODE;if("inline"!==o&&"contents"!==o&&!i)break;d=n}let s=d.tagName.toLowerCase();if("script"===s||"style"===s||"textarea"===s||"input"===s)return null;let c=function(e){let t=[],n=o=>{if(o.nodeType===Node.TEXT_NODE){let n=o,i=zt(e,n);return void(i&&t.push({textNode:n,textNodePath:i,originalText:n.nodeValue??""}))}if(o.nodeType!==Node.ELEMENT_NODE&&o!==e)return;let i=o.tagName?.toLowerCase();"script"===i||"style"===i||o.childNodes.forEach(n)};return e.childNodes.forEach(n),t}(d).filter(e=>!o||e.textNode===l),p=c.map(e=>e.originalText).join("");if(!p.trim())return null;let u=zt(d,l);if(!u)return null;let f=A(d).getComputedStyle(d),h=Bt(c,d,f,o),{textRect:m,boundaryRect:g,boundaryRects:y,flowRect:v,firstLineIndent:x}=h;if(m.width<=0||m.height<=0)return null;let w=parseFloat(f.fontSize)||12,b="nowrap"!==f.whiteSpace&&"pre"!==f.whiteSpace&&(o?y.length>1:function(e){let t=e.ownerDocument.createRange();t.selectNodeContents(e);let n=Array.from(t.getClientRects()).filter(e=>e.width>0&&e.height>0).length;return t.detach?.(),n>1}(l)||"inline"!==f.display);return{textNode:l,targetElement:d,textNodePath:u,segments:c,originalText:p,rect:m,boundaryRect:g,boundaryRects:y,flowRect:v,firstLineIndent:x,styles:f,fontSize:w,wrapsText:b,singleTextNode:o}})}function zt(e,t){let n=[],o=t;for(;o&&o!==e;){let e=o.parentNode;if(!e)return null;n.unshift(Array.prototype.indexOf.call(e.childNodes,o)),o=e}return o===e?n:null}function Wt(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}function Ht(e){let t=e.getBoundingClientRect(),n=A(e).getComputedStyle(e),o=(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.paddingLeft)||0),i=(parseFloat(n.borderRightWidth)||0)+(parseFloat(n.paddingRight)||0),a=(parseFloat(n.borderTopWidth)||0)+(parseFloat(n.paddingTop)||0),r=(parseFloat(n.borderBottomWidth)||0)+(parseFloat(n.paddingBottom)||0);return E({left:t.left+o,top:t.top+a,width:Math.max(0,t.width-o-i),height:Math.max(0,t.height-a-r)},e.ownerDocument)}function Bt(e,t,n,o=!1){let i=Wt(S(t)),a=function(e){let t=[];for(let n of e){if(!n.textNode.isConnected||!n.originalText.trim())continue;let e=n.textNode.ownerDocument.createRange();e.selectNodeContents(n.textNode),t.push(...Array.from(e.getClientRects()).filter(e=>e.width>0&&e.height>0).map(e=>Wt(E(e,n.textNode.ownerDocument)))),e.detach?.()}return De(t)}(e),r=e[0]?.textNode?function(e,t){let n=e.ownerDocument.createRange();n.selectNodeContents(e);let o=E(n.getBoundingClientRect(),e.ownerDocument);if(n.detach?.(),o.width>0&&o.height>0)return{left:o.left,top:o.top,width:o.width,height:o.height};let i=S(t);return{left:i.left,top:i.top,width:i.width,height:i.height}}(e[0].textNode,t):i,l=a.length>0?a:[r];return function({display:e,singleTextNode:t=!1,fragmentRects:n,elementRect:o,parentContentRect:i}){let a=De(n),r=Oe(a,o);if(!("inline"===e&&a.length>1&&i&&i.width>0))return{textRect:r,boundaryRect:t?r:o,boundaryRects:t?a:[o],firstLineIndent:0};let l=a[0],d={left:i.left,top:l.top,width:i.width,height:Math.max(r.height,Le(r)-l.top)},s=Math.max(0,Math.min(d.width,l.left-d.left));return{textRect:r,boundaryRect:Oe(a,o),boundaryRects:a,flowRect:d,firstLineIndent:s}}({display:n.display,singleTextNode:o,fragmentRects:l,elementRect:i,parentContentRect:t.parentElement?Ht(t.parentElement):void 0})}function jt(e,t,n){if(t===n||0===e.length)return[];let o=0;for(;o<t.length&&o<n.length&&t[o]===n[o];)o+=1;let i=0;for(;i<t.length-o&&i<n.length-o&&t[t.length-1-i]===n[n.length-1-i];)i+=1;let a=o,r=t.length-i,l=n.slice(o,n.length-i),d=0,s=!1;return e.flatMap((t,n)=>{let o=d,i=o+t.originalText.length;d=i;let c=a===r;if(!(c&&(a>=o&&a<i||n===e.length-1&&a===i))&&!(!c&&i>a&&o<r))return[];let p=Math.max(0,Math.min(t.originalText.length,a-o)),u=Math.max(0,Math.min(t.originalText.length,r-o)),f=t.originalText.slice(0,p);return s||(f+=l,s=!0),f+=t.originalText.slice(u),f===t.originalText?[]:[{segment:t,modifiedText:f}]})}function Yt(e,t){return Math.abs(e.left-t.left)<.5&&Math.abs(e.top-t.top)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5}function Kt(e,t){return e&&t?Yt(e,t):e===t}function qt(e,t){return e.length===t.length&&e.every((e,n)=>Yt(e,t[n]))}function Xt(){return{isDragging:!1,hasMoved:!1,mode:"move",startX:0,startY:0,element:null,originalParent:null,originalIndex:-1,selector:null,durableSelector:null,elementInfo:null}}function Vt(e){if(!e||e===document.body||e===document.documentElement||_t(e))return!1;let t=e.tagName.toLowerCase();return!["script","style","link","meta","head","html","body","input","textarea","select","option","button"].includes(t)&&!!e.parentElement}function Ut(e){let t=e.getAttribute("data-pm");return t||(t=Math.random().toString(36).substring(2,8),e.setAttribute("data-pm",t)),`[data-pm="${t}"]`}function Gt(e){return e.parentElement?Array.from(e.parentElement.children).indexOf(e):-1}function Qt(e){e.removeAttribute("data-pm"),e.querySelectorAll("[data-pm]").forEach(e=>e.removeAttribute("data-pm"))}function Jt(e,t,n,o,i=r){let a=n.parentElement;if(!a)return null;let l=i(e,t);for(;l&&l!==document.body;)if(l===n||n.contains(l))l=l.parentElement;else{if(l.parentElement===a&&Vt(l))break;l=l.parentElement}if(!l||l===document.body||l.parentElement!==a||l===o)return null;let d=l.getBoundingClientRect(),s=d.height>=d.width?t<d.top+d.height/2?"before":"after":e<d.left+d.width/2?"before":"after",c=Gt(l);return{parent:a,reference:l,placement:s,index:"before"===s?c:c+1}}function Zt(e,t,n){let o=Array.from(e.children).filter(e=>e!==t),i=Math.max(0,Math.min(n,o.length));e.insertBefore(t,o[i]??null)}function en({drag:e,clientX:t,clientY:n,pathname:o,createId:i,rootElement:a,elementAtPoint:r}){let s=e.element;if(!(s&&e.selector&&e.durableSelector&&e.elementInfo))return null;let c=Jt(t,n,s,a,r);if(!c)return null;let p=e.originalParent===c.parent&&c.index>e.originalIndex?c.index-1:c.index;if("move"===e.mode&&e.originalParent===c.parent&&(p===e.originalIndex||p===e.originalIndex+1))return null;let u=l(c.parent),f=Ut(c.parent),h=l(c.reference),m=Ut(c.reference),g=e.selector,y=e.durableSelector,v=e.elementInfo;if("copy"===e.mode){let e=s.cloneNode(!0);if(!(e instanceof Element))return null;Qt(e),Zt(c.parent,e,p),g=Ut(e),y=l(e),v={...d(e),selector:g}}else Zt(c.parent,s,p);let x=e.originalParent;return{id:i(),operation:e.mode,selector:g,durableSelector:y,element:v,sourceSelector:"copy"===e.mode?e.selector:void 0,sourceDurableSelector:"copy"===e.mode?e.durableSelector:void 0,sourceElement:"copy"===e.mode?e.elementInfo:void 0,originalParentSelector:x?Ut(x):void 0,originalParentDurableSelector:x?l(x):void 0,originalIndex:e.originalIndex,targetParentSelector:f,targetParentDurableSelector:u,targetIndex:p,referenceSelector:m,referenceDurableSelector:h,placement:c.placement,pathname:o}}function tn(e){return e instanceof HTMLElement&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName||!0===e.isContentEditable||"true"===e.getAttribute("contenteditable"))}function nn(e){return tn(e.composedPath?.()[0]??e.target)||tn(function(){if(typeof document>"u")return null;let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}())}function on(e,t,n){if(n)return[n];let o=new Set(t),i=new Map;for(let t of e)t.groupId&&t.threadId&&i.set(t.groupId,t.threadId);let a=new Set;for(let t of e){if(!o.has(t.id))continue;let e=t.threadId||(t.groupId?i.get(t.groupId):void 0);e&&a.add(e)}return[...a]}function an({state:e,stateRef:t,activeTextRef:n,selectedIdsRef:o,dispatch:i,clearSelection:a,selectAnnotation:r,handHoveredElement:s,onArchiveThread:c,openThreadId:p,currentPathname:u,hasOpenThread:f}){let h=q([]),m=q(0),g=q(null);j(()=>{let y=y=>{if("Escape"===y.key){if(y.defaultPrevented||y.repeat||n.current||f||nn(y))return;if(o.current.length>0)return y.preventDefault(),void a();let e=t.current;if(e.annotations.some(e=>"pending"===(e.status??"pending"))||e.styleModifications.some(e=>!e.captured)||e.textModifications.some(e=>!e.captured)||e.domModifications.some(e=>!e.captured)||e.spacingTokenChanges.some(e=>!e.captured)||e.spacingTokenMods.some(e=>!e.captured))return y.preventDefault(),void i({type:"DISCARD_DRAFT"})}if((y.metaKey||y.ctrlKey)&&"c"===y.key.toLowerCase()&&"hand"===e.activeTool&&s&&!n.current){if(Vt(s)){y.preventDefault();let e=Ut(s);g.current={source:s,sourceSelector:e,sourceDurableSelector:l(s),sourceElement:{...d(s),selector:e}}}return}if((y.metaKey||y.ctrlKey)&&"v"===y.key.toLowerCase()&&"hand"===e.activeTool&&g.current&&!n.current){let e=g.current,t=s&&Vt(s)?s:e.source,n=t.parentElement;if(n){y.preventDefault();let o=l(n),a=Ut(n),r=l(t),s=Ut(t),c=Gt(t)+1,p=e.source.cloneNode(!0);if(p instanceof Element){Qt(p),Zt(n,p,c);let t=Ut(p),f=l(p),h={...d(p),selector:t};i({type:"MODIFY_DOM_STRUCTURE",payload:{id:Ct(),operation:"copy",selector:t,durableSelector:f,element:h,sourceSelector:e.sourceSelector,sourceDurableSelector:e.sourceDurableSelector,sourceElement:e.sourceElement,targetParentSelector:a,targetParentDurableSelector:o,targetIndex:c,referenceSelector:s,referenceDurableSelector:r,placement:"after",pathname:u}})}}return}if((y.metaKey||y.ctrlKey)&&"v"===y.key&&h.current.length>0&&!n.current){y.preventDefault(),m.current+=1;let e=20*m.current,t=h.current[0]?.groupId?Math.random().toString(36).substring(2,9):void 0,n=h.current.map(n=>({...n,id:Math.random().toString(36).substring(2,9),groupId:n.groupId?t:void 0,timestamp:Date.now(),points:n.points.map(t=>({x:t.x+e,y:t.y+e}))}));i({type:"PASTE_ANNOTATIONS",payload:{annotations:n}});let o=n.find(e=>"text"!==e.type)??n[0];return void(o&&r(o.id))}let v=o.current;if(!(n.current||nn(y)||"Delete"!==y.key&&"Backspace"!==y.key||y.metaKey||y.ctrlKey||y.altKey)){if(0===v.length&&!p)return;let e=on(t.current.annotations,v,p);if(!c||0===e.length)return;y.preventDefault();for(let t of e)c(t);a()}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[n,a,u,i,s,f,c,p,r,o,e.activeTool,t])}export{Qe as $,Gt as A,Jt as B,en as C,nn as D,on as E,an as F,ne as G,oe as H,ie as I,Me as J,ke as K,Ee as L,Ae as M,Ce as N,Re as O,Fe as P,ze as Q,We as R,He as S,je as T,Ye as U,Ke as V,qe as W,Xe as X,Ve as Y,Ue as Z,Ge as _,It as a,Je as aa,St as b,Ze as ba,Tt as c,et as ca,Mt as d,tt as da,kt as e,nt as ea,Ct as f,ot as fa,$t as g,at as ga,Pt as h,rt as ha,re as i,lt as ia,le as j,dt as ja,ce as k,ut as ka,me as l,ft as la,ge as m,ht as ma,ye as n,mt as na,ve as o,vt as oa,Te as p,xt as pa,_t as q,wt as qa,Ft as r,Bt as s,jt as t,Yt as u,Kt as v,qt as w,Xt as x,Vt as y,Ut as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";var e=new WeakMap,t="popmelt:preview-viewport-change";function n(n){let r=n.ownerDocument.defaultView;r&&e.get(r)?.schedule(),n.dispatchEvent(new Event(t,{bubbles:!0}))}function r(t,n=window){let r=e.get(n)??function(t){let n={listeners:new Set,rafId:null,schedule:()=>{null===n.rafId&&(n.rafId=t.requestAnimationFrame(()=>{n.rafId=null;for(let e of n.listeners)e()}))}};return e.set(t,n),t.addEventListener("scroll",n.schedule,{passive:!0,capture:!0}),t.addEventListener("resize",n.schedule),n}(n);return r.listeners.add(t),()=>{r.listeners.delete(t)&&(r.listeners.size>0||(n.removeEventListener("scroll",r.schedule,!0),n.removeEventListener("resize",r.schedule),null!==r.rafId&&n.cancelAnimationFrame(r.rafId),e.delete(n)))}}export{t as a,n as b,r as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a as t}from"./chunk-V2I7PSJW.mjs";var e=new WeakMap,o=new Set;function n(t,n){e.set(t,n);for(let t of o)t();return()=>{if(e.get(t)===n){e.delete(t);for(let t of o)t()}}}function r(t){return o.add(t),()=>{o.delete(t)}}function l(t){let o=t?.closest("[data-popmelt-explore-original],[data-popmelt-explore-scene]");return o?e.get(o)??null:null}function i(e,o){if(t(e)){let t=e.style.getPropertyValue(o);if(t)return t}let n=o.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());try{for(let t of document.styleSheets)try{let r=t.cssRules||t.rules;for(let t of r)if(t instanceof CSSStyleRule&&e.matches(t.selectorText)){let e=t.style.getPropertyValue(o);if(e)return e;let r=t.style[n];if(r)return r}}catch{}}catch{}return null}function a(t){let e=window.getComputedStyle(t).display;return"flex"===e||"inline-flex"===e||"grid"===e||"inline-grid"===e}function s(t){let e=window.getComputedStyle(t);return{row:parseFloat(e.rowGap)||0,column:parseFloat(e.columnGap)||0}}function u(t){let e=Array.from(t.children).filter(t=>{if(!(t instanceof HTMLElement))return!1;let e=window.getComputedStyle(t);return"none"!==e.display&&"absolute"!==e.position&&"fixed"!==e.position});if(e.length<2)return[];let o=[],n=t.getBoundingClientRect(),r=window.getComputedStyle(t).flexDirection,l="column"===r||"column-reverse"===r;for(let t=0;t<e.length-1;t++){let r=e[t].getBoundingClientRect(),i=e[t+1].getBoundingClientRect();if(i.left>r.right+.5&&o.push({axis:"column",x:r.right,y:n.top,w:i.left-r.right,h:n.height}),i.top>r.bottom+.5&&o.push({axis:"row",x:n.left,y:r.bottom,w:n.width,h:i.top-r.bottom}),!(i.left>r.right+.5||i.top>r.bottom+.5))if(l){let t=(r.bottom+i.top)/2;o.push({axis:"row",x:n.left,y:t-3,w:n.width,h:6})}else{let t=(r.right+i.left)/2;o.push({axis:"column",x:t-3,y:n.top,w:6,h:n.height})}}return function(t){let e=[];for(let o of t){let t=e.find(t=>t.axis===o.axis&&("row"===o.axis?Math.abs(t.y-o.y)<2&&Math.abs(t.h-o.h)<2:Math.abs(t.x-o.x)<2&&Math.abs(t.w-o.w)<2));if(t)if("row"===o.axis){let e=Math.min(t.x,o.x),n=Math.max(t.x+t.w,o.x+o.w);t.x=e,t.w=n-e}else{let e=Math.min(t.y,o.y),n=Math.max(t.y+t.h,o.y+o.h);t.y=e,t.h=n-e}else e.push({...o})}return e}(o)}function p(t,e){let o=window.getComputedStyle(t),n=o.display;if("flex"!==n&&"inline-flex"!==n)return!1;let r=o.justifyContent;if("space-between"!==r&&"space-around"!==r&&"space-evenly"!==r&&"stretch"!==r)return!1;let l=o.flexDirection;return!(e!==("column"===l||"column-reverse"===l?"row":"column")||parseFloat("row"===e?o.rowGap:o.columnGap)>0)}function f(t){let e=window.getComputedStyle(t);return{top:parseFloat(e.paddingTop)||0,right:parseFloat(e.paddingRight)||0,bottom:parseFloat(e.paddingBottom)||0,left:parseFloat(e.paddingLeft)||0}}function d(t){let e=window.getComputedStyle(t);return{top:parseFloat(e.marginTop)||0,right:parseFloat(e.marginRight)||0,bottom:parseFloat(e.marginBottom)||0,left:parseFloat(e.marginLeft)||0}}function h(t){let e=window.getComputedStyle(t);return{topLeft:e.borderTopLeftRadius,topRight:e.borderTopRightRadius,bottomRight:e.borderBottomRightRadius,bottomLeft:e.borderBottomLeftRadius}}function g(t){let e=window.getComputedStyle(t);return{"top-left":parseFloat(e.borderTopLeftRadius)||0,"top-right":parseFloat(e.borderTopRightRadius)||0,"bottom-right":parseFloat(e.borderBottomRightRadius)||0,"bottom-left":parseFloat(e.borderBottomLeftRadius)||0}}function m(t){for(let e of t.childNodes)if(e.nodeType===Node.TEXT_NODE&&(e.textContent||"").trim().length>0)return!0;return!1}function c(t){let e=document.createRange(),o=!1;for(let n of t.childNodes)n.nodeType===Node.TEXT_NODE&&(n.textContent||"").trim().length>0&&(o||(e.setStart(n,0),o=!0),e.setEnd(n,n.textContent?.length??0));if(!o)return null;let n=e.getBoundingClientRect(),r=window.getComputedStyle(t),l=parseFloat(r.fontSize)||16,i=parseFloat(r.lineHeight);isNaN(i)&&(i=1.2*l);let a=Math.max(1,e.getClientRects().length),s=Math.max(n.height,a*i),u=(s-n.height)/2;return new DOMRect(n.x,n.y-u,n.width,s)}function w(t){let e=window.getComputedStyle(t),o=parseFloat(e.fontSize)||16,n=parseFloat(e.lineHeight);return isNaN(n)&&(n=1.2*o),{fontSize:o,lineHeight:n}}export{i as a,a as b,s as c,u as d,p as e,f,d as g,h,g as i,m as j,c as k,w as l,n as m,r as n,l as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as e,G as t,H as r,I as o,J as a,K as i,a as n,b as s,i as l,j as p,k as c,l as d,x as m}from"./chunk-67OWRNU3.mjs";import{a as w,b as u}from"./chunk-NOHXTT24.mjs";import{spawn as f}from"child_process";import{closeSync as h,openSync as g}from"fs";import{appendFile as _,mkdir as E,readFile as P,realpath as y}from"fs/promises";import{dirname as T,join as O}from"path";import{fileURLToPath as v}from"url";import{spawn as I}from"child_process";import{mkdtemp as R,readFile as S,rm as b}from"fs/promises";import{tmpdir as C}from"os";import{join as M}from"path";import j from"ws";async function N(e,t){let r=Date.now()+25e3;for(;Date.now()<r;){let t=await e();if(t)return t;await new Promise(e=>setTimeout(e,100))}throw new Error(`Timed out waiting for ${t}`)}function x(e){let t=new URL(e);if("http:"!==t.protocol||!["localhost","127.0.0.1"].includes(t.hostname)||t.username||t.password||t.hash||t.search)throw new Error("Managed participants require an explicit local app URL");return async e=>{let r,o,a=await R(M(C(),"popmelt-participant-")),i=I(process.env.CHROME_PATH??("darwin"===process.platform?"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome":"google-chrome"),["--headless=new","--no-first-run","--no-default-browser-check","--remote-debugging-address=127.0.0.1","--remote-debugging-port=0","--window-size=1440,1000",`--user-data-dir=${a}`,"about:blank"],{stdio:["ignore","ignore","pipe"]}),n="",s=!1,l=0,p=new Map;i.on("error",e=>{r=e}),i.stderr.on("data",e=>{n=(n+e).slice(-4e3)});let c=()=>{for(let e of p.values())clearTimeout(e.timer),e.reject(new Error("Participant browser disconnected"));p.clear()},d=async()=>{if(!s){if(s=!0,c(),o?.close(),i.pid&&null===i.exitCode&&null===i.signalCode){let e=new Promise(e=>i.once("exit",()=>e()));i.kill("SIGTERM");let t=setTimeout(()=>i.kill("SIGKILL"),3e3);await e,clearTimeout(t)}await b(a,{recursive:!0,force:!0})}};try{let m=await N(async()=>{if(r)throw r;if(null!==i.exitCode||null!==i.signalCode)throw new Error(`Participant browser exited: ${n}`);return S(M(a,"DevToolsActivePort"),"utf8").then(e=>e.split("\n")[0]).catch(()=>null)},"participant browser startup"),w=(await(await fetch(`http://127.0.0.1:${m}/json/list`,{signal:AbortSignal.timeout(3e3)})).json()).find(e=>"page"===e.type);if(!w)throw new Error("Participant browser has no page");o=new j(w.webSocketDebuggerUrl,{handshakeTimeout:5e3}),await new Promise((e,t)=>{o.once("open",e),o.once("error",t)}),o.on("close",c),o.on("error",c),o.on("message",e=>{let t=JSON.parse(e.toString()),r=p.get(t.id);r&&(p.delete(t.id),clearTimeout(r.timer),t.error?r.reject(new Error(t.error.message??"Participant browser request failed")):r.resolve(t.result))});let u=(e,t={})=>new Promise((r,a)=>{if(s||o?.readyState!==j.OPEN)return void a(new Error("Participant browser is closed"));let i=++l,n=setTimeout(()=>{p.delete(i),a(new Error(`Participant browser timed out: ${e}. Action was not retried.`))},35e3);p.set(i,{resolve:r,reject:a,timer:n}),o.send(JSON.stringify({id:i,method:e,params:t}))}),f=async(e,t=!1)=>{let r=await u("Runtime.evaluate",{expression:e,userGesture:t,awaitPromise:!0,returnByValue:!0});if(r.exceptionDetails)throw new Error("Participant action failed: "+JSON.stringify(r.exceptionDetails));return r.result?.value};await u("Page.enable"),await u("Runtime.enable");let h=(await u("Page.getFrameTree")).frameTree.frame.id,g=new Set,_=!1;await u("Runtime.addBinding",{name:"__popmeltCapture"}),o.on("message",e=>{let r=JSON.parse(e.toString());if("Runtime.executionContextCreated"===r.method){let e=r.params.context;e.auxData?.isDefault&&e.auxData.frameId===h&&g.add(e.id)}if("Runtime.executionContextDestroyed"===r.method&&g.delete(r.params.executionContextId),"Runtime.executionContextsCleared"===r.method&&g.clear(),"Runtime.bindingCalled"!==r.method||"__popmeltCapture"!==r.params.name||!g.has(r.params.executionContextId))return;let o,a=r.params.executionContextId,i=r.params.payload;if(i.length>22e4)return;try{o=JSON.parse(i)}catch{return}if(!Number.isSafeInteger(o.id)||!Array.isArray(o.selectors)||o.selectors.length>200||o.selectors.some(e=>"string"!=typeof e||e.length>1024))return;let n=e=>u("Runtime.evaluate",{contextId:a,expression:`window.__POPMELT_CAPTURE_DELIVER__?.(${o.id},${JSON.stringify(e)})`}).catch(()=>{});_?n(null):(_=!0,(async()=>{try{if(!await f(`location.origin + location.pathname === ${JSON.stringify(t.href)}`))return null;let e=await f(`window.__POPMELT_AGENT_VIEW__.geometry(${JSON.stringify(o.selectors)})`),r=e.clip;if(![r.x,r.y,r.width,r.height].every(Number.isFinite)||r.x<0||r.y<0||r.width<=0||r.height<=0||r.width>4096||r.height>4096)return null;await f("window.__POPMELT_CAPTURE_CHROME__ = [...document.querySelectorAll('[data-popmelt-top-layer-host]')].map(element => [element, element.style.opacity]); window.__POPMELT_CAPTURE_CHROME__.forEach(([element]) => element.style.opacity = '0');");try{let t=await u("Page.captureScreenshot",{format:"jpeg",quality:80,captureBeyondViewport:!0,clip:{...r,scale:Math.min(1,1280/Math.max(r.width,r.height))}});return"string"!=typeof t.data||t.data.length>5e5?null:{image:"data:image/jpeg;base64,"+t.data,targets:e.targets}}finally{await f("window.__POPMELT_CAPTURE_CHROME__?.forEach(([element, opacity]) => element.style.opacity = opacity); delete window.__POPMELT_CAPTURE_CHROME__;").catch(()=>{})}}catch{return null}})().then(n).finally(()=>{_=!1}))}),await u("Page.addScriptToEvaluateOnNewDocument",{source:`if (location.origin + location.pathname === ${JSON.stringify(t.href)}) {\n window.__POPMELT_AGENT_CREDENTIAL__ = ${JSON.stringify(e)};\n const waiting = new Map(); let id = 0;\n window.__POPMELT_CAPTURE_DELIVER__ = (id, frame) => { const pending = waiting.get(id); if (!pending) return; waiting.delete(id); clearTimeout(pending.timer); pending.resolve(frame); };\n window.__POPMELT_MANAGED_CAPTURE__ = () => { let stopped = false; const owned = new Set(); return {\n frame: selectors => stopped ? Promise.resolve(null) : new Promise(resolve => { const key = ++id; owned.add(key); const timer = setTimeout(() => window.__POPMELT_CAPTURE_DELIVER__(key, null), 5000); waiting.set(key, {resolve: frame => { owned.delete(key); resolve(frame); }, timer}); window.__popmeltCapture(JSON.stringify({id: key, selectors})); }),\n stop: () => { stopped = true; for (const key of owned) window.__POPMELT_CAPTURE_DELIVER__(key, null); }\n }; };\n }`});let E=()=>N(()=>f(`location.origin + location.pathname === ${JSON.stringify(t.href)} && Boolean(window.__POPMELT_AGENT_VIEW__)`),"native participant canvas");o.on("message",e=>{"Page.loadEventFired"===JSON.parse(e.toString()).method&&E().then(()=>f("window.__POPMELT_AGENT_VIEW__.share()",!0)).catch(()=>{})}),await u("Page.navigate",{url:t.href}),await E(),await f("window.__POPMELT_AGENT_VIEW__.share()",!0);let P=Promise.resolve();return{act(e){let t=P.then(async()=>(await E(),f(`window.__POPMELT_AGENT_VIEW__.act(${JSON.stringify(e)})`)));return P=t.catch(()=>{}),t},close:d}}catch(e){throw await d(),e}}}import{randomBytes as L,timingSafeEqual as $}from"crypto";import{readFile as k,writeFile as A,mkdir as D}from"fs/promises";import{join as J}from"path";var G=(e,t)=>"string"==typeof e&&Buffer.byteLength(e)===Buffer.byteLength(t)&&$(Buffer.from(e),Buffer.from(t));async function H(e){let t=J(e.projectRoot,".popmelt");await D(t,{recursive:!0});let r,o=J(t,"participant-host-recovery.json");try{if(r=JSON.parse(await k(o,"utf8")).token,"string"!=typeof r||!/^[\w-]{43}$/.test(r))throw new Error("Invalid host recovery capability")}catch(e){if("ENOENT"!==e.code)throw e;r=L(32).toString("base64url"),await A(o,JSON.stringify({token:r}),{mode:384,flag:"wx"})}let a=L(32).toString("base64url"),i=`popmelt-host-${e.projectId}`;return{handler:async(t,o)=>{if(o.setHeader("Cache-Control","no-store"),"POST"!==t.method||t.headers.origin!==e.origin||"application/json"!==t.headers["content-type"])return o.statusCode=403,void o.end();try{let n="";for await(let e of t)if(n+=e,n.length>2048)throw new Error("Invalid host proof");let s,l=JSON.parse(n),p=t.headers.cookie?.split(";").map(e=>e.trim()).find(e=>e.startsWith(`${i}=`))?.slice(i.length+1);if(a&&G(l.token,a))a="";else if(!G(p,r)){if(!l.credential)throw new Error("Host proof required");if(s=await e.host(),l.credential.participantId!==s.participantId||!G(l.credential.token,s.token))throw new Error("Invalid host proof")}s??=await e.host(),o.setHeader("Set-Cookie",`${i}=${r}; Path=/__popmelt/host; HttpOnly; SameSite=Strict; Max-Age=31536000`),o.setHeader("Content-Type","application/json"),o.end(JSON.stringify(s))}catch{o.statusCode=403,o.end()}},claimUrl:`${e.origin}/#popmelt-host=${a}`}}import{chmod as U,mkdir as B,writeFile as V}from"fs/promises";import{join as F}from"path";async function q(e){let{bridge:t}=e;if(!t.participantHost)throw new Error("The bridge does not support participant sessions");let r=await H({projectRoot:e.projectRoot,projectId:t.projectId,origin:e.origin,host:t.participantHost}),o=F(e.projectRoot,".popmelt");await B(o,{recursive:!0}),await V(F(o,"participant-bridge.json"),JSON.stringify({port:t.port,projectId:t.projectId}),{mode:384});let a=F(o,"participant-host-link.json");return await V(a,JSON.stringify({url:r.claimUrl}),{mode:384}),await U(a,384),{hostEntry:r.handler,read:async()=>({version:1,url:`http://127.0.0.1:${t.port}`,projectId:t.projectId,revision:await(e.sourceRevision?.())??"unversioned"})}}async function W(e,t){let r=(await P(t,"utf8").catch(()=>"")).slice(-8e3).trim();return new Error(r?`${e}\nBridge log (${t}):\n${r}`:e)}async function X(P){if("production"===process.env.NODE_ENV&&!P?.force)throw new Error("[Bridge] Refusing to start in production. Pass { force: true } to override.");if((P={...P,experimentalEventTransport:m(P?.experimentalEventTransport)}).detached){let i=P.projectRoot??process.cwd();P.backgroundDiscovery||await d(i);let m=await n(O(i,".popmelt","bridge-start.lock"),()=>async function(i){let n,d=i.port??1111,m=await async function(e){return y(e).catch(()=>e)}(i.projectRoot??process.cwd()),w=l(m),u=await t(m);for await(let{port:t,status:r}of o(m,d))if(r.projectId===w){if(r.version&&r.version!==p&&"detached"===r.restartMode){n??={port:t,status:r};continue}if("detached"===r.restartMode&&r.version===p&&(r.eventTransport??"sse")!==i.experimentalEventTransport)throw new Error(`[Bridge] Transport conflict on port ${t}: the project is using ${r.eventTransport??"sse"}, but this client requested ${i.experimentalEventTransport}. Use the running transport or stop the bridge before switching.`);if(!e(r,{projectId:w,version:p,restartMode:"detached",eventTransport:i.experimentalEventTransport}))continue;if(c()&&!i.backgroundDiscovery&&!(await fetch(`http://127.0.0.1:${t}/config`,{method:"PATCH",headers:{"Content-Type":"application/json","X-Popmelt-Project-Id":w},body:JSON.stringify({disableTelemetry:!0}),signal:AbortSignal.timeout(1500)})).ok)throw new Error("Unable to apply the telemetry opt-out to the running bridge.");let o=i.devOrigin;if(o&&r.devOrigin!==o)try{await fetch(`http://127.0.0.1:${t}/config`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({devOrigin:o})})}catch{}return process.env.POPMELT_BRIDGE_PORT=String(t),process.env.POPMELT_PROJECT_ID=w,{port:t,projectId:w,storeId:u.storeId,close:async()=>{}}}n&&await a(n.port,w,n.status);let P=O(T(v(import.meta.url)),"bridge-entry.mjs"),I=O(m,".popmelt"),R=O(I,"bridge.log");await E(I,{recursive:!0}),await _(R,`\n[${(new Date).toISOString()}] Starting detached bridge\n`);let S,b=g(R,"a");try{S=f(process.execPath,[P],{detached:!0,stdio:["ignore","ignore",b],env:{...process.env,POPMELT_PORT:String(d),POPMELT_PROJECT_ROOT:m,POPMELT_DEV_ORIGIN:i.devOrigin??"",POPMELT_COPILOT_PATH:i.copilotPath??"",POPMELT_EXPERIMENTAL_EVENT_TRANSPORT:i.experimentalEventTransport}})}finally{h(b)}let C=null;S.once("error",e=>{C=`spawn error: ${e.message}`}),S.once("exit",(e,t)=>{C=`child exited before becoming healthy (${t?`signal ${t}`:`code ${e??"unknown"}`})`}),S.unref();let M=Date.now()+3e4;for(;Date.now()<M;){if(await new Promise(e=>setTimeout(e,100)),C)throw await W(`[Bridge] Detached bridge ${C}`,R);let t=await s(m);if(t&&t.pid===S.pid){let o=await r(t.port);if(e(o,{projectId:w,version:p,restartMode:"detached",eventTransport:i.experimentalEventTransport}))return process.env.POPMELT_BRIDGE_PORT=String(t.port),process.env.POPMELT_PROJECT_ID=w,{port:t.port,projectId:w,storeId:u.storeId,close:async()=>{}}}}throw S.kill("SIGTERM"),await W(`[Bridge] Detached bridge failed to start within 30s (port ${d})`,R)}(P),4e4);if(!1===P.manageLease)return m;let I=await w({port:m.port,projectId:m.projectId});if(!I)return console.warn("[popmelt] detached bridge started without a process lease"),m;let R=u(I);return{...m,close:async()=>{R(),await I.release()}}}let I=await i(P);return process.env.POPMELT_BRIDGE_PORT=String(I.port),process.env.POPMELT_PROJECT_ID=I.projectId,I}export{x as a,H as b,q as c,X as d};
|