{"version":3,"file":"CdEOEGIx.js","sources":["../../../../../../.pnpm/@unhead+vue@1.11.18_vue@3.5.13_typescript@5.7.3_/node_modules/@unhead/vue/dist/index.mjs"],"sourcesContent":["import { useScript as useScript$1 } from 'unhead';\nexport { CapoPlugin, HashHydrationPlugin, createHeadCore } from 'unhead';\nimport { i as injectHead, h as headSymbol, V as Vue3 } from './shared/vue.ziyDaVMR.mjs';\nexport { c as createHead, a as createServerHead, r as resolveUnrefHeadInput, s as setHeadInjectionHandler } from './shared/vue.ziyDaVMR.mjs';\nimport { composableNames, whitelistSafeInput, unpackMeta } from '@unhead/shared';\nimport { u as useHead } from './shared/vue.-sixQ7xP.mjs';\nimport { getCurrentInstance, onMounted, isRef, watch, onScopeDispose, ref } from 'vue';\n\nconst coreComposableNames = [\n \"injectHead\"\n];\nconst unheadVueComposablesImports = {\n \"@unhead/vue\": [...coreComposableNames, ...composableNames]\n};\n\nfunction useHeadSafe(input, options = {}) {\n return useHead(input, { ...options, transform: whitelistSafeInput });\n}\n\nfunction registerVueScopeHandlers(script, scope) {\n if (!scope) {\n return;\n }\n const _registerCb = (key, cb) => {\n if (!script._cbs[key]) {\n cb(script.instance);\n return () => {\n };\n }\n let i = script._cbs[key].push(cb);\n const destroy = () => {\n if (i) {\n script._cbs[key]?.splice(i - 1, 1);\n i = null;\n }\n };\n onScopeDispose(destroy);\n return destroy;\n };\n script.onLoaded = (cb) => _registerCb(\"loaded\", cb);\n script.onError = (cb) => _registerCb(\"error\", cb);\n onScopeDispose(() => {\n script._triggerAbortController?.abort();\n });\n}\nfunction useScript(_input, _options) {\n const input = typeof _input === \"string\" ? { src: _input } : _input;\n const options = _options || {};\n const head = options?.head || injectHead();\n options.head = head;\n const scope = getCurrentInstance();\n options.eventContext = scope;\n if (scope && typeof options.trigger === \"undefined\") {\n options.trigger = onMounted;\n } else if (isRef(options.trigger)) {\n const refTrigger = options.trigger;\n let off;\n options.trigger = new Promise((resolve) => {\n off = watch(refTrigger, (val) => {\n if (val) {\n resolve(true);\n }\n }, {\n immediate: true\n });\n onScopeDispose(() => resolve(false), true);\n }).then((val) => {\n off?.();\n return val;\n });\n }\n head._scriptStatusWatcher = head._scriptStatusWatcher || head.hooks.hook(\"script:updated\", ({ script: s }) => {\n s._statusRef.value = s.status;\n });\n const script = useScript$1(input, options);\n script._statusRef = script._statusRef || ref(script.status);\n registerVueScopeHandlers(script, scope);\n return new Proxy(script, {\n get(_, key, a) {\n return Reflect.get(_, key === \"status\" ? \"_statusRef\" : key, a);\n }\n });\n}\n\nfunction useSeoMeta(input, options) {\n const { title, titleTemplate, ...meta } = input;\n return useHead({\n title,\n titleTemplate,\n // @ts-expect-error runtime type\n _flatMeta: meta\n }, {\n ...options,\n transform(t) {\n const meta2 = unpackMeta({ ...t._flatMeta });\n delete t._flatMeta;\n return {\n // @ts-expect-error runtime type\n ...t,\n meta: meta2\n };\n }\n });\n}\n\nfunction useServerHead(input, options = {}) {\n const head = options.head || injectHead();\n delete options.head;\n if (head)\n return head.push(input, { ...options, mode: \"server\" });\n}\n\nfunction useServerHeadSafe(input, options = {}) {\n return useHeadSafe(input, { ...options, mode: \"server\" });\n}\n\nfunction useServerSeoMeta(input, options) {\n return useSeoMeta(input, { ...options, mode: \"server\" });\n}\n\nconst Vue2ProvideUnheadPlugin = (_Vue, head) => {\n _Vue.mixin({\n beforeCreate() {\n const options = this.$options;\n const origProvide = options.provide;\n options.provide = function() {\n let origProvideResult;\n if (typeof origProvide === \"function\")\n origProvideResult = origProvide.call(this);\n else\n origProvideResult = origProvide || {};\n return {\n ...origProvideResult,\n [headSymbol]: head\n };\n };\n }\n });\n};\n\nconst VueHeadMixin = {\n created() {\n let source = false;\n if (Vue3) {\n const instance = getCurrentInstance();\n if (!instance)\n return;\n const options = instance.type;\n if (!options || !(\"head\" in options))\n return;\n source = typeof options.head === \"function\" ? () => options.head.call(instance.proxy) : options.head;\n } else {\n const head = this.$options.head;\n if (head) {\n source = typeof head === \"function\" ? () => head.call(this) : head;\n }\n }\n source && useHead(source);\n }\n};\n\nexport { Vue2ProvideUnheadPlugin, VueHeadMixin, injectHead, unheadVueComposablesImports, useHead, useHeadSafe, useScript, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };\n"],"names":["useSeoMeta","input","options","title","titleTemplate","meta","useHead","meta2","unpackMeta"],"mappings":"qCAoFA,SAASA,EAAWC,EAAOC,EAAS,CAClC,KAAM,CAAE,MAAAC,EAAO,cAAAC,EAAe,GAAGC,CAAM,EAAGJ,EAC1C,OAAOK,EAAQ,CACb,MAAAH,EACA,cAAAC,EAEA,UAAWC,CACf,EAAK,CACD,GAAGH,EACH,UAAU,EAAG,CACX,MAAMK,EAAQC,EAAW,CAAE,GAAG,EAAE,SAAS,CAAE,EAC3C,cAAO,EAAE,UACF,CAEL,GAAG,EACH,KAAMD,CACP,CACP,CACA,CAAG,CACH","x_google_ignoreList":[0]}