import{ac as f,ad as d,a8 as l,ae as y,af as S,i as m,ag as w}from"./CGQLQ9ei.js";import{i as h,b as x,a as $}from"./B2715eme.js";function k(){return m().public["nuxt-scripts"]}const R=["onNuxtReady","client"],b=["preconnect","dns-prefetch"];function v(t,r,c){const{src:e}=t,i=w(e),n=r&&b.includes(r),s=n?`${i.protocol}${i.host}`:e,o=!!i.host;if(!r||n&&!o)return;const u={href:s,rel:r,...C(t,["crossorigin","referrerpolicy","fetchpriority","integrity"])},a={fetchpriority:"low"};return r==="preload"&&(a.as="script"),o&&(a.crossorigin="anonymous",a.referrerpolicy="no-referrer"),$({link:[f(u,a)]},{head:c,tagPriority:"high"})}function I(t,r){var u,a,g;t=typeof t=="string"?{src:t}:t,r=f(r,(u=k())==null?void 0:u.defaultScriptOptions);const c=String(d(t)),e=l(),i=r.head||h();e.$scripts=e.$scripts||y({});const n=!!((a=e.$scripts)!=null&&a[c]);!r.warmupStrategy&&R.includes(String(r.trigger))&&(r.warmupStrategy="preload"),r.trigger==="onNuxtReady"&&(r.trigger=S),n||(g=performance==null?void 0:performance.mark)==null||g.call(performance,"mark_feature_usage",{detail:{feature:r.performanceMarkFeature??`nuxt-scripts:${c}`}});const s=x(t,r);s.warmup=p=>{s._warmupEl||(s._warmupEl=v(t,p,i))},r.warmupStrategy&&s.warmup(r.warmupStrategy);const o=s.remove;return s.remove=()=>{var p;return(p=s._warmupEl)==null||p.dispose(),e.$scripts[c]=void 0,o()},e.$scripts[c]=s,s}function O(t){return(m().public.scripts||{})[t]}function P(t,r,c){const e=O(t),i=Object.assign(c||{},typeof e=="object"?e:{}),n=r(i),s=f(i.scriptInput,n.scriptInput,{key:t}),o=Object.assign((i==null?void 0:i.scriptOptions)||{},n.scriptOptions||{}),u=o.beforeInit;return o.beforeInit=()=>{var a;u==null||u(),(a=n.clientInit)==null||a.call(n)},I(s,o)}function C(t,r){const c={};for(const e of r)e in t&&(c[e]=t[e]);return c}export{P as u};