@storyblok/react 4.3.1 → 4.3.3
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 +4 -4
- package/dist/common/client.d.ts +1 -1
- package/dist/common/index.d.ts +3 -3
- package/dist/common/storyblok-component.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/richtext.d.ts +2 -2
- package/dist/rsc/common.d.ts +3 -3
- package/dist/rsc/server-component.d.ts +2 -2
- package/dist/rsc/story.d.ts +2 -2
- package/dist/storyblok-js.js +2 -2
- package/dist/storyblok-js.mjs +504 -459
- package/dist/storyblok-rich-text.d.ts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +1 -1
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
</p>
|
|
32
32
|
|
|
33
33
|
## Kickstart a new project
|
|
34
|
-
Are you eager to dive into coding? **[Follow these steps to kickstart a new project with Storyblok and React](https://www.storyblok.com/technologies
|
|
34
|
+
Are you eager to dive into coding? **[Follow these steps to kickstart a new project with Storyblok and React](https://www.storyblok.com/technologies?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-react#react)**, and get started in just a few minutes!
|
|
35
35
|
|
|
36
36
|
## 5-minute Tutorial
|
|
37
37
|
Are you looking for a hands-on, step-by-step tutorial? The **[React 5-minute Tutorial](https://www.storyblok.com/tp/headless-cms-react?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-react)** has you covered! It provides comprehensive instructions on how to set up a Storyblok space and connect it to your React project.
|
|
@@ -60,7 +60,7 @@ Install the file from the CDN:
|
|
|
60
60
|
|
|
61
61
|
## Initialization
|
|
62
62
|
|
|
63
|
-
Register the plugin on your application and add the [access token](https://www.storyblok.com/docs/api/content-delivery
|
|
63
|
+
Register the plugin on your application and add the [access token](https://www.storyblok.com/docs/api/content-delivery/v2/getting-started/authentication?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-react) of your Storyblok space. You can also add the `apiPlugin` in case that you want to use the Storyblok API Client:
|
|
64
64
|
|
|
65
65
|
```js
|
|
66
66
|
import { apiPlugin, storyblokInit } from '@storyblok/react'
|
|
@@ -89,7 +89,7 @@ storyblokInit({
|
|
|
89
89
|
|
|
90
90
|
Add all your components to the components object in the `storyblokInit` function.
|
|
91
91
|
|
|
92
|
-
That's it! All the features are enabled for you: the _Api Client_ for interacting with [Storyblok CDN API](https://www.storyblok.com/docs/api/content-delivery
|
|
92
|
+
That's it! All the features are enabled for you: the _Api Client_ for interacting with [Storyblok CDN API](https://www.storyblok.com/docs/api/content-delivery/v2/getting-started/introduction?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-react), and _Storyblok Bridge_ for [real-time visual editing experience](https://www.storyblok.com/docs/guide/essentials/visual-editor?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-react).
|
|
93
93
|
|
|
94
94
|
> You can enable/disable some of these features if you don't need them, so you save some KB. Please read the "Features and API" section
|
|
95
95
|
|
|
@@ -759,7 +759,7 @@ By using these techniques, you can ensure that only the necessary components and
|
|
|
759
759
|
|
|
760
760
|
## Contributing
|
|
761
761
|
|
|
762
|
-
Please see our [contributing guidelines](https://github.com/storyblok/.github/blob/master/contributing.md) and our [code of conduct](https://www.storyblok.com/trust-center
|
|
762
|
+
Please see our [contributing guidelines](https://github.com/storyblok/.github/blob/master/contributing.md) and our [code of conduct](https://www.storyblok.com/trust-center?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-react#code-of-conduct).
|
|
763
763
|
This project use [semantic-release](https://semantic-release.gitbook.io/semantic-release/) for generate new versions by using commit messages and we use the Angular Convention to naming the commits. Check [this question](https://semantic-release.gitbook.io/semantic-release/support/faq#how-can-i-change-the-type-of-commits-that-trigger-a-release) about it in semantic-release FAQ.
|
|
764
764
|
|
|
765
765
|
Please run `simple-git-hooks` after cloning the repository to enable the pre-commit hooks.
|
package/dist/common/client.d.ts
CHANGED
package/dist/common/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SbReactComponentsMap, SbReactSDKOptions, StoryblokClient } from '../types';
|
|
2
2
|
export * from '../types';
|
|
3
3
|
export declare const useStoryblokApi: () => StoryblokClient;
|
|
4
4
|
export declare const setComponents: (newComponentsMap: SbReactComponentsMap) => SbReactComponentsMap;
|
|
5
|
-
export declare const getComponent: (componentKey: string) => false | import(
|
|
5
|
+
export declare const getComponent: (componentKey: string) => false | import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements>;
|
|
6
6
|
export declare const getEnableFallbackComponent: () => boolean;
|
|
7
|
-
export declare const getCustomFallbackComponent: () => import(
|
|
7
|
+
export declare const getCustomFallbackComponent: () => import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements>;
|
|
8
8
|
export declare const storyblokInit: (pluginOptions?: SbReactSDKOptions) => void;
|
|
9
9
|
export { useStoryblokApi as getStoryblokApi };
|
|
10
10
|
export { default as StoryblokComponent } from './storyblok-component';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SbBlokData } from '../types';
|
|
2
2
|
interface StoryblokComponentProps extends Omit<Record<string, unknown>, 'blok'> {
|
|
3
3
|
blok: SbBlokData;
|
|
4
4
|
}
|
|
5
|
-
declare const StoryblokComponent: import(
|
|
5
|
+
declare const StoryblokComponent: import('react').ForwardRefExoticComponent<Omit<StoryblokComponentProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
|
|
6
6
|
export default StoryblokComponent;
|
|
7
7
|
//# sourceMappingURL=storyblok-component.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const useStoryblok: (slug: string, apiOptions?: ISbStoriesParams, bridgeOptions?: StoryblokBridgeConfigV2) => ISbStoryData<import(
|
|
1
|
+
import { ISbStoriesParams, ISbStoryData, StoryblokBridgeConfigV2 } from './types';
|
|
2
|
+
export declare const useStoryblok: (slug: string, apiOptions?: ISbStoriesParams, bridgeOptions?: StoryblokBridgeConfigV2) => ISbStoryData<import('@storyblok/js').StoryblokComponentType<string> & {
|
|
3
3
|
[index: string]: any;
|
|
4
4
|
}>;
|
|
5
5
|
export * from './common/client';
|
package/dist/richtext.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { StoryblokRichTextNode, StoryblokRichTextOptions } from '@storyblok/js';
|
|
3
3
|
export declare function componentResolver(node: StoryblokRichTextNode<React.ReactElement>): React.ReactElement;
|
|
4
4
|
export declare function useStoryblokRichTextResolver(options: StoryblokRichTextOptions<React.ReactElement>): {
|
|
5
5
|
render: (node: StoryblokRichTextNode<React.ReactNode>) => React.ReactNode;
|
package/dist/rsc/common.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SbReactComponentsMap, SbReactSDKOptions, StoryblokClient } from '../types';
|
|
2
2
|
export declare const useStoryblokApi: () => StoryblokClient;
|
|
3
|
-
export declare const setComponents: (newComponentsMap: SbReactComponentsMap) => Map<string, import(
|
|
3
|
+
export declare const setComponents: (newComponentsMap: SbReactComponentsMap) => Map<string, import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements>>;
|
|
4
4
|
export declare const getComponent: (componentKey: string) => React.ElementType | false;
|
|
5
5
|
export declare const getEnableFallbackComponent: () => boolean;
|
|
6
|
-
export declare const getCustomFallbackComponent: () => import(
|
|
6
|
+
export declare const getCustomFallbackComponent: () => import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements>;
|
|
7
7
|
export declare const storyblokInit: (pluginOptions?: SbReactSDKOptions) => (() => StoryblokClient);
|
|
8
8
|
export * from '../types';
|
|
9
9
|
export { useStoryblokApi as getStoryblokApi };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SbBlokData } from '../types';
|
|
2
2
|
interface SbServerComponentProps extends Omit<Record<string, unknown>, 'blok'> {
|
|
3
3
|
blok: SbBlokData;
|
|
4
4
|
}
|
|
5
|
-
declare const StoryblokServerComponent: import(
|
|
5
|
+
declare const StoryblokServerComponent: import('react').ForwardRefExoticComponent<Omit<SbServerComponentProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
|
|
6
6
|
export default StoryblokServerComponent;
|
|
7
7
|
//# sourceMappingURL=server-component.d.ts.map
|
package/dist/rsc/story.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ISbStoryData, StoryblokBridgeConfigV2 } from '../types';
|
|
2
2
|
interface StoryblokStoryProps extends Omit<Record<string, unknown>, 'story' | 'bridgeOptions'> {
|
|
3
3
|
story: ISbStoryData;
|
|
4
4
|
bridgeOptions?: StoryblokBridgeConfigV2;
|
|
5
5
|
}
|
|
6
|
-
declare const StoryblokStory: import(
|
|
6
|
+
declare const StoryblokStory: import('react').ForwardRefExoticComponent<Omit<StoryblokStoryProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
|
|
7
7
|
export default StoryblokStory;
|
|
8
8
|
//# sourceMappingURL=story.d.ts.map
|
package/dist/storyblok-js.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let U=!1;const z=[],G=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let U=!1;const z=[],G=o=>new Promise((e,t)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=s=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}U?s():z.push(s)},document.getElementById("storyblok-javascript-bridge")))return;const r=document.createElement("script");r.async=!0,r.src=o,r.id="storyblok-javascript-bridge",r.onerror=s=>t(s),r.onload=s=>{z.forEach(n=>n()),U=!0,e(s)},document.getElementsByTagName("head")[0].appendChild(r)});var te=Object.defineProperty,re=(o,e,t)=>e in o?te(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,p=(o,e,t)=>re(o,typeof e!="symbol"?e+"":e,t);class se extends Error{constructor(e){super(e),this.name="AbortError"}}function oe(o,e,t){if(!Number.isFinite(e))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(t))throw new TypeError("Expected `interval` to be a finite number");const r=[];let s=[],n=0,i=!1;const l=async()=>{n++;const h=r.shift();if(h)try{const d=await o(...h.args);h.resolve(d)}catch(d){h.reject(d)}const u=setTimeout(()=>{n--,r.length>0&&l(),s=s.filter(d=>d!==u)},t);s.includes(u)||s.push(u)},a=(...h)=>i?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((u,d)=>{r.push({resolve:u,reject:d,args:h}),n<e&&l()});return a.abort=()=>{i=!0,s.forEach(clearTimeout),s=[],r.forEach(h=>h.reject(()=>new se("Throttle function aborted"))),r.length=0},a}class L{constructor(){p(this,"isCDNUrl",(e="")=>e.includes("/cdn/")),p(this,"getOptionsPage",(e,t=25,r=1)=>({...e,per_page:t,page:r})),p(this,"delay",e=>new Promise(t=>setTimeout(t,e))),p(this,"arrayFrom",(e=0,t)=>Array.from({length:e},t)),p(this,"range",(e=0,t=e)=>{const r=Math.abs(t-e)||0,s=e<t?1:-1;return this.arrayFrom(r,(n,i)=>i*s+e)}),p(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),p(this,"flatMap",(e=[],t)=>e.map(t).reduce((r,s)=>[...r,...s],[])),p(this,"escapeHTML",function(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"},r=/[&<>"']/g,s=new RegExp(r.source);return e&&s.test(e)?e.replace(r,n=>t[n]):e})}stringify(e,t,r){const s=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const i=e[n],l=r?"":encodeURIComponent(n);let a;typeof i=="object"?a=this.stringify(i,t?t+encodeURIComponent(`[${l}]`):l,Array.isArray(i)):a=`${t?t+encodeURIComponent(`[${l}]`):l}=${encodeURIComponent(i)}`,s.push(a)}return s.join("&")}getRegionURL(e){const t="api.storyblok.com",r="api-us.storyblok.com",s="app.storyblokchina.cn",n="api-ap.storyblok.com",i="api-ca.storyblok.com";switch(e){case"us":return r;case"cn":return s;case"ap":return n;case"ca":return i;default:return t}}}const ne=function(o,e){const t={};for(const r in o){const s=o[r];e.includes(r)&&s!==null&&(t[r]=s)}return t},ie=o=>o==="email",ae=()=>({singleTag:"hr"}),le=()=>({tag:"blockquote"}),ce=()=>({tag:"ul"}),he=o=>({tag:["pre",{tag:"code",attrs:o.attrs}]}),ue=()=>({singleTag:"br"}),de=o=>({tag:`h${o.attrs.level}`}),pe=o=>({singleTag:[{tag:"img",attrs:ne(o.attrs,["src","alt","title"])}]}),ge=()=>({tag:"li"}),me=()=>({tag:"ol"}),fe=()=>({tag:"p"}),ye=o=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":o.attrs.name,emoji:o.attrs.emoji}}]}),be=()=>({tag:"b"}),ke=()=>({tag:"s"}),ve=()=>({tag:"u"}),$e=()=>({tag:"strong"}),Te=()=>({tag:"code"}),we=()=>({tag:"i"}),Re=o=>{if(!o.attrs)return{tag:""};const e=new L().escapeHTML,t={...o.attrs},{linktype:r="url"}=o.attrs;if(delete t.linktype,t.href&&(t.href=e(o.attrs.href||"")),ie(r)&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),t.custom){for(const s in t.custom)t[s]=t.custom[s];delete t.custom}return{tag:[{tag:"a",attrs:t}]}},_e=o=>({tag:[{tag:"span",attrs:o.attrs}]}),Se=()=>({tag:"sub"}),Ee=()=>({tag:"sup"}),je=o=>({tag:[{tag:"span",attrs:o.attrs}]}),Ie=o=>{var e;return(e=o.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${o.attrs.color};`}}]}:{tag:""}},Oe=o=>{var e;return(e=o.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${o.attrs.color}`}}]}:{tag:""}},V={nodes:{horizontal_rule:ae,blockquote:le,bullet_list:ce,code_block:he,hard_break:ue,heading:de,image:pe,list_item:ge,ordered_list:me,paragraph:fe,emoji:ye},marks:{bold:be,strike:ke,underline:ve,strong:$e,code:Te,italic:we,link:Re,styled:_e,subscript:Se,superscript:Ee,anchor:je,highlight:Ie,textStyle:Oe}},xe=function(o){const e={"&":"&","<":"<",">":">",'"':""","'":"'"},t=/[&<>"']/g,r=new RegExp(t.source);return o&&r.test(o)?o.replace(t,s=>e[s]):o};let D=!1;class Ae{constructor(e){p(this,"marks"),p(this,"nodes"),e||(e=V),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e,t={optimizeImages:!1},r=!0){if(!D&&r&&(console.warn("Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` package instead. https://github.com/storyblok/richtext/"),D=!0),e&&e.content&&Array.isArray(e.content)){let s="";return e.content.forEach(n=>{s+=this.renderNode(n)}),t.optimizeImages?this.optimizeImages(s,t.optimizeImages):s}return console.warn(`The render method must receive an Object with a "content" field.
|
|
2
2
|
The "content" field must be an array of nodes as the type ISbRichtext.
|
|
3
3
|
ISbRichtext:
|
|
4
4
|
content?: ISbRichtext[]
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
type: 'doc'
|
|
24
|
-
}`),""}optimizeImages(e,t){let s=0,o=0,n="",i="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(n+=`width="${t.width}" `,s=t.width),typeof t.height=="number"&&t.height>0&&(n+=`height="${t.height}" `,o=t.height),(t.loading==="lazy"||t.loading==="eager")&&(n+=`loading="${t.loading}" `),typeof t.class=="string"&&t.class.length>0&&(n+=`class="${t.class}" `),t.filters&&(typeof t.filters.blur=="number"&&t.filters.blur>=0&&t.filters.blur<=100&&(i+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(i+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-F]{6}/gi)||t.filters.fill==="transparent")&&(i+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(i+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(i+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(i+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(i+=`:rotate(${t.filters.rotate})`),i.length>0&&(i=`/filters${i}`))),n.length>0&&(e=e.replace(/<img/g,`<img ${n.trim()}`));const l=s>0||o>0||i.length>0?`${s}x${o}${i}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${l}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,a=>{var h,u;const d=a.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(d&&d.length>0){const g={srcset:(h=t.srcset)==null?void 0:h.map(y=>{if(typeof y=="number")return`//${d}/m/${y}x0${i} ${y}w`;if(typeof y=="object"&&y.length===2){let w=0,O=0;return typeof y[0]=="number"&&(w=y[0]),typeof y[1]=="number"&&(O=y[1]),`//${d}/m/${w}x${O}${i} ${w}w`}return""}).join(", "),sizes:(u=t.sizes)==null?void 0:u.map(y=>y).join(", ")};let R="";return g.srcset&&(R+=`srcset="${g.srcset}" `),g.sizes&&(R+=`sizes="${g.sizes}" `),a.replace(/<img/g,`<img ${R.trim()}`)}return a})),e}renderNode(e){const t=[];e.marks&&e.marks.forEach(o=>{const n=this.getMatchingMark(o);n&&n.tag!==""&&t.push(this.renderOpeningTag(n.tag))});const s=this.getMatchingNode(e);return s&&s.tag&&t.push(this.renderOpeningTag(s.tag)),e.content?e.content.forEach(o=>{t.push(this.renderNode(o))}):e.text?t.push(Ie(e.text)):s&&s.singleTag?t.push(this.renderTag(s.singleTag," /")):s&&s.html?t.push(s.html):e.type==="emoji"&&t.push(this.renderEmoji(e)),s&&s.tag&&t.push(this.renderClosingTag(s.tag)),e.marks&&e.marks.slice(0).reverse().forEach(o=>{const n=this.getMatchingMark(o);n&&n.tag!==""&&t.push(this.renderClosingTag(n.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(s=>{if(s.constructor===String)return`<${s}${t}>`;{let o=`<${s.tag}`;if(s.attrs){for(const n in s.attrs)if(Object.prototype.hasOwnProperty.call(s.attrs,n)){const i=s.attrs[n];i!==null&&(o+=` ${n}="${i}"`)}}return`${o}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(t=>t.constructor===String?`</${t}>`:`</${t.tag}>`).join("")}getMatchingNode(e){const t=this.nodes[e.type];if(typeof t=="function")return t(e)}getMatchingMark(e){const t=this.marks[e.type];if(typeof t=="function")return t(e)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const t=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(t," /")}}const I=Oe;class xe{constructor(e){p(this,"baseURL"),p(this,"timeout"),p(this,"headers"),p(this,"responseInterceptor"),p(this,"fetch"),p(this,"ejectInterceptor"),p(this,"url"),p(this,"parameters"),p(this,"fetchOptions"),this.baseURL=e.baseURL,this.headers=e.headers||new Headers,this.timeout=e!=null&&e.timeout?e.timeout*1e3:0,this.responseInterceptor=e.responseInterceptor,this.fetch=(...t)=>e.fetch?e.fetch(...t):fetch(...t),this.ejectInterceptor=!1,this.url="",this.parameters={},this.fetchOptions={}}get(e,t){return this.url=e,this.parameters=t,this._methodHandler("get")}post(e,t){return this.url=e,this.parameters=t,this._methodHandler("post")}put(e,t){return this.url=e,this.parameters=t,this._methodHandler("put")}delete(e,t){return this.url=e,this.parameters=t,this._methodHandler("delete")}async _responseHandler(e){const t=[],s={data:{},headers:{},status:0,statusText:""};e.status!==204&&await e.json().then(o=>{s.data=o});for(const o of e.headers.entries())t[o[0]]=o[1];return s.headers={...t},s.status=e.status,s.statusText=e.statusText,s}async _methodHandler(e){let t=`${this.baseURL}${this.url}`,s=null;if(e==="get"){const a=new A;t=`${this.baseURL}${this.url}?${a.stringify(this.parameters)}`}else s=JSON.stringify(this.parameters);const o=new URL(t),n=new AbortController,{signal:i}=n;let l;this.timeout&&(l=setTimeout(()=>n.abort(),this.timeout));try{const a=await this.fetch(`${o}`,{method:e,headers:this.headers,body:s,signal:i,...this.fetchOptions});this.timeout&&clearTimeout(l);const h=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(h)):this._statusHandler(h)}catch(a){return{message:a}}}setFetchOptions(e={}){Object.keys(e).length>0&&"method"in e&&delete e.method,this.fetchOptions={...e}}eject(){this.ejectInterceptor=!0}_statusHandler(e){const t=/20[0-6]/g;return new Promise((s,o)=>{if(t.test(`${e.status}`))return s(e);const n={message:e.statusText,status:e.status,response:Array.isArray(e.data)?e.data[0]:e.data.error||e.data.slug};o(n)})}}const Ae=xe,B="SB-Agent",L={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"6.0.0"};let x={};const E={};class Ce{constructor(e,t){p(this,"client"),p(this,"maxRetries"),p(this,"retriesDelay"),p(this,"throttle"),p(this,"accessToken"),p(this,"cache"),p(this,"helpers"),p(this,"resolveCounter"),p(this,"relations"),p(this,"links"),p(this,"richTextResolver"),p(this,"resolveNestedRelations"),p(this,"stringifiedStoriesCache");let s=e.endpoint||t;if(!s){const i=new A().getRegionURL,l=e.https===!1?"http":"https";e.oauthToken?s=`${l}://${i(e.region)}/v1`:s=`${l}://${i(e.region)}/v2`}const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([i,l])=>{o.set(i,l)}),o.has(B)||(o.set(B,L.defaultAgentName),o.set(L.defaultAgentVersion,L.packageVersion));let n=5;e.oauthToken&&(o.set("Authorization",e.oauthToken),n=3),e.rateLimit&&(n=e.rateLimit),e.richTextSchema?this.richTextResolver=new I(e.richTextSchema):this.richTextResolver=new I,e.componentResolver&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttle=re(this.throttledRequest.bind(this),n,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.helpers=new A,this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.client=new Ae({baseURL:s,timeout:e.timeout||0,headers:o,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let s="";return t.attrs.body&&t.attrs.body.forEach(o=>{s+=e(o.component,o)}),{html:s}})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=E[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),typeof e.resolve_relations<"u"&&(e.resolve_level=2),e}factoryParamOptions(e,t){return this.helpers.isCDNUrl(e)?this.parseParams(t):t}makeRequest(e,t,s,o,n){const i=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,s,o));return this.cacheResponse(e,i,void 0,n)}get(e,t,s){t||(t={});const o=`/${e}`,n=this.factoryParamOptions(o,t);return this.cacheResponse(o,n,void 0,s)}async getAll(e,t,s,o){const n=(t==null?void 0:t.per_page)||25,i=`/${e}`.replace(/\/$/,""),l=s??i.substring(i.lastIndexOf("/")+1),a=1,h=await this.makeRequest(i,t,n,a,o),u=h.total?Math.ceil(h.total/n):1,d=await this.helpers.asyncMap(this.helpers.range(a,u),g=>this.makeRequest(i,t,n,g+1,o));return this.helpers.flatMap([h,...d],g=>Object.values(g.data[l]))}post(e,t,s){const o=`/${e}`;return Promise.resolve(this.throttle("post",o,t,s))}put(e,t,s){const o=`/${e}`;return Promise.resolve(this.throttle("put",o,t,s))}delete(e,t,s){const o=`/${e}`;return Promise.resolve(this.throttle("delete",o,t,s))}getStories(e,t){return this._addResolveLevel(e),this.get("cdn/stories",e,t)}getStory(e,t,s){return this._addResolveLevel(t),this.get(`cdn/stories/${e}`,t,s)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_addResolveLevel(e){typeof e.resolve_relations<"u"&&(e.resolve_level=2)}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t,s){const o=e[t];o&&o.fieldtype==="multilink"&&o.linktype==="story"&&typeof o.id=="string"&&this.links[s][o.id]?o.story=this._cleanCopy(this.links[s][o.id]):o&&o.linktype==="story"&&typeof o.uuid=="string"&&this.links[s][o.uuid]&&(o.story=this._cleanCopy(this.links[s][o.uuid]))}getStoryReference(e,t){return this.relations[e][t]?(this.stringifiedStoriesCache[t]||(this.stringifiedStoriesCache[t]=JSON.stringify(this.relations[e][t])),JSON.parse(this.stringifiedStoriesCache[t])):t}_insertRelations(e,t,s,o){s.includes(`${e.component}.${t}`)&&(typeof e[t]=="string"?e[t]=this.getStoryReference(o,e[t]):Array.isArray(e[t])&&(e[t]=e[t].map(n=>this.getStoryReference(o,n)).filter(Boolean)))}iterateTree(e,t,s){const o=n=>{if(n!=null){if(n.constructor===Array)for(let i=0;i<n.length;i++)o(n[i]);else if(n.constructor===Object){if(n._stopResolving)return;for(const i in n)(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,i,t,s),this._insertLinks(n,i,s)),o(n[i])}}};o(e.content)}async resolveLinks(e,t,s){let o=[];if(e.link_uuids){const n=e.link_uuids.length,i=[],l=50;for(let a=0;a<n;a+=l){const h=Math.min(n,a+l);i.push(e.link_uuids.slice(a,h))}for(let a=0;a<i.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,by_uuids:i[a].join(",")})).data.stories.forEach(h=>{o.push(h)})}else o=e.links;o.forEach(n=>{this.links[s][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,s){let o=[];if(e.rel_uuids){const n=e.rel_uuids.length,i=[],l=50;for(let a=0;a<n;a+=l){const h=Math.min(n,a+l);i.push(e.rel_uuids.slice(a,h))}for(let a=0;a<i.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,by_uuids:i[a].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(h=>{o.push(h)})}else o=e.rels;o&&o.length>0&&o.forEach(n=>{this.relations[s][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,s){var o,n;let i=[];if(this.links[s]={},this.relations[s]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(i=t.resolve_relations.split(",")),await this.resolveRelations(e,t,s)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((o=e.links)!=null&&o.length||(n=e.link_uuids)!=null&&n.length)&&await this.resolveLinks(e,t,s),this.resolveNestedRelations)for(const l in this.relations[s])this.iterateTree(this.relations[s][l],i,s);e.story?this.iterateTree(e.story,i,s):e.stories.forEach(l=>{this.iterateTree(l,i,s)}),this.stringifiedStoriesCache={},delete this.links[s],delete this.relations[s]}async cacheResponse(e,t,s,o){const n=this.helpers.stringify({url:e,params:t}),i=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&await this.flushCache(),t.version==="published"&&e!=="/cdn/spaces/me"){const l=await i.get(n);if(l)return Promise.resolve(l)}return new Promise(async(l,a)=>{var h;try{const u=await this.throttle("get",e,t,o);if(u.status!==200)return a(u);let d={data:u.data,headers:u.headers};if((h=u.headers)!=null&&h["per-page"]&&(d=Object.assign({},d,{perPage:u.headers["per-page"]?Number.parseInt(u.headers["per-page"]):0,total:u.headers["per-page"]?Number.parseInt(u.headers.total):0})),d.data.story||d.data.stories){const g=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(d.data,t,`${g}`)}return t.version==="published"&&e!=="/cdn/spaces/me"&&await i.set(n,d),d.data.cv&&t.token&&E[t.token]!==d.data.cv&&(await this.flushCache(),E[t.token]=d.data.cv),l(d)}catch(u){if(u.response&&u.status===429&&(s=typeof s>"u"?0:s+1,s<this.maxRetries))return console.log(`Hit rate limit. Retrying in ${this.retriesDelay/1e3} seconds.`),await this.helpers.delay(this.retriesDelay),this.cacheResponse(e,t,s).then(l).catch(a);a(u)}})}throttledRequest(e,t,s,o){return this.client.setFetchOptions(o),this.client[e](t,s)}cacheVersions(){return E}cacheVersion(){return E[this.accessToken]}setCacheVersion(e){this.accessToken&&(E[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(E[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(x[e])},getAll(){return Promise.resolve(x)},set(e,t){return x[e]=t,Promise.resolve(void 0)},flush(){return x={},Promise.resolve(void 0)}};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get(){return Promise.resolve()},getAll(){return Promise.resolve(void 0)},set(){return Promise.resolve(void 0)},flush(){return Promise.resolve(void 0)}}}}async flushCache(){return await this.cacheProvider().flush(),this.clearCacheVersion(),this}}const Le=(r={})=>{const{apiOptions:e}=r;if(!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new Ce(e)}},Pe=r=>{if(typeof r!="object"||typeof r._editable>"u")return{};try{const e=JSON.parse(r._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}:{}}catch{return{}}};function Ne(r,e){if(!e)return{src:r,attrs:{}};let t=0,s=0;const o={},n=[];function i(a,h,u,d,g){typeof a!="number"||a<=h||a>=u?console.warn(`[StoryblokRichText] - ${d.charAt(0).toUpperCase()+d.slice(1)} value must be a number between ${h} and ${u} (inclusive)`):g.push(`${d}(${a})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(o.width=e.width,t=e.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),e.height&&typeof e.height=="number"&&e.height>0?(o.height=e.height,s=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),e.loading&&["lazy","eager"].includes(e.loading)&&(o.loading=e.loading),e.class&&(o.class=e.class),e.filters){const{filters:a}=e||{},{blur:h,brightness:u,fill:d,format:g,grayscale:R,quality:y,rotate:w}=a||{};h&&i(h,0,100,"blur",n),y&&i(y,0,100,"quality",n),u&&i(u,0,100,"brightness",n),d&&n.push(`fill(${d})`),R&&n.push("grayscale()"),w&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${w})`),g&&["webp","png","jpeg"].includes(g)&&n.push(`format(${g})`)}e.srcset&&(o.srcset=e.srcset.map(a=>{if(typeof a=="number")return`${r}/m/${a}x0/${n.length>0?`filters:${n.join(":")}`:""} ${a}w`;if(Array.isArray(a)&&a.length===2){const[h,u]=a;return`${r}/m/${h}x${u}/${n.length>0?`filters:${n.join(":")}`:""} ${h}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),e.sizes&&(o.sizes=e.sizes.join(", "))}let l=`${r}/m/`;return t>0&&s>0&&(l=`${l}${t}x${s}/`),n.length>0&&(l=`${l}filters:${n.join(":")}`),{src:l,attrs:o}}var k=(r=>(r.DOCUMENT="doc",r.HEADING="heading",r.PARAGRAPH="paragraph",r.QUOTE="blockquote",r.OL_LIST="ordered_list",r.UL_LIST="bullet_list",r.LIST_ITEM="list_item",r.CODE_BLOCK="code_block",r.HR="horizontal_rule",r.BR="hard_break",r.IMAGE="image",r.EMOJI="emoji",r.COMPONENT="blok",r))(k||{}),v=(r=>(r.BOLD="bold",r.STRONG="strong",r.STRIKE="strike",r.UNDERLINE="underline",r.ITALIC="italic",r.CODE="code",r.LINK="link",r.ANCHOR="anchor",r.STYLED="styled",r.SUPERSCRIPT="superscript",r.SUBSCRIPT="subscript",r.TEXT_STYLE="textStyle",r.HIGHLIGHT="highlight",r))(v||{}),M=(r=>(r.TEXT="text",r))(M||{}),j=(r=>(r.URL="url",r.STORY="story",r.ASSET="asset",r.EMAIL="email",r))(j||{});const Me=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],He=(r={})=>Object.keys(r).map(e=>`${e}="${r[e]}"`).join(" "),Ue=(r={})=>Object.keys(r).map(e=>`${e}: ${r[e]}`).join("; ");function ze(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const q=r=>Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0));function De(r,e={},t){const s=He(e),o=s?`${r} ${s}`:r;return Me.includes(r)?`<${o}>`:`<${o}>${Array.isArray(t)?t.join(""):t||""}</${r}>`}function Be(r={}){let e=0;const{renderFn:t=De,textFn:s=ze,resolvers:o={},optimizeImages:n=!1,keyedResolvers:i=!1}=r,l=c=>m=>{const f=m.attrs||{};return i&&(f.key=`${c}-${e}`),t(c,f,m.children||null)},a=c=>{const{src:m,alt:f,title:b,srcset:T,sizes:$}=c.attrs||{};let S=m,_={};if(n){const{src:W,attrs:Q}=Ne(m,n);S=W,_=Q}i&&(_={..._,key:`img-${e}`});const X={src:S,alt:f,title:b,srcset:T,sizes:$,..._};return t("img",q(X))},h=c=>{const{level:m,...f}=c.attrs||{},b={...f};return i&&(b.key=`h${m}-${e}`),t(`h${m}`,b,c.children)},u=c=>{var m,f,b,T;const $=t("img",{src:(m=c.attrs)==null?void 0:m.fallbackImage,alt:(f=c.attrs)==null?void 0:f.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"}),S={"data-type":"emoji","data-name":(b=c.attrs)==null?void 0:b.name,"data-emoji":(T=c.attrs)==null?void 0:T.emoji};return i&&(S.key=`emoji-${e}`),t("span",S,$)},d=c=>t("pre",{...c.attrs,key:`code-${e}`},t("code",{key:`code-${e}`},c.children||"")),g=(c,m=!1)=>({text:f,attrs:b})=>{const{class:T,id:$,...S}=b||{},_=m?{class:T,id:$,style:Ue(S)||void 0}:b||{};return i&&(_.key=`${c}-${e}`),t(c,q(_),f)},R=c=>C(c),y=c=>{const{marks:m,...f}=c;return"text"in c?m?m.reduce((b,T)=>R({...T,text:b}),R({...f,children:f.children})):s(f.text):""},w=c=>{const{linktype:m,href:f,anchor:b,...T}=c.attrs||{};let $="";switch(m){case j.ASSET:case j.URL:$=f;break;case j.EMAIL:$=`mailto:${f}`;break;case j.STORY:$=f;break}return b&&($=`${$}#${b}`),t("a",{...T,href:$,key:`a-${e}`},c.text)},O=c=>{var m,f;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),t("span",{blok:(m=c==null?void 0:c.attrs)==null?void 0:m.body[0],id:(f=c.attrs)==null?void 0:f.id,key:`component-${e}`,style:"display: none"})},Y=new Map([[k.DOCUMENT,l("div")],[k.HEADING,h],[k.PARAGRAPH,l("p")],[k.UL_LIST,l("ul")],[k.OL_LIST,l("ol")],[k.LIST_ITEM,l("li")],[k.IMAGE,a],[k.EMOJI,u],[k.CODE_BLOCK,d],[k.HR,l("hr")],[k.BR,l("br")],[k.QUOTE,l("blockquote")],[k.COMPONENT,O],[M.TEXT,y],[v.LINK,w],[v.ANCHOR,w],[v.STYLED,g("span",!0)],[v.BOLD,g("strong")],[v.TEXT_STYLE,g("span",!0)],[v.ITALIC,g("em")],[v.UNDERLINE,g("u")],[v.STRIKE,g("s")],[v.CODE,g("code")],[v.SUPERSCRIPT,g("sup")],[v.SUBSCRIPT,g("sub")],[v.HIGHLIGHT,g("mark")],...Object.entries(o).map(([c,m])=>[c,m])]);function H(c){e+=1;const m=Y.get(c.type);if(!m)return console.error("<Storyblok>",`No resolver found for node type ${c.type}`),"";if(c.type==="text")return m(c);const f=c.content?c.content.map(C):void 0;return m({...c,children:f})}function C(c){return Array.isArray(c)?c.map(H):H(c)}return{render:C}}let P,N="https://app.storyblok.com/f/storyblok-v2-latest.js";const F=(r,e,t={})=>{var s;const o=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",n=+new URL((s=window.location)==null?void 0:s.href).searchParams.get("_storyblok")===r;if(!(!o||!n)){if(!r){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],i=>{i.action==="input"&&i.story.id===r?e(i.story):(i.action==="change"||i.action==="published")&&i.storyId===r&&window.location.reload()})})}},qe=(r={})=>{var e,t;const{bridge:s,accessToken:o,use:n=[],apiOptions:i={},richText:l={},bridgeUrl:a}=r;i.accessToken=i.accessToken||o;const h={bridge:s,apiOptions:i};let u={};n.forEach(g=>{u={...u,...g(h)}}),a&&(N=a);const d=!(typeof window>"u")&&((t=(e=window.location)==null?void 0:e.search)==null?void 0:t.includes("_storyblok_tk"));return s!==!1&&d&&G(N),P=new I(l.schema),l.resolver&&J(P,l.resolver),u},J=(r,e)=>{r.addNode("blok",t=>{let s="";return t.attrs.body.forEach(o=>{s+=e(o.component,o)}),{html:s}})},K=r=>!r||!(r!=null&&r.content.some(e=>e.content||e.type==="blok"||e.type==="horizontal_rule")),Ge=(r,e,t)=>{let s=t||P;if(!s){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return K(r)?"":(e&&(s=new I(e.schema),e.resolver&&J(s,e.resolver)),s.render(r,{},!1))},Ve=()=>G(N);exports.BlockTypes=k;exports.MarkTypes=v;exports.RichTextResolver=I;exports.RichTextSchema=V;exports.TextTypes=M;exports.apiPlugin=Le;exports.isRichTextEmpty=K;exports.loadStoryblokBridge=Ve;exports.registerStoryblokBridge=F;exports.renderRichText=Ge;exports.richTextResolver=Be;exports.storyblokEditable=Pe;exports.storyblokInit=qe;exports.useStoryblokBridge=F;
|
|
24
|
+
}`),""}optimizeImages(e,t){let r=0,s=0,n="",i="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(n+=`width="${t.width}" `,r=t.width),typeof t.height=="number"&&t.height>0&&(n+=`height="${t.height}" `,s=t.height),(t.loading==="lazy"||t.loading==="eager")&&(n+=`loading="${t.loading}" `),typeof t.class=="string"&&t.class.length>0&&(n+=`class="${t.class}" `),t.filters&&(typeof t.filters.blur=="number"&&t.filters.blur>=0&&t.filters.blur<=100&&(i+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(i+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-F]{6}/gi)||t.filters.fill==="transparent")&&(i+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(i+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(i+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(i+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(i+=`:rotate(${t.filters.rotate})`),i.length>0&&(i=`/filters${i}`))),n.length>0&&(e=e.replace(/<img/g,`<img ${n.trim()}`));const l=r>0||s>0||i.length>0?`${r}x${s}${i}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${l}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,a=>{var h,u;const d=a.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(d&&d.length>0){const f={srcset:(h=t.srcset)==null?void 0:h.map(y=>{if(typeof y=="number")return`//${d}/m/${y}x0${i} ${y}w`;if(typeof y=="object"&&y.length===2){let _=0,j=0;return typeof y[0]=="number"&&(_=y[0]),typeof y[1]=="number"&&(j=y[1]),`//${d}/m/${_}x${j}${i} ${_}w`}return""}).join(", "),sizes:(u=t.sizes)==null?void 0:u.map(y=>y).join(", ")};let b="";return f.srcset&&(b+=`srcset="${f.srcset}" `),f.sizes&&(b+=`sizes="${f.sizes}" `),a.replace(/<img/g,`<img ${b.trim()}`)}return a})),e}renderNode(e){const t=[];e.marks&&e.marks.forEach(s=>{const n=this.getMatchingMark(s);n&&n.tag!==""&&t.push(this.renderOpeningTag(n.tag))});const r=this.getMatchingNode(e);return r&&r.tag&&t.push(this.renderOpeningTag(r.tag)),e.content?e.content.forEach(s=>{t.push(this.renderNode(s))}):e.text?t.push(xe(e.text)):r&&r.singleTag?t.push(this.renderTag(r.singleTag," /")):r&&r.html?t.push(r.html):e.type==="emoji"&&t.push(this.renderEmoji(e)),r&&r.tag&&t.push(this.renderClosingTag(r.tag)),e.marks&&e.marks.slice(0).reverse().forEach(s=>{const n=this.getMatchingMark(s);n&&n.tag!==""&&t.push(this.renderClosingTag(n.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(r=>{if(r.constructor===String)return`<${r}${t}>`;{let s=`<${r.tag}`;if(r.attrs){for(const n in r.attrs)if(Object.prototype.hasOwnProperty.call(r.attrs,n)){const i=r.attrs[n];i!==null&&(s+=` ${n}="${i}"`)}}return`${s}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(t=>t.constructor===String?`</${t}>`:`</${t.tag}>`).join("")}getMatchingNode(e){const t=this.nodes[e.type];if(typeof t=="function")return t(e)}getMatchingMark(e){const t=this.marks[e.type];if(typeof t=="function")return t(e)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const t=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(t," /")}}const O=Ae;class Le{constructor(e){p(this,"baseURL"),p(this,"timeout"),p(this,"headers"),p(this,"responseInterceptor"),p(this,"fetch"),p(this,"ejectInterceptor"),p(this,"url"),p(this,"parameters"),p(this,"fetchOptions"),this.baseURL=e.baseURL,this.headers=e.headers||new Headers,this.timeout=e!=null&&e.timeout?e.timeout*1e3:0,this.responseInterceptor=e.responseInterceptor,this.fetch=(...t)=>e.fetch?e.fetch(...t):fetch(...t),this.ejectInterceptor=!1,this.url="",this.parameters={},this.fetchOptions={}}get(e,t){return this.url=e,this.parameters=t,this._methodHandler("get")}post(e,t){return this.url=e,this.parameters=t,this._methodHandler("post")}put(e,t){return this.url=e,this.parameters=t,this._methodHandler("put")}delete(e,t){return this.url=e,this.parameters=t??{},this._methodHandler("delete")}async _responseHandler(e){const t=[],r={data:{},headers:{},status:0,statusText:""};e.status!==204&&await e.json().then(s=>{r.data=s});for(const s of e.headers.entries())t[s[0]]=s[1];return r.headers={...t},r.status=e.status,r.statusText=e.statusText,r}async _methodHandler(e){let t=`${this.baseURL}${this.url}`,r=null;if(e==="get"){const a=new L;t=`${this.baseURL}${this.url}?${a.stringify(this.parameters)}`}else r=JSON.stringify(this.parameters);const s=new URL(t),n=new AbortController,{signal:i}=n;let l;this.timeout&&(l=setTimeout(()=>n.abort(),this.timeout));try{const a=await this.fetch(`${s}`,{method:e,headers:this.headers,body:r,signal:i,...this.fetchOptions});this.timeout&&clearTimeout(l);const h=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(h)):this._statusHandler(h)}catch(a){return{message:a}}}setFetchOptions(e={}){Object.keys(e).length>0&&"method"in e&&delete e.method,this.fetchOptions={...e}}eject(){this.ejectInterceptor=!0}_statusHandler(e){const t=/20[0-6]/g;return new Promise((r,s)=>{if(t.test(`${e.status}`))return r(e);const n={message:e.statusText,status:e.status,response:Array.isArray(e.data)?e.data[0]:e.data.error||e.data.slug};s(n)})}}const Pe=Le,B="SB-Agent",C={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"6.0.0"};let A={};const E={};class Ce{constructor(e,t){p(this,"client"),p(this,"maxRetries"),p(this,"retriesDelay"),p(this,"throttle"),p(this,"accessToken"),p(this,"cache"),p(this,"helpers"),p(this,"resolveCounter"),p(this,"relations"),p(this,"links"),p(this,"richTextResolver"),p(this,"resolveNestedRelations"),p(this,"stringifiedStoriesCache");let r=e.endpoint||t;if(!r){const i=new L().getRegionURL,l=e.https===!1?"http":"https";e.oauthToken?r=`${l}://${i(e.region)}/v1`:r=`${l}://${i(e.region)}/v2`}const s=new Headers;s.set("Content-Type","application/json"),s.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([i,l])=>{s.set(i,l)}),s.has(B)||(s.set(B,C.defaultAgentName),s.set(C.defaultAgentVersion,C.packageVersion));let n=5;e.oauthToken&&(s.set("Authorization",e.oauthToken),n=3),e.rateLimit&&(n=e.rateLimit),e.richTextSchema?this.richTextResolver=new O(e.richTextSchema):this.richTextResolver=new O,e.componentResolver&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttle=oe(this.throttledRequest.bind(this),n,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.helpers=new L,this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.client=new Pe({baseURL:r,timeout:e.timeout||0,headers:s,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let r="";return t.attrs.body&&t.attrs.body.forEach(s=>{r+=e(s.component,s)}),{html:r}})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=E[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),typeof e.resolve_relations<"u"&&(e.resolve_level=2),e}factoryParamOptions(e,t){return this.helpers.isCDNUrl(e)?this.parseParams(t):t}makeRequest(e,t,r,s,n){const i=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,r,s));return this.cacheResponse(e,i,void 0,n)}get(e,t,r){t||(t={});const s=`/${e}`,n=this.factoryParamOptions(s,t);return this.cacheResponse(s,n,void 0,r)}async getAll(e,t,r,s){const n=(t==null?void 0:t.per_page)||25,i=`/${e}`.replace(/\/$/,""),l=r??i.substring(i.lastIndexOf("/")+1),a=1,h=await this.makeRequest(i,t,n,a,s),u=h.total?Math.ceil(h.total/n):1,d=await this.helpers.asyncMap(this.helpers.range(a,u),f=>this.makeRequest(i,t,n,f+1,s));return this.helpers.flatMap([h,...d],f=>Object.values(f.data[l]))}post(e,t,r){const s=`/${e}`;return Promise.resolve(this.throttle("post",s,t,r))}put(e,t,r){const s=`/${e}`;return Promise.resolve(this.throttle("put",s,t,r))}delete(e,t,r){t||(t={});const s=`/${e}`;return Promise.resolve(this.throttle("delete",s,t,r))}getStories(e,t){return this._addResolveLevel(e),this.get("cdn/stories",e,t)}getStory(e,t,r){return this._addResolveLevel(t),this.get(`cdn/stories/${e}`,t,r)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_addResolveLevel(e){typeof e.resolve_relations<"u"&&(e.resolve_level=2)}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t,r){const s=e[t];s&&s.fieldtype==="multilink"&&s.linktype==="story"&&typeof s.id=="string"&&this.links[r][s.id]?s.story=this._cleanCopy(this.links[r][s.id]):s&&s.linktype==="story"&&typeof s.uuid=="string"&&this.links[r][s.uuid]&&(s.story=this._cleanCopy(this.links[r][s.uuid]))}getStoryReference(e,t){return this.relations[e][t]?JSON.parse(this.stringifiedStoriesCache[t]||JSON.stringify(this.relations[e][t])):t}_resolveField(e,t,r){const s=e[t];typeof s=="string"?e[t]=this.getStoryReference(r,s):Array.isArray(s)&&(e[t]=s.map(n=>this.getStoryReference(r,n)).filter(Boolean))}_insertRelations(e,t,r,s){if(Array.isArray(r)?r.find(i=>i.endsWith(`.${t}`)):r.endsWith(`.${t}`)){this._resolveField(e,t,s);return}const n=e.component?`${e.component}.${t}`:t;(Array.isArray(r)?r.includes(n):r===n)&&this._resolveField(e,t,s)}iterateTree(e,t,r){const s=(n,i="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((l,a)=>s(l,`${i}[${a}]`));else if(typeof n=="object")for(const l in n){const a=i?`${i}.${l}`:l;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,l,t,r),this._insertLinks(n,l,r)),s(n[l],a)}}};s(e.content)}async resolveLinks(e,t,r){let s=[];if(e.link_uuids){const n=e.link_uuids.length,i=[],l=50;for(let a=0;a<n;a+=l){const h=Math.min(n,a+l);i.push(e.link_uuids.slice(a,h))}for(let a=0;a<i.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,by_uuids:i[a].join(",")})).data.stories.forEach(h=>{s.push(h)})}else s=e.links;s.forEach(n=>{this.links[r][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,r){let s=[];if(e.rel_uuids){const n=e.rel_uuids.length,i=[],l=50;for(let a=0;a<n;a+=l){const h=Math.min(n,a+l);i.push(e.rel_uuids.slice(a,h))}for(let a=0;a<i.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,by_uuids:i[a].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(h=>{s.push(h)})}else s=e.rels;s&&s.length>0&&s.forEach(n=>{this.relations[r][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,r){var s,n;let i=[];if(this.links[r]={},this.relations[r]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(i=t.resolve_relations.split(",")),await this.resolveRelations(e,t,r)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((s=e.links)!=null&&s.length||(n=e.link_uuids)!=null&&n.length)&&await this.resolveLinks(e,t,r),this.resolveNestedRelations)for(const l in this.relations[r])this.iterateTree(this.relations[r][l],i,r);e.story?this.iterateTree(e.story,i,r):e.stories.forEach(l=>{this.iterateTree(l,i,r)}),this.stringifiedStoriesCache={},delete this.links[r],delete this.relations[r]}async cacheResponse(e,t,r,s){const n=this.helpers.stringify({url:e,params:t}),i=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&await this.flushCache(),t.version==="published"&&e!=="/cdn/spaces/me"){const l=await i.get(n);if(l)return Promise.resolve(l)}return new Promise(async(l,a)=>{var h;try{const u=await this.throttle("get",e,t,s);if(u.status!==200)return a(u);let d={data:u.data,headers:u.headers};if((h=u.headers)!=null&&h["per-page"]&&(d=Object.assign({},d,{perPage:u.headers["per-page"]?Number.parseInt(u.headers["per-page"]):0,total:u.headers["per-page"]?Number.parseInt(u.headers.total):0})),d.data.story||d.data.stories){const f=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(d.data,t,`${f}`)}return t.version==="published"&&e!=="/cdn/spaces/me"&&await i.set(n,d),d.data.cv&&t.token&&E[t.token]!==d.data.cv&&(await this.flushCache(),E[t.token]=d.data.cv),l(d)}catch(u){if(u.response&&u.status===429&&(r=typeof r>"u"?0:r+1,r<this.maxRetries))return console.log(`Hit rate limit. Retrying in ${this.retriesDelay/1e3} seconds.`),await this.helpers.delay(this.retriesDelay),this.cacheResponse(e,t,r).then(l).catch(a);a(u)}})}throttledRequest(e,t,r,s){return this.client.setFetchOptions(s),this.client[e](t,r)}cacheVersions(){return E}cacheVersion(){return E[this.accessToken]}setCacheVersion(e){this.accessToken&&(E[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(E[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(A[e])},getAll(){return Promise.resolve(A)},set(e,t){return A[e]=t,Promise.resolve(void 0)},flush(){return A={},Promise.resolve(void 0)}};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get(){return Promise.resolve()},getAll(){return Promise.resolve(void 0)},set(){return Promise.resolve(void 0)},flush(){return Promise.resolve(void 0)}}}}async flushCache(){return await this.cacheProvider().flush(),this.clearCacheVersion(),this}}const Ne=(o={})=>{const{apiOptions:e}=o;if(!e||!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new Ce(e)}},Me=o=>{if(typeof o!="object"||typeof o._editable>"u")return{};try{const e=JSON.parse(o._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":`${e.id}-${e.uid}`}:{}}catch{return{}}};function He(o,e){if(!e)return{src:o,attrs:{}};let t=0,r=0;const s={},n=[];function i(a,h,u,d,f){typeof a!="number"||a<=h||a>=u?console.warn(`[StoryblokRichText] - ${d.charAt(0).toUpperCase()+d.slice(1)} value must be a number between ${h} and ${u} (inclusive)`):f.push(`${d}(${a})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(s.width=e.width,t=e.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),e.height&&typeof e.height=="number"&&e.height>0?(s.height=e.height,r=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),e.loading&&["lazy","eager"].includes(e.loading)&&(s.loading=e.loading),e.class&&(s.class=e.class),e.filters){const{filters:a}=e||{},{blur:h,brightness:u,fill:d,format:f,grayscale:b,quality:y,rotate:_}=a||{};h&&i(h,0,100,"blur",n),y&&i(y,0,100,"quality",n),u&&i(u,0,100,"brightness",n),d&&n.push(`fill(${d})`),b&&n.push("grayscale()"),_&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${_})`),f&&["webp","png","jpeg"].includes(f)&&n.push(`format(${f})`)}e.srcset&&(s.srcset=e.srcset.map(a=>{if(typeof a=="number")return`${o}/m/${a}x0/${n.length>0?`filters:${n.join(":")}`:""} ${a}w`;if(Array.isArray(a)&&a.length===2){const[h,u]=a;return`${o}/m/${h}x${u}/${n.length>0?`filters:${n.join(":")}`:""} ${h}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),e.sizes&&(s.sizes=e.sizes.join(", "))}let l=`${o}/m/`;return t>0&&r>0&&(l=`${l}${t}x${r}/`),n.length>0&&(l=`${l}filters:${n.join(":")}`),{src:l,attrs:s}}var v=(o=>(o.DOCUMENT="doc",o.HEADING="heading",o.PARAGRAPH="paragraph",o.QUOTE="blockquote",o.OL_LIST="ordered_list",o.UL_LIST="bullet_list",o.LIST_ITEM="list_item",o.CODE_BLOCK="code_block",o.HR="horizontal_rule",o.BR="hard_break",o.IMAGE="image",o.EMOJI="emoji",o.COMPONENT="blok",o))(v||{}),T=(o=>(o.BOLD="bold",o.STRONG="strong",o.STRIKE="strike",o.UNDERLINE="underline",o.ITALIC="italic",o.CODE="code",o.LINK="link",o.ANCHOR="anchor",o.STYLED="styled",o.SUPERSCRIPT="superscript",o.SUBSCRIPT="subscript",o.TEXT_STYLE="textStyle",o.HIGHLIGHT="highlight",o))(T||{}),H=(o=>(o.TEXT="text",o))(H||{}),I=(o=>(o.URL="url",o.STORY="story",o.ASSET="asset",o.EMAIL="email",o))(I||{});const Ue=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],ze=(o={})=>Object.keys(o).map(e=>`${e}="${o[e]}"`).join(" "),De=(o={})=>Object.keys(o).map(e=>`${e}: ${o[e]}`).join("; ");function Be(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const q=o=>Object.fromEntries(Object.entries(o).filter(([e,t])=>t!==void 0));function F(o,e={},t){const r=ze(e),s=r?`${o} ${r}`:o,n=Array.isArray(t)?t.join(""):t||"";if(o){if(Ue.includes(o))return`<${s}>`}else return n;return`<${s}>${n}</${o}>`}function qe(o={}){let e=0;const{renderFn:t=F,textFn:r=Be,resolvers:s={},optimizeImages:n=!1,keyedResolvers:i=!1}=o,l=t!==F,a=c=>g=>{const m=g.attrs||{};return i&&(m.key=`${c}-${e}`),t(c,m,g.children||null)},h=c=>{const{src:g,alt:m,title:k,srcset:R,sizes:$}=c.attrs||{};let w=g,S={};if(n){const{src:Z,attrs:ee}=He(g,n);w=Z,S=ee}i&&(S={...S,key:`img-${e}`});const Q={src:w,alt:m,title:k,srcset:R,sizes:$,...S};return t("img",q(Q))},u=c=>{const{level:g,...m}=c.attrs||{},k={...m};return i&&(k.key=`h${g}-${e}`),t(`h${g}`,k,c.children)},d=c=>{var g,m,k,R;const $=t("img",{src:(g=c.attrs)==null?void 0:g.fallbackImage,alt:(m=c.attrs)==null?void 0:m.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"}),w={"data-type":"emoji","data-name":(k=c.attrs)==null?void 0:k.name,"data-emoji":(R=c.attrs)==null?void 0:R.emoji};return i&&(w.key=`emoji-${e}`),t("span",w,$)},f=c=>t("pre",{...c.attrs,key:`code-${e}`},t("code",{key:`code-${e}`},c.children||"")),b=(c,g=!1)=>({text:m,attrs:k})=>{const{class:R,id:$,...w}=k||{},S=g?{class:R,id:$,style:De(w)||void 0}:k||{};return i&&(S.key=`${c}-${e}`),t(c,q(S),m)},y=c=>P(c),_=c=>{const{marks:g,...m}=c;return"text"in c?g?g.reduce((k,R)=>y({...R,text:k}),y({...m,children:m.children})):r(m.text):""},j=c=>{const{linktype:g,href:m,anchor:k,...R}=c.attrs||{};let $="";switch(g){case I.ASSET:case I.URL:$=m;break;case I.EMAIL:$=`mailto:${m}`;break;case I.STORY:$=m,k&&($=`${$}#${k}`);break;default:$=m;break}const w={...R};return $&&(w.href=$),i&&(w.key=`a-${e}`),t("a",w,c.text)},W=c=>{var g,m;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),t("span",{blok:(g=c==null?void 0:c.attrs)==null?void 0:g.body[0],id:(m=c.attrs)==null?void 0:m.id,key:`component-${e}`,style:"display: none"})},X=new Map([[v.DOCUMENT,a("")],[v.HEADING,u],[v.PARAGRAPH,a("p")],[v.UL_LIST,a("ul")],[v.OL_LIST,a("ol")],[v.LIST_ITEM,a("li")],[v.IMAGE,h],[v.EMOJI,d],[v.CODE_BLOCK,f],[v.HR,a("hr")],[v.BR,a("br")],[v.QUOTE,a("blockquote")],[v.COMPONENT,W],[H.TEXT,_],[T.LINK,j],[T.ANCHOR,j],[T.STYLED,b("span",!0)],[T.BOLD,b("strong")],[T.TEXT_STYLE,b("span",!0)],[T.ITALIC,b("em")],[T.UNDERLINE,b("u")],[T.STRIKE,b("s")],[T.CODE,b("code")],[T.SUPERSCRIPT,b("sup")],[T.SUBSCRIPT,b("sub")],[T.HIGHLIGHT,b("mark")],...Object.entries(s).map(([c,g])=>[c,g])]);function x(c){e+=1;const g=X.get(c.type);if(!g)return console.error("<Storyblok>",`No resolver found for node type ${c.type}`),"";if(c.type==="text")return g(c);const m=c.content?c.content.map(P):void 0;return g({...c,children:m})}function P(c){return c.type==="doc"?l?c.content.map(x):c.content.map(x).join(""):Array.isArray(c)?c.map(x):x(c)}return{render:P}}let N,M="https://app.storyblok.com/f/storyblok-v2-latest.js";const J=(o,e,t={})=>{var r;const s=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",n=new URL((r=window.location)==null?void 0:r.href).searchParams.get("_storyblok"),i=n!==null&&+n===o;if(!(!s||!i)){if(!o){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],l=>{var a;l&&(l.action==="input"&&((a=l.story)==null?void 0:a.id)===o?e(l.story):(l.action==="change"||l.action==="published")&&l.storyId===o&&window.location.reload())})})}},K=(o,e)=>{o.addNode("blok",t=>{let r="";return t.attrs.body.forEach(s=>{r+=e(s.component,s)}),{html:r}})},Fe=(o={})=>{var e,t;const{bridge:r,accessToken:s,use:n=[],apiOptions:i={},richText:l={},bridgeUrl:a}=o;i.accessToken=i.accessToken||s;const h={bridge:r,apiOptions:i};let u={};n.forEach(f=>{u={...u,...f(h)}}),a&&(M=a);const d=!(typeof window>"u")&&((t=(e=window.location)==null?void 0:e.search)==null?void 0:t.includes("_storyblok_tk"));return r!==!1&&d&&G(M),N=new O(l.schema),l.resolver&&K(N,l.resolver),u},Y=o=>{var e;return!o||!((e=o==null?void 0:o.content)!=null&&e.some(t=>t.content||t.type==="blok"||t.type==="horizontal_rule"))},Ge=(o,e,t)=>{let r=t||N;if(!r){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return Y(o)?"":(e&&(r=new O(e.schema),e.resolver&&K(r,e.resolver)),r.render(o,{},!1))},Ve=()=>G(M);exports.BlockTypes=v;exports.MarkTypes=T;exports.RichTextResolver=O;exports.RichTextSchema=V;exports.TextTypes=H;exports.apiPlugin=Ne;exports.isRichTextEmpty=Y;exports.loadStoryblokBridge=Ve;exports.registerStoryblokBridge=J;exports.renderRichText=Ge;exports.richTextResolver=qe;exports.storyblokEditable=Me;exports.storyblokInit=Fe;exports.useStoryblokBridge=J;
|