import{n as x,i as P,t as C,c as W,d as _,e as I,f as R}from"./nOI-3DST.js";import{r as A,g as M,ao as b,E as S,W as T,l as $}from"./CibDhUcP.js";const E=I?window:void 0;function m(o){var n;const s=b(o);return(n=s==null?void 0:s.$el)!=null?n:s}function y(...o){let n,s,r,d;if(typeof o[0]=="string"||Array.isArray(o[0])?([s,r,d]=o,n=E):[n,s,r,d]=o,!n)return x;s=R(s),r=R(r);const f=[],a=()=>{f.forEach(l=>l()),f.length=0},c=(l,e,i,p)=>(l.addEventListener(e,i,p),()=>l.removeEventListener(e,i,p)),v=M(()=>[m(n),b(d)],([l,e])=>{if(a(),!l)return;const i=P(e)?{...e}:e;f.push(...s.flatMap(p=>r.map(g=>c(l,p,g,i))))},{immediate:!0,flush:"post"}),w=()=>{v(),a()};return C(w),w}let B=!1;function V(o,n,s={}){const{window:r=E,ignore:d=[],capture:f=!0,detectIframe:a=!1}=s;if(!r)return x;W&&!B&&(B=!0,Array.from(r.document.body.children).forEach(t=>t.addEventListener("click",x)),r.document.documentElement.addEventListener("click",x));let c=!0;const v=t=>b(d).some(u=>{if(typeof u=="string")return Array.from(r.document.querySelectorAll(u)).some(h=>h===t.target||t.composedPath().includes(h));{const h=m(u);return h&&(t.target===h||t.composedPath().includes(h))}});function w(t){const u=b(t);return u&&u.$.subTree.shapeFlag===16}function l(t,u){const h=b(t),O=h.$.subTree&&h.$.subTree.children;return O==null||!Array.isArray(O)?!1:O.some(k=>k.el===u.target||u.composedPath().includes(k.el))}const e=t=>{const u=m(o);if(t.target!=null&&!(!(u instanceof Element)&&w(o)&&l(o,t))&&!(!u||u===t.target||t.composedPath().includes(u))){if(t.detail===0&&(c=!v(t)),!c){c=!0;return}n(t)}};let i=!1;const p=[y(r,"click",t=>{i||(i=!0,setTimeout(()=>{i=!1},0),e(t))},{passive:!0,capture:f}),y(r,"pointerdown",t=>{const u=m(o);c=!v(t)&&!!(u&&!t.composedPath().includes(u))},{passive:!0}),a&&y(r,"blur",t=>{setTimeout(()=>{var u;const h=m(o);((u=r.document.activeElement)==null?void 0:u.tagName)==="IFRAME"&&!(h!=null&&h.contains(r.document.activeElement))&&n(t)},0)},{passive:!0})].filter(Boolean);return()=>p.forEach(t=>t())}function z(){const o=A(!1),n=$();return n&&T(()=>{o.value=!0},n),o}function L(o){const n=z();return S(()=>(n.value,!!o()))}function F(o,n,s={}){const{window:r=E,...d}=s;let f;const a=L(()=>r&&"ResizeObserver"in r),c=()=>{f&&(f.disconnect(),f=void 0)},v=S(()=>{const e=b(o);return Array.isArray(e)?e.map(i=>m(i)):[m(e)]}),w=M(v,e=>{if(c(),a.value&&r){f=new ResizeObserver(n);for(const i of e)i&&f.observe(i,d)}},{immediate:!0,flush:"post"}),l=()=>{c(),w()};return C(l),{isSupported:a,stop:l}}function j(o,n={width:0,height:0},s={}){const{window:r=E,box:d="content-box"}=s,f=S(()=>{var e,i;return(i=(e=m(o))==null?void 0:e.namespaceURI)==null?void 0:i.includes("svg")}),a=A(n.width),c=A(n.height),{stop:v}=F(o,([e])=>{const i=d==="border-box"?e.borderBoxSize:d==="content-box"?e.contentBoxSize:e.devicePixelContentBoxSize;if(r&&f.value){const p=m(o);if(p){const g=p.getBoundingClientRect();a.value=g.width,c.value=g.height}}else if(i){const p=R(i);a.value=p.reduce((g,{inlineSize:t})=>g+t,0),c.value=p.reduce((g,{blockSize:t})=>g+t,0)}else a.value=e.contentRect.width,c.value=e.contentRect.height},s);_(()=>{const e=m(o);e&&(a.value="offsetWidth"in e?e.offsetWidth:n.width,c.value="offsetHeight"in e?e.offsetHeight:n.height)});const w=M(()=>m(o),e=>{a.value=e?n.width:0,c.value=e?n.height:0});function l(){v(),w()}return{width:a,height:c,stop:l}}function q(o={}){const{window:n=E}=o,s=n==null?void 0:n.navigator,r=L(()=>s&&"language"in s),d=A(s==null?void 0:s.language);return y(n,"languagechange",()=>{s&&(d.value=s.language)},{passive:!0}),{isSupported:r,language:d}}export{q as a,V as o,j as u};
