@nuxtjs/prismic 4.0.0 → 4.1.0-pr.235.94cfeb5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +18 -32
- package/dist/module.d.mts +48 -75
- package/dist/module.json +3 -3
- package/dist/module.mjs +193 -242
- package/dist/runtime/PrismicPreview.d.vue.ts +3 -0
- package/dist/runtime/PrismicPreview.vue +8 -14
- package/dist/runtime/PrismicPreview.vue.d.ts +3 -0
- package/dist/runtime/plugin.client.js +13 -7
- package/dist/runtime/plugin.js +89 -72
- package/dist/runtime/usePrismicPreview.d.ts +1 -5
- package/dist/runtime/usePrismicPreview.js +3 -3
- package/dist/types.d.mts +3 -1
- package/package.json +38 -45
- package/src/module.ts +352 -185
- package/src/runtime/PrismicPreview.vue +12 -16
- package/src/runtime/plugin.client.ts +16 -12
- package/src/runtime/plugin.ts +114 -103
- package/src/runtime/usePrismicPreview.ts +7 -11
- package/dist/client/200.html +0 -1
- package/dist/client/404.html +0 -1
- package/dist/client/_nuxt/BMD6bpEv.js +0 -1
- package/dist/client/_nuxt/BQB6UGbx.js +0 -25
- package/dist/client/_nuxt/CkG7IjgS.js +0 -1
- package/dist/client/_nuxt/DlAUqK2U.js +0 -1
- package/dist/client/_nuxt/H1okkFcd.js +0 -1
- package/dist/client/_nuxt/RYS3n4u0.js +0 -1
- package/dist/client/_nuxt/V_weDLQm.js +0 -1
- package/dist/client/_nuxt/builds/latest.json +0 -1
- package/dist/client/_nuxt/builds/meta/ef21bbff-0463-480b-852c-adffad3f33b7.json +0 -1
- package/dist/client/_nuxt/entry.BC9BDAld.css +0 -1
- package/dist/client/_nuxt/error-404.smTsHvdw.css +0 -1
- package/dist/client/_nuxt/error-500.Bo-s0s94.css +0 -1
- package/dist/client/_nuxt/index.C4BggqQh.css +0 -1
- package/dist/client/index.html +0 -1
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -136
- package/dist/types.d.ts +0 -1
- package/src/devtools/index.ts +0 -127
- package/src/devtools/types.ts +0 -22
- package/src/lib/fileExists.ts +0 -15
- package/src/lib/index.ts +0 -2
- package/src/lib/logger.ts +0 -3
- package/src/types.ts +0 -137
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { refreshNuxtData, useRuntimeConfig } from '#imports'
|
|
1
|
+
import { defineNuxtPlugin } from "#app"
|
|
2
|
+
import { refreshNuxtData, useRuntimeConfig } from "#imports"
|
|
4
3
|
|
|
5
|
-
export default defineNuxtPlugin(
|
|
6
|
-
|
|
4
|
+
export default defineNuxtPlugin({
|
|
5
|
+
name: "prismic:plugin:client",
|
|
6
|
+
parallel: true,
|
|
7
|
+
setup() {
|
|
8
|
+
hotReloadPrismicPreview()
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
function hotReloadPrismicPreview() {
|
|
11
|
+
if (useRuntimeConfig().public.prismic?.preview) {
|
|
12
|
+
window.addEventListener("prismicPreviewUpdate", (event) => {
|
|
13
|
+
event.preventDefault()
|
|
14
|
+
refreshNuxtData()
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
15
19
|
})
|
package/src/runtime/plugin.ts
CHANGED
|
@@ -1,127 +1,138 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
// @ts-expect-error vfs cannot be resolved here
|
|
20
|
-
import sliceZoneDefaultComponent from '#build/prismic/proxy/sliceZoneDefaultComponent'
|
|
1
|
+
import { defineNuxtPlugin } from "#app"
|
|
2
|
+
import NuxtLink from "#app/components/nuxt-link"
|
|
3
|
+
import _client from "#build/prismic/proxy/client"
|
|
4
|
+
// @ts-expect-error - Proxy file
|
|
5
|
+
import defaultComponents from "#build/prismic/proxy/defaultComponents"
|
|
6
|
+
// @ts-expect-error - Proxy file
|
|
7
|
+
import linkResolver from "#build/prismic/proxy/linkResolver"
|
|
8
|
+
import {
|
|
9
|
+
onNuxtReady,
|
|
10
|
+
refreshNuxtData,
|
|
11
|
+
useCookie,
|
|
12
|
+
useHead,
|
|
13
|
+
useRequestEvent,
|
|
14
|
+
useRouter,
|
|
15
|
+
useRuntimeConfig,
|
|
16
|
+
} from "#imports"
|
|
17
|
+
import { Client, createClient } from "@prismicio/client"
|
|
18
|
+
import { createPrismic } from "@prismicio/vue"
|
|
21
19
|
|
|
22
20
|
export default defineNuxtPlugin({
|
|
23
|
-
name:
|
|
21
|
+
name: "prismic:setup",
|
|
24
22
|
parallel: true,
|
|
25
23
|
async setup(nuxtApp) {
|
|
26
|
-
const options
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
console.error('[@nuxtjs/prismic] An error happened while resolving your Prismic custom client, disabling Prismic module gracefully...', error)
|
|
24
|
+
const options = useRuntimeConfig().public.prismic
|
|
25
|
+
|
|
26
|
+
const client = await resolveClient()
|
|
27
|
+
handlePreview()
|
|
28
|
+
addToolbar()
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
async function resolveClient() {
|
|
31
|
+
if ((_client as unknown) instanceof Client) {
|
|
32
|
+
return _client!
|
|
33
|
+
} else if (typeof _client === "function") {
|
|
34
|
+
try {
|
|
35
|
+
return await nuxtApp.runWithContext(() =>
|
|
36
|
+
(_client as unknown as () => Client)(),
|
|
37
|
+
)
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error(
|
|
40
|
+
"[@nuxtjs/prismic] An error happened while resolving your Prismic custom client, disabling Prismic module gracefully...",
|
|
41
|
+
error,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
// The Vue plugin still requires a client to work, we're providing an obviously broken one.
|
|
45
|
+
return createClient(
|
|
46
|
+
"error-resolving-custom-client",
|
|
47
|
+
options.clientConfig,
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
return createClient(
|
|
52
|
+
options.environment || options.endpoint || "endpoint-not-provided",
|
|
53
|
+
options.clientConfig,
|
|
39
54
|
)
|
|
40
55
|
}
|
|
41
56
|
}
|
|
42
|
-
else {
|
|
43
|
-
client = _client
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const endpoint = options.environment || options.endpoint || client?.documentAPIEndpoint || ''
|
|
47
|
-
|
|
48
|
-
const prismicPlugin = createPrismic({
|
|
49
|
-
...options,
|
|
50
|
-
endpoint,
|
|
51
|
-
// TypeScript expects either an endpoint of a client, not both
|
|
52
|
-
client: client as undefined,
|
|
53
|
-
linkResolver,
|
|
54
|
-
richTextSerializer,
|
|
55
|
-
injectComponents: false, // Handled at module level
|
|
56
|
-
components: {
|
|
57
|
-
linkInternalComponent: NuxtLink,
|
|
58
|
-
linkExternalComponent: NuxtLink,
|
|
59
|
-
...options.components,
|
|
60
|
-
linkRel,
|
|
61
|
-
richTextComponents,
|
|
62
|
-
sliceZoneDefaultComponent,
|
|
63
|
-
},
|
|
64
|
-
})
|
|
65
57
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const previewCookie = useCookie('io.prismic.preview').value
|
|
58
|
+
function handlePreview() {
|
|
59
|
+
if (options.preview) {
|
|
60
|
+
const previewCookie = useCookie("io.prismic.preview").value
|
|
70
61
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
// Update client with req when running server side
|
|
63
|
+
if (import.meta.server) {
|
|
64
|
+
const req = useRequestEvent()?.node.req
|
|
65
|
+
if (req) {
|
|
66
|
+
client.enableAutoPreviewsFromReq(req)
|
|
67
|
+
}
|
|
76
68
|
}
|
|
77
|
-
}
|
|
78
69
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
70
|
+
if (previewCookie) {
|
|
71
|
+
try {
|
|
72
|
+
const session =
|
|
73
|
+
typeof previewCookie === "string"
|
|
74
|
+
? JSON.parse(decodeURIComponent(previewCookie))
|
|
75
|
+
: previewCookie
|
|
82
76
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
77
|
+
if (
|
|
78
|
+
Object.keys(session).some(
|
|
79
|
+
(key) =>
|
|
80
|
+
key in session &&
|
|
81
|
+
typeof session[key] === "object" &&
|
|
82
|
+
session[key] !== null &&
|
|
83
|
+
"preview" in session[key] &&
|
|
84
|
+
session[key].preview,
|
|
85
|
+
)
|
|
86
|
+
) {
|
|
87
|
+
let afterEachCalled = false
|
|
88
|
+
onNuxtReady(() => {
|
|
89
|
+
if (!afterEachCalled) {
|
|
90
|
+
refreshNuxtData()
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
useRouter().afterEach(() => {
|
|
94
|
+
afterEachCalled = true
|
|
93
95
|
refreshNuxtData()
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
refreshNuxtData()
|
|
99
|
-
})
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.warn("Failed to parse Prismic preview cookie", error)
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
console.warn('Failed to parse Prismic preview cookie', error)
|
|
104
|
-
}
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
104
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
105
|
+
function addToolbar() {
|
|
106
|
+
if (options.toolbar) {
|
|
107
|
+
// Add toolbar
|
|
108
|
+
useHead({
|
|
109
|
+
script: [
|
|
110
|
+
{
|
|
111
|
+
key: "prismic-preview",
|
|
112
|
+
src: `https://static.cdn.prismic.io/prismic.min.js?repo=${client.repositoryName}&new=true`,
|
|
113
|
+
async: true,
|
|
114
|
+
defer: true,
|
|
115
|
+
crossorigin: "anonymous",
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
})
|
|
119
|
+
} else {
|
|
120
|
+
// TODO: We might want to let user disable this behavior because it might have unexpected side effects
|
|
121
|
+
useCookie("io.prismic.preview").value = null
|
|
122
|
+
}
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
const prismicPlugin = createPrismic({
|
|
126
|
+
client,
|
|
127
|
+
componentsConfig: {
|
|
128
|
+
linkResolver,
|
|
129
|
+
linkInternalComponent: NuxtLink,
|
|
130
|
+
linkExternalComponent: NuxtLink,
|
|
131
|
+
defaultComponents,
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
nuxtApp.vueApp.use(prismicPlugin)
|
|
125
136
|
return {
|
|
126
137
|
provide: { prismic: prismicPlugin },
|
|
127
138
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-expect-error - Proxy file
|
|
2
|
+
import { usePrismic, useRouter } from "#imports"
|
|
3
|
+
import { onMounted } from "vue"
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Resolves Prismic previews on the preview entry page (`/preview`)
|
|
7
|
-
*
|
|
8
|
-
* @param defaultURL - The default URL to redirect to if the previewed document doesn't map to one.
|
|
9
|
-
*/
|
|
10
|
-
export const usePrismicPreview = (defaultURL = '/'): void => {
|
|
11
|
-
const { client, options: { linkResolver } } = usePrismic()
|
|
5
|
+
/** Resolves Prismic previews on the preview entry page (`/preview`) */
|
|
6
|
+
export const usePrismicPreview = (defaultURL = "/"): void => {
|
|
7
|
+
const { client, componentsConfig } = usePrismic()
|
|
12
8
|
const { push } = useRouter()
|
|
13
9
|
onMounted(async () => {
|
|
14
10
|
const redirectURL = await client.resolvePreviewURL({
|
|
15
|
-
linkResolver,
|
|
11
|
+
linkResolver: componentsConfig.linkResolver,
|
|
16
12
|
defaultURL,
|
|
17
13
|
})
|
|
18
14
|
|
package/dist/client/200.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html data-capo=""><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__prismic-client/_nuxt/entry.BC9BDAld.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__prismic-client/_nuxt/BQB6UGbx.js"><link rel="prefetch" as="style" crossorigin href="/__prismic-client/_nuxt/error-404.smTsHvdw.css"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/V_weDLQm.js"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/BMD6bpEv.js"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/DlAUqK2U.js"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/CkG7IjgS.js"><link rel="prefetch" as="style" crossorigin href="/__prismic-client/_nuxt/error-500.Bo-s0s94.css"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/H1okkFcd.js"><script type="module" src="/__prismic-client/_nuxt/BQB6UGbx.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1737402154202,false]</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__prismic-client",buildId:"ef21bbff-0463-480b-852c-adffad3f33b7",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/client/404.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html data-capo=""><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__prismic-client/_nuxt/entry.BC9BDAld.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__prismic-client/_nuxt/BQB6UGbx.js"><link rel="prefetch" as="style" crossorigin href="/__prismic-client/_nuxt/error-404.smTsHvdw.css"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/V_weDLQm.js"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/BMD6bpEv.js"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/DlAUqK2U.js"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/CkG7IjgS.js"><link rel="prefetch" as="style" crossorigin href="/__prismic-client/_nuxt/error-500.Bo-s0s94.css"><link rel="prefetch" as="script" crossorigin href="/__prismic-client/_nuxt/H1okkFcd.js"><script type="module" src="/__prismic-client/_nuxt/BQB6UGbx.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1737402154202,false]</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__prismic-client",buildId:"ef21bbff-0463-480b-852c-adffad3f33b7",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{B as S,m as B,r as w,C as _,D as E,E as T,F as U,g as I,G as F,H as A,I as L,J as H,K as D,u as x,L as N,M as O,N as V,O as M,P as z,Q as W,R as G}from"./BQB6UGbx.js";async function j(t,a=S()){const{path:v,matched:p}=a.resolve(t);if(!p.length||(a._routePreloaded||(a._routePreloaded=new Set),a._routePreloaded.has(v)))return;const g=a._preloadPromises=a._preloadPromises||[];if(g.length>4)return Promise.all(g).then(()=>j(t,a));a._routePreloaded.add(v);const e=p.map(n=>{var s;return(s=n.components)==null?void 0:s.default}).filter(n=>typeof n=="function");for(const n of e){const s=Promise.resolve(n()).catch(()=>{}).finally(()=>g.splice(g.indexOf(s)));g.push(s)}await Promise.all(g)}const Q=(...t)=>t.find(a=>a!==void 0);function $(t){const a=t.componentName||"NuxtLink";function v(e){return typeof e=="string"&&e.startsWith("#")}function p(e,n){if(!e||t.trailingSlash!=="append"&&t.trailingSlash!=="remove")return e;if(typeof e=="string")return k(e,t.trailingSlash);const s="path"in e&&e.path!==void 0?e.path:n(e).path;return{...e,name:void 0,path:k(s,t.trailingSlash)}}function g(e){const n=S(),s=z(),u=x(()=>!!e.target&&e.target!=="_self"),d=x(()=>{const f=e.to||e.href||"";return typeof f=="string"&&N(f,{acceptRelative:!0})}),P=L("RouterLink"),y=P&&typeof P!="string"?P.useLink:void 0,m=x(()=>{if(e.external)return!0;const f=e.to||e.href||"";return typeof f=="object"?!1:f===""||d.value}),r=x(()=>{const f=e.to||e.href||"";return m.value?f:p(f,n.resolve)}),c=m.value||y==null?void 0:y({...e,to:r}),b=x(()=>{var f;if(!r.value||d.value||v(r.value))return r.value;if(m.value){const C=typeof r.value=="object"&&"path"in r.value?O(r.value):r.value,R=typeof C=="object"?n.resolve(C).href:C;return p(R,n.resolve)}return typeof r.value=="object"?((f=n.resolve(r.value))==null?void 0:f.href)??null:p(V(s.app.baseURL,r.value),n.resolve)});return{to:r,hasTarget:u,isAbsoluteUrl:d,isExternal:m,href:b,isActive:(c==null?void 0:c.isActive)??x(()=>r.value===n.currentRoute.value.path),isExactActive:(c==null?void 0:c.isExactActive)??x(()=>r.value===n.currentRoute.value.path),route:(c==null?void 0:c.route)??x(()=>n.resolve(r.value)),async navigate(){await M(b.value,{replace:e.replace,external:m.value||u.value})}}}return B({name:a,props:{to:{type:[String,Object],default:void 0,required:!1},href:{type:[String,Object],default:void 0,required:!1},target:{type:String,default:void 0,required:!1},rel:{type:String,default:void 0,required:!1},noRel:{type:Boolean,default:void 0,required:!1},prefetch:{type:Boolean,default:void 0,required:!1},prefetchOn:{type:[String,Object],default:void 0,required:!1},noPrefetch:{type:Boolean,default:void 0,required:!1},activeClass:{type:String,default:void 0,required:!1},exactActiveClass:{type:String,default:void 0,required:!1},prefetchedClass:{type:String,default:void 0,required:!1},replace:{type:Boolean,default:void 0,required:!1},ariaCurrentValue:{type:String,default:void 0,required:!1},external:{type:Boolean,default:void 0,required:!1},custom:{type:Boolean,default:void 0,required:!1}},useLink:g,setup(e,{slots:n}){const s=S(),{to:u,href:d,navigate:P,isExternal:y,hasTarget:m,isAbsoluteUrl:r}=g(e),c=w(!1),b=w(null),f=l=>{var o;b.value=e.custom?(o=l==null?void 0:l.$el)==null?void 0:o.nextElementSibling:l==null?void 0:l.$el};function C(l){var o,i;return!c.value&&(typeof e.prefetchOn=="string"?e.prefetchOn===l:((o=e.prefetchOn)==null?void 0:o[l])??((i=t.prefetchOn)==null?void 0:i[l]))&&(e.prefetch??t.prefetch)!==!1&&e.noPrefetch!==!0&&e.target!=="_blank"&&!X()}async function R(l=_()){if(c.value)return;c.value=!0;const o=typeof u.value=="string"?u.value:y.value?O(u.value):s.resolve(u.value).fullPath,i=y.value?new URL(o,window.location.href).href:o;await Promise.all([l.hooks.callHook("link:prefetch",i).catch(()=>{}),!y.value&&!m.value&&j(u.value,s).catch(()=>{})])}if(C("visibility")){const l=_();let o,i=null;E(()=>{const h=J();T(()=>{o=U(()=>{var q;(q=b==null?void 0:b.value)!=null&&q.tagName&&(i=h.observe(b.value,async()=>{i==null||i(),i=null,await R(l)}))})})}),I(()=>{o&&F(o),i==null||i(),i=null})}return()=>{var i;if(!y.value&&!m.value&&!v(u.value)){const h={ref:f,to:u.value,activeClass:e.activeClass||t.activeClass,exactActiveClass:e.exactActiveClass||t.exactActiveClass,replace:e.replace,ariaCurrentValue:e.ariaCurrentValue,custom:e.custom};return e.custom||(C("interaction")&&(h.onPointerenter=R.bind(null,void 0),h.onFocus=R.bind(null,void 0)),c.value&&(h.class=e.prefetchedClass||t.prefetchedClass),h.rel=e.rel||void 0),A(L("RouterLink"),h,n.default)}const l=e.target||null,o=Q(e.noRel?"":e.rel,t.externalRelAttribute,r.value||m.value?"noopener noreferrer":"")||null;return e.custom?n.default?n.default({href:d.value,navigate:P,prefetch:R,get route(){if(!d.value)return;const h=new URL(d.value,window.location.href);return{path:h.pathname,fullPath:h.pathname,get query(){return H(h.search)},hash:h.hash,params:{},name:void 0,matched:[],redirectedFrom:void 0,meta:{},href:d.value}},rel:o,target:l,isExternal:y.value||m.value,isActive:!1,isExactActive:!1}):null:A("a",{ref:b,href:d.value||null,rel:o,target:l},(i=n.default)==null?void 0:i.call(n))}}})}const Z=$(D);function k(t,a){const v=a==="append"?W:G;return N(t)&&!t.startsWith("http")?t:v(t,!0)}function J(){const t=_();if(t._observer)return t._observer;let a=null;const v=new Map,p=(e,n)=>(a||(a=new IntersectionObserver(s=>{for(const u of s){const d=v.get(u.target);(u.isIntersecting||u.intersectionRatio>0)&&d&&d()}})),v.set(e,n),a.observe(e),()=>{v.delete(e),a==null||a.unobserve(e),v.size===0&&(a==null||a.disconnect(),a=null)});return t._observer={observe:p}}const K=/2g/;function X(){const t=navigator.connection;return!!(t&&(t.saveData||K.test(t.effectiveType)))}export{Z as _};
|