@storyblok/vue 8.1.5 → 8.1.6

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,6 +1,6 @@
1
- import { defineComponent as K, ref as C, resolveDynamicComponent as N, inject as ne, openBlock as J, createBlock as Y, mergeProps as ie, h as X, createTextVNode as ae, watch as le, onMounted as ce, defineAsyncComponent as he } from "vue";
1
+ import { defineComponent as G, ref as O, resolveDynamicComponent as N, inject as oe, openBlock as K, createBlock as J, mergeProps as ne, h as Y, createTextVNode as ie, watch as ae, onMounted as le, defineAsyncComponent as ce } from "vue";
2
2
  let D = !1;
3
- const z = [], ue = (r) => new Promise((e, t) => {
3
+ const z = [], he = (r) => new Promise((e, t) => {
4
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.");
@@ -13,53 +13,57 @@ const z = [], ue = (r) => new Promise((e, t) => {
13
13
  z.forEach((n) => n()), D = !0, e(o);
14
14
  }, document.getElementsByTagName("head")[0].appendChild(s);
15
15
  });
16
- var pe = Object.defineProperty, de = (r, e, t) => e in r ? pe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, p = (r, e, t) => de(r, typeof e != "symbol" ? e + "" : e, t);
17
- function B(r) {
18
- return !(r !== r || r === 1 / 0 || r === -1 / 0);
16
+ var ue = Object.defineProperty, de = (r, e, t) => e in r ? ue(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, p = (r, e, t) => de(r, typeof e != "symbol" ? e + "" : e, t);
17
+ class pe extends Error {
18
+ constructor(e) {
19
+ super(e), this.name = "AbortError";
20
+ }
19
21
  }
20
22
  function ge(r, e, t) {
21
- if (!B(e))
23
+ if (!Number.isFinite(e))
22
24
  throw new TypeError("Expected `limit` to be a finite number");
23
- if (!B(t))
25
+ if (!Number.isFinite(t))
24
26
  throw new TypeError("Expected `interval` to be a finite number");
25
27
  const s = [];
26
- let o = [], n = 0;
27
- const i = function() {
28
+ let o = [], n = 0, i = !1;
29
+ const a = async () => {
28
30
  n++;
29
- const a = setTimeout(function() {
30
- n--, s.length > 0 && i(), o = o.filter(function(u) {
31
- return u !== a;
32
- });
33
- }, t);
34
- o.indexOf(a) < 0 && o.push(a);
35
31
  const h = s.shift();
36
- h.resolve(r.apply(h.self, h.args));
37
- }, l = function(...a) {
38
- const h = this;
39
- return new Promise(function(u, d) {
40
- s.push({
41
- resolve: u,
42
- reject: d,
43
- args: a,
44
- self: h
45
- }), n < e && i();
46
- });
47
- };
48
- return l.abort = function() {
49
- o.forEach(clearTimeout), o = [], s.forEach(function(a) {
50
- a.reject(function() {
51
- Error.call(this, "Throttled function aborted"), this.name = "AbortError";
52
- });
53
- }), s.length = 0;
32
+ if (h)
33
+ try {
34
+ const d = await r(...h.args);
35
+ h.resolve(d);
36
+ } catch (d) {
37
+ h.reject(d);
38
+ }
39
+ const u = setTimeout(() => {
40
+ n--, s.length > 0 && a(), o = o.filter((d) => d !== u);
41
+ }, t);
42
+ o.includes(u) || o.push(u);
43
+ }, l = (...h) => i ? Promise.reject(
44
+ new Error(
45
+ "Throttled function is already aborted and not accepting new promises"
46
+ )
47
+ ) : new Promise((u, d) => {
48
+ s.push({
49
+ resolve: u,
50
+ reject: d,
51
+ args: h
52
+ }), n < e && a();
53
+ });
54
+ return l.abort = () => {
55
+ i = !0, o.forEach(clearTimeout), o = [], s.forEach(
56
+ (h) => h.reject(() => new pe("Throttle function aborted"))
57
+ ), s.length = 0;
54
58
  }, l;
55
59
  }
56
60
  let A = class {
57
61
  constructor() {
58
- p(this, "isCDNUrl", (r = "") => r.indexOf("/cdn/") > -1), p(this, "getOptionsPage", (r, e = 25, t = 1) => ({
62
+ p(this, "isCDNUrl", (r = "") => r.includes("/cdn/")), p(this, "getOptionsPage", (r, e = 25, t = 1) => ({
59
63
  ...r,
60
64
  per_page: e,
61
65
  page: t
62
- })), p(this, "delay", (r) => new Promise((e) => setTimeout(e, r))), p(this, "arrayFrom", (r = 0, e) => [...Array(r)].map(e)), p(this, "range", (r = 0, e = r) => {
66
+ })), p(this, "delay", (r) => new Promise((e) => setTimeout(e, r))), p(this, "arrayFrom", (r = 0, e) => Array.from({ length: r }, e)), p(this, "range", (r = 0, e = r) => {
63
67
  const t = Math.abs(e - r) || 0, s = r < e ? 1 : -1;
64
68
  return this.arrayFrom(t, (o, n) => n * s + r);
65
69
  }), p(this, "asyncMap", async (r, e) => Promise.all(r.map(e))), p(this, "flatMap", (r = [], e) => r.map(e).reduce((t, s) => [...t, ...s], [])), p(this, "escapeHTML", function(r) {
@@ -69,16 +73,16 @@ let A = class {
69
73
  ">": "&gt;",
70
74
  '"': "&quot;",
71
75
  "'": "&#39;"
72
- }, t = /[&<>"']/g, s = RegExp(t.source);
76
+ }, t = /[&<>"']/g, s = new RegExp(t.source);
73
77
  return r && s.test(r) ? r.replace(t, (o) => e[o]) : r;
74
78
  });
75
79
  }
76
80
  /**
77
81
  * @method stringify
78
- * @param {Object} params
79
- * @param {String} prefix
80
- * @param {Boolean} isArray
81
- * @return {String} Stringified object
82
+ * @param {object} params
83
+ * @param {string} prefix
84
+ * @param {boolean} isArray
85
+ * @return {string} Stringified object
82
86
  */
83
87
  stringify(r, e, t) {
84
88
  const s = [];
@@ -86,19 +90,19 @@ let A = class {
86
90
  if (!Object.prototype.hasOwnProperty.call(r, o))
87
91
  continue;
88
92
  const n = r[o], i = t ? "" : encodeURIComponent(o);
89
- let l;
90
- typeof n == "object" ? l = this.stringify(
93
+ let a;
94
+ typeof n == "object" ? a = this.stringify(
91
95
  n,
92
- e ? e + encodeURIComponent("[" + i + "]") : i,
96
+ e ? e + encodeURIComponent(`[${i}]`) : i,
93
97
  Array.isArray(n)
94
- ) : l = (e ? e + encodeURIComponent("[" + i + "]") : i) + "=" + encodeURIComponent(n), s.push(l);
98
+ ) : a = `${e ? e + encodeURIComponent(`[${i}]`) : i}=${encodeURIComponent(n)}`, s.push(a);
95
99
  }
96
100
  return s.join("&");
97
101
  }
98
102
  /**
99
103
  * @method getRegionURL
100
- * @param {String} regionCode region code, could be eu, us, cn, ap or ca
101
- * @return {String} The base URL of the region
104
+ * @param {string} regionCode region code, could be eu, us, cn, ap or ca
105
+ * @return {string} The base URL of the region
102
106
  */
103
107
  getRegionURL(r) {
104
108
  const e = "api.storyblok.com", t = "api-us.storyblok.com", s = "app.storyblokchina.cn", o = "api-ap.storyblok.com", n = "api-ca.storyblok.com";
@@ -120,7 +124,7 @@ const me = function(r, e) {
120
124
  const t = {};
121
125
  for (const s in r) {
122
126
  const o = r[s];
123
- e.indexOf(s) > -1 && o !== null && (t[s] = o);
127
+ e.includes(s) && o !== null && (t[s] = o);
124
128
  }
125
129
  return t;
126
130
  }, fe = (r) => r === "email", ye = () => ({
@@ -141,14 +145,14 @@ const me = function(r, e) {
141
145
  singleTag: "br"
142
146
  }), Te = (r) => ({
143
147
  tag: `h${r.attrs.level}`
144
- }), Re = (r) => ({
148
+ }), we = (r) => ({
145
149
  singleTag: [
146
150
  {
147
151
  tag: "img",
148
152
  attrs: me(r.attrs, ["src", "alt", "title"])
149
153
  }
150
154
  ]
151
- }), we = () => ({
155
+ }), Re = () => ({
152
156
  tag: "li"
153
157
  }), Se = () => ({
154
158
  tag: "ol"
@@ -165,15 +169,15 @@ const me = function(r, e) {
165
169
  }
166
170
  }
167
171
  ]
168
- }), xe = () => ({
169
- tag: "b"
170
172
  }), je = () => ({
171
- tag: "s"
173
+ tag: "b"
172
174
  }), Ie = () => ({
175
+ tag: "s"
176
+ }), xe = () => ({
173
177
  tag: "u"
174
- }), Oe = () => ({
175
- tag: "strong"
176
178
  }), Ce = () => ({
179
+ tag: "strong"
180
+ }), Oe = () => ({
177
181
  tag: "code"
178
182
  }), Ae = () => ({
179
183
  tag: "i"
@@ -250,18 +254,18 @@ const me = function(r, e) {
250
254
  code_block: ve,
251
255
  hard_break: $e,
252
256
  heading: Te,
253
- image: Re,
254
- list_item: we,
257
+ image: we,
258
+ list_item: Re,
255
259
  ordered_list: Se,
256
260
  paragraph: _e,
257
261
  emoji: Ee
258
262
  },
259
263
  marks: {
260
- bold: xe,
261
- strike: je,
262
- underline: Ie,
263
- strong: Oe,
264
- code: Ce,
264
+ bold: je,
265
+ strike: Ie,
266
+ underline: xe,
267
+ strong: Ce,
268
+ code: Oe,
265
269
  italic: Ae,
266
270
  link: Le,
267
271
  styled: Pe,
@@ -278,10 +282,10 @@ const me = function(r, e) {
278
282
  ">": "&gt;",
279
283
  '"': "&quot;",
280
284
  "'": "&#39;"
281
- }, t = /[&<>"']/g, s = RegExp(t.source);
285
+ }, t = /[&<>"']/g, s = new RegExp(t.source);
282
286
  return r && s.test(r) ? r.replace(t, (o) => e[o]) : r;
283
287
  };
284
- let q = !1;
288
+ let B = !1;
285
289
  class qe {
286
290
  constructor(e) {
287
291
  p(this, "marks"), p(this, "nodes"), e || (e = ze), this.marks = e.marks || [], this.nodes = e.nodes || [];
@@ -293,9 +297,9 @@ class qe {
293
297
  this.marks[e] = t;
294
298
  }
295
299
  render(e, t = { optimizeImages: !1 }, s = !0) {
296
- if (!q && s && (console.warn(
300
+ if (!B && s && (console.warn(
297
301
  "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/"
298
- ), q = !0), e && e.content && Array.isArray(e.content)) {
302
+ ), B = !0), e && e.content && Array.isArray(e.content)) {
299
303
  let o = "";
300
304
  return e.content.forEach((n) => {
301
305
  o += this.renderNode(n);
@@ -303,42 +307,42 @@ class qe {
303
307
  }
304
308
  return console.warn(
305
309
  `The render method must receive an Object with a "content" field.
306
- The "content" field must be an array of nodes as the type ISbRichtext.
307
- ISbRichtext:
308
- content?: ISbRichtext[]
309
- marks?: ISbRichtext[]
310
- attrs?: any
311
- text?: string
312
- type: string
313
-
314
- Example:
315
- {
316
- content: [
317
- {
318
- content: [
319
- {
320
- text: 'Hello World',
321
- type: 'text'
322
- }
323
- ],
324
- type: 'paragraph'
325
- }
326
- ],
327
- type: 'doc'
328
- }`
310
+ The "content" field must be an array of nodes as the type ISbRichtext.
311
+ ISbRichtext:
312
+ content?: ISbRichtext[]
313
+ marks?: ISbRichtext[]
314
+ attrs?: any
315
+ text?: string
316
+ type: string
317
+
318
+ Example:
319
+ {
320
+ content: [
321
+ {
322
+ content: [
323
+ {
324
+ text: 'Hello World',
325
+ type: 'text'
326
+ }
327
+ ],
328
+ type: 'paragraph'
329
+ }
330
+ ],
331
+ type: 'doc'
332
+ }`
329
333
  ), "";
330
334
  }
331
335
  optimizeImages(e, t) {
332
336
  let s = 0, o = 0, n = "", i = "";
333
- typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (n += `width="${t.width}" `, s = 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()}`));
334
- const l = s > 0 || o > 0 || i.length > 0 ? `${s}x${o}${i}` : "";
337
+ typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (n += `width="${t.width}" `, s = 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-F]{6}/gi) || 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()}`));
338
+ const a = s > 0 || o > 0 || i.length > 0 ? `${s}x${o}${i}` : "";
335
339
  return e = e.replace(
336
- /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,
337
- `a.storyblok.com/f/$1/$2.$3/m/${l}`
338
- ), typeof t != "boolean" && (t.sizes || t.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (a) => {
340
+ /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,
341
+ `a.storyblok.com/f/$1/$2.$3/m/${a}`
342
+ ), typeof t != "boolean" && (t.sizes || t.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (l) => {
339
343
  var h, u;
340
- const d = a.match(
341
- /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g
344
+ const d = l.match(
345
+ /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g
342
346
  );
343
347
  if (d && d.length > 0) {
344
348
  const g = {
@@ -346,16 +350,17 @@ class qe {
346
350
  if (typeof y == "number")
347
351
  return `//${d}/m/${y}x0${i} ${y}w`;
348
352
  if (typeof y == "object" && y.length === 2) {
349
- let w = 0, I = 0;
350
- return typeof y[0] == "number" && (w = y[0]), typeof y[1] == "number" && (I = y[1]), `//${d}/m/${w}x${I}${i} ${w}w`;
353
+ let w = 0, x = 0;
354
+ return typeof y[0] == "number" && (w = y[0]), typeof y[1] == "number" && (x = y[1]), `//${d}/m/${w}x${x}${i} ${w}w`;
351
355
  }
356
+ return "";
352
357
  }).join(", "),
353
358
  sizes: (u = t.sizes) == null ? void 0 : u.map((y) => y).join(", ")
354
359
  };
355
- let $ = "";
356
- return g.srcset && ($ += `srcset="${g.srcset}" `), g.sizes && ($ += `sizes="${g.sizes}" `), a.replace(/<img/g, `<img ${$.trim()}`);
360
+ let R = "";
361
+ return g.srcset && (R += `srcset="${g.srcset}" `), g.sizes && (R += `sizes="${g.sizes}" `), l.replace(/<img/g, `<img ${R.trim()}`);
357
362
  }
358
- return a;
363
+ return l;
359
364
  })), e;
360
365
  }
361
366
  renderNode(e) {
@@ -423,7 +428,7 @@ class qe {
423
428
  }
424
429
  }
425
430
  const L = qe;
426
- class Ve {
431
+ class Fe {
427
432
  constructor(e) {
428
433
  p(this, "baseURL"), p(this, "timeout"), p(this, "headers"), p(this, "responseInterceptor"), p(this, "fetch"), p(this, "ejectInterceptor"), p(this, "url"), p(this, "parameters"), p(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 = {};
429
434
  }
@@ -462,31 +467,31 @@ class Ve {
462
467
  async _methodHandler(e) {
463
468
  let t = `${this.baseURL}${this.url}`, s = null;
464
469
  if (e === "get") {
465
- const a = new A();
466
- t = `${this.baseURL}${this.url}?${a.stringify(
470
+ const l = new A();
471
+ t = `${this.baseURL}${this.url}?${l.stringify(
467
472
  this.parameters
468
473
  )}`;
469
474
  } else
470
475
  s = JSON.stringify(this.parameters);
471
476
  const o = new URL(t), n = new AbortController(), { signal: i } = n;
472
- let l;
473
- this.timeout && (l = setTimeout(() => n.abort(), this.timeout));
477
+ let a;
478
+ this.timeout && (a = setTimeout(() => n.abort(), this.timeout));
474
479
  try {
475
- const a = await this.fetch(`${o}`, {
480
+ const l = await this.fetch(`${o}`, {
476
481
  method: e,
477
482
  headers: this.headers,
478
483
  body: s,
479
484
  signal: i,
480
485
  ...this.fetchOptions
481
486
  });
482
- this.timeout && clearTimeout(l);
487
+ this.timeout && clearTimeout(a);
483
488
  const h = await this._responseHandler(
484
- a
489
+ l
485
490
  );
486
491
  return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(h)) : this._statusHandler(h);
487
- } catch (a) {
492
+ } catch (l) {
488
493
  return {
489
- message: a
494
+ message: l
490
495
  };
491
496
  }
492
497
  }
@@ -510,35 +515,39 @@ class Ve {
510
515
  });
511
516
  }
512
517
  }
513
- const Fe = Ve, V = "SB-Agent", M = {
518
+ const Ve = Fe, q = "SB-Agent", M = {
514
519
  defaultAgentName: "SB-JS-CLIENT",
515
520
  defaultAgentVersion: "SB-Agent-Version",
516
521
  packageVersion: "6.0.0"
517
522
  };
518
- let O = {};
523
+ let C = {};
519
524
  const E = {};
520
525
  class Ge {
521
526
  /**
522
527
  *
523
528
  * @param config ISbConfig interface
524
- * @param endpoint string, optional
529
+ * @param pEndpoint string, optional
525
530
  */
526
531
  constructor(e, t) {
527
532
  p(this, "client"), p(this, "maxRetries"), p(this, "retriesDelay"), p(this, "throttle"), p(this, "accessToken"), p(this, "cache"), p(this, "helpers"), p(this, "resolveCounter"), p(this, "relations"), p(this, "links"), p(this, "richTextResolver"), p(this, "resolveNestedRelations"), p(this, "stringifiedStoriesCache");
528
533
  let s = e.endpoint || t;
529
534
  if (!s) {
530
- const i = new A().getRegionURL, l = e.https === !1 ? "http" : "https";
531
- e.oauthToken ? s = `${l}://${i(e.region)}/v1` : s = `${l}://${i(e.region)}/v2`;
535
+ const i = new A().getRegionURL, a = e.https === !1 ? "http" : "https";
536
+ e.oauthToken ? s = `${a}://${i(e.region)}/v1` : s = `${a}://${i(e.region)}/v2`;
532
537
  }
533
538
  const o = new Headers();
534
- o.set("Content-Type", "application/json"), o.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([i, l]) => {
535
- o.set(i, l);
536
- }), o.has(V) || (o.set(V, M.defaultAgentName), o.set(
539
+ o.set("Content-Type", "application/json"), o.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([i, a]) => {
540
+ o.set(i, a);
541
+ }), o.has(q) || (o.set(q, M.defaultAgentName), o.set(
537
542
  M.defaultAgentVersion,
538
543
  M.packageVersion
539
544
  ));
540
545
  let n = 5;
541
- e.oauthToken && (o.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new L(e.richTextSchema) : this.richTextResolver = new L(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = ge(this.throttledRequest, n, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new A(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new Fe({
546
+ e.oauthToken && (o.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new L(e.richTextSchema) : this.richTextResolver = new L(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = ge(
547
+ this.throttledRequest.bind(this),
548
+ n,
549
+ 1e3
550
+ ), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new A(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new Ve({
542
551
  baseURL: s,
543
552
  timeout: e.timeout || 0,
544
553
  headers: o,
@@ -575,32 +584,35 @@ class Ge {
575
584
  return this.cacheResponse(o, n, void 0, s);
576
585
  }
577
586
  async getAll(e, t, s, o) {
578
- const n = (t == null ? void 0 : t.per_page) || 25, i = `/${e}`, l = i.split("/"), a = s || l[l.length - 1], h = 1, u = await this.makeRequest(
587
+ const n = (t == null ? void 0 : t.per_page) || 25, i = `/${e}`.replace(/\/$/, ""), a = s ?? i.substring(i.lastIndexOf("/") + 1), l = 1, h = await this.makeRequest(
579
588
  i,
580
589
  t,
581
590
  n,
582
- h,
591
+ l,
583
592
  o
584
- ), d = u.total ? Math.ceil(u.total / n) : 1, g = await this.helpers.asyncMap(
585
- this.helpers.range(h, d),
586
- ($) => this.makeRequest(i, t, n, $ + 1, o)
587
- );
588
- return this.helpers.flatMap(
589
- [u, ...g],
590
- ($) => Object.values($.data[a])
593
+ ), u = h.total ? Math.ceil(h.total / n) : 1, d = await this.helpers.asyncMap(
594
+ this.helpers.range(l, u),
595
+ (g) => this.makeRequest(i, t, n, g + 1, o)
591
596
  );
597
+ return this.helpers.flatMap([h, ...d], (g) => Object.values(g.data[a]));
592
598
  }
593
599
  post(e, t, s) {
594
600
  const o = `/${e}`;
595
- return Promise.resolve(this.throttle("post", o, t, s));
601
+ return Promise.resolve(
602
+ this.throttle("post", o, t, s)
603
+ );
596
604
  }
597
605
  put(e, t, s) {
598
606
  const o = `/${e}`;
599
- return Promise.resolve(this.throttle("put", o, t, s));
607
+ return Promise.resolve(
608
+ this.throttle("put", o, t, s)
609
+ );
600
610
  }
601
611
  delete(e, t, s) {
602
612
  const o = `/${e}`;
603
- return Promise.resolve(this.throttle("delete", o, t, s));
613
+ return Promise.resolve(
614
+ this.throttle("delete", o, t, s)
615
+ );
604
616
  }
605
617
  getStories(e, t) {
606
618
  return this._addResolveLevel(e), this.get("cdn/stories", e, t);
@@ -622,7 +634,7 @@ class Ge {
622
634
  }
623
635
  _insertLinks(e, t, s) {
624
636
  const o = e[t];
625
- o && o.fieldtype == "multilink" && o.linktype == "story" && typeof o.id == "string" && this.links[s][o.id] ? o.story = this._cleanCopy(this.links[s][o.id]) : o && o.linktype === "story" && typeof o.uuid == "string" && this.links[s][o.uuid] && (o.story = this._cleanCopy(this.links[s][o.uuid]));
637
+ o && o.fieldtype === "multilink" && o.linktype === "story" && typeof o.id == "string" && this.links[s][o.id] ? o.story = this._cleanCopy(this.links[s][o.id]) : o && o.linktype === "story" && typeof o.uuid == "string" && this.links[s][o.uuid] && (o.story = this._cleanCopy(this.links[s][o.uuid]));
626
638
  }
627
639
  /**
628
640
  *
@@ -636,7 +648,7 @@ class Ge {
636
648
  )), JSON.parse(this.stringifiedStoriesCache[t])) : t;
637
649
  }
638
650
  _insertRelations(e, t, s, o) {
639
- s.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)));
651
+ s.includes(`${e.component}.${t}`) && (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)));
640
652
  }
641
653
  iterateTree(e, t, s) {
642
654
  const o = (n) => {
@@ -666,17 +678,17 @@ class Ge {
666
678
  async resolveLinks(e, t, s) {
667
679
  let o = [];
668
680
  if (e.link_uuids) {
669
- const n = e.link_uuids.length, i = [], l = 50;
670
- for (let a = 0; a < n; a += l) {
671
- const h = Math.min(n, a + l);
672
- i.push(e.link_uuids.slice(a, h));
681
+ const n = e.link_uuids.length, i = [], a = 50;
682
+ for (let l = 0; l < n; l += a) {
683
+ const h = Math.min(n, l + a);
684
+ i.push(e.link_uuids.slice(l, h));
673
685
  }
674
- for (let a = 0; a < i.length; a++)
686
+ for (let l = 0; l < i.length; l++)
675
687
  (await this.getStories({
676
- per_page: l,
688
+ per_page: a,
677
689
  language: t.language,
678
690
  version: t.version,
679
- by_uuids: i[a].join(",")
691
+ by_uuids: i[l].join(",")
680
692
  })).data.stories.forEach(
681
693
  (h) => {
682
694
  o.push(h);
@@ -694,17 +706,17 @@ class Ge {
694
706
  async resolveRelations(e, t, s) {
695
707
  let o = [];
696
708
  if (e.rel_uuids) {
697
- const n = e.rel_uuids.length, i = [], l = 50;
698
- for (let a = 0; a < n; a += l) {
699
- const h = Math.min(n, a + l);
700
- i.push(e.rel_uuids.slice(a, h));
709
+ const n = e.rel_uuids.length, i = [], a = 50;
710
+ for (let l = 0; l < n; l += a) {
711
+ const h = Math.min(n, l + a);
712
+ i.push(e.rel_uuids.slice(l, h));
701
713
  }
702
- for (let a = 0; a < i.length; a++)
714
+ for (let l = 0; l < i.length; l++)
703
715
  (await this.getStories({
704
- per_page: l,
716
+ per_page: a,
705
717
  language: t.language,
706
718
  version: t.version,
707
- by_uuids: i[a].join(","),
719
+ by_uuids: i[l].join(","),
708
720
  excluding_fields: t.excluding_fields
709
721
  })).data.stories.forEach((h) => {
710
722
  o.push(h);
@@ -730,45 +742,50 @@ class Ge {
730
742
  async resolveStories(e, t, s) {
731
743
  var o, n;
732
744
  let i = [];
733
- if (this.links[s] = {}, this.relations[s] = {}, 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, s)), 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, s), this.resolveNestedRelations)
734
- for (const l in this.relations[s])
745
+ if (this.links[s] = {}, this.relations[s] = {}, 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, s)), t.resolve_links && ["1", "story", "url", "link"].includes(t.resolve_links) && ((o = e.links) != null && o.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t, s), this.resolveNestedRelations)
746
+ for (const a in this.relations[s])
735
747
  this.iterateTree(
736
- this.relations[s][l],
748
+ this.relations[s][a],
737
749
  i,
738
750
  s
739
751
  );
740
- e.story ? this.iterateTree(e.story, i, s) : e.stories.forEach((l) => {
741
- this.iterateTree(l, i, s);
752
+ e.story ? this.iterateTree(e.story, i, s) : e.stories.forEach((a) => {
753
+ this.iterateTree(a, i, s);
742
754
  }), this.stringifiedStoriesCache = {}, delete this.links[s], delete this.relations[s];
743
755
  }
744
756
  async cacheResponse(e, t, s, o) {
745
757
  const n = this.helpers.stringify({ url: e, params: t }), i = this.cacheProvider();
746
- if (this.cache.clear === "auto" && t.version === "draft" && await this.flushCache(), t.version === "published" && e != "/cdn/spaces/me") {
747
- const l = await i.get(n);
748
- if (l)
749
- return Promise.resolve(l);
758
+ if (this.cache.clear === "auto" && t.version === "draft" && await this.flushCache(), t.version === "published" && e !== "/cdn/spaces/me") {
759
+ const a = await i.get(n);
760
+ if (a)
761
+ return Promise.resolve(a);
750
762
  }
751
- return new Promise(async (l, a) => {
763
+ return new Promise(async (a, l) => {
752
764
  var h;
753
765
  try {
754
- const u = await this.throttle("get", e, t, o);
766
+ const u = await this.throttle(
767
+ "get",
768
+ e,
769
+ t,
770
+ o
771
+ );
755
772
  if (u.status !== 200)
756
- return a(u);
773
+ return l(u);
757
774
  let d = { data: u.data, headers: u.headers };
758
775
  if ((h = u.headers) != null && h["per-page"] && (d = Object.assign({}, d, {
759
- perPage: u.headers["per-page"] ? parseInt(u.headers["per-page"]) : 0,
760
- total: u.headers["per-page"] ? parseInt(u.headers.total) : 0
776
+ perPage: u.headers["per-page"] ? Number.parseInt(u.headers["per-page"]) : 0,
777
+ total: u.headers["per-page"] ? Number.parseInt(u.headers.total) : 0
761
778
  })), d.data.story || d.data.stories) {
762
779
  const g = this.resolveCounter = ++this.resolveCounter % 1e3;
763
780
  await this.resolveStories(d.data, t, `${g}`);
764
781
  }
765
- return t.version === "published" && e != "/cdn/spaces/me" && await i.set(n, d), d.data.cv && t.token && E[t.token] != d.data.cv && (await this.flushCache(), E[t.token] = d.data.cv), l(d);
782
+ return t.version === "published" && e !== "/cdn/spaces/me" && await i.set(n, d), d.data.cv && t.token && E[t.token] !== d.data.cv && (await this.flushCache(), E[t.token] = d.data.cv), a(d);
766
783
  } catch (u) {
767
784
  if (u.response && u.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
768
785
  return console.log(
769
786
  `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
770
- ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, s).then(l).catch(a);
771
- a(u);
787
+ ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, s).then(a).catch(l);
788
+ l(u);
772
789
  }
773
790
  });
774
791
  }
@@ -792,20 +809,21 @@ class Ge {
792
809
  case "memory":
793
810
  return {
794
811
  get(e) {
795
- return Promise.resolve(O[e]);
812
+ return Promise.resolve(C[e]);
796
813
  },
797
814
  getAll() {
798
- return Promise.resolve(O);
815
+ return Promise.resolve(C);
799
816
  },
800
817
  set(e, t) {
801
- return O[e] = t, Promise.resolve(void 0);
818
+ return C[e] = t, Promise.resolve(void 0);
802
819
  },
803
820
  flush() {
804
- return O = {}, Promise.resolve(void 0);
821
+ return C = {}, Promise.resolve(void 0);
805
822
  }
806
823
  };
807
824
  case "custom":
808
- if (this.cache.custom) return this.cache.custom;
825
+ if (this.cache.custom)
826
+ return this.cache.custom;
809
827
  default:
810
828
  return {
811
829
  get() {
@@ -856,19 +874,19 @@ function Je(r, e) {
856
874
  return { src: r, attrs: {} };
857
875
  let t = 0, s = 0;
858
876
  const o = {}, n = [];
859
- function i(a, h, u, d, g) {
860
- typeof a != "number" || a <= h || a >= u ? console.warn(`[StoryblokRichText] - ${d.charAt(0).toUpperCase() + d.slice(1)} value must be a number between ${h} and ${u} (inclusive)`) : g.push(`${d}(${a})`);
877
+ function i(l, h, u, d, g) {
878
+ typeof l != "number" || l <= h || l >= u ? console.warn(`[StoryblokRichText] - ${d.charAt(0).toUpperCase() + d.slice(1)} value must be a number between ${h} and ${u} (inclusive)`) : g.push(`${d}(${l})`);
861
879
  }
862
880
  if (typeof e == "object") {
863
881
  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, s = 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) {
864
- const { filters: a } = e || {}, { blur: h, brightness: u, fill: d, format: g, grayscale: $, quality: y, rotate: w } = a || {};
865
- h && i(h, 0, 100, "blur", n), y && i(y, 0, 100, "quality", n), u && i(u, 0, 100, "brightness", n), d && n.push(`fill(${d})`), $ && n.push("grayscale()"), w && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${w})`), g && ["webp", "png", "jpeg"].includes(g) && n.push(`format(${g})`);
882
+ const { filters: l } = e || {}, { blur: h, brightness: u, fill: d, format: g, grayscale: R, quality: y, rotate: w } = l || {};
883
+ h && i(h, 0, 100, "blur", n), y && i(y, 0, 100, "quality", n), u && i(u, 0, 100, "brightness", n), d && n.push(`fill(${d})`), R && n.push("grayscale()"), w && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${w})`), g && ["webp", "png", "jpeg"].includes(g) && n.push(`format(${g})`);
866
884
  }
867
- e.srcset && (o.srcset = e.srcset.map((a) => {
868
- if (typeof a == "number")
869
- return `${r}/m/${a}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${a}w`;
870
- if (Array.isArray(a) && a.length === 2) {
871
- const [h, u] = a;
885
+ e.srcset && (o.srcset = e.srcset.map((l) => {
886
+ if (typeof l == "number")
887
+ return `${r}/m/${l}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${l}w`;
888
+ if (Array.isArray(l) && l.length === 2) {
889
+ const [h, u] = l;
872
890
  return `${r}/m/${h}x${u}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${h}w`;
873
891
  } else {
874
892
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
@@ -876,13 +894,13 @@ function Je(r, e) {
876
894
  }
877
895
  }).join(", ")), e.sizes && (o.sizes = e.sizes.join(", "));
878
896
  }
879
- let l = `${r}/m/`;
880
- return t > 0 && s > 0 && (l = `${l}${t}x${s}/`), n.length > 0 && (l = `${l}filters:${n.join(":")}`), {
881
- src: l,
897
+ let a = `${r}/m/`;
898
+ return t > 0 && s > 0 && (a = `${a}${t}x${s}/`), n.length > 0 && (a = `${a}filters:${n.join(":")}`), {
899
+ src: a,
882
900
  attrs: o
883
901
  };
884
902
  }
885
- var k = /* @__PURE__ */ ((r) => (r.DOCUMENT = "doc", r.HEADING = "heading", r.PARAGRAPH = "paragraph", r.QUOTE = "blockquote", r.OL_LIST = "ordered_list", r.UL_LIST = "bullet_list", r.LIST_ITEM = "list_item", r.CODE_BLOCK = "code_block", r.HR = "horizontal_rule", r.BR = "hard_break", r.IMAGE = "image", r.EMOJI = "emoji", r.COMPONENT = "blok", r))(k || {}), v = /* @__PURE__ */ ((r) => (r.BOLD = "bold", r.STRONG = "strong", r.STRIKE = "strike", r.UNDERLINE = "underline", r.ITALIC = "italic", r.CODE = "code", r.LINK = "link", r.ANCHOR = "anchor", r.STYLED = "styled", r.SUPERSCRIPT = "superscript", r.SUBSCRIPT = "subscript", r.TEXT_STYLE = "textStyle", r.HIGHLIGHT = "highlight", r))(v || {}), W = /* @__PURE__ */ ((r) => (r.TEXT = "text", r))(W || {}), x = /* @__PURE__ */ ((r) => (r.URL = "url", r.STORY = "story", r.ASSET = "asset", r.EMAIL = "email", r))(x || {});
903
+ var k = /* @__PURE__ */ ((r) => (r.DOCUMENT = "doc", r.HEADING = "heading", r.PARAGRAPH = "paragraph", r.QUOTE = "blockquote", r.OL_LIST = "ordered_list", r.UL_LIST = "bullet_list", r.LIST_ITEM = "list_item", r.CODE_BLOCK = "code_block", r.HR = "horizontal_rule", r.BR = "hard_break", r.IMAGE = "image", r.EMOJI = "emoji", r.COMPONENT = "blok", r))(k || {}), v = /* @__PURE__ */ ((r) => (r.BOLD = "bold", r.STRONG = "strong", r.STRIKE = "strike", r.UNDERLINE = "underline", r.ITALIC = "italic", r.CODE = "code", r.LINK = "link", r.ANCHOR = "anchor", r.STYLED = "styled", r.SUPERSCRIPT = "superscript", r.SUBSCRIPT = "subscript", r.TEXT_STYLE = "textStyle", r.HIGHLIGHT = "highlight", r))(v || {}), X = /* @__PURE__ */ ((r) => (r.TEXT = "text", r))(X || {}), j = /* @__PURE__ */ ((r) => (r.URL = "url", r.STORY = "story", r.ASSET = "asset", r.EMAIL = "email", r))(j || {});
886
904
  const Ye = [
887
905
  "area",
888
906
  "base",
@@ -915,37 +933,37 @@ function et(r = {}) {
915
933
  resolvers: o = {},
916
934
  optimizeImages: n = !1,
917
935
  keyedResolvers: i = !1
918
- } = r, l = (c) => (m) => {
936
+ } = r, a = (c) => (m) => {
919
937
  const f = m.attrs || {};
920
938
  return i && (f.key = `${c}-${e}`), t(c, f, m.children || null);
921
- }, a = (c) => {
922
- const { src: m, alt: f, title: b, srcset: R, sizes: T } = c.attrs || {};
939
+ }, l = (c) => {
940
+ const { src: m, alt: f, title: b, srcset: T, sizes: $ } = c.attrs || {};
923
941
  let S = m, _ = {};
924
942
  if (n) {
925
- const { src: se, attrs: oe } = Je(m, n);
926
- S = se, _ = oe;
943
+ const { src: re, attrs: se } = Je(m, n);
944
+ S = re, _ = se;
927
945
  }
928
946
  i && (_ = {
929
947
  ..._,
930
948
  key: `img-${e}`
931
949
  });
932
- const re = {
950
+ const te = {
933
951
  src: S,
934
952
  alt: f,
935
953
  title: b,
936
- srcset: R,
937
- sizes: T,
954
+ srcset: T,
955
+ sizes: $,
938
956
  ..._
939
957
  };
940
- return t("img", F(re));
958
+ return t("img", F(te));
941
959
  }, h = (c) => {
942
960
  const { level: m, ...f } = c.attrs || {}, b = {
943
961
  ...f
944
962
  };
945
963
  return i && (b.key = `h${m}-${e}`), t(`h${m}`, b, c.children);
946
964
  }, u = (c) => {
947
- var m, f, b, R;
948
- const T = t("img", {
965
+ var m, f, b, T;
966
+ const $ = t("img", {
949
967
  src: (m = c.attrs) == null ? void 0 : m.fallbackImage,
950
968
  alt: (f = c.attrs) == null ? void 0 : f.alt,
951
969
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
@@ -954,44 +972,44 @@ function et(r = {}) {
954
972
  }), S = {
955
973
  "data-type": "emoji",
956
974
  "data-name": (b = c.attrs) == null ? void 0 : b.name,
957
- "data-emoji": (R = c.attrs) == null ? void 0 : R.emoji
975
+ "data-emoji": (T = c.attrs) == null ? void 0 : T.emoji
958
976
  };
959
- return i && (S.key = `emoji-${e}`), t("span", S, T);
977
+ return i && (S.key = `emoji-${e}`), t("span", S, $);
960
978
  }, d = (c) => t("pre", {
961
979
  ...c.attrs,
962
980
  key: `code-${e}`
963
981
  }, t("code", { key: `code-${e}` }, c.children || "")), g = (c, m = !1) => ({ text: f, attrs: b }) => {
964
- const { class: R, id: T, ...S } = b || {}, _ = m ? {
965
- class: R,
966
- id: T,
982
+ const { class: T, id: $, ...S } = b || {}, _ = m ? {
983
+ class: T,
984
+ id: $,
967
985
  style: We(S) || void 0
968
986
  } : b || {};
969
987
  return i && (_.key = `${c}-${e}`), t(c, F(_), f);
970
- }, $ = (c) => P(c), y = (c) => {
988
+ }, R = (c) => P(c), y = (c) => {
971
989
  const { marks: m, ...f } = c;
972
990
  return "text" in c ? m ? m.reduce(
973
- (b, R) => $({ ...R, text: b }),
991
+ (b, T) => R({ ...T, text: b }),
974
992
  // Fix: Ensure render function returns a string
975
- $({ ...f, children: f.children })
993
+ R({ ...f, children: f.children })
976
994
  // Fix: Cast children to string
977
995
  ) : s(f.text) : "";
978
996
  }, w = (c) => {
979
- const { linktype: m, href: f, anchor: b, ...R } = c.attrs || {};
980
- let T = "";
997
+ const { linktype: m, href: f, anchor: b, ...T } = c.attrs || {};
998
+ let $ = "";
981
999
  switch (m) {
982
- case x.ASSET:
983
- case x.URL:
984
- T = f;
1000
+ case j.ASSET:
1001
+ case j.URL:
1002
+ $ = f;
985
1003
  break;
986
- case x.EMAIL:
987
- T = `mailto:${f}`;
1004
+ case j.EMAIL:
1005
+ $ = `mailto:${f}`;
988
1006
  break;
989
- case x.STORY:
990
- T = f;
1007
+ case j.STORY:
1008
+ $ = f;
991
1009
  break;
992
1010
  }
993
- return b && (T = `${T}#${b}`), t("a", { ...R, href: T, key: `a-${e}` }, c.text);
994
- }, I = (c) => {
1011
+ return b && ($ = `${$}#${b}`), t("a", { ...T, href: $, key: `a-${e}` }, c.text);
1012
+ }, x = (c) => {
995
1013
  var m, f;
996
1014
  return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), t("span", {
997
1015
  blok: (m = c == null ? void 0 : c.attrs) == null ? void 0 : m.body[0],
@@ -999,21 +1017,21 @@ function et(r = {}) {
999
1017
  key: `component-${e}`,
1000
1018
  style: "display: none"
1001
1019
  });
1002
- }, te = new Map([
1003
- [k.DOCUMENT, l("div")],
1020
+ }, ee = new Map([
1021
+ [k.DOCUMENT, a("div")],
1004
1022
  [k.HEADING, h],
1005
- [k.PARAGRAPH, l("p")],
1006
- [k.UL_LIST, l("ul")],
1007
- [k.OL_LIST, l("ol")],
1008
- [k.LIST_ITEM, l("li")],
1009
- [k.IMAGE, a],
1023
+ [k.PARAGRAPH, a("p")],
1024
+ [k.UL_LIST, a("ul")],
1025
+ [k.OL_LIST, a("ol")],
1026
+ [k.LIST_ITEM, a("li")],
1027
+ [k.IMAGE, l],
1010
1028
  [k.EMOJI, u],
1011
1029
  [k.CODE_BLOCK, d],
1012
- [k.HR, l("hr")],
1013
- [k.BR, l("br")],
1014
- [k.QUOTE, l("blockquote")],
1015
- [k.COMPONENT, I],
1016
- [W.TEXT, y],
1030
+ [k.HR, a("hr")],
1031
+ [k.BR, a("br")],
1032
+ [k.QUOTE, a("blockquote")],
1033
+ [k.COMPONENT, x],
1034
+ [X.TEXT, y],
1017
1035
  [v.LINK, w],
1018
1036
  [v.ANCHOR, w],
1019
1037
  [v.STYLED, g("span", !0)],
@@ -1030,7 +1048,7 @@ function et(r = {}) {
1030
1048
  ]);
1031
1049
  function U(c) {
1032
1050
  e += 1;
1033
- const m = te.get(c.type);
1051
+ const m = ee.get(c.type);
1034
1052
  if (!m)
1035
1053
  return console.error("<Storyblok>", `No resolver found for node type ${c.type}`), "";
1036
1054
  if (c.type === "text")
@@ -1049,7 +1067,7 @@ function et(r = {}) {
1049
1067
  render: P
1050
1068
  };
1051
1069
  }
1052
- let H, G = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1070
+ let H, V = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1053
1071
  const tt = (r, e, t = {}) => {
1054
1072
  var s;
1055
1073
  const o = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = +new URL((s = window.location) == null ? void 0 : s.href).searchParams.get(
@@ -1073,18 +1091,18 @@ const tt = (r, e, t = {}) => {
1073
1091
  accessToken: o,
1074
1092
  use: n = [],
1075
1093
  apiOptions: i = {},
1076
- richText: l = {},
1077
- bridgeUrl: a
1094
+ richText: a = {},
1095
+ bridgeUrl: l
1078
1096
  } = r;
1079
1097
  i.accessToken = i.accessToken || o;
1080
1098
  const h = { bridge: s, apiOptions: i };
1081
1099
  let u = {};
1082
1100
  n.forEach((g) => {
1083
1101
  u = { ...u, ...g(h) };
1084
- }), a && (G = a);
1102
+ }), l && (V = l);
1085
1103
  const d = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
1086
- return s !== !1 && d && ue(G), H = new L(l.schema), l.resolver && Q(H, l.resolver), u;
1087
- }, Q = (r, e) => {
1104
+ return s !== !1 && d && he(V), H = new L(a.schema), a.resolver && W(H, a.resolver), u;
1105
+ }, W = (r, e) => {
1088
1106
  r.addNode("blok", (t) => {
1089
1107
  let s = "";
1090
1108
  return t.attrs.body.forEach((o) => {
@@ -1101,31 +1119,31 @@ const tt = (r, e, t = {}) => {
1101
1119
  );
1102
1120
  return;
1103
1121
  }
1104
- return st(r) ? "" : (e && (s = new L(e.schema), e.resolver && Q(s, e.resolver)), s.render(r, {}, !1));
1105
- }, Z = /* @__PURE__ */ K({
1122
+ return st(r) ? "" : (e && (s = new L(e.schema), e.resolver && W(s, e.resolver)), s.render(r, {}, !1));
1123
+ }, Q = /* @__PURE__ */ G({
1106
1124
  __name: "StoryblokComponent",
1107
1125
  props: {
1108
1126
  blok: {}
1109
1127
  },
1110
1128
  setup(r, { expose: e }) {
1111
- const t = r, s = C();
1129
+ const t = r, s = O();
1112
1130
  e({
1113
1131
  value: s
1114
1132
  });
1115
- const o = typeof N(t.blok.component) != "string", n = ne("VueSDKOptions"), i = C(t.blok.component);
1133
+ const o = typeof N(t.blok.component) != "string", n = oe("VueSDKOptions"), i = O(t.blok.component);
1116
1134
  return o || (n.enableFallbackComponent ? (i.value = n.customFallbackComponent ?? "FallbackComponent", typeof N(i.value) == "string" && console.error(
1117
1135
  `Is the Fallback component "${i.value}" registered properly?`
1118
1136
  )) : console.error(
1119
1137
  `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});"?`
1120
- )), (l, a) => (J(), Y(N(i.value), ie({
1138
+ )), (a, l) => (K(), J(N(i.value), ne({
1121
1139
  ref_key: "blokRef",
1122
1140
  ref: s
1123
- }, { ...l.$props, ...l.$attrs }), null, 16));
1141
+ }, { ...a.$props, ...a.$attrs }), null, 16));
1124
1142
  }
1125
1143
  }), ot = (r) => {
1126
1144
  var e, t;
1127
- return X(
1128
- Z,
1145
+ return Y(
1146
+ Q,
1129
1147
  {
1130
1148
  blok: (e = r == null ? void 0 : r.attrs) == null ? void 0 : e.body[0],
1131
1149
  id: (t = r.attrs) == null ? void 0 : t.id
@@ -1135,8 +1153,8 @@ const tt = (r, e, t = {}) => {
1135
1153
  };
1136
1154
  function nt(r) {
1137
1155
  const e = {
1138
- renderFn: X,
1139
- textFn: ae,
1156
+ renderFn: Y,
1157
+ textFn: ie,
1140
1158
  keyedResolvers: !0,
1141
1159
  resolvers: {
1142
1160
  [k.COMPONENT]: ot,
@@ -1145,15 +1163,15 @@ function nt(r) {
1145
1163
  };
1146
1164
  return et(e);
1147
1165
  }
1148
- const it = /* @__PURE__ */ K({
1166
+ const it = /* @__PURE__ */ G({
1149
1167
  __name: "StoryblokRichText",
1150
1168
  props: {
1151
1169
  doc: {},
1152
1170
  resolvers: {}
1153
1171
  },
1154
1172
  setup(r) {
1155
- const e = r, t = C(), s = () => t.value;
1156
- return le(
1173
+ const e = r, t = O(), s = () => t.value;
1174
+ return ae(
1157
1175
  [e.doc, e.resolvers],
1158
1176
  ([o, n]) => {
1159
1177
  const { render: i } = nt({
@@ -1164,7 +1182,7 @@ const it = /* @__PURE__ */ K({
1164
1182
  {
1165
1183
  immediate: !0
1166
1184
  }
1167
- ), (o, n) => (J(), Y(s));
1185
+ ), (o, n) => (K(), J(s));
1168
1186
  }
1169
1187
  }), at = {
1170
1188
  beforeMount(r, e) {
@@ -1173,35 +1191,35 @@ const it = /* @__PURE__ */ K({
1173
1191
  Object.keys(t).length > 0 && (r.setAttribute("data-blok-c", t["data-blok-c"]), r.setAttribute("data-blok-uid", t["data-blok-uid"]), r.classList.add("storyblok__outline"));
1174
1192
  }
1175
1193
  }
1176
- }, ee = (r) => {
1194
+ }, Z = (r) => {
1177
1195
  console.error(`You can't use ${r} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
1178
1196
  `);
1179
1197
  };
1180
- let j = null;
1181
- const ut = () => (j || ee("useStoryblokApi"), j), pt = async (r, e = {}, t = {}) => {
1182
- const s = C(null);
1183
- if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, ce(() => {
1198
+ let I = null;
1199
+ const ut = () => (I || Z("useStoryblokApi"), I), dt = async (r, e = {}, t = {}) => {
1200
+ const s = O(null);
1201
+ if (t.resolveRelations = t.resolveRelations ?? e.resolve_relations, t.resolveLinks = t.resolveLinks ?? e.resolve_links, le(() => {
1184
1202
  s.value && s.value.id && tt(
1185
1203
  s.value.id,
1186
1204
  (o) => s.value = o,
1187
1205
  t
1188
1206
  );
1189
- }), j) {
1190
- const { data: o } = await j.get(
1207
+ }), I) {
1208
+ const { data: o } = await I.get(
1191
1209
  `cdn/stories/${r}`,
1192
1210
  e
1193
1211
  );
1194
1212
  s.value = o.story;
1195
- } else ee("useStoryblok");
1213
+ } else Z("useStoryblok");
1196
1214
  return s;
1197
- }, dt = {
1215
+ }, pt = {
1198
1216
  install(r, e = {}) {
1199
- r.directive("editable", at), r.component("StoryblokComponent", Z), r.component("StoryblokRichText", it), e.enableFallbackComponent && !e.customFallbackComponent && r.component(
1217
+ r.directive("editable", at), r.component("StoryblokComponent", Q), r.component("StoryblokRichText", it), e.enableFallbackComponent && !e.customFallbackComponent && r.component(
1200
1218
  "FallbackComponent",
1201
- he(() => import("./FallbackComponent-C2j8Ky5h.mjs"))
1219
+ ce(() => import("./FallbackComponent-C2j8Ky5h.mjs"))
1202
1220
  );
1203
1221
  const { storyblokApi: t } = rt(e);
1204
- j = t, r.provide("VueSDKOptions", e);
1222
+ I = t, r.provide("VueSDKOptions", e);
1205
1223
  }
1206
1224
  };
1207
1225
  export {
@@ -1209,14 +1227,14 @@ export {
1209
1227
  v as MarkTypes,
1210
1228
  L as RichTextResolver,
1211
1229
  ze as RichTextSchema,
1212
- Z as StoryblokComponent,
1230
+ Q as StoryblokComponent,
1213
1231
  it as StoryblokRichText,
1214
- dt as StoryblokVue,
1215
- W as TextTypes,
1232
+ pt as StoryblokVue,
1233
+ X as TextTypes,
1216
1234
  ct as apiPlugin,
1217
1235
  ht as renderRichText,
1218
1236
  et as richTextResolver,
1219
- pt as useStoryblok,
1237
+ dt as useStoryblok,
1220
1238
  ut as useStoryblokApi,
1221
1239
  tt as useStoryblokBridge,
1222
1240
  nt as useStoryblokRichText