@storyblok/astro 6.1.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(u,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(u=typeof globalThis<"u"?globalThis:u||self,y(u.storyblokAstro={}))})(this,function(u){"use strict";const y=`<svg width="45px" height="53px" viewBox="0 0 45 53" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
1
+ (function(k,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(k=typeof globalThis<"u"?globalThis:k||self,A(k.storyblokAstro={}))})(this,function(k){"use strict";const A=`<svg width="45px" height="53px" viewBox="0 0 45 53" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
2
  <g id="storyblok-logo-kit" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
3
3
  <g id="storyblok-partner-logo" transform="translate(-59.000000, -169.000000)" fill-rule="nonzero">
4
4
  <g id="storyblok-symbol" transform="translate(59.000000, 169.000000)">
@@ -7,17 +7,17 @@
7
7
  </g>
8
8
  </g>
9
9
  </g>
10
- </svg>`,R=/[\p{Lu}]/u,M=/[\p{Ll}]/u,$=/^[\p{Lu}](?![\p{Lu}])/gu,v=/([\p{Alpha}\p{N}_]|$)/u,b=/[_.\- ]+/,O=new RegExp("^"+b.source),C=new RegExp(b.source+v.source,"gu"),S=new RegExp("\\d+"+v.source,"gu"),P=(r,t,e,o)=>{let s=!1,n=!1,a=!1,l=!1;for(let i=0;i<r.length;i++){const c=r[i];l=i>2?r[i-3]==="-":!0,s&&R.test(c)?(r=r.slice(0,i)+"-"+r.slice(i),s=!1,a=n,n=!0,i++):n&&a&&M.test(c)&&(!l||o)?(r=r.slice(0,i-1)+"-"+r.slice(i-1),a=n,n=!1,s=!0):(s=t(c)===c&&e(c)!==c,a=n,n=e(c)===c&&t(c)!==c)}return r},_=(r,t)=>($.lastIndex=0,r.replaceAll($,e=>t(e))),N=(r,t)=>(C.lastIndex=0,S.lastIndex=0,r.replaceAll(S,(e,o,s)=>["_","-"].includes(r.charAt(s+e.length))?e:t(e)).replaceAll(C,(e,o)=>t(o)));function z(r,t){if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(r)?r=r.map(n=>n.trim()).filter(n=>n.length).join("-"):r=r.trim(),r.length===0)return"";const e=t.locale===!1?n=>n.toLowerCase():n=>n.toLocaleLowerCase(t.locale),o=t.locale===!1?n=>n.toUpperCase():n=>n.toLocaleUpperCase(t.locale);return r.length===1?b.test(r)?"":t.pascalCase?o(r):e(r):(r!==e(r)&&(r=P(r,e,o,t.preserveConsecutiveUppercase)),r=r.replace(O,""),r=t.preserveConsecutiveUppercase?_(r,e):e(r),t.pascalCase&&(r=o(r.charAt(0))+r.slice(1)),N(r,o))}function m(r){return z(r)}function B(r,t={},e,o){const s="virtual:storyblok-components",n=`\0${s}`;return{name:"vite-plugin-storyblok-components",async resolveId(a){if(a===s)return n},async load(a){if(a===n){const l=[],i=[];for await(const[d,f]of Object.entries(t)){const h=await this.resolve(`/${r}/${f}.astro`);if(h)l.push(`import ${m(d)} from "${h.id}"`);else if(e)i.push(d);else throw new Error(`Component could not be found for blok "${d}"! Does "${`/${r}/${f}`}.astro" exist?`)}let c="";if(e)if(c=",FallbackComponent",o){const d=await this.resolve(`/${r}/${o}.astro`);if(!d)throw new Error(`Custom fallback component could not be found. Does "${`/${r}/${o}`}.astro" exist?`);l.push(`import FallbackComponent from "${d.id}"`)}else l.push("import FallbackComponent from '@storyblok/astro/FallbackComponent.astro'");if(Object.values(t).length)return`${l.join(";")};export default {${Object.keys(t).filter(d=>!i.includes(d)).map(d=>m(d)).join(",")}${c}}`;if(e)return`${l[0]}; export default {${c.replace(",","")}}`;throw new Error(`Currently, no Storyblok components are registered in astro.config.mjs.
10
+ </svg>`,V=/[\p{Lu}]/u,X=/[\p{Ll}]/u,B=/^[\p{Lu}](?![\p{Lu}])/gu,D=/([\p{Alpha}\p{N}_]|$)/u,_=/[_.\- ]+/,Z=new RegExp("^"+_.source),U=new RegExp(_.source+D.source,"gu"),z=new RegExp("\\d+"+D.source,"gu"),Q=(t,e,r,o)=>{let n=!1,s=!1,l=!1,p=!1;for(let c=0;c<t.length;c++){const u=t[c];p=c>2?t[c-3]==="-":!0,n&&V.test(u)?(t=t.slice(0,c)+"-"+t.slice(c),n=!1,l=s,s=!0,c++):s&&l&&X.test(u)&&(!p||o)?(t=t.slice(0,c-1)+"-"+t.slice(c-1),l=s,s=!1,n=!0):(n=e(u)===u&&r(u)!==u,l=s,s=r(u)===u&&e(u)!==u)}return t},ee=(t,e)=>(B.lastIndex=0,t.replaceAll(B,r=>e(r))),te=(t,e)=>(U.lastIndex=0,z.lastIndex=0,t.replaceAll(z,(r,o,n)=>["_","-"].includes(t.charAt(n+r.length))?r:e(r)).replaceAll(U,(r,o)=>e(o)));function re(t,e){if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(s=>s.trim()).filter(s=>s.length).join("-"):t=t.trim(),t.length===0)return"";const r=e.locale===!1?s=>s.toLowerCase():s=>s.toLocaleLowerCase(e.locale),o=e.locale===!1?s=>s.toUpperCase():s=>s.toLocaleUpperCase(e.locale);return t.length===1?_.test(t)?"":e.pascalCase?o(t):r(t):(t!==r(t)&&(t=Q(t,r,o,e.preserveConsecutiveUppercase)),t=t.replace(Z,""),t=e.preserveConsecutiveUppercase?ee(t,r):r(t),e.pascalCase&&(t=o(t.charAt(0))+t.slice(1)),te(t,o))}function M(t){return re(t)}function oe(t,e={},r,o){const n="virtual:storyblok-components",s=`\0${n}`;return{name:"vite-plugin-storyblok-components",async resolveId(l){if(l===n)return s},async load(l){if(l===s){const p=[],c=[];for await(const[h,w]of Object.entries(e)){const v=await this.resolve(`/${t}/${w}.astro`);if(v)p.push(`import ${M(h)} from "${v.id}"`);else if(r)c.push(h);else throw new Error(`Component could not be found for blok "${h}"! Does "${`/${t}/${w}`}.astro" exist?`)}let u="";if(r)if(u=",FallbackComponent",o){const h=await this.resolve(`/${t}/${o}.astro`);if(!h)throw new Error(`Custom fallback component could not be found. Does "${`/${t}/${o}`}.astro" exist?`);p.push(`import FallbackComponent from "${h.id}"`)}else p.push("import FallbackComponent from '@storyblok/astro/FallbackComponent.astro'");if(Object.values(e).length)return`${p.join(";")};export default {${Object.keys(e).filter(h=>!c.includes(h)).map(h=>M(h)).join(",")}${u}}`;if(r)return`${p[0]}; export default {${u.replace(",","")}}`;throw new Error(`Currently, no Storyblok components are registered in astro.config.mjs.
11
11
  Please register your components or enable the fallback component.
12
- Detailed information can be found here: https://github.com/storyblok/storyblok-astro`)}}}}function D(r,t,e){const o="virtual:storyblok-init",s=`\0${o}`;return{name:"vite-plugin-storyblok-init",async resolveId(n){if(n===o)return s},async load(n){if(n===s)return`
12
+ Detailed information can be found here: https://github.com/storyblok/storyblok-astro`)}}}}function se(t,e,r){const o="virtual:storyblok-init",n=`\0${o}`;return{name:"vite-plugin-storyblok-init",async resolveId(s){if(s===o)return n},async load(s){if(s===n)return`
13
13
  import { storyblokInit, apiPlugin } from "@storyblok/js";
14
14
  const { storyblokApi } = storyblokInit({
15
- accessToken: "${r}",
16
- use: ${t?"[]":"[apiPlugin]"},
17
- apiOptions: ${JSON.stringify(e)},
15
+ accessToken: "${t}",
16
+ use: ${e?"[]":"[apiPlugin]"},
17
+ apiOptions: ${JSON.stringify(r)},
18
18
  });
19
19
  export const storyblokApiInstance = storyblokApi;
20
- `}}}function F(r){const t="virtual:storyblok-options",e=`\0${t}`;return{name:"vite-plugin-storyblok-options",async resolveId(o){if(o===t)return e},async load(o){if(o===e)return`export default ${JSON.stringify(r)}`}}}let I=!1;const A=[],U=r=>new Promise((t,e)=>{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}I?s():A.push(s)},document.getElementById("storyblok-javascript-bridge")))return;const o=document.createElement("script");o.async=!0,o.src=r,o.id="storyblok-javascript-bridge",o.onerror=s=>e(s),o.onload=s=>{A.forEach(n=>n()),I=!0,t(s)},document.getElementsByTagName("head")[0].appendChild(o)});var q=Object.defineProperty,H=(r,t,e)=>t in r?q(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,p=(r,t,e)=>H(r,typeof t!="symbol"?t+"":t,e);class J{constructor(){p(this,"isCDNUrl",(t="")=>t.includes("/cdn/")),p(this,"getOptionsPage",(t,e=25,o=1)=>({...t,per_page:e,page:o})),p(this,"delay",t=>new Promise(e=>setTimeout(e,t))),p(this,"arrayFrom",(t=0,e)=>Array.from({length:t},e)),p(this,"range",(t=0,e=t)=>{const o=Math.abs(e-t)||0,s=t<e?1:-1;return this.arrayFrom(o,(n,a)=>a*s+t)}),p(this,"asyncMap",async(t,e)=>Promise.all(t.map(e))),p(this,"flatMap",(t=[],e)=>t.map(e).reduce((o,s)=>[...o,...s],[])),p(this,"escapeHTML",function(t){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},o=/[&<>"']/g,s=new RegExp(o.source);return t&&s.test(t)?t.replace(o,n=>e[n]):t})}stringify(t,e,o){const s=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const a=t[n],l=o?"":encodeURIComponent(n);let i;typeof a=="object"?i=this.stringify(a,e?e+encodeURIComponent(`[${l}]`):l,Array.isArray(a)):i=`${e?e+encodeURIComponent(`[${l}]`):l}=${encodeURIComponent(a)}`,s.push(i)}return s.join("&")}getRegionURL(t){const e="api.storyblok.com",o="api-us.storyblok.com",s="app.storyblokchina.cn",n="api-ap.storyblok.com",a="api-ca.storyblok.com";switch(t){case"us":return o;case"cn":return s;case"ap":return n;case"ca":return a;default:return e}}}const W=function(r,t){const e={};for(const o in r){const s=r[o];t.includes(o)&&s!==null&&(e[o]=s)}return e},K=r=>r==="email",V=()=>({singleTag:"hr"}),Z=()=>({tag:"blockquote"}),G=()=>({tag:"ul"}),Y=r=>({tag:["pre",{tag:"code",attrs:r.attrs}]}),Q=()=>({singleTag:"br"}),X=r=>({tag:`h${r.attrs.level}`}),ee=r=>({singleTag:[{tag:"img",attrs:W(r.attrs,["src","alt","title"])}]}),te=()=>({tag:"li"}),re=()=>({tag:"ol"}),oe=()=>({tag:"p"}),se=r=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":r.attrs.name,emoji:r.attrs.emoji}}]}),ne=()=>({tag:"b"}),ae=()=>({tag:"s"}),le=()=>({tag:"u"}),ie=()=>({tag:"strong"}),ce=()=>({tag:"code"}),ue=()=>({tag:"i"}),de=r=>{if(!r.attrs)return{tag:""};const t=new J().escapeHTML,e={...r.attrs},{linktype:o="url"}=r.attrs;if(delete e.linktype,e.href&&(e.href=t(r.attrs.href||"")),K(o)&&(e.href=`mailto:${e.href}`),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),e.custom){for(const s in e.custom)e[s]=e.custom[s];delete e.custom}return{tag:[{tag:"a",attrs:e}]}},ge=r=>({tag:[{tag:"span",attrs:r.attrs}]}),pe=()=>({tag:"sub"}),fe=()=>({tag:"sup"}),he=r=>({tag:[{tag:"span",attrs:r.attrs}]}),ye=r=>{var t;return(t=r.attrs)!=null&&t.color?{tag:[{tag:"span",attrs:{style:`background-color:${r.attrs.color};`}}]}:{tag:""}},be=r=>{var t;return(t=r.attrs)!=null&&t.color?{tag:[{tag:"span",attrs:{style:`color:${r.attrs.color}`}}]}:{tag:""}},T={nodes:{horizontal_rule:V,blockquote:Z,bullet_list:G,code_block:Y,hard_break:Q,heading:X,image:ee,list_item:te,ordered_list:re,paragraph:oe,emoji:se},marks:{bold:ne,strike:ae,underline:le,strong:ie,code:ce,italic:ue,link:de,styled:ge,subscript:pe,superscript:fe,anchor:he,highlight:ye,textStyle:be}},me=function(r){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},e=/[&<>"']/g,o=new RegExp(e.source);return r&&o.test(r)?r.replace(e,s=>t[s]):r};let E=!1;class L{constructor(t){p(this,"marks"),p(this,"nodes"),t||(t=T),this.marks=t.marks||[],this.nodes=t.nodes||[]}addNode(t,e){this.nodes[t]=e}addMark(t,e){this.marks[t]=e}render(t,e={optimizeImages:!1},o=!0){if(!E&&o&&(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/"),E=!0),t&&t.content&&Array.isArray(t.content)){let s="";return t.content.forEach(n=>{s+=this.renderNode(n)}),e.optimizeImages?this.optimizeImages(s,e.optimizeImages):s}return console.warn(`The render method must receive an Object with a "content" field.
20
+ `}}}function ne(t){const e="virtual:storyblok-options",r=`\0${e}`;return{name:"vite-plugin-storyblok-options",async resolveId(o){if(o===e)return r},async load(o){if(o===r)return`export default ${JSON.stringify(t)}`}}}let H=!1;const F=[],ae=t=>new Promise((e,r)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=n=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}H?n():F.push(n)},document.getElementById("storyblok-javascript-bridge")))return;const o=document.createElement("script");o.async=!0,o.src=t,o.id="storyblok-javascript-bridge",o.onerror=n=>r(n),o.onload=n=>{F.forEach(s=>s()),H=!0,e(n)},document.getElementsByTagName("head")[0].appendChild(o)});var le=Object.defineProperty,ie=(t,e,r)=>e in t?le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S=(t,e,r)=>ie(t,typeof e!="symbol"?e+"":e,r);class ce{constructor(){S(this,"isCDNUrl",(e="")=>e.includes("/cdn/")),S(this,"getOptionsPage",(e,r=25,o=1)=>({...e,per_page:r,page:o})),S(this,"delay",e=>new Promise(r=>setTimeout(r,e))),S(this,"arrayFrom",(e=0,r)=>Array.from({length:e},r)),S(this,"range",(e=0,r=e)=>{const o=Math.abs(r-e)||0,n=e<r?1:-1;return this.arrayFrom(o,(s,l)=>l*n+e)}),S(this,"asyncMap",async(e,r)=>Promise.all(e.map(r))),S(this,"flatMap",(e=[],r)=>e.map(r).reduce((o,n)=>[...o,...n],[])),S(this,"escapeHTML",function(e){const r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},o=/[&<>"']/g,n=new RegExp(o.source);return e&&n.test(e)?e.replace(o,s=>r[s]):e})}stringify(e,r,o){const n=[];for(const s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const l=e[s];if(l==null)continue;const p=o?"":encodeURIComponent(s);let c;typeof l=="object"?c=this.stringify(l,r?r+encodeURIComponent(`[${p}]`):p,Array.isArray(l)):c=`${r?r+encodeURIComponent(`[${p}]`):p}=${encodeURIComponent(l)}`,n.push(c)}return n.join("&")}getRegionURL(e){const r="api.storyblok.com",o="api-us.storyblok.com",n="app.storyblokchina.cn",s="api-ap.storyblok.com",l="api-ca.storyblok.com";switch(e){case"us":return o;case"cn":return n;case"ap":return s;case"ca":return l;default:return r}}}const ue=function(t,e){const r={};for(const o in t){const n=t[o];e.includes(o)&&n!==null&&(r[o]=n)}return r},de=t=>t==="email",ge=()=>({singleTag:"hr"}),pe=()=>({tag:"blockquote"}),fe=()=>({tag:"ul"}),he=t=>({tag:["pre",{tag:"code",attrs:t.attrs}]}),be=()=>({singleTag:"br"}),ye=t=>({tag:`h${t.attrs.level}`}),me=t=>({singleTag:[{tag:"img",attrs:ue(t.attrs,["src","alt","title"])}]}),ke=()=>({tag:"li"}),$e=()=>({tag:"ol"}),we=()=>({tag:"p"}),Te=t=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":t.attrs.name,emoji:t.attrs.emoji}}]}),ve=()=>({tag:"b"}),Ce=()=>({tag:"s"}),Ee=()=>({tag:"u"}),Se=()=>({tag:"strong"}),Ie=()=>({tag:"code"}),Le=()=>({tag:"i"}),Ae=t=>{if(!t.attrs)return{tag:""};const e=new ce().escapeHTML,r={...t.attrs},{linktype:o="url"}=t.attrs;if(delete r.linktype,r.href&&(r.href=e(t.attrs.href||"")),de(o)&&(r.href=`mailto:${r.href}`),r.anchor&&(r.href=`${r.href}#${r.anchor}`,delete r.anchor),r.custom){for(const n in r.custom)r[n]=r.custom[n];delete r.custom}return{tag:[{tag:"a",attrs:r}]}},Re=t=>({tag:[{tag:"span",attrs:t.attrs}]}),xe=()=>({tag:"sub"}),je=()=>({tag:"sup"}),Oe=t=>({tag:[{tag:"span",attrs:t.attrs}]}),_e=t=>{var e;return(e=t.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${t.attrs.color};`}}]}:{tag:""}},Me=t=>{var e;return(e=t.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${t.attrs.color}`}}]}:{tag:""}},q={nodes:{horizontal_rule:ge,blockquote:pe,bullet_list:fe,code_block:he,hard_break:be,heading:ye,image:me,list_item:ke,ordered_list:$e,paragraph:we,emoji:Te},marks:{bold:ve,strike:Ce,underline:Ee,strong:Se,code:Ie,italic:Le,link:Ae,styled:Re,subscript:xe,superscript:je,anchor:Oe,highlight:_e,textStyle:Me}},Ne=function(t){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},r=/[&<>"']/g,o=new RegExp(r.source);return t&&o.test(t)?t.replace(r,n=>e[n]):t};let G=!1;class K{constructor(e){S(this,"marks"),S(this,"nodes"),e||(e=q),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,r){this.nodes[e]=r}addMark(e,r){this.marks[e]=r}render(e,r={optimizeImages:!1},o=!0){if(!G&&o&&(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/"),G=!0),e&&e.content&&Array.isArray(e.content)){let n="";return e.content.forEach(s=>{n+=this.renderNode(s)}),r.optimizeImages?this.optimizeImages(n,r.optimizeImages):n}return console.warn(`The render method must receive an Object with a "content" field.
21
21
  The "content" field must be an array of nodes as the type ISbRichtext.
22
22
  ISbRichtext:
23
23
  content?: ISbRichtext[]
@@ -40,23 +40,23 @@ Detailed information can be found here: https://github.com/storyblok/storyblok-a
40
40
  }
41
41
  ],
