@popmelt.com/core 0.40.1 → 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.
Files changed (198) hide show
  1. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  2. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  3. package/dist/ExploreAttachment-ALV7FL3Y.mjs +1 -0
  4. package/dist/PagePreviewLayer-UPCGG4EV.mjs +1 -0
  5. package/dist/ParticipantRuntime-CBUA7BL5.mjs +1 -0
  6. package/dist/PhoneHostGate-TVNOJYL5.mjs +1 -0
  7. package/dist/PopmeltProvider-5g-1VH5a.d.mts +15 -0
  8. package/dist/PopmeltTasteConnectedPane-PD64Q6LF.mjs +1 -0
  9. package/dist/QueuedReplies-ESF5UL3J.mjs +1 -0
  10. package/dist/SamplePlacementOverlay-V533Y4XN.mjs +1 -0
  11. package/dist/ShareProjectPane-PMODH6QQ.mjs +1 -0
  12. package/dist/SuppliedContext-ADMN2D2I.mjs +1 -0
  13. package/dist/{ThreadErrorCard-SUFOXXLG.mjs → ThreadErrorCard-KS2XWRT3.mjs} +1 -1
  14. package/dist/ThreadPanel-5TDPZBAU.mjs +1 -0
  15. package/dist/adapter-react-three-fiber.d.mts +1 -1
  16. package/dist/adapter-react-three-fiber.mjs +1 -1
  17. package/dist/adapter-three.d.mts +1 -1
  18. package/dist/adapter-three.mjs +1 -1
  19. package/dist/bridge-entry.mjs +1 -1
  20. package/dist/browser-runtime-FUXWVGQ7.mjs +1 -0
  21. package/dist/browser.d.mts +4 -4
  22. package/dist/browser.mjs +1 -1
  23. package/dist/canvas-text.d.mts +1 -1
  24. package/dist/{checkFixture-LBDNT3M5.mjs → checkFixture-42NYMFAK.mjs} +1 -1
  25. package/dist/chunk-2TA7N3CI.mjs +1 -0
  26. package/dist/chunk-32BKJ5JN.mjs +1 -0
  27. package/dist/chunk-3HVPVKWV.mjs +1 -0
  28. package/dist/chunk-4RQ5XD3I.mjs +1 -0
  29. package/dist/chunk-5J4BZL6N.mjs +1 -0
  30. package/dist/chunk-6OPX4CUT.mjs +1 -0
  31. package/dist/{chunk-4MLXPN7W.mjs → chunk-776SEJZO.mjs} +1 -1
  32. package/dist/chunk-7OATJ6BO.mjs +1 -0
  33. package/dist/chunk-7VIC4MGC.mjs +1 -0
  34. package/dist/chunk-AET77LFV.mjs +1 -0
  35. package/dist/chunk-ALWPAFIW.mjs +1 -0
  36. package/dist/chunk-AOFKEBLN.mjs +1 -0
  37. package/dist/{chunk-6EO73WJN.mjs → chunk-BSVZXOOS.mjs} +1 -1
  38. package/dist/chunk-D2ONGS5P.mjs +1 -0
  39. package/dist/chunk-DDUXU6LA.mjs +1 -0
  40. package/dist/chunk-DMKBAI2Z.mjs +1 -0
  41. package/dist/chunk-DUWONLQE.mjs +1 -0
  42. package/dist/chunk-EG6UHPJV.mjs +1 -0
  43. package/dist/{chunk-XVQAHYF2.mjs → chunk-FZUHHJWW.mjs} +1 -1
  44. package/dist/{chunk-L3QE62SE.mjs → chunk-GE5BE6PI.mjs} +1 -1
  45. package/dist/{chunk-K22VZV3V.mjs → chunk-GLF7Z5IR.mjs} +1 -1
  46. package/dist/chunk-GLIGPLM4.mjs +1 -0
  47. package/dist/chunk-H3T2O3HA.mjs +1 -0
  48. package/dist/chunk-HFKGW34E.mjs +1 -0
  49. package/dist/{chunk-Q5MIJ5F2.mjs → chunk-HFWGYXPG.mjs} +1 -1
  50. package/dist/{chunk-53QOGFAT.mjs → chunk-ITLRSHNZ.mjs} +1 -1
  51. package/dist/chunk-JWWWU4GY.mjs +1 -0
  52. package/dist/chunk-KD2AOPYP.mjs +1 -0
  53. package/dist/chunk-KE4MQBRY.mjs +1 -0
  54. package/dist/chunk-KF73S7MG.mjs +1 -0
  55. package/dist/{chunk-ZQMKLODZ.mjs → chunk-LDDDSIAQ.mjs} +1 -1
  56. package/dist/chunk-LWPNOBGS.mjs +1 -0
  57. package/dist/{chunk-MPEVFQ43.mjs → chunk-PCUUOIFD.mjs} +1 -1
  58. package/dist/chunk-PRZ6C5X3.mjs +1 -0
  59. package/dist/chunk-PTMHSMZH.mjs +1 -0
  60. package/dist/chunk-RFTQCRGC.mjs +1 -0
  61. package/dist/{chunk-DBCCE7BA.mjs → chunk-S2U2IGUO.mjs} +1 -1
  62. package/dist/{chunk-EUFK7B6S.mjs → chunk-S7IWZSWH.mjs} +1 -1
  63. package/dist/chunk-SOFNYBJD.mjs +1 -0
  64. package/dist/chunk-SZQTGYPS.mjs +1 -0
  65. package/dist/chunk-TA2BMDSC.mjs +30 -0
  66. package/dist/{chunk-ECWY6Z6K.mjs → chunk-ULR4IDEX.mjs} +1 -1
  67. package/dist/{chunk-OECEYJNK.mjs → chunk-VJKC2RJB.mjs} +1 -1
  68. package/dist/chunk-VOL4KS67.mjs +1 -0
  69. package/dist/chunk-VSWRWS2H.mjs +1 -0
  70. package/dist/chunk-W5TNOJOR.mjs +1 -0
  71. package/dist/{chunk-LUTP7QBD.mjs → chunk-WSI2SQWU.mjs} +1 -1
  72. package/dist/chunk-WWNI7JCA.mjs +1 -0
  73. package/dist/chunk-XDZUDDYB.mjs +1 -0
  74. package/dist/chunk-XGSOAF5E.mjs +1 -0
  75. package/dist/chunk-XHTSKQMB.mjs +1 -0
  76. package/dist/chunk-YG3RSK5J.mjs +1 -0
  77. package/dist/chunk-YHCZYT4T.mjs +1 -0
  78. package/dist/chunk-Z4NMA34Y.mjs +1 -0
  79. package/dist/chunk-ZXCAONMC.mjs +1 -0
  80. package/dist/cli.mjs +1 -1
  81. package/dist/codex-note-context-WX33QFE7.mjs +1 -0
  82. package/dist/codex-project-77GHT2I3.mjs +1 -0
  83. package/dist/{codex-session-registry-YNU6LEVH.mjs → codex-session-registry-A3NQRRZ3.mjs} +1 -1
  84. package/dist/codex-store-mount-KFJYT6AS.mjs +1 -0
  85. package/dist/dev-app-port-LHUBCOBE.mjs +1 -0
  86. package/dist/{dev-server-BRrhkH5t.d.mts → dev-server-D8Qxrp1A.d.mts} +2 -1
  87. package/dist/dev-server-FZJ6HDKP.mjs +1 -0
  88. package/dist/guest-admission.mjs +1 -1
  89. package/dist/guest-live-canvas.mjs +1 -1
  90. package/dist/index.d.mts +9 -25
  91. package/dist/index.mjs +1 -1
  92. package/dist/media.d.mts +3 -3
  93. package/dist/memory-store.d.mts +7 -2
  94. package/dist/memory.mjs +1 -1
  95. package/dist/orientation-markup.mjs +1 -0
  96. package/dist/outline-trace.mjs +1 -0
  97. package/dist/{page-interaction-YXHXEYOT.mjs → page-interaction-74JGNCZ5.mjs} +1 -1
  98. package/dist/{page-planes-Jz2yR_Wk.d.mts → page-planes-BeFZ3Wso.d.mts} +15 -472
  99. package/dist/{participantBootstrap-DDOxY-Cy.d.mts → participantBootstrap-BcfNTEe9.d.mts} +3 -3
  100. package/dist/peer-client-B2KMU667.mjs +1 -0
  101. package/dist/phone-app-HNBDX7UX.mjs +1 -0
  102. package/dist/plain-html-H35WPIRO.mjs +1 -0
  103. package/dist/plane-history.mjs +1 -0
  104. package/dist/plugin-astro.d.mts +8 -3
  105. package/dist/plugin-astro.mjs +1 -1
  106. package/dist/plugin-nuxt.d.mts +6 -2
  107. package/dist/plugin-nuxt.mjs +1 -1
  108. package/dist/plugin-vite.d.mts +10 -5
  109. package/dist/plugin-vite.mjs +1 -1
  110. package/dist/protocol-BIUE4rB6.d.mts +9 -0
  111. package/dist/server.d.mts +14 -3
  112. package/dist/server.mjs +1 -1
  113. package/dist/shared-page-6AUYAPJ3.mjs +1 -0
  114. package/dist/steerStyles-C4YBV4TZ.mjs +1 -0
  115. package/dist/sticker-colors.mjs +1 -0
  116. package/dist/sticker-mode.mjs +1 -0
  117. package/dist/{subjects-cLtt9-iK.d.mts → subjects-qHIrZrlt.d.mts} +57 -1
  118. package/dist/taste-constraints.mjs +1 -0
  119. package/dist/taste-contract.mjs +1 -0
  120. package/dist/taste-fragment.mjs +1 -0
  121. package/dist/taste-graph-inspection.mjs +1 -0
  122. package/dist/taste-layout.mjs +1 -0
  123. package/dist/taste-page-composition.mjs +1 -0
  124. package/dist/taste-proposal-session-PSI4TX6H.mjs +1 -0
  125. package/dist/taste-proposal.mjs +1 -0
  126. package/dist/taste-token-math.mjs +1 -0
  127. package/dist/thread-request.mjs +1 -0
  128. package/dist/thread-view-client.d.mts +2 -0
  129. package/dist/thread-view-client.mjs +1 -0
  130. package/dist/thread-view.html +136 -0
  131. package/dist/{video-adapter-xL95wukX.d.mts → video-adapter-B5eap10v.d.mts} +1 -1
  132. package/infra/phone-pairing/app-listener.cjs +107 -0
  133. package/infra/phone-pairing/binding.mjs +369 -20
  134. package/infra/phone-pairing/machine-config.mjs +43 -26
  135. package/infra/phone-pairing/machine-service.mjs +94 -6
  136. package/infra/phone-pairing/machine.mjs +5 -1
  137. package/infra/phone-pairing/reservations.mjs +103 -0
  138. package/infra/phone-pairing/writer-lock.mjs +107 -0
  139. package/package.json +30 -35
  140. package/dist/ExploreAttachment-ZPC5AR5V.mjs +0 -1
  141. package/dist/PagePreviewLayer-C7WBS7IX.mjs +0 -1
  142. package/dist/ParticipantRuntime-CWE62D2G.mjs +0 -1
  143. package/dist/PhoneHostGate-NWJXZBBP.mjs +0 -1
  144. package/dist/PopmeltTasteConnectedPane-2BNDKMMB.mjs +0 -1
  145. package/dist/QueuedReplies-5YG2DN3W.mjs +0 -1
  146. package/dist/SamplePlacementOverlay-ULOV22WR.mjs +0 -1
  147. package/dist/ShareProjectPane-KEE7EYMP.mjs +0 -1
  148. package/dist/SuppliedContext-IT25WBGQ.mjs +0 -1
  149. package/dist/ThreadPanel-NNJHQQSD.mjs +0 -1
  150. package/dist/browser-runtime-G6AEOA4X.mjs +0 -1
  151. package/dist/chunk-2FHGLE7G.mjs +0 -1
  152. package/dist/chunk-32TDB3N4.mjs +0 -1
  153. package/dist/chunk-4EDMISUV.mjs +0 -1
  154. package/dist/chunk-5IZHN3A7.mjs +0 -1
  155. package/dist/chunk-6DU4ITXT.mjs +0 -1
  156. package/dist/chunk-6RC7JZ73.mjs +0 -1
  157. package/dist/chunk-A4GARXVQ.mjs +0 -1
  158. package/dist/chunk-AKEVJPGD.mjs +0 -1
  159. package/dist/chunk-AWWUJO3N.mjs +0 -1
  160. package/dist/chunk-BD7DW4UK.mjs +0 -1
  161. package/dist/chunk-CRZEJJI6.mjs +0 -1
  162. package/dist/chunk-CUVWMYUV.mjs +0 -1
  163. package/dist/chunk-DSTHM3V5.mjs +0 -30
  164. package/dist/chunk-EWTZVC7E.mjs +0 -1
  165. package/dist/chunk-FR6VIGJ2.mjs +0 -1
  166. package/dist/chunk-HVDJYNQ6.mjs +0 -1
  167. package/dist/chunk-KN4GC34I.mjs +0 -1
  168. package/dist/chunk-KUILFVXZ.mjs +0 -1
  169. package/dist/chunk-LLVF422C.mjs +0 -1
  170. package/dist/chunk-MHTX52KW.mjs +0 -1
  171. package/dist/chunk-N37INB4D.mjs +0 -1
  172. package/dist/chunk-NFPUOL4J.mjs +0 -1
  173. package/dist/chunk-OA63PYHZ.mjs +0 -1
  174. package/dist/chunk-PQKSXNIZ.mjs +0 -1
  175. package/dist/chunk-PYGRFSUU.mjs +0 -1
  176. package/dist/chunk-QYNW5LE2.mjs +0 -1
  177. package/dist/chunk-RAABZFBD.mjs +0 -1
  178. package/dist/chunk-REPKQAJK.mjs +0 -1
  179. package/dist/chunk-TMSGNHXH.mjs +0 -1
  180. package/dist/chunk-TVS2ZIAW.mjs +0 -1
  181. package/dist/chunk-UIADZXVT.mjs +0 -1
  182. package/dist/chunk-V7AOJQXQ.mjs +0 -1
  183. package/dist/chunk-WKQGWQ3P.mjs +0 -1
  184. package/dist/chunk-WPU4472Z.mjs +0 -1
  185. package/dist/chunk-WYQZ7DAK.mjs +0 -1
  186. package/dist/chunk-X6I6KQDG.mjs +0 -1
  187. package/dist/chunk-YMWXWXPV.mjs +0 -1
  188. package/dist/codex-note-context-GXC2474A.mjs +0 -1
  189. package/dist/codex-project-HVK7FSWQ.mjs +0 -1
  190. package/dist/codex-store-mount-KHTSSESB.mjs +0 -1
  191. package/dist/dev-server-QMA23NJQ.mjs +0 -1
  192. package/dist/participantBootstrap-BuTrTQbo.d.mts +0 -22
  193. package/dist/peer-client-JL754ZR7.mjs +0 -1
  194. package/dist/plain-html-EF7MUNRZ.mjs +0 -1
  195. package/dist/shared-page-QN2XRXUE.mjs +0 -1
  196. package/dist/steerStyles-E76E44PI.mjs +0 -1
  197. package/dist/taste-proposal-session-AAXK4CFL.mjs +0 -1
  198. package/infra/phone-pairing/README.md +0 -25
