@storyblok/react 4.7.0 → 5.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.
@@ -1,438 +1,347 @@
1
- let z = !1;
2
- const D = [], V = (n) => new Promise((e, t) => {
3
- if (typeof window > "u" || (window.storyblokRegisterEvent = (s) => {
1
+ function se(n, e) {
2
+ if (!e)
3
+ return { src: n, attrs: {} };
4
+ let t = 0, r = 0;
5
+ const s = {}, o = [];
6
+ function c(i, h, f, y, _) {
7
+ typeof i != "number" || i <= h || i >= f ? console.warn(`[StoryblokRichText] - ${y.charAt(0).toUpperCase() + y.slice(1)} value must be a number between ${h} and ${f} (inclusive)`) : _.push(`${y}(${i})`);
8
+ }
9
+ if (typeof e == "object") {
10
+ if (typeof e.width == "number" && e.width > 0 ? (s.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 ? (s.height = e.height, r = e.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), e.loading && ["lazy", "eager"].includes(e.loading) && (s.loading = e.loading), e.class && (s.class = e.class), e.filters) {
11
+ const { filters: i } = e || {}, { blur: h, brightness: f, fill: y, format: _, grayscale: T, quality: A, rotate: S } = i || {};
12
+ h && c(h, 0, 100, "blur", o), A && c(A, 0, 100, "quality", o), f && c(f, 0, 100, "brightness", o), y && o.push(`fill(${y})`), T && o.push("grayscale()"), S && [0, 90, 180, 270].includes(e.filters.rotate || 0) && o.push(`rotate(${S})`), _ && ["webp", "png", "jpeg"].includes(_) && o.push(`format(${_})`);
13
+ }
14
+ e.srcset && (s.srcset = e.srcset.map((i) => {
15
+ if (typeof i == "number")
16
+ return `${n}/m/${i}x0/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${i}w`;
17
+ if (Array.isArray(i) && i.length === 2) {
18
+ const [h, f] = i;
19
+ return `${n}/m/${h}x${f}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${h}w`;
20
+ } else {
21
+ console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
22
+ return;
23
+ }
24
+ }).join(", ")), e.sizes && (s.sizes = e.sizes.join(", "));
25
+ }
26
+ let l = `${n}/m/`;
27
+ return t > 0 && r > 0 && (l = `${l}${t}x${r}/`), o.length > 0 && (l = `${l}filters:${o.join(":")}`), {
28
+ src: l,
29
+ attrs: s
30
+ };
31
+ }
32
+ var v = /* @__PURE__ */ ((n) => (n.DOCUMENT = "doc", n.HEADING = "heading", n.PARAGRAPH = "paragraph", n.QUOTE = "blockquote", n.OL_LIST = "ordered_list", n.UL_LIST = "bullet_list", n.LIST_ITEM = "list_item", n.CODE_BLOCK = "code_block", n.HR = "horizontal_rule", n.BR = "hard_break", n.IMAGE = "image", n.EMOJI = "emoji", n.COMPONENT = "blok", n.TABLE = "table", n.TABLE_ROW = "tableRow", n.TABLE_CELL = "tableCell", n.TABLE_HEADER = "tableHeader", n))(v || {}), $ = /* @__PURE__ */ ((n) => (n.BOLD = "bold", n.STRONG = "strong", n.STRIKE = "strike", n.UNDERLINE = "underline", n.ITALIC = "italic", n.CODE = "code", n.LINK = "link", n.ANCHOR = "anchor", n.STYLED = "styled", n.SUPERSCRIPT = "superscript", n.SUBSCRIPT = "subscript", n.TEXT_STYLE = "textStyle", n.HIGHLIGHT = "highlight", n))($ || {}), V = /* @__PURE__ */ ((n) => (n.TEXT = "text", n))(V || {}), I = /* @__PURE__ */ ((n) => (n.URL = "url", n.STORY = "story", n.ASSET = "asset", n.EMAIL = "email", n))(I || {});
33
+ const re = [
34
+ "area",
35
+ "base",
36
+ "br",
37
+ "col",
38
+ "embed",
39
+ "hr",
40
+ "img",
41
+ "input",
42
+ "link",
43
+ "meta",
44
+ "param",
45
+ "source",
46
+ "track",
47
+ "wbr"
48
+ ], ne = (n = {}) => Object.keys(n).map((e) => `${e}="${n[e]}"`).join(" "), oe = (n = {}) => Object.keys(n).map((e) => `${e}: ${n[e]}`).join("; ");
49
+ function ie(n) {
50
+ return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
51
+ }
52
+ const O = (n) => Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0));
53
+ function D(n, e = {}, t) {
54
+ const r = ne(e), s = r ? `${n} ${r}` : n, o = Array.isArray(t) ? t.join("") : t || "";
55
+ if (n) {
56
+ if (re.includes(n))
57
+ return `<${s}>`;
58
+ } else return o;
59
+ return `<${s}>${o}</${n}>`;
60
+ }
61
+ function ae(n = {}) {
62
+ const e = /* @__PURE__ */ new Map(), {
63
+ renderFn: t = D,
64
+ textFn: r = ie,
65
+ resolvers: s = {},
66
+ optimizeImages: o = !1,
67
+ keyedResolvers: c = !1
68
+ } = n, l = t !== D, i = (a) => (u, d) => {
69
+ const p = u.attrs || {};
70
+ return d.render(a, p, u.children || null);
71
+ }, h = (a, u) => {
72
+ const { src: d, alt: p, title: m, srcset: w, sizes: b } = a.attrs || {};
73
+ let k = d, R = {};
74
+ if (o) {
75
+ const { src: ee, attrs: te } = se(d, o);
76
+ k = ee, R = te;
77
+ }
78
+ const Z = {
79
+ src: k,
80
+ alt: p,
81
+ title: m,
82
+ srcset: w,
83
+ sizes: b,
84
+ ...R
85
+ };
86
+ return u.render("img", O(Z));
87
+ }, f = (a, u) => {
88
+ const { level: d, ...p } = a.attrs || {};
89
+ return u.render(`h${d}`, p, a.children);
90
+ }, y = (a, u) => {
91
+ var d, p, m, w;
92
+ const b = u.render("img", {
93
+ src: (d = a.attrs) == null ? void 0 : d.fallbackImage,
94
+ alt: (p = a.attrs) == null ? void 0 : p.alt,
95
+ style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
96
+ draggable: "false",
97
+ loading: "lazy"
98
+ });
99
+ return u.render("span", {
100
+ "data-type": "emoji",
101
+ "data-name": (m = a.attrs) == null ? void 0 : m.name,
102
+ "data-emoji": (w = a.attrs) == null ? void 0 : w.emoji
103
+ }, b);
104
+ }, _ = (a, u) => u.render(
105
+ "pre",
106
+ a.attrs || {},
107
+ u.render("code", {}, a.children || "")
108
+ ), T = (a, u = !1) => ({ text: d, attrs: p }, m) => {
109
+ const { class: w, id: b, ...k } = p || {}, R = u ? {
110
+ class: w,
111
+ id: b,
112
+ style: oe(k) || void 0
113
+ } : p || {};
114
+ return m.render(a, O(R), d);
115
+ }, A = (a) => C(a), S = (a) => {
116
+ const { marks: u, ...d } = a;
117
+ if ("text" in a) {
118
+ if (u)
119
+ return u.reduce(
120
+ (m, w) => A({ ...w, text: m }),
121
+ A({ ...d, children: d.children })
122
+ );
123
+ const p = a.attrs || {};
124
+ if (c) {
125
+ const m = e.get("txt") || 0;
126
+ e.set("txt", m + 1), p.key = `txt-${m}`;
127
+ }
128
+ return r(d.text, p);
129
+ }
130
+ return "";
131
+ }, H = (a, u) => {
132
+ const { linktype: d, href: p, anchor: m, ...w } = a.attrs || {};
133
+ let b = "";
134
+ switch (d) {
135
+ case I.ASSET:
136
+ case I.URL:
137
+ b = p;
138
+ break;
139
+ case I.EMAIL:
140
+ b = `mailto:${p}`;
141
+ break;
142
+ case I.STORY:
143
+ b = p, m && (b = `${b}#${m}`);
144
+ break;
145
+ default:
146
+ b = p;
147
+ break;
148
+ }
149
+ const k = { ...w };
150
+ return b && (k.href = b), u.render("a", k, a.text);
151
+ }, J = (a, u) => {
152
+ var d, p;
153
+ return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), u.render("span", {
154
+ blok: (d = a == null ? void 0 : a.attrs) == null ? void 0 : d.body[0],
155
+ id: (p = a.attrs) == null ? void 0 : p.id,
156
+ style: "display: none"
157
+ });
158
+ }, Y = (a, u) => {
159
+ const d = {}, p = u.render("tbody", {}, a.children);
160
+ return u.render("table", d, p);
161
+ }, K = (a, u) => {
162
+ const d = {};
163
+ return u.render("tr", d, a.children);
164
+ }, W = (a, u) => {
165
+ const { colspan: d, rowspan: p, colwidth: m, backgroundColor: w, ...b } = a.attrs || {}, k = {
166
+ ...b
167
+ };
168
+ d > 1 && (k.colspan = d), p > 1 && (k.rowspan = p);
169
+ const R = [];
170
+ return m && R.push(`width: ${m}px;`), w && R.push(`background-color: ${w};`), R.length > 0 && (k.style = R.join(" ")), u.render("td", O(k), a.children);
171
+ }, X = (a, u) => {
172
+ const { colspan: d, rowspan: p, colwidth: m, backgroundColor: w, ...b } = a.attrs || {}, k = {
173
+ ...b
174
+ };
175
+ d > 1 && (k.colspan = d), p > 1 && (k.rowspan = p);
176
+ const R = [];
177
+ return m && R.push(`width: ${m}px;`), w && R.push(`background-color: ${w};`), R.length > 0 && (k.style = R.join(" ")), u.render("th", O(k), a.children);
178
+ }, U = /* @__PURE__ */ new Map([
179
+ [v.DOCUMENT, i("")],
180
+ [v.HEADING, f],
181
+ [v.PARAGRAPH, i("p")],
182
+ [v.UL_LIST, i("ul")],
183
+ [v.OL_LIST, i("ol")],
184
+ [v.LIST_ITEM, i("li")],
185
+ [v.IMAGE, h],
186
+ [v.EMOJI, y],
187
+ [v.CODE_BLOCK, _],
188
+ [v.HR, i("hr")],
189
+ [v.BR, i("br")],
190
+ [v.QUOTE, i("blockquote")],
191
+ [v.COMPONENT, J],
192
+ [V.TEXT, S],
193
+ [$.LINK, H],
194
+ [$.ANCHOR, H],
195
+ [$.STYLED, T("span", !0)],
196
+ [$.BOLD, T("strong")],
197
+ [$.TEXT_STYLE, T("span", !0)],
198
+ [$.ITALIC, T("em")],
199
+ [$.UNDERLINE, T("u")],
200
+ [$.STRIKE, T("s")],
201
+ [$.CODE, T("code")],
202
+ [$.SUPERSCRIPT, T("sup")],
203
+ [$.SUBSCRIPT, T("sub")],
204
+ [$.HIGHLIGHT, T("mark")],
205
+ [v.TABLE, Y],
206
+ [v.TABLE_ROW, K],
207
+ [v.TABLE_CELL, W],
208
+ [v.TABLE_HEADER, X]
209
+ ]), B = new Map([
210
+ ...U,
211
+ ...Object.entries(s).map(([a, u]) => [a, u])
212
+ ]), Q = () => ({
213
+ render: (a, u = {}, d) => {
214
+ if (c && a) {
215
+ const p = e.get(a) || 0;
216
+ e.set(a, p + 1), u.key = `${a}-${p}`;
217
+ }
218
+ return t(a, u, d);
219
+ },
220
+ originalResolvers: U,
221
+ mergedResolvers: B
222
+ });
223
+ function L(a) {
224
+ const u = B.get(a.type);
225
+ if (!u)
226
+ return console.error("<Storyblok>", `No resolver found for node type ${a.type}`), "";
227
+ const d = Q();
228
+ if (a.type === "text")
229
+ return u(a, d);
230
+ const p = a.content ? a.content.map(C) : void 0;
231
+ return u({
232
+ ...a,
233
+ children: p
234
+ }, d);
235
+ }
236
+ function C(a) {
237
+ return a.type === "doc" ? l ? a.content.map(L) : a.content.map(L).join("") : Array.isArray(a) ? a.map(L) : L(a);
238
+ }
239
+ return {
240
+ render: C
241
+ };
242
+ }
243
+ let M = !1;
244
+ const z = [], q = (n) => new Promise((e, t) => {
245
+ if (typeof window > "u") {
246
+ t(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
247
+ return;
248
+ }
249
+ if (window.storyblokRegisterEvent = (s) => {
4
250
  if (window.location === window.parent.location) {
5
251
  console.warn("You are not in Draft Mode or in the Visual Editor.");
6
252
  return;
7
253
  }
8
- z ? s() : D.push(s);
9
- }, document.getElementById("storyblok-javascript-bridge")))
254
+ M ? s() : z.push(s);
255
+ }, document.getElementById("storyblok-javascript-bridge")) {
256
+ e(void 0);
10
257
  return;
258
+ }
11
259
  const r = document.createElement("script");
12
260
  r.async = !0, r.src = n, r.id = "storyblok-javascript-bridge", r.onerror = (s) => t(s), r.onload = (s) => {
13
- D.forEach((o) => o()), z = !0, e(s);
261
+ z.forEach((o) => o()), M = !0, e(s);
14
262
  }, document.getElementsByTagName("head")[0].appendChild(r);
15
263
  });
16
- var ne = Object.defineProperty, oe = (n, e, t) => e in n ? ne(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, m = (n, e, t) => oe(n, typeof e != "symbol" ? e + "" : e, t);
17
- class ae extends Error {
264
+ var le = Object.defineProperty, ce = (n, e, t) => e in n ? le(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, g = (n, e, t) => ce(n, typeof e != "symbol" ? e + "" : e, t);
265
+ class he extends Error {
18
266
  constructor(e) {
19
267
  super(e), this.name = "AbortError";
20
268
  }
21
269
  }
22
- function ie(n, e, t) {
270
+ function ue(n, e, t) {
23
271
  if (!Number.isFinite(e))
24
272
  throw new TypeError("Expected `limit` to be a finite number");
25
273
  if (!Number.isFinite(t))
26
274
  throw new TypeError("Expected `interval` to be a finite number");
27
275
  const r = [];
28
- let s = [], o = 0, a = !1;
276
+ let s = [], o = 0, c = !1;
29
277
  const l = async () => {
30
278
  o++;
31
279
  const h = r.shift();
32
280
  if (h)
33
281
  try {
34
- const p = await n(...h.args);
35
- h.resolve(p);
36
- } catch (p) {
37
- h.reject(p);
282
+ const y = await n(...h.args);
283
+ h.resolve(y);
284
+ } catch (y) {
285
+ h.reject(y);
38
286
  }
39
- const d = setTimeout(() => {
40
- o--, r.length > 0 && l(), s = s.filter((p) => p !== d);
287
+ const f = setTimeout(() => {
288
+ o--, r.length > 0 && l(), s = s.filter((y) => y !== f);
41
289
  }, t);
42
- s.includes(d) || s.push(d);
43
- }, i = (...h) => a ? Promise.reject(
290
+ s.includes(f) || s.push(f);
291
+ }, i = (...h) => c ? Promise.reject(
44
292
  new Error(
45
293
  "Throttled function is already aborted and not accepting new promises"
46
294
  )
47
- ) : new Promise((d, p) => {
295
+ ) : new Promise((f, y) => {
48
296
  r.push({
49
- resolve: d,
50
- reject: p,
297
+ resolve: f,
298
+ reject: y,
51
299
  args: h
52
300
  }), o < e && l();
53
301
  });
54
302
  return i.abort = () => {
55
- a = !0, s.forEach(clearTimeout), s = [], r.forEach(
56
- (h) => h.reject(() => new ae("Throttle function aborted"))
303
+ c = !0, s.forEach(clearTimeout), s = [], r.forEach(
304
+ (h) => h.reject(() => new he("Throttle function aborted"))
57
305
  ), r.length = 0;
58
306
  }, i;
59
307
  }
60
- class C {
61
- constructor() {
62
- m(this, "isCDNUrl", (e = "") => e.includes("/cdn/")), m(this, "getOptionsPage", (e, t = 25, r = 1) => ({
63
- ...e,
64
- per_page: t,
65
- page: r
66
- })), m(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), m(this, "arrayFrom", (e = 0, t) => Array.from({ length: e }, t)), m(this, "range", (e = 0, t = e) => {
67
- const r = Math.abs(t - e) || 0, s = e < t ? 1 : -1;
68
- return this.arrayFrom(r, (o, a) => a * s + e);
69
- }), m(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), m(this, "flatMap", (e = [], t) => e.map(t).reduce((r, s) => [...r, ...s], [])), m(this, "escapeHTML", function(e) {
70
- const t = {
71
- "&": "&amp;",
72
- "<": "&lt;",
73
- ">": "&gt;",
74
- '"': "&quot;",
75
- "'": "&#39;"
76
- }, r = /[&<>"']/g, s = new RegExp(r.source);
77
- return e && s.test(e) ? e.replace(r, (o) => t[o]) : e;
78
- });
79
- }
80
- /**
81
- * @method stringify
82
- * @param {object} params
83
- * @param {string} prefix
84
- * @param {boolean} isArray
85
- * @return {string} Stringified object
86
- */
87
- stringify(e, t, r) {
88
- const s = [];
89
- for (const o in e) {
90
- if (!Object.prototype.hasOwnProperty.call(e, o))
91
- continue;
92
- const a = e[o];
93
- if (a == null)
94
- continue;
95
- const l = r ? "" : encodeURIComponent(o);
96
- let i;
97
- typeof a == "object" ? i = this.stringify(
98
- a,
99
- t ? t + encodeURIComponent(`[${l}]`) : l,
100
- Array.isArray(a)
101
- ) : i = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(a)}`, s.push(i);
102
- }
103
- return s.join("&");
104
- }
105
- /**
106
- * @method getRegionURL
107
- * @param {string} regionCode region code, could be eu, us, cn, ap or ca
108
- * @return {string} The base URL of the region
109
- */
110
- getRegionURL(e) {
111
- const t = "api.storyblok.com", r = "api-us.storyblok.com", s = "app.storyblokchina.cn", o = "api-ap.storyblok.com", a = "api-ca.storyblok.com";
112
- switch (e) {
113
- case "us":
114
- return r;
115
- case "cn":
116
- return s;
117
- case "ap":
118
- return o;
119
- case "ca":
120
- return a;
121
- default:
122
- return t;
123
- }
124
- }
125
- }
126
- const le = function(n, e) {
127
- const t = {};
128
- for (const r in n) {
129
- const s = n[r];
130
- e.includes(r) && s !== null && (t[r] = s);
131
- }
132
- return t;
133
- }, ce = (n) => n === "email", he = () => ({
134
- singleTag: "hr"
135
- }), ue = () => ({
136
- tag: "blockquote"
137
- }), de = () => ({
138
- tag: "ul"
139
- }), pe = (n) => ({
140
- tag: [
141
- "pre",
142
- {
143
- tag: "code",
144
- attrs: n.attrs
145
- }
146
- ]
147
- }), ge = () => ({
148
- singleTag: "br"
149
- }), fe = (n) => ({
150
- tag: `h${n.attrs.level}`
151
- }), me = (n) => ({
152
- singleTag: [
153
- {
154
- tag: "img",
155
- attrs: le(n.attrs, ["src", "alt", "title"])
156
- }
157
- ]
158
- }), ye = () => ({
159
- tag: "li"
160
- }), be = () => ({
161
- tag: "ol"
162
- }), ve = () => ({
163
- tag: "p"
164
- }), ke = (n) => ({
165
- tag: [
166
- {
167
- tag: "span",
168
- attrs: {
169
- "data-type": "emoji",
170
- "data-name": n.attrs.name,
171
- emoji: n.attrs.emoji
172
- }
173
- }
174
- ]
175
- }), Te = () => ({
176
- tag: "b"
177
- }), we = () => ({
178
- tag: "s"
179
- }), $e = () => ({
180
- tag: "u"
181
- }), Re = () => ({
182
- tag: "strong"
183
- }), _e = () => ({
184
- tag: "code"
185
- }), Ee = () => ({
186
- tag: "i"
187
- }), Se = (n) => {
188
- if (!n.attrs)
189
- return {
190
- tag: ""
191
- };
192
- const e = new C().escapeHTML, t = { ...n.attrs }, { linktype: r = "url" } = n.attrs;
193
- if (delete t.linktype, t.href && (t.href = e(n.attrs.href || "")), ce(r) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
194
- for (const s in t.custom)
195
- t[s] = t.custom[s];
196
- delete t.custom;
197
- }
198
- return {
199
- tag: [
200
- {
201
- tag: "a",
202
- attrs: t
203
- }
204
- ]
205
- };
206
- }, je = (n) => ({
207
- tag: [
208
- {
209
- tag: "span",
210
- attrs: n.attrs
211
- }
212
- ]
213
- }), xe = () => ({
214
- tag: "sub"
215
- }), Ie = () => ({
216
- tag: "sup"
217
- }), Ae = (n) => ({
218
- tag: [
219
- {
220
- tag: "span",
221
- attrs: n.attrs
222
- }
223
- ]
224
- }), Oe = (n) => {
225
- var e;
226
- return (e = n.attrs) != null && e.color ? {
227
- tag: [
228
- {
229
- tag: "span",
230
- attrs: {
231
- style: `background-color:${n.attrs.color};`
232
- }
233
- }
234
- ]
235
- } : {
236
- tag: ""
237
- };
238
- }, Le = (n) => {
239
- var e;
240
- return (e = n.attrs) != null && e.color ? {
241
- tag: [
242
- {
243
- tag: "span",
244
- attrs: {
245
- style: `color:${n.attrs.color}`
246
- }
247
- }
248
- ]
249
- } : {
250
- tag: ""
251
- };
252
- }, Ce = {
253
- nodes: {
254
- horizontal_rule: he,
255
- blockquote: ue,
256
- bullet_list: de,
257
- code_block: pe,
258
- hard_break: ge,
259
- heading: fe,
260
- image: me,
261
- list_item: ye,
262
- ordered_list: be,
263
- paragraph: ve,
264
- emoji: ke
265
- },
266
- marks: {
267
- bold: Te,
268
- strike: we,
269
- underline: $e,
270
- strong: Re,
271
- code: _e,
272
- italic: Ee,
273
- link: Se,
274
- styled: je,
275
- subscript: xe,
276
- superscript: Ie,
277
- anchor: Ae,
278
- highlight: Oe,
279
- textStyle: Le
308
+ const de = (n = "") => n.includes("/cdn/"), pe = (n, e = 25, t = 1) => ({
309
+ ...n,
310
+ per_page: e,
311
+ page: t
312
+ }), fe = (n) => new Promise((e) => setTimeout(e, n)), ye = (n = 0, e) => Array.from({ length: n }, e), ge = (n = 0, e = n) => {
313
+ const t = Math.abs(e - n) || 0, r = n < e ? 1 : -1;
314
+ return ye(t, (s, o) => o * r + n);
315
+ }, me = async (n, e) => Promise.all(n.map(e)), be = (n = [], e) => n.map(e).reduce((t, r) => [...t, ...r], []), N = (n, e, t) => {
316
+ const r = [];
317
+ for (const s in n) {
318
+ if (!Object.prototype.hasOwnProperty.call(n, s))
319
+ continue;
320
+ const o = n[s];
321
+ if (o == null)
322
+ continue;
323
+ const c = t ? "" : encodeURIComponent(s);
324
+ let l;
325
+ typeof o == "object" ? l = N(
326
+ o,
327
+ e ? e + encodeURIComponent(`[${c}]`) : c,
328
+ Array.isArray(o)
329
+ ) : l = `${e ? e + encodeURIComponent(`[${c}]`) : c}=${encodeURIComponent(o)}`, r.push(l);
280
330
  }
281
- }, Pe = function(n) {
331
+ return r.join("&");
332
+ }, F = (n) => {
282
333
  const e = {
283
- "&": "&amp;",
284
- "<": "&lt;",
285
- ">": "&gt;",
286
- '"': "&quot;",
287
- "'": "&#39;"
288
- }, t = /[&<>"']/g, r = new RegExp(t.source);
289
- return n && r.test(n) ? n.replace(t, (s) => e[s]) : n;
334
+ eu: "api.storyblok.com",
335
+ us: "api-us.storyblok.com",
336
+ cn: "app.storyblokchina.cn",
337
+ ap: "api-ap.storyblok.com",
338
+ ca: "api-ca.storyblok.com"
339
+ };
340
+ return e[n] ?? e.eu;
290
341
  };
291
- let q = !1;
292
- class P {
293
- constructor(e) {
294
- m(this, "marks"), m(this, "nodes"), e || (e = Ce), this.marks = e.marks || [], this.nodes = e.nodes || [];
295
- }
296
- addNode(e, t) {
297
- this.nodes[e] = t;
298
- }
299
- addMark(e, t) {
300
- this.marks[e] = t;
301
- }
302
- render(e, t = { optimizeImages: !1 }, r = !0) {
303
- if (!q && r && (console.warn(
304
- "Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` package instead. https://github.com/storyblok/richtext/"
305
- ), q = !0), e && e.content && Array.isArray(e.content)) {
306
- let s = "";
307
- return e.content.forEach((o) => {
308
- s += this.renderNode(o);
309
- }), t.optimizeImages ? this.optimizeImages(s, t.optimizeImages) : s;
310
- }
311
- return console.warn(
312
- `The render method must receive an Object with a "content" field.
313
- The "content" field must be an array of nodes as the type ISbRichtext.
314
- ISbRichtext:
315
- content?: ISbRichtext[]
316
- marks?: ISbRichtext[]
317
- attrs?: any
318
- text?: string
319
- type: string
320
-
321
- Example:
322
- {
323
- content: [
324
- {
325
- content: [
326
- {
327
- text: 'Hello World',
328
- type: 'text'
329
- }
330
- ],
331
- type: 'paragraph'
332
- }
333
- ],
334
- type: 'doc'
335
- }`
336
- ), "";
337
- }
338
- optimizeImages(e, t) {
339
- let r = 0, s = 0, o = "", a = "";
340
- typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (o += `width="${t.width}" `, r = t.width), typeof t.height == "number" && t.height > 0 && (o += `height="${t.height}" `, s = t.height), (t.loading === "lazy" || t.loading === "eager") && (o += `loading="${t.loading}" `), typeof t.class == "string" && t.class.length > 0 && (o += `class="${t.class}" `), t.filters && (typeof t.filters.blur == "number" && t.filters.blur >= 0 && t.filters.blur <= 100 && (a += `:blur(${t.filters.blur})`), typeof t.filters.brightness == "number" && t.filters.brightness >= -100 && t.filters.brightness <= 100 && (a += `:brightness(${t.filters.brightness})`), t.filters.fill && (t.filters.fill.match(/[0-9A-F]{6}/gi) || t.filters.fill === "transparent") && (a += `:fill(${t.filters.fill})`), t.filters.format && ["webp", "png", "jpeg"].includes(t.filters.format) && (a += `:format(${t.filters.format})`), typeof t.filters.grayscale == "boolean" && t.filters.grayscale && (a += ":grayscale()"), typeof t.filters.quality == "number" && t.filters.quality >= 0 && t.filters.quality <= 100 && (a += `:quality(${t.filters.quality})`), t.filters.rotate && [90, 180, 270].includes(t.filters.rotate) && (a += `:rotate(${t.filters.rotate})`), a.length > 0 && (a = `/filters${a}`))), o.length > 0 && (e = e.replace(/<img/g, `<img ${o.trim()}`));
341
- const l = r > 0 || s > 0 || a.length > 0 ? `${r}x${s}${a}` : "";
342
- return e = e.replace(
343
- /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,
344
- `a.storyblok.com/f/$1/$2.$3/m/${l}`
345
- ), typeof t != "boolean" && (t.sizes || t.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (i) => {
346
- var h, d;
347
- const p = i.match(
348
- /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g
349
- );
350
- if (p && p.length > 0) {
351
- const b = {
352
- srcset: (h = t.srcset) == null ? void 0 : h.map((y) => {
353
- if (typeof y == "number")
354
- return `//${p}/m/${y}x0${a} ${y}w`;
355
- if (typeof y == "object" && y.length === 2) {
356
- let S = 0, I = 0;
357
- return typeof y[0] == "number" && (S = y[0]), typeof y[1] == "number" && (I = y[1]), `//${p}/m/${S}x${I}${a} ${S}w`;
358
- }
359
- return "";
360
- }).join(", "),
361
- sizes: (d = t.sizes) == null ? void 0 : d.map((y) => y).join(", ")
362
- };
363
- let E = "";
364
- return b.srcset && (E += `srcset="${b.srcset}" `), b.sizes && (E += `sizes="${b.sizes}" `), i.replace(/<img/g, `<img ${E.trim()}`);
365
- }
366
- return i;
367
- })), e;
368
- }
369
- renderNode(e) {
370
- const t = [];
371
- e.marks && e.marks.forEach((s) => {
372
- const o = this.getMatchingMark(s);
373
- o && o.tag !== "" && t.push(this.renderOpeningTag(o.tag));
374
- });
375
- const r = this.getMatchingNode(e);
376
- return r && r.tag && t.push(this.renderOpeningTag(r.tag)), e.content ? e.content.forEach((s) => {
377
- t.push(this.renderNode(s));
378
- }) : e.text ? t.push(Pe(e.text)) : r && r.singleTag ? t.push(this.renderTag(r.singleTag, " /")) : r && r.html ? t.push(r.html) : e.type === "emoji" && t.push(this.renderEmoji(e)), r && r.tag && t.push(this.renderClosingTag(r.tag)), e.marks && e.marks.slice(0).reverse().forEach((s) => {
379
- const o = this.getMatchingMark(s);
380
- o && o.tag !== "" && t.push(this.renderClosingTag(o.tag));
381
- }), t.join("");
382
- }
383
- renderTag(e, t) {
384
- return e.constructor === String ? `<${e}${t}>` : e.map((r) => {
385
- if (r.constructor === String)
386
- return `<${r}${t}>`;
387
- {
388
- let s = `<${r.tag}`;
389
- if (r.attrs) {
390
- for (const o in r.attrs)
391
- if (Object.prototype.hasOwnProperty.call(r.attrs, o)) {
392
- const a = r.attrs[o];
393
- a !== null && (s += ` ${o}="${a}"`);
394
- }
395
- }
396
- return `${s}${t}>`;
397
- }
398
- }).join("");
399
- }
400
- renderOpeningTag(e) {
401
- return this.renderTag(e, "");
402
- }
403
- renderClosingTag(e) {
404
- return e.constructor === String ? `</${e}>` : e.slice(0).reverse().map((t) => t.constructor === String ? `</${t}>` : `</${t.tag}>`).join("");
405
- }
406
- getMatchingNode(e) {
407
- const t = this.nodes[e.type];
408
- if (typeof t == "function")
409
- return t(e);
410
- }
411
- getMatchingMark(e) {
412
- const t = this.marks[e.type];
413
- if (typeof t == "function")
414
- return t(e);
415
- }
416
- renderEmoji(e) {
417
- if (e.attrs.emoji)
418
- return e.attrs.emoji;
419
- const t = [
420
- {
421
- tag: "img",
422
- attrs: {
423
- src: e.attrs.fallbackImage,
424
- draggable: "false",
425
- loading: "lazy",
426
- align: "absmiddle"
427
- }
428
- }
429
- ];
430
- return this.renderTag(t, " /");
431
- }
432
- }
433
- class Ne {
342
+ class ve {
434
343
  constructor(e) {
435
- 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 = {};
344
+ g(this, "baseURL"), g(this, "timeout"), g(this, "headers"), g(this, "responseInterceptor"), g(this, "fetch"), g(this, "ejectInterceptor"), g(this, "url"), g(this, "parameters"), g(this, "fetchOptions"), this.baseURL = e.baseURL, this.headers = e.headers || new Headers(), this.timeout = e != null && e.timeout ? e.timeout * 1e3 : 0, this.responseInterceptor = e.responseInterceptor, this.fetch = (...t) => e.fetch ? e.fetch(...t) : fetch(...t), this.ejectInterceptor = !1, this.url = "", this.parameters = {}, this.fetchOptions = {};
436
345
  }
437
346
  /**
438
347
  *
@@ -468,14 +377,8 @@ class Ne {
468
377
  }
469
378
  async _methodHandler(e) {
470
379
  let t = `${this.baseURL}${this.url}`, r = null;
471
- if (e === "get") {
472
- const i = new C();
473
- t = `${this.baseURL}${this.url}?${i.stringify(
474
- this.parameters
475
- )}`;
476
- } else
477
- r = JSON.stringify(this.parameters);
478
- const s = new URL(t), o = new AbortController(), { signal: a } = o;
380
+ e === "get" ? t = `${this.baseURL}${this.url}?${N(this.parameters)}` : r = JSON.stringify(this.parameters);
381
+ const s = new URL(t), o = new AbortController(), { signal: c } = o;
479
382
  let l;
480
383
  this.timeout && (l = setTimeout(() => o.abort(), this.timeout));
481
384
  try {
@@ -483,7 +386,7 @@ class Ne {
483
386
  method: e,
484
387
  headers: this.headers,
485
388
  body: r,
486
- signal: a,
389
+ signal: c,
487
390
  ...this.fetchOptions
488
391
  });
489
392
  this.timeout && clearTimeout(l);
@@ -503,53 +406,77 @@ class Ne {
503
406
  eject() {
504
407
  this.ejectInterceptor = !0;
505
408
  }
409
+ /**
410
+ * Normalizes error messages from different response structures
411
+ * @param data The response data that might contain error information
412
+ * @returns A normalized error message string
413
+ */
414
+ _normalizeErrorMessage(e) {
415
+ if (Array.isArray(e))
416
+ return e[0] || "Unknown error";
417
+ if (e && typeof e == "object") {
418
+ if (e.error)
419
+ return e.error;
420
+ for (const t in e) {
421
+ if (Array.isArray(e[t]))
422
+ return `${t}: ${e[t][0]}`;
423
+ if (typeof e[t] == "string")
424
+ return `${t}: ${e[t]}`;
425
+ }
426
+ if (e.slug)
427
+ return e.slug;
428
+ }
429
+ return "Unknown error";
430
+ }
506
431
  _statusHandler(e) {
507
432
  const t = /20[0-6]/g;
508
433
  return new Promise((r, s) => {
509
434
  if (t.test(`${e.status}`))
510
435
  return r(e);
511
436
  const o = {
512
- message: e.statusText,
437
+ message: this._normalizeErrorMessage(e.data),
513
438
  status: e.status,
514
- response: Array.isArray(e.data) ? e.data[0] : e.data.error || e.data.slug
439
+ response: e
515
440
  };
516
441
  s(o);
517
442
  });
518
443
  }
519
444
  }
520
- const F = "SB-Agent", H = {
445
+ const G = "SB-Agent", P = {
521
446
  defaultAgentName: "SB-JS-CLIENT",
522
447
  defaultAgentVersion: "SB-Agent-Version",
523
448
  packageVersion: "6.0.0"
449
+ }, ke = {
450
+ DRAFT: "draft"
524
451
  };
525
- let O = {};
526
- const j = {};
527
- class He {
452
+ let j = {};
453
+ const E = {};
454
+ class we {
528
455
  /**
529
456
  *
530
457
  * @param config ISbConfig interface
531
458
  * @param pEndpoint string, optional
532
459
  */
533
460
  constructor(e, t) {
534
- m(this, "client"), m(this, "maxRetries"), m(this, "retriesDelay"), m(this, "throttle"), m(this, "accessToken"), m(this, "cache"), m(this, "helpers"), m(this, "resolveCounter"), m(this, "relations"), m(this, "links"), m(this, "richTextResolver"), m(this, "resolveNestedRelations"), m(this, "stringifiedStoriesCache");
461
+ g(this, "client"), g(this, "maxRetries"), g(this, "retriesDelay"), g(this, "throttle"), g(this, "accessToken"), g(this, "cache"), g(this, "resolveCounter"), g(this, "relations"), g(this, "links"), g(this, "version"), g(this, "richTextResolver"), g(this, "resolveNestedRelations"), g(this, "stringifiedStoriesCache"), g(this, "inlineAssets");
535
462
  let r = e.endpoint || t;
536
463
  if (!r) {
537
- const a = new C().getRegionURL, l = e.https === !1 ? "http" : "https";
538
- e.oauthToken ? r = `${l}://${a(e.region)}/v1` : r = `${l}://${a(e.region)}/v2`;
464
+ const c = e.https === !1 ? "http" : "https";
465
+ e.oauthToken ? r = `${c}://${F(e.region)}/v1` : r = `${c}://${F(e.region)}/v2`;
539
466
  }
540
467
  const s = new Headers();
541
- 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(([a, l]) => {
542
- s.set(a, l);
543
- }), s.has(F) || (s.set(F, H.defaultAgentName), s.set(
544
- H.defaultAgentVersion,
545
- H.packageVersion
468
+ 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(([c, l]) => {
469
+ s.set(c, l);
470
+ }), s.has(G) || (s.set(G, P.defaultAgentName), s.set(
471
+ P.defaultAgentVersion,
472
+ P.packageVersion
546
473
  ));
547
474
  let o = 5;
548
- e.oauthToken && (s.set("Authorization", e.oauthToken), o = 3), e.rateLimit && (o = e.rateLimit), e.richTextSchema ? this.richTextResolver = new P(e.richTextSchema) : this.richTextResolver = new P(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = ie(
475
+ 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(
549
476
  this.throttledRequest.bind(this),
550
477
  o,
551
478
  1e3
552
- ), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new C(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new Ne({
479
+ ), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || ke.DRAFT, this.inlineAssets = e.inlineAssets || !1, this.client = new ve({
553
480
  baseURL: r,
554
481
  timeout: e.timeout || 0,
555
482
  headers: s,
@@ -557,70 +484,58 @@ class He {
557
484
  fetch: e.fetch
558
485
  });
559
486
  }
560
- setComponentResolver(e) {
561
- this.richTextResolver.addNode("blok", (t) => {
562
- let r = "";
563
- return t.attrs.body && t.attrs.body.forEach((s) => {
564
- r += e(s.component, s);
565
- }), {
566
- html: r
567
- };
568
- });
569
- }
570
487
  parseParams(e) {
571
- return e.token || (e.token = this.getToken()), e.cv || (e.cv = j[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
488
+ 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;
572
489
  }
573
490
  factoryParamOptions(e, t) {
574
- return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
491
+ return de(e) ? this.parseParams(t) : t;
575
492
  }
576
493
  makeRequest(e, t, r, s, o) {
577
- const a = this.factoryParamOptions(
494
+ const c = this.factoryParamOptions(
578
495
  e,
579
- this.helpers.getOptionsPage(t, r, s)
496
+ pe(t, r, s)
580
497
  );
581
- return this.cacheResponse(e, a, void 0, o);
498
+ return this.cacheResponse(e, c, void 0, o);
582
499
  }
583
- get(e, t, r) {
500
+ get(e, t = {}, r) {
584
501
  t || (t = {});
585
- const s = `/${e}`, o = this.factoryParamOptions(s, t);
502
+ const s = `/${e}`;
503
+ t.version = t.version || this.version;
504
+ const o = this.factoryParamOptions(s, t);
586
505
  return this.cacheResponse(s, o, void 0, r);
587
506
  }
588
- async getAll(e, t, r, s) {
589
- const o = (t == null ? void 0 : t.per_page) || 25, a = `/${e}`.replace(/\/$/, ""), l = r ?? a.substring(a.lastIndexOf("/") + 1), i = 1, h = await this.makeRequest(
590
- a,
507
+ async getAll(e, t = {}, r, s) {
508
+ const o = (t == null ? void 0 : t.per_page) || 25, c = `/${e}`.replace(/\/$/, ""), l = r ?? c.substring(c.lastIndexOf("/") + 1);
509
+ t.version = t.version || this.version;
510
+ const i = 1, h = await this.makeRequest(
511
+ c,
591
512
  t,
592
513
  o,
593
514
  i,
594
515
  s
595
- ), d = h.total ? Math.ceil(h.total / o) : 1, p = await this.helpers.asyncMap(
596
- this.helpers.range(i, d),
597
- (b) => this.makeRequest(a, t, o, b + 1, s)
516
+ ), f = h.total ? Math.ceil(h.total / o) : 1, y = await me(
517
+ ge(i, f),
518
+ (_) => this.makeRequest(c, t, o, _ + 1, s)
598
519
  );
599
- return this.helpers.flatMap([h, ...p], (b) => Object.values(b.data[l]));
520
+ return be([h, ...y], (_) => Object.values(_.data[l]));
600
521
  }
601
- post(e, t, r) {
522
+ post(e, t = {}, r) {
602
523
  const s = `/${e}`;
603
- return Promise.resolve(
604
- this.throttle("post", s, t, r)
605
- );
524
+ return this.throttle("post", s, t, r);
606
525
  }
607
- put(e, t, r) {
526
+ put(e, t = {}, r) {
608
527
  const s = `/${e}`;
609
- return Promise.resolve(
610
- this.throttle("put", s, t, r)
611
- );
528
+ return this.throttle("put", s, t, r);
612
529
  }
613
- delete(e, t, r) {
530
+ delete(e, t = {}, r) {
614
531
  t || (t = {});
615
532
  const s = `/${e}`;
616
- return Promise.resolve(
617
- this.throttle("delete", s, t, r)
618
- );
533
+ return this.throttle("delete", s, t, r);
619
534
  }
620
- getStories(e, t) {
535
+ getStories(e = {}, t) {
621
536
  return this._addResolveLevel(e), this.get("cdn/stories", e, t);
622
537
  }
623
- getStory(e, t, r) {
538
+ getStory(e, t = {}, r) {
624
539
  return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, r);
625
540
  }
626
541
  getToken() {
@@ -682,7 +597,7 @@ class He {
682
597
  * allowing flexible specification of relation patterns.
683
598
  */
684
599
  _insertRelations(e, t, r, s) {
685
- if (Array.isArray(r) ? r.find((a) => a.endsWith(`.${t}`)) : r.endsWith(`.${t}`)) {
600
+ if (Array.isArray(r) ? r.find((c) => c.endsWith(`.${t}`)) : r.endsWith(`.${t}`)) {
686
601
  this._resolveField(e, t, s);
687
602
  return;
688
603
  }
@@ -696,13 +611,13 @@ class He {
696
611
  * @param resolveId - The unique identifier for the current resolution context
697
612
  */
698
613
  iterateTree(e, t, r) {
699
- const s = (o, a = "") => {
614
+ const s = (o, c = "") => {
700
615
  if (!(!o || o._stopResolving)) {
701
616
  if (Array.isArray(o))
702
- o.forEach((l, i) => s(l, `${a}[${i}]`));
617
+ o.forEach((l, i) => s(l, `${c}[${i}]`));
703
618
  else if (typeof o == "object")
704
619
  for (const l in o) {
705
- const i = a ? `${a}.${l}` : l;
620
+ const i = c ? `${c}.${l}` : l;
706
621
  (o.component && o._uid || o.type === "link") && (this._insertRelations(o, l, t, r), this._insertLinks(o, l, r)), s(o[l], i);
707
622
  }
708
623
  }
@@ -712,18 +627,18 @@ class He {
712
627
  async resolveLinks(e, t, r) {
713
628
  let s = [];
714
629
  if (e.link_uuids) {
715
- const o = e.link_uuids.length, a = [], l = 50;
630
+ const o = e.link_uuids.length, c = [], l = 50;
716
631
  for (let i = 0; i < o; i += l) {
717
632
  const h = Math.min(o, i + l);
718
- a.push(e.link_uuids.slice(i, h));
633
+ c.push(e.link_uuids.slice(i, h));
719
634
  }
720
- for (let i = 0; i < a.length; i++)
635
+ for (let i = 0; i < c.length; i++)
721
636
  (await this.getStories({
722
637
  per_page: l,
723
638
  language: t.language,
724
639
  version: t.version,
725
640
  starts_with: t.starts_with,
726
- by_uuids: a[i].join(",")
641
+ by_uuids: c[i].join(",")
727
642
  })).data.stories.forEach(
728
643
  (h) => {
729
644
  s.push(h);
@@ -741,18 +656,18 @@ class He {
741
656
  async resolveRelations(e, t, r) {
742
657
  let s = [];
743
658
  if (e.rel_uuids) {
744
- const o = e.rel_uuids.length, a = [], l = 50;
659
+ const o = e.rel_uuids.length, c = [], l = 50;
745
660
  for (let i = 0; i < o; i += l) {
746
661
  const h = Math.min(o, i + l);
747
- a.push(e.rel_uuids.slice(i, h));
662
+ c.push(e.rel_uuids.slice(i, h));
748
663
  }
749
- for (let i = 0; i < a.length; i++)
664
+ for (let i = 0; i < c.length; i++)
750
665
  (await this.getStories({
751
666
  per_page: l,
752
667
  language: t.language,
753
668
  version: t.version,
754
669
  starts_with: t.starts_with,
755
- by_uuids: a[i].join(","),
670
+ by_uuids: c[i].join(","),
756
671
  excluding_fields: t.excluding_fields
757
672
  })).data.stories.forEach((h) => {
758
673
  s.push(h);
@@ -778,53 +693,53 @@ class He {
778
693
  */
779
694
  async resolveStories(e, t, r) {
780
695
  var s, o;
781
- let a = [];
782
- if (this.links[r] = {}, this.relations[r] = {}, 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, r)), t.resolve_links && ["1", "story", "url", "link"].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)
696
+ let c = [];
697
+ if (this.links[r] = {}, this.relations[r] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (c = t.resolve_relations.split(",")), await this.resolveRelations(e, t, r)), t.resolve_links && ["1", "story", "url", "link"].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)
783
698
  for (const l in this.relations[r])
784
699
  this.iterateTree(
785
700
  this.relations[r][l],
786
- a,
701
+ c,
787
702
  r
788
703
  );
789
- e.story ? this.iterateTree(e.story, a, r) : e.stories.forEach((l) => {
790
- this.iterateTree(l, a, r);
704
+ e.story ? this.iterateTree(e.story, c, r) : e.stories.forEach((l) => {
705
+ this.iterateTree(l, c, r);
791
706
  }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
792
707
  }
793
708
  async cacheResponse(e, t, r, s) {
794
- const o = this.helpers.stringify({ url: e, params: t }), a = this.cacheProvider();
709
+ const o = N({ url: e, params: t }), c = this.cacheProvider();
795
710
  if (t.version === "published" && e !== "/cdn/spaces/me") {
796
- const l = await a.get(o);
711
+ const l = await c.get(o);
797
712
  if (l)
798
713
  return Promise.resolve(l);
799
714
  }
800
715
  return new Promise(async (l, i) => {
801
716
  var h;
802
717
  try {
803
- const d = await this.throttle(
718
+ const f = await this.throttle(
804
719
  "get",
805
720
  e,
806
721
  t,
807
722
  s
808
723
  );
809
- if (d.status !== 200)
810
- return i(d);
811
- let p = { data: d.data, headers: d.headers };
812
- if ((h = d.headers) != null && h["per-page"] && (p = Object.assign({}, p, {
813
- perPage: d.headers["per-page"] ? Number.parseInt(d.headers["per-page"]) : 0,
814
- total: d.headers["per-page"] ? Number.parseInt(d.headers.total) : 0
815
- })), p.data.story || p.data.stories) {
816
- const E = this.resolveCounter = ++this.resolveCounter % 1e3;
817
- await this.resolveStories(p.data, t, `${E}`);
724
+ if (f.status !== 200)
725
+ return i(f);
726
+ let y = { data: f.data, headers: f.headers };
727
+ if ((h = f.headers) != null && h["per-page"] && (y = Object.assign({}, y, {
728
+ perPage: f.headers["per-page"] ? Number.parseInt(f.headers["per-page"]) : 0,
729
+ total: f.headers["per-page"] ? Number.parseInt(f.headers.total) : 0
730
+ })), y.data.story || y.data.stories) {
731
+ const T = this.resolveCounter = ++this.resolveCounter % 1e3;
732
+ await this.resolveStories(y.data, t, `${T}`), y = await this.processInlineAssets(y);
818
733
  }
819
- t.version === "published" && e !== "/cdn/spaces/me" && await a.set(o, p);
820
- const b = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
821
- return t.token && p.data.cv && (b && j[t.token] && j[t.token] !== p.data.cv && await this.flushCache(), j[t.token] = p.data.cv), l(p);
822
- } catch (d) {
823
- if (d.response && d.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
734
+ t.version === "published" && e !== "/cdn/spaces/me" && await c.set(o, y);
735
+ const _ = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
736
+ return t.token && y.data.cv && (_ && E[t.token] && E[t.token] !== y.data.cv && await this.flushCache(), E[t.token] = y.data.cv), l(y);
737
+ } catch (f) {
738
+ if (f.response && f.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
824
739
  return console.log(
825
740
  `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
826
- ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, r).then(l).catch(i);
827
- i(d);
741
+ ), await fe(this.retriesDelay), this.cacheResponse(e, t, r).then(l).catch(i);
742
+ i(f);
828
743
  }
829
744
  });
830
745
  }
@@ -832,37 +747,38 @@ class He {
832
747
  return this.client.setFetchOptions(s), this.client[e](t, r);
833
748
  }
834
749
  cacheVersions() {
835
- return j;
750
+ return E;
836
751
  }
837
752
  cacheVersion() {
838
- return j[this.accessToken];
753
+ return E[this.accessToken];
839
754
  }
840
755
  setCacheVersion(e) {
841
- this.accessToken && (j[this.accessToken] = e);
756
+ this.accessToken && (E[this.accessToken] = e);
842
757
  }
843
758
  clearCacheVersion() {
844
- this.accessToken && (j[this.accessToken] = 0);
759
+ this.accessToken && (E[this.accessToken] = 0);
845
760
  }
846
761
  cacheProvider() {
847
762
  switch (this.cache.type) {
848
763
  case "memory":
849
764
  return {
850
765
  get(e) {
851
- return Promise.resolve(O[e]);
766
+ return Promise.resolve(j[e]);
852
767
  },
853
768
  getAll() {
854
- return Promise.resolve(O);
769
+ return Promise.resolve(j);
855
770
  },
856
771
  set(e, t) {
857
- return O[e] = t, Promise.resolve(void 0);
772
+ return j[e] = t, Promise.resolve(void 0);
858
773
  },
859
774
  flush() {
860
- return O = {}, Promise.resolve(void 0);
775
+ return j = {}, Promise.resolve(void 0);
861
776
  }
862
777
  };
863
778
  case "custom":
864
779
  if (this.cache.custom)
865
780
  return this.cache.custom;
781
+ // eslint-disable-next-line no-fallthrough
866
782
  default:
867
783
  return {
868
784
  get() {
@@ -883,8 +799,27 @@ class He {
883
799
  async flushCache() {
884
800
  return await this.cacheProvider().flush(), this.clearCacheVersion(), this;
885
801
  }
802
+ async processInlineAssets(e) {
803
+ if (!this.inlineAssets)
804
+ return e;
805
+ const t = (r) => {
806
+ if (!r || typeof r != "object")
807
+ return r;
808
+ if (Array.isArray(r))
809
+ return r.map((o) => t(o));
810
+ let s = { ...r };
811
+ s.fieldtype === "asset" && Array.isArray(e.data.assets) && (s = {
812
+ ...s,
813
+ ...e.data.assets.find((o) => o.id === s.id)
814
+ });
815
+ for (const o in s)
816
+ typeof s[o] == "object" && (s[o] = t(s[o]));
817
+ return s;
818
+ };
819
+ 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;
820
+ }
886
821
  }
887
- const Fe = (n = {}) => {
822
+ const Te = (n = {}) => {
888
823
  const { apiOptions: e } = n;
889
824
  if (!e || !e.accessToken) {
890
825
  console.error(
@@ -892,8 +827,8 @@ const Fe = (n = {}) => {
892
827
  );
893
828
  return;
894
829
  }
895
- return { storyblokApi: new He(e) };
896
- }, Ge = (n) => {
830
+ return { storyblokApi: new we(e) };
831
+ }, Re = (n) => {
897
832
  if (typeof n != "object" || typeof n._editable > "u")
898
833
  return {};
899
834
  try {
@@ -908,249 +843,13 @@ const Fe = (n = {}) => {
908
843
  return {};
909
844
  }
910
845
  };
911
- function Me(n, e) {
912
- if (!e)
913
- return { src: n, attrs: {} };
914
- let t = 0, r = 0;
915
- const s = {}, o = [];
916
- function a(i, h, d, p, b) {
917
- typeof i != "number" || i <= h || i >= d ? console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase() + p.slice(1)} value must be a number between ${h} and ${d} (inclusive)`) : b.push(`${p}(${i})`);
918
- }
919
- if (typeof e == "object") {
920
- if (typeof e.width == "number" && e.width > 0 ? (s.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 ? (s.height = e.height, r = e.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), e.loading && ["lazy", "eager"].includes(e.loading) && (s.loading = e.loading), e.class && (s.class = e.class), e.filters) {
921
- const { filters: i } = e || {}, { blur: h, brightness: d, fill: p, format: b, grayscale: E, quality: y, rotate: S } = i || {};
922
- h && a(h, 0, 100, "blur", o), y && a(y, 0, 100, "quality", o), d && a(d, 0, 100, "brightness", o), p && o.push(`fill(${p})`), E && o.push("grayscale()"), S && [0, 90, 180, 270].includes(e.filters.rotate || 0) && o.push(`rotate(${S})`), b && ["webp", "png", "jpeg"].includes(b) && o.push(`format(${b})`);
923
- }
924
- e.srcset && (s.srcset = e.srcset.map((i) => {
925
- if (typeof i == "number")
926
- return `${n}/m/${i}x0/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${i}w`;
927
- if (Array.isArray(i) && i.length === 2) {
928
- const [h, d] = i;
929
- return `${n}/m/${h}x${d}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${h}w`;
930
- } else {
931
- console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
932
- return;
933
- }
934
- }).join(", ")), e.sizes && (s.sizes = e.sizes.join(", "));
935
- }
936
- let l = `${n}/m/`;
937
- return t > 0 && r > 0 && (l = `${l}${t}x${r}/`), o.length > 0 && (l = `${l}filters:${o.join(":")}`), {
938
- src: l,
939
- attrs: s
940
- };
941
- }
942
- var T = /* @__PURE__ */ ((n) => (n.DOCUMENT = "doc", n.HEADING = "heading", n.PARAGRAPH = "paragraph", n.QUOTE = "blockquote", n.OL_LIST = "ordered_list", n.UL_LIST = "bullet_list", n.LIST_ITEM = "list_item", n.CODE_BLOCK = "code_block", n.HR = "horizontal_rule", n.BR = "hard_break", n.IMAGE = "image", n.EMOJI = "emoji", n.COMPONENT = "blok", n.TABLE = "table", n.TABLE_ROW = "tableRow", n.TABLE_CELL = "tableCell", n.TABLE_HEADER = "tableHeader", n))(T || {}), _ = /* @__PURE__ */ ((n) => (n.BOLD = "bold", n.STRONG = "strong", n.STRIKE = "strike", n.UNDERLINE = "underline", n.ITALIC = "italic", n.CODE = "code", n.LINK = "link", n.ANCHOR = "anchor", n.STYLED = "styled", n.SUPERSCRIPT = "superscript", n.SUBSCRIPT = "subscript", n.TEXT_STYLE = "textStyle", n.HIGHLIGHT = "highlight", n))(_ || {}), J = /* @__PURE__ */ ((n) => (n.TEXT = "text", n))(J || {}), x = /* @__PURE__ */ ((n) => (n.URL = "url", n.STORY = "story", n.ASSET = "asset", n.EMAIL = "email", n))(x || {});
943
- const Ue = [
944
- "area",
945
- "base",
946
- "br",
947
- "col",
948
- "embed",
949
- "hr",
950
- "img",
951
- "input",
952
- "link",
953
- "meta",
954
- "param",
955
- "source",
956
- "track",
957
- "wbr"
958
- ], Be = (n = {}) => Object.keys(n).map((e) => `${e}="${n[e]}"`).join(" "), ze = (n = {}) => Object.keys(n).map((e) => `${e}: ${n[e]}`).join("; ");
959
- function De(n) {
960
- return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
961
- }
962
- const L = (n) => Object.fromEntries(Object.entries(n).filter(([e, t]) => t !== void 0));
963
- function G(n, e = {}, t) {
964
- const r = Be(e), s = r ? `${n} ${r}` : n, o = Array.isArray(t) ? t.join("") : t || "";
965
- if (n) {
966
- if (Ue.includes(n))
967
- return `<${s}>`;
968
- } else return o;
969
- return `<${s}>${o}</${n}>`;
970
- }
971
- function Ve(n = {}) {
972
- const e = /* @__PURE__ */ new Map(), {
973
- renderFn: t = G,
974
- textFn: r = De,
975
- resolvers: s = {},
976
- optimizeImages: o = !1,
977
- keyedResolvers: a = !1
978
- } = n, l = t !== G, i = () => ({ render: (c, u = {}, g) => {
979
- if (a && c) {
980
- const f = e.get(c) || 0;
981
- e.set(c, f + 1), u.key = `${c}-${f}`;
982
- }
983
- return t(c, u, g);
984
- } }), h = (c) => (u, g) => {
985
- const f = u.attrs || {};
986
- return g.render(c, f, u.children || null);
987
- }, d = (c, u) => {
988
- const { src: g, alt: f, title: v, srcset: $, sizes: k } = c.attrs || {};
989
- let w = g, R = {};
990
- if (o) {
991
- const { src: re, attrs: se } = Me(g, o);
992
- w = re, R = se;
993
- }
994
- const te = {
995
- src: w,
996
- alt: f,
997
- title: v,
998
- srcset: $,
999
- sizes: k,
1000
- ...R
1001
- };
1002
- return u.render("img", L(te));
1003
- }, p = (c, u) => {
1004
- const { level: g, ...f } = c.attrs || {};
1005
- return u.render(`h${g}`, f, c.children);
1006
- }, b = (c, u) => {
1007
- var g, f, v, $;
1008
- const k = u.render("img", {
1009
- src: (g = c.attrs) == null ? void 0 : g.fallbackImage,
1010
- alt: (f = c.attrs) == null ? void 0 : f.alt,
1011
- style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
1012
- draggable: "false",
1013
- loading: "lazy"
1014
- });
1015
- return u.render("span", {
1016
- "data-type": "emoji",
1017
- "data-name": (v = c.attrs) == null ? void 0 : v.name,
1018
- "data-emoji": ($ = c.attrs) == null ? void 0 : $.emoji
1019
- }, k);
1020
- }, E = (c, u) => u.render(
1021
- "pre",
1022
- c.attrs || {},
1023
- u.render("code", {}, c.children || "")
1024
- ), y = (c, u = !1) => ({ text: g, attrs: f }, v) => {
1025
- const { class: $, id: k, ...w } = f || {}, R = u ? {
1026
- class: $,
1027
- id: k,
1028
- style: ze(w) || void 0
1029
- } : f || {};
1030
- return v.render(c, L(R), g);
1031
- }, S = (c) => N(c), I = (c) => {
1032
- const { marks: u, ...g } = c;
1033
- if ("text" in c) {
1034
- if (u)
1035
- return u.reduce(
1036
- (v, $) => S({ ...$, text: v }),
1037
- S({ ...g, children: g.children })
1038
- );
1039
- const f = c.attrs || {};
1040
- if (a) {
1041
- const v = e.get("txt") || 0;
1042
- e.set("txt", v + 1), f.key = `txt-${v}`;
1043
- }
1044
- return r(g.text, f);
1045
- }
1046
- return "";
1047
- }, B = (c, u) => {
1048
- const { linktype: g, href: f, anchor: v, ...$ } = c.attrs || {};
1049
- let k = "";
1050
- switch (g) {
1051
- case x.ASSET:
1052
- case x.URL:
1053
- k = f;
1054
- break;
1055
- case x.EMAIL:
1056
- k = `mailto:${f}`;
1057
- break;
1058
- case x.STORY:
1059
- k = f, v && (k = `${k}#${v}`);
1060
- break;
1061
- default:
1062
- k = f;
1063
- break;
1064
- }
1065
- const w = { ...$ };
1066
- return k && (w.href = k), u.render("a", w, c.text);
1067
- }, Y = (c, u) => {
1068
- var g, f;
1069
- return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), u.render("span", {
1070
- blok: (g = c == null ? void 0 : c.attrs) == null ? void 0 : g.body[0],
1071
- id: (f = c.attrs) == null ? void 0 : f.id,
1072
- style: "display: none"
1073
- });
1074
- }, W = (c, u) => {
1075
- const g = {}, f = u.render("tbody", {}, c.children);
1076
- return u.render("table", g, f);
1077
- }, X = (c, u) => {
1078
- const g = {};
1079
- return u.render("tr", g, c.children);
1080
- }, Q = (c, u) => {
1081
- const { colspan: g, rowspan: f, colwidth: v, backgroundColor: $, ...k } = c.attrs || {}, w = {
1082
- ...k
1083
- };
1084
- g > 1 && (w.colspan = g), f > 1 && (w.rowspan = f);
1085
- const R = [];
1086
- return v && R.push(`width: ${v}px;`), $ && R.push(`background-color: ${$};`), R.length > 0 && (w.style = R.join(" ")), u.render("td", L(w), c.children);
1087
- }, Z = (c, u) => {
1088
- const { colspan: g, rowspan: f, colwidth: v, backgroundColor: $, ...k } = c.attrs || {}, w = {
1089
- ...k
1090
- };
1091
- g > 1 && (w.colspan = g), f > 1 && (w.rowspan = f);
1092
- const R = [];
1093
- return v && R.push(`width: ${v}px;`), $ && R.push(`background-color: ${$};`), R.length > 0 && (w.style = R.join(" ")), u.render("th", L(w), c.children);
1094
- }, ee = new Map([
1095
- [T.DOCUMENT, h("")],
1096
- [T.HEADING, p],
1097
- [T.PARAGRAPH, h("p")],
1098
- [T.UL_LIST, h("ul")],
1099
- [T.OL_LIST, h("ol")],
1100
- [T.LIST_ITEM, h("li")],
1101
- [T.IMAGE, d],
1102
- [T.EMOJI, b],
1103
- [T.CODE_BLOCK, E],
1104
- [T.HR, h("hr")],
1105
- [T.BR, h("br")],
1106
- [T.QUOTE, h("blockquote")],
1107
- [T.COMPONENT, Y],
1108
- [J.TEXT, I],
1109
- [_.LINK, B],
1110
- [_.ANCHOR, B],
1111
- [_.STYLED, y("span", !0)],
1112
- [_.BOLD, y("strong")],
1113
- [_.TEXT_STYLE, y("span", !0)],
1114
- [_.ITALIC, y("em")],
1115
- [_.UNDERLINE, y("u")],
1116
- [_.STRIKE, y("s")],
1117
- [_.CODE, y("code")],
1118
- [_.SUPERSCRIPT, y("sup")],
1119
- [_.SUBSCRIPT, y("sub")],
1120
- [_.HIGHLIGHT, y("mark")],
1121
- [T.TABLE, W],
1122
- [T.TABLE_ROW, X],
1123
- [T.TABLE_CELL, Q],
1124
- [T.TABLE_HEADER, Z],
1125
- ...Object.entries(s).map(([c, u]) => [c, u])
1126
- ]);
1127
- function A(c) {
1128
- const u = ee.get(c.type);
1129
- if (!u)
1130
- return console.error("<Storyblok>", `No resolver found for node type ${c.type}`), "";
1131
- const g = i();
1132
- if (c.type === "text")
1133
- return u(c, g);
1134
- const f = c.content ? c.content.map(N) : void 0;
1135
- return u({
1136
- ...c,
1137
- children: f
1138
- }, g);
1139
- }
1140
- function N(c) {
1141
- return c.type === "doc" ? l ? c.content.map(A) : c.content.map(A).join("") : Array.isArray(c) ? c.map(A) : A(c);
1142
- }
1143
- return {
1144
- render: N
1145
- };
1146
- }
1147
- let M, U = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1148
- const Je = (n, e, t = {}) => {
846
+ let x = "https://app.storyblok.com/f/storyblok-v2-latest.js";
847
+ const _e = (n, e, t = {}) => {
1149
848
  var r;
1150
849
  const s = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = new URL((r = window.location) == null ? void 0 : r.href).searchParams.get(
1151
850
  "_storyblok"
1152
- ), a = o !== null && +o === n;
1153
- if (!(!s || !a)) {
851
+ ), c = o !== null && +o === n;
852
+ if (!(!s || !c)) {
1154
853
  if (!n) {
1155
854
  console.warn("Story ID is not defined. Please provide a valid ID.");
1156
855
  return;
@@ -1162,59 +861,38 @@ const Je = (n, e, t = {}) => {
1162
861
  });
1163
862
  });
1164
863
  }
1165
- }, K = (n, e) => {
1166
- n.addNode("blok", (t) => {
1167
- let r = "";
1168
- return t.attrs.body.forEach((s) => {
1169
- r += e(s.component, s);
1170
- }), {
1171
- html: r
1172
- };
1173
- });
1174
- }, Ke = (n = {}) => {
864
+ }, $e = (n = {}) => {
1175
865
  var e, t;
1176
866
  const {
1177
867
  bridge: r,
1178
868
  accessToken: s,
1179
869
  use: o = [],
1180
- apiOptions: a = {},
1181
- richText: l = {},
1182
- bridgeUrl: i
870
+ apiOptions: c = {},
871
+ bridgeUrl: l
1183
872
  } = n;
1184
- a.accessToken = a.accessToken || s;
1185
- const h = { bridge: r, apiOptions: a };
1186
- let d = {};
1187
- o.forEach((b) => {
1188
- d = { ...d, ...b(h) };
1189
- }), i && (U = i);
1190
- const p = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
1191
- return r !== !1 && p && V(U), M = new P(l.schema), l.resolver && K(M, l.resolver), d;
1192
- }, qe = (n) => {
1193
- var e;
1194
- return !n || !((e = n == null ? void 0 : n.content) != null && e.some((t) => t.content || t.type === "blok" || t.type === "horizontal_rule"));
1195
- }, Ye = (n, e, t) => {
1196
- let r = t || M;
1197
- if (!r) {
1198
- console.error(
1199
- "Please initialize the Storyblok SDK before calling the renderRichText function"
1200
- );
1201
- return;
1202
- }
1203
- return qe(n) ? "" : (e && (r = new P(e.schema), e.resolver && K(r, e.resolver)), r.render(n, {}, !1));
1204
- }, We = () => V(U);
873
+ c.accessToken = c.accessToken || s;
874
+ const i = { bridge: r, apiOptions: c };
875
+ let h = {};
876
+ o.forEach((y) => {
877
+ h = { ...h, ...y(i) };
878
+ }), l && (x = l);
879
+ const f = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
880
+ return r !== !1 && f && q(x), h;
881
+ };
882
+ function Ee(n, e) {
883
+ return ae(e).render(n);
884
+ }
885
+ const Ae = () => q(x);
1205
886
  export {
1206
- T as BlockTypes,
1207
- _ as MarkTypes,
1208
- P as RichTextResolver,
1209
- Ce as RichTextSchema,
1210
- J as TextTypes,
1211
- Fe as apiPlugin,
1212
- qe as isRichTextEmpty,
1213
- We as loadStoryblokBridge,
1214
- Je as registerStoryblokBridge,
1215
- Ye as renderRichText,
1216
- Ve as richTextResolver,
1217
- Ge as storyblokEditable,
1218
- Ke as storyblokInit,
1219
- Je as useStoryblokBridge
887
+ v as BlockTypes,
888
+ $ as MarkTypes,
889
+ V as TextTypes,
890
+ Te as apiPlugin,
891
+ Ae as loadStoryblokBridge,
892
+ _e as registerStoryblokBridge,
893
+ Ee as renderRichText,
894
+ ae as richTextResolver,
895
+ Re as storyblokEditable,
896
+ $e as storyblokInit,
897
+ _e as useStoryblokBridge
1220
898
  };