@storyblok/vue 9.0.0 → 9.0.1

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,128 @@ 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) => {
250
+ let V = !1;
251
+ const z = [], Te = (s) => new Promise((e, t) => {
246
252
  if (typeof window > "u" || (window.storyblokRegisterEvent = (r) => {
247
253
  if (window.location === window.parent.location) {
248
254
  console.warn("You are not in Draft Mode or in the Visual Editor.");
249
255
  return;
250
256
  }
251
- M ? r() : F.push(r);
257
+ V ? r() : z.push(r);
252
258
  }, document.getElementById("storyblok-javascript-bridge")))
253
259
  return;
254
260
  const o = document.createElement("script");
255
261
  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);
262
+ z.forEach((n) => n()), V = !0, e(r);
257
263
  }, document.getElementsByTagName("head")[0].appendChild(o);
258
264
  });
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 {
265
+ 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);
266
+ class $e extends Error {
261
267
  constructor(e) {
262
268
  super(e), this.name = "AbortError";
263
269
  }
264
270
  }
265
- function $e(s, e, t) {
271
+ function Ae(s, e, t) {
266
272
  if (!Number.isFinite(e))
267
273
  throw new TypeError("Expected `limit` to be a finite number");
268
274
  if (!Number.isFinite(t))
269
275
  throw new TypeError("Expected `interval` to be a finite number");
270
276
  const o = [];
271
- let r = [], n = 0, i = !1;
272
- const l = async () => {
277
+ let r = [], n = 0, a = !1;
278
+ const c = async () => {
273
279
  n++;
274
280
  const u = o.shift();
275
281
  if (u)
@@ -280,10 +286,10 @@ function $e(s, e, t) {
280
286
  u.reject(y);
281
287
  }
282
288
  const f = setTimeout(() => {
283
- n--, o.length > 0 && l(), r = r.filter((y) => y !== f);
289
+ n--, o.length > 0 && c(), r = r.filter((y) => y !== f);
284
290
  }, t);
285
291
  r.includes(f) || r.push(f);
286
- }, c = (...u) => i ? Promise.reject(
292
+ }, i = (...u) => a ? Promise.reject(
287
293
  new Error(
288
294
  "Throttled function is already aborted and not accepting new promises"
289
295
  )
@@ -292,22 +298,22 @@ function $e(s, e, t) {
292
298
  resolve: f,
293
299
  reject: y,
294
300
  args: u
295
- }), n < e && l();
301
+ }), n < e && c();
296
302
  });
297
- return c.abort = () => {
298
- i = !0, r.forEach(clearTimeout), r = [], o.forEach(
299
- (u) => u.reject(() => new Re("Throttle function aborted"))
303
+ return i.abort = () => {
304
+ a = !0, r.forEach(clearTimeout), r = [], o.forEach(
305
+ (u) => u.reject(() => new $e("Throttle function aborted"))
300
306
  ), o.length = 0;
301
- }, c;
307
+ }, i;
302
308
  }