@@ -1 +1 @@
1
- import{a as m,b as p}from"./chunk-BD7DW4UK.mjs";import"./chunk-LUTP7QBD.mjs";import"./chunk-LLVF422C.mjs";import"./chunk-53QOGFAT.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-PQKSXNIZ.mjs";import"./chunk-K22VZV3V.mjs";import"./chunk-YMWXWXPV.mjs";import"./chunk-UIADZXVT.mjs";import"./chunk-6RC7JZ73.mjs";import"./chunk-NOHXTT24.mjs";export{m as participantPlanes,p as popmelt};
1
+ import{a as m,b as p}from"./chunk-AOFKEBLN.mjs";import"./chunk-WSI2SQWU.mjs";import"./chunk-LWPNOBGS.mjs";import"./chunk-4RQ5XD3I.mjs";import"./chunk-ITLRSHNZ.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-W5TNOJOR.mjs";import"./chunk-GLF7Z5IR.mjs";import"./chunk-KD2AOPYP.mjs";import"./chunk-KF73S7MG.mjs";import"./chunk-WWNI7JCA.mjs";import"./chunk-NOHXTT24.mjs";export{m as participantPlanes,p as popmelt};
@@ -0,0 +1,9 @@
1
+ type Provider = 'claude' | 'codex' | 'copilot' | 'omp' | 'opencode' | 'cursor';
2
+ /** Client-side envelope used for persisted and streaming bridge events. */
3
+ type BridgeEvent = {
4
+ type: string;
5
+ data: Record<string, unknown>;
6
+ timestamp: number;
7
+ };
8
+
9
+ export type { BridgeEvent as B, Provider as P };
package/dist/server.d.mts CHANGED
@@ -1,11 +1,16 @@
1
- import { a as ParticipantAgentAdapter, b as ParticipantCredential, P as PopmeltHandle, d as ParticipantPlaneApps, e as PopmeltOptions, f as PageFramework, N as NextBundlerFlag, G as GuestAppRequest, g as PeerSessions, h as PeerShape } from './page-planes-Jz2yR_Wk.mjs';
2
- export { i as ParticipantAgentView, j as createParticipantGuestAccess, c as createParticipantPlaneApps } from './page-planes-Jz2yR_Wk.mjs';
3
- import { P as ParticipantBootstrapConfig } from './participantBootstrap-BuTrTQbo.mjs';
1
+ import { a as ParticipantAgentAdapter, b as ParticipantCredential, P as PopmeltHandle, d as ParticipantPlaneApps, e as PopmeltOptions, f as PhoneApp, g as PageFramework, N as NextBundlerFlag, G as GuestAppRequest, h as PeerSessions, i as PeerShape } from './page-planes-BeFZ3Wso.mjs';
2
+ export { j as ParticipantAgentView, k as createParticipantGuestAccess, c as createParticipantPlaneApps } from './page-planes-BeFZ3Wso.mjs';
3
+ import { f as ParticipantBootstrapConfig } from './participantBootstrap-BcfNTEe9.mjs';
4
4
  import * as node_http from 'node:http';
5
5
  import { IncomingMessage, ServerResponse } from 'node:http';
6
6
  import { c as ImprintGraph, d as ImprintTransaction, e as ImprintMutation, f as ImprintContext, g as ImprintSummaryKind, h as ImprintExplanationKind, i as ImprintScope, j as ImprintTopologyRelationType, k as ImprintExplanationRef, I as ImprintThreadSummary, a as ImprintGroundingAction, l as ImprintRelation, Q as QualifiedImprintRelation } from './types-XKO-uva0.mjs';
7
7
  export { m as ImprintConcrete, n as ImprintEvidence, o as ImprintExplanation, p as ImprintExplanationState, q as ImprintRelationType } from './types-XKO-uva0.mjs';
8
8
  import 'vite';
9
+ import './protocol-BIUE4rB6.mjs';
10
+ import './PopmeltProvider-5g-1VH5a.mjs';
11
+ import 'react';
12
+ import './subjects-qHIrZrlt.mjs';
13
+ import './video-adapter-B5eap10v.mjs';
9
14
 
10
15
  /** One disposable, local Chrome profile per agent. Never attaches to a user's browser. */
11
16
  declare function managedParticipantBrowser(url: string): ParticipantAgentAdapter;
@@ -207,9 +212,14 @@ declare function parseImprintDraft(responseText: string, parseContext?: ImprintP
207
212
  visibleText: string;
208
213
  error?: string;
209
214
  };
215
+ type ImprintPromptSession = {
216
+ known: ReadonlyMap<string, string>;
217
+ sent: Record<string, string>;
218
+ };
210
219
  declare function formatImprintPrompt(context: ImprintContext | undefined, options?: {
211
220
  requestText?: string;
212
221
  delivery?: 'bridge' | 'ambient';
222
+ session?: ImprintPromptSession;
213
223
  }): string;
