@popmelt.com/core 0.35.0 → 0.36.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 +11 -15
- package/THIRD_PARTY_NOTICES.md +26 -0
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/ExploreAttachment-H5WPEAZB.mjs +1 -0
- package/dist/{PagePreviewLayer-TJZOJBSD.mjs → PagePreviewLayer-WCYOBKAS.mjs} +1 -1
- package/dist/ParticipantRuntime-HEC26AER.mjs +1 -0
- package/dist/{PhoneHostGate-LNSDZOG2.mjs → PhoneHostGate-Q2AXVOSH.mjs} +1 -1
- package/dist/PopmeltTasteConnectedPane-B7DHQKRQ.mjs +1 -0
- package/dist/QueuedReplies-ESIFFRKS.mjs +1 -0
- package/dist/{SuppliedContext-YKQSMF3J.mjs → SuppliedContext-7ASO6GAW.mjs} +1 -1
- package/dist/ThreadErrorCard-6R7W3RGZ.mjs +1 -0
- package/dist/ThreadPanel-3IS7GUYS.mjs +1 -0
- package/dist/bridge-entry.mjs +1 -1
- package/dist/browser-runtime-ILNTJLZ5.mjs +1 -0
- package/dist/browser.mjs +1 -1
- package/dist/{checkFixture-BXILOUP5.mjs → checkFixture-YE2ROOLL.mjs} +1 -1
- package/dist/{chunk-AYDREFWN.mjs → chunk-26P7UUHT.mjs} +1 -1
- package/dist/chunk-3SEXH3AZ.mjs +1 -0
- package/dist/chunk-3XJEC6LS.mjs +1 -0
- package/dist/chunk-7CGKO4IU.mjs +30 -0
- package/dist/{chunk-M5P6VHZY.mjs → chunk-AH6LZOQC.mjs} +1 -1
- package/dist/{chunk-ZG6XHKYO.mjs → chunk-BACXPVHP.mjs} +1 -1
- package/dist/{chunk-N4737FRL.mjs → chunk-DLUNNAZC.mjs} +1 -1
- package/dist/chunk-EXIUW3JX.mjs +1 -0
- package/dist/chunk-FLTHWLRC.mjs +1 -0
- package/dist/chunk-GBVPRXA3.mjs +1 -0
- package/dist/chunk-L7QONR4K.mjs +1 -0
- package/dist/chunk-MSWXKP77.mjs +1 -0
- package/dist/chunk-NWE5PYKM.mjs +1 -0
- package/dist/{chunk-XG2YIAJS.mjs → chunk-OZBMHEOD.mjs} +1 -1
- package/dist/chunk-PNTM77NT.mjs +1 -0
- package/dist/chunk-TLREGQQB.mjs +1 -0
- package/dist/chunk-TUXBMJQZ.mjs +1 -0
- package/dist/chunk-X2Q3H6X7.mjs +1 -0
- package/dist/chunk-XJQJQ5V5.mjs +1 -0
- package/dist/chunk-YHYFWNN6.mjs +1 -0
- package/dist/{chunk-KTRMNVPZ.mjs → chunk-ZDXQ7WNW.mjs} +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/codex-note-context-YFURG7VL.mjs +1 -0
- package/dist/{codex-project-B5466BL6.mjs → codex-project-3NSU5OWL.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/memory-store.d.mts +1 -1
- package/dist/peer-client-56EAHIGF.mjs +1 -0
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-nuxt.mjs +1 -1
- package/dist/plugin-vite.d.mts +17 -0
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server.d.mts +3 -3
- package/dist/server.mjs +1 -1
- package/dist/{types-C8tjyhiF.d.mts → types-g9YCBx4Z.d.mts} +2 -1
- package/package.json +2 -1
- package/dist/ExploreAttachment-TTEKD4AU.mjs +0 -1
- package/dist/ParticipantRuntime-BQAOTSQZ.mjs +0 -1
- package/dist/PopmeltTasteConnectedPane-NCCF7YUX.mjs +0 -1
- package/dist/QueuedReplies-LQUBEZ6K.mjs +0 -1
- package/dist/ThreadErrorCard-4MOA34C4.mjs +0 -1
- package/dist/ThreadPanel-T6IXWFLA.mjs +0 -1
- package/dist/browser-runtime-HQM2Y6EL.mjs +0 -1
- package/dist/chunk-66VOM5NA.mjs +0 -1
- package/dist/chunk-CRJPE33X.mjs +0 -1
- package/dist/chunk-DOJBWTT5.mjs +0 -1
- package/dist/chunk-F45IVFS3.mjs +0 -1
- package/dist/chunk-F5XSNRGT.mjs +0 -1
- package/dist/chunk-GKOMTSWV.mjs +0 -1
- package/dist/chunk-PQT5FYN5.mjs +0 -1
- package/dist/chunk-R34FOW4D.mjs +0 -1
- package/dist/chunk-S7BCEQKP.mjs +0 -1
- package/dist/chunk-T4CCY2EL.mjs +0 -1
- package/dist/chunk-TH7DML4A.mjs +0 -1
- package/dist/chunk-UEGDSECJ.mjs +0 -1
- package/dist/chunk-Y3SF5YCR.mjs +0 -1
- package/dist/chunk-ZG7MAEEV.mjs +0 -30
- package/dist/codex-note-context-OUG4S6XE.mjs +0 -1
- package/dist/peer-client-SCSWLRCX.mjs +0 -1
- /package/dist/{chunk-6LBPTCGC.mjs → chunk-G6RYESYI.mjs} +0 -0
- /package/dist/{chunk-XM6RE6HT.mjs → chunk-YD3PDEFX.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{forwardRef as a}from"react";import{jsxs as h,Fragment as d,jsx as t}from"react/jsx-runtime";function e(d,t){return a(function({size:a=24,width:e=a,height:i=a,color:c="currentColor",className:l,children:r,...p},n){let M=!!r||Object.keys(p).some(a=>a.startsWith("aria-")||"role"===a||"title"===a);return h("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:e,height:i,viewBox:"0 0 24 24",fill:"none",stroke:c,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:l?`lucide ${d} ${l}`:`lucide ${d}`,"aria-hidden":!M||void 0,...p,children:[t,r]})})}var i=e("lucide-smartphone",h(d,{children:[t("rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}),t("path",{d:"M12 18h.01"})]})),c=e("lucide-a-large-small",h(d,{children:[t("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),t("path",{d:"M15.697 14h5.606"}),t("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),t("path",{d:"M3.304 13h6.392"})]})),l=e("lucide-text-align-center lucide-align-center",h(d,{children:[t("path",{d:"M21 5H3"}),t("path",{d:"M17 12H7"}),t("path",{d:"M19 19H5"})]})),r=e("lucide-align-center-vertical",h(d,{children:[t("path",{d:"M12 2v20"}),t("path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4"}),t("path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4"}),t("path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1"}),t("path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1"})]})),p=e("lucide-align-end-vertical",h(d,{children:[t("rect",{width:"16",height:"6",x:"2",y:"4",rx:"2"}),t("rect",{width:"9",height:"6",x:"9",y:"14",rx:"2"}),t("path",{d:"M22 22V2"})]})),n=e("lucide-align-horizontal-justify-center",h(d,{children:[t("rect",{width:"6",height:"14",x:"2",y:"5",rx:"2"}),t("rect",{width:"6",height:"10",x:"16",y:"7",rx:"2"}),t("path",{d:"M12 2v20"})]})),M=e("lucide-align-horizontal-justify-end",h(d,{children:[t("rect",{width:"6",height:"14",x:"2",y:"5",rx:"2"}),t("rect",{width:"6",height:"10",x:"12",y:"7",rx:"2"}),t("path",{d:"M22 2v20"})]})),s=e("lucide-align-horizontal-justify-start",h(d,{children:[t("rect",{width:"6",height:"14",x:"6",y:"5",rx:"2"}),t("rect",{width:"6",height:"10",x:"16",y:"7",rx:"2"}),t("path",{d:"M2 2v20"})]})),u=e("lucide-align-horizontal-space-around",h(d,{children:[t("rect",{width:"6",height:"10",x:"9",y:"7",rx:"2"}),t("path",{d:"M4 22V2"}),t("path",{d:"M20 22V2"})]})),o=e("lucide-align-horizontal-space-between",h(d,{children:[t("rect",{width:"6",height:"14",x:"3",y:"5",rx:"2"}),t("rect",{width:"6",height:"10",x:"15",y:"7",rx:"2"}),t("path",{d:"M3 2v20"}),t("path",{d:"M21 2v20"})]})),x=e("lucide-text-align-justify lucide-align-justify",h(d,{children:[t("path",{d:"M3 5h18"}),t("path",{d:"M3 12h18"}),t("path",{d:"M3 19h18"})]})),v=e("lucide-text-align-start lucide-text lucide-align-left",h(d,{children:[t("path",{d:"M21 5H3"}),t("path",{d:"M15 12H3"}),t("path",{d:"M17 19H3"})]})),g=e("lucide-text-align-end lucide-align-right",h(d,{children:[t("path",{d:"M21 5H3"}),t("path",{d:"M21 12H9"}),t("path",{d:"M21 19H7"})]})),m=e("lucide-align-start-vertical",h(d,{children:[t("rect",{width:"9",height:"6",x:"6",y:"14",rx:"2"}),t("rect",{width:"16",height:"6",x:"6",y:"4",rx:"2"}),t("path",{d:"M2 2v20"})]})),y=e("lucide-archive",h(d,{children:[t("rect",{width:"20",height:"5",x:"2",y:"3",rx:"1"}),t("path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}),t("path",{d:"M10 12h4"})]})),w=e("lucide-arrow-down",h(d,{children:[t("path",{d:"M12 5v14"}),t("path",{d:"m19 12-7 7-7-7"})]})),H=e("lucide-arrow-left",h(d,{children:[t("path",{d:"m12 19-7-7 7-7"}),t("path",{d:"M19 12H5"})]})),z=e("lucide-arrow-left-right",h(d,{children:[t("path",{d:"M8 3 4 7l4 4"}),t("path",{d:"M4 7h16"}),t("path",{d:"m16 21 4-4-4-4"}),t("path",{d:"M20 17H4"})]})),f=e("lucide-arrow-right",h(d,{children:[t("path",{d:"M5 12h14"}),t("path",{d:"m12 5 7 7-7 7"})]})),V=e("lucide-arrow-up-right",h(d,{children:[t("path",{d:"M7 7h10v10"}),t("path",{d:"M7 17 17 7"})]})),L=e("lucide-ban",h(d,{children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("path",{d:"M4.929 4.929 19.07 19.071"})]})),k=e("lucide-between-horizontal-start lucide-between-horizonal-start",h(d,{children:[t("rect",{width:"13",height:"7",x:"8",y:"3",rx:"1"}),t("path",{d:"m2 9 3 3-3 3"}),t("rect",{width:"13",height:"7",x:"8",y:"14",rx:"1"})]})),b=e("lucide-between-vertical-end",h(d,{children:[t("rect",{width:"7",height:"13",x:"3",y:"3",rx:"1"}),t("path",{d:"m9 22 3-3 3 3"}),t("rect",{width:"7",height:"13",x:"14",y:"3",rx:"1"})]})),A=e("lucide-blend",h(d,{children:[t("circle",{cx:"15",cy:"9",r:"7"}),t("circle",{cx:"9",cy:"15",r:"7"})]})),j=e("lucide-letter-b lucide-bold",t("path",{d:"M6 12h9a4 4 0 010 8H7a1 1 0 01-1-1V5a1 1 0 011-1h7a4 4 0 010 8"})),C=e("lucide-bot",h(d,{children:[t("path",{d:"M12 8V4H8"}),t("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),t("path",{d:"M2 14h2"}),t("path",{d:"M20 14h2"}),t("path",{d:"M15 13v2"}),t("path",{d:"M9 13v2"})]})),q=e("lucide-brain",h(d,{children:[t("path",{d:"M12 18V5"}),t("path",{d:"M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4"}),t("path",{d:"M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294"}),t("path",{d:"M17.996 5.125a4 4 0 012.526 5.77"}),t("path",{d:"M18 18a4 4 0 002-7.465"}),t("path",{d:"M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517"}),t("path",{d:"M6 18a4 4 0 01-2-7.465"}),t("path",{d:"M6.004 5.125a4 4 0 00-2.526 5.77"})]})),N=e("lucide-check",t("path",{d:"M20 6 9 17l-5-5"})),Z=e("lucide-chevron-down",t("path",{d:"m6 9 6 6 6-6"})),$=e("lucide-chevron-left",t("path",{d:"m15 18-6-6 6-6"})),B=e("lucide-chevron-right",t("path",{d:"m9 18 6-6-6-6"})),O=e("lucide-circle-dashed",h(d,{children:[t("path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0"}),t("path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0"}),t("path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7"}),t("path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8"}),t("path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69"}),t("path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8"}),t("path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69"}),t("path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7"})]})),W=e("lucide-clock",h(d,{children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("path",{d:"M12 6v6l4 2"})]})),D=e("lucide-command",t("path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"})),E=e("lucide-component",h(d,{children:[t("path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}),t("path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}),t("path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}),t("path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"})]})),F=e("lucide-copy",h(d,{children:[t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})),G=e("lucide-corner-down-left",h(d,{children:[t("path",{d:"M20 4v7a4 4 0 0 1-4 4H4"}),t("path",{d:"m9 10-5 5 5 5"})]})),I=e("lucide-eye",h(d,{children:[t("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),t("circle",{cx:"12",cy:"12",r:"3"})]})),J=e("lucide-eye-off",h(d,{children:[t("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),t("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),t("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),t("path",{d:"m2 2 20 20"})]})),K=e("lucide-fingerprint-pattern lucide-fingerprint",h(d,{children:[t("path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"}),t("path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88"}),t("path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02"}),t("path",{d:"M2 12a10 10 0 0 1 18-6"}),t("path",{d:"M2 16h.01"}),t("path",{d:"M21.8 16c.2-2 .131-5.354 0-6"}),t("path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2"}),t("path",{d:"M8.65 22c.21-.66.45-1.32.57-2"}),t("path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2"})]})),P=e("lucide-folder",t("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})),Q=e("lucide-hand",h(d,{children:[t("path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}),t("path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"}),t("path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"}),t("path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"})]})),R=e("lucide-rotate-ccw-clock lucide-history",h(d,{children:[t("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),t("path",{d:"M3 3v5h5"}),t("path",{d:"M12 7v5l4 2"})]})),S=e("lucide-image",h(d,{children:[t("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),t("circle",{cx:"9",cy:"9",r:"2"}),t("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]})),T=e("lucide-info",h(d,{children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("path",{d:"M12 16v-4"}),t("path",{d:"M12 8h.01"})]})),U=e("lucide-link-2",h(d,{children:[t("path",{d:"M9 17H7A5 5 0 0 1 7 7h2"}),t("path",{d:"M15 7h2a5 5 0 1 1 0 10h-2"}),t("line",{x1:"8",x2:"16",y1:"12",y2:"12"})]})),X=e("lucide-loader-circle lucide-loader-2",t("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})),Y=e("lucide-lock",h(d,{children:[t("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),t("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})),_=e("lucide-lock-open lucide-unlock",h(d,{children:[t("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),t("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"})]})),aa=e("lucide-log-out",h(d,{children:[t("path",{d:"m16 17 5-5-5-5"}),t("path",{d:"M21 12H9"}),t("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"})]})),ha=e("lucide-maximize-2",h(d,{children:[t("path",{d:"M15 3h6v6"}),t("path",{d:"m21 3-7 7"}),t("path",{d:"m3 21 7-7"}),t("path",{d:"M9 21H3v-6"})]})),da=e("lucide-message-circle",t("path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"})),ta=e("lucide-message-circle-question-mark lucide-message-circle-question",h(d,{children:[t("path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}),t("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),t("path",{d:"M12 17h.01"})]})),ea=e("lucide-minimize-2",h(d,{children:[t("path",{d:"m14 10 7-7"}),t("path",{d:"M20 10h-6V4"}),t("path",{d:"m3 21 7-7"}),t("path",{d:"M4 14h6v6"})]})),ia=e("lucide-minus",t("path",{d:"M5 12h14"})),ca=e("lucide-monitor",h(d,{children:[t("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}),t("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),t("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})),la=e("lucide-moon",t("path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"})),ra=e("lucide-move",h(d,{children:[t("path",{d:"M12 2v20"}),t("path",{d:"m15 19-3 3-3-3"}),t("path",{d:"m19 9 3 3-3 3"}),t("path",{d:"M2 12h20"}),t("path",{d:"m5 9-3 3 3 3"}),t("path",{d:"m9 5 3-3 3 3"})]})),pa=e("lucide-move-horizontal",h(d,{children:[t("path",{d:"m18 8 4 4-4 4"}),t("path",{d:"M2 12h20"}),t("path",{d:"m6 8-4 4 4 4"})]})),na=e("lucide-move-vertical",h(d,{children:[t("path",{d:"M12 2v20"}),t("path",{d:"m8 18 4 4 4-4"}),t("path",{d:"m8 6 4-4 4 4"})]})),Ma=e("lucide-octagon-alert lucide-alert-octagon",h(d,{children:[t("path",{d:"M12 16h.01"}),t("path",{d:"M12 8v4"}),t("path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z"})]})),sa=e("lucide-palette",h(d,{children:[t("path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"}),t("circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor"}),t("circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor"}),t("circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor"}),t("circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor"})]})),ua=e("lucide-pause",h(d,{children:[t("rect",{x:"14",y:"3",width:"5",height:"18",rx:"1"}),t("rect",{x:"5",y:"3",width:"5",height:"18",rx:"1"})]})),oa=e("lucide-pen-line lucide-edit-3",h(d,{children:[t("path",{d:"M13 21h8"}),t("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"})]})),xa=e("lucide-play",t("path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"})),va=e("lucide-plug",h(d,{children:[t("path",{d:"M12 22v-5"}),t("path",{d:"M15 8V2"}),t("path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z"}),t("path",{d:"M9 8V2"})]})),ga=e("lucide-plus",h(d,{children:[t("path",{d:"M5 12h14"}),t("path",{d:"M12 5v14"})]})),ma=e("lucide-refresh-cw",h(d,{children:[t("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),t("path",{d:"M21 3v5h-5"}),t("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),t("path",{d:"M8 16H3v5"})]})),ya=e("lucide-reply",h(d,{children:[t("path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"}),t("path",{d:"m9 17-5-5 5-5"})]})),wa=e("lucide-rotate-ccw",h(d,{children:[t("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),t("path",{d:"M3 3v5h5"})]})),Ha=e("lucide-rotate-cw",h(d,{children:[t("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),t("path",{d:"M21 3v5h-5"})]})),za=e("lucide-ruler",h(d,{children:[t("path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"}),t("path",{d:"m14.5 12.5 2-2"}),t("path",{d:"m11.5 9.5 2-2"}),t("path",{d:"m8.5 6.5 2-2"}),t("path",{d:"m17.5 15.5 2-2"})]})),fa=e("lucide-scaling",h(d,{children:[t("path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),t("path",{d:"M14 15H9v-5"}),t("path",{d:"M16 3h5v5"}),t("path",{d:"M21 3 9 15"})]})),Va=e("lucide-search",h(d,{children:[t("path",{d:"m21 21-4.34-4.34"}),t("circle",{cx:"11",cy:"11",r:"8"})]})),La=e("lucide-send",h(d,{children:[t("path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"}),t("path",{d:"m21.854 2.147-10.94 10.939"})]})),ka=e("lucide-send-horizontal lucide-send-horizonal",h(d,{children:[t("path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z"}),t("path",{d:"M6 12h16"})]})),ba=e("lucide-settings",h(d,{children:[t("path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}),t("circle",{cx:"12",cy:"12",r:"3"})]})),Aa=e("lucide-signal",h(d,{children:[t("path",{d:"M2 20h.01"}),t("path",{d:"M7 20v-4"}),t("path",{d:"M12 20v-8"}),t("path",{d:"M17 20V8"}),t("path",{d:"M22 4v16"})]})),ja=e("lucide-signal-high",h(d,{children:[t("path",{d:"M2 20h.01"}),t("path",{d:"M7 20v-4"}),t("path",{d:"M12 20v-8"}),t("path",{d:"M17 20V8"})]})),Ca=e("lucide-signal-low",h(d,{children:[t("path",{d:"M2 20h.01"}),t("path",{d:"M7 20v-4"})]})),qa=e("lucide-signal-medium",h(d,{children:[t("path",{d:"M2 20h.01"}),t("path",{d:"M7 20v-4"}),t("path",{d:"M12 20v-8"})]})),Na=e("lucide-signal-zero",t("path",{d:"M2 20h.01"})),Za=e("lucide-sliders-horizontal",h(d,{children:[t("path",{d:"M10 5H3"}),t("path",{d:"M12 19H3"}),t("path",{d:"M14 3v4"}),t("path",{d:"M16 17v4"}),t("path",{d:"M21 12h-9"}),t("path",{d:"M21 19h-5"}),t("path",{d:"M21 5h-7"}),t("path",{d:"M8 10v4"}),t("path",{d:"M8 12H3"})]})),$a=e("lucide-square-mouse-pointer lucide-inspect",h(d,{children:[t("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"}),t("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"})]})),Ba=e("lucide-stretch-horizontal",h(d,{children:[t("rect",{width:"20",height:"6",x:"2",y:"4",rx:"2"}),t("rect",{width:"20",height:"6",x:"2",y:"14",rx:"2"})]})),Oa=e("lucide-sun",h(d,{children:[t("circle",{cx:"12",cy:"12",r:"4"}),t("path",{d:"M12 2v2"}),t("path",{d:"M12 20v2"}),t("path",{d:"m4.93 4.93 1.41 1.41"}),t("path",{d:"m17.66 17.66 1.41 1.41"}),t("path",{d:"M2 12h2"}),t("path",{d:"M20 12h2"}),t("path",{d:"m6.34 17.66-1.41 1.41"}),t("path",{d:"m19.07 4.93-1.41 1.41"})]})),Wa=e("lucide-terminal",h(d,{children:[t("path",{d:"M12 19h8"}),t("path",{d:"m4 17 6-6-6-6"})]})),Da=e("lucide-thumbs-up",h(d,{children:[t("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"}),t("path",{d:"M7 10v12"})]})),Ea=e("lucide-trash lucide-trash-2",h(d,{children:[t("path",{d:"M10 11v6"}),t("path",{d:"M14 11v6"}),t("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),t("path",{d:"M3 6h18"}),t("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})),Fa=e("lucide-triangle-alert lucide-alert-triangle",h(d,{children:[t("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),t("path",{d:"M12 9v4"}),t("path",{d:"M12 17h.01"})]})),Ga=e("lucide-user",h(d,{children:[t("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),t("circle",{cx:"12",cy:"7",r:"4"})]})),Ia=e("lucide-user-plus",h(d,{children:[t("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),t("circle",{cx:"9",cy:"7",r:"4"}),t("line",{x1:"19",x2:"19",y1:"8",y2:"14"}),t("line",{x1:"22",x2:"16",y1:"11",y2:"11"})]})),Ja=e("lucide-x",h(d,{children:[t("path",{d:"M18 6 6 18"}),t("path",{d:"m6 6 12 12"})]})),Ka=e("lucide-zap",t("path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z"}));export{ta as $,C as A,Ca as Aa,q as B,qa as Ba,N as C,Na as Ca,Z as D,Za as Da,$ as E,$a as Ea,B as F,Ba as Fa,O as G,Oa as Ga,W as H,Wa as Ha,D as I,Da as Ia,E as J,Ea as Ja,F as K,Fa as Ka,G as L,Ga as La,I as M,Ia as Ma,J as N,Ja as Na,K as O,Ka as Oa,P,Q,R,S,T,U,X as V,Y as W,_ as X,aa as Y,ha as Z,da as _,e as a,ea as aa,i as b,ia as ba,c,ca,l as d,la as da,r as e,ra as ea,p as f,pa as fa,n as g,na as ga,M as h,Ma as ha,s as i,sa as ia,u as j,ua as ja,o as k,oa as ka,x as l,xa as la,v as m,va as ma,g as n,ga as na,m as o,ma as oa,y as p,ya as pa,w as q,wa as qa,H as r,Ha as ra,z as s,za as sa,f as t,fa as ta,V as u,Va as ua,L as v,La as va,k as w,ka as wa,b as x,ba as xa,A as y,Aa as ya,j as z,ja as za};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as t,f as e}from"./chunk-DLUNNAZC.mjs";import{i as a,r,z as i}from"./chunk-7CGKO4IU.mjs";import{readFile as o,realpath as n,mkdir as s,writeFile as c}from"fs/promises";import{createHash as p}from"crypto";import{join as d,resolve as l}from"path";function u(t,e){let a=p("sha256").update(e).digest("hex");return d(t,".popmelt","participant-agents",a+".json")}async function f(t,a){if(a.storeId!==t.storeId)return{ok:!1,body:{status:"writable_store_required"}};if("string"!=typeof a.threadId||!a.threadId||"string"!=typeof a.text||!a.text.trim()||a.text.length>8e3)return{ok:!1,body:{status:"invalid_note"}};let r;try{r=await m(t,t.sessionId,!0)}catch(t){if("ENOENT"!==t.code)throw t;return{ok:!1,body:{status:"participant_invitation_required"}}}if(!r)return{ok:!1,body:{status:"enrolled_bridge_required"}};let i=await e(r.endpoint,"/participants/thread-note",{...r.request,method:"POST",signal:AbortSignal.timeout(3e4),body:JSON.stringify({storeId:t.storeId,threadId:a.threadId,reply:a.text,sessionId:t.sessionId,requestId:a.requestId})});return{ok:i.response.ok,body:i.body}}async function m(t,i,s=!1){let c=await o(d(t.projectRoot,".popmelt","participant-bridge.json"),"utf8").then(JSON.parse).catch(e=>{if("ENOENT"!==e.code||!t.bridgePort)throw e;return{projectId:t.projectId,port:t.bridgePort}});if(c.projectId!==t.projectId||!Number.isInteger(c.port)||c.port<1||c.port>65535)return null;let p={redirect:"error",signal:AbortSignal.timeout(3e3)},l=await e(c,"/status",p);if(!l.response.ok||l.body?.projectId!==t.projectId)return null;let f,m=u(t.projectRoot,i);try{f=JSON.parse(await o(m,"utf8"))}catch(l){if("ENOENT"!==l.code||!s)throw l;let u=await n(t.projectRoot),h=r(i);if(a(u)!==t.projectId||!h)return null;let g=JSON.parse(await o(d(u,".popmelt","participant-host.json"),"utf8"));if(!(await e(c,"/participants/agent-join",{...p,method:"POST",headers:{"X-Popmelt-Participant-Id":g.participantId,"X-Popmelt-Participant-Token":g.token},body:JSON.stringify({sessionId:i,name:h,headless:!0})})).response.ok)return null;f=JSON.parse(await o(m,"utf8"))}return{endpoint:c,request:{...p,headers:{"X-Popmelt-Participant-Id":f.participantId,"X-Popmelt-Participant-Token":f.token}}}}async function h(t,a,r){let i=[t,...t.mountedStores].find(t=>t.storeId===a.storeId);if(!i||r&&i!==t)return{ok:!1,body:{status:"store_unavailable"}};if(r&&("string"!=typeof a.threadId||!a.threadId))return{ok:!1,body:{status:"thread_required"}};let o=await m(i,t.sessionId,r).catch(t=>{if("ENOENT"===t.code)return null;throw t});if(!o)return{ok:!1,body:{status:"enrolled_bridge_required",message:"Join this project as a Popmelt peer and check that its bridge is running."}};let{endpoint:n,request:s}=o,c=await e(n,r?t.sessionId.startsWith("claude:")?"/participants/link-claude-chat":"/participants/link-codex-chat":"/participants/check-claude-notes",{...s,method:"POST",body:JSON.stringify({sessionId:t.sessionId,...r?{threadId:a.threadId}:{}})});return{ok:c.response.ok,body:c.body}}async function g(r,l,f={}){if(t())return{status:"already_managed_by_bridge"};if((await e(r,"/status",{redirect:"error",signal:AbortSignal.timeout(3e3)})).body?.participantSessions)return async function(t,r,l){if(!l.projectRoot)throw new Error("Participant connections require the active project root");let f=await n(l.projectRoot);if(a(f)!==t.projectId)throw new Error("Participant project does not match");let m,h,g=d(f,".popmelt"),w=p("sha256").update(r).digest("hex"),I=async(a,r,i)=>{let o=await e(t,"/participants/"+a,{method:"POST",redirect:"error",headers:{"X-Popmelt-Participant-Id":r.participantId,"X-Popmelt-Participant-Token":r.token},body:JSON.stringify(i),signal:AbortSignal.timeout(9e4)}),n=o.body;if(!o.response.ok||n.error)throw new Error(n.error??"Participant connection unavailable");return n};try{m=JSON.parse(await o(u(f,r),"utf8"))}catch(t){if("ENOENT"!==t.code)throw t;if(!l.name)return{status:"participant_invitation_required"};let e=JSON.parse(await o(d(g,"participant-host.json"),"utf8")),a=await I("agent-join",e,{sessionId:r,name:l.name});m=a.credential,h=a.participant}if(!l.action){let t=await I("agent-connect",m,{});return{status:"participant_connected",participantId:m.participantId,participant:t.participant??h}}let y=await I("agent-act",m,{action:i(l.action)}),b=y.evidence;if(b?.frame?.image){let t=b.frame.image;if(!/^data:image\/jpeg;base64,[A-Za-z0-9+/=]+$/.test(t)||t.length>7e5)throw new Error("Invalid participant preview");let e=d(g,"artifacts","participant-previews");await s(e,{recursive:!0,mode:448});let a=d(e,w+".jpg");return await c(a,Buffer.from(t.slice(t.indexOf(",")+1),"base64"),{mode:384}),{status:"participant_connected",participant:y.participant,evidence:{...b,frame:{imagePath:a,targets:b.frame.targets}}}}return{status:"participant_connected",participant:y.participant,evidence:y.evidence}}(r,l,f);let m=async(t,a)=>{let i=await e(r,`/peers/${t}`,{method:"POST",body:JSON.stringify(a),signal:AbortSignal.timeout(5e4)}),o=i.body;if(!i.response.ok||o?.error)throw new Error(o?.error??"Peer connection unavailable");return o},h=await m("join",{sessionId:l,name:f.name}),g=f.action?await m("act",{token:h.token,clientId:f.clientId,action:i(f.action)}):h,w=g.peer;return{...g.status?{status:g.status}:{},...w?{peer:{...w,state:w.state?{annotations:w.state.annotations,styleModifications:w.state.styleModifications,textModifications:w.state.textModifications,undoDepth:w.state.undoStack.length,redoDepth:w.state.redoStack.length}:null}}:{},...g.evidence?{evidence:g.evidence}:{},clients:h.clients}}async function w(t){let r=e=>{let a=t.indexOf(e);return a>=0?t[a+1]:void 0},i=r("--session");if(!i)throw new Error("Usage: popmelt peer --session <stable-agent-session> [--project-root <active-project>] [--name <your-name>] [--client <canvas-id>] [--action <JSON>]");let s=await n(l(r("--project-root")??process.cwd())),c=JSON.parse(await o(d(s,".popmelt","bridge.lock"),"utf8")),p=a(s),u=await e({port:c.port,projectId:p},"/status",{signal:AbortSignal.timeout(3e3)});if(!u.response.ok||u.body.projectRoot!==s&&(!u.body.participantSessions||u.body.projectId!==p))throw new Error("No matching running project bridge");let f=r("--action");console.log(JSON.stringify(await g({port:c.port,projectId:p},i,{name:r("--name"),projectRoot:s,clientId:r("--client"),action:f?JSON.parse(f):void 0}),null,2))}export{u as a,f as b,m as c,h as d,g as e,w as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{c as e}from"./chunk-ZSL57PQ7.mjs";import{jsx as t,jsxs as i}from"react/jsx-runtime";var l="ui-monospace, SFMono-Regular, Menlo, monospace",r=0;function n({size:e=11}){let l=++r,n=`pm-vs-m${l}`,o=`pm-vs-f0-${l}`,s=`pm-vs-f1-${l}`,a=`pm-vs-g${l}`;return i("svg",{width:e,height:e,viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",verticalAlign:"middle",marginLeft:3,flexShrink:0},children:[t("mask",{id:n,style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"100",height:"100",children:t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M70.9119 99.3171C72.4869 99.9307 74.2828 99.8914 75.8725 99.1264L96.4608 89.2197C98.6242 88.1787 100 85.9892 100 83.5872V16.4133C100 14.0113 98.6243 11.8218 96.4609 10.7808L75.8725 0.873756C73.7862 -0.130129 71.3446 0.11576 69.5135 1.44695C69.252 1.63711 69.0028 1.84943 68.769 2.08341L29.3551 38.0415L12.1872 25.0096C10.589 23.7965 8.35363 23.8959 6.86933 25.2461L1.36303 30.2549C-0.452552 31.9064 -0.454633 34.7627 1.35853 36.417L16.2471 50.0001L1.35853 63.5832C-0.454633 65.2374 -0.452552 68.0938 1.36303 69.7453L6.86933 74.7541C8.35363 76.1043 10.589 76.2037 12.1872 74.9905L29.3551 61.9587L68.769 97.9167C69.3925 98.5406 70.1246 99.0104 70.9119 99.3171ZM75.0152 27.2989L45.1091 50.0001L75.0152 72.7012V27.2989Z",fill:"white"})}),i("g",{mask:`url(#${n})`,children:[t("path",{d:"M96.4614 10.7962L75.8569 0.875542C73.4719 -0.272773 70.6217 0.211611 68.75 2.08333L1.29858 63.5832C-0.515693 65.2373 -0.513607 68.0937 1.30308 69.7452L6.81272 74.754C8.29793 76.1042 10.5347 76.2036 12.1338 74.9905L93.3609 13.3699C96.086 11.3026 100 13.2462 100 16.6667V16.4275C100 14.0265 98.6246 11.8378 96.4614 10.7962Z",fill:"#0065A9"}),t("g",{filter:`url(#${o})`,children:t("path",{d:"M96.4614 89.2038L75.8569 99.1245C73.4719 100.273 70.6217 99.7884 68.75 97.9167L1.29858 36.4169C-0.515693 34.7627 -0.513607 31.9063 1.30308 30.2548L6.81272 25.246C8.29793 23.8958 10.5347 23.7964 12.1338 25.0095L93.3609 86.6301C96.086 88.6974 100 86.7538 100 83.3334V83.5726C100 85.9735 98.6246 88.1622 96.4614 89.2038Z",fill:"#007ACC"})}),t("g",{filter:`url(#${s})`,children:t("path",{d:"M75.8578 99.1263C73.4721 100.274 70.6219 99.7885 68.75 97.9166C71.0564 100.223 75 98.5895 75 95.3278V4.67213C75 1.41039 71.0564 -0.223106 68.75 2.08329C70.6219 0.211402 73.4721 -0.273666 75.8578 0.873633L96.4587 10.7807C98.6234 11.8217 100 14.0112 100 16.4132V83.5871C100 85.9891 98.6234 88.1786 96.4586 89.2196L75.8578 99.1263Z",fill:"#1F9CF0"})}),t("g",{style:{mixBlendMode:"overlay"},opacity:"0.25",children:t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M70.8511 99.3171C72.4261 99.9306 74.2221 99.8913 75.8117 99.1264L96.4 89.2197C98.5634 88.1787 99.9392 85.9892 99.9392 83.5871V16.4133C99.9392 14.0112 98.5635 11.8217 96.4001 10.7807L75.8117 0.873695C73.7255 -0.13019 71.2838 0.115699 69.4527 1.44688C69.1912 1.63705 68.942 1.84937 68.7082 2.08335L29.2943 38.0414L12.1264 25.0096C10.5283 23.7964 8.29285 23.8959 6.80855 25.246L1.30225 30.2548C-0.513334 31.9064 -0.515415 34.7627 1.29775 36.4169L16.1863 50L1.29775 63.5832C-0.515415 65.2374 -0.513334 68.0937 1.30225 69.7452L6.80855 74.754C8.29285 76.1042 10.5283 76.2036 12.1264 74.9905L29.2943 61.9586L68.7082 97.9167C69.3317 98.5405 70.0638 99.0104 70.8511 99.3171ZM74.9544 27.2989L45.0483 50L74.9544 72.7012V27.2989Z",fill:`url(#${a})`})})]}),i("defs",{children:[i("filter",{id:o,x:"-8.39411",y:"15.8291",width:"116.727",height:"92.2456",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[t("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),t("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),t("feOffset",{}),t("feGaussianBlur",{stdDeviation:"4.16667"}),t("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),t("feBlend",{mode:"overlay",in2:"BackgroundImageFix",result:"effect1_dropShadow"}),t("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow",result:"shape"})]}),i("filter",{id:s,x:"60.4167",y:"-8.07558",width:"47.9167",height:"116.151",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[t("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),t("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),t("feOffset",{}),t("feGaussianBlur",{stdDeviation:"4.16667"}),t("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),t("feBlend",{mode:"overlay",in2:"BackgroundImageFix",result:"effect1_dropShadow"}),t("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow",result:"shape"})]}),i("linearGradient",{id:a,x1:"49.9392",y1:"0.257812",x2:"49.9392",y2:"99.7423",gradientUnits:"userSpaceOnUse",children:[t("stop",{stopColor:"white"}),t("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]})]})]})}var o=/^#[0-9a-fA-F]{3,8}$/,s=/^(?:rgba?|hsla?|oklch)\([^)]+\)$/,a=new Set(["black","white","red","blue","green","yellow","orange","purple","pink","gray","grey","cyan","magenta","brown","navy","teal","maroon","olive","silver","aqua","fuchsia","lime"]);function d(e){let t=e.trim();return o.test(t)||s.test(t)||a.has(t.toLowerCase())}function h(e,i){return t("span",{style:{display:"inline-block",width:10,height:10,backgroundColor:e,border:"1px solid rgba(0,0,0,0.15)",borderRadius:2,verticalAlign:"middle",marginRight:3}},i)}function p(e){let i=e.split(/(?<![^\s([{])(@(?:codex|claude))(?=$|[\s.,!?:;)\]}])/gi);return 1===i.length?e:i.map((e,i)=>i%2?t("strong",{"data-popmelt-tool-mention":!0,children:e},i):e)}function c(e){let r,o=[],s=/(`[^`]+`)|(\*\*\*(.+?)\*\*\*)|(\*\*(.+?)\*\*)|(\*(.+?)\*)|(_([^_]+?)_)|(\[([^\]]+)\]\(([^)]+)\))|(#[0-9a-fA-F]{3,8})(?![0-9a-fA-F])|((?:rgba?|hsla?|oklch)\([^)]+\))/g,a=0;for(;null!==(r=s.exec(e));){if(r.index>a&&o.push(p(e.slice(a,r.index))),r[1]){let e=r[1].slice(1,-1);d(e)&&o.push(h(e,`sw-${r.index}`)),o.push(t("code",{style:{fontFamily:l,fontSize:"0.9em",backgroundColor:"rgba(0,0,0,0.06)",padding:"1px 4px",borderRadius:2},children:e},r.index))}else if(void 0!==r[3])o.push(t("strong",{children:t("em",{children:r[3]})},r.index));else if(void 0!==r[5])o.push(t("strong",{children:r[5]},r.index));else if(void 0!==r[7])o.push(t("em",{children:r[7]},r.index));else if(void 0!==r[9])o.push(t("em",{children:r[9]},r.index));else if(void 0!==r[11]&&void 0!==r[12]){let e=r[12],s=!/^https?:\/\/|^mailto:/i.test(e),a=s?`vscode://file/${e}`:e;s?o.push(i("a",{href:a,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline",whiteSpace:"nowrap",backgroundColor:"rgba(0,0,0,0.06)",padding:"1px 4px",borderRadius:2,fontFamily:l,fontSize:"0.9em"},children:[r[11],t(n,{})]},r.index)):o.push(t("a",{href:a,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:r[11]},r.index))}else void 0!==r[13]?(o.push(h(r[13],`sw-${r.index}`)),o.push(r[13])):void 0!==r[14]&&(o.push(h(r[14],`sw-${r.index}`)),o.push(r[14]));a=r.index+r[0].length}return a<e.length&&o.push(p(e.slice(a))),o}function f(e){let i=e.split("\n"),r=[],n=0;for(;n<i.length;){let e=i[n];if(e.trimStart().startsWith("```")){let e=[];for(n++;n<i.length&&!i[n].trimStart().startsWith("```");)e.push(i[n]),n++;n++,r.push(t("pre",{style:{fontFamily:l,fontSize:"0.9em",lineHeight:1.4,backgroundColor:"rgba(0,0,0,0.04)",padding:"6px 8px",margin:"4px 0",overflowX:"auto",whiteSpace:"pre"},children:e.join("\n")},r.length));continue}if(/^(-{3,}|\*{3,}|_{3,})\s*$/.test(e)){r.push(t("hr",{style:{border:"none",borderTop:"1px solid rgba(0,0,0,0.1)",margin:"6px 0"}},r.length)),n++;continue}let o=e.match(/^(#{1,4})\s+(.+)/);if(o){let e=o[1].length,i={1:16,2:14,3:13,4:12};r.push(t("div",{style:{fontWeight:700,fontSize:i[e]??12,margin:"8px 0 2px"},children:c(o[2])},r.length)),n++;continue}if(e.trimStart().startsWith("|")&&e.trimEnd().endsWith("|")){let e=[];for(;n<i.length&&i[n].trimStart().startsWith("|")&&i[n].trimEnd().endsWith("|");)e.push(i[n]),n++;let l=e=>/^\|[\s\-:|]+\|$/.test(e),o=e.filter(e=>!l(e)),s=e=>e.split("|").slice(1,-1).map(e=>e.trim()),a=e=>/^\*\*.+\*\*$/.test(e)||/^__.+__$/.test(e),d=o.map(s),h=d.length>1&&d.slice(1).every(e=>e[0]&&a(e[0])),p=d.length>0&&d[0].every(e=>a(e));r.push(t("div",{style:{overflowX:"auto",margin:"4px 0",paddingBottom:4},children:t("table",{style:{borderCollapse:"separate",borderSpacing:0,fontSize:"0.95em",width:"max-content",minWidth:"100%"},children:t("tbody",{children:o.map((e,i)=>t("tr",{children:s(e).map((e,l)=>t(0===i?"th":"td",{style:{border:"1px solid rgba(0,0,0,0.1)",padding:"3px 6px",textAlign:"left",fontWeight:0===i?600:400,minWidth:60,whiteSpace:"nowrap",...0===l&&h||0===i&&p?{position:"sticky",...0===l&&h?{left:0}:{},...0===i&&p?{top:0}:{},background:"#fff",zIndex:0===l&&h&&0===i&&p?2:1}:{}},children:c(e)},l))},i))})})},r.length));continue}if(e.match(/^(\s*)([-*])\s+(.+)/)){let e=[];for(;n<i.length;){let t=i[n].match(/^\s*[-*]\s+(.+)/);if(t)e.push(t[1]),n++;else{if(!(e.length>0&&i[n].match(/^\s+\S/))||i[n].match(/^\s*\d+\.\s/)||i[n].match(/^\s*[-*]\s+/))break;e[e.length-1]+=" "+i[n].trim(),n++}}r.push(t("ul",{style:{margin:0,paddingLeft:20,listStyleType:"disc",display:"flex",flexDirection:"column",gap:8,fontSize:"inherit",lineHeight:"inherit"},children:e.map((e,i)=>t("li",{children:c(e)},i))},r.length));continue}let s=e.match(/^(\s*)(\d+)\.\s+(.+)/);if(s){let e=s[1].length,l=parseInt(s[2],10)||1,o=[],a=null;for(;n<i.length;){let t=i[n],l=t.match(/^(\s*)(\d+)\.\s+(.+)/);if(l&&l[1].length===e)a=[l[3]],o.push(a),n++;else if(a&&""===t.trim())n++;else if(o.length>0&&i[n].match(/^\s+\S/)&&!i[n].match(/^\s*\d+\.\s/)&&!i[n].match(/^\s*[-*]\s+/))a.push(i[n].trim()),n++;else if(a&&/^(Eval|Checks|Sources|Rationale|Prompt|Assertions?|Reason|Why|Expected|Notes?):/i.test(t.trim()))a.push(t.trim()),n++;else{if(!(a&&a.length>1&&t.trim())||t.match(/^(#{1,4})\s+/)||t.trimStart().startsWith("|")||t.match(/^\s*[-*]\s+/)||t.match(/^\s*\d+\.\s+/)||/^(\*\*)?[A-Z][A-Za-z /&-]{2,40}(\*\*)?$/.test(t.trim()))break;a.push(t.trim()),n++}}r.push(t("ol",{start:l,style:{margin:0,paddingLeft:20,listStyleType:"decimal",display:"flex",flexDirection:"column",gap:8,fontSize:"inherit",lineHeight:"inherit"},children:o.map((e,i)=>t("li",{children:t("div",{style:{display:"flex",flexDirection:"column",gap:6},children:e.map((e,i)=>t("div",{children:c(e)},i))})},i))},r.length));continue}""!==e.trim()?(r.push(t("div",{style:{fontSize:"inherit",lineHeight:"inherit"},children:c(e)},r.length)),n++):n++}return t("div",{style:{display:"flex",flexDirection:"column",fontSize:"inherit",gap:8,lineHeight:"inherit"},children:r})}var m={color:"var(--popmelt-thread-primary)",fontSize:14,letterSpacing:"0.14px",lineHeight:1.3,wordBreak:"break-word"};function u({text:i}){return t("div",{"data-popmelt-response-text":"",style:m,children:t(e,{children:f(i)})})}function g(e){let t=e.createElement("style");return t.textContent=":root, body { overflow: hidden !important; overscroll-behavior: none !important; }",e.head.append(t),()=>t.remove()}export{p as a,f as b,m as c,u as d,g as e};
|
|
1
|
+
"use client";import{c as e}from"./chunk-ZSL57PQ7.mjs";import{jsx as t,jsxs as i}from"react/jsx-runtime";var l="ui-monospace, SFMono-Regular, Menlo, monospace",r=0;function n({size:e=11}){let l=++r,n=`pm-vs-m${l}`,o=`pm-vs-f0-${l}`,s=`pm-vs-f1-${l}`,a=`pm-vs-g${l}`;return i("svg",{width:e,height:e,viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",verticalAlign:"middle",marginLeft:3,flexShrink:0},children:[t("mask",{id:n,style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"100",height:"100",children:t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M70.9119 99.3171C72.4869 99.9307 74.2828 99.8914 75.8725 99.1264L96.4608 89.2197C98.6242 88.1787 100 85.9892 100 83.5872V16.4133C100 14.0113 98.6243 11.8218 96.4609 10.7808L75.8725 0.873756C73.7862 -0.130129 71.3446 0.11576 69.5135 1.44695C69.252 1.63711 69.0028 1.84943 68.769 2.08341L29.3551 38.0415L12.1872 25.0096C10.589 23.7965 8.35363 23.8959 6.86933 25.2461L1.36303 30.2549C-0.452552 31.9064 -0.454633 34.7627 1.35853 36.417L16.2471 50.0001L1.35853 63.5832C-0.454633 65.2374 -0.452552 68.0938 1.36303 69.7453L6.86933 74.7541C8.35363 76.1043 10.589 76.2037 12.1872 74.9905L29.3551 61.9587L68.769 97.9167C69.3925 98.5406 70.1246 99.0104 70.9119 99.3171ZM75.0152 27.2989L45.1091 50.0001L75.0152 72.7012V27.2989Z",fill:"white"})}),i("g",{mask:`url(#${n})`,children:[t("path",{d:"M96.4614 10.7962L75.8569 0.875542C73.4719 -0.272773 70.6217 0.211611 68.75 2.08333L1.29858 63.5832C-0.515693 65.2373 -0.513607 68.0937 1.30308 69.7452L6.81272 74.754C8.29793 76.1042 10.5347 76.2036 12.1338 74.9905L93.3609 13.3699C96.086 11.3026 100 13.2462 100 16.6667V16.4275C100 14.0265 98.6246 11.8378 96.4614 10.7962Z",fill:"#0065A9"}),t("g",{filter:`url(#${o})`,children:t("path",{d:"M96.4614 89.2038L75.8569 99.1245C73.4719 100.273 70.6217 99.7884 68.75 97.9167L1.29858 36.4169C-0.515693 34.7627 -0.513607 31.9063 1.30308 30.2548L6.81272 25.246C8.29793 23.8958 10.5347 23.7964 12.1338 25.0095L93.3609 86.6301C96.086 88.6974 100 86.7538 100 83.3334V83.5726C100 85.9735 98.6246 88.1622 96.4614 89.2038Z",fill:"#007ACC"})}),t("g",{filter:`url(#${s})`,children:t("path",{d:"M75.8578 99.1263C73.4721 100.274 70.6219 99.7885 68.75 97.9166C71.0564 100.223 75 98.5895 75 95.3278V4.67213C75 1.41039 71.0564 -0.223106 68.75 2.08329C70.6219 0.211402 73.4721 -0.273666 75.8578 0.873633L96.4587 10.7807C98.6234 11.8217 100 14.0112 100 16.4132V83.5871C100 85.9891 98.6234 88.1786 96.4586 89.2196L75.8578 99.1263Z",fill:"#1F9CF0"})}),t("g",{style:{mixBlendMode:"overlay"},opacity:"0.25",children:t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M70.8511 99.3171C72.4261 99.9306 74.2221 99.8913 75.8117 99.1264L96.4 89.2197C98.5634 88.1787 99.9392 85.9892 99.9392 83.5871V16.4133C99.9392 14.0112 98.5635 11.8217 96.4001 10.7807L75.8117 0.873695C73.7255 -0.13019 71.2838 0.115699 69.4527 1.44688C69.1912 1.63705 68.942 1.84937 68.7082 2.08335L29.2943 38.0414L12.1264 25.0096C10.5283 23.7964 8.29285 23.8959 6.80855 25.246L1.30225 30.2548C-0.513334 31.9064 -0.515415 34.7627 1.29775 36.4169L16.1863 50L1.29775 63.5832C-0.515415 65.2374 -0.513334 68.0937 1.30225 69.7452L6.80855 74.754C8.29285 76.1042 10.5283 76.2036 12.1264 74.9905L29.2943 61.9586L68.7082 97.9167C69.3317 98.5405 70.0638 99.0104 70.8511 99.3171ZM74.9544 27.2989L45.0483 50L74.9544 72.7012V27.2989Z",fill:`url(#${a})`})})]}),i("defs",{children:[i("filter",{id:o,x:"-8.39411",y:"15.8291",width:"116.727",height:"92.2456",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[t("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),t("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),t("feOffset",{}),t("feGaussianBlur",{stdDeviation:"4.16667"}),t("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),t("feBlend",{mode:"overlay",in2:"BackgroundImageFix",result:"effect1_dropShadow"}),t("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow",result:"shape"})]}),i("filter",{id:s,x:"60.4167",y:"-8.07558",width:"47.9167",height:"116.151",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[t("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),t("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),t("feOffset",{}),t("feGaussianBlur",{stdDeviation:"4.16667"}),t("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),t("feBlend",{mode:"overlay",in2:"BackgroundImageFix",result:"effect1_dropShadow"}),t("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow",result:"shape"})]}),i("linearGradient",{id:a,x1:"49.9392",y1:"0.257812",x2:"49.9392",y2:"99.7423",gradientUnits:"userSpaceOnUse",children:[t("stop",{stopColor:"white"}),t("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]})]})]})}var o=/^#[0-9a-fA-F]{3,8}$/,s=/^(?:rgba?|hsla?|oklch)\([^)]+\)$/,a=new Set(["black","white","red","blue","green","yellow","orange","purple","pink","gray","grey","cyan","magenta","brown","navy","teal","maroon","olive","silver","aqua","fuchsia","lime"]);function d(e){let t=e.trim();return o.test(t)||s.test(t)||a.has(t.toLowerCase())}function h(e,i){return t("span",{style:{display:"inline-block",width:10,height:10,backgroundColor:e,border:"1px solid rgba(0,0,0,0.15)",borderRadius:2,verticalAlign:"middle",marginRight:3}},i)}function p(e){let i=e.split(/(?<![^\s([{])(@(?:codex|claude))(?=$|[\s.,!?:;)\]}])/gi);return 1===i.length?e:i.map((e,i)=>i%2?t("strong",{"data-popmelt-tool-mention":!0,children:e},i):e)}function c(e){let r,o=[],s=/(`[^`]+`)|(\*\*\*(.+?)\*\*\*)|(\*\*(.+?)\*\*)|(\*(.+?)\*)|(_([^_]+?)_)|(\[([^\]]+)\]\(([^)]+)\))|(#[0-9a-fA-F]{3,8})(?![0-9a-fA-F])|((?:rgba?|hsla?|oklch)\([^)]+\))/g,a=0;for(;null!==(r=s.exec(e));){if(r.index>a&&o.push(p(e.slice(a,r.index))),r[1]){let e=r[1].slice(1,-1);d(e)&&o.push(h(e,`sw-${r.index}`)),o.push(t("code",{style:{fontFamily:l,fontSize:"0.9em",backgroundColor:"rgba(0,0,0,0.06)",padding:"1px 4px",borderRadius:2},children:e},r.index))}else if(void 0!==r[3])o.push(t("strong",{children:t("em",{children:r[3]})},r.index));else if(void 0!==r[5])o.push(t("strong",{children:r[5]},r.index));else if(void 0!==r[7])o.push(t("em",{children:r[7]},r.index));else if(void 0!==r[9])o.push(t("em",{children:r[9]},r.index));else if(void 0!==r[11]&&void 0!==r[12]){let e=r[12],s=!/^https?:\/\/|^mailto:/i.test(e),a=s?`vscode://file/${e}`:e;s?o.push(i("a",{href:a,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline",whiteSpace:"nowrap",backgroundColor:"rgba(0,0,0,0.06)",padding:"1px 4px",borderRadius:2,fontFamily:l,fontSize:"0.9em"},children:[r[11],t(n,{})]},r.index)):o.push(t("a",{href:a,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:r[11]},r.index))}else void 0!==r[13]?(o.push(h(r[13],`sw-${r.index}`)),o.push(r[13])):void 0!==r[14]&&(o.push(h(r[14],`sw-${r.index}`)),o.push(r[14]));a=r.index+r[0].length}return a<e.length&&o.push(p(e.slice(a))),o}function f(e){let i=e.split("\n"),r=[],n=0;for(;n<i.length;){let e=i[n];if(e.trimStart().startsWith("```")){let e=[];for(n++;n<i.length&&!i[n].trimStart().startsWith("```");)e.push(i[n]),n++;n++,r.push(t("pre",{style:{fontFamily:l,fontSize:"0.9em",lineHeight:1.4,backgroundColor:"rgba(0,0,0,0.04)",padding:"6px 8px",margin:"4px 0",overflowX:"auto",whiteSpace:"pre"},children:e.join("\n")},r.length));continue}if(/^(-{3,}|\*{3,}|_{3,})\s*$/.test(e)){r.push(t("hr",{style:{border:"none",borderTop:"1px solid rgba(0,0,0,0.1)",margin:"6px 0"}},r.length)),n++;continue}let o=e.match(/^(#{1,4})\s+(.+)/);if(o){let e=o[1].length,i={1:16,2:14,3:13,4:12};r.push(t("div",{style:{fontWeight:700,fontSize:i[e]??12,margin:"8px 0 2px"},children:c(o[2])},r.length)),n++;continue}if(e.trimStart().startsWith("|")&&e.trimEnd().endsWith("|")){let e=[];for(;n<i.length&&i[n].trimStart().startsWith("|")&&i[n].trimEnd().endsWith("|");)e.push(i[n]),n++;let l=e=>/^\|[\s\-:|]+\|$/.test(e),o=e.filter(e=>!l(e)),s=e=>e.split("|").slice(1,-1).map(e=>e.trim()),a=e=>/^\*\*.+\*\*$/.test(e)||/^__.+__$/.test(e),d=o.map(s),h=d.length>1&&d.slice(1).every(e=>e[0]&&a(e[0])),p=d.length>0&&d[0].every(e=>a(e));r.push(t("div",{style:{overflowX:"auto",margin:"4px 0",paddingBottom:4},children:t("table",{style:{borderCollapse:"separate",borderSpacing:0,fontSize:"0.95em",width:"max-content",minWidth:"100%"},children:t("tbody",{children:o.map((e,i)=>t("tr",{children:s(e).map((e,l)=>t(0===i?"th":"td",{style:{border:"1px solid rgba(0,0,0,0.1)",padding:"3px 6px",textAlign:"left",fontWeight:0===i?600:400,minWidth:60,whiteSpace:"nowrap",...0===l&&h||0===i&&p?{position:"sticky",...0===l&&h?{left:0}:{},...0===i&&p?{top:0}:{},background:"#fff",zIndex:0===l&&h&&0===i&&p?2:1}:{}},children:c(e)},l))},i))})})},r.length));continue}if(e.match(/^(\s*)([-*])\s+(.+)/)){let e=[];for(;n<i.length;){let t=i[n].match(/^\s*[-*]\s+(.+)/);if(t)e.push(t[1]),n++;else{if(!(e.length>0&&i[n].match(/^\s+\S/))||i[n].match(/^\s*\d+\.\s/)||i[n].match(/^\s*[-*]\s+/))break;e[e.length-1]+=" "+i[n].trim(),n++}}r.push(t("ul",{style:{margin:0,paddingLeft:20,listStyleType:"disc",display:"flex",flexDirection:"column",gap:8,fontSize:"inherit",lineHeight:"inherit"},children:e.map((e,i)=>t("li",{children:c(e)},i))},r.length));continue}let s=e.match(/^(\s*)(\d+)\.\s+(.+)/);if(s){let e=s[1].length,l=parseInt(s[2],10)||1,o=[],a=null;for(;n<i.length;){let t=i[n],l=t.match(/^(\s*)(\d+)\.\s+(.+)/);if(l&&l[1].length===e)a=[l[3]],o.push(a),n++;else if(a&&""===t.trim())n++;else if(o.length>0&&i[n].match(/^\s+\S/)&&!i[n].match(/^\s*\d+\.\s/)&&!i[n].match(/^\s*[-*]\s+/))a.push(i[n].trim()),n++;else if(a&&/^(Eval|Checks|Sources|Rationale|Prompt|Assertions?|Reason|Why|Expected|Notes?):/i.test(t.trim()))a.push(t.trim()),n++;else{if(!(a&&a.length>1&&t.trim())||t.match(/^(#{1,4})\s+/)||t.trimStart().startsWith("|")||t.match(/^\s*[-*]\s+/)||t.match(/^\s*\d+\.\s+/)||/^(\*\*)?[A-Z][A-Za-z /&-]{2,40}(\*\*)?$/.test(t.trim()))break;a.push(t.trim()),n++}}r.push(t("ol",{start:l,style:{margin:0,paddingLeft:20,listStyleType:"decimal",display:"flex",flexDirection:"column",gap:8,fontSize:"inherit",lineHeight:"inherit"},children:o.map((e,i)=>t("li",{children:t("div",{style:{display:"flex",flexDirection:"column",gap:6},children:e.map((e,i)=>t("div",{children:c(e)},i))})},i))},r.length));continue}""!==e.trim()?(r.push(t("div",{style:{fontSize:"inherit",lineHeight:"inherit"},children:c(e)},r.length)),n++):n++}return t("div",{style:{display:"flex",flexDirection:"column",fontSize:"inherit",gap:8,lineHeight:"inherit"},children:r})}var m={color:"var(--popmelt-thread-primary)",fontSize:14,letterSpacing:"0.14px",lineHeight:1.3,wordBreak:"break-word"};function u({text:i}){return t("div",{"data-popmelt-response-text":"",style:m,children:t(e,{children:f(i)})})}export{p as a,f as b,m as c,u as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a as e}from"./chunk-G6RYESYI.mjs";import{ua as t,A as r,B as n,Oa as i,D as o}from"./chunk-MSWXKP77.mjs";import{a as l}from"./chunk-57FM7XQV.mjs";import{useId as a,useState as s,useRef as d,useCallback as u,useLayoutEffect as c,useEffect as p,useMemo as f}from"react";import{jsx as L,jsxs as h,Fragment as m}from"react/jsx-runtime";var v={id:"",label:"Codex default",source:"cli",isDefault:!0};function g(e){return[v,...e.filter(e=>""!==e.id)]}var C={id:"",label:"Claude default",source:"static"};function b(e){return/^claude-(?:ai|code)(?:$|[-.])/i.test(e)}function x(e){return[C,...e.filter(e=>e.id&&!b(e.id))]}function y({size:e=16,style:t}){return L("svg",{width:e,height:e,viewBox:"0 0 1200 1200",fill:"currentColor",stroke:"none",style:{flexShrink:0,...t},children:L("path",{d:"M 233.959793 800.214905 L 468.644287 668.536987 L 472.590637 657.100647 L 468.644287 650.738403 L 457.208069 650.738403 L 417.986633 648.322144 L 283.892639 644.69812 L 167.597321 639.865845 L 54.926208 633.825623 L 26.577238 627.785339 L 3.3e-05 592.751709 L 2.73832 575.27533 L 26.577238 559.248352 L 60.724873 562.228149 L 136.187973 567.382629 L 249.422867 575.194763 L 331.570496 580.026978 L 453.261841 592.671082 L 472.590637 592.671082 L 475.328857 584.859009 L 468.724915 580.026978 L 463.570557 575.194763 L 346.389313 495.785217 L 219.543671 411.865906 L 153.100723 363.543762 L 117.181267 339.060425 L 99.060455 316.107361 L 91.248367 266.01355 L 123.865784 230.093994 L 167.677887 233.073853 L 178.872513 236.053772 L 223.248367 270.201477 L 318.040283 343.570496 L 441.825592 434.738342 L 459.946411 449.798706 L 467.194672 444.64447 L 468.080597 441.020203 L 459.946411 427.409485 L 392.617493 305.718323 L 320.778564 181.932983 L 288.80542 130.630859 L 280.348999 99.865845 C 277.369171 87.221436 275.194641 76.590698 275.194641 63.624268 L 312.322174 13.20813 L 332.8591 6.604126 L 382.389313 13.20813 L 403.248352 31.328979 L 434.013519 101.71814 L 483.865753 212.537048 L 561.181274 363.221497 L 583.812134 407.919434 L 595.892639 449.315491 L 600.40271 461.959839 L 608.214783 461.959839 L 608.214783 454.711609 L 614.577271 369.825623 L 626.335632 265.61084 L 637.771851 131.516846 L 641.718201 93.745117 L 660.402832 48.483276 L 697.530334 24.000122 L 726.52356 37.852417 L 750.362549 72 L 747.060486 94.067139 L 732.886047 186.201416 L 705.100708 330.52356 L 686.979919 427.167847 L 697.530334 427.167847 L 709.61084 415.087341 L 758.496704 350.174561 L 840.644348 247.490051 L 876.885925 206.738342 L 919.167847 161.71814 L 946.308838 140.29541 L 997.61084 140.29541 L 1035.38269 196.429626 L 1018.469849 254.416199 L 965.637634 321.422852 L 921.825562 378.201538 L 859.006714 462.765259 L 819.785278 530.41626 L 823.409424 535.812073 L 832.75177 534.92627 L 974.657776 504.724915 L 1051.328979 490.872559 L 1142.818848 475.167786 L 1184.214844 494.496582 L 1188.724854 514.147644 L 1172.456421 554.335693 L 1074.604126 578.496765 L 959.838989 601.449829 L 788.939636 641.879272 L 786.845764 643.409485 L 789.261841 646.389343 L 866.255127 653.637634 L 899.194702 655.409424 L 979.812134 655.409424 L 1129.932861 666.604187 L 1169.154419 692.537109 L 1192.671265 724.268677 L 1188.724854 748.429688 L 1128.322144 779.194641 L 1046.818848 759.865845 L 856.590759 714.604126 L 791.355774 698.335754 L 782.335693 698.335754 L 782.335693 703.731567 L 836.69812 756.885986 L 936.322205 846.845581 L 1061.073975 962.81897 L 1067.436279 991.490112 L 1051.409424 1014.120911 L 1034.496704 1011.704712 L 924.885986 929.234924 L 882.604126 892.107544 L 786.845764 811.48999 L 780.483276 811.48999 L 780.483276 819.946289 L 802.550415 852.241699 L 919.087341 1027.409424 L 925.127625 1081.127686 L 916.671204 1098.604126 L 886.469849 1109.154419 L 853.288696 1103.114136 L 785.073914 1007.355835 L 714.684631 899.516785 L 657.906067 802.872498 L 650.979858 806.81897 L 617.476624 1167.704834 L 601.771851 1186.147705 L 565.530212 1200 L 535.328857 1177.046997 L 519.302124 1139.919556 L 535.328857 1066.550537 L 554.657776 970.792053 L 570.362488 894.68457 L 584.536926 800.134277 L 592.993347 768.724976 L 592.429626 766.630859 L 585.503479 767.516968 L 514.22821 865.369263 L 405.825531 1011.865906 L 320.053711 1103.677979 L 299.516815 1111.812256 L 263.919525 1093.369263 L 267.221497 1060.429688 L 287.114136 1031.114136 L 405.825531 880.107361 L 477.422913 786.52356 L 523.651062 732.483276 L 523.328918 724.671265 L 520.590698 724.671265 L 205.288605 929.395935 L 149.154434 936.644409 L 124.993355 914.01355 L 127.973183 876.885986 L 139.409409 864.80542 L 234.201385 799.570435 L 233.879227 799.8927 Z"})})}function w({size:e=16,style:t,gradient:r}){let n=a();return h("svg",{width:e,height:e,viewBox:"1.7 1.7 20.6 20.6",fill:r?`url(#${n})`:"currentColor",stroke:"none",style:{flexShrink:0,...t},children:[r&&L("defs",{children:h("linearGradient",{id:n,x2:"0%",y2:"100%",children:[L("stop",{offset:"0%",stopColor:"#aca6ff"}),L("stop",{offset:"50%",stopColor:"#7a9cff"}),L("stop",{offset:"100%",stopColor:"#3f49ff"})]})}),L("path",{fillRule:"evenodd",d:"M9.3316 2.03768C11.1644 1.54688 13.0268 2.04668 14.356 3.20174C16.0859 2.86512 17.9511 3.36418 19.2935 4.70663C20.6356 6.04882 21.1326 7.91288 20.7964 9.64217C21.9527 10.9716 22.4534 12.8349 21.9625 14.6685C21.4711 16.5025 20.1051 17.8657 18.439 18.439C17.8658 20.1047 16.503 21.47 14.6695 21.9615C12.8356 22.4528 10.9727 21.9519 9.64312 20.7955C7.91371 21.1319 6.04993 20.635 4.70757 19.2926C3.36558 17.9505 2.86659 16.0866 3.20269 14.357C2.04693 13.0273 1.54757 11.1638 2.03863 9.33065C2.52997 7.49759 3.89436 6.13282 5.56011 5.55917C6.13382 3.8935 7.49837 2.52891 9.3316 2.03768Z M16.0005 13.5992C16.4972 13.5995 16.9007 14.0029 16.9009 14.4996C16.9009 14.9965 16.4974 15.3997 16.0005 15.4H13.0005C12.5035 15.4 12.1002 14.9967 12.1002 14.4996C12.1004 14.0027 12.5036 13.5992 13.0005 13.5992H16.0005Z M8.03765 8.72811C8.46377 8.47284 9.01638 8.61074 9.27203 9.03671L10.6177 11.2789C10.8836 11.7221 10.8834 12.277 10.6177 12.7203L9.27203 14.9625C9.01633 15.3887 8.46385 15.5267 8.03765 15.2711C7.61143 15.0153 7.47333 14.4629 7.72906 14.0367L8.95074 11.9996L7.72906 9.96249C7.47341 9.53628 7.61146 8.98382 8.03765 8.72811Z"})]})}function k({size:e=16,style:t}){return L("svg",{width:e,height:e,viewBox:"0 0 49.7202 40.0402",fill:"currentColor",stroke:"none",style:{flexShrink:0,...t},children:L("path",{d:"M29.8768 25.3531C30.9809 25.3531 31.876 26.2481 31.876 27.3522V31.3505C31.876 32.4545 30.9809 33.3496 29.8768 33.3496C28.7727 33.3496 27.8777 32.4545 27.8777 31.3505V27.3522C27.8777 26.2481 28.7727 25.3531 29.8768 25.3531ZM19.8812 25.3531C20.9852 25.3531 21.8803 26.2481 21.8803 27.3522V31.3505C21.8803 32.4545 20.9852 33.3496 19.8812 33.3496C18.7771 33.3496 17.882 32.4545 17.882 31.3505V27.3522C17.882 26.2481 18.7771 25.3531 19.8812 25.3531ZM24.8601 40.8772C36.974 40.8772 46.9603 33.8278 48.6801 30.8403C48.8058 30.6218 48.8464 30.3723 48.8464 30.1202V24.8018C48.8464 24.5813 48.8124 24.3622 48.7308 24.1574C47.9871 22.2899 46.0394 19.5773 43.5257 18.8495C43.1925 17.994 42.6989 16.7433 42.2384 15.8201C42.3154 15.1138 42.3426 14.3853 42.3426 13.6492C42.3426 10.99 41.7789 8.65743 40.0805 6.92044C39.2872 6.10915 38.3028 5.48684 37.1355 5.01903C34.3398 2.74775 30.2723 0.837036 24.8169 0.837036C19.3616 0.837036 15.3805 2.74775 12.5847 5.01903C11.4174 5.48684 10.433 6.10915 9.63975 6.92044C7.9413 8.65743 7.37764 10.99 7.37764 13.6492C7.37764 14.3853 7.40477 15.1138 7.48186 15.8201C7.02133 16.7433 6.52774 17.994 6.19449 18.8495C3.68082 19.5773 1.73309 22.2899 0.989389 24.1574C0.907813 24.3622 0.873779 24.5813 0.873779 24.8018V30.1202C0.873779 30.3723 0.914376 30.6218 1.04014 30.8403C2.75994 33.8278 12.7462 40.8772 24.8601 40.8772ZM26.485 13.0046C26.4 12.3422 26.3595 11.749 26.3584 11.2191L26.3584 11.1772C26.361 9.63975 26.6971 8.63938 27.2339 8.02499C27.9156 7.2448 29.3246 6.64707 32.2941 6.96844C35.3026 7.29402 36.9842 8.04072 37.9376 9.01574C38.8606 9.95971 39.3455 11.372 39.3455 13.6492C39.3455 16.0687 38.9969 17.4982 38.2302 18.3678C37.5012 19.1946 36.0656 19.8674 32.9214 19.8674C30.5041 19.8674 29.1221 19.0812 28.2386 17.9939C27.2899 16.8264 26.7559 15.1161 26.485 13.0046ZM23.2353 13.0046C23.3203 12.3422 23.3607 11.749 23.3619 11.2191L23.3619 11.1772C23.3592 9.63974 23.0232 8.63937 22.4863 8.02498C21.8046 7.24479 20.3957 6.64707 17.4261 6.96843C14.4176 7.29402 12.736 8.04071 11.7826 9.01573C10.8596 9.9597 10.3747 11.372 10.3747 13.6492C10.3747 16.0687 10.7234 17.4982 11.49 18.3677C12.219 19.1946 13.6546 19.8674 16.7989 19.8674C19.2161 19.8674 20.5981 19.0812 21.4816 17.9939C22.4304 16.8264 22.9643 15.1161 23.2353 13.0046ZM25.2042 18.8676L25.0543 18.8676C24.8715 18.8678 24.6005 18.868 24.516 18.8676C24.3045 19.2218 24.0693 19.5618 23.8075 19.884C22.2697 21.7764 19.9741 22.8644 16.7988 22.8644C13.3524 22.8644 10.8266 22.1471 9.24196 20.3498C9.15187 20.2476 9.07125 20.1406 9.07125 20.1406L8.87613 20.3498V33.5049C11.7429 35.0628 17.8959 37.8586 24.8601 37.8586C31.8243 37.8586 37.9773 35.0628 40.8441 33.5049V20.3498L40.649 20.1406C40.649 20.1406 40.5829 20.231 40.4783 20.3498C38.8936 22.1471 36.3678 22.8644 32.9214 22.8644C29.7461 22.8644 27.4506 21.7764 25.9127 19.884C25.6509 19.5618 25.4157 19.2218 25.2042 18.8676Z",fillRule:"evenodd",clipRule:"evenodd"})})}function M({size:e=16,style:t,gradient:r}){let n=a();return h("svg",{width:e,height:e,viewBox:"8 8 48 48",fill:"none",style:{flexShrink:0,...t},children:[r&&L("defs",{children:h("linearGradient",{id:n,x2:"65%",y2:"115%",children:[L("stop",{offset:"0%",stopColor:"#df5ecc"}),L("stop",{offset:"57%",stopColor:"#8b65ec"}),L("stop",{offset:"100%",stopColor:"#79b3e7"})]})}),L("path",{fill:r?`url(#${n})`:"currentColor",d:"M14 16h36v8H40v32h-8V24h-6v22h-8V24h-4z"})]})}function E({provider:e,size:t=16,style:r,gradient:n}){return"codex"===e?L(w,{size:t,style:r,gradient:n}):"opencode"===e?h("svg",{width:t,height:t,viewBox:"0 0 16 16","aria-hidden":"true",style:r,children:[L("path",{fill:"currentColor",fillRule:"evenodd",d:"M2 1h12v14H2zM5 4v8h6V4z"}),L("path",{fill:"currentColor",opacity:".4",d:"M5 8h6v4H5z"})]}):"copilot"===e?L(k,{size:t,style:r}):"omp"===e?L(M,{size:t,style:r,gradient:n}):L(y,{size:t,style:r})}var S=[{effort:"low"},{effort:"medium"},{effort:"high"},{effort:"xhigh"},{effort:"max"}],T=[C,{id:"claude-opus-4-6",label:"Opus 4.6",source:"static",supportedReasoningLevels:S},{id:"claude-sonnet-4-6",label:"Sonn 4.6",source:"static",supportedReasoningLevels:S}],z=[v],P=[{id:"",label:"Default",source:"static"}],R=[{id:"",label:"OMP default",source:"static"}],I={claude:T,codex:z,copilot:P,omp:R,opencode:[{id:"",label:"OpenCode default",source:"static"}]},D=[...T,...z,...P,...R];function V(e,t){if("copilot"===t&&!e)return"Copilot";if("opencode"===t&&!e)return"OpenCode";if("omp"===t&&!e)return"OMP";if(!e)return"codex"===t?"Codex":"Claude Code";let r=D.find(t=>t.id===e);return r?r.label:e.replace(/-\d{8,}$/,"")}var $=100,F=200,O={surface:null,phase:"visible"};function H({openDelayMs:e=100,exitDurationMs:t=200,pinnedSurface:r=null}={}){let[n,i]=s(O),o=d(O),l=d(null),a=d(r);a.current=r;let f=d(null),L=d(null),h=u(e=>{o.current.surface===e.surface&&o.current.phase===e.phase||(o.current=e,i(e))},[]),m=u(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]),v=u(()=>{L.current&&(clearTimeout(L.current),L.current=null)},[]),g=u(e=>{l.current=e,m(),v(),h({surface:e,phase:"visible"})},[v,m,h]),C=u(t=>{if(!a.current||o.current.surface!==a.current||t===a.current){if(l.current=t,m(),v(),null!==o.current.surface)return void h({surface:t,phase:"visible"});f.current=setTimeout(()=>{f.current=null,l.current===t&&h({surface:t,phase:"visible"})},e)}},[v,m,e,h]),b=u(e=>{e!==a.current&&(l.current===e&&(l.current=null),m(),o.current.surface===e&&(v(),h({surface:e,phase:"exiting"}),L.current=setTimeout(()=>{L.current=null,null===l.current&&h(O)},t)))},[v,m,t,h]),x=u(e=>{e&&o.current.surface!==e||(l.current=null,m(),v(),h(O))},[v,m,h]);return c(()=>{r&&o.current.surface===r&&g(r)},[r,g]),p(()=>()=>{m(),v()},[v,m]),{surface:n.surface,phase:n.phase,enter:C,leave:b,show:g,dismiss:x}}function A(e){let t=(e.id||e.label).replace(/^.*\//,"").match(/(?:^|[\s-])(\d+)(?:[.\s-](\d{1,2}))?/);return t?1e3*Number(t[1])+Number(t[2]??0):0}function X(e){if(void 0!==e.tierRank)return e.tierRank;let t=`${e.id} ${e.label}`.toLowerCase();return/\b(nano|spark|haiku)\b/.test(t)?1:/\b(mini|luna|flash)\b/.test(t)?2:/\b(terra|sonnet)\b/.test(t)?3:/\b(sol|opus|pro)\b/.test(t)?4:/\b(fable|ultra)\b/.test(t)?5:3}function B(e){let t=e.length>0&&e.every(({model:e})=>e.releaseDate&&Number.isFinite(Date.parse(e.releaseDate)));return[...e].sort((e,r)=>(t?Date.parse(e.model.releaseDate)-Date.parse(r.model.releaseDate):A(e.model)-A(r.model))||X(e.model)-X(r.model)||(r.model.catalogPriority??-r.index)-(e.model.catalogPriority??-e.index))}function N(e,t){return B(t.map((e,t)=>({index:t,model:e})))}function Z(e){let t=e?.speedTiers?.filter(e=>"default"!==e.id);return t?.length?[{value:"default",label:"Normal"},...t.map(e=>({value:e.id,label:e.label}))]:[]}function j(e,t){let r=t.serviceTier;if(!r||"default"===r||e.speedTiers?.some(({id:e})=>e===r))return t;let n="fast"===r&&e.speedTiers?.some(({id:e})=>"priority"===e);return{...t,serviceTier:n?"priority":void 0}}function G(e,t){return t?B(e.flatMap((e,r)=>e.upstreamProvider===t?[{index:r,model:e}]:[])):[]}function Y(e){let t={anthropic:"Anthropic","openai-codex":"OpenAI Codex",openai:"OpenAI",openrouter:"OpenRouter"};return t[e]?t[e]:e.split(/[-_]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function W(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"")}function U(e,t,r){let n=e.getRootNode().elementFromPoint?.(t,r)??e.ownerDocument.elementFromPoint?.(t,r);return n instanceof Node&&e.contains(n)}function q(e,t,r,n){let i=()=>{e.removeEventListener("pointermove",l,!0),e.removeEventListener("pointerup",o,!0),e.removeEventListener("pointercancel",o,!0),e.defaultView?.removeEventListener("blur",a)},o=e=>{e.pointerId===t&&(i(),r(e))},l=e=>{if(e.pointerId===t){if("mouse"===e.pointerType&&!(1&e.buttons))return void o(e);n?.(e)}},a=()=>{i(),r(null)};return e.addEventListener("pointermove",l,!0),e.addEventListener("pointerup",o,!0),e.addEventListener("pointercancel",o,!0),e.defaultView?.addEventListener("blur",a),i}function K(e,t){if(!t.width||!t.height)return null;let r=e.x<t.left?t.left-e.x:e.x-t.right,n=e.y<t.top?t.top-e.y:e.y-t.bottom;return r<=0&&n<=0?null:n>=r?{axis:"y",distance:n,direction:e.y<t.top?1:-1,start:t.left,end:t.right}:{axis:"x",distance:r,direction:e.x<t.left?1:-1,start:t.top,end:t.bottom}}function Q(e,t,r,n){let i=e.ownerDocument,o=n?.trigger,l=null,a=null,s=null,d=!1,u=e=>{d!==e&&(d=e,n?.onHoldChange?.(e))},c=({x:t,y:r})=>U(e,t,r)||!(!o||!U(o,t,r)),p=()=>{null!==l&&(cancelAnimationFrame(l),l=null)},f=()=>r?.()??(n?e:null),L=(e,r)=>{a?.(),p(),u(!0);let n=e,o=null,l=0,s=0,d=performance.now(),L=d+320,h=(e=!1)=>{a=null,u(!1),cancelAnimationFrame(x),clearTimeout(y),i.removeEventListener("pointermove",v,!0),i.removeEventListener("pointerdown",g,!0),i.removeEventListener("keydown",C,!0),i.defaultView?.removeEventListener("blur",b),e&&!c(n)&&(p(),t(n))},m=()=>{if(!o)return;if(c(n))return void h();let t="x"===o.axis?"y":"x",r=(n[o.axis]-e[o.axis])*o.direction,i=Math.max(0,r/o.distance),a=e[t],u=a+(o.start-a)*i,p=a+(o.end-a)*i,f=6+28*(1-i);if(r<l-6||i>1||n[t]<u-f||n[t]>p+f)return void h(!0);if(l=Math.max(l,r),r-s<12)return;s=r;let m=performance.now(),v=Math.min(d+560,m+160);v<=L||(L=v,clearTimeout(y),y=setTimeout(()=>h(!0),L-m))},v=e=>{"mouse"===e.pointerType&&(n={x:e.clientX,y:e.clientY},m())},g=e=>{n={x:e.clientX,y:e.clientY},h(!0)},C=e=>{"Escape"===e.key&&h(!0)},b=()=>h(!0),x=requestAnimationFrame(()=>{let t=f(),n=t?.getBoundingClientRect();!n||r&&t===r.pane&&n.left===r.bounds.left&&n.top===r.bounds.top&&n.width===r.bounds.width&&n.height===r.bounds.height?h(!0):(o=K(e,n),o?m():h(!0))}),y=setTimeout(()=>h(!0),320);a=h,i.addEventListener("pointermove",v,!0),i.addEventListener("pointerdown",g,!0),i.addEventListener("keydown",C,!0),i.defaultView?.addEventListener("blur",b)},h=r=>{if(null!==s||a||"touch"===r.pointerType)return;let i=r.relatedTarget;if(i instanceof Node&&(e.contains(i)||o?.contains(i)))return;let d={x:r.clientX,y:r.clientY};n&&"mouse"===r.pointerType?L(d):(p(),l=requestAnimationFrame(()=>{l=null,!a&&null===s&&!c(d)&&t(d)}))},m=e=>{if(null!==s||a||0===e.detail||"pointerType"in e&&"mouse"!==e.pointerType)return;let t=f();if(!(t&&e.target instanceof Node&&t.contains(e.target)))return;let r={x:e.clientX,y:e.clientY},n=t.getBoundingClientRect();K(r,n)||L(r,{pane:t,bounds:n})},v=e=>{if(s=null,"mouse"===e?.pointerType){let r={x:e.clientX,y:e.clientY};if("pointercancel"!==e.type)return void L(r);if(!c(r))return u(!1),void t(r)}u(!1)},g=e=>{0!==e.button||s||!(e.target instanceof Element)||!e.target.closest("[data-model-scrub]")||(a?.(),p(),s=q(i,e.pointerId,v),u(!0))};return(r||n)&&e.addEventListener("click",m,!0),e.addEventListener("pointerout",h),e.addEventListener("pointerover",p),o?.addEventListener("pointerout",h),o?.addEventListener("pointerover",p),n&&e.addEventListener("pointerdown",g,!0),()=>{p(),a?.(),s?.(),u(!1),e.removeEventListener("click",m,!0),e.removeEventListener("pointerout",h),e.removeEventListener("pointerover",p),o?.removeEventListener("pointerout",h),o?.removeEventListener("pointerover",p),e.removeEventListener("pointerdown",g,!0)}}var _=e,J={WebkitUserSelect:"none",userSelect:"none"},ee={minimal:"Minimal",low:"Low",medium:"Medium",high:"High",xhigh:"X-high",max:"Max",ultra:"Ultra"};function te(e){let t=e.replace(/-/g," ").replace(/^claude\s+/i,"").replace(/^GPT\s*/i,"GPT ").replace(/^Sonn\b/i,"Sonnet").replace(/^(fable|opus|sonnet)\b/i,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()),r=t.match(/^GPT\s+(\d+)(?:\.(\d+))?\b/i);if(!r)return t;let n=Number(r[1]),i=Number(r[2]??0);return n>5||5===n&&i>=6?t.replace(/^GPT\s+/i,""):t}function re({count:e,index:t,pill:r}){let n=Math.min(e,7),i=t<0?-1:e<=1?0:Math.round(t*(n-1)/(e-1));return L("span",{title:t>=0?`${t+1} of ${e}`:void 0,style:{alignItems:"center",background:r?"var(--picker-control)":"transparent",borderRadius:9,display:"inline-flex",gap:2,justifyContent:"center",padding:r?"2px 4px":4,transition:"background-color 120ms ease, padding 120ms ease"},children:Array.from({length:n},(e,t)=>{let r=t===i;return L("span",{style:0!==t||r?{background:"currentColor",opacity:r?1:.55,borderRadius:999,height:r?3:2,width:r?3:2,transition:"background-color 120ms ease, height 120ms ease, width 120ms ease"}:{background:"currentColor",opacity:.45,borderRadius:2,height:6,width:1,transition:"background-color 120ms ease, height 120ms ease, width 120ms ease"}},t)})})}function ne({icon:e,options:t,selectedIndex:r,displayLabel:n,onSelect:i,scrub:o=!1,settingLabel:l}){let a=d(null),u=d(!1),[p,f]=s(!1),[m,v]=s(!1),g=r>=0&&r<t.length?r:0,C=t[g],b=!i||t.length<=1,x=r<0?"Inherit":C?.label,y=d({onSelect:i,count:t.length});c(()=>{y.current={onSelect:i,count:t.length},(!o||b)&&a.current&&(a.current(),v(!1))},[b,i,t.length,o]),c(()=>()=>a.current?.(),[]);return h("button",{type:"button","aria-label":l?`${l}: ${x}`:void 0,disabled:b,onPointerDown:e=>{if(!o||b||0!==e.button||a.current)return;let t=e.currentTarget,{pointerId:n,clientX:i}=e,l=t.getBoundingClientRect(),s=t.ownerDocument.defaultView,d=s?.visualViewport,c=d?.offsetLeft??0,p=c+(d?.width??s?.innerWidth??l.right),f=Math.max(l.left,c)+4,L=Math.min(l.right,p)-4,h=!1,m=r;u.current=!1,v(!0);let C=e=>{let t=e-i,{count:r,onSelect:n}=y.current,o=Math.min(g,r-1),l=t<0?o:r-1-o,a=Math.max(1,t<0?i-f:L-i);if(!h&&Math.abs(t)<Math.min(4,a))return;h=!0;let s=Math.min(22,a/Math.max(1,l)),d=Math.max(0,Math.min(r-1,o+Math.round(t/s)));d!==m&&(m=d,n?.(d))},x=q(t.ownerDocument,n,e=>{"pointerup"===e?.type&&C(e.clientX),a.current?.(),v(!1),u.current=!!e&&"pointercancel"!==e.type&&(h||!U(t,e.clientX,e.clientY))},e=>C(e.clientX));a.current=()=>{a.current=null,x(),t.hasPointerCapture(n)&&t.releasePointerCapture(n)},t.setPointerCapture(n)},"data-model-scrub":o&&!b?"":void 0,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),onClick:e=>{let n=u.current;u.current=!1,!(e.detail>0&&n)&&(b||i(((r<0?-1:g)+1)%t.length))},style:{alignItems:"center",background:"transparent",border:0,borderRadius:24,color:p||m?"var(--picker-primary)":"var(--picker-secondary)",cursor:b?"default":o?"ew-resize":"pointer",display:"flex",fontFamily:_,fontSize:12,height:30,justifyContent:"space-between",letterSpacing:"0.12px",padding:"8px 6px 8px 10px",touchAction:o?"none":"auto",...J,width:"100%",transition:"background-color 120ms ease, color 120ms ease"},children:[h("span",{style:{alignItems:"center",display:"inline-flex",gap:6,minWidth:0},children:[L(e,{"aria-hidden":"true",size:12,strokeWidth:1.75}),L("span",{style:{...J,lineHeight:1.35,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l??n??C?.label??"Unavailable"})]}),h("span",{style:{alignItems:"center",display:"inline-flex",gap:2},children:[l&&L("span",{style:{...J,fontSize:11},children:x}),L(re,{count:t.length,index:r,pill:p||m})]})]})}function ie({theme:e,visible:o,style:a,provider:u,availableProviders:c=[],models:v,modelIndex:g,agentSettings:C={},onProviderChange:b,onModelChange:x,onAgentSettingsChange:y,triggerRef:w,onHoverExit:k,onHoverHoldChange:M}){let S=d(null);p(()=>{let e=S.current,t=w?.current;if(o&&e&&t&&k)return Q(e,k,void 0,{trigger:t,onHoldChange:M})},[o,w,k,M]);let T="dark"===e?"light":"dark",z=l[T],P=v[g]??v[0],R=f(()=>function(e){return[...new Set(e.flatMap(e=>e.upstreamProvider?[e.upstreamProvider]:[]))]}(v),[v]),I=P?.upstreamProvider??R[0],[D,V]=s(""),[$,F]=s(!1),[O,H]=s(!1),A=f(()=>function(e,t){let r=W(t);return r?e.filter(e=>W(`${e} ${Y(e)}`).includes(r)):e}(R,D),[D,R]),X=function(e,t){if(!e||!t)return"";let r=Y(e);return W(`${e} ${r}`).includes(W(t))?r:""}(A[0],D),B=X.toLowerCase().indexOf(D.trim().toLowerCase());p(()=>{$||V(I?Y(I):"")},[$,I]);let j=e=>{let t=function(e,t){let r=G(e,t);return r.find(e=>e.model.isDefault)?.index??r[0]?.index??0}(v,e);V(Y(e)),F(!1),x?.(t)},U=f(()=>"omp"===u?G(v,I):N(0,v),[v,u,I]),q=U.findIndex(e=>e.index===g),K=U.map(e=>({value:String(e.index),label:te(e.model.label)})),J="claude"===u?["low","medium","high","xhigh","max"]:["low","medium","high","xhigh"],re=P?.supportedReasoningLevels?.map(e=>e.effort)??J,ie=re.map(e=>({value:e,label:ee[e]??e})),oe=C.reasoningEffort??P?.defaultReasoningLevel??re[0],le=Math.max(0,re.indexOf(oe??"")),ae=Z(P),se=f(()=>U.some(({model:e})=>Z(e).length>0),[U]),de=ae.findIndex(e=>e.value===C.serviceTier),ue=["codex","claude","omp","copilot","opencode"].filter(e=>0===c.length||c.includes(e));return h("div",{"data-model-picker":!0,"data-popmelt-font":"sans",ref:S,style:{"--picker-control":z.control,"--picker-primary":z.primary,"--picker-secondary":"dark"===T?z.threadPrimary:z.hoverForeground,colorScheme:T,color:z.primary,background:z.raisedSurface,border:`1px solid ${z.border}`,borderRadius:20,bottom:39,boxSizing:"border-box",display:"flex",flexDirection:"column",left:0,opacity:o?1:0,padding:4,pointerEvents:o?"auto":"none",fontFamily:_,position:"absolute",transition:"opacity 120ms ease",width:Math.max(se?152:139,32*ue.length),zIndex:4,...a},children:[L("div",{style:{display:"flex",width:"100%"},children:ue.map(e=>{let t=u===e;return L("button",{type:"button","aria-label":"Use "+("codex"===e?"GPT":"claude"===e?"Claude":"copilot"===e?"Copilot":"opencode"===e?"OpenCode":"OMP"),"aria-pressed":t,disabled:!b,onClick:()=>b?.(e),style:{alignItems:"center",background:t?z.control:"transparent",border:0,borderRadius:24,color:t?z.primary:"var(--picker-secondary)",cursor:b?"pointer":"default",display:"flex",flex:1,justifyContent:"center",padding:"8px 10px",transition:"background-color 120ms ease, color 120ms ease"},children:L(E,{provider:e,size:12})},e)})}),"omp"===u&&R.length>0&&h("div",{style:{position:"relative",width:"100%"},children:[L(t,{"aria-hidden":"true",size:12,strokeWidth:1.75,style:{color:z.secondary,left:10,opacity:O?1:0,pointerEvents:"none",position:"absolute",top:8,transition:"opacity 120ms ease",zIndex:3}}),$&&X&&L("div",{"aria-hidden":"true",style:{color:z.secondary,fontFamily:_,fontSize:12,height:28,left:0,lineHeight:"28px",overflow:"hidden",padding:O?"0 10px 0 28px":"0 10px",pointerEvents:"none",position:"absolute",right:0,top:0,transition:"padding-left 120ms ease",whiteSpace:"pre",zIndex:1},children:B>=0?h(m,{children:[X.slice(0,B),L("span",{style:{color:z.primary},children:X.slice(B,B+D.trim().length)}),X.slice(B+D.trim().length)]}):X}),L("input",{"aria-label":"OMP provider","aria-autocomplete":"inline",autoComplete:"off",onBlur:()=>{F(!1)},onChange:e=>{V(e.currentTarget.value),F(!0)},onFocus:e=>{F(!0),e.currentTarget.select()},onKeyDown:e=>{if("Enter"===e.key){let t=A[0];t&&(e.preventDefault(),j(t),e.currentTarget.blur())}else if("Tab"===e.key){let e=A[0];e&&X&&j(e)}else"Escape"===e.key&&e.currentTarget.blur()},onMouseEnter:()=>H(!0),onMouseLeave:()=>H(!1),placeholder:"Provider",value:D,style:{background:"transparent",border:0,borderRadius:0,boxSizing:"border-box",color:$&&X?"transparent":$||O?z.primary:"var(--picker-secondary)",caretColor:$&&!X?z.primary:"transparent",cursor:$?"text":"pointer",fontFamily:_,fontSize:12,height:28,outline:"none",padding:O?"6px 10px 6px 28px":"6px 10px",position:"relative",transition:"color 120ms ease, padding-left 120ms ease",width:"100%",zIndex:2}})]}),L(ne,{icon:r,options:K,selectedIndex:q,displayLabel:q<0&&P?te(P.label):void 0,onSelect:x?e=>{let t=U[e];t&&x?.(t.index)}:void 0,scrub:o}),"opencode"!==u&&L(ne,{icon:n,options:ie,selectedIndex:le,onSelect:y?e=>y({...C,reasoningEffort:ie[e].value}):void 0,scrub:o}),ae.length>0&&L(ne,{icon:i,settingLabel:"Speed",options:ae,selectedIndex:de,onSelect:y?e=>y({...C,serviceTier:ae[e].value}):void 0,scrub:o})]})}function oe({triggerRef:e,provider:t,open:r,onClick:n,onMouseEnter:i,onMouseLeave:l,style:a}){let[d,u]=s(!1);return h("button",{type:"button",ref:e,"data-model-picker":!0,"aria-expanded":r,"aria-label":"Choose model settings",onMouseEnter:()=>{u(!0),i?.()},onMouseLeave:()=>{u(!1),l?.()},onClick:n,style:{alignItems:"center",background:r||d?"var(--popmelt-thread-control, #eaeaea)":"transparent",border:0,borderRadius:40,color:"var(--popmelt-thread-muted-strong, #888)",cursor:"pointer",display:"flex",gap:2,height:24,padding:"0 3px 0 6px",...a,transition:"background-color 120ms ease, color 120ms ease"},children:[L(E,{provider:t,size:14}),L(o,{"aria-hidden":"true",size:12,strokeWidth:1.75,style:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 120ms ease"}})]})}export{g as a,b,x as c,y as d,w as e,E as f,T as g,I as h,V as i,$ as j,F as k,H as l,N as m,Z as n,j as o,U as p,Q as q,ie as r,oe as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{b as e,a as t}from"./chunk-NSCO633B.mjs";import{f as n}from"./chunk-J4WDYITA.mjs";import{b as r,aa as o,S as i,P as a,L as l,C as s,B as d,J as c,H as u,F as p,G as h,M as m,K as f,I as g,O as y,ea as x,ga as v,N as C,Y as w,da as b,E as k,V as I,U as S,X as M,ia as $}from"./chunk-26P7UUHT.mjs";import{a as E}from"./chunk-G2ZHJXHZ.mjs";import{b as A,a as H}from"./chunk-G6RYESYI.mjs";import{S as T,H as R,ha as j,$ as P,Ka as z,pa as N,c as V,z as B,w as L,x as W,m as Z,ia as F,ea as D,ta as O,ra as _,G as q,y as Y,fa as J,ga as K,Da as X,o as G,e as Q,f as U,Fa as ee,i as te,g as ne,h as re,k as oe,j as ie,d as ae,n as le,l as se}from"./chunk-MSWXKP77.mjs";import{b as de,a as ce}from"./chunk-G7JR5Z3P.mjs";import{a as ue}from"./chunk-HU2XWUJC.mjs";import{f as pe,c as he}from"./chunk-XT6PHPPG.mjs";import{x as me,y as fe,d as ge,b as ye,j as xe,w as ve,K as Ce,M as we,L as be,N as ke,k as Ie,g as Se,f as Me,I as $e,i as Ee,n as Ae}from"./chunk-HAE5LUJX.mjs";import{b as He,a as Te}from"./chunk-53SKVMWR.mjs";import{c as Re,a as je}from"./chunk-57FM7XQV.mjs";import{a as Pe}from"./chunk-LVEMYZOA.mjs";import{d as ze,m as Ne,v as Ve,u as Be,p as Le}from"./chunk-WHJEKDNP.mjs";import{createContext as We,useMemo as Ze,useState as Fe,useEffect as De,useCallback as Oe,useRef as _e,useLayoutEffect as qe,useContext as Ye,useReducer as Je}from"react";import{jsxs as Ke,jsx as Xe,Fragment as Ge}from"react/jsx-runtime";function Qe(e){let{selector:t,durableSelector:n,pathname:r,annotationNumber:o,changes:i}=e;return{selector:t,durableSelector:n,pathname:r,annotationNumber:o,changes:i.map(({property:e,original:t,modified:n,token:r})=>({property:e,original:t,modified:n,token:r}))}}function Ue(e,t){if((e.pathname??"")!==(t.pathname??"")||e.selector!==t.selector&&(!e.durableSelector||e.durableSelector!==t.durableSelector))return!1;let n=e=>JSON.stringify(e.map(({property:e,original:t,modified:n,token:r})=>[e,t,n,r??null]).sort((e,t)=>String(e[0]).localeCompare(String(t[0]))));return n(e.changes)===n(t.changes)}function et(e,t,n,r=new Set){let o=new Map(t.filter(e=>e.authorId===n).flatMap(e=>e.annotations?.map(({id:t})=>[t,e.threadId])??[])),i=!1,a=e.annotations.map(e=>{if(r.has(e.id)&&["pending","sending"].includes(e.status??"pending"))return i=!0,{...e,status:"awaiting_review"};let t="sending"===e.status&&!!e.threadId&&e.threadId===o.get(e.id);return"pending"!==(e.status??"pending")&&!t||e.threadId&&e.threadId!==o.get(e.id)||!o.has(e.id)?e:(i=!0,{...e,threadId:o.get(e.id)??e.threadId,status:"awaiting_review"})}),l=!1,s=e.styleModifications.map(e=>{if(e.captured)return e;let r=[...t].reverse().find(t=>t.authorId===n&&t.threadId&&t.styleModifications?.some(t=>Ue(e,t)));return r?.threadId?(l=!0,{...e,awaitingReview:{submissionId:r.id,threadId:r.threadId}}):e});return i||l?{...e,annotations:i?a:e.annotations,styleModifications:l?s:e.styleModifications}:e}function tt(e){if(e.awaitingReview)return{jobId:`suggestion:${e.awaitingReview.submissionId}`,threadId:e.awaitingReview.threadId,status:"awaiting_review",selectors:[e.selector],annotationNumber:e.annotationNumber}}function nt(e,t){if(!t)return e;let n=e.activeColor!==t,r=e.annotations.map(e=>e.color===t?e:(n=!0,{...e,color:t}));return n?{...e,activeColor:t,annotations:r}:e}function rt(e,t){return t.selectors??(t.targetBindingId?[]:[e])}function ot(e,t,n){let r=[...new Set(e)];if(1!==r.length)return;let o=n(r[0]);if(!o)return;let i=t.filter(e=>!(!e.threadId||!e.linkedSelector||"pending"===e.status)&&n(e.linkedSelector)===o),a=[...new Set(i.map(e=>e.threadId))];return 1===a.length?{threadId:a[0],targetBindingId:i.find(e=>e.targetBindingId)?.targetBindingId,color:i.find(e=>e.color)?.color,selectorAliases:[...new Set([r[0],...i.map(e=>e.linkedSelector)])]}:void 0}function it(e,t,n,r){let o=[...new Set(e)];return 1!==o.length?n:st(o[0],t,r)?.color??n}function at(e,t){let n=[...new Set(e)];if(1!==n.length)return;let r=st(n[0],t);return r?.continuationEligible?r.threadId:void 0}function lt(e,t){let n=[...new Set(e)];if(1!==n.length)return;let r=st(n[0],t);return r?.continuationEligible?r.targetBindingId:void 0}function st(e,t,n){for(let[n,r]of t)if(rt(n,r).includes(e))return r;if(!n)return;let r=n(e);if(r)for(let[e,o]of t)if(rt(e,o).some(e=>n(e)===r))return o}function dt(e,t,n){let r=new Map(e);for(let[o,i]of e)i.threadId===t&&r.set(o,{...i,jobId:n,threadId:t,status:"in_flight",label:void 0});return r}function ct(e,t){let n=new Set;for(let[r,o]of e)if(t.has(o.threadId))for(let e of rt(r,o))n.add(e);return n}function ut(e,t,n,r,o,i){let a=new Set(o);for(let[n,r]of e)if(r.jobId===t)for(let e of rt(n,r))a.add(e);let l=new Map(e);for(let e of a){let o=[...l].find(([t,n])=>rt(t,n).includes(e)),a=o?.[1];if(a&&a.jobId!==t)continue;let s=i??a?.threadId;if(!s)continue;let d=o?.[0]??`job:${t}:${e}`;l.set(d,{...a,jobId:t,threadId:s,status:n,label:r,selectors:a?.selectors??[e]})}return l}function pt(e,t,n){let r=new Map(e);for(let[e,o]of t)n.has(o.jobId)&&r.set(e,o);return r}function ht(e,t,n,r){if(!r)return new Map;let o=new Map;for(let[r,i]of e){if(t.has(i.threadId))continue;let e=n.indexOf(i.threadId);o.set(r,{...i,annotationNumber:i.annotationNumber??(e>=0?e+1:void 0)})}return o}function mt(e,t,n){if(t)return e?t.jobId===n?t:void 0:t}var ft=Number.MAX_SAFE_INTEGER;function gt(e){return`${e.pathname??"*"}\0${e.selector}`}function yt(e,t){return`element:${e??"*"}\0${t}`}function xt({annotations:e,styleModifications:t,textModifications:n}){let r=new Map,o=0,i=new Map;for(let t of e)t.groupId&&t.linkedSelector&&i.set(t.groupId,{selector:t.linkedSelector,pathname:t.pathname});for(let t of e){let e=t.groupId?i.get(t.groupId):t.linkedSelector?{selector:t.linkedSelector,pathname:t.pathname}:void 0,n=e?yt(e.pathname,e.selector):`annotation:${t.groupId??t.id}`,a=r.get(n);a?(a.createdAt=Math.min(a.createdAt,t.timestamp),a.annotationIds.push(t.id)):r.set(n,{key:n,createdAt:t.timestamp,stableIndex:o++,annotationIds:[t.id]})}let a=e=>{let t=gt(e),n=`element:${t}`,i=e.createdAt??ft,a=r.get(n);if(a)return a.createdAt=Math.min(a.createdAt,i),void(a.modificationKey=t);r.set(n,{key:n,createdAt:i,stableIndex:o++,annotationIds:[],modificationKey:t})};t.forEach(a),n.forEach(a);let l=new Map,s=new Map,d=[...r.values()].sort((e,t)=>e.createdAt-t.createdAt||e.stableIndex-t.stableIndex);return d.forEach((e,t)=>{let n=t+1;e.annotationIds.forEach(e=>l.set(e,n)),e.modificationKey&&s.set(e.modificationKey,n)}),{annotationNumberById:l,modificationNumberByKey:s,count:d.length}}function vt(e){let t=new Set,n=new Map;for(let t of e){if(!t.linkedSelector)continue;let e=n.get(t.linkedSelector)||[];e.push(t),n.set(t.linkedSelector,e)}let r=new Set,o=new Set;for(let e of n.values()){if(e.length<=1){e[0]?.groupId&&o.add(e[0].groupId);continue}e.sort((e,t)=>t.timestamp-e.timestamp);let n=e[0];n.groupId&&o.add(n.groupId);for(let n=1;n<e.length;n++){let o=e[n];t.add(o),o.groupId&&r.add(o.groupId)}}for(let n of e)n.groupId&&r.has(n.groupId)&&!o.has(n.groupId)&&t.add(n);return t}function Ct({state:e,pageAnnotations:t,pageStyleModifications:n,pageTextModifications:r}){let o=Ze(()=>vt(e.annotations),[e.annotations]),i=Ze(()=>xt({annotations:t.filter(e=>!o.has(e)),styleModifications:n,textModifications:r}),[t,n,r,o]),a=Ze(()=>{let e=new Map,t=t=>{let n=i.modificationNumberByKey.get(gt(t));if(void 0===n)return;let r=e.get(t.selector);(void 0===r||n<r)&&e.set(t.selector,n)};return n.forEach(t),r.forEach(t),e},[n,r,i.modificationNumberByKey]);return{supersededAnnotations:o,stagedArtifactOrder:i,annotationGroupMap:i.annotationNumberById,pageModificationNumberBySelector:a}}var wt="The content or target changed while capturing. Review your changes and send again.";function bt(e){return{id:e.id,type:e.type,text:e.text,groupId:e.groupId,pathname:e.pathname,linkedSelector:e.linkedSelector,target:e.target,targetBindingId:e.targetBindingId,threadId:e.threadId,elements:e.elements,region:e.region,points:e.linkedSelector||e.target?e.points.slice(1):e.points,attachments:e.attachments,imageCount:e.imageCount,interactionEpisode:e.interactionEpisode,status:"sending"===e.status?"pending":e.status??"pending"}}function kt(e,t){let n=new Map(t.annotations.map(e=>[e.id,e]));return e.annotations.every(e=>{let t=n.get(e.id);return t&&(t===e||r(bt(e),bt(t)))})&&["styleModifications","textModifications","domModifications","spacingTokenChanges"].every(n=>e[n].every(e=>t[n].some(t=>r(e,t))))}function It(e){let t=e instanceof Error?e.message:"";return t===wt||"Page context could not be captured. Try sending again."===t?t:t.startsWith("Draft changed during capture")?"The saved draft changed during capture. Review it and send again.":"The host removed an annotation in this request"===t?"One of these annotations was removed. Review the remaining draft and send again.":/failed to fetch|network|offline|disconnect|closed|sync paused/i.test(t)?"The bridge connection was interrupted. Check the thread before retrying.":"Popmelt couldn’t confirm delivery. Check the thread before retrying."}async function St(e,t,n,r){let o=n=>{e.length&&t({type:"SET_ANNOTATION_STATUS",payload:{ids:e,status:n,..."pending"===n?{from:"sending"}:{}}})};o("sending");let i=!1;try{return i=await n(),i}catch(e){return console.error("[Popmelt] Annotation send failed:",e),r?.(e),!1}finally{i||o("pending")}}var Mt="devtools-active-text";async function $t(e,t,n){if(e.current)return n;e.current=!0;try{return await t()}finally{e.current=!1}}function Et(e){e.removeItem(Mt)}function At(e){return!("Enter"!==e.key||!e.metaKey&&!e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),!0)}function Ht(e){return!!e&&(void 0!==e.originalText?e.text!==e.originalText:e.text.trim().length>0||!!e.hasInteractionEpisode)}var Tt={expanded:"devtools-toolbar-expanded",annotations:"devtools-annotations",styleMods:"devtools-style-modifications",textMods:"devtools-text-modifications",domMods:"devtools-dom-modifications",spacingChanges:"devtools-spacing-changes",tool:"devtools-active-tool",color:"devtools-next-thread-color",legacyColor:"devtools-active-color",stroke:"devtools-stroke-width",inspected:"devtools-inspected-element"};function Rt(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function jt(e,t){return{styleModifications:Rt(e.getItem(t.styleMods)),textModifications:Rt(e.getItem(t.textMods)),domModifications:Rt(e.getItem(t.domMods)),spacingTokenChanges:Rt(e.getItem(t.spacingChanges))}}function Pt(e,t){return`${e}:project:${encodeURIComponent(t.trim())}`}function zt(e){return{expanded:Pt(Tt.expanded,e),annotations:Pt(Tt.annotations,e),styleMods:Pt(Tt.styleMods,e),textMods:Pt(Tt.textMods,e),domMods:Pt(Tt.domMods,e),spacingChanges:Pt(Tt.spacingChanges,e),tool:Pt(Tt.tool,e),color:Pt(Tt.color,e),stroke:Pt(Tt.stroke,e),inspected:Pt(Tt.inspected,e)}}function Nt(e){return Pt("popmelt-workspace-generation",e)}function Vt(e,t){let n=e.getItem(Nt(t));if(null===n||""===n.trim())return null;let r=Number(n);return Number.isInteger(r)&&r>=0?r:null}function Bt(e,t){return!(!Number.isInteger(t)||t<0)&&t>(e??0)}function Lt(e,t){return"string"==typeof e.pathname&&e.pathname===t}function Wt(e){let{storage:t,projectId:n,pathname:r,selectorExists:o}=e,i=zt(n),a=Pt("popmelt-annotation-workspace-migration-v1",n);if("complete"===t.getItem(a))return i;let l=function(e,t,n){return e.filter(e=>!(!e||"string"!=typeof e.id||!Lt(e,t)||"pending"!==(e.status??"pending")||e.threadId||!e.target&&e.linkedSelector&&!n(e.linkedSelector)))}(function(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(t.getItem(Tt.annotations)),r,o);null===t.getItem(i.annotations)&&t.setItem(i.annotations,JSON.stringify(l));let s=[["expanded",Tt.expanded],["tool",Tt.tool],["color",Tt.color],["stroke",Tt.stroke]];for(let[e,n]of s){let r="color"===e?t.getItem(n)??t.getItem(Tt.legacyColor):t.getItem(n);null!==r&&null===t.getItem(i[e])&&t.setItem(i[e],r)}for(let e of[i.styleMods,i.textMods,i.domMods,i.spacingChanges])null===t.getItem(e)&&t.setItem(e,"[]");null===t.getItem(i.inspected)&&t.removeItem(i.inspected),t.setItem(a,"complete");for(let e of Object.values(Tt))t.removeItem(e);return i}function Zt(e,t,n=new Set){let r=function(e){let t=new Map;for(let n of e)n.groupId&&n.threadId&&t.set(n.groupId,n.threadId);return t}(e);return e.filter(e=>{let o=function(e,t){return e.threadId??(e.groupId?t.get(e.groupId):void 0)}(e,r);return Lt(e,t)&&"dismissed"!==e.status&&(!o||!n.has(o))})}function Ft(e,t,n,r=new Set,o=new Map){let i=new Set;for(let e of Zt(t,n,r))e.linkedSelector&&i.add(e.linkedSelector);for(let[e,t]of o)if(!r.has(t.threadId))for(let n of t.selectors??[e])i.add(n);return e.filter(e=>(!e.pathname||e.pathname===n)&&(!e.captured||i.has(e.selector)||!!e.durableSelector&&i.has(e.durableSelector)))}function Dt({state:e,activeText:t,currentPathname:n,dismissedThreadIds:r,modifiedElementThreadStates:o}){let i=Ze(()=>Zt(e.annotations,n,r),[e.annotations,n,r]),a=Ze(()=>Ft(e.styleModifications,e.annotations,n,r,o),[e.annotations,e.styleModifications,n,r,o]),l=Ze(()=>Ft(e.textModifications,e.annotations,n,r,o),[e.annotations,e.textModifications,n,r,o]),s=Ze(()=>{let t=new Set,r=e=>!(e.captured||e.pathname&&e.pathname!==n);for(let n of e.styleModifications)r(n)&&!n.awaitingReview&&t.add(`element:${n.selector}`);for(let n of e.textModifications)r(n)&&t.add(`element:${n.selector}`);for(let n of e.domModifications)r(n)&&t.add(`element:${n.selector}`);for(let n of e.spacingTokenChanges)n.captured||t.add(`spacing:${n.tokenPath}`);for(let n of e.spacingTokenMods)n.captured||t.add(`spacing:${n.tokenPath}`);return t},[n,e.domModifications,e.spacingTokenChanges,e.spacingTokenMods,e.styleModifications,e.textModifications]),d=Ze(()=>function(e,t,n=[]){let r=new Set(e.filter(e=>"pending"===(e.status??"pending")).map(e=>`annotation:${e.groupId||e.id}`));t?.isNew&&!t.domEdit&&(t.text.trim()||t.interactionEpisode?.steps.length)&&r.add(`annotation:${t.groupId||t.id}`);for(let e of n)r.add(`edit:${e}`);return r.size}(e.annotations,t,s),[e.annotations,t,s]),c=Ze(()=>e.annotations.filter(e=>"text"===e.type&&e.text&&"pending"===(e.status??"pending")).sort((e,t)=>t.timestamp-e.timestamp),[e.annotations]);return{pageAnnotations:i,pageStyleModifications:a,pageTextModifications:l,pendingBundleCount:d,pendingTextAnnotations:c}}function Ot(e,t="host",n){let[r,o]=Fe(()=>n?.read().selectedId??t),[i,a]=Fe(null);De(()=>{o(n?.read().selectedId??t),a(null)},[n,t]);let l=Oe(e=>{n?.select(e),o(e),a(null)},[n]),s=Oe(e=>a(e),[]),d=Oe(e=>{a(t=>t===e?null:t)},[]);return De(()=>{let t=()=>a(null);e||t();let n=()=>{document.hidden&&t()};return window.addEventListener("blur",t),document.addEventListener("visibilitychange",n),()=>{window.removeEventListener("blur",t),document.removeEventListener("visibilitychange",n)}},[e]),{selectedId:r,viewedId:e?i??r:r,isPeeking:e&&null!==i&&i!==r,select:l,peek:s,leave:d}}function _t({name:e,isOwnPlane:t,color:n,changed:r}){return Ke("div",{"data-devtools":"peer-plane-label","data-popmelt-font":"mono",role:"status",title:r?"Source changed beneath staged work. Editing, clearing, commenting or sending acknowledges the affected work; viewing alone does not.":void 0,style:{position:"fixed",bottom:8,left:"50%",transform:"translateX(-50%)",maxWidth:"calc(100vw - 32px)",boxSizing:"border-box",padding:"4px 8px",borderRadius:8,background:n,color:"#fff",fontFamily:A,fontSize:12,fontWeight:500,lineHeight:"16px",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",zIndex:10002},children:[t?"Your plane":`${e}’s plane`,r&&" (source changed)"]})}function qt(e,t=[],n=""){let r=new Map;if(!e)return r;let o=et(e,t,n),i=vt(o.annotations),a=o.annotations.filter(e=>!i.has(e)),l=xt({...o,annotations:a});for(let e of a){let t=l.annotationNumberById.get(e.id);e.threadId&&void 0!==t&&!r.has(e.threadId)&&r.set(e.threadId,t)}for(let e of o.styleModifications){let t=e.awaitingReview?.threadId,n=l.modificationNumberByKey.get(gt(e));t&&void 0!==n&&!r.has(t)&&r.set(t,n)}return r}var Yt=We(null);function Jt(e,t){return JSON.stringify([e,t??null])}function Kt(e){return(e.annotations?.length?e.annotations:[{id:void 0,label:"Submitted changes"}]).map(t=>({submission:e,annotation:t,key:Jt(e.id,t.id)}))}function Xt(e,t){return e.filter(e=>e.threadId===t).flatMap(e=>Kt(e).map(e=>e.key))}function Gt(e,t){let n=[],r=()=>{try{let r=JSON.parse(e.getItem(t)??"[]");Array.isArray(r)&&(n=[...new Set([...r.filter(e=>"string"==typeof e),...n])].slice(-1e3))}catch{}return n},o=o=>{let i=r(),a=o.filter(e=>!i.includes(e));if(!a.length)return i;let l=[...new Set([...i,...a])].slice(-1e3);n=l;try{e.setItem(t,JSON.stringify(l))}catch{}return l};return{read:r,markMany:o,mark:e=>o([e])}}function Qt(e){return(e%360+360)%360}function Ut(e){let t=e.match(/oklch\([^)]*\s+([\d.]+)\s*\)/i);if(!t?.[1])return null;let n=Number.parseFloat(t[1]);return Number.isFinite(n)?Qt(n):null}function en(e){return`oklch(0.628 0.258 ${Qt(e)})`}function tn(e){return en((Ut(e)??29)+60)}function nn(e){return new Set(e.filter(e=>e.groupId&&e.threadId).map(e=>e.groupId))}function rn(e,t){let n=!(!e.groupId||!t.has(e.groupId));return!("pending"!==(e.status??"pending")||e.threadId||n||e.replyCount&&e.replyCount>0)}function on(e,t,n){return e.threadId?`thread:${e.threadId}`:e.groupId&&n.has(e.groupId)?`thread-group:${e.groupId}`:e.groupId?`group:${e.groupId}`:e.id?`annotation:${e.id}`:`annotation-index:${t}`}function an(e,t){let n=Math.abs(Qt(e)-Qt(t));return Math.min(n,360-n)<.5}function ln(e,t,n){let r=Ut(e)??29,o=Math.round(6),i=nn(t),a=t.flatMap((e,t)=>{if(!e.color)return[];if(n&&e.pathname&&e.pathname!==n)return[];if(rn(e,i))return[];let r=Ut(e.color);return null===r?[]:[{hue:r,key:on(e,t,i)}]}),l=en(r),s=Number.POSITIVE_INFINITY;for(let e=0;e<o;e+=1){let t=Qt(r+60*e),n=new Set(a.filter(e=>an(e.hue,t)).map(e=>e.key));if(0===n.size)return en(t);n.size<s&&(s=n.size,l=en(t))}return l}function sn(e,t){let n=nn(e);return e.map(e=>rn(e,n)?{...e,color:t}:e)}function dn(e){let t=new Set(e.annotationIds),n={color:e.color,threadId:e.threadId,pathname:e.pathname},r=e.annotations.map(n=>n.id&&t.has(n.id)?{...n,color:e.color,threadId:e.threadId}:n);return r.push(n),ln(tn(e.color),r,e.pathname)}function cn(e,t){return e.find(e=>e.color)?.color??t}function un(e){let t=[...e.annotations].sort((e,t)=>t.timestamp-e.timestamp),n=nn(e.annotations),r=t.find(e=>rn(e,n)&&!!e.color);if(r?.color)return ln(r.color,e.annotations,e.currentPathname);if(e.savedCursor)return ln(e.savedCursor,e.annotations,e.currentPathname);let o=t.find(e=>!(!e.threadId||!e.color));return ln(o?.color?tn(o.color):e.legacyColor??en(29),e.annotations,e.currentPathname)}var pn=["circle","square","diamond","hexagon"];function hn(e="circle",t=26){return{circle:19,square:17.5,diamond:20,hexagon:19}[e]*t/24}var mn=e=>e.map((t,n)=>{let r=e=>{let n=Math.hypot(e[0]-t[0],e[1]-t[1]),r=Math.min(3,n/2)/n;return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r].join(" ")};return`${n?"L":"M"}${r(e[(n+e.length-1)%e.length])} Q${t.join(" ")} ${r(e[(n+1)%e.length])}`}).join(" ")+" Z",fn={diamond:mn([[12,1],[23,12],[12,23],[1,12]]),hexagon:mn([[12,2],[21,7],[21,17],[12,22],[3,17],[3,7]])},gn=[210,150,270,90,330,30].map(e=>Qt(29+e)),yn=[.68,.5,.82,.59,.75,.43];function xn(e){if("host"===e.identity?.relationship)return"circle";if(e.shape&&pn.includes(e.shape))return e.shape;let t=/^oklch\(([\d.]+) ([\d.]+) ([\d.]+)\)$/.exec(e.color??"");if(t){let n=yn.indexOf(Number(t[1])),r=gn.indexOf(Number(t[3])),o=Math.round(4*(.14/Number(t[2])-1)),i=(o*yn.length+n)*gn.length+r;if(n>=0&&r>=0&&o>=0&&Number.isSafeInteger(i)&&vn(i)===e.color)return function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Invalid peer color slot");return pn[([0,2,3,0,1,1][e%6]+Math.floor(e/6))%4]}(i)}return"circle"}function vn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Invalid peer color slot");let t=Math.floor(e/gn.length),n=yn;return`oklch(${n[t%n.length]} ${.14/(1+.25*Math.floor(t/n.length))} ${gn[e%gn.length]})`}function Cn(e,t,n){return"host"===e?.identity.relationship?e.identity.id===t?n:e.color??ue.activeColor:e?.color??vn(0)}function wn(e){return"inspect"!==e.type&&"style"!==e.type&&"comment"!==e.type&&"attention"!==e.type||!e.selector?null:{selector:e.selector,plane:"inspect"===e.type?e.plane??"own":"own",activity:"attention"===e.type?e.activity??"looking":"inspect"===e.type?"looking":"working"}}function bn(e){return function(e){let t=e.replace(/^\uFEFF/,"").trim().replace(/^<\?xml[\s\S]*?\?>\s*/i,"").replace(/^(?:<!--[\s\S]*?-->\s*)+/i,"").replace(/^<!doctype\s+svg[\s\S]*?>\s*/i,"");return/^<svg(?:\s|>)[\s\S]*<\/svg>\s*$/i.test(t)}(e)?{blob:new Blob([e],{type:"image/svg+xml"}),kind:"svg",name:"figma-selection.svg"}:e.length>=8192?{blob:new Blob([e],{type:"text/plain"}),kind:"text",name:"pasted-context.txt"}:null}function kn(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function In(e){return`${e} image${e>1?"s":""} attached`}function Sn(e){return e<=0?0:32+7.2*String(e).length}function Mn({imageCount:e,color:t,layered:n=!1}){return e<=0?null:Ke("div",{"data-devtools":"active-image-attachment-badge",role:"img","aria-label":In(e),title:In(e),style:{position:"relative",flex:"0 0 auto",display:"flex",marginRight:-2,zIndex:2},children:[Xe("span",{"aria-hidden":!0,style:{position:"absolute",left:-4,top:"50%",width:14.142,height:14.142,transform:"translateY(-50%)",display:"grid",placeItems:"center",pointerEvents:"none",maskImage:n?He:void 0,WebkitMaskImage:n?He:void 0},children:Xe("span",{style:{width:10,height:10,background:t,transform:"rotate(-45deg)"}})}),Ke("span",{style:{position:"relative",display:"flex",alignItems:"center",gap:4,height:22,padding:n?"0 8px 0 10px":"0 8px",borderRadius:8,backgroundColor:t,color:"#fff",font:`12px/1.2 ${H}`,whiteSpace:"nowrap",maskImage:n?Te:void 0,WebkitMaskImage:n?Te:void 0},children:[Xe(T,{size:12,strokeWidth:2,"aria-hidden":!0}),e]})]})}function $n({point:e,scroll:t,attachments:n,showAttachments:r,onRemoveAttachment:o}){return Xe(Ge,{children:r&&n.length>0&&Xe("div",{"data-devtools":!0,style:{position:"fixed",left:e.x-8-t.x,top:e.y-4-t.y-24,zIndex:10001,display:"flex",gap:4,flexWrap:"wrap",maxWidth:400},children:n.map(e=>Ke("button",{type:"button",title:"Remove attachment",onMouseDown:e=>e.preventDefault(),onClick:()=>o(e.id),style:{appearance:"none",border:0,borderRadius:8,background:"rgba(0,0,0,0.72)",color:"#fff",cursor:"pointer",font:"11px/16px system-ui, sans-serif",padding:"2px 7px",whiteSpace:"nowrap"},children:[e.name," · ",kn(e.size)," ×"]},e.id))})})}function En({query:e,border:t,background:n,foreground:r,renderIcon:o}){return Ke("span",{"aria-hidden":"true","data-popmelt-sticker-query":!0,style:{position:"absolute",left:"50%",top:44,minWidth:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",gap:4,padding:"0 10px",boxSizing:"border-box",border:`1px solid ${t}`,borderRadius:12,background:n,color:r,fontSize:11,fontWeight:600,letterSpacing:.22,lineHeight:1,whiteSpace:"nowrap",transform:"translateX(-50%)",zIndex:4},children:[e.tokens.map((e,t)=>"icon"===e.kind?Xe("span",{"aria-label":e.label,"data-popmelt-sticker-query-token":"icon",style:{display:"inline-flex",color:r,flexShrink:0},children:o(e)},`${e.label}-${t}`):Xe("span",{"data-popmelt-sticker-query-token":"label",style:{color:r,opacity:.72},children:e.label},`${e.label}-${t}`)),e.typed?Xe("span",{children:e.typed}):Ke("span",{style:{display:"inline-flex",alignItems:"center",gap:0,color:r,opacity:.58,fontWeight:500},children:[Xe("span",{"data-popmelt-sticker-query-caret":!0,style:{width:1,height:11,flexShrink:0,background:r,animation:"popmeltStickerQueryCaret 900ms steps(1, end) infinite"}}),Xe("span",{children:e.fallback})]}),e.completion&&Xe("span",{style:{color:r,opacity:.62},children:e.completion}),e.fallback&&e.typed&&Ke("span",{style:{color:r,opacity:.68},children:["→ ",e.fallback]})]})}var An=106,Hn=42,Tn=24,Rn=250,jn=32,Pn="cubic-bezier(0.16, 1, 0.3, 1)",zn=[0,180,240,300];function Nn(e,t,n=42,r=40,o=An){let i=e.left+o,a=e.top+n,l=Math.min(i,t.right)-Math.max(e.left,t.left),s=Math.min(a,t.bottom)-Math.max(e.top,t.top);if(l<=0||s<=0)return 1;let d=Math.min(l,s);return Math.max(0,1-d/r)}function Vn(e,t,n,r=42,o=80,i=8,a=An){let l=Math.min(Math.max(e.x,n.left),n.right),s=Math.min(Math.max(e.y,n.top),n.bottom),d={x:l-e.x,y:s-e.y},c=Math.hypot(d.x,d.y);if(0===c)return 0;let u=d.x/c,p=d.y/c,h=[{x:t.left,y:t.top},{x:t.left+a,y:t.top},{x:t.left,y:t.top+r},{x:t.left+a,y:t.top+r}],m=Math.max(0,...h.map(t=>(t.x-e.x)*u+(t.y-e.y)*p)),f=Math.max(o,m+i);return Math.min(1,c/f)}var Bn={padding:"padding",margin:"margin",border:"border",radius:"radius",stack:"stack-vertical",grid:"grid",text:"text-size",color:"palette",transform:"transform-translate",opacity:"opacity"},Ln={top:0,right:90,bottom:180,left:270},Wn={"top-right":0,"bottom-right":90,"bottom-left":180,"top-left":270};function Zn({name:e}){switch(e){case"padding":return Xe("path",{d:"M9.333 0.375C10.701 0.375 11.625 1.662 11.625 3V9C11.625 10.338 10.701 11.625 9.333 11.625H2.667C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H9.333ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V9C1.625 9.871 2.194 10.375 2.667 10.375H9.333C9.806 10.375 10.375 9.871 10.375 9V3C10.375 2.129 9.806 1.625 9.333 1.625H2.667ZM7.375 3A0.625 0.625 0 0 1 7.375 4.25H4.625A0.625 0.625 0 0 1 4.625 3H7.375Z",fill:"currentColor"});case"padding-top":return Xe("path",{d:"M9.333 1.375C10.701 1.375 11.625 2.662 11.625 4V10A0.625 0.625 0 0 1 10.375 10V4C10.375 3.129 9.806 2.625 9.333 2.625H2.667C2.194 2.625 1.625 3.129 1.625 4V10A0.625 0.625 0 0 1 0.375 10V4C0.375 2.662 1.299 1.375 2.667 1.375H9.333ZM7.375 5A0.625 0.625 0 0 1 7.375 6.25H4.625A0.625 0.625 0 0 1 4.625 5H7.375Z",fill:"currentColor"});case"padding-x":return Xe("path",{d:"M2.75 0.375C3.095 0.375 3.375 0.655 3.375 1S3.095 1.625 2.75 1.625C2.344 1.625 2.073 1.759 1.904 1.929C1.733 2.101 1.625 2.354 1.625 2.667V9.333C1.625 9.646 1.733 9.899 1.904 10.071C2.073 10.241 2.344 10.375 2.75 10.375C3.095 10.375 3.375 10.655 3.375 11S3.095 11.625 2.75 11.625C2.052 11.625 1.448 11.386 1.018 10.952C0.59 10.522 0.375 9.941 0.375 9.333V2.667C0.375 2.059 0.59 1.478 1.018 1.048C1.448 0.614 2.052 0.375 2.75 0.375ZM9.25 0.375C9.948 0.375 10.552 0.614 10.982 1.048C11.41 1.478 11.625 2.059 11.625 2.667V9.333C11.625 9.941 11.41 10.522 10.982 10.952C10.552 11.386 9.948 11.625 9.25 11.625C8.905 11.625 8.625 11.345 8.625 11S8.905 10.375 9.25 10.375C9.656 10.375 9.927 10.241 10.096 10.071C10.267 9.899 10.375 9.646 10.375 9.333V2.667C10.375 2.354 10.267 2.101 10.096 1.929C9.927 1.759 9.656 1.625 9.25 1.625C8.905 1.625 8.625 1.345 8.625 1S8.905 0.375 9.25 0.375ZM8.079 5.25C8.424 5.25 8.704 5.53 8.704 5.875S8.424 6.5 8.079 6.5H3.921C3.576 6.5 3.296 6.22 3.296 5.875S3.576 5.25 3.921 5.25H8.079Z",fill:"currentColor"});case"padding-y":return Xe("path",{d:"M11.625 2.75C11.625 3.095 11.346 3.375 11 3.375S10.375 3.095 10.375 2.75C10.375 2.344 10.241 2.073 10.072 1.904C9.899 1.733 9.646 1.625 9.333 1.625H2.667C2.355 1.625 2.102 1.733 1.929 1.904C1.759 2.073 1.625 2.344 1.625 2.75C1.625 3.095 1.346 3.375 1 3.375S0.375 3.095 0.375 2.75C0.375 2.052 0.615 1.448 1.048 1.018C1.479 0.59 2.06 0.375 2.667 0.375H9.333C9.941 0.375 10.522 0.59 10.953 1.018C11.386 1.448 11.625 2.052 11.625 2.75ZM11.625 9.25C11.625 9.948 11.386 10.552 10.953 10.982C10.522 11.41 9.941 11.625 9.333 11.625H2.667C2.06 11.625 1.479 11.41 1.048 10.982C0.615 10.552 0.375 9.948 0.375 9.25C0.375 8.905 0.655 8.625 1 8.625S1.625 8.905 1.625 9.25C1.625 9.656 1.759 9.927 1.929 10.096C2.102 10.267 2.355 10.375 2.667 10.375H9.333C9.646 10.375 9.899 10.267 10.072 10.096C10.241 9.927 10.375 9.656 10.375 9.25C10.375 8.905 10.655 8.625 11 8.625S11.625 8.905 11.625 9.25ZM6.75 8.079C6.75 8.424 6.471 8.704 6.125 8.704S5.5 8.424 5.5 8.079V3.921C5.5 3.576 5.78 3.296 6.125 3.296S6.75 3.576 6.75 3.921V8.079Z",fill:"currentColor"});case"margin":return Xe("path",{d:"M9.333 4.525C10.701 4.525 11.625 5.812 11.625 7.15V8.15C11.625 9.488 10.701 10.775 9.333 10.775H2.667C1.299 10.775 0.375 9.488 0.375 8.15V7.15C0.375 5.812 1.299 4.525 2.667 4.525H9.333ZM2.667 5.775C2.194 5.775 1.625 6.279 1.625 7.15V8.15C1.625 9.021 2.194 9.525 2.667 9.525H9.333C9.806 9.525 10.375 9.021 10.375 8.15V7.15C10.375 6.279 9.806 5.775 9.333 5.775H2.667ZM8.375 1.2A0.625 0.625 0 0 1 8.375 2.45H3.625A0.625 0.625 0 0 1 3.625 1.2H8.375Z",fill:"currentColor"});case"margin-top":return Xe("path",{d:"M9.333 4.575C10.701 4.575 11.625 5.862 11.625 7.2V10.2A0.625 0.625 0 0 1 10.375 10.2V7.2C10.375 6.329 9.806 5.825 9.333 5.825H2.667C2.194 5.825 1.625 6.329 1.625 7.2V10.2A0.625 0.625 0 0 1 0.375 10.2V7.2C0.375 5.862 1.299 4.575 2.667 4.575H9.333ZM8.375 1.25A0.625 0.625 0 0 1 8.375 2.5H3.625A0.625 0.625 0 0 1 3.625 1.25H8.375Z",fill:"currentColor"});case"margin-x":return Xe("path",{d:"M11.277 2.902C11.622 2.902 11.902 3.182 11.902 3.527V8.277C11.902 8.622 11.622 8.902 11.277 8.902S10.652 8.622 10.652 8.277V3.527C10.652 3.182 10.931 2.902 11.277 2.902ZM0.724 2.901C1.069 2.901 1.349 3.181 1.349 3.526V8.276C1.349 8.621 1.069 8.901 0.724 8.901S0.099 8.621 0.099 8.276V3.527C0.099 3.182 0.379 2.901 0.724 2.901ZM7.333 3.325C8.643 3.325 9.543 4.506 9.617 5.781C9.62 5.805 9.625 5.829 9.625 5.853L9.622 5.901L9.625 5.95C9.625 5.974 9.62 5.998 9.617 6.021C9.544 7.297 8.643 8.478 7.333 8.478H4.667C3.357 8.478 2.456 7.297 2.382 6.021C2.379 5.998 2.375 5.974 2.375 5.95L2.377 5.901L2.375 5.853C2.375 5.829 2.379 5.805 2.382 5.781C2.456 4.506 3.358 3.325 4.667 3.325H7.333ZM4.667 4.575C4.203 4.575 3.647 5.06 3.626 5.901C3.647 6.742 4.203 7.228 4.667 7.228H7.333C7.798 7.228 8.352 6.742 8.372 5.901C8.351 5.06 7.798 4.575 7.333 4.575H4.667Z",fill:"currentColor"});case"margin-y":return Xe("path",{d:"M8.375 10.001C8.72 10.001 9 10.281 9 10.626S8.72 11.251 8.375 11.251H3.625C3.28 11.251 3 10.971 3 10.626S3.28 10.001 3.625 10.001H8.375ZM9.333 3.325C10.642 3.325 11.543 4.506 11.617 5.781C11.62 5.805 11.625 5.829 11.625 5.853L11.622 5.901L11.625 5.95C11.625 5.974 11.619 5.998 11.617 6.021C11.543 7.297 10.643 8.478 9.333 8.478H2.667C1.357 8.478 0.455 7.297 0.381 6.021C0.379 5.998 0.375 5.974 0.375 5.95L0.377 5.901L0.375 5.853C0.375 5.829 0.379 5.805 0.381 5.781C0.456 4.506 1.357 3.325 2.667 3.325H9.333ZM2.667 4.575C2.202 4.575 1.648 5.061 1.627 5.901C1.647 6.742 2.202 7.228 2.667 7.228H9.333C9.797 7.228 10.352 6.742 10.373 5.901C10.352 5.06 9.797 4.575 9.333 4.575H2.667ZM8.376 0.751C8.721 0.751 9.001 1.031 9.001 1.376S8.72 2.001 8.376 2.001H3.626C3.28 2.001 3.001 1.72 3.001 1.375S3.281 0.751 3.626 0.751H8.376Z",fill:"currentColor"});case"border":return Xe(Ge,{children:Xe("path",{d:"M4 1.25H8M4 10.75H8M1.25 8V4M10.75 8V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});case"radius":return Xe(Ge,{children:Xe("path",{d:"M3.25 1.25C2.145 1.25 1.25 2.145 1.25 3.25M10.75 3.25C10.75 2.145 9.855 1.25 8.75 1.25M3.25 10.75C2.145 10.75 1.25 9.855 1.25 8.75M10.75 8.75C10.75 9.855 9.855 10.75 8.75 10.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});case"gap-x":return Ke(Ge,{children:[Xe("path",{d:"M6.625 9.375A0.625 0.625 0 0 1 5.375 9.375V2.625A0.625 0.625 0 0 1 6.625 2.625V9.375Z",fill:"currentColor"}),Xe("circle",{cx:"1.252",cy:"1.248",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"10.748",cy:"1.248",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"1.252",cy:"6",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"10.748",cy:"6",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"1.252",cy:"10.752",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"10.748",cy:"10.752",r:"0.748",fill:"currentColor"})]});case"gap-y":return Ke(Ge,{children:[Xe("path",{d:"M9.375 5.375A0.625 0.625 0 0 1 9.375 6.625H2.625A0.625 0.625 0 0 1 2.625 5.375H9.375Z",fill:"currentColor"}),Xe("circle",{cx:"1.248",cy:"10.748",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"1.248",cy:"1.252",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"6",cy:"10.748",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"6",cy:"1.252",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"10.752",cy:"10.748",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"10.752",cy:"1.252",r:"0.748",fill:"currentColor"})]});case"border-top":return Ke(Ge,{children:[Xe("path",{d:"M3.25 0.5A0.75 0.75 0 0 1 3.25 2C2.56 2 2 2.56 2 3.25V8.75C2 9.44 2.56 10 3.25 10A0.75 0.75 0 0 1 3.25 11.5C1.731 11.5 0.5 10.269 0.5 8.75V3.25C0.5 1.731 1.731 0.5 3.25 0.5Z",fill:"currentColor"}),Xe("circle",{cx:"10.748",cy:"10.752",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"6.625",cy:"10.752",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"10.748",cy:"6",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"10.748",cy:"1.248",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"6.625",cy:"1.248",r:"0.748",fill:"currentColor"})]});case"radius-top-right":return Ke(Ge,{children:[Xe("path",{d:"M8.25 1.25H8.75A2 2 0 0 1 10.75 3.25V3.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),Xe("circle",{cx:"9.748",cy:"9.748",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"2.248",cy:"9.748",r:"0.748",fill:"currentColor"}),Xe("circle",{cx:"2.248",cy:"2.248",r:"0.748",fill:"currentColor"})]});case"stack-vertical":case"stack-horizontal":return Xe("path",{d:"M9.333 0.375C10.701 0.375 11.625 1.662 11.625 3V9C11.625 10.338 10.701 11.625 9.333 11.625H2.667C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H9.333ZM1.625 6.625V9C1.625 9.871 2.194 10.375 2.667 10.375H9.333C9.806 10.375 10.375 9.871 10.375 9V6.625H1.625ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V5.375H10.375V3C10.375 2.129 9.806 1.625 9.333 1.625H2.667Z",fill:"currentColor"});case"align":return Ke(Ge,{children:[Xe("path",{d:"M1 2H11M2.5 5.25H9.5M4 8.5H8",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),Xe("path",{d:"M6 0.75V10.75",stroke:"currentColor",strokeWidth:"0.75",strokeDasharray:"1 2"})]});case"justify":return Ke(Ge,{children:[Xe("path",{d:"M1 1.5V10.5M11 1.5V10.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),Xe("path",{d:"M3 3H9M3 6H9M3 9H9",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]});case"grid":return Xe("path",{d:"M9.333 0.375C10.701 0.375 11.625 1.662 11.625 3V9C11.625 10.338 10.701 11.625 9.333 11.625H2.667C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H9.333ZM6.625 10.375H9.333C9.806 10.375 10.375 9.871 10.375 9V6.625H6.625V10.375ZM1.625 9C1.625 9.871 2.194 10.375 2.667 10.375H5.375V6.625H1.625V9ZM6.625 5.375H10.375V3C10.375 2.129 9.806 1.625 9.333 1.625H6.625V5.375ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V5.375H5.375V1.625H2.667Z",fill:"currentColor"});case"grid-rows":return Xe("path",{d:"M4.512 0.385C5.781 0.491 6.625 1.721 6.625 3V9C6.625 10.279 5.78 11.508 4.511 11.614C4.477 11.62 4.443 11.625 4.408 11.625H2.666C1.299 11.625 0.375 10.338 0.375 9V3C0.375 1.662 1.299 0.375 2.667 0.375H4.409C4.444 0.375 4.478 0.379 4.512 0.385ZM10.748 10.004C11.161 10.004 11.497 10.339 11.497 10.752C11.497 11.165 11.161 11.5 10.748 11.5C10.335 11.5 10 11.165 10 10.752C10 10.339 10.335 10.004 10.748 10.004ZM1.625 9C1.625 9.871 2.193 10.375 2.666 10.375H4.333C4.806 10.375 5.375 9.871 5.375 9V6.625H1.625V9ZM10.748 5.252C11.161 5.252 11.497 5.587 11.497 6C11.497 6.413 11.161 6.748 10.748 6.748C10.335 6.748 10 6.413 10 6C10 5.587 10.335 5.252 10.748 5.252ZM2.667 1.625C2.194 1.625 1.625 2.129 1.625 3V5.375H5.375V3C5.375 2.129 4.806 1.625 4.333 1.625H2.667ZM10.748 0.5C11.161 0.5 11.497 0.835 11.497 1.248C11.497 1.661 11.161 1.997 10.748 1.997C10.335 1.997 10 1.661 10 1.248C10 0.835 10.335 0.5 10.748 0.5Z",fill:"currentColor"});case"grid-columns":return Xe("path",{d:"M0.321 7.424C0.427 6.155 1.657 5.311 2.936 5.311H8.936C10.215 5.311 11.444 6.156 11.55 7.425C11.556 7.458 11.561 7.493 11.561 7.528V9.27C11.56 10.637 10.274 11.561 8.936 11.561H2.936C1.598 11.561 0.311 10.636 0.311 9.269V7.527C0.311 7.492 0.315 7.458 0.321 7.424ZM9.94 1.188C9.94 0.775 10.275 0.439 10.688 0.439C11.101 0.439 11.437 0.774 11.437 1.188C11.437 1.601 11.101 1.936 10.688 1.936C10.275 1.936 9.94 1.601 9.94 1.188ZM8.936 10.311C9.806 10.311 10.31 9.743 10.311 9.27V7.603C10.311 7.129 9.807 6.561 8.936 6.561H6.561V10.311H8.936ZM5.188 1.188C5.188 0.775 5.523 0.439 5.936 0.439C6.349 0.439 6.685 0.774 6.685 1.188C6.685 1.601 6.349 1.936 5.936 1.936C5.523 1.936 5.188 1.601 5.188 1.188ZM1.561 9.269C1.561 9.742 2.065 10.311 2.936 10.311H5.311V6.561H2.936C2.065 6.561 1.561 7.129 1.561 7.603V9.269ZM0.436 1.188C0.436 0.774 0.772 0.439 1.185 0.439C1.598 0.439 1.933 0.775 1.933 1.188C1.933 1.601 1.598 1.936 1.185 1.936C0.772 1.936 0.436 1.601 0.436 1.188Z",fill:"currentColor"})}}function Fn({family:e,size:t=12,step:n,subproperty:r="all"}){let o=function(e,t="all"){return Ie(e,t)?{name:"palette",rotation:0}:"stack"===e?"horizontal"===t?{name:"stack-horizontal",rotation:90}:"align"===t?{name:"align",rotation:0}:"justify"===t?{name:"justify",rotation:0}:{name:"stack-vertical",rotation:0}:"grid"===e?{name:"rows"===t?"grid-rows":"columns"===t?"grid-columns":"grid",rotation:90}:"text"===e?{name:"weight"===t?"text-weight":"line-height"===t?"text-leading":"letter-spacing"===t?"text-tracking":"text-align"===t?"text-align":"text-size",rotation:0}:"transform"===e?{name:"scale"===t?"transform-scale":"rotate"===t?"transform-rotate":"transform-translate",rotation:0}:"opacity"===e?{name:"mix-blend"===t?"mix-blend":"opacity",rotation:0}:"all"===t?{name:Bn[e],rotation:0}:"radius"===e?{name:"radius-top-right",rotation:Wn[t]??0}:{name:"padding"===e?"x"===t?"padding-x":"y"===t?"padding-y":"padding-top":"margin"===e?"x"===t?"margin-x":"y"===t?"margin-y":"margin-top":"border-top",rotation:("border"===e?90:0)+(Ln[t]??0)}}(e,r),i="text-size"===o.name?V:"text-weight"===o.name?B:"text-leading"===o.name?L:"text-tracking"===o.name?W:"text-align"===o.name?Z:"palette"===o.name?F:"transform-translate"===o.name?D:"transform-scale"===o.name?O:"transform-rotate"===o.name?_:"opacity"===o.name?q:"mix-blend"===o.name?Y:null;return i?Xe(i,{"aria-hidden":"true","data-popmelt-sticker-icon":`${e}-${r}`,width:t,height:t,strokeWidth:2.5,style:{display:"block",transform:o.rotation?`rotate(${o.rotation}deg)`:void 0,transition:"width 250ms ease, height 250ms ease"}}):Xe("svg",{"aria-hidden":"true","data-popmelt-sticker-icon":`${e}-${r}`,viewBox:"0 0 12 12",fill:"none",style:{width:t,height:t,display:"block",transform:o.rotation?`rotate(${o.rotation}deg)`:void 0,transition:"width 250ms ease, height 250ms ease"},children:Xe(Zn,{name:o.name})})}function Dn(e,t){let n=(Ee.indexOf(e)+t%Ee.length+Ee.length)%Ee.length;return Ee[n]}function On(e,t){let n=Ee.indexOf(e),r=(Ee.indexOf(t)-n+Ee.length)%Ee.length;return r<=Ee.length/2?r:r-Ee.length}function _n(e,t,n,r="all"){let o=Ae(e,r),i=(o.indexOf(t)+n%o.length+o.length)%o.length;return o[i]}function qn(e,t,n,r="all"){let o=Ae(e,r),i=o.indexOf(t),a=(o.indexOf(n)-i+o.length)%o.length;return a<=o.length/2?a:a-o.length}function Yn({offset:e,colors:t,renderItem:n,showControl:r=!0,activeColor:o,snapActiveColor:i=!1}){let a=[e-2,e-1,e,e+1,e+2];return Ke("div",{style:{position:"relative",width:96,height:32,overflow:"hidden"},children:[r&&Xe("span",{"aria-hidden":"true",style:{position:"absolute",left:jn,top:0,width:jn,height:jn,borderRadius:16,background:t.control}}),Xe("div",{"data-popmelt-sticker-rail":!0,style:{position:"absolute",inset:0,transform:`translateX(${-e*jn}px)`,transition:"transform 250ms ease",willChange:"transform"},children:a.map(r=>{let a=r===e;return Xe("span",{style:{position:"absolute",left:jn+r*jn,top:0,width:jn,height:jn,display:"flex",alignItems:"center",justifyContent:"center",color:a?o??t.primary:t.mutedStrong,transition:i?"none":`color 400ms ${Pn}`},children:n(r,a)},r)})})]})}function Jn({family:e,colors:t,showControl:n=!0,activeColor:r,snapActiveColor:o}){let i=_e(e),a=_e(e),[l,s]=Fe(0);return qe(()=>{if(a.current===e)return;let t=On(a.current,e);a.current=e,s(e=>e+t)},[e]),Xe(Yn,{offset:l,colors:t,showControl:n,activeColor:r,snapActiveColor:o,renderItem:(e,t)=>{let n=Dn(i.current,e);return Xe(Fn,{family:n,subproperty:"all",size:t?14:12})}})}function Kn({color:e,colors:t,showControl:n=!0}){let r=_e(e),o=_e(e),[i,a]=Fe(0);return qe(()=>{if(o.current===e)return;let t=Se(o.current,e);o.current=e,a(e=>e+t)},[e]),Xe(Yn,{offset:i,colors:t,showControl:n,renderItem:(e,t)=>{let n=Me(r.current,e),o=t?14:12;return Xe("span",{"aria-label":n,"data-popmelt-sticker-color":n,style:{width:o,height:o,borderRadius:"50%",background:ge(n,ye),boxShadow:"inset 0 0 0 1px rgb(0 0 0 / 0.08)",transition:"width 250ms ease, height 250ms ease"}})}})}function Xn({name:e,size:t}){let n="align-start"===e?G:"align-center"===e?Q:"align-end"===e?U:"align-stretch"===e?ee:"justify-start"===e?te:"justify-center"===e?ne:"justify-end"===e?re:"justify-between"===e?oe:"justify-around"===e?ie:"text-align-left"===e?Z:"text-align-center"===e?ae:"text-align-right"===e?le:"text-align-justify"===e?se:null;return n?Xe(n,{"aria-hidden":"true","data-popmelt-sticker-step-icon":e,width:t,height:t,strokeWidth:2.25,style:{display:"block"}}):Xe("svg",{"aria-hidden":"true","data-popmelt-sticker-step-icon":e,width:t,height:t,viewBox:"0 0 14 14",fill:"none",style:{display:"block"},children:Ke(Ge,"align-baseline"===e?{children:[Xe("path",{d:"M1.5 10.5H12.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),Xe("path",{d:"M3 8V4.75M3 4.75H6.5M6.5 4.75V8M8.5 8V6M8.5 6H11M11 6V8",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]}:{children:[Xe("path",{d:"M1.5 2V12M12.5 2V12",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),Xe("rect",{x:"3.25",y:"4.75",width:"2",height:"4.5",rx:"1",fill:"currentColor"}),Xe("rect",{x:"8.75",y:"4.75",width:"2",height:"4.5",rx:"1",fill:"currentColor"}),Xe("circle",{cx:"7",cy:"7",r:"0.75",fill:"currentColor"})]})})}function Gn({family:e,step:t,subproperty:n,colors:r,showControl:o=!0,unavailable:i=!1,activeColor:a,snapActiveColor:l=!1}){let s=_e(t),d=_e(t),[c,u]=Fe(0);return De(()=>{if(d.current===t)return;let r=qn(e,d.current,t,n);d.current=t,u(e=>e+r)},[e,t,n]),Xe(Yn,{offset:c,colors:r,showControl:o,activeColor:a??(i?r.muted:r.primary),snapActiveColor:l,renderItem:(t,r)=>{let o=_n(e,s.current,t,n),a=function(e,t,n){if("stack"===e&&"align"===t){if("start"===n)return"align-start";if("center"===n)return"align-center";if("end"===n)return"align-end";if("stretch"===n)return"align-stretch";if("baseline"===n)return"align-baseline"}if("stack"===e&&"justify"===t){if("start"===n)return"justify-start";if("center"===n)return"justify-center";if("end"===n)return"justify-end";if("between"===n)return"justify-between";if("around"===n)return"justify-around";if("evenly"===n)return"justify-evenly"}if("text"===e&&"text-align"===t){if("left"===n)return"text-align-left";if("center"===n)return"text-align-center";if("right"===n)return"text-align-right";if("justify"===n)return"text-align-justify"}return null}(e,n,o);return Xe("span",{"data-popmelt-sticker-step-unavailable":r&&i?"true":void 0,style:{alignItems:"center",display:"flex",fontSize:r?14:12,justifyContent:"center",transition:"font-size 250ms ease"},children:a?Xe(Xn,{name:a,size:r?14:12}):$e(o,e,n)})}})}function Qn(e){return"family"===e?0:35}function Un(e){return"family"===e?jn/Tn:1}function er(e){return"family"===e?14/(12*Un(e)):1}function tr(e,t,n){return`${e}:${t}:${n}`}function nr(e,t,n){return!!xe(n)&&("color"===e?"family"!==t:("text"===e||"border"===e)&&"value"===t)}function rr({family:e,step:t,subproperty:n,stage:r,accentColor:o,applyPulse:i=0,snapPulse:a=0,stepUnavailable:l=!1,colors:s}){let d=function(e,t="padding",n="all"){return Ie(t,n)?"family"===e?{family:0,variant:-jn,value:-64}:"variant"===e?{family:jn,variant:0,value:-jn}:{family:64,variant:jn,value:0}:"family"===e?{family:0,variant:-64,value:-jn}:{family:jn,variant:-jn,value:0}}(r,e,n),c=_e(r),u=_e(i),p=_e(a),[h,m]=Fe(!1),f=p.current!==a;qe(()=>{p.current=a},[a]),qe(()=>{let e=c.current!==r&&"family"!==r,t="value"===r&&u.current!==i;if(c.current=r,u.current=i,!e&&!t)return;m(!0);let n=window.requestAnimationFrame(()=>m(!1));return()=>window.cancelAnimationFrame(n)},[i,r]);let g=e=>({position:"absolute",left:0,right:0,top:4,height:jn,transform:`translateY(${e}px)`,transition:f?"none":"transform 250ms ease",willChange:"transform"});return Ke("div",{"data-popmelt-sticker-depth-rail":r,style:{position:"relative",width:96,height:40,marginBlock:-4,overflow:"hidden",zIndex:2},children:[Xe("span",{"aria-hidden":"true","data-popmelt-sticker-depth-control":!0,style:{position:"absolute",left:jn,top:4,width:jn,height:jn,borderRadius:16,background:h?o:s.control,transition:h?"none":`background 400ms ${Pn}`}}),Xe("div",{"aria-hidden":"family"!==r,"data-popmelt-sticker-depth-row":"family",style:g(d.family),children:Xe(Jn,{family:e,colors:s,showControl:!1,activeColor:h?s.surface:s.primary,snapActiveColor:h})}),Xe("div",{"aria-hidden":"variant"!==r,"data-popmelt-sticker-depth-row":"variant",style:g(d.variant),children:Ie(e,n)&&xe(n)&&Xe(Kn,{color:n,colors:s,showControl:!1})}),Xe("div",{"aria-hidden":"value"!==r,"data-popmelt-sticker-depth-row":"value",style:g(d.value),children:Xe(Gn,{family:e,step:t,subproperty:n,colors:s,showControl:!1,unavailable:l,activeColor:h?s.surface:void 0,snapActiveColor:h},tr(r,e,n))})]})}function or(e,t,n=42,r=An){let o=e.x+10,i=e.y+10;return{left:Math.min(Math.max(8,o),Math.max(8,t.width-r-8)),top:Math.min(Math.max(8,i),Math.max(8,t.height-n-8))}}function ir(e,t,n){return n?0:Math.min(e,t)}function ar({cursor:e,family:t,step:n,subproperty:r,stage:i,accentColor:a,applyPulse:l=0,contextLabelPulse:s=0,depthSnapPulse:d=0,rejectPulse:c=0,stepUnavailable:u=!1,query:p=null,toolbarElement:h,controlBounds:m,threadElement:f,annotationRailHovered:g=!1}){let[y]=Re(),x=je[y],v=`color-mix(in srgb, ${x.actionForeground} 16%, ${x.actionSurface})`,C=me(t,r),w=_e(t),b=_e(i),k=_e(r),I=_e(i),S=_e(l),M=_e(s),$=_e(c),E=_e(null),A=_e(!1),T=_e(!1),R=_e(0),j=_e(0),P=_e(0),z=_e(0),[N,V]=Fe(null),[B,L]=Fe(!1),[W,Z]=Fe(!1),[F,D]=Fe(!1),[O,_]=Fe(null),[q,Y]=Fe(!1),[J,K]=Fe(0),[X,G]=Fe(!1),[Q,U]=Fe(!1);qe(()=>{if($.current===c)return;$.current=c,U(!1);let e=window.requestAnimationFrame(()=>U(!0)),t=window.setTimeout(()=>U(!1),240);return()=>{window.cancelAnimationFrame(e),window.clearTimeout(t)}},[c]),qe(()=>{let e=I.current!==i&&"family"!==i,t="value"===i&&S.current!==l;if(I.current=i,S.current=l,!e&&!t)return;G(!0);let n=window.requestAnimationFrame(()=>G(!1));return()=>window.cancelAnimationFrame(n)},[l,i]),qe(()=>{let e="family"!==b.current&&"family"===i;b.current=i;let n=(e=!1)=>{R.current&&window.cancelAnimationFrame(R.current),e||window.clearTimeout(j.current),window.clearTimeout(P.current),window.clearTimeout(z.current),R.current=0,e||(j.current=0),P.current=0,z.current=0},r=e=>{P.current=window.setTimeout(()=>{Z(e),T.current=!1,L(!1)},750),z.current=window.setTimeout(()=>{A.current=!1,V(null)},984)};if("family"!==i){if(n(),w.current=t,!A.current)return;return Z(!0),T.current=!1,L(!1),void(z.current=window.setTimeout(()=>{A.current=!1,V(null)},Rn))}if(w.current!==t||e){if(w.current=t,A.current=!0,V(t),e)return n(),Z(!1),D(!0),T.current=!0,L(!0),j.current=window.setTimeout(()=>{j.current=0,D(!1)},Rn),void r(!1);j.current||(n(!0),D(!1),Z(!1),T.current||(T.current=!0,L(!0)),r(!1))}},[t,i]),De(()=>()=>{window.cancelAnimationFrame(R.current),window.clearTimeout(j.current),window.clearTimeout(P.current),window.clearTimeout(z.current)},[]),De(()=>{let e=M.current!==s;if(M.current=s,!function(e,t,n="all"){return"value"===t||Ie(e,n)&&"variant"===t}(t,i,r))return _(null),Y(!1),void(k.current=r);if(w.current!==t)return k.current=r,_(null),void Y(!1);if(k.current===r&&!e)return;k.current=r,Y(e),_(e?function(e,t){let n=ve(e),r=fe(e,t);return r===n?n:`${n} ${r}`}(t,r):fe(t,r));let n=window.setTimeout(()=>{_(null),Y(!1)},750);return()=>window.clearTimeout(n)},[s,t,i,r]),qe(()=>{O&&E.current?K(E.current.scrollWidth):K(0)},[O]);let ee=function(e,t=7.5){return null===e?Tn:Math.max(39,18+2*t+Math.ceil(e))}(O?J:null,q?10:7.5),te=q?10:7.5,ne=O?0:140,re=p||"family"!==i||N?68:Hn,oe=Ze(()=>or(e,m?.viewport??{width:typeof window>"u"?An:window.innerWidth,height:typeof window>"u"?Hn:window.innerHeight},re),[re,e,m?.viewport]),ie=h?Nn(oe,h.getBoundingClientRect(),re):1,ae=f?Vn(e,oe,f.getBoundingClientRect(),re):1,le=m?.compact?function(e,t,n,r,o){let i,a=8,l=o-r-8,s=1;for(let d of n){let n=Math.max(d.left-e.x,e.x-d.right,0),c=Math.max(d.top-e.y,e.y-d.bottom,0);if(s=Math.min(s,Math.hypot(n,c)/12),t.left+An<=d.left||t.left>=d.right)continue;let u=(d.top+d.bottom)/2<o/2,p=u?d.bottom+1:d.top-1-r;u?a=Math.max(a,p):l=Math.min(l,p);let h=u?t.top<=p:t.top>=p,m=u?e.y-d.bottom:d.top-e.y;if(!h||m<0)continue;let f=Math.max(n/12,Math.max(0,m-1)/r);f<s&&(s=f,i=u?0:r)}let d=Math.max(a,Math.min(t.top,l));return{top:d,scale:s,originY:i??Math.min(r,Math.max(0,e.y-d))}}(e,oe,m.bounds,re,m.viewport?.height??window.innerHeight):void 0,se=le?.scale??m?.bounds.reduce((t,n)=>Math.min(t,Vn(e,oe,n,re,40)),1)??1,de=ir(Math.min(ie,se),ae,g),ce=le?.top??oe.top,ue={position:"fixed",left:oe.left,top:ce,width:An,height:Hn,display:"flex",alignItems:"center",justifyContent:"center",gap:1,boxSizing:"border-box",padding:4,border:`1px solid ${x.border}`,borderRadius:22,background:x.surface,color:x.primary,fontFamily:H,fontSize:12,fontWeight:600,lineHeight:1,pointerEvents:"none",overflow:"visible",opacity:de,transform:`scale(${de})`,transformOrigin:`${e.x-oe.left}px ${le?.originY??e.y-ce}px`,visibility:0===de?"hidden":"visible",animation:Q?"popmeltStickerReject 220ms ease-out":void 0,zIndex:2147483647,colorScheme:y},pe=p?function(e){return[...e.tokens.map(e=>e.label),`${e.typed}${e.completion||e.fallback}`].filter(Boolean).join(" ")}(p):"";return Ke("div",{role:"status","aria-label":p?`Sticker search: ${pe||"search tokens"}`:`Sticker ${i}: ${"family"===i?t:"variant"===i?C:`${n} ${C}`}`,"data-devtools":"sticker-hud","data-popmelt-sticker-hud":!0,"aria-hidden":g||void 0,style:ue,children:[Xe("style",{children:`@keyframes popmeltStickerReject {\n ${o}\n }\n @keyframes popmeltStickerFamilyLabelEnter {\n from {\n opacity: 0;\n transform: translate(-50%, 10px) scale(0.9);\n }\n to {\n opacity: 1;\n transform: translate(-50%, 0) scale(1);\n }\n }\n @keyframes popmeltStickerQueryCaret {\n 0%, 45% { opacity: 1; }\n 55%, 100% { opacity: 0; }\n }`}),Xe("span",{"aria-hidden":"true","data-popmelt-sticker-wheel-shell":!0,style:{position:"absolute",inset:1,borderRadius:21,background:x.surface,zIndex:1}}),Xe(rr,{family:t,step:n,subproperty:r,stage:i,accentColor:a,applyPulse:l,snapPulse:d,stepUnavailable:u,colors:x}),!p&&Ke("span",{"aria-hidden":"true","data-popmelt-sticker-token-context":!0,"data-popmelt-sticker-token-context-stage":i,"data-popmelt-sticker-token-context-expanded":O?"true":"false",style:{position:"absolute",left:(An-ee)/2,top:9,width:ee,height:Tn,display:"flex",alignItems:"center",justifyContent:"center",gap:O?4:0,padding:O?`0 ${te}px`:0,boxSizing:"border-box",border:`1px solid ${v}`,borderRadius:12,background:x.actionSurface,color:x.actionForeground,transform:`translateY(${Qn(i)}px) scale(${Un(i)})`,transition:`left ${ne}ms ease-out, width ${ne}ms ease-out, gap ${ne}ms ease-out, padding ${ne}ms ease-out, transform 250ms ease`,transformOrigin:"center",willChange:"left, width, transform",overflow:"hidden",zIndex:0},children:[Xe("span",{style:{display:"block",transform:`scale(${er(i)})`,transition:"transform 250ms ease",transformOrigin:"center"},children:nr(t,i,r)?Xe("span",{"data-popmelt-sticker-color-context":r,style:{display:"block",width:12,height:12,borderRadius:"50%",background:ge(r,"value"===i?n:ye),boxShadow:"inset 0 0 0 1px rgb(255 255 255 / 0.16)"}}):Xe(Fn,{family:t,subproperty:"text"===t&&"variant"===i&&xe(r)?"color":r})}),Xe("span",{ref:E,"data-popmelt-sticker-subproperty-label":!0,style:{flexShrink:0,opacity:O&&J>0?1:0,color:x.actionForeground,fontSize:11,fontWeight:600,letterSpacing:.22,lineHeight:1,whiteSpace:"nowrap",transition:"opacity 120ms ease"},children:O})]}),p&&Xe(En,{query:p,border:v,background:x.actionSurface,foreground:x.actionForeground,renderIcon:e=>Xe(Fn,{family:e.family,subproperty:e.subproperty,size:12})}),Xe("span",{"aria-hidden":"true","data-popmelt-sticker-depth-burst":!0,style:{position:"absolute",left:37,top:5,width:jn,height:jn,overflow:"visible",pointerEvents:"none",zIndex:3},children:zn.map(e=>Xe("span",{style:{position:"absolute",left:"50%",top:"50%",width:4,height:1.5,borderRadius:1,background:a,opacity:X?1:0,transform:`translate(-50%, -50%) rotate(${e}deg) translateX(${X?17:30}px) scaleX(${X?.7:1})`,transformOrigin:"center",transition:X?"none":"transform 180ms cubic-bezier(0.16, 1, 0.3, 1), opacity 180ms ease-out",willChange:"transform, opacity"}},e))}),!p&&N&&Xe("span",{"data-popmelt-sticker-family-label":!0,style:{position:"absolute",left:"50%",top:44,height:Tn,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 10px",boxSizing:"border-box",opacity:B?1:0,transform:`translate(-50%, ${W?-35:0}px) scale(${W?.9:1})`,transformOrigin:"center",transition:"transform 250ms ease, opacity 200ms ease",animation:B&&F?"popmeltStickerFamilyLabelEnter 250ms ease":void 0,border:`1px solid ${v}`,borderRadius:12,background:x.actionSurface,color:x.actionForeground,fontSize:11,fontWeight:600,letterSpacing:.22,lineHeight:1,whiteSpace:"nowrap",willChange:"transform, opacity",zIndex:0},children:ve(N)})]})}var lr=["reviewing","considering","thinking","zhuzhing","iterating","tweaking","reflecting","noodling","pondering","finessing","polishing","riffing"];function sr(e){if(e.subjectLabel)return`<${e.subjectLabel}>`;let t=e.dataAttributes?.["data-popmelt-label"]?.trim();if(t)return t;let n=e.tagName,r=e.id?`#${e.id}`:"",o=e.className?`.${e.className.split(" ").slice(0,2).join(".")}`:"";return e.reactComponent?`<${e.reactComponent}> ${n}${r}${o}`:`${n}${r}${o}`}var dr=["id","data-pm","data-popmelt-frame","data-testid","data-test","data-cy","data-popmelt-media-id","data-popmelt-see-id","data-popmelt-subject-key","aria-label","name","href"],cr=["style","class","open","hidden","aria-hidden","data-state"];function ur(e){let t=new Set(dr);for(let n of e){/\.[\w\\-]/.test(n)&&t.add("class");for(let e of n.matchAll(/\[\s*([\w:-]+)/g))t.add(e[1]);if(/:(checked|disabled|enabled|required|optional|read-only|read-write)\b/.test(n))for(let e of["checked","selected","disabled","required","readonly","contenteditable"])t.add(e)}return{attributes:[...new Set([...t,...cr])],changesIdentity:e=>"attributes"!==e.type||t.has(e.attributeName??"")}}var pr=12,hr=.24,mr=8;function fr(e){return{...l(),display:"flex",alignItems:"center",gap:4,backgroundColor:e,color:"#fff",fontSize:12,lineHeight:12*a+"px",fontFamily:i,letterSpacing:"0.24px",padding:"0 8px",borderRadius:8,whiteSpace:"nowrap",maxWidth:400}}var gr={overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0};function yr(e,t){return!(!t||e!==t&&!e.contains(t))}function xr(e){let t=new Set(["resolved","needs_review","waiting_input","failed"]);return!!("text"===e.type&&e.text&&e.linkedSelector&&e.status&&t.has(e.status)&&e.threadId)}function vr(e){let t=e.status??"pending",n=new Set(["pending","sending","in_flight","resolved","waiting_input","failed"]);return!!("text"===e.type&&e.text&&e.linkedSelector&&n.has(t))}function Cr(e){return e.isInFlight?"#888888":e.comment?!1===e.comment.pending?"#888888":e.threadAccentColor:e.isInFlight||e.hasThreadState||e.hasStickers?"#888888":e.accentColor}function wr(e,t){let n=e.get(t);return!!n&&(clearTimeout(n),e.delete(t),!0)}function br(e,t,n){return null!==e&&e.selector===t&&e.expandedIndices.includes(n)}function kr(e,t){return e?.selector===t?null:e}function Ir({selector:e,label:t,tokens:n}){return JSON.stringify([e,t,n])}function Sr({hasElementChanges:e=!1,hasPendingChanges:t,hasThreadState:n,isHovered:r,hasTimedReveal:o,isRevealedSticker:i}){let a=(e||t||n)&&!r;return{annotationCollapsed:a,stickerCollapsed:a&&!i,sendCompact:a&&!o}}function Mr({property:e}){let t,n=/^(padding|margin)(?:-(top|right|bottom|left))?$/.exec(e);n&&(t={family:n[1],subproperty:n[2]??"all"});let r=/^border-(top|right|bottom|left)-width$/.exec(e);r&&(t={family:"border",subproperty:r[1]});let o=/^border-(top-left|top-right|bottom-right|bottom-left)-radius$/.exec(e);o&&(t={family:"radius",subproperty:o[1]});let i={"border-width":["border","all"],"border-radius":["radius","all"],"font-size":["text","size"],"font-weight":["text","weight"],"line-height":["text","line-height"],"letter-spacing":["text","letter-spacing"],"text-align":["text","text-align"],"flex-direction":["stack","direction"],"align-items":["stack","align"],"justify-content":["stack","justify"],gap:["stack","gap"],"grid-template-columns":["grid","columns"],"grid-template-rows":["grid","rows"],translate:["transform","translate"],scale:["transform","scale"],rotate:["transform","rotate"],opacity:["opacity","opacity"],"mix-blend-mode":["opacity","mix-blend"]}[e];if(i&&(t={family:i[0],subproperty:i[1]}),t)return Xe(Fn,{...t});let a=/(^|-)color$|^(fill|stroke)$/.test(e)?F:/(^|-)(width|inline-size)$/.test(e)?J:/(^|-)(height|block-size)$/.test(e)?K:X;return Xe(a,{"aria-hidden":"true","data-popmelt-property-icon":e,size:12,strokeWidth:2.5,style:{display:"block"}})}function $r({chip:e}){return e.selection?Xe(Fn,{...e.selection}):Xe(Mr,{property:e.custom.property})}function Er(e){return e.comment?.threadState??e.threadState}function Ar(e){return sr(e.element)}function Hr(e,t,n){return function(e,t,n){if(void 0===n.avoidLeft&&void 0===n.avoidRight)return!0;let r=typeof window<"u"?window.innerWidth:9999,o=n.avoidLeft??0,i=n.avoidRight??r;return e+t>o&&e<i}(t,n,e)?e:{}}function Tr(e){let t=e.stickers.map(e=>e.token).join(""),n=e.comment?.text??e.label;return Math.min(720,44+7.2*n.length+7.2*t.length)}function Rr(e,t){return t||!1===e?.pending?0:e?.imageCount??0}function jr(e,t,n,r,o,i){return`translate(${"right"===n?`max(calc(-100% + ${r}px), calc(0px - max(0px, ${e}px)))`:`min(0px, calc(100vw - max(0px, ${e}px) - 100%))`}, min(max(0px, calc(${void 0!==o?`${o}px`:"0px"} - max(0px, ${t}px))), calc(${void 0!==i?`${i}px`:"100dvh"} - max(0px, ${t}px) - 100%)))`}function Pr({left:e,top:t,avoidTop:n,avoidBottom:r,anchor:o,horizontalAlignment:i="left",visualRef:a,style:l,children:s,...d}){let c=k(o),u=e-c.left,p=t-c.top;return Xe("div",{"data-devtools":"badge-hit-area",...d,style:{position:"fixed",left:`max(0px, ${u}px)`,top:`max(0px, ${p}px)`,padding:`${c.top}px ${c.right}px ${c.bottom}px ${c.left}px`,transform:jr(u,p,i,c.left+c.right,n,r),...l},children:Xe("div",{ref:a,children:s})})}function zr({targetDocument:e,subjectRegistry:t,projectedTargets:n,readOnly:r=!1,focusedSelector:o,threadAccessory:i,styleModifications:a,textModifications:l,stagedComments:w,accentColor:k,annotationNumberBySelector:I,inFlightSelectors:S,inFlightAnnotationIds:M,activeAnnotationIds:$,inFlightSelectorJobIds:A,waitingApprovalJobIds:H,inFlightSelectorColors:T,toolbarRef:V,onHoverSelector:B,sendHintSelector:L,pendingBundleCount:W=1,onHoverSendBundle:Z,onSend:F,onSelectSticker:D,onDeleteSticker:O,threadStates:_,onViewThread:q,hoveredElement:Y,hoveredElementInfo:J,showHoverIdentifier:K=!1,onEditComment:X,onDeleteComment:G,onDeletePeerComment:Q,onDeletePeerStyles:U,onDiscardTextChanges:ee,onArchiveThread:te,onClearInteractionEpisode:ne,onEditSubject:re,onDeleteSubject:oe,onHoverSubjectLabel:ie,activeCommentEntry:ae,refreshKey:le}){let se=Ye(s),ce=Ye(E),[ue,me]=Fe([]),[fe,ge]=Fe(null),[ye,xe]=Fe(null),[ve,Ie]=Fe(()=>new Map),Se=_e(new Map),Me=_e(new Map),$e=_e(new Map),Ee=_e(new Map),Ae=_e(new Map),Re=_e(new Map),je=Oe(e=>{wr(Ae.current,e)},[]),Ne=Oe(e=>{!function(e,t,n,r=1e3){wr(e,t),e.set(t,setTimeout(()=>{e.delete(t),n()},r))}(Ae.current,e,()=>{xe(t=>t===e?null:t),ge(t=>t?.selector===e?null:t)})},[]),Le=Oe((e,t,n)=>{ge(r=>function(e,t){return e&&e.selector===t.selector?t.index===e.index?e:{...t,expandedIndices:t.index>e.index?[...new Set([...e.expandedIndices,t.index])]:[...new Set([...e.expandedIndices.filter(e=>e<=t.index),t.index])]}:{...t,expandedIndices:[t.index]}}(r,{selector:e,target:t,index:n}))},[]),We=Oe(e=>!!S?.has(e.selector)||!!e.comment&&!!$?.has(e.comment.id),[$,S]),Ze=Oe((e,t)=>!We(e)&&(!!e.comment&&!!M?.has(e.comment.id)||"in_flight"===t?.status),[We,M]),Je=Oe(e=>{let t=mt(e.hasPendingChanges,Er(e),A?.get(e.selector));return function({isInFlight:e,isQueued:t=!1,threadStatus:n}){return e?"working":t||"in_flight"===n?"queued":"waiting_input"===n?"question":"failed"===n?"failed":"resolved"===n?"replied":"draft"}({isInFlight:We(e),isQueued:Ze(e,t),threadStatus:t?.status})},[We,Ze,A]),Qe=ue.filter(e=>e.hasPendingChanges||!!Er(e)).map(e=>Ir({selector:e.selector,label:e.label,tokens:[...e.stickers.map(e=>e.token),..."draft"===Je(e)?[]:[`status:${Je(e)}`]]})).join("|");qe(()=>{let e=new Set,t=new Map,n=new Set,r=new Set;for(let o of ue){let i=Er(o);if(!o.hasPendingChanges&&!i)continue;e.add(o.selector);let a=Je(o),l=Ir({selector:o.selector,label:o.label,tokens:[...o.stickers.map(e=>e.token),..."draft"===a?[]:[`status:${a}`]]});if(Se.current.get(o.selector)===l)continue;Se.current.set(o.selector,l);let s=$e.current.get(o.selector);$e.current.set(o.selector,a),"working"===a&&"working"!==s&&r.add(o.selector);let d=Me.current.get(o.selector),c=new Map,u=null;for(let e of o.stickers){let t=Ce(e);c.set(t,e.token),d?.get(t)!==e.token&&(u=t)}if(Me.current.set(o.selector,c),!o.hasPendingChanges&&(void 0===s||"draft"===s&&"queued"!==a&&"working"!==a)){let e=Ee.current.get(o.selector);e&&clearTimeout(e),Ee.current.delete(o.selector),n.add(o.selector);continue}t.set(o.selector,u);let p=Ee.current.get(o.selector);p&&clearTimeout(p),Ee.current.set(o.selector,setTimeout(()=>{Ie(e=>{if(!e.has(o.selector))return e;let t=new Map(e);return t.delete(o.selector),t}),Ee.current.delete(o.selector)},1e3))}for(let[t,n]of Ee.current)e.has(t)||(clearTimeout(n),Ee.current.delete(t),Se.current.delete(t),Me.current.delete(t),$e.current.delete(t));r.size>0&&ge(e=>e&&r.has(e.selector)?null:e),Ie(r=>{let o=new Map([...r].filter(([t])=>e.has(t)));for(let[e,n]of t)o.set(e,n);for(let e of n)o.delete(e);return o.size===r.size&&[...o].every(([e,t])=>r.get(e)===t)?r:o})},[ue,Qe,Je]),De(()=>()=>{for(let e of Ee.current.values())clearTimeout(e);Ee.current.clear();for(let e of Ae.current.values())clearTimeout(e);Ae.current.clear(),Se.current.clear(),Me.current.clear(),$e.current.clear()},[]);let Ue=S&&S.size>0||$&&$.size>0,{charIndex:et,word:nt}=function(e){let t=Ye(s),[n,r]=Fe(0),[o,i]=Fe(()=>Math.floor(Math.random()*lr.length));return De(()=>{if(!e||!t)return;let n=setInterval(()=>r(e=>(e+1)%3),250),o=setInterval(()=>i(e=>(e+1)%lr.length),3e3);return()=>{clearInterval(n),clearInterval(o)}},[e,t]),{charIndex:n,word:lr[o]}}(!!Ue);De(()=>{if(!se)return;let t=null,r=!1,o=e??document,i=ur([...w.flatMap(e=>[e.selector,e.element.selector]),...a.flatMap(e=>[e.selector,e.element.selector]),...l.flatMap(e=>[e.selector,e.element.selector]),...Array.from(_??[]).flatMap(([e,t])=>t.selectors??[e])]),s=(e,t)=>n?null:Ve(e,t,o),c=()=>{let t=[],r=new Map,i=t=>(r.has(t)||r.set(t,n?null:e?(e=>{try{let t=o.querySelectorAll(e);return 1===t.length?t[0]:null}catch{return null}})(t):he(t)),r.get(t)),d=new Map;for(let e of w)d.set(e.selector,{selector:e.selector,element:e.element,styleChangeCount:0,textChangeCount:0,hasPendingChanges:!1!==e.pending,stickers:[],comment:e});for(let e of a){let t=d.get(e.selector),n=[...t?.stickers??[]];if(be(e.captured,A?.get(e.selector)))for(let t of ke(e.changes)){let e=Ce(t);n.some(t=>Ce(t)===e)||n.push(t)}d.set(e.selector,{selector:e.selector,element:e.element,styleChangeCount:(t?.styleChangeCount??0)+e.changes.length,textChangeCount:t?.textChangeCount??0,modifiedText:t?.modifiedText,hasPendingChanges:(t?.hasPendingChanges??!1)||!e.captured&&!e.awaitingReview,threadState:tt(e)??t?.threadState,stickers:n,comment:t?.comment})}for(let e of l){let t=d.get(e.selector);d.set(e.selector,{selector:e.selector,element:t?.element??e.element,styleChangeCount:t?.styleChangeCount??0,textChangeCount:1,modifiedText:e.modified,hasPendingChanges:(t?.hasPendingChanges??!1)||!e.captured,stickers:t?.stickers??[],threadState:t?.threadState,comment:t?.comment})}let c=new Set,u=new Set,p=new Set;for(let e of d.values()){let t=e.comment?.threadState;t?.threadId&&u.add(t.threadId),t?.targetBindingId&&p.add(t.targetBindingId)}for(let[e,t]of d){let n=s(e,t.element);n&&(t.resolvedElement=n),n&&c.add(n)}for(let[e,t]of _??[]){if(n||u.has(t.threadId)||t.targetBindingId&&p.has(t.targetBindingId))continue;let r=Be(t.selectors??[e],t.targetFingerprint,o);if("matched"!==r.status)continue;let{element:i}=r,a=t.selectors?.[0]??e;!i||c.has(i)||(c.add(i),d.set(a,{selector:a,element:{...pe(i),selector:a},styleChangeCount:0,textChangeCount:0,hasPendingChanges:!1,stickers:[],resolvedElement:i,threadState:t}))}Array.from(d.values()).forEach(e=>{let r=e.transientElement??e.resolvedElement??s(e.selector,e.element),o=n?.get(e.selector);if(!r&&!o)return;let a=function(e){return e.textChangeCount>0&&0===e.styleChangeCount?{label:`Text changed: ${e.modifiedText?.replace(/\s+/g," ").trim()||"Empty text"}`}:{label:e.elementLabel}}({elementLabel:Ar(e),styleChangeCount:e.styleChangeCount,textChangeCount:e.textChangeCount,modifiedText:e.modifiedText}),l=e.comment?.threadState??e.threadState??(_?st(e.selector,_,i):void 0);t.push({threadState:l,selector:e.selector,label:e.threadState?.title?.trim()||a.label,annotationNumber:e.transientElement?void 0:e.comment?.annotationNumber??l?.annotationNumber??I.get(e.selector),domElement:r,projectedRect:o,hasPendingChanges:e.hasPendingChanges,hasElementChanges:e.styleChangeCount>0||e.textChangeCount>0,stickers:e.stickers,transient:!!e.transientElement,comment:e.comment})}),me(e=>function(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.selector===r.selector&&e.label===r.label&&e.annotationNumber===r.annotationNumber&&e.domElement===r.domElement&&e.projectedRect===r.projectedRect&&e.threadState===r.threadState&&e.comment===r.comment&&e.hasPendingChanges===r.hasPendingChanges&&e.hasElementChanges===r.hasElementChanges&&e.transient===r.transient&&e.stickers.length===r.stickers.length&&e.stickers.every((e,t)=>{let n=r.stickers[t];return e.token===n.token&&e.selection===n.selection&&Ce(e)===Ce(n)})})}(e,t)?e:t)},u=()=>{r||null!==t||(t=requestAnimationFrame(()=>{t=null,c()}))};if(c(),n)return;window.addEventListener("resize",u,!0);let p=new MutationObserver(e=>{e.some(i.changesIdentity)&&u()});p.observe(o.body,{attributes:!0,childList:!0,characterData:!0,subtree:!0,attributeFilter:i.attributes}),window.addEventListener("load",u),o.fonts?.ready?.then(u);let h=[...a,...l].some(e=>e.selector.startsWith("@frame("))||w.some(e=>e.selector.startsWith("@frame("))?d(u):void 0;return()=>{r=!0,h?.(),window.removeEventListener("resize",u,!0),window.removeEventListener("load",u),p.disconnect(),t&&cancelAnimationFrame(t)}},[se,I,w,a,l,_,A,e,n]);let rt=K&&!ye&&Y&&J?.selector&&!ue.some(e=>e.domElement===Y)?{selector:J.selector,label:Ar({element:J}),annotationNumber:void 0,domElement:Y,hasPendingChanges:!1,hasElementChanges:!1,stickers:[],transient:!0}:null,ot=rt?[...ue,rt]:ue;if(0===ot.length)return null;let it=se?V?.current?.getBoundingClientRect():void 0,at=!!it&&it.top<window.innerHeight/2,lt=it?{avoidTop:at?it.bottom+8:void 0,avoidBottom:at?void 0:it.top-8,avoidLeft:it.left-8,avoidRight:it.right+8}:{},dt=e=>i?.threadId&&i.threadId===(e.comment?.threadId??Er(e)?.threadId)?i:void 0,ct=e=>ce?.preview&&ce.preview.threadId===(e.comment?.threadId??Er(e)?.threadId),ut=e=>{let t=ae?.element===e.domElement,n=mt(e.hasPendingChanges,Er(e),A?.get(e.selector)),r=We(e),o=Ze(e,n),i=H?.has(A?.get(e.selector)??n?.jobId??""),a=e.comment?.awaitingReview?"Awaiting review":i?"Approval needed":r?nt||"Thinking":o?"Queued":"in_flight"===n?.status?"Thinking":"waiting_input"===n?.status?"Question":"failed"===n?.status?"Failed":n?.label??"Replied";return(t?ae.width+(ae.trailingWidth??0)+Tr(e):Tr(e)+Sn(Rr(e.comment,r||!!n))+b(e.comment?.interactionEpisodeStepCount??0))+(dt(e)?.width??(n||e.comment?.awaitingReview?28+7.2*a.length:0))+(ct(e)?m+2:0)},pt=ot.find(e=>e.transient)??ot.find(e=>e.domElement&&yr(e.domElement,Y)||ye===e.selector||fe?.selector===e.selector)??(r?ot.find(e=>e.selector===o):void 0),ht=(()=>{if(!pt)return null;let e=pt.projectedRect,t=e?{...e,right:e.left+e.width,bottom:e.top+e.height}:pt.domElement?ze(pt.domElement):void 0;if(!t)return null;let n=ut(pt),r=c(t,22,2,window.innerHeight,n,window.innerWidth);return u(r,n,22)})(),ft=fr(k),gt=gr;return Ke(Ge,{children:[Xe("style",{dangerouslySetInnerHTML:{__html:'\n[data-devtools="badge"]::selection,\n[data-devtools="badge"] *::selection {\n background: #000000;\n color: #ffffff;\n}\n.popmelt-staged-sticker-group {\n display: flex;\n align-items: center;\n isolation: isolate;\n}\n.popmelt-staged-sticker-layer {\n position: relative;\n align-self: stretch;\n display: flex;\n align-items: center;\n margin-right: -2px;\n}\n.popmelt-staged-sticker-pointer {\n position: absolute;\n left: -4px;\n top: 50%;\n width: 14.142px;\n height: 14.142px;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: translateY(-50%);\n pointer-events: none;\n}\n.popmelt-staged-sticker-pointer::before {\n content: \'\';\n width: 10px;\n height: 10px;\n background: var(--popmelt-staged-accent);\n transform: rotate(-45deg);\n}\n.popmelt-collapsible-badge-detail {\n max-width: 400px;\n opacity: 1;\n overflow: hidden;\n transition: max-width 180ms cubic-bezier(0.2, 0, 0, 1), opacity 100ms linear;\n}\n.popmelt-collapsible-badge-detail-inner {\n display: block;\n min-width: 0;\n overflow: hidden;\n padding-left: 4px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n[data-popmelt-collapsed="true"] .popmelt-collapsible-badge-detail {\n max-width: 0;\n opacity: 0;\n}\n@supports (interpolate-size: allow-keywords) {\n .popmelt-collapsible-badge-detail {\n width: max-content;\n interpolate-size: allow-keywords;\n transition: width 180ms cubic-bezier(0.2, 0, 0, 1), opacity 100ms linear;\n }\n [data-popmelt-collapsed="true"] .popmelt-collapsible-badge-detail {\n width: 0;\n max-width: 400px;\n }\n}\n[data-popmelt-snap-collapse="true"] .popmelt-collapsible-badge-detail {\n transition: none;\n}\n@media (prefers-reduced-motion: reduce) {\n .popmelt-collapsible-badge-detail {\n transition: none;\n }\n}\n'}}),ot.map(e=>{let n=dt(e),i=ae?.element===e.domElement,s=mt(e.hasPendingChanges,Er(e),A?.get(e.selector)),d=We(e),c=Ze(e,s),w=function(e,t,n,r){return t?r?.get(e)??n:n}(e.selector,d,k,T),b=function(e,t,n){return n?.color?n.color:!1===t?.pending&&(t.threadState||t.awaitingReview)?t.color:e}(w,e.comment,Er(e)),I=function(e,t){return t?"#888888":e}(b,d||"in_flight"===s?.status),S=H?.has(A?.get(e.selector)??s?.jobId??""),M=e.comment?.awaitingReview||"awaiting_review"===s?.status,$=M?"Awaiting review":S?"Approval needed":d?nt||"Thinking":c?"Queued":"in_flight"===s?.status?"Thinking":"waiting_input"===s?.status?"Question":"failed"===s?.status?"Failed":s?.label??"Replied",E=!(!e.domElement||!yr(e.domElement,Y)),V=ye===e.selector,_=ve.has(e.selector),J=ve.get(e.selector),K=!!s||!1===e.comment?.pending,se=Sr({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,hasThreadState:K,isHovered:r&&o===e.selector||E||V||br(fe,e.selector,0),hasTimedReveal:_,isRevealedSticker:!1}),ce=e.stickers.length+1,ue=Sr({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,hasThreadState:K,isHovered:br(fe,e.selector,ce),hasTimedReveal:_,isRevealedSticker:!1}),pe=Sr({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,hasThreadState:K,isHovered:r&&o===e.selector||E||V||br(fe,e.selector,ce),hasTimedReveal:_,isRevealedSticker:_}),he=ut(e),me=(i?ae.imageCount:Rr(e.comment,d||!!s))??0,be=e.stickers.length>0||me>0,ke=p({hasCommentEntry:i||!!e.comment,stagedChangeCount:e.stickers.length+ +(me>0)}),Ie=d||!!s||!!e.comment?.awaitingReview,Se=!Ie&&e.selector===L,Me=!i&&se.annotationCollapsed&&pe.stickerCollapsed&&ue.sendCompact&&!_&&fe?.selector!==e.selector,$e=Me?h({annotationNumber:e.annotationNumber,stickerCount:e.stickers.length,interactionEpisodeStepCount:e.comment?.interactionEpisodeStepCount??0,hasStatus:Ie,hasSend:Se,controlGap:ke})+Sn(me)+(ct(e)?m+ke:0):he;return Xe(f,{element:e.domElement,projectedRect:e.projectedRect,onRemove:e.comment&&Q?()=>Q(e.comment.id):U&&a.some(t=>t.selector===e.selector)?()=>U(a.filter(t=>t.selector===e.selector)):void 0,onActivate:e.comment?.threadId||s?.threadId?()=>q?.(e.comment?.threadId??s?.threadId):void 0,hideOutline:!(r&&pt===e),color:b,fillOpacity:.1,outlineZIndex:10002,subjectRegistry:t,hideTooltip:!0,railGap:2,railWidth:he,refreshKey:le,renderRail:t=>{let o=Re.current.get(e.selector)?.getBoundingClientRect(),p=o?.width?o:u(t,he,22),h=!!(Me&&pt!==e&&ht&&g(p,ht));if(pt!==e&&ht&&g(u(t,$e,22),ht))return null;let m="right"===t.horizontalAlignment?t.left-he:t.left,f=Hr(lt,m,he);if(e.transient){let n=e.domElement?de(e.domElement):null;return Xe(Pr,{"data-popmelt-rail-priority":"intent","data-popmelt-subject-label-action":n?"true":void 0,"data-popmelt-subject-adapter":n?.adapter,"data-popmelt-subject-key":n?.key,left:t.left,top:t.top,avoidTop:f.avoidTop,avoidBottom:f.avoidBottom,anchor:t.anchor,horizontalAlignment:t.horizontalAlignment,style:{zIndex:10001,pointerEvents:n?"auto":"none",cursor:n?"pointer":void 0},onPointerDown:e=>{n&&e.stopPropagation()},onClick:e=>{n&&(e.preventDefault(),e.stopPropagation(),re?.(n))},onContextMenu:e=>{n&&(e.preventDefault(),e.stopPropagation(),oe?.(n))},onMouseEnter:()=>{n&&ie?.(n)},onMouseLeave:()=>ie?.(null),children:Xe("div",{"data-devtools":"steer-element-identifier",ref:t=>{e.domElement&&Pe(e.domElement,t)},"data-popmelt-subject-label-action":n?"true":void 0,style:{...ft,borderRadius:e.domElement===document.body?y("bottom-left"):y(t.anchor)},children:Xe("span",{style:gt,children:e.label})})})}return Xe(Pr,{"data-popmelt-rail-priority":"history","data-popmelt-snap-collapse":h||void 0,visualRef:t=>{t?Re.current.set(e.selector,t):Re.current.delete(e.selector)},left:t.left,top:t.top,avoidTop:f.avoidTop,avoidBottom:f.avoidBottom,anchor:t.anchor,horizontalAlignment:t.horizontalAlignment,onClick:()=>{if(i)return;let t=function(e,t){if(e){if(e.threadId)return{type:"open-thread",threadId:e.threadId};if(!1!==e.pending)return{type:"edit-comment",annotationId:e.id};if(e.threadState?.threadId)return{type:"open-thread",threadId:e.threadState.threadId}}return t?{type:"open-thread",threadId:t}:{type:"none"}}(e.comment,e.comment?.threadId??s?.threadId);"edit-comment"===t.type?X?.(t.annotationId):"open-thread"===t.type&&q?.(t.threadId)},onContextMenu:t=>{if(t.preventDefault(),t.stopPropagation(),e.comment&&Q)Q(e.comment.id);else{if(U){let t=a.filter(t=>t.selector===e.selector);if(t.length)return void U(t)}e.comment&&!1!==e.comment.pending&&G?(je(e.selector),ge(t=>kr(t,e.selector)),xe(t=>t===e.selector?null:t),B?.(null),G(e.comment.id)):l.some(t=>t.selector===e.selector&&!t.captured)?ee?.(e.selector):!e.hasPendingChanges&&!d&&"resolved"===s?.status&&te?.(s.threadId)}},onMouseEnter:()=>{je(e.selector),xe(e.selector),B?.(e.selector)},onMouseLeave:()=>{Ne(e.selector),B?.(null)},style:{zIndex:i?10002:1e4,cursor:i?"text":"pointer",pointerEvents:"auto"},children:Ke("div",{ref:t=>{e.domElement&&Pe(e.domElement,t)},style:{display:"flex",alignItems:"center",gap:ke},children:[i?ae.render(t.anchor):Ke("div",{"data-devtools":"badge","data-popmelt-collapsed":se.annotationCollapsed,onMouseEnter:()=>Le(e.selector,"annotation",0),style:{...ft,...n&&{maxWidth:`min(400px, calc(100vw - ${n.width+24}px))`},backgroundColor:Cr({accentColor:k,threadAccentColor:b,comment:e.comment,isInFlight:d,hasThreadState:!!s,hasStickers:e.stickers.length>0}),gap:0,letterSpacing:e.comment?0:ft.letterSpacing,borderRadius:e.domElement===document.body?y("bottom-left"):y(t.anchor)},children:[Xe("span",{style:{fontWeight:600},children:e.annotationNumber}),Xe("span",{className:"popmelt-collapsible-badge-detail",children:Xe("span",{className:"popmelt-collapsible-badge-detail-inner",style:{...gt,paddingLeft:e.comment?0:void 0},children:e.comment?Ke(Ge,{children:[".",Xe("span",{style:{marginLeft:2},children:n?n.formatText(e.comment.text):e.comment.text})]}):Ke(Ge,{children:[". ",e.label]})})})]}),!be&&Xe(x,{stepCount:i?0:e.comment?.interactionEpisodeStepCount??0,onClear:!1!==e.comment?.pending&&ne?()=>ne(e.comment.id):void 0,submitted:!1===e.comment?.pending}),be&&Ke("div",{className:"popmelt-staged-sticker-group",children:[e.stickers.map((t,n)=>{let o=Ce(t),i=Sr({hasElementChanges:e.hasElementChanges,hasPendingChanges:e.hasPendingChanges,hasThreadState:!!s,isHovered:br(fe,e.selector,n+1),hasTimedReveal:_,isRevealedSticker:_&&o===J}),a=we(n,e.stickers.length+ +(me>0)),l=0===n?void 0:Te;return Ke("div",{className:"popmelt-staged-sticker-layer",style:{zIndex:a.zIndex},children:[Xe("span",{"aria-hidden":!0,className:"popmelt-staged-sticker-pointer",style:{"--popmelt-staged-accent":I,WebkitMaskImage:0===n?void 0:He,maskImage:0===n?void 0:He}}),Ke("button",{type:"button","data-devtools":"staged-sticker","data-popmelt-style-property":t.custom?.property,title:t.custom?`${t.custom.property}: ${t.custom.value}`:void 0,"data-popmelt-collapsed":i.stickerCollapsed,onMouseEnter:()=>Le(e.selector,o,n+1),"aria-label":t.custom?`Custom ${t.custom.property}: ${t.custom.value}`:`${r?"Staged":"Edit staged"} ${t.token} sticker`,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:n=>{n.preventDefault(),n.stopPropagation(),t.selection&&D?.(e.selector,t.selection)},onContextMenu:n=>{n.preventDefault(),n.stopPropagation(),je(e.selector),ge(t=>kr(t,e.selector)),B?.(null),t.selection&&O?.(e.selector,t.selection)},style:{...ft,position:"relative",height:"100%",minHeight:22,appearance:"none",border:0,margin:0,paddingLeft:a.paddingLeft,paddingRight:a.paddingRight,gap:0,cursor:t.selection&&(D||O)?"pointer":"default",backgroundColor:I,WebkitMaskImage:l,maskImage:l},children:[Xe($r,{chip:t}),Xe("span",{className:"popmelt-collapsible-badge-detail",children:Xe("span",{className:"popmelt-collapsible-badge-detail-inner",children:t.token})})]})]},o)}),Xe(Mn,{imageCount:me,color:I,layered:e.stickers.length>0}),!i&&(e.comment?.interactionEpisodeStepCount??0)>0&&Xe("div",{className:"popmelt-staged-sticker-layer",style:{zIndex:1},children:Xe(x,{stepCount:e.comment.interactionEpisodeStepCount,layered:!0,onClear:!1!==e.comment?.pending&&ne?()=>ne(e.comment.id):void 0,submitted:!1===e.comment?.pending})}),Se&&Xe(v,{bundleCount:W,compact:ue.sendCompact,layered:!0,onHoverChange:t=>{t&&Le(e.selector,"send",ce),Z?.(t)},onSend:F,style:{position:"relative",zIndex:(e.comment?.interactionEpisodeStepCount??0)>0?0:1}})]}),n?.controls,Xe(C,{threadId:e.comment?.threadId??s?.threadId,color:b}),!n&&Ie&&Xe("button",{type:"button","data-devtools":"annotation-badge","data-popmelt-collapsed":pe.stickerCollapsed,onMouseEnter:()=>Le(e.selector,"thread-status",ce),"aria-label":s?`${$}. Open thread`:$,onPointerDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>{t.preventDefault(),t.stopPropagation();let n=e.comment?.threadId??s?.threadId;n&&q?.(n)},style:{...ft,appearance:"none",border:0,margin:0,cursor:s&&q?"pointer":"default",backgroundColor:b,gap:0},children:Ke(Ge,M?{children:[Xe(R,{size:12,strokeWidth:2.25}),Xe("span",{className:"popmelt-collapsible-badge-detail",children:Xe("span",{className:"popmelt-collapsible-badge-detail-inner",children:$})})]}:d?{children:[S?Xe(j,{size:12,"aria-label":"Approval needed"}):Xe("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle"},children:Ke(Ge,1===et?{children:[Xe("circle",{cx:"7",cy:"7",r:"2"}),Xe("circle",{cx:"17",cy:"7",r:"2"}),Xe("circle",{cx:"7",cy:"17",r:"2"}),Xe("circle",{cx:"17",cy:"17",r:"2"})]}:{children:[Xe("circle",{cx:"12",cy:"6",r:"2"}),Xe("circle",{cx:"6",cy:"12",r:"2"}),Xe("circle",{cx:"18",cy:"12",r:"2"}),Xe("circle",{cx:"12",cy:"18",r:"2"})]})}),Xe("span",{className:"popmelt-collapsible-badge-detail",children:Xe("span",{className:"popmelt-collapsible-badge-detail-inner",style:{opacity:.8},children:$})})]}:{children:[c?Xe(R,{"data-devtools":"queued-status-icon",size:12,strokeWidth:2.25,style:{verticalAlign:"middle",opacity:.6}}):"waiting_input"===s?.status?Xe(P,{"data-devtools":"question-status-icon",size:12,strokeWidth:2.25,style:{transform:"translateY(-0.5px)",flexShrink:0}}):Xe("failed"===s?.status?z:N,{size:12,strokeWidth:2.25}),Xe("span",{className:"popmelt-collapsible-badge-detail",children:Xe("span",{className:"popmelt-collapsible-badge-detail-inner",children:$})})]})}),Se&&!be&&Xe(v,{bundleCount:W,compact:ue.sendCompact,onHoverChange:t=>{t&&Le(e.selector,"send",ce),Z?.(t)},onSend:F})]})})}},`${e.transient?"intent":"history"}:${e.selector}`)})]})}var Nr=4;function Vr(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function Br(e,t){return function(e,t){return e===t||Le(e,t)||Le(t,e)}(e,t)||null!==Ne(e)&&Ne(e)===Ne(t)}function Lr(e){let t=0,n=Ne(e);for(;n;)t+=1,n=Ne(n);return t}function Wr(e,t){return Ve(e,t?.[0])}function Zr(e){return!(!e.linkedSelector||"body"!==e.elements?.[0]?.tagName.toLowerCase())}function Fr(e){let t=c(e,22,2,window.innerHeight);return{x:t.left+window.scrollX+8,y:t.top+window.scrollY+4}}function Dr(e){let t=e?.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}}function Or(e,t){if(0===t.size)return null;let n=new Set,r=new Set;for(let o of e)t.has(o.id)&&(o.groupId&&n.add(o.groupId),o.threadId&&r.add(o.threadId));for(let t of e)t.groupId&&n.has(t.groupId)&&t.threadId&&r.add(t.threadId);let o=new Set(t);for(let t of e)(t.groupId&&n.has(t.groupId)||t.threadId&&r.has(t.threadId))&&o.add(t.id);return o}function _r(e,t,n=0,r,o,i=90){let a=e.left+window.scrollX+8,l="top-left"===t?e.top+window.scrollY-4-22-22*n+4:e.bottom+window.scrollY+4+4+22*n,s=window.scrollY+4,d=window.scrollY+window.innerHeight-22-4,c=null;if(r&&void 0!==o){let t=r.getBoundingClientRect(),n=e.left;if(n+o+16+i>t.left&&n<t.right)if(t.top<window.innerHeight/2){let e=window.scrollY+t.bottom+4;e>s&&(s=e,c="top")}else{let e=window.scrollY+t.top-22-4;e<d&&(d=e,c="bottom")}}return s>d&&(d=s),l<s?l="top"===c?s:e.top+window.scrollY+4:l>d&&(l="bottom"===c?d:Math.max(e.top+window.scrollY+4,d)),{x:a,y:l}}var qr=new Set(["resolved","needs_review","waiting_input","failed"]);function Yr(e){return e.linkedSelector??(e.target?ce(e.target):void 0)}function Jr(e,t){let n=e.groupId?t.filter(t=>t.groupId===e.groupId):[e],r=n.find(e=>void 0!==e.status&&qr.has(e.status)),o=n.find(e=>e.threadId),i=n.find(e=>Yr(e)),a=i?Yr(i):void 0;if(!r?.status||!o?.threadId||!a)return;let l=n.find(e=>e.targetBindingId),s=n.find(e=>e.replyJobIds?.length);return{status:r.status,threadId:o.threadId,targetBindingId:l?.targetBindingId,replyJobIds:s?.replyJobIds,linkedSelector:a,elements:i?.elements}}function Kr({resolveElement:e,projectedSelectors:t,activeText:n,activeColor:r,annotations:o,annotationNumberById:i,focusedThreadAnnotationId:a,hiddenCollidingAnnotationIds:l,modifiedElementThreadStates:s,nestedCollidingAnnotationCountById:d,nestedCollidingAnnotationIdsById:c,pageAnnotations:u,pageStyleModifications:p,pageTextModifications:h,sendHintAnchorId:m,supersededAnnotations:f,visibleCollisionRepresentativeByAnnotationId:g,activeTextSendHintId:y,targetResolutionRevision:x}){let v=Oe((n,r)=>t?null:e?e(n,r):Wr(n,r),[x,e,t]),C=Ze(()=>{let e=[],n=new Set,r=[...u].sort((e,t)=>t.timestamp-e.timestamp);for(let o of r){if("text"!==o.type||!o.text||!o.linkedSelector||f.has(o)||l.has(o.id))continue;let r=o.status??(o.captured?"in_flight":"pending");if(!["pending","sending","in_flight","awaiting_review"].includes(r))continue;let a=i.get(o.id);if(void 0===a||n.has(o.linkedSelector))continue;let s=v(o.linkedSelector,o.elements),d=o.elements?.[0];!s&&(!t?.has(o.linkedSelector)||!d)||(n.add(o.linkedSelector),e.push({id:o.id,selector:o.linkedSelector,text:o.text.replace(/\n/g," "),annotationNumber:a,color:o.color,element:d??pe(s),pending:"pending"===r,awaitingReview:"awaiting_review"===r,threadId:o.threadId,imageCount:o.imageCount??0,interactionEpisodeStepCount:o.interactionEpisode?.steps.length}))}return e},[i,l,u,f,v,t]),w=Ze(()=>new Set(C.map(e=>e.id)),[C]),b=Ze(()=>{let e=new Map;for(let t of u){if("text"!==t.type)continue;let n=Jr(t,u);n&&e.set(t.id,n)}return e},[u]),k=Ze(()=>{let e=[],n=new Set,r=[...u].sort((e,t)=>+(t.id===a)-+(e.id===a)||t.timestamp-e.timestamp);for(let o of r){let r=b.get(o.id);if(!r||!xr({...o,status:r.status,threadId:r.threadId,linkedSelector:r.linkedSelector})||!o.text||f.has(o)||l.has(o.id)||n.has(r.linkedSelector))continue;let a=i.get(o.id);if(void 0===a)continue;let s=v(r.linkedSelector,r.elements),d=r.elements?.[0];!s&&(!t?.has(r.linkedSelector)||!d)||(n.add(r.linkedSelector),e.push({id:o.id,selector:r.linkedSelector,text:o.text.replace(/\n/g," "),annotationNumber:a,color:o.color,element:d??pe(s),pending:!1,imageCount:o.imageCount??0,interactionEpisodeStepCount:o.interactionEpisode?.steps.length,threadState:{jobId:r.replyJobIds?.[r.replyJobIds.length-1]??r.threadId,threadId:r.threadId,targetBindingId:r.targetBindingId,annotationNumber:a,status:"waiting_input"===r.status?"waiting_input":"failed"===r.status?"failed":"resolved",label:"waiting_input"===r.status?"Question":"failed"===r.status?"Failed":"Replied"}}))}return e},[i,a,l,u,b,f,v,t]),I=Ze(()=>[...C,...k],[k,C]),S=Ze(()=>{let e=new Set,t=new Set,n=new Set,r=new Set;for(let[e,o]of s??[])if("matched"===Be(o.selectors??[e],o.targetFingerprint).status){t.add(o.threadId),o.targetBindingId&&n.add(o.targetBindingId);for(let e of o.selectors??[])r.add(e);!o.targetBindingId&&!o.selectors?.length&&r.add(e)}for(let o of u){let i=b.get(o.id),a=o.groupId?u.filter(e=>e.groupId===o.groupId):[o],s=a.map(Yr).find(e=>!!e),d=a.find(e=>e.threadId)?.threadId,c=a.find(e=>e.targetBindingId)?.targetBindingId;"text"===o.type&&o.text&&s&&!f.has(o)&&!l.has(o.id)&&((d&&t.has(d)||c&&n.has(c)||r.has(s)||i&&xr({...o,status:i.status,threadId:i.threadId,linkedSelector:i.linkedSelector})&&v(i.linkedSelector,i.elements))&&e.add(o.id))}return e},[l,s,u,b,f,v]),M=Ze(()=>{let e=new Set;for(let t of u)vr(t)&&t.linkedSelector&&!f.has(t)&&!l.has(t.id)&&v(t.linkedSelector,t.elements)&&e.add(t.id);return e},[l,u,f,v]),$=Ze(()=>{let e=new Set(M);for(let t of w)e.add(t);for(let t of S)e.add(t);return e},[M,S,w]),E=Ze(()=>new Map(I.map(e=>[e.selector,e.color])),[I]),A=Ze(()=>new Set([...l,...$]),[$,l]),H=Ze(()=>{if(!n?.linkedSelector||n.domEdit)return null;let e=v(n.linkedSelector,n.elements);if(!e)return null;let t=[...p,...h].find(t=>!t.captured&&Wr(t.selector,[t.element])===e),r=u.find(e=>e.id===n.id),o=!(n.isNew||!r||!vr(r));return t||o?{element:e,selector:t?.selector??n.linkedSelector}:null},[n,u,p,h,v]),T=m===y?m:m?g.get(m)??m:null,R=Ze(()=>{if(T===y)return n?.text.trim()?H?.selector??null:null;if(T&&T!==y)return C.find(e=>e.id===T)?.selector??null;for(let e=h.length-1;e>=0;e-=1){let t=h[e];if(t&&!t.captured)return t.selector}for(let e=p.length-1;e>=0;e-=1){let t=p[e];if(t&&!t.captured&&!t.awaitingReview)return t.selector}return null},[n,H,y,p,h,C,T]),j=n?n.isNew?y:n.id:null,P=j?d.get(j)??0:0,z=j?c.get(j)??[]:[],N=n?.isNew?void 0:o.find(e=>e.id===n?.id),V="pending"===(N?.status??(N?.captured?"in_flight":"pending"))?N?.color??r:"#8c8c8c",B=Ze(()=>u.filter(e=>!(f.has(e)||l.has(e.id)||$.has(e.id)||n&&!n.isNew&&e.id===n.id)),[n,$,l,u,f]);return{activeTextAnnotation:N,activeTextCollisionId:j,activeTextModifiedRail:H,activeTextNestedAnnotationCount:P,activeTextNestedAnnotationIds:z,activeTextNestedBadgeColor:V,elementRailColorBySelector:E,elementRailCommentIds:$,elementRailComments:I,hiddenAnnotationBadgeIds:A,modifiedElementSendHintSelector:R,stagedElementComments:C,visibleCanvasAnnotations:B,visibleSendHintAnchorId:T}}function Xr(e){if(e.length<2)return null;let t=e[0],n=e[e.length-1];return t&&n?[t,n]:null}function Gr(e,t,n){return e.map(e=>({x:e.x-t,y:e.y-n}))}function Qr(e,t,n,r,o,i){let a=String(r);e.font="600 11px system-ui, -apple-system, sans-serif";let l=e.measureText(a).width+8,s=t-l/2,d=n+i/2+2;e.fillStyle=o,e.fillRect(s,d,l,19),e.fillStyle="#ffffff",e.textBaseline="middle",e.fillText(a,s+4,d+9.5)}function Ur(e,t){if(e.points.length<2&&"text"!==e.type)return null;switch(e.type){case"rectangle":case"freehand":{let t,n;if("freehand"===e.type)t=Math.min(...e.points.map(e=>e.x)),n=Math.max(...e.points.map(e=>e.y));else{let r=e.points[0],o=e.points[e.points.length-1];t=Math.min(r.x,o.x),n=Math.max(r.y,o.y)}return{x:t,y:n}}case"circle":{let t=e.points[0],n=e.points[e.points.length-1];return{x:Math.min(t.x,n.x),y:(Math.min(t.y,n.y)+Math.max(t.y,n.y))/2}}case"line":{let t=e.points[0],n=e.points[e.points.length-1],r=t.y>n.y?t:n;return{x:r.x,y:r.y}}default:return null}}function eo(){let e=_e(null),t=Oe(()=>{let t=e.current;if(!t)return;let n=t.getContext("2d");n&&n.clearRect(0,0,t.width,t.height)},[]),r=Oe((t,r,o,i=1,a=!1,l=!1)=>{let s=e.current;if(!s)return;let d=s.getContext("2d");if(!d)return;let c=t.status??(t.captured?"in_flight":"pending"),u="pending"===c?t.color:"#8c8c8c";switch(d.save(),d.globalAlpha=i,t.region&&n(d,t.region.points,u,!l),t.type){case"freehand":((e,t,n,r)=>{let o=Xr(t);if(!o)return;let[i,a]=o;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.lineCap="round",e.lineJoin="round",e.moveTo(i.x,i.y);for(let n=1;n<t.length-1;n++){let r=t[n],o=t[n+1];!r||!o||e.quadraticCurveTo(r.x,r.y,(r.x+o.x)/2,(r.y+o.y)/2)}e.lineTo(a.x,a.y),e.stroke()})(d,t.points,u,t.strokeWidth);break;case"line":((e,t,n,r)=>{let o=Xr(t);if(!o)return;let[i,a]=o;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.lineCap="round",e.moveTo(i.x,i.y),e.lineTo(a.x,a.y),e.stroke()})(d,t.points,u,t.strokeWidth);break;case"rectangle":((e,t,n,r)=>{let o=Xr(t);if(!o)return;let[i,a]=o;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.lineCap="round",e.lineJoin="round",e.strokeRect(Math.min(i.x,a.x),Math.min(i.y,a.y),Math.abs(a.x-i.x),Math.abs(a.y-i.y))})(d,t.points,u,t.strokeWidth);break;case"circle":((e,t,n,r)=>{let o=Xr(t);if(!o)return;let[i,a]=o,l=(i.x+a.x)/2,s=(i.y+a.y)/2,d=Math.abs(a.x-i.x)/2,c=Math.abs(a.y-i.y)/2;e.beginPath(),e.strokeStyle=n,e.lineWidth=r,e.ellipse(l,s,d,c,0,0,2*Math.PI),e.stroke()})(d,t.points,u,t.strokeWidth);break;case"text":if(t.text&&t.points[0]){let e="pending"===c?"#ffffff":"#dddddd";w(d,t.points[0],t.text,u,t.fontSize,r,t.points[0].x,o,e,Zr(t)?"bottom-left":t.linkedAnchor,a)}}d.restore()},[]),o=Oe((t,n)=>{let r=e.current;if(!r||t.points.length<2)return;let o=r.getContext("2d");if(o){if(o.fillStyle="#ffffff",o.strokeStyle=t.color,o.lineWidth=1.5,"line"===t.type){return void[t.points[0],t.points[t.points.length-1]].forEach(e=>{o.beginPath(),o.arc(e.x,e.y,n/2,0,2*Math.PI),o.fill(),o.stroke()})}if("circle"===t.type){let e=t.points[0],r=t.points[t.points.length-1],i=Math.min(e.x,r.x),a=Math.max(e.x,r.x),l=Math.min(e.y,r.y),s=Math.max(e.y,r.y),d=(i+a)/2,c=(l+s)/2;return void[{x:d,y:l},{x:d,y:s},{x:i,y:c},{x:a,y:c}].forEach(e=>{o.beginPath(),o.rect(e.x-n/2,e.y-n/2,n,n),o.fill(),o.stroke()})}if("rectangle"===t.type||"freehand"===t.type){let e,r,i,a;if("freehand"===t.type)e=Math.min(...t.points.map(e=>e.x)),r=Math.max(...t.points.map(e=>e.x)),i=Math.min(...t.points.map(e=>e.y)),a=Math.max(...t.points.map(e=>e.y));else{let n=t.points[0],o=t.points[t.points.length-1];e=Math.min(n.x,o.x),r=Math.max(n.x,o.x),i=Math.min(n.y,o.y),a=Math.max(n.y,o.y)}[{x:e,y:i},{x:r,y:i},{x:e,y:a},{x:r,y:a}].forEach(e=>{o.beginPath(),o.rect(e.x-n/2,e.y-n/2,n,n),o.fill(),o.stroke()})}}},[]),i=Oe((n,i,a,l=0,s=0,d,c,u,p,h,m=.5,f,g)=>{if(t(),n.forEach(e=>{let t={...e,points:Gr(e.points,l,s),...e.region?{region:{...e.region,points:Gr(e.region.points,l,s)}}:{}},n=d?.get(e.id),o=h?.has(e.id)??!1,i=!!c?.size,a=c?.has(e.id)??!1,y=i?a?1:.2:!p||p.has(e.id)||o?1:m;r(t,n,u,y,f?.has(e.id),g?.has(e.id))}),i&&i.length>0&&a){let t=e.current?.getContext("2d");for(let e of i){let r=n.find(t=>t.id===e);if(r){let e=h?.has(r.id)??!1,i=!!c?.size,u=c?.has(r.id)??!1,f=i?u?1:.2:!p||p.has(r.id)||e?1:m,g={...r,points:Gr(r.points,l,s)};if(t?.save(),t&&(t.globalAlpha=f),o(g,a),t&&"text"!==r.type&&d&&(!r.groupId||!n.some(e=>e.groupId===r.groupId&&"text"===e.type))){let e=d.get(r.id);if(void 0!==e){let n=Ur(g);if(n){let o="pending"===(r.status??(r.captured?"in_flight":"pending"))?r.color:"#999999";Qr(t,n.x,n.y,e,o,a)}}}t?.restore()}}}},[t,r,o]),a=Oe(()=>{let t=e.current;if(!t)return;let n=window.devicePixelRatio||1,r=window.visualViewport?.width??window.innerWidth,o=window.visualViewport?.height??window.innerHeight;t.width=r*n,t.height=o*n;let i=t.getContext("2d");i&&i.scale(n,n)},[]);return{canvasRef:e,clearCanvas:t,drawAnnotation:r,redrawAll:i,resizeCanvas:a}}var to=new Set;function no({annotations:e,annotationGroupMap:t,targetDocument:n,color:r,onViewThread:o,onDelete:l}){let{canvasRef:s,redrawAll:d,resizeCanvas:c}=eo(),[u,p]=Fe({x:0,y:0,revision:0}),[h,m]=Fe([]);qe(()=>{let e=n.defaultView,t=()=>{let t=e?.frameElement?.getBoundingClientRect();p(n=>({x:(t?.left??0)-(e?.scrollX??0),y:(t?.top??0)-(e?.scrollY??0),revision:n.revision+1}))};return t(),e?.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t),()=>{e?.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[n]);let f=Ze(()=>Zt(e,n.location?.pathname??"/").filter(e=>e.points.length>0).map(e=>({...e,color:r,...e.region?{region:{...e.region,points:e.region.points.map(e=>({x:e.x+u.x,y:e.y+u.y}))}}:{},points:e.points.map(e=>({x:e.x+u.x,y:e.y+u.y}))})),[e,r,n,u]);return qe(()=>{if(!f.length)return void m([]);c(),d(f,[],void 0,0,0,t);let e=s.current?.getContext("2d");e&&m(f.map(n=>{if("text"!==n.type){let e=function(e){if(0===e.length)return{x:0,y:0,width:0,height:0};let t=e.map(e=>e.x),n=e.map(e=>e.y),r=Math.min(...t),o=Math.max(...t),i=Math.min(...n);return{x:r,y:i,width:o-r,height:Math.max(...n)-i}}(n.points);return{annotation:n,left:e.x,top:e.y,width:Math.max(12,e.width),height:Math.max(12,e.height)}}let r=n.fontSize??12,o=t.get(n.id),l=`${void 0===o?"":`${o}. `}${(n.text??"").replace(/\n/g," ")}`,s=n.points[0];e.font=`${r}px ${i}`;let d=e.measureText(I(e,l,S(s.x))).width+16,c=M(s,r,void 0,d);return{annotation:n,left:c.x-8,top:c.y-4,width:d,height:r*a+8}}))},[f,t,s,d,c]),f.length?Ke(Ge,{children:[Xe("canvas",{ref:s,"aria-hidden":!0,style:{position:"fixed",inset:0,width:"100vw",height:"100vh",pointerEvents:"none",zIndex:9999}}),h.map(({annotation:e,...t})=>Xe("button",{type:"button","data-devtools":"peer-canvas-annotation","data-annotation-id":e.id,"aria-label":e.text??"Annotation",onClick:t=>{t.stopPropagation(),e.threadId&&o?.(e.threadId)},onPointerDown:e=>e.stopPropagation(),onContextMenu:l?t=>{t.preventDefault(),t.stopPropagation(),l(e.id)}:void 0,style:{...t,position:"fixed",padding:0,border:0,background:"transparent",pointerEvents:"auto",cursor:e.threadId?"pointer":"default",zIndex:9999}},e.id)),Xe($,{annotations:f,supersededAnnotations:to,annotationGroupMap:t,scrollX:0,scrollY:0,onViewThread:o,canvasRef:s,pendingBundleCount:0})]}):null}var ro=new Set,oo=new Map,io=new Map,ao=new Map;function lo({peer:n,targetDocument:r,projectedTargets:o,hoveredElement:i,getSubjects:a,onApprove:l,focusedAnnotationId:s}){let d=Ye(e),c=Ye(t),u=c?.isHost&&"guest"===n.identity.relationship&&c.deletePeerAnnotations&&!c.view?.isPeeking?e=>{c.deletePeerAnnotations(n.identity.id,[e]).catch(()=>{})}:void 0,p=Ze(()=>nt(et(n.state??ue,c?.pendingSubmissions??[],n.identity.id),"guest"===n.identity.relationship?n.color:void 0),[n.state,n.identity.id,n.identity.relationship,n.color,c?.pendingSubmissions]),h=c?.isHost&&"guest"===n.identity.relationship&&c.deletePeerStyles&&!c.view?.isPeeking?e=>{c.deletePeerStyles(n.identity.id,e.map(Qe)).catch(()=>{})}:void 0,[m,f]=Fe(0),g=Ze(()=>ur((n.state?.annotations??[]).flatMap(e=>[e.linkedSelector,e.elements?.[0]?.selector].filter(e=>!!e))),[n.state?.annotations]);De(()=>{if(!r||o)return;let e=new MutationObserver(e=>{e.some(g.changesIdentity)&&f(e=>e+1)});return e.observe(r.body,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:g.attributes}),()=>e.disconnect()},[r,o,g]);let y=Oe((e,t)=>!r||o?null:Ve(e,t?.[0],r),[r,o]),x=Ze(()=>o?new Set(o.keys()):void 0,[o]),v=Ct({state:p,pageAnnotations:p.annotations,pageStyleModifications:p.styleModifications,pageTextModifications:p.textModifications}),C=p.annotations.find(e=>e.id===s)?.linkedSelector,w=[...p.annotations].filter(e=>!e.captured&&!v.supersededAnnotations.has(e)).sort((e,t)=>t.timestamp-e.timestamp)[0],b=Kr({resolveElement:y,projectedSelectors:x,activeText:null,activeColor:n.color,annotations:p.annotations,annotationNumberById:v.annotationGroupMap,hiddenCollidingAnnotationIds:ro,nestedCollidingAnnotationCountById:oo,nestedCollidingAnnotationIdsById:io,pageAnnotations:p.annotations,pageStyleModifications:p.styleModifications,pageTextModifications:p.textModifications,sendHintAnchorId:w?.id??null,supersededAnnotations:v.supersededAnnotations,visibleCollisionRepresentativeByAnnotationId:ao,activeTextSendHintId:"",targetResolutionRevision:n.revision+m});return Ke("div",{"data-devtools":"peer-rails","data-peer-id":n.identity.id,"aria-label":`${n.identity.name}'s suggestions`,children:[r&&!o&&Xe(no,{annotations:b.visibleCanvasAnnotations,annotationGroupMap:v.annotationGroupMap,targetDocument:r,color:n.color,onViewThread:d,onDelete:u}),Xe(zr,{targetDocument:r,projectedTargets:o,hoveredElement:i,subjectRegistry:a?.(),readOnly:!0,onDeletePeerComment:u,onDeletePeerStyles:h,styleModifications:p.styleModifications,textModifications:p.textModifications,stagedComments:b.elementRailComments,accentColor:n.color,annotationNumberBySelector:v.pageModificationNumberBySelector,sendHintSelector:l?b.modifiedElementSendHintSelector:null,pendingBundleCount:v.stagedArtifactOrder.count,onSend:l,onViewThread:d,focusedSelector:C,refreshKey:n.revision})]})}function so(e,t){let[n,r]=Je(e=>e+1,0),o=Date.now(),i=t?e.filter(e=>e.startedAt<=o&&o<e.expiresAt+2e3).map(e=>({presence:e,engaged:!e.ended&&o<e.expiresAt})):[],a=Math.min(...i.map(({presence:e,engaged:t})=>t?e.expiresAt:e.expiresAt+2e3));return De(()=>{if(!t||!Number.isFinite(a))return;let e=setTimeout(r,Math.max(0,a-Date.now()));return window.addEventListener("focus",r),document.addEventListener("visibilitychange",r),()=>{clearTimeout(e),window.removeEventListener("focus",r),document.removeEventListener("visibilitychange",r)}},[t,a,n]),i}export{Et as $,Vn as A,un as Aa,or as B,hn as Ba,ir as C,fn as Ca,ar as D,xn as Da,zr as E,Cn as Ea,Nr as F,Vr as G,Br as H,Lr as I,Wr as J,Zr as K,Fr as L,Dr as M,Or as N,_r as O,Kr as P,gt as Q,xt as R,vt as S,Ct as T,eo as U,wt as V,kt as W,It as X,St as Y,Mt as Z,$t as _,Ue as a,At as aa,et as b,Ht as ba,nt as c,jt as ca,wn as d,Pt as da,sr as e,zt as ea,ur as f,Nt as fa,bn as g,Vt as ga,Sn as h,Bt as ha,Mn as i,Wt as ia,$n as j,Dt as ja,pr as k,lo as ka,hr as l,Ot as la,mr as m,so as ma,fr as n,_t as na,ot as o,qt as oa,it as p,Yt as pa,at as q,Jt as qa,lt as r,Kt as ra,xr as s,Xt as sa,vr as t,Gt as ta,dt as u,Ut as ua,ct as v,en as va,ut as w,ln as wa,pt as x,sn as xa,ht as y,dn as ya,Nn as z,cn as za};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{forwardRef as e,useId as t,useRef as n,useState as r,useLayoutEffect as o,useEffect as i}from"react";import{createPortal as l}from"react-dom";import{jsx as a,jsxs as d}from"react/jsx-runtime";var c=e(function({style:e,...t},n){return a("span",{...t,ref:n,role:"tooltip",style:{background:"var(--popmelt-thread-raised, #222)",color:"var(--popmelt-thread-primary, #eee)",borderRadius:16,boxSizing:"border-box",...e}})}),s=new WeakMap;function u(e){return e.closest("[data-popmelt-tooltip-group]")??e.parentElement}function p({hint:e,above:t,anchorRef:n,children:r,...o}){return a(h,{hint:e??o["aria-label"],above:t,anchorRef:n,children:e=>a("button",{type:"button",...o,"aria-describedby":e,children:r})})}function h({hint:e,above:p,anchorRef:h,children:m}){let f=t(),v=n(null),b=n(null),g=n(!1),y=n(!1),[x,w]=r("closed"),R="entering"===x||"instant"===x,E="closed"!==x?v.current:null,M=E?.closest('[data-popmelt-tooltip-boundary], [data-devtools="thread-panel"]'),L=E?.getRootNode(),W=M??(L&&"host"in L?L:E?.ownerDocument.body);function k(t,n){if(!e)return;let r=u(t),o=r&&s.get(r),i=!1;if(o&&o.tip!==b.current){let e=t.ownerDocument.defaultView;i=n&&!!e&&Number(e.getComputedStyle(o.tip).opacity)>0,o.close()}w(i?"instant":"entering")}return o(()=>{let e=b.current,t=E?.ownerDocument.defaultView;if(!E||!e||!t)return;let n=h?.current??E,r=()=>{let r=M?.getBoundingClientRect(),o=n.getBoundingClientRect(),i=Math.max(r?.left??0,0)+8,l=Math.min(r?.right??t.innerWidth,t.innerWidth)-8,a=Math.max(r?.top??0,0)+8,d=Math.min(r?.bottom??t.innerHeight,t.innerHeight)-8;e.style.maxWidth=Math.max(0,Math.min(180,l-i))+"px";let{width:c,height:s}=e.getBoundingClientRect();if(o.right<=i||o.left>=l||o.bottom<=a||o.top>=d||c>l-i||s>d-a)return void(e.style.visibility="hidden");let u=(e,t,n)=>Math.max(t,Math.min(e,n)),h=u(o.left+(o.width-c)/2,i,l-c),m=o.top-s-4,f=o.bottom+4,v=u((p?m>=a:f+s>d)?m:f,a,d-s);e.style.left=h-(r?.left??0)-(M?.clientLeft??0)+"px",e.style.top=v-(r?.top??0)-(M?.clientTop??0)+"px",e.style.visibility="visible"};r();let o=new t.ResizeObserver(r);o.observe(E),n!==E&&o.observe(n),o.observe(e),M&&o.observe(M);let i=E.getRootNode();return i.addEventListener("scroll",r,!0),t.addEventListener("resize",r),()=>{o.disconnect(),i.removeEventListener("scroll",r,!0),t.removeEventListener("resize",r)}},[E,h,M,p,e]),o(()=>{let e=E&&u(E),t=b.current;if(!e||!t)return;let n={tip:t,close:()=>w("closed")};return s.set(e,n),()=>{s.get(e)===n&&s.delete(e)}},[E]),o(()=>{let e=b.current,t=E?.ownerDocument.defaultView;if(!e||!t)return;let n="instant"!==x&&!t.matchMedia("(prefers-reduced-motion: reduce)").matches;if(e.style.transition=n?"opacity 120ms ease-out":"none","entering"===x&&t.getComputedStyle(e).opacity,e.style.opacity=R?"1":"0",!R){if(!n)return void w("closed");let e=t.setTimeout(()=>w("closed"),120);return()=>t.clearTimeout(e)}},[E,R,x]),i(()=>{let e=v.current?.ownerDocument;if(!R||!e)return;let t=e=>{"Escape"===e.key&&(w("closed"),e.stopPropagation())};return e.addEventListener("keydown",t,!0),()=>e.removeEventListener("keydown",t,!0)},[R]),d("span",{ref:v,style:{position:"relative",display:"inline-flex",minWidth:0},onPointerEnter:e=>{"touch"!==e.pointerType&&(g.current=!0,k(e.currentTarget,!0))},onPointerLeave:()=>{g.current=!1,y.current||w(e=>"closed"===e?e:"leaving")},onFocus:e=>{y.current=e.target.matches(":focus-visible"),y.current&&k(e.currentTarget,!1)},onBlur:()=>{y.current=!1,g.current||w(e=>"closed"===e?e:"leaving")},children:[m(R&&e?f:void 0),W&&e&&l(a(c,{ref:b,id:f,"aria-hidden":!R||void 0,style:{position:M?"absolute":"fixed",opacity:0,visibility:"hidden",background:"var(--popmelt-thread-action, #222)",color:"var(--popmelt-thread-on-action, #eee)",whiteSpace:"normal",overflowWrap:"anywhere",zIndex:20,width:"max-content",maxWidth:180,pointerEvents:"none",fontSize:12,fontWeight:500,lineHeight:1.35,padding:"5px 8px",borderRadius:8},children:e}),W)]})}export{c as a,p as b};
|