@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 +0,0 @@
1
- "use client";import{a as e}from"./chunk-RIGP4DAV.mjs";import{Raycaster as t,Vector2 as r,Vector3 as n,Color as a,Box3 as i,Matrix3 as o,Plane as l,Matrix4 as s,Vector4 as c,WebGLRenderTarget as u,Frustum as d,MeshBasicMaterial as p,EqualDepth as f}from"three";import{clone as m}from"three/examples/jsm/utils/SkeletonUtils.js";function h(e){try{return JSON.parse(e)}catch{return null}}function x(e,t){return Array.isArray(e)&&e.length===t&&e.every(Number.isFinite)}function g(e){let t=e;return!!t&&"string"==typeof t.source&&!!t.source&&t.source.length<=2048&&x(t.position,3)&&x(t.scale,3)&&x(t.quaternion,4)}function y(e){let t=h(e);if(!Array.isArray(t))return null;let r=new Set;for(let e of t){if(!e||"string"!=typeof e.key||!/^placed-[\w-]{1,128}$/.test(e.key)||r.has(e.key)||!g(e.sample))return null;r.add(e.key)}return t}function v(e,t){let r=m(e),n=new Map;function a(e){let t=n.get(e);return t||(t=e.clone(),t.transparent=!0,t.opacity*=.5,t.depthWrite=!1,n.set(e,t)),t}return r.traverse(e=>{if(t){e.raycast=()=>{},e.castShadow=!1,"isLight"in e&&(e.visible=!1);let t=e;t.material&&(t.material=Array.isArray(t.material)?t.material.map(a):a(t.material))}}),{object:r,dispose(){for(let e of n.values())e.dispose();r.traverse(e=>{"isSkinnedMesh"in e&&e.skeleton.dispose(),"isInstancedMesh"in e&&e.dispose(),"shadow"in e&&e.shadow?.dispose()})}}}function w(e,t){e.position.fromArray(t.position),e.quaternion.fromArray(t.quaternion),e.scale.fromArray(t.scale),e.updateMatrix(),e.updateWorldMatrix(!0,!0)}function b(e,a){let s,c,u=new Map,d=new WeakMap,p=new t,f="[]";function m(e){e.object.removeFromParent(),d.delete(e.object),e.dispose?.()}function x(e){return a(e.source)}function b(){c=void 0,s&&(m(s),s=void 0,e.invalidate?.())}return{codec:{format:"popmelt-three-instance/v1",placementOnly:!0,read:()=>f,accepts:e=>null!==y(e),write(t){let r=y(t);if(!r)return;let n=new Map;try{for(let{key:t,sample:a}of r){if(u.get(t)?.sample.source===a.source)continue;let r=x(a);if(!r?.parent)throw Error("The sampled Three.js object is unavailable.");let i=e.sampling?.duplicate?.(r)??v(r,!1);if(i.object.parent||i.object===e.scene)throw Error("A sampled object must be a fresh, detached instance.");n.set(t,i)}}catch(e){for(let e of n.values())m(e);return void console.warn("[Popmelt] Could not create the sampled Three.js object.",e)}let a=new Set(r.map(e=>e.key));for(let[e,t]of u)a.has(e)&&!n.has(e)||(m(t),u.delete(e));for(let{key:e,sample:t}of r){let r=n.get(e);r&&(r.object.traverse(t=>{t!==r.object&&"string"==typeof t.userData.popmeltId&&(t.userData.popmeltId=e+"/"+t.userData.popmeltId)}),r.object.userData.popmeltId=e,d.set(r.object,e),x(t).parent.add(r.object),u.set(e,{...r,sample:t}));let a=u.get(e);a.sample=t,w(a.object,t)}f=t,e.invalidate?.()},objects:{read(t,r){let n=y(t)?.find(e=>e.key===r);if(n)return JSON.stringify(n.sample);let i=a(r);return i?.parent&&i!==e.scene?JSON.stringify({source:r,position:i.position.toArray(),quaternion:i.quaternion.toArray(),scale:i.scale.toArray()}):null},replace:()=>null,placement:{canPlace(e){let t=h(e);return g(t)&&!!x(t)?.parent},at(t,a){let c=h(t);if(!g(c))return null;let u=x(c);if(!u?.parent)return null;let d=e.canvas.getBoundingClientRect();if(!d.width||!d.height)return null;e.scene.updateWorldMatrix(!0,!0),e.camera.updateWorldMatrix(!0,!1),p.layers.mask=e.camera.layers.mask,p.setFromCamera(new r((a.x-d.left)/d.width*2-1,1-(a.y-d.top)/d.height*2),e.camera);let f=p.intersectObject(e.scene,!0).find(({object:e})=>{for(let t=e;t;t=t.parent)if(!t.visible||t===u||t===s?.object)return!1;return!0}),m=e.sampling?.position?.(u,f,p.ray);if(null===m)return null;if(!m){let t=(new i).setFromObject(u);if(t.isEmpty())return null;let r=t.getCenter(new n),a=u.getWorldPosition(new n);if(f){let e=f.face?.normal.clone().applyNormalMatrix((new o).getNormalMatrix(f.object.matrixWorld))??p.ray.direction.clone().negate();e.dot(p.ray.direction)>0&&e.negate();let r=t.getSize(new n),a=(Math.abs(e.x)*r.x+Math.abs(e.y)*r.y+Math.abs(e.z)*r.z)/2;m=f.point.clone().addScaledVector(e,a)}else{let t=(new l).setFromNormalAndCoplanarPoint(e.camera.getWorldDirection(new n),r);if(m=p.ray.intersectPlane(t,new n),!m)return null}m.add(a.sub(r))}return c.position=u.parent.worldToLocal(m.clone()).toArray(),JSON.stringify(c)},preview(t){let r=t&&h(t),n=g(r)&&x(r);if(!n||!g(r)||!n.parent)return b();if(c!==n){if(s?.source!==n){b();try{s={...v(n,!0),source:n}}catch{return void(c=n)}d.set(s.object,""),n.parent.add(s.object)}w(s.object,r),e.invalidate?.()}},insert(e,t,r){let n=y(e),i=h(r);return n&&/^placed-[\w-]{1,128}$/.test(t)&&g(i)&&x(i)?.parent&&!a(t)?JSON.stringify([...n.filter(e=>e.key!==t),{key:t,sample:i}]):null}}}},owner:function(e){if(s||u.size)for(;e;){let t=d.get(e);if(void 0!==t)return t;e=e.parent}},placed:u}}function M(e,t){let r=e.texture;return t.applyMatrix3(r.matrix),t.x*=e.fields.width,t.y=(r.flipY?1-t.y:t.y)*e.fields.height,t}function j(e,t){let r=e.texture.channel?1===e.texture.channel?t.uv1:void 0:t.uv;if(!r)return null;e.texture.matrixAutoUpdate&&e.texture.updateMatrix();let n=M(e,r.clone());return e.fields.hit(n.x,n.y)}function T(e,t,r,n){let a=[],i=e.at(-1);for(let o of e){if(!i)break;let e=n*(i.uv[t]-r),l=n*(o.uv[t]-r);if(Math.sign(e)*Math.sign(l)<0){let t=e/(e-l);a.push({uv:i.uv.clone().lerp(o.uv,t),pos:i.pos.clone().lerp(o.pos,t)})}l>=0&&a.push(o),i=o}return a}function S(t,a,i,o){let{mesh:l,texture:s,fields:c}=t,u=c.bounds(a);if(!u)return null;for(let e=l;e;e=e.parent)if(!e.visible)return null;let d=l.geometry,p=d.getAttribute(s.channel?"uv"+s.channel:"uv");if(!p)return null;let f=d.index,m=f?.count??p.count,h=o.getBoundingClientRect(),x=[];l.updateWorldMatrix(!0,!1),s.matrixAutoUpdate&&s.updateMatrix();for(let e=d.drawRange.start;e+2<Math.min(m,d.drawRange.start+d.drawRange.count);e+=3){let a=[];for(let i=0;i<3;i++){let o=f?f.getX(e+i):e+i;a.push({uv:M(t,new r(p.getX(o),p.getY(o))),pos:l.getVertexPosition(o,new n)})}a=T(a,"x",u.left,1),a=T(a,"x",u.left+u.width,-1),a=T(a,"y",u.top,1),a=T(a,"y",u.top+u.height,-1);for(let{pos:e}of a){let t=e.applyMatrix4(l.matrixWorld).project(i);t.z>=-1&&t.z<=1&&x.push({x:h.left+(t.x+1)*h.width/2,y:h.top+(1-t.y)*h.height/2})}}let g=e(x);return!g||g.width<=0||g.height<=0?null:{key:a,label:a,context:t.context??l.name,sourceElement:o,bounds:g}}function A(e,t,n,o,l,p){let f=e.ownerDocument,m=f.defaultView,h=f.createElement("span");h.dataset.devtools="three-hover-layer",h.setAttribute("aria-hidden","true"),h.style.cssText="all:initial!important;position:absolute!important;display:block!important;overflow:hidden!important;pointer-events:none!important;box-sizing:border-box!important;";let x=f.createElement("canvas");x.style.cssText="position:absolute;pointer-events:none;",h.attachShadow({mode:"open"}).append(x);let g,y,v,w,b=new r,M=new c,j=new i,T=new s,S=new d,A=new u(1,1),C=new a,R=null,k=new Uint8Array(0),P=-1,W=!1,F=!1,D=!1,z=0,O=!1;function I(){z++,h.remove()}return{paint:function(r,a,i,c){if(D||!m||!e.isConnected||r.getRenderTarget())return!1;let u=e.getBoundingClientRect(),d=m.devicePixelRatio||1;if(r.getDrawingBufferSize(b),b.x+1>=u.width*d&&b.y+1>=u.height*d||!u.width||!u.height||r.getScissorTest())return(h.isConnected||W)&&I(),!1;if(r.getCurrentViewport(M),M.x||M.y||M.z!==b.x||M.w!==b.y||(R??(R=x.getContext("2d")),!R))return!1;if(function(t){if(w)return;let r=t.onAfterRender,n=Object.hasOwn(t,"onAfterRender"),a=function(...t){r.apply(this,t);let n=t[0];n.domElement===e&&!n.getRenderTarget()&&P!==n.info.render.frame&&!p()&&I()};t.onAfterRender=a,w=()=>{t.onAfterRender===a&&(n?t.onAfterRender=r:Reflect.deleteProperty(t,"onAfterRender"))}}(a),P===r.info.render.frame)return!0;if(P=r.info.render.frame,W)return F=!0,!0;T.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),j.setFromObject(t).applyMatrix4(T);let f=Math.max(0,8*Math.floor(((j.min.x+1)*u.width/2-3)/8)/u.width),E=Math.min(1,8*Math.ceil(((j.max.x+1)*u.width/2+3)/8)/u.width),B=Math.max(0,8*Math.floor(((1-j.max.y)*u.height/2-3)/8)/u.height),N=Math.min(1,8*Math.ceil(((1-j.min.y)*u.height/2+3)/8)/u.height),V=E-f,H=N-B;if(!(V>0&&H>0))return I(),!0;let L=u.width*V,q=u.height*H,U=Math.min(Math.max(2,d),Math.sqrt(2097152/(L*q)),r.capabilities.maxTextureSize/Math.max(L,q)),$=Math.max(1,Math.ceil(L*U)),_=Math.max(1,Math.ceil(q*U));A.setSize($,_),g!==i&&(g=i,y=Object.create(i),y.projectionMatrix=new s,y.projectionMatrixInverse=new s),T.set(1/V,0,0,(1-f-E)/V,0,1/H,0,(B+N-1)/H,0,0,1,0,0,0,0,1),y.projectionMatrix.multiplyMatrices(T,i.projectionMatrix),y.projectionMatrixInverse.copy(y.projectionMatrix).invert(),T.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse),S.setFromProjectionMatrix(T);let J=y,G=r.renderLists.get(a,0),X=[G.opaque,G.transmissive,G.transparent],Y=r.getClearAlpha();r.getClearColor(C);let K,Q=z;try{r.setRenderTarget(A),r.setClearColor(0,0),r.state.buffers.color.setMask(!0),r.state.buffers.depth.setMask(!0),r.clear();for(let e of X)for(let{object:t,geometry:n,material:o,group:l}of e){if(!n||!o.depthWrite||!t.layers.test(i.layers)||t.frustumCulled&&!S.intersectsObject(t))continue;t.modelViewMatrix.multiplyMatrices(J.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix);let e=o.colorWrite;try{o.colorWrite=!1,r.renderBufferDirect(J,a,n,o,t,l)}finally{o.colorWrite=e}}for(let e of X)for(let{object:t,geometry:r,material:a,group:o}of e)!r||!n.has(t)||!a.colorWrite||!t.layers.test(i.layers)||c(J,t,r,a,o,U);k.length!==$*_*4&&(k=new Uint8Array($*_*4)),r.readRenderTargetPixelsAsync?K=r.readRenderTargetPixelsAsync(A,0,0,$,_,k):r.readRenderTargetPixels(A,0,0,$,_,k)}finally{r.setClearColor(C,Y),r.setRenderTarget(null),r.state.viewport(M)}function Z(){if(z!==Q||!e.isConnected||!R||!m)return;if(!v||v.width!==$||v.height!==_){x.width=$,x.height=_,v=R.createImageData($,_);for(let e=0;e<v.data.length;e+=4)v.data[e]=o>>16&255,v.data[e+1]=o>>8&255,v.data[e+2]=255&o}for(let e=0;e<_;e++){let t=e*$*4+3,r=(_-e-1)*$*4+3;for(let e=0;e<$;e++,t+=4,r+=4)v.data[t]=k[r]}R.putImageData(v,0,0);let t=m.getComputedStyle(e),r=(e,t)=>h.style.setProperty(e,t,"important");r("position","fixed"===t.position?"fixed":"absolute"),r("left",e.offsetLeft+"px"),r("top",e.offsetTop+"px"),r("width",e.offsetWidth+"px"),r("height",e.offsetHeight+"px"),r("border-radius",t.borderRadius),r("transform",t.transform),r("transform-origin",t.transformOrigin),r("z-index",t.zIndex);let n=parseFloat(t.paddingLeft)||0,a=parseFloat(t.paddingTop)||0,i=e.clientWidth-n-(parseFloat(t.paddingRight)||0),l=e.clientHeight-a-(parseFloat(t.paddingBottom)||0);x.style.left=e.clientLeft+n+f*i+"px",x.style.top=e.clientTop+a+B*l+"px",x.style.width=V*i+"px",x.style.height=H*l+"px",h.parentNode!==e.parentNode&&e.after(h)}return K?(W=!0,K.then(Z,()=>{Q===z&&(D=!0,I())}).finally(()=>{W=!1,!O&&(F||D)&&l?.(),F=!1})):Z(),!0},dispose:function(){O=!0,I(),w?.(),A.dispose()}}}function C(e,t,n,o){let l=t;if(!t.startsWith("#")){let e=n.canvas.ownerDocument.createElement("canvas");e.width=e.height=1;let r=e.getContext("2d");if(r){r.fillStyle=t,r.fillRect(0,0,1,1);let e=r.getImageData(0,0,1,1).data;l=e[0]<<16|e[1]<<8|e[2]}}let d=function(e,t,n){let o,l=t.ownerDocument.defaultView,d=l?.matchMedia?.("(prefers-reduced-motion: reduce)"),p=performance.now(),f=0,m={value:0},h=new r,x=new i,g=new s,y=new c;n&&d?.addEventListener("change",n);let v,w=new u(1,1,{depthBuffer:!1}),b=new c,M=new r,j=new r,T=new a,S=-1,A=null;return{update:function(t,r,a,i){let s=t.getRenderTarget();if(S===t.info.render.frame&&v===a&&A===s)return;S=t.info.render.frame,v=a,A=s,t.getCurrentViewport(b),s?M.set(s.width,s.height):t.getDrawingBufferSize(M);let c=t.domElement.getBoundingClientRect();w.setSize(Math.max(1,b.z),Math.max(1,b.w)),j.set(1*(i??M.x/Math.max(1,c.width))/w.width,1*(i??M.y/Math.max(1,c.height))/w.height);let u=performance.now();if(d?.matches)m.value=-1;else{g.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),x.setFromObject(e).applyMatrix4(g);let t=Math.max(1e-4,x.max.x-x.min.x),r=Math.max(1e-4,x.max.y-x.min.y),i=1/(2*j.x),s=1/(2*j.y);y.set((x.min.x+x.max.x)/2,(x.min.y+x.max.y)/2,i,s),h.set(Math.max(.5,(t*i-1)/2),Math.max(.5,(r*s-1)/2));let c=4*(h.x+h.y);m.value>=0&&Number.isFinite(c)&&c>0&&(f=(f+72*(u-p)/(1e3*c))%1),m.value=Number.isFinite(c)?f*c:-1,n&&l&&void 0===o&&(o=l.requestAnimationFrame(()=>{o=void 0,n()}))}p=u;let C=t.getActiveCubeFace(),R=t.getActiveMipmapLevel(),k=t.getClearAlpha();t.getClearColor(T);try{t.setRenderTarget(w),t.setClearColor(0,0),t.state.buffers.color.setMask(!0),t.clear(!0,!1,!1),e.traverseVisible(e=>{let n=e;if(!n.isMesh||!n.layers.test(a.layers))return;n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld),n.normalMatrix.getNormalMatrix(n.modelViewMatrix);let{geometry:i,material:o}=n;if(Array.isArray(o))for(let e of i.groups){let l=o[e.materialIndex??0];l?.visible&&l.colorWrite&&t.renderBufferDirect(a,r,i,l,n,e)}else o.visible&&o.colorWrite&&t.renderBufferDirect(a,r,i,o,n,null)})}finally{t.setClearColor(T,k),t.setRenderTarget(s,C,R),t.state.viewport(b)}},applyTo:function(e){e.onBeforeCompile=e=>{e.uniforms.hoverMask={value:w.texture},e.uniforms.hoverViewport={value:b},e.uniforms.traceHeadPx=m,e.uniforms.traceHalfSizePx={value:h},e.uniforms.traceBounds={value:y},e.uniforms.hoverStep={value:j},e.fragmentShader=`\n uniform sampler2D hoverMask;\n uniform vec4 hoverViewport;\n uniform vec2 hoverStep;\n uniform float traceHeadPx;\n uniform vec2 traceHalfSizePx;\n uniform vec4 traceBounds;\n float traceStrength(vec2 uv) {\n if (traceHeadPx < 0.0) return 0.0;\n // Map a ray from the subject center to clockwise CSS-pixel distance\n // on the projected bounds. Crossings of holes keep the same sweep.\n vec2 ray = (2.0 * uv - 1.0 - traceBounds.xy) * traceBounds.zw / traceHalfSizePx;\n float radius = max(abs(ray.x), abs(ray.y));\n if (radius < 1e-7) return 0.0;\n vec2 edge = ray / radius;\n float w = traceHalfSizePx.x, h = traceHalfSizePx.y;\n float distancePx;\n if (ray.y >= abs(ray.x)) distancePx = edge.x * w;\n else if (ray.x >= abs(ray.y)) distancePx = w + (1.0 - edge.y) * h;\n else if (-ray.y >= abs(ray.x)) distancePx = (2.0 - edge.x) * w + 2.0 * h;\n else distancePx = 3.0 * w + (3.0 + edge.y) * h;\n float perimeter = 4.0 * (w + h);\n float behind = mod(traceHeadPx - distancePx, perimeter);\n float segment = min(${24..toFixed(1)}, perimeter * 0.19);\n return clamp(2.0 - behind / max(segment, 0.0001), 0.0, 1.0);\n }\n float coverage(vec2 uv, float center) {\n return clamp(texture2D(hoverMask, uv).a / center, 0.0, 1.0);\n }\n `+e.fragmentShader.replace("#include <tonemapping_fragment>","\n vec2 uv = (gl_FragCoord.xy - hoverViewport.xy) / hoverViewport.zw;\n float center = max(texture2D(hoverMask, uv).a, 0.001);\n float tracer = traceStrength(uv);\n // The moving head fattens to two CSS pixels over the one-pixel resting line.\n vec2 span = hoverStep * (1.0 + tracer);\n vec2 dx = vec2(span.x, 0.0);\n vec2 dy = vec2(0.0, span.y);\n vec2 diag = 0.70710678 * span;\n float inside = min(min(coverage(uv + dx, center), coverage(uv - dx, center)), min(coverage(uv + dy, center), coverage(uv - dy, center)));\n inside = min(inside, min(coverage(uv + diag, center), coverage(uv - diag, center)));\n diag.y = -diag.y;\n inside = min(inside, min(coverage(uv + diag, center), coverage(uv - diag, center)));\n gl_FragColor.a *= mix(0.38, 1.0, (1.0 - inside) * mix(0.3, 1.0, tracer));\n #include <tonemapping_fragment>\n ")}},dispose:function(){void 0!==o&&l?.cancelAnimationFrame(o),n&&d?.removeEventListener("change",n),w.dispose()}}}(e,n.canvas,n.invalidate),m=new Map,h=[],x=new Set,g=A(n.canvas,e,x,new a(l).getHex(),n.invalidate,o);function y(e,t,r,n,a,i,o,s){d.update(e,t,r,s);let c=m.get(i);c||(c=new p({color:l,transparent:!0,depthWrite:!1,toneMapped:!1,fog:!1}),d.applyTo(c),m.set(i,c)),c.opacity=i.transparent?i.opacity:1,c.side=i.side,c.depthTest=i.depthTest,c.depthFunc=i.depthWrite?f:i.depthFunc,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection;let u=i;c.wireframe=!0===u.wireframe,i.depthWrite||(c.map=u.map??null,c.alphaMap=u.alphaMap??null,c.alphaTest=i.alphaTest),e.renderBufferDirect(r,t,a,c,n,o)}return e.traverse(e=>{if(!e.isMesh)return;x.add(e);let t=e.onAfterRender,r=!Object.hasOwn(e,"onAfterRender"),a=function(...e){t.apply(this,e);let[r,a,i,l,s,c]=e;r.domElement!==n.canvas||"function"!=typeof r.renderBufferDirect||a.overrideMaterial||!s.colorWrite||o()||g.paint(r,a,i,(e,t,n,i,o,l)=>y(r,a,e,t,n,i,o,l))||y(r,a,i,this,l,s,c)};e.onAfterRender=a,h.push(()=>{e.onAfterRender===a&&(r?Reflect.deleteProperty(e,"onAfterRender"):e.onAfterRender=t)})}),n.invalidate?.(),()=>{for(let e of h)e();for(let e of m.values())e.dispose();g.dispose(),d.dispose(),n.invalidate?.()}}function R(e){return[e.x,e.y,e.z].map(e=>Number(e.toFixed(4))).join(", ")}function k(e){let t=e.material;return t&&(Array.isArray(t)?t:[t]).map(e=>e.name?.trim()||e.type).filter(Boolean).join(", ")||void 0}function P(e){let t=(e.parent?.children??[]).filter(t=>t.type===e.type&&t.name===e.name),r=Math.max(0,t.indexOf(e)),n=e.name.trim()||e.type;return`${encodeURIComponent(n)}[${r}]`}function W(e){let t=[],r=e;for(;r?.parent;)t.push(P(r)),r=r.parent;return t.reverse().join("/")}function F(e){let t=e.userData.popmeltLabel;return"string"==typeof t&&t.trim()?t.trim():e.name.trim()||e.type}function D(e){let t=e;for(;t.parent;){let e=t.name.trim(),r=e.match(/^(.*)_(?:alpha|normal|material)(?:_\d+)+$/i),n=t.parent;for(;n.parent&&!n.name.trim();)n=n.parent;let a=n.name.trim();if(!a||!e.startsWith(`${a}_`)&&!r)break;t=n}return t}function z(e,a){let o,l=e.raycaster??new t,s=new r,c=0,u=t=>e.key?.(t)??function(e){let t=e.userData.popmeltId;return"string"==typeof t&&t.trim()?t.trim():W(e)}(t),d=(t,r)=>{let a=f?.owner(t)??u(t);if(!a)return null;let o=function(e,t,r){let a=(new i).setFromObject(e,!0);if(a.isEmpty())return null;let o=r.getBoundingClientRect(),l=[];for(let e of[a.min.x,a.max.x])for(let r of[a.min.y,a.max.y])for(let i of[a.min.z,a.max.z])l.push(new n(e,r,i).project(t));let s=l.map(e=>o.left+(e.x+1)/2*o.width),c=l.map(e=>o.top+(1-e.y)/2*o.height),u=Math.max(o.left,Math.min(...s)),d=Math.min(o.right,Math.max(...s)),p=Math.max(o.top,Math.min(...c)),f=Math.min(o.bottom,Math.max(...c));return d<=u||f<=p?null:{left:u,top:p,width:d-u,height:f-p}}(t,e.camera,e.canvas);return o?{key:a,label:e.label?.(t)??F(t),sourceElement:e.canvas,bounds:o,context:W(t),data:{renderer:"Three.js",objectType:t.type,...t.name?{objectName:t.name}:{},scenePath:W(t),...r&&r!==t?{renderObjectName:r.name.trim()||r.type,renderObjectType:r.type,renderScenePath:W(r)}:{},position:R(t.position),rotation:R(t.rotation),scale:R(t.scale),visible:String(t.visible),...k(t)?{material:k(t)}:{},...Object.fromEntries(Object.entries(e.describe?.(t)??{}).filter(e=>"string"==typeof e[1]&&e[1].length>0))}}:null},p=t=>{let r=null,n=!1,a=t.endsWith("]");return e.scene.traverse(i=>{!e.key&&!a&&("string"!=typeof i.userData.popmeltId||i.userData.popmeltId.trim()!==t)||void 0!==f?.owner(i)||u(i)!==t||(r?n=!0:r=i)}),n?null:r},f=void 0===e.sampleCanvas?a?.createThreeSampling(e,p):void 0,m=e.sampleCanvas??f?.codec,h=e=>f?.placed.get(e)?.object??p(e);return{id:e.id?.trim()||"three",...m&&{sampleCanvas:{...m,element:e.canvas}},hitTest({x:t,y:r}){let n=e.canvas.getBoundingClientRect();if(t<n.left||t>n.right||r<n.top||r>n.bottom)return null;s.set((t-n.left)/n.width*2-1,-(r-n.top)/n.height*2+1),l.setFromCamera(s,e.camera);for(let t of l.intersectObject(e.scene,!0)){let r=e.textSurfaces?.find(e=>e.mesh===t.object);if(r&&a){let n=a.pickTextureText(r,t),i=n&&a.projectTextureText(r,n,e.camera,e.canvas);if(i)return i}let n=f?.owner(t.object),i=void 0!==n?f?.placed.get(n)?.object:e.select?e.select(t.object):D(t.object);if(!i||!i.visible)continue;let o=d(i,t.object);if(o)return o}return null},...a&&{highlightHover(t,r){if(e.textSurfaces?.some(e=>e.fields.editable(t)))return;let n=h(t);if(!n)return;o?.();let i=a.highlightThreeGeometry(n,r,e,()=>c>0);return o=i,()=>{o===i&&(o=void 0,i())}}},getViewKey(){let t=e.camera;return t.updateWorldMatrix(!0,!1),JSON.stringify([t.type,...t.matrixWorld.elements,...t.projectionMatrix.elements].map(e=>"number"==typeof e?Number(e.toFixed(5)):e))},resolve(t){let r=e.textSurfaces?.find(e=>e.fields.editable(t));if(r&&a)return a.projectTextureText(r,t,e.camera,e.canvas);let n=h(t);return n?d(n):null},...e.captureFrame?{async captureSurfaces(){c++;try{let t=await(e.captureFrame?.());return t?[{element:e.canvas,dataUrl:t}]:[]}finally{c--,o&&e.invalidate?.()}}}:{}}}function O(e,t,r){let n=e.domElement.width,a=e.domElement.height;if(n<=0||a<=0)return null;let i=e.getRenderTarget(),o=e.xr.enabled;try{return e.xr.enabled=!1,e.setRenderTarget(null),e.render(t,r),e.domElement.toDataURL("image/png")}catch{return null}finally{e.setRenderTarget(i),e.xr.enabled=o}}function I(e){let t=z(e,{createThreeSampling:b,highlightThreeGeometry:C,pickTextureText:j,projectTextureText:S});return(e.textSurfaces?.length||e.getEditableText)&&(t.getEditableText=t=>{for(let r of e.textSurfaces??[]){let e=r.fields.editable(t);if(e)return{...e,sourceEditor:!0}}return e.getEditableText?.(t)??null}),t}export{W as a,D as b,O as c,I as d};
@@ -1 +0,0 @@
1
- "use client";import{a as e,b as t}from"./chunk-A4GARXVQ.mjs";import{useRef as r,useId as n,useLayoutEffect as i}from"react";import{jsxs as o,Fragment as a,jsx as l}from"react/jsx-runtime";var s=Array.from({length:16},(e,t)=>{let r=2.75+5*t;return`M${r} 0L${r-40} 40`}).join(" ");function c({active:c,interactive:h=!1,hatched:d=!1,tracing:u,onSettlingChange:p,...m}){let g=r(null),f=r(null),y=r(null),M=n(),v=M+"-trace",x=M+"-perimeter",b=r(0),k=r(!1),A=r(null);return i(()=>{c&&(f.current?.setAttribute("fill",m.fill??"currentColor"),f.current?.setAttribute("stroke","none"))},[c,m.fill]),i(()=>{let t=g.current;if(!t)return;t.style.removeProperty("fill"),t.style.removeProperty("stroke");let r=window.matchMedia("(prefers-reduced-motion: reduce)"),n=0,i=null,o=0,a=!1,l=b.current,s=Math.ceil(l),d=!c&&s-l>1e-9,m=!1,M=0,v=null,x=t,P=x.style.cursor,I=x.style.touchAction,L=e=>{f.current?.setAttribute("d",e),y.current?.setAttribute("d",e)},$=()=>{A.current??(A.current=function(){let t=[],r=0,n=0;for(let[,i,o]of e.matchAll(/([A-Z])([^A-Z]*)/g)){let e=(o.match(/-?\d*\.?\d+/g)??[]).map(Number),a=r,l=n;if("Z"!==i)if("H"===i?r=e[0]:"V"===i?n=e[0]:(r=e[e.length-2],n=e[e.length-1]),"C"===i)for(let i=1;i<=24;i++){let o=i/24,s=1-o;t.push({x:s**3*a+3*s**2*o*e[0]+3*s*o**2*e[2]+o**3*r,y:s**3*l+3*s**2*o*e[1]+3*s*o**2*e[3]+o**3*n})}else t.push({x:r,y:n})}let i=24,o=t.findIndex(e=>e.y>=i),a=o;for(;a+1<t.length&&t[a+1].y>=i;)a++;let l=(e,t)=>({x:e.x+(t.x-e.x)*(i-e.y)/(t.y-e.y),y:i}),s=l(t[o-1],t[o]),c=l(t[a],t[a+1]),h=(s.x+c.x)/2,d=(s.x-c.x)/2,u=[s,...t.slice(o,a+1),c].map(e=>{let t=Math.asin(Math.max(-1,Math.min(1,(e.x-h)/d))),r=Math.cos(t);return{longitude:t,height:r>1e-5?(e.y-i)/r:0}}),p=[],m=[8,6.2,8.6,6.5,8],g=[0,1.4,.8,1.8,1.1,0],f=(e,t,r,n)=>{for(let i=0;i<=24;i++){let o=i/24,a=1-o;p.push({longitude:a**3*e[0]+3*a**2*o*t[0]+3*a*o**2*r[0]+o**3*n[0],height:a**3*e[1]+3*a**2*o*t[1]+3*a*o**2*r[1]+o**3*n[1]})}};for(let[e,t]of m.entries()){let r=Math.PI/2+e/m.length*Math.PI,n=r+Math.PI/m.length,i=(r+n)/2,o=.145,a=g[e],l=g[e+1];f([r,a],[i-o,a],[i-o,a+.7],[i-o,t-1.4]);for(let e=0;e<=32;e++){let r=Math.PI*(1-e/32);p.push({longitude:i+o*Math.cos(r),height:t-1.4+1.4*Math.sin(r)})}f([i+o,t-1.4],[i+o,l+.7],[i+o,l],[n,l])}let y=[...u,...p],M=e=>`L${e.x} ${e.y}`,v=`M${t[0].x} ${t[0].y}`+t.slice(1,o).map(M).join("")+M(s),x=M(c)+t.slice(a+1).map(M).join("")+"Z";return t=>{let r=Math.atan2(Math.sin(t),Math.cos(t));if(Math.abs(r)<1e-9)return e;let n=y.map(e=>({longitude:Math.atan2(Math.sin(e.longitude+r),Math.cos(e.longitude+r)),height:e.height})).filter(e=>Math.abs(e.longitude)<Math.PI/2).sort((e,t)=>t.longitude-e.longitude).map(e=>`L${h+d*Math.sin(e.longitude)} ${i+e.height*Math.cos(e.longitude)}`).join("");return v+n+x}}()),L(A.current(-b.current*Math.PI*2))},w=()=>{a=!0,b.current=0,L(e),f.current?.removeAttribute("fill"),f.current?.removeAttribute("stroke"),p?.(!1)},C=e=>{let t=null===i?0:e-i;if(i=e,m){let e=Math.min(t/1e3,.05),r=c?1/15:0,n=Math.exp(-1.8*e);b.current+=r*e+(M-r)*(1-n)/1.8,M=r+(M-r)*n,Math.abs(M-r)<.005&&(m=!1,l=b.current,s=Math.round(l),o=0)}else if(c)b.current+=t/15e3;else{o+=t;let e=Math.min(1,o/250);if(1===e)return void w();let r=1-(1-e)**3;b.current=l+(s-l)*r}$(),n=requestAnimationFrame(C)},j=()=>{cancelAnimationFrame(n),i=null,!v&&!a&&(c||!r.matches&&k.current&&!document.hidden?r.matches?(b.current=0,L(e)):k.current&&!document.hidden&&(n=requestAnimationFrame(C)):w())},X=e=>{v||!e.isPrimary||0!==e.button||(x.setPointerCapture(e.pointerId),v={id:e.pointerId,startX:e.clientX,x:e.clientX,time:e.timeStamp,moved:!1},M=0,cancelAnimationFrame(n),x.style.cursor="grabbing")},E=e=>{if(!v||v.id!==e.pointerId||!v.moved&&Math.abs(e.clientX-v.startX)<3)return;v.moved=!0;let t=-(e.clientX-v.x)/160,r=Math.max((e.timeStamp-v.time)/1e3,.001),n=24/(2*Math.PI);M+=(Math.max(-n,Math.min(n,t/r))-M)*(1-Math.exp(-r/.035)),b.current+=t,v.x=e.clientX,v.time=e.timeStamp,$()},S=e=>{!v||v.id!==e.pointerId||(v.moved&&(M*=Math.exp(-Math.max(0,e.timeStamp-v.time-40)/60),m="pointerup"===e.type&&!r.matches,a=!1,l=b.current,s=Math.round(l),o=0),v=null,x.style.cursor="grab",x.hasPointerCapture(e.pointerId)&&x.releasePointerCapture(e.pointerId),j())};if((u||!c&&!d)&&(w(),!h))return;let F=e=>{for(let[t,r]of Object.entries({pointerdown:X,pointermove:E,pointerup:S,pointercancel:S,lostpointercapture:S}))x[e](t,r)};h&&(x.style.cursor="grab",x.style.touchAction="pan-y",F("addEventListener")),p?.(d);let O=new IntersectionObserver(([e])=>{k.current=e?.isIntersecting??!1,j()});return O.observe(t),r.addEventListener("change",j),document.addEventListener("visibilitychange",j),j(),()=>{cancelAnimationFrame(n),O.disconnect(),h&&(F("removeEventListener"),x.style.cursor=P,x.style.touchAction=I,v&&x.hasPointerCapture(v.id)&&x.releasePointerCapture(v.id)),r.removeEventListener("change",j),document.removeEventListener("visibilitychange",j)}},[c,h,p,u]),o("svg",{...m,ref:g,children:[d&&o(a,{children:[l("defs",{children:o("mask",{id:M,x:"0",y:"0",width:"40",height:"40",maskUnits:"userSpaceOnUse",style:{maskType:"luminance"},children:[l("rect",{width:"40",height:"40",fill:"white"}),l("path",{ref:y,d:e,fill:"black",stroke:"black",strokeWidth:"5",strokeLinejoin:"round"})]})}),l("path",{d:s,fill:"none",stroke:"currentColor",strokeWidth:"0.65",mask:`url(#${M})`})]}),void 0!==u&&l("style",{children:'\n @keyframes popmelt-logo-trace { to { stroke-dashoffset: -100; } }\n @media (prefers-reduced-motion: no-preference) {\n [data-popmelt-logo-fill] { transition: fill-opacity 360ms ease-in-out; }\n [data-popmelt-logo-outline] { transition: opacity 360ms ease-in-out; }\n [data-popmelt-logo-outline][opacity="0"] [data-popmelt-logo-sweep] { animation-play-state: paused; }\n [data-popmelt-logo-sweep] { animation: popmelt-logo-trace 1500ms linear infinite; }\n [data-popmelt-logo-tail] { display: inline; }\n [data-popmelt-logo-trace] { stroke-dasharray: 19 81; }\n }\n '}),l("path",{ref:f,d:e,"data-popmelt-logo-fill":void 0!==u||void 0,fillOpacity:void 0===u?void 0:u?0:1}),void 0!==u&&o(a,{children:[l("defs",{children:l("clipPath",{id:v,children:l("path",{clipRule:"evenodd",d:`M0 0H40V40H0Z ${e}`})})}),o("g",{"data-popmelt-logo-outline":!0,opacity:u?1:0,pointerEvents:"none",clipPath:`url(#${v})`,fill:"none",stroke:"currentColor",strokeWidth:"2.7",strokeLinecap:"round",children:[l("g",{opacity:.3,children:l("path",{id:x,d:e,pathLength:"100"})}),o("g",{"data-popmelt-logo-sweep":!0,children:[l("g",{"data-popmelt-logo-tail":!0,display:"none",strokeLinecap:"butt",children:t.map(({dash:e,opacity:t})=>l("use",{href:`#${x}`,strokeDasharray:e,strokeOpacity:t},e))}),l("path",{"data-popmelt-logo-trace":!0,d:e,pathLength:"100"})]})]})]})]})}export{c as a};
@@ -1 +0,0 @@
1
- import{randomUUID as t}from"crypto";import{mkdir as a,readdir as r,rmdir as i,stat as e,unlink as o,writeFile as s}from"fs/promises";import{dirname as c,join as w}from"path";import{setTimeout as n}from"timers/promises";var f=t=>"ENOENT"===t.code;async function h(t){await i(t).catch(t=>{if("ENOENT"!==t.code&&"ENOTEMPTY"!==t.code&&"EEXIST"!==t.code)throw t})}async function m(t,a){await o(w(t,a)).catch(t=>{if(!f(t))throw t}),await h(t)}async function l(i,o,l=1e4){await a(c(i),{recursive:!0});let d=`${process.pid}-${t()}`,p=Date.now()+l;for(;;){let t=!1;try{await a(i),t=!0}catch(t){if("EEXIST"!==t.code)throw t}if(t){let t=!1;try{await s(w(i,d),"",{flag:"wx",mode:384});let a=await r(i);t=1===a.length&&a[0]===d}catch(t){if(!f(t))throw await m(i,d),t}if(t)try{return await o()}finally{await m(i,d)}await m(i,d)}else{let t=await r(i).catch(t=>{if(f(t))return[];throw t});for(let a of t){let t=/^(\d+)-[a-f0-9-]{36}$/.exec(a);if(t&&!(Number(t[1])<1))try{process.kill(Number(t[1]),0)}catch(t){"ESRCH"===t.code&&await m(i,a)}}if(0===t.length){let t=await e(i).catch(t=>{if(f(t))return null;throw t});t&&Date.now()-t.mtimeMs>1e3&&await h(i)}}if(Date.now()>=p)throw new Error("Thread storage is busy with another writer; retry the operation.");await n(15+Math.floor(15*Math.random()))}}export{l as a};
@@ -1 +0,0 @@
1
- import{a as m}from"./chunk-EUFK7B6S.mjs";import"./chunk-L3QE62SE.mjs";import"./chunk-4MLXPN7W.mjs";import"./chunk-CUVWMYUV.mjs";import"./chunk-OECEYJNK.mjs";import"./chunk-MPEVFQ43.mjs";import"./chunk-MHTX52KW.mjs";import"./chunk-DSTHM3V5.mjs";import"./chunk-PYGRFSUU.mjs";import"./chunk-6EO73WJN.mjs";import"./chunk-NC7YXD7Q.mjs";import"./chunk-KOHR4LAQ.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-NOHXTT24.mjs";export{m as canvasReceiptsForTurn};
@@ -1 +0,0 @@
1
- import{a as m,b as o,c as r,d as s,e as i,f as c}from"./chunk-4MLXPN7W.mjs";import"./chunk-CUVWMYUV.mjs";import"./chunk-OECEYJNK.mjs";import"./chunk-MPEVFQ43.mjs";import"./chunk-MHTX52KW.mjs";import"./chunk-DSTHM3V5.mjs";import"./chunk-PYGRFSUU.mjs";import"./chunk-6EO73WJN.mjs";import"./chunk-NC7YXD7Q.mjs";import"./chunk-KOHR4LAQ.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-NOHXTT24.mjs";export{c as callCodexBridge,r as codexExecutionOwner,m as discoverCodexPopmeltProjects,i as ensureCodexBridge,o as findCodexPopmeltProject,s as isBridgeOwnedCodexRun};
@@ -1 +0,0 @@
1
- import{a as t}from"./chunk-4MLXPN7W.mjs";import"./chunk-CUVWMYUV.mjs";import"./chunk-OECEYJNK.mjs";import"./chunk-MPEVFQ43.mjs";import"./chunk-MHTX52KW.mjs";import"./chunk-DSTHM3V5.mjs";import"./chunk-PYGRFSUU.mjs";import{c as o,f as r}from"./chunk-6EO73WJN.mjs";import"./chunk-NC7YXD7Q.mjs";import"./chunk-KOHR4LAQ.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-NOHXTT24.mjs";import{realpath as e}from"fs/promises";async function i(i,s){let n=await r(i);if(!n)throw new Error("Open the Popmelt project in this chat first.");let m=await e(s),p=await t(n.projectRoot),c=p.find(t=>t.root===m&&t.initialized);if(!c)throw new Error("Choose an existing Popmelt store discovered in this workspace.");if(p.some(t=>t.root!==m&&t.storeId===c.storeId))throw new Error("More than one workspace directory uses this store ID.");let h={storeId:c.storeId,projectId:c.projectId,projectRoot:m};return await o(i,t=>{if(t.projectRoot!==n.projectRoot||t.storeId!==n.storeId)throw new Error("The primary Popmelt store changed. Retry the mount.");if(t.projectRoot===m||t.storeId===h.storeId)throw new Error("This store is already the writable primary.");let o=t.mountedStores.find(t=>t.storeId===h.storeId||t.projectRoot===m);if(o){if(o.storeId!==h.storeId||o.projectRoot!==m||o.projectId!==h.projectId)throw new Error("A mounted store has a conflicting identity.");return t}return{...t,orientation:"explicit",mountedStores:[...t.mountedStores,h],updatedAt:(new Date).toISOString()}}),{...h,readOnly:!0}}export{i as mountCodexStore};
@@ -1 +0,0 @@
1
- import{a as e,b as r,c as i,d as t,e as a,f as o}from"./chunk-6RC7JZ73.mjs";import"./chunk-NOHXTT24.mjs";export{o as bridgeInjectionScript,t as buildBridgeTarget,a as createBridgeProxyMiddleware,e as readBridgeContextFromEnvironment,i as registerBridgeLease,r as resolveBridgeContext};
@@ -1,22 +0,0 @@
1
- /** Public, credential-free description stamped by the application's dev server.
2
- * The revision is context metadata (or `unversioned`), never sync/Send authority.
3
- */
4
- type ParticipantBootstrapConfig = {
5
- version?: 1;
6
- planeApps?: boolean;
7
- lanInviteOrigin?: string;
8
- /** Preferred initial transport when the host supports on-demand guest gateways. */
9
- guestInvites?: 'lan' | 'tunnel';
10
- tunnelAvailable?: boolean;
11
- appVersion?: string;
12
- url: string;
13
- projectId: string;
14
- revision: string;
15
- };
16
- declare global {
17
- interface Window {
18
- __POPMELT_PARTICIPANTS__?: ParticipantBootstrapConfig;
19
- }
20
- }
21
-
22
- export type { ParticipantBootstrapConfig as P };
@@ -1 +0,0 @@
1
- import{a as m,b as n,c as s,d as r,e as t,f as o}from"./chunk-L3QE62SE.mjs";import"./chunk-4MLXPN7W.mjs";import"./chunk-CUVWMYUV.mjs";import"./chunk-OECEYJNK.mjs";import"./chunk-MPEVFQ43.mjs";import"./chunk-MHTX52KW.mjs";import"./chunk-DSTHM3V5.mjs";import"./chunk-PYGRFSUU.mjs";import"./chunk-6EO73WJN.mjs";import"./chunk-NC7YXD7Q.mjs";import"./chunk-KOHR4LAQ.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-NOHXTT24.mjs";export{m as agentCredentialFile,t as callPeer,r as canvasChatRequest,s as enrolledCanvasEndpoint,o as runPeerCommand,n as sendThreadNote};
@@ -1 +0,0 @@
1
- import{a as m}from"./chunk-MPEVFQ43.mjs";import"./chunk-HKHZBKAN.mjs";export{m as startPlainHtml};
@@ -1 +0,0 @@
1
- import{c as a,d as r}from"./chunk-MHTX52KW.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-UIADZXVT.mjs";export{r as createSharedPageReader,a as sharedPagePath};
@@ -1 +0,0 @@
1
- import{h as s,i as a,j as e,k as t,l as r,m as i,n as d}from"./chunk-PYGRFSUU.mjs";export{s as groupSteerEdits,a as mergeOptionEdits,r as readSteerEdit,t as readSteerEdits,i as readSteerStyle,e as stylesForEdits,d as withSteerDrafts};
@@ -1 +0,0 @@
1
- "use client";export{M as createProposalSession,N as tasteProposalSession}from"./chunk-CRZEJJI6.mjs";import"./chunk-XTOCFTVW.mjs";import"./chunk-YGP6PPOZ.mjs";
@@ -1,25 +0,0 @@
1
- # Managed phone pairing
2
-
3
- The desktop host opens **Pair and Share → Pair your phone**. The QR contains a one-minute enrollment ticket in the URL fragment. Safari removes the ticket from its address bar, creates a passkey and offers to open the project. Bookmark the pairing page. Returning to it calls for a fresh passkey assertion even when the phone already has a session.
4
-
5
- ## Where traffic goes
6
-
7
- - The Worker at `pair.popmelt.com` serves the passkey UI. The signed assertion goes directly from the browser to the project's gateway through Cloudflare.
8
- - The Mac stores the public key and verifies the exact origin, relying party, challenge and user verification. A one-use handoff opens the live app on a separate hostname. The gateway requires a private session cookie for assets and phone bridge requests. Active sessions last one hour.
9
- - Remote collaborator invites continue using Quick Tunnels. Wi-Fi host pairing continues to use the existing LAN relay. A provisioned host can choose **Pair over Wi-Fi** in the same pane.
10
-
11
- ## Provision one named tunnel per Mac
12
-
13
- On macOS with Node 22 or later and `cloudflared`, run the following from this directory. The operator needs control of the Cloudflare zone. The person pairing their phone needs no account. Deploy the shared Worker at `pair.popmelt.com` once.
14
-
15
- 1. Create one named tunnel for the Mac, or adopt its existing tunnel UUID with `node machine.mjs init <tunnel-uuid>`. The Mac needs the connector credentials and a Cloudflare login authorized to create its project DNS records. Run the service from a trusted account with a trusted `cloudflared` executable on its PATH.
16
- 2. Start the Mac's pairing service with `node machine.mjs run` in place of the direct `cloudflared tunnel ... run` launch command. For an existing connector, start the new service first and retire the old connector after the new one connects. Existing project hostnames, grants and bookmarks survive the cutover.
17
- 3. In any project running the updated Core, open **Pair and Share → Pair your phone** from its local desktop host. The service registers the hostname and updates its live route. The pane waits for the public hostname to reach that project’s gateway before starting the one-minute QR timer. Each project needs a distinct loopback app port. Reopening the pane or retrying a failed registration reuses the same project ID. **Pair over Wi-Fi** remains available independently.
18
-
19
- The tunnel forwards traffic to a private socket on the Mac. The service accepts only registered project hostnames and forwards each to that project's private gateway. Unknown hosts receive 404. Registration uses a separate owner-only Unix socket. The browser and Core bridge receive no Cloudflare credential. Each gateway verifies its own enrolled passkeys, issues its own sessions and handles revocation independently.
20
-
21
- Keep the project, its bridge and the machine service running. The service owns the connector process. It reloads its project list from `~/.popmelt-pair/machine/projects.json` on startup. Operator tooling can still use `node machine.mjs add <project-directory> <loopback-app-origin>` on a running service. To recover after a provisioner is killed while holding `machine/provision.lock`, confirm it has exited and remove that empty lock directory before retrying.
22
-
23
- A directory rename on the same volume preserves the pairing ID. A copied checkout or replacement volume needs an explicit new binding. Keep the relying-party hostname reserved for the pairing UI. Retire an old project hostname together with its routing, and never reassign its pairing ID.
24
-
25
- `popmelt phone revoke` invalidates the saved phone grants and closes active sessions **for the current project**. Access after revocation requires another scan from its desktop host.