@storyblok/vue 9.2.1 → 9.2.4

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,40 +4,95 @@
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
7
- import { defineComponent as Y, ref as P, resolveDynamicComponent as N, inject as de, createBlock as W, openBlock as X, mergeProps as pe, h as Q, createTextVNode as fe, watch as ye, onMounted as me, defineAsyncComponent as be } from "vue";
8
- function ge(s, e) {
9
- if (!e)
10
- return { src: s, attrs: {} };
11
- let t = 0, o = 0;
12
- const r = {}, n = [];
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
- }
16
- if (typeof e == "object") {
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: i } = e || {}, { blur: u, brightness: f, fill: y, format: R, grayscale: _, quality: A, rotate: L } = i || {};
19
- u && a(u, 0, 100, "blur", n), A && a(A, 0, 100, "quality", n), f && a(f, 0, 100, "brightness", n), y && n.push(`fill(${y})`), _ && 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})`);
7
+ import { defineComponent as Z, ref as P, resolveDynamicComponent as H, inject as pe, createBlock as W, openBlock as X, mergeProps as fe, h as Q, createTextVNode as ye, watch as me, onMounted as be, defineAsyncComponent as ge } from "vue";
8
+ var ve = Object.defineProperty, ke = (e, t, r) => t in e ? ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, m = (e, t, r) => ke(e, typeof t != "symbol" ? t + "" : t, r);
9
+ function I(e, t, r) {
10
+ this.type = e, this.tag = t, this.attrs = null, this.map = null, this.nesting = r, this.level = 0, this.children = null, this.content = "", this.markup = "", this.info = "", this.meta = null, this.block = !1, this.hidden = !1;
11
+ }
12
+ I.prototype.attrIndex = function(e) {
13
+ if (!this.attrs)
14
+ return -1;
15
+ const t = this.attrs;
16
+ for (let r = 0, s = t.length; r < s; r++)
17
+ if (t[r][0] === e)
18
+ return r;
19
+ return -1;
20
+ };
21
+ I.prototype.attrPush = function(e) {
22
+ this.attrs ? this.attrs.push(e) : this.attrs = [e];
23
+ };
24
+ I.prototype.attrSet = function(e, t) {
25
+ const r = this.attrIndex(e), s = [e, t];
26
+ r < 0 ? this.attrPush(s) : this.attrs[r] = s;
27
+ };
28
+ I.prototype.attrGet = function(e) {
29
+ const t = this.attrIndex(e);
30
+ let r = null;
31
+ return t >= 0 && (r = this.attrs[t][1]), r;
32
+ };
33
+ I.prototype.attrJoin = function(e, t) {
34
+ const r = this.attrIndex(e);
35
+ r < 0 ? this.attrPush([e, t]) : this.attrs[r][1] = this.attrs[r][1] + " " + t;
36
+ };
37
+ const we = "[a-zA-Z_:][a-zA-Z0-9:._-]*", _e = "[^\"'=<>`\\x00-\\x20]+", Te = "'[^']*'", Re = '"[^"]*"', Ae = "(?:" + _e + "|" + Te + "|" + Re + ")", $e = "(?:\\s+" + we + "(?:\\s*=\\s*" + Ae + ")?)", Ee = "<[A-Za-z][A-Za-z0-9\\-]*" + $e + "*\\s*\\/?>", Se = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>", Ie = new RegExp("^(?:" + Ee + "|" + Se + ")");
38
+ new RegExp(Ie.source + "\\s*$");
39
+ const ee = [];
40
+ for (let e = 0; e < 256; e++)
41
+ ee.push(0);
42
+ "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e) {
43
+ ee[e.charCodeAt(0)] = 1;
44
+ });
45
+ let v = /* @__PURE__ */ function(e) {
46
+ 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;
47
+ }({}), R = /* @__PURE__ */ function(e) {
48
+ 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;
49
+ }({}), Ce = /* @__PURE__ */ function(e) {
50
+ return e.TEXT = "text", e;
51
+ }({}), j = /* @__PURE__ */ function(e) {
52
+ return e.URL = "url", e.STORY = "story", e.ASSET = "asset", e.EMAIL = "email", e;
53
+ }({});
54
+ function Le(e, t) {
55
+ if (!t) return {
56
+ src: e,
57
+ attrs: {}
58
+ };
59
+ let r = 0, s = 0;
60
+ const o = {}, n = [];
61
+ function l(c, u, f, y, A) {
62
+ 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)`) : A.push(`${y}(${c})`);
63
+ }
64
+ if (typeof t == "object") {
65
+ if (typeof t.width == "number" && t.width > 0 ? (o.width = t.width, r = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), t.height && typeof t.height == "number" && t.height > 0 ? (o.height = t.height, s = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), t.loading && ["lazy", "eager"].includes(t.loading) && (o.loading = t.loading), t.class && (o.class = t.class), t.filters) {
66
+ const { filters: c } = t || {}, { blur: u, brightness: f, fill: y, format: A, grayscale: T, quality: E, rotate: C } = c || {};
67
+ u && l(u, 0, 100, "blur", n), E && l(E, 0, 100, "quality", n), f && l(f, 0, 100, "brightness", n), y && n.push(`fill(${y})`), T && n.push("grayscale()"), C && [
68
+ 0,
69
+ 90,
70
+ 180,
71
+ 270
72
+ ].includes(t.filters.rotate || 0) && n.push(`rotate(${C})`), A && [
73
+ "webp",
74
+ "png",
75
+ "jpeg"
76
+ ].includes(A) && n.push(`format(${A})`);
20
77
  }
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
- return `${s}/m/${u}x${f}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${u}w`;
78
+ t.srcset && (o.srcset = t.srcset.map((c) => {
79
+ if (typeof c == "number") return `${e}/m/${c}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${c}w`;
80
+ if (Array.isArray(c) && c.length === 2) {
81
+ const [u, f] = c;
82
+ return `${e}/m/${u}x${f}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${u}w`;
27
83
  } else {
28
84
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
29
85
  return;
30
86
  }
31
- }).join(", ")), e.sizes && (r.sizes = e.sizes.join(", "));
87
+ }).join(", ")), t.sizes && (o.sizes = t.sizes.join(", "));
32
88
  }
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
- attrs: r
89
+ let a = `${e}/m/`;
90
+ return r > 0 && s > 0 && (a = `${a}${r}x${s}/`), n.length > 0 && (a = `${a}filters:${n.join(":")}`), {
91
+ src: a,
92
+ attrs: o
37
93
  };
38
94
  }
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))($ || {}), Z = /* @__PURE__ */ ((s) => (s.TEXT = "text", s))(Z || {}), S = /* @__PURE__ */ ((s) => (s.URL = "url", s.STORY = "story", s.ASSET = "asset", s.EMAIL = "email", s))(S || {});
40
- const ve = [
95
+ const je = [
41
96
  "area",
42
97
  "base",
43
98
  "br",
@@ -52,310 +107,276 @@ const ve = [
52
107
  "source",
53
108
  "track",
54
109
  "wbr"
55
- ], ke = (s = {}) => Object.keys(s).map((e) => `${e}="${s[e]}"`).join(" "), we = (s = {}) => Object.keys(s).map((e) => `${e}: ${s[e]}`).join("; ");
56
- function _e(s) {
57
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
110
+ ], Oe = (e = {}) => Object.keys(e).map((t) => `${t}="${e[t]}"`).join(" "), xe = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
111
+ function Pe(e) {
112
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
58
113
  }
59
- const O = (s) => Object.fromEntries(Object.entries(s).filter(([e, t]) => t !== void 0));
60
- function F(s, e = {}, t) {
61
- const o = ke(e), r = o ? `${s} ${o}` : s, n = Array.isArray(t) ? t.join("") : t || "";
62
- if (s) {
63
- if (ve.includes(s))
64
- return `<${r}>`;
114
+ const O = (e) => Object.fromEntries(Object.entries(e).filter(([t, r]) => r !== void 0));
115
+ function z(e, t = {}, r) {
116
+ const s = Oe(t), o = s ? `${e} ${s}` : e, n = Array.isArray(r) ? r.join("") : r || "";
117
+ if (e) {
118
+ if (je.includes(e)) return `<${o}>`;
65
119
  } else return n;
66
- return `<${r}>${n}</${s}>`;
120
+ return `<${o}>${n}</${e}>`;
67
121
  }
68
- function ee(s = {}) {
69
- const e = /* @__PURE__ */ new Map(), {
70
- renderFn: t = F,
71
- textFn: o = _e,
72
- resolvers: r = {},
73
- optimizeImages: n = !1,
74
- keyedResolvers: a = !1
75
- } = s, c = t !== F, i = (l) => (h, d) => {
122
+ function te(e = {}) {
123
+ const t = /* @__PURE__ */ new Map(), { renderFn: r = z, textFn: s = Pe, resolvers: o = {}, optimizeImages: n = !1, keyedResolvers: l = !1 } = e, a = r !== z, c = (i) => (h, d) => {
76
124
  const p = h.attrs || {};
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, T = {};
125
+ return d.render(i, p, h.children || null);
126
+ }, u = (i, h) => {
127
+ const { src: d, alt: p, title: b, srcset: w, sizes: g } = i.attrs || {};
128
+ let k = d, _ = {};
81
129
  if (n) {
82
- const { src: ue, attrs: he } = ge(d, n);
83
- k = ue, T = he;
130
+ const { src: he, attrs: de } = Le(d, n);
131
+ k = he, _ = de;
84
132
  }
85
- const ce = {
133
+ const ue = {
86
134
  src: k,
87
135
  alt: p,
88
136
  title: b,
89
137
  srcset: w,
90
- sizes: v,
91
- ...T
138
+ sizes: g,
139
+ ..._
92
140
  };
93
- return h.render("img", O(ce));
94
- }, f = (l, h) => {
95
- const { level: d, ...p } = l.attrs || {};
96
- return h.render(`h${d}`, p, l.children);
97
- }, y = (l, h) => {
141
+ return h.render("img", O(ue));
142
+ }, f = (i, h) => {
143
+ const { level: d, ...p } = i.attrs || {};
144
+ return h.render(`h${d}`, p, i.children);
145
+ }, y = (i, h) => {
98
146
  var d, p, b, w;
99
- const v = h.render("img", {
100
- src: (d = l.attrs) == null ? void 0 : d.fallbackImage,
101
- alt: (p = l.attrs) == null ? void 0 : p.alt,
147
+ const g = h.render("img", {
148
+ src: (d = i.attrs) == null ? void 0 : d.fallbackImage,
149
+ alt: (p = i.attrs) == null ? void 0 : p.alt,
102
150
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
103
151
  draggable: "false",
104
152
  loading: "lazy"
105
153
  });
106
154
  return h.render("span", {
107
155
  "data-type": "emoji",
108
- "data-name": (b = l.attrs) == null ? void 0 : b.name,
109
- "data-emoji": (w = l.attrs) == null ? void 0 : w.emoji
110
- }, v);
111
- }, R = (l, h) => h.render(
112
- "pre",
113
- l.attrs || {},
114
- h.render("code", {}, l.children || "")
115
- ), _ = (l, h = !1) => ({ text: d, attrs: p }, b) => {
116
- const { class: w, id: v, ...k } = p || {}, T = h ? {
156
+ "data-name": (b = i.attrs) == null ? void 0 : b.name,
157
+ "data-emoji": (w = i.attrs) == null ? void 0 : w.emoji
158
+ }, g);
159
+ }, A = (i, h) => h.render("pre", i.attrs || {}, h.render("code", {}, i.children || "")), T = (i, h = !1) => ({ text: d, attrs: p }, b) => {
160
+ const { class: w, id: g, ...k } = p || {}, _ = h ? {
117
161
  class: w,
118
- id: v,
119
- style: we(k) || void 0
162
+ id: g,
163
+ style: xe(k) || void 0
120
164
  } : p || {};
121
- return b.render(l, O(T), d);
122
- }, A = (l) => x(l), L = (l) => {
123
- const { marks: h, ...d } = l;
124
- if ("text" in l) {
125
- if (h)
126
- return h.reduce(
127
- (b, w) => A({ ...w, text: b }),
128
- A({ ...d, children: d.children })
129
- );
130
- const p = l.attrs || {};
131
- if (a) {
132
- const b = e.get("txt") || 0;
133
- e.set("txt", b + 1), p.key = `txt-${b}`;
165
+ return b.render(i, O(_), d);
166
+ }, E = (i) => N(i), C = (i) => {
167
+ const { marks: h, ...d } = i;
168
+ if ("text" in i) {
169
+ if (h) return h.reduce((b, w) => E({
170
+ ...w,
171
+ text: b
172
+ }), E({
173
+ ...d,
174
+ children: d.children
175
+ }));
176
+ const p = i.attrs || {};
177
+ if (l) {
178
+ const b = t.get("txt") || 0;
179
+ t.set("txt", b + 1), p.key = `txt-${b}`;
134
180
  }
135
- return o(d.text, p);
181
+ return s(d.text, p);
136
182
  }
137
183
  return "";
138
- }, D = (l, h) => {
139
- const { linktype: d, href: p, anchor: b, ...w } = l.attrs || {};
140
- let v = "";
184
+ }, B = (i, h) => {
185
+ const { linktype: d, href: p, anchor: b, ...w } = i.attrs || {};
186
+ let g = "";
141
187
  switch (d) {
142
- case S.ASSET:
143
- case S.URL:
144
- v = p;
188
+ case j.ASSET:
189
+ case j.URL:
190
+ g = p;
145
191
  break;
146
- case S.EMAIL:
147
- v = `mailto:${p}`;
192
+ case j.EMAIL:
193
+ g = `mailto:${p}`;
148
194
  break;
149
- case S.STORY:
150
- v = p, b && (v = `${v}#${b}`);
195
+ case j.STORY:
196
+ g = p, b && (g = `${g}#${b}`);
151
197
  break;
152
198
  default:
153
- v = p;
199
+ g = p;
154
200
  break;
155
201
  }