214
224
  declare class ImprintService {
215
225
  readonly store: ImprintStore;
@@ -259,6 +269,7 @@ declare function startDevelopmentSession(options: {
259
269
  projectRoot?: string;
260
270
  port?: number;
261
271
  devOrigin: string;
272
+ phoneApp?: PhoneApp;
262
273
  framework?: PageFramework;
263
274
  nextBundler?: NextBundlerFlag;
264
275
  readGuestApp?: (request: GuestAppRequest) => Promise<Response | undefined>;
package/dist/server.mjs CHANGED
@@ -1 +1 @@
1
- import{a as t,b as s,c as a}from"./chunk-CUVWMYUV.mjs";import"./chunk-OECEYJNK.mjs";import"./chunk-MPEVFQ43.mjs";import"./chunk-MHTX52KW.mjs";import{i as m,j as r,k as i,l as p}from"./chunk-DSTHM3V5.mjs";import"./chunk-PYGRFSUU.mjs";import"./chunk-6EO73WJN.mjs";import{a as n,b as o}from"./chunk-NC7YXD7Q.mjs";import"./chunk-KOHR4LAQ.mjs";import{b as c,d as e,e as u}from"./chunk-LLVF422C.mjs";import{b as j}from"./chunk-53QOGFAT.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-PQKSXNIZ.mjs";import"./chunk-K22VZV3V.mjs";import"./chunk-YMWXWXPV.mjs";import"./chunk-UIADZXVT.mjs";import"./chunk-NOHXTT24.mjs";export{p as ImprintService,m as ImprintStore,u as createParticipantDevBootstrap,c as createParticipantGuestAccess,e as createParticipantHostEntry,j as createParticipantPlaneApps,i as formatImprintPrompt,n as imprintExplanationRef,t as managedParticipantBrowser,r as parseImprintDraft,o as qualifyImprintRelation,a as startDevelopmentSession,s as startPopmelt};
1
+ import{a as t,b as s,c as m}from"./chunk-XHTSKQMB.mjs";import"./chunk-VJKC2RJB.mjs";import"./chunk-PCUUOIFD.mjs";import"./chunk-YHCZYT4T.mjs";import{i as a,j as r,k as i,l as p}from"./chunk-TA2BMDSC.mjs";import"./chunk-ALWPAFIW.mjs";import"./chunk-BSVZXOOS.mjs";import"./chunk-7OATJ6BO.mjs";import{a as n,b as o}from"./chunk-NC7YXD7Q.mjs";import"./chunk-KOHR4LAQ.mjs";import{b as c,d as e,e as u}from"./chunk-4RQ5XD3I.mjs";import{b as j}from"./chunk-ITLRSHNZ.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-W5TNOJOR.mjs";import"./chunk-GLF7Z5IR.mjs";import"./chunk-KD2AOPYP.mjs";import"./chunk-KF73S7MG.mjs";import"./chunk-NOHXTT24.mjs";export{p as ImprintService,a as ImprintStore,u as createParticipantDevBootstrap,c as createParticipantGuestAccess,e as createParticipantHostEntry,j as createParticipantPlaneApps,i as formatImprintPrompt,n as imprintExplanationRef,t as managedParticipantBrowser,r as parseImprintDraft,o as qualifyImprintRelation,m as startDevelopmentSession,s as startPopmelt};
@@ -0,0 +1 @@
1
+ import{c as a,d as r}from"./chunk-YHCZYT4T.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-KF73S7MG.mjs";export{r as createSharedPageReader,a as sharedPagePath};
@@ -0,0 +1 @@
1
+ import{a as e,b as t,c as r,d as s,e as a,f as d,g as i}from"./chunk-ALWPAFIW.mjs";export{e as groupSteerEdits,t as mergeOptionEdits,a as readSteerEdit,s as readSteerEdits,d as readSteerStyle,r as stylesForEdits,i as withSteerDrafts};
@@ -0,0 +1 @@
1
+ import{a as s,b as a,c as o,d as r,e,f as C,g as t,h as l,i as S,j as i,k as c}from"./chunk-AET77LFV.mjs";export{o as STICKER_COLOR_DEFAULT_STEP,r as STICKER_COLOR_FALLBACK,s as STICKER_COLOR_NAMES,a as STICKER_COLOR_STEPS,C as cycleStickerColorName,S as nearestStickerColor,i as nearestStickerColorStep,t as stickerColorNameAtPosition,l as stickerColorRailDelta,e as stickerColorValue,c as stickerColorsEqual};
@@ -0,0 +1 @@
1
+ import{a as t,b as r,e,j as i,k as n}from"./chunk-AET77LFV.mjs";var o=["padding","margin","border","radius","stack","grid","text","color","transform","opacity"],l=[0,1,2,3,4,6,8,10,12,16],a=[-16,-12,-10,-8,-6,-4,-3,-2,-1,0,1,2,3,4,6,8,10,12,16],s=["vertical","horizontal"],u=["stretch","start","center","end","baseline"],c=["start","center","end","between","around","evenly"],d=[1,2,3,4,5,6],f=["xs","sm","base","lg","xl","2xl","3xl","4xl"],g=[300,400,500,600,700,800],p=["none","tight","snug","normal","relaxed","loose"],m=["tighter","tight","normal","wide","wider","widest"],b=["left","center","right","justify"],h=[25,50,75,90,95,100,105,110,125,150],x=[-180,-90,-45,-25,-12,-6,-3,-2,-1,0,1,2,3,6,12,25,45,90,180],y=[0,5,10,20,25,30,40,50,60,70,75,80,90,95,100],w=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$={padding:l,margin:l,border:[0,1,2,4,8],radius:l},k={padding:"p",margin:"m",border:"border",radius:"rounded",stack:"flex",grid:"grid",text:"text",color:"text",transform:"transform",opacity:"opacity"},S={padding:"P",margin:"M",border:"B",radius:"R",stack:"F",grid:"G",text:"FO",color:"BG",transform:"T",opacity:"O"},C={padding:"Padding",margin:"Margin",border:"Borders",radius:"Radii",stack:"Flexbox",grid:"Grid",text:"Fonts",color:"Background",transform:"Transform",opacity:"Opacity"},v={padding:["all","x","y","top","right","bottom","left"],margin:["all","x","y","top","right","bottom","left"],border:["all","top","right","bottom","left","color"],radius:["all","top-left","top-right","bottom-right","bottom-left"],stack:["direction","gap","align","justify"],grid:["gap","rows","columns"],text:["size","weight","line-height","letter-spacing","text-align","color"],color:t,transform:["translate","scale","rotate"],opacity:["opacity","mix-blend"]},F={all:"",x:"X",y:"Y",top:"T",right:"R",bottom:"B",left:"L","top-left":"TL","top-right":"TR","bottom-right":"BR","bottom-left":"BL",vertical:"V",horizontal:"H",direction:"D",gap:"G",align:"A",justify:"J",rows:"R",columns:"C",size:"S",weight:"W","line-height":"H","letter-spacing":"L","text-align":"A",color:"C",translate:"T",scale:"S",rotate:"R",opacity:"O","mix-blend":"B"};function N(r){return t.includes(r)}function L(t,r){return"color"===t||("text"===t||"border"===t)&&("color"===r||N(r))}var z=t=>encodeURIComponent(t),E=t=>`%3Cdefs%3E%3Cfilter id='cursor-shadow' x='-35%25' y='-35%25' width='170%25' height='180%25'%3E%3CfeDropShadow dx='0' dy='.5' stdDeviation='.35' flood-color='black' flood-opacity='.22'/%3E%3CfeDropShadow dx='0' dy='.75' stdDeviation='.65' flood-color='${z(t)}' flood-opacity='.42'/%3E%3CfeDropShadow dx='0' dy='1.25' stdDeviation='1.1' flood-color='${z(t)}' flood-opacity='.24'/%3E%3C/filter%3E%3C/defs%3E`;function M(t="black"){return`url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='-3 -3 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E${E(t)}%3Cpath filter='url(%23cursor-shadow)' d='M5.19194 14.2778L0.732307 2.01384C0.442115 1.21582 1.21582 0.442116 2.01384 0.732307L14.2778 5.19194C15.7506 5.72748 15.5191 7.87826 13.9661 8.08812L10.298 8.58381C9.40594 8.70436 8.70436 9.40594 8.58381 10.298L8.08812 13.9661C7.87826 15.5191 5.72748 15.7506 5.19194 14.2778Z' fill='${z(t)}' stroke='white' stroke-width='1.25'/%3E%3C/svg%3E") 4 4, pointer`}function B(t="black"){return`url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='-3 -3 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E${E(t)}%3Cpath transform='scale(1.125)' filter='url(%23cursor-shadow)' d='M1 8V2C1 1.44772 1.44772 1 2 1H8C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8Z' fill='${z(t)}' stroke='white' stroke-width='1.111'/%3E%3C/svg%3E") 4 4, pointer`}var R=M(),T=B();function j(t,e="all"){let i=P(t,e);return"color"===t||("text"===t||"border"===t)&&L(t,i)?r:"stack"===t?"direction"===i?s:"align"===i?u:"justify"===i?c:l:"grid"===t?"gap"===i?l:d:"text"===t?"weight"===i?g:"line-height"===i?p:"letter-spacing"===i?m:"text-align"===i?b:f:"transform"===t?"scale"===i?h:"rotate"===i?x:a:"opacity"===t?"mix-blend"===i?w:y:$[t]}function O(t,r,e="all"){let i=j(t,e);if(i.includes(r))return r;if("number"!=typeof r)return i[0];let n=i.filter(t=>"number"==typeof t);return 0===n.length?i[0]:n.reduce((t,e)=>Math.abs(e-r)<Math.abs(t-r)?e:t)}function A(t){return v[t]}function P(t,r){if("stack"===t&&("vertical"===r||"horizontal"===r))return"direction";if(("text"===t||"border"===t)&&N(r))return r;let e=A(t);return e.includes(r)?r:e[0]}function D(t,r){return"text"===t?"size":"transform"===t?"translate":"opacity"===t?"opacity":P(t,r)}function V(t,r,e){return"family"===t?"family":"text"!==r&&"border"!==r||"color"!==e?"value":"variant"}function G(t,r,e){let i=A(t),n="text"!==t&&"border"!==t||!N(r)?P(t,r):"color",o=i.indexOf(n);return i[(o+e+i.length)%i.length]}function H(t,r){let e=o.indexOf(t);return o[(e+r+o.length)%o.length]}function I(t,r,e,i="all"){let n=j(t,i),o=O(t,r,i),l=n.indexOf(o);return n[(l+e+n.length)%n.length]}function U(t){return[H(t,-1),t,H(t,1)]}function W(t,r,e="all"){let i=O(t,r,e);return[I(t,i,-1,e),i,I(t,i,1,e)]}function K(t){return S[t]}function _(t){return C[t]}function Z(t,r){let e=P(t,r);return"color"===t||("text"===t||"border"===t)&&N(e)?e:`${K(t)}${F[e]}`}function J(t,r){let e=P(t,r);return"color"===t||("text"===t||"border"===t)&&N(e)?e[0].toUpperCase()+e.slice(1):"text"===t?"size"===e?"Size":"weight"===e?"Weight":"line-height"===e?"Leading":"letter-spacing"===e?"Tracking":"text-align"===e?"Align":"Color":"border"===t&&"color"===e?"Color":"transform"===t?"translate"===e?"translate":e:"opacity"===t?"mix-blend"===e?"mix-blend-mode":"opacity":"all"===e?_(t):F[e]}function X(t,r){let e=P(t,r);if("color"===t)return"background-color";if("stack"===t)return"direction"===e?"flex-direction":"align"===e?"align-items":"justify"===e?"justify-content":"gap";if("grid"===t)return"rows"===e?"grid-template-rows":"columns"===e?"grid-template-columns":"gap";if("text"===t)return"color"===e||N(e)?"color":"weight"===e?"font-weight":"line-height"===e?"line-height":"letter-spacing"===e?"letter-spacing":"text-align"===e?"text-align":"font-size";if("border"===t&&("color"===e||N(e)))return"border-color";if("transform"===t)return e;if("opacity"===t)return"mix-blend"===e?"mix-blend-mode":"opacity";if("radius"===t)return"all"===e?"border-radius":`border-${e}-radius`;let i="border"===t?"border":t,n="border"===t?"width":"";return"all"===e?n?`${i}-${n}`:i:"padding"!==t&&"margin"!==t||"x"!==e?"padding"!==t&&"margin"!==t||"y"!==e?n?`${i}-${e}-${n}`:`${i}-${e}`:`${i}-top`:`${i}-left`}function Y(t,r){let e=P(t,r);return"color"===t?["background-color"]:"stack"===t||"grid"===t?"gap"===e?["row-gap","column-gap"]:[X(t,e)]:"text"===t?"color"===e||N(e)?["color"]:"line-height"===e||"letter-spacing"===e?[X(t,e),"font-size"]:[X(t,e)]:"border"!==t||"color"!==e&&!N(e)?"transform"===t||"opacity"===t?[X(t,e)]:"padding"!==t&&"margin"!==t||"x"!==e?"padding"!==t&&"margin"!==t||"y"!==e?"all"!==e?[X(t,e)]:"radius"===t?["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"]:"border"===t?["border-top-width","border-right-width","border-bottom-width","border-left-width"]:[`${t}-top`,`${t}-right`,`${t}-bottom`,`${t}-left`]:[`${t}-top`,`${t}-bottom`]:[`${t}-left`,`${t}-right`]:["border-top-color","border-right-color","border-bottom-color","border-left-color"]}function q(t,r){let e=t.trim().toLowerCase();if(("stack"===r||"grid"===r)&&"normal"===e)return 0;let i=e.split(/[\s/]+/).filter(Boolean);if(0===i.length)return null;let n=i.map(t=>{if(/^0(?:\.0+)?$/.test(t))return 0;let r=t.match(/^(-?\d+(?:\.\d+)?)px$/);return r?Number(r[1]):Number.NaN});return n.some(t=>!Number.isFinite(t))?null:n.every(t=>Math.abs(t-n[0])<.01)?n[0]:null}function Q(t,r,e){let i=e.trim().toLowerCase();if("text"===t){if("size"===r){let r=q(e,t);return null===r?null:pt(f,t=>ct[t],r)}if("weight"===r){if("normal"===i)return 400;if("bold"===i)return 700;let t=Number(i);return Number.isFinite(t)?pt(g,t=>t,t):null}if("text-align"===r)return"start"===i?"left":"end"===i?"right":b.includes(i)?i:null}if("transform"===t){if("none"===i)return"scale"===r?100:0;if("translate"===r){let r=q(e,t);return null===r?null:pt(l,t=>4*t,r)}if("scale"===r){let t=100*Number.parseFloat(e);return Number.isFinite(t)?pt(h,t=>t,t):null}if("rotate"===r){let t=Number.parseFloat(e);return Number.isFinite(t)?pt(x,t=>t,t):null}}if("opacity"===t){if("mix-blend"===r)return w.includes(i)?i:null;let t=100*Number.parseFloat(e);return Number.isFinite(t)?pt(y,t=>t,t):null}if("stack"!==t)return null;if("direction"===r){if("column"===i||"column-reverse"===i)return"vertical";if("row"===i||"row-reverse"===i)return"horizontal"}if("align"===r){if("flex-start"===i||"start"===i)return"start";if("center"===i)return"center";if("flex-end"===i||"end"===i)return"end";if("stretch"===i)return"stretch";if("baseline"===i)return"baseline"}if("justify"===r){if("flex-start"===i||"start"===i)return"start";if("center"===i)return"center";if("flex-end"===i||"end"===i)return"end";if("space-between"===i)return"between";if("space-around"===i)return"around";if("space-evenly"===i)return"evenly"}return null}function tt(t,r,o="all"){let l=P(t,o);if("color"===t||("text"===t||"border"===t)&&N(l)){let t=i(l,r[0]??"");if(null===t)return null;let o=e(l,t);return r.every(t=>n(t,o))?t:null}if("text"===t){if("line-height"===l&&"normal"===(r[0]??"").trim().toLowerCase())return"normal";if("line-height"===l){let e=q(r[0]??"",t),i=q(r[1]??"",t);return null===e||null===i||0===i?null:pt(p,t=>ft[t],e/i)}if("letter-spacing"===l){let e=(r[0]??"").trim().toLowerCase();if("normal"===e)return"normal";let i=q(e,t),n=q(r[1]??"",t);return null===i||null===n||0===n?null:pt(m,t=>gt[t],i/n)}return Q(t,l,r[0]??"")}if("transform"===t||"opacity"===t||"stack"===t&&"gap"!==l)return Q(t,l,r[0]??"");if("grid"===t&&"gap"!==l){let t=r[0]?.trim().split(/\s+/).filter(Boolean).length??0;return j("grid",l).includes(t)?t:null}let a=r.map(r=>q(r,t));if(0===a.length||a.some(t=>null===t))return null;let s=a[0];if(!a.every(t=>Math.abs(t-s)<.01))return null;let u=j(t,l).filter(t=>"number"==typeof t);return 0===u.length?null:u.reduce((r,e)=>Math.abs(Number.parseFloat(lt(t,e,l))-s)<Math.abs(Number.parseFloat(lt(t,r,l))-s)?e:r)}function rt(t,r,i,o="all"){let l=P(t,o);if("color"===t||("text"===t||"border"===t)&&N(l)){let t=e(l,r);return i.length>0&&i.every(r=>n(r,t))}if("text"===t){if("size"===l){let e=q(i[0]??"",t);return null!==e&&Math.abs(e-ct[r])<.01}if("weight"===l)return Q(t,l,i[0]??"")===r;if("line-height"===l){let e=(i[0]??"").trim().toLowerCase();if("normal"===e)return"normal"===r;let n=q(e,t),o=q(i[1]??"",t);return null!==n&&null!==o&&0!==o&&Math.abs(n/o-ft[r])<.01}if("letter-spacing"===l){let e=(i[0]??"").trim().toLowerCase();if("normal"===e)return"normal"===r;let n=q(e,t),o=q(i[1]??"",t);return null!==n&&null!==o&&0!==o&&Math.abs(n/o-gt[r])<.001}return Q(t,l,i[0]??"")===r}if("transform"===t||"opacity"===t||"stack"===t&&"gap"!==l)return Q(t,l,i[0]??"")===r;if("grid"===t&&"gap"!==l)return(i[0]?.trim().split(/\s+/).filter(Boolean).length??0)===r;if("number"!=typeof r)return!1;let a=Number.parseFloat(lt(t,r,l)),s=i.map(r=>q(r,t));return s.length>0&&s.every(t=>null!==t&&Math.abs(t-a)<.01)}function et(t,r,e,i){let n=rt(t,r,Y(t,e).map(i),e),o=ut(t),l=at(t,e,r).every(t=>i(t.property).trim()===t.value),a="border"===t&&!L(t,e)&&"number"==typeof r&&r>0?it(e):null,s=!a||!["","none"].includes(i(a).trim());return n&&(!o||i("display").trim()===o)&&l&&s}function it(t){let r=P("border",t);return"all"===r?"border-style":`border-${r}-style`}function nt(t){return"color"===t?"background-color":"border"===t?"border-top-color":"color"}function ot(t,r,e){let i=P(t,e);if("color"===t)return`bg-${i}-${r}`;if("stack"===t)return"direction"===i?"horizontal"===r?"flex-row":"flex-col":"gap"===i?`gap-${r}`:"align"===i?`items-${r}`:`justify-${r}`;if("grid"===t)return"gap"===i?`gap-${r}`:`${"rows"===i?"grid-rows":"grid-cols"}-${r}`;if("text"===t)return N(i)?`text-${i}-${r}`:"size"===i?`text-${r}`:"weight"===i?dt[r]:"line-height"===i?`leading-${r}`:"letter-spacing"===i?`tracking-${r}`:`text-${r}`;if("border"===t&&N(i))return`border-${i}-${r}`;if("transform"===t)return`${i}-${r}`;if("opacity"===t)return"mix-blend"===i?`mix-blend-${r}`:`opacity-${r}`;let n=k[t];if("all"===i)return`${n}-${r}`;let o="top-left"===i?"tl":"top-right"===i?"tr":"bottom-right"===i?"br":"bottom-left"===i?"bl":i[0];return"padding"===t||"margin"===t?`${n}${o}-${r}`:`${n}-${o}-${r}`}function lt(t,r,i="all"){let n=P(t,i);if("color"===t||("text"===t||"border"===t)&&N(n))return e(n,r);if("stack"===t){if("direction"===n)return"horizontal"===r?"row":"column";if("align"===n)return"start"===r?"flex-start":"end"===r?"flex-end":String(r);if("justify"===n)return"start"===r?"flex-start":"end"===r?"flex-end":"between"===r||"around"===r||"evenly"===r?`space-${r}`:String(r)}return"grid"===t&&"gap"!==n?`repeat(${r}, minmax(0, 1fr))`:"text"===t?"size"===n?`${ct[r]}px`:"weight"===n?String(r):"line-height"===n?String(ft[r]):"letter-spacing"===n?`${gt[r]}em`:String(r):"transform"===t?"scale"===n?String(Number(r)/100):"rotate"===n?`${r}deg`:`${4*Number(r)}px ${4*Number(r)}px`:"opacity"===t?String("mix-blend"===n?r:Number(r)/100):"number"!=typeof r?"0px":`${"border"===t?r:4*r}px`}function at(t,r,e){let i=P(t,r);return"padding"!==t&&"margin"!==t||"x"!==i&&"y"!==i?[]:[{property:"x"===i?`${t}-right`:`${t}-bottom`,value:lt(t,e??0,i),token:ot(t,e??0,i)}]}function st(t,r,e){if("text"===r&&("size"===e||"all"===e))return String(ct[t]);if("text"===r&&"line-height"===e){let r=ft[t];return String(Number(r.toFixed(1)))}if("text"===r&&"letter-spacing"===e){let r=gt[t];return String(Number(r.toFixed(2))).replace(/^(-?)0\./,"$1.")}return"number"==typeof t?String(t):"vertical"===t?"V":"horizontal"===t?"H":"start"===t?"S":"center"===t?"C":"end"===t?"E":"stretch"===t?"ST":"baseline"===t?"BL":"between"===t?"BT":"around"===t?"AR":"EV"}function ut(t){return"stack"===t?"flex":"grid"===t?"grid":null}var ct={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36},dt={300:"font-light",400:"font-normal",500:"font-medium",600:"font-semibold",700:"font-bold",800:"font-extrabold"},ft={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},gt={tighter:-.05,tight:-.025,normal:0,wide:.025,wider:.05,widest:.1};function pt(t,r,e){return t.reduce((t,i)=>Math.abs(r(i)-e)<Math.abs(r(t)-e)?i:t)}export{T as COMMENT_CURSOR,R as POPMELT_CURSOR,o as STICKER_FAMILIES,B as commentCursor,H as cycleStickerFamily,I as cycleStickerStep,G as cycleStickerSubproperty,N as isStickerColorName,L as isStickerColorPath,rt as isStickerStepApplied,et as isStickerStyleSetApplied,O as normalizeStickerStep,P as normalizeStickerSubproperty,M as popmeltCursor,it as stickerBorderStyleProperty,nt as stickerColorProperty,at as stickerCompanionStyles,Y as stickerComputedProperties,ut as stickerDisplayValue,K as stickerFamilyKey,_ as stickerFamilyLabel,U as stickerFamilyWindow,X as stickerProperty,V as stickerStageAfterFacetChange,tt as stickerStepFromCssValues,st as stickerStepLabel,W as stickerStepWindow,j as stickerStepsForFamily,A as stickerSubpropertiesForFamily,D as stickerSubpropertyForFamilyEntry,Z as stickerSubpropertyKey,J as stickerSubpropertyLabel,ot as stickerToken,lt as stickerValue};
@@ -25,6 +25,19 @@ type CanvasSampleCodec = {
25
25
  };
26
26
  };
27
27
  };
28
+ type CanvasSample = {
29
+ subject?: {
30
+ adapter: string;
31
+ key: string;
32
+ canvasSelector: string;
33
+ inserted?: true;
34
+ label?: string;
35
+ };
36
+ pathname: string;
37
+ selector: string;
38
+ format: string;
39
+ value: string;
40
+ };
28
41
 
29
42
  type ComponentSample = {
30
43
  version: string;
@@ -123,6 +136,8 @@ type ToolType = (typeof TOOL_TYPES)[number];
123
136
  declare const LEGACY_ANNOTATION_TYPES: readonly ["freehand", "line", "rectangle", "circle"];
124
137
  type LegacyAnnotationType = (typeof LEGACY_ANNOTATION_TYPES)[number];
125
138
  type AnnotationType = LegacyAnnotationType | 'text';
139
+ /** @internal Retired modes retained temporarily while their dead paths are removed. */
140
+ type InteractionMode = ToolType | LegacyAnnotationType | 'hand';
126
141
  type Point = {
127
142
  x: number;
128
143
  y: number;
@@ -440,6 +455,47 @@ type Annotation = {
440
455
  attachments?: AnnotationAttachment[];
441
456
  interactionEpisode?: InteractionEpisode;
442
457
  };
458
+ /** A token modification tracked for undo/redo. Stores enough to revert both
459
+ * the model.json value and DOM inline style overrides. */
460
+ type SpacingTokenMod = {
461
+ tokenPath: string;
462
+ originalValue: string;
463
+ currentValue: string;
464
+ targets: Array<{
465
+ selector: string;
466
+ property: string;
467
+ }>;
468
+ originalPx: number;
469
+ currentPx: number;
470
+ captured?: boolean;
471
+ };
472
+ type UndoEntry = {
473
+ canvasSamples?: CanvasSample[];
474
+ textEditSessionId?: string;
475
+ annotations: Annotation[];
476
+ styleModifications: StyleModification[];
477
+ textModifications: TextModification[];
478
+ domModifications: DomModification[];
479
+ spacingTokenChanges: SpacingTokenChange[];
480
+ spacingTokenMods: SpacingTokenMod[];
481
+ };
482
+ type AnnotationState = {
483
+ canvasSamples?: CanvasSample[];
484
+ isAnnotating: boolean;
485
+ activeTool: InteractionMode;
486
+ activeColor: string;
487
+ strokeWidth: number;
488
+ annotations: Annotation[];
489
+ undoStack: UndoEntry[];
490
+ redoStack: UndoEntry[];
491
+ selectedAnnotationIds: string[];
492
+ lastSelectedId: string | null;
493
+ styleModifications: StyleModification[];
494
+ textModifications: TextModification[];
495
+ domModifications: DomModification[];
496
+ spacingTokenChanges: SpacingTokenChange[];
497
+ spacingTokenMods: SpacingTokenMod[];
498
+ };
443
499
  type BridgeStatus = {
444
500
  ok: boolean;
445
501
  activeJob: {
@@ -569,4 +625,4 @@ type PopmeltSubjectAdapter = {
569
625
  removeSubject?(key: string): void;
570
626
  };
571
627
 
572
- export type { Annotation as A, BridgeStatus as B, CanvasSampleCodec as C, DomModification as D, ElementInfo as E, ImageObjectContext as I, OpaqueTargetReference as O, PopmeltSubjectAdapter as P, ReactSourceLocation as R, SubjectFeedbackAttachment as S, TextModification as T, VideoObjectContext as V, PopmeltSubjectBounds as a, PopmeltSubject as b, PopmeltSubjectCreationSession as c, PopmeltSubjectOutlinePoint as d, PopmeltSubjectTrackingAnchor as e, AnnotationAttachment as f, StyleModification as g, SpacingTokenChange as h, AnnotationRegion as i, AnnotationType as j, ClaudeResponse as k, Point as l, PopmeltSurfaceSnapshot as m, StyleChange as n, ToolType as o };
628
+ export type { Annotation as A, BridgeStatus as B, CanvasSampleCodec as C, DomModification as D, ElementInfo as E, ImageObjectContext as I, OpaqueTargetReference as O, PopmeltSubjectAdapter as P, ReactSourceLocation as R, SubjectFeedbackAttachment as S, TextModification as T, VideoObjectContext as V, PopmeltSubjectBounds as a, PopmeltSubject as b, PopmeltSubjectCreationSession as c, PopmeltSubjectOutlinePoint as d, PopmeltSubjectTrackingAnchor as e, AnnotationAttachment as f, StyleModification as g, SpacingTokenChange as h, AnnotationRegion as i, AnnotationType as j, ClaudeResponse as k, Point as l, PopmeltSurfaceSnapshot as m, StyleChange as n, ToolType as o, StickerFamily as p, StickerSubproperty as q, AnnotationState as r };
@@ -0,0 +1 @@
1
+ import{a,b as t,c as r,d as s,e as n,f as e,g as o,h as i,i as p,j as C,k as c,l as f}from"./chunk-7VIC4MGC.mjs";export{n as constraintLinkError,a as createTasteDraft,o as formatConstraint,c as inferConstraintDerivative,i as parseConstraintStep,s as parseConstraintValue,p as parseReferenceOpacity,e as resolveConstraint,C as resolveConstraintStep,t as typographyRoleConstraints,f as unlinkConstraint,r as withTypographyGroup};
@@ -0,0 +1 @@
1
+ import{e}from"./chunk-32BKJ5JN.mjs";var t=e=>!!e&&"object"==typeof e&&!Array.isArray(e),r=(e,t=512)=>"string"==typeof e&&e.length<=t,i=e=>r(e,100)&&/^[a-zA-Z0-9_-]+$/.test(e),n=e=>r(e,4096)&&![...e].some(e=>e.charCodeAt(0)<9)&&!/[;{}<>]|\b(?:url|expression|javascript)\s*[:(]/i.test(e),a=(e,t)=>Object.keys(e).every(e=>t.includes(e)),o=(e,t)=>new Set(e.map(e=>e[t])).size===e.length,s=new Set("display boxSizing width height flexDirection flexWrap alignItems justifyContent alignSelf flexGrow flexShrink gridTemplateColumns rowGap columnGap gap padding paddingInline paddingBlock border borderRadius paddingTop paddingRight paddingBottom paddingLeft marginTop marginRight marginBottom marginLeft borderTop borderRight borderBottom borderLeft borderColor borderWidth borderTopLeftRadius borderTopRightRadius borderBottomLeftRadius borderBottomRightRadius color backgroundColor backgroundImage boxShadow opacity fontFamily fontSize fontWeight fontStyle lineHeight letterSpacing textAlign textTransform textDecoration whiteSpace overflow fill stroke strokeWidth strokeLinecap strokeLinejoin objectFit".split(" ")),d=new Set("div span img svg path circle rect line polyline polygon ellipse g".split(" ")),l=new Set("src alt viewBox d cx cy r x y x1 x2 y1 y2 rx ry width height points preserveAspectRatio transform fillRule clipRule".split(" "));function g(e,t){if(!r(e,2048)||/[\s\\<>"'`]/.test(e)||!/^(?:\.\/|https?:\/\/)/i.test(e))return null;try{let r=new URL(e,t);return!/^(http|https):$/.test(r.protocol)||r.username||r.password||r.hash?null:r}catch{return null}}function u(e){return Array.isArray(e)&&e.length<=64&&e.every(e=>t(e)&&a(e,["family","src","weight","style","unicodeRange","ascentOverride","descentOverride","lineGapOverride"])&&"string"==typeof e.family&&e.family.length<=100&&/^[\p{L}\p{N} _.-]+$/u.test(e.family)&&!!e.family.trim()&&"string"==typeof e.src&&!!g(e.src,"https://bundle.invalid/taste.json")&&Array.isArray(e.weight)&&2===e.weight.length&&e.weight.every(e=>"number"==typeof e&&Number.isFinite(e)&&e>=1&&e<=1e3)&&e.weight[0]<=e.weight[1]&&["normal","italic","oblique"].includes(String(e.style))&&(void 0===e.unicodeRange||r(e.unicodeRange,1024)&&/^U\+[\dA-F?]{1,6}(?:-[\dA-F]{1,6})?(?:,\s*U\+[\dA-F?]{1,6}(?:-[\dA-F]{1,6})?)*$/i.test(e.unicodeRange))&&[e.ascentOverride,e.descentOverride,e.lineGapOverride].every(e=>void 0===e||r(e,12)&&/^\d+(?:\.\d+)?%$/.test(e)))}function c(e,r){if(!t(e)||!a(e,["outsideSlots","slots"])||"omit"!==e.outsideSlots||!Array.isArray(e.slots)||e.slots.length>128)return!1;let n=new Set;for(let o of e.slots){if(!(t(o)&&a(o,["fragmentId","nodeId","kind"])&&i(o.fragmentId)&&i(o.nodeId)&&r.get(o.fragmentId)?.has(o.nodeId)&&["illustration","brand-mark","control-icon"].includes(String(o.kind))))return!1;let e=o.fragmentId+"/"+o.nodeId;if(n.has(e))return!1;n.add(e)}return!0}function p(e){return Array.isArray(e)?"["+e.map(p).join(",")+"]":t(e)?"{"+Object.keys(e).sort().map(t=>JSON.stringify(t)+":"+p(e[t])).join(",")+"}":JSON.stringify(e)}function y(g){try{if(!t(g)||!a(g,["format","schemaVersion","draft"])||"popmelt.taste.graph"!==g.format||1!==g.schemaVersion||(new TextEncoder).encode(JSON.stringify(g)).byteLength>512e3)return!1;let p=g.draft;if(!t(p)||!a(p,["schemaVersion","name","constraints","tokens","usage","fragments","featuredComponentId","fontFaces","layouts","artwork"])||void 0!==p.fontFaces&&!u(p.fontFaces)||1!==p.schemaVersion||!r(p.name,80)||!p.name.trim()||!Array.isArray(p.constraints)||p.constraints.length<1||p.constraints.length>32||!p.constraints.every(e=>t(e)&&a(e,["id","name","kind","group","typographyRole","scaleMode","value","parentId","derivative","scale"])&&i(e.id)&&r(e.name,80)&&(void 0===e.group||"typography"===e.group)&&(void 0===e.typographyRole||"body"===e.typographyRole||"heading"===e.typographyRole)&&["layout","color","font"].includes(String(e.kind))&&n(e.value)&&(null===e.parentId||i(e.parentId))&&Number.isFinite(e.derivative)&&Number.isFinite(e.scale)&&"number"==typeof e.scale&&e.scale>=0&&(void 0===e.scaleMode||"increment"===e.scaleMode))||!o(p.constraints,"id"))return!1;let y=new Map(p.constraints.map(e=>[String(e.id),e]));for(let e of p.constraints){let t=new Set,r=e;for(;null!==r.parentId;){if(t.has(r.id))return!1;t.add(r.id);let e=y.get(r.parentId);if(!e||e.kind!==r.kind)return!1;r=e}if(!r.value.trim())return!1}let m=e=>Array.isArray(e)&&e.length<=128&&e.every(e=>t(e)&&a(e,["id","name","value"])&&i(e.id)&&i(e.name)&&n(e.value)&&e.value.trim()&&[...e.value.matchAll(/@([a-zA-Z0-9_-]+)/g)].every(e=>y.has(e[1])))&&o(e,"id")&&o(e,"name");if(!m(p.tokens))return!1;let h=p.tokens,f=(e,r)=>t(e)&&a(e,["kind","id","step"])&&("dimension"===e.kind?y.has(String(e.id)):"token"===e.kind&&r.some(t=>t.id===e.id))&&(void 0===e.step||"number"==typeof e.step&&Number.isInteger(e.step)&&Math.abs(e.step)<=100);if(void 0!==p.usage&&(!Array.isArray(p.usage)||p.usage.length>256||!p.usage.every(e=>t(e)&&a(e,["target","property","source"])&&["page","heading","body","muted","card","button","input"].includes(String(e.target))&&s.has(String(e.property))&&f(e.source,h))))return!1;let v=p.fragments??[];if(!Array.isArray(v)||v.length>32||!o(v,"id")||void 0!==p.layouts&&!e(p.layouts,new Set(v.map(e=>String(e.id)))))return!1;let b=new Map;for(let e of v){if(!(t(e)&&a(e,["id","name","width","height","root","tokens","guidance"])&&i(e.id)&&r(e.name,80)&&e.name.trim()&&(void 0===e.guidance||r(e.guidance,1200)&&e.guidance.trim())&&[e.width,e.height].every(e=>"number"==typeof e&&Number.isFinite(e)&&e>0&&e<=2e4)&&m(e.tokens??[])))return!1;let g=e.tokens??[];if(!m(g))return!1;let u=[...h,...g];if(!o(u,"id")||!o(u,"name"))return!1;let c=new Set,y=0,v=(e,o)=>"string"==typeof e?e.length<=1e4:!(!t(e)||!a(e,["id","tag","styles","localStyles","attributes","children"])||!i(e.id)||c.has(e.id)||++y>256||o>16||!d.has(String(e.tag))||!t(e.styles)||!Array.isArray(e.children)||e.children.length>256||(c.add(e.id),!Object.entries(e.styles).every(([e,t])=>s.has(e)&&f(t,u)))||!(void 0===e.localStyles||t(e.localStyles)&&Object.entries(e.localStyles).every(([e,t])=>s.has(e)&&n(t)))||!(void 0===e.attributes||t(e.attributes)&&Object.entries(e.attributes).every(([e,t])=>l.has(e)&&r(t,2e4)&&("src"!==e||/^https:\/\//.test(t)))))&&e.children.every(e=>v(e,o+1));if(!v(e.root,0))return!1;void 0!==p.artwork&&b.set(e.id,c)}return!(void 0!==p.artwork&&!c(p.artwork,b))&&(null==p.featuredComponentId||v.some(e=>e.id===p.featuredComponentId))}catch{return!1}}export{p as canonicalTasteJson,g as resolveTasteFontSource,c as validTasteArtwork,y as validTasteDocument,u as validTasteFontFaces};
@@ -0,0 +1 @@
1
+ import{m as a,n as s,o as e,p as t,q as r,r as m,s as n,t as g,u,v as o,w as F,x as f}from"./chunk-6OPX4CUT.mjs";import"./chunk-H3T2O3HA.mjs";import"./chunk-7VIC4MGC.mjs";export{a as FRAGMENT_PROPERTIES,t as fragmentDraft,o as fragmentNodeStyle,u as fragmentStyleValue,r as isFragmentGeometry,e as isFragmentStructure,s as normalizeFragmentStructure,F as parseTasteFragment,n as safeFragmentImage,m as safeFragmentValue,f as tasteFragmentPrompt,g as validateFragmentRequest};
@@ -0,0 +1 @@
1
+ import{a as e,b as n,c as t,p as i,u as s}from"./chunk-6OPX4CUT.mjs";import"./chunk-H3T2O3HA.mjs";import{f as r,g as a}from"./chunk-7VIC4MGC.mjs";function d(n,t){t=i(t,n);let d=new Map,o=e=>{let n=t.constraints.find(n=>n.id===e);return n?n.parentId?`@${t.constraints.find(e=>e.id===n.parentId)?.name??n.parentId}${"font"===n.kind?"":"color"===n.kind?` · hue ${n.derivative}°`:` × ${n.derivative}`}`:n.value:"Missing dimension"},u=n=>{let i=n.children.filter(e=>"string"==typeof e).join(" ").trim();for(let[u,l]of Object.entries(n.styles)){let c=`${l.kind}:${l.id}:${l.step??0}`,p=d.get(c);if(!p){let n="token"===l.kind?t.tokens.find(e=>e.id===l.id):void 0,i="dimension"===l.kind?t.constraints.find(e=>e.id===l.id):void 0,s=[],u=new Set("dimension"===l.kind?[l.id]:[]),m=e=>{if(u.has(e))return;u.add(e);let n=t.constraints.find(n=>n.id===e);if(!n)return;let i="Unresolved";try{i=a(r(t.constraints,e))}catch{}s.push({id:e,name:n.name,expression:o(e),value:i}),n.parentId&&m(n.parentId)};n&&e(n.value,t.constraints).forEach(e=>{let n=t.constraints.find(n=>n.name===e.name);n&&m(n.id)}),i?.parentId&&m(i.parentId),p={key:c,source:l,name:n?.name??i?.name??l.id,expression:n?.value??o(l.id),derived:s.length>0,dependencies:s,values:[],targets:[]},d.set(c,p)}let m=s(t,l,u)??"Unresolved";p.values.includes(m)||p.values.push(m),p.targets.push({nodeId:n.id,label:i.slice(0,64)||`${n.tag} · ${n.id}`,property:u})}n.children.forEach(e=>{"string"!=typeof e&&u(e)})};return u(n.root),[...d.values()]}function o(i){let s=new Map(i.constraints.map(e=>[e.id,[]]));for(let e of i.constraints)e.parentId&&s.get(e.parentId)?.push({kind:"dimension",id:e.id});function o(t,r){return Object.fromEntries(t.map(t=>{let a=e(t.value,i.constraints).map((e,n)=>{let a=i.constraints.find(n=>n.name.toLowerCase()===e.name.toLowerCase()),d=e.step??0;return a&&s.get(a.id)?.push({kind:"token",id:t.id,...r?{fragmentId:r}:{},referenceIndex:n,step:d,...void 0!==e.opacity?{opacity:e.opacity}:{}}),{dimensionId:a?.id??null,expression:t.value.slice(e.start,e.end),step:d}});return[t.id,{...t,references:a,bindings:c("token",t.id,r),resolved:n(t.value,i.constraints)}]}))}let u=i.usage??[],l=(i.fragments??[]).map(e=>({fragment:e,uses:d(e,i)}));function c(e,n,t){return{usage:t?[]:u.filter(t=>t.source.kind===e&&t.source.id===n),components:l.flatMap(({fragment:i,uses:s})=>t&&i.id!==t?[]:s.filter(s=>s.source.kind===e&&s.source.id===n&&("token"!==e||t||!i.tokens?.some(e=>e.id===n))).map(e=>({fragmentId:i.id,step:e.source.step??0,targets:e.targets})))}}let p=o(i.tokens),m=Object.fromEntries(l.map(({fragment:e,uses:n})=>[e.id,{name:e.name,...e.guidance&&{guidance:e.guidance},tokens:o(e.tokens??[],e.id),uses:n}])),f=Object.fromEntries(i.constraints.map(e=>{let n=Object.fromEntries(("font"===e.kind?[0]:[-2,-1,0,1,2]).map(n=>{try{return[n,a(r(i.constraints,e.id,n))]}catch{return[n,null]}})),t=e.parentId?"font"===e.kind?"inherit":"color"===e.kind?"rotate-hue":"multiply":"literal";return[e.id,{...e,derivation:t,resolvedBase:n[0],steps:n,dependents:s.get(e.id),bindings:c("dimension",e.id)}]}));return{artwork:i.artwork??null,layouts:i.layouts??[],fontFaces:i.fontFaces??[],dimensions:f,tokens:p,usage:i.usage??[],resolvedUsage:t(i),components:m,featuredComponentId:i.featuredComponentId??null}}export{o as inspectTasteGraph};
@@ -0,0 +1 @@
1
+ import{a,b as s,c as e,d as o,e as t}from"./chunk-32BKJ5JN.mjs";export{a as layoutProperties,e as layoutVariableName,s as safeLayoutValue,o as safeLayoutVariable,t as validTasteLayouts};
@@ -0,0 +1 @@
1
+ import{d as a,e,f as o,g as s}from"./chunk-6OPX4CUT.mjs";import"./chunk-H3T2O3HA.mjs";import"./chunk-7VIC4MGC.mjs";export{a as appendPageComponentNode,s as pageComponentPrompt,o as parsePageComponent,e as readyPageLayers};
@@ -0,0 +1 @@
1
+ "use client";export{h as createProposalSession,i as tasteProposalSession}from"./chunk-EG6UHPJV.mjs";import"./chunk-XTOCFTVW.mjs";import"./chunk-YGP6PPOZ.mjs";
@@ -0,0 +1 @@
1
+ import{h as a,i as s,j as o,k as r,l as t}from"./chunk-6OPX4CUT.mjs";import"./chunk-H3T2O3HA.mjs";import"./chunk-7VIC4MGC.mjs";export{a as TasteProposalValidationError,s as emptyTasteProposal,o as parseTasteProposal,r as tasteProposalPrompt,t as validateTastePageEvidence};
@@ -0,0 +1 @@
1
+ import{a as e,b as s,c as o,d as a}from"./chunk-H3T2O3HA.mjs";import"./chunk-7VIC4MGC.mjs";export{o as findTokenCalculations,e as mathReference,s as resolveCalcExpression,a as resolveTokenMath};
@@ -0,0 +1 @@
1
+ function e(e,t){return"string"==typeof t.canvasLabel?t.canvasLabel:[e,t.modified].filter(Boolean).join(" ")}function t(e){return c(e,512)||"Empty text"}function n(e){if("changes"!==e.kind)return;if("string"==typeof e.replacementText)return e.replacementText;let t=[];for(let n of e.changes){if(!n.startsWith("Text: "))return;let e=n.slice(6).split(" → ");if(2!==e.length)return;t.push("empty"===e[1]?"":e[1])}return t.length?t.join(" "):void 0}function a(e){if(!e?.length)return;let t=[];for(let a of e){let e=n(a);if(void 0===e)return;t.push(e.replace(/\s+/g," ").trim()||"Empty text")}return t.join("; ")}function i(e=[]){let a={};if(e.some(e=>"annotation"===e.kind))return a;for(let i of e){if("changes"!==i.kind)continue;let e=n(i);void 0!==e&&(a[i.elementKey]=t(e))}return a}function o(e){let t=e?.requestItems?.flatMap(e=>"annotation"===e.kind&&e.text.trim()?[e.text.trim()]:[]);if(t?.length)return t.join("; ");let n=e?.requestItems?.flatMap(e=>"changes"===e.kind?[`${e.elementLabel} [${e.changes.join(", ")}]`]:[]);return n?.length?n.join("; "):e?.requestText?.trim()||void 0}function r(e,t){if(!e?.frames?.length)return[];let n=new Map;for(let t of e.steps){let e=t.visuals?.afterFrameId;e&&!n.has(e)&&n.set(e,t.action?.label?`After ${t.action.label}`:"Resulting state")}return e.frames.flatMap((e,a)=>{let i=t[e.imageIndex];return i?[{id:e.id,imageIndex:e.imageIndex,label:0===a?"Initial state":n.get(e.id)??"State",url:i}]:[]})}function l(e){let t=e.instruction?.trim();return t?e.attachments?.some(e=>e.name?.trim()===t)?null:t:null}function s(e,t){let n=e?.tagName?.toLowerCase(),a=e?.id?`#${e.id}`:"",i=e?.className?`.${e.className.trim().split(/\s+/).slice(0,2).join(".")}`:"",o=n?`${n}${a}${i}`:t;return e?.reactComponent?`<${e.reactComponent}> ${o}`:o}function m(e){let t=e.elements?.[0]?.reactComponent||e.elements?.[0]?.tagName||e.linkedSelector,n=e.type&&"annotation"!==e.type?`${e.type} annotation`:"Annotation";return t?`${n} on ${t}`:n}function u(t){let n=t.annotations.map(e=>{let t=e.interactionEpisode?.steps.length??0;return{kind:"annotation",annotationId:e.id,pathname:e.pathname,text:l(e)??m(e),...t>0?{interactionEpisodeStepCount:t}:{}}}),a=new Map,i=t=>{let i=`${t.pathname??""}:${t.durableSelector??t.selector}`,o=a.get(i);if(o)return o.changes.push(t.text),void 0!==o.replacementText&&t.textEdit?o.replacementText=e(o.replacementText,t.textEdit):delete o.replacementText,void(void 0!==t.annotationNumber&&(void 0===o.annotationNumber||t.annotationNumber<o.annotationNumber)&&(o.annotationNumber=t.annotationNumber));let r={kind:"changes",elementKey:i,elementLabel:s(t.element,t.selector),...void 0!==t.annotationNumber?{annotationNumber:t.annotationNumber}:{},pathname:t.pathname,changes:[t.text],...t.textEdit?{replacementText:e(void 0,t.textEdit)}:{}};a.set(i,r),n.push(r)};for(let e of t.styleModifications??[])for(let t of e.changes)i({...e,text:`${t.property}: ${t.original||"unset"} → ${t.modified||"unset"}${t.token?` (${t.token})`:""}`});for(let e of t.textModifications??[])i({...e,textEdit:e,text:`Text: ${e.original||"empty"} → ${e.modified||"empty"}`});for(let e of t.domModifications??[])i({...e,text:"copy"===e.operation?"Copied element":"Moved element"});return t.spacingTokenChanges?.length&&n.push({kind:"changes",elementKey:"spacing-tokens",elementLabel:"Spacing tokens",changes:t.spacingTokenChanges.map(e=>`${e.tokenName}: ${e.originalPx}px → ${e.newPx}px`)}),n}function p(e){let t=e.annotations.flatMap(e=>{let t=l(e);return t?[{instruction:t,pathname:e.pathname}]:[]});if(0===t.length)return;if(new Set(t.map(e=>e.pathname).filter(Boolean)).size<=1)return t.map(e=>e.instruction).join("\n\n");let n=new Map;for(let e of t){let t=e.pathname||"(unknown)",a=n.get(t)??[];a.push(e.instruction),n.set(t,a)}return[...n.entries()].map(([e,t])=>`\`${e}\`\n${t.map(e=>`- ${e}`).join("\n")}`).join("\n")}function c(e,t=96){let n=e.replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,Math.max(0,t-3))}...`:n}export{e as appendTextEditValue,r as buildInteractionEpisodeVisualFrames,u as buildThreadRequestItems,t as canvasTextEditLabel,i as canvasTextEditLabels,s as formatThreadElementLabel,p as formatThreadRequestText,o as getThreadRequestTitle,c as previewThreadRequestText,a as textEditRequestTitle};
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1 @@
1
+ "use client";var e,t,n,a,r,o=e=>document.querySelector(e),i=new URLSearchParams(location.search).get("projectId"),l="popmelt-threads:"+i,s=o("#threads"),d=o("#reply"),c=o("form"),p=o("#notice"),h=o("#more"),m=o("#retry"),u=o("#send"),f=sessionStorage.getItem(l),y="",v=1,g=0,w=!1,b=!1,C=new Map,S=e=>e instanceof Error?e.message:"The bridge is unavailable.";async function I(e,t){let n={"X-Popmelt-Project-Id":i};f&&(n["X-Popmelt-Threads-Session"]=f),t&&(n["Content-Type"]="application/json");let a=await fetch("/thread-view/"+e,{method:t?"POST":"GET",headers:n,body:t&&JSON.stringify(t),cache:"no-store",redirect:"error",signal:AbortSignal.timeout(12e3)}),r=await a.json();if(!a.ok)throw 401===a.status&&(f=null,sessionStorage.removeItem(l),m.hidden=!1),Error(r.error||"The bridge could not complete the request.");return r}function x(e,t){let n=document.createElement(e);return n.textContent=t,n}function k(n){y&&C.set(y,d.value),y=n,d.value=C.get(n)||"",a=r=void 0,e=t=void 0,o("#messages").replaceChildren(),o("#approvals").replaceChildren(),c.hidden=!0,p.textContent=""}async function T(){let i=++g;w=!0;try{let l=[],d=!1;for(let e=0;e<v;e++){let t=await I("api/threads/history?archived=false&limit=50&offset="+50*e);if(i!==g)return;if(l.push(...t.threads),d=t.hasMore,!d)break}h.hidden=!d;let u=l.map(e=>[e.id,(e.marker&&"Idle"!==e.marker.status?e.marker.status+" · ":"")+e.preview]),f=JSON.stringify(u);if(n!==f&&(n=f,s.replaceChildren(...u.map(([e,t])=>new Option(t,e)))),l.some(e=>e.id===y)||k(l[0]?.id||""),s.value=y,y){let n=encodeURIComponent(y),[l,s]=await Promise.all([I("api/thread/"+n),I("api/approvals?threadId="+n)]);if(i!==g)return;!function(n,i){let l=n.messages.map(e=>[e.role,"human"===e.role?e.replyToQuestion||e.requestText||e.feedbackSummary||"":[...new Set([e.responseText,e.question,e.error].filter(Boolean))].join("\n\n")]).filter(([,e])=>e),s=JSON.stringify(l);a!==s&&(a=s,o("#messages").replaceChildren(...l.map(([e,t])=>{let n=document.createElement("article");return n.dataset.role=e,n.append(x("small","human"===e?"User":"Agent"),x("p",t)),n})));let d=n.messages.findLast(e=>"assistant"===e.role&&e.provider);e=d?.provider,t=d?.model;let h=i.filter(e=>"pending"===e.status),m=JSON.stringify(h);r!==m&&(r=m,o("#approvals").replaceChildren(...h.map(e=>{let t=x("section","");t.className="approval",t.append(x("small","Approval needed"),x("h2",e.summary),x("pre",e.details),x("p",e.cwd));for(let[n,a]of[["Allow once","allow"],["Deny","deny"]]){let r=x("button",n);r.onclick=()=>E(async()=>{await I("api/approvals",{id:e.id,jobId:e.jobId,threadId:e.threadId,decision:a}),p.textContent="allow"===a?"Allowed once.":"Denied."}),t.append(r)}return t}))),c.hidden=!1}(l,s.approvals)}o("main").hidden=!1,o("#connection").textContent=l.length?"":"No open threads in this project.",m.hidden=!0}catch(e){i===g&&(o("#connection").textContent=S(e),m.hidden=!1)}finally{i===g&&(w=!1)}}async function j(){m.disabled=!0;try{f||(({session:f}=await I("connect",{})),sessionStorage.setItem(l,f)),await T()}catch(e){o("#connection").textContent=S(e),m.hidden=!1}finally{m.disabled=!1}}async function E(e){if(b)return;b=!0,++g;let t=[s,d,u,h,...o("#approvals").querySelectorAll("button")];t.forEach(e=>e.disabled=!0),p.textContent="";try{await e()}catch(e){p.textContent=S(e)}finally{await T(),t.forEach(e=>e.disabled=!1),b=!1}}c.onsubmit=n=>{n.preventDefault();let a=d.value.trim();!a||!y||E(async()=>{await I("api/reply",{threadId:y,reply:a,provider:e,model:t}),C.delete(y),d.value="",p.textContent="Reply sent."})},s.onchange=()=>{k(s.value),T()},h.onclick=()=>{v++,T()},m.onclick=j,j(),setInterval(()=>{!document.hidden&&f&&!w&&!b&&m.hidden&&T()},3e3);
@@ -0,0 +1,136 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>Threads · Popmelt</title>
7
+ <style>
8
+ :root {
9
+ color-scheme: dark;
10
+ font:
11
+ 16px/1.5 system-ui,
12
+ sans-serif;
13
+ background: #101010;
14
+ color: #ededed;
15
+ }
16
+ * {
17
+ box-sizing: border-box;
18
+ }
19
+ body {
20
+ max-width: 46rem;
21
+ margin: auto;
22
+ padding: clamp(1rem, 4vw, 3rem);
23
+ }
24
+ header {
25
+ display: flex;
26
+ gap: 0.8rem;
27
+ align-items: baseline;
28
+ }
29
+ header span,
30
+ label,
31
+ small {
32
+ color: #bbb;
33
+ }
34
+ h1 {
35
+ font-size: 1.6rem;
36
+ letter-spacing: -0.04em;
37
+ }
38
+ select,
39
+ textarea,
40
+ button {
41
+ font: inherit;
42
+ color: inherit;
43
+ background: #222;
44
+ border: 1px solid #444;
45
+ border-radius: 0.6rem;
46
+ padding: 0.55rem 0.85rem;
47
+ }
48
+ select,
49
+ textarea {
50
+ width: 100%;
51
+ }
52
+ button {
53
+ cursor: pointer;
54
+ font-weight: 600;
55
+ }
56
+ button:hover {
57
+ background: #333;
58
+ }
59
+ button:disabled {
60
+ opacity: 0.45;
61
+ cursor: default;
62
+ }
63
+ :focus-visible {
64
+ outline: 2px solid white;
65
+ outline-offset: 2px;
66
+ }
67
+ [hidden] {
68
+ display: none !important;
69
+ }
70
+ article {
71
+ margin: 1rem 0;
72
+ }
73
+ article p,
74
+ pre {
75
+ white-space: pre-wrap;
76
+ overflow-wrap: anywhere;
77
+ margin: 0.25rem 0;
78
+ }
79
+ article[data-role='human'],
80
+ section.approval {
81
+ background: #202020;
82
+ border-radius: 0.8rem;
83
+ padding: 0.75rem 1rem;
84
+ }
85
+ section.approval {
86
+ border: 1px solid #877557;
87
+ margin: 1rem 0;
88
+ }
89
+ section.approval button {
90
+ margin: 0.6rem 0.5rem 0 0;
91
+ }
92
+ .primary {
93
+ background: #eee;
94
+ color: #111;
95
+ }
96
+ .primary:hover {
97
+ background: #ccc;
98
+ }
99
+ form {
100
+ margin-top: 1rem;
101
+ }
102
+ textarea {
103
+ display: block;
104
+ resize: vertical;
105
+ margin: 0.3rem 0 0.55rem;
106
+ }
107
+ #notice {
108
+ color: #ddd;
109
+ }
110
+ #more {
111
+ margin-top: 0.4rem;
112
+ }
113
+ </style>
114
+ </head>
115
+ <body>
116
+ <header>
117
+ <span>Popmelt</span>
118
+ <h1>Threads</h1>
119
+ </header>
120
+ <p id="connection" role="status">Connecting to the local bridge…</p>
121
+ <button id="retry" hidden>Reconnect</button>
122
+ <main hidden>
123
+ <label for="threads">Thread</label
124
+ ><select id="threads"></select
125
+ ><button id="more" hidden>More threads</button>
126
+ <div id="messages" aria-label="Conversation"></div>
127
+ <div id="approvals"></div>
128
+ <form hidden>
129
+ <label for="reply">Reply</label><textarea id="reply" rows="3"></textarea
130
+ ><button id="send" class="primary">Send reply</button>
131
+ </form>
132
+ <p id="notice" role="status"></p>
133
+ </main>
134
+ <script type="module" src="/thread-view/client.mjs"></script>
135
+ </body>
136
+ </html>
@@ -1,4 +1,4 @@
1
- import { P as PopmeltSubjectAdapter, b as PopmeltSubject, E as ElementInfo, c as PopmeltSubjectCreationSession, a as PopmeltSubjectBounds, d as PopmeltSubjectOutlinePoint, e as PopmeltSubjectTrackingAnchor } from './subjects-cLtt9-iK.mjs';
1
+ import { P as PopmeltSubjectAdapter, b as PopmeltSubject, E as ElementInfo, c as PopmeltSubjectCreationSession, a as PopmeltSubjectBounds, d as PopmeltSubjectOutlinePoint, e as PopmeltSubjectTrackingAnchor } from './subjects-qHIrZrlt.mjs';
2
2
 
3
3
  /** Geometry is normalized against the loaded image, not its rendered size. */
4
4
  type ImageObjectBox = {
@@ -0,0 +1,107 @@
1
+ // The phone gateway sends requests to this launch's private socket. A framework
2
+ // can release or rebind its TCP port without redirecting any phone traffic.
3
+ const http = module.require('node:http');
4
+ const https = module.require('node:https');
5
+ const tls = module.require('node:tls');
6
+ const fs = module.require('node:fs');
7
+ const { basename, join } = module.require('node:path');
8
+ const { randomUUID } = module.require('node:crypto');
9
+ const listeners = new WeakMap();
10
+
11
+ function appPort(server) {
12
+ if (!server?.listening) return;
13
+ const address = server.address();
14
+ if (address && typeof address === 'object') return address.port;
15
+ }
16
+
17
+ function listenerFor(server, directory) {
18
+ const port = appPort(server);
19
+ if (!port) return;
20
+ let pending = listeners.get(server);
21
+ if (pending) return pending;
22
+ const dir = directory || fs.mkdtempSync('/tmp/popmelt-app-');
23
+ const socketPath = join(dir, randomUUID() + '.sock');
24
+ const listener = http.createServer((req, res) => {
25
+ // The reservation may have changed while this request was in flight.
26
+ if (
27
+ appPort(server) !== port ||
28
+ req.headers.host?.split(':').at(-1) !== String(port)
29
+ )
30
+ return res.writeHead(503, { 'x-popmelt-app-offline': '1' }).end();
31
+ if (req.method === 'HEAD' && req.url === '/__pair/listener')
32
+ return res.writeHead(204).end();
33
+ server.emit('request', req, res);
34
+ });
35
+ pending = new Promise((resolve, reject) => {
36
+ function close() {
37
+ resolve(undefined);
38
+ listeners.delete(server);
39
+ listener.close(() => {
40
+ if (!directory) fs.rmdir(dir, () => {});
41
+ });
42
+ listener.closeAllConnections();
43
+ }
44
+ server.once('close', close);
45
+ listener.once('error', (err) => {
46
+ server.off('close', close);
47
+ reject(err);
48
+ close();
49
+ });
50
+ listener.listen(socketPath, () => {
51
+ listener.unref();
52
+ resolve({ socketPath, port, secure: server instanceof tls.Server });
53
+ });
54
+ });
55
+ listeners.set(server, pending);
56
+ return pending;
57
+ }
58
+ exports.listenerFor = listenerFor;
59
+
60
+ // Wrapped dev servers (including Next) own the HTTP server in a child process.
61
+ // Observe only listeners in this checkout and on the wrapper's selected port.
62
+ const settings = process.env.POPMELT_PHONE_LISTENER;
63
+ if (settings && !process.env.POPMELT_PLANE_RENDERER) {
64
+ // Next rewrites NODE_OPTIONS as a map before forking its dev server and
65
+ // merges repeated --require values into a single invalid filename. Let the
66
+ // fork inherit our preload through execArgv, preserving the user's options.
67
+ const preload = '--require ' + JSON.stringify(__filename);
68
+ const options = process.env.NODE_OPTIONS;
69
+ if (
70
+ basename(process.argv[1] || '') === 'next' &&
71
+ process.argv.includes('dev') &&
72
+ options?.endsWith(preload)
73
+ ) {
74
+ process.env.NODE_OPTIONS = options.slice(0, -preload.length).trimEnd();
75
+ process.execArgv.push('--require', __filename);
76
+ }
77
+ const { directory, root, port } = JSON.parse(settings);
78
+ if (fs.realpathSync(process.cwd()) === root) {
79
+ const channel = module.require('node:diagnostics_channel');
80
+ const observed = new WeakSet();
81
+ function observe(server) {
82
+ if (
83
+ !(server instanceof http.Server || server instanceof https.Server) ||
84
+ appPort(server) !== port ||
85
+ observed.has(server)
86
+ )
87
+ return;
88
+ observed.add(server);
89
+ listenerFor(server, directory)
90
+ ?.then((target) => {
91
+ if (!target || appPort(server) !== port) return;
92
+ const tmp = join(directory, randomUUID());
93
+ fs.writeFileSync(tmp, JSON.stringify(target), { mode: 0o600 });
94
+ fs.renameSync(tmp, join(directory, 'listener.json'));
95
+ })
96
+ .catch(() => observed.delete(server));
97
+ server.once('close', () => observed.delete(server));
98
+ }
99
+ channel.subscribe('tracing:net.server.listen:asyncEnd', ({ server }) =>
100
+ observe(server),
101
+ );
102
+ // Older Node versions announce accepted connections without listen tracing.
103
+ channel.subscribe('net.server.socket', ({ socket }) =>
104
+ observe(socket.server),
105
+ );
106
+ }
107
+ }