@popmelt.com/core 0.36.0 → 0.37.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 (222) hide show
  1. package/README.md +78 -23
  2. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  3. package/claude-plugin/skills/popmelt-core/SKILL.md +1 -0
  4. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  5. package/codex-plugin/skills/popmelt-core/SKILL.md +1 -0
  6. package/dist/ExploreAttachment-IO3CNUWH.mjs +1 -0
  7. package/dist/PagePreviewLayer-KQ2FLIGX.mjs +1 -0
  8. package/dist/ParticipantRuntime-Y2BQVJSL.mjs +1 -0
  9. package/dist/PhoneHostGate-2G4BA5FP.mjs +1 -0
  10. package/dist/PopmeltTasteConnectedPane-H5QWBFD7.mjs +1 -0
  11. package/dist/PreviewRuntime-V2PZF462.mjs +1 -0
  12. package/dist/{QueuedReplies-ESIFFRKS.mjs → QueuedReplies-4APDDNQX.mjs} +1 -1
  13. package/dist/SamplePlacementOverlay-ELSP5AHM.mjs +1 -0
  14. package/dist/ShareProjectPane-OR2LS2A3.mjs +1 -0
  15. package/dist/SuppliedContext-SAQKEDWW.mjs +1 -0
  16. package/dist/ThreadErrorCard-OSHIWSHR.mjs +1 -0
  17. package/dist/ThreadPanel-YPL2HDUC.mjs +1 -0
  18. package/dist/adapter-react-three-fiber.d.mts +6 -2
  19. package/dist/adapter-react-three-fiber.mjs +1 -1
  20. package/dist/adapter-three.d.mts +34 -0
  21. package/dist/adapter-three.mjs +45 -1
  22. package/dist/bridge-entry.mjs +1 -1
  23. package/dist/bridgeSSEStream-6OMAFDFW.mjs +1 -0
  24. package/dist/bridgeWebSocketStream-WIOGOPJW.mjs +1 -0
  25. package/dist/browser-runtime-O3EKN3FI.mjs +1 -0
  26. package/dist/browser.d.mts +4 -4
  27. package/dist/browser.mjs +1 -1
  28. package/dist/canvas-chat-note-O3USBECW.mjs +1 -0
  29. package/dist/checkFixture-SOSI7AT4.mjs +1 -0
  30. package/dist/chunk-3VOEPWRL.mjs +1 -0
  31. package/dist/chunk-4OEHQ6M7.mjs +24 -0
  32. package/dist/chunk-4YQWU5YB.mjs +1 -0
  33. package/dist/chunk-5IZHN3A7.mjs +1 -0
  34. package/dist/chunk-6EO73WJN.mjs +1 -0
  35. package/dist/chunk-6O5QLRSA.mjs +1 -0
  36. package/dist/chunk-76WRZ2NH.mjs +1 -0
  37. package/dist/chunk-A4GARXVQ.mjs +1 -0
  38. package/dist/chunk-AAMUU2QA.mjs +1 -0
  39. package/dist/chunk-AGCS65LT.mjs +1 -0
  40. package/dist/chunk-AGYBVMHX.mjs +1 -0
  41. package/dist/{chunk-RR4SHK7O.mjs → chunk-AOTDTBQO.mjs} +1 -1
  42. package/dist/chunk-ATLUO4G7.mjs +1 -0
  43. package/dist/chunk-AYZUOBFI.mjs +1 -0
  44. package/dist/chunk-B22WBEQC.mjs +1 -0
  45. package/dist/chunk-B2ISA6V6.mjs +1 -0
  46. package/dist/chunk-B4DYUYX4.mjs +1 -0
  47. package/dist/chunk-BVGHHT3Y.mjs +1 -0
  48. package/dist/{chunk-NDGM4DAP.mjs → chunk-BYASSHKJ.mjs} +1 -1
  49. package/dist/chunk-C2ZSNUXQ.mjs +1 -0
  50. package/dist/chunk-CIA6WVXQ.mjs +1 -0
  51. package/dist/chunk-CIKFUS7J.mjs +1 -0
  52. package/dist/chunk-CK3CDA3L.mjs +1 -0
  53. package/dist/{chunk-AH6LZOQC.mjs → chunk-DO46YJCX.mjs} +1 -1
  54. package/dist/chunk-DRPRASD6.mjs +1 -0
  55. package/dist/chunk-EBJ23A7F.mjs +1 -0
  56. package/dist/chunk-ECMLCGAM.mjs +1 -0
  57. package/dist/chunk-EILBHZDX.mjs +1 -0
  58. package/dist/{chunk-DOCRI237.mjs → chunk-ELKVFX2O.mjs} +1 -1
  59. package/dist/{chunk-EXIUW3JX.mjs → chunk-EUFR7R5Q.mjs} +1 -1
  60. package/dist/chunk-EZVFCJEG.mjs +1 -0
  61. package/dist/chunk-FHCKFQBY.mjs +1 -0
  62. package/dist/chunk-FJWWBKCQ.mjs +1 -0
  63. package/dist/chunk-FON4QY7P.mjs +1 -0
  64. package/dist/chunk-GLF7Z5IR.mjs +1 -0
  65. package/dist/chunk-HAZXZ5TU.mjs +1 -0
  66. package/dist/chunk-HKHZBKAN.mjs +1 -0
  67. package/dist/chunk-I6FJ533W.mjs +1 -0
  68. package/dist/chunk-I7AI52RX.mjs +1 -0
  69. package/dist/{chunk-YHYFWNN6.mjs → chunk-IAXSC2ZN.mjs} +1 -1
  70. package/dist/chunk-IGKU4YIV.mjs +1 -0
  71. package/dist/chunk-IW7V7WNL.mjs +1 -0
  72. package/dist/chunk-JCW2WY7X.mjs +1 -0
  73. package/dist/chunk-JEGBAHYK.mjs +1 -0
  74. package/dist/chunk-JLK3VRBT.mjs +1 -0
  75. package/dist/chunk-KCDHP4N3.mjs +1 -0
  76. package/dist/chunk-KF73S7MG.mjs +1 -0
  77. package/dist/chunk-L6S66APQ.mjs +1 -0
  78. package/dist/chunk-LH7HKUCK.mjs +1 -0
  79. package/dist/chunk-LOUWY55X.mjs +1 -0
  80. package/dist/chunk-LXFKOYLK.mjs +1 -0
  81. package/dist/chunk-MDPZUECK.mjs +1 -0
  82. package/dist/chunk-MHWIFSXJ.mjs +1 -0
  83. package/dist/chunk-MPEVFQ43.mjs +1 -0
  84. package/dist/{chunk-57FM7XQV.mjs → chunk-NI77Y3WC.mjs} +1 -1
  85. package/dist/chunk-NXTWB3A7.mjs +1 -0
  86. package/dist/chunk-OA63PYHZ.mjs +1 -0
  87. package/dist/chunk-OFJUTWJU.mjs +1 -0
  88. package/dist/chunk-OREALBUO.mjs +1 -0
  89. package/dist/chunk-OVZ4CQGM.mjs +1 -0
  90. package/dist/chunk-PILMDBAX.mjs +1 -0
  91. package/dist/chunk-PLE6FFKY.mjs +1 -0
  92. package/dist/chunk-PRPXMDZ7.mjs +1 -0
  93. package/dist/chunk-PWQB3FIW.mjs +1 -0
  94. package/dist/chunk-ROKRMYFR.mjs +1 -0
  95. package/dist/chunk-SNAJBV7T.mjs +30 -0
  96. package/dist/chunk-SOGN7S54.mjs +1 -0
  97. package/dist/chunk-SOT33EQ4.mjs +1 -0
  98. package/dist/chunk-SQA27YGA.mjs +1 -0
  99. package/dist/chunk-SUAHDXJZ.mjs +1 -0
  100. package/dist/chunk-TCGXG7UA.mjs +1 -0
  101. package/dist/chunk-TMSGNHXH.mjs +1 -0
  102. package/dist/chunk-TQ3SP5TE.mjs +1 -0
  103. package/dist/chunk-UTP56NCY.mjs +1 -0
  104. package/dist/chunk-W2QQVB2H.mjs +1 -0
  105. package/dist/chunk-WC4ZNVFM.mjs +1 -0
  106. package/dist/chunk-WDSFOF2E.mjs +1 -0
  107. package/dist/chunk-WP2SHSCG.mjs +1 -0
  108. package/dist/chunk-X6I6KQDG.mjs +1 -0
  109. package/dist/chunk-XJJDBMZI.mjs +1 -0
  110. package/dist/chunk-XY7YW7SH.mjs +1 -0
  111. package/dist/chunk-YMWXWXPV.mjs +1 -0
  112. package/dist/chunk-YU3ZY76H.mjs +1 -0
  113. package/dist/chunk-YVT3J6JB.mjs +1 -0
  114. package/dist/chunk-YYFF2X3L.mjs +1 -0
  115. package/dist/cli.mjs +1 -1
  116. package/dist/codex-note-context-UI55CWRI.mjs +1 -0
  117. package/dist/codex-project-LIU27RXA.mjs +1 -0
  118. package/dist/codex-session-registry-YNU6LEVH.mjs +1 -0
  119. package/dist/codex-store-mount-EPETPOBA.mjs +1 -0
  120. package/dist/{dev-server-DtX2_HCa.d.mts → dev-server-BRrhkH5t.d.mts} +11 -1
  121. package/dist/dev-server-WYB2CRC5.mjs +1 -0
  122. package/dist/focus-inspection-42IEM45O.mjs +1 -0
  123. package/dist/guest-admission.d.mts +2 -0
  124. package/dist/guest-admission.mjs +1 -0
  125. package/dist/guest-live-canvas.d.mts +2 -0
  126. package/dist/guest-live-canvas.mjs +1 -0
  127. package/dist/index.d.mts +6 -6
  128. package/dist/index.mjs +1 -1
  129. package/dist/invitationLink-LUIIOAEZ.mjs +1 -0
  130. package/dist/inviteQr-HVHH45SN.mjs +1 -0
  131. package/dist/inviteQr-U77MLSEQ.mjs +1 -0
  132. package/dist/media.d.mts +3 -3
  133. package/dist/memory-store.d.mts +5 -1
  134. package/dist/page-interaction-TV3P6B3X.mjs +1 -0
  135. package/dist/page-planes-2ZepTpen.d.mts +817 -0
  136. package/dist/participantBootstrap-BuTrTQbo.d.mts +22 -0
  137. package/dist/{participantBootstrap-DFJlcKRI.d.mts → participantBootstrap-DuosDN9G.d.mts} +9 -3
  138. package/dist/peer-client-RSC6EGAF.mjs +1 -0
  139. package/dist/plain-html-EF7MUNRZ.mjs +1 -0
  140. package/dist/plugin-astro.d.mts +5 -2
  141. package/dist/plugin-astro.mjs +1 -1
  142. package/dist/plugin-next.mjs +1 -1
  143. package/dist/plugin-nuxt.d.mts +4 -2
  144. package/dist/plugin-nuxt.mjs +1 -1
  145. package/dist/plugin-vite.d.mts +69 -9
  146. package/dist/plugin-vite.mjs +1 -1
  147. package/dist/qr-encoder.mjs +3 -0
  148. package/dist/server.d.mts +42 -19
  149. package/dist/server.mjs +1 -1
  150. package/dist/shared-page-GO76UP7I.mjs +1 -0
  151. package/dist/{subjects-DdavjSTL.d.mts → subjects-BhO1x5tz.d.mts} +80 -1
  152. package/dist/taste-proposal-session-DBOUA54V.mjs +1 -0
  153. package/dist/toolbarFonts-GVPRHJGB.mjs +1 -0
  154. package/dist/{types-g9YCBx4Z.d.mts → types-CggBG-H6.d.mts} +1 -137
  155. package/dist/{video-adapter-DB6Hex1f.d.mts → video-adapter-B8J5awc_.d.mts} +2 -2
  156. package/dist/workspace-snapshot-6LN7U2NJ.mjs +1 -0
  157. package/package.json +45 -22
  158. package/samples/README.md +32 -0
  159. package/samples/build.d.mts +16 -0
  160. package/samples/build.mjs +138 -0
  161. package/dist/ExploreAttachment-H5WPEAZB.mjs +0 -1
  162. package/dist/PagePreviewLayer-WCYOBKAS.mjs +0 -1
  163. package/dist/ParticipantRuntime-HEC26AER.mjs +0 -1
  164. package/dist/PhoneHostGate-Q2AXVOSH.mjs +0 -1
  165. package/dist/PopmeltTasteConnectedPane-B7DHQKRQ.mjs +0 -1
  166. package/dist/PreviewRuntime-H2UOLP6T.mjs +0 -1
  167. package/dist/SuppliedContext-7ASO6GAW.mjs +0 -1
  168. package/dist/ThreadErrorCard-6R7W3RGZ.mjs +0 -1
  169. package/dist/ThreadPanel-3IS7GUYS.mjs +0 -1
  170. package/dist/bridgeSSEStream-K3UIMBTC.mjs +0 -1
  171. package/dist/bridgeWebSocketStream-2SUZUBE3.mjs +0 -1
  172. package/dist/browser-runtime-ILNTJLZ5.mjs +0 -1
  173. package/dist/canvas-chat-note-MGAEUYJO.mjs +0 -1
  174. package/dist/checkFixture-YE2ROOLL.mjs +0 -1
  175. package/dist/chunk-26P7UUHT.mjs +0 -1
  176. package/dist/chunk-2P2NUZW7.mjs +0 -1
  177. package/dist/chunk-3SEXH3AZ.mjs +0 -1
  178. package/dist/chunk-3XJEC6LS.mjs +0 -1
  179. package/dist/chunk-4LHTPRFY.mjs +0 -1
  180. package/dist/chunk-5D2ADU7H.mjs +0 -1
  181. package/dist/chunk-5K7SACPW.mjs +0 -1
  182. package/dist/chunk-67QNAAUC.mjs +0 -1
  183. package/dist/chunk-7CGKO4IU.mjs +0 -30
  184. package/dist/chunk-BACXPVHP.mjs +0 -1
  185. package/dist/chunk-DC47WNPG.mjs +0 -1
  186. package/dist/chunk-DJTGR3RO.mjs +0 -1
  187. package/dist/chunk-DLUNNAZC.mjs +0 -1
  188. package/dist/chunk-EX63NVDN.mjs +0 -1
  189. package/dist/chunk-FLTHWLRC.mjs +0 -1
  190. package/dist/chunk-G6RYESYI.mjs +0 -1
  191. package/dist/chunk-G7JR5Z3P.mjs +0 -1
  192. package/dist/chunk-GBVPRXA3.mjs +0 -1
  193. package/dist/chunk-HAE5LUJX.mjs +0 -1
  194. package/dist/chunk-HU2XWUJC.mjs +0 -1
  195. package/dist/chunk-HV7HRQ2S.mjs +0 -1
  196. package/dist/chunk-J4WDYITA.mjs +0 -1
  197. package/dist/chunk-L7QONR4K.mjs +0 -1
  198. package/dist/chunk-LVEMYZOA.mjs +0 -1
  199. package/dist/chunk-MSWXKP77.mjs +0 -1
  200. package/dist/chunk-NSCO633B.mjs +0 -1
  201. package/dist/chunk-NWE5PYKM.mjs +0 -1
  202. package/dist/chunk-O4HZP3RP.mjs +0 -1
  203. package/dist/chunk-OAHYSDJ4.mjs +0 -1
  204. package/dist/chunk-PNTM77NT.mjs +0 -1
  205. package/dist/chunk-RUTWU5W2.mjs +0 -1
  206. package/dist/chunk-TLREGQQB.mjs +0 -1
  207. package/dist/chunk-TUXBMJQZ.mjs +0 -1
  208. package/dist/chunk-V2I7PSJW.mjs +0 -1
  209. package/dist/chunk-WDAXARLI.mjs +0 -1
  210. package/dist/chunk-WHJEKDNP.mjs +0 -1
  211. package/dist/chunk-X2Q3H6X7.mjs +0 -1
  212. package/dist/chunk-XJQJQ5V5.mjs +0 -1
  213. package/dist/chunk-XT6PHPPG.mjs +0 -1
  214. package/dist/chunk-YD3PDEFX.mjs +0 -1
  215. package/dist/chunk-ZDXQ7WNW.mjs +0 -1
  216. package/dist/codex-note-context-YFURG7VL.mjs +0 -1
  217. package/dist/codex-project-3NSU5OWL.mjs +0 -1
  218. package/dist/codex-session-registry-ONODFWFD.mjs +0 -1
  219. package/dist/focus-inspection-SZJ5KP23.mjs +0 -1
  220. package/dist/peer-client-56EAHIGF.mjs +0 -1
  221. package/dist/taste-proposal-session-XU4N7RUV.mjs +0 -1
  222. package/dist/workspace-snapshot-RTTXNNUX.mjs +0 -1
