@storyblok/svelte 2.4.5 → 2.4.7
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.
- package/dist/storyblok-svelte.js +3 -3
- package/dist/storyblok-svelte.mjs +468 -462
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
let U = !1;
|
|
2
|
-
const H = [],
|
|
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) =>
|
|
13
|
-
H.forEach((o) => o()), U = !0,
|
|
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
|
|
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
|
|
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
|
|
27
|
+
const a = function() {
|
|
28
28
|
o++;
|
|
29
|
-
const
|
|
30
|
-
o--, r.length > 0 &&
|
|
31
|
-
return u !==
|
|
29
|
+
const c = setTimeout(function() {
|
|
30
|
+
o--, r.length > 0 && a(), n = n.filter(function(u) {
|
|
31
|
+
return u !== c;
|
|
32
32
|
});
|
|
33
|
-
},
|
|
34
|
-
n.indexOf(
|
|
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(...
|
|
37
|
+
}, i = 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:
|
|
43
|
+
args: c,
|
|
44
44
|
self: l
|
|
45
|
-
}), o <
|
|
45
|
+
}), o < e && a();
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
return i.abort = function() {
|
|
49
|
-
n.forEach(clearTimeout), n = [], r.forEach(function(
|
|
50
|
-
|
|
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
54
|
}, i;
|
|
55
55
|
}
|
|
56
|
-
const
|
|
57
|
-
const
|
|
56
|
+
const ne = function(s, e) {
|
|
57
|
+
const t = {};
|
|
58
58
|
for (const r in s) {
|
|
59
59
|
const n = s[r];
|
|
60
|
-
|
|
60
|
+
e.indexOf(r) > -1 && n !== null && (t[r] = n);
|
|
61
61
|
}
|
|
62
|
-
return
|
|
63
|
-
},
|
|
62
|
+
return t;
|
|
63
|
+
}, oe = (s) => s === "email", ie = () => ({
|
|
64
64
|
singleTag: "hr"
|
|
65
|
-
}),
|
|
65
|
+
}), ae = () => ({
|
|
66
66
|
tag: "blockquote"
|
|
67
|
-
}),
|
|
67
|
+
}), ce = () => ({
|
|
68
68
|
tag: "ul"
|
|
69
|
-
}),
|
|
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
|
-
}),
|
|
77
|
+
}), he = () => ({
|
|
78
78
|
singleTag: "br"
|
|
79
|
-
}),
|
|
79
|
+
}), ue = (s) => ({
|
|
80
80
|
tag: `h${s.attrs.level}`
|
|
81
|
-
}),
|
|
81
|
+
}), de = (s) => ({
|
|
82
82
|
singleTag: [
|
|
83
83
|
{
|
|
84
84
|
tag: "img",
|
|
85
|
-
attrs:
|
|
85
|
+
attrs: ne(s.attrs, ["src", "alt", "title"])
|
|
86
86
|
}
|
|
87
87
|
]
|
|
88
|
-
}),
|
|
88
|
+
}), fe = () => ({
|
|
89
89
|
tag: "li"
|
|
90
|
-
}),
|
|
90
|
+
}), pe = () => ({
|
|
91
91
|
tag: "ol"
|
|
92
|
-
}),
|
|
92
|
+
}), ge = () => ({
|
|
93
93
|
tag: "p"
|
|
94
|
-
}),
|
|
94
|
+
}), me = () => ({
|
|
95
95
|
tag: "b"
|
|
96
|
-
}),
|
|
96
|
+
}), ye = () => ({
|
|
97
97
|
tag: "strike"
|
|
98
|
-
}),
|
|
98
|
+
}), ke = () => ({
|
|
99
99
|
tag: "u"
|
|
100
|
-
}),
|
|
100
|
+
}), _e = () => ({
|
|
101
101
|
tag: "strong"
|
|
102
|
-
}),
|
|
102
|
+
}), be = () => ({
|
|
103
103
|
tag: "code"
|
|
104
|
-
}),
|
|
104
|
+
}), ve = () => ({
|
|
105
105
|
tag: "i"
|
|
106
|
-
}),
|
|
107
|
-
const
|
|
108
|
-
return
|
|
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:
|
|
112
|
+
attrs: e
|
|
113
113
|
}
|
|
114
114
|
]
|
|
115
115
|
};
|
|
116
|
-
}, $
|
|
116
|
+
}, $e = (s) => ({
|
|
117
117
|
tag: [
|
|
118
118
|
{
|
|
119
119
|
tag: "span",
|
|
120
120
|
attrs: s.attrs
|
|
121
121
|
}
|
|
122
122
|
]
|
|
123
|
-
}),
|
|
123
|
+
}), Te = {
|
|
124
124
|
nodes: {
|
|
125
|
-
horizontal_rule:
|
|
126
|
-
blockquote:
|
|
127
|
-
bullet_list:
|
|
128
|
-
code_block:
|
|
129
|
-
hard_break:
|
|
130
|
-
heading:
|
|
131
|
-
image:
|
|
132
|
-
list_item:
|
|
133
|
-
ordered_list:
|
|
134
|
-
paragraph:
|
|
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:
|
|
138
|
-
strike:
|
|
139
|
-
underline:
|
|
140
|
-
strong:
|
|
141
|
-
code:
|
|
142
|
-
italic:
|
|
143
|
-
link:
|
|
144
|
-
styled: $
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
const
|
|
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
|
"&": "&",
|
|
149
149
|
"<": "<",
|
|
150
150
|
">": ">",
|
|
151
151
|
'"': """,
|
|
152
152
|
"'": "'"
|
|
153
|
-
},
|
|
154
|
-
return s && r.test(s) ? s.replace(
|
|
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(
|
|
158
|
-
h(this, "marks"), h(this, "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(
|
|
161
|
-
this.nodes[
|
|
160
|
+
addNode(e, t) {
|
|
161
|
+
this.nodes[e] = t;
|
|
162
162
|
}
|
|
163
|
-
addMark(
|
|
164
|
-
this.marks[
|
|
163
|
+
addMark(e, t) {
|
|
164
|
+
this.marks[e] = t;
|
|
165
165
|
}
|
|
166
|
-
render(
|
|
167
|
-
if (
|
|
168
|
-
let
|
|
169
|
-
return
|
|
170
|
-
|
|
171
|
-
}),
|
|
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(
|
|
178
|
-
const
|
|
179
|
-
|
|
177
|
+
renderNode(e) {
|
|
178
|
+
const t = [];
|
|
179
|
+
e.marks && e.marks.forEach((n) => {
|
|
180
180
|
const o = this.getMatchingMark(n);
|
|
181
|
-
o &&
|
|
181
|
+
o && t.push(this.renderOpeningTag(o.tag));
|
|
182
182
|
});
|
|
183
|
-
const r = this.getMatchingNode(
|
|
184
|
-
return r && r.tag &&
|
|
185
|
-
|
|
186
|
-
}) :
|
|
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 &&
|
|
189
|
-
}),
|
|
188
|
+
o && t.push(this.renderClosingTag(o.tag));
|
|
189
|
+
}), t.join("");
|
|
190
190
|
}
|
|
191
|
-
renderTag(
|
|
192
|
-
return
|
|
191
|
+
renderTag(e, t) {
|
|
192
|
+
return e.constructor === String ? `<${e}${t}>` : e.map((r) => {
|
|
193
193
|
if (r.constructor === String)
|
|
194
|
-
return `<${r}${
|
|
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
|
|
200
|
-
|
|
199
|
+
const a = r.attrs[o];
|
|
200
|
+
a !== null && (n += ` ${o}="${a}"`);
|
|
201
201
|
}
|
|
202
|
-
return `${n}${
|
|
202
|
+
return `${n}${t}>`;
|
|
203
203
|
}
|
|
204
204
|
}).join("");
|
|
205
205
|
}
|
|
206
|
-
renderOpeningTag(
|
|
207
|
-
return this.renderTag(
|
|
206
|
+
renderOpeningTag(e) {
|
|
207
|
+
return this.renderTag(e, "");
|
|
208
208
|
}
|
|
209
|
-
renderClosingTag(
|
|
210
|
-
return
|
|
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(
|
|
213
|
-
const
|
|
214
|
-
if (typeof
|
|
215
|
-
return e
|
|
212
|
+
getMatchingNode(e) {
|
|
213
|
+
const t = this.nodes[e.type];
|
|
214
|
+
if (typeof t == "function")
|
|
215
|
+
return t(e);
|
|
216
216
|
}
|
|
217
|
-
getMatchingMark(
|
|
218
|
-
const
|
|
219
|
-
if (typeof
|
|
220
|
-
return e
|
|
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", (
|
|
226
|
-
...
|
|
227
|
-
per_page:
|
|
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", (
|
|
230
|
-
const r = Math.abs(
|
|
231
|
-
return this.arrayFrom(r, (o,
|
|
232
|
-
}), h(this, "asyncMap", async (
|
|
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, a) => a * 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(
|
|
234
|
+
stringify(e, t, r) {
|
|
235
235
|
const n = [];
|
|
236
|
-
for (const o in
|
|
237
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
236
|
+
for (const o in e) {
|
|
237
|
+
if (!Object.prototype.hasOwnProperty.call(e, o))
|
|
238
238
|
continue;
|
|
239
|
-
const
|
|
240
|
-
let
|
|
241
|
-
typeof
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
Array.isArray(
|
|
245
|
-
) :
|
|
239
|
+
const a = e[o], i = r ? "" : encodeURIComponent(o);
|
|
240
|
+
let c;
|
|
241
|
+
typeof a == "object" ? c = this.stringify(
|
|
242
|
+
a,
|
|
243
|
+
t ? t + encodeURIComponent("[" + i + "]") : i,
|
|
244
|
+
Array.isArray(a)
|
|
245
|
+
) : c = (t ? t + encodeURIComponent("[" + i + "]") : i) + "=" + encodeURIComponent(a), n.push(c);
|
|
246
246
|
}
|
|
247
247
|
return n.join("&");
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
-
class
|
|
251
|
-
constructor(
|
|
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 =
|
|
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(
|
|
255
|
-
return this.url =
|
|
254
|
+
get(e, t) {
|
|
255
|
+
return this.url = e, this.parameters = t, this._methodHandler("get");
|
|
256
256
|
}
|
|
257
|
-
post(
|
|
258
|
-
return this.url =
|
|
257
|
+
post(e, t) {
|
|
258
|
+
return this.url = e, this.parameters = t, this._methodHandler("post");
|
|
259
259
|
}
|
|
260
|
-
put(
|
|
261
|
-
return this.url =
|
|
260
|
+
put(e, t) {
|
|
261
|
+
return this.url = e, this.parameters = t, this._methodHandler("put");
|
|
262
262
|
}
|
|
263
|
-
delete(
|
|
264
|
-
return this.url =
|
|
263
|
+
delete(e, t) {
|
|
264
|
+
return this.url = e, this.parameters = t, this._methodHandler("delete");
|
|
265
265
|
}
|
|
266
|
-
async _responseHandler(
|
|
267
|
-
const
|
|
266
|
+
async _responseHandler(e) {
|
|
267
|
+
const t = [], r = {
|
|
268
268
|
data: {},
|
|
269
269
|
headers: {},
|
|
270
270
|
status: 0,
|
|
271
271
|
statusText: ""
|
|
272
272
|
};
|
|
273
|
-
|
|
273
|
+
e.status !== 204 && await e.json().then((n) => {
|
|
274
274
|
r.data = n;
|
|
275
275
|
});
|
|
276
|
-
for (const n of
|
|
277
|
-
|
|
278
|
-
return r.headers = { ...
|
|
279
|
-
}
|
|
280
|
-
async _methodHandler(
|
|
281
|
-
let
|
|
282
|
-
if (
|
|
283
|
-
const
|
|
284
|
-
|
|
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(
|
|
289
|
+
const n = new URL(t), o = new AbortController(), { signal: a } = o;
|
|
290
290
|
let i;
|
|
291
291
|
this.timeout && (i = setTimeout(() => o.abort(), this.timeout));
|
|
292
292
|
try {
|
|
293
|
-
const
|
|
294
|
-
method:
|
|
293
|
+
const c = await this.fetch(`${n}`, {
|
|
294
|
+
method: e,
|
|
295
295
|
headers: this.headers,
|
|
296
296
|
body: r,
|
|
297
|
-
signal:
|
|
297
|
+
signal: a
|
|
298
298
|
});
|
|
299
299
|
this.timeout && clearTimeout(i);
|
|
300
|
-
const l = await this._responseHandler(
|
|
300
|
+
const l = await this._responseHandler(c);
|
|
301
301
|
return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(l)) : this._statusHandler(l);
|
|
302
|
-
} catch (
|
|
303
|
-
return
|
|
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(
|
|
310
|
-
const
|
|
311
|
+
_statusHandler(e) {
|
|
312
|
+
const t = /20[0-6]/g;
|
|
311
313
|
return new Promise((r, n) => {
|
|
312
|
-
if (
|
|
313
|
-
return r(
|
|
314
|
+
if (t.test(`${e.status}`))
|
|
315
|
+
return r(e);
|
|
314
316
|
const o = {
|
|
315
|
-
message: new Error(
|
|
316
|
-
|
|
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
|
|
325
|
-
constructor(
|
|
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"), !
|
|
327
|
-
const o =
|
|
328
|
-
|
|
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}` : "", a = e.https === !1 ? "http" : "https";
|
|
331
|
+
e.oauthToken ? t = `${a}://api${o}.storyblok.com/v1` : t = `${a}://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,
|
|
332
|
-
|
|
334
|
+
r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), r.forEach((o, a) => {
|
|
335
|
+
e.headers && e.headers[a] && r.set(a, e.headers[a]);
|
|
333
336
|
});
|
|
334
337
|
let n = 5;
|
|
335
|
-
|
|
336
|
-
baseURL:
|
|
337
|
-
timeout:
|
|
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:
|
|
340
|
-
fetch:
|
|
342
|
+
responseInterceptor: e.responseInterceptor,
|
|
343
|
+
fetch: e.fetch
|
|
341
344
|
});
|
|
342
345
|
}
|
|
343
|
-
setComponentResolver(
|
|
344
|
-
this.richTextResolver.addNode("blok", (
|
|
346
|
+
setComponentResolver(e) {
|
|
347
|
+
this.richTextResolver.addNode("blok", (t) => {
|
|
345
348
|
let r = "";
|
|
346
|
-
return
|
|
347
|
-
r +=
|
|
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(
|
|
354
|
-
return
|
|
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(
|
|
357
|
-
return this.helpers.isCDNUrl(
|
|
359
|
+
factoryParamOptions(e, t) {
|
|
360
|
+
return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
|
|
358
361
|
}
|
|
359
|
-
makeRequest(
|
|
362
|
+
makeRequest(e, t, r, n) {
|
|
360
363
|
const o = this.factoryParamOptions(
|
|
361
|
-
|
|
362
|
-
this.helpers.getOptionsPage(
|
|
364
|
+
e,
|
|
365
|
+
this.helpers.getOptionsPage(t, r, n)
|
|
363
366
|
);
|
|
364
|
-
return this.cacheResponse(
|
|
367
|
+
return this.cacheResponse(e, o);
|
|
365
368
|
}
|
|
366
|
-
get(
|
|
367
|
-
|
|
368
|
-
const r = `/${
|
|
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(
|
|
372
|
-
const n = (
|
|
373
|
-
this.helpers.range(
|
|
374
|
-
(p) => this.makeRequest(o,
|
|
374
|
+
async getAll(e, t, r) {
|
|
375
|
+
const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`, a = o.split("/"), i = r || a[a.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
381
|
(p) => Object.values(p.data[i])
|
|
379
382
|
);
|
|
380
383
|
}
|
|
381
|
-
post(
|
|
382
|
-
const r = `/${
|
|
383
|
-
return Promise.resolve(this.throttle("post", r,
|
|
384
|
+
post(e, t) {
|
|
385
|
+
const r = `/${e}`;
|
|
386
|
+
return Promise.resolve(this.throttle("post", r, t));
|
|
384
387
|
}
|
|
385
|
-
put(
|
|
386
|
-
const r = `/${
|
|
387
|
-
return Promise.resolve(this.throttle("put", r,
|
|
388
|
+
put(e, t) {
|
|
389
|
+
const r = `/${e}`;
|
|
390
|
+
return Promise.resolve(this.throttle("put", r, t));
|
|
388
391
|
}
|
|
389
|
-
delete(
|
|
390
|
-
const r = `/${
|
|
391
|
-
return Promise.resolve(this.throttle("delete", r,
|
|
392
|
+
delete(e, t) {
|
|
393
|
+
const r = `/${e}`;
|
|
394
|
+
return Promise.resolve(this.throttle("delete", r, t));
|
|
392
395
|
}
|
|
393
|
-
getStories(
|
|
394
|
-
return this.get("cdn/stories",
|
|
396
|
+
getStories(e) {
|
|
397
|
+
return this.get("cdn/stories", e);
|
|
395
398
|
}
|
|
396
|
-
getStory(
|
|
397
|
-
return this.get(`cdn/stories/${
|
|
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(
|
|
406
|
-
return JSON.parse(JSON.stringify(
|
|
408
|
+
_cleanCopy(e) {
|
|
409
|
+
return JSON.parse(JSON.stringify(e));
|
|
407
410
|
}
|
|
408
|
-
_insertLinks(
|
|
409
|
-
const r = t
|
|
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(
|
|
413
|
-
if (r.indexOf(`${
|
|
414
|
-
if (typeof t
|
|
415
|
-
this.relations[t
|
|
416
|
-
else if (t
|
|
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
|
|
421
|
+
e[t].forEach((o) => {
|
|
419
422
|
this.relations[o] && n.push(this._cleanCopy(this.relations[o]));
|
|
420
|
-
}), t
|
|
423
|
+
}), e[t] = n;
|
|
421
424
|
}
|
|
422
425
|
}
|
|
423
426
|
}
|
|
424
|
-
iterateTree(
|
|
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
|
-
|
|
440
|
+
t
|
|
438
441
|
), this._insertLinks(n, o)), r(n[o]);
|
|
439
442
|
}
|
|
440
443
|
}
|
|
441
444
|
};
|
|
442
|
-
r(
|
|
445
|
+
r(e.content);
|
|
443
446
|
}
|
|
444
|
-
async resolveLinks(
|
|
447
|
+
async resolveLinks(e, t) {
|
|
445
448
|
let r = [];
|
|
446
|
-
if (
|
|
447
|
-
const n =
|
|
448
|
-
for (let i = 0; i < n; i +=
|
|
449
|
-
const
|
|
450
|
-
o.push(
|
|
449
|
+
if (e.link_uuids) {
|
|
450
|
+
const n = e.link_uuids.length, o = [], a = 50;
|
|
451
|
+
for (let i = 0; i < n; i += a) {
|
|
452
|
+
const c = Math.min(n, i + a);
|
|
453
|
+
o.push(e.link_uuids.slice(i, c));
|
|
451
454
|
}
|
|
452
455
|
for (let i = 0; i < o.length; i++)
|
|
453
456
|
(await this.getStories({
|
|
454
|
-
per_page:
|
|
455
|
-
language:
|
|
456
|
-
version:
|
|
457
|
+
per_page: a,
|
|
458
|
+
language: t.language,
|
|
459
|
+
version: t.version,
|
|
457
460
|
by_uuids: o[i].join(",")
|
|
458
461
|
})).data.stories.forEach(
|
|
459
|
-
(
|
|
460
|
-
r.push(
|
|
462
|
+
(c) => {
|
|
463
|
+
r.push(c);
|
|
461
464
|
}
|
|
462
465
|
);
|
|
463
466
|
} else
|
|
464
|
-
r =
|
|
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(
|
|
472
|
+
async resolveRelations(e, t) {
|
|
470
473
|
let r = [];
|
|
471
|
-
if (
|
|
472
|
-
const n =
|
|
473
|
-
for (let i = 0; i < n; i +=
|
|
474
|
-
const
|
|
475
|
-
o.push(
|
|
474
|
+
if (e.rel_uuids) {
|
|
475
|
+
const n = e.rel_uuids.length, o = [], a = 50;
|
|
476
|
+
for (let i = 0; i < n; i += a) {
|
|
477
|
+
const c = Math.min(n, i + a);
|
|
478
|
+
o.push(e.rel_uuids.slice(i, c));
|
|
476
479
|
}
|
|
477
480
|
for (let i = 0; i < o.length; i++)
|
|
478
481
|
(await this.getStories({
|
|
479
|
-
per_page:
|
|
480
|
-
language:
|
|
481
|
-
version:
|
|
482
|
+
per_page: a,
|
|
483
|
+
language: t.language,
|
|
484
|
+
version: t.version,
|
|
482
485
|
by_uuids: o[i].join(",")
|
|
483
|
-
})).data.stories.forEach((
|
|
484
|
-
r.push(
|
|
486
|
+
})).data.stories.forEach((c) => {
|
|
487
|
+
r.push(c);
|
|
485
488
|
});
|
|
486
489
|
} else
|
|
487
|
-
r =
|
|
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(
|
|
495
|
+
async resolveStories(e, t) {
|
|
493
496
|
var r, n;
|
|
494
497
|
let o = [];
|
|
495
|
-
if (typeof
|
|
496
|
-
for (const
|
|
497
|
-
this.iterateTree(this.relations[
|
|
498
|
-
|
|
499
|
-
this.iterateTree(
|
|
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 a in this.relations)
|
|
500
|
+
this.iterateTree(this.relations[a], o);
|
|
501
|
+
e.story ? this.iterateTree(e.story, o) : e.stories.forEach((a) => {
|
|
502
|
+
this.iterateTree(a, o);
|
|
500
503
|
});
|
|
501
504
|
}
|
|
502
|
-
cacheResponse(
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
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 a = await o.get(n);
|
|
509
|
+
if (a)
|
|
510
|
+
return Promise.resolve(a);
|
|
511
|
+
}
|
|
512
|
+
return new Promise((a, i) => {
|
|
510
513
|
try {
|
|
511
514
|
(async () => {
|
|
512
|
-
var
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
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 ? i(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), a(u));
|
|
523
|
+
} catch (l) {
|
|
524
|
+
return i(l);
|
|
525
|
+
}
|
|
521
526
|
})();
|
|
522
527
|
} catch {
|
|
523
528
|
}
|
|
524
529
|
});
|
|
525
530
|
}
|
|
526
|
-
throttledRequest(
|
|
527
|
-
return this.client[
|
|
531
|
+
throttledRequest(e, t, r) {
|
|
532
|
+
return this.client[e](t, r);
|
|
528
533
|
}
|
|
529
534
|
cacheVersions() {
|
|
530
535
|
return g;
|
|
@@ -532,122 +537,123 @@ class jt {
|
|
|
532
537
|
cacheVersion() {
|
|
533
538
|
return g[this.accessToken];
|
|
534
539
|
}
|
|
535
|
-
setCacheVersion(
|
|
536
|
-
this.accessToken && (g[this.accessToken] =
|
|
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(
|
|
543
|
-
return b[
|
|
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(
|
|
549
|
-
b[
|
|
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
|
|
573
|
-
const { apiOptions:
|
|
574
|
-
if (!
|
|
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
|
|
581
|
-
},
|
|
592
|
+
return { storyblokApi: new Pe(e) };
|
|
593
|
+
}, je = (s) => {
|
|
582
594
|
if (typeof s != "object" || typeof s._editable > "u")
|
|
583
595
|
return {};
|
|
584
|
-
const
|
|
596
|
+
const e = JSON.parse(
|
|
585
597
|
s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
|
|
586
598
|
);
|
|
587
599
|
return {
|
|
588
|
-
"data-blok-c": JSON.stringify(
|
|
589
|
-
"data-blok-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
|
|
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(
|
|
607
|
-
r.action === "input" && r.story.id === s ?
|
|
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
|
-
},
|
|
617
|
+
}, Se = (s = {}) => {
|
|
612
618
|
const {
|
|
613
|
-
bridge:
|
|
614
|
-
accessToken:
|
|
619
|
+
bridge: e,
|
|
620
|
+
accessToken: t,
|
|
615
621
|
use: r = [],
|
|
616
622
|
apiOptions: n = {},
|
|
617
623
|
richText: o = {}
|
|
618
624
|
} = s;
|
|
619
|
-
n.accessToken = n.accessToken ||
|
|
620
|
-
const
|
|
625
|
+
n.accessToken = n.accessToken || t;
|
|
626
|
+
const a = { bridge: e, apiOptions: n };
|
|
621
627
|
let i = {};
|
|
622
|
-
return r.forEach((
|
|
623
|
-
i = { ...i, ...a
|
|
624
|
-
}),
|
|
625
|
-
}, G = (s,
|
|
626
|
-
s.addNode("blok", (
|
|
628
|
+
return r.forEach((c) => {
|
|
629
|
+
i = { ...i, ...c(a) };
|
|
630
|
+
}), e !== !1 && ee(Ee), x = new T(o.schema), o.resolver && G(x, o.resolver), i;
|
|
631
|
+
}, G = (s, e) => {
|
|
632
|
+
s.addNode("blok", (t) => {
|
|
627
633
|
let r = "";
|
|
628
|
-
return
|
|
629
|
-
r +=
|
|
634
|
+
return t.attrs.body.forEach((n) => {
|
|
635
|
+
r += e(n.component, n);
|
|
630
636
|
}), {
|
|
631
637
|
html: r
|
|
632
638
|
};
|
|
633
639
|
});
|
|
634
|
-
},
|
|
635
|
-
let r =
|
|
640
|
+
}, Ze = (s, e, t) => {
|
|
641
|
+
let r = t || x;
|
|
636
642
|
if (!r) {
|
|
637
643
|
console.error(
|
|
638
644
|
"Please initialize the Storyblok SDK before calling the renderRichText function"
|
|
639
645
|
);
|
|
640
646
|
return;
|
|
641
647
|
}
|
|
642
|
-
return s === "" ? "" : s ? (
|
|
648
|
+
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
649
|
|
|
644
650
|
For more info about the richtext object check https://github.com/storyblok/storyblok-js#rendering-rich-text`), "");
|
|
645
651
|
};
|
|
646
|
-
function
|
|
652
|
+
function P() {
|
|
647
653
|
}
|
|
648
|
-
function
|
|
649
|
-
for (const
|
|
650
|
-
s[
|
|
654
|
+
function j(s, e) {
|
|
655
|
+
for (const t in e)
|
|
656
|
+
s[t] = e[t];
|
|
651
657
|
return s;
|
|
652
658
|
}
|
|
653
659
|
function Q(s) {
|
|
@@ -662,53 +668,53 @@ function _(s) {
|
|
|
662
668
|
function W(s) {
|
|
663
669
|
return typeof s == "function";
|
|
664
670
|
}
|
|
665
|
-
function
|
|
666
|
-
return s != s ?
|
|
671
|
+
function Oe(s, e) {
|
|
672
|
+
return s != s ? e == e : s !== e || s && typeof s == "object" || typeof s == "function";
|
|
667
673
|
}
|
|
668
|
-
function
|
|
674
|
+
function Ce(s) {
|
|
669
675
|
return Object.keys(s).length === 0;
|
|
670
676
|
}
|
|
671
|
-
function
|
|
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) {
|
|
677
|
+
function Ie(s) {
|
|
678
678
|
const e = {};
|
|
679
|
-
t
|
|
680
|
-
|
|
681
|
-
!t.has(r) && r[0] !== "$" && (e[r] = s[r]);
|
|
679
|
+
for (const t in s)
|
|
680
|
+
t[0] !== "$" && (e[t] = s[t]);
|
|
682
681
|
return e;
|
|
683
682
|
}
|
|
684
|
-
function
|
|
685
|
-
|
|
683
|
+
function B(s, e) {
|
|
684
|
+
const t = {};
|
|
685
|
+
e = new Set(e);
|
|
686
|
+
for (const r in s)
|
|
687
|
+
!e.has(r) && r[0] !== "$" && (t[r] = s[r]);
|
|
688
|
+
return t;
|
|
689
|
+
}
|
|
690
|
+
function Ae(s, e, t) {
|
|
691
|
+
s.insertBefore(e, t || null);
|
|
686
692
|
}
|
|
687
693
|
function X(s) {
|
|
688
694
|
s.parentNode && s.parentNode.removeChild(s);
|
|
689
695
|
}
|
|
690
|
-
function
|
|
696
|
+
function Ne(s) {
|
|
691
697
|
return document.createTextNode(s);
|
|
692
698
|
}
|
|
693
|
-
function
|
|
694
|
-
return
|
|
699
|
+
function Me() {
|
|
700
|
+
return Ne("");
|
|
695
701
|
}
|
|
696
|
-
function
|
|
702
|
+
function Le(s) {
|
|
697
703
|
return Array.from(s.childNodes);
|
|
698
704
|
}
|
|
699
|
-
function J(s,
|
|
700
|
-
return new s(
|
|
705
|
+
function J(s, e) {
|
|
706
|
+
return new s(e);
|
|
701
707
|
}
|
|
702
708
|
let N;
|
|
703
709
|
function k(s) {
|
|
704
710
|
N = s;
|
|
705
711
|
}
|
|
706
|
-
const y = [], F = [], v = [], V = [],
|
|
707
|
-
let
|
|
708
|
-
function
|
|
709
|
-
|
|
712
|
+
const y = [], F = [], v = [], V = [], Ue = Promise.resolve();
|
|
713
|
+
let E = !1;
|
|
714
|
+
function He() {
|
|
715
|
+
E || (E = !0, Ue.then(Z));
|
|
710
716
|
}
|
|
711
|
-
function
|
|
717
|
+
function S(s) {
|
|
712
718
|
v.push(s);
|
|
713
719
|
}
|
|
714
720
|
const R = /* @__PURE__ */ new Set();
|
|
@@ -720,34 +726,34 @@ function Z() {
|
|
|
720
726
|
do {
|
|
721
727
|
try {
|
|
722
728
|
for (; m < y.length; ) {
|
|
723
|
-
const
|
|
724
|
-
m++, k(
|
|
729
|
+
const e = y[m];
|
|
730
|
+
m++, k(e), qe(e.$$);
|
|
725
731
|
}
|
|
726
|
-
} catch (
|
|
727
|
-
throw y.length = 0, m = 0,
|
|
732
|
+
} catch (e) {
|
|
733
|
+
throw y.length = 0, m = 0, e;
|
|
728
734
|
}
|
|
729
735
|
for (k(null), y.length = 0, m = 0; F.length; )
|
|
730
736
|
F.pop()();
|
|
731
|
-
for (let
|
|
732
|
-
const
|
|
733
|
-
R.has(
|
|
737
|
+
for (let e = 0; e < v.length; e += 1) {
|
|
738
|
+
const t = v[e];
|
|
739
|
+
R.has(t) || (R.add(t), t());
|
|
734
740
|
}
|
|
735
741
|
v.length = 0;
|
|
736
742
|
} while (y.length);
|
|
737
743
|
for (; V.length; )
|
|
738
744
|
V.pop()();
|
|
739
|
-
|
|
745
|
+
E = !1, R.clear(), k(s);
|
|
740
746
|
}
|
|
741
|
-
function
|
|
747
|
+
function qe(s) {
|
|
742
748
|
if (s.fragment !== null) {
|
|
743
749
|
s.update(), _(s.before_update);
|
|
744
|
-
const
|
|
745
|
-
s.dirty = [-1], s.fragment && s.fragment.p(s.ctx,
|
|
750
|
+
const e = s.dirty;
|
|
751
|
+
s.dirty = [-1], s.fragment && s.fragment.p(s.ctx, e), s.after_update.forEach(S);
|
|
746
752
|
}
|
|
747
753
|
}
|
|
748
754
|
const w = /* @__PURE__ */ new Set();
|
|
749
755
|
let f;
|
|
750
|
-
function
|
|
756
|
+
function De() {
|
|
751
757
|
f = {
|
|
752
758
|
r: 0,
|
|
753
759
|
c: [],
|
|
@@ -755,70 +761,70 @@ function Dt() {
|
|
|
755
761
|
// parent group
|
|
756
762
|
};
|
|
757
763
|
}
|
|
758
|
-
function
|
|
764
|
+
function Be() {
|
|
759
765
|
f.r || _(f.c), f = f.p;
|
|
760
766
|
}
|
|
761
|
-
function O(s,
|
|
762
|
-
s && s.i && (w.delete(s), s.i(
|
|
767
|
+
function O(s, e) {
|
|
768
|
+
s && s.i && (w.delete(s), s.i(e));
|
|
763
769
|
}
|
|
764
|
-
function Y(s,
|
|
770
|
+
function Y(s, e, t, r) {
|
|
765
771
|
if (s && s.o) {
|
|
766
772
|
if (w.has(s))
|
|
767
773
|
return;
|
|
768
774
|
w.add(s), f.c.push(() => {
|
|
769
|
-
w.delete(s), r && (
|
|
770
|
-
}), s.o(
|
|
775
|
+
w.delete(s), r && (t && s.d(1), r());
|
|
776
|
+
}), s.o(e);
|
|
771
777
|
} else
|
|
772
778
|
r && r();
|
|
773
779
|
}
|
|
774
|
-
function
|
|
775
|
-
const
|
|
780
|
+
function Je(s, e) {
|
|
781
|
+
const t = {}, r = {}, n = { $$scope: 1 };
|
|
776
782
|
let o = s.length;
|
|
777
783
|
for (; o--; ) {
|
|
778
|
-
const
|
|
784
|
+
const a = s[o], i = e[o];
|
|
779
785
|
if (i) {
|
|
780
|
-
for (const
|
|
781
|
-
|
|
782
|
-
for (const
|
|
783
|
-
n[
|
|
786
|
+
for (const c in a)
|
|
787
|
+
c in i || (r[c] = 1);
|
|
788
|
+
for (const c in i)
|
|
789
|
+
n[c] || (t[c] = i[c], n[c] = 1);
|
|
784
790
|
s[o] = i;
|
|
785
791
|
} else
|
|
786
|
-
for (const
|
|
787
|
-
n[
|
|
792
|
+
for (const c in a)
|
|
793
|
+
n[c] = 1;
|
|
788
794
|
}
|
|
789
|
-
for (const
|
|
790
|
-
|
|
791
|
-
return
|
|
795
|
+
for (const a in r)
|
|
796
|
+
a in t || (t[a] = void 0);
|
|
797
|
+
return t;
|
|
792
798
|
}
|
|
793
|
-
function
|
|
799
|
+
function Fe(s) {
|
|
794
800
|
return typeof s == "object" && s !== null ? s : {};
|
|
795
801
|
}
|
|
796
802
|
function z(s) {
|
|
797
803
|
s && s.c();
|
|
798
804
|
}
|
|
799
|
-
function C(s,
|
|
805
|
+
function C(s, e, t, r) {
|
|
800
806
|
const { fragment: n, after_update: o } = s.$$;
|
|
801
|
-
n && n.m(
|
|
802
|
-
const
|
|
803
|
-
s.$$.on_destroy ? s.$$.on_destroy.push(...
|
|
804
|
-
}), o.forEach(
|
|
807
|
+
n && n.m(e, t), r || S(() => {
|
|
808
|
+
const a = s.$$.on_mount.map(Q).filter(W);
|
|
809
|
+
s.$$.on_destroy ? s.$$.on_destroy.push(...a) : _(a), s.$$.on_mount = [];
|
|
810
|
+
}), o.forEach(S);
|
|
805
811
|
}
|
|
806
|
-
function I(s,
|
|
807
|
-
const
|
|
808
|
-
|
|
812
|
+
function I(s, e) {
|
|
813
|
+
const t = s.$$;
|
|
814
|
+
t.fragment !== null && (_(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
|
|
809
815
|
}
|
|
810
|
-
function
|
|
811
|
-
s.$$.dirty[0] === -1 && (y.push(s),
|
|
816
|
+
function Ve(s, e) {
|
|
817
|
+
s.$$.dirty[0] === -1 && (y.push(s), He(), s.$$.dirty.fill(0)), s.$$.dirty[e / 31 | 0] |= 1 << e % 31;
|
|
812
818
|
}
|
|
813
|
-
function
|
|
814
|
-
const
|
|
819
|
+
function Ye(s, e, t, r, n, o, a, i = [-1]) {
|
|
820
|
+
const c = N;
|
|
815
821
|
k(s);
|
|
816
822
|
const l = s.$$ = {
|
|
817
823
|
fragment: null,
|
|
818
824
|
ctx: [],
|
|
819
825
|
// state
|
|
820
826
|
props: o,
|
|
821
|
-
update:
|
|
827
|
+
update: P,
|
|
822
828
|
not_equal: n,
|
|
823
829
|
bound: D(),
|
|
824
830
|
// lifecycle
|
|
@@ -827,47 +833,47 @@ function Yt(s, t, e, r, n, o, c, i = [-1]) {
|
|
|
827
833
|
on_disconnect: [],
|
|
828
834
|
before_update: [],
|
|
829
835
|
after_update: [],
|
|
830
|
-
context: new Map(
|
|
836
|
+
context: new Map(e.context || (c ? c.$$.context : [])),
|
|
831
837
|
// everything else
|
|
832
838
|
callbacks: D(),
|
|
833
839
|
dirty: i,
|
|
834
840
|
skip_bound: !1,
|
|
835
|
-
root:
|
|
841
|
+
root: e.target || c.$$.root
|
|
836
842
|
};
|
|
837
|
-
|
|
843
|
+
a && a(l.root);
|
|
838
844
|
let u = !1;
|
|
839
|
-
if (l.ctx =
|
|
845
|
+
if (l.ctx = t ? t(s, e.props || {}, (d, p, ...M) => {
|
|
840
846
|
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 &&
|
|
842
|
-
}) : [], l.update(), u = !0, _(l.before_update), l.fragment = r ? r(l.ctx) : !1,
|
|
843
|
-
if (
|
|
844
|
-
const d =
|
|
847
|
+
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;
|
|
848
|
+
}) : [], l.update(), u = !0, _(l.before_update), l.fragment = r ? r(l.ctx) : !1, e.target) {
|
|
849
|
+
if (e.hydrate) {
|
|
850
|
+
const d = Le(e.target);
|
|
845
851
|
l.fragment && l.fragment.l(d), d.forEach(X);
|
|
846
852
|
} else
|
|
847
853
|
l.fragment && l.fragment.c();
|
|
848
|
-
|
|
854
|
+
e.intro && O(s.$$.fragment), C(s, e.target, e.anchor, e.customElement), Z();
|
|
849
855
|
}
|
|
850
|
-
k(
|
|
856
|
+
k(c);
|
|
851
857
|
}
|
|
852
|
-
class
|
|
858
|
+
class ze {
|
|
853
859
|
$destroy() {
|
|
854
|
-
I(this, 1), this.$destroy =
|
|
855
|
-
}
|
|
856
|
-
$on(
|
|
857
|
-
if (!W(
|
|
858
|
-
return
|
|
859
|
-
const r = this.$$.callbacks[
|
|
860
|
-
return r.push(
|
|
861
|
-
const n = r.indexOf(
|
|
860
|
+
I(this, 1), this.$destroy = P;
|
|
861
|
+
}
|
|
862
|
+
$on(e, t) {
|
|
863
|
+
if (!W(t))
|
|
864
|
+
return P;
|
|
865
|
+
const r = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
866
|
+
return r.push(t), () => {
|
|
867
|
+
const n = r.indexOf(t);
|
|
862
868
|
n !== -1 && r.splice(n, 1);
|
|
863
869
|
};
|
|
864
870
|
}
|
|
865
|
-
$set(
|
|
866
|
-
this.$$set && !
|
|
871
|
+
$set(e) {
|
|
872
|
+
this.$$set && !Ce(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
|
|
867
873
|
}
|
|
868
874
|
}
|
|
869
|
-
function
|
|
870
|
-
let
|
|
875
|
+
function Ke(s) {
|
|
876
|
+
let e, t, r;
|
|
871
877
|
const n = [
|
|
872
878
|
{ blok: (
|
|
873
879
|
/*blok*/
|
|
@@ -880,108 +886,108 @@ function Kt(s) {
|
|
|
880
886
|
/*component*/
|
|
881
887
|
s[1]
|
|
882
888
|
);
|
|
883
|
-
function
|
|
884
|
-
let
|
|
889
|
+
function a(i) {
|
|
890
|
+
let c = {};
|
|
885
891
|
for (let l = 0; l < n.length; l += 1)
|
|
886
|
-
|
|
887
|
-
return { props:
|
|
892
|
+
c = j(c, n[l]);
|
|
893
|
+
return { props: c };
|
|
888
894
|
}
|
|
889
|
-
return o && (
|
|
895
|
+
return o && (e = J(o, a())), {
|
|
890
896
|
c() {
|
|
891
|
-
|
|
897
|
+
e && z(e.$$.fragment), t = Me();
|
|
892
898
|
},
|
|
893
|
-
m(i,
|
|
894
|
-
|
|
899
|
+
m(i, c) {
|
|
900
|
+
e && C(e, i, c), Ae(i, t, c), r = !0;
|
|
895
901
|
},
|
|
896
|
-
p(i, [
|
|
897
|
-
const l =
|
|
898
|
-
5 ?
|
|
899
|
-
|
|
902
|
+
p(i, [c]) {
|
|
903
|
+
const l = c & /*blok, $$restProps*/
|
|
904
|
+
5 ? Je(n, [
|
|
905
|
+
c & /*blok*/
|
|
900
906
|
1 && { blok: (
|
|
901
907
|
/*blok*/
|
|
902
908
|
i[0]
|
|
903
909
|
) },
|
|
904
|
-
|
|
905
|
-
4 &&
|
|
910
|
+
c & /*$$restProps*/
|
|
911
|
+
4 && Fe(
|
|
906
912
|
/*$$restProps*/
|
|
907
913
|
i[2]
|
|
908
914
|
)
|
|
909
915
|
]) : {};
|
|
910
916
|
if (o !== (o = /*component*/
|
|
911
917
|
i[1])) {
|
|
912
|
-
if (
|
|
913
|
-
|
|
914
|
-
const u =
|
|
918
|
+
if (e) {
|
|
919
|
+
De();
|
|
920
|
+
const u = e;
|
|
915
921
|
Y(u.$$.fragment, 1, 0, () => {
|
|
916
922
|
I(u, 1);
|
|
917
|
-
}),
|
|
923
|
+
}), Be();
|
|
918
924
|
}
|
|
919
|
-
o ? (
|
|
925
|
+
o ? (e = J(o, a()), z(e.$$.fragment), O(e.$$.fragment, 1), C(e, t.parentNode, t)) : e = null;
|
|
920
926
|
} else
|
|
921
|
-
o &&
|
|
927
|
+
o && e.$set(l);
|
|
922
928
|
},
|
|
923
929
|
i(i) {
|
|
924
|
-
r || (
|
|
930
|
+
r || (e && O(e.$$.fragment, i), r = !0);
|
|
925
931
|
},
|
|
926
932
|
o(i) {
|
|
927
|
-
|
|
933
|
+
e && Y(e.$$.fragment, i), r = !1;
|
|
928
934
|
},
|
|
929
935
|
d(i) {
|
|
930
|
-
i && X(
|
|
936
|
+
i && X(t), e && I(e, i);
|
|
931
937
|
}
|
|
932
938
|
};
|
|
933
939
|
}
|
|
934
|
-
function
|
|
940
|
+
function Ge(s, e, t) {
|
|
935
941
|
const r = ["blok"];
|
|
936
|
-
let n = B(
|
|
937
|
-
return
|
|
938
|
-
|
|
939
|
-
}, [
|
|
942
|
+
let n = B(e, r), o, { blok: a } = e;
|
|
943
|
+
return a ? o = Qe(a.component) : console.error("Please provide a 'blok' property to the StoryblokComponent"), s.$$set = (i) => {
|
|
944
|
+
e = j(j({}, e), Ie(i)), t(2, n = B(e, r)), "blok" in i && t(0, a = i.blok);
|
|
945
|
+
}, [a, o, n];
|
|
940
946
|
}
|
|
941
|
-
class
|
|
942
|
-
constructor(
|
|
943
|
-
super(),
|
|
947
|
+
class et extends ze {
|
|
948
|
+
constructor(e) {
|
|
949
|
+
super(), Ye(this, e, Ge, Ke, Oe, { blok: 0 });
|
|
944
950
|
}
|
|
945
951
|
}
|
|
946
|
-
const
|
|
947
|
-
const
|
|
948
|
-
const n =
|
|
952
|
+
const tt = (s, e) => {
|
|
953
|
+
const t = (r) => {
|
|
954
|
+
const n = je(r);
|
|
949
955
|
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
956
|
};
|
|
951
|
-
return e
|
|
957
|
+
return t(e), {
|
|
952
958
|
update(r) {
|
|
953
|
-
|
|
959
|
+
t(r);
|
|
954
960
|
}
|
|
955
961
|
};
|
|
956
962
|
};
|
|
957
963
|
let A = null;
|
|
958
|
-
const
|
|
964
|
+
const st = () => (A || console.log(
|
|
959
965
|
"You can't use getStoryblokApi if you're not loading apiPlugin."
|
|
960
966
|
), A);
|
|
961
967
|
let $ = null;
|
|
962
|
-
const
|
|
963
|
-
const { storyblokApi:
|
|
964
|
-
A =
|
|
965
|
-
},
|
|
966
|
-
let
|
|
967
|
-
return
|
|
968
|
+
const rt = (s) => {
|
|
969
|
+
const { storyblokApi: e } = Se(s);
|
|
970
|
+
A = e, $ = s.components || {};
|
|
971
|
+
}, Qe = (s) => {
|
|
972
|
+
let e = null;
|
|
973
|
+
return e = typeof $ == "function" ? $()[s] : $[s], e || console.error(`You didn't load the ${s} component. Please load it in storyblokInit. For example:
|
|
968
974
|
storyblokInit({
|
|
969
975
|
accessToken: "<your-token>",
|
|
970
976
|
components: {
|
|
971
977
|
"teaser": Teaser
|
|
972
978
|
}
|
|
973
979
|
})
|
|
974
|
-
`),
|
|
980
|
+
`), e;
|
|
975
981
|
};
|
|
976
982
|
export {
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
983
|
+
Te as RichTextSchema,
|
|
984
|
+
et as StoryblokComponent,
|
|
985
|
+
We as apiPlugin,
|
|
986
|
+
Qe as getComponent,
|
|
987
|
+
st as getStoryblokApi,
|
|
988
|
+
Ze as renderRichText,
|
|
989
|
+
tt as storyblokEditable,
|
|
990
|
+
rt as storyblokInit,
|
|
991
|
+
st as useStoryblokApi,
|
|
992
|
+
Xe as useStoryblokBridge
|
|
987
993
|
};
|