42
42
  type: 'doc'
43
- }`),""}optimizeImages(t,e){let o=0,s=0,n="",a="";typeof e!="boolean"&&(typeof e.width=="number"&&e.width>0&&(n+=`width="${e.width}" `,o=e.width),typeof e.height=="number"&&e.height>0&&(n+=`height="${e.height}" `,s=e.height),(e.loading==="lazy"||e.loading==="eager")&&(n+=`loading="${e.loading}" `),typeof e.class=="string"&&e.class.length>0&&(n+=`class="${e.class}" `),e.filters&&(typeof e.filters.blur=="number"&&e.filters.blur>=0&&e.filters.blur<=100&&(a+=`:blur(${e.filters.blur})`),typeof e.filters.brightness=="number"&&e.filters.brightness>=-100&&e.filters.brightness<=100&&(a+=`:brightness(${e.filters.brightness})`),e.filters.fill&&(e.filters.fill.match(/[0-9A-F]{6}/gi)||e.filters.fill==="transparent")&&(a+=`:fill(${e.filters.fill})`),e.filters.format&&["webp","png","jpeg"].includes(e.filters.format)&&(a+=`:format(${e.filters.format})`),typeof e.filters.grayscale=="boolean"&&e.filters.grayscale&&(a+=":grayscale()"),typeof e.filters.quality=="number"&&e.filters.quality>=0&&e.filters.quality<=100&&(a+=`:quality(${e.filters.quality})`),e.filters.rotate&&[90,180,270].includes(e.filters.rotate)&&(a+=`:rotate(${e.filters.rotate})`),a.length>0&&(a=`/filters${a}`))),n.length>0&&(t=t.replace(/<img/g,`<img ${n.trim()}`));const l=o>0||s>0||a.length>0?`${o}x${s}${a}`:"";return t=t.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${l}`),typeof e!="boolean"&&(e.sizes||e.srcset)&&(t=t.replace(/<img.*?src=["|'](.*?)["|']/g,i=>{var c,d;const f=i.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(f&&f.length>0){const h={srcset:(c=e.srcset)==null?void 0:c.map(g=>{if(typeof g=="number")return`//${f}/m/${g}x0${a} ${g}w`;if(typeof g=="object"&&g.length===2){let w=0,j=0;return typeof g[0]=="number"&&(w=g[0]),typeof g[1]=="number"&&(j=g[1]),`//${f}/m/${w}x${j}${a} ${w}w`}return""}).join(", "),sizes:(d=e.sizes)==null?void 0:d.map(g=>g).join(", ")};let k="";return h.srcset&&(k+=`srcset="${h.srcset}" `),h.sizes&&(k+=`sizes="${h.sizes}" `),i.replace(/<img/g,`<img ${k.trim()}`)}return i})),t}renderNode(t){const e=[];t.marks&&t.marks.forEach(s=>{const n=this.getMatchingMark(s);n&&n.tag!==""&&e.push(this.renderOpeningTag(n.tag))});const o=this.getMatchingNode(t);return o&&o.tag&&e.push(this.renderOpeningTag(o.tag)),t.content?t.content.forEach(s=>{e.push(this.renderNode(s))}):t.text?e.push(me(t.text)):o&&o.singleTag?e.push(this.renderTag(o.singleTag," /")):o&&o.html?e.push(o.html):t.type==="emoji"&&e.push(this.renderEmoji(t)),o&&o.tag&&e.push(this.renderClosingTag(o.tag)),t.marks&&t.marks.slice(0).reverse().forEach(s=>{const n=this.getMatchingMark(s);n&&n.tag!==""&&e.push(this.renderClosingTag(n.tag))}),e.join("")}renderTag(t,e){return t.constructor===String?`<${t}${e}>`:t.map(o=>{if(o.constructor===String)return`<${o}${e}>`;{let s=`<${o.tag}`;if(o.attrs){for(const n in o.attrs)if(Object.prototype.hasOwnProperty.call(o.attrs,n)){const a=o.attrs[n];a!==null&&(s+=` ${n}="${a}"`)}}return`${s}${e}>`}}).join("")}renderOpeningTag(t){return this.renderTag(t,"")}renderClosingTag(t){return t.constructor===String?`</${t}>`:t.slice(0).reverse().map(e=>e.constructor===String?`</${e}>`:`</${e.tag}>`).join("")}getMatchingNode(t){const e=this.nodes[t.type];if(typeof e=="function")return e(t)}getMatchingMark(t){const e=this.marks[t.type];if(typeof e=="function")return e(t)}renderEmoji(t){if(t.attrs.emoji)return t.attrs.emoji;const e=[{tag:"img",attrs:{src:t.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(e," /")}}const ke=r=>{if(typeof r!="object"||typeof r._editable>"u")return{};try{const t=JSON.parse(r._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return t?{"data-blok-c":JSON.stringify(t),"data-blok-uid":`${t.id}-${t.uid}`}:{}}catch{return{}}};let we,$e="https://app.storyblok.com/f/storyblok-v2-latest.js";const ve=(r,t)=>{r.addNode("blok",e=>{let o="";return e.attrs.body.forEach(s=>{o+=t(s.component,s)}),{html:o}})},Ce=r=>{var t;return!r||!((t=r==null?void 0:r.content)!=null&&t.some(e=>e.content||e.type==="blok"||e.type==="horizontal_rule"))},Se=(r,t,e)=>{let o=e||we;if(!o){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return Ce(r)?"":(t&&(o=new L(t.schema),t.resolver&&ve(o,t.resolver)),o.render(r,{},!1))},Ie=()=>U($e);function Ae(){if(!(globalThis!=null&&globalThis.storyblokApiInstance))throw new Error("storyblokApiInstance has not been initialized correctly");return globalThis.storyblokApiInstance}async function Te(r){let t=null;return r&&r.locals._storyblok_preview_data&&(t=r.locals._storyblok_preview_data),t}function Ee(r,t){var o;const e=(o=globalThis==null?void 0:globalThis.storyblokApiInstance)==null?void 0:o.richTextResolver;if(!e)throw new Error("Please initialize the Storyblok SDK before calling the renderRichText function");return Se(r,t,e)}function Le(r){return typeof r=="object"?`const storyblokInstance = new StoryblokBridge(${JSON.stringify(r)});`:"const storyblokInstance = new StoryblokBridge();"}function xe(r){const t={useCustomApi:!1,bridge:!0,componentsDir:"src",enableFallbackComponent:!1,livePreview:!1,...r},e=Le(t.bridge);return{name:"@storyblok/astro",hooks:{"astro:config:setup":({injectScript:o,updateConfig:s,addDevToolbarApp:n,addMiddleware:a,config:l})=>{if(s({vite:{plugins:[D(t.accessToken,t.useCustomApi,t.apiOptions),B(t.componentsDir,t.components,t.enableFallbackComponent,t.customFallbackComponent),F(t)]}}),t.livePreview&&(l==null?void 0:l.output)!=="server")throw new Error("To utilize the Astro Storyblok Live feature, Astro must be configured to run in SSR mode. Please disable this feature or switch Astro to SSR mode.");o("page-ssr",`
43
+ }`),""}optimizeImages(e,r){let o=0,n=0,s="",l="";typeof r!="boolean"&&(typeof r.width=="number"&&r.width>0&&(s+=`width="${r.width}" `,o=r.width),typeof r.height=="number"&&r.height>0&&(s+=`height="${r.height}" `,n=r.height),(r.loading==="lazy"||r.loading==="eager")&&(s+=`loading="${r.loading}" `),typeof r.class=="string"&&r.class.length>0&&(s+=`class="${r.class}" `),r.filters&&(typeof r.filters.blur=="number"&&r.filters.blur>=0&&r.filters.blur<=100&&(l+=`:blur(${r.filters.blur})`),typeof r.filters.brightness=="number"&&r.filters.brightness>=-100&&r.filters.brightness<=100&&(l+=`:brightness(${r.filters.brightness})`),r.filters.fill&&(r.filters.fill.match(/[0-9A-F]{6}/gi)||r.filters.fill==="transparent")&&(l+=`:fill(${r.filters.fill})`),r.filters.format&&["webp","png","jpeg"].includes(r.filters.format)&&(l+=`:format(${r.filters.format})`),typeof r.filters.grayscale=="boolean"&&r.filters.grayscale&&(l+=":grayscale()"),typeof r.filters.quality=="number"&&r.filters.quality>=0&&r.filters.quality<=100&&(l+=`:quality(${r.filters.quality})`),r.filters.rotate&&[90,180,270].includes(r.filters.rotate)&&(l+=`:rotate(${r.filters.rotate})`),l.length>0&&(l=`/filters${l}`))),s.length>0&&(e=e.replace(/<img/g,`<img ${s.trim()}`));const p=o>0||n>0||l.length>0?`${o}x${n}${l}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${p}`),typeof r!="boolean"&&(r.sizes||r.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,c=>{var u,h;const w=c.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(w&&w.length>0){const v={srcset:(u=r.srcset)==null?void 0:u.map(f=>{if(typeof f=="number")return`//${w}/m/${f}x0${l} ${f}w`;if(typeof f=="object"&&f.length===2){let I=0,j=0;return typeof f[0]=="number"&&(I=f[0]),typeof f[1]=="number"&&(j=f[1]),`//${w}/m/${I}x${j}${l} ${I}w`}return""}).join(", "),sizes:(h=r.sizes)==null?void 0:h.map(f=>f).join(", ")};let L="";return v.srcset&&(L+=`srcset="${v.srcset}" `),v.sizes&&(L+=`sizes="${v.sizes}" `),c.replace(/<img/g,`<img ${L.trim()}`)}return c})),e}renderNode(e){const r=[];e.marks&&e.marks.forEach(n=>{const s=this.getMatchingMark(n);s&&s.tag!==""&&r.push(this.renderOpeningTag(s.tag))});const o=this.getMatchingNode(e);return o&&o.tag&&r.push(this.renderOpeningTag(o.tag)),e.content?e.content.forEach(n=>{r.push(this.renderNode(n))}):e.text?r.push(Ne(e.text)):o&&o.singleTag?r.push(this.renderTag(o.singleTag," /")):o&&o.html?r.push(o.html):e.type==="emoji"&&r.push(this.renderEmoji(e)),o&&o.tag&&r.push(this.renderClosingTag(o.tag)),e.marks&&e.marks.slice(0).reverse().forEach(n=>{const s=this.getMatchingMark(n);s&&s.tag!==""&&r.push(this.renderClosingTag(s.tag))}),r.join("")}renderTag(e,r){return e.constructor===String?`<${e}${r}>`:e.map(o=>{if(o.constructor===String)return`<${o}${r}>`;{let n=`<${o.tag}`;if(o.attrs){for(const s in o.attrs)if(Object.prototype.hasOwnProperty.call(o.attrs,s)){const l=o.attrs[s];l!==null&&(n+=` ${s}="${l}"`)}}return`${n}${r}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(r=>r.constructor===String?`</${r}>`:`</${r.tag}>`).join("")}getMatchingNode(e){const r=this.nodes[e.type];if(typeof r=="function")return r(e)}getMatchingMark(e){const r=this.marks[e.type];if(typeof r=="function")return r(e)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const r=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(r," /")}}const Pe=t=>{if(typeof t!="object"||typeof t._editable>"u")return{};try{const e=JSON.parse(t._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":`${e.id}-${e.uid}`}:{}}catch{return{}}};function Be(t,e){if(!e)return{src:t,attrs:{}};let r=0,o=0;const n={},s=[];function l(c,u,h,w,v){typeof c!="number"||c<=u||c>=h?console.warn(`[StoryblokRichText] - ${w.charAt(0).toUpperCase()+w.slice(1)} value must be a number between ${u} and ${h} (inclusive)`):v.push(`${w}(${c})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(n.width=e.width,r=e.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),e.height&&typeof e.height=="number"&&e.height>0?(n.height=e.height,o=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),e.loading&&["lazy","eager"].includes(e.loading)&&(n.loading=e.loading),e.class&&(n.class=e.class),e.filters){const{filters:c}=e||{},{blur:u,brightness:h,fill:w,format:v,grayscale:L,quality:f,rotate:I}=c||{};u&&l(u,0,100,"blur",s),f&&l(f,0,100,"quality",s),h&&l(h,0,100,"brightness",s),w&&s.push(`fill(${w})`),L&&s.push("grayscale()"),I&&[0,90,180,270].includes(e.filters.rotate||0)&&s.push(`rotate(${I})`),v&&["webp","png","jpeg"].includes(v)&&s.push(`format(${v})`)}e.srcset&&(n.srcset=e.srcset.map(c=>{if(typeof c=="number")return`${t}/m/${c}x0/${s.length>0?`filters:${s.join(":")}`:""} ${c}w`;if(Array.isArray(c)&&c.length===2){const[u,h]=c;return`${t}/m/${u}x${h}/${s.length>0?`filters:${s.join(":")}`:""} ${u}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),e.sizes&&(n.sizes=e.sizes.join(", "))}let p=`${t}/m/`;return r>0&&o>0&&(p=`${p}${r}x${o}/`),s.length>0&&(p=`${p}filters:${s.join(":")}`),{src:p,attrs:n}}var y=(t=>(t.DOCUMENT="doc",t.HEADING="heading",t.PARAGRAPH="paragraph",t.QUOTE="blockquote",t.OL_LIST="ordered_list",t.UL_LIST="bullet_list",t.LIST_ITEM="list_item",t.CODE_BLOCK="code_block",t.HR="horizontal_rule",t.BR="hard_break",t.IMAGE="image",t.EMOJI="emoji",t.COMPONENT="blok",t.TABLE="table",t.TABLE_ROW="tableRow",t.TABLE_CELL="tableCell",t.TABLE_HEADER="tableHeader",t))(y||{}),E=(t=>(t.BOLD="bold",t.STRONG="strong",t.STRIKE="strike",t.UNDERLINE="underline",t.ITALIC="italic",t.CODE="code",t.LINK="link",t.ANCHOR="anchor",t.STYLED="styled",t.SUPERSCRIPT="superscript",t.SUBSCRIPT="subscript",t.TEXT_STYLE="textStyle",t.HIGHLIGHT="highlight",t))(E||{}),N=(t=>(t.TEXT="text",t))(N||{}),R=(t=>(t.URL="url",t.STORY="story",t.ASSET="asset",t.EMAIL="email",t))(R||{});const De=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Ue=(t={})=>Object.keys(t).map(e=>`${e}="${t[e]}"`).join(" "),ze=(t={})=>Object.keys(t).map(e=>`${e}: ${t[e]}`).join("; ");function He(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const x=t=>Object.fromEntries(Object.entries(t).filter(([e,r])=>r!==void 0));function W(t,e={},r){const o=Ue(e),n=o?`${t} ${o}`:t,s=Array.isArray(r)?r.join(""):r||"";if(t){if(De.includes(t))return`<${n}>`}else return s;return`<${n}>${s}</${t}>`}function Fe(t={}){const e=new Map,{renderFn:r=W,textFn:o=He,resolvers:n={},optimizeImages:s=!1,keyedResolvers:l=!1}=t,p=r!==W,c=()=>({render:(a,i={},d)=>{if(l&&a){const g=e.get(a)||0;e.set(a,g+1),i.key=`${a}-${g}`}return r(a,i,d)}}),u=a=>(i,d)=>{const g=i.attrs||{};return d.render(a,g,i.children||null)},h=(a,i)=>{const{src:d,alt:g,title:b,srcset:T,sizes:m}=a.attrs||{};let $=d,C={};if(s){const{src:dt,attrs:gt}=Be(d,s);$=dt,C=gt}const ut={src:$,alt:g,title:b,srcset:T,sizes:m,...C};return i.render("img",x(ut))},w=(a,i)=>{const{level:d,...g}=a.attrs||{};return i.render(`h${d}`,g,a.children)},v=(a,i)=>{var d,g,b,T;const m=i.render("img",{src:(d=a.attrs)==null?void 0:d.fallbackImage,alt:(g=a.attrs)==null?void 0:g.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return i.render("span",{"data-type":"emoji","data-name":(b=a.attrs)==null?void 0:b.name,"data-emoji":(T=a.attrs)==null?void 0:T.emoji},m)},L=(a,i)=>i.render("pre",a.attrs||{},i.render("code",{},a.children||"")),f=(a,i=!1)=>({text:d,attrs:g},b)=>{const{class:T,id:m,...$}=g||{},C=i?{class:T,id:m,style:ze($)||void 0}:g||{};return b.render(a,x(C),d)},I=a=>P(a),j=a=>{const{marks:i,...d}=a;if("text"in a){if(i)return i.reduce((b,T)=>I({...T,text:b}),I({...d,children:d.children}));const g=a.attrs||{};if(l){const b=e.get("txt")||0;e.set("txt",b+1),g.key=`txt-${b}`}return o(d.text,g)}return""},Y=(a,i)=>{const{linktype:d,href:g,anchor:b,...T}=a.attrs||{};let m="";switch(d){case R.ASSET:case R.URL:m=g;break;case R.EMAIL:m=`mailto:${g}`;break;case R.STORY:m=g,b&&(m=`${m}#${b}`);break;default:m=g;break}const $={...T};return m&&($.href=m),i.render("a",$,a.text)},st=(a,i)=>{var d,g;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),i.render("span",{blok:(d=a==null?void 0:a.attrs)==null?void 0:d.body[0],id:(g=a.attrs)==null?void 0:g.id,style:"display: none"})},nt=(a,i)=>{const d={},g=i.render("tbody",{},a.children);return i.render("table",d,g)},at=(a,i)=>{const d={};return i.render("tr",d,a.children)},lt=(a,i)=>{const{colspan:d,rowspan:g,colwidth:b,backgroundColor:T,...m}=a.attrs||{},$={...m};d>1&&($.colspan=d),g>1&&($.rowspan=g);const C=[];return b&&C.push(`width: ${b}px;`),T&&C.push(`background-color: ${T};`),C.length>0&&($.style=C.join(" ")),i.render("td",x($),a.children)},it=(a,i)=>{const{colspan:d,rowspan:g,colwidth:b,backgroundColor:T,...m}=a.attrs||{},$={...m};d>1&&($.colspan=d),g>1&&($.rowspan=g);const C=[];return b&&C.push(`width: ${b}px;`),T&&C.push(`background-color: ${T};`),C.length>0&&($.style=C.join(" ")),i.render("th",x($),a.children)},ct=new Map([[y.DOCUMENT,u("")],[y.HEADING,w],[y.PARAGRAPH,u("p")],[y.UL_LIST,u("ul")],[y.OL_LIST,u("ol")],[y.LIST_ITEM,u("li")],[y.IMAGE,h],[y.EMOJI,v],[y.CODE_BLOCK,L],[y.HR,u("hr")],[y.BR,u("br")],[y.QUOTE,u("blockquote")],[y.COMPONENT,st],[N.TEXT,j],[E.LINK,Y],[E.ANCHOR,Y],[E.STYLED,f("span",!0)],[E.BOLD,f("strong")],[E.TEXT_STYLE,f("span",!0)],[E.ITALIC,f("em")],[E.UNDERLINE,f("u")],[E.STRIKE,f("s")],[E.CODE,f("code")],[E.SUPERSCRIPT,f("sup")],[E.SUBSCRIPT,f("sub")],[E.HIGHLIGHT,f("mark")],[y.TABLE,nt],[y.TABLE_ROW,at],[y.TABLE_CELL,lt],[y.TABLE_HEADER,it],...Object.entries(n).map(([a,i])=>[a,i])]);function O(a){const i=ct.get(a.type);if(!i)return console.error("<Storyblok>",`No resolver found for node type ${a.type}`),"";const d=c();if(a.type==="text")return i(a,d);const g=a.content?a.content.map(P):void 0;return i({...a,children:g},d)}function P(a){return a.type==="doc"?p?a.content.map(O):a.content.map(O).join(""):Array.isArray(a)?a.map(O):O(a)}return{render:P}}let qe,Ge="https://app.storyblok.com/f/storyblok-v2-latest.js";const Ke=(t,e)=>{t.addNode("blok",r=>{let o="";return r.attrs.body.forEach(n=>{o+=e(n.component,n)}),{html:o}})},We=t=>{var e;return!t||!((e=t==null?void 0:t.content)!=null&&e.some(r=>r.content||r.type==="blok"||r.type==="horizontal_rule"))},Je=(t,e,r)=>{let o=r||qe;if(!o){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return We(t)?"":(e&&(o=new K(e.schema),e.resolver&&Ke(o,e.resolver)),o.render(t,{},!1))},Ye=()=>ae(Ge);function Ve(){if(!(globalThis!=null&&globalThis.storyblokApiInstance))throw new Error("storyblokApiInstance has not been initialized correctly");return globalThis.storyblokApiInstance}async function Xe(t){let e=null;return t&&t.locals._storyblok_preview_data&&(e=t.locals._storyblok_preview_data),e}function Ze(t,e){var o;const r=(o=globalThis==null?void 0:globalThis.storyblokApiInstance)==null?void 0:o.richTextResolver;if(!r)throw new Error("Please initialize the Storyblok SDK before calling the renderRichText function");return Je(t,e,r)}function Qe(t){return typeof t=="object"?`const storyblokInstance = new StoryblokBridge(${JSON.stringify(t)});`:"const storyblokInstance = new StoryblokBridge();"}function et(t){const e={useCustomApi:!1,bridge:!0,componentsDir:"src",enableFallbackComponent:!1,livePreview:!1,...t},r=Qe(e.bridge);return{name:"@storyblok/astro",hooks:{"astro:config:setup":({injectScript:o,updateConfig:n,addDevToolbarApp:s,addMiddleware:l,config:p})=>{if(n({vite:{plugins:[se(e.accessToken,e.useCustomApi,e.apiOptions),oe(e.componentsDir,e.components,e.enableFallbackComponent,e.customFallbackComponent),ne(e)]}}),e.livePreview&&(p==null?void 0:p.output)!=="server")throw new Error("To utilize the Astro Storyblok Live feature, Astro must be configured to run in SSR mode. Please disable this feature or switch Astro to SSR mode.");o("page-ssr",`
44
44
  import { storyblokApiInstance } from "virtual:storyblok-init";
45
45
  globalThis.storyblokApiInstance = storyblokApiInstance;
46
- `),t.bridge&&!t.livePreview&&o("page",`import { loadStoryblokBridge } from "@storyblok/astro";
46
+ `),e.bridge&&!e.livePreview&&o("page",`import { loadStoryblokBridge } from "@storyblok/astro";
47
47
  loadStoryblokBridge().then(() => {
48
48
  const { StoryblokBridge, location } = window;
49
- ${e}
49
+ ${r}
50
50
  storyblokInstance.on(["published", "change"], (event) => {
51
51
  if (!event.slugChanged) {
52
52
  location.reload(true);
53
53
  }
54
54
  });
55
55
  });
56
- `),t.livePreview&&(o("page",`import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
56
+ `),e.livePreview&&(o("page",`import { loadStoryblokBridge, handleStoryblokMessage } from "@storyblok/astro";
57
57
  loadStoryblokBridge().then(() => {
58
58
  const { StoryblokBridge, location } = window;
59
- ${e}
59
+ ${r}
60
60
  storyblokInstance.on(["published", "change", "input"], handleStoryblokMessage);
61
61
  });
62
- `),a({entrypoint:"@storyblok/astro/middleware.ts",order:"pre"})),n({id:"storyblok",name:"Storyblok",icon:y,entrypoint:"@storyblok/astro/toolbarApp.ts"})}}}}let x;async function je(r){const{action:t,story:e}=r||{};if(t==="input"&&e){const o=async()=>{const n=await Me(e),a=document.body;if(n.outerHTML===a.outerHTML)return;const l=document.querySelector('[data-blok-focused="true"]');Re(a,n,l),document.dispatchEvent(new Event("storyblok-live-preview-updated"))};clearTimeout(x),x=setTimeout(o,500)}["published","change"].includes(r==null?void 0:r.action)&&location.reload()}function Re(r,t,e){if(e){const o=e.getAttribute("data-blok-uid"),s=t.querySelector(`[data-blok-uid="${o}"]`);s&&(s.setAttribute("data-blok-focused","true"),e.replaceWith(s))}else r.replaceWith(t)}async function Me(r){const e=await(await fetch(location.href,{method:"POST",body:JSON.stringify({...r,is_storyblok_preview:!0}),headers:{"Content-Type":"application/json"}})).text();return new DOMParser().parseFromString(e,"text/html").body}u.RichTextResolver=L,u.RichTextSchema=T,u.getLiveStory=Te,u.handleStoryblokMessage=je,u.loadStoryblokBridge=Ie,u.renderRichText=Ee,u.storyblok=xe,u.storyblokEditable=ke,u.toCamelCase=m,u.useStoryblokApi=Ae,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
62
+ `),l({entrypoint:"@storyblok/astro/middleware.ts",order:"pre"})),s({id:"storyblok",name:"Storyblok",icon:A,entrypoint:"@storyblok/astro/toolbarApp.ts"})}}}}let J;async function tt(t){const{action:e,story:r}=t||{};if(e==="input"&&r){const o=async()=>{const s=await ot(r),l=document.body;if(s.outerHTML===l.outerHTML)return;const p=document.querySelector('[data-blok-focused="true"]');rt(l,s,p),document.dispatchEvent(new Event("storyblok-live-preview-updated"))};clearTimeout(J),J=setTimeout(o,500)}["published","change"].includes(t==null?void 0:t.action)&&location.reload()}function rt(t,e,r){if(r){const o=r.getAttribute("data-blok-uid"),n=e.querySelector(`[data-blok-uid="${o}"]`);n&&(n.setAttribute("data-blok-focused","true"),r.replaceWith(n))}else t.replaceWith(e)}async function ot(t){const r=await(await fetch(location.href,{method:"POST",body:JSON.stringify({...t,is_storyblok_preview:!0}),headers:{"Content-Type":"application/json"}})).text();return new DOMParser().parseFromString(r,"text/html").body}k.RichTextResolver=K,k.RichTextSchema=q,k.TextTypes=N,k.getLiveStory=Xe,k.handleStoryblokMessage=tt,k.loadStoryblokBridge=Ye,k.renderRichText=Ze,k.richTextResolver=Fe,k.storyblok=et,k.storyblokEditable=Pe,k.toCamelCase=M,k.useStoryblokApi=Ve,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@storyblok/astro",
3
3
  "type": "module",
