@storyblok/vue 9.0.0 → 9.0.2

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.
@@ -4,25 +4,25 @@
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
7
- import { defineComponent as q, ref as x, resolveDynamicComponent as N, inject as ue, createBlock as J, openBlock as K, mergeProps as he, h as Y, createTextVNode as de, watch as pe, onMounted as fe, defineAsyncComponent as ye } from "vue";
8
- function me(s, e) {
7
+ import { defineComponent as K, ref as x, resolveDynamicComponent as N, inject as he, createBlock as Y, openBlock as W, mergeProps as de, h as X, createTextVNode as pe, watch as fe, onMounted as ye, defineAsyncComponent as me } from "vue";
8
+ function be(s, e) {
9
9
  if (!e)
10
10
  return { src: s, attrs: {} };
11
11
  let t = 0, o = 0;
12
12
  const r = {}, n = [];
13
- function i(c, u, f, y, _) {
14
- typeof c != "number" || c <= u || c >= f ? console.warn(`[StoryblokRichText] - ${y.charAt(0).toUpperCase() + y.slice(1)} value must be a number between ${u} and ${f} (inclusive)`) : _.push(`${y}(${c})`);
13
+ function a(i, u, f, y, R) {
14
+ typeof i != "number" || i <= u || i >= f ? console.warn(`[StoryblokRichText] - ${y.charAt(0).toUpperCase() + y.slice(1)} value must be a number between ${u} and ${f} (inclusive)`) : R.push(`${y}(${i})`);
15
15
  }
16
16
  if (typeof e == "object") {
17
17
  if (typeof e.width == "number" && e.width > 0 ? (r.width = e.width, t = e.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), e.height && typeof e.height == "number" && e.height > 0 ? (r.height = e.height, o = e.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), e.loading && ["lazy", "eager"].includes(e.loading) && (r.loading = e.loading), e.class && (r.class = e.class), e.filters) {
18
- const { filters: c } = e || {}, { blur: u, brightness: f, fill: y, format: _, grayscale: E, quality: R, rotate: S } = c || {};
19
- u && i(u, 0, 100, "blur", n), R && i(R, 0, 100, "quality", n), f && i(f, 0, 100, "brightness", n), y && n.push(`fill(${y})`), E && n.push("grayscale()"), S && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${S})`), _ && ["webp", "png", "jpeg"].includes(_) && n.push(`format(${_})`);
18
+ const { filters: i } = e || {}, { blur: u, brightness: f, fill: y, format: R, grayscale: T, quality: E, rotate: L } = i || {};
19
+ u && a(u, 0, 100, "blur", n), E && a(E, 0, 100, "quality", n), f && a(f, 0, 100, "brightness", n), y && n.push(`fill(${y})`), T && n.push("grayscale()"), L && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${L})`), R && ["webp", "png", "jpeg"].includes(R) && n.push(`format(${R})`);
20
20
  }
21
- e.srcset && (r.srcset = e.srcset.map((c) => {
22
- if (typeof c == "number")
23
- return `${s}/m/${c}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${c}w`;
24
- if (Array.isArray(c) && c.length === 2) {
25
- const [u, f] = c;
21
+ e.srcset && (r.srcset = e.srcset.map((i) => {
22
+ if (typeof i == "number")
23
+ return `${s}/m/${i}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${i}w`;
24
+ if (Array.isArray(i) && i.length === 2) {
25
+ const [u, f] = i;
26
26
  return `${s}/m/${u}x${f}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${u}w`;
27
27
  } else {
28
28
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
@@ -30,14 +30,14 @@ function me(s, e) {
30
30
  }
31
31
  }).join(", ")), e.sizes && (r.sizes = e.sizes.join(", "));
32
32
  }
33
- let l = `${s}/m/`;
34
- return t > 0 && o > 0 && (l = `${l}${t}x${o}/`), n.length > 0 && (l = `${l}filters:${n.join(":")}`), {
35
- src: l,
33
+ let c = `${s}/m/`;
34
+ return t > 0 && o > 0 && (c = `${c}${t}x${o}/`), n.length > 0 && (c = `${c}filters:${n.join(":")}`), {
35
+ src: c,
36
36
  attrs: r
37
37
  };
38
38
  }
39
- var g = /* @__PURE__ */ ((s) => (s.DOCUMENT = "doc", s.HEADING = "heading", s.PARAGRAPH = "paragraph", s.QUOTE = "blockquote", s.OL_LIST = "ordered_list", s.UL_LIST = "bullet_list", s.LIST_ITEM = "list_item", s.CODE_BLOCK = "code_block", s.HR = "horizontal_rule", s.BR = "hard_break", s.IMAGE = "image", s.EMOJI = "emoji", s.COMPONENT = "blok", s.TABLE = "table", s.TABLE_ROW = "tableRow", s.TABLE_CELL = "tableCell", s.TABLE_HEADER = "tableHeader", s))(g || {}), $ = /* @__PURE__ */ ((s) => (s.BOLD = "bold", s.STRONG = "strong", s.STRIKE = "strike", s.UNDERLINE = "underline", s.ITALIC = "italic", s.CODE = "code", s.LINK = "link", s.ANCHOR = "anchor", s.STYLED = "styled", s.SUPERSCRIPT = "superscript", s.SUBSCRIPT = "subscript", s.TEXT_STYLE = "textStyle", s.HIGHLIGHT = "highlight", s))($ || {}), W = /* @__PURE__ */ ((s) => (s.TEXT = "text", s))(W || {}), I = /* @__PURE__ */ ((s) => (s.URL = "url", s.STORY = "story", s.ASSET = "asset", s.EMAIL = "email", s))(I || {});
40
- const be = [
39
+ var g = /* @__PURE__ */ ((s) => (s.DOCUMENT = "doc", s.HEADING = "heading", s.PARAGRAPH = "paragraph", s.QUOTE = "blockquote", s.OL_LIST = "ordered_list", s.UL_LIST = "bullet_list", s.LIST_ITEM = "list_item", s.CODE_BLOCK = "code_block", s.HR = "horizontal_rule", s.BR = "hard_break", s.IMAGE = "image", s.EMOJI = "emoji", s.COMPONENT = "blok", s.TABLE = "table", s.TABLE_ROW = "tableRow", s.TABLE_CELL = "tableCell", s.TABLE_HEADER = "tableHeader", s))(g || {}), $ = /* @__PURE__ */ ((s) => (s.BOLD = "bold", s.STRONG = "strong", s.STRIKE = "strike", s.UNDERLINE = "underline", s.ITALIC = "italic", s.CODE = "code", s.LINK = "link", s.ANCHOR = "anchor", s.STYLED = "styled", s.SUPERSCRIPT = "superscript", s.SUBSCRIPT = "subscript", s.TEXT_STYLE = "textStyle", s.HIGHLIGHT = "highlight", s))($ || {}), Q = /* @__PURE__ */ ((s) => (s.TEXT = "text", s))(Q || {}), S = /* @__PURE__ */ ((s) => (s.URL = "url", s.STORY = "story", s.ASSET = "asset", s.EMAIL = "email", s))(S || {});
40
+ const ge = [
41
41
  "area",
42
42
  "base",
43
43
  "br",
@@ -52,107 +52,101 @@ const be = [
52
52
  "source",
53
53
  "track",
54
54
  "wbr"
55
- ], ge = (s = {}) => Object.keys(s).map((e) => `${e}="${s[e]}"`).join(" "), ve = (s = {}) => Object.keys(s).map((e) => `${e}: ${s[e]}`).join("; ");
56
- function ke(s) {
55
+ ], ve = (s = {}) => Object.keys(s).map((e) => `${e}="${s[e]}"`).join(" "), ke = (s = {}) => Object.keys(s).map((e) => `${e}: ${s[e]}`).join("; ");
56
+ function we(s) {
57
57
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
58
58
  }
59
59
  const O = (s) => Object.fromEntries(Object.entries(s).filter(([e, t]) => t !== void 0));
60
- function B(s, e = {}, t) {
61
- const o = ge(e), r = o ? `${s} ${o}` : s, n = Array.isArray(t) ? t.join("") : t || "";
60
+ function F(s, e = {}, t) {
61
+ const o = ve(e), r = o ? `${s} ${o}` : s, n = Array.isArray(t) ? t.join("") : t || "";
62
62
  if (s) {
63
- if (be.includes(s))
63
+ if (ge.includes(s))
64
64
  return `<${r}>`;
65
65
  } else return n;
66
66
  return `<${r}>${n}</${s}>`;
67
67
  }
68
- function X(s = {}) {
68
+ function Z(s = {}) {
69
69
  const e = /* @__PURE__ */ new Map(), {
70
- renderFn: t = B,
71
- textFn: o = ke,
70
+ renderFn: t = F,
71
+ textFn: o = we,
72
72
  resolvers: r = {},
73
73
  optimizeImages: n = !1,
74
- keyedResolvers: i = !1
75
- } = s, l = t !== B, c = () => ({ render: (a, h = {}, d) => {
76
- if (i && a) {
77
- const p = e.get(a) || 0;
78
- e.set(a, p + 1), h.key = `${a}-${p}`;
79
- }
80
- return t(a, h, d);
81
- } }), u = (a) => (h, d) => {
74
+ keyedResolvers: a = !1
75
+ } = s, c = t !== F, i = (l) => (h, d) => {
82
76
  const p = h.attrs || {};
83
- return d.render(a, p, h.children || null);
84
- }, f = (a, h) => {
85
- const { src: d, alt: p, title: b, srcset: w, sizes: v } = a.attrs || {};
86
- let k = d, T = {};
77
+ return d.render(l, p, h.children || null);
78
+ }, u = (l, h) => {
79
+ const { src: d, alt: p, title: b, srcset: w, sizes: v } = l.attrs || {};
80
+ let k = d, _ = {};
87
81
  if (n) {
88
- const { src: le, attrs: ce } = me(d, n);
89
- k = le, T = ce;
82
+ const { src: ce, attrs: ue } = be(d, n);
83
+ k = ce, _ = ue;
90
84
  }
91
- const ae = {
85
+ const le = {
92
86
  src: k,
93
87
  alt: p,
94
88
  title: b,
95
89
  srcset: w,
96
90
  sizes: v,
97
- ...T
91
+ ..._
98
92
  };
99
- return h.render("img", O(ae));
100
- }, y = (a, h) => {
101
- const { level: d, ...p } = a.attrs || {};
102
- return h.render(`h${d}`, p, a.children);
103
- }, _ = (a, h) => {
93
+ return h.render("img", O(le));
94
+ }, f = (l, h) => {
95
+ const { level: d, ...p } = l.attrs || {};
96
+ return h.render(`h${d}`, p, l.children);
97
+ }, y = (l, h) => {
104
98
  var d, p, b, w;
105
99
  const v = h.render("img", {
106
- src: (d = a.attrs) == null ? void 0 : d.fallbackImage,
107
- alt: (p = a.attrs) == null ? void 0 : p.alt,
100
+ src: (d = l.attrs) == null ? void 0 : d.fallbackImage,
101
+ alt: (p = l.attrs) == null ? void 0 : p.alt,
108
102
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
109
103
  draggable: "false",
110
104
  loading: "lazy"
111
105
  });
112
106
  return h.render("span", {
113
107
  "data-type": "emoji",
114
- "data-name": (b = a.attrs) == null ? void 0 : b.name,
115
- "data-emoji": (w = a.attrs) == null ? void 0 : w.emoji
108
+ "data-name": (b = l.attrs) == null ? void 0 : b.name,
109
+ "data-emoji": (w = l.attrs) == null ? void 0 : w.emoji
116
110
  }, v);
117
- }, E = (a, h) => h.render(
111
+ }, R = (l, h) => h.render(
118
112
  "pre",
119
- a.attrs || {},
120
- h.render("code", {}, a.children || "")
121
- ), R = (a, h = !1) => ({ text: d, attrs: p }, b) => {
122
- const { class: w, id: v, ...k } = p || {}, T = h ? {
113
+ l.attrs || {},
114
+ h.render("code", {}, l.children || "")
115
+ ), T = (l, h = !1) => ({ text: d, attrs: p }, b) => {
116
+ const { class: w, id: v, ...k } = p || {}, _ = h ? {
123
117
  class: w,
124
118
  id: v,
125
- style: ve(k) || void 0
119
+ style: ke(k) || void 0
126
120
  } : p || {};
127
- return b.render(a, O(T), d);
128
- }, S = (a) => P(a), ee = (a) => {
129
- const { marks: h, ...d } = a;
130
- if ("text" in a) {
121
+ return b.render(l, O(_), d);
122
+ }, E = (l) => P(l), L = (l) => {
123
+ const { marks: h, ...d } = l;
124
+ if ("text" in l) {
131
125
  if (h)
132
126
  return h.reduce(
133
- (b, w) => S({ ...w, text: b }),
134
- S({ ...d, children: d.children })
127
+ (b, w) => E({ ...w, text: b }),
128
+ E({ ...d, children: d.children })
135
129
  );
136
- const p = a.attrs || {};
137
- if (i) {
130
+ const p = l.attrs || {};
131
+ if (a) {
138
132
  const b = e.get("txt") || 0;
139
133
  e.set("txt", b + 1), p.key = `txt-${b}`;
140
134
  }
141
135
  return o(d.text, p);
142
136
  }
143
137
  return "";
144
- }, U = (a, h) => {
145
- const { linktype: d, href: p, anchor: b, ...w } = a.attrs || {};
138
+ }, U = (l, h) => {
139
+ const { linktype: d, href: p, anchor: b, ...w } = l.attrs || {};
146
140
  let v = "";
147
141
  switch (d) {
148
- case I.ASSET:
149
- case I.URL:
142
+ case S.ASSET:
143
+ case S.URL:
150
144
  v = p;
151
145
  break;
152
- case I.EMAIL:
146
+ case S.EMAIL:
153
147
  v = `mailto:${p}`;
154
148
  break;
155
- case I.STORY:
149
+ case S.STORY:
156
150
  v = p, b && (v = `${v}#${b}`);
157
151
  break;
158
152
  default:
@@ -160,116 +154,134 @@ function X(s = {}) {
160
154
  break;
161
155
  }
162
156
  const k = { ...w };
163
- return v && (k.href = v), h.render("a", k, a.text);
164
- }, te = (a, h) => {
157
+ return v && (k.href = v), h.render("a", k, l.text);
158
+ }, se = (l, h) => {
165
159
  var d, p;
166
160
  return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), h.render("span", {
167
- blok: (d = a == null ? void 0 : a.attrs) == null ? void 0 : d.body[0],
168
- id: (p = a.attrs) == null ? void 0 : p.id,
161
+ blok: (d = l == null ? void 0 : l.attrs) == null ? void 0 : d.body[0],
162
+ id: (p = l.attrs) == null ? void 0 : p.id,
169
163
  style: "display: none"
170
164
  });
171
- }, se = (a, h) => {
172
- const d = {}, p = h.render("tbody", {}, a.children);
165
+ }, re = (l, h) => {
166
+ const d = {}, p = h.render("tbody", {}, l.children);
173
167
  return h.render("table", d, p);
174
- }, re = (a, h) => {
168
+ }, oe = (l, h) => {
175
169
  const d = {};
176
- return h.render("tr", d, a.children);
177
- }, oe = (a, h) => {
178
- const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...v } = a.attrs || {}, k = {
170
+ return h.render("tr", d, l.children);
171
+ }, ne = (l, h) => {
172
+ const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...v } = l.attrs || {}, k = {
179
173
  ...v
180
174
  };
181
175
  d > 1 && (k.colspan = d), p > 1 && (k.rowspan = p);
182
- const T = [];
183
- return b && T.push(`width: ${b}px;`), w && T.push(`background-color: ${w};`), T.length > 0 && (k.style = T.join(" ")), h.render("td", O(k), a.children);
184
- }, ne = (a, h) => {
185
- const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...v } = a.attrs || {}, k = {
176
+ const _ = [];
177
+ return b && _.push(`width: ${b}px;`), w && _.push(`background-color: ${w};`), _.length > 0 && (k.style = _.join(" ")), h.render("td", O(k), l.children);
178
+ }, ie = (l, h) => {
179
+ const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...v } = l.attrs || {}, k = {
186
180
  ...v
187
181
  };
188
182
  d > 1 && (k.colspan = d), p > 1 && (k.rowspan = p);
189
- const T = [];
190
- return b && T.push(`width: ${b}px;`), w && T.push(`background-color: ${w};`), T.length > 0 && (k.style = T.join(" ")), h.render("th", O(k), a.children);
191
- }, ie = new Map([
192
- [g.DOCUMENT, u("")],
193
- [g.HEADING, y],
194
- [g.PARAGRAPH, u("p")],
195
- [g.UL_LIST, u("ul")],
196
- [g.OL_LIST, u("ol")],
197
- [g.LIST_ITEM, u("li")],
198
- [g.IMAGE, f],
199
- [g.EMOJI, _],
200
- [g.CODE_BLOCK, E],
201
- [g.HR, u("hr")],
202
- [g.BR, u("br")],
203
- [g.QUOTE, u("blockquote")],
204
- [g.COMPONENT, te],
205
- [W.TEXT, ee],
183
+ const _ = [];
184
+ return b && _.push(`width: ${b}px;`), w && _.push(`background-color: ${w};`), _.length > 0 && (k.style = _.join(" ")), h.render("th", O(k), l.children);
185
+ }, B = /* @__PURE__ */ new Map([
186
+ [g.DOCUMENT, i("")],
187
+ [g.HEADING, f],
188
+ [g.PARAGRAPH, i("p")],
189
+ [g.UL_LIST, i("ul")],
190
+ [g.OL_LIST, i("ol")],
191
+ [g.LIST_ITEM, i("li")],
192
+ [g.IMAGE, u],
193
+ [g.EMOJI, y],
194
+ [g.CODE_BLOCK, R],
195
+ [g.HR, i("hr")],
196
+ [g.BR, i("br")],
197
+ [g.QUOTE, i("blockquote")],
198
+ [g.COMPONENT, se],
199
+ [Q.TEXT, L],
206
200
  [$.LINK, U],
207
201
  [$.ANCHOR, U],
208
- [$.STYLED, R("span", !0)],
209
- [$.BOLD, R("strong")],
210
- [$.TEXT_STYLE, R("span", !0)],
211
- [$.ITALIC, R("em")],
212
- [$.UNDERLINE, R("u")],
213
- [$.STRIKE, R("s")],
214
- [$.CODE, R("code")],
215
- [$.SUPERSCRIPT, R("sup")],
216
- [$.SUBSCRIPT, R("sub")],
217
- [$.HIGHLIGHT, R("mark")],
218
- [g.TABLE, se],
219
- [g.TABLE_ROW, re],
220
- [g.TABLE_CELL, oe],
221
- [g.TABLE_HEADER, ne],
222
- ...Object.entries(r).map(([a, h]) => [a, h])
223
- ]);
224
- function C(a) {
225
- const h = ie.get(a.type);
202
+ [$.STYLED, T("span", !0)],
203
+ [$.BOLD, T("strong")],
204
+ [$.TEXT_STYLE, T("span", !0)],
205
+ [$.ITALIC, T("em")],
206
+ [$.UNDERLINE, T("u")],
207
+ [$.STRIKE, T("s")],
208
+ [$.CODE, T("code")],
209
+ [$.SUPERSCRIPT, T("sup")],
210
+ [$.SUBSCRIPT, T("sub")],
211
+ [$.HIGHLIGHT, T("mark")],
212
+ [g.TABLE, re],
213
+ [g.TABLE_ROW, oe],
214
+ [g.TABLE_CELL, ne],
215
+ [g.TABLE_HEADER, ie]
216
+ ]), M = new Map([
217
+ ...B,
218
+ ...Object.entries(r).map(([l, h]) => [l, h])
219
+ ]), ae = () => ({
220
+ render: (l, h = {}, d) => {
221
+ if (a && l) {
222
+ const p = e.get(l) || 0;
223
+ e.set(l, p + 1), h.key = `${l}-${p}`;
224
+ }
225
+ return t(l, h, d);
226
+ },
227
+ originalResolvers: B,
228
+ mergedResolvers: M
229
+ });
230
+ function C(l) {
231
+ const h = M.get(l.type);
226
232
  if (!h)
227
- return console.error("<Storyblok>", `No resolver found for node type ${a.type}`), "";
228
- const d = c();
229
- if (a.type === "text")
230
- return h(a, d);
231
- const p = a.content ? a.content.map(P) : void 0;
233
+ return console.error("<Storyblok>", `No resolver found for node type ${l.type}`), "";
234
+ const d = ae();
235
+ if (l.type === "text")
236
+ return h(l, d);
237
+ const p = l.content ? l.content.map(P) : void 0;
232
238
  return h({
233
- ...a,
239
+ ...l,
234
240
  children: p
235
241
  }, d);
236
242
  }
237
- function P(a) {
238
- return a.type === "doc" ? l ? a.content.map(C) : a.content.map(C).join("") : Array.isArray(a) ? a.map(C) : C(a);
243
+ function P(l) {
244
+ return l.type === "doc" ? c ? l.content.map(C) : l.content.map(C).join("") : Array.isArray(l) ? l.map(C) : C(l);
239
245
  }
240
246
  return {
241
247
  render: P
242
248
  };
243
249
  }
244
- let M = !1;
245
- const F = [], we = (s) => new Promise((e, t) => {
246
- if (typeof window > "u" || (window.storyblokRegisterEvent = (r) => {
250
+ let V = !1;
251
+ const z = [], Te = (s) => new Promise((e, t) => {
252
+ if (typeof window > "u") {
253
+ t(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
254
+ return;
255
+ }
256
+ if (window.storyblokRegisterEvent = (r) => {
247
257
  if (window.location === window.parent.location) {
248
258
  console.warn("You are not in Draft Mode or in the Visual Editor.");
249
259
  return;
250
260
  }
251
- M ? r() : F.push(r);
252
- }, document.getElementById("storyblok-javascript-bridge")))
261
+ V ? r() : z.push(r);
262
+ }, document.getElementById("storyblok-javascript-bridge")) {
263
+ e(void 0);
253
264
  return;
265
+ }
254
266
  const o = document.createElement("script");
255
267
  o.async = !0, o.src = s, o.id = "storyblok-javascript-bridge", o.onerror = (r) => t(r), o.onload = (r) => {
256
- F.forEach((n) => n()), M = !0, e(r);
268
+ z.forEach((n) => n()), V = !0, e(r);
257
269
  }, document.getElementsByTagName("head")[0].appendChild(o);
258
270
  });
259
- var Te = Object.defineProperty, _e = (s, e, t) => e in s ? Te(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, m = (s, e, t) => _e(s, typeof e != "symbol" ? e + "" : e, t);
260
- class Re extends Error {
271
+ var _e = Object.defineProperty, Re = (s, e, t) => e in s ? _e(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, m = (s, e, t) => Re(s, typeof e != "symbol" ? e + "" : e, t);
272
+ class $e extends Error {
261
273
  constructor(e) {
262
274
  super(e), this.name = "AbortError";
263
275
  }
264
276
  }
265
- function $e(s, e, t) {
277
+ function Ae(s, e, t) {
266
278
  if (!Number.isFinite(e))
267
279
  throw new TypeError("Expected `limit` to be a finite number");
268
280
  if (!Number.isFinite(t))
269
281
  throw new TypeError("Expected `interval` to be a finite number");
270
282
  const o = [];
271
- let r = [], n = 0, i = !1;
272
- const l = async () => {
283
+ let r = [], n = 0, a = !1;
284
+ const c = async () => {
273
285
  n++;
274
286
  const u = o.shift();
275
287
  if (u)
@@ -280,10 +292,10 @@ function $e(s, e, t) {
280
292
  u.reject(y);
281
293
  }
282
294
  const f = setTimeout(() => {
283
- n--, o.length > 0 && l(), r = r.filter((y) => y !== f);
295
+ n--, o.length > 0 && c(), r = r.filter((y) => y !== f);
284
296
  }, t);
285
297
  r.includes(f) || r.push(f);
286
- }, c = (...u) => i ? Promise.reject(
298
+ }, i = (...u) => a ? Promise.reject(
287
299
  new Error(
288
300
  "Throttled function is already aborted and not accepting new promises"
289
301
  )
@@ -292,22 +304,22 @@ function $e(s, e, t) {
292
304
  resolve: f,
293
305
  reject: y,
294
306
  args: u
295
- }), n < e && l();
307
+ }), n < e && c();
296
308
  });
297
- return c.abort = () => {
298
- i = !0, r.forEach(clearTimeout), r = [], o.forEach(
299
- (u) => u.reject(() => new Re("Throttle function aborted"))
309
+ return i.abort = () => {
310
+ a = !0, r.forEach(clearTimeout), r = [], o.forEach(
311
+ (u) => u.reject(() => new $e("Throttle function aborted"))
300
312
  ), o.length = 0;
301
- }, c;
313
+ }, i;
302
314
  }
303
- const Ae = (s = "") => s.includes("/cdn/"), Ee = (s, e = 25, t = 1) => ({
315
+ const Ee = (s = "") => s.includes("/cdn/"), Se = (s, e = 25, t = 1) => ({
304
316
  ...s,
305
317
  per_page: e,
306
318
  page: t
307
- }), Se = (s) => new Promise((e) => setTimeout(e, s)), Ie = (s = 0, e) => Array.from({ length: s }, e), Le = (s = 0, e = s) => {
319
+ }), Ie = (s) => new Promise((e) => setTimeout(e, s)), Le = (s = 0, e) => Array.from({ length: s }, e), Ce = (s = 0, e = s) => {
308
320
  const t = Math.abs(e - s) || 0, o = s < e ? 1 : -1;
309
- return Ie(t, (r, n) => n * o + s);
310
- }, Ce = async (s, e) => Promise.all(s.map(e)), Oe = (s = [], e) => s.map(e).reduce((t, o) => [...t, ...o], []), D = (s, e, t) => {
321
+ return Le(t, (r, n) => n * o + s);
322
+ }, Oe = async (s, e) => Promise.all(s.map(e)), je = (s = [], e) => s.map(e).reduce((t, o) => [...t, ...o], []), D = (s, e, t) => {
311
323
  const o = [];
312
324
  for (const r in s) {
313
325
  if (!Object.prototype.hasOwnProperty.call(s, r))
@@ -315,16 +327,16 @@ const Ae = (s = "") => s.includes("/cdn/"), Ee = (s, e = 25, t = 1) => ({
315
327
  const n = s[r];
316
328
  if (n == null)
317
329
  continue;
318
- const i = t ? "" : encodeURIComponent(r);
319
- let l;
320
- typeof n == "object" ? l = D(
330
+ const a = t ? "" : encodeURIComponent(r);
331
+ let c;
332
+ typeof n == "object" ? c = D(
321
333
  n,
322
- e ? e + encodeURIComponent(`[${i}]`) : i,
334
+ e ? e + encodeURIComponent(`[${a}]`) : a,
323
335
  Array.isArray(n)
324
- ) : l = `${e ? e + encodeURIComponent(`[${i}]`) : i}=${encodeURIComponent(n)}`, o.push(l);
336
+ ) : c = `${e ? e + encodeURIComponent(`[${a}]`) : a}=${encodeURIComponent(n)}`, o.push(c);
325
337
  }
326
338
  return o.join("&");
327
- }, V = (s) => {
339
+ }, G = (s) => {
328
340
  const e = {
329
341
  eu: "api.storyblok.com",
330
342
  us: "api-us.storyblok.com",
@@ -334,7 +346,7 @@ const Ae = (s = "") => s.includes("/cdn/"), Ee = (s, e = 25, t = 1) => ({
334
346
  };
335
347
  return e[s] ?? e.eu;
336
348
  };
337
- class je {
349
+ class xe {
338
350
  constructor(e) {
339
351
  m(this, "baseURL"), m(this, "timeout"), m(this, "headers"), m(this, "responseInterceptor"), m(this, "fetch"), m(this, "ejectInterceptor"), m(this, "url"), m(this, "parameters"), m(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 = {};
340
352
  }
@@ -373,25 +385,25 @@ class je {
373
385
  async _methodHandler(e) {
374
386
  let t = `${this.baseURL}${this.url}`, o = null;
375
387
  e === "get" ? t = `${this.baseURL}${this.url}?${D(this.parameters)}` : o = JSON.stringify(this.parameters);
376
- const r = new URL(t), n = new AbortController(), { signal: i } = n;
377
- let l;
378
- this.timeout && (l = setTimeout(() => n.abort(), this.timeout));
388
+ const r = new URL(t), n = new AbortController(), { signal: a } = n;
389
+ let c;
390
+ this.timeout && (c = setTimeout(() => n.abort(), this.timeout));
379
391
  try {
380
- const c = await this.fetch(`${r}`, {
392
+ const i = await this.fetch(`${r}`, {
381
393
  method: e,
382
394
  headers: this.headers,
383
395
  body: o,
384
- signal: i,
396
+ signal: a,
385
397
  ...this.fetchOptions
386
398
  });
387
- this.timeout && clearTimeout(l);
399
+ this.timeout && clearTimeout(c);
388
400
  const u = await this._responseHandler(
389
- c
401
+ i
390
402
  );
391
403
  return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(u)) : this._statusHandler(u);
392
- } catch (c) {
404
+ } catch (i) {
393
405
  return {
394
- message: c
406
+ message: i
395
407
  };
396
408
  }
397
409
  }
@@ -437,16 +449,16 @@ class je {
437
449
  });
438
450
  }
439
451
  }
440
- const z = "SB-Agent", H = {
452
+ const q = "SB-Agent", H = {
441
453
  defaultAgentName: "SB-JS-CLIENT",
442
454
  defaultAgentVersion: "SB-Agent-Version",
443
455
  packageVersion: "6.0.0"
444
- }, xe = {
456
+ }, Pe = {
445
457
  DRAFT: "draft"
446
458
  };
447
459
  let j = {};
448
460
  const A = {};
449
- class Pe {
461
+ class Ne {
450
462
  /**
451
463
  *
452
464
  * @param config ISbConfig interface
@@ -456,22 +468,22 @@ class Pe {
456
468
  m(this, "client"), m(this, "maxRetries"), m(this, "retriesDelay"), m(this, "throttle"), m(this, "accessToken"), m(this, "cache"), m(this, "resolveCounter"), m(this, "relations"), m(this, "links"), m(this, "version"), m(this, "richTextResolver"), m(this, "resolveNestedRelations"), m(this, "stringifiedStoriesCache"), m(this, "inlineAssets");
457
469
  let o = e.endpoint || t;
458
470
  if (!o) {
459
- const i = e.https === !1 ? "http" : "https";
460
- e.oauthToken ? o = `${i}://${V(e.region)}/v1` : o = `${i}://${V(e.region)}/v2`;
471
+ const a = e.https === !1 ? "http" : "https";
472
+ e.oauthToken ? o = `${a}://${G(e.region)}/v1` : o = `${a}://${G(e.region)}/v2`;
461
473
  }
462
474
  const r = new Headers();
463
- 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(([i, l]) => {
464
- r.set(i, l);
465
- }), r.has(z) || (r.set(z, H.defaultAgentName), r.set(
475
+ 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(([a, c]) => {
476
+ r.set(a, c);
477
+ }), r.has(q) || (r.set(q, H.defaultAgentName), r.set(
466
478
  H.defaultAgentVersion,
467
479
  H.packageVersion
468
480
  ));
469
481
  let n = 5;
470
- e.oauthToken && (r.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = $e(
482
+ e.oauthToken && (r.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Ae(
471
483
  this.throttledRequest.bind(this),
472
484
  n,
473
485
  1e3
474
- ), 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 || xe.DRAFT, this.inlineAssets = e.inlineAssets || !1, this.client = new je({
486
+ ), 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 || Pe.DRAFT, this.inlineAssets = e.inlineAssets || !1, this.client = new xe({
475
487
  baseURL: o,
476
488
  timeout: e.timeout || 0,
477
489
  headers: r,
@@ -483,14 +495,14 @@ class Pe {
483
495
  return e.token || (e.token = this.getToken()), e.cv || (e.cv = A[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
484
496
  }
485
497
  factoryParamOptions(e, t) {
486
- return Ae(e) ? this.parseParams(t) : t;
498
+ return Ee(e) ? this.parseParams(t) : t;
487
499
  }
488
500
  makeRequest(e, t, o, r, n) {
489
- const i = this.factoryParamOptions(
501
+ const a = this.factoryParamOptions(
490
502
  e,
491
- Ee(t, o, r)
503
+ Se(t, o, r)
492
504
  );
493
- return this.cacheResponse(e, i, void 0, n);
505
+ return this.cacheResponse(e, a, void 0, n);
494
506
  }
495
507
  get(e, t = {}, o) {
496
508
  t || (t = {});
@@ -500,19 +512,19 @@ class Pe {
500
512
  return this.cacheResponse(r, n, void 0, o);
501
513
  }
502
514
  async getAll(e, t = {}, o, r) {
503
- const n = (t == null ? void 0 : t.per_page) || 25, i = `/${e}`.replace(/\/$/, ""), l = o ?? i.substring(i.lastIndexOf("/") + 1);
515
+ const n = (t == null ? void 0 : t.per_page) || 25, a = `/${e}`.replace(/\/$/, ""), c = o ?? a.substring(a.lastIndexOf("/") + 1);
504
516
  t.version = t.version || this.version;
505
- const c = 1, u = await this.makeRequest(
506
- i,
517
+ const i = 1, u = await this.makeRequest(
518
+ a,
507
519
  t,
508
520
  n,
509
- c,
521
+ i,
510
522
  r
511
- ), f = u.total ? Math.ceil(u.total / n) : 1, y = await Ce(
512
- Le(c, f),
513
- (_) => this.makeRequest(i, t, n, _ + 1, r)
523
+ ), f = u.total ? Math.ceil(u.total / n) : 1, y = await Oe(
524
+ Ce(i, f),
525
+ (R) => this.makeRequest(a, t, n, R + 1, r)
514
526
  );
515
- return Oe([u, ...y], (_) => Object.values(_.data[l]));
527
+ return je([u, ...y], (R) => Object.values(R.data[c]));
516
528
  }
517
529
  post(e, t = {}, o) {
518
530
  const r = `/${e}`;
@@ -592,7 +604,7 @@ class Pe {
592
604
  * allowing flexible specification of relation patterns.
593
605
  */
594
606
  _insertRelations(e, t, o, r) {
595
- if (Array.isArray(o) ? o.find((i) => i.endsWith(`.${t}`)) : o.endsWith(`.${t}`)) {
607
+ if (Array.isArray(o) ? o.find((a) => a.endsWith(`.${t}`)) : o.endsWith(`.${t}`)) {
596
608
  this._resolveField(e, t, r);
597
609
  return;
598
610
  }
@@ -606,14 +618,14 @@ class Pe {
606
618
  * @param resolveId - The unique identifier for the current resolution context
607
619
  */
608
620
  iterateTree(e, t, o) {
609
- const r = (n, i = "") => {
621
+ const r = (n, a = "") => {
610
622
  if (!(!n || n._stopResolving)) {
611
623
  if (Array.isArray(n))
612
- n.forEach((l, c) => r(l, `${i}[${c}]`));
624
+ n.forEach((c, i) => r(c, `${a}[${i}]`));
613
625
  else if (typeof n == "object")
614
- for (const l in n) {
615
- const c = i ? `${i}.${l}` : l;
616
- (n.component && n._uid || n.type === "link") && (this._insertRelations(n, l, t, o), this._insertLinks(n, l, o)), r(n[l], c);
626
+ for (const c in n) {
627
+ const i = a ? `${a}.${c}` : c;
628
+ (n.component && n._uid || n.type === "link") && (this._insertRelations(n, c, t, o), this._insertLinks(n, c, o)), r(n[c], i);
617
629
  }
618
630
  }
619
631
  };
@@ -622,18 +634,18 @@ class Pe {
622
634
  async resolveLinks(e, t, o) {
623
635
  let r = [];
624
636
  if (e.link_uuids) {
625
- const n = e.link_uuids.length, i = [], l = 50;
626
- for (let c = 0; c < n; c += l) {
627
- const u = Math.min(n, c + l);
628
- i.push(e.link_uuids.slice(c, u));
637
+ const n = e.link_uuids.length, a = [], c = 50;
638
+ for (let i = 0; i < n; i += c) {
639
+ const u = Math.min(n, i + c);
640
+ a.push(e.link_uuids.slice(i, u));
629
641
  }
630
- for (let c = 0; c < i.length; c++)
642
+ for (let i = 0; i < a.length; i++)
631
643
  (await this.getStories({
632
- per_page: l,
644
+ per_page: c,
633
645
  language: t.language,
634
646
  version: t.version,
635
647
  starts_with: t.starts_with,
636
- by_uuids: i[c].join(",")
648
+ by_uuids: a[i].join(",")
637
649
  })).data.stories.forEach(
638
650
  (u) => {
639
651
  r.push(u);
@@ -651,18 +663,18 @@ class Pe {
651
663
  async resolveRelations(e, t, o) {
652
664
  let r = [];
653
665
  if (e.rel_uuids) {
654
- const n = e.rel_uuids.length, i = [], l = 50;
655
- for (let c = 0; c < n; c += l) {
656
- const u = Math.min(n, c + l);
657
- i.push(e.rel_uuids.slice(c, u));
666
+ const n = e.rel_uuids.length, a = [], c = 50;
667
+ for (let i = 0; i < n; i += c) {
668
+ const u = Math.min(n, i + c);
669
+ a.push(e.rel_uuids.slice(i, u));
658
670
  }
659
- for (let c = 0; c < i.length; c++)
671
+ for (let i = 0; i < a.length; i++)
660
672
  (await this.getStories({
661
- per_page: l,
673
+ per_page: c,
662
674
  language: t.language,
663
675
  version: t.version,
664
676
  starts_with: t.starts_with,
665
- by_uuids: i[c].join(","),
677
+ by_uuids: a[i].join(","),
666
678
  excluding_fields: t.excluding_fields
667
679
  })).data.stories.forEach((u) => {
668
680
  r.push(u);
@@ -688,26 +700,26 @@ class Pe {
688
700
  */
689
701
  async resolveStories(e, t, o) {
690
702
  var r, n;
691
- let i = [];
692
- if (this.links[o] = {}, this.relations[o] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (i = t.resolve_relations.split(",")), await this.resolveRelations(e, t, o)), t.resolve_links && ["1", "story", "url", "link"].includes(t.resolve_links) && ((r = e.links) != null && r.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t, o), this.resolveNestedRelations)
693
- for (const l in this.relations[o])
703
+ let a = [];
704
+ if (this.links[o] = {}, this.relations[o] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (a = t.resolve_relations.split(",")), await this.resolveRelations(e, t, o)), t.resolve_links && ["1", "story", "url", "link"].includes(t.resolve_links) && ((r = e.links) != null && r.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t, o), this.resolveNestedRelations)
705
+ for (const c in this.relations[o])
694
706
  this.iterateTree(
695
- this.relations[o][l],
696
- i,
707
+ this.relations[o][c],
708
+ a,
697
709
  o
698
710
  );
699
- e.story ? this.iterateTree(e.story, i, o) : e.stories.forEach((l) => {
700
- this.iterateTree(l, i, o);
711
+ e.story ? this.iterateTree(e.story, a, o) : e.stories.forEach((c) => {
712
+ this.iterateTree(c, a, o);
701
713
  }), this.stringifiedStoriesCache = {}, delete this.links[o], delete this.relations[o];
702
714
  }
703
715
  async cacheResponse(e, t, o, r) {
704
- const n = D({ url: e, params: t }), i = this.cacheProvider();
716
+ const n = D({ url: e, params: t }), a = this.cacheProvider();
705
717
  if (t.version === "published" && e !== "/cdn/spaces/me") {
706
- const l = await i.get(n);
707
- if (l)
708
- return Promise.resolve(l);
718
+ const c = await a.get(n);
719
+ if (c)
720
+ return Promise.resolve(c);
709
721
  }
710
- return new Promise(async (l, c) => {
722
+ return new Promise(async (c, i) => {
711
723
  var u;
712
724
  try {
713
725
  const f = await this.throttle(
@@ -717,24 +729,24 @@ class Pe {
717
729
  r
718
730
  );
719
731
  if (f.status !== 200)
720
- return c(f);
732
+ return i(f);
721
733
  let y = { data: f.data, headers: f.headers };
722
734
  if ((u = f.headers) != null && u["per-page"] && (y = Object.assign({}, y, {
723
735
  perPage: f.headers["per-page"] ? Number.parseInt(f.headers["per-page"]) : 0,
724
736
  total: f.headers["per-page"] ? Number.parseInt(f.headers.total) : 0
725
737
  })), y.data.story || y.data.stories) {
726
- const E = this.resolveCounter = ++this.resolveCounter % 1e3;
727
- await this.resolveStories(y.data, t, `${E}`), y = await this.processInlineAssets(y);
738
+ const T = this.resolveCounter = ++this.resolveCounter % 1e3;
739
+ await this.resolveStories(y.data, t, `${T}`), y = await this.processInlineAssets(y);
728
740
  }
729
- t.version === "published" && e !== "/cdn/spaces/me" && await i.set(n, y);
730
- const _ = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
731
- return t.token && y.data.cv && (_ && A[t.token] && A[t.token] !== y.data.cv && await this.flushCache(), A[t.token] = y.data.cv), l(y);
741
+ t.version === "published" && e !== "/cdn/spaces/me" && await a.set(n, y);
742
+ const R = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
743
+ return t.token && y.data.cv && (R && A[t.token] && A[t.token] !== y.data.cv && await this.flushCache(), A[t.token] = y.data.cv), c(y);
732
744
  } catch (f) {
733
745
  if (f.response && f.status === 429 && (o = typeof o > "u" ? 0 : o + 1, o < this.maxRetries))
734
746
  return console.log(
735
747
  `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
736
- ), await Se(this.retriesDelay), this.cacheResponse(e, t, o).then(l).catch(c);
737
- c(f);
748
+ ), await Ie(this.retriesDelay), this.cacheResponse(e, t, o).then(c).catch(i);
749
+ i(f);
738
750
  }
739
751
  });
740
752
  }
@@ -813,7 +825,7 @@ class Pe {
813
825
  return e.data.story && (e.data.story.content = t(e.data.story.content)), e.data.stories && (e.data.stories = e.data.stories.map((o) => (o.content = t(o.content), o))), e;
814
826
  }
815
827
  }
816
- const ze = (s = {}) => {
828
+ const Ge = (s = {}) => {
817
829
  const { apiOptions: e } = s;
818
830
  if (!e || !e.accessToken) {
819
831
  console.error(
@@ -821,8 +833,8 @@ const ze = (s = {}) => {
821
833
  );
822
834
  return;
823
835
  }
824
- return { storyblokApi: new Pe(e) };
825
- }, Ne = (s) => {
836
+ return { storyblokApi: new Ne(e) };
837
+ }, He = (s) => {
826
838
  if (typeof s != "object" || typeof s._editable > "u")
827
839
  return {};
828
840
  try {
@@ -837,46 +849,46 @@ const ze = (s = {}) => {
837
849
  return {};
838
850
  }
839
851
  };
840
- let G = "https://app.storyblok.com/f/storyblok-v2-latest.js";
841
- const He = (s, e, t = {}) => {
852
+ let J = "https://app.storyblok.com/f/storyblok-v2-latest.js";
853
+ const De = (s, e, t = {}) => {
842
854
  var o;
843
855
  const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = new URL((o = window.location) == null ? void 0 : o.href).searchParams.get(
844
856
  "_storyblok"
845
- ), i = n !== null && +n === s;
846
- if (!(!r || !i)) {
857
+ ), a = n !== null && +n === s;
858
+ if (!(!r || !a)) {
847
859
  if (!s) {
848
860
  console.warn("Story ID is not defined. Please provide a valid ID.");
849
861
  return;
850
862
  }
851
863
  window.storyblokRegisterEvent(() => {
852
- new window.StoryblokBridge(t).on(["input", "published", "change"], (l) => {
853
- var c;
854
- l && (l.action === "input" && ((c = l.story) == null ? void 0 : c.id) === s ? e(l.story) : (l.action === "change" || l.action === "published") && l.storyId === s && window.location.reload());
864
+ new window.StoryblokBridge(t).on(["input", "published", "change"], (c) => {
865
+ var i;
866
+ c && (c.action === "input" && ((i = c.story) == null ? void 0 : i.id) === s ? e(c.story) : (c.action === "change" || c.action === "published") && c.storyId === s && window.location.reload());
855
867
  });
856
868
  });
857
869
  }
858
- }, De = (s = {}) => {
870
+ }, Ue = (s = {}) => {
859
871
  var e, t;
860
872
  const {
861
873
  bridge: o,
862
874
  accessToken: r,
863
875
  use: n = [],
864
- apiOptions: i = {},
865
- bridgeUrl: l
876
+ apiOptions: a = {},
877
+ bridgeUrl: c
866
878
  } = s;
867
- i.accessToken = i.accessToken || r;
868
- const c = { bridge: o, apiOptions: i };
879
+ a.accessToken = a.accessToken || r;
880
+ const i = { bridge: o, apiOptions: a };
869
881
  let u = {};
870
882
  n.forEach((y) => {
871
- u = { ...u, ...y(c) };
872
- }), l && (G = l);
883
+ u = { ...u, ...y(i) };
884
+ }), c && (J = c);
873
885
  const f = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
874
- return o !== !1 && f && we(G), u;
886
+ return o !== !1 && f && Te(J), u;
875
887
  };
876
- function Ge(s, e) {
877
- return X(e).render(s);
888
+ function qe(s, e) {
889
+ return Z(e).render(s);
878
890
  }
879
- const Q = /* @__PURE__ */ q({
891
+ const ee = /* @__PURE__ */ K({
880
892
  __name: "StoryblokComponent",
881
893
  props: {
882
894
  blok: {}
@@ -886,20 +898,20 @@ const Q = /* @__PURE__ */ q({
886
898
  e({
887
899
  value: o
888
900
  });
889
- const r = typeof N(t.blok.component) != "string", n = ue("VueSDKOptions"), i = x(t.blok.component);
890
- return !r && n && (n.enableFallbackComponent ? (i.value = n.customFallbackComponent ?? "FallbackComponent", typeof N(i.value) == "string" && console.error(
891
- `Is the Fallback component "${i.value}" registered properly?`
901
+ const r = typeof N(t.blok.component) != "string", n = he("VueSDKOptions"), a = x(t.blok.component);
902
+ return !r && n && (n.enableFallbackComponent ? (a.value = n.customFallbackComponent ?? "FallbackComponent", typeof N(a.value) == "string" && console.error(
903
+ `Is the Fallback component "${a.value}" registered properly?`
892
904
  )) : console.error(
893
905
  `Component could not be found for blok "${t.blok.component}"! Is it defined in main.ts as "app.component("${t.blok.component}", ${t.blok.component});"?`
894
- )), (l, c) => (K(), J(N(i.value), he({
906
+ )), (c, i) => (W(), Y(N(a.value), de({
895
907
  ref_key: "blokRef",
896
908
  ref: o
897
- }, { ...l.$props, ...l.$attrs }), null, 16));
909
+ }, { ...c.$props, ...c.$attrs }), null, 16));
898
910
  }
899
- }), Ue = (s) => {
911
+ }), Be = (s) => {
900
912
  var e, t;
901
- return Y(
902
- Q,
913
+ return X(
914
+ ee,
903
915
  {
904
916
  blok: (e = s == null ? void 0 : s.attrs) == null ? void 0 : e.body[0],
905
917
  id: (t = s.attrs) == null ? void 0 : t.id
@@ -907,21 +919,21 @@ const Q = /* @__PURE__ */ q({
907
919
  s.children
908
920
  );
909
921
  };
910
- function Be(s) {
922
+ function Me(s) {
911
923
  const e = {
912
- renderFn: Y,
924
+ renderFn: X,
913
925
  // TODO: Check why this changed.
914
926
  // @ts-expect-error - createTextVNode types has been recently changed.
915
- textFn: de,
927
+ textFn: pe,
916
928
  keyedResolvers: !0,
917
929
  resolvers: {
918
- [g.COMPONENT]: Ue,
930
+ [g.COMPONENT]: Be,
919
931
  ...s.resolvers
920
932
  }
921
933
  };
922
- return X(e);
934
+ return Z(e);
923
935
  }
924
- const Me = /* @__PURE__ */ q({
936
+ const Fe = /* @__PURE__ */ K({
925
937
  __name: "StoryblokRichText",
926
938
  props: {
927
939
  doc: {},
@@ -929,67 +941,67 @@ const Me = /* @__PURE__ */ q({
929
941
  },
930
942
  setup(s) {
931
943
  const e = s, t = x(), o = () => t.value;
932
- return pe([() => e.doc, () => e.resolvers], ([r, n]) => {
933
- const { render: i } = Be({
944
+ return fe([() => e.doc, () => e.resolvers], ([r, n]) => {
945
+ const { render: a } = Me({
934
946
  resolvers: n ?? {}
935
947
  });
936
- t.value = i(r);
948
+ t.value = a(r);
937
949
  }, {
938
950
  immediate: !0,
939
951
  deep: !0
940
- }), (r, n) => (K(), J(o));
952
+ }), (r, n) => (W(), Y(o));
941
953
  }
942
- }), Fe = {
954
+ }), Ve = {
943
955
  beforeMount(s, e) {
944
956
  if (e.value) {
945
- const t = Ne(e.value);
957
+ const t = He(e.value);
946
958
  Object.keys(t).length > 0 && (s.setAttribute("data-blok-c", t["data-blok-c"]), s.setAttribute("data-blok-uid", t["data-blok-uid"]), s.classList.add("storyblok__outline"));
947
959
  }
948
960
  }
949
- }, Z = (s) => {
961
+ }, te = (s) => {
950
962
  console.error(`You can't use ${s} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
951
963
  `);
952
964
  };
953
- let L = null;
954
- const qe = () => (L || Z("useStoryblokApi"), L), Je = async (s, e = {}, t = {}) => {
965
+ let I = null;
966
+ const Je = () => (I || te("useStoryblokApi"), I), Ke = async (s, e = {}, t = {}) => {
955
967
  const o = x(null);
956
- if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, fe(() => {
957
- o.value && o.value.id && He(
968
+ if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, ye(() => {
969
+ o.value && o.value.id && De(
958
970
  o.value.id,
959
971
  (r) => o.value = r,
960
972
  t
961
973
  );
962
- }), L) {
963
- const { data: r } = await L.get(
974
+ }), I) {
975
+ const { data: r } = await I.get(
964
976
  `cdn/stories/${s}`,
965
977
  e
966
978
  );
967
979
  o.value = r.story;
968
980
  } else
969
- Z("useStoryblok");
981
+ te("useStoryblok");
970
982
  return o;
971
- }, Ke = {
983
+ }, Ye = {
972
984
  install(s, e = {}) {
973
- s.directive("editable", Fe), s.component("StoryblokComponent", Q), s.component("StoryblokRichText", Me), e.enableFallbackComponent && !e.customFallbackComponent && s.component(
985
+ s.directive("editable", Ve), s.component("StoryblokComponent", ee), s.component("StoryblokRichText", Fe), e.enableFallbackComponent && !e.customFallbackComponent && s.component(
974
986
  "FallbackComponent",
975
- ye(() => import("./FallbackComponent-Dky11gEu.js"))
987
+ me(() => import("./FallbackComponent-Dky11gEu.js"))
976
988
  );
977
- const { storyblokApi: t } = De(e);
978
- L = t || null, s.provide("VueSDKOptions", e);
989
+ const { storyblokApi: t } = Ue(e);
990
+ I = t || null, s.provide("VueSDKOptions", e);
979
991
  }
980
992
  };
981
993
  export {
982
994
  g as BlockTypes,
983
995
  $ as MarkTypes,
984
- Q as StoryblokComponent,
985
- Me as StoryblokRichText,
986
- Ke as StoryblokVue,
987
- W as TextTypes,
988
- ze as apiPlugin,
989
- Ge as renderRichText,
990
- X as richTextResolver,
991
- Je as useStoryblok,
992
- qe as useStoryblokApi,
993
- He as useStoryblokBridge,
994
- Be as useStoryblokRichText
996
+ ee as StoryblokComponent,
997
+ Fe as StoryblokRichText,
998
+ Ye as StoryblokVue,
999
+ Q as TextTypes,
1000
+ Ge as apiPlugin,
1001
+ qe as renderRichText,
1002
+ Z as richTextResolver,
1003
+ Ke as useStoryblok,
1004
+ Je as useStoryblokApi,
1005
+ De as useStoryblokBridge,
1006
+ Me as useStoryblokRichText
995
1007
  };