303
- const Ae = (s = "") => s.includes("/cdn/"), Ee = (s, e = 25, t = 1) => ({
309
+ const Ee = (s = "") => s.includes("/cdn/"), Se = (s, e = 25, t = 1) => ({
304
310
  ...s,
305
311
  per_page: e,
306
312
  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) => {
313
+ }), Ie = (s) => new Promise((e) => setTimeout(e, s)), Le = (s = 0, e) => Array.from({ length: s }, e), Ce = (s = 0, e = s) => {
308
314
  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) => {
315
+ return Le(t, (r, n) => n * o + s);
316
+ }, 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
317
  const o = [];
312
318
  for (const r in s) {
313
319
  if (!Object.prototype.hasOwnProperty.call(s, r))
@@ -315,16 +321,16 @@ const Ae = (s = "") => s.includes("/cdn/"), Ee = (s, e = 25, t = 1) => ({
315
321
  const n = s[r];
316
322
  if (n == null)
317
323
  continue;
318
- const i = t ? "" : encodeURIComponent(r);
319
- let l;
320
- typeof n == "object" ? l = D(
324
+ const a = t ? "" : encodeURIComponent(r);
325
+ let c;
326
+ typeof n == "object" ? c = D(
321
327
  n,
322
- e ? e + encodeURIComponent(`[${i}]`) : i,
328
+ e ? e + encodeURIComponent(`[${a}]`) : a,
323
329
  Array.isArray(n)
324
- ) : l = `${e ? e + encodeURIComponent(`[${i}]`) : i}=${encodeURIComponent(n)}`, o.push(l);
330
+ ) : c = `${e ? e + encodeURIComponent(`[${a}]`) : a}=${encodeURIComponent(n)}`, o.push(c);
325
331
  }
326
332
  return o.join("&");
327
- }, V = (s) => {
333
+ }, G = (s) => {
328
334
  const e = {
329
335
  eu: "api.storyblok.com",
330
336
  us: "api-us.storyblok.com",
@@ -334,7 +340,7 @@ const Ae = (s = "") => s.includes("/cdn/"), Ee = (s, e = 25, t = 1) => ({
334
340
  };
335
341
  return e[s] ?? e.eu;
336
342
  };
337
- class je {
343
+ class xe {
338
344
  constructor(e) {
339
345
  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
346
  }
@@ -373,25 +379,25 @@ class je {
373
379
  async _methodHandler(e) {
374
380
  let t = `${this.baseURL}${this.url}`, o = null;
375
381
  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));
382
+ const r = new URL(t), n = new AbortController(), { signal: a } = n;
383
+ let c;
384
+ this.timeout && (c = setTimeout(() => n.abort(), this.timeout));
379
385
  try {
380
- const c = await this.fetch(`${r}`, {
386
+ const i = await this.fetch(`${r}`, {
381
387
  method: e,
382
388
  headers: this.headers,
383
389
  body: o,
384
- signal: i,
390
+ signal: a,
385
391
  ...this.fetchOptions
386
392
  });
387
- this.timeout && clearTimeout(l);
393
+ this.timeout && clearTimeout(c);
388
394
  const u = await this._responseHandler(
389
- c
395
+ i
390
396
  );
391
397
  return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(u)) : this._statusHandler(u);
392
- } catch (c) {
398
+ } catch (i) {
393
399
  return {
394
- message: c
400
+ message: i
395
401
  };
396
402
  }
397
403
  }
@@ -437,16 +443,16 @@ class je {
437
443
  });
438
444
  }
439
445
  }
440
- const z = "SB-Agent", H = {
446
+ const q = "SB-Agent", H = {
441
447
  defaultAgentName: "SB-JS-CLIENT",
442
448
  defaultAgentVersion: "SB-Agent-Version",
443
449
  packageVersion: "6.0.0"
444
- }, xe = {
450
+ }, Pe = {
445
451
  DRAFT: "draft"
446
452
  };
447
453
  let j = {};
448
454
  const A = {};
449
- class Pe {
455
+ class Ne {
450
456
  /**
451
457
  *
452
458
  * @param config ISbConfig interface
@@ -456,22 +462,22 @@ class Pe {
456
462
  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
463
  let o = e.endpoint || t;
458
464
  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`;
465
+ const a = e.https === !1 ? "http" : "https";
466
+ e.oauthToken ? o = `${a}://${G(e.region)}/v1` : o = `${a}://${G(e.region)}/v2`;
461
467
  }
462
468
  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(
469
+ 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]) => {
470
+ r.set(a, c);
471
+ }), r.has(q) || (r.set(q, H.defaultAgentName), r.set(
466
472
  H.defaultAgentVersion,
467
473
  H.packageVersion
468
474
  ));
469
475
  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(
476
+ 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
477
  this.throttledRequest.bind(this),
472
478
  n,
473
479
  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({
480
+ ), 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
481
  baseURL: o,
476
482
  timeout: e.timeout || 0,
477
483
  headers: r,
@@ -483,14 +489,14 @@ class Pe {
483
489
  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
490
  }
485
491
  factoryParamOptions(e, t) {
486
- return Ae(e) ? this.parseParams(t) : t;
492
+ return Ee(e) ? this.parseParams(t) : t;
487
493
  }
488
494
  makeRequest(e, t, o, r, n) {
489
- const i = this.factoryParamOptions(
495
+ const a = this.factoryParamOptions(
490
496
  e,
491
- Ee(t, o, r)
497
+ Se(t, o, r)
492
498
  );
493
- return this.cacheResponse(e, i, void 0, n);
499
+ return this.cacheResponse(e, a, void 0, n);
494
500
  }
495
501
  get(e, t = {}, o) {
496
502
  t || (t = {});
@@ -500,19 +506,19 @@ class Pe {
500
506
  return this.cacheResponse(r, n, void 0, o);
501
507
  }
502
508
  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);
509
+ const n = (t == null ? void 0 : t.per_page) || 25, a = `/${e}`.replace(/\/$/, ""), c = o ?? a.substring(a.lastIndexOf("/") + 1);
504
510
  t.version = t.version || this.version;
505
- const c = 1, u = await this.makeRequest(
506
- i,
511
+ const i = 1, u = await this.makeRequest(
512
+ a,
507
513
  t,
508
514
  n,
509
- c,
515
+ i,
510
516
  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)
517
+ ), f = u.total ? Math.ceil(u.total / n) : 1, y = await Oe(
518
+ Ce(i, f),
519
+ (R) => this.makeRequest(a, t, n, R + 1, r)
514
520
  );
515
- return Oe([u, ...y], (_) => Object.values(_.data[l]));
521
+ return je([u, ...y], (R) => Object.values(R.data[c]));
516
522
  }
517
523
  post(e, t = {}, o) {
518
524
  const r = `/${e}`;
@@ -592,7 +598,7 @@ class Pe {
592
598
  * allowing flexible specification of relation patterns.
593
599
  */
594
600
  _insertRelations(e, t, o, r) {
595
- if (Array.isArray(o) ? o.find((i) => i.endsWith(`.${t}`)) : o.endsWith(`.${t}`)) {
601
+ if (Array.isArray(o) ? o.find((a) => a.endsWith(`.${t}`)) : o.endsWith(`.${t}`)) {
596
602
  this._resolveField(e, t, r);
597
603
  return;
598
604
  }
@@ -606,14 +612,14 @@ class Pe {
606
612
  * @param resolveId - The unique identifier for the current resolution context
607
613
  */
608
614
  iterateTree(e, t, o) {
609
- const r = (n, i = "") => {
615
+ const r = (n, a = "") => {
610
616
  if (!(!n || n._stopResolving)) {
611
617
  if (Array.isArray(n))
612
- n.forEach((l, c) => r(l, `${i}[${c}]`));
618
+ n.forEach((c, i) => r(c, `${a}[${i}]`));
613
619
  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);
620
+ for (const c in n) {
621
+ const i = a ? `${a}.${c}` : c;
622
+ (n.component && n._uid || n.type === "link") && (this._insertRelations(n, c, t, o), this._insertLinks(n, c, o)), r(n[c], i);
617
623
  }
618
624
  }
619
625
  };
@@ -622,18 +628,18 @@ class Pe {
622
628
  async resolveLinks(e, t, o) {
623
629
  let r = [];
624
630
  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));
631
+ const n = e.link_uuids.length, a = [], c = 50;
632
+ for (let i = 0; i < n; i += c) {
633
+ const u = Math.min(n, i + c);
634
+ a.push(e.link_uuids.slice(i, u));
629
635
  }
630
- for (let c = 0; c < i.length; c++)
636
+ for (let i = 0; i < a.length; i++)
631
637
  (await this.getStories({
632
- per_page: l,
638
+ per_page: c,
633
639
  language: t.language,
634
640
  version: t.version,
635
641
  starts_with: t.starts_with,
636
- by_uuids: i[c].join(",")
642
+ by_uuids: a[i].join(",")
637
643
  })).data.stories.forEach(
638
644
  (u) => {
639
645
  r.push(u);
@@ -651,18 +657,18 @@ class Pe {
651
657
  async resolveRelations(e, t, o) {
652
658
  let r = [];
653
659
  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));
660
+ const n = e.rel_uuids.length, a = [], c = 50;
661
+ for (let i = 0; i < n; i += c) {
662
+ const u = Math.min(n, i + c);
663
+ a.push(e.rel_uuids.slice(i, u));
658
664
  }
659
- for (let c = 0; c < i.length; c++)
665
+ for (let i = 0; i < a.length; i++)
660
666
  (await this.getStories({
661
- per_page: l,
667
+ per_page: c,
662
668
  language: t.language,
663
669
  version: t.version,
664
670
  starts_with: t.starts_with,
665
- by_uuids: i[c].join(","),
671
+ by_uuids: a[i].join(","),
666
672
  excluding_fields: t.excluding_fields
667
673
  })).data.stories.forEach((u) => {
668
674
  r.push(u);
@@ -688,26 +694,26 @@ class Pe {
688
694
  */
689
695
  async resolveStories(e, t, o) {
690
696
  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])
697
+ let a = [];
698
+ 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)
699
+ for (const c in this.relations[o])
694
700
  this.iterateTree(
695
- this.relations[o][l],
696
- i,
701
+ this.relations[o][c],
702
+ a,
697
703
  o
698
704
  );
699
- e.story ? this.iterateTree(e.story, i, o) : e.stories.forEach((l) => {
700
- this.iterateTree(l, i, o);
705
+ e.story ? this.iterateTree(e.story, a, o) : e.stories.forEach((c) => {
706
+ this.iterateTree(c, a, o);
701
707
  }), this.stringifiedStoriesCache = {}, delete this.links[o], delete this.relations[o];
702
708
  }
703
709
  async cacheResponse(e, t, o, r) {
704
- const n = D({ url: e, params: t }), i = this.cacheProvider();
710
+ const n = D({ url: e, params: t }), a = this.cacheProvider();
705
711
  if (t.version === "published" && e !== "/cdn/spaces/me") {
706
- const l = await i.get(n);
707
- if (l)
708
- return Promise.resolve(l);
712
+ const c = await a.get(n);
713
+ if (c)
714
+ return Promise.resolve(c);
709
715
  }
710
- return new Promise(async (l, c) => {
716
+ return new Promise(async (c, i) => {
711
717
  var u;
712
718
  try {
713
719
  const f = await this.throttle(
@@ -717,24 +723,24 @@ class Pe {
717
723
  r
718
724
  );
719
725
  if (f.status !== 200)
720
- return c(f);
726
+ return i(f);
721
727
  let y = { data: f.data, headers: f.headers };
722
728
  if ((u = f.headers) != null && u["per-page"] && (y = Object.assign({}, y, {
723
729
  perPage: f.headers["per-page"] ? Number.parseInt(f.headers["per-page"]) : 0,
724
730
  total: f.headers["per-page"] ? Number.parseInt(f.headers.total) : 0
725
731
  })), 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);
732
+ const T = this.resolveCounter = ++this.resolveCounter % 1e3;
733
+ await this.resolveStories(y.data, t, `${T}`), y = await this.processInlineAssets(y);
728
734
  }
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);
735
+ t.version === "published" && e !== "/cdn/spaces/me" && await a.set(n, y);
736
+ const R = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
737
+ 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
738
  } catch (f) {
733
739
  if (f.response && f.status === 429 && (o = typeof o > "u" ? 0 : o + 1, o < this.maxRetries))
734
740
  return console.log(
735
741
  `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);
742
+ ), await Ie(this.retriesDelay), this.cacheResponse(e, t, o).then(c).catch(i);
743
+ i(f);
738
744
  }
739
745
  });
740
746
  }
@@ -813,7 +819,7 @@ class Pe {
813
819
  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
820
  }
815
821
  }
816
- const ze = (s = {}) => {
822
+ const Ge = (s = {}) => {
817
823
  const { apiOptions: e } = s;
818
824
  if (!e || !e.accessToken) {
819
825
  console.error(
@@ -821,8 +827,8 @@ const ze = (s = {}) => {
821
827
  );
822
828
  return;
823
829
  }
824
- return { storyblokApi: new Pe(e) };
825
- }, Ne = (s) => {
830
+ return { storyblokApi: new Ne(e) };
831
+ }, He = (s) => {
826
832
  if (typeof s != "object" || typeof s._editable > "u")
827
833
  return {};
828
834
  try {
@@ -837,46 +843,46 @@ const ze = (s = {}) => {
837
843
  return {};
838
844
  }
839
845
  };
840
- let G = "https://app.storyblok.com/f/storyblok-v2-latest.js";
841
- const He = (s, e, t = {}) => {
846
+ let J = "https://app.storyblok.com/f/storyblok-v2-latest.js";
847
+ const De = (s, e, t = {}) => {
842
848
  var o;
843
849
  const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = new URL((o = window.location) == null ? void 0 : o.href).searchParams.get(
844
850
  "_storyblok"
845
- ), i = n !== null && +n === s;
846
- if (!(!r || !i)) {
851
+ ), a = n !== null && +n === s;
852
+ if (!(!r || !a)) {
847
853
  if (!s) {
848
854
  console.warn("Story ID is not defined. Please provide a valid ID.");
849
855
  return;
850
856
  }
851
857
  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());
858
+ new window.StoryblokBridge(t).on(["input", "published", "change"], (c) => {
859
+ var i;
860
+ 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
861
  });
856
862
  });
857
863
  }
858
- }, De = (s = {}) => {
864
+ }, Ue = (s = {}) => {
859
865
  var e, t;
860
866
  const {
861
867
  bridge: o,
862
868
  accessToken: r,
863
869
  use: n = [],
864
- apiOptions: i = {},
865
- bridgeUrl: l
870
+ apiOptions: a = {},
871
+ bridgeUrl: c
866
872
  } = s;
867
- i.accessToken = i.accessToken || r;
868
- const c = { bridge: o, apiOptions: i };
873
+ a.accessToken = a.accessToken || r;
874
+ const i = { bridge: o, apiOptions: a };
869
875
  let u = {};
870
876
  n.forEach((y) => {
871
- u = { ...u, ...y(c) };
872
- }), l && (G = l);
877
+ u = { ...u, ...y(i) };
878
+ }), c && (J = c);
873
879
  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;
880
+ return o !== !1 && f && Te(J), u;
875
881
  };
876
- function Ge(s, e) {
877
- return X(e).render(s);
882
+ function qe(s, e) {
883
+ return Z(e).render(s);
878
884
  }
879
- const Q = /* @__PURE__ */ q({
885
+ const ee = /* @__PURE__ */ K({
880
886
  __name: "StoryblokComponent",
881
887
  props: {
882
888
  blok: {}
@@ -886,20 +892,20 @@ const Q = /* @__PURE__ */ q({
886
892
  e({
887
893
  value: o
888
894
  });
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?`
895
+ const r = typeof N(t.blok.component) != "string", n = he("VueSDKOptions"), a = x(t.blok.component);
896
+ return !r && n && (n.enableFallbackComponent ? (a.value = n.customFallbackComponent ?? "FallbackComponent", typeof N(a.value) == "string" && console.error(
897
+ `Is the Fallback component "${a.value}" registered properly?`
892
898
  )) : console.error(
893
899
  `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({
900
+ )), (c, i) => (W(), Y(N(a.value), de({
895
901
  ref_key: "blokRef",
896
902
  ref: o
897
- }, { ...l.$props, ...l.$attrs }), null, 16));
903
+ }, { ...c.$props, ...c.$attrs }), null, 16));
898
904
  }
899
- }), Ue = (s) => {
905
+ }), Be = (s) => {
900
906
  var e, t;
901
- return Y(
902
- Q,
907
+ return X(
908
+ ee,
903
909
  {
904
910
  blok: (e = s == null ? void 0 : s.attrs) == null ? void 0 : e.body[0],
905
911
  id: (t = s.attrs) == null ? void 0 : t.id
@@ -907,21 +913,21 @@ const Q = /* @__PURE__ */ q({
907
913
  s.children
908
914
  );
909
915
  };
910
- function Be(s) {
916
+ function Me(s) {
911
917
  const e = {
912
- renderFn: Y,
918
+ renderFn: X,
913
919
  // TODO: Check why this changed.
914
920
  // @ts-expect-error - createTextVNode types has been recently changed.
915
- textFn: de,
921
+ textFn: pe,
916
922
  keyedResolvers: !0,
917
923
  resolvers: {
918
- [g.COMPONENT]: Ue,
924
+ [g.COMPONENT]: Be,
919
925
  ...s.resolvers
920
926
  }
921
927
  };
922
- return X(e);
928
+ return Z(e);
923
929
  }
924
- const Me = /* @__PURE__ */ q({
930
+ const Fe = /* @__PURE__ */ K({
925
931
  __name: "StoryblokRichText",
926
932
  props: {
927
933
  doc: {},
@@ -929,67 +935,67 @@ const Me = /* @__PURE__ */ q({
929
935
  },
930
936
  setup(s) {
931
937
  const e = s, t = x(), o = () => t.value;
932
- return pe([() => e.doc, () => e.resolvers], ([r, n]) => {
933
- const { render: i } = Be({
938
+ return fe([() => e.doc, () => e.resolvers], ([r, n]) => {
939
+ const { render: a } = Me({
934
940
  resolvers: n ?? {}
935
941
  });
936
- t.value = i(r);
942
+ t.value = a(r);
937
943
  }, {
938
944
  immediate: !0,
939
945
  deep: !0
940
- }), (r, n) => (K(), J(o));
946
+ }), (r, n) => (W(), Y(o));
941
947
  }
942
- }), Fe = {
948
+ }), Ve = {
943
949
  beforeMount(s, e) {
944
950
  if (e.value) {
945
- const t = Ne(e.value);
951
+ const t = He(e.value);
946
952
  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
953
  }
948
954
  }
949
- }, Z = (s) => {
955
+ }, te = (s) => {
950
956
  console.error(`You can't use ${s} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
951
957
  `);
952
958
  };
953
- let L = null;
954
- const qe = () => (L || Z("useStoryblokApi"), L), Je = async (s, e = {}, t = {}) => {
959
+ let I = null;
960
+ const Je = () => (I || te("useStoryblokApi"), I), Ke = async (s, e = {}, t = {}) => {
955
961
  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(
962
+ if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, ye(() => {
963
+ o.value && o.value.id && De(
958
964
  o.value.id,
959
965
  (r) => o.value = r,
960
966
  t
961
967
  );
962
- }), L) {
963
- const { data: r } = await L.get(
968
+ }), I) {
969
+ const { data: r } = await I.get(
964
970
  `cdn/stories/${s}`,
965
971
  e
966
972
  );
967
973
  o.value = r.story;
968
974
  } else
969
- Z("useStoryblok");
975
+ te("useStoryblok");
970
976
  return o;
971
- }, Ke = {
977
+ }, Ye = {
972
978
  install(s, e = {}) {
973
- s.directive("editable", Fe), s.component("StoryblokComponent", Q), s.component("StoryblokRichText", Me), e.enableFallbackComponent && !e.customFallbackComponent && s.component(
979
+ s.directive("editable", Ve), s.component("StoryblokComponent", ee), s.component("StoryblokRichText", Fe), e.enableFallbackComponent && !e.customFallbackComponent && s.component(
974
980
  "FallbackComponent",
975
- ye(() => import("./FallbackComponent-Dky11gEu.js"))
981
+ me(() => import("./FallbackComponent-Dky11gEu.js"))
976
982
  );
977
- const { storyblokApi: t } = De(e);
978
- L = t || null, s.provide("VueSDKOptions", e);
983
+ const { storyblokApi: t } = Ue(e);
984
+ I = t || null, s.provide("VueSDKOptions", e);
979
985
  }
980
986
  };
981
987
  export {
982
988
  g as BlockTypes,
983
989
  $ 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
990
+ ee as StoryblokComponent,
991
+ Fe as StoryblokRichText,
992
+ Ye as StoryblokVue,
993
+ Q as TextTypes,
994
+ Ge as apiPlugin,
995
+ qe as renderRichText,
996
+ Z as richTextResolver,
997
+ Ke as useStoryblok,
998
+ Je as useStoryblokApi,
999
+ De as useStoryblokBridge,
1000
+ Me as useStoryblokRichText
995
1001
  };