@popmelt.com/core 0.40.0 → 0.41.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/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/ExploreAttachment-ALV7FL3Y.mjs +1 -0
- package/dist/PagePreviewLayer-UPCGG4EV.mjs +1 -0
- package/dist/ParticipantRuntime-CBUA7BL5.mjs +1 -0
- package/dist/PhoneHostGate-TVNOJYL5.mjs +1 -0
- package/dist/PopmeltProvider-5g-1VH5a.d.mts +15 -0
- package/dist/PopmeltTasteConnectedPane-PD64Q6LF.mjs +1 -0
- package/dist/QueuedReplies-ESF5UL3J.mjs +1 -0
- package/dist/SamplePlacementOverlay-V533Y4XN.mjs +1 -0
- package/dist/ShareProjectPane-PMODH6QQ.mjs +1 -0
- package/dist/SuppliedContext-ADMN2D2I.mjs +1 -0
- package/dist/{ThreadErrorCard-KPP7YUFC.mjs → ThreadErrorCard-KS2XWRT3.mjs} +1 -1
- package/dist/ThreadPanel-5TDPZBAU.mjs +1 -0
- package/dist/adapter-react-three-fiber.d.mts +1 -1
- package/dist/adapter-react-three-fiber.mjs +1 -1
- package/dist/adapter-three.d.mts +1 -1
- package/dist/adapter-three.mjs +1 -1
- package/dist/bridge-entry.mjs +1 -1
- package/dist/browser-runtime-FUXWVGQ7.mjs +1 -0
- package/dist/browser.d.mts +4 -4
- package/dist/browser.mjs +1 -1
- package/dist/canvas-text.d.mts +1 -1
- package/dist/{checkFixture-VDRYDCUX.mjs → checkFixture-42NYMFAK.mjs} +1 -1
- package/dist/chunk-2TA7N3CI.mjs +1 -0
- package/dist/chunk-32BKJ5JN.mjs +1 -0
- package/dist/chunk-3HVPVKWV.mjs +1 -0
- package/dist/{chunk-RDB75FUD.mjs → chunk-44NLL6X3.mjs} +1 -1
- package/dist/chunk-4RQ5XD3I.mjs +1 -0
- package/dist/chunk-5J4BZL6N.mjs +1 -0
- package/dist/chunk-6OPX4CUT.mjs +1 -0
- package/dist/{chunk-27WBFE5X.mjs → chunk-776SEJZO.mjs} +1 -1
- package/dist/chunk-7OATJ6BO.mjs +1 -0
- package/dist/chunk-7VIC4MGC.mjs +1 -0
- package/dist/{chunk-6RMM7JB6.mjs → chunk-ADRWR5GI.mjs} +1 -1
- package/dist/chunk-AET77LFV.mjs +1 -0
- package/dist/chunk-ALWPAFIW.mjs +1 -0
- package/dist/chunk-AOFKEBLN.mjs +1 -0
- package/dist/{chunk-6EO73WJN.mjs → chunk-BSVZXOOS.mjs} +1 -1
- package/dist/chunk-D2ONGS5P.mjs +1 -0
- package/dist/chunk-DDUXU6LA.mjs +1 -0
- package/dist/chunk-DMKBAI2Z.mjs +1 -0
- package/dist/chunk-DUWONLQE.mjs +1 -0
- package/dist/chunk-EG6UHPJV.mjs +1 -0
- package/dist/{chunk-DJFZGYX6.mjs → chunk-FZUHHJWW.mjs} +1 -1
- package/dist/{chunk-CR6TRUUV.mjs → chunk-GE5BE6PI.mjs} +1 -1
- package/dist/{chunk-K22VZV3V.mjs → chunk-GLF7Z5IR.mjs} +1 -1
- package/dist/chunk-GLIGPLM4.mjs +1 -0
- package/dist/chunk-H3T2O3HA.mjs +1 -0
- package/dist/chunk-HFKGW34E.mjs +1 -0
- package/dist/{chunk-V5FCWXMN.mjs → chunk-HFWGYXPG.mjs} +1 -1
- package/dist/{chunk-53QOGFAT.mjs → chunk-ITLRSHNZ.mjs} +1 -1
- package/dist/chunk-JWWWU4GY.mjs +1 -0
- package/dist/chunk-KD2AOPYP.mjs +1 -0
- package/dist/chunk-KE4MQBRY.mjs +1 -0
- package/dist/{chunk-TVIKC33M.mjs → chunk-KF35YUNZ.mjs} +1 -1
- package/dist/chunk-KF73S7MG.mjs +1 -0
- package/dist/{chunk-UBPJIVWE.mjs → chunk-LDDDSIAQ.mjs} +1 -1
- package/dist/chunk-LWPNOBGS.mjs +1 -0
- package/dist/{chunk-MPEVFQ43.mjs → chunk-PCUUOIFD.mjs} +1 -1
- package/dist/chunk-PRZ6C5X3.mjs +1 -0
- package/dist/chunk-PTMHSMZH.mjs +1 -0
- package/dist/chunk-RFTQCRGC.mjs +1 -0
- package/dist/{chunk-FFBBRCPC.mjs → chunk-S2U2IGUO.mjs} +1 -1
- package/dist/{chunk-Y2BJZLYU.mjs → chunk-S7IWZSWH.mjs} +1 -1
- package/dist/chunk-SOFNYBJD.mjs +1 -0
- package/dist/chunk-SZQTGYPS.mjs +1 -0
- package/dist/chunk-TA2BMDSC.mjs +30 -0
- package/dist/{chunk-T4WUQPBS.mjs → chunk-ULR4IDEX.mjs} +1 -1
- package/dist/{chunk-OECEYJNK.mjs → chunk-VJKC2RJB.mjs} +1 -1
- package/dist/{chunk-NFO2CREV.mjs → chunk-VLTK7KWK.mjs} +1 -1
- package/dist/chunk-VOL4KS67.mjs +1 -0
- package/dist/chunk-VSWRWS2H.mjs +1 -0
- package/dist/chunk-W5TNOJOR.mjs +1 -0
- package/dist/{chunk-LUTP7QBD.mjs → chunk-WSI2SQWU.mjs} +1 -1
- package/dist/chunk-WWNI7JCA.mjs +1 -0
- package/dist/chunk-XDZUDDYB.mjs +1 -0
- package/dist/chunk-XGSOAF5E.mjs +1 -0
- package/dist/chunk-XHTSKQMB.mjs +1 -0
- package/dist/chunk-YG3RSK5J.mjs +1 -0
- package/dist/chunk-YHCZYT4T.mjs +1 -0
- package/dist/{chunk-3LZQLRZ2.mjs → chunk-YTIDSDPP.mjs} +1 -1
- package/dist/chunk-Z4NMA34Y.mjs +1 -0
- package/dist/chunk-ZXCAONMC.mjs +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/codex-note-context-WX33QFE7.mjs +1 -0
- package/dist/codex-project-77GHT2I3.mjs +1 -0
- package/dist/{codex-session-registry-YNU6LEVH.mjs → codex-session-registry-A3NQRRZ3.mjs} +1 -1
- package/dist/codex-store-mount-KFJYT6AS.mjs +1 -0
- package/dist/dev-app-port-LHUBCOBE.mjs +1 -0
- package/dist/{dev-server-BRrhkH5t.d.mts → dev-server-D8Qxrp1A.d.mts} +2 -1
- package/dist/dev-server-FZJ6HDKP.mjs +1 -0
- package/dist/{focus-inspection-BMDJJC5K.mjs → focus-inspection-FVQ6TVGA.mjs} +1 -1
- package/dist/guest-admission.mjs +1 -1
- package/dist/guest-live-canvas.mjs +1 -1
- package/dist/index.d.mts +9 -25
- package/dist/index.mjs +1 -1
- package/dist/media.d.mts +3 -3
- package/dist/memory-store.d.mts +7 -2
- package/dist/memory.mjs +1 -1
- package/dist/orientation-markup.mjs +1 -0
- package/dist/outline-trace.mjs +1 -0
- package/dist/{page-interaction-YXHXEYOT.mjs → page-interaction-74JGNCZ5.mjs} +1 -1
- package/dist/{page-planes-Jz2yR_Wk.d.mts → page-planes-BeFZ3Wso.d.mts} +15 -472
- package/dist/{participantBootstrap-DDOxY-Cy.d.mts → participantBootstrap-BcfNTEe9.d.mts} +3 -3
- package/dist/peer-client-B2KMU667.mjs +1 -0
- package/dist/phone-app-HNBDX7UX.mjs +1 -0
- package/dist/plain-html-H35WPIRO.mjs +1 -0
- package/dist/plane-history.mjs +1 -0
- package/dist/plugin-astro.d.mts +8 -3
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-nuxt.d.mts +6 -2
- package/dist/plugin-nuxt.mjs +1 -1
- package/dist/plugin-vite.d.mts +10 -5
- package/dist/plugin-vite.mjs +1 -1
- package/dist/protocol-BIUE4rB6.d.mts +9 -0
- package/dist/server.d.mts +14 -3
- package/dist/server.mjs +1 -1
- package/dist/shared-page-6AUYAPJ3.mjs +1 -0
- package/dist/steerStyles-C4YBV4TZ.mjs +1 -0
- package/dist/sticker-colors.mjs +1 -0
- package/dist/sticker-mode.mjs +1 -0
- package/dist/{subjects-cLtt9-iK.d.mts → subjects-qHIrZrlt.d.mts} +57 -1
- package/dist/taste-constraints.mjs +1 -0
- package/dist/taste-contract.mjs +1 -0
- package/dist/taste-fragment.mjs +1 -0
- package/dist/taste-graph-inspection.mjs +1 -0
- package/dist/taste-layout.mjs +1 -0
- package/dist/taste-page-composition.mjs +1 -0
- package/dist/taste-proposal-session-PSI4TX6H.mjs +1 -0
- package/dist/taste-proposal.mjs +1 -0
- package/dist/taste-token-math.mjs +1 -0
- package/dist/thread-request.mjs +1 -0
- package/dist/thread-view-client.d.mts +2 -0
- package/dist/thread-view-client.mjs +1 -0
- package/dist/thread-view.html +136 -0
- package/dist/{video-adapter-xL95wukX.d.mts → video-adapter-B5eap10v.d.mts} +1 -1
- package/infra/phone-pairing/app-listener.cjs +107 -0
- package/infra/phone-pairing/binding.mjs +369 -20
- package/infra/phone-pairing/machine-config.mjs +43 -26
- package/infra/phone-pairing/machine-service.mjs +94 -6
- package/infra/phone-pairing/machine.mjs +5 -1
- package/infra/phone-pairing/reservations.mjs +103 -0
- package/infra/phone-pairing/writer-lock.mjs +107 -0
- package/package.json +8 -3
- package/dist/ExploreAttachment-DBMYVYWK.mjs +0 -1
- package/dist/PagePreviewLayer-CVUA6CTQ.mjs +0 -1
- package/dist/ParticipantRuntime-PCBEG3Q2.mjs +0 -1
- package/dist/PhoneHostGate-FZLK4R6M.mjs +0 -1
- package/dist/PopmeltTasteConnectedPane-62LUNNWZ.mjs +0 -1
- package/dist/QueuedReplies-5YG2DN3W.mjs +0 -1
- package/dist/SamplePlacementOverlay-LR7GZVYP.mjs +0 -1
- package/dist/ShareProjectPane-U47UTAOP.mjs +0 -1
- package/dist/SuppliedContext-F7WKJ5XO.mjs +0 -1
- package/dist/ThreadPanel-GOYQEF3I.mjs +0 -1
- package/dist/browser-runtime-BBQQQLF7.mjs +0 -1
- package/dist/chunk-3EYAVOPH.mjs +0 -1
- package/dist/chunk-4EDMISUV.mjs +0 -1
- package/dist/chunk-52OTX7DP.mjs +0 -1
- package/dist/chunk-5IZHN3A7.mjs +0 -1
- package/dist/chunk-6GS4BQVU.mjs +0 -30
- package/dist/chunk-6U5JWZ4X.mjs +0 -1
- package/dist/chunk-7DXJSJCI.mjs +0 -1
- package/dist/chunk-A4GARXVQ.mjs +0 -1
- package/dist/chunk-AKUIREET.mjs +0 -1
- package/dist/chunk-AWWUJO3N.mjs +0 -1
- package/dist/chunk-BDUWFDBP.mjs +0 -1
- package/dist/chunk-C4AMAM3W.mjs +0 -1
- package/dist/chunk-CRZEJJI6.mjs +0 -1
- package/dist/chunk-ERPJ6LXX.mjs +0 -1
- package/dist/chunk-EWTZVC7E.mjs +0 -1
- package/dist/chunk-FR6VIGJ2.mjs +0 -1
- package/dist/chunk-FSSHNWMO.mjs +0 -1
- package/dist/chunk-HC2SF7KE.mjs +0 -1
- package/dist/chunk-HTQEMKFA.mjs +0 -1
- package/dist/chunk-LLVF422C.mjs +0 -1
- package/dist/chunk-MHTX52KW.mjs +0 -1
- package/dist/chunk-OA63PYHZ.mjs +0 -1
- package/dist/chunk-P2LMCRUN.mjs +0 -1
- package/dist/chunk-PQITT2QK.mjs +0 -1
- package/dist/chunk-PQKSXNIZ.mjs +0 -1
- package/dist/chunk-PYGRFSUU.mjs +0 -1
- package/dist/chunk-RCY5N5KQ.mjs +0 -1
- package/dist/chunk-TMSGNHXH.mjs +0 -1
- package/dist/chunk-TTOCYOEH.mjs +0 -1
- package/dist/chunk-U5NROUVA.mjs +0 -24
- package/dist/chunk-UIADZXVT.mjs +0 -1
- package/dist/chunk-UPEEIAVJ.mjs +0 -1
- package/dist/chunk-VQ76TWRR.mjs +0 -1
- package/dist/chunk-WYQZ7DAK.mjs +0 -1
- package/dist/chunk-X6I6KQDG.mjs +0 -1
- package/dist/chunk-YMWXWXPV.mjs +0 -1
- package/dist/chunk-ZC2I35WD.mjs +0 -1
- package/dist/codex-note-context-2CHDGTG3.mjs +0 -1
- package/dist/codex-project-TIMWOCE5.mjs +0 -1
- package/dist/codex-store-mount-MAQK6VEG.mjs +0 -1
- package/dist/dev-server-ESGE6QNP.mjs +0 -1
- package/dist/participantBootstrap-BuTrTQbo.d.mts +0 -22
- package/dist/peer-client-LPDWWFT4.mjs +0 -1
- package/dist/plain-html-EF7MUNRZ.mjs +0 -1
- package/dist/shared-page-QN2XRXUE.mjs +0 -1
- package/dist/steerStyles-E76E44PI.mjs +0 -1
- package/dist/taste-proposal-session-AAXK4CFL.mjs +0 -1
- /package/dist/{toolbarFonts-JAGSN3DN.mjs → toolbarFonts-33BI56VQ.mjs} +0 -0
- /package/dist/{webpEncoder-QJRHTWUU.mjs → webpEncoder-JVMGDKHV.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{c as e,f as t,d as n,e as r,a,b as o}from"./chunk-LDDDSIAQ.mjs";import{a as i}from"./chunk-GLIGPLM4.mjs";import{d as s}from"./chunk-HOWDQUPT.mjs";import{g as l,f as p,b as c}from"./chunk-ZSL57PQ7.mjs";import{a as d,b as u,c as h}from"./chunk-DMKBAI2Z.mjs";import{c as m,a as g,b as f}from"./chunk-ELKVFX2O.mjs";import{n as v,m as b,k as x,b as w,c as y,l as k,j as C,i as S}from"./chunk-JWWWU4GY.mjs";import"./chunk-Q6N77LIS.mjs";import"./chunk-FHCKFQBY.mjs";import"./chunk-APP5IYTE.mjs";import"./chunk-VOL4KS67.mjs";import{a as E}from"./chunk-G2ZHJXHZ.mjs";import"./chunk-53SKVMWR.mjs";import"./chunk-RK6UROPO.mjs";import"./chunk-AOTDTBQO.mjs";import{h as I}from"./chunk-VXRRHXUP.mjs";import"./chunk-WP2SHSCG.mjs";import{v as P}from"./chunk-LH7HKUCK.mjs";import{k as O}from"./chunk-HFKGW34E.mjs";import{c as T}from"./chunk-ZVDKW7TO.mjs";import{a as j}from"./chunk-Q6C7ZA3H.mjs";import"./chunk-CK3CDA3L.mjs";import"./chunk-7D4BUDKG.mjs";import{b as N}from"./chunk-OEJXPUAR.mjs";import{E as M,O as R,ba as A,_ as z,t as B,$ as L,G as D,H as J}from"./chunk-KE4MQBRY.mjs";import"./chunk-HM6EBJVO.mjs";import{a as K,c as V}from"./chunk-ADRWR5GI.mjs";import"./chunk-SUAHDXJZ.mjs";import"./chunk-YGP6PPOZ.mjs";import{useContext as W,useState as H,useRef as U,useLayoutEffect as q,useMemo as X,useEffect as Y,useCallback as G}from"react";import{popmeltCursor as F}from"./sticker-mode.mjs";import{createPortal as Q}from"react-dom";import{jsxs as Z,Fragment as $,jsx as _}from"react/jsx-runtime";import{createContext as ee,domToCanvas as te,destroyContext as ne}from"modern-screenshot";function re(e,t,n,r=!1){let[a,o]=H({}),i=n?.backdrop,s=n?.style.color;return q(()=>{if(location.pathname!==e.pathname||r&&i)return void o({background:i,ink:s});let n="component"===t?w(e):void 0,a=n?.component??n?.element??P(e.selector,e.element);if(!a)return void o({background:i,ink:s});let l=a.ownerDocument.defaultView,p=()=>{let e=f(a)??i,t=l.getComputedStyle(a).color;o(n=>n.background===e&&n.ink===t?n:{background:e,ink:t})};p();let c=new MutationObserver(p),d=[a,...g(a)],u=e=>{["color","background-color"].includes(e.propertyName)&&e.target===e.currentTarget&&p()};for(let e of d)c.observe(e,{attributes:!0}),e.addEventListener("transitionend",u);let h=l.matchMedia("(prefers-color-scheme: dark)");return h.addEventListener("change",p),l.addEventListener("resize",p),()=>{c.disconnect();for(let e of d)e.removeEventListener("transitionend",u);h.removeEventListener("change",p),l.removeEventListener("resize",p)}},[e,t,i,s,r]),a}var ae=`\n.sp-card button { border: 0; cursor: pointer; font: inherit; }\n.sp-card {\n --sp-control-bg: light-dark(var(--popmelt-thread-soft, #f2f2f2), #363636);\n position: relative;\n align-self: stretch;\n min-width: 0;\n width: 100%;\n margin-top: 6px;\n border-radius: 12px;\n overflow: hidden;\n color: var(--popmelt-thread-primary, #222);\n font:\n 13px/1.38 'Popmelt Geist',\n system-ui,\n sans-serif;\n}\n.sp-card, .sp-workspace {\n color-scheme: light dark;\n background-color: var(--sp-page-background, var(--popmelt-thread-raised, light-dark(#fff, #181818)));\n background-image: radial-gradient(circle, var(--sp-page-dot, light-dark(#f2f2f2, #222222)) 1px, transparent 1.25px);\n background-size: 11px 11px;\n}\n:is(.sp-workspace[data-popmelt-theme='dark'], [data-popmelt-theme='dark'] .sp-card) {\n color-scheme: dark;\n}\n:is(.sp-workspace[data-popmelt-theme='light'], [data-popmelt-theme='light'] .sp-card) {\n color-scheme: light;\n}\n.sp-stage {\n position: relative;\n min-height: 185px;\n display: grid;\n /* The zoom viewport measures this track. Keep captured images and previous\n zoom measurements from increasing its intrinsic minimum width. */\n grid-template-columns: minmax(0, 1fr);\n place-items: center;\n padding: 0;\n}\n.sp-actions,\n.sp-zoom-actions {\n position: absolute;\n z-index: 2;\n top: 6px;\n display: flex;\n gap: 3px;\n opacity: 0;\n pointer-events: none;\n transition: opacity 120ms ease-out;\n}\n.sp-actions {\n right: 6px;\n}\n.sp-zoom-actions {\n left: 6px;\n}\n.sp-card:is(:hover, :has(:focus-visible)) :is(.sp-actions, .sp-zoom-actions),\n.sp-actions[data-preview-active='true'] {\n opacity: 1;\n pointer-events: auto;\n}\n.sp-zoom-actions [role='group'] {\n display: flex;\n gap: 2px;\n}\n.sp-card :is(.sp-actions, .sp-zoom-actions) button {\n color: var(--popmelt-thread-primary, #383838);\n background: var(--sp-control-bg);\n border-radius: 8px;\n width: 28px;\n height: 26px;\n display: grid;\n place-items: center;\n}\n.sp-card .sp-zoom-actions button {\n width: 26px;\n}\n.sp-card .sp-zoom-actions button:disabled {\n color: #aaa;\n cursor: default;\n}\n.sp-card .sp-actions button[aria-pressed='true'] {\n background: var(--sp-accent, #ed1014);\n color: white;\n}\n.sp-card button:focus-visible {\n outline: 2px solid var(--sp-accent, #ed1014);\n outline-offset: 2px;\n}\n.sp-card svg {\n width: 14px;\n height: 14px;\n}\n/* Thread text is selectable by default, including individual spans. */\n.sp-card footer, .sp-card footer * {\n -webkit-user-select: none !important;\n user-select: none !important;\n}\n.sp-card footer {\n font: 14px/1.5 ${K};\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 3px;\n position: absolute;\n inset: auto 0 0;\n z-index: 2;\n padding: 6px;\n pointer-events: none;\n}\n.sp-card .tag-option,\n.sp-card .pager button {\n padding: 3px;\n background: none;\n color: inherit;\n}\n.sp-card .tag-option {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n min-width: 0;\n text-align: left;\n}\n.sp-card .tag-option > span {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.sp-card .tag-option > svg {\n flex: none;\n opacity: 0;\n transition: opacity 120ms ease-out;\n}\n.sp-card .tag-option:is(:hover, :focus-visible) > svg {\n opacity: 1;\n}\n@media (hover: none), (max-width: 480px) {\n .sp-card .tag-option > svg {\n opacity: 1;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .sp-card .tag-option > svg {\n transition: none;\n }\n}\n.sp-card .pager {\n display: flex;\n align-items: center;\n gap: 3px;\n color: var(--popmelt-thread-primary, #383838);\n white-space: nowrap;\n}\n.sp-card .pager-number {\n font-variant-numeric: tabular-nums;\n}\n.sp-card .pager button {\n width: 22px;\n height: 22px;\n display: grid;\n place-items: center;\n}\n.sp-card footer :is(.tag-option, .pager) {\n pointer-events: auto;\n touch-action: manipulation;\n}\n.sp-card footer .tag-option {\n padding: 0;\n}\n.sp-card .tag-option > span,\n.sp-card .pager {\n box-sizing: border-box;\n min-height: 26px;\n padding: 2px 8px;\n border-radius: 8px;\n background: var(--sp-control-bg);\n}\n.sp-card .tag-option > span {\n align-content: center;\n}\n.sp-card footer .pager {\n padding-inline: 2px;\n touch-action: pan-y pinch-zoom;\n}\n@media (prefers-reduced-motion: reduce) {\n .sp-actions,\n .sp-zoom-actions {\n transition: none;\n }\n}\n@media (hover: none), (max-width: 480px) {\n .sp-actions,\n .sp-zoom-actions {\n pointer-events: auto;\n opacity: 1;\n transition: none;\n }\n}\n\n.sp-expanded-placeholder, .sp-steer-frame { height: 260px; }\n.sp-steer-frame {\n position: relative;\n border: 0;\n display: block;\n width: 100%;\n border-radius: inherit;\n}\n\n/* An expanded card covers the annotation canvas. Its editor takes the free side of the thread. */\n/* Group the toolbar and its popovers above the editor, alongside the thread. */\n:is(body, [data-popmelt-root]):has(> .sp-workspace:not([hidden])) [data-popmelt-toolbar-layer] {\n position: relative;\n z-index: 10004;\n}\n/* Preserve the toolbar's geometry while the active preview covers its controls. */\n[data-popmelt-toolbar-layer][inert] { opacity: 0; }\n.sp-workspace {\n position: fixed;\n inset: 8px;\n overflow: clip;\n box-shadow: 0 0 0 100vmax light-dark(rgb(255 255 255 / 50%), rgb(0 0 0 / 50%));\n}\n.sp-workspace .sp-card {\n position: absolute;\n inset: 0 var(--sp-work-right, 0px) 0 var(--sp-work-left, 0px);\n width: auto;\n display: flex;\n flex-direction: column;\n margin: 0;\n border-radius: 0;\n background: transparent;\n}\n.sp-workspace .sp-stage {\n flex: 1;\n min-height: 0;\n}\n.sp-workspace .sp-steer-frame {\n position: absolute;\n inset: 0;\n height: 100%;\n}\n.sp-workspace :is(.sp-actions, .sp-zoom-actions) {\n top: 12px;\n opacity: 1;\n pointer-events: auto;\n}\n.sp-workspace .sp-actions { right: 12px; }\n.sp-workspace .sp-zoom-actions { left: 12px; }\n.sp-workspace .sp-card footer { padding: 12px; }\n.sp-card .sp-expanded-badge {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n border-radius: 8px;\n min-height: 26px;\n padding: 2px 8px;\n background: var(--sp-control-bg);\n color: inherit;\n}\n[data-popmelt-explore-canvas="right"] .sp-expanded-badge > svg { rotate: 180deg; }\n@media (max-width: 480px) {\n /* Keep the same mounted composer and card; the portal uses the space above them. */\n [data-devtools="thread-panel"][data-popmelt-explore-canvas] {\n top: auto !important;\n height: auto !important;\n padding: 0 !important;\n border: 0 !important;\n background: transparent !important;\n backdrop-filter: none !important;\n }\n [data-popmelt-explore-canvas] [data-popmelt-thread-shell] {\n overflow: visible !important;\n background: transparent !important;\n }\n [data-popmelt-explore-canvas] :is([data-popmelt-thread-header], [data-devtools="thread-panel-messages"], [data-queued-replies-area], [data-scroll-to-bottom]) {\n display: none !important;\n }\n .sp-workspace {\n inset: max(var(--popmelt-thread-visible-top, 8px), env(safe-area-inset-top))\n max(8px, env(safe-area-inset-right))\n calc(max(var(--popmelt-thread-visible-bottom, 8px), env(safe-area-inset-bottom)) + var(--sp-thread-height, 0px) + 6px)\n max(8px, env(safe-area-inset-left));\n }\n .sp-workspace .sp-card { inset: 0; }\n [data-popmelt-explore-canvas] .sp-expanded-badge > svg { rotate: 90deg; }\n}\n`;function oe({anchor:e,surfaceStyle:t,children:n}){let{visible:r}=W(a),o=U(null),[i,s]=H(null);return q(()=>{s(e.current?.closest("[data-popmelt-root]")??document.body)},[e]),q(()=>{if(r&&i)return function(e){let t=e.createElement("style");return t.textContent=":root, body { overflow: hidden !important; overscroll-behavior: none !important; }",e.head.append(t),()=>t.remove()}(i.ownerDocument)},[i,r]),q(()=>{let t=o.current,n=e.current?.closest('[data-devtools="thread-panel"]');if(!t||!n||!r)return;n.dataset.popmeltExploreCanvas="left";let a=i?.querySelector("[data-popmelt-toolbar-layer]"),s=a?.querySelector("#devtools-toolbar"),l=()=>{let e=n.getBoundingClientRect();if(a&&s){let t=s.getBoundingClientRect(),n=e.left<t.right+1&&e.right>t.left-1&&e.top<t.bottom+1&&e.bottom>t.top-1;a.inert=j(window.innerWidth)||n}let r=t.getBoundingClientRect(),o=e.left-r.left>=r.right-e.right;n.dataset.popmeltExploreCanvas=o?"left":"right",t.style.setProperty("--sp-thread-height",`${e.height}px`),t.style.setProperty("--sp-work-left",o?"0px":`${Math.max(0,e.right-r.left)}px`),t.style.setProperty("--sp-work-right",o?`${Math.max(0,r.right-e.left)}px`:"0px"),t.style.borderRadius=getComputedStyle(n).borderRadius,t.dataset.popmeltTheme=n.dataset.popmeltTheme;for(let e of Array.from(n.style))e.startsWith("--popmelt-thread-")&&t.style.setProperty(e,n.style.getPropertyValue(e))};l();let p=new ResizeObserver(l);p.observe(n),s&&p.observe(s);let c=new MutationObserver(l);return c.observe(n,{attributes:!0,attributeFilter:["style","data-popmelt-theme"]}),s&&c.observe(s,{attributeFilter:["style"]}),window.addEventListener("resize",l),()=>{a&&(a.inert=!1),delete n.dataset.popmeltExploreCanvas,p.disconnect(),c.disconnect(),window.removeEventListener("resize",l)}},[e,i,r]),i?Q(_("div",{hidden:!r,ref:o,className:"sp-workspace","data-popmelt-font":"sans",style:{...t,zIndex:10003},children:n}),i):null}function ie({tag:e,framing:t}){let n=U(null);return _("div",{"data-devtools":"preview-feedback-picker",style:{position:"absolute",inset:0,cursor:e?"crosshair":"default",userSelect:"none"},onPointerDown:e=>{n.current=e.isPrimary&&0===e.button?{id:e.pointerId,x:e.clientX,y:e.clientY,dragged:!1}:null},onPointerMove:e=>{let r=n.current;if(r?.id!==e.pointerId)return;let a=e.clientX-r.x,o=e.clientY-r.y;if(!r.dragged&&Math.hypot(a,o)<=8||(r.dragged=!0,r.x=e.clientX,r.y=e.clientY,"touch"!==e.pointerType||t.getScale()<=1))return;let{width:i,height:s}=e.currentTarget.getBoundingClientRect();if(!i||!s)return;let l=t.getView(i,s);t.setView(l.scale,l.x+a/i,l.y+o/s,i,s)},onPointerLeave:()=>{n.current=null},onPointerCancel:()=>{n.current=null},onPointerUp:t=>{let r=n.current;if(n.current=null,r?.id!==t.pointerId||r.dragged||Math.hypot(t.clientX-r.x,t.clientY-r.y)>8||!e)return;let a=t.currentTarget.parentElement?.querySelector(".sp-fit");if(!a)return;let o=I(t.clientX,t.clientY,{within:a})?.closest("[data-scratch-part]");o&&e(o.getAttribute("data-scratch-part"),S(o))}})}function se({capture:e,framing:t}){let n=U(null),[r,a]=H(1);return q(()=>{let r=n.current,o=()=>{let n=Math.max(.01,Math.min(1,(r.clientWidth-36)/e.width,(r.clientHeight-36)/e.height));a(n),t.setFitScale(n)};o();let i=new ResizeObserver(o);return i.observe(r),()=>i.disconnect()},[e,t]),_("div",{className:"sp-steer-frame",ref:n,children:_(h,{interactive:!0,framing:t,overlay:_(ie,{framing:t}),children:_("div",{style:{display:"grid",placeItems:"center",width:"100%",height:"100%"},children:_("img",{alt:"Original at exploration time",src:e.still,draggable:!1,style:{width:e.width*r,height:e.height*r,maxWidth:"none"}})})})})}function le({original:e,bundles:t,target:n,theme:a,accent:o,framing:i,onEscape:s}){let[l,p]=H(!1),{capture:c,runnable:d}=e,u=d&&t?.[d.fixture.bundle];return d&&!l&&"string"!=typeof u?u?_(r,{bundle:u,target:n,readOnly:!0,capture:c,theme:a,accent:o,framing:i,initial:[],onError:()=>p(!0),onEscape:s}):_("div",{className:"sp-steer-frame",role:"status",children:"Loading original…"}):c?.still?_(se,{capture:c,framing:i}):_("div",{className:"sp-steer-frame",role:"status",children:"Original unavailable for this round."})}function pe({frameUrl:e,theme:t,...n}){let[r,a]=H(null);return q(()=>{r&&t&&(r.documentElement.style.colorScheme=t)},[r,t]),q(()=>{if(!r||!n.captureRef)return;let e=()=>{let e=r.querySelector(".sp-fit");return e?async function(e,t){let n=e.ownerDocument;await n.fonts.ready;let r=e.getBoundingClientRect(),a=e.offsetWidth,o=e.offsetHeight;if(!a||!o||!r.width)throw Error("The option is not ready to capture.");let i=r.width/a,s=Array.from(e.children,e=>e.getBoundingClientRect()).filter(e=>e.width&&e.height);s.length||s.push(r);let l,p=Math.max(0,(Math.min(r.right,...s.map(e=>e.left))-r.left)/i-12),c=Math.max(0,(Math.min(r.bottom,...s.map(e=>e.top))-r.top)/i-12),d=Math.min(a,(Math.max(r.left,...s.map(e=>e.right))-r.left)/i+12),u=Math.min(o,(Math.max(r.top,...s.map(e=>e.bottom))-r.top)/i+12),h=await ee(e,{width:a,height:o,scale:Math.min(2,1600/Math.max(a,o)),backgroundColor:t,timeout:2500,style:{transform:"none",position:"static",margin:"0"},onCloneEachNode:e=>{if(1!==e.nodeType)return;let t=e;(t.hasAttribute("data-tagged")||t.hasAttribute("data-badge-hover")||t.hasAttribute("data-scratch-part"))&&(t.style.outline="none"),t.removeAttribute("data-tagged"),t.removeAttribute("data-badge-hover")}});h.sandbox=n.createElement("iframe");try{l=await te(h)}finally{ne(h)}let m=n.createElement("canvas"),g=l.width/a;return m.width=Math.max(1,Math.ceil((d-p)*g)),m.height=Math.max(1,Math.ceil((u-c)*g)),m.getContext("2d").drawImage(l,-p*g,-c*g),new Promise((e,t)=>m.toBlob(n=>n?e(n):t(Error("Could not capture the reviewed option.")),"image/png"))}(e,n.captureBackground??"transparent"):Promise.reject(Error("The option is still loading."))},t=n.captureRef;return t.current=e,()=>{t.current===e&&(t.current=null)}},[r,n.captureRef,n.captureBackground]),Z($,{children:[_("iframe",{className:"sp-steer-frame",style:{colorScheme:t},"aria-label":"Edit or comment on this option",src:e,srcDoc:e?void 0:i,onLoad:e=>{let t=e.currentTarget.contentDocument;t&&V(t),a(t)}}),r&&_(ce,{doc:r,...n},n.editorKey)]})}function ce({doc:e,...t}){let{toggle:n}=W(a),r=U(t),i=U(t);i.current=t;let s=U(void 0);q(()=>{let t=e.defaultView;if(!t)return;let{node:a,initial:o,target:l,accentColor:p,framing:c}=r.current,d=!0,u=o;s.current=t.startScratchSteer?.(a,l,p,c,e=>{if(!d)return;let t=C(o,e);JSON.stringify(t)!==JSON.stringify(u)&&(u=t,i.current.onChange(t))},e=>{d&&i.current.onTag(e)},e=>{d&&i.current.onPreview(e)},n);let h=e=>{"Escape"!==e.key||!i.current.onEscapeWorkspace||e.target?.closest?.('input, textarea, [contenteditable="true"]')||(e.preventDefault(),e.stopImmediatePropagation(),i.current.onEscapeWorkspace())};return t.addEventListener("keydown",h,!0),()=>{d=!1,s.current=void 0,i.current.onPreview(null),t.removeEventListener("keydown",h,!0)}},[e,n]);let l=T(),[p,c]=H();q(()=>{let t=e.defaultView?.frameElement;if(t instanceof HTMLIFrameElement)return o(t,c,()=>{e.documentElement.setAttribute("data-preview-control-hovered","")})},[e]);let{selectedPart:d,hoveredPart:u,focusRequest:h}=t;return q(()=>{s.current?.({feedbackOnly:l,selectedPart:d,hoveredPart:u,focusRequest:h,controlBounds:p})},[e,n,d,u,h,p,l]),null}function de(e){!e||e.getRootNode().activeElement?.closest("[data-popmelt-thread-composer]")||e.querySelector("[data-expand-option]")?.focus({preventScroll:!0})}function ue({batch:e,frameUrl:t,bundles:r,canApply:a=!0,frozenVersion:o,framing:i,theme:l,accentColor:p,selection:c,preview:h,setTag:g,onTogglePreview:f,onBrowse:v,edits:b,revisions:x,index:w,hoveredTarget:y,focusRequest:k,onPreviewStyle:C,onFixtureCanvas:S,onSteer:E,onApply:I,busy:P,expanded:T,onExpand:j}){let N=U(null),[L,D]=H(""),[J,K]=H(!1),V=U(null),W=U(null),X=G(e=>{W.current=e,de(e)},[]),Y=U(T);q(()=>{Y.current&&!T&&de(V.current),Y.current=T},[T]),q(()=>{if(k?.batchId!==e.id||k.option!==w)return;let t=T?W.current:V.current,n=t?.closest('[data-devtools="thread-panel-messages"]');if(!t||!n)return;let r=t.getBoundingClientRect(),a=n.getBoundingClientRect();r.top>=a.top&&r.bottom<=a.bottom||n.scrollBy({top:r.top-a.top-Math.max(0,(n.clientHeight-r.height)/2),behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"})},[e.id,w,k,T]);let Q=JSON.stringify([e.id,w,o??x?.[w]??0]),[ee]=H(()=>i??d(null)),te=e.options.length,ne=-1===w?e.original:void 0,ie=e.options[Math.max(0,w)],{background:se,ink:ce}=re(e.target,ne?.capture?.scope??("fixture"in ie?ie.previewScope:void 0),e.original?.capture,!!ne),ue=se?m(se):void 0,me=ue?.theme??l,ge={"--sp-page-background":se,"--sp-accent":p,"--sp-page-dot":ue?.dot,backgroundImage:ne?"none":void 0},fe={batchId:e.id,option:w,path:[]},ve=h?.showVariant&&h.target.batchId===e.id&&h.target.option===w;let be="fixture"in ie?r?.[ie.fixture.bundle]:void 0,xe=_(he,{title:ne?"Original":ie.title,index:ne?-1:w,hasOriginal:!!e.original,optionCount:te,accentColor:p,canTag:a,onTag:()=>g(fe),browseBy:function(t){let n=e.original?-1:0,r=te-n,a=n+(w-n+t+r)%r;D(""),v({...fe,option:a})}}),we=Z("div",{className:"sp-stage",style:{cursor:F(p)},children:[_("div",{className:"sp-zoom-actions",children:_(u,{framing:ee})}),Z("div",{className:"sp-actions","data-preview-active":!!h,children:[!ne&&ve&&a&&_(O,{hint:!0,variant:"custom","aria-label":"Apply this option in code",disabled:P||J,onClick:async()=>{D(""),K(!0);try{if(!N.current)throw Error("The option is still loading. Try again in a moment.");let e=await N.current();await I(fe,e)}catch(e){D(e instanceof Error?e.message:"Could not apply this option.")}finally{K(!1)}},children:_(M,{})}),!o&&(!ne||!!h)&&_(O,{variant:"custom","aria-pressed":!!h,hint:!T&&h?"Turn off page preview":"Preview on page","aria-label":"Preview on page",disabled:"fixture"in ie&&(!be||"string"==typeof be),onClick:()=>f(fe),children:_(R,{})}),_(O,{hint:!0,variant:"custom","data-expand-option":"","aria-label":T?"Collapse preview":"Expand preview","aria-expanded":T,onClick:()=>j(!T),children:_(T?A:z,{})})]}),ne?_(le,{original:ne,target:e.target,bundles:r,framing:ee,theme:me,accent:p,onEscape:T?()=>j(!1):void 0}):"fixture"in ie?_(n,{captureRef:N,captureBackground:se??void 0,frameKey:Q,frozenParent:!!o,readOnly:!!o,capture:o?e.original?.capture:void 0,bundle:be,previewScope:ie.previewScope,target:e.target,pageInk:se?ce:void 0,framing:ee,theme:me,accent:p,initial:b.filter(t=>t.batchId===e.id&&t.option===w),onCanvas:e=>S?.(ie.fixture.bundle,e),onEscape:T?()=>j(!1):void 0,selected:c?.batchId===e.id&&c.option===w?c.fixturePart:void 0,onTag:(e,t)=>g({...fe,fixturePart:e,fixturePartLabel:t}),onChange:e=>E(w,e),onPreview:e=>C(w,e)}):_(pe,{captureRef:N,captureBackground:se??void 0,editorKey:Q,readOnly:!!o,framing:ee,onEscapeWorkspace:T?()=>j(!1):void 0,frameUrl:t,target:e.target,node:ie.root,theme:me,accentColor:p,initial:b.filter(t=>t.batchId===e.id&&t.option===w),onPreview:e=>C(w,e),hoveredPart:y?.batchId===e.id&&y.option===w?y.part:void 0,focusRequest:k?.batchId===e.id&&k.option===w?k:void 0,selectedPart:c?.batchId===e.id&&c.option===w?c.path.join(".")+(c.field?"/label":""):void 0,onChange:e=>E(w,e),onTag:e=>{let[t,n]=e.split("/");g({...fe,path:t?t.split(".").map(Number):[],field:"label"===n?"label":void 0})}}),L&&_("span",{role:"alert",children:L}),xe]});return Z($,{children:[Z("section",{ref:V,"data-explore-batch":e.id,"aria-label":"Explore options",className:"sp-card",style:ge,"data-popmelt-tooltip-group":"",children:[_("style",{children:ae}),T?Z("div",{className:"sp-stage sp-expanded-placeholder",children:[Z(O,{variant:"custom",className:"sp-expanded-badge",hint:"Collapse preview","aria-label":"Preview expanded. Collapse preview","aria-expanded":!0,onClick:()=>j(!1),children:[_(B,{"aria-hidden":"true"}),"Preview expanded"]}),xe]}):we]}),!ne&&"fixture"in ie&&ie.rationale&&_(s,{text:ie.rationale}),T&&_(oe,{anchor:V,surfaceStyle:ge,children:_("section",{ref:X,"aria-label":"Expanded explore options",className:"sp-card","data-popmelt-tooltip-group":"","data-popmelt-tooltip-boundary":!0,children:we})})]})}function he({title:e,index:t,optionCount:n,hasOriginal:r,accentColor:a,onTag:o,canTag:i,browseBy:s}){let l=U(null),p=U(null);return Z("footer",{children:[t<0?_("span",{className:"tag-option",children:_("span",{children:e})}):Z(O,{variant:"custom",above:!0,className:"tag-option",disabled:!i,hint:"Add to chat",anchorRef:l,"aria-label":`Add ${e} to chat`,onClick:o,children:[_("span",{children:e}),_(L,{ref:l,"aria-hidden":"true",color:a})]}),(r||n>1)&&Z("div",{className:"pager",onTouchStart:e=>{let t=e.touches[0];p.current=1===e.touches.length?{id:t.identifier,x:t.clientX,y:t.clientY}:null},onTouchCancel:()=>{p.current=null},onTouchEnd:e=>{let t=p.current;p.current=null;let n=e.changedTouches[0];if(!t||!n||n.identifier!==t.id||e.touches.length)return;let r=n.clientX-t.x,a=n.clientY-t.y;Math.abs(r)<24||Math.abs(r)<1.3*Math.abs(a)||(e.preventDefault(),s(r>0?1:-1))},children:[_(O,{variant:"custom","aria-label":"Previous option",onClick:()=>s(-1),children:_(D,{})}),Z("span",{"aria-live":"polite",children:[_("span",{className:"pager-number",children:t+1})," of"," ",_("span",{className:"pager-number",children:n})]}),_(O,{variant:"custom","aria-label":"Next option",onClick:()=>s(1),children:_(J,{})})]})]})}function me(e,t,n){return`popmelt-explore-draft:${e}:${t}:${n}`}function ge(e,t,n,r,a){try{let o=me(e,t,n);void 0!==a?window.localStorage.setItem(o,JSON.stringify({revision:a,edits:r})):r.length?window.localStorage.setItem(o,JSON.stringify(r)):window.localStorage.removeItem(o)}catch{}}function fe(e,t,n,r){try{let a=me(e,t,n),o=window.localStorage.getItem(a);if(!o)return;let i=JSON.parse(o),s=Array.isArray(i)?{revision:0,edits:i}:i;s.revision===r.revision&&JSON.stringify(s.edits.map(k))===JSON.stringify(r.edits)&&window.localStorage.removeItem(a)}catch{}}var ve={edits:[]};function be(e,t,n,r,a){let[o]=H(()=>function(e,t){let n={};return t.options.forEach((r,a)=>{try{let r=window.localStorage.getItem(me(e,t.id,a));if(!r)return;let o=JSON.parse(r),{revision:i,edits:s}=Array.isArray(o)?{revision:0,edits:o}:o;if(!Number.isSafeInteger(i)||i<0||!Array.isArray(s))return;let l=s.map(k);if(l.some(e=>e.batchId!==t.id||e.option!==a))return;b({messages:[{batch:t}]},x(l)),n[a]={revision:i,edits:l}}catch{}}),n}(e,t)),[i,s]=H(()=>({...n,...o})),l=U(i),p=U({...n}),c=U({...o}),d=U(new Set),u=U(new Map),[h,m]=H({}),[g,f]=H(""),v=a&&void 0!==n;function w(e,t,n){let r=l.current[e]??ve;l.current={...l.current,[e]:t},JSON.stringify(r.edits)!==JSON.stringify(t.edits)&&(s(l.current),n&&m(t=>({...t,[e]:(t[e]??0)+1})))}async function y(n){if(v&&!d.current.has(n)){d.current.add(n);try{for(;c.current[n];){let a=c.current[n],o=await N(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({batchId:t.id,option:n,...a})});if(!o.ok&&409!==o.status)throw Error();let{draft:i}=await o.json();if(!i||!Number.isSafeInteger(i.revision)||!Array.isArray(i.edits))throw Error();i.revision>=(p.current[n]?.revision??0)&&(p.current[n]=i);let s=c.current[n];409===o.status||s===a?(delete c.current[n],fe(e,t.id,n,s),w(n,p.current[n],!0),f(409===o.status?"This option changed on another device. Its latest saved edits are shown.":"")):(s.revision=i.revision,ge(e,t.id,n,s.edits,s.revision))}}catch{f("Couldn’t sync option edits to this project.")}finally{d.current.delete(n)}}}let C=()=>Object.keys(c.current).forEach(e=>{y(Number(e))}),S=U(C);return q(()=>{S.current=C}),q(()=>{if(n)for(let[e,t]of Object.entries(n)){let n=Number(e);t.revision<(p.current[n]?.revision??0)||(p.current[n]=t,c.current[n]||w(n,t,!0))}},[n]),Y(()=>{if(!v)return;let e=()=>S.current();e(),window.addEventListener("online",e);let t=u.current;return()=>{window.removeEventListener("online",e);for(let e of t.values())clearTimeout(e);t.clear(),e()}},[v]),{edits:X(()=>Object.values(i).flatMap(e=>e.edits),[i]),save:function(n,r){let a=c.current[n]?.revision??p.current[n]?.revision??0,o={revision:a,edits:r.map(k)};JSON.stringify(l.current[n]?.edits??[])!==JSON.stringify(o.edits)&&(c.current[n]=o,ge(e,t.id,n,o.edits,a),w(n,o,!1),v&&(clearTimeout(u.current.get(n)),u.current.set(n,setTimeout(()=>{u.current.delete(n),y(n)},220))))},revisions:h,failure:g,retry:C,unsynced:!!Object.keys(c.current).length}}function xe({batch:n,draftScope:r,threadId:a,sharedDrafts:o,bridgeUrl:i,theme:s,accentColor:u,active:h,hidden:m,revealOnPage:g,activate:f,expanded:k,onExpand:C,canReply:S,submit:I,selection:P,onAttach:T,focusRequest:j,workspaceRef:N,followSource:M}){let R=e(i,v(n)),A=W(E),z=A?.preview?.batchId===n.id&&A.preview.threadId===a?A.preview:null,B=A?!!z?.enabled:h,[L,D]=H(()=>z?.index??0),J=U(null);q(()=>{J.current!==j&&(J.current=j,j&&j.batchId===n.id&&n.options[j.option]&&D(j.option))},[j,n.id,n.options]);let K=X(()=>j?{...j,part:""}:null,[j]),V=be(r,n,o,i+"/thread/"+encodeURIComponent(a)+"/explore-draft",S),[Y,G]=H(),F=j!==Y&&j?.option===L?j.snapshot:void 0,Q=F?.edits??V.edits,[ee]=H(()=>d(null)),te=X(()=>k&&!m&&!F&&L>=0?{batchId:n.id,option:L}:null,[k,m,F,n.id,L]),[ne,re]=H(z?.targets??null),[ae,oe]=H(()=>z&&"fixture"in z.option?{[z.option.fixture.bundle]:z.hasCanvas}:{}),[ie,se]=H(""),[le,pe]=H(null),ce=X(()=>b({messages:[{batch:n}]},x(Q)).messages[0].batch,[n,Q]);q(()=>{if(!te)return;let e={source:te,framing:ee,reference:()=>p(ce,{...te,path:[]},Q)};return N.current=e,()=>{N.current===e&&(N.current=null)}},[N,te,ee,ce,Q]),q(()=>{let e=N.current;if(!e||e.source!==M)return;let t=n.options.findIndex((t,r)=>{let a=n.parents?.[r];return a?.batchId===e.source.batchId&&a.option===e.source.option&&(!("fixture"in t)||"object"==typeof R[t.fixture.bundle])});t<0||(ee.restore(e.framing.snapshot()),D(t),C(!0))},[n,R,M,ee,C,N]);let de=ce.options[Math.max(0,L)],he=e=>"fixture"in de?y(e,de.previewScope,!!ae[de.fixture.bundle]):e.element,me=L>=0&&ne&&he(ne),ge="fixture"in de&&"component"===de.previewScope?"Core could not locate a single root for this component on the page. You can still review the option here.":"Open the annotated page with its target visible to preview this option.",fe="fixture"in de?R[de.fixture.bundle]??(z&&"fixture"in z.option&&z.option.fixture.bundle===de.fixture.bundle?z.bundle:void 0):void 0,ve=X(()=>{let e=x(Q)[n.id]?.[L]??{},t={...e};if(le?.option===L)for(let[n,r]of Object.entries(le.parts))t[n]={...e[n],...r};return t},[Q,n.id,L,le]),xe="fixture"in de&&!!ae[de.fixture.bundle],we=X(()=>ne?{threadId:a,batchId:n.id,index:L,enabled:!0,target:n.target,option:de,targets:ne,hasCanvas:xe,bundle:"string"==typeof fe?void 0:fe,parts:ve,theme:s,accentColor:u,revealOnPage:g}:null,[a,n.id,n.target,L,de,ne,xe,fe,ve,s,u,g]),ye=!!z,ke=A?.setPreview;q(()=>{F||!ye||!we||!ke||ke(e=>e?.batchId===n.id&&e.threadId===a?{...we,enabled:e.enabled,suspended:e.suspended}:e)},[F,ye,we,ke,n.id,a]);let Ce=()=>{ke?.(e=>e?.batchId===n.id&&e.threadId===a?{...e,enabled:!1}:e),f(!1)},Se=B?{target:{batchId:n.id,option:L,path:[]},showVariant:L>=0}:null,Ee=n.parents?.[L];return Z($,{children:[_(ue,{batch:ce,framing:ee,bundles:R,index:L,edits:Q,theme:s,accentColor:u,selection:P,preview:Se,expanded:k&&!m,onExpand:C,revisions:V.revisions,focusRequest:K,hoveredTarget:null,busy:!1,canApply:S&&!F,frozenVersion:F?j?.returnTo:void 0,onTogglePreview:()=>{if(se(""),Se&&!k)return void Ce();let e=w(n.target),t=location.pathname===n.target.pathname&&he(e);t&&t.parentElement&&!t.matches("body,html")&&!t.closest("[data-devtools]")?(re(e),ke?.({threadId:a,batchId:n.id,index:L,enabled:!0,target:n.target,option:de,targets:e,hasCanvas:xe,bundle:"string"==typeof fe?void 0:fe,parts:ve,theme:s,accentColor:u,revealOnPage:g}),C(!1),f(!0)):se(ge)},onBrowse:e=>{G(j),D(e.option),pe(null)},onFixtureCanvas:(e,t)=>oe(n=>n[e]===t?n:{...n,[e]:t}),onPreviewStyle:(e,t)=>pe(n=>t?{option:e,parts:t}:n?.option===e?null:n),onSteer:(e,t)=>{if(F)return;let r=t.map(t=>({...t,batchId:n.id,option:e}));V.save(e,r)},setTag:e=>{S&&!F&&T(p(ce,e,Q))},onApply:async(e,t)=>{let{text:n,meta:r}=l(ce,e.option,Q);if(!await I(n,t?{...r,exploreOption:{...r.exploreOption,selection:{...r.exploreOption.selection,reviewedImage:{replyImageIndex:0,capturedAt:Date.now(),description:"The attached image shows this reviewed option with its saved edits. Use it as the visual target to apply; the original annotation screenshot is earlier context."}}}}:r,t?[t]:void 0))throw Error("This thread cannot send the apply request.");Ce(),C(!1)}}),F&&j?.returnTo?Z("span",{children:["Parent version ·"," ",_(c,{reference:j.returnTo,children:"Back to iteration"})]}):Ee?Z("span",{children:["Based on"," ",_(c,{reference:{...Ee,snapshot:Ee,returnTo:{batchId:n.id,option:L,title:de.title}},showVersion:!0})]}):null,V.failure&&Z("span",{role:"alert",children:[V.failure," ",V.unsynced&&_(O,{variant:"custom",onClick:V.retry,children:"Retry"})]}),(ie||B&&L>=0&&!m&&ne&&!me)&&_("span",{role:"alert",children:ie||ge}),!A&&!F&&B&&!m&&we&&_(t,{preview:we})]})}export{xe as ExploreAttachment};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";export{f as PagePreviewLayer}from"./chunk-LDDDSIAQ.mjs";import"./chunk-GLIGPLM4.mjs";import"./chunk-JWWWU4GY.mjs";import"./chunk-Q6N77LIS.mjs";import"./chunk-FHCKFQBY.mjs";import"./chunk-APP5IYTE.mjs";import"./chunk-VOL4KS67.mjs";import"./chunk-53SKVMWR.mjs";import"./chunk-AOTDTBQO.mjs";import"./chunk-WP2SHSCG.mjs";import"./chunk-LH7HKUCK.mjs";import"./chunk-ZVDKW7TO.mjs";import"./chunk-Q6C7ZA3H.mjs";import"./chunk-7D4BUDKG.mjs";import"./chunk-OEJXPUAR.mjs";import"./chunk-HM6EBJVO.mjs";import"./chunk-SUAHDXJZ.mjs";import"./chunk-YGP6PPOZ.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{d as t,b as e,c as o,a as r}from"./chunk-RFTQCRGC.mjs";import"./chunk-UFU5IA3G.mjs";import"./chunk-Z4NMA34Y.mjs";import{f as i}from"./chunk-3HVPVKWV.mjs";import"./chunk-RXC7B7SX.mjs";import"./chunk-SZQTGYPS.mjs";import"./chunk-FZUHHJWW.mjs";import"./chunk-SOGN7S54.mjs";import"./chunk-XDZUDDYB.mjs";import"./chunk-VSWRWS2H.mjs";import"./chunk-B4RLDY5H.mjs";import"./chunk-PH2MLB3T.mjs";import"./chunk-S2U2IGUO.mjs";import"./chunk-XTOCFTVW.mjs";import"./chunk-EHM2ZBQU.mjs";import{a as n}from"./chunk-ULR4IDEX.mjs";import{h as a,X as s}from"./chunk-2TA7N3CI.mjs";import"./chunk-PRZ6C5X3.mjs";import"./chunk-VOL4KS67.mjs";import"./chunk-VLTK7KWK.mjs";import"./chunk-PTMHSMZH.mjs";import"./chunk-G2ZHJXHZ.mjs";import"./chunk-53SKVMWR.mjs";import"./chunk-HFWGYXPG.mjs";import"./chunk-RK6UROPO.mjs";import"./chunk-AOTDTBQO.mjs";import"./chunk-2F2BVGFH.mjs";import"./chunk-RWZ7SVMO.mjs";import"./chunk-HAZXZ5TU.mjs";import"./chunk-YTIDSDPP.mjs";import"./chunk-KF35YUNZ.mjs";import"./chunk-VBH2YQLG.mjs";import"./chunk-VXRRHXUP.mjs";import"./chunk-WP2SHSCG.mjs";import{e as c,g as l,f as p}from"./chunk-AAMUU2QA.mjs";import"./chunk-LH7HKUCK.mjs";import{a as m}from"./chunk-DDUXU6LA.mjs";import{b as h,f as u,c as d,d as f}from"./chunk-5TCWBNV4.mjs";import{p as j}from"./chunk-ZXCAONMC.mjs";import"./chunk-DUWONLQE.mjs";import"./chunk-ATLUO4G7.mjs";import"./chunk-YG3RSK5J.mjs";import"./chunk-C2ZSNUXQ.mjs";import"./chunk-EILBHZDX.mjs";import"./chunk-HFKGW34E.mjs";import"./chunk-ZVDKW7TO.mjs";import"./chunk-HQVWOBYH.mjs";import"./chunk-Q6C7ZA3H.mjs";import"./chunk-OREALBUO.mjs";import"./chunk-CK3CDA3L.mjs";import{c as k,a as g}from"./chunk-7D4BUDKG.mjs";import"./chunk-OEJXPUAR.mjs";import{V as w}from"./chunk-KE4MQBRY.mjs";import"./chunk-B4DYUYX4.mjs";import"./chunk-HM6EBJVO.mjs";import"./chunk-ADRWR5GI.mjs";import{b as S}from"./chunk-SUAHDXJZ.mjs";import"./chunk-PRPXMDZ7.mjs";import"./chunk-YGP6PPOZ.mjs";import{useState as y,useSyncExternalStore as v,useEffect as P}from"react";import{jsx as I,jsxs as H}from"react/jsx-runtime";function O(t,i){let n,a={phase:"starting"},m=0,j=!1,k=!1,g=0,w=new Set,y=`popmelt-participant:${t.projectId}`,v=new h(t.url,t.projectId),P=t=>{if(!k){a=t;for(let t of w)t()}},I=()=>history.state?.popmeltGuestEntry===t.projectId,H=e=>history.replaceState({...history.state,popmeltGuestEntry:t.projectId},"",e),O=t=>fetch("/__popmelt/host",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(t),redirect:"error"}),U=async(e={},o=!1,r)=>{if(S(t.url))return null;let i=await O(e);if(403===i.status){let e=i.headers.get("X-Popmelt-Host-Origin"),n=i.headers.get("X-Popmelt-Session"),a=new URL(location.href);if(!o||!n||window.top!==window||!["localhost","127.0.0.1","[::1]"].includes(a.hostname)||a.pathname.startsWith("/__popmelt/")||a.searchParams.has("__popmelt_code_preview")||a.hash.includes("popmelt-")||I())return null;let s=localStorage.getItem(`popmelt-admission:${t.projectId}`);if(s)try{if(JSON.parse(s)?.receipt)return null}catch{return null}if(e&&function(t,e){try{let o=new URL(t),r=new URL(e),i=["localhost","127.0.0.1","[::1]"];return o.origin===t&&r.origin===e&&t!==e&&["http:","https:"].includes(o.protocol)&&o.protocol===r.protocol&&o.port===r.port&&i.includes(o.hostname)&&i.includes(r.hostname)}catch{return!1}}(location.origin,e)){let t=await fetch(e+"/__popmelt/host",{method:"HEAD",credentials:"omit",redirect:"error",referrerPolicy:"no-referrer",signal:AbortSignal.timeout(2e3)}).catch(()=>null);if(!k&&204===t?.status&&t.headers.get("X-Popmelt-Session")===n)throw a.host=new URL(e).host,location.replace(a.href),A;return null}let c=i.headers.get("X-Popmelt-Local-Port");if(!c||!/^[1-9]\d{0,4}$/.test(c)||Number(c)>65535)return null;let l=await fetch("http://127.0.0.1:"+c+"/",{method:"POST",headers:{"X-Popmelt-Session":n},credentials:"omit",cache:"no-store",redirect:"error",referrerPolicy:"no-referrer",signal:AbortSignal.timeout(6500)}).catch(()=>null);if(!l?.ok||k)return null;let p=await l.json().catch(()=>null);if("string"!=typeof p?.proof||(i=await O({localProof:p.proof,previousId:r}),403===i.status))return null}if(!i.ok)throw new Error(`Host entry unavailable (${i.status}).`);let n=`popmelt-before-participants:${t.projectId}`;return null===localStorage.getItem(n)&&localStorage.setItem(n,JSON.stringify(Object.fromEntries(Object.values(s(t.projectId)).map(t=>[t,localStorage.getItem(t)])))),await i.json()},A=Symbol("navigating"),R=async(a,s=g)=>{if(k||s!==g)return;let m=await r({bridgeUrl:t.url,projectId:t.projectId,credential:a,runtimeStorage:sessionStorage,observedSource:{sourceId:t.projectId,revision:t.revision},loadOwnSource:i,prepareApplication:t.planeApps?async r=>{if(k||s!==g)throw A;let i=c(location.pathname);if(r.author.id===a.participantId&&"host"===r.author.relationship&&!S(t.url)){if("/"!==i){let t=new URL(location.href);throw t.pathname=p(t.pathname),location.replace(t.href),A}return("/"===r.ownWorkspace?.basePath?r.ownWorkspace.revision:void 0)??r.draft.source?.revision??t.revision}let n=await e(a,a.participantId,void 0,location.pathname);if(k||s!==g)throw A;let m=o(n.application);if(t.appVersion??(t.appVersion=n.application.version),m!==l(location.pathname)||t.appVersion&&t.appVersion!==n.application.version)throw localStorage.setItem(y,JSON.stringify(a)),location.replace(m+location.search+location.hash),A;return n.application.basis??t.revision}:void 0}).catch(t=>{if(t!==A)throw t});if(m){if(k||s!==g)return void m.dispose();try{localStorage.setItem(y,JSON.stringify(a))}catch(t){throw m.dispose(),t}if(n?.dispose(),I()){let t={...history.state};delete t.popmeltGuestEntry,history.replaceState(t,"")}n=m,P({phase:"connected",connection:m}),U({credential:a}).catch(()=>{})}},b=()=>{H(location.href),g++,n?.dispose(),n=void 0,function(t,e){t.removeItem(`popmelt-participant:${e}`);let o,r=`popmelt-admission:${e}`;try{o=JSON.parse(t.getItem(r)??"null")}catch{return void t.removeItem(r)}o&&"object"==typeof o&&t.setItem(r,JSON.stringify({name:o.name,colorIdentity:o.colorIdentity??o.receipt}))}(localStorage,t.projectId),P({phase:"entry",invitation:null})};return{client:v,getSnapshot:()=>a,subscribe:t=>(w.add(t),()=>{w.delete(t)}),retain(){if(k)throw new Error("Participant lifecycle is disposed");m++,j||(j=!0,(async()=>{let t=u(location.href),e=new URL(t.cleanUrl),o=new URLSearchParams(e.hash.slice(1)),r=o.get("popmelt-host");o.delete("popmelt-host"),r&&(e.hash=o.toString()),t.token?H(e.href):e.href!==location.href&&history.replaceState(history.state,"",e);let i=null;if(r){if(i=await U({token:r}),!i&&!t.token&&(i=await U({},!0)),!i)throw new Error("Host entry expired. Use the current private host link.")}else if(!t.token&&!I()){try{i=JSON.parse(localStorage.getItem(y)??"null")}catch{}i??(i=await U({},!0))}if(k)return;if(!i)return void P({phase:"entry",invitation:t.token??null});let n=g;for(let e=1;!k&&n===g;e++)try{return void await R(i,n)}catch(o){if(k||n!==g)return;if(d(o)){P({phase:"error",message:o.message}),await new Promise(t=>setTimeout(t,f(e)));continue}if("access_removed"===o.code)return void b();if(401!==o.status)throw o;let a=await U({},!r&&!t.token,i.participantId);return void(a?await R(a):b())}})().catch(t=>{t!==A&&P({phase:"error",message:t.message})}));let t=!1;return()=>{t||(t=!0,m--,queueMicrotask(()=>{m||k||(k=!0,g++,n?.dispose(),n=void 0,w.clear())}))}},removed:b,async join(e,o){if("entry"!==a.phase||!a.invitation||k)throw new Error("No active invitation");if(!o)throw new Error("Peer identity is not ready");let r=g,i=await v.joinOrRequestAdmission(a.invitation,e,o);if(!k&&r===g){if("admission"in i)return localStorage.setItem(`popmelt-admission:${t.projectId}`,JSON.stringify({name:i.admission.name,receipt:o,colorIdentity:o})),void P({phase:"entry",invitation:null});await R(i.joined.credential,r)}},admit:t=>R(t)}}function U({config:r,loadOwnSource:s,children:p}){let[h]=y(()=>O(r,s)),u=a(),d=v(h.subscribe,h.getSnapshot,h.getSnapshot);P(()=>h.retain(),[h]);let[f,U,A]=k(),R="connected"===d.phase?d.connection:null;if(P(()=>{if(!R||!r.planeApps)return;let t,i=new AbortController,n=R.isHost&&!S(r.url)&&"/"===c(location.pathname),a=n?void 0:r.appVersion,s=async()=>{try{let t=await e(R.credential,R.credential.participantId,i.signal,location.pathname);if(n&&"/"!==t.application.basePath)throw new Error("Host checkout unavailable");let s=o(t.application);if(a??(a=t.application.version),!i.signal.aborted&&(s!==l(location.pathname)||t.application.version!==a)){if(R.isHost&&!S(r.url)){let t=await fetch(s+location.search,{method:"HEAD",headers:{Accept:"text/html"},mode:"same-origin",cache:"no-store",signal:i.signal});if(!t.ok||!t.headers.get("content-type")?.includes("text/html")||l(new URL(t.url).pathname)!==s)throw new Error("Host plane document unavailable")}return await R.state.flush(),void(i.signal.aborted||(s===l(location.pathname)?location.reload():location.replace(s+location.search+location.hash)))}}catch{}i.signal.aborted||(t=setTimeout(s,1500))};return s(),()=>{i.abort(),clearTimeout(t)}},[r.planeApps,r.appVersion,r.url,R,u]),R)return I(t,{connection:R,codePreviewUrl:location.href,planeApps:r.planeApps,onAccessRemoved:h.removed,children:p});let b="starting"===d.phase||"error"===d.phase,L="entry"===d.phase?d.invitation:null;return I(n,{children:I("div",{"data-devtools":"participant-entry",style:{display:"contents",pointerEvents:"auto"},children:b?I(i,{entry:{theme:f,themePreference:A,onThemePreferenceChange:U,ariaLabel:"starting"===d.phase?"Popmelt connecting":"Popmelt disconnected",action:null,logoOnly:!0,connected:!1,connection:H("span",{"data-popmelt-entry-content":!0,role:"status",style:{...j(g[f],!1),cursor:"default"},children:[I(w,{size:14,strokeWidth:1.5,"aria-hidden":"true"}),"starting"===d.phase?"Connecting…":"Disconnected"]})}}):I(m,{showHostLinkHelp:window.top===window&&["localhost","127.0.0.1","[::1]"].includes(location.hostname)&&!S(r.url)&&"/"===c(location.pathname),client:h.client,storage:localStorage,storageKey:`popmelt-admission:${r.projectId}`,theme:f,themePreference:A,onThemePreferenceChange:U,onAdmitted:h.admit,onJoin:L?h.join:void 0},L??"request-access")})})}export{U as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a as r,d as t}from"./chunk-RFTQCRGC.mjs";import"./chunk-UFU5IA3G.mjs";import"./chunk-Z4NMA34Y.mjs";import"./chunk-FZUHHJWW.mjs";import"./chunk-SOGN7S54.mjs";import"./chunk-S2U2IGUO.mjs";import"./chunk-EHM2ZBQU.mjs";import"./chunk-2TA7N3CI.mjs";import"./chunk-PRZ6C5X3.mjs";import"./chunk-VOL4KS67.mjs";import"./chunk-VLTK7KWK.mjs";import"./chunk-PTMHSMZH.mjs";import"./chunk-G2ZHJXHZ.mjs";import"./chunk-53SKVMWR.mjs";import"./chunk-HFWGYXPG.mjs";import"./chunk-RK6UROPO.mjs";import"./chunk-AOTDTBQO.mjs";import"./chunk-2F2BVGFH.mjs";import"./chunk-RWZ7SVMO.mjs";import"./chunk-HAZXZ5TU.mjs";import"./chunk-YTIDSDPP.mjs";import"./chunk-KF35YUNZ.mjs";import"./chunk-VBH2YQLG.mjs";import"./chunk-VXRRHXUP.mjs";import"./chunk-WP2SHSCG.mjs";import"./chunk-AAMUU2QA.mjs";import"./chunk-LH7HKUCK.mjs";import"./chunk-5TCWBNV4.mjs";import"./chunk-EILBHZDX.mjs";import"./chunk-ZVDKW7TO.mjs";import"./chunk-HQVWOBYH.mjs";import"./chunk-Q6C7ZA3H.mjs";import"./chunk-OREALBUO.mjs";import"./chunk-CK3CDA3L.mjs";import"./chunk-7D4BUDKG.mjs";import{b as o}from"./chunk-OEJXPUAR.mjs";import"./chunk-KE4MQBRY.mjs";import"./chunk-B4DYUYX4.mjs";import{d as n,f as i,c as m,a as e}from"./chunk-HM6EBJVO.mjs";import"./chunk-ADRWR5GI.mjs";import"./chunk-SUAHDXJZ.mjs";import"./chunk-PRPXMDZ7.mjs";import"./chunk-YGP6PPOZ.mjs";import{useState as c,useEffect as s,cloneElement as p}from"react";import{jsxs as h,jsx as u}from"react/jsx-runtime";function j({children:j,projectId:k,participantConfig:a}){let[l,d]=c(null),[H,U]=c("");if(s(()=>{let t,m,c=!1;return d(null),U(""),n(k).then(async n=>{if(c)return;let s=location.origin+e;m=i(s,n);let p=await o(s+"/status",{signal:AbortSignal.timeout(6e3)}),h=p.ok?await p.json():null;if(h?.projectId!==n.projectId)throw new Error("Phone access expired. Create a fresh pairing link in the project terminal.");if(!c){if(h.phoneParticipantId)t=await r({projectId:n.projectId,bridgeUrl:s,credential:{participantId:h.phoneParticipantId,token:""},runtimeStorage:sessionStorage,observedSource:{sourceId:n.projectId,revision:a?.revision??"unversioned"}});else if(a)throw new Error("This phone is not connected to the multiplayer host.");c?t?.dispose():d({bridgeUrl:s,projectId:n.projectId,connection:t})}}).catch(r=>{m?.(),c||U(r instanceof Error?r.message:"Phone pairing failed.")}),()=>{c=!0,t?.dispose(),m?.()}},[k,a]),H)return h("p",{role:"alert","data-devtools":"phone-pairing-error",children:[H," ",u("button",{type:"button",onClick:m,children:"Forget this pairing"})]});if(!l)return null;let I=p(j,{bridgeUrl:l.bridgeUrl,projectId:l.projectId});return l.connection?u(t,{connection:l.connection,onAccessRemoved:m,children:I}):I}export{j as PhoneHostGate};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { P as PopmeltOptions } from './participantBootstrap-BcfNTEe9.mjs';
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
__POPMELT_BRIDGE_URL__?: string;
|
|
8
|
+
__POPMELT_PROJECT_ID__?: string;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type PopmeltProviderProps = PropsWithChildren<PopmeltOptions>;
|
|
13
|
+
declare function PopmeltProvider({ children, enabled, ...props }: PopmeltProviderProps): react.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { PopmeltProvider as P, type PopmeltProviderProps as a };
|