@storyblok/svelte 2.4.8 → 2.4.10
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/README.md +261 -12
- package/{StoryblokComponent.svelte → dist/StoryblokComponent.svelte} +3 -2
- package/dist/StoryblokComponent.svelte.d.ts +18 -0
- package/dist/index.js +53 -0
- package/dist/types.js +1 -0
- package/package.json +17 -17
- package/dist/main.d.ts +0 -11
- package/dist/storyblok-svelte.js +0 -10
- package/dist/storyblok-svelte.mjs +0 -996
- package/dist/vite.config.d.ts +0 -2
- package/index.ts +0 -81
- package/types.ts +0 -35
|
@@ -1,996 +0,0 @@
|
|
|
1
|
-
let U = !1;
|
|
2
|
-
const H = [], ee = (s) => new Promise((e, t) => {
|
|
3
|
-
if (typeof window > "u" || (window.storyblokRegisterEvent = (n) => {
|
|
4
|
-
if (window.location === window.parent.location) {
|
|
5
|
-
console.warn("You are not in Draft Mode or in the Visual Editor.");
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
U ? n() : H.push(n);
|
|
9
|
-
}, document.getElementById("storyblok-javascript-bridge")))
|
|
10
|
-
return;
|
|
11
|
-
const r = document.createElement("script");
|
|
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
|
-
}, document.getElementsByTagName("head")[0].appendChild(r);
|
|
15
|
-
});
|
|
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
|
-
function q(s) {
|
|
18
|
-
return !(s !== s || s === 1 / 0 || s === -1 / 0);
|
|
19
|
-
}
|
|
20
|
-
function re(s, e, t) {
|
|
21
|
-
if (!q(e))
|
|
22
|
-
throw new TypeError("Expected `limit` to be a finite number");
|
|
23
|
-
if (!q(t))
|
|
24
|
-
throw new TypeError("Expected `interval` to be a finite number");
|
|
25
|
-
const r = [];
|
|
26
|
-
let n = [], o = 0;
|
|
27
|
-
const i = function() {
|
|
28
|
-
o++;
|
|
29
|
-
const c = setTimeout(function() {
|
|
30
|
-
o--, r.length > 0 && i(), n = n.filter(function(u) {
|
|
31
|
-
return u !== c;
|
|
32
|
-
});
|
|
33
|
-
}, t);
|
|
34
|
-
n.indexOf(c) < 0 && n.push(c);
|
|
35
|
-
const l = r.shift();
|
|
36
|
-
l.resolve(s.apply(l.self, l.args));
|
|
37
|
-
}, a = function(...c) {
|
|
38
|
-
const l = this;
|
|
39
|
-
return new Promise(function(u, d) {
|
|
40
|
-
r.push({
|
|
41
|
-
resolve: u,
|
|
42
|
-
reject: d,
|
|
43
|
-
args: c,
|
|
44
|
-
self: l
|
|
45
|
-
}), o < e && i();
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
return a.abort = function() {
|
|
49
|
-
n.forEach(clearTimeout), n = [], r.forEach(function(c) {
|
|
50
|
-
c.reject(function() {
|
|
51
|
-
Error.call(this, "Throttled function aborted"), this.name = "AbortError";
|
|
52
|
-
});
|
|
53
|
-
}), r.length = 0;
|
|
54
|
-
}, a;
|
|
55
|
-
}
|
|
56
|
-
const ne = function(s, e) {
|
|
57
|
-
const t = {};
|
|
58
|
-
for (const r in s) {
|
|
59
|
-
const n = s[r];
|
|
60
|
-
e.indexOf(r) > -1 && n !== null && (t[r] = n);
|
|
61
|
-
}
|
|
62
|
-
return t;
|
|
63
|
-
}, oe = (s) => s === "email", ie = () => ({
|
|
64
|
-
singleTag: "hr"
|
|
65
|
-
}), ae = () => ({
|
|
66
|
-
tag: "blockquote"
|
|
67
|
-
}), ce = () => ({
|
|
68
|
-
tag: "ul"
|
|
69
|
-
}), le = (s) => ({
|
|
70
|
-
tag: [
|
|
71
|
-
"pre",
|
|
72
|
-
{
|
|
73
|
-
tag: "code",
|
|
74
|
-
attrs: s.attrs
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
}), he = () => ({
|
|
78
|
-
singleTag: "br"
|
|
79
|
-
}), ue = (s) => ({
|
|
80
|
-
tag: `h${s.attrs.level}`
|
|
81
|
-
}), de = (s) => ({
|
|
82
|
-
singleTag: [
|
|
83
|
-
{
|
|
84
|
-
tag: "img",
|
|
85
|
-
attrs: ne(s.attrs, ["src", "alt", "title"])
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
}), fe = () => ({
|
|
89
|
-
tag: "li"
|
|
90
|
-
}), pe = () => ({
|
|
91
|
-
tag: "ol"
|
|
92
|
-
}), ge = () => ({
|
|
93
|
-
tag: "p"
|
|
94
|
-
}), me = () => ({
|
|
95
|
-
tag: "b"
|
|
96
|
-
}), ye = () => ({
|
|
97
|
-
tag: "strike"
|
|
98
|
-
}), ke = () => ({
|
|
99
|
-
tag: "u"
|
|
100
|
-
}), _e = () => ({
|
|
101
|
-
tag: "strong"
|
|
102
|
-
}), be = () => ({
|
|
103
|
-
tag: "code"
|
|
104
|
-
}), ve = () => ({
|
|
105
|
-
tag: "i"
|
|
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
|
-
tag: [
|
|
110
|
-
{
|
|
111
|
-
tag: "a",
|
|
112
|
-
attrs: e
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
};
|
|
116
|
-
}, $e = (s) => ({
|
|
117
|
-
tag: [
|
|
118
|
-
{
|
|
119
|
-
tag: "span",
|
|
120
|
-
attrs: s.attrs
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
}), Te = {
|
|
124
|
-
nodes: {
|
|
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
|
-
},
|
|
136
|
-
marks: {
|
|
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
|
-
"&": "&",
|
|
149
|
-
"<": "<",
|
|
150
|
-
">": ">",
|
|
151
|
-
'"': """,
|
|
152
|
-
"'": "'"
|
|
153
|
-
}, t = /[&<>"']/g, r = RegExp(t.source);
|
|
154
|
-
return s && r.test(s) ? s.replace(t, (n) => e[n]) : s;
|
|
155
|
-
};
|
|
156
|
-
class T {
|
|
157
|
-
constructor(e) {
|
|
158
|
-
h(this, "marks"), h(this, "nodes"), e || (e = Te), this.marks = e.marks || [], this.nodes = e.nodes || [];
|
|
159
|
-
}
|
|
160
|
-
addNode(e, t) {
|
|
161
|
-
this.nodes[e] = t;
|
|
162
|
-
}
|
|
163
|
-
addMark(e, t) {
|
|
164
|
-
this.marks[e] = t;
|
|
165
|
-
}
|
|
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
|
-
}
|
|
173
|
-
return console.warn(
|
|
174
|
-
"The render method must receive an object with a content field, which is an array"
|
|
175
|
-
), "";
|
|
176
|
-
}
|
|
177
|
-
renderNode(e) {
|
|
178
|
-
const t = [];
|
|
179
|
-
e.marks && e.marks.forEach((n) => {
|
|
180
|
-
const o = this.getMatchingMark(n);
|
|
181
|
-
o && t.push(this.renderOpeningTag(o.tag));
|
|
182
|
-
});
|
|
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
|
-
const o = this.getMatchingMark(n);
|
|
188
|
-
o && t.push(this.renderClosingTag(o.tag));
|
|
189
|
-
}), t.join("");
|
|
190
|
-
}
|
|
191
|
-
renderTag(e, t) {
|
|
192
|
-
return e.constructor === String ? `<${e}${t}>` : e.map((r) => {
|
|
193
|
-
if (r.constructor === String)
|
|
194
|
-
return `<${r}${t}>`;
|
|
195
|
-
{
|
|
196
|
-
let n = `<${r.tag}`;
|
|
197
|
-
if (r.attrs)
|
|
198
|
-
for (const o in r.attrs) {
|
|
199
|
-
const i = r.attrs[o];
|
|
200
|
-
i !== null && (n += ` ${o}="${i}"`);
|
|
201
|
-
}
|
|
202
|
-
return `${n}${t}>`;
|
|
203
|
-
}
|
|
204
|
-
}).join("");
|
|
205
|
-
}
|
|
206
|
-
renderOpeningTag(e) {
|
|
207
|
-
return this.renderTag(e, "");
|
|
208
|
-
}
|
|
209
|
-
renderClosingTag(e) {
|
|
210
|
-
return e.constructor === String ? `</${e}>` : e.slice(0).reverse().map((t) => t.constructor === String ? `</${t}>` : `</${t.tag}>`).join("");
|
|
211
|
-
}
|
|
212
|
-
getMatchingNode(e) {
|
|
213
|
-
const t = this.nodes[e.type];
|
|
214
|
-
if (typeof t == "function")
|
|
215
|
-
return t(e);
|
|
216
|
-
}
|
|
217
|
-
getMatchingMark(e) {
|
|
218
|
-
const t = this.marks[e.type];
|
|
219
|
-
if (typeof t == "function")
|
|
220
|
-
return t(e);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
class K {
|
|
224
|
-
constructor() {
|
|
225
|
-
h(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), h(this, "getOptionsPage", (e, t = 25, r = 1) => ({
|
|
226
|
-
...e,
|
|
227
|
-
per_page: t,
|
|
228
|
-
page: r
|
|
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
|
-
}
|
|
234
|
-
stringify(e, t, r) {
|
|
235
|
-
const n = [];
|
|
236
|
-
for (const o in e) {
|
|
237
|
-
if (!Object.prototype.hasOwnProperty.call(e, o))
|
|
238
|
-
continue;
|
|
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
|
-
}
|
|
247
|
-
return n.join("&");
|
|
248
|
-
}
|
|
249
|
-
}
|
|
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
|
-
}
|
|
254
|
-
get(e, t) {
|
|
255
|
-
return this.url = e, this.parameters = t, this._methodHandler("get");
|
|
256
|
-
}
|
|
257
|
-
post(e, t) {
|
|
258
|
-
return this.url = e, this.parameters = t, this._methodHandler("post");
|
|
259
|
-
}
|
|
260
|
-
put(e, t) {
|
|
261
|
-
return this.url = e, this.parameters = t, this._methodHandler("put");
|
|
262
|
-
}
|
|
263
|
-
delete(e, t) {
|
|
264
|
-
return this.url = e, this.parameters = t, this._methodHandler("delete");
|
|
265
|
-
}
|
|
266
|
-
async _responseHandler(e) {
|
|
267
|
-
const t = [], r = {
|
|
268
|
-
data: {},
|
|
269
|
-
headers: {},
|
|
270
|
-
status: 0,
|
|
271
|
-
statusText: ""
|
|
272
|
-
};
|
|
273
|
-
e.status !== 204 && await e.json().then((n) => {
|
|
274
|
-
r.data = n;
|
|
275
|
-
});
|
|
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
|
-
this.parameters
|
|
286
|
-
)}`;
|
|
287
|
-
} else
|
|
288
|
-
r = JSON.stringify(this.parameters);
|
|
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
|
-
try {
|
|
293
|
-
const c = await this.fetch(`${n}`, {
|
|
294
|
-
method: e,
|
|
295
|
-
headers: this.headers,
|
|
296
|
-
body: r,
|
|
297
|
-
signal: i
|
|
298
|
-
});
|
|
299
|
-
this.timeout && clearTimeout(a);
|
|
300
|
-
const l = await this._responseHandler(c);
|
|
301
|
-
return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(l)) : this._statusHandler(l);
|
|
302
|
-
} catch (c) {
|
|
303
|
-
return {
|
|
304
|
-
message: c
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
eject() {
|
|
309
|
-
this.ejectInterceptor = !0;
|
|
310
|
-
}
|
|
311
|
-
_statusHandler(e) {
|
|
312
|
-
const t = /20[0-6]/g;
|
|
313
|
-
return new Promise((r, n) => {
|
|
314
|
-
if (t.test(`${e.status}`))
|
|
315
|
-
return r(e);
|
|
316
|
-
const o = {
|
|
317
|
-
message: new Error(e.statusText),
|
|
318
|
-
status: e.status,
|
|
319
|
-
response: e.data.error || e.data.slug
|
|
320
|
-
};
|
|
321
|
-
n(o);
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
let b = {};
|
|
326
|
-
const g = {};
|
|
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`;
|
|
332
|
-
}
|
|
333
|
-
const r = new Headers();
|
|
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]);
|
|
336
|
-
});
|
|
337
|
-
let n = 5;
|
|
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,
|
|
341
|
-
headers: r,
|
|
342
|
-
responseInterceptor: e.responseInterceptor,
|
|
343
|
-
fetch: e.fetch
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
setComponentResolver(e) {
|
|
347
|
-
this.richTextResolver.addNode("blok", (t) => {
|
|
348
|
-
let r = "";
|
|
349
|
-
return t.attrs.body.forEach((n) => {
|
|
350
|
-
r += e(n.component, n);
|
|
351
|
-
}), {
|
|
352
|
-
html: r
|
|
353
|
-
};
|
|
354
|
-
});
|
|
355
|
-
}
|
|
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;
|
|
358
|
-
}
|
|
359
|
-
factoryParamOptions(e, t) {
|
|
360
|
-
return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
|
|
361
|
-
}
|
|
362
|
-
makeRequest(e, t, r, n) {
|
|
363
|
-
const o = this.factoryParamOptions(
|
|
364
|
-
e,
|
|
365
|
-
this.helpers.getOptionsPage(t, r, n)
|
|
366
|
-
);
|
|
367
|
-
return this.cacheResponse(e, o);
|
|
368
|
-
}
|
|
369
|
-
get(e, t) {
|
|
370
|
-
t || (t = {});
|
|
371
|
-
const r = `/${e}`, n = this.factoryParamOptions(r, t);
|
|
372
|
-
return this.cacheResponse(r, n);
|
|
373
|
-
}
|
|
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)
|
|
378
|
-
);
|
|
379
|
-
return this.helpers.flatMap(
|
|
380
|
-
[l, ...d],
|
|
381
|
-
(p) => Object.values(p.data[a])
|
|
382
|
-
);
|
|
383
|
-
}
|
|
384
|
-
post(e, t) {
|
|
385
|
-
const r = `/${e}`;
|
|
386
|
-
return Promise.resolve(this.throttle("post", r, t));
|
|
387
|
-
}
|
|
388
|
-
put(e, t) {
|
|
389
|
-
const r = `/${e}`;
|
|
390
|
-
return Promise.resolve(this.throttle("put", r, t));
|
|
391
|
-
}
|
|
392
|
-
delete(e, t) {
|
|
393
|
-
const r = `/${e}`;
|
|
394
|
-
return Promise.resolve(this.throttle("delete", r, t));
|
|
395
|
-
}
|
|
396
|
-
getStories(e) {
|
|
397
|
-
return this.get("cdn/stories", e);
|
|
398
|
-
}
|
|
399
|
-
getStory(e, t) {
|
|
400
|
-
return this.get(`cdn/stories/${e}`, t);
|
|
401
|
-
}
|
|
402
|
-
getToken() {
|
|
403
|
-
return this.accessToken;
|
|
404
|
-
}
|
|
405
|
-
ejectInterceptor() {
|
|
406
|
-
this.client.eject();
|
|
407
|
-
}
|
|
408
|
-
_cleanCopy(e) {
|
|
409
|
-
return JSON.parse(JSON.stringify(e));
|
|
410
|
-
}
|
|
411
|
-
_insertLinks(e, t) {
|
|
412
|
-
const r = e[t];
|
|
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]));
|
|
414
|
-
}
|
|
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) {
|
|
420
|
-
const n = [];
|
|
421
|
-
e[t].forEach((o) => {
|
|
422
|
-
this.relations[o] && n.push(this._cleanCopy(this.relations[o]));
|
|
423
|
-
}), e[t] = n;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
iterateTree(e, t) {
|
|
428
|
-
const r = (n) => {
|
|
429
|
-
if (n != null) {
|
|
430
|
-
if (n.constructor === Array)
|
|
431
|
-
for (let o = 0; o < n.length; o++)
|
|
432
|
-
r(n[o]);
|
|
433
|
-
else if (n.constructor === Object) {
|
|
434
|
-
if (n._stopResolving)
|
|
435
|
-
return;
|
|
436
|
-
for (const o in n)
|
|
437
|
-
(n.component && n._uid || n.type === "link") && (this._insertRelations(
|
|
438
|
-
n,
|
|
439
|
-
o,
|
|
440
|
-
t
|
|
441
|
-
), this._insertLinks(n, o)), r(n[o]);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
r(e.content);
|
|
446
|
-
}
|
|
447
|
-
async resolveLinks(e, t) {
|
|
448
|
-
let r = [];
|
|
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));
|
|
454
|
-
}
|
|
455
|
-
for (let a = 0; a < o.length; a++)
|
|
456
|
-
(await this.getStories({
|
|
457
|
-
per_page: i,
|
|
458
|
-
language: t.language,
|
|
459
|
-
version: t.version,
|
|
460
|
-
by_uuids: o[a].join(",")
|
|
461
|
-
})).data.stories.forEach(
|
|
462
|
-
(c) => {
|
|
463
|
-
r.push(c);
|
|
464
|
-
}
|
|
465
|
-
);
|
|
466
|
-
} else
|
|
467
|
-
r = e.links;
|
|
468
|
-
r.forEach((n) => {
|
|
469
|
-
this.links[n.uuid] = { ...n, _stopResolving: !0 };
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
async resolveRelations(e, t) {
|
|
473
|
-
let r = [];
|
|
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));
|
|
479
|
-
}
|
|
480
|
-
for (let a = 0; a < o.length; a++)
|
|
481
|
-
(await this.getStories({
|
|
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);
|
|
488
|
-
});
|
|
489
|
-
} else
|
|
490
|
-
r = e.rels;
|
|
491
|
-
r && r.length > 0 && r.forEach((n) => {
|
|
492
|
-
this.relations[n.uuid] = { ...n, _stopResolving: !0 };
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
async resolveStories(e, t) {
|
|
496
|
-
var r, n;
|
|
497
|
-
let 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);
|
|
503
|
-
});
|
|
504
|
-
}
|
|
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) => {
|
|
513
|
-
try {
|
|
514
|
-
(async () => {
|
|
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
|
-
}
|
|
526
|
-
})();
|
|
527
|
-
} catch {
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
throttledRequest(e, t, r) {
|
|
532
|
-
return this.client[e](t, r);
|
|
533
|
-
}
|
|
534
|
-
cacheVersions() {
|
|
535
|
-
return g;
|
|
536
|
-
}
|
|
537
|
-
cacheVersion() {
|
|
538
|
-
return g[this.accessToken];
|
|
539
|
-
}
|
|
540
|
-
setCacheVersion(e) {
|
|
541
|
-
this.accessToken && (g[this.accessToken] = e);
|
|
542
|
-
}
|
|
543
|
-
cacheProvider() {
|
|
544
|
-
switch (this.cache.type) {
|
|
545
|
-
case "memory":
|
|
546
|
-
return {
|
|
547
|
-
get(e) {
|
|
548
|
-
return Promise.resolve(b[e]);
|
|
549
|
-
},
|
|
550
|
-
getAll() {
|
|
551
|
-
return Promise.resolve(b);
|
|
552
|
-
},
|
|
553
|
-
set(e, t) {
|
|
554
|
-
return b[e] = t, Promise.resolve(void 0);
|
|
555
|
-
},
|
|
556
|
-
flush() {
|
|
557
|
-
return b = {}, Promise.resolve(void 0);
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
case "custom":
|
|
561
|
-
if (this.cache.custom)
|
|
562
|
-
return this.cache.custom;
|
|
563
|
-
default:
|
|
564
|
-
return {
|
|
565
|
-
get() {
|
|
566
|
-
return Promise.resolve(void 0);
|
|
567
|
-
},
|
|
568
|
-
getAll() {
|
|
569
|
-
return Promise.resolve(void 0);
|
|
570
|
-
},
|
|
571
|
-
set() {
|
|
572
|
-
return Promise.resolve(void 0);
|
|
573
|
-
},
|
|
574
|
-
flush() {
|
|
575
|
-
return Promise.resolve(void 0);
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
async flushCache() {
|
|
581
|
-
return await this.cacheProvider().flush(), this;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
const We = (s = {}) => {
|
|
585
|
-
const { apiOptions: e } = s;
|
|
586
|
-
if (!e.accessToken) {
|
|
587
|
-
console.error(
|
|
588
|
-
"You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
|
|
589
|
-
);
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
return { storyblokApi: new Pe(e) };
|
|
593
|
-
}, je = (s) => {
|
|
594
|
-
if (typeof s != "object" || typeof s._editable > "u")
|
|
595
|
-
return {};
|
|
596
|
-
const e = JSON.parse(
|
|
597
|
-
s._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
|
|
598
|
-
);
|
|
599
|
-
return {
|
|
600
|
-
"data-blok-c": JSON.stringify(e),
|
|
601
|
-
"data-blok-uid": e.id + "-" + e.uid
|
|
602
|
-
};
|
|
603
|
-
};
|
|
604
|
-
let x;
|
|
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") {
|
|
607
|
-
if (!s) {
|
|
608
|
-
console.warn("Story ID is not defined. Please provide a valid ID.");
|
|
609
|
-
return;
|
|
610
|
-
}
|
|
611
|
-
window.storyblokRegisterEvent(() => {
|
|
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();
|
|
614
|
-
});
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
}, Se = (s = {}) => {
|
|
618
|
-
var e, t;
|
|
619
|
-
const {
|
|
620
|
-
bridge: r,
|
|
621
|
-
accessToken: n,
|
|
622
|
-
use: o = [],
|
|
623
|
-
apiOptions: i = {},
|
|
624
|
-
richText: a = {}
|
|
625
|
-
} = s;
|
|
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) => {
|
|
636
|
-
let r = "";
|
|
637
|
-
return t.attrs.body.forEach((n) => {
|
|
638
|
-
r += e(n.component, n);
|
|
639
|
-
}), {
|
|
640
|
-
html: r
|
|
641
|
-
};
|
|
642
|
-
});
|
|
643
|
-
}, Ze = (s, e, t) => {
|
|
644
|
-
let r = t || x;
|
|
645
|
-
if (!r) {
|
|
646
|
-
console.error(
|
|
647
|
-
"Please initialize the Storyblok SDK before calling the renderRichText function"
|
|
648
|
-
);
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
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.
|
|
652
|
-
|
|
653
|
-
For more info about the richtext object check https://github.com/storyblok/storyblok-js#rendering-rich-text`), "");
|
|
654
|
-
};
|
|
655
|
-
function P() {
|
|
656
|
-
}
|
|
657
|
-
function j(s, e) {
|
|
658
|
-
for (const t in e)
|
|
659
|
-
s[t] = e[t];
|
|
660
|
-
return s;
|
|
661
|
-
}
|
|
662
|
-
function Q(s) {
|
|
663
|
-
return s();
|
|
664
|
-
}
|
|
665
|
-
function D() {
|
|
666
|
-
return /* @__PURE__ */ Object.create(null);
|
|
667
|
-
}
|
|
668
|
-
function _(s) {
|
|
669
|
-
s.forEach(Q);
|
|
670
|
-
}
|
|
671
|
-
function W(s) {
|
|
672
|
-
return typeof s == "function";
|
|
673
|
-
}
|
|
674
|
-
function Oe(s, e) {
|
|
675
|
-
return s != s ? e == e : s !== e || s && typeof s == "object" || typeof s == "function";
|
|
676
|
-
}
|
|
677
|
-
function Ce(s) {
|
|
678
|
-
return Object.keys(s).length === 0;
|
|
679
|
-
}
|
|
680
|
-
function Ie(s) {
|
|
681
|
-
const e = {};
|
|
682
|
-
for (const t in s)
|
|
683
|
-
t[0] !== "$" && (e[t] = s[t]);
|
|
684
|
-
return e;
|
|
685
|
-
}
|
|
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);
|
|
695
|
-
}
|
|
696
|
-
function X(s) {
|
|
697
|
-
s.parentNode && s.parentNode.removeChild(s);
|
|
698
|
-
}
|
|
699
|
-
function Ne(s) {
|
|
700
|
-
return document.createTextNode(s);
|
|
701
|
-
}
|
|
702
|
-
function Me() {
|
|
703
|
-
return Ne("");
|
|
704
|
-
}
|
|
705
|
-
function Le(s) {
|
|
706
|
-
return Array.from(s.childNodes);
|
|
707
|
-
}
|
|
708
|
-
function J(s, e) {
|
|
709
|
-
return new s(e);
|
|
710
|
-
}
|
|
711
|
-
let N;
|
|
712
|
-
function k(s) {
|
|
713
|
-
N = s;
|
|
714
|
-
}
|
|
715
|
-
const y = [], F = [], v = [], V = [], Ue = Promise.resolve();
|
|
716
|
-
let E = !1;
|
|
717
|
-
function He() {
|
|
718
|
-
E || (E = !0, Ue.then(Z));
|
|
719
|
-
}
|
|
720
|
-
function S(s) {
|
|
721
|
-
v.push(s);
|
|
722
|
-
}
|
|
723
|
-
const R = /* @__PURE__ */ new Set();
|
|
724
|
-
let m = 0;
|
|
725
|
-
function Z() {
|
|
726
|
-
if (m !== 0)
|
|
727
|
-
return;
|
|
728
|
-
const s = N;
|
|
729
|
-
do {
|
|
730
|
-
try {
|
|
731
|
-
for (; m < y.length; ) {
|
|
732
|
-
const e = y[m];
|
|
733
|
-
m++, k(e), qe(e.$$);
|
|
734
|
-
}
|
|
735
|
-
} catch (e) {
|
|
736
|
-
throw y.length = 0, m = 0, e;
|
|
737
|
-
}
|
|
738
|
-
for (k(null), y.length = 0, m = 0; F.length; )
|
|
739
|
-
F.pop()();
|
|
740
|
-
for (let e = 0; e < v.length; e += 1) {
|
|
741
|
-
const t = v[e];
|
|
742
|
-
R.has(t) || (R.add(t), t());
|
|
743
|
-
}
|
|
744
|
-
v.length = 0;
|
|
745
|
-
} while (y.length);
|
|
746
|
-
for (; V.length; )
|
|
747
|
-
V.pop()();
|
|
748
|
-
E = !1, R.clear(), k(s);
|
|
749
|
-
}
|
|
750
|
-
function qe(s) {
|
|
751
|
-
if (s.fragment !== null) {
|
|
752
|
-
s.update(), _(s.before_update);
|
|
753
|
-
const e = s.dirty;
|
|
754
|
-
s.dirty = [-1], s.fragment && s.fragment.p(s.ctx, e), s.after_update.forEach(S);
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
const w = /* @__PURE__ */ new Set();
|
|
758
|
-
let f;
|
|
759
|
-
function De() {
|
|
760
|
-
f = {
|
|
761
|
-
r: 0,
|
|
762
|
-
c: [],
|
|
763
|
-
p: f
|
|
764
|
-
// parent group
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
function Be() {
|
|
768
|
-
f.r || _(f.c), f = f.p;
|
|
769
|
-
}
|
|
770
|
-
function O(s, e) {
|
|
771
|
-
s && s.i && (w.delete(s), s.i(e));
|
|
772
|
-
}
|
|
773
|
-
function Y(s, e, t, r) {
|
|
774
|
-
if (s && s.o) {
|
|
775
|
-
if (w.has(s))
|
|
776
|
-
return;
|
|
777
|
-
w.add(s), f.c.push(() => {
|
|
778
|
-
w.delete(s), r && (t && s.d(1), r());
|
|
779
|
-
}), s.o(e);
|
|
780
|
-
} else
|
|
781
|
-
r && r();
|
|
782
|
-
}
|
|
783
|
-
function Je(s, e) {
|
|
784
|
-
const t = {}, r = {}, n = { $$scope: 1 };
|
|
785
|
-
let o = s.length;
|
|
786
|
-
for (; o--; ) {
|
|
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;
|
|
794
|
-
} else
|
|
795
|
-
for (const c in i)
|
|
796
|
-
n[c] = 1;
|
|
797
|
-
}
|
|
798
|
-
for (const i in r)
|
|
799
|
-
i in t || (t[i] = void 0);
|
|
800
|
-
return t;
|
|
801
|
-
}
|
|
802
|
-
function Fe(s) {
|
|
803
|
-
return typeof s == "object" && s !== null ? s : {};
|
|
804
|
-
}
|
|
805
|
-
function z(s) {
|
|
806
|
-
s && s.c();
|
|
807
|
-
}
|
|
808
|
-
function C(s, e, t, r) {
|
|
809
|
-
const { fragment: n, after_update: o } = s.$$;
|
|
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);
|
|
814
|
-
}
|
|
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 = []);
|
|
818
|
-
}
|
|
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;
|
|
821
|
-
}
|
|
822
|
-
function Ye(s, e, t, r, n, o, i, a = [-1]) {
|
|
823
|
-
const c = N;
|
|
824
|
-
k(s);
|
|
825
|
-
const l = s.$$ = {
|
|
826
|
-
fragment: null,
|
|
827
|
-
ctx: [],
|
|
828
|
-
// state
|
|
829
|
-
props: o,
|
|
830
|
-
update: P,
|
|
831
|
-
not_equal: n,
|
|
832
|
-
bound: D(),
|
|
833
|
-
// lifecycle
|
|
834
|
-
on_mount: [],
|
|
835
|
-
on_destroy: [],
|
|
836
|
-
on_disconnect: [],
|
|
837
|
-
before_update: [],
|
|
838
|
-
after_update: [],
|
|
839
|
-
context: new Map(e.context || (c ? c.$$.context : [])),
|
|
840
|
-
// everything else
|
|
841
|
-
callbacks: D(),
|
|
842
|
-
dirty: a,
|
|
843
|
-
skip_bound: !1,
|
|
844
|
-
root: e.target || c.$$.root
|
|
845
|
-
};
|
|
846
|
-
i && i(l.root);
|
|
847
|
-
let u = !1;
|
|
848
|
-
if (l.ctx = t ? t(s, e.props || {}, (d, p, ...M) => {
|
|
849
|
-
const L = M.length ? M[0] : p;
|
|
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);
|
|
854
|
-
l.fragment && l.fragment.l(d), d.forEach(X);
|
|
855
|
-
} else
|
|
856
|
-
l.fragment && l.fragment.c();
|
|
857
|
-
e.intro && O(s.$$.fragment), C(s, e.target, e.anchor, e.customElement), Z();
|
|
858
|
-
}
|
|
859
|
-
k(c);
|
|
860
|
-
}
|
|
861
|
-
class ze {
|
|
862
|
-
$destroy() {
|
|
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);
|
|
871
|
-
n !== -1 && r.splice(n, 1);
|
|
872
|
-
};
|
|
873
|
-
}
|
|
874
|
-
$set(e) {
|
|
875
|
-
this.$$set && !Ce(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
function Ke(s) {
|
|
879
|
-
let e, t, r;
|
|
880
|
-
const n = [
|
|
881
|
-
{ blok: (
|
|
882
|
-
/*blok*/
|
|
883
|
-
s[0]
|
|
884
|
-
) },
|
|
885
|
-
/*$$restProps*/
|
|
886
|
-
s[2]
|
|
887
|
-
];
|
|
888
|
-
var o = (
|
|
889
|
-
/*component*/
|
|
890
|
-
s[1]
|
|
891
|
-
);
|
|
892
|
-
function i(a) {
|
|
893
|
-
let c = {};
|
|
894
|
-
for (let l = 0; l < n.length; l += 1)
|
|
895
|
-
c = j(c, n[l]);
|
|
896
|
-
return { props: c };
|
|
897
|
-
}
|
|
898
|
-
return o && (e = J(o, i())), {
|
|
899
|
-
c() {
|
|
900
|
-
e && z(e.$$.fragment), t = Me();
|
|
901
|
-
},
|
|
902
|
-
m(a, c) {
|
|
903
|
-
e && C(e, a, c), Ae(a, t, c), r = !0;
|
|
904
|
-
},
|
|
905
|
-
p(a, [c]) {
|
|
906
|
-
const l = c & /*blok, $$restProps*/
|
|
907
|
-
5 ? Je(n, [
|
|
908
|
-
c & /*blok*/
|
|
909
|
-
1 && { blok: (
|
|
910
|
-
/*blok*/
|
|
911
|
-
a[0]
|
|
912
|
-
) },
|
|
913
|
-
c & /*$$restProps*/
|
|
914
|
-
4 && Fe(
|
|
915
|
-
/*$$restProps*/
|
|
916
|
-
a[2]
|
|
917
|
-
)
|
|
918
|
-
]) : {};
|
|
919
|
-
if (o !== (o = /*component*/
|
|
920
|
-
a[1])) {
|
|
921
|
-
if (e) {
|
|
922
|
-
De();
|
|
923
|
-
const u = e;
|
|
924
|
-
Y(u.$$.fragment, 1, 0, () => {
|
|
925
|
-
I(u, 1);
|
|
926
|
-
}), Be();
|
|
927
|
-
}
|
|
928
|
-
o ? (e = J(o, i()), z(e.$$.fragment), O(e.$$.fragment, 1), C(e, t.parentNode, t)) : e = null;
|
|
929
|
-
} else
|
|
930
|
-
o && e.$set(l);
|
|
931
|
-
},
|
|
932
|
-
i(a) {
|
|
933
|
-
r || (e && O(e.$$.fragment, a), r = !0);
|
|
934
|
-
},
|
|
935
|
-
o(a) {
|
|
936
|
-
e && Y(e.$$.fragment, a), r = !1;
|
|
937
|
-
},
|
|
938
|
-
d(a) {
|
|
939
|
-
a && X(t), e && I(e, a);
|
|
940
|
-
}
|
|
941
|
-
};
|
|
942
|
-
}
|
|
943
|
-
function Ge(s, e, t) {
|
|
944
|
-
const r = ["blok"];
|
|
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];
|
|
949
|
-
}
|
|
950
|
-
class et extends ze {
|
|
951
|
-
constructor(e) {
|
|
952
|
-
super(), Ye(this, e, Ge, Ke, Oe, { blok: 0 });
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
const tt = (s, e) => {
|
|
956
|
-
const t = (r) => {
|
|
957
|
-
const n = je(r);
|
|
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"));
|
|
959
|
-
};
|
|
960
|
-
return t(e), {
|
|
961
|
-
update(r) {
|
|
962
|
-
t(r);
|
|
963
|
-
}
|
|
964
|
-
};
|
|
965
|
-
};
|
|
966
|
-
let A = null;
|
|
967
|
-
const st = () => (A || console.log(
|
|
968
|
-
"You can't use getStoryblokApi if you're not loading apiPlugin."
|
|
969
|
-
), A);
|
|
970
|
-
let $ = null;
|
|
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:
|
|
977
|
-
storyblokInit({
|
|
978
|
-
accessToken: "<your-token>",
|
|
979
|
-
components: {
|
|
980
|
-
"teaser": Teaser
|
|
981
|
-
}
|
|
982
|
-
})
|
|
983
|
-
`), e;
|
|
984
|
-
};
|
|
985
|
-
export {
|
|
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
|
|
996
|
-
};
|