@@ -1 +1,45 @@
1
- import{Box3 as y,Raycaster as x,Vector2 as O,Vector3 as j}from"three";function b(e){return[e.x,e.y,e.z].map(n=>Number(n.toFixed(4))).join(", ")}function d(e){let n=e.material;return n&&(Array.isArray(n)?n:[n]).map(r=>r.name?.trim()||r.type).filter(Boolean).join(", ")||void 0}function M(e,n,c){let s=e.domElement.width,r=e.domElement.height;if(s<=0||r<=0)return null;let l=e.getRenderTarget(),t=e.xr.enabled;try{return e.xr.enabled=!1,e.setRenderTarget(null),e.render(n,c),e.domElement.toDataURL("image/png")}catch{return null}finally{e.setRenderTarget(l),e.xr.enabled=t}}function D(e){let s=(e.parent?.children??[]).filter(t=>t.type===e.type&&t.name===e.name),r=Math.max(0,s.indexOf(e)),l=e.name.trim()||e.type;return`${encodeURIComponent(l)}[${r}]`}function f(e){let n=[],c=e;for(;c?.parent;)n.push(D(c)),c=c.parent;return n.reverse().join("/")}function v(e){let n=e.userData.popmeltId;return typeof n=="string"&&n.trim()?n.trim():f(e)}function T(e){let n=e.userData.popmeltLabel;return typeof n=="string"&&n.trim()?n.trim():e.name.trim()||e.type}function R(e){let n=e;for(;n.parent;){let c=n.name.trim(),s=c.match(/^(.*)_(?:alpha|normal|material)(?:_\d+)+$/i),r=n.parent;for(;r.parent&&!r.name.trim();)r=r.parent;let l=r.name.trim();if(!l||!c.startsWith(`${l}_`)&&!s)break;n=r}return n}function P(e,n,c){let s=new y().setFromObject(e,!0);if(s.isEmpty())return null;let r=c.getBoundingClientRect(),l=[];for(let p of[s.min.x,s.max.x])for(let h of[s.min.y,s.max.y])for(let g of[s.min.z,s.max.z])l.push(new j(p,h,g).project(n));let t=l.map(p=>r.left+(p.x+1)/2*r.width),a=l.map(p=>r.top+(1-p.y)/2*r.height),i=Math.max(r.left,Math.min(...t)),u=Math.min(r.right,Math.max(...t)),m=Math.max(r.top,Math.min(...a)),o=Math.min(r.bottom,Math.max(...a));return u<=i||o<=m?null:{left:i,top:m,width:u-i,height:o-m}}function C(e){let n=e.raycaster??new x,c=new O,s=t=>e.key?.(t)??v(t),r=(t,a)=>{let i=s(t);if(!i)return null;let u=P(t,e.camera,e.canvas);return u?{key:i,label:e.label?.(t)??T(t),sourceElement:e.canvas,bounds:u,context:f(t),data:{renderer:"Three.js",objectType:t.type,...t.name?{objectName:t.name}:{},scenePath:f(t),...a&&a!==t?{renderObjectName:a.name.trim()||a.type,renderObjectType:a.type,renderScenePath:f(a)}:{},position:b(t.position),rotation:b(t.rotation),scale:b(t.scale),visible:String(t.visible),...d(t)?{material:d(t)}:{},...Object.fromEntries(Object.entries(e.describe?.(t)??{}).filter(m=>typeof m[1]=="string"&&m[1].length>0))}}:null},l=t=>{let a=null;return e.scene.traverse(i=>{!a&&s(i)===t&&(a=i)}),a};return{id:e.id?.trim()||"three",hitTest({x:t,y:a}){let i=e.canvas.getBoundingClientRect();if(t<i.left||t>i.right||a<i.top||a>i.bottom)return null;c.set((t-i.left)/i.width*2-1,-((a-i.top)/i.height)*2+1),n.setFromCamera(c,e.camera);for(let u of n.intersectObject(e.scene,!0)){let m=e.select?e.select(u.object):R(u.object);if(!m||!m.visible)continue;let o=r(m,u.object);if(o)return o}return null},resolve(t){let a=l(t);return a?r(a):null},...e.captureFrame?{async captureSurfaces(){let t=await e.captureFrame?.();return t?[{element:e.canvas,dataUrl:t}]:[]}}:{}}}export{M as captureThreeRendererFrame,C as createThreeSubjectAdapter,R as selectThreeNamedPrimitiveParent,f as threeObjectPath};
1
+ import{Box3 as He,Raycaster as ke,Vector2 as ze,Vector3 as Ie}from"three";import{Color as Le,EqualDepth as Fe,MeshBasicMaterial as Ge}from"three";import{Box3 as Ce,Color as Re,Frustum as Te,Matrix4 as se,Vector2 as Se,Vector4 as De,WebGLRenderTarget as je}from"three";function ye(e,a,s,m,i,g){let y=e.ownerDocument,b=y.defaultView,t=y.createElement("span");t.dataset.devtools="three-hover-layer",t.setAttribute("aria-hidden","true"),t.style.cssText="all:initial!important;position:absolute!important;display:block!important;overflow:hidden!important;pointer-events:none!important;box-sizing:border-box!important;";let n=y.createElement("canvas");n.style.cssText="position:absolute;pointer-events:none;",t.attachShadow({mode:"open"}).append(n);let l=new Se,r=new De,o=new Ce,f=new se,R=new Te,T=new je(1,1),u=new Re,P,w,d=null,S=new Uint8Array(0),j,I=-1,H=!1,p=!1,M=!1,D=0,V=!1,L;function k(){D++,t.remove()}function q(c){if(L)return;let F=c.onAfterRender,x=Object.hasOwn(c,"onAfterRender"),B=function(...h){F.apply(this,h);let C=h[0];C.domElement===e&&!C.getRenderTarget()&&I!==C.info.render.frame&&!g()&&k()};c.onAfterRender=B,L=()=>{c.onAfterRender===B&&(x?c.onAfterRender=F:Reflect.deleteProperty(c,"onAfterRender"))}}function Q(c,F,x,B){if(M||!b||!e.isConnected||c.getRenderTarget())return!1;let h=e.getBoundingClientRect(),C=b.devicePixelRatio||1;if(c.getDrawingBufferSize(l),l.x+1>=h.width*C&&l.y+1>=h.height*C||!h.width||!h.height||c.getScissorTest())return(t.isConnected||H)&&k(),!1;if(c.getCurrentViewport(r),r.x||r.y||r.z!==l.x||r.w!==l.y||(d??(d=n.getContext("2d")),!d))return!1;if(q(F),I===c.info.render.frame)return!0;if(I=c.info.render.frame,H)return p=!0,!0;f.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse),o.setFromObject(a).applyMatrix4(f);let _=Math.max(0,Math.floor(((o.min.x+1)*h.width/2-3)/8)*8/h.width),me=Math.min(1,Math.ceil(((o.max.x+1)*h.width/2+3)/8)*8/h.width),ee=Math.max(0,Math.floor(((1-o.max.y)*h.height/2-3)/8)*8/h.height),fe=Math.min(1,Math.ceil(((1-o.min.y)*h.height/2+3)/8)*8/h.height),$=me-_,U=fe-ee;if(!($>0&&U>0))return k(),!0;let te=h.width*$,re=h.height*U,ne=Math.min(Math.max(2,C),Math.sqrt(2097152/(te*re)),c.capabilities.maxTextureSize/Math.max(te,re)),W=Math.max(1,Math.ceil(te*ne)),G=Math.max(1,Math.ceil(re*ne));T.setSize(W,G),P!==x&&(P=x,w=Object.create(x),w.projectionMatrix=new se,w.projectionMatrixInverse=new se),f.set(1/$,0,0,(1-_-me)/$,0,1/U,0,(ee+fe-1)/U,0,0,1,0,0,0,0,1),w.projectionMatrix.multiplyMatrices(f,x.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),f.multiplyMatrices(w.projectionMatrix,w.matrixWorldInverse),R.setFromProjectionMatrix(f);let ae=w,ie=c.renderLists.get(F,0),ue=[ie.opaque,ie.transmissive,ie.transparent],Me=c.getClearAlpha();c.getClearColor(u);let pe=D,oe;try{c.setRenderTarget(T),c.setClearColor(0,0),c.state.buffers.color.setMask(!0),c.state.buffers.depth.setMask(!0),c.clear();for(let O of ue)for(let{object:v,geometry:z,material:E,group:N}of O){if(!z||!E.depthWrite||!v.layers.test(x.layers)||v.frustumCulled&&!R.intersectsObject(v))continue;v.modelViewMatrix.multiplyMatrices(ae.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix);let K=E.colorWrite;try{E.colorWrite=!1,c.renderBufferDirect(ae,F,z,E,v,N)}finally{E.colorWrite=K}}for(let O of ue)for(let{object:v,geometry:z,material:E,group:N}of O)!z||!s.has(v)||!E.colorWrite||!v.layers.test(x.layers)||B(ae,v,z,E,N,ne);S.length!==W*G*4&&(S=new Uint8Array(W*G*4)),c.readRenderTargetPixelsAsync?oe=c.readRenderTargetPixelsAsync(T,0,0,W,G,S):c.readRenderTargetPixels(T,0,0,W,G,S)}finally{c.setClearColor(u,Me),c.setRenderTarget(null),c.state.viewport(r)}function de(){if(D!==pe||!e.isConnected||!d||!b)return;if(!j||j.width!==W||j.height!==G){n.width=W,n.height=G,j=d.createImageData(W,G);for(let A=0;A<j.data.length;A+=4)j.data[A]=m>>16&255,j.data[A+1]=m>>8&255,j.data[A+2]=m&255}for(let A=0;A<G;A++){let Y=A*W*4+3,he=(G-A-1)*W*4+3;for(let ge=0;ge<W;ge++,Y+=4,he+=4)j.data[Y]=S[he]}d.putImageData(j,0,0);let O=b.getComputedStyle(e),v=(A,Y)=>t.style.setProperty(A,Y,"important");v("position",O.position==="fixed"?"fixed":"absolute"),v("left",e.offsetLeft+"px"),v("top",e.offsetTop+"px"),v("width",e.offsetWidth+"px"),v("height",e.offsetHeight+"px"),v("border-radius",O.borderRadius),v("transform",O.transform),v("transform-origin",O.transformOrigin),v("z-index",O.zIndex);let z=parseFloat(O.paddingLeft)||0,E=parseFloat(O.paddingTop)||0,N=e.clientWidth-z-(parseFloat(O.paddingRight)||0),K=e.clientHeight-E-(parseFloat(O.paddingBottom)||0);n.style.left=e.clientLeft+z+_*N+"px",n.style.top=e.clientTop+E+ee*K+"px",n.style.width=$*N+"px",n.style.height=U*K+"px",t.parentNode!==e.parentNode&&e.after(t)}return oe?(H=!0,oe.then(de,()=>{pe===D&&(M=!0,k())}).finally(()=>{H=!1,!V&&(p||M)&&i?.(),p=!1})):de(),!0}function Z(){V=!0,k(),L?.(),T.dispose()}return{paint:Q,dispose:Z}}import{Box3 as Oe,Color as Pe,Matrix4 as Ae,Vector2 as le,Vector4 as xe,WebGLRenderTarget as Be}from"three";var We=72,Ee=24;function ve(e,a,s){let m=a.ownerDocument.defaultView,i=m?.matchMedia?.("(prefers-reduced-motion: reduce)"),g=performance.now(),y=0,b={value:0},t=new le,n=new Oe,l=new Ae,r=new xe,o;s&&i?.addEventListener("change",s);let f=new Be(1,1,{depthBuffer:!1}),R=new xe,T=new le,u=new le,P=new Pe,w=-1,d,S=null;function j(p,M,D,V){let L=p.getRenderTarget();if(w===p.info.render.frame&&d===D&&S===L)return;w=p.info.render.frame,d=D,S=L,p.getCurrentViewport(R),L?T.set(L.width,L.height):p.getDrawingBufferSize(T);let k=p.domElement.getBoundingClientRect();f.setSize(Math.max(1,R.z),Math.max(1,R.w)),u.set(1*(V??T.x/Math.max(1,k.width))/f.width,1*(V??T.y/Math.max(1,k.height))/f.height);let q=performance.now();if(i?.matches)b.value=-1;else{l.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),n.setFromObject(e).applyMatrix4(l);let F=Math.max(1e-4,n.max.x-n.min.x),x=Math.max(1e-4,n.max.y-n.min.y),B=1/(2*u.x),h=1/(2*u.y);r.set((n.min.x+n.max.x)/2,(n.min.y+n.max.y)/2,B,h),t.set(Math.max(.5,(F*B-1)/2),Math.max(.5,(x*h-1)/2));let C=4*(t.x+t.y);b.value>=0&&Number.isFinite(C)&&C>0&&(y=(y+(q-g)*We/(1e3*C))%1),b.value=Number.isFinite(C)?y*C:-1,s&&m&&o===void 0&&(o=m.requestAnimationFrame(()=>{o=void 0,s()}))}g=q;let Q=p.getActiveCubeFace(),Z=p.getActiveMipmapLevel(),c=p.getClearAlpha();p.getClearColor(P);try{p.setRenderTarget(f),p.setClearColor(0,0),p.state.buffers.color.setMask(!0),p.clear(!0,!1,!1),e.traverseVisible(F=>{let x=F;if(!x.isMesh||!x.layers.test(D.layers))return;x.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,x.matrixWorld),x.normalMatrix.getNormalMatrix(x.modelViewMatrix);let{geometry:B,material:h}=x;if(Array.isArray(h))for(let C of B.groups){let _=h[C.materialIndex??0];_?.visible&&_.colorWrite&&p.renderBufferDirect(D,M,B,_,x,C)}else h.visible&&h.colorWrite&&p.renderBufferDirect(D,M,B,h,x,null)})}finally{p.setClearColor(P,c),p.setRenderTarget(L,Q,Z),p.state.viewport(R)}}function I(p){p.onBeforeCompile=M=>{M.uniforms.hoverMask={value:f.texture},M.uniforms.hoverViewport={value:R},M.uniforms.traceHeadPx=b,M.uniforms.traceHalfSizePx={value:t},M.uniforms.traceBounds={value:r},M.uniforms.hoverStep={value:u},M.fragmentShader=`
2
+ uniform sampler2D hoverMask;
3
+ uniform vec4 hoverViewport;
4
+ uniform vec2 hoverStep;
5
+ uniform float traceHeadPx;
6
+ uniform vec2 traceHalfSizePx;
7
+ uniform vec4 traceBounds;
8
+ float traceStrength(vec2 uv) {
9
+ if (traceHeadPx < 0.0) return 0.0;
10
+ // Map a ray from the subject center to clockwise CSS-pixel distance
11
+ // on the projected bounds. Crossings of holes keep the same sweep.
12
+ vec2 ray = (2.0 * uv - 1.0 - traceBounds.xy) * traceBounds.zw / traceHalfSizePx;
13
+ float radius = max(abs(ray.x), abs(ray.y));
14
+ if (radius < 1e-7) return 0.0;
15
+ vec2 edge = ray / radius;
16
+ float w = traceHalfSizePx.x, h = traceHalfSizePx.y;
17
+ float distancePx;
18
+ if (ray.y >= abs(ray.x)) distancePx = edge.x * w;
19
+ else if (ray.x >= abs(ray.y)) distancePx = w + (1.0 - edge.y) * h;
20
+ else if (-ray.y >= abs(ray.x)) distancePx = (2.0 - edge.x) * w + 2.0 * h;
21
+ else distancePx = 3.0 * w + (3.0 + edge.y) * h;
22
+ float perimeter = 4.0 * (w + h);
23
+ float behind = mod(traceHeadPx - distancePx, perimeter);
24
+ float segment = min(${Ee.toFixed(1)}, perimeter * ${19/100});
25
+ return clamp(2.0 - behind / max(segment, 0.0001), 0.0, 1.0);
26
+ }
27
+ float coverage(vec2 uv, float center) {
28
+ return clamp(texture2D(hoverMask, uv).a / center, 0.0, 1.0);
29
+ }
30
+ `+M.fragmentShader.replace("#include <tonemapping_fragment>",`
31
+ vec2 uv = (gl_FragCoord.xy - hoverViewport.xy) / hoverViewport.zw;
32
+ float center = max(texture2D(hoverMask, uv).a, 0.001);
33
+ float tracer = traceStrength(uv);
34
+ // The moving head fattens to two CSS pixels over the one-pixel resting line.
35
+ vec2 span = hoverStep * (1.0 + tracer);
36
+ vec2 dx = vec2(span.x, 0.0);
37
+ vec2 dy = vec2(0.0, span.y);
38
+ vec2 diag = 0.70710678 * span;
39
+ float inside = min(min(coverage(uv + dx, center), coverage(uv - dx, center)), min(coverage(uv + dy, center), coverage(uv - dy, center)));
40
+ inside = min(inside, min(coverage(uv + diag, center), coverage(uv - diag, center)));
41
+ diag.y = -diag.y;
42
+ inside = min(inside, min(coverage(uv + diag, center), coverage(uv - diag, center)));
43
+ gl_FragColor.a *= mix(0.38, 1.0, (1.0 - inside) * mix(${.3}, 1.0, tracer));
44
+ #include <tonemapping_fragment>
45
+ `)}}function H(){o!==void 0&&m?.cancelAnimationFrame(o),s&&i?.removeEventListener("change",s),f.dispose()}return{update:j,applyTo:I,dispose:H}}function be(e,a,s,m){let i=a;if(!a.startsWith("#")){let r=s.canvas.ownerDocument.createElement("canvas");r.width=r.height=1;let o=r.getContext("2d");if(o){o.fillStyle=a,o.fillRect(0,0,1,1);let f=o.getImageData(0,0,1,1).data;i=f[0]<<16|f[1]<<8|f[2]}}let g=ve(e,s.canvas,s.invalidate),y=new Map,b=[],t=new Set,n=ye(s.canvas,e,t,new Le(i).getHex(),s.invalidate,m);function l(r,o,f,R,T,u,P,w){g.update(r,o,f,w);let d=y.get(u);d||(d=new Ge({color:i,transparent:!0,depthWrite:!1,toneMapped:!1,fog:!1}),g.applyTo(d),y.set(u,d)),d.opacity=u.transparent?u.opacity:1,d.side=u.side,d.depthTest=u.depthTest,d.depthFunc=u.depthWrite?Fe:u.depthFunc,d.clippingPlanes=u.clippingPlanes,d.clipIntersection=u.clipIntersection;let S=u;d.wireframe=S.wireframe===!0,u.depthWrite||(d.map=S.map??null,d.alphaMap=S.alphaMap??null,d.alphaTest=u.alphaTest),r.renderBufferDirect(f,o,T,d,R,P)}return e.traverse(r=>{if(!r.isMesh)return;t.add(r);let o=r.onAfterRender,f=!Object.hasOwn(r,"onAfterRender"),R=function(...T){o.apply(this,T);let[u,P,w,d,S,j]=T;u.domElement!==s.canvas||typeof u.renderBufferDirect!="function"||P.overrideMaterial||!S.colorWrite||m()||n.paint(u,P,w,(I,H,p,M,D,V)=>l(u,P,I,H,p,M,D,V))||l(u,P,w,this,d,S,j)};r.onAfterRender=R,b.push(()=>{r.onAfterRender===R&&(f?Reflect.deleteProperty(r,"onAfterRender"):r.onAfterRender=o)})}),s.invalidate?.(),()=>{for(let r of b)r();for(let r of y.values())r.dispose();n.dispose(),g.dispose(),s.invalidate?.()}}function ce(e){return[e.x,e.y,e.z].map(a=>Number(a.toFixed(4))).join(", ")}function we(e){let a=e.material;return a&&(Array.isArray(a)?a:[a]).map(i=>i.name?.trim()||i.type).filter(Boolean).join(", ")||void 0}function it(e,a,s){let m=e.domElement.width,i=e.domElement.height;if(m<=0||i<=0)return null;let g=e.getRenderTarget(),y=e.xr.enabled;try{return e.xr.enabled=!1,e.setRenderTarget(null),e.render(a,s),e.domElement.toDataURL("image/png")}catch{return null}finally{e.setRenderTarget(g),e.xr.enabled=y}}function Ve(e){let m=(e.parent?.children??[]).filter(y=>y.type===e.type&&y.name===e.name),i=Math.max(0,m.indexOf(e)),g=e.name.trim()||e.type;return`${encodeURIComponent(g)}[${i}]`}function J(e){let a=[],s=e;for(;s?.parent;)a.push(Ve(s)),s=s.parent;return a.reverse().join("/")}function _e(e){let a=e.userData.popmeltId;return typeof a=="string"&&a.trim()?a.trim():J(e)}function Ne(e){let a=e.userData.popmeltLabel;return typeof a=="string"&&a.trim()?a.trim():e.name.trim()||e.type}function $e(e){let a=e;for(;a.parent;){let s=a.name.trim(),m=s.match(/^(.*)_(?:alpha|normal|material)(?:_\d+)+$/i),i=a.parent;for(;i.parent&&!i.name.trim();)i=i.parent;let g=i.name.trim();if(!g||!s.startsWith(`${g}_`)&&!m)break;a=i}return a}function Ue(e,a,s){let m=new He().setFromObject(e,!0);if(m.isEmpty())return null;let i=s.getBoundingClientRect(),g=[];for(let o of[m.min.x,m.max.x])for(let f of[m.min.y,m.max.y])for(let R of[m.min.z,m.max.z])g.push(new Ie(o,f,R).project(a));let y=g.map(o=>i.left+(o.x+1)/2*i.width),b=g.map(o=>i.top+(1-o.y)/2*i.height),t=Math.max(i.left,Math.min(...y)),n=Math.min(i.right,Math.max(...y)),l=Math.max(i.top,Math.min(...b)),r=Math.min(i.bottom,Math.max(...b));return n<=t||r<=l?null:{left:t,top:l,width:n-t,height:r-l}}function ot(e){let a=e.raycaster??new ke,s=new ze,m=0,i,g=t=>e.key?.(t)??_e(t),y=(t,n)=>{let l=g(t);if(!l)return null;let r=Ue(t,e.camera,e.canvas);return r?{key:l,label:e.label?.(t)??Ne(t),sourceElement:e.canvas,bounds:r,context:J(t),data:{renderer:"Three.js",objectType:t.type,...t.name?{objectName:t.name}:{},scenePath:J(t),...n&&n!==t?{renderObjectName:n.name.trim()||n.type,renderObjectType:n.type,renderScenePath:J(n)}:{},position:ce(t.position),rotation:ce(t.rotation),scale:ce(t.scale),visible:String(t.visible),...we(t)?{material:we(t)}:{},...Object.fromEntries(Object.entries(e.describe?.(t)??{}).filter(o=>typeof o[1]=="string"&&o[1].length>0))}}:null},b=t=>{let n=null,l=!1;return e.scene.traverse(r=>{g(r)===t&&(n?l=!0:n=r)}),l?null:n};return{id:e.id?.trim()||"three",...e.sampleCanvas&&{sampleCanvas:{...e.sampleCanvas,element:e.canvas}},hitTest({x:t,y:n}){let l=e.canvas.getBoundingClientRect();if(t<l.left||t>l.right||n<l.top||n>l.bottom)return null;s.set((t-l.left)/l.width*2-1,-((n-l.top)/l.height)*2+1),a.setFromCamera(s,e.camera);for(let r of a.intersectObject(e.scene,!0)){let o=e.select?e.select(r.object):$e(r.object);if(!o||!o.visible)continue;let f=y(o,r.object);if(f)return f}return null},highlightHover(t,n){let l=b(t);if(!l)return;i?.();let r=be(l,n,e,()=>m>0);return i=r,()=>{i===r&&(i=void 0,r())}},resolve(t){let n=b(t);return n?y(n):null},...e.captureFrame?{async captureSurfaces(){m++;try{let t=await e.captureFrame?.();return t?[{element:e.canvas,dataUrl:t}]:[]}finally{m--,i&&e.invalidate?.()}}}:{}}}export{it as captureThreeRendererFrame,ot as createThreeSubjectAdapter,$e as selectThreeNamedPrimitiveParent,J as threeObjectPath};
@@ -1 +1 @@
1
- import{L as e,c as o,d as s}from"./chunk-7CGKO4IU.mjs";import"./chunk-PYGRFSUU.mjs";import"./chunk-HV7HRQ2S.mjs";import"./chunk-RUJC32MA.mjs";import"./chunk-QXVMGZFP.mjs";var t=parseInt(process.env.POPMELT_PORT||"1111",10),r=process.env.POPMELT_PROJECT_ROOT||process.cwd(),c=process.env.POPMELT_DEV_ORIGIN||void 0,p=process.env.POPMELT_COPILOT_PATH||void 0,a=process.env.POPMELT_CDP_URL||void 0;(async function(){let i=await e({port:t,projectRoot:r,devOrigin:c,copilotPath:p,opencodePath:process.env.POPMELT_OPENCODE_PATH||void 0,nativeCaptureUrl:a,restartMode:"detached"}),n={pid:process.pid,port:i.port,startedAt:Date.now()};await o(r,n),await new Promise(e=>{let o=!1,t=async()=>{o||(o=!0,await i.close(),await s(r,n),e(),process.exit(0))};process.on("SIGTERM",t),process.on("SIGINT",t)})})().catch(e=>{console.error("[popmelt bridge-entry] Fatal:",e),process.exit(1)});
1
+ import{O as o,b as s,c as e}from"./chunk-SNAJBV7T.mjs";import"./chunk-PYGRFSUU.mjs";import"./chunk-6EO73WJN.mjs";import"./chunk-RUJC32MA.mjs";import"./chunk-QXVMGZFP.mjs";import"./chunk-UTP56NCY.mjs";import"./chunk-GLF7Z5IR.mjs";import"./chunk-YMWXWXPV.mjs";import"./chunk-KF73S7MG.mjs";var r=parseInt(process.env.POPMELT_PORT||"1111",10),t=process.env.POPMELT_PROJECT_ROOT||process.cwd(),c=process.env.POPMELT_DEV_ORIGIN||void 0,p=process.env.POPMELT_COPILOT_PATH||void 0,i=process.env.POPMELT_CDP_URL||void 0;(async function(){let n=await o({port:r,projectRoot:t,devOrigin:c,copilotPath:p,cursorPath:process.env.POPMELT_CURSOR_PATH||void 0,opencodePath:process.env.POPMELT_OPENCODE_PATH||void 0,nativeCaptureUrl:i,restartMode:"detached"}),P={pid:process.pid,port:n.port,startedAt:Date.now()};await s(t,P),await new Promise(o=>{let s=!1,r=async()=>{s||(s=!0,await n.close(),await e(t,P),o(),process.exit(0))};process.on("SIGTERM",r),process.on("SIGINT",r)})})().catch(o=>{console.error("[popmelt bridge-entry] Fatal:",o),process.exit(1)});
@@ -0,0 +1 @@
1
+ "use client";import{g as e}from"./chunk-AGCS65LT.mjs";import"./chunk-SUAHDXJZ.mjs";async function t(t,r,a,n){if(r.aborted)return;let o=await e(t,{signal:r});if(!o.ok||!o.body||!o.headers.get("content-type")?.includes("text/event-stream"))throw new Error("Event stream unavailable");if(r.aborted)return;a();let i=o.body.getReader(),s=new TextDecoder,l="",d="message",c=[],f=0;try{for(;!r.aborted;){let e,t=await i.read();if(t.done)throw new Error("Event stream ended");if(l+=s.decode(t.value,{stream:!0}),l.length>2097152)throw new Error("Event frame too large");for(;-1!==(e=l.indexOf("\n"));){let t=l.slice(0,e).replace(/\r$/,"");if(l=l.slice(e+1),t){if(t.startsWith("event:"))d=t.slice(6).trimStart();else if(t.startsWith("data:")&&(c.push(t.slice(5).replace(/^ /,"")),f+=t.length,f>2097152))throw new Error("Event frame too large")}else c.length&&n(d,c.join("\n")),d="message",c=[],f=0}}}finally{await i.cancel().catch(()=>{})}}export{t as readBridgeSSE};
@@ -0,0 +1 @@
1
+ "use client";import{j as e}from"./chunk-AGCS65LT.mjs";import"./chunk-SUAHDXJZ.mjs";async function t(t,r,n){if(r.aborted)return;let o=new URL(t);if("http:"!==o.protocol||!["localhost","127.0.0.1","[::1]"].includes(o.hostname))throw new Error("WebSocket experiment requires a local bridge");let i=new URL(o);i.pathname="/events/ticket";let a=new AbortController,s=()=>a.abort();r.addEventListener("abort",s,{once:!0});let c=setTimeout(s,1e4);try{let s=await fetch(i,e(t,{method:"POST",signal:a.signal,redirect:"error",credentials:"omit"}));if(!s.ok)throw new Error("Event subscription unavailable");let l=await s.json();if(1!==l.version||"string"!=typeof l.ticket||l.ticket.length>128)throw new Error("Invalid event subscription");if(a.signal.aborted){if(r.aborted)return;throw new Error("Event subscription timed out")}o.protocol="ws:",o.pathname="/events/socket",o.search="",o.hash="",await new Promise((e,t)=>{let i=new WebSocket(o),s=!1,d=!1,v=n=>{d||(d=!0,a.signal.removeEventListener("abort",p),i.close(),n&&!r.aborted?t(n):e())},p=()=>v(new Error("Event subscription ended"));a.signal.addEventListener("abort",p,{once:!0}),i.onopen=()=>i.send(JSON.stringify({version:1,type:"subscribe",ticket:l.ticket})),i.onerror=()=>v(new Error("Event socket unavailable")),i.onclose=()=>v(new Error("Event socket ended")),i.onmessage=({data:e})=>{if(!d)try{if("string"!=typeof e||e.length>2097152)throw new Error("Invalid event frame");let t=JSON.parse(e);if(1!==t.version)throw new Error("Unsupported event protocol");if(s||"connected"!==t.type){if(!s||"event"!==t.type||"string"!=typeof t.event?.type)throw new Error("Unexpected event frame");n(t.event.type,JSON.stringify(t.event))}else s=!0,clearTimeout(c),n("connected",JSON.stringify({status:"connected"}))}catch{v(new Error("Invalid event frame"))}}})}finally{a.abort(),clearTimeout(c),r.removeEventListener("abort",s)}}export{t as readBridgeWebSocket};
@@ -0,0 +1 @@
1
+ "use client";import{b as m,a as r}from"./chunk-YU3ZY76H.mjs";import"./chunk-WC4ZNVFM.mjs";import"./chunk-4OEHQ6M7.mjs";import"./chunk-LOUWY55X.mjs";import"./chunk-PH2MLB3T.mjs";import"./chunk-ELKVFX2O.mjs";import"./chunk-PWQB3FIW.mjs";import"./chunk-Q6N77LIS.mjs";import"./chunk-ZVDKW7TO.mjs";import"./chunk-XTOCFTVW.mjs";import"./chunk-Q74FBX2I.mjs";import"./chunk-XY7YW7SH.mjs";import"./chunk-SOGN7S54.mjs";import"./chunk-YVT3J6JB.mjs";import"./chunk-EZVFCJEG.mjs";import"./chunk-IAXSC2ZN.mjs";import"./chunk-KCDHP4N3.mjs";import"./chunk-LXFKOYLK.mjs";import"./chunk-OVZ4CQGM.mjs";import"./chunk-BYASSHKJ.mjs";import"./chunk-I7AI52RX.mjs";import"./chunk-FHCKFQBY.mjs";import"./chunk-APP5IYTE.mjs";import"./chunk-B2ISA6V6.mjs";import"./chunk-DRPRASD6.mjs";import"./chunk-B22WBEQC.mjs";import"./chunk-CIA6WVXQ.mjs";import"./chunk-G2ZHJXHZ.mjs";import"./chunk-TMSGNHXH.mjs";import"./chunk-53SKVMWR.mjs";import"./chunk-76WRZ2NH.mjs";import"./chunk-AGYBVMHX.mjs";import"./chunk-YYFF2X3L.mjs";import"./chunk-L6S66APQ.mjs";import"./chunk-FJWWBKCQ.mjs";import"./chunk-RK6UROPO.mjs";import"./chunk-5IZHN3A7.mjs";import"./chunk-AOTDTBQO.mjs";import"./chunk-HAZXZ5TU.mjs";import"./chunk-JEGBAHYK.mjs";import"./chunk-I6FJ533W.mjs";import"./chunk-W2QQVB2H.mjs";import"./chunk-WP2SHSCG.mjs";import"./chunk-AAMUU2QA.mjs";import"./chunk-LH7HKUCK.mjs";import"./chunk-BVGHHT3Y.mjs";import"./chunk-X6I6KQDG.mjs";import"./chunk-ATLUO4G7.mjs";import"./chunk-Q6C7ZA3H.mjs";import"./chunk-SOT33EQ4.mjs";import"./chunk-C2ZSNUXQ.mjs";import"./chunk-EBJ23A7F.mjs";import"./chunk-EILBHZDX.mjs";import"./chunk-XJJDBMZI.mjs";import"./chunk-OREALBUO.mjs";import"./chunk-B4DYUYX4.mjs";import"./chunk-CK3CDA3L.mjs";import"./chunk-NI77Y3WC.mjs";import"./chunk-FON4QY7P.mjs";import"./chunk-OA63PYHZ.mjs";import"./chunk-ECMLCGAM.mjs";import"./chunk-N2ZEZCHO.mjs";import"./chunk-J3UIBBU2.mjs";import"./chunk-PRPXMDZ7.mjs";import"./chunk-A4GARXVQ.mjs";import"./chunk-AGCS65LT.mjs";import"./chunk-SUAHDXJZ.mjs";import{createElement as t}from"react";import{createRoot as o}from"react-dom/client";function n(n,u){let i=o(n);return i.render(t(m,u)),()=>{i.unmount(),r()}}export{n as mountBrowserRuntime};
@@ -1,7 +1,7 @@
1
- import { P as PopmeltOptions } from './participantBootstrap-DFJlcKRI.mjs';
2
- export { i as isPopmeltPreview } from './participantBootstrap-DFJlcKRI.mjs';
3
- import './subjects-DdavjSTL.mjs';
4
- import './video-adapter-DB6Hex1f.mjs';
1
+ import { P as PopmeltOptions } from './participantBootstrap-DuosDN9G.mjs';
2
+ export { i as isPopmeltPreview } from './participantBootstrap-DuosDN9G.mjs';
3
+ import './subjects-BhO1x5tz.mjs';
4
+ import './video-adapter-B8J5awc_.mjs';
5
5
 