156
202
  const k = { ...w };
157
- return v && (k.href = v), h.render("a", k, l.text);
158
- }, re = (l, h) => {
203
+ return g && (k.href = g), h.render("a", k, i.text);
204
+ }, oe = (i, h) => {
159
205
  var d, p;
160
206
  return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), h.render("span", {
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,
207
+ blok: (d = i == null ? void 0 : i.attrs) == null ? void 0 : d.body[0],
208
+ id: (p = i.attrs) == null ? void 0 : p.id,
163
209
  style: "display: none"
164
210
  });
165
- }, oe = (l, h) => {
166
- const d = {}, p = h.render("tbody", {}, l.children);
211
+ }, ne = (i, h) => {
212
+ const d = {}, p = h.render("tbody", {}, i.children);
167
213
  return h.render("table", d, p);
168
- }, ne = (l, h) => {
214
+ }, ie = (i, h) => {
169
215
  const d = {};
170
- return h.render("tr", d, l.children);
171
- }, ie = (l, h) => {
172
- const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...v } = l.attrs || {}, k = {
173
- ...v
174
- };
216
+ return h.render("tr", d, i.children);
217
+ }, ae = (i, h) => {
218
+ const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...g } = i.attrs || {}, k = { ...g };
175
219
  d > 1 && (k.colspan = d), p > 1 && (k.rowspan = p);
176
- const T = [];
177
- 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), l.children);
178
- }, ae = (l, h) => {
179
- const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...v } = l.attrs || {}, k = {
180
- ...v
181
- };
220
+ const _ = [];
221
+ return b && _.push(`width: ${b}px;`), w && _.push(`background-color: ${w};`), _.length > 0 && (k.style = _.join(" ")), h.render("td", O(k), i.children);
222
+ }, le = (i, h) => {
223
+ const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...g } = i.attrs || {}, k = { ...g };
182
224
  d > 1 && (k.colspan = d), p > 1 && (k.rowspan = p);
