import{_ as S,$ as g,a0 as M,r as v,a1 as O,a2 as R,a3 as C,u as T,a4 as y,a5 as w,a6 as b,C as _}from"./index-mMdhNzKT.js";function k(e){return R()?(C(e),!0):!1}function m(e){return typeof e=="function"?e():T(e)}const h=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const W=e=>e!=null,B=()=>{};function D(e){return e||y()}function U(...e){if(e.length!==1)return S(...e);const t=e[0];return typeof t=="function"?g(M(()=>({get:t,set:B}))):v(t)}function $(e,t){D(t)&&O(e,t)}function A(e){var t;const i=m(e);return(t=i==null?void 0:i.$el)!=null?t:i}const E=h?window:void 0,G=h?window.document:void 0;function L(){const e=v(!1),t=y();return t&&_(()=>{e.value=!0},t),e}function q(e){const t=L();return b(()=>(t.value,!!e()))}function x(e,t,i={}){const{window:s=E,...c}=i;let n;const l=q(()=>s&&"MutationObserver"in s),a=()=>{n&&(n.disconnect(),n=void 0)},r=b(()=>{const u=m(e),p=(Array.isArray(u)?u:[u]).map(A).filter(W);return new Set(p)}),d=w(()=>r.value,u=>{a(),l.value&&s&&u.size&&(n=new MutationObserver(t),u.forEach(p=>n.observe(p,c)))},{immediate:!0,flush:"post"}),f=()=>n==null?void 0:n.takeRecords(),o=()=>{a(),d()};return k(o),{isSupported:l,stop:o,takeRecords:f}}function I(e=null,t={}){var i,s,c;const{document:n=G,restoreOnUnmount:l=o=>o}=t,a=(i=n==null?void 0:n.title)!=null?i:"",r=U((s=e??(n==null?void 0:n.title))!=null?s:null),d=e&&typeof e=="function";function f(o){if(!("titleTemplate"in t))return o;const u=t.titleTemplate||"%s";return typeof u=="function"?u(o):m(u).replace(/%s/g,o)}return w(r,(o,u)=>{o!==u&&n&&(n.title=f(typeof o=="string"?o:""))},{immediate:!0}),t.observe&&!t.titleTemplate&&n&&!d&&x((c=n.head)==null?void 0:c.querySelector("title"),()=>{n&&n.title!==r.value&&(r.value=f(n.title))},{childList:!0}),$(()=>{if(l){const o=l(a,r.value||"");o!=null&&n&&(n.title=o)}}),r}export{I as u};
