@storyblok/astro 7.3.5 → 7.3.6
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/dist/storyblok-astro.es.js +590 -508
- package/dist/storyblok-astro.umd.js +12 -12
- package/package.json +2 -2
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const
|
|
1
|
+
const be = `
|
|
2
2
|
<svg class="logo-storyblok logo-storyblok--dark" role="img" aria-label="Storyblok Official Logo" viewBox="0 0 19 22" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path d="M29.0287 14.9132C28.2686 14.9132 27.5302 14.8018 26.7918 14.5568C26.0988 14.3265 25.462 13.9468 24.924 13.4432L25.9013 11.7504C26.4443 12.1291 26.9655 12.4186 27.4867 12.6414C27.9862 12.8641 28.4858 12.9532 28.9636 12.9532C29.3111 12.9532 29.5934 12.8864 29.7888 12.7527C29.9843 12.6414 30.0712 12.4409 30.0712 12.1959C30.0712 11.9732 29.9626 11.7504 29.702 11.6168C29.2938 11.4162 28.8636 11.2666 28.4206 11.1714L26.9003 10.6591C26.4877 10.4809 26.1619 10.3027 25.9013 10.1023C25.6407 9.92408 25.4452 9.67908 25.3366 9.43408C25.2184 9.1529 25.1592 8.84935 25.1629 8.54317C25.1502 7.66646 25.5255 6.83107 26.1836 6.27136C26.4877 6.00408 26.8786 5.80363 27.313 5.64772C27.7473 5.49181 28.2251 5.42499 28.7247 5.42499C29.3979 5.42499 30.0277 5.51408 30.6141 5.69226C31.2005 5.89272 31.7652 6.22681 32.3081 6.71681L31.244 8.38726C30.8236 8.07881 30.3722 7.81747 29.8974 7.60772C29.4848 7.42954 29.1156 7.36272 28.7247 7.36272C28.4423 7.36272 28.1817 7.40726 27.9862 7.5409C27.7691 7.65226 27.6822 7.85272 27.6822 8.11999C27.6822 8.38726 27.7908 8.56545 28.008 8.69908C28.2251 8.83272 28.6595 8.96635 29.2459 9.12226C29.7903 9.26289 30.3268 9.4339 30.853 9.63454C31.2874 9.81272 31.6349 10.0132 31.9172 10.2136C32.4511 10.6169 32.7463 11.2726 32.6991 11.9509C32.6991 12.8641 32.3733 13.5768 31.7 14.1114C31.0485 14.6459 30.1798 14.9132 29.0287 14.9132ZM39.7792 14.2673C39.41 14.4232 38.9756 14.5791 38.4978 14.7127C38.02 14.8464 37.5422 14.9354 37.0427 14.9354C36.6952 14.9354 36.3911 14.8909 36.0871 14.8018C35.7915 14.7134 35.5176 14.5616 35.2835 14.3564C35.0663 14.1782 34.8926 13.9109 34.7623 13.6214C34.632 13.3095 34.5451 12.9309 34.5451 12.4854V7.69681H33.4158V5.60317H34.5668V2.68545H37.2599V5.5809H39.0842V7.69681H37.2599V11.5277C37.2599 11.8173 37.325 12.04 37.4771 12.1959C37.6291 12.3073 37.8245 12.3741 38.0417 12.3741C38.2589 12.3741 38.4761 12.3518 38.6715 12.2627C38.8887 12.1959 39.0842 12.1291 39.2362 12.04L39.7575 14.2673H39.7792ZM44.8612 14.9132C44.1701 14.9255 43.4835 14.7968 42.8414 14.5345C41.7112 14.076 40.8261 13.1439 40.409 11.9732C39.9823 10.8102 39.9823 9.52792 40.409 8.36499C40.8261 7.19423 41.7112 6.26214 42.8414 5.80363C43.4278 5.55863 44.1011 5.42499 44.8612 5.42499C46.1833 5.36117 47.4671 5.88947 48.3795 6.87272C48.7922 7.2959 49.0962 7.80817 49.3134 8.36499C49.758 9.5322 49.758 10.8282 49.3134 11.9954C48.8937 13.1518 48.0186 14.0734 46.9027 14.5345C46.2538 14.7998 45.5596 14.9285 44.8612 14.9132ZM42.9066 10.1914C42.9066 10.9041 43.0803 11.4832 43.4495 11.9064C43.8405 12.3518 44.3183 12.5745 44.8829 12.5745C45.4284 12.5853 45.9487 12.3391 46.2946 11.9064C46.4683 11.6836 46.5987 11.4609 46.7072 11.1491C46.8158 10.8595 46.8593 10.5254 46.8593 10.1914C46.8593 9.45636 46.6638 8.87726 46.2946 8.45408C45.9254 8.00863 45.4476 7.78589 44.8829 7.78589C44.3394 7.78464 43.8229 8.02909 43.4712 8.45408C43.2975 8.67681 43.1455 8.89954 43.0369 9.21136C42.939 9.52794 42.8949 9.85944 42.9066 10.1914ZM56.6541 7.98636C56.0026 7.98636 55.3945 8.09772 54.8515 8.32045C54.3736 8.48572 53.9666 8.81646 53.7005 9.2559V14.7573H50.9857V5.60317H53.4833V7.42954C53.7873 6.8059 54.1783 6.3159 54.6778 5.98181C55.1556 5.62545 55.6551 5.44726 56.1981 5.42499H56.4804L56.6541 5.44726V7.96408V7.98636ZM57.8486 16.1159C58.2263 16.2505 58.6217 16.3256 59.0214 16.3386C59.3472 16.3386 59.6078 16.2273 59.8033 16.0045C59.977 15.7818 60.129 15.3364 60.2811 14.7573L56.893 5.60317H59.6947L61.7579 12.3518L63.5605 5.60317H66.1015L62.6918 16.2273C62.1569 18.0318 60.3638 19.1157 58.5653 18.7218C58.3481 18.6773 58.0875 18.6104 57.8486 18.4991V16.1159ZM72.5301 14.9133C71.8568 14.9133 71.2487 14.7795 70.7492 14.4677C70.2417 14.1818 69.8208 13.758 69.533 13.2427V14.7573H67.1657V2.01727H69.9022V7.09545C70.4962 6.02938 71.6157 5.38681 72.8124 5.42499C73.3771 5.42499 73.8983 5.53636 74.3761 5.80363C74.8539 6.02636 75.2448 6.38272 75.614 6.8059C76.6831 8.32739 76.974 10.2831 76.3959 12.0623C76.1787 12.6414 75.8746 13.1536 75.5054 13.5768C74.7429 14.4342 73.6616 14.9198 72.5301 14.9133ZM71.7699 12.5745C72.6515 12.5764 73.4369 12.0037 73.7245 11.1491C74.043 10.2518 73.887 9.24956 73.3119 8.49863C72.9724 8.0401 72.4398 7.7753 71.8785 7.7859C71.4659 7.7859 71.0749 7.94181 70.7057 8.23136C70.3582 8.54317 70.0759 8.92181 69.8805 9.38954V11.305C70.2309 12.0628 70.9738 12.5476 71.7916 12.5523L71.7699 12.5745ZM78.0247 2.01727H80.7395V11.4832C80.7395 12.1959 81.0218 12.53 81.6082 12.53C81.9183 12.5309 82.2239 12.4545 82.4987 12.3073L82.8679 14.3786C82.1072 14.7203 81.2875 14.902 80.4572 14.9132C79.6753 14.9132 79.0672 14.6904 78.6546 14.2895C78.2202 13.8441 78.003 13.265 78.003 12.4632V2.01727H78.0247ZM87.9933 14.9132C87.3023 14.9255 86.6157 14.7968 85.9736 14.5345C84.8367 14.0789 83.9437 13.1469 83.5194 11.9732C82.8914 10.2226 83.2408 8.26037 84.4316 6.85045C84.8659 6.40499 85.3437 6.0709 85.9518 5.80363C86.5382 5.55863 87.2115 5.42499 87.9716 5.42499C89.2937 5.36117 90.5776 5.88947 91.49 6.87272C91.9243 7.2959 92.2066 7.80817 92.4238 8.36499C93.0767 10.1133 92.7249 12.0889 91.5117 13.4877C91.099 13.9332 90.5995 14.2895 89.9914 14.5345C89.3493 14.7968 88.6627 14.9255 87.9716 14.9132H87.9933ZM86.017 10.1914C86.017 10.9041 86.1907 11.4832 86.5599 11.9064C86.9509 12.3518 87.4287 12.5745 87.9933 12.5745C88.5382 12.5821 89.0571 12.3364 89.405 11.9064C89.5788 11.6836 89.7091 11.4609 89.8177 11.1491C89.9262 10.8595 89.9697 10.5254 89.9697 10.1914C89.9697 9.45636 89.7742 8.87726 89.405 8.45408C89.0358 8.00863 88.558 7.78589 87.9933 7.78589C87.4498 7.78464 86.9334 8.02909 86.5817 8.45408C86.4079 8.67681 86.2559 8.89954 86.1473 9.21136C86.0387 9.52317 86.017 9.83499 86.017 10.1914ZM100.112 14.7573L97.7882 11.06L96.8326 12.0845V14.7573H94.1178V2.01727H96.8326V9.38954L99.8514 5.60317H102.74L99.5256 9.54545L103.001 14.7573H100.112Z" fill="currentColor"></path>
|
|
4
4
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.71089C0 0.76599 0.76599 0 1.71089 0H17.1089C18.0538 0 18.8198 0.76599 18.8198 1.71089V17.1089C18.8198 18.0538 18.0538 18.8198 17.1089 18.8198H7.13145L4.57616 20.9297C4.24445 21.2036 3.74366 20.9676 3.74366 20.5375V18.8198H1.71089C0.76599 18.8198 0 18.0538 0 17.1089V1.71089ZM3.74233 3.10946H11.9675C13.7438 3.10946 15.1839 4.5495 15.1839 6.32587C15.1839 7.74936 14.2592 8.95687 12.9777 9.38045C14.4761 9.65447 15.6117 10.9667 15.6117 12.5443C15.6117 14.3207 14.1717 15.7607 12.3953 15.7607H3.74247V9.54229H3.74233V3.10946ZM10.583 6.00384H6.73607V7.93369H10.583C11.1159 7.93369 11.5479 7.50168 11.5479 6.96877C11.5479 6.43585 11.1159 6.00384 10.583 6.00384ZM6.73607 10.2925H10.9035C11.4956 10.2925 11.9757 10.7725 11.9757 11.3647C11.9757 11.9568 11.4956 12.4368 10.9035 12.4368H6.73607V10.2925Z" fill="currentColor"></path>
|
|
5
5
|
</svg>
|
|
6
6
|
`;
|
|
7
|
-
function
|
|
8
|
-
const
|
|
7
|
+
function Ce(e, t, s) {
|
|
8
|
+
const r = "virtual:storyblok-init", o = `\0${r}`;
|
|
9
9
|
return {
|
|
10
10
|
name: "vite-plugin-storyblok-init",
|
|
11
11
|
async resolveId(n) {
|
|
12
|
-
if (n ===
|
|
12
|
+
if (n === r)
|
|
13
13
|
return o;
|
|
14
14
|
},
|
|
15
15
|
async load(n) {
|
|
@@ -19,54 +19,54 @@ function pe(e, t, r) {
|
|
|
19
19
|
const { storyblokApi } = storyblokInit({
|
|
20
20
|
accessToken: "${e}",
|
|
21
21
|
use: ${t ? "[]" : "[apiPlugin]"},
|
|
22
|
-
apiOptions: ${JSON.stringify(
|
|
22
|
+
apiOptions: ${JSON.stringify(s)},
|
|
23
23
|
});
|
|
24
24
|
export const storyblokApiInstance = storyblokApi;
|
|
25
25
|
`;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const t = "virtual:storyblok-options",
|
|
29
|
+
function ve(e) {
|
|
30
|
+
const t = "virtual:storyblok-options", s = `\0${t}`;
|
|
31
31
|
return {
|
|
32
32
|
name: "vite-plugin-storyblok-options",
|
|
33
|
-
async resolveId(
|
|
34
|
-
if (
|
|
35
|
-
return
|
|
33
|
+
async resolveId(r) {
|
|
34
|
+
if (r === t)
|
|
35
|
+
return s;
|
|
36
36
|
},
|
|
37
|
-
async load(
|
|
38
|
-
if (
|
|
37
|
+
async load(r) {
|
|
38
|
+
if (r === s)
|
|
39
39
|
return `export default ${JSON.stringify(e)}`;
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function dt() {
|
|
44
44
|
if (!(globalThis != null && globalThis.storyblokApiInstance))
|
|
45
45
|
throw new Error("storyblokApiInstance has not been initialized correctly");
|
|
46
46
|
return globalThis.storyblokApiInstance;
|
|
47
47
|
}
|
|
48
|
-
async function
|
|
48
|
+
async function pt(e) {
|
|
49
49
|
let t = null;
|
|
50
50
|
return e && e.locals._storyblok_preview_data && (t = e.locals._storyblok_preview_data), t;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ke(e) {
|
|
53
53
|
return typeof e == "object" ? `const storyblokInstance = new StoryblokBridge(${JSON.stringify(e)});` : "const storyblokInstance = new StoryblokBridge();";
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function we(e) {
|
|
56
56
|
return e.endsWith(".astro") ? e : `${e}.astro`;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function B(e) {
|
|
59
59
|
return `/${e.trim().replace(/^\/+/, "").replace(/\/+$/, "").replace(/\/{2,}/g, "/")}`;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
let o = !1, n = !1,
|
|
61
|
+
const Le = /[\p{Lu}]/u, Ae = /[\p{Ll}]/u, W = /^[\p{Lu}](?![\p{Lu}])/gu, ie = /([\p{Alpha}\p{N}_]|$)/u, q = /[_.\- ]+/, Ee = new RegExp("^" + q.source), Y = new RegExp(q.source + ie.source, "gu"), K = new RegExp("\\d+" + ie.source, "gu"), Re = (e, t, s, r) => {
|
|
62
|
+
let o = !1, n = !1, l = !1, i = !1;
|
|
63
63
|
for (let c = 0; c < e.length; c++) {
|
|
64
64
|
const u = e[c];
|
|
65
|
-
|
|
65
|
+
i = c > 2 ? e[c - 3] === "-" : !0, o && Le.test(u) ? (e = e.slice(0, c) + "-" + e.slice(c), o = !1, l = n, n = !0, c++) : n && l && Ae.test(u) && (!i || r) ? (e = e.slice(0, c - 1) + "-" + e.slice(c - 1), l = n, n = !1, o = !0) : (o = t(u) === u && s(u) !== u, l = n, n = s(u) === u && t(u) !== u);
|
|
66
66
|
}
|
|
67
67
|
return e;
|
|
68
|
-
},
|
|
69
|
-
function
|
|
68
|
+
}, _e = (e, t) => (W.lastIndex = 0, e.replaceAll(W, (s) => t(s))), Te = (e, t) => (Y.lastIndex = 0, K.lastIndex = 0, e.replaceAll(K, (s, r, o) => ["_", "-"].includes(e.charAt(o + s.length)) ? s : t(s)).replaceAll(Y, (s, r) => t(r)));
|
|
69
|
+
function $e(e, t) {
|
|
70
70
|
if (!(typeof e == "string" || Array.isArray(e)))
|
|
71
71
|
throw new TypeError("Expected the input to be `string | string[]`");
|
|
72
72
|
if (t = {
|
|
@@ -75,55 +75,55 @@ function Ae(e, t) {
|
|
|
75
75
|
...t
|
|
76
76
|
}, Array.isArray(e) ? e = e.map((n) => n.trim()).filter((n) => n.length).join("-") : e = e.trim(), e.length === 0)
|
|
77
77
|
return "";
|
|
78
|
-
const
|
|
79
|
-
return e.length === 1 ?
|
|
78
|
+
const s = t.locale === !1 ? (n) => n.toLowerCase() : (n) => n.toLocaleLowerCase(t.locale), r = t.locale === !1 ? (n) => n.toUpperCase() : (n) => n.toLocaleUpperCase(t.locale);
|
|
79
|
+
return e.length === 1 ? q.test(e) ? "" : t.pascalCase ? r(e) : s(e) : (e !== s(e) && (e = Re(e, s, r, t.preserveConsecutiveUppercase)), e = e.replace(Ee, ""), e = t.preserveConsecutiveUppercase ? _e(e, s) : s(e), t.pascalCase && (e = r(e.charAt(0)) + e.slice(1)), Te(e, r));
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
81
|
+
function Se(e) {
|
|
82
|
+
return $e(e);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function Ie(e, t, s, r) {
|
|
85
85
|
const o = "virtual:import-storyblok-components", n = `\0${o}`;
|
|
86
86
|
return {
|
|
87
87
|
name: "vite-plugin-import-storyblok-components",
|
|
88
88
|
/**
|
|
89
89
|
* Resolves virtual module imports
|
|
90
90
|
*/
|
|
91
|
-
async resolveId(
|
|
92
|
-
if (
|
|
91
|
+
async resolveId(l) {
|
|
92
|
+
if (l === o)
|
|
93
93
|
return n;
|
|
94
94
|
},
|
|
95
95
|
/**
|
|
96
96
|
* Generates the virtual module content with dynamic imports
|
|
97
97
|
*/
|
|
98
|
-
async load(
|
|
99
|
-
if (
|
|
98
|
+
async load(l) {
|
|
99
|
+
if (l !== n)
|
|
100
100
|
return;
|
|
101
|
-
const
|
|
101
|
+
const i = await xe(
|
|
102
102
|
this,
|
|
103
103
|
t,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
), c = await
|
|
104
|
+
s,
|
|
105
|
+
r
|
|
106
|
+
), c = await Me(
|
|
107
107
|
this,
|
|
108
108
|
e,
|
|
109
109
|
t,
|
|
110
|
-
|
|
110
|
+
s
|
|
111
111
|
);
|
|
112
|
-
return
|
|
112
|
+
return Oe(
|
|
113
113
|
t,
|
|
114
|
-
|
|
114
|
+
i,
|
|
115
115
|
c
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
const o = `${
|
|
120
|
+
function Oe(e, t, s) {
|
|
121
|
+
const o = `${B(e)}/storyblok/**/*.astro`;
|
|
122
122
|
return `
|
|
123
123
|
// Import utilities and fallback component
|
|
124
124
|
import { toCamelCase } from '@storyblok/astro';
|
|
125
125
|
${t}
|
|
126
|
-
${
|
|
126
|
+
${s.join(`
|
|
127
127
|
`)}
|
|
128
128
|
|
|
129
129
|
// Dynamically import all Storyblok components using Vite's glob import
|
|
@@ -147,10 +147,10 @@ function Ee(e, t, r) {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
// Manual imports (overwrite auto if same key exists)
|
|
150
|
-
${
|
|
151
|
-
var
|
|
152
|
-
const
|
|
153
|
-
return `storyblokComponents['${
|
|
150
|
+
${s.map((n) => {
|
|
151
|
+
var i;
|
|
152
|
+
const l = (i = n.match(/import\s+(\w+)\s+from/)) == null ? void 0 : i[1];
|
|
153
|
+
return `storyblokComponents['${l}'] = ${l};`;
|
|
154
154
|
}).join(`
|
|
155
155
|
`)}
|
|
156
156
|
|
|
@@ -161,13 +161,13 @@ function Ee(e, t, r) {
|
|
|
161
161
|
export { storyblokComponents };
|
|
162
162
|
`.trim();
|
|
163
163
|
}
|
|
164
|
-
async function
|
|
165
|
-
if (!
|
|
164
|
+
async function xe(e, t, s, r) {
|
|
165
|
+
if (!s)
|
|
166
166
|
return "";
|
|
167
|
-
if (
|
|
168
|
-
const o =
|
|
167
|
+
if (r) {
|
|
168
|
+
const o = ae(
|
|
169
169
|
t,
|
|
170
|
-
|
|
170
|
+
r
|
|
171
171
|
);
|
|
172
172
|
if (!await e.resolve(o))
|
|
173
173
|
throw new Error(
|
|
@@ -177,24 +177,24 @@ async function Le(e, t, r, s) {
|
|
|
177
177
|
}
|
|
178
178
|
return "import FallbackComponent from '@storyblok/astro/FallbackComponent.astro';";
|
|
179
179
|
}
|
|
180
|
-
async function
|
|
180
|
+
async function Me(e, t, s, r) {
|
|
181
181
|
const o = [];
|
|
182
|
-
for await (const [n,
|
|
183
|
-
const
|
|
182
|
+
for await (const [n, l] of Object.entries(t)) {
|
|
183
|
+
const i = ae(s, l), c = await e.resolve(i);
|
|
184
184
|
if (c)
|
|
185
|
-
o.push(`import ${
|
|
186
|
-
else if (!
|
|
185
|
+
o.push(`import ${Se(n)} from "${c.id}"`);
|
|
186
|
+
else if (!r)
|
|
187
187
|
throw new Error(
|
|
188
|
-
`Component could not be found for blok "${n}"! Does "${
|
|
188
|
+
`Component could not be found for blok "${n}"! Does "${i}" exist?`
|
|
189
189
|
);
|
|
190
190
|
}
|
|
191
191
|
return o;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const
|
|
195
|
-
return
|
|
193
|
+
function ae(e, t) {
|
|
194
|
+
const r = `${B(e)}${B(t)}`;
|
|
195
|
+
return we(r);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function ft(e) {
|
|
198
198
|
const t = {
|
|
199
199
|
useCustomApi: !1,
|
|
200
200
|
bridge: !0,
|
|
@@ -203,55 +203,55 @@ function rt(e) {
|
|
|
203
203
|
livePreview: !1,
|
|
204
204
|
...e
|
|
205
205
|
}, {
|
|
206
|
-
accessToken:
|
|
207
|
-
useCustomApi:
|
|
206
|
+
accessToken: s,
|
|
207
|
+
useCustomApi: r,
|
|
208
208
|
apiOptions: o,
|
|
209
209
|
componentsDir: n,
|
|
210
|
-
customFallbackComponent:
|
|
211
|
-
enableFallbackComponent:
|
|
210
|
+
customFallbackComponent: l,
|
|
211
|
+
enableFallbackComponent: i,
|
|
212
212
|
components: c,
|
|
213
213
|
bridge: u,
|
|
214
|
-
livePreview:
|
|
215
|
-
} = t,
|
|
214
|
+
livePreview: d
|
|
215
|
+
} = t, p = ke(t.bridge);
|
|
216
216
|
return {
|
|
217
217
|
name: "@storyblok/astro",
|
|
218
218
|
hooks: {
|
|
219
219
|
"astro:config:setup": ({
|
|
220
|
-
injectScript:
|
|
220
|
+
injectScript: L,
|
|
221
221
|
updateConfig: _,
|
|
222
|
-
addDevToolbarApp:
|
|
223
|
-
addMiddleware:
|
|
224
|
-
config:
|
|
222
|
+
addDevToolbarApp: v,
|
|
223
|
+
addMiddleware: T,
|
|
224
|
+
config: $
|
|
225
225
|
}) => {
|
|
226
226
|
if (_({
|
|
227
227
|
vite: {
|
|
228
228
|
plugins: [
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
Ce(s, r, o),
|
|
230
|
+
Ie(
|
|
231
231
|
c || {},
|
|
232
232
|
n,
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
i,
|
|
234
|
+
l
|
|
235
235
|
),
|
|
236
|
-
|
|
236
|
+
ve(t)
|
|
237
237
|
]
|
|
238
238
|
}
|
|
239
|
-
}),
|
|
239
|
+
}), d && ($ == null ? void 0 : $.output) !== "server")
|
|
240
240
|
throw new Error(
|
|
241
241
|
"To utilize the Astro Storyblok Live feature, Astro must be configured to run in SSR mode. Please disable this feature or switch Astro to SSR mode."
|
|
242
242
|
);
|
|
243
|
-
|
|
243
|
+
L(
|
|
244
244
|
"page-ssr",
|
|
245
245
|
`
|
|
246
246
|
import { storyblokApiInstance } from "virtual:storyblok-init";
|
|
247
247
|
globalThis.storyblokApiInstance = storyblokApiInstance;
|
|
248
248
|
`
|
|
249
|
-
), u && !
|
|
249
|
+
), u && !d && L(
|
|
250
250
|
"page",
|
|
251
251
|
`import { loadStoryblokBridge } from "@storyblok/astro";
|
|
252
252
|
loadStoryblokBridge().then(() => {
|
|
253
253
|
const { StoryblokBridge, location } = window;
|
|
254
|
-
${
|
|
254
|
+
${p}
|
|
255
255
|
storyblokInstance.on(["published", "change"], (event) => {
|
|
256
256
|
if (!event.slugChanged) {
|
|
257
257
|
location.reload(true);
|
|
@@ -259,55 +259,55 @@ function rt(e) {
|
|
|
259
259
|
});
|
|
260
260
|
});
|
|
261
261
|
`
|
|
262
|
-
),
|
|
262
|
+
), d && (L(
|
|
263
263
|
"page",
|
|
264
264
|
`import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
|
|
265
265
|
loadStoryblokBridge().then(() => {
|
|
266
266
|
const { StoryblokBridge, location } = window;
|
|
267
|
-
${
|
|
267
|
+
${p}
|
|
268
268
|
storyblokInstance.on(["published", "change", "input"], handleStoryblokMessage);
|
|
269
269
|
});
|
|
270
270
|
`
|
|
271
|
-
),
|
|
271
|
+
), T({
|
|
272
272
|
entrypoint: "@storyblok/astro/middleware.ts",
|
|
273
273
|
order: "pre"
|
|
274
|
-
})),
|
|
274
|
+
})), v({
|
|
275
275
|
id: "storyblok",
|
|
276
276
|
name: "Storyblok",
|
|
277
|
-
icon:
|
|
277
|
+
icon: be,
|
|
278
278
|
entrypoint: "@storyblok/astro/toolbarApp.ts"
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
|
-
let
|
|
285
|
-
async function
|
|
286
|
-
const { action: t, story:
|
|
287
|
-
if (t === "input" &&
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
const n = await
|
|
291
|
-
if (n.outerHTML ===
|
|
284
|
+
let X;
|
|
285
|
+
async function mt(e) {
|
|
286
|
+
const { action: t, story: s } = e || {};
|
|
287
|
+
if (t === "input" && s) {
|
|
288
|
+
const r = async () => {
|
|
289
|
+
Q("storyblok-live-preview-updating", { story: s });
|
|
290
|
+
const n = await He(s), l = document.body;
|
|
291
|
+
if (n.outerHTML === l.outerHTML)
|
|
292
292
|
return;
|
|
293
|
-
const
|
|
294
|
-
|
|
293
|
+
const i = document.querySelector('[data-blok-focused="true"]');
|
|
294
|
+
Pe(l, n, i), Q("storyblok-live-preview-updated", { story: s });
|
|
295
295
|
};
|
|
296
|
-
clearTimeout(
|
|
296
|
+
clearTimeout(X), X = setTimeout(r, 500);
|
|
297
297
|
}
|
|
298
298
|
["published", "change"].includes(e == null ? void 0 : e.action) && location.reload();
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
if (
|
|
302
|
-
const
|
|
303
|
-
`[data-blok-uid="${
|
|
300
|
+
function Pe(e, t, s) {
|
|
301
|
+
if (s) {
|
|
302
|
+
const r = s.getAttribute("data-blok-uid"), o = t.querySelector(
|
|
303
|
+
`[data-blok-uid="${r}"]`
|
|
304
304
|
);
|
|
305
|
-
o && (o.setAttribute("data-blok-focused", "true"),
|
|
305
|
+
o && (o.setAttribute("data-blok-focused", "true"), s.replaceWith(o));
|
|
306
306
|
} else
|
|
307
307
|
e.replaceWith(t);
|
|
308
308
|
}
|
|
309
|
-
async function
|
|
310
|
-
const
|
|
309
|
+
async function He(e) {
|
|
310
|
+
const s = await (await fetch(location.href, {
|
|
311
311
|
method: "POST",
|
|
312
312
|
body: JSON.stringify({
|
|
313
313
|
...e,
|
|
@@ -317,22 +317,22 @@ async function Ie(e) {
|
|
|
317
317
|
"Content-Type": "application/json"
|
|
318
318
|
}
|
|
319
319
|
})).text();
|
|
320
|
-
return new DOMParser().parseFromString(
|
|
320
|
+
return new DOMParser().parseFromString(s, "text/html").body;
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function Q(e, t) {
|
|
323
323
|
document.dispatchEvent(new CustomEvent(e, { detail: t }));
|
|
324
324
|
}
|
|
325
|
-
var
|
|
326
|
-
let
|
|
325
|
+
var Ne = Object.defineProperty, je = (e, t, s) => t in e ? Ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, g = (e, t, s) => je(e, typeof t != "symbol" ? t + "" : t, s);
|
|
326
|
+
let k = /* @__PURE__ */ function(e) {
|
|
327
327
|
return e.DOCUMENT = "doc", e.HEADING = "heading", e.PARAGRAPH = "paragraph", e.QUOTE = "blockquote", e.OL_LIST = "ordered_list", e.UL_LIST = "bullet_list", e.LIST_ITEM = "list_item", e.CODE_BLOCK = "code_block", e.HR = "horizontal_rule", e.BR = "hard_break", e.IMAGE = "image", e.EMOJI = "emoji", e.COMPONENT = "blok", e.TABLE = "table", e.TABLE_ROW = "tableRow", e.TABLE_CELL = "tableCell", e.TABLE_HEADER = "tableHeader", e;
|
|
328
|
-
}({}),
|
|
328
|
+
}({}), A = /* @__PURE__ */ function(e) {
|
|
329
329
|
return e.BOLD = "bold", e.STRONG = "strong", e.STRIKE = "strike", e.UNDERLINE = "underline", e.ITALIC = "italic", e.CODE = "code", e.LINK = "link", e.ANCHOR = "anchor", e.STYLED = "styled", e.SUPERSCRIPT = "superscript", e.SUBSCRIPT = "subscript", e.TEXT_STYLE = "textStyle", e.HIGHLIGHT = "highlight", e;
|
|
330
|
-
}({}),
|
|
330
|
+
}({}), De = /* @__PURE__ */ function(e) {
|
|
331
331
|
return e.TEXT = "text", e;
|
|
332
|
-
}({}),
|
|
332
|
+
}({}), M = /* @__PURE__ */ function(e) {
|
|
333
333
|
return e.URL = "url", e.STORY = "story", e.ASSET = "asset", e.EMAIL = "email", e;
|
|
334
334
|
}({});
|
|
335
|
-
const
|
|
335
|
+
const Ue = [
|
|
336
336
|
"area",
|
|
337
337
|
"base",
|
|
338
338
|
"br",
|
|
@@ -347,101 +347,101 @@ const xe = [
|
|
|
347
347
|
"source",
|
|
348
348
|
"track",
|
|
349
349
|
"wbr"
|
|
350
|
-
],
|
|
351
|
-
const { custom: t, ...
|
|
352
|
-
...
|
|
350
|
+
], Ve = (e = {}) => {
|
|
351
|
+
const { custom: t, ...s } = e, r = {
|
|
352
|
+
...s,
|
|
353
353
|
...t
|
|
354
354
|
};
|
|
355
|
-
return Object.keys(
|
|
356
|
-
},
|
|
357
|
-
function
|
|
355
|
+
return Object.keys(r).map((o) => `${o}="${r[o]}"`).join(" ");
|
|
356
|
+
}, Be = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
|
|
357
|
+
function Fe(e) {
|
|
358
358
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
359
359
|
}
|
|
360
|
-
const
|
|
361
|
-
function
|
|
360
|
+
const I = (e) => Object.fromEntries(Object.entries(e).filter(([t, s]) => s !== void 0));
|
|
361
|
+
function qe(e, t) {
|
|
362
362
|
if (!t) return {
|
|
363
363
|
src: e,
|
|
364
364
|
attrs: {}
|
|
365
365
|
};
|
|
366
|
-
let
|
|
366
|
+
let s = 0, r = 0;
|
|
367
367
|
const o = {}, n = [];
|
|
368
|
-
function
|
|
369
|
-
typeof c != "number" || c <= u || c >=
|
|
368
|
+
function l(c, u, d, p, L) {
|
|
369
|
+
typeof c != "number" || c <= u || c >= d ? console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase() + p.slice(1)} value must be a number between ${u} and ${d} (inclusive)`) : L.push(`${p}(${c})`);
|
|
370
370
|
}
|
|
371
371
|
if (typeof t == "object") {
|
|
372
|
-
if (t.width !== void 0 && (typeof t.width == "number" && t.width >= 0 ? (o.width = t.width,
|
|
373
|
-
const { filters: c } = t || {}, { blur: u, brightness:
|
|
374
|
-
u &&
|
|
372
|
+
if (t.width !== void 0 && (typeof t.width == "number" && t.width >= 0 ? (o.width = t.width, s = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than or equal to 0")), t.height !== void 0 && (typeof t.height == "number" && t.height >= 0 ? (o.height = t.height, r = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than or equal to 0")), t.height === 0 && t.width === 0 && (delete o.width, delete o.height, console.warn("[StoryblokRichText] - Width and height values cannot both be 0")), t.loading && ["lazy", "eager"].includes(t.loading) && (o.loading = t.loading), t.class && (o.class = t.class), t.filters) {
|
|
373
|
+
const { filters: c } = t || {}, { blur: u, brightness: d, fill: p, format: L, grayscale: _, quality: v, rotate: T } = c || {};
|
|
374
|
+
u && l(u, 0, 100, "blur", n), v && l(v, 0, 100, "quality", n), d && l(d, 0, 100, "brightness", n), p && n.push(`fill(${p})`), _ && n.push("grayscale()"), T && [
|
|
375
375
|
0,
|
|
376
376
|
90,
|
|
377
377
|
180,
|
|
378
378
|
270
|
|
379
|
-
].includes(t.filters.rotate || 0) && n.push(`rotate(${
|
|
379
|
+
].includes(t.filters.rotate || 0) && n.push(`rotate(${T})`), L && [
|
|
380
380
|
"webp",
|
|
381
381
|
"png",
|
|
382
382
|
"jpeg"
|
|
383
|
-
].includes(
|
|
383
|
+
].includes(L) && n.push(`format(${L})`);
|
|
384
384
|
}
|
|
385
385
|
t.srcset && (o.srcset = t.srcset.map((c) => {
|
|
386
386
|
if (typeof c == "number") return `${e}/m/${c}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${c}w`;
|
|
387
387
|
if (Array.isArray(c) && c.length === 2) {
|
|
388
|
-
const [u,
|
|
389
|
-
return `${e}/m/${u}x${
|
|
388
|
+
const [u, d] = c;
|
|
389
|
+
return `${e}/m/${u}x${d}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${u}w`;
|
|
390
390
|
} else {
|
|
391
391
|
console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
|
|
392
392
|
return;
|
|
393
393
|
}
|
|
394
394
|
}).join(", ")), t.sizes && (o.sizes = t.sizes.join(", "));
|
|
395
395
|
}
|
|
396
|
-
let
|
|
397
|
-
return (
|
|
398
|
-
src:
|
|
396
|
+
let i = `${e}/m/`;
|
|
397
|
+
return (s > 0 || r > 0) && (i = `${i}${s}x${r}/`), n.length > 0 && (i = `${i}filters:${n.join(":")}`), {
|
|
398
|
+
src: i,
|
|
399
399
|
attrs: o
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
const
|
|
402
|
+
function ee(e, t = {}, s) {
|
|
403
|
+
const r = Ve(t), o = r ? `${e} ${r}` : e, n = Array.isArray(s) ? s.join("") : s || "";
|
|
404
404
|
if (e) {
|
|
405
|
-
if (
|
|
405
|
+
if (Ue.includes(e)) return `<${o}>`;
|
|
406
406
|
} else return n;
|
|
407
407
|
return `<${o}>${n}</${e}>`;
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
const t = /* @__PURE__ */ new Map(), { renderFn:
|
|
411
|
-
const { textAlign: h, class:
|
|
412
|
-
return y && b.push(y.endsWith(";") ? y : `${y};`), h && b.push(`text-align: ${h};`),
|
|
409
|
+
function Ge(e = {}) {
|
|
410
|
+
const t = /* @__PURE__ */ new Map(), { renderFn: s = ee, textFn: r = Fe, resolvers: o = {}, optimizeImages: n = !1, keyedResolvers: l = !1 } = e, i = s !== ee, c = (a = {}) => {
|
|
411
|
+
const { textAlign: h, class: f, id: m, style: y, ...C } = a, b = [];
|
|
412
|
+
return y && b.push(y.endsWith(";") ? y : `${y};`), h && b.push(`text-align: ${h};`), I({
|
|
413
413
|
...C,
|
|
414
|
-
class:
|
|
415
|
-
id:
|
|
414
|
+
class: f,
|
|
415
|
+
id: m,
|
|
416
416
|
...b.length > 0 ? { style: b.join(" ") } : {}
|
|
417
417
|
});
|
|
418
|
-
}, u = (a) => (h,
|
|
419
|
-
const
|
|
420
|
-
return
|
|
421
|
-
},
|
|
422
|
-
const { src:
|
|
423
|
-
let
|
|
418
|
+
}, u = (a) => (h, f) => {
|
|
419
|
+
const m = c(h.attrs);
|
|
420
|
+
return f.render(a, m, h.children || null);
|
|
421
|
+
}, d = (a, h) => {
|
|
422
|
+
const { src: f, alt: m, title: y, srcset: C, sizes: b } = a.attrs || {};
|
|
423
|
+
let E = f, w = {};
|
|
424
424
|
if (n) {
|
|
425
|
-
const { src:
|
|
426
|
-
|
|
425
|
+
const { src: ye, attrs: ge } = qe(f, n);
|
|
426
|
+
E = ye, w = ge;
|
|
427
427
|
}
|
|
428
|
-
const
|
|
429
|
-
src:
|
|
430
|
-
alt:
|
|
428
|
+
const S = {
|
|
429
|
+
src: E,
|
|
430
|
+
alt: m,
|
|
431
431
|
title: y,
|
|
432
432
|
srcset: C,
|
|
433
433
|
sizes: b,
|
|
434
|
-
...
|
|
434
|
+
...w
|
|
435
435
|
};
|
|
436
|
-
return h.render("img",
|
|
437
|
-
},
|
|
438
|
-
const { level:
|
|
439
|
-
return h.render(`h${
|
|
440
|
-
},
|
|
441
|
-
var
|
|
436
|
+
return h.render("img", I(S));
|
|
437
|
+
}, p = (a, h) => {
|
|
438
|
+
const { level: f, ...m } = a.attrs || {}, y = c(m);
|
|
439
|
+
return h.render(`h${f}`, y, a.children);
|
|
440
|
+
}, L = (a, h) => {
|
|
441
|
+
var f, m, y, C;
|
|
442
442
|
const b = h.render("img", {
|
|
443
|
-
src: (
|
|
444
|
-
alt: (
|
|
443
|
+
src: (f = a.attrs) == null ? void 0 : f.fallbackImage,
|
|
444
|
+
alt: (m = a.attrs) == null ? void 0 : m.alt,
|
|
445
445
|
style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
|
|
446
446
|
draggable: "false",
|
|
447
447
|
loading: "lazy"
|
|
@@ -451,147 +451,147 @@ function De(e = {}) {
|
|
|
451
451
|
"data-name": (y = a.attrs) == null ? void 0 : y.name,
|
|
452
452
|
"data-emoji": (C = a.attrs) == null ? void 0 : C.emoji
|
|
453
453
|
}, b);
|
|
454
|
-
}, _ = (a, h) => h.render("pre", a.attrs || {}, h.render("code", {}, a.children || "")),
|
|
455
|
-
const { class: C, id: b, ...
|
|
454
|
+
}, _ = (a, h) => h.render("pre", a.attrs || {}, h.render("code", {}, a.children || "")), v = (a, h = !1) => ({ text: f, attrs: m }, y) => {
|
|
455
|
+
const { class: C, id: b, ...E } = m || {}, w = h ? {
|
|
456
456
|
class: C,
|
|
457
457
|
id: b,
|
|
458
|
-
style:
|
|
459
|
-
} :
|
|
460
|
-
return y.render(a,
|
|
461
|
-
},
|
|
462
|
-
const { marks: h, ...
|
|
458
|
+
style: Be(E) || void 0
|
|
459
|
+
} : m || {};
|
|
460
|
+
return y.render(a, I(w), f);
|
|
461
|
+
}, T = (a) => N(a), $ = (a) => {
|
|
462
|
+
const { marks: h, ...f } = a;
|
|
463
463
|
if ("text" in a) {
|
|
464
|
-
if (h) return h.reduce((y, C) =>
|
|
464
|
+
if (h) return h.reduce((y, C) => T({
|
|
465
465
|
...C,
|
|
466
466
|
text: y
|
|
467
|
-
}),
|
|
468
|
-
...
|
|
469
|
-
children:
|
|
467
|
+
}), T({
|
|
468
|
+
...f,
|
|
469
|
+
children: f.children
|
|
470
470
|
}));
|
|
471
|
-
const
|
|
472
|
-
if (
|
|
471
|
+
const m = a.attrs || {};
|
|
472
|
+
if (l) {
|
|
473
473
|
const y = t.get("txt") || 0;
|
|
474
|
-
t.set("txt", y + 1),
|
|
474
|
+
t.set("txt", y + 1), m.key = `txt-${y}`;
|
|
475
475
|
}
|
|
476
|
-
return
|
|
476
|
+
return r(f.text, m);
|
|
477
477
|
}
|
|
478
478
|
return "";
|
|
479
|
-
},
|
|
480
|
-
const { linktype:
|
|
479
|
+
}, z = (a, h) => {
|
|
480
|
+
const { linktype: f, href: m, anchor: y, ...C } = a.attrs || {};
|
|
481
481
|
let b = "";
|
|
482
|
-
switch (
|
|
483
|
-
case
|
|
484
|
-
case
|
|
485
|
-
b =
|
|
482
|
+
switch (f) {
|
|
483
|
+
case M.ASSET:
|
|
484
|
+
case M.URL:
|
|
485
|
+
b = m;
|
|
486
486
|
break;
|
|
487
|
-
case
|
|
488
|
-
b = `mailto:${
|
|
487
|
+
case M.EMAIL:
|
|
488
|
+
b = `mailto:${m}`;
|
|
489
489
|
break;
|
|
490
|
-
case
|
|
491
|
-
b =
|
|
490
|
+
case M.STORY:
|
|
491
|
+
b = m, y && (b = `${b}#${y}`);
|
|
492
492
|
break;
|
|
493
493
|
default:
|
|
494
|
-
b =
|
|
494
|
+
b = m;
|
|
495
495
|
break;
|
|
496
496
|
}
|
|
497
|
-
const
|
|
498
|
-
return b && (
|
|
499
|
-
},
|
|
500
|
-
var
|
|
497
|
+
const E = { ...C };
|
|
498
|
+
return b && (E.href = b), h.render("a", E, a.text);
|
|
499
|
+
}, ue = (a, h) => {
|
|
500
|
+
var f, m;
|
|
501
501
|
return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), h.render("span", {
|
|
502
|
-
blok: (
|
|
503
|
-
id: (
|
|
502
|
+
blok: (f = a == null ? void 0 : a.attrs) == null ? void 0 : f.body[0],
|
|
503
|
+
id: (m = a.attrs) == null ? void 0 : m.id,
|
|
504
504
|
style: "display: none"
|
|
505
505
|
});
|
|
506
|
-
},
|
|
507
|
-
const
|
|
508
|
-
return h.render("table",
|
|
509
|
-
},
|
|
510
|
-
const
|
|
511
|
-
return h.render("tr",
|
|
512
|
-
},
|
|
513
|
-
const { colspan:
|
|
514
|
-
y &&
|
|
515
|
-
const
|
|
516
|
-
...
|
|
517
|
-
...
|
|
518
|
-
...
|
|
519
|
-
...
|
|
506
|
+
}, he = (a, h) => {
|
|
507
|
+
const f = c(a.attrs), m = a.children || null;
|
|
508
|
+
return h.render("table", f, h.render("tbody", {}, m));
|
|
509
|
+
}, de = (a, h) => {
|
|
510
|
+
const f = c(a.attrs);
|
|
511
|
+
return h.render("tr", f, a.children);
|
|
512
|
+
}, pe = (a, h) => {
|
|
513
|
+
const { colspan: f, rowspan: m, colwidth: y, backgroundColor: C, textAlign: b, ...E } = a.attrs || {}, w = [];
|
|
514
|
+
y && w.push(`width: ${y}px;`), C && w.push(`background-color: ${C};`), b && w.push(`text-align: ${b};`);
|
|
515
|
+
const S = {
|
|
516
|
+
...E,
|
|
517
|
+
...f > 1 ? { colspan: f } : {},
|
|
518
|
+
...m > 1 ? { rowspan: m } : {},
|
|
519
|
+
...w.length > 0 ? { style: w.join(" ") } : {}
|
|
520
520
|
};
|
|
521
|
-
return h.render("td",
|
|
522
|
-
},
|
|
523
|
-
const { colspan:
|
|
524
|
-
y &&
|
|
525
|
-
const
|
|
526
|
-
...
|
|
527
|
-
...
|
|
528
|
-
...
|
|
529
|
-
...
|
|
521
|
+
return h.render("td", I(S), a.children);
|
|
522
|
+
}, fe = (a, h) => {
|
|
523
|
+
const { colspan: f, rowspan: m, colwidth: y, backgroundColor: C, textAlign: b, ...E } = a.attrs || {}, w = [];
|
|
524
|
+
y && w.push(`width: ${y}px;`), C && w.push(`background-color: ${C};`), b && w.push(`text-align: ${b};`);
|
|
525
|
+
const S = {
|
|
526
|
+
...E,
|
|
527
|
+
...f > 1 ? { colspan: f } : {},
|
|
528
|
+
...m > 1 ? { rowspan: m } : {},
|
|
529
|
+
...w.length > 0 ? { style: w.join(" ") } : {}
|
|
530
530
|
};
|
|
531
|
-
return h.render("th",
|
|
532
|
-
},
|
|
533
|
-
[
|
|
534
|
-
[
|
|
535
|
-
[
|
|
536
|
-
[
|
|
537
|
-
[
|
|
538
|
-
[
|
|
539
|
-
[
|
|
540
|
-
[
|
|
541
|
-
[
|
|
542
|
-
[
|
|
543
|
-
[
|
|
544
|
-
[
|
|
545
|
-
[
|
|
546
|
-
[
|
|
547
|
-
[
|
|
548
|
-
[
|
|
549
|
-
[
|
|
550
|
-
[
|
|
551
|
-
[
|
|
552
|
-
[
|
|
553
|
-
[
|
|
554
|
-
[
|
|
555
|
-
[
|
|
556
|
-
[
|
|
557
|
-
[
|
|
558
|
-
[
|
|
559
|
-
[
|
|
560
|
-
[
|
|
561
|
-
[
|
|
562
|
-
[
|
|
563
|
-
]),
|
|
564
|
-
render: (a, h = {},
|
|
565
|
-
if (
|
|
566
|
-
const
|
|
567
|
-
t.set(a,
|
|
531
|
+
return h.render("th", I(S), a.children);
|
|
532
|
+
}, Z = /* @__PURE__ */ new Map([
|
|
533
|
+
[k.DOCUMENT, u("")],
|
|
534
|
+
[k.HEADING, p],
|
|
535
|
+
[k.PARAGRAPH, u("p")],
|
|
536
|
+
[k.UL_LIST, u("ul")],
|
|
537
|
+
[k.OL_LIST, u("ol")],
|
|
538
|
+
[k.LIST_ITEM, u("li")],
|
|
539
|
+
[k.IMAGE, d],
|
|
540
|
+
[k.EMOJI, L],
|
|
541
|
+
[k.CODE_BLOCK, _],
|
|
542
|
+
[k.HR, u("hr")],
|
|
543
|
+
[k.BR, u("br")],
|
|
544
|
+
[k.QUOTE, u("blockquote")],
|
|
545
|
+
[k.COMPONENT, ue],
|
|
546
|
+
[De.TEXT, $],
|
|
547
|
+
[A.LINK, z],
|
|
548
|
+
[A.ANCHOR, z],
|
|
549
|
+
[A.STYLED, v("span", !0)],
|
|
550
|
+
[A.BOLD, v("strong")],
|
|
551
|
+
[A.TEXT_STYLE, v("span", !0)],
|
|
552
|
+
[A.ITALIC, v("em")],
|
|
553
|
+
[A.UNDERLINE, v("u")],
|
|
554
|
+
[A.STRIKE, v("s")],
|
|
555
|
+
[A.CODE, v("code")],
|
|
556
|
+
[A.SUPERSCRIPT, v("sup")],
|
|
557
|
+
[A.SUBSCRIPT, v("sub")],
|
|
558
|
+
[A.HIGHLIGHT, v("mark")],
|
|
559
|
+
[k.TABLE, he],
|
|
560
|
+
[k.TABLE_ROW, de],
|
|
561
|
+
[k.TABLE_CELL, pe],
|
|
562
|
+
[k.TABLE_HEADER, fe]
|
|
563
|
+
]), J = new Map([...Z, ...Object.entries(o).map(([a, h]) => [a, h])]), me = () => ({
|
|
564
|
+
render: (a, h = {}, f) => {
|
|
565
|
+
if (l && a) {
|
|
566
|
+
const m = t.get(a) || 0;
|
|
567
|
+
t.set(a, m + 1), h.key = `${a}-${m}`;
|
|
568
568
|
}
|
|
569
|
-
return
|
|
569
|
+
return s(a, h, f);
|
|
570
570
|
},
|
|
571
|
-
originalResolvers:
|
|
572
|
-
mergedResolvers:
|
|
571
|
+
originalResolvers: Z,
|
|
572
|
+
mergedResolvers: J
|
|
573
573
|
});
|
|
574
|
-
function
|
|
575
|
-
const h =
|
|
574
|
+
function x(a) {
|
|
575
|
+
const h = J.get(a.type);
|
|
576
576
|
if (!h)
|
|
577
577
|
return console.error("<Storyblok>", `No resolver found for node type ${a.type}`), "";
|
|
578
|
-
const
|
|
579
|
-
if (a.type === "text") return h(a,
|
|
580
|
-
const
|
|
578
|
+
const f = me();
|
|
579
|
+
if (a.type === "text") return h(a, f);
|
|
580
|
+
const m = a.content ? a.content.map(N) : void 0;
|
|
581
581
|
return h({
|
|
582
582
|
...a,
|
|
583
|
-
children:
|
|
584
|
-
},
|
|
583
|
+
children: m
|
|
584
|
+
}, f);
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
return a.type === "doc" ?
|
|
586
|
+
function N(a) {
|
|
587
|
+
return a.type === "doc" ? i ? a.content.map(x) : a.content.map(x).join("") : Array.isArray(a) ? a.map(x) : x(a);
|
|
588
588
|
}
|
|
589
|
-
return { render:
|
|
589
|
+
return { render: N };
|
|
590
590
|
}
|
|
591
|
-
let
|
|
592
|
-
const
|
|
591
|
+
let te = !1;
|
|
592
|
+
const se = [], le = (e) => new Promise((t, s) => {
|
|
593
593
|
if (typeof window > "u") {
|
|
594
|
-
|
|
594
|
+
s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
|
|
595
595
|
return;
|
|
596
596
|
}
|
|
597
597
|
if (window.storyblokRegisterEvent = (o) => {
|
|
@@ -599,70 +599,34 @@ const K = [], se = (e) => new Promise((t, r) => {
|
|
|
599
599
|
console.warn("You are not in Draft Mode or in the Visual Editor.");
|
|
600
600
|
return;
|
|
601
601
|
}
|
|
602
|
-
|
|
602
|
+
te ? o() : se.push(o);
|
|
603
603
|
}, document.getElementById("storyblok-javascript-bridge")) {
|
|
604
604
|
t(void 0);
|
|
605
605
|
return;
|
|
606
606
|
}
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
}, document.getElementsByTagName("head")[0].appendChild(
|
|
611
|
-
})
|
|
612
|
-
var Ue = class extends Error {
|
|
613
|
-
constructor(e) {
|
|
614
|
-
super(e), this.name = "AbortError";
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
function Ve(e, t, r) {
|
|
618
|
-
if (!Number.isFinite(t)) throw new TypeError("Expected `limit` to be a finite number");
|
|
619
|
-
if (!Number.isFinite(r)) throw new TypeError("Expected `interval` to be a finite number");
|
|
620
|
-
const s = [];
|
|
621
|
-
let o = [], n = 0, i = !1;
|
|
622
|
-
const l = async () => {
|
|
623
|
-
n++;
|
|
624
|
-
const u = s.shift();
|
|
625
|
-
if (u) try {
|
|
626
|
-
const m = await e(...u.args);
|
|
627
|
-
u.resolve(m);
|
|
628
|
-
} catch (m) {
|
|
629
|
-
u.reject(m);
|
|
630
|
-
}
|
|
631
|
-
const f = setTimeout(() => {
|
|
632
|
-
n--, s.length > 0 && l(), o = o.filter((m) => m !== f);
|
|
633
|
-
}, r);
|
|
634
|
-
o.includes(f) || o.push(f);
|
|
635
|
-
}, c = (...u) => i ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((f, m) => {
|
|
636
|
-
s.push({
|
|
637
|
-
resolve: f,
|
|
638
|
-
reject: m,
|
|
639
|
-
args: u
|
|
640
|
-
}), n < t && l();
|
|
641
|
-
});
|
|
642
|
-
return c.abort = () => {
|
|
643
|
-
i = !0, o.forEach(clearTimeout), o = [], s.forEach((u) => u.reject(() => new Ue("Throttle function aborted"))), s.length = 0;
|
|
644
|
-
}, c;
|
|
645
|
-
}
|
|
646
|
-
var Be = Ve;
|
|
647
|
-
const X = (e = "") => e.includes("/cdn/"), Fe = (e, t = 25, r = 1) => ({
|
|
607
|
+
const r = document.createElement("script");
|
|
608
|
+
r.async = !0, r.src = e, r.id = "storyblok-javascript-bridge", r.onerror = (o) => s(o), r.onload = (o) => {
|
|
609
|
+
se.forEach((n) => n()), te = !0, t(o);
|
|
610
|
+
}, document.getElementsByTagName("head")[0].appendChild(r);
|
|
611
|
+
}), re = (e = "") => e.includes("/cdn/"), ze = (e, t = 25, s = 1) => ({
|
|
648
612
|
...e,
|
|
649
613
|
per_page: t,
|
|
650
|
-
page:
|
|
651
|
-
}),
|
|
652
|
-
const
|
|
653
|
-
return
|
|
654
|
-
},
|
|
655
|
-
const
|
|
614
|
+
page: s
|
|
615
|
+
}), Ze = (e) => new Promise((t) => setTimeout(t, e)), Je = (e = 0, t) => Array.from({ length: e }, t), We = (e = 0, t = e) => {
|
|
616
|
+
const s = Math.abs(t - e) || 0, r = e < t ? 1 : -1;
|
|
617
|
+
return Je(s, (o, n) => n * r + e);
|
|
618
|
+
}, Ye = async (e, t) => Promise.all(e.map(t)), Ke = (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], []), G = (e, t, s) => {
|
|
619
|
+
const r = [];
|
|
656
620
|
for (const o in e) {
|
|
657
621
|
if (!Object.prototype.hasOwnProperty.call(e, o)) continue;
|
|
658
622
|
const n = e[o];
|
|
659
623
|
if (n == null) continue;
|
|
660
|
-
const
|
|
661
|
-
let
|
|
662
|
-
typeof n == "object" ?
|
|
624
|
+
const l = s ? "" : encodeURIComponent(o);
|
|
625
|
+
let i;
|
|
626
|
+
typeof n == "object" ? i = G(n, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(n)) : i = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(n)}`, r.push(i);
|
|
663
627
|
}
|
|
664
|
-
return
|
|
665
|
-
},
|
|
628
|
+
return r.join("&");
|
|
629
|
+
}, oe = (e) => {
|
|
666
630
|
const t = {
|
|
667
631
|
eu: "api.storyblok.com",
|
|
668
632
|
us: "api-us.storyblok.com",
|
|
@@ -672,7 +636,7 @@ const X = (e = "") => e.includes("/cdn/"), Fe = (e, t = 25, r = 1) => ({
|
|
|
672
636
|
};
|
|
673
637
|
return t[e] ?? t.eu;
|
|
674
638
|
};
|
|
675
|
-
var
|
|
639
|
+
var Xe = class {
|
|
676
640
|
constructor(e) {
|
|
677
641
|
g(this, "baseURL"), g(this, "timeout"), g(this, "headers"), g(this, "responseInterceptor"), g(this, "fetch"), g(this, "ejectInterceptor"), g(this, "url"), g(this, "parameters"), g(this, "fetchOptions"), this.baseURL = e.baseURL, this.headers = e.headers || new Headers(), this.timeout = e != null && e.timeout ? e.timeout * 1e3 : 0, this.responseInterceptor = e.responseInterceptor, this.fetch = (...t) => e.fetch ? e.fetch(...t) : fetch(...t), this.ejectInterceptor = !1, this.url = "", this.parameters = {}, this.fetchOptions = {};
|
|
678
642
|
}
|
|
@@ -695,37 +659,37 @@ var We = class {
|
|
|
695
659
|
return this.url = e, this.parameters = t ?? {}, this._methodHandler("delete");
|
|
696
660
|
}
|
|
697
661
|
async _responseHandler(e) {
|
|
698
|
-
const t = [],
|
|
662
|
+
const t = [], s = {
|
|
699
663
|
data: {},
|
|
700
664
|
headers: {},
|
|
701
665
|
status: 0,
|
|
702
666
|
statusText: ""
|
|
703
667
|
};
|
|
704
|
-
e.status !== 204 && await e.json().then((
|
|
705
|
-
|
|
668
|
+
e.status !== 204 && await e.json().then((r) => {
|
|
669
|
+
s.data = r;
|
|
706
670
|
});
|
|
707
|
-
for (const
|
|
708
|
-
return
|
|
671
|
+
for (const r of e.headers.entries()) t[r[0]] = r[1];
|
|
672
|
+
return s.headers = { ...t }, s.status = e.status, s.statusText = e.statusText, s;
|
|
709
673
|
}
|
|
710
674
|
async _methodHandler(e) {
|
|
711
|
-
let t = `${this.baseURL}${this.url}`,
|
|
712
|
-
e === "get" ? t = `${this.baseURL}${this.url}?${
|
|
713
|
-
const
|
|
714
|
-
let
|
|
715
|
-
this.timeout && (
|
|
675
|
+
let t = `${this.baseURL}${this.url}`, s = null;
|
|
676
|
+
e === "get" ? t = `${this.baseURL}${this.url}?${G(this.parameters)}` : s = JSON.stringify(this.parameters);
|
|
677
|
+
const r = new URL(t), o = new AbortController(), { signal: n } = o;
|
|
678
|
+
let l = null;
|
|
679
|
+
this.timeout && (l = setTimeout(() => o.abort(), this.timeout));
|
|
716
680
|
try {
|
|
717
|
-
const
|
|
681
|
+
const i = await this.fetch(`${r}`, {
|
|
718
682
|
method: e,
|
|
719
683
|
headers: this.headers,
|
|
720
|
-
body:
|
|
684
|
+
body: s,
|
|
721
685
|
signal: n,
|
|
722
686
|
...this.fetchOptions
|
|
723
687
|
});
|
|
724
|
-
this.timeout &&
|
|
725
|
-
const c = await this._responseHandler(
|
|
688
|
+
this.timeout && l && clearTimeout(l);
|
|
689
|
+
const c = await this._responseHandler(i);
|
|
726
690
|
return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(c)) : this._statusHandler(c);
|
|
727
|
-
} catch (
|
|
728
|
-
return { message:
|
|
691
|
+
} catch (i) {
|
|
692
|
+
return { message: i };
|
|
729
693
|
}
|
|
730
694
|
}
|
|
731
695
|
setFetchOptions(e = {}) {
|
|
@@ -753,93 +717,209 @@ var We = class {
|
|
|
753
717
|
}
|
|
754
718
|
_statusHandler(e) {
|
|
755
719
|
const t = /20[0-6]/g;
|
|
756
|
-
return new Promise((
|
|
757
|
-
if (t.test(`${e.status}`)) return
|
|
720
|
+
return new Promise((s, r) => {
|
|
721
|
+
if (t.test(`${e.status}`)) return s(e);
|
|
758
722
|
const o = {
|
|
759
723
|
message: this._normalizeErrorMessage(e.data),
|
|
760
724
|
status: e.status,
|
|
761
725
|
response: e
|
|
762
726
|
};
|
|
763
|
-
|
|
727
|
+
r(o);
|
|
764
728
|
});
|
|
765
729
|
}
|
|
766
|
-
},
|
|
767
|
-
const
|
|
730
|
+
}, Qe = Xe;
|
|
731
|
+
const ne = "SB-Agent", j = {
|
|
768
732
|
defaultAgentName: "SB-JS-CLIENT",
|
|
769
733
|
defaultAgentVersion: "SB-Agent-Version",
|
|
770
734
|
packageVersion: "7.0.0"
|
|
771
|
-
},
|
|
735
|
+
}, ce = {
|
|
736
|
+
DRAFT: "draft",
|
|
772
737
|
PUBLISHED: "published"
|
|
738
|
+
}, et = 25, D = {
|
|
739
|
+
SMALL: 25,
|
|
740
|
+
MEDIUM: 50,
|
|
741
|
+
LARGE: 75
|
|
742
|
+
}, O = {
|
|
743
|
+
SINGLE_OR_SMALL: 50,
|
|
744
|
+
MEDIUM: 15,
|
|
745
|
+
LARGE: 10,
|
|
746
|
+
VERY_LARGE: 6
|
|
747
|
+
}, U = 1e3, V = 3;
|
|
748
|
+
function tt(e) {
|
|
749
|
+
return e.version === ce.DRAFT;
|
|
750
|
+
}
|
|
751
|
+
function st(e, t) {
|
|
752
|
+
const s = e.includes("/cdn/stories/"), r = e.split("/").length > 3 && !e.endsWith("/cdn/stories"), o = "find_by" in t;
|
|
753
|
+
return s && r || o;
|
|
754
|
+
}
|
|
755
|
+
function rt(e) {
|
|
756
|
+
return e <= D.SMALL ? O.SINGLE_OR_SMALL : e <= D.MEDIUM ? O.MEDIUM : e <= D.LARGE ? O.LARGE : O.VERY_LARGE;
|
|
757
|
+
}
|
|
758
|
+
function P(e, t, s = {}, r) {
|
|
759
|
+
if (s.userRateLimit !== void 0) return Math.min(s.userRateLimit, U);
|
|
760
|
+
if (s.serverHeadersRateLimit !== void 0) return Math.min(s.serverHeadersRateLimit, U);
|
|
761
|
+
if (t && !tt(t)) return U;
|
|
762
|
+
if (r !== void 0) return r;
|
|
763
|
+
if (st(e, t)) return O.SINGLE_OR_SMALL;
|
|
764
|
+
const o = t.per_page || et;
|
|
765
|
+
return rt(o);
|
|
766
|
+
}
|
|
767
|
+
function ot(e) {
|
|
768
|
+
if (!e) return null;
|
|
769
|
+
const t = e["x-ratelimit"] || e["X-RateLimit"], s = e["x-ratelimit-policy"] || e["X-RateLimit-Policy"];
|
|
770
|
+
if (!t && !s) return null;
|
|
771
|
+
const r = {};
|
|
772
|
+
if (t) {
|
|
773
|
+
const o = t.match(/r=(\d+)/);
|
|
774
|
+
o && (r.remaining = Number.parseInt(o[1], 10));
|
|
775
|
+
}
|
|
776
|
+
if (s) {
|
|
777
|
+
const o = s.match(/q=(\d+)/);
|
|
778
|
+
o && (r.max = Number.parseInt(o[1], 10));
|
|
779
|
+
}
|
|
780
|
+
return Object.keys(r).length > 0 ? r : null;
|
|
781
|
+
}
|
|
782
|
+
function nt(e, t = !1) {
|
|
783
|
+
return {
|
|
784
|
+
userRateLimit: e,
|
|
785
|
+
serverHeadersRateLimit: void 0,
|
|
786
|
+
isManagementApi: t
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
var it = class extends Error {
|
|
790
|
+
constructor(e) {
|
|
791
|
+
super(e), this.name = "AbortError";
|
|
792
|
+
}
|
|
773
793
|
};
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
794
|
+
function at(e, t, s) {
|
|
795
|
+
if (!Number.isFinite(t)) throw new TypeError("Expected `limit` to be a finite number");
|
|
796
|
+
if (!Number.isFinite(s)) throw new TypeError("Expected `interval` to be a finite number");
|
|
797
|
+
const r = [];
|
|
798
|
+
let o = [], n = 0, l = !1;
|
|
799
|
+
const i = async () => {
|
|
800
|
+
n++;
|
|
801
|
+
const u = r.shift();
|
|
802
|
+
if (u) try {
|
|
803
|
+
const p = await e(...u.args);
|
|
804
|
+
u.resolve(p);
|
|
805
|
+
} catch (p) {
|
|
806
|
+
u.reject(p);
|
|
807
|
+
}
|
|
808
|
+
const d = setTimeout(() => {
|
|
809
|
+
n--, r.length > 0 && i(), o = o.filter((p) => p !== d);
|
|
810
|
+
}, s);
|
|
811
|
+
o.includes(d) || o.push(d);
|
|
812
|
+
}, c = (...u) => l ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((d, p) => {
|
|
813
|
+
r.push({
|
|
814
|
+
resolve: d,
|
|
815
|
+
reject: p,
|
|
816
|
+
args: u
|
|
817
|
+
}), n < t && i();
|
|
818
|
+
});
|
|
819
|
+
return c.abort = () => {
|
|
820
|
+
l = !0, o.forEach(clearTimeout), o = [], r.forEach((u) => u.reject(() => new it("Throttle function aborted"))), r.length = 0;
|
|
821
|
+
}, c;
|
|
822
|
+
}
|
|
823
|
+
var lt = at, ct = class {
|
|
824
|
+
constructor(e, t = 1e3) {
|
|
825
|
+
g(this, "queues"), g(this, "interval"), g(this, "throttledRequestFn"), this.queues = /* @__PURE__ */ new Map(), this.interval = t, this.throttledRequestFn = e;
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Gets or creates a throttle queue for the specified rate limit
|
|
829
|
+
*/
|
|
830
|
+
getQueue(e) {
|
|
831
|
+
let t = this.queues.get(e);
|
|
832
|
+
return t || (t = lt(this.throttledRequestFn, e, this.interval), this.queues.set(e, t)), t;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Executes a request through the appropriate throttle queue based on rate limit
|
|
836
|
+
*/
|
|
837
|
+
execute(e, ...t) {
|
|
838
|
+
return this.getQueue(e)(...t);
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Aborts all throttle queues
|
|
842
|
+
*/
|
|
843
|
+
abortAll() {
|
|
844
|
+
this.queues.forEach((e) => {
|
|
845
|
+
var t;
|
|
846
|
+
(t = e.abort) == null || t.call(e);
|
|
847
|
+
}), this.queues.clear();
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Gets the number of active queues
|
|
851
|
+
*/
|
|
852
|
+
getQueueCount() {
|
|
853
|
+
return this.queues.size;
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
let H = {};
|
|
857
|
+
const R = {};
|
|
858
|
+
var ut = class {
|
|
777
859
|
/**
|
|
778
860
|
*
|
|
779
861
|
* @param config ISbConfig interface
|
|
780
862
|
* @param pEndpoint string, optional
|
|
781
863
|
*/
|
|
782
864
|
constructor(e, t) {
|
|
783
|
-
g(this, "client"), g(this, "maxRetries"), g(this, "retriesDelay"), g(this, "
|
|
784
|
-
let
|
|
785
|
-
if (!
|
|
786
|
-
const
|
|
787
|
-
e.oauthToken ?
|
|
865
|
+
g(this, "client"), g(this, "maxRetries"), g(this, "retriesDelay"), g(this, "throttleManager"), g(this, "accessToken"), g(this, "cache"), g(this, "resolveCounter"), g(this, "relations"), g(this, "links"), g(this, "version"), g(this, "rateLimitConfig"), g(this, "richTextResolver"), g(this, "resolveNestedRelations"), g(this, "stringifiedStoriesCache"), g(this, "inlineAssets");
|
|
866
|
+
let s = e.endpoint || t;
|
|
867
|
+
if (!s) {
|
|
868
|
+
const o = e.https === !1 ? "http" : "https";
|
|
869
|
+
e.oauthToken ? s = `${o}://${oe(e.region)}/v1` : s = `${o}://${oe(e.region)}/v2`;
|
|
788
870
|
}
|
|
789
|
-
const
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}),
|
|
793
|
-
|
|
794
|
-
e.oauthToken && (s.set("Authorization", e.oauthToken), o = 3), e.rateLimit && (o = e.rateLimit), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Be(this.throttledRequest.bind(this), o, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || Ke.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new Ye({
|
|
795
|
-
baseURL: r,
|
|
871
|
+
const r = new Headers();
|
|
872
|
+
r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([o, n]) => {
|
|
873
|
+
r.set(o, n);
|
|
874
|
+
}), r.has(ne) || (r.set(ne, j.defaultAgentName), r.set(j.defaultAgentVersion, j.packageVersion)), e.oauthToken && r.set("Authorization", e.oauthToken), this.rateLimitConfig = nt(e.rateLimit, !!e.oauthToken), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttleManager = new ct(this.throttledRequest.bind(this), 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || ce.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new Qe({
|
|
875
|
+
baseURL: s,
|
|
796
876
|
timeout: e.timeout || 0,
|
|
797
|
-
headers:
|
|
877
|
+
headers: r,
|
|
798
878
|
responseInterceptor: e.responseInterceptor,
|
|
799
879
|
fetch: e.fetch
|
|
800
880
|
});
|
|
801
881
|
}
|
|
802
882
|
parseParams(e) {
|
|
803
|
-
return e.token || (e.token = this.getToken()), e.cv || (e.cv =
|
|
883
|
+
return e.token || (e.token = this.getToken()), e.cv || (e.cv = R[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
|
|
804
884
|
}
|
|
805
885
|
factoryParamOptions(e, t) {
|
|
806
|
-
return
|
|
886
|
+
return re(e) ? this.parseParams(t) : t;
|
|
807
887
|
}
|
|
808
|
-
makeRequest(e, t,
|
|
809
|
-
const n = this.factoryParamOptions(e,
|
|
888
|
+
makeRequest(e, t, s, r, o) {
|
|
889
|
+
const n = this.factoryParamOptions(e, ze(t, s, r));
|
|
810
890
|
return this.cacheResponse(e, n, void 0, o);
|
|
811
891
|
}
|
|
812
|
-
get(e, t = {},
|
|
892
|
+
get(e, t = {}, s) {
|
|
813
893
|
t || (t = {});
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
const o = this.factoryParamOptions(
|
|
817
|
-
return this.cacheResponse(
|
|
894
|
+
const r = `/${e}`;
|
|
895
|
+
re(r) && (t.version = t.version || this.version);
|
|
896
|
+
const o = this.factoryParamOptions(r, t);
|
|
897
|
+
return this.cacheResponse(r, o, void 0, s);
|
|
818
898
|
}
|
|
819
|
-
async getAll(e, t = {},
|
|
820
|
-
const o = (t == null ? void 0 : t.per_page) || 25, n = `/${e}`.replace(/\/$/, ""),
|
|
899
|
+
async getAll(e, t = {}, s, r) {
|
|
900
|
+
const o = (t == null ? void 0 : t.per_page) || 25, n = `/${e}`.replace(/\/$/, ""), l = s ?? n.substring(n.lastIndexOf("/") + 1);
|
|
821
901
|
t.version = t.version || this.version;
|
|
822
|
-
const
|
|
823
|
-
return
|
|
902
|
+
const i = 1, c = await this.makeRequest(n, t, o, i, r), u = c.total ? Math.ceil(c.total / (c.perPage || o)) : 1, d = await Ye(We(i, u), (p) => this.makeRequest(n, t, o, p + 1, r));
|
|
903
|
+
return Ke([c, ...d], (p) => Object.values(p.data[l]));
|
|
824
904
|
}
|
|
825
|
-
post(e, t = {},
|
|
826
|
-
const
|
|
827
|
-
return this.
|
|
905
|
+
post(e, t = {}, s) {
|
|
906
|
+
const r = `/${e}`, o = P(void 0, void 0, this.rateLimitConfig, V);
|
|
907
|
+
return this.throttleManager.execute(o, "post", r, t, s);
|
|
828
908
|
}
|
|
829
|
-
put(e, t = {},
|
|
830
|
-
const
|
|
831
|
-
return this.
|
|
909
|
+
put(e, t = {}, s) {
|
|
910
|
+
const r = `/${e}`, o = P(void 0, void 0, this.rateLimitConfig, V);
|
|
911
|
+
return this.throttleManager.execute(o, "put", r, t, s);
|
|
832
912
|
}
|
|
833
|
-
delete(e, t = {},
|
|
913
|
+
delete(e, t = {}, s) {
|
|
834
914
|
t || (t = {});
|
|
835
|
-
const
|
|
836
|
-
return this.
|
|
915
|
+
const r = `/${e}`, o = P(void 0, void 0, this.rateLimitConfig, V);
|
|
916
|
+
return this.throttleManager.execute(o, "delete", r, t, s);
|
|
837
917
|
}
|
|
838
918
|
getStories(e = {}, t) {
|
|
839
919
|
return this._addResolveLevel(e), this.get("cdn/stories", e, t);
|
|
840
920
|
}
|
|
841
|
-
getStory(e, t = {},
|
|
842
|
-
return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t,
|
|
921
|
+
getStory(e, t = {}, s) {
|
|
922
|
+
return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, s);
|
|
843
923
|
}
|
|
844
924
|
getToken() {
|
|
845
925
|
return this.accessToken;
|
|
@@ -853,9 +933,9 @@ var Xe = class {
|
|
|
853
933
|
_cleanCopy(e) {
|
|
854
934
|
return JSON.parse(JSON.stringify(e));
|
|
855
935
|
}
|
|
856
|
-
_insertLinks(e, t,
|
|
857
|
-
const
|
|
858
|
-
|
|
936
|
+
_insertLinks(e, t, s) {
|
|
937
|
+
const r = e[t];
|
|
938
|
+
r && r.fieldtype === "multilink" && r.linktype === "story" && typeof r.id == "string" && this.links[s][r.id] ? r.story = this._cleanCopy(this.links[s][r.id]) : r && r.linktype === "story" && typeof r.uuid == "string" && this.links[s][r.uuid] && (r.story = this._cleanCopy(this.links[s][r.uuid]));
|
|
859
939
|
}
|
|
860
940
|
/**
|
|
861
941
|
*
|
|
@@ -876,9 +956,9 @@ var Xe = class {
|
|
|
876
956
|
* - For single strings: directly replaces the UUID with the story reference
|
|
877
957
|
* - For arrays: maps through each UUID and replaces with corresponding story references
|
|
878
958
|
*/
|
|
879
|
-
_resolveField(e, t,
|
|
880
|
-
const
|
|
881
|
-
typeof
|
|
959
|
+
_resolveField(e, t, s) {
|
|
960
|
+
const r = e[t];
|
|
961
|
+
typeof r == "string" ? e[t] = this.getStoryReference(s, r) : Array.isArray(r) && (e[t] = r.map((o) => this.getStoryReference(s, o)).filter(Boolean));
|
|
882
962
|
}
|
|
883
963
|
/**
|
|
884
964
|
* Inserts relations into the JSON tree by resolving references
|
|
@@ -897,13 +977,13 @@ var Xe = class {
|
|
|
897
977
|
* The method supports both string and array formats for the fields parameter,
|
|
898
978
|
* allowing flexible specification of relation patterns.
|
|
899
979
|
*/
|
|
900
|
-
_insertRelations(e, t,
|
|
901
|
-
if (Array.isArray(
|
|
902
|
-
this._resolveField(e, t,
|
|
980
|
+
_insertRelations(e, t, s, r) {
|
|
981
|
+
if (Array.isArray(s) ? s.find((n) => n.endsWith(`.${t}`)) : s.endsWith(`.${t}`)) {
|
|
982
|
+
this._resolveField(e, t, r);
|
|
903
983
|
return;
|
|
904
984
|
}
|
|
905
985
|
const o = e.component ? `${e.component}.${t}` : t;
|
|
906
|
-
(Array.isArray(
|
|
986
|
+
(Array.isArray(s) ? s.includes(o) : s === o) && this._resolveField(e, t, r);
|
|
907
987
|
}
|
|
908
988
|
/**
|
|
909
989
|
* Recursively traverses and resolves relations in the story content tree
|
|
@@ -911,67 +991,67 @@ var Xe = class {
|
|
|
911
991
|
* @param fields - The relation patterns to resolve
|
|
912
992
|
* @param resolveId - The unique identifier for the current resolution context
|
|
913
993
|
*/
|
|
914
|
-
iterateTree(e, t,
|
|
915
|
-
const
|
|
994
|
+
iterateTree(e, t, s) {
|
|
995
|
+
const r = (o, n = "") => {
|
|
916
996
|
if (!(!o || o._stopResolving)) {
|
|
917
|
-
if (Array.isArray(o)) o.forEach((
|
|
918
|
-
else if (typeof o == "object") for (const
|
|
919
|
-
const
|
|
920
|
-
(o.component && o._uid || o.type === "link") && (this._insertRelations(o,
|
|
997
|
+
if (Array.isArray(o)) o.forEach((l, i) => r(l, `${n}[${i}]`));
|
|
998
|
+
else if (typeof o == "object") for (const l in o) {
|
|
999
|
+
const i = n ? `${n}.${l}` : l;
|
|
1000
|
+
(o.component && o._uid || o.type === "link") && (this._insertRelations(o, l, t, s), this._insertLinks(o, l, s)), r(o[l], i);
|
|
921
1001
|
}
|
|
922
1002
|
}
|
|
923
1003
|
};
|
|
924
|
-
|
|
1004
|
+
r(e.content);
|
|
925
1005
|
}
|
|
926
|
-
async resolveLinks(e, t,
|
|
927
|
-
let
|
|
1006
|
+
async resolveLinks(e, t, s) {
|
|
1007
|
+
let r = [];
|
|
928
1008
|
if (e.link_uuids) {
|
|
929
|
-
const o = e.link_uuids.length, n = [],
|
|
930
|
-
for (let
|
|
931
|
-
const c = Math.min(o,
|
|
932
|
-
n.push(e.link_uuids.slice(
|
|
1009
|
+
const o = e.link_uuids.length, n = [], l = 50;
|
|
1010
|
+
for (let i = 0; i < o; i += l) {
|
|
1011
|
+
const c = Math.min(o, i + l);
|
|
1012
|
+
n.push(e.link_uuids.slice(i, c));
|
|
933
1013
|
}
|
|
934
|
-
for (let
|
|
1014
|
+
for (let i = 0; i < n.length; i++)
|
|
935
1015
|
(await this.getStories({
|
|
936
|
-
per_page:
|
|
1016
|
+
per_page: l,
|
|
937
1017
|
language: t.language,
|
|
938
1018
|
version: t.version,
|
|
939
1019
|
starts_with: t.starts_with,
|
|
940
|
-
by_uuids: n[
|
|
1020
|
+
by_uuids: n[i].join(",")
|
|
941
1021
|
})).data.stories.forEach((c) => {
|
|
942
|
-
|
|
1022
|
+
r.push(c);
|
|
943
1023
|
});
|
|
944
|
-
} else
|
|
945
|
-
|
|
946
|
-
this.links[
|
|
1024
|
+
} else r = e.links;
|
|
1025
|
+
r.forEach((o) => {
|
|
1026
|
+
this.links[s][o.uuid] = {
|
|
947
1027
|
...o,
|
|
948
1028
|
_stopResolving: !0
|
|
949
1029
|
};
|
|
950
1030
|
});
|
|
951
1031
|
}
|
|
952
|
-
async resolveRelations(e, t,
|
|
953
|
-
let
|
|
1032
|
+
async resolveRelations(e, t, s) {
|
|
1033
|
+
let r = [];
|
|
954
1034
|
if (e.rel_uuids) {
|
|
955
|
-
const o = e.rel_uuids.length, n = [],
|
|
956
|
-
for (let
|
|
957
|
-
const c = Math.min(o,
|
|
958
|
-
n.push(e.rel_uuids.slice(
|
|
1035
|
+
const o = e.rel_uuids.length, n = [], l = 50;
|
|
1036
|
+
for (let i = 0; i < o; i += l) {
|
|
1037
|
+
const c = Math.min(o, i + l);
|
|
1038
|
+
n.push(e.rel_uuids.slice(i, c));
|
|
959
1039
|
}
|
|
960
|
-
for (let
|
|
1040
|
+
for (let i = 0; i < n.length; i++)
|
|
961
1041
|
(await this.getStories({
|
|
962
|
-
per_page:
|
|
1042
|
+
per_page: l,
|
|
963
1043
|
language: t.language,
|
|
964
1044
|
version: t.version,
|
|
965
1045
|
starts_with: t.starts_with,
|
|
966
|
-
by_uuids: n[
|
|
1046
|
+
by_uuids: n[i].join(","),
|
|
967
1047
|
excluding_fields: t.excluding_fields
|
|
968
1048
|
})).data.stories.forEach((c) => {
|
|
969
|
-
|
|
1049
|
+
r.push(c);
|
|
970
1050
|
});
|
|
971
|
-
|
|
972
|
-
} else
|
|
973
|
-
|
|
974
|
-
this.relations[
|
|
1051
|
+
r.length > 0 && (e.rels = r, delete e.rel_uuids);
|
|
1052
|
+
} else r = e.rels;
|
|
1053
|
+
r && r.length > 0 && r.forEach((o) => {
|
|
1054
|
+
this.relations[s][o.uuid] = {
|
|
975
1055
|
...o,
|
|
976
1056
|
_stopResolving: !0
|
|
977
1057
|
};
|
|
@@ -986,21 +1066,21 @@ var Xe = class {
|
|
|
986
1066
|
* @returns Promise<void>
|
|
987
1067
|
*
|
|
988
1068
|
*/
|
|
989
|
-
async resolveStories(e, t,
|
|
990
|
-
var
|
|
1069
|
+
async resolveStories(e, t, s) {
|
|
1070
|
+
var r, o;
|
|
991
1071
|
let n = [];
|
|
992
|
-
if (this.links[
|
|
1072
|
+
if (this.links[s] = {}, this.relations[s] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (n = t.resolve_relations.split(",")), await this.resolveRelations(e, t, s)), t.resolve_links && [
|
|
993
1073
|
"1",
|
|
994
1074
|
"story",
|
|
995
1075
|
"url",
|
|
996
1076
|
"link"
|
|
997
|
-
].includes(t.resolve_links) && ((
|
|
998
|
-
e.story ? this.iterateTree(e.story, n,
|
|
999
|
-
this.iterateTree(
|
|
1000
|
-
}), this.stringifiedStoriesCache = {}, delete this.links[
|
|
1077
|
+
].includes(t.resolve_links) && ((r = e.links) != null && r.length || (o = e.link_uuids) != null && o.length) && await this.resolveLinks(e, t, s), this.resolveNestedRelations) for (const l in this.relations[s]) this.iterateTree(this.relations[s][l], n, s);
|
|
1078
|
+
e.story ? this.iterateTree(e.story, n, s) : e.stories.forEach((l) => {
|
|
1079
|
+
this.iterateTree(l, n, s);
|
|
1080
|
+
}), this.stringifiedStoriesCache = {}, delete this.links[s], delete this.relations[s];
|
|
1001
1081
|
}
|
|
1002
|
-
async cacheResponse(e, t,
|
|
1003
|
-
const o =
|
|
1082
|
+
async cacheResponse(e, t, s, r) {
|
|
1083
|
+
const o = G({
|
|
1004
1084
|
url: e,
|
|
1005
1085
|
params: t
|
|
1006
1086
|
}), n = this.cacheProvider();
|
|
@@ -1008,62 +1088,64 @@ var Xe = class {
|
|
|
1008
1088
|
const i = await n.get(o);
|
|
1009
1089
|
if (i) return Promise.resolve(i);
|
|
1010
1090
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1091
|
+
const l = P(e, t, this.rateLimitConfig);
|
|
1092
|
+
return new Promise(async (i, c) => {
|
|
1093
|
+
var u;
|
|
1013
1094
|
try {
|
|
1014
|
-
const
|
|
1015
|
-
if (
|
|
1016
|
-
let
|
|
1017
|
-
data:
|
|
1018
|
-
headers:
|
|
1095
|
+
const d = await this.throttleManager.execute(l, "get", e, t, r);
|
|
1096
|
+
if (d.status !== 200) return c(d);
|
|
1097
|
+
let p = {
|
|
1098
|
+
data: d.data,
|
|
1099
|
+
headers: d.headers
|
|
1019
1100
|
};
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1101
|
+
const L = ot(d.headers);
|
|
1102
|
+
if ((L == null ? void 0 : L.max) !== void 0 && (this.rateLimitConfig.serverHeadersRateLimit = L.max), (u = d.headers) != null && u["per-page"] && (p = Object.assign({}, p, {
|
|
1103
|
+
perPage: d.headers["per-page"] ? Number.parseInt(d.headers["per-page"]) : 0,
|
|
1104
|
+
total: d.headers["per-page"] ? Number.parseInt(d.headers.total) : 0
|
|
1105
|
+
})), p.data.story || p.data.stories) {
|
|
1106
|
+
const v = this.resolveCounter = ++this.resolveCounter % 1e3;
|
|
1107
|
+
await this.resolveStories(p.data, t, `${v}`), p = await this.processInlineAssets(p);
|
|
1026
1108
|
}
|
|
1027
|
-
t.version === "published" && e !== "/cdn/spaces/me" && await n.set(o,
|
|
1028
|
-
const
|
|
1029
|
-
return t.token &&
|
|
1030
|
-
} catch (
|
|
1031
|
-
if (
|
|
1032
|
-
return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await
|
|
1033
|
-
|
|
1109
|
+
t.version === "published" && e !== "/cdn/spaces/me" && await n.set(o, p);
|
|
1110
|
+
const _ = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
|
|
1111
|
+
return t.token && p.data.cv && (_ && R[t.token] && R[t.token] !== p.data.cv && await this.flushCache(), R[t.token] = p.data.cv), i(p);
|
|
1112
|
+
} catch (d) {
|
|
1113
|
+
if (d.response && d.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
|
|
1114
|
+
return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await Ze(this.retriesDelay), this.cacheResponse(e, t, s).then(i).catch(c);
|
|
1115
|
+
c(d);
|
|
1034
1116
|
}
|
|
1035
1117
|
});
|
|
1036
1118
|
}
|
|
1037
|
-
throttledRequest(e, t,
|
|
1038
|
-
return this.client.setFetchOptions(
|
|
1119
|
+
throttledRequest(e, t, s, r) {
|
|
1120
|
+
return this.client.setFetchOptions(r), this.client[e](t, s);
|
|
1039
1121
|
}
|
|
1040
1122
|
cacheVersions() {
|
|
1041
|
-
return
|
|
1123
|
+
return R;
|
|
1042
1124
|
}
|
|
1043
1125
|
cacheVersion() {
|
|
1044
|
-
return
|
|
1126
|
+
return R[this.accessToken];
|
|
1045
1127
|
}
|
|
1046
1128
|
setCacheVersion(e) {
|
|
1047
|
-
this.accessToken && (
|
|
1129
|
+
this.accessToken && (R[this.accessToken] = e);
|
|
1048
1130
|
}
|
|
1049
1131
|
clearCacheVersion() {
|
|
1050
|
-
this.accessToken && (
|
|
1132
|
+
this.accessToken && (R[this.accessToken] = 0);
|
|
1051
1133
|
}
|
|
1052
1134
|
cacheProvider() {
|
|
1053
1135
|
switch (this.cache.type) {
|
|
1054
1136
|
case "memory":
|
|
1055
1137
|
return {
|
|
1056
1138
|
get(e) {
|
|
1057
|
-
return Promise.resolve(
|
|
1139
|
+
return Promise.resolve(H[e]);
|
|
1058
1140
|
},
|
|
1059
1141
|
getAll() {
|
|
1060
|
-
return Promise.resolve(
|
|
1142
|
+
return Promise.resolve(H);
|
|
1061
1143
|
},
|
|
1062
1144
|
set(e, t) {
|
|
1063
|
-
return
|
|
1145
|
+
return H[e] = t, Promise.resolve(void 0);
|
|
1064
1146
|
},
|
|
1065
1147
|
flush() {
|
|
1066
|
-
return
|
|
1148
|
+
return H = {}, Promise.resolve(void 0);
|
|
1067
1149
|
}
|
|
1068
1150
|
};
|
|
1069
1151
|
case "custom":
|
|
@@ -1090,21 +1172,21 @@ var Xe = class {
|
|
|
1090
1172
|
}
|
|
1091
1173
|
async processInlineAssets(e) {
|
|
1092
1174
|
if (!this.inlineAssets) return e;
|
|
1093
|
-
const t = (
|
|
1094
|
-
if (!
|
|
1095
|
-
if (Array.isArray(
|
|
1096
|
-
let
|
|
1097
|
-
|
|
1098
|
-
...e.data.assets.find((o) => o.id ===
|
|
1099
|
-
...
|
|
1175
|
+
const t = (s) => {
|
|
1176
|
+
if (!s || typeof s != "object") return s;
|
|
1177
|
+
if (Array.isArray(s)) return s.map((o) => t(o));
|
|
1178
|
+
let r = { ...s };
|
|
1179
|
+
r.fieldtype === "asset" && Array.isArray(e.data.assets) && (r = {
|
|
1180
|
+
...e.data.assets.find((o) => o.id === r.id),
|
|
1181
|
+
...r
|
|
1100
1182
|
});
|
|
1101
|
-
for (const o in
|
|
1102
|
-
return
|
|
1183
|
+
for (const o in r) typeof r[o] == "object" && (r[o] = t(r[o]));
|
|
1184
|
+
return r;
|
|
1103
1185
|
};
|
|
1104
|
-
return e.data.story && (e.data.story.content = t(e.data.story.content)), e.data.stories && (e.data.stories = e.data.stories.map((
|
|
1186
|
+
return e.data.story && (e.data.story.content = t(e.data.story.content)), e.data.stories && (e.data.stories = e.data.stories.map((s) => (s.content = t(s.content), s))), e;
|
|
1105
1187
|
}
|
|
1106
|
-
},
|
|
1107
|
-
const
|
|
1188
|
+
}, ht = ut;
|
|
1189
|
+
const yt = (e = {}) => {
|
|
1108
1190
|
const { apiOptions: t } = e;
|
|
1109
1191
|
if (!t || !t.accessToken) {
|
|
1110
1192
|
console.error(
|
|
@@ -1112,8 +1194,8 @@ const ot = (e = {}) => {
|
|
|
1112
1194
|
);
|
|
1113
1195
|
return;
|
|
1114
1196
|
}
|
|
1115
|
-
return { storyblokApi: new
|
|
1116
|
-
},
|
|
1197
|
+
return { storyblokApi: new ht(t) };
|
|
1198
|
+
}, gt = (e) => {
|
|
1117
1199
|
if (typeof e != "object" || typeof e._editable > "u")
|
|
1118
1200
|
return {};
|
|
1119
1201
|
try {
|
|
@@ -1128,39 +1210,39 @@ const ot = (e = {}) => {
|
|
|
1128
1210
|
return {};
|
|
1129
1211
|
}
|
|
1130
1212
|
};
|
|
1131
|
-
let
|
|
1132
|
-
const
|
|
1133
|
-
var t,
|
|
1213
|
+
let F = "https://app.storyblok.com/f/storyblok-v2-latest.js";
|
|
1214
|
+
const bt = (e = {}) => {
|
|
1215
|
+
var t, s;
|
|
1134
1216
|
const {
|
|
1135
|
-
bridge:
|
|
1217
|
+
bridge: r,
|
|
1136
1218
|
accessToken: o,
|
|
1137
1219
|
use: n = [],
|
|
1138
|
-
apiOptions:
|
|
1139
|
-
bridgeUrl:
|
|
1220
|
+
apiOptions: l = {},
|
|
1221
|
+
bridgeUrl: i
|
|
1140
1222
|
} = e;
|
|
1141
|
-
|
|
1142
|
-
const c = { bridge:
|
|
1223
|
+
l.accessToken = l.accessToken || o;
|
|
1224
|
+
const c = { bridge: r, apiOptions: l };
|
|
1143
1225
|
let u = {};
|
|
1144
|
-
n.forEach((
|
|
1145
|
-
u = { ...u, ...
|
|
1146
|
-
}),
|
|
1147
|
-
const
|
|
1148
|
-
return
|
|
1226
|
+
n.forEach((p) => {
|
|
1227
|
+
u = { ...u, ...p(c) };
|
|
1228
|
+
}), i && (F = i);
|
|
1229
|
+
const d = !(typeof window > "u") && ((s = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : s.includes("_storyblok_tk"));
|
|
1230
|
+
return r !== !1 && d && le(F), u;
|
|
1149
1231
|
};
|
|
1150
|
-
function
|
|
1151
|
-
return
|
|
1232
|
+
function Ct(e, t) {
|
|
1233
|
+
return Ge(t).render(e);
|
|
1152
1234
|
}
|
|
1153
|
-
const
|
|
1235
|
+
const vt = () => le(F);
|
|
1154
1236
|
export {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1237
|
+
yt as apiPlugin,
|
|
1238
|
+
pt as getLiveStory,
|
|
1239
|
+
mt as handleStoryblokMessage,
|
|
1240
|
+
vt as loadStoryblokBridge,
|
|
1241
|
+
Ct as renderRichText,
|
|
1242
|
+
Ge as richTextResolver,
|
|
1243
|
+
ft as storyblok,
|
|
1244
|
+
gt as storyblokEditable,
|
|
1245
|
+
bt as storyblokInit,
|
|
1246
|
+
Se as toCamelCase,
|
|
1247
|
+
dt as useStoryblokApi
|
|
1166
1248
|
};
|