6
6
  type PopmeltMount = {
7
7
  /** Remove this integration's UI and subscriptions; saved work is retained. */
package/dist/browser.mjs CHANGED
@@ -1 +1 @@
1
- "use client";export{a as isPopmeltPreview}from"./chunk-EX63NVDN.mjs";var t={unmount(){}};async function e(e={}){if(!e.enabled||typeof document>"u")return t;if(document.querySelector("[data-popmelt-browser-host], [data-popmelt-top-layer-host]"))throw new Error("Popmelt is already mounted. Unmount it before mounting again.");let o=document.createElement("div");o.setAttribute("data-popmelt-browser-host",""),o.setAttribute("data-devtools",""),document.documentElement.appendChild(o);let r=[["__POPMELT_PROJECT_ID__",e.projectId],["__POPMELT_BRIDGE_URL__",e.bridgeUrl]].flatMap(([t,e])=>{if(void 0===e)return[];let o=Object.prototype.hasOwnProperty.call(window,t),r=window[t],n=e??void 0;return window[t]=n,[()=>{window[t]===n&&(o?window[t]=r:delete window[t])}]}),n=()=>{o.remove();for(let t of r)t()};try{let{mountBrowserRuntime:t}=await(import("./browser-runtime-ILNTJLZ5.mjs"));if(!o.isConnected)throw new Error("Popmelt mount was removed before startup.");let r=t(o,e),a=!0;return{unmount(){if(a){a=!1;try{r()}finally{n()}}}}}catch(t){throw n(),t}}export{e as mountPopmelt};
1
+ "use client";export{a as isPopmeltPreview}from"./chunk-KCDHP4N3.mjs";import"./chunk-SUAHDXJZ.mjs";var t={unmount(){}};async function e(e={}){if(!e.enabled||typeof document>"u")return t;if(document.querySelector("[data-popmelt-browser-host], [data-popmelt-top-layer-host]"))throw new Error("Popmelt is already mounted. Unmount it before mounting again.");let o=document.createElement("div");o.setAttribute("data-popmelt-browser-host",""),o.setAttribute("data-devtools",""),document.documentElement.appendChild(o);let r=[["__POPMELT_PROJECT_ID__",e.projectId],["__POPMELT_BRIDGE_URL__",e.bridgeUrl]].flatMap(([t,e])=>{if(void 0===e)return[];let o=Object.prototype.hasOwnProperty.call(window,t),r=window[t],n=e??void 0;return window[t]=n,[()=>{window[t]===n&&(o?window[t]=r:delete window[t])}]}),n=()=>{o.remove();for(let t of r)t()};try{let{mountBrowserRuntime:t}=await(import("./browser-runtime-O3EKN3FI.mjs"));if(!o.isConnected)throw new Error("Popmelt mount was removed before startup.");let r=t(o,e),i=!0;return{unmount(){if(i){i=!1;try{r()}finally{n()}}}}}catch(t){throw n(),t}}export{e as mountPopmelt};
@@ -0,0 +1 @@
1
+ "use client";import{b as e}from"./chunk-FON4QY7P.mjs";import"./chunk-AGCS65LT.mjs";import"./chunk-SUAHDXJZ.mjs";async function t(t,o,r,n,s,a){let i="claude"===n[1].toLowerCase()?"Claude":"Codex";if(!s)throw new Error("Only the host can send a chat note.");if(a)throw new Error("Send a text-only note.");let d=r.find(e=>e.provider===i&&e.linked),m=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(n[2])),g=Array.from(new Uint8Array(m),e=>e.toString(16).padStart(2,"0")).join(""),h=e=>JSON.stringify(["popmelt-note",t,o,e,g]),S=h(i),c=h(d?.id??i),l=sessionStorage.getItem(S)??sessionStorage.getItem(c)??crypto.randomUUID();sessionStorage.setItem(S,l);let p=await e(`${t}/participants/send-to-${i.toLowerCase()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:o,text:n[2],requestId:l,linkId:d?.id})}),I=await p.json();if(!p.ok||!I.queuedInChat&&!I.availableInChat)throw new Error(I.error??"The bridge did not confirm delivery.");return sessionStorage.getItem(S)===l&&sessionStorage.removeItem(S),sessionStorage.getItem(c)===l&&sessionStorage.removeItem(c),{jobId:I.jobId}}export{t as sendCanvasChatNote};
@@ -0,0 +1 @@
1
+ "use client";import{b as e}from"./chunk-OFJUTWJU.mjs";import{b as t}from"./chunk-FON4QY7P.mjs";import"./chunk-AGCS65LT.mjs";import"./chunk-SUAHDXJZ.mjs";async function o(o,n){if(!/^[a-f0-9]{64}$/.test(n.hash)||"string"!=typeof n.ticket)return;let r,i=!0;try{let r=await t(o+"/files/explore-"+n.hash+".json",{signal:AbortSignal.timeout(8e3)});if(!r.ok)throw Error("The browser could not load the fixture bundle.");let a=await r.json();i=!1,await async function(t,o){let n=document.createElement("iframe");n.sandbox.add("allow-scripts"),n.referrerPolicy="no-referrer",n.tabIndex=-1,n.inert=!0,n.setAttribute("aria-hidden","true"),n.setAttribute("data-devtools","explore-check");let r=320;try{r=document.querySelector(o)?.getBoundingClientRect().width||r}catch{}n.style.cssText="position:fixed;inset:0 auto auto 0;height:260px;border:0;opacity:0;pointer-events:none",n.style.width=Math.min(1440,Math.max(200,r))+"px";let{port1:i,port2:a}=new MessageChannel;try{await new Promise((o,s)=>{let c=setTimeout(()=>l("The fixture did not mount visible content within 12 seconds."),12e3),l=e=>{clearTimeout(c),e?s(new Error(e)):o()};i.onmessage=({data:e})=>{"painted"===e?.type&&l(),"error"===e?.type&&l(String(e.message||"The fixture failed to mount.").slice(0,500))},n.onload=()=>n.contentWindow?.postMessage({bundle:t,initial:[],reference:{style:{},width:r,fonts:"",lightInk:"#222",darkInk:"#ddd"},framing:{pageScale:null,focusX:0,focusY:0},accent:"#f00",mirror:!0,check:!0},"*",[a]),n.srcdoc=e,document.body.append(n)})}finally{n.onload=null,n.remove(),i.close(),a.close()}}(a,n.selector)}catch(e){r=e instanceof Error?e.message.slice(0,500):"The preview could not start."}await t(o+"/explore/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ticket:n.ticket,error:r,unavailable:i}),signal:AbortSignal.timeout(4e3)})}export{o as checkFixture};
@@ -0,0 +1 @@
1
+ "use client";import{h as t,g as e,e as r}from"./chunk-AGCS65LT.mjs";import{c as i,b as n}from"./chunk-SUAHDXJZ.mjs";var s="popmelt-join",o=/^[A-Za-z0-9_-]{43}$/;function a(t,e,r){let n=new URL(t);if(!["http:","https:"].includes(n.protocol)||!["localhost","127.0.0.1","[::1]"].includes(n.hostname)||!o.test(e))throw new Error("A local page and valid invitation are required");if(r){let t=new URL(r),n=/^(?:192\.168\.|10\.|172\.(?:1[6-9]|2\d|3[01])\.)/.test(t.hostname)&&/^\d+\.\d+\.\d+\.\d+$/.test(t.hostname);if(t.origin!==r||"https:"!==t.protocol||!n&&!i(r))throw new Error("Invalid guest invitation origin");return t.origin+"/__popmelt/join#"+s+"="+e}let a=c(n.href).cleanUrl,p=new URL(a);return p.hash=`${p.hash.slice(1)}${p.hash?"&":""}${s}=${e}`,p.href}function c(t){let e=new URL(t),r=null,i=e.hash.slice(1).split("&").filter(t=>{if(!t.startsWith(`${s}=`))return!0;let e=t.slice(13);return o.test(e)&&(r=e),!1});return e.hash=i.join("&"),{token:r,cleanUrl:e.href}}var p=class extends Error{constructor(t,e,r){super(e),this.status=t,this.code=r}},d=class{constructor(e,r,i,s=(...t)=>fetch(...t)){this.projectId=r,this.transport=s;let o=new URL(e);if(this.phone=t(e,r),!this.phone&&!n(e)&&("http:"!==o.protocol||!["localhost","127.0.0.1","[::1]"].includes(o.hostname)||o.username||o.password||o.search||o.hash||"/"!==o.pathname))throw new Error("Participant transport requires a local bridge origin");if(!r)throw new Error("Project identity required");this.base=this.phone||n(e)?e:o.origin,this.credential=i?{...i}:void 0}moderateStyles(t,e,r=!1){return this.rpc("moderate-styles",{participantId:t,styleModifications:e,restore:r})}moderateAnnotations(t,e,r=!1,i){return this.rpc("moderate-annotations",{participantId:t,annotationIds:e,restore:r,threadId:i})}async request(r,i,s={},o){let a=i instanceof FormData;if(this.phone&&!t(this.base,this.projectId))throw new Error("Phone pairing is no longer active");let c=await(this.phone?e:this.transport)(this.base+r,{method:"POST",redirect:"error",credentials:n(this.base)?"same-origin":"omit",signal:o??AbortSignal.timeout(3e4),headers:{...a?{}:{"Content-Type":"application/json"},"X-Popmelt-Project-Id":this.projectId,...this.credential&&!this.phone?{"X-Popmelt-Participant-Id":this.credential.participantId,"X-Popmelt-Participant-Token":this.credential.token}:{},...s},body:a?i:JSON.stringify(i)}),d=await c.json().catch(()=>null);if(!c.ok)throw new p(c.status,"string"==typeof d?.error?d.error:"Participant request failed","string"==typeof d?.code?d.code:void 0);if(null===d)throw new Error("Invalid participant response");return{data:d,status:c.status}}async rpc(t,e={},r){return(await this.request("/participants/"+t,e,{},r)).data}mountRequestScope(t){if(!this.credential)throw new Error("Join before mounting a canvas");return this.phone?()=>{}:r(this.base,{"X-Popmelt-Project-Id":this.projectId,"X-Popmelt-Participant-Id":this.credential.participantId,"X-Popmelt-Participant-Token":this.credential.token,...t?{"X-Popmelt-Source-Revision":t.revision}:{}})}source(){return this.rpc("source")}snapshot(){return this.rpc("snapshot")}setHostModelSelection(t){return this.rpc("model-selection",{selection:t})}reserveAdmissionColor(t){return this.rpc("access-color",{receipt:t})}requestAdmission(t,e,r){return this.rpc("access-request",{receipt:t,name:e,colorIdentity:r})}admissionStatus(t){return this.rpc("access-status",{receipt:t})}cancelAdmission(t){return this.rpc("access-cancel",{receipt:t})}admissions(){return this.rpc("access-list")}decideAdmission(t,e){return this.rpc("access-decide",{id:t,decision:e})}attention(){return this.rpc("attention-read")}async reportAttention(t,e,r,i,n){return(await this.request("/participants/attention",{runtime:t,phase:e,operationId:r,location:i},{},n??AbortSignal.timeout(1500))).data}invite(){return this.rpc("invite")}guestInvite(t,e=(typeof location>"u"?"/":location.pathname)){return this.rpc("guest-invite",{mode:t,pathname:e},AbortSignal.timeout("tunnel"===t?18e4:6e4))}revokeInvite(t){return this.rpc("revoke-invite",{invitation:t})}join(t,e,r){return this.rpc("join",{invitation:t,name:e,...r?{colorIdentity:r}:{}})}joinOrRequestAdmission(t,e,r){return this.rpc("join-or-request",{invitation:t,name:e,colorIdentity:r})}read(t,e,r=!1){return this.rpc("read",{participantId:t,historyVersion:2,...r&&{ownSource:!0}},e)}connect(t,e){return this.rpc("connect",{runtimeId:t,previousToken:e})}renew(t,e){return this.rpc("renew",{runtime:t,activeColor:e})}disconnect(t){return this.rpc("disconnect",{runtime:t})}publish(t,e,r,i){return r.sourceId!==this.projectId?Promise.reject(new Error("Source world mismatch")):this.rpc("publish",{runtime:t,expectedRevision:e,sourceRevision:r.revision,state:i})}merge(t,e,r,i){return r.sourceId!==this.projectId?Promise.reject(new Error("Source world mismatch")):this.rpc("merge",{runtime:t,expectedRevision:e,sourceRevision:r.revision,events:i,historyVersion:2})}rename(t){return this.rpc("rename",{name:t})}setProjectVisibility(t){return this.rpc("project-visibility",{visibility:t})}setPermission(t,e){return this.rpc("permission",{participantId:t,permission:e})}revokeAccess(t){return this.rpc("revoke-access",{participantId:t})}pending(){return this.rpc("pending")}preview(t){return this.rpc("preview-read",{participantId:t})}previewWanted(t){return this.rpc("preview-demand",{runtime:t})}publishPreview(t,e,r){return this.rpc("preview-publish",{runtime:t,image:e,geometry:r})}review(t){return this.rpc("review",{id:t})}discard(t){return this.rpc("discard",{id:t})}submission(t,e){if(202===e&&!0===t.pendingApproval&&"string"==typeof t.submissionId)return{status:"pending-approval",submissionId:t.submissionId,threadId:"string"==typeof t.threadId?t.threadId:void 0};if(200===e&&"string"==typeof t.jobId&&"string"==typeof t.threadId&&"number"==typeof t.position)return{...t,status:"queued",jobId:t.jobId,threadId:t.threadId,position:t.position};throw new Error("Unexpected participant submission response")}async send(t,e,r){if(r.sourceId!==this.projectId)throw new Error("Source world mismatch");let i=await this.request("/send",t,{"X-Popmelt-Draft-Revision":String(e),"X-Popmelt-Source-Revision":r.revision});return this.submission(i.data,i.status)}contribute(t,e){return this.rpc("contribute",{threadId:t,text:e})}async approve(t,e){let r=await this.request("/participants/approve",{id:t,revision:e});return this.submission(r.data,r.status)}};function h(t){return t instanceof p?t.status>=500||408===t.status||429===t.status||409===t.status&&("runtime_expired"===t.code||"draft_conflict"===t.code):t instanceof TypeError||"object"==typeof t&&null!==t&&"name"in t&&("TimeoutError"===t.name||"AbortError"===t.name)}function u(t,e=8e3){return Math.min(1e3*2**Math.min(Math.max(0,t-1),10),e)*(.5+.5*Math.random())}export{p as a,d as b,h as c,u as d,a as e,c as f};