@storyblok/svelte 2.4.6 → 2.4.8

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,5 +1,5 @@
1
1
  let U = !1;
2
- const H = [], tt = (s) => new Promise((t, e) => {
2
+ const H = [], ee = (s) => new Promise((e, t) => {
3
3
  if (typeof window > "u" || (window.storyblokRegisterEvent = (n) => {
4
4
  if (window.location === window.parent.location) {
5
5
  console.warn("You are not in Draft Mode or in the Visual Editor.");
@@ -9,64 +9,64 @@ const H = [], tt = (s) => new Promise((t, e) => {
9
9
  }, document.getElementById("storyblok-javascript-bridge")))
10
10
  return;
11
11
  const r = document.createElement("script");
12
- r.async = !0, r.src = s, r.id = "storyblok-javascript-bridge", r.onerror = (n) => e(n), r.onload = (n) => {
13
- H.forEach((o) => o()), U = !0, t(n);
12
+ r.async = !0, r.src = s, r.id = "storyblok-javascript-bridge", r.onerror = (n) => t(n), r.onload = (n) => {
13
+ H.forEach((o) => o()), U = !0, e(n);
14
14
  }, document.getElementsByTagName("head")[0].appendChild(r);
15
15
  });
16
- var et = Object.defineProperty, st = (s, t, e) => t in s ? et(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, h = (s, t, e) => (st(s, typeof t != "symbol" ? t + "" : t, e), e);
16
+ var te = Object.defineProperty, se = (s, e, t) => e in s ? te(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, h = (s, e, t) => (se(s, typeof e != "symbol" ? e + "" : e, t), t);
17
17
  function q(s) {
18
18
  return !(s !== s || s === 1 / 0 || s === -1 / 0);
19
19
  }
20
- function rt(s, t, e) {
21
- if (!q(t))
22
- throw new TypeError("Expected `limit` to be a finite number");
20
+ function re(s, e, t) {
23
21
  if (!q(e))
22
+ throw new TypeError("Expected `limit` to be a finite number");
23
+ if (!q(t))
24
24
  throw new TypeError("Expected `interval` to be a finite number");
25
25
  const r = [];
26
26
  let n = [], o = 0;
27
- const c = function() {
27
+ const i = function() {
28
28
  o++;
29
- const a = setTimeout(function() {
30
- o--, r.length > 0 && c(), n = n.filter(function(u) {
31
- return u !== a;
29
+ const c = setTimeout(function() {
30
+ o--, r.length > 0 && i(), n = n.filter(function(u) {
31
+ return u !== c;
32
32
  });
33
- }, e);
34
- n.indexOf(a) < 0 && n.push(a);
33
+ }, t);
34
+ n.indexOf(c) < 0 && n.push(c);
35
35
  const l = r.shift();
36
36
  l.resolve(s.apply(l.self, l.args));
37
- }, i = function(...a) {
37
+ }, a = function(...c) {
38
38
  const l = this;
39
39
  return new Promise(function(u, d) {
40
40
  r.push({
41
41
  resolve: u,
42
42
  reject: d,
43
- args: a,
43
+ args: c,
44
44
  self: l
45
- }), o < t && c();
45
+ }), o < e && i();
46
46
  });
47
47
  };
48
- return i.abort = function() {
49
- n.forEach(clearTimeout), n = [], r.forEach(function(a) {
50
- a.reject(function() {
48
+ return a.abort = function() {
49
+ n.forEach(clearTimeout), n = [], r.forEach(function(c) {
50
+ c.reject(function() {
51
51
  Error.call(this, "Throttled function aborted"), this.name = "AbortError";
52
52
  });
53
53
  }), r.length = 0;
54
- }, i;
54
+ }, a;
55
55
  }
56
- const nt = function(s, t) {
57
- const e = {};
56
+ const ne = function(s, e) {
57
+ const t = {};
58
58
  for (const r in s) {
59
59
  const n = s[r];
60
- t.indexOf(r) > -1 && n !== null && (e[r] = n);
60
+ e.indexOf(r) > -1 && n !== null && (t[r] = n);
61
61
  }
62
- return e;
63
- }, ot = (s) => s === "email", it = () => ({
62
+ return t;
63
+ }, oe = (s) => s === "email", ie = () => ({
64
64
  singleTag: "hr"
65
- }), at = () => ({
65
+ }), ae = () => ({
66
66
  tag: "blockquote"
67
- }), ct = () => ({
67
+ }), ce = () => ({
68
68
  tag: "ul"
69
- }), lt = (s) => ({
69
+ }), le = (s) => ({
70
70
  tag: [
71
71
  "pre",
72
72
  {
@@ -74,246 +74,249 @@ const nt = function(s, t) {
74
74
  attrs: s.attrs
75
75
  }
76
76
  ]
77
- }), ht = () => ({
77
+ }), he = () => ({
78
78
  singleTag: "br"
79
- }), ut = (s) => ({
79
+ }), ue = (s) => ({
80
80
  tag: `h${s.attrs.level}`
81
- }), dt = (s) => ({
81
+ }), de = (s) => ({
82
82
  singleTag: [
83
83
  {
84
84
  tag: "img",
85
- attrs: nt(s.attrs, ["src", "alt", "title"])
85
+ attrs: ne(s.attrs, ["src", "alt", "title"])
86
86
  }
87
87
  ]
88
- }), ft = () => ({
88
+ }), fe = () => ({
89
89
  tag: "li"
90
- }), pt = () => ({
90
+ }), pe = () => ({
91
91
  tag: "ol"
92
- }), gt = () => ({
92
+ }), ge = () => ({
93
93
  tag: "p"
94
- }), mt = () => ({
94
+ }), me = () => ({
95
95
  tag: "b"
96
- }), yt = () => ({
96
+ }), ye = () => ({
97
97
  tag: "strike"
98
- }), kt = () => ({
98
+ }), ke = () => ({
99
99
  tag: "u"
100
- }), _t = () => ({
100
+ }), _e = () => ({
101
101
  tag: "strong"
102
- }), bt = () => ({
102
+ }), be = () => ({
103
103
  tag: "code"
104
- }), vt = () => ({
104
+ }), ve = () => ({
105
105
  tag: "i"
106
- }), wt = (s) => {
107
- const t = { ...s.attrs }, { linktype: e = "url" } = s.attrs;
108
- return ot(e) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), {
106
+ }), we = (s) => {
107
+ const e = { ...s.attrs }, { linktype: t = "url" } = s.attrs;
108
+ return oe(t) && (e.href = `mailto:${e.href}`), e.anchor && (e.href = `${e.href}#${e.anchor}`, delete e.anchor), {
109
109
  tag: [
110
110
  {
111
111
  tag: "a",
112
- attrs: t
112
+ attrs: e
113
113
  }
114
114
  ]
115
115
  };
116
- }, $t = (s) => ({
116
+ }, $e = (s) => ({
117
117
  tag: [
118
118
  {
119
119
  tag: "span",
120
120
  attrs: s.attrs
121
121
  }
122
122
  ]
123
- }), Tt = {
123
+ }), Te = {
124
124
  nodes: {
125
- horizontal_rule: it,
126
- blockquote: at,
127
- bullet_list: ct,
128
- code_block: lt,
129
- hard_break: ht,
130
- heading: ut,
131
- image: dt,
132
- list_item: ft,
133
- ordered_list: pt,
134
- paragraph: gt
125
+ horizontal_rule: ie,
126
+ blockquote: ae,
127
+ bullet_list: ce,
128
+ code_block: le,
129
+ hard_break: he,
130
+ heading: ue,
131
+ image: de,
132
+ list_item: fe,
133
+ ordered_list: pe,
134
+ paragraph: ge
135
135
  },
136
136
  marks: {
137
- bold: mt,
138
- strike: yt,
139
- underline: kt,
140
- strong: _t,
141
- code: bt,
142
- italic: vt,
143
- link: wt,
144
- styled: $t
145
- }
146
- }, Rt = function(s) {
147
- const t = {
137
+ bold: me,
138
+ strike: ye,
139
+ underline: ke,
140
+ strong: _e,
141
+ code: be,
142
+ italic: ve,
143
+ link: we,
144
+ styled: $e
145
+ }
146
+ }, Re = function(s) {
147
+ const e = {
148
148
  "&": "&amp;",
149
149
  "<": "&lt;",
150
150
  ">": "&gt;",
151
151
  '"': "&quot;",
152
152
  "'": "&#39;"
153
- }, e = /[&<>"']/g, r = RegExp(e.source);
154
- return s && r.test(s) ? s.replace(e, (n) => t[n]) : s;
153
+ }, t = /[&<>"']/g, r = RegExp(t.source);
154
+ return s && r.test(s) ? s.replace(t, (n) => e[n]) : s;
155
155
  };
156
156
  class T {
157
- constructor(t) {
158
- h(this, "marks"), h(this, "nodes"), t || (t = Tt), this.marks = t.marks || [], this.nodes = t.nodes || [];
157
+ constructor(e) {
158
+ h(this, "marks"), h(this, "nodes"), e || (e = Te), this.marks = e.marks || [], this.nodes = e.nodes || [];
159
159
  }
160
- addNode(t, e) {
161
- this.nodes[t] = e;
160
+ addNode(e, t) {
161
+ this.nodes[e] = t;
162
162
  }
163
- addMark(t, e) {
164
- this.marks[t] = e;
163
+ addMark(e, t) {
164
+ this.marks[e] = t;
165
165
  }
166
- render(t) {
167
- if (t && t.content && Array.isArray(t.content)) {
168
- let e = "";
169
- return t.content.forEach((r) => {
170
- e += this.renderNode(r);
171
- }), e;
166
+ render(e) {
167
+ if (e && e.content && Array.isArray(e.content)) {
168
+ let t = "";
169
+ return e.content.forEach((r) => {
170
+ t += this.renderNode(r);
171
+ }), t;
172
172
  }
173
173
  return console.warn(
174
174
  "The render method must receive an object with a content field, which is an array"
175
175
  ), "";
176
176
  }
177
- renderNode(t) {
178
- const e = [];
179
- t.marks && t.marks.forEach((n) => {
177
+ renderNode(e) {
178
+ const t = [];
179
+ e.marks && e.marks.forEach((n) => {
180
180
  const o = this.getMatchingMark(n);
181
- o && e.push(this.renderOpeningTag(o.tag));
181
+ o && t.push(this.renderOpeningTag(o.tag));
182
182
  });
183
- const r = this.getMatchingNode(t);
184
- return r && r.tag && e.push(this.renderOpeningTag(r.tag)), t.content ? t.content.forEach((n) => {
185
- e.push(this.renderNode(n));
186
- }) : t.text ? e.push(Rt(t.text)) : r && r.singleTag ? e.push(this.renderTag(r.singleTag, " /")) : r && r.html && e.push(r.html), r && r.tag && e.push(this.renderClosingTag(r.tag)), t.marks && t.marks.slice(0).reverse().forEach((n) => {
183
+ const r = this.getMatchingNode(e);
184
+ return r && r.tag && t.push(this.renderOpeningTag(r.tag)), e.content ? e.content.forEach((n) => {
185
+ t.push(this.renderNode(n));
186
+ }) : e.text ? t.push(Re(e.text)) : r && r.singleTag ? t.push(this.renderTag(r.singleTag, " /")) : r && r.html && t.push(r.html), r && r.tag && t.push(this.renderClosingTag(r.tag)), e.marks && e.marks.slice(0).reverse().forEach((n) => {
187
187
  const o = this.getMatchingMark(n);
188
- o && e.push(this.renderClosingTag(o.tag));
189
- }), e.join("");
188
+ o && t.push(this.renderClosingTag(o.tag));
189
+ }), t.join("");
190
190
  }
191
- renderTag(t, e) {
192
- return t.constructor === String ? `<${t}${e}>` : t.map((r) => {
191
+ renderTag(e, t) {
192
+ return e.constructor === String ? `<${e}${t}>` : e.map((r) => {
193
193
  if (r.constructor === String)
194
- return `<${r}${e}>`;
194
+ return `<${r}${t}>`;
195
195
  {
196
196
  let n = `<${r.tag}`;
197
197
  if (r.attrs)
198
198
  for (const o in r.attrs) {
199
- const c = r.attrs[o];
200
- c !== null && (n += ` ${o}="${c}"`);
199
+ const i = r.attrs[o];
200
+ i !== null && (n += ` ${o}="${i}"`);
201
201
  }
202
- return `${n}${e}>`;
202
+ return `${n}${t}>`;
203
203
  }
204
204
  }).join("");
205
205
  }
206
- renderOpeningTag(t) {
207
- return this.renderTag(t, "");
206
+ renderOpeningTag(e) {
207
+ return this.renderTag(e, "");
208
208
  }
209
- renderClosingTag(t) {
210
- return t.constructor === String ? `</${t}>` : t.slice(0).reverse().map((e) => e.constructor === String ? `</${e}>` : `</${e.tag}>`).join("");
209
+ renderClosingTag(e) {
210
+ return e.constructor === String ? `</${e}>` : e.slice(0).reverse().map((t) => t.constructor === String ? `</${t}>` : `</${t.tag}>`).join("");
211
211
  }
212
- getMatchingNode(t) {
213
- const e = this.nodes[t.type];
214
- if (typeof e == "function")
215
- return e(t);
212
+ getMatchingNode(e) {
213
+ const t = this.nodes[e.type];
214
+ if (typeof t == "function")
215
+ return t(e);
216
216
  }
217
- getMatchingMark(t) {
218
- const e = this.marks[t.type];
219
- if (typeof e == "function")
220
- return e(t);
217
+ getMatchingMark(e) {
218
+ const t = this.marks[e.type];
219
+ if (typeof t == "function")
220
+ return t(e);
221
221
  }
222
222
  }
223
223
  class K {
224
224
  constructor() {
225
- h(this, "isCDNUrl", (t = "") => t.indexOf("/cdn/") > -1), h(this, "getOptionsPage", (t, e = 25, r = 1) => ({
226
- ...t,
227
- per_page: e,
225
+ h(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), h(this, "getOptionsPage", (e, t = 25, r = 1) => ({
226
+ ...e,
227
+ per_page: t,
228
228
  page: r
229
- })), h(this, "delay", (t) => new Promise((e) => setTimeout(e, t))), h(this, "arrayFrom", (t = 0, e) => [...Array(t)].map(e)), h(this, "range", (t = 0, e = t) => {
230
- const r = Math.abs(e - t) || 0, n = t < e ? 1 : -1;
231
- return this.arrayFrom(r, (o, c) => c * n + t);
232
- }), h(this, "asyncMap", async (t, e) => Promise.all(t.map(e))), h(this, "flatMap", (t = [], e) => t.map(e).reduce((r, n) => [...r, ...n], []));
229
+ })), h(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), h(this, "arrayFrom", (e = 0, t) => [...Array(e)].map(t)), h(this, "range", (e = 0, t = e) => {
230
+ const r = Math.abs(t - e) || 0, n = e < t ? 1 : -1;
231
+ return this.arrayFrom(r, (o, i) => i * n + e);
232
+ }), h(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), h(this, "flatMap", (e = [], t) => e.map(t).reduce((r, n) => [...r, ...n], []));
233
233
  }
234
- stringify(t, e, r) {
234
+ stringify(e, t, r) {
235
235
  const n = [];
236
- for (const o in t) {
237
- if (!Object.prototype.hasOwnProperty.call(t, o))
236
+ for (const o in e) {
237
+ if (!Object.prototype.hasOwnProperty.call(e, o))
238
238
  continue;
239
- const c = t[o], i = r ? "" : encodeURIComponent(o);
240
- let a;
241
- typeof c == "object" ? a = this.stringify(
242
- c,
243
- e ? e + encodeURIComponent("[" + i + "]") : i,
244
- Array.isArray(c)
245
- ) : a = (e ? e + encodeURIComponent("[" + i + "]") : i) + "=" + encodeURIComponent(c), n.push(a);
239
+ const i = e[o], a = r ? "" : encodeURIComponent(o);
240
+ let c;
241
+ typeof i == "object" ? c = this.stringify(
242
+ i,
243
+ t ? t + encodeURIComponent("[" + a + "]") : a,
244
+ Array.isArray(i)
245
+ ) : c = (t ? t + encodeURIComponent("[" + a + "]") : a) + "=" + encodeURIComponent(i), n.push(c);
246
246
  }
247
247
  return n.join("&");
248
248
  }
249
249
  }
250
- class xt {
251
- constructor(t) {
252
- h(this, "baseURL"), h(this, "timeout"), h(this, "headers"), h(this, "responseInterceptor"), h(this, "fetch"), h(this, "ejectInterceptor"), h(this, "url"), h(this, "parameters"), this.baseURL = t.baseURL, this.headers = t.headers || [], this.timeout = t != null && t.timeout ? t.timeout * 1e3 : 0, this.responseInterceptor = t.responseInterceptor, this.fetch = (...e) => t.fetch ? t.fetch(...e) : fetch(...e), this.ejectInterceptor = !1, this.url = "", this.parameters = {};
250
+ class xe {
251
+ constructor(e) {
252
+ h(this, "baseURL"), h(this, "timeout"), h(this, "headers"), h(this, "responseInterceptor"), h(this, "fetch"), h(this, "ejectInterceptor"), h(this, "url"), h(this, "parameters"), this.baseURL = e.baseURL, this.headers = e.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 = {};
253
253
  }
254
- get(t, e) {
255
- return this.url = t, this.parameters = e, this._methodHandler("get");
254
+ get(e, t) {
255
+ return this.url = e, this.parameters = t, this._methodHandler("get");
256
256
  }
257
- post(t, e) {
258
- return this.url = t, this.parameters = e, this._methodHandler("post");
257
+ post(e, t) {
258
+ return this.url = e, this.parameters = t, this._methodHandler("post");
259
259
  }
260
- put(t, e) {
261
- return this.url = t, this.parameters = e, this._methodHandler("put");
260
+ put(e, t) {
261
+ return this.url = e, this.parameters = t, this._methodHandler("put");
262
262
  }
263
- delete(t, e) {
264
- return this.url = t, this.parameters = e, this._methodHandler("delete");
263
+ delete(e, t) {
264
+ return this.url = e, this.parameters = t, this._methodHandler("delete");
265
265
  }
266
- async _responseHandler(t) {
267
- const e = [], r = {
266
+ async _responseHandler(e) {
267
+ const t = [], r = {
268
268
  data: {},
269
269
  headers: {},
270
270
  status: 0,
271
271
  statusText: ""
272
272
  };
273
- t.status !== 204 && await t.json().then((n) => {
273
+ e.status !== 204 && await e.json().then((n) => {
274
274
  r.data = n;
275
275
  });
276
- for (const n of t.headers.entries())
277
- e[n[0]] = n[1];
278
- return r.headers = { ...e }, r.status = t.status, r.statusText = t.statusText, r;
279
- }
280
- async _methodHandler(t) {
281
- let e = `${this.baseURL}${this.url}`, r = null;
282
- if (t === "get") {
283
- const a = new K();
284
- e = `${this.baseURL}${this.url}?${a.stringify(
276
+ for (const n of e.headers.entries())
277
+ t[n[0]] = n[1];
278
+ return r.headers = { ...t }, r.status = e.status, r.statusText = e.statusText, r;
279
+ }
280
+ async _methodHandler(e) {
281
+ let t = `${this.baseURL}${this.url}`, r = null;
282
+ if (e === "get") {
283
+ const c = new K();
284
+ t = `${this.baseURL}${this.url}?${c.stringify(
285
285
  this.parameters
286
286
  )}`;
287
287
  } else
288
288
  r = JSON.stringify(this.parameters);
289
- const n = new URL(e), o = new AbortController(), { signal: c } = o;
290
- let i;
291
- this.timeout && (i = setTimeout(() => o.abort(), this.timeout));
289
+ const n = new URL(t), o = new AbortController(), { signal: i } = o;
290
+ let a;
291
+ this.timeout && (a = setTimeout(() => o.abort(), this.timeout));
292
292
  try {
293
- const a = await this.fetch(`${n}`, {
294
- method: t,
293
+ const c = await this.fetch(`${n}`, {
294
+ method: e,
295
295
  headers: this.headers,
296
296
  body: r,
297
- signal: c
297
+ signal: i
298
298
  });
299
- this.timeout && clearTimeout(i);
300
- const l = await this._responseHandler(a);
299
+ this.timeout && clearTimeout(a);
300
+ const l = await this._responseHandler(c);
301
301
  return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(l)) : this._statusHandler(l);
302
- } catch (a) {
303
- return a;
302
+ } catch (c) {
303
+ return {
304
+ message: c
305
+ };
304
306
  }
305
307
  }
306
308
  eject() {
307
309
  this.ejectInterceptor = !0;
308
310
  }
309
- _statusHandler(t) {
310
- const e = /20[0-6]/g;
311
+ _statusHandler(e) {
312
+ const t = /20[0-6]/g;
311
313
  return new Promise((r, n) => {
312
- if (e.test(`${t.status}`))
313
- return r(t);
314
+ if (t.test(`${e.status}`))
315
+ return r(e);
314
316
  const o = {
315
- message: new Error(t.statusText || `status: ${t.status}`),
316
- response: t
317
+ message: new Error(e.statusText),
318
+ status: e.status,
319
+ response: e.data.error || e.data.slug
317
320
  };
318
321
  n(o);
319
322
  });
@@ -321,80 +324,80 @@ class xt {
321
324
  }
322
325
  let b = {};
323
326
  const g = {};
324
- class jt {
325
- constructor(t, e) {
326
- if (h(this, "client"), h(this, "maxRetries"), h(this, "throttle"), h(this, "accessToken"), h(this, "cache"), h(this, "helpers"), h(this, "relations"), h(this, "links"), h(this, "richTextResolver"), h(this, "resolveNestedRelations"), !e) {
327
- const o = t.region ? `-${t.region}` : "", c = t.https === !1 ? "http" : "https";
328
- t.oauthToken ? e = `${c}://api${o}.storyblok.com/v1` : e = `${c}://api${o}.storyblok.com/v2`;
327
+ class Pe {
328
+ constructor(e, t) {
329
+ if (h(this, "client"), h(this, "maxRetries"), h(this, "throttle"), h(this, "accessToken"), h(this, "cache"), h(this, "helpers"), h(this, "relations"), h(this, "links"), h(this, "richTextResolver"), h(this, "resolveNestedRelations"), !t) {
330
+ const o = e.region ? `-${e.region}` : "", i = e.https === !1 ? "http" : "https";
331
+ e.oauthToken ? t = `${i}://api${o}.storyblok.com/v1` : t = `${i}://api${o}.storyblok.com/v2`;
329
332
  }
330
333
  const r = new Headers();
331
- r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), r.forEach((o, c) => {
332
- t.headers && t.headers[c] && r.set(c, t.headers[c]);
334
+ r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), r.forEach((o, i) => {
335
+ e.headers && e.headers[i] && r.set(i, e.headers[i]);
333
336
  });
334
337
  let n = 5;
335
- t.oauthToken && (r.set("Authorization", t.oauthToken), n = 3), t.rateLimit && (n = t.rateLimit), t.richTextSchema ? this.richTextResolver = new T(t.richTextSchema) : this.richTextResolver = new T(), t.componentResolver && this.setComponentResolver(t.componentResolver), this.maxRetries = t.maxRetries, this.throttle = rt(this.throttledRequest, n, 1e3), this.accessToken = t.accessToken || "", this.relations = {}, this.links = {}, this.cache = t.cache || { clear: "manual" }, this.helpers = new K(), this.resolveNestedRelations = !1, this.client = new xt({
336
- baseURL: e,
337
- timeout: t.timeout || 0,
338
+ e.oauthToken && (r.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new T(e.richTextSchema) : this.richTextResolver = new T(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries, this.throttle = re(this.throttledRequest, n, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new K(), this.resolveNestedRelations = !1, this.client = new xe({
339
+ baseURL: t,
340
+ timeout: e.timeout || 0,
338
341
  headers: r,
339
- responseInterceptor: t.responseInterceptor,
340
- fetch: t.fetch
342
+ responseInterceptor: e.responseInterceptor,
343
+ fetch: e.fetch
341
344
  });
342
345
  }
343
- setComponentResolver(t) {
344
- this.richTextResolver.addNode("blok", (e) => {
346
+ setComponentResolver(e) {
347
+ this.richTextResolver.addNode("blok", (t) => {
345
348
  let r = "";
346
- return e.attrs.body.forEach((n) => {
347
- r += t(n.component, n);
349
+ return t.attrs.body.forEach((n) => {
350
+ r += e(n.component, n);
348
351
  }), {
349
352
  html: r
350
353
  };
351
354
  });
352
355
  }
353
- parseParams(t) {
354
- return t.version || (t.version = "published"), t.token || (t.token = this.getToken()), t.cv || (t.cv = g[t.token]), Array.isArray(t.resolve_relations) && (t.resolve_relations = t.resolve_relations.join(",")), t;
356
+ parseParams(e) {
357
+ return e.version || (e.version = "published"), e.token || (e.token = this.getToken()), e.cv || (e.cv = g[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), e;
355
358
  }
356
- factoryParamOptions(t, e) {
357
- return this.helpers.isCDNUrl(t) ? this.parseParams(e) : e;
359
+ factoryParamOptions(e, t) {
360
+ return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
358
361
  }
359
- makeRequest(t, e, r, n) {
362
+ makeRequest(e, t, r, n) {
360
363
  const o = this.factoryParamOptions(
361
- t,
362
- this.helpers.getOptionsPage(e, r, n)
364
+ e,
365
+ this.helpers.getOptionsPage(t, r, n)
363
366
  );
364
- return this.cacheResponse(t, o);
367
+ return this.cacheResponse(e, o);
365
368
  }
366
- get(t, e) {
367
- e || (e = {});
368
- const r = `/${t}`, n = this.factoryParamOptions(r, e);
369
+ get(e, t) {
370
+ t || (t = {});
371
+ const r = `/${e}`, n = this.factoryParamOptions(r, t);
369
372
  return this.cacheResponse(r, n);
370
373
  }
371
- async getAll(t, e, r) {
372
- const n = (e == null ? void 0 : e.per_page) || 25, o = `/${t}`, c = o.split("/"), i = r || c[c.length - 1], a = 1, l = await this.makeRequest(o, e, n, a), u = l.total ? Math.ceil(l.total / n) : 1, d = await this.helpers.asyncMap(
373
- this.helpers.range(a, u),
374
- (p) => this.makeRequest(o, e, n, p + 1)
374
+ async getAll(e, t, r) {
375
+ const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`, i = o.split("/"), a = r || i[i.length - 1], c = 1, l = await this.makeRequest(o, t, n, c), u = l.total ? Math.ceil(l.total / n) : 1, d = await this.helpers.asyncMap(
376
+ this.helpers.range(c, u),
377
+ (p) => this.makeRequest(o, t, n, p + 1)
375
378
  );
376
379
  return this.helpers.flatMap(
377
380
  [l, ...d],
378
- (p) => Object.values(p.data[i])
381
+ (p) => Object.values(p.data[a])
379
382
  );
380
383
  }
381
- post(t, e) {
382
- const r = `/${t}`;
383
- return Promise.resolve(this.throttle("post", r, e));
384
+ post(e, t) {
385
+ const r = `/${e}`;
386
+ return Promise.resolve(this.throttle("post", r, t));
384
387
  }
385
- put(t, e) {
386
- const r = `/${t}`;
387
- return Promise.resolve(this.throttle("put", r, e));
388
+ put(e, t) {
389
+ const r = `/${e}`;
390
+ return Promise.resolve(this.throttle("put", r, t));
388
391
  }
389
- delete(t, e) {
390
- const r = `/${t}`;
391
- return Promise.resolve(this.throttle("delete", r, e));
392
+ delete(e, t) {
393
+ const r = `/${e}`;
394
+ return Promise.resolve(this.throttle("delete", r, t));
392
395
  }
393
- getStories(t) {
394
- return this.get("cdn/stories", t);
396
+ getStories(e) {
397
+ return this.get("cdn/stories", e);
395
398
  }
396
- getStory(t, e) {
397
- return this.get(`cdn/stories/${t}`, e);
399
+ getStory(e, t) {
400
+ return this.get(`cdn/stories/${e}`, t);
398
401
  }
399
402
  getToken() {
400
403
  return this.accessToken;
@@ -402,26 +405,26 @@ class jt {
402
405
  ejectInterceptor() {
403
406
  this.client.eject();
404
407
  }
405
- _cleanCopy(t) {
406
- return JSON.parse(JSON.stringify(t));
408
+ _cleanCopy(e) {
409
+ return JSON.parse(JSON.stringify(e));
407
410
  }
408
- _insertLinks(t, e) {
409
- const r = t[e];
411
+ _insertLinks(e, t) {
412
+ const r = e[t];
410
413
  r && r.fieldtype == "multilink" && r.linktype == "story" && typeof r.id == "string" && this.links[r.id] ? r.story = this._cleanCopy(this.links[r.id]) : r && r.linktype === "story" && typeof r.uuid == "string" && this.links[r.uuid] && (r.story = this._cleanCopy(this.links[r.uuid]));
411
414
  }
412
- _insertRelations(t, e, r) {
413
- if (r.indexOf(`${t.component}.${e}`) > -1) {
414
- if (typeof t[e] == "string")
415
- this.relations[t[e]] && (t[e] = this._cleanCopy(this.relations[t[e]]));
416
- else if (t[e] && t[e].constructor === Array) {
415
+ _insertRelations(e, t, r) {
416
+ if (r.indexOf(`${e.component}.${t}`) > -1) {
417
+ if (typeof e[t] == "string")
418
+ this.relations[e[t]] && (e[t] = this._cleanCopy(this.relations[e[t]]));
419
+ else if (e[t] && e[t].constructor === Array) {
417
420
  const n = [];
418
- t[e].forEach((o) => {
421
+ e[t].forEach((o) => {
419
422
  this.relations[o] && n.push(this._cleanCopy(this.relations[o]));
420
- }), t[e] = n;
423
+ }), e[t] = n;
421
424
  }
422
425
  }
423
426
  }
424
- iterateTree(t, e) {
427
+ iterateTree(e, t) {
425
428
  const r = (n) => {
426
429
  if (n != null) {
427
430
  if (n.constructor === Array)
@@ -434,97 +437,99 @@ class jt {
434
437
  (n.component && n._uid || n.type === "link") && (this._insertRelations(
435
438
  n,
436
439
  o,
437
- e
440
+ t
438
441
  ), this._insertLinks(n, o)), r(n[o]);
439
442
  }
440
443
  }
441
444
  };
442
- r(t.content);
445
+ r(e.content);
443
446
  }
444
- async resolveLinks(t, e) {
447
+ async resolveLinks(e, t) {
445
448
  let r = [];
446
- if (t.link_uuids) {
447
- const n = t.link_uuids.length, o = [], c = 50;
448
- for (let i = 0; i < n; i += c) {
449
- const a = Math.min(n, i + c);
450
- o.push(t.link_uuids.slice(i, a));
449
+ if (e.link_uuids) {
450
+ const n = e.link_uuids.length, o = [], i = 50;
451
+ for (let a = 0; a < n; a += i) {
452
+ const c = Math.min(n, a + i);
453
+ o.push(e.link_uuids.slice(a, c));
451
454
  }
452
- for (let i = 0; i < o.length; i++)
455
+ for (let a = 0; a < o.length; a++)
453
456
  (await this.getStories({
454
- per_page: c,
455
- language: e.language,
456
- version: e.version,
457
- by_uuids: o[i].join(",")
457
+ per_page: i,
458
+ language: t.language,
459
+ version: t.version,
460
+ by_uuids: o[a].join(",")
458
461
  })).data.stories.forEach(
459
- (a) => {
460
- r.push(a);
462
+ (c) => {
463
+ r.push(c);
461
464
  }
462
465
  );
463
466
  } else
464
- r = t.links;
467
+ r = e.links;
465
468
  r.forEach((n) => {
466
469
  this.links[n.uuid] = { ...n, _stopResolving: !0 };
467
470
  });
468
471
  }
469
- async resolveRelations(t, e) {
472
+ async resolveRelations(e, t) {
470
473
  let r = [];
471
- if (t.rel_uuids) {
472
- const n = t.rel_uuids.length, o = [], c = 50;
473
- for (let i = 0; i < n; i += c) {
474
- const a = Math.min(n, i + c);
475
- o.push(t.rel_uuids.slice(i, a));
474
+ if (e.rel_uuids) {
475
+ const n = e.rel_uuids.length, o = [], i = 50;
476
+ for (let a = 0; a < n; a += i) {
477
+ const c = Math.min(n, a + i);
478
+ o.push(e.rel_uuids.slice(a, c));
476
479
  }
477
- for (let i = 0; i < o.length; i++)
480
+ for (let a = 0; a < o.length; a++)
478
481
  (await this.getStories({
479
- per_page: c,
480
- language: e.language,
481
- version: e.version,
482
- by_uuids: o[i].join(",")
483
- })).data.stories.forEach((a) => {
484
- r.push(a);
482
+ per_page: i,
483
+ language: t.language,
484
+ version: t.version,
485
+ by_uuids: o[a].join(",")
486
+ })).data.stories.forEach((c) => {
487
+ r.push(c);
485
488
  });
486
489
  } else
487
- r = t.rels;
490
+ r = e.rels;
488
491
  r && r.length > 0 && r.forEach((n) => {
489
492
  this.relations[n.uuid] = { ...n, _stopResolving: !0 };
490
493
  });
491
494
  }
492
- async resolveStories(t, e) {
495
+ async resolveStories(e, t) {
493
496
  var r, n;
494
497
  let o = [];
495
- if (typeof e.resolve_relations < "u" && e.resolve_relations.length > 0 && (typeof e.resolve_relations == "string" && (o = e.resolve_relations.split(",")), await this.resolveRelations(t, e)), e.resolve_links && ["1", "story", "url"].indexOf(e.resolve_links) > -1 && ((r = t.links) != null && r.length || (n = t.link_uuids) != null && n.length) && await this.resolveLinks(t, e), this.resolveNestedRelations)
496
- for (const c in this.relations)
497
- this.iterateTree(this.relations[c], o);
498
- t.story ? this.iterateTree(t.story, o) : t.stories.forEach((c) => {
499
- this.iterateTree(c, o);
498
+ if (typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (o = t.resolve_relations.split(",")), await this.resolveRelations(e, t)), t.resolve_links && ["1", "story", "url"].indexOf(t.resolve_links) > -1 && ((r = e.links) != null && r.length || (n = e.link_uuids) != null && n.length) && await this.resolveLinks(e, t), this.resolveNestedRelations)
499
+ for (const i in this.relations)
500
+ this.iterateTree(this.relations[i], o);
501
+ e.story ? this.iterateTree(e.story, o) : e.stories.forEach((i) => {
502
+ this.iterateTree(i, o);
500
503
  });
501
504
  }
502
- cacheResponse(t, e, r) {
503
- return new Promise((n, o) => {
504
- const c = this.helpers.stringify({ url: t, params: e }), i = this.cacheProvider();
505
- if (this.cache.clear === "auto" && e.version === "draft" && this.flushCache(), e.version === "published" && t != "/cdn/spaces/me") {
506
- const a = i.get(c);
507
- if (a)
508
- return n(a);
509
- }
505
+ async cacheResponse(e, t, r) {
506
+ const n = this.helpers.stringify({ url: e, params: t }), o = this.cacheProvider();
507
+ if (this.cache.clear === "auto" && t.version === "draft" && await this.flushCache(), t.version === "published" && e != "/cdn/spaces/me") {
508
+ const i = await o.get(n);
509
+ if (i)
510
+ return Promise.resolve(i);
511
+ }
512
+ return new Promise((i, a) => {
510
513
  try {
511
514
  (async () => {
512
- var a;
513
- const l = await this.throttle("get", t, e);
514
- let u = { data: l.data, headers: l.headers };
515
- if ((a = l.headers) != null && a["per-page"] && (u = Object.assign({}, u, {
516
- perPage: l.headers["per-page"] ? parseInt(l.headers["per-page"]) : 0,
517
- total: l.headers["per-page"] ? parseInt(l.headers.total) : 0
518
- })), l.status != 200)
519
- return o(l);
520
- (u.data.story || u.data.stories) && await this.resolveStories(u.data, e), e.version === "published" && t != "/cdn/spaces/me" && i.set(c, u), u.data.cv && e.token && (e.version == "draft" && g[e.token] != u.data.cv && this.flushCache(), g[e.token] = u.data.cv), n(u);
515
+ var c;
516
+ try {
517
+ const l = await this.throttle("get", e, t);
518
+ let u = { data: l.data, headers: l.headers };
519
+ return (c = l.headers) != null && c["per-page"] && (u = Object.assign({}, u, {
520
+ perPage: l.headers["per-page"] ? parseInt(l.headers["per-page"]) : 0,
521
+ total: l.headers["per-page"] ? parseInt(l.headers.total) : 0
522
+ })), l.status != 200 ? a(l) : ((u.data.story || u.data.stories) && await this.resolveStories(u.data, t), t.version === "published" && e != "/cdn/spaces/me" && await o.set(n, u), u.data.cv && t.token && (t.version == "draft" && g[t.token] != u.data.cv && await this.flushCache(), g[t.token] = u.data.cv), i(u));
523
+ } catch (l) {
524
+ return a(l);
525
+ }
521
526
  })();
522
527
  } catch {
523
528
  }
524
529
  });
525
530
  }
526
- throttledRequest(t, e, r) {
527
- return this.client[t](e, r);
531
+ throttledRequest(e, t, r) {
532
+ return this.client[e](t, r);
528
533
  }
529
534
  cacheVersions() {
530
535
  return g;
@@ -532,122 +537,126 @@ class jt {
532
537
  cacheVersion() {
533
538
  return g[this.accessToken];
534
539
  }
535
- setCacheVersion(t) {
536
- this.accessToken && (g[this.accessToken] = t);
540
+ setCacheVersion(e) {
541
+ this.accessToken && (g[this.accessToken] = e);
537
542
  }
538
543
  cacheProvider() {
539
544
  switch (this.cache.type) {
540
545
  case "memory":
541
546
  return {
542
- get(t) {
543
- return b[t];
547
+ get(e) {
548
+ return Promise.resolve(b[e]);
544
549
  },
545
550
  getAll() {
546
- return b;
551
+ return Promise.resolve(b);
547
552
  },
548
- set(t, e) {
549
- b[t] = e;
553
+ set(e, t) {
554
+ return b[e] = t, Promise.resolve(void 0);
550
555
  },
551
556
  flush() {
552
- b = {};
557
+ return b = {}, Promise.resolve(void 0);
553
558
  }
554
559
  };
560
+ case "custom":
561
+ if (this.cache.custom)
562
+ return this.cache.custom;
555
563
  default:
556
564
  return {
557
565
  get() {
566
+ return Promise.resolve(void 0);
558
567
  },
559
568
  getAll() {
569
+ return Promise.resolve(void 0);
560
570
  },
561
571
  set() {
572
+ return Promise.resolve(void 0);
562
573
  },
563
574
  flush() {
575
+ return Promise.resolve(void 0);
564
576
  }
565
577
  };
566
578
  }
567
579
  }
568
- flushCache() {
569
- return this.cacheProvider().flush(), this;
580
+ async flushCache() {
581
+ return await this.cacheProvider().flush(), this;
570
582
  }
571
583
  }
572
- const Wt = (s = {}) => {
573
- const { apiOptions: t } = s;
574
- if (!t.accessToken) {
584
+ const We = (s = {}) => {
585
+ const { apiOptions: e } = s;
586
+ if (!e.accessToken) {
575
587
  console.error(
576
588
  "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
577
589
  );
578
590
  return;
579
591
  }
580
- return { storyblokApi: new jt(t) };
581
- }, Et = (s) => {
592
+ return { storyblokApi: new Pe(e) };
593
+ }, je = (s) => {
582
594
  if (typeof s != "object" || typeof s._editable > "u")
583
595
  return {};
584
- const t = JSON.parse(
596
+ const e = JSON.parse(
585
597
  s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
586
598
  );
587
599
  return {
588
- "data-blok-c": JSON.stringify(t),
589
- "data-blok-uid": t.id + "-" + t.uid
600
+ "data-blok-c": JSON.stringify(e),
601
+ "data-blok-uid": e.id + "-" + e.uid
590
602
  };
591
603
  };
592
604
  let x;
593
- const St = "https://app.storyblok.com/f/storyblok-v2-latest.js", Xt = (s, t, e = {}) => {
594
- if (!(typeof window > "u")) {
595
- if (typeof window.storyblokRegisterEvent > "u") {
596
- console.error(
597
- "Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js"
598
- );
599
- return;
600
- }
605
+ const Ee = "https://app.storyblok.com/f/storyblok-v2-latest.js", Xe = (s, e, t = {}) => {
606
+ if (!(typeof window > "u") && typeof window.storyblokRegisterEvent < "u") {
601
607
  if (!s) {
602
608
  console.warn("Story ID is not defined. Please provide a valid ID.");
603
609
  return;
604
610
  }
605
611
  window.storyblokRegisterEvent(() => {
606
- new window.StoryblokBridge(e).on(["input", "published", "change"], (r) => {
607
- r.action === "input" && r.story.id === s ? t(r.story) : (r.action === "change" || r.action === "published") && r.storyId === s && window.location.reload();
612
+ new window.StoryblokBridge(t).on(["input", "published", "change"], (r) => {
613
+ r.action === "input" && r.story.id === s ? e(r.story) : (r.action === "change" || r.action === "published") && r.storyId === s && window.location.reload();
608
614
  });
609
615
  });
610
616
  }
611
- }, Pt = (s = {}) => {
617
+ }, Se = (s = {}) => {
618
+ var e, t;
612
619
  const {
613
- bridge: t,
614
- accessToken: e,
615
- use: r = [],
616
- apiOptions: n = {},
617
- richText: o = {}
620
+ bridge: r,
621
+ accessToken: n,
622
+ use: o = [],
623
+ apiOptions: i = {},
624
+ richText: a = {}
618
625
  } = s;
619
- n.accessToken = n.accessToken || e;
620
- const c = { bridge: t, apiOptions: n };
621
- let i = {};
622
- return r.forEach((a) => {
623
- i = { ...i, ...a(c) };
624
- }), t !== !1 && tt(St), x = new T(o.schema), o.resolver && G(x, o.resolver), i;
625
- }, G = (s, t) => {
626
- s.addNode("blok", (e) => {
626
+ i.accessToken = i.accessToken || n;
627
+ const c = { bridge: r, apiOptions: i };
628
+ let l = {};
629
+ o.forEach((d) => {
630
+ l = { ...l, ...d(c) };
631
+ });
632
+ const u = !(typeof window > "u") && ((t = (e = window.location) == null ? void 0 : e.search) == null ? void 0 : t.includes("_storyblok_tk"));
633
+ return r !== !1 && u && ee(Ee), x = new T(a.schema), a.resolver && G(x, a.resolver), l;
634
+ }, G = (s, e) => {
635
+ s.addNode("blok", (t) => {
627
636
  let r = "";
628
- return e.attrs.body.forEach((n) => {
629
- r += t(n.component, n);
637
+ return t.attrs.body.forEach((n) => {
638
+ r += e(n.component, n);
630
639
  }), {
631
640
  html: r
632
641
  };
633
642
  });
634
- }, Zt = (s, t, e) => {
635
- let r = e || x;
643
+ }, Ze = (s, e, t) => {
644
+ let r = t || x;
636
645
  if (!r) {
637
646
  console.error(
638
647
  "Please initialize the Storyblok SDK before calling the renderRichText function"
639
648
  );
640
649
  return;
641
650
  }
642
- return s === "" ? "" : s ? (t && (r = new T(t.schema), t.resolver && G(r, t.resolver)), r.render(s)) : (console.warn(`${s} is not a valid Richtext object. This might be because the value of the richtext field is empty.
651
+ return s === "" ? "" : s ? (e && (r = new T(e.schema), e.resolver && G(r, e.resolver)), r.render(s)) : (console.warn(`${s} is not a valid Richtext object. This might be because the value of the richtext field is empty.
643
652
 
644
653
  For more info about the richtext object check https://github.com/storyblok/storyblok-js#rendering-rich-text`), "");
645
654
  };
646
- function j() {
655
+ function P() {
647
656
  }
648
- function E(s, t) {
649
- for (const e in t)
650
- s[e] = t[e];
657
+ function j(s, e) {
658
+ for (const t in e)
659
+ s[t] = e[t];
651
660
  return s;
652
661
  }
653
662
  function Q(s) {
@@ -662,53 +671,53 @@ function _(s) {
662
671
  function W(s) {
663
672
  return typeof s == "function";
664
673
  }
665
- function Ot(s, t) {
666
- return s != s ? t == t : s !== t || s && typeof s == "object" || typeof s == "function";
674
+ function Oe(s, e) {
675
+ return s != s ? e == e : s !== e || s && typeof s == "object" || typeof s == "function";
667
676
  }
668
- function Ct(s) {
677
+ function Ce(s) {
669
678
  return Object.keys(s).length === 0;
670
679
  }
671
- function It(s) {
672
- const t = {};
673
- for (const e in s)
674
- e[0] !== "$" && (t[e] = s[e]);
675
- return t;
676
- }
677
- function B(s, t) {
680
+ function Ie(s) {
678
681
  const e = {};
679
- t = new Set(t);
680
- for (const r in s)
681
- !t.has(r) && r[0] !== "$" && (e[r] = s[r]);
682
+ for (const t in s)
683
+ t[0] !== "$" && (e[t] = s[t]);
682
684
  return e;
683
685
  }
684
- function At(s, t, e) {
685
- s.insertBefore(t, e || null);
686
+ function B(s, e) {
687
+ const t = {};
688
+ e = new Set(e);
689
+ for (const r in s)
690
+ !e.has(r) && r[0] !== "$" && (t[r] = s[r]);
691
+ return t;
692
+ }
693
+ function Ae(s, e, t) {
694
+ s.insertBefore(e, t || null);
686
695
  }
687
696
  function X(s) {
688
697
  s.parentNode && s.parentNode.removeChild(s);
689
698
  }
690
- function Nt(s) {
699
+ function Ne(s) {
691
700
  return document.createTextNode(s);
692
701
  }
693
- function Mt() {
694
- return Nt("");
702
+ function Me() {
703
+ return Ne("");
695
704
  }
696
- function Lt(s) {
705
+ function Le(s) {
697
706
  return Array.from(s.childNodes);
698
707
  }
699
- function J(s, t) {
700
- return new s(t);
708
+ function J(s, e) {
709
+ return new s(e);
701
710
  }
702
711
  let N;
703
712
  function k(s) {
704
713
  N = s;
705
714
  }
706
- const y = [], F = [], v = [], V = [], Ut = Promise.resolve();
707
- let S = !1;
708
- function Ht() {
709
- S || (S = !0, Ut.then(Z));
715
+ const y = [], F = [], v = [], V = [], Ue = Promise.resolve();
716
+ let E = !1;
717
+ function He() {
718
+ E || (E = !0, Ue.then(Z));
710
719
  }
711
- function P(s) {
720
+ function S(s) {
712
721
  v.push(s);
713
722
  }
714
723
  const R = /* @__PURE__ */ new Set();
@@ -720,34 +729,34 @@ function Z() {
720
729
  do {
721
730
  try {
722
731
  for (; m < y.length; ) {
723
- const t = y[m];
724
- m++, k(t), qt(t.$$);
732
+ const e = y[m];
733
+ m++, k(e), qe(e.$$);
725
734
  }
726
- } catch (t) {
727
- throw y.length = 0, m = 0, t;
735
+ } catch (e) {
736
+ throw y.length = 0, m = 0, e;
728
737
  }
729
738
  for (k(null), y.length = 0, m = 0; F.length; )
730
739
  F.pop()();
731
- for (let t = 0; t < v.length; t += 1) {
732
- const e = v[t];
733
- R.has(e) || (R.add(e), e());
740
+ for (let e = 0; e < v.length; e += 1) {
741
+ const t = v[e];
742
+ R.has(t) || (R.add(t), t());
734
743
  }
735
744
  v.length = 0;
736
745
  } while (y.length);
737
746
  for (; V.length; )
738
747
  V.pop()();
739
- S = !1, R.clear(), k(s);
748
+ E = !1, R.clear(), k(s);
740
749
  }
741
- function qt(s) {
750
+ function qe(s) {
742
751
  if (s.fragment !== null) {
743
752
  s.update(), _(s.before_update);
744
- const t = s.dirty;
745
- s.dirty = [-1], s.fragment && s.fragment.p(s.ctx, t), s.after_update.forEach(P);
753
+ const e = s.dirty;
754
+ s.dirty = [-1], s.fragment && s.fragment.p(s.ctx, e), s.after_update.forEach(S);
746
755
  }
747
756
  }
748
757
  const w = /* @__PURE__ */ new Set();
749
758
  let f;
750
- function Dt() {
759
+ function De() {
751
760
  f = {
752
761
  r: 0,
753
762
  c: [],
@@ -755,70 +764,70 @@ function Dt() {
755
764
  // parent group
756
765
  };
757
766
  }
758
- function Bt() {
767
+ function Be() {
759
768
  f.r || _(f.c), f = f.p;
760
769
  }
761
- function O(s, t) {
762
- s && s.i && (w.delete(s), s.i(t));
770
+ function O(s, e) {
771
+ s && s.i && (w.delete(s), s.i(e));
763
772
  }
764
- function Y(s, t, e, r) {
773
+ function Y(s, e, t, r) {
765
774
  if (s && s.o) {
766
775
  if (w.has(s))
767
776
  return;
768
777
  w.add(s), f.c.push(() => {
769
- w.delete(s), r && (e && s.d(1), r());
770
- }), s.o(t);
778
+ w.delete(s), r && (t && s.d(1), r());
779
+ }), s.o(e);
771
780
  } else
772
781
  r && r();
773
782
  }
774
- function Jt(s, t) {
775
- const e = {}, r = {}, n = { $$scope: 1 };
783
+ function Je(s, e) {
784
+ const t = {}, r = {}, n = { $$scope: 1 };
776
785
  let o = s.length;
777
786
  for (; o--; ) {
778
- const c = s[o], i = t[o];
779
- if (i) {
780
- for (const a in c)
781
- a in i || (r[a] = 1);
782
- for (const a in i)
783
- n[a] || (e[a] = i[a], n[a] = 1);
784
- s[o] = i;
787
+ const i = s[o], a = e[o];
788
+ if (a) {
789
+ for (const c in i)
790
+ c in a || (r[c] = 1);
791
+ for (const c in a)
792
+ n[c] || (t[c] = a[c], n[c] = 1);
793
+ s[o] = a;
785
794
  } else
786
- for (const a in c)
787
- n[a] = 1;
795
+ for (const c in i)
796
+ n[c] = 1;
788
797
  }
789
- for (const c in r)
790
- c in e || (e[c] = void 0);
791
- return e;
798
+ for (const i in r)
799
+ i in t || (t[i] = void 0);
800
+ return t;
792
801
  }
793
- function Ft(s) {
802
+ function Fe(s) {
794
803
  return typeof s == "object" && s !== null ? s : {};
795
804
  }
796
805
  function z(s) {
797
806
  s && s.c();
798
807
  }
799
- function C(s, t, e, r) {
808
+ function C(s, e, t, r) {
800
809
  const { fragment: n, after_update: o } = s.$$;
801
- n && n.m(t, e), r || P(() => {
802
- const c = s.$$.on_mount.map(Q).filter(W);
803
- s.$$.on_destroy ? s.$$.on_destroy.push(...c) : _(c), s.$$.on_mount = [];
804
- }), o.forEach(P);
810
+ n && n.m(e, t), r || S(() => {
811
+ const i = s.$$.on_mount.map(Q).filter(W);
812
+ s.$$.on_destroy ? s.$$.on_destroy.push(...i) : _(i), s.$$.on_mount = [];
813
+ }), o.forEach(S);
805
814
  }
806
- function I(s, t) {
807
- const e = s.$$;
808
- e.fragment !== null && (_(e.on_destroy), e.fragment && e.fragment.d(t), e.on_destroy = e.fragment = null, e.ctx = []);
815
+ function I(s, e) {
816
+ const t = s.$$;
817
+ t.fragment !== null && (_(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
809
818
  }
810
- function Vt(s, t) {
811
- s.$$.dirty[0] === -1 && (y.push(s), Ht(), s.$$.dirty.fill(0)), s.$$.dirty[t / 31 | 0] |= 1 << t % 31;
819
+ function Ve(s, e) {
820
+ s.$$.dirty[0] === -1 && (y.push(s), He(), s.$$.dirty.fill(0)), s.$$.dirty[e / 31 | 0] |= 1 << e % 31;
812
821
  }
813
- function Yt(s, t, e, r, n, o, c, i = [-1]) {
814
- const a = N;
822
+ function Ye(s, e, t, r, n, o, i, a = [-1]) {
823
+ const c = N;
815
824
  k(s);
816
825
  const l = s.$$ = {
817
826
  fragment: null,
818
827
  ctx: [],
819
828
  // state
820
829
  props: o,
821
- update: j,
830
+ update: P,
822
831
  not_equal: n,
823
832
  bound: D(),
824
833
  // lifecycle
@@ -827,47 +836,47 @@ function Yt(s, t, e, r, n, o, c, i = [-1]) {
827
836
  on_disconnect: [],
828
837
  before_update: [],
829
838
  after_update: [],
830
- context: new Map(t.context || (a ? a.$$.context : [])),
839
+ context: new Map(e.context || (c ? c.$$.context : [])),
831
840
  // everything else
832
841
  callbacks: D(),
833
- dirty: i,
842
+ dirty: a,
834
843
  skip_bound: !1,
835
- root: t.target || a.$$.root
844
+ root: e.target || c.$$.root
836
845
  };
837
- c && c(l.root);
846
+ i && i(l.root);
838
847
  let u = !1;
839
- if (l.ctx = e ? e(s, t.props || {}, (d, p, ...M) => {
848
+ if (l.ctx = t ? t(s, e.props || {}, (d, p, ...M) => {
840
849
  const L = M.length ? M[0] : p;
841
- return l.ctx && n(l.ctx[d], l.ctx[d] = L) && (!l.skip_bound && l.bound[d] && l.bound[d](L), u && Vt(s, d)), p;
842
- }) : [], l.update(), u = !0, _(l.before_update), l.fragment = r ? r(l.ctx) : !1, t.target) {
843
- if (t.hydrate) {
844
- const d = Lt(t.target);
850
+ return l.ctx && n(l.ctx[d], l.ctx[d] = L) && (!l.skip_bound && l.bound[d] && l.bound[d](L), u && Ve(s, d)), p;
851
+ }) : [], l.update(), u = !0, _(l.before_update), l.fragment = r ? r(l.ctx) : !1, e.target) {
852
+ if (e.hydrate) {
853
+ const d = Le(e.target);
845
854
  l.fragment && l.fragment.l(d), d.forEach(X);
846
855
  } else
847
856
  l.fragment && l.fragment.c();
848
- t.intro && O(s.$$.fragment), C(s, t.target, t.anchor, t.customElement), Z();
857
+ e.intro && O(s.$$.fragment), C(s, e.target, e.anchor, e.customElement), Z();
849
858
  }
850
- k(a);
859
+ k(c);
851
860
  }
852
- class zt {
861
+ class ze {
853
862
  $destroy() {
854
- I(this, 1), this.$destroy = j;
855
- }
856
- $on(t, e) {
857
- if (!W(e))
858
- return j;
859
- const r = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
860
- return r.push(e), () => {
861
- const n = r.indexOf(e);
863
+ I(this, 1), this.$destroy = P;
864
+ }
865
+ $on(e, t) {
866
+ if (!W(t))
867
+ return P;
868
+ const r = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
869
+ return r.push(t), () => {
870
+ const n = r.indexOf(t);
862
871
  n !== -1 && r.splice(n, 1);
863
872
  };
864
873
  }
865
- $set(t) {
866
- this.$$set && !Ct(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
874
+ $set(e) {
875
+ this.$$set && !Ce(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
867
876
  }
868
877
  }
869
- function Kt(s) {
870
- let t, e, r;
878
+ function Ke(s) {
879
+ let e, t, r;
871
880
  const n = [
872
881
  { blok: (
873
882
  /*blok*/
@@ -880,108 +889,108 @@ function Kt(s) {
880
889
  /*component*/
881
890
  s[1]
882
891
  );
883
- function c(i) {
884
- let a = {};
892
+ function i(a) {
893
+ let c = {};
885
894
  for (let l = 0; l < n.length; l += 1)
886
- a = E(a, n[l]);
887
- return { props: a };
895
+ c = j(c, n[l]);
896
+ return { props: c };
888
897
  }
889
- return o && (t = J(o, c())), {
898
+ return o && (e = J(o, i())), {
890
899
  c() {
891
- t && z(t.$$.fragment), e = Mt();
900
+ e && z(e.$$.fragment), t = Me();
892
901
  },
893
- m(i, a) {
894
- t && C(t, i, a), At(i, e, a), r = !0;
902
+ m(a, c) {
903
+ e && C(e, a, c), Ae(a, t, c), r = !0;
895
904
  },
896
- p(i, [a]) {
897
- const l = a & /*blok, $$restProps*/
898
- 5 ? Jt(n, [
899
- a & /*blok*/
905
+ p(a, [c]) {
906
+ const l = c & /*blok, $$restProps*/
907
+ 5 ? Je(n, [
908
+ c & /*blok*/
900
909
  1 && { blok: (
901
910
  /*blok*/
902
- i[0]
911
+ a[0]
903
912
  ) },
904
- a & /*$$restProps*/
905
- 4 && Ft(
913
+ c & /*$$restProps*/
914
+ 4 && Fe(
906
915
  /*$$restProps*/
907
- i[2]
916
+ a[2]
908
917
  )
909
918
  ]) : {};
910
919
  if (o !== (o = /*component*/
911
- i[1])) {
912
- if (t) {
913
- Dt();
914
- const u = t;
920
+ a[1])) {
921
+ if (e) {
922
+ De();
923
+ const u = e;
915
924
  Y(u.$$.fragment, 1, 0, () => {
916
925
  I(u, 1);
917
- }), Bt();
926
+ }), Be();
918
927
  }
919
- o ? (t = J(o, c()), z(t.$$.fragment), O(t.$$.fragment, 1), C(t, e.parentNode, e)) : t = null;
928
+ o ? (e = J(o, i()), z(e.$$.fragment), O(e.$$.fragment, 1), C(e, t.parentNode, t)) : e = null;
920
929
  } else
921
- o && t.$set(l);
930
+ o && e.$set(l);
922
931
  },
923
- i(i) {
924
- r || (t && O(t.$$.fragment, i), r = !0);
932
+ i(a) {
933
+ r || (e && O(e.$$.fragment, a), r = !0);
925
934
  },
926
- o(i) {
927
- t && Y(t.$$.fragment, i), r = !1;
935
+ o(a) {
936
+ e && Y(e.$$.fragment, a), r = !1;
928
937
  },
929
- d(i) {
930
- i && X(e), t && I(t, i);
938
+ d(a) {
939
+ a && X(t), e && I(e, a);
931
940
  }
932
941
  };
933
942
  }
934
- function Gt(s, t, e) {
943
+ function Ge(s, e, t) {
935
944
  const r = ["blok"];
936
- let n = B(t, r), o, { blok: c } = t;
937
- return c ? o = Qt(c.component) : console.error("Please provide a 'blok' property to the StoryblokComponent"), s.$$set = (i) => {
938
- t = E(E({}, t), It(i)), e(2, n = B(t, r)), "blok" in i && e(0, c = i.blok);
939
- }, [c, o, n];
945
+ let n = B(e, r), o, { blok: i } = e;
946
+ return i ? o = Qe(i.component) : console.error("Please provide a 'blok' property to the StoryblokComponent"), s.$$set = (a) => {
947
+ e = j(j({}, e), Ie(a)), t(2, n = B(e, r)), "blok" in a && t(0, i = a.blok);
948
+ }, [i, o, n];
940
949
  }
941
- class te extends zt {
942
- constructor(t) {
943
- super(), Yt(this, t, Gt, Kt, Ot, { blok: 0 });
950
+ class et extends ze {
951
+ constructor(e) {
952
+ super(), Ye(this, e, Ge, Ke, Oe, { blok: 0 });
944
953
  }
945
954
  }
946
- const ee = (s, t) => {
947
- const e = (r) => {
948
- const n = Et(r);
955
+ const tt = (s, e) => {
956
+ const t = (r) => {
957
+ const n = je(r);
949
958
  n["data-blok-c"] && (s.setAttribute("data-blok-c", n["data-blok-c"]), s.setAttribute("data-blok-uid", n["data-blok-uid"]), s.classList.add("storyblok__outline"));
950
959
  };
951
- return e(t), {
960
+ return t(e), {
952
961
  update(r) {
953
- e(r);
962
+ t(r);
954
963
  }
955
964
  };
956
965
  };
957
966
  let A = null;
958
- const se = () => (A || console.log(
967
+ const st = () => (A || console.log(
959
968
  "You can't use getStoryblokApi if you're not loading apiPlugin."
960
969
  ), A);
961
970
  let $ = null;
962
- const re = (s) => {
963
- const { storyblokApi: t } = Pt(s);
964
- A = t, $ = s.components || {};
965
- }, Qt = (s) => {
966
- let t = null;
967
- return t = typeof $ == "function" ? $()[s] : $[s], t || console.error(`You didn't load the ${s} component. Please load it in storyblokInit. For example:
971
+ const rt = (s) => {
972
+ const { storyblokApi: e } = Se(s);
973
+ A = e, $ = s.components || {};
974
+ }, Qe = (s) => {
975
+ let e = null;
976
+ return e = typeof $ == "function" ? $()[s] : $[s], e || console.error(`You didn't load the ${s} component. Please load it in storyblokInit. For example:
968
977
  storyblokInit({
969
978
  accessToken: "<your-token>",
970
979
  components: {
971
980
  "teaser": Teaser
972
981
  }
973
982
  })
974
- `), t;
983
+ `), e;
975
984
  };
976
985
  export {
977
- Tt as RichTextSchema,
978
- te as StoryblokComponent,
979
- Wt as apiPlugin,
980
- Qt as getComponent,
981
- se as getStoryblokApi,
982
- Zt as renderRichText,
983
- ee as storyblokEditable,
984
- re as storyblokInit,
985
- se as useStoryblokApi,
986
- Xt as useStoryblokBridge
986
+ Te as RichTextSchema,
987
+ et as StoryblokComponent,
988
+ We as apiPlugin,
989
+ Qe as getComponent,
990
+ st as getStoryblokApi,
991
+ Ze as renderRichText,
992
+ tt as storyblokEditable,
993
+ rt as storyblokInit,
994
+ st as useStoryblokApi,
995
+ Xe as useStoryblokBridge
987
996
  };