@ktt45678/vidstack
Version:
UI component library for building high-quality, accessible video and audio experiences on the web.
2 lines (1 loc) • 2.77 kB
JavaScript
import{a5 as A,G as x,o as v,a8 as w,a2 as C,q as d,e as T,l as u,b as g,P as k,z as S,a9 as P,aa as $,ab as V,ac as L}from"./vidstack-B1PqmCkk.js";function M(t,e,n){if(t)return u(t,e,n)}function F(t,e){const n=e.composedPath()[0];return w(n)&&t.contains(n)}const f=new Set;{let t=function(){for(const e of f)try{e()}catch{}window.requestAnimationFrame(t)};t()}function H(t){return f.add(t),()=>f.delete(t)}function N(t,e,n){t.hasAttribute(e)||t.setAttribute(e,n)}function O(t,e){if(t.hasAttribute("aria-label")||t.hasAttribute("data-no-label"))return;if(!C(e)){d(t,"aria-label",e);return}function n(){d(t,"aria-label",e())}T(n)}function p(t){const e=getComputedStyle(t);return e.display!=="none"&&parseInt(e.opacity)>0}function q(t){return!!t&&("checkVisibility"in t?t.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}):p(t))}function D(t,e){return H(()=>e(q(t)))}function I(t,e,n){for(;e;){if(e===t)return!0;if(n?.(e))break;e=e.parentElement}return!1}function j(t,e){u(t,"pointerup",n=>{n.button===0&&!n.defaultPrevented&&e(n)}),u(t,"keydown",n=>{g(n)&&e(n)})}function R(t){return k(t)&&(t.touches.length>1||t.changedTouches.length>1)}function z(t){let e=A(),n=window.requestAnimationFrame(()=>{x(t,e),n=-1});return()=>void window.cancelAnimationFrame(n)}function B(t,e,n){let a,l=t,c=t.parentElement,o=t.content.firstElementChild,r=[];!o&&t.firstElementChild&&(t.innerHTML=t.firstElementChild.outerHTML,t.firstElementChild.remove(),o=t.content.firstElementChild);for(let i=0;i<e;i++)a=document.importNode(o,!0),n?.(a,i),c.insertBefore(a,l.nextSibling),r.push(a),l=a;return v(()=>{for(let i=0;i<r.length;i++)r[i].remove()}),r}function G(t){const e=document.createElement("template");return e.innerHTML=t,e.content}function J(t){return t.cloneNode(!0).firstElementChild}function K(t,e,n,{offsetVarName:a,xOffset:l,yOffset:c,...o}){if(!t)return;const r=n.replace(" ","-").replace("-center","");if(S(t,"visibility",e?null:"hidden"),!e)return;let i=n.includes("top");const b=s=>n.includes("left")?`calc(-1 * ${s})`:s,h=s=>i?`calc(-1 * ${s})`:s;return P(e,t,()=>{$(e,t,{placement:r,middleware:[...o.middleware??[],V({fallbackAxisSideDirection:"start",crossAxis:!1}),L()],...o}).then(({x:s,y,middlewareData:E})=>{const m=!!E.flip?.index;i=n.includes(m?"bottom":"top"),t.setAttribute("data-placement",m?n.startsWith("top")?n.replace("top","bottom"):n.replace("bottom","top"):n),Object.assign(t.style,{top:`calc(${y+"px"} + ${h(c?c+"px":`var(--${a}-y-offset, 0px)`)})`,left:`calc(${s+"px"} + ${b(l?l+"px":`var(--${a}-x-offset, 0px)`)})`})})})}function U(t){return getComputedStyle(t).animationName!=="none"}function W(t){return t instanceof HTMLElement}export{W as a,O as b,B as c,I as d,F as e,p as f,K as g,U as h,R as i,D as j,G as k,J as l,M as m,j as o,z as r,N as s};