183
- const T = [];
184
- 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), 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, re],
199
- [Z.TEXT, L],
200
- [$.LINK, D],
201
- [$.ANCHOR, D],
202
- [$.STYLED, _("span", !0)],
203
- [$.BOLD, _("strong")],
204
- [$.TEXT_STYLE, _("span", !0)],
205
- [$.ITALIC, _("em")],
206
- [$.UNDERLINE, _("u")],
207
- [$.STRIKE, _("s")],
208
- [$.CODE, _("code")],
209
- [$.SUPERSCRIPT, _("sup")],
210
- [$.SUBSCRIPT, _("sub")],
211
- [$.HIGHLIGHT, _("mark")],
212
- [g.TABLE, oe],
213
- [g.TABLE_ROW, ne],
214
- [g.TABLE_CELL, ie],
215
- [g.TABLE_HEADER, ae]
216
- ]), M = new Map([
217
- ...B,
218
- ...Object.entries(r).map(([l, h]) => [l, h])
219
- ]), le = () => ({
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}`;
225
+ const _ = [];
226
+ return b && _.push(`width: ${b}px;`), w && _.push(`background-color: ${w};`), _.length > 0 && (k.style = _.join(" ")), h.render("th", O(k), i.children);
227
+ }, F = /* @__PURE__ */ new Map([
228
+ [v.DOCUMENT, c("")],
229
+ [v.HEADING, f],
230
+ [v.PARAGRAPH, c("p")],
231
+ [v.UL_LIST, c("ul")],
232
+ [v.OL_LIST, c("ol")],
233
+ [v.LIST_ITEM, c("li")],
234
+ [v.IMAGE, u],
235
+ [v.EMOJI, y],
236
+ [v.CODE_BLOCK, A],
237
+ [v.HR, c("hr")],
238
+ [v.BR, c("br")],
239
+ [v.QUOTE, c("blockquote")],
240
+ [v.COMPONENT, oe],
241
+ [Ce.TEXT, C],
242
+ [R.LINK, B],
243
+ [R.ANCHOR, B],
244
+ [R.STYLED, T("span", !0)],
245
+ [R.BOLD, T("strong")],
246
+ [R.TEXT_STYLE, T("span", !0)],
247
+ [R.ITALIC, T("em")],
248
+ [R.UNDERLINE, T("u")],
249
+ [R.STRIKE, T("s")],
250
+ [R.CODE, T("code")],
251
+ [R.SUPERSCRIPT, T("sup")],
252
+ [R.SUBSCRIPT, T("sub")],
253
+ [R.HIGHLIGHT, T("mark")],
254
+ [v.TABLE, ne],
255
+ [v.TABLE_ROW, ie],
256
+ [v.TABLE_CELL, ae],
257
+ [v.TABLE_HEADER, le]
258
+ ]), M = new Map([...F, ...Object.entries(o).map(([i, h]) => [i, h])]), ce = () => ({
259
+ render: (i, h = {}, d) => {
260
+ if (l && i) {
261
+ const p = t.get(i) || 0;
262
+ t.set(i, p + 1), h.key = `${i}-${p}`;
224
263
  }
225
- return t(l, h, d);
264
+ return r(i, h, d);
226
265
  },
227
- originalResolvers: B,
266
+ originalResolvers: F,
228
267
  mergedResolvers: M
229
268
  });
230
- function C(l) {
231
- const h = M.get(l.type);
269
+ function L(i) {
270
+ const h = M.get(i.type);
232
271
  if (!h)
233
- return console.error("<Storyblok>", `No resolver found for node type ${l.type}`), "";
234
- const d = le();
235
- if (l.type === "text")
236
- return h(l, d);
237
- const p = l.content ? l.content.map(x) : void 0;
272
+ return console.error("<Storyblok>", `No resolver found for node type ${i.type}`), "";
273
+ const d = ce();
274
+ if (i.type === "text") return h(i, d);
275
+ const p = i.content ? i.content.map(N) : void 0;
238
276
  return h({
239
- ...l,
277
+ ...i,
240
278
  children: p
241
279
  }, d);
242
280
  }
243
- function x(l) {
244
- return l.type === "doc" ? c ? l.content.map(C) : l.content.map(C).join("") : Array.isArray(l) ? l.map(C) : C(l);
281
+ function N(i) {
282
+ return i.type === "doc" ? a ? i.content.map(L) : i.content.map(L).join("") : Array.isArray(i) ? i.map(L) : L(i);
245
283
  }
246
- return {
247
- render: x
248
- };
284
+ return { render: N };
249
285
  }
250
286
  let V = !1;
251
- const z = [], Te = (s) => new Promise((e, t) => {
287
+ const G = [], Ne = (e) => new Promise((t, r) => {
252
288
  if (typeof window > "u") {
253
- t(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
289
+ r(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
254
290
  return;
255
291
  }
256
- if (window.storyblokRegisterEvent = (r) => {
292
+ if (window.storyblokRegisterEvent = (o) => {
257
293
  if (!window.location.search.includes("_storyblok")) {
258
294
  console.warn("You are not in Draft Mode or in the Visual Editor.");
259
295
  return;
260
296
  }
261
- V ? r() : z.push(r);
297
+ V ? o() : G.push(o);
262
298
  }, document.getElementById("storyblok-javascript-bridge")) {
263
- e(void 0);
299
+ t(void 0);
264
300
  return;
265
301
  }
266
- const o = document.createElement("script");
267
- o.async = !0, o.src = s, o.id = "storyblok-javascript-bridge", o.onerror = (r) => t(r), o.onload = (r) => {
268
- z.forEach((n) => n()), V = !0, e(r);
269
- }, document.getElementsByTagName("head")[0].appendChild(o);
302
+ const s = document.createElement("script");
303
+ s.async = !0, s.src = e, s.id = "storyblok-javascript-bridge", s.onerror = (o) => r(o), s.onload = (o) => {
304
+ G.forEach((n) => n()), V = !0, t(o);
305
+ }, document.getElementsByTagName("head")[0].appendChild(s);
270
306
  });
271
- var Re = Object.defineProperty, $e = (s, e, t) => e in s ? Re(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);
272
- class Ee extends Error {
307
+ var He = class extends Error {
273
308
  constructor(e) {
274
309
  super(e), this.name = "AbortError";
275
310
  }
276
- }
277
- function Ae(s, e, t) {
278
- if (!Number.isFinite(e))
279
- throw new TypeError("Expected `limit` to be a finite number");
280
- if (!Number.isFinite(t))
281
- throw new TypeError("Expected `interval` to be a finite number");
282
- const o = [];
283
- let r = [], n = 0, a = !1;
284
- const c = async () => {
311
+ };
312
+ function De(e, t, r) {
313
+ if (!Number.isFinite(t)) throw new TypeError("Expected `limit` to be a finite number");
314
+ if (!Number.isFinite(r)) throw new TypeError("Expected `interval` to be a finite number");
315
+ const s = [];
316
+ let o = [], n = 0, l = !1;
317
+ const a = async () => {
285
318
  n++;
286
- const u = o.shift();
287
- if (u)
288
- try {
289
- const y = await s(...u.args);
290
- u.resolve(y);
291
- } catch (y) {
292
- u.reject(y);
293
- }
319
+ const u = s.shift();
320
+ if (u) try {
321
+ const y = await e(...u.args);
322
+ u.resolve(y);
323
+ } catch (y) {
324
+ u.reject(y);
325
+ }
294
326
  const f = setTimeout(() => {
295
- n--, o.length > 0 && c(), r = r.filter((y) => y !== f);
296
- }, t);
297
- r.includes(f) || r.push(f);
298
- }, i = (...u) => a ? Promise.reject(
299
- new Error(
300
- "Throttled function is already aborted and not accepting new promises"
301
- )
302
- ) : new Promise((f, y) => {
303
- o.push({
327
+ n--, s.length > 0 && a(), o = o.filter((y) => y !== f);
328
+ }, r);
329
+ o.includes(f) || o.push(f);
330
+ }, c = (...u) => l ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((f, y) => {
331
+ s.push({
304
332
  resolve: f,
305
333
  reject: y,
306
334
  args: u
307
- }), n < e && c();
335
+ }), n < t && a();
308
336
  });
309
- return i.abort = () => {
310
- a = !0, r.forEach(clearTimeout), r = [], o.forEach(
311
- (u) => u.reject(() => new Ee("Throttle function aborted"))
312
- ), o.length = 0;
313
- }, i;
337
+ return c.abort = () => {
338
+ l = !0, o.forEach(clearTimeout), o = [], s.forEach((u) => u.reject(() => new He("Throttle function aborted"))), s.length = 0;
339
+ }, c;
314
340
  }
315
- const G = (s = "") => s.includes("/cdn/"), Se = (s, e = 25, t = 1) => ({
316
- ...s,
317
- per_page: e,
318
- page: t
319
- }), Ie = (s) => new Promise((e) => setTimeout(e, s)), Le = (s = 0, e) => Array.from({ length: s }, e), Ce = (s = 0, e = s) => {
320
- const t = Math.abs(e - s) || 0, o = s < e ? 1 : -1;
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], []), U = (s, e, t) => {
323
- const o = [];
324
- for (const r in s) {
325
- if (!Object.prototype.hasOwnProperty.call(s, r))
326
- continue;
327
- const n = s[r];
328
- if (n == null)
329
- continue;
330
- const a = t ? "" : encodeURIComponent(r);
331
- let c;
332
- typeof n == "object" ? c = U(
333
- n,
334
- e ? e + encodeURIComponent(`[${a}]`) : a,
335
- Array.isArray(n)
336
- ) : c = `${e ? e + encodeURIComponent(`[${a}]`) : a}=${encodeURIComponent(n)}`, o.push(c);
337
- }
338
- return o.join("&");
339
- }, q = (s) => {
340
- const e = {
341
+ var Ue = De;
342
+ const K = (e = "") => e.includes("/cdn/"), Be = (e, t = 25, r = 1) => ({
343
+ ...e,
344
+ per_page: t,
345
+ page: r
346
+ }), Fe = (e) => new Promise((t) => setTimeout(t, e)), Me = (e = 0, t) => Array.from({ length: e }, t), ze = (e = 0, t = e) => {
347
+ const r = Math.abs(t - e) || 0, s = e < t ? 1 : -1;
348
+ return Me(r, (o, n) => n * s + e);
349
+ }, Ve = async (e, t) => Promise.all(e.map(t)), Ge = (e = [], t) => e.map(t).reduce((r, s) => [...r, ...s], []), U = (e, t, r) => {
350
+ const s = [];
351
+ for (const o in e) {
352
+ if (!Object.prototype.hasOwnProperty.call(e, o)) continue;
353
+ const n = e[o];
354
+ if (n == null) continue;
355
+ const l = r ? "" : encodeURIComponent(o);
356
+ let a;
357
+ typeof n == "object" ? a = U(n, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(n)) : a = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(n)}`, s.push(a);
358
+ }
359
+ return s.join("&");
360
+ }, q = (e) => {
361
+ const t = {
341
362
  eu: "api.storyblok.com",
342
363
  us: "api-us.storyblok.com",
343
364
  cn: "app.storyblokchina.cn",
344
365
  ap: "api-ap.storyblok.com",
345
366
  ca: "api-ca.storyblok.com"
346
367
  };
347
- return e[s] ?? e.eu;
368
+ return t[e] ?? t.eu;
348
369
  };
