@popmelt.com/core 0.25.0 → 0.27.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 (37) hide show
  1. package/README.md +8 -0
  2. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  3. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  4. package/dist/{ParticipantRuntime-WZLITXXM.mjs → ParticipantRuntime-AD3YD4FW.mjs} +4 -4
  5. package/dist/{PopmeltTasteConnectedPane-77Z23N6Y.mjs → PopmeltTasteConnectedPane-HLCTVPJP.mjs} +6 -6
  6. package/dist/{PreviewRuntime-ATSECGMB.mjs → PreviewRuntime-KGLZJGUN.mjs} +1 -1
  7. package/dist/adapter-react-three-fiber.d.mts +1 -1
  8. package/dist/adapter-three.d.mts +6 -0
  9. package/dist/bridge-entry.mjs +61 -61
  10. package/dist/{browser-runtime-PC2NODES.mjs → browser-runtime-3JZGB3P2.mjs} +1 -1
  11. package/dist/browser.d.mts +4 -4
  12. package/dist/browser.mjs +1 -1
  13. package/dist/{chunk-FRHGK5ZV.mjs → chunk-7YCLSSQA.mjs} +1 -1
  14. package/dist/chunk-7YIQQYRU.mjs +77 -0
  15. package/dist/{chunk-YMJHG3Q6.mjs → chunk-C5Q6LDAS.mjs} +1 -1
  16. package/dist/chunk-D7HY2EDH.mjs +2 -0
  17. package/dist/chunk-MDJYUX5S.mjs +370 -0
  18. package/dist/{chunk-VUJWDJ6C.mjs → chunk-MTRUVFH7.mjs} +1 -1
  19. package/dist/chunk-TFPKDKDO.mjs +345 -0
  20. package/dist/{chunk-NXMPY7RX.mjs → chunk-TSY2K45H.mjs} +1 -1
  21. package/dist/cli.mjs +81 -81
  22. package/dist/index.d.mts +5 -5
  23. package/dist/index.mjs +1 -1
  24. package/dist/media.d.mts +3 -3
  25. package/dist/{participantBootstrap-BQHbHI4r.d.mts → participantBootstrap-QZ3wuqi1.d.mts} +2 -2
  26. package/dist/plugin-astro.mjs +1 -1
  27. package/dist/plugin-nuxt.mjs +1 -1
  28. package/dist/plugin-vite.mjs +1 -1
  29. package/dist/{server-6X5YVYKP.mjs → server-MJF4KF26.mjs} +64 -64
  30. package/dist/server.mjs +64 -64
  31. package/dist/{subjects-BM3Smdow.d.mts → subjects-CG6UyWFr.d.mts} +6 -0
  32. package/dist/{video-adapter-Gm5gmoiz.d.mts → video-adapter-DrTI5cRl.d.mts} +1 -1
  33. package/package.json +25 -23
  34. package/dist/chunk-RLCNRGNJ.mjs +0 -77
  35. package/dist/chunk-XIWFG3E4.mjs +0 -345
  36. package/dist/chunk-YHITBHLH.mjs +0 -370
  37. package/dist/chunk-ZJPPZLXU.mjs +0 -2
