@storyblok/vue 8.0.9 → 8.1.0

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,76 +1,76 @@
1
- import { defineComponent as O, ref as _, resolveDynamicComponent as $, inject as N, openBlock as L, createBlock as M, mergeProps as z, onMounted as U, defineAsyncComponent as H } from "vue";
2
- let j = !1;
3
- const C = [], V = (i) => new Promise((e, t) => {
4
- if (typeof window > "u" || (window.storyblokRegisterEvent = (r) => {
1
+ import { defineComponent as q, ref as P, resolveDynamicComponent as A, inject as ee, openBlock as F, createBlock as V, mergeProps as te, h as G, createTextVNode as re, onMounted as se, defineAsyncComponent as oe } from "vue";
2
+ let U = !1;
3
+ const H = [], ne = (s) => new Promise((e, t) => {
4
+ if (typeof window > "u" || (window.storyblokRegisterEvent = (o) => {
5
5
  if (window.location === window.parent.location) {
6
6
  console.warn("You are not in Draft Mode or in the Visual Editor.");
7
7
  return;
8
8
  }
9
- j ? r() : C.push(r);
9
+ U ? o() : H.push(o);
10
10
  }, document.getElementById("storyblok-javascript-bridge"))) return;
11
- const s = document.createElement("script");
12
- s.async = !0, s.src = i, s.id = "storyblok-javascript-bridge", s.onerror = (r) => t(r), s.onload = (r) => {
13
- C.forEach((o) => o()), j = !0, e(r);
14
- }, document.getElementsByTagName("head")[0].appendChild(s);
11
+ const r = document.createElement("script");
12
+ r.async = !0, r.src = s, r.id = "storyblok-javascript-bridge", r.onerror = (o) => t(o), r.onload = (o) => {
13
+ H.forEach((n) => n()), U = !0, e(o);
14
+ }, document.getElementsByTagName("head")[0].appendChild(r);
15
15
  });
16
- var D = Object.defineProperty, q = (i, e, t) => e in i ? D(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, c = (i, e, t) => (q(i, typeof e != "symbol" ? e + "" : e, t), t);
17
- function x(i) {
18
- return !(i !== i || i === 1 / 0 || i === -1 / 0);
16
+ var ie = Object.defineProperty, ae = (s, e, t) => e in s ? ie(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, d = (s, e, t) => ae(s, typeof e != "symbol" ? e + "" : e, t);
17
+ function D(s) {
18
+ return !(s !== s || s === 1 / 0 || s === -1 / 0);
19
19
  }
20
- function F(i, e, t) {
21
- if (!x(e))
20
+ function le(s, e, t) {
21
+ if (!D(e))
22
22
  throw new TypeError("Expected `limit` to be a finite number");
23
- if (!x(t))
23
+ if (!D(t))
24
24
  throw new TypeError("Expected `interval` to be a finite number");
25
- const s = [];
26
- let r = [], o = 0;
27
- const n = function() {
28
- o++;
25
+ const r = [];
26
+ let o = [], n = 0;
27
+ const i = function() {
28
+ n++;
29
29
  const a = setTimeout(function() {
30
- o--, s.length > 0 && n(), r = r.filter(function(h) {
31
- return h !== a;
30
+ n--, r.length > 0 && i(), o = o.filter(function(p) {
31
+ return p !== a;
32
32
  });
33
33
  }, t);
34
- r.indexOf(a) < 0 && r.push(a);
35
- const u = s.shift();
36
- u.resolve(i.apply(u.self, u.args));
34
+ o.indexOf(a) < 0 && o.push(a);
35
+ const u = r.shift();
36
+ u.resolve(s.apply(u.self, u.args));
37
37
  }, l = function(...a) {
38
38
  const u = this;
39
- return new Promise(function(h, p) {
40
- s.push({
41
- resolve: h,
42
- reject: p,
39
+ return new Promise(function(p, h) {
40
+ r.push({
41
+ resolve: p,
42
+ reject: h,
43
43
  args: a,
44
44
  self: u
45
- }), o < e && n();
45
+ }), n < e && i();
46
46
  });
47
47
  };
48
48
  return l.abort = function() {
49
- r.forEach(clearTimeout), r = [], s.forEach(function(a) {
49
+ o.forEach(clearTimeout), o = [], r.forEach(function(a) {
50
50
  a.reject(function() {
51
51
  Error.call(this, "Throttled function aborted"), this.name = "AbortError";
52
52
  });
53
- }), s.length = 0;
53
+ }), r.length = 0;
54
54
  }, l;
55
55
  }
56
- class k {
56
+ class j {
57
57
  constructor() {
58
- c(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), c(this, "getOptionsPage", (e, t = 25, s = 1) => ({
58
+ d(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), d(this, "getOptionsPage", (e, t = 25, r = 1) => ({
59
59
  ...e,
60
60
  per_page: t,
61
- page: s
62
- })), c(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), c(this, "arrayFrom", (e = 0, t) => [...Array(e)].map(t)), c(this, "range", (e = 0, t = e) => {
63
- const s = Math.abs(t - e) || 0, r = e < t ? 1 : -1;
64
- return this.arrayFrom(s, (o, n) => n * r + e);
65
- }), c(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), c(this, "flatMap", (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], [])), c(this, "escapeHTML", function(e) {
61
+ page: r
62
+ })), d(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), d(this, "arrayFrom", (e = 0, t) => [...Array(e)].map(t)), d(this, "range", (e = 0, t = e) => {
63
+ const r = Math.abs(t - e) || 0, o = e < t ? 1 : -1;
64
+ return this.arrayFrom(r, (n, i) => i * o + e);
65
+ }), d(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), d(this, "flatMap", (e = [], t) => e.map(t).reduce((r, o) => [...r, ...o], [])), d(this, "escapeHTML", function(e) {
66
66
  const t = {
67
67
  "&": "&amp;",
68
68
  "<": "&lt;",
69
69
  ">": "&gt;",
70
70
  '"': "&quot;",
71
71
  "'": "&#39;"
72
- }, s = /[&<>"']/g, r = RegExp(s.source);
73
- return e && r.test(e) ? e.replace(s, (o) => t[o]) : e;
72
+ }, r = /[&<>"']/g, o = RegExp(r.source);
73
+ return e && o.test(e) ? e.replace(r, (n) => t[n]) : e;
74
74
  });
75
75
  }
76
76
  /**
@@ -80,20 +80,20 @@ class k {
80
80
  * @param {Boolean} isArray
81
81
  * @return {String} Stringified object
82
82
  */
83
- stringify(e, t, s) {
84
- const r = [];
85
- for (const o in e) {
86
- if (!Object.prototype.hasOwnProperty.call(e, o))
83
+ stringify(e, t, r) {
84
+ const o = [];
85
+ for (const n in e) {
86
+ if (!Object.prototype.hasOwnProperty.call(e, n))
87
87
  continue;
88
- const n = e[o], l = s ? "" : encodeURIComponent(o);
88
+ const i = e[n], l = r ? "" : encodeURIComponent(n);
89
89
  let a;
90
- typeof n == "object" ? a = this.stringify(
91
- n,
90
+ typeof i == "object" ? a = this.stringify(
91
+ i,
92
92
  t ? t + encodeURIComponent("[" + l + "]") : l,
93
- Array.isArray(n)
94
- ) : a = (t ? t + encodeURIComponent("[" + l + "]") : l) + "=" + encodeURIComponent(n), r.push(a);
93
+ Array.isArray(i)
94
+ ) : a = (t ? t + encodeURIComponent("[" + l + "]") : l) + "=" + encodeURIComponent(i), o.push(a);
95
95
  }
96
- return r.join("&");
96
+ return o.join("&");
97
97
  }
98
98
  /**
99
99
  * @method getRegionURL
@@ -101,91 +101,91 @@ class k {
101
101
  * @return {String} The base URL of the region
102
102
  */
103
103
  getRegionURL(e) {
104
- const t = "api.storyblok.com", s = "api-us.storyblok.com", r = "app.storyblokchina.cn", o = "api-ap.storyblok.com", n = "api-ca.storyblok.com";
104
+ const t = "api.storyblok.com", r = "api-us.storyblok.com", o = "app.storyblokchina.cn", n = "api-ap.storyblok.com", i = "api-ca.storyblok.com";
105
105
  switch (e) {
106
106
  case "us":
107
- return s;
108
- case "cn":
109
107
  return r;
110
- case "ap":
108
+ case "cn":
111
109
  return o;
112
- case "ca":
110
+ case "ap":
113
111
  return n;
112
+ case "ca":
113
+ return i;
114
114
  default:
115
115
  return t;
116
116
  }
117
117
  }
118
118
  }
119
- const B = function(i, e) {
119
+ const ce = function(s, e) {
120
120
  const t = {};
121
- for (const s in i) {
122
- const r = i[s];
123
- e.indexOf(s) > -1 && r !== null && (t[s] = r);
121
+ for (const r in s) {
122
+ const o = s[r];
123
+ e.indexOf(r) > -1 && o !== null && (t[r] = o);
124
124
  }
125
125
  return t;
126
- }, J = (i) => i === "email", K = () => ({
126
+ }, he = (s) => s === "email", ue = () => ({
127
127
  singleTag: "hr"
128
- }), Y = () => ({
128
+ }), pe = () => ({
129
129
  tag: "blockquote"
130
- }), W = () => ({
130
+ }), de = () => ({
131
131
  tag: "ul"
132
- }), G = (i) => ({
132
+ }), ge = (s) => ({
133
133
  tag: [
134
134
  "pre",
135
135
  {
136
136
  tag: "code",
137
- attrs: i.attrs
137
+ attrs: s.attrs
138
138
  }
139
139
  ]
140
- }), Q = () => ({
140
+ }), fe = () => ({
141
141
  singleTag: "br"
142
- }), X = (i) => ({
143
- tag: `h${i.attrs.level}`
144
- }), Z = (i) => ({
142
+ }), me = (s) => ({
143
+ tag: `h${s.attrs.level}`
144
+ }), ye = (s) => ({
145
145
  singleTag: [
146
146
  {
147
147
  tag: "img",
148
- attrs: B(i.attrs, ["src", "alt", "title"])
148
+ attrs: ce(s.attrs, ["src", "alt", "title"])
149
149
  }
150
150
  ]
151
- }), ee = () => ({
151
+ }), be = () => ({
152
152
  tag: "li"
153
- }), te = () => ({
153
+ }), ke = () => ({
154
154
  tag: "ol"
155
- }), se = () => ({
155
+ }), ve = () => ({
156
156
  tag: "p"
157
- }), re = (i) => ({
157
+ }), $e = (s) => ({
158
158
  tag: [
159
159
  {
160
160
  tag: "span",
161
161
  attrs: {
162
162
  "data-type": "emoji",
163
- "data-name": i.attrs.name,
164
- emoji: i.attrs.emoji
163
+ "data-name": s.attrs.name,
164
+ emoji: s.attrs.emoji
165
165
  }
166
166
  }
167
167
  ]
168
- }), oe = () => ({
168
+ }), Te = () => ({
169
169
  tag: "b"
170
- }), ie = () => ({
170
+ }), Re = () => ({
171
171
  tag: "s"
172
- }), ne = () => ({
172
+ }), we = () => ({
173
173
  tag: "u"
174
- }), ae = () => ({
174
+ }), _e = () => ({
175
175
  tag: "strong"
176
- }), le = () => ({
176
+ }), Se = () => ({
177
177
  tag: "code"
178
- }), ce = () => ({
178
+ }), Ee = () => ({
179
179
  tag: "i"
180
- }), he = (i) => {
181
- if (!i.attrs)
180
+ }), xe = (s) => {
181
+ if (!s.attrs)
182
182
  return {
183
183
  tag: ""
184
184
  };
185
- const e = new k().escapeHTML, t = { ...i.attrs }, { linktype: s = "url" } = i.attrs;
186
- if (delete t.linktype, t.href && (t.href = e(i.attrs.href || "")), J(s) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
187
- for (const r in t.custom)
188
- t[r] = t.custom[r];
185
+ const e = new j().escapeHTML, t = { ...s.attrs }, { linktype: r = "url" } = s.attrs;
186
+ if (delete t.linktype, t.href && (t.href = e(s.attrs.href || "")), he(r) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
187
+ for (const o in t.custom)
188
+ t[o] = t.custom[o];
189
189
  delete t.custom;
190
190
  }
191
191
  return {
@@ -196,94 +196,94 @@ const B = function(i, e) {
196
196
  }
197
197
  ]
198
198
  };
199
- }, ue = (i) => ({
199
+ }, Ie = (s) => ({
200
200
  tag: [
201
201
  {
202
202
  tag: "span",
203
- attrs: i.attrs
203
+ attrs: s.attrs
204
204
  }
205
205
  ]
206
- }), pe = () => ({
206
+ }), je = () => ({
207
207
  tag: "sub"
208
- }), de = () => ({
208
+ }), Ce = () => ({
209
209
  tag: "sup"
210
- }), ge = (i) => ({
210
+ }), Oe = (s) => ({
211
211
  tag: [
212
212
  {
213
213
  tag: "span",
214
- attrs: i.attrs
214
+ attrs: s.attrs
215
215
  }
216
216
  ]
217
- }), fe = (i) => {
217
+ }), Ae = (s) => {
218
218
  var e;
219
- return (e = i.attrs) != null && e.color ? {
219
+ return (e = s.attrs) != null && e.color ? {
220
220
  tag: [
221
221
  {
222
222
  tag: "span",
223
223
  attrs: {
224
- style: `background-color:${i.attrs.color};`
224
+ style: `background-color:${s.attrs.color};`
225
225
  }
226
226
  }
227
227
  ]
228
228
  } : {
229
229
  tag: ""
230
230
  };
231
- }, me = (i) => {
231
+ }, Le = (s) => {
232
232
  var e;
233
- return (e = i.attrs) != null && e.color ? {
233
+ return (e = s.attrs) != null && e.color ? {
234
234
  tag: [
235
235
  {
236
236
  tag: "span",
237
237
  attrs: {
238
- style: `color:${i.attrs.color}`
238
+ style: `color:${s.attrs.color}`
239
239
  }
240
240
  }
241
241
  ]
242
242
  } : {
243
243
  tag: ""
244
244
  };
245
- }, ye = {
245
+ }, Pe = {
246
246
  nodes: {
247
- horizontal_rule: K,
248
- blockquote: Y,
249
- bullet_list: W,
250
- code_block: G,
251
- hard_break: Q,
252
- heading: X,
253
- image: Z,
254
- list_item: ee,
255
- ordered_list: te,
256
- paragraph: se,
257
- emoji: re
247
+ horizontal_rule: ue,
248
+ blockquote: pe,
249
+ bullet_list: de,
250
+ code_block: ge,
251
+ hard_break: fe,
252
+ heading: me,
253
+ image: ye,
254
+ list_item: be,
255
+ ordered_list: ke,
256
+ paragraph: ve,
257
+ emoji: $e
258
258
  },
259
259
  marks: {
260
- bold: oe,
261
- strike: ie,
262
- underline: ne,
263
- strong: ae,
264
- code: le,
265
- italic: ce,
266
- link: he,
267
- styled: ue,
268
- subscript: pe,
269
- superscript: de,
270
- anchor: ge,
271
- highlight: fe,
272
- textStyle: me
273
- }
274
- }, be = function(i) {
260
+ bold: Te,
261
+ strike: Re,
262
+ underline: we,
263
+ strong: _e,
264
+ code: Se,
265
+ italic: Ee,
266
+ link: xe,
267
+ styled: Ie,
268
+ subscript: je,
269
+ superscript: Ce,
270
+ anchor: Oe,
271
+ highlight: Ae,
272
+ textStyle: Le
273
+ }
274
+ }, Ne = function(s) {
275
275
  const e = {
276
276
  "&": "&amp;",
277
277
  "<": "&lt;",
278
278
  ">": "&gt;",
279
279
  '"': "&quot;",
280
280
  "'": "&#39;"
281
- }, t = /[&<>"']/g, s = RegExp(t.source);
282
- return i && s.test(i) ? i.replace(t, (r) => e[r]) : i;
281
+ }, t = /[&<>"']/g, r = RegExp(t.source);
282
+ return s && r.test(s) ? s.replace(t, (o) => e[o]) : s;
283
283
  };
284
- class v {
284
+ class Me {
285
285
  constructor(e) {
286
- c(this, "marks"), c(this, "nodes"), e || (e = ye), this.marks = e.marks || [], this.nodes = e.nodes || [];
286
+ d(this, "marks"), d(this, "nodes"), e || (e = Pe), this.marks = e.marks || [], this.nodes = e.nodes || [];
287
287
  }
288
288
  addNode(e, t) {
289
289
  this.nodes[e] = t;
@@ -292,11 +292,13 @@ class v {
292
292
  this.marks[e] = t;
293
293
  }
294
294
  render(e, t = { optimizeImages: !1 }) {
295
- if (e && e.content && Array.isArray(e.content)) {
296
- let s = "";
297
- return e.content.forEach((r) => {
298
- s += this.renderNode(r);
299
- }), t.optimizeImages ? this.optimizeImages(s, t.optimizeImages) : s;
295
+ if (console.warn(
296
+ "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/"
297
+ ), e && e.content && Array.isArray(e.content)) {
298
+ let r = "";
299
+ return e.content.forEach((o) => {
300
+ r += this.renderNode(o);
301
+ }), t.optimizeImages ? this.optimizeImages(r, t.optimizeImages) : r;
300
302
  }
301
303
  return console.warn(
302
304
  `The render method must receive an Object with a "content" field.
@@ -326,63 +328,63 @@ class v {
326
328
  ), "";
327
329
  }
328
330
  optimizeImages(e, t) {
329
- let s = 0, r = 0, o = "", n = "";
330
- typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (o += `width="${t.width}" `, s = t.width), typeof t.height == "number" && t.height > 0 && (o += `height="${t.height}" `, r = 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 && (n += `:blur(${t.filters.blur})`), typeof t.filters.brightness == "number" && t.filters.brightness >= -100 && t.filters.brightness <= 100 && (n += `:brightness(${t.filters.brightness})`), t.filters.fill && (t.filters.fill.match(/[0-9A-Fa-f]{6}/g) || t.filters.fill === "transparent") && (n += `:fill(${t.filters.fill})`), t.filters.format && ["webp", "png", "jpeg"].includes(t.filters.format) && (n += `:format(${t.filters.format})`), typeof t.filters.grayscale == "boolean" && t.filters.grayscale && (n += ":grayscale()"), typeof t.filters.quality == "number" && t.filters.quality >= 0 && t.filters.quality <= 100 && (n += `:quality(${t.filters.quality})`), t.filters.rotate && [90, 180, 270].includes(t.filters.rotate) && (n += `:rotate(${t.filters.rotate})`), n.length > 0 && (n = "/filters" + n))), o.length > 0 && (e = e.replace(/<img/g, `<img ${o.trim()}`));
331
- const l = s > 0 || r > 0 || n.length > 0 ? `${s}x${r}${n}` : "";
331
+ let r = 0, o = 0, n = "", i = "";
332
+ typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (n += `width="${t.width}" `, r = t.width), typeof t.height == "number" && t.height > 0 && (n += `height="${t.height}" `, o = t.height), (t.loading === "lazy" || t.loading === "eager") && (n += `loading="${t.loading}" `), typeof t.class == "string" && t.class.length > 0 && (n += `class="${t.class}" `), t.filters && (typeof t.filters.blur == "number" && t.filters.blur >= 0 && t.filters.blur <= 100 && (i += `:blur(${t.filters.blur})`), typeof t.filters.brightness == "number" && t.filters.brightness >= -100 && t.filters.brightness <= 100 && (i += `:brightness(${t.filters.brightness})`), t.filters.fill && (t.filters.fill.match(/[0-9A-Fa-f]{6}/g) || t.filters.fill === "transparent") && (i += `:fill(${t.filters.fill})`), t.filters.format && ["webp", "png", "jpeg"].includes(t.filters.format) && (i += `:format(${t.filters.format})`), typeof t.filters.grayscale == "boolean" && t.filters.grayscale && (i += ":grayscale()"), typeof t.filters.quality == "number" && t.filters.quality >= 0 && t.filters.quality <= 100 && (i += `:quality(${t.filters.quality})`), t.filters.rotate && [90, 180, 270].includes(t.filters.rotate) && (i += `:rotate(${t.filters.rotate})`), i.length > 0 && (i = "/filters" + i))), n.length > 0 && (e = e.replace(/<img/g, `<img ${n.trim()}`));
333
+ const l = r > 0 || o > 0 || i.length > 0 ? `${r}x${o}${i}` : "";
332
334
  return e = e.replace(
333
335
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,
334
336
  `a.storyblok.com/f/$1/$2.$3/m/${l}`
335
337
  ), typeof t != "boolean" && (t.sizes || t.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (a) => {
336
- var u, h;
337
- const p = a.match(
338
+ var u, p;
339
+ const h = a.match(
338
340
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g
339
341
  );
340
- if (p && p.length > 0) {
341
- const g = {
342
- srcset: (u = t.srcset) == null ? void 0 : u.map((d) => {
343
- if (typeof d == "number")
344
- return `//${p}/m/${d}x0${n} ${d}w`;
345
- if (typeof d == "object" && d.length === 2) {
346
- let w = 0, S = 0;
347
- return typeof d[0] == "number" && (w = d[0]), typeof d[1] == "number" && (S = d[1]), `//${p}/m/${w}x${S}${n} ${w}w`;
342
+ if (h && h.length > 0) {
343
+ const m = {
344
+ srcset: (u = t.srcset) == null ? void 0 : u.map((y) => {
345
+ if (typeof y == "number")
346
+ return `//${h}/m/${y}x0${i} ${y}w`;
347
+ if (typeof y == "object" && y.length === 2) {
348
+ let w = 0, x = 0;
349
+ return typeof y[0] == "number" && (w = y[0]), typeof y[1] == "number" && (x = y[1]), `//${h}/m/${w}x${x}${i} ${w}w`;
348
350
  }
349
351
  }).join(", "),
350
- sizes: (h = t.sizes) == null ? void 0 : h.map((d) => d).join(", ")
352
+ sizes: (p = t.sizes) == null ? void 0 : p.map((y) => y).join(", ")
351
353
  };
352
- let f = "";
353
- return g.srcset && (f += `srcset="${g.srcset}" `), g.sizes && (f += `sizes="${g.sizes}" `), a.replace(/<img/g, `<img ${f.trim()}`);
354
+ let $ = "";
355
+ return m.srcset && ($ += `srcset="${m.srcset}" `), m.sizes && ($ += `sizes="${m.sizes}" `), a.replace(/<img/g, `<img ${$.trim()}`);
354
356
  }
355
357
  return a;
356
358
  })), e;
357
359
  }
358
360
  renderNode(e) {
359
361
  const t = [];
360
- e.marks && e.marks.forEach((r) => {
361
- const o = this.getMatchingMark(r);
362
- o && o.tag !== "" && t.push(this.renderOpeningTag(o.tag));
362
+ e.marks && e.marks.forEach((o) => {
363
+ const n = this.getMatchingMark(o);
364
+ n && n.tag !== "" && t.push(this.renderOpeningTag(n.tag));
363
365
  });
364
- const s = this.getMatchingNode(e);
365
- return s && s.tag && t.push(this.renderOpeningTag(s.tag)), e.content ? e.content.forEach((r) => {
366
- t.push(this.renderNode(r));
367
- }) : e.text ? t.push(be(e.text)) : s && s.singleTag ? t.push(this.renderTag(s.singleTag, " /")) : s && s.html ? t.push(s.html) : e.type === "emoji" && t.push(this.renderEmoji(e)), s && s.tag && t.push(this.renderClosingTag(s.tag)), e.marks && e.marks.slice(0).reverse().forEach((r) => {
368
- const o = this.getMatchingMark(r);
369
- o && o.tag !== "" && t.push(this.renderClosingTag(o.tag));
366
+ const r = this.getMatchingNode(e);
367
+ return r && r.tag && t.push(this.renderOpeningTag(r.tag)), e.content ? e.content.forEach((o) => {
368
+ t.push(this.renderNode(o));
369
+ }) : e.text ? t.push(Ne(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((o) => {
370
+ const n = this.getMatchingMark(o);
371
+ n && n.tag !== "" && t.push(this.renderClosingTag(n.tag));
370
372
  }), t.join("");
371
373
  }
372
374
  renderTag(e, t) {
373
- return e.constructor === String ? `<${e}${t}>` : e.map((s) => {
374
- if (s.constructor === String)
375
- return `<${s}${t}>`;
375
+ return e.constructor === String ? `<${e}${t}>` : e.map((r) => {
376
+ if (r.constructor === String)
377
+ return `<${r}${t}>`;
376
378
  {
377
- let r = `<${s.tag}`;
378
- if (s.attrs) {
379
- for (const o in s.attrs)
380
- if (Object.prototype.hasOwnProperty.call(s.attrs, o)) {
381
- const n = s.attrs[o];
382
- n !== null && (r += ` ${o}="${n}"`);
379
+ let o = `<${r.tag}`;
380
+ if (r.attrs) {
381
+ for (const n in r.attrs)
382
+ if (Object.prototype.hasOwnProperty.call(r.attrs, n)) {
383
+ const i = r.attrs[n];
384
+ i !== null && (o += ` ${n}="${i}"`);
383
385
  }
384
386
  }
385
- return `${r}${t}>`;
387
+ return `${o}${t}>`;
386
388
  }
387
389
  }).join("");
388
390
  }
@@ -419,9 +421,10 @@ class v {
419
421
  return this.renderTag(t, " /");
420
422
  }
421
423
  }
422
- class ke {
424
+ const C = Me;
425
+ class Ue {
423
426
  constructor(e) {
424
- c(this, "baseURL"), c(this, "timeout"), c(this, "headers"), c(this, "responseInterceptor"), c(this, "fetch"), c(this, "ejectInterceptor"), c(this, "url"), c(this, "parameters"), c(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 = {};
427
+ d(this, "baseURL"), d(this, "timeout"), d(this, "headers"), d(this, "responseInterceptor"), d(this, "fetch"), d(this, "ejectInterceptor"), d(this, "url"), d(this, "parameters"), d(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 = {};
425
428
  }
426
429
  /**
427
430
  *
@@ -442,37 +445,37 @@ class ke {
442
445
  return this.url = e, this.parameters = t, this._methodHandler("delete");
443
446
  }
444
447
  async _responseHandler(e) {
445
- const t = [], s = {
448
+ const t = [], r = {
446
449
  data: {},
447
450
  headers: {},
448
451
  status: 0,
449
452
  statusText: ""
450
453
  };
451
- e.status !== 204 && await e.json().then((r) => {
452
- s.data = r;
454
+ e.status !== 204 && await e.json().then((o) => {
455
+ r.data = o;
453
456
  });
454
- for (const r of e.headers.entries())
455
- t[r[0]] = r[1];
456
- return s.headers = { ...t }, s.status = e.status, s.statusText = e.statusText, s;
457
+ for (const o of e.headers.entries())
458
+ t[o[0]] = o[1];
459
+ return r.headers = { ...t }, r.status = e.status, r.statusText = e.statusText, r;
457
460
  }
458
461
  async _methodHandler(e) {
459
- let t = `${this.baseURL}${this.url}`, s = null;
462
+ let t = `${this.baseURL}${this.url}`, r = null;
460
463
  if (e === "get") {
461
- const a = new k();
464
+ const a = new j();
462
465
  t = `${this.baseURL}${this.url}?${a.stringify(
463
466
  this.parameters
464
467
  )}`;
465
468
  } else
466
- s = JSON.stringify(this.parameters);
467
- const r = new URL(t), o = new AbortController(), { signal: n } = o;
469
+ r = JSON.stringify(this.parameters);
470
+ const o = new URL(t), n = new AbortController(), { signal: i } = n;
468
471
  let l;
469
- this.timeout && (l = setTimeout(() => o.abort(), this.timeout));
472
+ this.timeout && (l = setTimeout(() => n.abort(), this.timeout));
470
473
  try {
471
- const a = await this.fetch(`${r}`, {
474
+ const a = await this.fetch(`${o}`, {
472
475
  method: e,
473
476
  headers: this.headers,
474
- body: s,
475
- signal: n,
477
+ body: r,
478
+ signal: i,
476
479
  ...this.fetchOptions
477
480
  });
478
481
  this.timeout && clearTimeout(l);
@@ -494,116 +497,115 @@ class ke {
494
497
  }
495
498
  _statusHandler(e) {
496
499
  const t = /20[0-6]/g;
497
- return new Promise((s, r) => {
500
+ return new Promise((r, o) => {
498
501
  if (t.test(`${e.status}`))
499
- return s(e);
500
- const o = {
502
+ return r(e);
503
+ const n = {
501
504
  message: e.statusText,
502
505
  status: e.status,
503
506
  response: Array.isArray(e.data) ? e.data[0] : e.data.error || e.data.slug
504
507
  };
505
- r(o);
508
+ o(n);
506
509
  });
507
510
  }
508
511
  }
509
- const P = "SB-Agent", R = {
512
+ const He = Ue, z = "SB-Agent", L = {
510
513
  defaultAgentName: "SB-JS-CLIENT",
511
514
  defaultAgentVersion: "SB-Agent-Version",
512
515
  packageVersion: "6.0.0"
513
516
  };
514
- let b = {};
515
- const m = {};
516
- class ve {
517
+ let I = {};
518
+ const _ = {};
519
+ class De {
517
520
  /**
518
521
  *
519
522
  * @param config ISbConfig interface
520
523
  * @param endpoint string, optional
521
524
  */
522
525
  constructor(e, t) {
523
- c(this, "client"), c(this, "maxRetries"), c(this, "retriesDelay"), c(this, "throttle"), c(this, "accessToken"), c(this, "cache"), c(this, "helpers"), c(this, "resolveCounter"), c(this, "relations"), c(this, "links"), c(this, "richTextResolver"), c(this, "resolveNestedRelations"), c(this, "stringifiedStoriesCache");
524
- let s = e.endpoint || t;
525
- if (!s) {
526
- const n = new k().getRegionURL, l = e.https === !1 ? "http" : "https";
527
- e.oauthToken ? s = `${l}://${n(e.region)}/v1` : s = `${l}://${n(e.region)}/v2`;
526
+ d(this, "client"), d(this, "maxRetries"), d(this, "retriesDelay"), d(this, "throttle"), d(this, "accessToken"), d(this, "cache"), d(this, "helpers"), d(this, "resolveCounter"), d(this, "relations"), d(this, "links"), d(this, "richTextResolver"), d(this, "resolveNestedRelations"), d(this, "stringifiedStoriesCache");
527
+ let r = e.endpoint || t;
528
+ if (!r) {
529
+ const i = new j().getRegionURL, l = e.https === !1 ? "http" : "https";
530
+ e.oauthToken ? r = `${l}://${i(e.region)}/v1` : r = `${l}://${i(e.region)}/v2`;
528
531
  }
529
- const r = new Headers();
530
- if (r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), e.headers)
531
- for (const n in e.headers)
532
- r.set(n, e.headers[n]);
533
- r.has(P) || (r.set(P, R.defaultAgentName), r.set(
534
- R.defaultAgentVersion,
535
- R.packageVersion
532
+ const o = new Headers();
533
+ o.set("Content-Type", "application/json"), o.set("Accept", "application/json"), e.headers && e.headers.entries().toArray().forEach(([i, l]) => {
534
+ o.set(i, l);
535
+ }), o.has(z) || (o.set(z, L.defaultAgentName), o.set(
536
+ L.defaultAgentVersion,
537
+ L.packageVersion
536
538
  ));
537
- let o = 5;
538
- e.oauthToken && (r.set("Authorization", e.oauthToken), o = 3), e.rateLimit && (o = e.rateLimit), e.richTextSchema ? this.richTextResolver = new v(e.richTextSchema) : this.richTextResolver = new v(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = F(this.throttledRequest, o, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new k(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new ke({
539
- baseURL: s,
539
+ let n = 5;
540
+ e.oauthToken && (o.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new C(e.richTextSchema) : this.richTextResolver = new C(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = le(this.throttledRequest, n, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new j(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new He({
541
+ baseURL: r,
540
542
  timeout: e.timeout || 0,
541
- headers: r,
543
+ headers: o,
542
544
  responseInterceptor: e.responseInterceptor,
543
545
  fetch: e.fetch
544
546
  });
545
547
  }
546
548
  setComponentResolver(e) {
547
549
  this.richTextResolver.addNode("blok", (t) => {
548
- let s = "";
549
- return t.attrs.body && t.attrs.body.forEach((r) => {
550
- s += e(r.component, r);
550
+ let r = "";
551
+ return t.attrs.body && t.attrs.body.forEach((o) => {
552
+ r += e(o.component, o);
551
553
  }), {
552
- html: s
554
+ html: r
553
555
  };
554
556
  });
555
557
  }
556
558
  parseParams(e) {
557
- return e.token || (e.token = this.getToken()), e.cv || (e.cv = m[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
559
+ 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;
558
560
  }
559
561
  factoryParamOptions(e, t) {
560
562
  return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
561
563
  }
562
- makeRequest(e, t, s, r, o) {
563
- const n = this.factoryParamOptions(
564
+ makeRequest(e, t, r, o, n) {
565
+ const i = this.factoryParamOptions(
564
566
  e,
565
- this.helpers.getOptionsPage(t, s, r)
567
+ this.helpers.getOptionsPage(t, r, o)
566
568
  );
567
- return this.cacheResponse(e, n, void 0, o);
569
+ return this.cacheResponse(e, i, void 0, n);
568
570
  }
569
- get(e, t, s) {
571
+ get(e, t, r) {
570
572
  t || (t = {});
571
- const r = `/${e}`, o = this.factoryParamOptions(r, t);
572
- return this.cacheResponse(r, o, void 0, s);
573
+ const o = `/${e}`, n = this.factoryParamOptions(o, t);
574
+ return this.cacheResponse(o, n, void 0, r);
573
575
  }
574
- async getAll(e, t, s, r) {
575
- const o = (t == null ? void 0 : t.per_page) || 25, n = `/${e}`, l = n.split("/"), a = s || l[l.length - 1], u = 1, h = await this.makeRequest(
576
- n,
576
+ async getAll(e, t, r, o) {
577
+ const n = (t == null ? void 0 : t.per_page) || 25, i = `/${e}`, l = i.split("/"), a = r || l[l.length - 1], u = 1, p = await this.makeRequest(
578
+ i,
577
579
  t,
578
- o,
580
+ n,
579
581
  u,
580
- r
581
- ), p = h.total ? Math.ceil(h.total / o) : 1, g = await this.helpers.asyncMap(
582
- this.helpers.range(u, p),
583
- (f) => this.makeRequest(n, t, o, f + 1, r)
582
+ o
583
+ ), h = p.total ? Math.ceil(p.total / n) : 1, m = await this.helpers.asyncMap(
584
+ this.helpers.range(u, h),
585
+ ($) => this.makeRequest(i, t, n, $ + 1, o)
584
586
  );
585
587
  return this.helpers.flatMap(
586
- [h, ...g],
587
- (f) => Object.values(f.data[a])
588
+ [p, ...m],
589
+ ($) => Object.values($.data[a])
588
590
  );
589
591
  }
590
- post(e, t, s) {
591
- const r = `/${e}`;
592
- return Promise.resolve(this.throttle("post", r, t, s));
592
+ post(e, t, r) {
593
+ const o = `/${e}`;
594
+ return Promise.resolve(this.throttle("post", o, t, r));
593
595
  }
594
- put(e, t, s) {
595
- const r = `/${e}`;
596
- return Promise.resolve(this.throttle("put", r, t, s));
596
+ put(e, t, r) {
597
+ const o = `/${e}`;
598
+ return Promise.resolve(this.throttle("put", o, t, r));
597
599
  }
598
- delete(e, t, s) {
599
- const r = `/${e}`;
600
- return Promise.resolve(this.throttle("delete", r, t, s));
600
+ delete(e, t, r) {
601
+ const o = `/${e}`;
602
+ return Promise.resolve(this.throttle("delete", o, t, r));
601
603
  }
602
604
  getStories(e, t) {
603
605
  return this._addResolveLevel(e), this.get("cdn/stories", e, t);
604
606
  }
605
- getStory(e, t, s) {
606
- return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, s);
607
+ getStory(e, t, r) {
608
+ return this._addResolveLevel(t), this.get(`cdn/stories/${e}`, t, r);
607
609
  }
608
610
  getToken() {
609
611
  return this.accessToken;
@@ -617,9 +619,9 @@ class ve {
617
619
  _cleanCopy(e) {
618
620
  return JSON.parse(JSON.stringify(e));
619
621
  }
620
- _insertLinks(e, t, s) {
621
- const r = e[t];
622
- r && r.fieldtype == "multilink" && r.linktype == "story" && typeof r.id == "string" && this.links[s][r.id] ? r.story = this._cleanCopy(this.links[s][r.id]) : r && r.linktype === "story" && typeof r.uuid == "string" && this.links[s][r.uuid] && (r.story = this._cleanCopy(this.links[s][r.uuid]));
622
+ _insertLinks(e, t, r) {
623
+ const o = e[t];
624
+ o && o.fieldtype == "multilink" && o.linktype == "story" && typeof o.id == "string" && this.links[r][o.id] ? o.story = this._cleanCopy(this.links[r][o.id]) : o && o.linktype === "story" && typeof o.uuid == "string" && this.links[r][o.uuid] && (o.story = this._cleanCopy(this.links[r][o.uuid]));
623
625
  }
624
626
  /**
625
627
  *
@@ -632,85 +634,85 @@ class ve {
632
634
  this.relations[e][t]
633
635
  )), JSON.parse(this.stringifiedStoriesCache[t])) : t;
634
636
  }
635
- _insertRelations(e, t, s, r) {
636
- s.indexOf(`${e.component}.${t}`) > -1 && (typeof e[t] == "string" ? e[t] = this.getStoryReference(r, e[t]) : Array.isArray(e[t]) && (e[t] = e[t].map((o) => this.getStoryReference(r, o)).filter(Boolean)));
637
- }
638
- iterateTree(e, t, s) {
639
- const r = (o) => {
640
- if (o != null) {
641
- if (o.constructor === Array)
642
- for (let n = 0; n < o.length; n++)
643
- r(o[n]);
644
- else if (o.constructor === Object) {
645
- if (o._stopResolving)
637
+ _insertRelations(e, t, r, o) {
638
+ r.indexOf(`${e.component}.${t}`) > -1 && (typeof e[t] == "string" ? e[t] = this.getStoryReference(o, e[t]) : Array.isArray(e[t]) && (e[t] = e[t].map((n) => this.getStoryReference(o, n)).filter(Boolean)));
639
+ }
640
+ iterateTree(e, t, r) {
641
+ const o = (n) => {
642
+ if (n != null) {
643
+ if (n.constructor === Array)
644
+ for (let i = 0; i < n.length; i++)
645
+ o(n[i]);
646
+ else if (n.constructor === Object) {
647
+ if (n._stopResolving)
646
648
  return;
647
- for (const n in o)
648
- (o.component && o._uid || o.type === "link") && (this._insertRelations(
649
- o,
649
+ for (const i in n)
650
+ (n.component && n._uid || n.type === "link") && (this._insertRelations(
650
651
  n,
652
+ i,
651
653
  t,
652
- s
654
+ r
653
655
  ), this._insertLinks(
654
- o,
655
656
  n,
656
- s
657
- )), r(o[n]);
657
+ i,
658
+ r
659
+ )), o(n[i]);
658
660
  }
659
661
  }
660
662
  };
661
- r(e.content);
663
+ o(e.content);
662
664
  }
663
- async resolveLinks(e, t, s) {
664
- let r = [];
665
+ async resolveLinks(e, t, r) {
666
+ let o = [];
665
667
  if (e.link_uuids) {
666
- const o = e.link_uuids.length, n = [], l = 50;
667
- for (let a = 0; a < o; a += l) {
668
- const u = Math.min(o, a + l);
669
- n.push(e.link_uuids.slice(a, u));
668
+ const n = e.link_uuids.length, i = [], l = 50;
669
+ for (let a = 0; a < n; a += l) {
670
+ const u = Math.min(n, a + l);
671
+ i.push(e.link_uuids.slice(a, u));
670
672
  }
671
- for (let a = 0; a < n.length; a++)
673
+ for (let a = 0; a < i.length; a++)
672
674
  (await this.getStories({
673
675
  per_page: l,
674
676
  language: t.language,
675
677
  version: t.version,
676
- by_uuids: n[a].join(",")
678
+ by_uuids: i[a].join(",")
677
679
  })).data.stories.forEach(
678
680
  (u) => {
679
- r.push(u);
681
+ o.push(u);
680
682
  }
681
683
  );
682
684
  } else
683
- r = e.links;
684
- r.forEach((o) => {
685
- this.links[s][o.uuid] = {
686
- ...o,
685
+ o = e.links;
686
+ o.forEach((n) => {
687
+ this.links[r][n.uuid] = {
688
+ ...n,
687
689
  _stopResolving: !0
688
690
  };
689
691
  });
690
692
  }
691
- async resolveRelations(e, t, s) {
692
- let r = [];
693
+ async resolveRelations(e, t, r) {
694
+ let o = [];
693
695
  if (e.rel_uuids) {
694
- const o = e.rel_uuids.length, n = [], l = 50;
695
- for (let a = 0; a < o; a += l) {
696
- const u = Math.min(o, a + l);
697
- n.push(e.rel_uuids.slice(a, u));
696
+ const n = e.rel_uuids.length, i = [], l = 50;
697
+ for (let a = 0; a < n; a += l) {
698
+ const u = Math.min(n, a + l);
699
+ i.push(e.rel_uuids.slice(a, u));
698
700
  }
699
- for (let a = 0; a < n.length; a++)
701
+ for (let a = 0; a < i.length; a++)
700
702
  (await this.getStories({
701
703
  per_page: l,
702
704
  language: t.language,
703
705
  version: t.version,
704
- by_uuids: n[a].join(","),
706
+ by_uuids: i[a].join(","),
705
707
  excluding_fields: t.excluding_fields
706
708
  })).data.stories.forEach((u) => {
707
- r.push(u);
709
+ o.push(u);
708
710
  });
709
711
  } else
710
- r = e.rels;
711
- r && r.length > 0 && r.forEach((o) => {
712
- this.relations[s][o.uuid] = {
713
- ...o,
712
+ o = e.rels;
713
+ o && o.length > 0 && o.forEach((n) => {
714
+ this.relations[r][n.uuid] = {
715
+ ...n,
714
716
  _stopResolving: !0
715
717
  };
716
718
  });
@@ -724,86 +726,85 @@ class ve {
724
726
  * @returns Promise<void>
725
727
  *
726
728
  */
727
- async resolveStories(e, t, s) {
728
- var r, o;
729
- let n = [];
730
- if (this.links[s] = {}, this.relations[s] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (n = t.resolve_relations.split(",")), await this.resolveRelations(e, t, s)), t.resolve_links && ["1", "story", "url", "link"].indexOf(t.resolve_links) > -1 && ((r = e.links) != null && r.length || (o = e.link_uuids) != null && o.length) && await this.resolveLinks(e, t, s), this.resolveNestedRelations)
731
- for (const l in this.relations[s])
729
+ async resolveStories(e, t, r) {
730
+ var o, n;
731
+ let i = [];
732
+ if (this.links[r] = {}, this.relations[r] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (i = t.resolve_relations.split(",")), await this.resolveRelations(e, t, r)), t.resolve_links && ["1", "story", "url", "link"].indexOf(t.resolve_links) > -1 && ((o = e.links) != null && o.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t, r), this.resolveNestedRelations)
733
+ for (const l in this.relations[r])
732
734
  this.iterateTree(
733
- this.relations[s][l],
734
- n,
735
- s
735
+ this.relations[r][l],
736
+ i,
737
+ r
736
738
  );
737
- e.story ? this.iterateTree(e.story, n, s) : e.stories.forEach((l) => {
738
- this.iterateTree(l, n, s);
739
- }), this.stringifiedStoriesCache = {}, delete this.links[s], delete this.relations[s];
739
+ e.story ? this.iterateTree(e.story, i, r) : e.stories.forEach((l) => {
740
+ this.iterateTree(l, i, r);
741
+ }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
740
742
  }
741
- async cacheResponse(e, t, s, r) {
742
- const o = this.helpers.stringify({ url: e, params: t }), n = this.cacheProvider();
743
+ async cacheResponse(e, t, r, o) {
744
+ const n = this.helpers.stringify({ url: e, params: t }), i = this.cacheProvider();
743
745
  if (this.cache.clear === "auto" && t.version === "draft" && await this.flushCache(), t.version === "published" && e != "/cdn/spaces/me") {
744
- const l = await n.get(o);
746
+ const l = await i.get(n);
745
747
  if (l)
746
748
  return Promise.resolve(l);
747
749
  }
748
750
  return new Promise(async (l, a) => {
749
751
  var u;
750
752
  try {
751
- const h = await this.throttle("get", e, t, r);
752
- if (h.status !== 200)
753
- return a(h);
754
- let p = { data: h.data, headers: h.headers };
755
- if ((u = h.headers) != null && u["per-page"] && (p = Object.assign({}, p, {
756
- perPage: h.headers["per-page"] ? parseInt(h.headers["per-page"]) : 0,
757
- total: h.headers["per-page"] ? parseInt(h.headers.total) : 0
758
- })), p.data.story || p.data.stories) {
759
- const g = this.resolveCounter = ++this.resolveCounter % 1e3;
760
- await this.resolveStories(p.data, t, `${g}`);
753
+ const p = await this.throttle("get", e, t, o);
754
+ if (p.status !== 200)
755
+ return a(p);
756
+ let h = { data: p.data, headers: p.headers };
757
+ if ((u = p.headers) != null && u["per-page"] && (h = Object.assign({}, h, {
758
+ perPage: p.headers["per-page"] ? parseInt(p.headers["per-page"]) : 0,
759
+ total: p.headers["per-page"] ? parseInt(p.headers.total) : 0
760
+ })), h.data.story || h.data.stories) {
761
+ const m = this.resolveCounter = ++this.resolveCounter % 1e3;
762
+ await this.resolveStories(h.data, t, `${m}`);
761
763
  }
762
- return t.version === "published" && e != "/cdn/spaces/me" && await n.set(o, p), p.data.cv && t.token && (t.version === "draft" && m[t.token] != p.data.cv && await this.flushCache(), m[t.token] = t.cv ? t.cv : p.data.cv), l(p);
763
- } catch (h) {
764
- if (h.response && h.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
764
+ return t.version === "published" && e != "/cdn/spaces/me" && await i.set(n, h), h.data.cv && t.token && (t.version === "draft" && _[t.token] != h.data.cv && await this.flushCache(), _[t.token] = t.cv ? t.cv : h.data.cv), l(h);
765
+ } catch (p) {
766
+ if (p.response && p.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
765
767
  return console.log(
766
768
  `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
767
- ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, s).then(l).catch(a);
768
- a(h);
769
+ ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, r).then(l).catch(a);
770
+ a(p);
769
771
  }
770
772
  });
771
773
  }
772
- throttledRequest(e, t, s, r) {
773
- return this.client.setFetchOptions(r), this.client[e](t, s);
774
+ throttledRequest(e, t, r, o) {
775
+ return this.client.setFetchOptions(o), this.client[e](t, r);
774
776
  }
775
777
  cacheVersions() {
776
- return m;
778
+ return _;
777
779
  }
778
780
  cacheVersion() {
779
- return m[this.accessToken];
781
+ return _[this.accessToken];
780
782
  }
781
783
  setCacheVersion(e) {
782
- this.accessToken && (m[this.accessToken] = e);
784
+ this.accessToken && (_[this.accessToken] = e);
783
785
  }
784
786
  clearCacheVersion() {
785
- this.accessToken && (m[this.accessToken] = 0);
787
+ this.accessToken && (_[this.accessToken] = 0);
786
788
  }
787
789
  cacheProvider() {
788
790
  switch (this.cache.type) {
789
791
  case "memory":
790
792
  return {
791
793
  get(e) {
792
- return Promise.resolve(b[e]);
794
+ return Promise.resolve(I[e]);
793
795
  },
794
796
  getAll() {
795
- return Promise.resolve(b);
797
+ return Promise.resolve(I);
796
798
  },
797
799
  set(e, t) {
798
- return b[e] = t, Promise.resolve(void 0);
800
+ return I[e] = t, Promise.resolve(void 0);
799
801
  },
800
802
  flush() {
801
- return b = {}, Promise.resolve(void 0);
803
+ return I = {}, Promise.resolve(void 0);
802
804
  }
803
805
  };
804
806
  case "custom":
805
- if (this.cache.custom)
806
- return this.cache.custom;
807
+ if (this.cache.custom) return this.cache.custom;
807
808
  default:
808
809
  return {
809
810
  get() {
@@ -825,21 +826,21 @@ class ve {
825
826
  return await this.cacheProvider().flush(), this.clearCacheVersion(), this;
826
827
  }
827
828
  }
828
- const Ce = (i = {}) => {
829
- const { apiOptions: e } = i;
829
+ const rt = (s = {}) => {
830
+ const { apiOptions: e } = s;
830
831
  if (!e.accessToken) {
831
832
  console.error(
832
833
  "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
833
834
  );
834
835
  return;
835
836
  }
836
- return { storyblokApi: new ve(e) };
837
- }, we = (i) => {
838
- if (typeof i != "object" || typeof i._editable > "u")
837
+ return { storyblokApi: new De(e) };
838
+ }, ze = (s) => {
839
+ if (typeof s != "object" || typeof s._editable > "u")
839
840
  return {};
840
841
  try {
841
842
  const e = JSON.parse(
842
- i._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
843
+ s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
843
844
  );
844
845
  return e ? {
845
846
  "data-blok-c": JSON.stringify(e),
@@ -849,125 +850,325 @@ const Ce = (i = {}) => {
849
850
  return {};
850
851
  }
851
852
  };
852
- let T, I = "https://app.storyblok.com/f/storyblok-v2-latest.js";
853
- const $e = (i, e, t = {}) => {
854
- var s;
855
- const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = +new URL((s = window.location) == null ? void 0 : s.href).searchParams.get(
853
+ var b = /* @__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))(b || {}), k = /* @__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))(k || {}), K = /* @__PURE__ */ ((s) => (s.TEXT = "text", s))(K || {}), S = /* @__PURE__ */ ((s) => (s.URL = "url", s.STORY = "story", s.ASSET = "asset", s.EMAIL = "email", s))(S || {});
854
+ function Be(s, e) {
855
+ if (!e) return { src: s, attrs: {} };
856
+ let t = 0, r = 0;
857
+ const o = {}, n = [];
858
+ function i(a, u, p, h, m) {
859
+ typeof a != "number" || a <= u || a >= p ? console.warn(`[StoryblokRichText] - ${h.charAt(0).toUpperCase() + h.slice(1)} value must be a number between ${u} and ${p} (inclusive)`) : m.push(`${h}(${a})`);
860
+ }
861
+ if (typeof e == "object") {
862
+ if (typeof e.width == "number" && e.width > 0 ? (o.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 ? (o.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) && (o.loading = e.loading), e.class && (o.class = e.class), e.filters) {
863
+ const { filters: a } = e || {}, { blur: u, brightness: p, fill: h, format: m, grayscale: $, quality: y, rotate: w } = a || {};
864
+ u && i(u, 0, 100, "blur", n), y && i(y, 0, 100, "quality", n), p && i(p, 0, 100, "brightness", n), h && n.push(`fill(${h})`), $ && n.push("grayscale()"), w && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${w})`), m && ["webp", "png", "jpeg"].includes(m) && n.push(`format(${m})`);
865
+ }
866
+ e.srcset && (o.srcset = e.srcset.map((a) => {
867
+ if (typeof a == "number")
868
+ return `${s}/m/${a}x0/${n.length > 0 ? "filters:" + n.join(":") : ""} ${a}w`;
869
+ if (Array.isArray(a) && a.length === 2) {
870
+ const [u, p] = a;
871
+ return `${s}/m/${u}x${p}/${n.length > 0 ? "filters:" + n.join(":") : ""} ${u}w`;
872
+ }
873
+ }).join(", ")), e.sizes && (o.sizes = e.sizes.join(", "));
874
+ }
875
+ let l = `${s}/m/`;
876
+ return t > 0 && r > 0 && (l = `${l}${t}x${r}/`), n.length > 0 && (l = `${l}filters:${n.join(":")}`), {
877
+ src: l,
878
+ attrs: o
879
+ };
880
+ }
881
+ const qe = (s = {}) => Object.keys(s).map((e) => `${e}="${s[e]}"`).join(" "), Fe = (s = {}) => Object.keys(s).map((e) => `${e}: ${s[e]}`).join("; ");
882
+ function Ve(s) {
883
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
884
+ }
885
+ function Ge(s, e = {}, t) {
886
+ const r = qe(e);
887
+ return `<${r ? `${s} ${r}` : s}>${Array.isArray(t) ? t.join("") : t || ""}</${s}>`;
888
+ }
889
+ function Ke(s = {}) {
890
+ let e = 0;
891
+ const {
892
+ renderFn: t = Ge,
893
+ textFn: r = Ve,
894
+ resolvers: o = {},
895
+ optimizeImages: n = !1
896
+ } = s, i = (c) => (g) => t(c, { ...g.attrs, key: `${c}-${e}` }, g.children || null), l = (c) => {
897
+ const { src: g, alt: f, ...v } = c.attrs || {};
898
+ let T = g, R = {};
899
+ if (n) {
900
+ const { src: Q, attrs: Z } = Be(g, n);
901
+ T = Q, R = Z;
902
+ }
903
+ const W = {
904
+ src: T,
905
+ alt: f || "",
906
+ key: `img-${e}`,
907
+ ...v,
908
+ ...R
909
+ };
910
+ return t("img", W, "");
911
+ }, a = (c) => {
912
+ const { level: g, ...f } = c.attrs || {};
913
+ return t(`h${g}`, { ...f, key: `h${g}-${e}` }, c.children);
914
+ }, u = (c) => {
915
+ var g, f, v, T;
916
+ return t("span", {
917
+ "data-type": "emoji",
918
+ "data-name": (g = c.attrs) == null ? void 0 : g.name,
919
+ emoji: (f = c.attrs) == null ? void 0 : f.emoji,
920
+ key: `emoji-${e}`
921
+ }, t("img", {
922
+ src: (v = c.attrs) == null ? void 0 : v.fallbackImage,
923
+ alt: (T = c.attrs) == null ? void 0 : T.alt,
924
+ style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
925
+ draggable: "false",
926
+ loading: "lazy"
927
+ }, ""));
928
+ }, p = (c) => t("pre", { ...c.attrs, key: `code-${e}` }, t("code", { key: `code-${e}` }, c.children || "")), h = (c, g = !1) => ({ text: f, attrs: v }) => t(c, g ? {
929
+ style: Fe(v),
930
+ key: `${c}-${e}`
931
+ } : { ...v, key: `${c}-${e}` }, f), m = (c) => O(c), $ = (c) => {
932
+ const { marks: g, ...f } = c;
933
+ return "text" in c ? g ? g.reduce(
934
+ (v, T) => m({ ...T, text: v }),
935
+ // Fix: Ensure render function returns a string
936
+ m({ ...f, children: f.children })
937
+ // Fix: Cast children to string
938
+ ) : r(f.text) : "";
939
+ }, y = (c) => {
940
+ const { linktype: g, href: f, anchor: v, ...T } = c.attrs || {};
941
+ let R = "";
942
+ switch (g) {
943
+ case S.ASSET:
944
+ case S.URL:
945
+ R = f;
946
+ break;
947
+ case S.EMAIL:
948
+ R = `mailto:${f}`;
949
+ break;
950
+ case S.STORY:
951
+ R = f;
952
+ break;
953
+ }
954
+ return v && (R = `${R}#${v}`), t("a", { ...T, href: R, key: `a-${e}` }, c.text);
955
+ }, w = (c) => {
956
+ var g, f;
957
+ return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), t("span", {
958
+ blok: (g = c == null ? void 0 : c.attrs) == null ? void 0 : g.body[0],
959
+ id: (f = c.attrs) == null ? void 0 : f.id,
960
+ key: `component-${e}`,
961
+ style: "display: none"
962
+ }, "");
963
+ }, x = new Map([
964
+ [b.DOCUMENT, i("div")],
965
+ [b.HEADING, a],
966
+ [b.PARAGRAPH, i("p")],
967
+ [b.UL_LIST, i("ul")],
968
+ [b.OL_LIST, i("ol")],
969
+ [b.LIST_ITEM, i("li")],
970
+ [b.IMAGE, l],
971
+ [b.EMOJI, u],
972
+ [b.CODE_BLOCK, p],
973
+ [b.HR, i("hr")],
974
+ [b.BR, i("br")],
975
+ [b.QUOTE, i("blockquote")],
976
+ [b.COMPONENT, w],
977
+ [K.TEXT, $],
978
+ [k.LINK, y],
979
+ [k.ANCHOR, y],
980
+ [k.STYLED, h("span", !0)],
981
+ [k.BOLD, h("strong")],
982
+ [k.TEXT_STYLE, h("span", !0)],
983
+ [k.ITALIC, h("em")],
984
+ [k.UNDERLINE, h("u")],
985
+ [k.STRIKE, h("s")],
986
+ [k.CODE, h("code")],
987
+ [k.SUPERSCRIPT, h("sup")],
988
+ [k.SUBSCRIPT, h("sub")],
989
+ [k.HIGHLIGHT, h("mark")],
990
+ ...Object.entries(o).map(([c, g]) => [c, g])
991
+ ]);
992
+ function M(c) {
993
+ e += 1;
994
+ const g = x.get(c.type);
995
+ if (!g)
996
+ return console.error("<Storyblok>", `No resolver found for node type ${c.type}`), "";
997
+ if (c.type === "text")
998
+ return g(c);
999
+ const f = c.content ? c.content.map(O) : void 0;
1000
+ return g({
1001
+ ...c,
1002
+ children: f
1003
+ // Fix: Update the type of 'children' to Node[]
1004
+ });
1005
+ }
1006
+ function O(c) {
1007
+ return Array.isArray(c) ? c.map(M) : M(c);
1008
+ }
1009
+ return {
1010
+ render: O
1011
+ };
1012
+ }
1013
+ let N, B = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1014
+ const Je = (s, e, t = {}) => {
1015
+ var r;
1016
+ const o = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = +new URL((r = window.location) == null ? void 0 : r.href).searchParams.get(
856
1017
  "_storyblok"
857
- ) === i;
858
- if (!(!r || !o)) {
859
- if (!i) {
1018
+ ) === s;
1019
+ if (!(!o || !n)) {
1020
+ if (!s) {
860
1021
  console.warn("Story ID is not defined. Please provide a valid ID.");
861
1022
  return;
862
1023
  }
863
1024
  window.storyblokRegisterEvent(() => {
864
- new window.StoryblokBridge(t).on(["input", "published", "change"], (n) => {
865
- n.action === "input" && n.story.id === i ? e(n.story) : (n.action === "change" || n.action === "published") && n.storyId === i && window.location.reload();
1025
+ new window.StoryblokBridge(t).on(["input", "published", "change"], (i) => {
1026
+ i.action === "input" && i.story.id === s ? e(i.story) : (i.action === "change" || i.action === "published") && i.storyId === s && window.location.reload();
866
1027
  });
867
1028
  });
868
1029
  }
869
- }, Re = (i = {}) => {
1030
+ }, Ye = (s = {}) => {
870
1031
  var e, t;
871
1032
  const {
872
- bridge: s,
873
- accessToken: r,
874
- use: o = [],
875
- apiOptions: n = {},
1033
+ bridge: r,
1034
+ accessToken: o,
1035
+ use: n = [],
1036
+ apiOptions: i = {},
876
1037
  richText: l = {},
877
1038
  bridgeUrl: a
878
- } = i;
879
- n.accessToken = n.accessToken || r;
880
- const u = { bridge: s, apiOptions: n };
881
- let h = {};
882
- o.forEach((g) => {
883
- h = { ...h, ...g(u) };
884
- }), a && (I = a);
885
- const p = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
886
- return s !== !1 && p && V(I), T = new v(l.schema), l.resolver && E(T, l.resolver), h;
887
- }, E = (i, e) => {
888
- i.addNode("blok", (t) => {
889
- let s = "";
890
- return t.attrs.body.forEach((r) => {
891
- s += e(r.component, r);
1039
+ } = s;
1040
+ i.accessToken = i.accessToken || o;
1041
+ const u = { bridge: r, apiOptions: i };
1042
+ let p = {};
1043
+ n.forEach((m) => {
1044
+ p = { ...p, ...m(u) };
1045
+ }), a && (B = a);
1046
+ const h = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
1047
+ return r !== !1 && h && ne(B), N = new C(l.schema), l.resolver && J(N, l.resolver), p;
1048
+ }, J = (s, e) => {
1049
+ s.addNode("blok", (t) => {
1050
+ let r = "";
1051
+ return t.attrs.body.forEach((o) => {
1052
+ r += e(o.component, o);
892
1053
  }), {
893
- html: s
1054
+ html: r
894
1055
  };
895
1056
  });
896
- }, _e = (i) => !i || !(i != null && i.content.some((e) => e.content || e.type === "blok" || e.type === "horizontal_rule")), xe = (i, e, t) => {
897
- let s = t || T;
898
- if (!s) {
1057
+ }, Xe = (s) => !s || !(s != null && s.content.some((e) => e.content || e.type === "blok" || e.type === "horizontal_rule")), st = (s, e, t) => {
1058
+ let r = t || N;
1059
+ if (!r) {
899
1060
  console.error(
900
1061
  "Please initialize the Storyblok SDK before calling the renderRichText function"
901
1062
  );
902
1063
  return;
903
1064
  }
904
- return _e(i) ? "" : (e && (s = new v(e.schema), e.resolver && E(s, e.resolver)), s.render(i));
905
- }, Te = /* @__PURE__ */ O({
1065
+ return Xe(s) ? "" : (e && (r = new C(e.schema), e.resolver && J(r, e.resolver)), r.render(s));
1066
+ }, Y = /* @__PURE__ */ q({
906
1067
  __name: "StoryblokComponent",
907
1068
  props: {
908
1069
  blok: {}
909
1070
  },
910
- setup(i, { expose: e }) {
911
- const t = i, s = _();
1071
+ setup(s, { expose: e }) {
1072
+ const t = s, r = P();
912
1073
  e({
913
- value: s
1074
+ value: r
914
1075
  });
915
- const r = typeof $(t.blok.component) != "string", o = N("VueSDKOptions"), n = _(t.blok.component);
916
- return r || (o.enableFallbackComponent ? (n.value = o.customFallbackComponent ?? "FallbackComponent", typeof $(n.value) == "string" && console.error(
917
- `Is the Fallback component "${n.value}" registered properly?`
1076
+ const o = typeof A(t.blok.component) != "string", n = ee("VueSDKOptions"), i = P(t.blok.component);
1077
+ return o || (n.enableFallbackComponent ? (i.value = n.customFallbackComponent ?? "FallbackComponent", typeof A(i.value) == "string" && console.error(
1078
+ `Is the Fallback component "${i.value}" registered properly?`
918
1079
  )) : console.error(
919
1080
  `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});"?`
920
- )), (l, a) => (L(), M($(n.value), z({
1081
+ )), (l, a) => (F(), V(A(i.value), te({
921
1082
  ref_key: "blokRef",
922
- ref: s
1083
+ ref: r
923
1084
  }, { ...l.$props, ...l.$attrs }), null, 16));
924
1085
  }
925
- }), Se = {
926
- beforeMount(i, e) {
1086
+ }), We = (s) => {
1087
+ var e, t;
1088
+ return G(
1089
+ Y,
1090
+ {
1091
+ blok: (e = s == null ? void 0 : s.attrs) == null ? void 0 : e.body[0],
1092
+ id: (t = s.attrs) == null ? void 0 : t.id
1093
+ },
1094
+ s.children
1095
+ );
1096
+ };
1097
+ function Qe(s) {
1098
+ const e = {
1099
+ renderFn: G,
1100
+ textFn: re,
1101
+ resolvers: {
1102
+ [b.COMPONENT]: We,
1103
+ ...s.resolvers
1104
+ }
1105
+ };
1106
+ return Ke(e);
1107
+ }
1108
+ const Ze = /* @__PURE__ */ q({
1109
+ __name: "StoryblokRichText",
1110
+ props: {
1111
+ doc: {},
1112
+ resolvers: {}
1113
+ },
1114
+ setup(s) {
1115
+ const e = s, { render: t } = Qe({
1116
+ resolvers: e.resolvers ?? {}
1117
+ }), r = () => t(e.doc);
1118
+ return (o, n) => (F(), V(r));
1119
+ }
1120
+ }), et = {
1121
+ beforeMount(s, e) {
927
1122
  if (e.value) {
928
- const t = we(e.value);
929
- Object.keys(t).length > 0 && (i.setAttribute("data-blok-c", t["data-blok-c"]), i.setAttribute("data-blok-uid", t["data-blok-uid"]), i.classList.add("storyblok__outline"));
1123
+ const t = ze(e.value);
1124
+ 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"));
930
1125
  }
931
1126
  }
932
- }, A = (i) => {
933
- console.error(`You can't use ${i} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
1127
+ }, X = (s) => {
1128
+ console.error(`You can't use ${s} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
934
1129
  `);
935
1130
  };
936
- let y = null;
937
- const Pe = () => (y || A("useStoryblokApi"), y), Ie = async (i, e = {}, t = {}) => {
938
- const s = _(null);
939
- if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, U(() => {
940
- s.value && s.value.id && $e(
941
- s.value.id,
942
- (r) => s.value = r,
1131
+ let E = null;
1132
+ const ot = () => (E || X("useStoryblokApi"), E), nt = async (s, e = {}, t = {}) => {
1133
+ const r = P(null);
1134
+ if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, se(() => {
1135
+ r.value && r.value.id && Je(
1136
+ r.value.id,
1137
+ (o) => r.value = o,
943
1138
  t
944
1139
  );
945
- }), y) {
946
- const { data: r } = await y.get(
947
- `cdn/stories/${i}`,
1140
+ }), E) {
1141
+ const { data: o } = await E.get(
1142
+ `cdn/stories/${s}`,
948
1143
  e
949
1144
  );
950
- s.value = r.story;
951
- } else A("useStoryblok");
952
- return s;
953
- }, Ee = {
954
- install(i, e = {}) {
955
- i.directive("editable", Se), i.component("StoryblokComponent", Te), e.enableFallbackComponent && !e.customFallbackComponent && i.component(
1145
+ r.value = o.story;
1146
+ } else X("useStoryblok");
1147
+ return r;
1148
+ }, it = {
1149
+ install(s, e = {}) {
1150
+ s.directive("editable", et), s.component("StoryblokComponent", Y), s.component("StoryblokRichText", Ze), e.enableFallbackComponent && !e.customFallbackComponent && s.component(
956
1151
  "FallbackComponent",
957
- H(() => import("./FallbackComponent-D9TGQNbC.mjs"))
1152
+ oe(() => import("./FallbackComponent-D9TGQNbC.mjs"))
958
1153
  );
959
- const { storyblokApi: t } = Re(e);
960
- y = t, i.provide("VueSDKOptions", e);
1154
+ const { storyblokApi: t } = Ye(e);
1155
+ E = t, s.provide("VueSDKOptions", e);
961
1156
  }
962
1157
  };
963
1158
  export {
964
- v as RichTextResolver,
965
- ye as RichTextSchema,
966
- Te as StoryblokComponent,
967
- Ee as StoryblokVue,
968
- Ce as apiPlugin,
969
- xe as renderRichText,
970
- Ie as useStoryblok,
971
- Pe as useStoryblokApi,
972
- $e as useStoryblokBridge
1159
+ b as BlockTypes,
1160
+ k as MarkTypes,
1161
+ C as RichTextResolver,
1162
+ Pe as RichTextSchema,
1163
+ Y as StoryblokComponent,
1164
+ Ze as StoryblokRichText,
1165
+ it as StoryblokVue,
1166
+ K as TextTypes,
1167
+ rt as apiPlugin,
1168
+ st as renderRichText,
1169
+ Ke as richTextResolver,
1170
+ nt as useStoryblok,
1171
+ ot as useStoryblokApi,
1172
+ Je as useStoryblokBridge,
1173
+ Qe as useStoryblokRichText
973
1174
  };