349
- class Pe {
370
+ var Ke = class {
350
371
  constructor(e) {
351
372
  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 = {};
352
373
  }
353
374
  /**
354
- *
355
- * @param url string
356
- * @param params ISbStoriesParams
357
- * @returns Promise<ISbResponse | Error>
358
- */
375
+ *
376
+ * @param url string
377
+ * @param params ISbStoriesParams
378
+ * @returns Promise<ISbResponse | Error>
379
+ */
359
380
  get(e, t) {
360
381
  return this.url = e, this.parameters = t, this._methodHandler("get");
361
382
  }
@@ -369,42 +390,37 @@ class Pe {
369
390
  return this.url = e, this.parameters = t ?? {}, this._methodHandler("delete");
370
391
  }
371
392
  async _responseHandler(e) {
372
- const t = [], o = {
393
+ const t = [], r = {
373
394
  data: {},
374
395
  headers: {},
375
396
  status: 0,
376
397
  statusText: ""
377
398
  };
378
- e.status !== 204 && await e.json().then((r) => {
379
- o.data = r;
399
+ e.status !== 204 && await e.json().then((s) => {
400
+ r.data = s;
380
401
  });
381
- for (const r of e.headers.entries())
382
- t[r[0]] = r[1];
383
- return o.headers = { ...t }, o.status = e.status, o.statusText = e.statusText, o;
402
+ for (const s of e.headers.entries()) t[s[0]] = s[1];
403
+ return r.headers = { ...t }, r.status = e.status, r.statusText = e.statusText, r;
384
404
  }
385
405
  async _methodHandler(e) {
386
- let t = `${this.baseURL}${this.url}`, o = null;
387
- e === "get" ? t = `${this.baseURL}${this.url}?${U(this.parameters)}` : o = JSON.stringify(this.parameters);
388
- const r = new URL(t), n = new AbortController(), { signal: a } = n;
389
- let c;
390
- this.timeout && (c = setTimeout(() => n.abort(), this.timeout));
406
+ let t = `${this.baseURL}${this.url}`, r = null;
407
+ e === "get" ? t = `${this.baseURL}${this.url}?${U(this.parameters)}` : r = JSON.stringify(this.parameters);
408
+ const s = new URL(t), o = new AbortController(), { signal: n } = o;
409
+ let l;
410
+ this.timeout && (l = setTimeout(() => o.abort(), this.timeout));
391
411
  try {
392
- const i = await this.fetch(`${r}`, {
412
+ const a = await this.fetch(`${s}`, {
393
413
  method: e,
394
414
  headers: this.headers,
395
- body: o,
396
- signal: a,
415
+ body: r,
416
+ signal: n,
397
417
  ...this.fetchOptions
398
418
  });
399
- this.timeout && clearTimeout(c);
400
- const u = await this._responseHandler(
401
- i
402
- );
403
- return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(u)) : this._statusHandler(u);
404
- } catch (i) {
405
- return {
406
- message: i
407
- };
419
+ this.timeout && clearTimeout(l);
420
+ const c = await this._responseHandler(a);
421
+ return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(c)) : this._statusHandler(c);
422
+ } catch (a) {
423
+ return { message: a };
408
424
  }
409
425
  }
410
426
  setFetchOptions(e = {}) {
@@ -414,136 +430,111 @@ class Pe {
414
430
  this.ejectInterceptor = !0;
415
431
  }
416
432
  /**
417
- * Normalizes error messages from different response structures
418
- * @param data The response data that might contain error information
419
- * @returns A normalized error message string
420
- */
433
+ * Normalizes error messages from different response structures
434
+ * @param data The response data that might contain error information
435
+ * @returns A normalized error message string
436
+ */
421
437
  _normalizeErrorMessage(e) {
422
- if (Array.isArray(e))
423
- return e[0] || "Unknown error";
438
+ if (Array.isArray(e)) return e[0] || "Unknown error";
424
439
  if (e && typeof e == "object") {
425
- if (e.error)
426
- return e.error;
440
+ if (e.error) return e.error;
427
441
  for (const t in e) {
428
- if (Array.isArray(e[t]))
429
- return `${t}: ${e[t][0]}`;
430
- if (typeof e[t] == "string")
431
- return `${t}: ${e[t]}`;
442
+ if (Array.isArray(e[t])) return `${t}: ${e[t][0]}`;
443
+ if (typeof e[t] == "string") return `${t}: ${e[t]}`;
432
444
  }
433
- if (e.slug)
434
- return e.slug;
445
+ if (e.slug) return e.slug;
435
446
  }
436
447
  return "Unknown error";
437
448
  }
438
449
  _statusHandler(e) {
439
450
  const t = /20[0-6]/g;
440
- return new Promise((o, r) => {
441
- if (t.test(`${e.status}`))
442
- return o(e);
443
- const n = {
451
+ return new Promise((r, s) => {
452
+ if (t.test(`${e.status}`)) return r(e);
453
+ const o = {
444
454
  message: this._normalizeErrorMessage(e.data),
445
455
  status: e.status,
446
456
  response: e
447
457
  };
448
- r(n);
458
+ s(o);
449
459
  });
450
460
  }
451
- }
452
- const J = "SB-Agent", H = {
461
+ }, qe = Ke;
462
+ const J = "SB-Agent", D = {
453
463
  defaultAgentName: "SB-JS-CLIENT",
454
464
  defaultAgentVersion: "SB-Agent-Version",
455
465
  packageVersion: "7.0.0"
456
- }, xe = {
466
+ }, Je = {
457
467
  PUBLISHED: "published"
458
468
  };
459
- let j = {};
460
- const E = {};
461
- class Ne {
469
+ let x = {};
470
+ const $ = {};
471
+ var Ye = class {
462
472
  /**
463
- *
464
- * @param config ISbConfig interface
465
- * @param pEndpoint string, optional
466
- */
473
+ *
474
+ * @param config ISbConfig interface
475
+ * @param pEndpoint string, optional
476
+ */
467
477
  constructor(e, t) {
468
478
  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");
469
- let o = e.endpoint || t;
470
- if (!o) {
471
- const a = e.https === !1 ? "http" : "https";
472
- e.oauthToken ? o = `${a}://${q(e.region)}/v1` : o = `${a}://${q(e.region)}/v2`;
479
+ let r = e.endpoint || t;
480
+ if (!r) {
481
+ const n = e.https === !1 ? "http" : "https";
482
+ e.oauthToken ? r = `${n}://${q(e.region)}/v1` : r = `${n}://${q(e.region)}/v2`;
473
483
  }
474
- const r = new Headers();
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(J) || (r.set(J, H.defaultAgentName), r.set(
478
- H.defaultAgentVersion,
479
- H.packageVersion
480
- ));
481
- let n = 5;
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(
483
- this.throttledRequest.bind(this),
484
- n,
485
- 1e3
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 || xe.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new Pe({
487
- baseURL: o,
484
+ const s = new Headers();
485
+ s.set("Content-Type", "application/json"), s.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([n, l]) => {
486
+ s.set(n, l);
487
+ }), s.has(J) || (s.set(J, D.defaultAgentName), s.set(D.defaultAgentVersion, D.packageVersion));
488
+ let o = 5;
489
+ e.oauthToken && (s.set("Authorization", e.oauthToken), o = 3), e.rateLimit && (o = e.rateLimit), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Ue(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 || Je.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new qe({
490
+ baseURL: r,
488
491
  timeout: e.timeout || 0,
489
- headers: r,
492
+ headers: s,
490
493
  responseInterceptor: e.responseInterceptor,
491
494
  fetch: e.fetch
492
495
  });
493
496
  }
494
497
  parseParams(e) {
495
- return e.token || (e.token = this.getToken()), e.cv || (e.cv = E[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
498
+ return e.token || (e.token = this.getToken()), e.cv || (e.cv = $[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
496
499
  }
497
500
  factoryParamOptions(e, t) {
498
- return G(e) ? this.parseParams(t) : t;
501
+ return K(e) ? this.parseParams(t) : t;
499
502
  }
500
- makeRequest(e, t, o, r, n) {
501
- const a = this.factoryParamOptions(
502
- e,
503
- Se(t, o, r)
504
- );
505
- return this.cacheResponse(e, a, void 0, n);
503
+ makeRequest(e, t, r, s, o) {
504
+ const n = this.factoryParamOptions(e, Be(t, r, s));
505
+ return this.cacheResponse(e, n, void 0, o);
506
506
  }
507
- get(e, t = {}, o) {
507
+ get(e, t = {}, r) {
508
508
  t || (t = {});
509
- const r = `/${e}`;
510
- G(r) && (t.version = t.version || this.version);
511
- const n = this.factoryParamOptions(r, t);
512
- return this.cacheResponse(r, n, void 0, o);
509
+ const s = `/${e}`;
510
+ K(s) && (t.version = t.version || this.version);
511
+ const o = this.factoryParamOptions(s, t);
512
+ return this.cacheResponse(s, o, void 0, r);
513
513
  }
514
- async getAll(e, t = {}, o, r) {
515
- const n = (t == null ? void 0 : t.per_page) || 25, a = `/${e}`.replace(/\/$/, ""), c = o ?? a.substring(a.lastIndexOf("/") + 1);
514
+ async getAll(e, t = {}, r, s) {
515
+ const o = (t == null ? void 0 : t.per_page) || 25, n = `/${e}`.replace(/\/$/, ""), l = r ?? n.substring(n.lastIndexOf("/") + 1);
516
516
  t.version = t.version || this.version;
517
- const i = 1, u = await this.makeRequest(
518
- a,
519
- t,
520
- n,
521
- i,
522
- 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)
526
- );
527
- return je([u, ...y], (R) => Object.values(R.data[c]));
517
+ const a = 1, c = await this.makeRequest(n, t, o, a, s), u = c.total ? Math.ceil(c.total / (c.perPage || o)) : 1, f = await Ve(ze(a, u), (y) => this.makeRequest(n, t, o, y + 1, s));
518
+ return Ge([c, ...f], (y) => Object.values(y.data[l]));
528
519
  }
529
- post(e, t = {}, o) {
530
- const r = `/${e}`;
531
- return this.throttle("post", r, t, o);
520
+ post(e, t = {}, r) {
521
+ const s = `/${e}`;
522
+ return this.throttle("post", s, t, r);
532
523
  }
533
- put(e, t = {}, o) {
534
- const r = `/${e}`;
535
- return this.throttle("put", r, t, o);
524
+ put(e, t = {}, r) {
525
+ const s = `/${e}`;
526
+ return this.throttle("put", s, t, r);
536
527
  }
537
- delete(e, t = {}, o) {
528
+ delete(e, t = {}, r) {
538
529
  t || (t = {});
539
- const r = `/${e}`;
540
- return this.throttle("delete", r, t, o);
530
+ const s = `/${e}`;
531
+ return this.throttle("delete", s, t, r);
541
532
  }
542
533
  getStories(e = {}, t) {
543
534
  return this._addResolveLevel(e), this.get("cdn/stories", e, t);
544
535
  }
545
- getStory(e, t = {}, o) {
546
- return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, o);
536
+ getStory(e, t = {}, r) {
537
+ return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, r);
547
538
  }
548
539
  getToken() {
549
540
  return this.accessToken;
@@ -557,235 +548,221 @@ class Ne {
557
548
  _cleanCopy(e) {
558
549
  return JSON.parse(JSON.stringify(e));
559
550
  }
560
- _insertLinks(e, t, o) {
561
- const r = e[t];
562
- r && r.fieldtype === "multilink" && r.linktype === "story" && typeof r.id == "string" && this.links[o][r.id] ? r.story = this._cleanCopy(this.links[o][r.id]) : r && r.linktype === "story" && typeof r.uuid == "string" && this.links[o][r.uuid] && (r.story = this._cleanCopy(this.links[o][r.uuid]));
551
+ _insertLinks(e, t, r) {
552
+ const s = e[t];
553
+ s && s.fieldtype === "multilink" && s.linktype === "story" && typeof s.id == "string" && this.links[r][s.id] ? s.story = this._cleanCopy(this.links[r][s.id]) : s && s.linktype === "story" && typeof s.uuid == "string" && this.links[r][s.uuid] && (s.story = this._cleanCopy(this.links[r][s.uuid]));
563
554
  }
564
555
  /**
565
- *
566
- * @param resolveId A counter number as a string
567
- * @param uuid The uuid of the story
568
- * @returns string | object
569
- */
556
+ *
557
+ * @param resolveId A counter number as a string
558
+ * @param uuid The uuid of the story
559
+ * @returns string | object
560
+ */
570
561
  getStoryReference(e, t) {
571
562
  return this.relations[e][t] ? JSON.parse(this.stringifiedStoriesCache[t] || JSON.stringify(this.relations[e][t])) : t;
572
563
  }
573
564
  /**
574
- * Resolves a field's value by replacing UUIDs with their corresponding story references
575
- * @param jtree - The JSON tree object containing the field to resolve
576
- * @param treeItem - The key of the field to resolve
577
- * @param resolveId - The unique identifier for the current resolution context
578
- *
579
- * This method handles both single string UUIDs and arrays of UUIDs:
580
- * - For single strings: directly replaces the UUID with the story reference
581
- * - For arrays: maps through each UUID and replaces with corresponding story references
582
- */
583
- _resolveField(e, t, o) {
584
- const r = e[t];
585
- typeof r == "string" ? e[t] = this.getStoryReference(o, r) : Array.isArray(r) && (e[t] = r.map(
586
- (n) => this.getStoryReference(o, n)
587
- ).filter(Boolean));
565
+ * Resolves a field's value by replacing UUIDs with their corresponding story references
566
+ * @param jtree - The JSON tree object containing the field to resolve
567
+ * @param treeItem - The key of the field to resolve
568
+ * @param resolveId - The unique identifier for the current resolution context
569
+ *
570
+ * This method handles both single string UUIDs and arrays of UUIDs:
571
+ * - For single strings: directly replaces the UUID with the story reference
572
+ * - For arrays: maps through each UUID and replaces with corresponding story references
573
+ */
574
+ _resolveField(e, t, r) {
575
+ const s = e[t];
576
+ typeof s == "string" ? e[t] = this.getStoryReference(r, s) : Array.isArray(s) && (e[t] = s.map((o) => this.getStoryReference(r, o)).filter(Boolean));
588
577
  }
589
578
  /**
590
- * Inserts relations into the JSON tree by resolving references
591
- * @param jtree - The JSON tree object to process
592
- * @param treeItem - The current field being processed
593
- * @param fields - The relation patterns to resolve (string or array of strings)
594
- * @param resolveId - The unique identifier for the current resolution context
595
- *
596
- * This method handles two types of relation patterns:
597
- * 1. Nested relations: matches fields that end with the current field name
598
- * Example: If treeItem is "event_type", it matches patterns like "*.event_type"
599
- *
600
- * 2. Direct component relations: matches exact component.field patterns
601
- * Example: "event.event_type" for component "event" and field "event_type"
602
- *
603
- * The method supports both string and array formats for the fields parameter,
604
- * allowing flexible specification of relation patterns.
605
- */
606
- _insertRelations(e, t, o, r) {
607
- if (Array.isArray(o) ? o.find((a) => a.endsWith(`.${t}`)) : o.endsWith(`.${t}`)) {
608
- this._resolveField(e, t, r);
579
+ * Inserts relations into the JSON tree by resolving references
580
+ * @param jtree - The JSON tree object to process
581
+ * @param treeItem - The current field being processed
582
+ * @param fields - The relation patterns to resolve (string or array of strings)
583
+ * @param resolveId - The unique identifier for the current resolution context
584
+ *
585
+ * This method handles two types of relation patterns:
586
+ * 1. Nested relations: matches fields that end with the current field name
587
+ * Example: If treeItem is "event_type", it matches patterns like "*.event_type"
588
+ *
589
+ * 2. Direct component relations: matches exact component.field patterns
590
+ * Example: "event.event_type" for component "event" and field "event_type"
591
+ *
592
+ * The method supports both string and array formats for the fields parameter,
593
+ * allowing flexible specification of relation patterns.
594
+ */
595
+ _insertRelations(e, t, r, s) {
596
+ if (Array.isArray(r) ? r.find((n) => n.endsWith(`.${t}`)) : r.endsWith(`.${t}`)) {
597
+ this._resolveField(e, t, s);
609
598
  return;
610
599
  }
611
- const n = e.component ? `${e.component}.${t}` : t;
612
- (Array.isArray(o) ? o.includes(n) : o === n) && this._resolveField(e, t, r);
600
+ const o = e.component ? `${e.component}.${t}` : t;
601
+ (Array.isArray(r) ? r.includes(o) : r === o) && this._resolveField(e, t, s);
613
602
  }
614
603
  /**
615
- * Recursively traverses and resolves relations in the story content tree
616
- * @param story - The story object containing the content to process
617
- * @param fields - The relation patterns to resolve
618
- * @param resolveId - The unique identifier for the current resolution context
619
- */
620
- iterateTree(e, t, o) {
621
- const r = (n, a = "") => {
622
- if (!(!n || n._stopResolving)) {
623
- if (Array.isArray(n))
624
- n.forEach((c, i) => r(c, `${a}[${i}]`));
625
- else if (typeof n == "object")
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);
629
- }
604
+ * Recursively traverses and resolves relations in the story content tree
605
+ * @param story - The story object containing the content to process
606
+ * @param fields - The relation patterns to resolve
607
+ * @param resolveId - The unique identifier for the current resolution context
608
+ */
609
+ iterateTree(e, t, r) {
610
+ const s = (o, n = "") => {
611
+ if (!(!o || o._stopResolving)) {
612
+ if (Array.isArray(o)) o.forEach((l, a) => s(l, `${n}[${a}]`));
613
+ else if (typeof o == "object") for (const l in o) {
614
+ const a = n ? `${n}.${l}` : l;
615
+ (o.component && o._uid || o.type === "link") && (this._insertRelations(o, l, t, r), this._insertLinks(o, l, r)), s(o[l], a);
616
+ }
630
617
  }
631
618
  };
632
- r(e.content);
619
+ s(e.content);
633
620
  }
634
- async resolveLinks(e, t, o) {
635
- let r = [];
621
+ async resolveLinks(e, t, r) {
622
+ let s = [];
636
623
  if (e.link_uuids) {
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));
624
+ const o = e.link_uuids.length, n = [], l = 50;
625
+ for (let a = 0; a < o; a += l) {
626
+ const c = Math.min(o, a + l);
627
+ n.push(e.link_uuids.slice(a, c));
641
628
  }
642
- for (let i = 0; i < a.length; i++)
629
+ for (let a = 0; a < n.length; a++)
643
630
  (await this.getStories({
644
- per_page: c,
631
+ per_page: l,
645
632
  language: t.language,
646
633
  version: t.version,
647
634
  starts_with: t.starts_with,
648
- by_uuids: a[i].join(",")
649
- })).data.stories.forEach(
650
- (u) => {
651
- r.push(u);
652
- }
653
- );
654
- } else
655
- r = e.links;
656
- r.forEach((n) => {
657
- this.links[o][n.uuid] = {
658
- ...n,
635
+ by_uuids: n[a].join(",")
636
+ })).data.stories.forEach((c) => {
637
+ s.push(c);
638
+ });
639
+ } else s = e.links;
640
+ s.forEach((o) => {
641
+ this.links[r][o.uuid] = {
642
+ ...o,
659
643
  _stopResolving: !0
660
644
  };
661
645
  });
662
646
  }
663
- async resolveRelations(e, t, o) {
664
- let r = [];
647
+ async resolveRelations(e, t, r) {
648
+ let s = [];
665
649
  if (e.rel_uuids) {
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));
650
+ const o = e.rel_uuids.length, n = [], l = 50;
651
+ for (let a = 0; a < o; a += l) {
652
+ const c = Math.min(o, a + l);
653
+ n.push(e.rel_uuids.slice(a, c));
670
654
  }
671
- for (let i = 0; i < a.length; i++)
655
+ for (let a = 0; a < n.length; a++)
672
656
  (await this.getStories({
673
- per_page: c,
657
+ per_page: l,
674
658
  language: t.language,
675
659
  version: t.version,
676
660
  starts_with: t.starts_with,
677
- by_uuids: a[i].join(","),
661
+ by_uuids: n[a].join(","),
678
662
  excluding_fields: t.excluding_fields
679
- })).data.stories.forEach((u) => {
680
- r.push(u);
663
+ })).data.stories.forEach((c) => {
664
+ s.push(c);
681
665
  });
682
- r.length > 0 && (e.rels = r, delete e.rel_uuids);
683
- } else
684
- r = e.rels;
685
- r && r.length > 0 && r.forEach((n) => {
686
- this.relations[o][n.uuid] = {
687
- ...n,
666
+ s.length > 0 && (e.rels = s, delete e.rel_uuids);
667
+ } else s = e.rels;
668
+ s && s.length > 0 && s.forEach((o) => {
669
+ this.relations[r][o.uuid] = {
670
+ ...o,
688
671
  _stopResolving: !0
689
672
  };
690
673
  });
691
674
  }
692
675
  /**
693
- *
694
- * @param responseData
695
- * @param params
696
- * @param resolveId
697
- * @description Resolves the relations and links of the stories
698
- * @returns Promise<void>
699
- *
700
- */
701
- async resolveStories(e, t, o) {
702
- var r, n;
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])
706
- this.iterateTree(
707
- this.relations[o][c],
708
- a,
709
- o
710
- );
711
- e.story ? this.iterateTree(e.story, a, o) : e.stories.forEach((c) => {
712
- this.iterateTree(c, a, o);
713
- }), this.stringifiedStoriesCache = {}, delete this.links[o], delete this.relations[o];
714
- }
715
- async cacheResponse(e, t, o, r) {
716
- const n = U({ url: e, params: t }), a = this.cacheProvider();
676
+ *
677
+ * @param responseData
678
+ * @param params
679
+ * @param resolveId
680
+ * @description Resolves the relations and links of the stories
681
+ * @returns Promise<void>
682
+ *
683
+ */
684
+ async resolveStories(e, t, r) {
685
+ var s, o;
686
+ let n = [];
687
+ if (this.links[r] = {}, this.relations[r] = {}, 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, r)), t.resolve_links && [
688
+ "1",
689
+ "story",
690
+ "url",
691
+ "link"
692
+ ].includes(t.resolve_links) && ((s = e.links) != null && s.length || (o = e.link_uuids) != null && o.length) && await this.resolveLinks(e, t, r), this.resolveNestedRelations) for (const l in this.relations[r]) this.iterateTree(this.relations[r][l], n, r);
693
+ e.story ? this.iterateTree(e.story, n, r) : e.stories.forEach((l) => {
694
+ this.iterateTree(l, n, r);
695
+ }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
696
+ }
697
+ async cacheResponse(e, t, r, s) {
698
+ const o = U({
699
+ url: e,
700
+ params: t
701
+ }), n = this.cacheProvider();
717
702
  if (t.version === "published" && e !== "/cdn/spaces/me") {
718
- const c = await a.get(n);
719
- if (c)
720
- return Promise.resolve(c);
703
+ const l = await n.get(o);
704
+ if (l) return Promise.resolve(l);
721
705
  }
722
- return new Promise(async (c, i) => {
723
- var u;
706
+ return new Promise(async (l, a) => {
707
+ var c;
724
708
  try {
725
- const f = await this.throttle(
726
- "get",
727
- e,
728
- t,
729
- r
730
- );
731
- if (f.status !== 200)
732
- return i(f);
733
- let y = { data: f.data, headers: f.headers };
734
- if ((u = f.headers) != null && u["per-page"] && (y = Object.assign({}, y, {
735
- perPage: f.headers["per-page"] ? Number.parseInt(f.headers["per-page"]) : 0,
736
- total: f.headers["per-page"] ? Number.parseInt(f.headers.total) : 0
737
- })), y.data.story || y.data.stories) {
738
- const _ = this.resolveCounter = ++this.resolveCounter % 1e3;
739
- await this.resolveStories(y.data, t, `${_}`), y = await this.processInlineAssets(y);
709
+ const u = await this.throttle("get", e, t, s);
710
+ if (u.status !== 200) return a(u);
711
+ let f = {
712
+ data: u.data,
713
+ headers: u.headers
714
+ };
715
+ if ((c = u.headers) != null && c["per-page"] && (f = Object.assign({}, f, {
716
+ perPage: u.headers["per-page"] ? Number.parseInt(u.headers["per-page"]) : 0,
717
+ total: u.headers["per-page"] ? Number.parseInt(u.headers.total) : 0
718
+ })), f.data.story || f.data.stories) {
719
+ const A = this.resolveCounter = ++this.resolveCounter % 1e3;
720
+ await this.resolveStories(f.data, t, `${A}`), f = await this.processInlineAssets(f);
740
721
  }
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 && E[t.token] && E[t.token] !== y.data.cv && await this.flushCache(), E[t.token] = y.data.cv), c(y);
744
- } catch (f) {
745
- if (f.response && f.status === 429 && (o = typeof o > "u" ? 0 : o + 1, o < this.maxRetries))
746
- return console.log(
747
- `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
748
- ), await Ie(this.retriesDelay), this.cacheResponse(e, t, o).then(c).catch(i);
749
- i(f);
722
+ t.version === "published" && e !== "/cdn/spaces/me" && await n.set(o, f);
723
+ const y = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
724
+ return t.token && f.data.cv && (y && $[t.token] && $[t.token] !== f.data.cv && await this.flushCache(), $[t.token] = f.data.cv), l(f);
725
+ } catch (u) {
726
+ if (u.response && u.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
727
+ return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await Fe(this.retriesDelay), this.cacheResponse(e, t, r).then(l).catch(a);
728
+ a(u);
750
729
  }
751
730
  });
752
731
  }
753
- throttledRequest(e, t, o, r) {
754
- return this.client.setFetchOptions(r), this.client[e](t, o);
732
+ throttledRequest(e, t, r, s) {
733
+ return this.client.setFetchOptions(s), this.client[e](t, r);
755
734
  }
756
735
  cacheVersions() {
757
- return E;
736
+ return $;
758
737
  }
759
738
  cacheVersion() {
760
- return E[this.accessToken];
739
+ return $[this.accessToken];
761
740
  }
762
741
  setCacheVersion(e) {
763
- this.accessToken && (E[this.accessToken] = e);
742
+ this.accessToken && ($[this.accessToken] = e);
764
743
  }
765
744
  clearCacheVersion() {
766
- this.accessToken && (E[this.accessToken] = 0);
745
+ this.accessToken && ($[this.accessToken] = 0);
767
746
  }
768
747
  cacheProvider() {
769
748
  switch (this.cache.type) {
770
749
  case "memory":
771
750
  return {
772
751
  get(e) {
773
- return Promise.resolve(j[e]);
752
+ return Promise.resolve(x[e]);
774
753
  },
775
754
  getAll() {
776
- return Promise.resolve(j);
755
+ return Promise.resolve(x);
777
756
  },
778
757
  set(e, t) {
779
- return j[e] = t, Promise.resolve(void 0);
758
+ return x[e] = t, Promise.resolve(void 0);
780
759
  },
781
760
  flush() {
782
- return j = {}, Promise.resolve(void 0);
761
+ return x = {}, Promise.resolve(void 0);
783
762
  }
784
763
  };
785
764
  case "custom":
786
- if (this.cache.custom)
787
- return this.cache.custom;
788
- // eslint-disable-next-line no-fallthrough
765
+ if (this.cache.custom) return this.cache.custom;
789
766
  default:
790
767
  return {
791
768
  get() {
@@ -807,203 +784,199 @@ class Ne {
807
784
  return await this.cacheProvider().flush(), this.clearCacheVersion(), this;
808
785
  }
809
786
  async processInlineAssets(e) {
810
- if (!this.inlineAssets)
811
- return e;
812
- const t = (o) => {
813
- if (!o || typeof o != "object")
814
- return o;
815
- if (Array.isArray(o))
816
- return o.map((n) => t(n));
817
- let r = { ...o };
818
- r.fieldtype === "asset" && Array.isArray(e.data.assets) && (r = {
819
- ...r,
820
- ...e.data.assets.find((n) => n.id === r.id)
787
+ if (!this.inlineAssets) return e;
788
+ const t = (r) => {
789
+ if (!r || typeof r != "object") return r;
790
+ if (Array.isArray(r)) return r.map((o) => t(o));
791
+ let s = { ...r };
792
+ s.fieldtype === "asset" && Array.isArray(e.data.assets) && (s = {
793
+ ...s,
794
+ ...e.data.assets.find((o) => o.id === s.id)
821
795
  });
822
- for (const n in r)
823
- typeof r[n] == "object" && (r[n] = t(r[n]));
824
- return r;
796
+ for (const o in s) typeof s[o] == "object" && (s[o] = t(s[o]));
797
+ return s;
825
798
  };
826
- 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;
799
+ return e.data.story && (e.data.story.content = t(e.data.story.content)), e.data.stories && (e.data.stories = e.data.stories.map((r) => (r.content = t(r.content), r))), e;
827
800
  }
828
- }
829
- const Ge = (s = {}) => {
830
- const { apiOptions: e } = s;
831
- if (!e || !e.accessToken) {
801
+ }, Ze = Ye;
802
+ const nt = (e = {}) => {
803
+ const { apiOptions: t } = e;
804
+ if (!t || !t.accessToken) {
832
805
  console.error(
833
806
  "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
834
807
  );
835
808
  return;
836
809
  }
837
- return { storyblokApi: new Ne(e) };
838
- }, He = (s) => {
839
- if (typeof s != "object" || typeof s._editable > "u")
810
+ return { storyblokApi: new Ze(t) };
811
+ }, We = (e) => {
812
+ if (typeof e != "object" || typeof e._editable > "u")
840
813
  return {};
841
814
  try {
842
- const e = JSON.parse(
843
- s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
815
+ const t = JSON.parse(
816
+ e._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
844
817
  );
845
- return e ? {
846
- "data-blok-c": JSON.stringify(e),
847
- "data-blok-uid": `${e.id}-${e.uid}`
818
+ return t ? {
819
+ "data-blok-c": JSON.stringify(t),
820
+ "data-blok-uid": `${t.id}-${t.uid}`
848
821
  } : {};
849
822
  } catch {
850
823
  return {};
851
824
  }
852
825
  };
853
- let K = "https://app.storyblok.com/f/storyblok-v2-latest.js";
854
- const Ue = (s, e, t = {}) => {
855
- var o;
856
- const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = new URL((o = window.location) == null ? void 0 : o.href).searchParams.get(
826
+ let Y = "https://app.storyblok.com/f/storyblok-v2-latest.js";
827
+ const Xe = (e, t, r = {}) => {
828
+ var s;
829
+ const o = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = new URL((s = window.location) == null ? void 0 : s.href).searchParams.get(
857
830
  "_storyblok"
858
- ), a = n !== null && +n === s;
859
- if (!(!r || !a)) {
860
- if (!s) {
831
+ ), l = n !== null && +n === e;
832
+ if (!(!o || !l)) {
833
+ if (!e) {
861
834
  console.warn("Story ID is not defined. Please provide a valid ID.");
862
835
  return;
863
836
  }
864
837
  window.storyblokRegisterEvent(() => {
865
- new window.StoryblokBridge(t).on(["input", "published", "change"], (c) => {
866
- var i;
867
- 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());
838
+ new window.StoryblokBridge(r).on(["input", "published", "change"], (a) => {
839
+ var c;
840
+ a && (a.action === "input" && ((c = a.story) == null ? void 0 : c.id) === e ? t(a.story) : (a.action === "change" || a.action === "published") && a.storyId === e && window.location.reload());
868
841
  });
869
842
  });
870
843
  }
871
- }, De = (s = {}) => {
872
- var e, t;
844
+ }, Qe = (e = {}) => {
845
+ var t, r;
873
846
  const {
874
- bridge: o,
875
- accessToken: r,
847
+ bridge: s,
848
+ accessToken: o,
876
849
  use: n = [],
877
- apiOptions: a = {},
878
- bridgeUrl: c
879
- } = s;
880
- a.accessToken = a.accessToken || r;
881
- const i = { bridge: o, apiOptions: a };
850
+ apiOptions: l = {},
851
+ bridgeUrl: a
852
+ } = e;
853
+ l.accessToken = l.accessToken || o;
854
+ const c = { bridge: s, apiOptions: l };
882
855
  let u = {};
883
856
  n.forEach((y) => {
884
- u = { ...u, ...y(i) };
885
- }), c && (K = c);
886
- const f = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
887
- return o !== !1 && f && Te(K), u;
857
+ u = { ...u, ...y(c) };
858
+ }), a && (Y = a);
859
+ const f = !(typeof window > "u") && ((r = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : r.includes("_storyblok_tk"));
860
+ return s !== !1 && f && Ne(Y), u;
888
861
  };
889
- function qe(s, e) {
890
- return ee(e).render(s);
862
+ function it(e, t) {
863
+ return te(t).render(e);
891
864
  }
892
- const te = /* @__PURE__ */ Y({
865
+ const re = /* @__PURE__ */ Z({
893
866
  __name: "StoryblokComponent",
894
867
  props: {
895
868
  blok: {}
896
869
  },
897
- setup(s, { expose: e }) {
898
- var c;
899
- const t = s, o = P();
900
- e({
901
- value: o
870
+ setup(e, { expose: t }) {
871
+ var a;
872
+ const r = e, s = P();
873
+ t({
874
+ value: s
902
875
  });
903
- const r = typeof N(t.blok.component) != "string", n = de("VueSDKOptions"), a = P((c = t.blok.component) == null ? void 0 : c.replace(/_/g, "-"));
904
- return !r && n && (n.enableFallbackComponent ? (a.value = n.customFallbackComponent ?? "FallbackComponent", typeof N(a.value) == "string" && console.error(
905
- `Is the Fallback component "${a.value}" registered properly?`
876
+ const o = typeof H(r.blok.component) != "string", n = pe("VueSDKOptions"), l = P((a = r.blok.component) == null ? void 0 : a.replace(/_/g, "-"));
877
+ return !o && n && (n.enableFallbackComponent ? (l.value = n.customFallbackComponent ?? "FallbackComponent", typeof H(l.value) == "string" && console.error(
878
+ `Is the Fallback component "${l.value}" registered properly?`
906
879
  )) : console.error(
907
- `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});"?`
908
- )), (i, u) => (X(), W(N(a.value), pe({
880
+ `Component could not be found for blok "${r.blok.component}"! Is it defined in main.ts as "app.component("${r.blok.component}", ${r.blok.component});"?`
881
+ )), (c, u) => (X(), W(H(l.value), fe({
909
882
  ref_key: "blokRef",
910
- ref: o
911
- }, { ...i.$props, ...i.$attrs }), null, 16));
883
+ ref: s
884
+ }, { ...c.$props, ...c.$attrs }), null, 16));
912
885
  }
913
- }), Be = (s) => {
914
- var e, t;
886
+ }), et = (e) => {
887
+ var t, r;
915
888
  return Q(
916
- te,
889
+ re,
917
890
  {
918
- blok: (e = s == null ? void 0 : s.attrs) == null ? void 0 : e.body[0],
919
- id: (t = s.attrs) == null ? void 0 : t.id
891
+ blok: (t = e == null ? void 0 : e.attrs) == null ? void 0 : t.body[0],
892
+ id: (r = e.attrs) == null ? void 0 : r.id
920
893
  },
921
- s.children
894
+ e.children
922
895
  );
923
896
  };
924
- function Me(s) {
925
- const e = {
897
+ function tt(e) {
898
+ const t = {
926
899
  renderFn: Q,
927
900
  // TODO: Check why this changed.
928
901
  // @ts-expect-error - createTextVNode types has been recently changed.
929
- textFn: fe,
902
+ textFn: ye,
930
903
  keyedResolvers: !0,
931
904
  resolvers: {
932
- [g.COMPONENT]: Be,
933
- ...s.resolvers
905
+ [v.COMPONENT]: et,
906
+ ...e.resolvers
934
907
  }
935
908
  };
936
- return ee(e);
909
+ return te(t);
937
910
  }
938
- const Fe = /* @__PURE__ */ Y({
911
+ const rt = /* @__PURE__ */ Z({
939
912
  __name: "StoryblokRichText",
940
913
  props: {
941
914
  doc: {},
942
915
  resolvers: {}
943
916
  },
944
- setup(s) {
945
- const e = s, t = P(), o = () => t.value;
946
- return ye([() => e.doc, () => e.resolvers], ([r, n]) => {
947
- const { render: a } = Me({
917
+ setup(e) {
918
+ const t = e, r = P(), s = () => r.value;
919
+ return me([() => t.doc, () => t.resolvers], ([o, n]) => {
920
+ const { render: l } = tt({
948
921
  resolvers: n ?? {}
949
922
  });
950
- t.value = a(r);
923
+ r.value = l(o);
951
924
  }, {
952
925
  immediate: !0,
953
926
  deep: !0
954
- }), (r, n) => (X(), W(o));
927
+ }), (o, n) => (X(), W(s));
955
928
  }
956
- }), Ve = {
957
- beforeMount(s, e) {
958
- if (e.value) {
959
- const t = He(e.value);
960
- 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"));
929
+ }), st = {
930
+ beforeMount(e, t) {
931
+ if (t.value) {
932
+ const r = We(t.value);
933
+ Object.keys(r).length > 0 && (e.setAttribute("data-blok-c", r["data-blok-c"]), e.setAttribute("data-blok-uid", r["data-blok-uid"]), e.classList.add("storyblok__outline"));
961
934
  }
962
935
  }
963
- }, se = (s) => {
964
- console.error(`You can't use ${s} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
936
+ }, se = (e) => {
937
+ console.error(`You can't use ${e} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
965
938
  `);
966
939
  };
967
- let I = null;
968
- const Je = () => (I || se("useStoryblokApi"), I), Ke = async (s, e = {}, t = {}) => {
969
- const o = P(null);
970
- if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, me(() => {
971
- o.value && o.value.id && Ue(
972
- o.value.id,
973
- (r) => o.value = r,
974
- t
940
+ let S = null;
941
+ const at = () => (S || se("useStoryblokApi"), S), lt = async (e, t = {}, r = {}) => {
942
+ const s = P(null);
943
+ if (r.resolveRelations = r.resolveRelations ?? t.resolve_relations, r.resolveLinks = r.resolveLinks ?? t.resolve_links, be(() => {
944
+ s.value && s.value.id && Xe(
945
+ s.value.id,
946
+ (o) => s.value = o,
947
+ r
975
948
  );
976
- }), I) {
977
- const { data: r } = await I.get(
978
- `cdn/stories/${s}`,
979
- e
949
+ }), S) {
950
+ const { data: o } = await S.get(
951
+ `cdn/stories/${e}`,
952
+ t
980
953
  );
981
- o.value = r.story;
954
+ s.value = o.story;
982
955
  } else
983
956
  se("useStoryblok");
984
- return o;
985
- }, Ye = {
986
- install(s, e = {}) {
987
- s.directive("editable", Ve), s.component("StoryblokComponent", te), s.component("StoryblokRichText", Fe), e.enableFallbackComponent && !e.customFallbackComponent && s.component(
957
+ return s;
958
+ }, ct = {
959
+ install(e, t = {}) {
960
+ e.directive("editable", st), e.component("StoryblokComponent", re), e.component("StoryblokRichText", rt), t.enableFallbackComponent && !t.customFallbackComponent && e.component(
988
961
  "FallbackComponent",
989
- be(() => import("./FallbackComponent-Dky11gEu.js"))
962
+ ge(() => import("./FallbackComponent-Dky11gEu.js"))
990
963
  );
991
- const { storyblokApi: t } = De(e);
992
- I = t || null, s.provide("VueSDKOptions", e);
964
+ const { storyblokApi: r } = Qe(t);
965
+ S = r || null, e.provide("VueSDKOptions", t);
993
966
  }
994
967
  };
995
968
  export {
996
- g as BlockTypes,
997
- $ as MarkTypes,
998
- te as StoryblokComponent,
999
- Fe as StoryblokRichText,
1000
- Ye as StoryblokVue,
1001
- Z as TextTypes,
1002
- Ge as apiPlugin,
1003
- qe as renderRichText,
1004
- ee as richTextResolver,
1005
- Ke as useStoryblok,
1006
- Je as useStoryblokApi,
1007
- Ue as useStoryblokBridge,
1008
- Me as useStoryblokRichText
969
+ v as BlockTypes,
970
+ R as MarkTypes,
971
+ re as StoryblokComponent,
972
+ rt as StoryblokRichText,
973
+ ct as StoryblokVue,
974
+ Ce as TextTypes,
975
+ nt as apiPlugin,
976
+ it as renderRichText,
977
+ te as richTextResolver,
978
+ lt as useStoryblok,
979
+ at as useStoryblokApi,
980
+ Xe as useStoryblokBridge,
981
+ tt as useStoryblokRichText
1009
982
  };