@@ -1 +1 @@
1
- import{a as o,b as d,c as l,d as s}from"./chunk-VUJWDJ6C.mjs";function g(r){let p=r?.basePath??"/popmelt",e={port:null,projectId:null},n="virtual:popmelt/bridge",i=`\0${n}`;return{name:"popmelt",resolveId(t){if(t===n)return i},load(t){if(t===i)return`export const bridgeUrl = ${JSON.stringify(e.port===null?null:`http://localhost:${e.port}`)}; export const projectId = ${JSON.stringify(e.projectId)};`},async configureServer(t){e=await o(r,t,5173),await d(e,t),t.middlewares.use(l(p,()=>e))},transformIndexHtml(){if(e.port!==null)return[{tag:"script",attrs:{type:"text/javascript"},children:s(e),injectTo:"head-prepend"}]}}}export{g as a};
1
+ import{a as o,b as d,c as l,d as s}from"./chunk-MTRUVFH7.mjs";function g(r){let p=r?.basePath??"/popmelt",e={port:null,projectId:null},n="virtual:popmelt/bridge",i=`\0${n}`;return{name:"popmelt",resolveId(t){if(t===n)return i},load(t){if(t===i)return`export const bridgeUrl = ${JSON.stringify(e.port===null?null:`http://localhost:${e.port}`)}; export const projectId = ${JSON.stringify(e.projectId)};`},async configureServer(t){e=await o(r,t,5173),await d(e,t),t.middlewares.use(l(p,()=>e))},transformIndexHtml(){if(e.port!==null)return[{tag:"script",attrs:{type:"text/javascript"},children:s(e),injectTo:"head-prepend"}]}}}export{g as a};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ function c(e){try{let t=e.defaultView?.frameElement;return t?.localName==="iframe"?t:null}catch{return null}}function D(e){if(e.localName!=="iframe"||e.closest("[data-devtools],[data-popmelt-peer-surface]"))return null;try{let t=e.contentDocument;return t?.documentElement?t:null}catch{return null}}function V(e){let t=e.getBoundingClientRect(),r=e.offsetWidth?t.width/e.offsetWidth:1,n=e.offsetHeight?t.height/e.offsetHeight:1;return{x:t.left+e.clientLeft*r,y:t.top+e.clientTop*n,sx:r,sy:n}}function F(e,t){let{left:r,top:n,width:o,height:l}=e,i=c(t);for(;i;){let a=V(i);r=a.x+r*a.sx,n=a.y+n*a.sy,o*=a.sx,l*=a.sy,i=c(i.ownerDocument)}return new DOMRect(r,n,o,l)}function H(e){return F(e.getBoundingClientRect(),e.ownerDocument)}function O(e,t,r){let n=[],o=c(r);for(;o;)n.unshift(o),o=c(o.ownerDocument);for(let l of n){let i=V(l);e=(e-i.x)/i.sx,t=(t-i.y)/i.sy}return{x:e,y:t}}function gt(e){return e.ownerDocument.defaultView??window}function ht(e){return!!(e&&e.namespaceURI==="http://www.w3.org/1999/xhtml")}function T(e,t=document){if(e===t)return!0;let r=c(e);return!!(r?.isConnected&&r.contentDocument===e&&T(r.ownerDocument,t))}function pt(e,t){if(!T(t))return new DOMRect(0,0,0,0);let r=e.left,n=e.top,o=e.right,l=e.bottom;for(let i=c(t);i;i=c(i.ownerDocument)){let a=F({left:0,top:0,width:i.clientWidth,height:i.clientHeight},i.contentDocument);r=Math.max(r,a.left),n=Math.max(n,a.top),o=Math.min(o,a.right),l=Math.min(l,a.bottom)}return new DOMRect(r,n,Math.max(0,o-r),Math.max(0,l-n))}var v="@frame(";function yt(e,t){return`${v}${encodeURIComponent(JSON.stringify({selector:e,url:t.URL}))}) `}function z(e){if(!e.startsWith(v))return null;let t=e.indexOf(") ");if(t<0)return null;try{let r=JSON.parse(decodeURIComponent(e.slice(v.length,t)));return typeof r.selector!="string"||typeof r.url!="string"?null:{...r,rest:e.slice(t+2)}}catch{return null}}var W=" >>> ";function X(e){return Array.from(e.querySelectorAll("*")).flatMap(t=>t.shadowRoot?[t.shadowRoot]:[])}function R(e=document){let t=[e];for(let r of t)t.push(...X(r));return t}function h(e,t=document){if(e.startsWith(v)){let o=z(e);if(!o)return null;let l=o.selector.startsWith(v)||o.selector.includes(W)?[h(o.selector,t)].filter(u=>!!u):R(t).flatMap(u=>Array.from(u.querySelectorAll(o.selector))),i=l.length===1?l[0]:null,a=i&&D(i);return!a||a.URL!==o.url?null:h(o.rest,a)}let r=e.split(W);if(r.length>1){let o=t,l=null;for(let i=0;i<r.length;i+=1){if(l=o.querySelector(r[i]),!l)return null;if(i<r.length-1){if(!l.shadowRoot)return null;o=l.shadowRoot}}return l}let n=[t];for(let o of n){let l=o.querySelector(e);if(l)return l;n.push(...X(o))}return null}function p(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode();return"host"in t?t.host:null}function bt(e,t){return t.startsWith(v)||t.includes(W)?h(t)===e:e.matches(t)}function $(e,t){let r=e;for(;r;){if(r.matches(t))return r;r=p(r)}return null}function wt(e,t){let r=t;for(;r;){if(r===e)return!0;r=p(r)}return!1}function St(e,t,r,n=o=>[o]){let o=[];for(let l of e.querySelectorAll("iframe")){if(!D(l))continue;let i=l.getBoundingClientRect();if(t<i.left||t>i.right||r<i.top||r>i.bottom||l.ownerDocument.defaultView?.getComputedStyle(l).pointerEvents!=="none")continue;let a=l.style.getPropertyValue("pointer-events"),u=l.style.getPropertyPriority("pointer-events");l.style.setProperty("pointer-events","auto","important"),o.push(()=>a?l.style.setProperty("pointer-events",a,u):l.style.removeProperty("pointer-events"))}try{let l=typeof e.elementsFromPoint=="function"?e.elementsFromPoint(t,r):[],i=e.elementFromPoint?.(t,r)??null;return(i&&!l.includes(i)?[i,...l]:l).filter(a=>e.nodeType===9||a.getRootNode()===e).flatMap(n)}finally{o.forEach(l=>l())}}function P(e,t,r=document){let n=[],o=new Set,l=r.nodeType===9?r:r.ownerDocument,i=O(e,t,l);for(let a of R(r).reverse())for(let u of St(a,i.x,i.y,f=>{let s=D(f);return s?[...P(e,t,s),f]:[f]}))o.has(u)||(o.add(u),n.push(u));return n}function E(){return W}var vt=["id","data-testid","data-test","data-cy","data-popmelt-media-id","aria-label","name","href"],J=e=>e.replace(/\s+/g," ").trim();function A(e){return e==="id"||e==="data-popmelt-media-id"||/^data-(?:testid|test|cy)(?:-[a-z0-9_-]+)?$/.test(e)}function Z(e,t){return!!(t&&t.length<=200&&!(e==="id"&&/^(radix-|:|_r_)/.test(t)))}function G(e){let t={},r=new Set([...vt,...e.getAttributeNames().filter(A)]);for(let l of r){let i=e.getAttribute(l);i&&Z(l,i)&&(t[l]=i)}let n=J(e.querySelector("h1,h2,h3,h4,h5,h6")?.textContent??""),o=J(Array.from(e.childNodes).filter(l=>l.nodeType===3).map(l=>l.textContent).join(" "));return{tag:e.tagName.toLowerCase(),...Object.keys(t).length?{attributes:t}:{},...n&&n.length<=200?{heading:n}:{},...o&&o.length<=200?{text:o}:{}}}function K(e,t,r=document){let n=R(r),o=s=>{try{return n.flatMap(d=>Array.from(d.querySelectorAll(s)))}catch{return[]}},l=!!(t&&(t.heading||t.text||Object.keys(t.attributes??{}).length)),i=s=>{if(!t||!l)return!0;let d=G(s);return d.tag===t.tag&&(!t.heading||d.heading===t.heading)&&(!t.text||d.text===t.text)&&Object.entries(t.attributes??{}).every(([m,S])=>s.getAttribute(m)===S)};for(let s of e){if(s.includes(" >>> ")||s.startsWith("@frame(")){try{let m=h(s,r),S=z(s),U=Object.entries(t?.attributes??{}).filter(([L])=>A(L)),dt=S&&m&&(S.rest.startsWith("[data-pm=")||U.length>0&&m.tagName.toLowerCase()===t?.tag&&U.every(([L,mt])=>m.getAttribute(L)===mt));if(m&&(dt||i(m)))return{status:"matched",element:m}}catch{}continue}let d=o(s);if(d.length===1&&(/^\[data-pm=/.test(s)||!l))return{status:"matched",element:d[0]}}if(!l||e.some(s=>s.includes(" >>> ")||s.startsWith("@frame("))||!/^[a-z][a-z0-9-]*$/.test(t.tag))return{status:"missing"};let a=o(t.tag);if(a.length>500)return{status:"ambiguous"};let u=Object.entries(t.attributes??{}).filter(([s])=>A(s));if(u.length){let s=a.filter(d=>u.every(([m,S])=>d.getAttribute(m)===S));return s.length===1?{status:"matched",element:s[0]}:{status:s.length?"ambiguous":"missing"}}let f=a.filter(i);return f.length===1?{status:"matched",element:f[0]}:{status:f.length?"ambiguous":"missing"}}function At(e,t,r=document){let n={};if(t)for(let[a,u]of Object.entries({...t.dataAttributes,...t.id?{id:t.id}:{}}))A(a)&&Z(a,u)&&(n[a]=u);let o=t?.targetFingerprint?.tag??t?.tagName?.toLowerCase(),l=t&&o?{...t.targetFingerprint,tag:o,attributes:{...n,...t.targetFingerprint?.attributes}}:t?.targetFingerprint,i=K([e,t?.selector].filter(a=>!!a),l,r);return i.status==="matched"?i.element:null}var Nt=["data-popmelt-frame","data-popmelt-media-id","data-testid","data-test","data-cy"];function j(e){let t=e.getRootNode();if(!("querySelectorAll"in t))return null;let r=new Set([...Nt,...e.getAttributeNames().filter(n=>n!=="id"&&A(n))]);for(let n of r){let o=e.getAttribute(n);if(!o||o.length>200)continue;let l=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(o):Array.from(o,a=>{if(a==='"'||a==="\\")return`\\${a}`;let u=a.charCodeAt(0);return u<32||u===127?`\\${u.toString(16)} `:a}).join(""),i=`[${n}="${l}"]`;if(t.querySelectorAll(i).length===1)return i}return null}function I(e){if(c(e.ownerDocument))return y(e);let t=j(e);if(t)return t;if(e.id)return`#${e.id}`;let r=e.tagName.toLowerCase(),n=Array.from(e.classList).slice(0,3).join(".");return n?`${r}.${n}`:r}function y(e){return Q(Y(e),e.ownerDocument)}function Q(e,t){let r=c(t);if(r){!(r.id&&r.ownerDocument.querySelectorAll(`#${CSS.escape(r.id)}`).length===1)&&!j(r)&&r.setAttribute("data-popmelt-frame",globalThis.crypto?.randomUUID?.()??`frame-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`);let n=r.hasAttribute("data-popmelt-frame")?`[data-popmelt-frame="${r.getAttribute("data-popmelt-frame")}"]`:Y(r),o=c(r.ownerDocument)?y(r):n;return yt(o,t)+e}return e}function Y(e){if(e.getRootNode().nodeType===9&&e.id&&!e.id.startsWith("radix-")&&!e.id.startsWith(":")&&e.ownerDocument.querySelectorAll(`#${CSS.escape(e.id)}`).length===1)return`#${CSS.escape(e.id)}`;let t=[],r=e;for(;r&&r!==e.ownerDocument.documentElement;){let n=r.tagName.toLowerCase(),o=j(r);if(o?n=o:r.id&&!r.id.startsWith("radix-")&&!r.id.startsWith(":")&&r.getRootNode().querySelectorAll(`#${CSS.escape(r.id)}`).length===1&&(n=`#${CSS.escape(r.id)}`),!o&&!n.startsWith("#")){let a=Array.from(r.classList).filter(u=>!u.startsWith("_")&&u.length<30).slice(0,2);a.length>0&&(n+="."+a.map(u=>CSS.escape(u)).join("."))}let l=r.parentElement;if(l&&!o&&!n.startsWith("#")){let a=Array.from(l.children).filter(u=>u.tagName===r.tagName);if(a.length>1){let u=a.indexOf(r)+1;n+=`:nth-of-type(${u})`}}if(t.unshift(n),o||n.startsWith("#")){let a=r.getRootNode();if(a.nodeType===9)break;if("host"in a){t.unshift(E().trim()),r=a.host;continue}}if(l){r=l;continue}let i=r.getRootNode();if(!("host"in i))break;t.unshift(E().trim()),r=i.host}return t.join(" > ").replace(/ > >>> > /g,E())}function g(e){try{return h(e)}catch{return null}}function N(e){return!!(e&&(e.namespaceURI==="http://www.w3.org/1999/xhtml"||e.namespaceURI==="http://www.w3.org/2000/svg"))}var k=new WeakMap,x=new WeakMap;function xt(e,t){if(N(t))for(let[r,n]of x.get(e)??[])n.value?t.style.setProperty(r,n.value,n.priority):t.style.removeProperty(r)}function Ct(e,t){k.set(e,new Set(t))}function Dt(e){k.delete(e)}function tt(e,t){return N(e)&&(k.get(e)?.has(t)??!1)}function et(e){let t=e.sticker;return t?t.family==="padding"||t.family==="margin"?t.subproperty==="all"?10:t.subproperty==="x"||t.subproperty==="y"?20:30:t.family==="radius"||t.family==="border"?t.subproperty==="all"?10:20:10:0}function Wt(e){return e.changes.map((t,r)=>({change:t,index:r})).sort((t,r)=>et(t.change)-et(r.change)||t.index-r.index).map(({change:t})=>t)}function rt(e,t,r){if(N(e)){let n=x.get(e);n||(n=new Map,x.set(e,n)),n.has(t)||n.set(t,{value:e.style.getPropertyValue(t),priority:e.style.getPropertyPriority(t)}),e.style.setProperty(t,r,"important")}}function Rt(e,t,r,n=!1){if(N(e)){let o=n?x.get(e)?.get(t):void 0;o?.value?e.style.setProperty(t,o.value,o.priority):e.style.removeProperty(t),x.get(e)?.delete(t)}}function nt(e){let t=g(e.selector);if(!t&&e.durableSelector&&(t=g(e.durableSelector),t)){let r=e.selector.match(/\[data-pm="([^"]+)"\]/)?.[1];r&&t.setAttribute("data-pm",r)}return t}function $t(e){for(let t of e){let r=nt(t);if(r)for(let n of Wt(t))tt(r,n.property)||rt(r,n.property,n.modified)}}function Pt(e,t=!1){for(let r of e){let n=g(r.selector);if(n)for(let o of r.changes)tt(n,o.property)||Rt(n,o.property,o.original,t)}}function ot(e){let t=g(e.selector);if(!t&&e.durableSelector&&(t=g(e.durableSelector),t)){let r=e.selector.match(/\[data-pm="([^"]+)"\]/)?.[1];r&&t.setAttribute("data-pm",r)}return t}function lt(e,t){let r=e;for(let n of t)r=r?.childNodes[n]??null;return r?.nodeType===Node.TEXT_NODE?r:null}function Et(e){for(let t of e){let r=ot(t);if(!r)continue;let n=lt(r,t.textNodePath);n&&(!t.selector.startsWith("@frame(")||n.nodeValue===t.original)&&n.nodeValue!==t.modified&&(n.nodeValue=t.modified)}}function Mt(e){for(let t of e){let r=ot(t);if(!r)continue;let n=lt(r,t.textNodePath);n&&(!t.selector.startsWith("@frame(")||n.nodeValue===t.modified)&&n.nodeValue!==t.original&&(n.nodeValue=t.original)}}function b(e,t){if(!e)return null;let r=g(e);if(!r&&t&&(r=g(t),r)){let n=e.match(/\[data-pm="([^"]+)"\]/)?.[1];n&&r.setAttribute("data-pm",n)}return r}function Lt(e){e.removeAttribute("data-pm"),e.querySelectorAll("[data-pm]").forEach(t=>t.removeAttribute("data-pm"))}function Ft(e,t){let r=t.match(/\[data-pm="([^"]+)"\]/)?.[1];r&&e.setAttribute("data-pm",r)}function _(e,t,r){let n=Array.from(e.children).filter(l=>l!==t),o=Math.max(0,Math.min(r,n.length));e.insertBefore(t,n[o]??null)}function Ot(e){for(let t of e){let r=b(t.targetParentSelector,t.targetParentDurableSelector);if(!r)continue;if(t.operation==="move"){let l=b(t.selector,t.durableSelector);if(!l||l===r||l.contains(r))continue;_(r,l,t.targetIndex);continue}if(b(t.selector,t.durableSelector))continue;let n=b(t.sourceSelector,t.sourceDurableSelector);if(!n)continue;let o=n.cloneNode(!0);o instanceof Element&&(Lt(o),Ft(o,t.selector),_(r,o,t.targetIndex))}}function Tt(e){for(let t of[...e].reverse()){if(t.operation==="copy"){b(t.selector,t.durableSelector)?.remove();continue}let r=b(t.selector,t.durableSelector),n=b(t.originalParentSelector,t.originalParentDurableSelector);!r||!n||r===n||r.contains(n)||_(n,r,t.originalIndex??n.children.length)}}function it(e){let t=Object.keys(e).find(l=>l.startsWith("__reactFiber$")||l.startsWith("__reactInternalInstance$"));if(!t)return null;let r=e[t],n=[],o=r?._debugSource;for(;r;){let l=r.type,i=l?.displayName||l?.name;i&&typeof i=="string"&&/^[A-Z]/.test(i)&&!i.startsWith("_")&&i!=="Fragment"&&n.unshift(i),r=r.return}return n.length>0?{name:n[n.length-1],path:n,...o?.fileName&&Number.isFinite(o.lineNumber)?{source:o}:{}}:null}function jt(e){let t=Object.keys(e).find(o=>o.startsWith("__reactFiber$")||o.startsWith("__reactInternalInstance$"));if(!t)return[];let r=e[t],n=[];for(;r;){let o=r.type,l=typeof o=="function"||typeof o=="object"?o?.displayName||o?.name:null;l&&typeof l=="string"&&/^[A-Z]/.test(l)&&!l.startsWith("_")&&l!=="Fragment"&&n.push({name:l,fiber:r}),r=r.return}return n.reverse(),n}function It(e){let t=e,r=new Set;for(;t&&!r.has(t);){if(r.add(t),t.stateNode instanceof Element)return t.stateNode;t.child?t=t.child:t=null}return null}var kt=900,M=80;function w(e){if(!e)return null;try{return h(e)}catch{return null}}function C(e){return(e??"").replace(/\s+/g," ").trim()}function at(e){let t=C(e.getAttribute("aria-label"));if(t)return t.slice(0,M);let r=C(e.getAttribute("aria-labelledby"));if(r){let o=r.split(/\s+/).map(l=>C(document.getElementById(l)?.textContent)).filter(Boolean).join(" ");if(o)return o.slice(0,M)}let n=C(e.getAttribute("title"));return n?n.slice(0,M):C(e.textContent).slice(0,M)}function _t(e){return e.id?Array.from(document.querySelectorAll("[aria-controls]")).find(t=>t.getAttribute("aria-controls")===e.id)??null:null}function qt(e){if(e instanceof HTMLDetailsElement){let n=Array.from(e.children).find(l=>l.tagName.toLowerCase()==="summary");if(!n)return null;let o=at(n);return o?{triggerSelector:y(n),targetSelector:y(e),label:o}:null}let t=_t(e);if(!t)return null;let r=at(t);return r?{triggerSelector:y(t),targetSelector:y(e),label:r}:null}function q(e){let t=[],r=new Set,n=p(e);for(;n&&n!==document.body&&n!==document.documentElement;){let l=qt(n);l&&!r.has(l.triggerSelector)&&(r.add(l.triggerSelector),t.push(l)),n=p(n)}if(t.length===0)return;let o=t.reverse();return{steps:o,location:o.map(l=>l.label)}}function ut(e){let t=e?.[0]?.revealRecipe;if(t?.steps.length)return t;let r=w(e?.[0]?.selector);return r?q(r):void 0}function Bt(e){let t=ut(e)?.location.filter(Boolean);return t?.length?`Inside: ${t.join(" \u203A ")}`:null}function B(e){if(!e?.isConnected)return!1;let t=e.getBoundingClientRect();if(t.width<=0||t.height<=0||e.getClientRects().length===0)return!1;let r=e;for(;r;){let n=window.getComputedStyle(r);if(n.display==="none"||n.visibility==="hidden"||n.visibility==="collapse"||Number.parseFloat(n.opacity||"1")<=0)return!1;r=r.parentElement}return!0}function Ut(e,t,r){return t.getAttribute("aria-expanded")==="true"||t.getAttribute("data-state")==="open"?!0:r instanceof HTMLDetailsElement?r.open:B(r)}function st(e,t=kt){return e?new Promise(r=>{let n=performance.now(),o=()=>{let l=w(e);if(B(l)){r(l);return}if(performance.now()-n>=t){r(null);return}requestAnimationFrame(o)};o()}):Promise.resolve(null)}function Vt(e,t){return w(e)??w(t?.[0]?.selector)}async function Ht(e,t){let r=Vt(e,t);if(B(r))return r;let n=ut(t)??(r?q(r):void 0);if(!n)return null;for(let l of n.steps){let i=w(l.triggerSelector);if(!(i instanceof HTMLElement))return null;let a=w(l.targetSelector);if(!Ut(l,i,a)&&(i.click(),!await st(l.targetSelector)))return null}let o=e&&w(e)?e:t?.[0]?.selector;return st(o)}function zt(e){let t={targetFingerprint:G(e),selector:I(e),tagName:e.tagName.toLowerCase()},r=[],n=e.ownerDocument,o=c(n);for(;o;)r.unshift({url:n.URL,title:n.title,label:o.title||o.getAttribute("aria-label")||o.id||void 0}),n=o.ownerDocument,o=c(n);r.length&&(t.frameContext=r),e.id&&(t.id=e.id),e.classList.length>0&&(t.className=Array.from(e.classList).join(" "));let l=Xt(e)||e.matches('button, a, [role="button"], [role="tab"]')&&(e.getAttribute("aria-label")||e.getAttribute("title")||e.textContent?.trim())||"";l&&l.length>0&&l.length<200&&(t.textContent=l);let i={};for(let s of e.attributes)s.name.startsWith("data-")&&(i[s.name]=s.value);Object.keys(i).length>0&&(t.dataAttributes=i);let a=it(e);a&&(t.reactComponent=a.name,t.reactComponentPath=a.path,a.source&&(t.reactSource=a.source));let u=te(e);u&&(t.context=u);let f=q(e);return f&&(t.revealRecipe=f),t}function Xt(e){let t="";for(let r of e.childNodes)r.nodeType===Node.TEXT_NODE&&(t+=r.textContent||"");return t.trim()}function Jt(e,t,r){return ft(e,t,r)[0]??null}var Zt="[data-popmelt-canvas-block]";function ct(e,t){let r=P(e,t).find(n=>n.id!=="devtools-canvas"&&n.id!=="devtools-scrim");return!!(r&&$(r,Zt))}function Gt(e){return e.namespaceURI==="http://www.w3.org/2000/svg"?e.closest("svg")??e:e}function ft(e,t,r){if(ct(e,t))return[];let n=new Set,o=P(e,t),l=o.map(Gt).filter(i=>n.has(i)||(n.add(i),i.id==="devtools-canvas"||i.id==="devtools-toolbar"||i.id==="devtools-scrim")||$(i,"#devtools-toolbar")||i.hasAttribute("data-devtools")||$(i,"[data-devtools]")?!1:i!==i.ownerDocument.body&&i!==i.ownerDocument.documentElement);return l.length>0?l:r?.allowBodyFallback&&o.includes(document.body)?[document.body]:[]}function Kt(e,t,r){for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE||!n.textContent?.trim())continue;let o=e.ownerDocument.createRange();o.selectNodeContents(n);let l=o.getClientRects?.();if(l&&Array.from(l).some(i=>{let a=O(t,r,e.ownerDocument);return a.x>=i.left&&a.x<=i.right&&a.y>=i.top&&a.y<=i.bottom}))return!0}return!1}function Qt(e,t,r){if(Kt(e,t,r)||["button","canvas","embed","iframe","img","input","object","select","svg","textarea","video"].includes(e.tagName.toLowerCase()))return!0;let n=getComputedStyle(e);if(n.backgroundImage&&n.backgroundImage!=="none")return!0;let o=n.backgroundColor.trim();if(o&&o!=="transparent"&&!/rgba?\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(o))return!0;let l=H(e),i={top:Number.parseFloat(n.borderTopWidth)||0,right:Number.parseFloat(n.borderRightWidth)||0,bottom:Number.parseFloat(n.borderBottomWidth)||0,left:Number.parseFloat(n.borderLeftWidth)||0};return i.top>0&&r<=l.top+i.top||i.right>0&&t>=l.right-i.right||i.bottom>0&&r>=l.bottom-i.bottom||i.left>0&&t<=l.left+i.left}function Yt(e,t,r){let n=ft(e,t,r);return n.find(o=>Qt(o,e,t))??n.at(-1)??null}function te(e){let t=p(e),r=["section","article","nav","aside","header","footer","main"];for(;t&&t!==e.ownerDocument.body;){let n=t.tagName.toLowerCase();if(r.includes(n)&&t.id)return c(t.ownerDocument)?I(t):`${n}#${t.id}`;if(t.id&&!t.id.startsWith("radix-")&&!t.id.startsWith(":"))return c(t.ownerDocument)?I(t):`${n}#${t.id}`;t=p(t)}return null}export{It as A,zt as B,Jt as C,ct as D,Yt as E,N as F,xt as G,Ct as H,Dt as I,rt as J,nt as K,$t as L,Pt as M,Et as N,Mt as O,Ot as P,Tt as Q,c as a,D as b,F as c,H as d,O as e,gt as f,ht as g,T as h,pt as i,R as j,h as k,p as l,bt as m,$ as n,wt as o,P as p,E as q,K as r,At as s,y as t,Q as u,g as v,Bt as w,Ht as x,it as y,jt as z};