4
- "version": "6.1.0",
4
+ "version": "6.2.0",
5
5
  "private": false,
6
6
  "packageManager": "pnpm@9.13.2",
7
7
  "description": "Official Astro integration for the Storyblok Headless CMS",
@@ -66,13 +66,14 @@
66
66
  "test:e2e": "start-server-and-test playground:test http://localhost:4321/ cy:run",
67
67
  "test:e2e-watch": "start-server-and-test playground:test http://localhost:4321/ cy:open",
68
68
  "cy:run": "cypress run",
69
- "cy:open": "cypress open"
69
+ "cy:open": "cypress open",
70
+ "check-licenses": "node scripts/license-checker.mjs"
70
71
  },
71
72
  "peerDependencies": {
72
73
  "astro": "^3.0.0 || ^4.0.0 || ^5.0.0"
73
74
  },
74
75
  "dependencies": {
75
- "@storyblok/js": "3.3.0",
76
+ "@storyblok/js": "3.5.0",
76
77
  "camelcase": "^8.0.0"
77
78
  },
78
79
  "devDependencies": {
@@ -89,6 +90,7 @@
89
90
  "eslint-config-prettier": "^9.1.0",
90
91
  "eslint-plugin-astro": "^1.3.1",
91
92
  "eslint-plugin-cypress": "^4.1.0",
93
+ "license-checker": "^25.0.1",
92
94
  "lint-staged": "^15.2.10",
93
95
  "prettier": "^3.3.3",
94
96
  "prettier-plugin-astro": "^0.13.0",