@storyblok/vue 9.4.2 → 9.4.4

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,6 +1,6 @@
1
1
  /**
2
2
  * name: @storyblok/vue
3
- * (c) 2025
3
+ * (c) 2026
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * name: @storyblok/vue
3
- * (c) 2025
3
+ * (c) 2026
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
7
- (function(v,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],h):(v=typeof globalThis<"u"?globalThis:v||self,h(v.storyblokVue={},v.Vue))})(this,function(v,h){"use strict";var ue=Object.defineProperty,he=(e,t,s)=>t in e?ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,g=(e,t,s)=>he(e,typeof t!="symbol"?t+"":t,s);let _=function(e){return e.DOCUMENT="doc",e.HEADING="heading",e.PARAGRAPH="paragraph",e.QUOTE="blockquote",e.OL_LIST="ordered_list",e.UL_LIST="bullet_list",e.LIST_ITEM="list_item",e.CODE_BLOCK="code_block",e.HR="horizontal_rule",e.BR="hard_break",e.IMAGE="image",e.EMOJI="emoji",e.COMPONENT="blok",e.TABLE="table",e.TABLE_ROW="tableRow",e.TABLE_CELL="tableCell",e.TABLE_HEADER="tableHeader",e}({}),A=function(e){return e.BOLD="bold",e.STRONG="strong",e.STRIKE="strike",e.UNDERLINE="underline",e.ITALIC="italic",e.CODE="code",e.LINK="link",e.ANCHOR="anchor",e.STYLED="styled",e.SUPERSCRIPT="superscript",e.SUBSCRIPT="subscript",e.TEXT_STYLE="textStyle",e.HIGHLIGHT="highlight",e}({}),Y=function(e){return e.TEXT="text",e}({}),P=function(e){return e.URL="url",e.STORY="story",e.ASSET="asset",e.EMAIL="email",e}({});const de=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],pe=(e={})=>{const{custom:t,...s}=e,r={...s,...t};return Object.keys(r).map(n=>`${n}="${r[n]}"`).join(" ")},fe=(e={})=>Object.keys(e).map(t=>`${t}: ${e[t]}`).join("; ");function me(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const L=e=>Object.fromEntries(Object.entries(e).filter(([t,s])=>s!==void 0));function ye(e,t){if(!t)return{src:e,attrs:{}};let s=0,r=0;const n={},o=[];function l(c,m,y,d,E){typeof c!="number"||c<=m||c>=y?console.warn(`[StoryblokRichText] - ${d.charAt(0).toUpperCase()+d.slice(1)} value must be a number between ${m} and ${y} (inclusive)`):E.push(`${d}(${c})`)}if(typeof t=="object"){if(t.width!==void 0&&(typeof t.width=="number"&&t.width>=0?(n.width=t.width,s=t.width):console.warn("[StoryblokRichText] - Width value must be a number greater than or equal to 0")),t.height!==void 0&&(typeof t.height=="number"&&t.height>=0?(n.height=t.height,r=t.height):console.warn("[StoryblokRichText] - Height value must be a number greater than or equal to 0")),t.height===0&&t.width===0&&(delete n.width,delete n.height,console.warn("[StoryblokRichText] - Width and height values cannot both be 0")),t.loading&&["lazy","eager"].includes(t.loading)&&(n.loading=t.loading),t.class&&(n.class=t.class),t.filters){const{filters:c}=t||{},{blur:m,brightness:y,fill:d,format:E,grayscale:O,quality:T,rotate:j}=c||{};m&&l(m,0,100,"blur",o),T&&l(T,0,100,"quality",o),y&&l(y,0,100,"brightness",o),d&&o.push(`fill(${d})`),O&&o.push("grayscale()"),j&&[0,90,180,270].includes(t.filters.rotate||0)&&o.push(`rotate(${j})`),E&&["webp","png","jpeg"].includes(E)&&o.push(`format(${E})`)}t.srcset&&(n.srcset=t.srcset.map(c=>{if(typeof c=="number")return`${e}/m/${c}x0/${o.length>0?`filters:${o.join(":")}`:""} ${c}w`;if(Array.isArray(c)&&c.length===2){const[m,y]=c;return`${e}/m/${m}x${y}/${o.length>0?`filters:${o.join(":")}`:""} ${m}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),t.sizes&&(n.sizes=t.sizes.join(", "))}let a=`${e}/m/`;return(s>0||r>0)&&(a=`${a}${s}x${r}/`),o.length>0&&(a=`${a}filters:${o.join(":")}`),{src:a,attrs:n}}function J(e,t={},s){const r=pe(t),n=r?`${e} ${r}`:e,o=Array.isArray(s)?s.join(""):s||"";if(e){if(de.includes(e))return`<${n}>`}else return o;return`<${n}>${o}</${e}>`}function H(e={}){const t=new Map,{renderFn:s=J,textFn:r=me,resolvers:n={},optimizeImages:o=!1,keyedResolvers:l=!1}=e,a=s!==J,c=(i={})=>{const{textAlign:u,class:p,id:f,style:b,...R}=i,k=[];return b&&k.push(b.endsWith(";")?b:`${b};`),u&&k.push(`text-align: ${u};`),L({...R,class:p,id:f,...k.length>0?{style:k.join(" ")}:{}})},m=i=>(u,p)=>{const f=c(u.attrs);return p.render(i,f,u.children||null)},y=(i,u)=>{const{src:p,alt:f,title:b,srcset:R,sizes:k}=i.attrs||{};let S=p,w={};if(o){const{src:st,attrs:rt}=ye(p,o);S=st,w=rt}const x={src:S,alt:f,title:b,srcset:R,sizes:k,...w};return u.render("img",L(x))},d=(i,u)=>{const{level:p,...f}=i.attrs||{},b=c(f);return u.render(`h${p}`,b,i.children)},E=(i,u)=>{var p,f,b,R;const k=u.render("img",{src:(p=i.attrs)==null?void 0:p.fallbackImage,alt:(f=i.attrs)==null?void 0:f.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return u.render("span",{"data-type":"emoji","data-name":(b=i.attrs)==null?void 0:b.name,"data-emoji":(R=i.attrs)==null?void 0:R.emoji},k)},O=(i,u)=>u.render("pre",i.attrs||{},u.render("code",{},i.children||"")),T=(i,u=!1)=>({text:p,attrs:f},b)=>{const{class:R,id:k,...S}=f||{},w=u?{class:R,id:k,style:fe(S)||void 0}:f||{};return b.render(i,L(w),p)},j=i=>z(i),Ke=i=>{const{marks:u,...p}=i;if("text"in i){if(u)return u.reduce((b,R)=>j({...R,text:b}),j({...p,children:p.children}));const f=i.attrs||{};if(l){const b=t.get("txt")||0;t.set("txt",b+1),f.key=`txt-${b}`}return r(p.text,f)}return""},ae=(i,u)=>{const{linktype:p,href:f,anchor:b,...R}=i.attrs||{};let k="";switch(p){case P.ASSET:case P.URL:k=f;break;case P.EMAIL:k=`mailto:${f}`;break;case P.STORY:k=f,b&&(k=`${k}#${b}`);break;default:k=f;break}const S={...R};return k&&(S.href=k),u.render("a",S,i.text)},We=(i,u)=>{var p,f;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),u.render("span",{blok:(p=i==null?void 0:i.attrs)==null?void 0:p.body[0],id:(f=i.attrs)==null?void 0:f.id,style:"display: none"})},Xe=(i,u)=>{const p=c(i.attrs),f=i.children||null;return u.render("table",p,u.render("tbody",{},f))},Qe=(i,u)=>{const p=c(i.attrs);return u.render("tr",p,i.children)},Ze=(i,u)=>{const{colspan:p,rowspan:f,colwidth:b,backgroundColor:R,textAlign:k,...S}=i.attrs||{},w=[];b&&w.push(`width: ${b}px;`),R&&w.push(`background-color: ${R};`),k&&w.push(`text-align: ${k};`);const x={...S,...p>1?{colspan:p}:{},...f>1?{rowspan:f}:{},...w.length>0?{style:w.join(" ")}:{}};return u.render("td",L(x),i.children)},et=(i,u)=>{const{colspan:p,rowspan:f,colwidth:b,backgroundColor:R,textAlign:k,...S}=i.attrs||{},w=[];b&&w.push(`width: ${b}px;`),R&&w.push(`background-color: ${R};`),k&&w.push(`text-align: ${k};`);const x={...S,...p>1?{colspan:p}:{},...f>1?{rowspan:f}:{},...w.length>0?{style:w.join(" ")}:{}};return u.render("th",L(x),i.children)},le=new Map([[_.DOCUMENT,m("")],[_.HEADING,d],[_.PARAGRAPH,m("p")],[_.UL_LIST,m("ul")],[_.OL_LIST,m("ol")],[_.LIST_ITEM,m("li")],[_.IMAGE,y],[_.EMOJI,E],[_.CODE_BLOCK,O],[_.HR,m("hr")],[_.BR,m("br")],[_.QUOTE,m("blockquote")],[_.COMPONENT,We],[Y.TEXT,Ke],[A.LINK,ae],[A.ANCHOR,ae],[A.STYLED,T("span",!0)],[A.BOLD,T("strong")],[A.TEXT_STYLE,T("span",!0)],[A.ITALIC,T("em")],[A.UNDERLINE,T("u")],[A.STRIKE,T("s")],[A.CODE,T("code")],[A.SUPERSCRIPT,T("sup")],[A.SUBSCRIPT,T("sub")],[A.HIGHLIGHT,T("mark")],[_.TABLE,Xe],[_.TABLE_ROW,Qe],[_.TABLE_CELL,Ze],[_.TABLE_HEADER,et]]),ce=new Map([...le,...Object.entries(n).map(([i,u])=>[i,u])]),tt=()=>({render:(i,u={},p)=>{if(l&&i){const f=t.get(i)||0;t.set(i,f+1),u.key=`${i}-${f}`}return s(i,u,p)},originalResolvers:le,mergedResolvers:ce});function D(i){const u=ce.get(i.type);if(!u)return console.error("<Storyblok>",`No resolver found for node type ${i.type}`),"";const p=tt();if(i.type==="text")return u(i,p);const f=i.content?i.content.map(z):void 0;return u({...i,children:f},p)}function z(i){return i.type==="doc"?a?i.content.map(D):i.content.map(D).join(""):Array.isArray(i)?i.map(D):D(i)}return{render:z}}let K=!1;const W=[],ge=e=>new Promise((t,s)=>{if(typeof window>"u"){s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));return}if(window.storyblokRegisterEvent=n=>{if(!window.location.search.includes("_storyblok")){console.warn("You are not in Draft Mode or in the Visual Editor.");return}K?n():W.push(n)},document.getElementById("storyblok-javascript-bridge")){t(void 0);return}const r=document.createElement("script");r.async=!0,r.src=e,r.id="storyblok-javascript-bridge",r.onerror=n=>s(n),r.onload=n=>{W.forEach(o=>o()),K=!0,t(n)},document.getElementsByTagName("head")[0].appendChild(r)}),X=(e="")=>e.includes("/cdn/"),be=(e,t=25,s=1)=>({...e,per_page:t,page:s}),ke=e=>new Promise(t=>setTimeout(t,e)),ve=(e=0,t)=>Array.from({length:e},t),_e=(e=0,t=e)=>{const s=Math.abs(t-e)||0,r=e<t?1:-1;return ve(s,(n,o)=>o*r+e)},Re=async(e,t)=>Promise.all(e.map(t)),we=(e=[],t)=>e.map(t).reduce((s,r)=>[...s,...r],[]),U=(e,t,s)=>{const r=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const o=e[n];if(o==null)continue;const l=s?"":encodeURIComponent(n);let a;typeof o=="object"?a=U(o,t?t+encodeURIComponent(`[${l}]`):l,Array.isArray(o)):a=`${t?t+encodeURIComponent(`[${l}]`):l}=${encodeURIComponent(o)}`,r.push(a)}return r.join("&")},Q=e=>{const t={eu:"api.storyblok.com",us:"api-us.storyblok.com",cn:"app.storyblokchina.cn",ap:"api-ap.storyblok.com",ca:"api-ca.storyblok.com"};return t[e]??t.eu};var Te=class{constructor(e){g(this,"baseURL"),g(this,"timeout"),g(this,"headers"),g(this,"responseInterceptor"),g(this,"fetch"),g(this,"ejectInterceptor"),g(this,"url"),g(this,"parameters"),g(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(r=>{s.data=r});for(const r of e.headers.entries())t[r[0]]=r[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;e==="get"?t=`${this.baseURL}${this.url}?${U(this.parameters)}`:s=JSON.stringify(this.parameters);const r=new URL(t),n=new AbortController,{signal:o}=n;let l=null;this.timeout&&(l=setTimeout(()=>n.abort(),this.timeout));try{const a=await this.fetch(`${r}`,{method:e,headers:this.headers,body:s,signal:o,...this.fetchOptions});this.timeout&&l&&clearTimeout(l);const c=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(c)):this._statusHandler(c)}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}_normalizeErrorMessage(e){if(Array.isArray(e))return e[0]||"Unknown error";if(e&&typeof e=="object"){if(e.error)return e.error;for(const t in e){if(Array.isArray(e[t]))return`${t}: ${e[t][0]}`;if(typeof e[t]=="string")return`${t}: ${e[t]}`}if(e.slug)return e.slug}return"Unknown error"}_statusHandler(e){const t=/20[0-6]/g;return new Promise((s,r)=>{if(t.test(`${e.status}`))return s(e);const n={message:this._normalizeErrorMessage(e.data),status:e.status,response:e};r(n)})}},Ae=Te;const Z="SB-Agent",B={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"7.0.0"},ee={DRAFT:"draft",PUBLISHED:"published"},Ee=25,F={SMALL:25,MEDIUM:50,LARGE:75},C={SINGLE_OR_SMALL:50,MEDIUM:15,LARGE:10,VERY_LARGE:6},V=1e3,q=3;function Se(e){return e.version===ee.DRAFT}function $e(e,t){const s=e.includes("/cdn/stories/"),r=e.split("/").length>3&&!e.endsWith("/cdn/stories"),n="find_by"in t;return s&&r||n}function Le(e){return e<=F.SMALL?C.SINGLE_OR_SMALL:e<=F.MEDIUM?C.MEDIUM:e<=F.LARGE?C.LARGE:C.VERY_LARGE}function M(e,t,s={},r){if(s.userRateLimit!==void 0)return Math.min(s.userRateLimit,V);if(s.serverHeadersRateLimit!==void 0)return Math.min(s.serverHeadersRateLimit,V);if(t&&!Se(t))return V;if(r!==void 0)return r;if($e(e,t))return C.SINGLE_OR_SMALL;const n=t.per_page||Ee;return Le(n)}function Ce(e){if(!e)return null;const t=e["x-ratelimit"]||e["X-RateLimit"],s=e["x-ratelimit-policy"]||e["X-RateLimit-Policy"];if(!t&&!s)return null;const r={};if(t){const n=t.match(/r=(\d+)/);n&&(r.remaining=Number.parseInt(n[1],10))}if(s){const n=s.match(/q=(\d+)/);n&&(r.max=Number.parseInt(n[1],10))}return Object.keys(r).length>0?r:null}function Ie(e,t=!1){return{userRateLimit:e,serverHeadersRateLimit:void 0,isManagementApi:t}}var Oe=class extends Error{constructor(e){super(e),this.name="AbortError"}};function je(e,t,s){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(s))throw new TypeError("Expected `interval` to be a finite number");const r=[];let n=[],o=0,l=!1;const a=async()=>{o++;const m=r.shift();if(m)try{const d=await e(...m.args);m.resolve(d)}catch(d){m.reject(d)}const y=setTimeout(()=>{o--,r.length>0&&a(),n=n.filter(d=>d!==y)},s);n.includes(y)||n.push(y)},c=(...m)=>l?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((y,d)=>{r.push({resolve:y,reject:d,args:m}),o<t&&a()});return c.abort=()=>{l=!0,n.forEach(clearTimeout),n=[],r.forEach(m=>m.reject(()=>new Oe("Throttle function aborted"))),r.length=0},c}var xe=je,Pe=class{constructor(e,t=1e3){g(this,"queues"),g(this,"interval"),g(this,"throttledRequestFn"),this.queues=new Map,this.interval=t,this.throttledRequestFn=e}getQueue(e){let t=this.queues.get(e);return t||(t=xe(this.throttledRequestFn,e,this.interval),this.queues.set(e,t)),t}execute(e,...t){return this.getQueue(e)(...t)}abortAll(){this.queues.forEach(e=>{var t;(t=e.abort)==null||t.call(e)}),this.queues.clear()}getQueueCount(){return this.queues.size}};let N={};const $={};var Me=class{constructor(e,t){g(this,"client"),g(this,"maxRetries"),g(this,"retriesDelay"),g(this,"throttleManager"),g(this,"accessToken"),g(this,"cache"),g(this,"resolveCounter"),g(this,"relations"),g(this,"links"),g(this,"version"),g(this,"rateLimitConfig"),g(this,"richTextResolver"),g(this,"resolveNestedRelations"),g(this,"stringifiedStoriesCache"),g(this,"inlineAssets");let s=e.endpoint||t;if(!s){const n=e.https===!1?"http":"https";e.oauthToken?s=`${n}://${Q(e.region)}/v1`:s=`${n}://${Q(e.region)}/v2`}const r=new Headers;r.set("Content-Type","application/json"),r.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([n,o])=>{r.set(n,o)}),r.has(Z)||(r.set(Z,B.defaultAgentName),r.set(B.defaultAgentVersion,B.packageVersion)),e.oauthToken&&r.set("Authorization",e.oauthToken),this.rateLimitConfig=Ie(e.rateLimit,!!e.oauthToken),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttleManager=new Pe(this.throttledRequest.bind(this),1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.version=e.version||ee.PUBLISHED,this.inlineAssets=e.inlineAssets||!1,this.client=new Ae({baseURL:s,timeout:e.timeout||0,headers:r,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=$[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 X(e)?this.parseParams(t):t}makeRequest(e,t,s,r,n){const o=this.factoryParamOptions(e,be(t,s,r));return this.cacheResponse(e,o,void 0,n)}get(e,t={},s){t||(t={});const r=`/${e}`;X(r)&&(t.version=t.version||this.version);const n=this.factoryParamOptions(r,t);return this.cacheResponse(r,n,void 0,s)}async getAll(e,t={},s,r){const n=(t==null?void 0:t.per_page)||25,o=`/${e}`.replace(/\/$/,""),l=s??o.substring(o.lastIndexOf("/")+1);t.version=t.version||this.version;const a=1,c=await this.makeRequest(o,t,n,a,r),m=c.total?Math.ceil(c.total/(c.perPage||n)):1,y=await Re(_e(a,m),d=>this.makeRequest(o,t,n,d+1,r));return we([c,...y],d=>Object.values(d.data[l]))}post(e,t={},s){const r=`/${e}`,n=M(void 0,void 0,this.rateLimitConfig,q);return this.throttleManager.execute(n,"post",r,t,s)}put(e,t={},s){const r=`/${e}`,n=M(void 0,void 0,this.rateLimitConfig,q);return this.throttleManager.execute(n,"put",r,t,s)}delete(e,t={},s){t||(t={});const r=`/${e}`,n=M(void 0,void 0,this.rateLimitConfig,q);return this.throttleManager.execute(n,"delete",r,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 r=e[t];r&&r.fieldtype==="multilink"&&r.linktype==="story"&&typeof r.id=="string"&&this.links[s][r.id]?r.story=this._cleanCopy(this.links[s][r.id]):r&&r.linktype==="story"&&typeof r.uuid=="string"&&this.links[s][r.uuid]&&(r.story=this._cleanCopy(this.links[s][r.uuid]))}getStoryReference(e,t){return this.relations[e][t]?JSON.parse(this.stringifiedStoriesCache[t]||JSON.stringify(this.relations[e][t])):t}_resolveField(e,t,s){const r=e[t];typeof r=="string"?e[t]=this.getStoryReference(s,r):Array.isArray(r)&&(e[t]=r.map(n=>this.getStoryReference(s,n)).filter(Boolean))}_insertRelations(e,t,s,r){if(Array.isArray(s)?s.find(o=>o.endsWith(`.${t}`)):s.endsWith(`.${t}`)){this._resolveField(e,t,r);return}const n=e.component?`${e.component}.${t}`:t;(Array.isArray(s)?s.includes(n):s===n)&&this._resolveField(e,t,r)}iterateTree(e,t,s){const r=(n,o="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((l,a)=>r(l,`${o}[${a}]`));else if(typeof n=="object")for(const l in n){const a=o?`${o}.${l}`:l;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,l,t,s),this._insertLinks(n,l,s)),r(n[l],a)}}};r(e.content)}async resolveLinks(e,t,s){let r=[];if(e.link_uuids){const n=e.link_uuids.length,o=[],l=50;for(let a=0;a<n;a+=l){const c=Math.min(n,a+l);o.push(e.link_uuids.slice(a,c))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:o[a].join(",")})).data.stories.forEach(c=>{r.push(c)})}else r=e.links;r.forEach(n=>{this.links[s][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,s){let r=[];if(e.rel_uuids){const n=e.rel_uuids.length,o=[],l=50;for(let a=0;a<n;a+=l){const c=Math.min(n,a+l);o.push(e.rel_uuids.slice(a,c))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:o[a].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(c=>{r.push(c)});r.length>0&&(e.rels=r,delete e.rel_uuids)}else r=e.rels;r&&r.length>0&&r.forEach(n=>{this.relations[s][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,s){var r,n;let o=[];if(this.links[s]={},this.relations[s]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(o=t.resolve_relations.split(",")),await this.resolveRelations(e,t,s)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((r=e.links)!=null&&r.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],o,s);e.story?this.iterateTree(e.story,o,s):e.stories.forEach(l=>{this.iterateTree(l,o,s)}),this.stringifiedStoriesCache={},delete this.links[s],delete this.relations[s]}async cacheResponse(e,t,s,r){const n=U({url:e,params:t}),o=this.cacheProvider();if(t.version==="published"&&e!=="/cdn/spaces/me"){const a=await o.get(n);if(a)return Promise.resolve(a)}const l=M(e,t,this.rateLimitConfig);return new Promise(async(a,c)=>{var m;try{const y=await this.throttleManager.execute(l,"get",e,t,r);if(y.status!==200)return c(y);let d={data:y.data,headers:y.headers};const E=Ce(y.headers);if((E==null?void 0:E.max)!==void 0&&(this.rateLimitConfig.serverHeadersRateLimit=E.max),(m=y.headers)!=null&&m["per-page"]&&(d=Object.assign({},d,{perPage:y.headers["per-page"]?Number.parseInt(y.headers["per-page"]):0,total:y.headers["per-page"]?Number.parseInt(y.headers.total):0})),d.data.story||d.data.stories){const T=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(d.data,t,`${T}`),d=await this.processInlineAssets(d)}t.version==="published"&&e!=="/cdn/spaces/me"&&await o.set(n,d);const O=this.cache.clear==="onpreview"&&t.version==="draft"||this.cache.clear==="auto";return t.token&&d.data.cv&&(O&&$[t.token]&&$[t.token]!==d.data.cv&&await this.flushCache(),$[t.token]=d.data.cv),a(d)}catch(y){if(y.response&&y.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 ke(this.retriesDelay),this.cacheResponse(e,t,s).then(a).catch(c);c(y)}})}throttledRequest(e,t,s,r){return this.client.setFetchOptions(r),this.client[e](t,s)}cacheVersions(){return $}cacheVersion(){return $[this.accessToken]}setCacheVersion(e){this.accessToken&&($[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&($[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(N[e])},getAll(){return Promise.resolve(N)},set(e,t){return N[e]=t,Promise.resolve(void 0)},flush(){return N={},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}async processInlineAssets(e){if(!this.inlineAssets)return e;const t=s=>{if(!s||typeof s!="object")return s;if(Array.isArray(s))return s.map(n=>t(n));let r={...s};r.fieldtype==="asset"&&Array.isArray(e.data.assets)&&(r={...e.data.assets.find(n=>n.id===r.id),...r});for(const n in r)typeof r[n]=="object"&&(r[n]=t(r[n]));return r};return e.data.story&&(e.data.story.content=t(e.data.story.content)),e.data.stories&&(e.data.stories=e.data.stories.map(s=>(s.content=t(s.content),s))),e}},te=Me;const Ne=(e={})=>{const{apiOptions:t}=e;if(!t||!t.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 te(t)}},De=e=>{if(typeof e!="object"||typeof e._editable>"u")return{};try{const t=JSON.parse(e._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return t?{"data-blok-c":JSON.stringify(t),"data-blok-uid":`${t.id}-${t.uid}`}:{}}catch{return{}}};let se="https://app.storyblok.com/f/storyblok-v2-latest.js";const re=(e,t,s={})=>{var r;const n=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",o=new URL((r=window.location)==null?void 0:r.href).searchParams.get("_storyblok"),l=o!==null&&+o===e;if(!(!n||!l)){if(!e){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(s).on(["input","published","change"],a=>{var c;a&&(a.action==="input"&&((c=a.story)==null?void 0:c.id)===e?t(a.story):(a.action==="change"||a.action==="published")&&a.storyId===e&&window.location.reload())})})}},He=(e={})=>{var t,s;const{bridge:r,accessToken:n,use:o=[],apiOptions:l={},bridgeUrl:a}=e;l.accessToken=l.accessToken||n;const c={bridge:r,apiOptions:l};let m={};o.forEach(d=>{m={...m,...d(c)}}),a&&(se=a);const y=!(typeof window>"u")&&((s=(t=window.location)==null?void 0:t.search)==null?void 0:s.includes("_storyblok_tk"));return r!==!1&&y&&ge(se),m};function Ue(e,t){return H(t).render(e)}const G=h.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(e,{expose:t}){var a;const s=e,r=h.ref();t({value:r});const n=typeof h.resolveDynamicComponent(s.blok.component)!="string",o=h.inject("VueSDKOptions"),l=h.ref((a=s.blok.component)==null?void 0:a.replace(/_/g,"-"));return!n&&o&&(o.enableFallbackComponent?(l.value=o.customFallbackComponent??"FallbackComponent",typeof h.resolveDynamicComponent(l.value)=="string"&&console.error(`Is the Fallback component "${l.value}" registered properly?`)):console.error(`Component could not be found for blok "${s.blok.component}"! Is it defined in main.ts as "app.component("${s.blok.component}", ${s.blok.component});"?`)),(c,m)=>(h.openBlock(),h.createBlock(h.resolveDynamicComponent(l.value),h.mergeProps({ref_key:"blokRef",ref:r},{...c.$props,...c.$attrs}),h.createSlots({_:2},[h.renderList(c.$slots,(y,d)=>({name:d,fn:h.withCtx(E=>[h.renderSlot(c.$slots,d,h.normalizeProps(h.guardReactiveProps(E)))])}))]),1040))}}),Be=e=>{var s;const t=(s=e==null?void 0:e.attrs)==null?void 0:s.body;return!Array.isArray(t)||t.length===0?[]:t.map(r=>{var n;return h.h(G,{blok:r,id:(n=e==null?void 0:e.attrs)==null?void 0:n.id},e.children)})};function ne(e){const t={renderFn:h.h,textFn:h.createTextVNode,keyedResolvers:!0,resolvers:{[_.COMPONENT]:Be,...e.resolvers}};return H(t)}const oe=h.defineComponent({__name:"StoryblokRichText",props:{doc:{},resolvers:{}},setup(e){const t=e,s=h.ref(),r=()=>s.value;return h.watch([()=>t.doc,()=>t.resolvers],([n,o])=>{const{render:l}=ne({resolvers:o??{}});s.value=l(n)},{immediate:!0,deep:!0}),(n,o)=>(h.openBlock(),h.createBlock(r))}}),Fe={beforeMount(e,t){if(t.value){const s=De(t.value);Object.keys(s).length>0&&(e.setAttribute("data-blok-c",s["data-blok-c"]),e.setAttribute("data-blok-uid",s["data-blok-uid"]),e.classList.add("storyblok__outline"))}}},ie=e=>{console.error(`You can't use ${e} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
8
- `)};let I=null;const Ve=()=>(I||ie("useStoryblokApi"),I),qe=async(e,t={},s={})=>{const r=h.ref(null);if(s.resolveRelations=s.resolveRelations??t.resolve_relations,s.resolveLinks=s.resolveLinks??t.resolve_links,h.onMounted(()=>{r.value&&r.value.id&&re(r.value.id,n=>r.value=n,s)}),I){const{data:n}=await I.get(`cdn/stories/${e}`,t);r.value=n.story}else ie("useStoryblok");return r},Ge={install(e,t={}){e.directive("editable",Fe),e.component("StoryblokComponent",G),e.component("StoryblokRichText",oe),t.enableFallbackComponent&&!t.customFallbackComponent&&e.component("FallbackComponent",h.defineAsyncComponent(()=>Promise.resolve().then(()=>Je)));const{storyblokApi:s}=He(t);I=s||null,e.provide("VueSDKOptions",t)}},ze={class:"fallback-component"},Ye={class:"component"},Je=Object.freeze(Object.defineProperty({__proto__:null,default:((e,t)=>{const s=e.__vccOpts||e;for(const[r,n]of t)s[r]=n;return s})(h.defineComponent({__name:"FallbackComponent",props:{blok:{}},setup(e){return(t,s)=>(h.openBlock(),h.createElementBlock("div",ze,[h.createElementVNode("p",null,[s[0]||(s[0]=h.createTextVNode(" Component could not be found for blok ",-1)),h.createElementVNode("span",Ye,h.toDisplayString(t.blok.component),1),s[1]||(s[1]=h.createTextVNode("! Is it configured correctly? ",-1))])]))}}),[["__scopeId","data-v-9abcd1f2"]])},Symbol.toStringTag,{value:"Module"}));v.BlockTypes=_,v.MarkTypes=A,v.StoryblokClient=te,v.StoryblokComponent=G,v.StoryblokRichText=oe,v.StoryblokVue=Ge,v.TextTypes=Y,v.apiPlugin=Ne,v.renderRichText=Ue,v.richTextResolver=H,v.useStoryblok=qe,v.useStoryblokApi=Ve,v.useStoryblokBridge=re,v.useStoryblokRichText=ne,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
7
+ (function(_,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],d):(_=typeof globalThis<"u"?globalThis:_||self,d(_.storyblokVue={},_.Vue))})(this,function(_,d){"use strict";var ue=Object.defineProperty,he=(e,t,s)=>t in e?ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,y=(e,t,s)=>he(e,typeof t!="symbol"?t+"":t,s);let R=function(e){return e.DOCUMENT="doc",e.HEADING="heading",e.PARAGRAPH="paragraph",e.QUOTE="blockquote",e.OL_LIST="ordered_list",e.UL_LIST="bullet_list",e.LIST_ITEM="list_item",e.CODE_BLOCK="code_block",e.HR="horizontal_rule",e.BR="hard_break",e.IMAGE="image",e.EMOJI="emoji",e.COMPONENT="blok",e.TABLE="table",e.TABLE_ROW="tableRow",e.TABLE_CELL="tableCell",e.TABLE_HEADER="tableHeader",e}({}),E=function(e){return e.BOLD="bold",e.STRONG="strong",e.STRIKE="strike",e.UNDERLINE="underline",e.ITALIC="italic",e.CODE="code",e.LINK="link",e.ANCHOR="anchor",e.STYLED="styled",e.SUPERSCRIPT="superscript",e.SUBSCRIPT="subscript",e.TEXT_STYLE="textStyle",e.HIGHLIGHT="highlight",e}({}),J=function(e){return e.TEXT="text",e}({}),P=function(e){return e.URL="url",e.STORY="story",e.ASSET="asset",e.EMAIL="email",e}({});const de=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],pe=(e={})=>{const{custom:t,...s}=e,r={...s,...t};return Object.keys(r).map(n=>`${n}="${r[n]}"`).join(" ")},fe=(e={})=>Object.keys(e).map(t=>`${t}: ${e[t]}`).join("; ");function me(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const I=e=>Object.fromEntries(Object.entries(e).filter(([t,s])=>s!==void 0));function ye(e,t){if(!t)return{src:e,attrs:{}};let s=0,r=0;const n={},o=[];function l(c,p,k,h,v){typeof c!="number"||c<=p||c>=k?console.warn(`[StoryblokRichText] - ${h.charAt(0).toUpperCase()+h.slice(1)} value must be a number between ${p} and ${k} (inclusive)`):v.push(`${h}(${c})`)}if(typeof t=="object"){if(t.width!==void 0&&(typeof t.width=="number"&&t.width>=0?(n.width=t.width,s=t.width):console.warn("[StoryblokRichText] - Width value must be a number greater than or equal to 0")),t.height!==void 0&&(typeof t.height=="number"&&t.height>=0?(n.height=t.height,r=t.height):console.warn("[StoryblokRichText] - Height value must be a number greater than or equal to 0")),t.height===0&&t.width===0&&(delete n.width,delete n.height,console.warn("[StoryblokRichText] - Width and height values cannot both be 0")),t.loading&&["lazy","eager"].includes(t.loading)&&(n.loading=t.loading),t.class&&(n.class=t.class),t.filters){const{filters:c}=t||{},{blur:p,brightness:k,fill:h,format:v,grayscale:L,quality:A,rotate:C}=c||{};p&&l(p,0,100,"blur",o),A&&l(A,0,100,"quality",o),k&&l(k,0,100,"brightness",o),h&&o.push(`fill(${h})`),L&&o.push("grayscale()"),C&&[0,90,180,270].includes(t.filters.rotate||0)&&o.push(`rotate(${C})`),v&&["webp","png","jpeg"].includes(v)&&o.push(`format(${v})`)}t.srcset&&(n.srcset=t.srcset.map(c=>{if(typeof c=="number")return`${e}/m/${c}x0/${o.length>0?`filters:${o.join(":")}`:""} ${c}w`;if(Array.isArray(c)&&c.length===2){const[p,k]=c;return`${e}/m/${p}x${k}/${o.length>0?`filters:${o.join(":")}`:""} ${p}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),t.sizes&&(n.sizes=t.sizes.join(", "))}let a=`${e}/m/`;return(s>0||r>0)&&(a=`${a}${s}x${r}/`),o.length>0&&(a=`${a}filters:${o.join(":")}`),{src:a,attrs:n}}function K(e,t={},s){const r=pe(t),n=r?`${e} ${r}`:e,o=Array.isArray(s)?s.join(""):s||"";if(e){if(de.includes(e))return`<${n}>`}else return o;return`<${n}>${o}</${e}>`}function U(e={}){const t=new Map,{renderFn:s=K,textFn:r=me,resolvers:n={},optimizeImages:o=!1,keyedResolvers:l=!1}=e,a=s!==K,c=(i={})=>{const{textAlign:u,class:f,id:m,style:g,...w}=i,b=[];return g&&b.push(g.endsWith(";")?g:`${g};`),u&&b.push(`text-align: ${u};`),I({...w,class:f,id:m,...b.length>0?{style:b.join(" ")}:{}})},p=i=>(u,f)=>{const m=c(u.attrs);return f.render(i,m,u.children||null)},k=(i,u)=>{const{src:f,alt:m,title:g,srcset:w,sizes:b}=i.attrs||{};let S=f,T={};if(o){const{src:st,attrs:rt}=ye(f,o);S=st,T=rt}const x={src:S,alt:m,title:g,srcset:w,sizes:b,...T};return u.render("img",I(x))},h=(i,u)=>{const{level:f,...m}=i.attrs||{},g=c(m);return u.render(`h${f}`,g,i.children)},v=(i,u)=>{var f,m,g,w;const b=u.render("img",{src:(f=i.attrs)==null?void 0:f.fallbackImage,alt:(m=i.attrs)==null?void 0:m.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return u.render("span",{"data-type":"emoji","data-name":(g=i.attrs)==null?void 0:g.name,"data-emoji":(w=i.attrs)==null?void 0:w.emoji},b)},L=(i,u)=>u.render("pre",i.attrs||{},u.render("code",{},i.children||"")),A=(i,u=!1)=>({text:f,attrs:m},g)=>{const{class:w,id:b,...S}=m||{},T=u?{class:w,id:b,style:fe(S)||void 0}:m||{};return g.render(i,I(T),f)},C=i=>Y(i),Ke=i=>{const{marks:u,...f}=i;if("text"in i){if(u)return u.reduce((g,w)=>C({...w,text:g}),C({...f,children:f.children}));const m=i.attrs||{};if(l){const g=t.get("txt")||0;t.set("txt",g+1),m.key=`txt-${g}`}return r(f.text,m)}return""},ae=(i,u)=>{const{linktype:f,href:m,anchor:g,...w}=i.attrs||{};let b="";switch(f){case P.ASSET:case P.URL:b=m;break;case P.EMAIL:b=`mailto:${m}`;break;case P.STORY:b=m,g&&(b=`${b}#${g}`);break;default:b=m;break}const S={...w};return b&&(S.href=b),u.render("a",S,i.text)},We=(i,u)=>{var f,m;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),u.render("span",{blok:(f=i==null?void 0:i.attrs)==null?void 0:f.body[0],id:(m=i.attrs)==null?void 0:m.id,style:"display: none"})},Xe=(i,u)=>{const f=c(i.attrs),m=i.children||null;return u.render("table",f,u.render("tbody",{},m))},Qe=(i,u)=>{const f=c(i.attrs);return u.render("tr",f,i.children)},Ze=(i,u)=>{const{colspan:f,rowspan:m,colwidth:g,backgroundColor:w,textAlign:b,...S}=i.attrs||{},T=[];g&&T.push(`width: ${g}px;`),w&&T.push(`background-color: ${w};`),b&&T.push(`text-align: ${b};`);const x={...S,...f>1?{colspan:f}:{},...m>1?{rowspan:m}:{},...T.length>0?{style:T.join(" ")}:{}};return u.render("td",I(x),i.children)},et=(i,u)=>{const{colspan:f,rowspan:m,colwidth:g,backgroundColor:w,textAlign:b,...S}=i.attrs||{},T=[];g&&T.push(`width: ${g}px;`),w&&T.push(`background-color: ${w};`),b&&T.push(`text-align: ${b};`);const x={...S,...f>1?{colspan:f}:{},...m>1?{rowspan:m}:{},...T.length>0?{style:T.join(" ")}:{}};return u.render("th",I(x),i.children)},le=new Map([[R.DOCUMENT,p("")],[R.HEADING,h],[R.PARAGRAPH,p("p")],[R.UL_LIST,p("ul")],[R.OL_LIST,p("ol")],[R.LIST_ITEM,p("li")],[R.IMAGE,k],[R.EMOJI,v],[R.CODE_BLOCK,L],[R.HR,p("hr")],[R.BR,p("br")],[R.QUOTE,p("blockquote")],[R.COMPONENT,We],[J.TEXT,Ke],[E.LINK,ae],[E.ANCHOR,ae],[E.STYLED,A("span",!0)],[E.BOLD,A("strong")],[E.TEXT_STYLE,A("span",!0)],[E.ITALIC,A("em")],[E.UNDERLINE,A("u")],[E.STRIKE,A("s")],[E.CODE,A("code")],[E.SUPERSCRIPT,A("sup")],[E.SUBSCRIPT,A("sub")],[E.HIGHLIGHT,A("mark")],[R.TABLE,Xe],[R.TABLE_ROW,Qe],[R.TABLE_CELL,Ze],[R.TABLE_HEADER,et]]),ce=new Map([...le,...Object.entries(n).map(([i,u])=>[i,u])]),tt=()=>({render:(i,u={},f)=>{if(l&&i){const m=t.get(i)||0;t.set(i,m+1),u.key=`${i}-${m}`}return s(i,u,f)},originalResolvers:le,mergedResolvers:ce});function H(i){const u=ce.get(i.type);if(!u)return console.error("<Storyblok>",`No resolver found for node type ${i.type}`),"";const f=tt();if(i.type==="text")return u(i,f);const m=i.content?i.content.map(Y):void 0;return u({...i,children:m},f)}function Y(i){return i.type==="doc"?a?i.content.map(H):i.content.map(H).join(""):Array.isArray(i)?i.map(H):H(i)}return{render:Y}}let W=!1;const X=[],ge=e=>new Promise((t,s)=>{if(typeof window>"u"){s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));return}if(window.storyblokRegisterEvent=n=>{if(!window.location.search.includes("_storyblok")){console.warn("You are not in Draft Mode or in the Visual Editor.");return}W?n():X.push(n)},document.getElementById("storyblok-javascript-bridge")){t(void 0);return}const r=document.createElement("script");r.async=!0,r.src=e,r.id="storyblok-javascript-bridge",r.onerror=n=>s(n),r.onload=n=>{X.forEach(o=>o()),W=!0,t(n)},document.getElementsByTagName("head")[0].appendChild(r)}),B=(e="")=>e.includes("/cdn/"),be=(e,t=25,s=1)=>({...e,per_page:t,page:s}),ke=e=>new Promise(t=>setTimeout(t,e)),ve=(e=0,t)=>Array.from({length:e},t),_e=(e=0,t=e)=>{const s=Math.abs(t-e)||0,r=e<t?1:-1;return ve(s,(n,o)=>o*r+e)},Re=async(e,t)=>Promise.all(e.map(t)),we=(e=[],t)=>e.map(t).reduce((s,r)=>[...s,...r],[]),F=(e,t,s)=>{const r=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const o=e[n];if(o==null)continue;const l=s?"":encodeURIComponent(n);let a;typeof o=="object"?a=F(o,t?t+encodeURIComponent(`[${l}]`):l,Array.isArray(o)):a=`${t?t+encodeURIComponent(`[${l}]`):l}=${encodeURIComponent(o)}`,r.push(a)}return r.join("&")},Q=e=>{const t={eu:"api.storyblok.com",us:"api-us.storyblok.com",cn:"app.storyblokchina.cn",ap:"api-ap.storyblok.com",ca:"api-ca.storyblok.com"};return t[e]??t.eu};var Te=class{constructor(e){y(this,"baseURL"),y(this,"timeout"),y(this,"headers"),y(this,"responseInterceptor"),y(this,"fetch"),y(this,"ejectInterceptor"),y(this,"url"),y(this,"parameters"),y(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(r=>{s.data=r});for(const r of e.headers.entries())t[r[0]]=r[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;e==="get"?t=`${this.baseURL}${this.url}?${F(this.parameters)}`:s=JSON.stringify(this.parameters);const r=new URL(t),n=new AbortController,{signal:o}=n;let l=null;this.timeout&&(l=setTimeout(()=>n.abort(),this.timeout));try{const a=await this.fetch(`${r}`,{method:e,headers:this.headers,body:s,signal:o,...this.fetchOptions});this.timeout&&l&&clearTimeout(l);const c=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(c)):this._statusHandler(c)}catch(a){return a.name==="AbortError"?{message:"Request timeout: The request was aborted due to timeout"}:{message:a.message||a.toString()||"An unknown error occurred"}}}setFetchOptions(e={}){Object.keys(e).length>0&&"method"in e&&delete e.method,this.fetchOptions={...e}}eject(){this.ejectInterceptor=!0}_normalizeErrorMessage(e){if(Array.isArray(e))return e[0]||"Unknown error";if(e&&typeof e=="object"){if(e.error)return e.error;for(const t in e){if(Array.isArray(e[t]))return`${t}: ${e[t][0]}`;if(typeof e[t]=="string")return`${t}: ${e[t]}`}if(e.slug)return e.slug}return"Unknown error"}_statusHandler(e){const t=/20[0-6]/g;return new Promise((s,r)=>{if(t.test(`${e.status}`))return s(e);const n={message:this._normalizeErrorMessage(e.data),status:e.status,response:e};r(n)})}},Ae=Te;const Z="SB-Agent",q={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"7.0.0"},ee={DRAFT:"draft",PUBLISHED:"published"},Ee=25,V={SMALL:25,MEDIUM:50,LARGE:75},O={SINGLE_OR_SMALL:50,MEDIUM:15,LARGE:10,VERY_LARGE:6},G=1e3,M=3;function Se(e){return e.version===ee.DRAFT}function $e(e,t){const s=e.includes("/cdn/stories/"),r=e.split("/").length>3&&!e.endsWith("/cdn/stories"),n="find_by"in t;return s&&r||n}function Le(e){return e<=V.SMALL?O.SINGLE_OR_SMALL:e<=V.MEDIUM?O.MEDIUM:e<=V.LARGE?O.LARGE:O.VERY_LARGE}function N(e,t,s={},r){if(s.userRateLimit!==void 0)return Math.min(s.userRateLimit,G);if(s.serverHeadersRateLimit!==void 0)return Math.min(s.serverHeadersRateLimit,G);if(r!==void 0)return r;if(t&&!Se(t))return G;if($e(e,t))return O.SINGLE_OR_SMALL;const n=t.per_page||Ee;return Le(n)}function Ce(e){if(!e)return null;const t=e["x-ratelimit"]||e["X-RateLimit"],s=e["x-ratelimit-policy"]||e["X-RateLimit-Policy"];if(!t&&!s)return null;const r={};if(t){const n=t.match(/r=(\d+)/);n&&(r.remaining=Number.parseInt(n[1],10))}if(s){const n=s.match(/q=(\d+)/);n&&(r.max=Number.parseInt(n[1],10))}return Object.keys(r).length>0?r:null}function Ie(e,t=!1){return{userRateLimit:e,serverHeadersRateLimit:void 0,isManagementApi:t}}var Oe=class extends Error{constructor(e){super(e),this.name="AbortError"}};function je(e,t,s){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(s))throw new TypeError("Expected `interval` to be a finite number");const r=[];let n=[],o=0,l=!1;const a=async()=>{o++;const p=r.shift();if(p)try{const h=await e(...p.args);p.resolve(h)}catch(h){p.reject(h)}const k=setTimeout(()=>{o--,r.length>0&&a(),n=n.filter(h=>h!==k)},s);n.includes(k)||n.push(k)},c=(...p)=>l?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((k,h)=>{r.push({resolve:k,reject:h,args:p}),o<t&&a()});return c.abort=()=>{l=!0,n.forEach(clearTimeout),n=[],r.forEach(p=>p.reject(()=>new Oe("Throttle function aborted"))),r.length=0},c}var xe=je,Pe=class{constructor(e,t=1e3){y(this,"queues"),y(this,"interval"),y(this,"throttledRequestFn"),this.queues=new Map,this.interval=t,this.throttledRequestFn=e}getQueue(e){let t=this.queues.get(e);return t||(t=xe(this.throttledRequestFn,e,this.interval),this.queues.set(e,t)),t}execute(e,...t){return this.getQueue(e)(...t)}abortAll(){this.queues.forEach(e=>{var t;(t=e.abort)==null||t.call(e)}),this.queues.clear()}getQueueCount(){return this.queues.size}};let D={};const $={};var Me=class{constructor(e,t){y(this,"client"),y(this,"maxRetries"),y(this,"retriesDelay"),y(this,"throttleManager"),y(this,"accessToken"),y(this,"cache"),y(this,"resolveCounter"),y(this,"relations"),y(this,"links"),y(this,"version"),y(this,"rateLimitConfig"),y(this,"richTextResolver"),y(this,"resolveNestedRelations"),y(this,"stringifiedStoriesCache"),y(this,"inlineAssets");let s=e.endpoint||t;if(!s){const n=e.https===!1?"http":"https";e.oauthToken?s=`${n}://${Q(e.region)}/v1`:s=`${n}://${Q(e.region)}/v2`}const r=new Headers;r.set("Content-Type","application/json"),r.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([n,o])=>{r.set(n,o)}),r.has(Z)||(r.set(Z,q.defaultAgentName),r.set(q.defaultAgentVersion,q.packageVersion)),e.oauthToken&&r.set("Authorization",e.oauthToken),this.rateLimitConfig=Ie(e.rateLimit,!!e.oauthToken),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttleManager=new Pe(this.throttledRequest.bind(this),1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.version=e.version||ee.PUBLISHED,this.inlineAssets=e.inlineAssets||!1,this.client=new Ae({baseURL:s,timeout:e.timeout||0,headers:r,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=$[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 B(e)?this.parseParams(t):t}makeRequest(e,t,s,r,n){const o=this.factoryParamOptions(e,be(t,s,r));return this.cacheResponse(e,o,void 0,n)}get(e,t={},s){t||(t={});const r=`/${e}`;B(r)&&(t.version=t.version||this.version);const n=this.factoryParamOptions(r,t);return this.cacheResponse(r,n,void 0,s)}async getAll(e,t={},s,r){const n=(t==null?void 0:t.per_page)||25,o=`/${e}`.replace(/\/$/,""),l=s??o.substring(o.lastIndexOf("/")+1);t.version=t.version||this.version;const a=1,c=await this.makeRequest(o,t,n,a,r),p=c.total?Math.ceil(c.total/(c.perPage||n)):1,k=await Re(_e(a,p),h=>this.makeRequest(o,t,n,h+1,r));return we([c,...k],h=>Object.values(h.data[l]))}post(e,t={},s){const r=`/${e}`,n=N(void 0,void 0,this.rateLimitConfig,M);return this.throttleManager.execute(n,"post",r,t,s)}put(e,t={},s){const r=`/${e}`,n=N(void 0,void 0,this.rateLimitConfig,M);return this.throttleManager.execute(n,"put",r,t,s)}delete(e,t={},s){t||(t={});const r=`/${e}`,n=N(void 0,void 0,this.rateLimitConfig,M);return this.throttleManager.execute(n,"delete",r,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 r=e[t];r&&r.fieldtype==="multilink"&&r.linktype==="story"&&typeof r.id=="string"&&this.links[s][r.id]?r.story=this._cleanCopy(this.links[s][r.id]):r&&r.linktype==="story"&&typeof r.uuid=="string"&&this.links[s][r.uuid]&&(r.story=this._cleanCopy(this.links[s][r.uuid]))}getStoryReference(e,t){return this.relations[e][t]?JSON.parse(this.stringifiedStoriesCache[t]||JSON.stringify(this.relations[e][t])):t}_resolveField(e,t,s){const r=e[t];typeof r=="string"?e[t]=this.getStoryReference(s,r):Array.isArray(r)&&(e[t]=r.map(n=>this.getStoryReference(s,n)).filter(Boolean))}_insertRelations(e,t,s,r){if(Array.isArray(s)?s.find(o=>o.endsWith(`.${t}`)):s.endsWith(`.${t}`)){this._resolveField(e,t,r);return}const n=e.component?`${e.component}.${t}`:t;(Array.isArray(s)?s.includes(n):s===n)&&this._resolveField(e,t,r)}iterateTree(e,t,s){const r=(n,o="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((l,a)=>r(l,`${o}[${a}]`));else if(typeof n=="object")for(const l in n){const a=o?`${o}.${l}`:l;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,l,t,s),this._insertLinks(n,l,s)),r(n[l],a)}}};r(e.content)}async resolveLinks(e,t,s){let r=[];if(e.link_uuids){const n=e.link_uuids.length,o=[],l=50;for(let a=0;a<n;a+=l){const c=Math.min(n,a+l);o.push(e.link_uuids.slice(a,c))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:o[a].join(",")})).data.stories.forEach(c=>{r.push(c)})}else r=e.links;r.forEach(n=>{this.links[s][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,s){let r=[];if(e.rel_uuids){const n=e.rel_uuids.length,o=[],l=50;for(let a=0;a<n;a+=l){const c=Math.min(n,a+l);o.push(e.rel_uuids.slice(a,c))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:o[a].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(c=>{r.push(c)});r.length>0&&(e.rels=r,delete e.rel_uuids)}else r=e.rels;r&&r.length>0&&r.forEach(n=>{this.relations[s][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,s){var r,n;let o=[];if(this.links[s]={},this.relations[s]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(o=t.resolve_relations.split(",")),await this.resolveRelations(e,t,s)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((r=e.links)!=null&&r.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],o,s);e.story?this.iterateTree(e.story,o,s):e.stories.forEach(l=>{this.iterateTree(l,o,s)}),this.stringifiedStoriesCache={},delete this.links[s],delete this.relations[s]}async cacheResponse(e,t,s,r){const n=F({url:e,params:t}),o=this.cacheProvider();if(t.version==="published"&&e!=="/cdn/spaces/me"){const c=await o.get(n);if(c)return Promise.resolve(c)}const l=!B(e)&&this.rateLimitConfig.isManagementApi?M:void 0,a=N(e,t,this.rateLimitConfig,l);return new Promise(async(c,p)=>{var k;try{const h=await this.throttleManager.execute(a,"get",e,t,r);if(h.status!==200)return p(h);let v={data:h.data,headers:h.headers};const L=Ce(h.headers);if((L==null?void 0:L.max)!==void 0&&(this.rateLimitConfig.serverHeadersRateLimit=L.max),(k=h.headers)!=null&&k["per-page"]&&(v=Object.assign({},v,{perPage:h.headers["per-page"]?Number.parseInt(h.headers["per-page"]):0,total:h.headers["per-page"]?Number.parseInt(h.headers.total):0})),v.data.story||v.data.stories){const C=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(v.data,t,`${C}`),v=await this.processInlineAssets(v)}t.version==="published"&&e!=="/cdn/spaces/me"&&await o.set(n,v);const A=this.cache.clear==="onpreview"&&t.version==="draft"||this.cache.clear==="auto";return t.token&&v.data.cv&&(A&&$[t.token]&&$[t.token]!==v.data.cv&&await this.flushCache(),$[t.token]=v.data.cv),c(v)}catch(h){if(h.response&&h.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 ke(this.retriesDelay),this.cacheResponse(e,t,s).then(c).catch(p);p(h)}})}throttledRequest(e,t,s,r){return this.client.setFetchOptions(r),this.client[e](t,s)}cacheVersions(){return $}cacheVersion(){return $[this.accessToken]}setCacheVersion(e){this.accessToken&&($[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&($[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(D[e])},getAll(){return Promise.resolve(D)},set(e,t){return D[e]=t,Promise.resolve(void 0)},flush(){return D={},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}async processInlineAssets(e){if(!this.inlineAssets)return e;const t=s=>{if(!s||typeof s!="object")return s;if(Array.isArray(s))return s.map(n=>t(n));let r={...s};r.fieldtype==="asset"&&Array.isArray(e.data.assets)&&(r={...e.data.assets.find(n=>n.id===r.id),...r});for(const n in r)typeof r[n]=="object"&&(r[n]=t(r[n]));return r};return e.data.story&&(e.data.story.content=t(e.data.story.content)),e.data.stories&&(e.data.stories=e.data.stories.map(s=>(s.content=t(s.content),s))),e}},te=Me;const Ne=(e={})=>{const{apiOptions:t}=e;if(!t||!t.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 te(t)}},De=e=>{if(typeof e!="object"||typeof e._editable>"u")return{};try{const t=JSON.parse(e._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return t?{"data-blok-c":JSON.stringify(t),"data-blok-uid":`${t.id}-${t.uid}`}:{}}catch{return{}}};let se="https://app.storyblok.com/f/storyblok-v2-latest.js";const re=(e,t,s={})=>{var r;const n=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",o=new URL((r=window.location)==null?void 0:r.href).searchParams.get("_storyblok"),l=o!==null&&+o===e;if(!(!n||!l)){if(!e){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(s).on(["input","published","change"],a=>{var c;a&&(a.action==="input"&&((c=a.story)==null?void 0:c.id)===e?t(a.story):(a.action==="change"||a.action==="published")&&a.storyId===e&&window.location.reload())})})}},He=(e={})=>{var t,s;const{bridge:r,accessToken:n,use:o=[],apiOptions:l={},bridgeUrl:a}=e;l.accessToken=l.accessToken||n;const c={bridge:r,apiOptions:l};let p={};o.forEach(h=>{p={...p,...h(c)}}),a&&(se=a);const k=!(typeof window>"u")&&((s=(t=window.location)==null?void 0:t.search)==null?void 0:s.includes("_storyblok_tk"));return r!==!1&&k&&ge(se),p};function Ue(e,t){return U(t).render(e)}const z=d.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(e,{expose:t}){var a;const s=e,r=d.ref();t({value:r});const n=typeof d.resolveDynamicComponent(s.blok.component)!="string",o=d.inject("VueSDKOptions"),l=d.ref((a=s.blok.component)==null?void 0:a.replace(/_/g,"-"));return!n&&o&&(o.enableFallbackComponent?(l.value=o.customFallbackComponent??"FallbackComponent",typeof d.resolveDynamicComponent(l.value)=="string"&&console.error(`Is the Fallback component "${l.value}" registered properly?`)):console.error(`Component could not be found for blok "${s.blok.component}"! Is it defined in main.ts as "app.component("${s.blok.component}", ${s.blok.component});"?`)),(c,p)=>(d.openBlock(),d.createBlock(d.resolveDynamicComponent(l.value),d.mergeProps({ref_key:"blokRef",ref:r},{...c.$props,...c.$attrs}),d.createSlots({_:2},[d.renderList(c.$slots,(k,h)=>({name:h,fn:d.withCtx(v=>[d.renderSlot(c.$slots,h,d.normalizeProps(d.guardReactiveProps(v)))])}))]),1040))}}),Be=e=>{var s;const t=(s=e==null?void 0:e.attrs)==null?void 0:s.body;return!Array.isArray(t)||t.length===0?[]:t.map(r=>{var n;return d.h(z,{blok:r,id:(n=e==null?void 0:e.attrs)==null?void 0:n.id},e.children)})};function ne(e){const t={renderFn:d.h,textFn:d.createTextVNode,keyedResolvers:!0,resolvers:{[R.COMPONENT]:Be,...e.resolvers}};return U(t)}const oe=d.defineComponent({__name:"StoryblokRichText",props:{doc:{},resolvers:{}},setup(e){const t=e,s=d.ref(),r=()=>s.value;return d.watch([()=>t.doc,()=>t.resolvers],([n,o])=>{const{render:l}=ne({resolvers:o??{}});s.value=l(n)},{immediate:!0,deep:!0}),(n,o)=>(d.openBlock(),d.createBlock(r))}}),Fe={beforeMount(e,t){if(t.value){const s=De(t.value);Object.keys(s).length>0&&(e.setAttribute("data-blok-c",s["data-blok-c"]),e.setAttribute("data-blok-uid",s["data-blok-uid"]),e.classList.add("storyblok__outline"))}}},ie=e=>{console.error(`You can't use ${e} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
8
+ `)};let j=null;const qe=()=>(j||ie("useStoryblokApi"),j),Ve=async(e,t={},s={})=>{const r=d.ref(null);if(s.resolveRelations=s.resolveRelations??t.resolve_relations,s.resolveLinks=s.resolveLinks??t.resolve_links,d.onMounted(()=>{r.value&&r.value.id&&re(r.value.id,n=>r.value=n,s)}),j){const{data:n}=await j.get(`cdn/stories/${e}`,t);r.value=n.story}else ie("useStoryblok");return r},Ge={install(e,t={}){e.directive("editable",Fe),e.component("StoryblokComponent",z),e.component("StoryblokRichText",oe),t.enableFallbackComponent&&!t.customFallbackComponent&&e.component("FallbackComponent",d.defineAsyncComponent(()=>Promise.resolve().then(()=>Je)));const{storyblokApi:s}=He(t);j=s||null,e.provide("VueSDKOptions",t)}},ze={class:"fallback-component"},Ye={class:"component"},Je=Object.freeze(Object.defineProperty({__proto__:null,default:((e,t)=>{const s=e.__vccOpts||e;for(const[r,n]of t)s[r]=n;return s})(d.defineComponent({__name:"FallbackComponent",props:{blok:{}},setup(e){return(t,s)=>(d.openBlock(),d.createElementBlock("div",ze,[d.createElementVNode("p",null,[s[0]||(s[0]=d.createTextVNode(" Component could not be found for blok ",-1)),d.createElementVNode("span",Ye,d.toDisplayString(t.blok.component),1),s[1]||(s[1]=d.createTextVNode("! Is it configured correctly? ",-1))])]))}}),[["__scopeId","data-v-9abcd1f2"]])},Symbol.toStringTag,{value:"Module"}));_.BlockTypes=R,_.MarkTypes=E,_.StoryblokClient=te,_.StoryblokComponent=z,_.StoryblokRichText=oe,_.StoryblokVue=Ge,_.TextTypes=J,_.apiPlugin=Ne,_.renderRichText=Ue,_.richTextResolver=U,_.useStoryblok=Ve,_.useStoryblokApi=qe,_.useStoryblokBridge=re,_.useStoryblokRichText=ne,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * name: @storyblok/vue
3
- * (c) 2025
3
+ * (c) 2026
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
7
- import { defineComponent as te, ref as N, resolveDynamicComponent as D, inject as ve, createBlock as se, openBlock as re, mergeProps as be, createSlots as ke, renderList as Re, withCtx as _e, renderSlot as we, normalizeProps as Te, guardReactiveProps as Ae, h as ne, createTextVNode as Ee, watch as Le, onMounted as $e, defineAsyncComponent as Se } from "vue";
8
- var Ie = Object.defineProperty, Ce = (e, t, s) => t in e ? Ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, g = (e, t, s) => Ce(e, typeof t != "symbol" ? t + "" : t, s);
9
- let k = /* @__PURE__ */ function(e) {
7
+ import { defineComponent as te, ref as H, resolveDynamicComponent as U, inject as ve, createBlock as se, openBlock as re, mergeProps as be, createSlots as ke, renderList as Re, withCtx as we, renderSlot as _e, normalizeProps as Te, guardReactiveProps as Ae, h as ne, createTextVNode as Ee, watch as Le, onMounted as $e, defineAsyncComponent as Se } from "vue";
8
+ var Ie = Object.defineProperty, Ce = (e, t, s) => t in e ? Ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, y = (e, t, s) => Ce(e, typeof t != "symbol" ? t + "" : t, s);
9
+ let R = /* @__PURE__ */ function(e) {
10
10
  return e.DOCUMENT = "doc", e.HEADING = "heading", e.PARAGRAPH = "paragraph", e.QUOTE = "blockquote", e.OL_LIST = "ordered_list", e.UL_LIST = "bullet_list", e.LIST_ITEM = "list_item", e.CODE_BLOCK = "code_block", e.HR = "horizontal_rule", e.BR = "hard_break", e.IMAGE = "image", e.EMOJI = "emoji", e.COMPONENT = "blok", e.TABLE = "table", e.TABLE_ROW = "tableRow", e.TABLE_CELL = "tableCell", e.TABLE_HEADER = "tableHeader", e;
11
11
  }({}), T = /* @__PURE__ */ function(e) {
12
12
  return e.BOLD = "bold", e.STRONG = "strong", e.STRIKE = "strike", e.UNDERLINE = "underline", e.ITALIC = "italic", e.CODE = "code", e.LINK = "link", e.ANCHOR = "anchor", e.STYLED = "styled", e.SUPERSCRIPT = "superscript", e.SUBSCRIPT = "subscript", e.TEXT_STYLE = "textStyle", e.HIGHLIGHT = "highlight", e;
@@ -48,28 +48,28 @@ function Ne(e, t) {
48
48
  };
49
49
  let s = 0, r = 0;
50
50
  const n = {}, o = [];
51
- function l(c, f, m, h, w) {
52
- typeof c != "number" || c <= f || c >= m ? console.warn(`[StoryblokRichText] - ${h.charAt(0).toUpperCase() + h.slice(1)} value must be a number between ${f} and ${m} (inclusive)`) : w.push(`${h}(${c})`);
51
+ function l(c, d, v, h, b) {
52
+ typeof c != "number" || c <= d || c >= v ? console.warn(`[StoryblokRichText] - ${h.charAt(0).toUpperCase() + h.slice(1)} value must be a number between ${d} and ${v} (inclusive)`) : b.push(`${h}(${c})`);
53
53
  }
54
54
  if (typeof t == "object") {
55
55
  if (t.width !== void 0 && (typeof t.width == "number" && t.width >= 0 ? (n.width = t.width, s = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than or equal to 0")), t.height !== void 0 && (typeof t.height == "number" && t.height >= 0 ? (n.height = t.height, r = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than or equal to 0")), t.height === 0 && t.width === 0 && (delete n.width, delete n.height, console.warn("[StoryblokRichText] - Width and height values cannot both be 0")), t.loading && ["lazy", "eager"].includes(t.loading) && (n.loading = t.loading), t.class && (n.class = t.class), t.filters) {
56
- const { filters: c } = t || {}, { blur: f, brightness: m, fill: h, format: w, grayscale: L, quality: _, rotate: $ } = c || {};
57
- f && l(f, 0, 100, "blur", o), _ && l(_, 0, 100, "quality", o), m && l(m, 0, 100, "brightness", o), h && o.push(`fill(${h})`), L && o.push("grayscale()"), $ && [
56
+ const { filters: c } = t || {}, { blur: d, brightness: v, fill: h, format: b, grayscale: L, quality: _, rotate: $ } = c || {};
57
+ d && l(d, 0, 100, "blur", o), _ && l(_, 0, 100, "quality", o), v && l(v, 0, 100, "brightness", o), h && o.push(`fill(${h})`), L && o.push("grayscale()"), $ && [
58
58
  0,
59
59
  90,
60
60
  180,
61
61
  270
62
- ].includes(t.filters.rotate || 0) && o.push(`rotate(${$})`), w && [
62
+ ].includes(t.filters.rotate || 0) && o.push(`rotate(${$})`), b && [
63
63
  "webp",
64
64
  "png",
65
65
  "jpeg"
66
- ].includes(w) && o.push(`format(${w})`);
66
+ ].includes(b) && o.push(`format(${b})`);
67
67
  }
68
68
  t.srcset && (n.srcset = t.srcset.map((c) => {
69
69
  if (typeof c == "number") return `${e}/m/${c}x0/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${c}w`;
70
70
  if (Array.isArray(c) && c.length === 2) {
71
- const [f, m] = c;
72
- return `${e}/m/${f}x${m}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${f}w`;
71
+ const [d, v] = c;
72
+ return `${e}/m/${d}x${v}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${d}w`;
73
73
  } else {
74
74
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
75
75
  return;
@@ -82,7 +82,7 @@ function Ne(e, t) {
82
82
  attrs: n
83
83
  };
84
84
  }
85
- function J(e, t = {}, s) {
85
+ function K(e, t = {}, s) {
86
86
  const r = je(t), n = r ? `${e} ${r}` : e, o = Array.isArray(s) ? s.join("") : s || "";
87
87
  if (e) {
88
88
  if (Oe.includes(e)) return `<${n}>`;
@@ -90,145 +90,145 @@ function J(e, t = {}, s) {
90
90
  return `<${n}>${o}</${e}>`;
91
91
  }
92
92
  function oe(e = {}) {
93
- const t = /* @__PURE__ */ new Map(), { renderFn: s = J, textFn: r = Me, resolvers: n = {}, optimizeImages: o = !1, keyedResolvers: l = !1 } = e, a = s !== J, c = (i = {}) => {
94
- const { textAlign: u, class: d, id: p, style: y, ...b } = i, v = [];
95
- return y && v.push(y.endsWith(";") ? y : `${y};`), u && v.push(`text-align: ${u};`), I({
96
- ...b,
97
- class: d,
98
- id: p,
99
- ...v.length > 0 ? { style: v.join(" ") } : {}
93
+ const t = /* @__PURE__ */ new Map(), { renderFn: s = K, textFn: r = Me, resolvers: n = {}, optimizeImages: o = !1, keyedResolvers: l = !1 } = e, a = s !== K, c = (i = {}) => {
94
+ const { textAlign: u, class: p, id: f, style: m, ...k } = i, g = [];
95
+ return m && g.push(m.endsWith(";") ? m : `${m};`), u && g.push(`text-align: ${u};`), I({
96
+ ...k,
97
+ class: p,
98
+ id: f,
99
+ ...g.length > 0 ? { style: g.join(" ") } : {}
100
100
  });
101
- }, f = (i) => (u, d) => {
102
- const p = c(u.attrs);
103
- return d.render(i, p, u.children || null);
104
- }, m = (i, u) => {
105
- const { src: d, alt: p, title: y, srcset: b, sizes: v } = i.attrs || {};
106
- let A = d, R = {};
101
+ }, d = (i) => (u, p) => {
102
+ const f = c(u.attrs);
103
+ return p.render(i, f, u.children || null);
104
+ }, v = (i, u) => {
105
+ const { src: p, alt: f, title: m, srcset: k, sizes: g } = i.attrs || {};
106
+ let A = p, w = {};
107
107
  if (o) {
108
- const { src: ye, attrs: ge } = Ne(d, o);
109
- A = ye, R = ge;
108
+ const { src: ye, attrs: ge } = Ne(p, o);
109
+ A = ye, w = ge;
110
110
  }
111
111
  const S = {
112
112
  src: A,
113
- alt: p,
114
- title: y,
115
- srcset: b,
116
- sizes: v,
117
- ...R
113
+ alt: f,
114
+ title: m,
115
+ srcset: k,
116
+ sizes: g,
117
+ ...w
118
118
  };
119
119
  return u.render("img", I(S));
120
120
  }, h = (i, u) => {
121
- const { level: d, ...p } = i.attrs || {}, y = c(p);
122
- return u.render(`h${d}`, y, i.children);
123
- }, w = (i, u) => {
124
- var d, p, y, b;
125
- const v = u.render("img", {
126
- src: (d = i.attrs) == null ? void 0 : d.fallbackImage,
127
- alt: (p = i.attrs) == null ? void 0 : p.alt,
121
+ const { level: p, ...f } = i.attrs || {}, m = c(f);
122
+ return u.render(`h${p}`, m, i.children);
123
+ }, b = (i, u) => {
124
+ var p, f, m, k;
125
+ const g = u.render("img", {
126
+ src: (p = i.attrs) == null ? void 0 : p.fallbackImage,
127
+ alt: (f = i.attrs) == null ? void 0 : f.alt,
128
128
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
129
129
  draggable: "false",
130
130
  loading: "lazy"
131
131
  });
132
132
  return u.render("span", {
133
133
  "data-type": "emoji",
134
- "data-name": (y = i.attrs) == null ? void 0 : y.name,
135
- "data-emoji": (b = i.attrs) == null ? void 0 : b.emoji
136
- }, v);
137
- }, L = (i, u) => u.render("pre", i.attrs || {}, u.render("code", {}, i.children || "")), _ = (i, u = !1) => ({ text: d, attrs: p }, y) => {
138
- const { class: b, id: v, ...A } = p || {}, R = u ? {
139
- class: b,
140
- id: v,
134
+ "data-name": (m = i.attrs) == null ? void 0 : m.name,
135
+ "data-emoji": (k = i.attrs) == null ? void 0 : k.emoji
136
+ }, g);
137
+ }, L = (i, u) => u.render("pre", i.attrs || {}, u.render("code", {}, i.children || "")), _ = (i, u = !1) => ({ text: p, attrs: f }, m) => {
138
+ const { class: k, id: g, ...A } = f || {}, w = u ? {
139
+ class: k,
140
+ id: g,
141
141
  style: Pe(A) || void 0
142
- } : p || {};
143
- return y.render(i, I(R), d);
144
- }, $ = (i) => H(i), ce = (i) => {
145
- const { marks: u, ...d } = i;
142
+ } : f || {};
143
+ return m.render(i, I(w), p);
144
+ }, $ = (i) => D(i), ce = (i) => {
145
+ const { marks: u, ...p } = i;
146
146
  if ("text" in i) {
147
- if (u) return u.reduce((y, b) => $({
148
- ...b,
149
- text: y
147
+ if (u) return u.reduce((m, k) => $({
148
+ ...k,
149
+ text: m
150
150
  }), $({
151
- ...d,
152
- children: d.children
151
+ ...p,
152
+ children: p.children
153
153
  }));
154
- const p = i.attrs || {};
154
+ const f = i.attrs || {};
155
155
  if (l) {
156
- const y = t.get("txt") || 0;
157
- t.set("txt", y + 1), p.key = `txt-${y}`;
156
+ const m = t.get("txt") || 0;
157
+ t.set("txt", m + 1), f.key = `txt-${m}`;
158
158
  }
159
- return r(d.text, p);
159
+ return r(p.text, f);
160
160
  }
161
161
  return "";
162
- }, V = (i, u) => {
163
- const { linktype: d, href: p, anchor: y, ...b } = i.attrs || {};
164
- let v = "";
165
- switch (d) {
162
+ }, z = (i, u) => {
163
+ const { linktype: p, href: f, anchor: m, ...k } = i.attrs || {};
164
+ let g = "";
165
+ switch (p) {
166
166
  case j.ASSET:
167
167
  case j.URL:
168
- v = p;
168
+ g = f;
169
169
  break;
170
170
  case j.EMAIL:
171
- v = `mailto:${p}`;
171
+ g = `mailto:${f}`;
172
172
  break;
173
173
  case j.STORY:
174
- v = p, y && (v = `${v}#${y}`);
174
+ g = f, m && (g = `${g}#${m}`);
175
175
  break;
176
176
  default:
177
- v = p;
177
+ g = f;
178
178
  break;
179
179
  }
180
- const A = { ...b };
181
- return v && (A.href = v), u.render("a", A, i.text);
180
+ const A = { ...k };
181
+ return g && (A.href = g), u.render("a", A, i.text);
182
182
  }, ue = (i, u) => {
183
- var d, p;
183
+ var p, f;
184
184
  return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), u.render("span", {
185
- blok: (d = i == null ? void 0 : i.attrs) == null ? void 0 : d.body[0],
186
- id: (p = i.attrs) == null ? void 0 : p.id,
185
+ blok: (p = i == null ? void 0 : i.attrs) == null ? void 0 : p.body[0],
186
+ id: (f = i.attrs) == null ? void 0 : f.id,
187
187
  style: "display: none"
188
188
  });
189
189
  }, he = (i, u) => {
190
- const d = c(i.attrs), p = i.children || null;
191
- return u.render("table", d, u.render("tbody", {}, p));
190
+ const p = c(i.attrs), f = i.children || null;
191
+ return u.render("table", p, u.render("tbody", {}, f));
192
192
  }, de = (i, u) => {
193
- const d = c(i.attrs);
194
- return u.render("tr", d, i.children);
193
+ const p = c(i.attrs);
194
+ return u.render("tr", p, i.children);
195
195
  }, pe = (i, u) => {
196
- const { colspan: d, rowspan: p, colwidth: y, backgroundColor: b, textAlign: v, ...A } = i.attrs || {}, R = [];
197
- y && R.push(`width: ${y}px;`), b && R.push(`background-color: ${b};`), v && R.push(`text-align: ${v};`);
196
+ const { colspan: p, rowspan: f, colwidth: m, backgroundColor: k, textAlign: g, ...A } = i.attrs || {}, w = [];
197
+ m && w.push(`width: ${m}px;`), k && w.push(`background-color: ${k};`), g && w.push(`text-align: ${g};`);
198
198
  const S = {
199
199
  ...A,
200
- ...d > 1 ? { colspan: d } : {},
201
- ...p > 1 ? { rowspan: p } : {},
202
- ...R.length > 0 ? { style: R.join(" ") } : {}
200
+ ...p > 1 ? { colspan: p } : {},
201
+ ...f > 1 ? { rowspan: f } : {},
202
+ ...w.length > 0 ? { style: w.join(" ") } : {}
203
203
  };
204
204
  return u.render("td", I(S), i.children);
205
205
  }, fe = (i, u) => {
206
- const { colspan: d, rowspan: p, colwidth: y, backgroundColor: b, textAlign: v, ...A } = i.attrs || {}, R = [];
207
- y && R.push(`width: ${y}px;`), b && R.push(`background-color: ${b};`), v && R.push(`text-align: ${v};`);
206
+ const { colspan: p, rowspan: f, colwidth: m, backgroundColor: k, textAlign: g, ...A } = i.attrs || {}, w = [];
207
+ m && w.push(`width: ${m}px;`), k && w.push(`background-color: ${k};`), g && w.push(`text-align: ${g};`);
208
208
  const S = {
209
209
  ...A,
210
- ...d > 1 ? { colspan: d } : {},
211
- ...p > 1 ? { rowspan: p } : {},
212
- ...R.length > 0 ? { style: R.join(" ") } : {}
210
+ ...p > 1 ? { colspan: p } : {},
211
+ ...f > 1 ? { rowspan: f } : {},
212
+ ...w.length > 0 ? { style: w.join(" ") } : {}
213
213
  };
214
214
  return u.render("th", I(S), i.children);
215
- }, z = /* @__PURE__ */ new Map([
216
- [k.DOCUMENT, f("")],
217
- [k.HEADING, h],
218
- [k.PARAGRAPH, f("p")],
219
- [k.UL_LIST, f("ul")],
220
- [k.OL_LIST, f("ol")],
221
- [k.LIST_ITEM, f("li")],
222
- [k.IMAGE, m],
223
- [k.EMOJI, w],
224
- [k.CODE_BLOCK, L],
225
- [k.HR, f("hr")],
226
- [k.BR, f("br")],
227
- [k.QUOTE, f("blockquote")],
228
- [k.COMPONENT, ue],
215
+ }, Y = /* @__PURE__ */ new Map([
216
+ [R.DOCUMENT, d("")],
217
+ [R.HEADING, h],
218
+ [R.PARAGRAPH, d("p")],
219
+ [R.UL_LIST, d("ul")],
220
+ [R.OL_LIST, d("ol")],
221
+ [R.LIST_ITEM, d("li")],
222
+ [R.IMAGE, v],
223
+ [R.EMOJI, b],
224
+ [R.CODE_BLOCK, L],
225
+ [R.HR, d("hr")],
226
+ [R.BR, d("br")],
227
+ [R.QUOTE, d("blockquote")],
228
+ [R.COMPONENT, ue],
229
229
  [xe.TEXT, ce],
230
- [T.LINK, V],
231
- [T.ANCHOR, V],
230
+ [T.LINK, z],
231
+ [T.ANCHOR, z],
232
232
  [T.STYLED, _("span", !0)],
233
233
  [T.BOLD, _("strong")],
234
234
  [T.TEXT_STYLE, _("span", !0)],
@@ -239,40 +239,40 @@ function oe(e = {}) {
239
239
  [T.SUPERSCRIPT, _("sup")],
240
240
  [T.SUBSCRIPT, _("sub")],
241
241
  [T.HIGHLIGHT, _("mark")],
242
- [k.TABLE, he],
243
- [k.TABLE_ROW, de],
244
- [k.TABLE_CELL, pe],
245
- [k.TABLE_HEADER, fe]
246
- ]), Y = new Map([...z, ...Object.entries(n).map(([i, u]) => [i, u])]), me = () => ({
247
- render: (i, u = {}, d) => {
242
+ [R.TABLE, he],
243
+ [R.TABLE_ROW, de],
244
+ [R.TABLE_CELL, pe],
245
+ [R.TABLE_HEADER, fe]
246
+ ]), J = new Map([...Y, ...Object.entries(n).map(([i, u]) => [i, u])]), me = () => ({
247
+ render: (i, u = {}, p) => {
248
248
  if (l && i) {
249
- const p = t.get(i) || 0;
250
- t.set(i, p + 1), u.key = `${i}-${p}`;
249
+ const f = t.get(i) || 0;
250
+ t.set(i, f + 1), u.key = `${i}-${f}`;
251
251
  }
252
- return s(i, u, d);
252
+ return s(i, u, p);
253
253
  },
254
- originalResolvers: z,
255
- mergedResolvers: Y
254
+ originalResolvers: Y,
255
+ mergedResolvers: J
256
256
  });
257
257
  function O(i) {
258
- const u = Y.get(i.type);
258
+ const u = J.get(i.type);
259
259
  if (!u)
260
260
  return console.error("<Storyblok>", `No resolver found for node type ${i.type}`), "";
261
- const d = me();
262
- if (i.type === "text") return u(i, d);
263
- const p = i.content ? i.content.map(H) : void 0;
261
+ const p = me();
262
+ if (i.type === "text") return u(i, p);
263
+ const f = i.content ? i.content.map(D) : void 0;
264
264
  return u({
265
265
  ...i,
266
- children: p
267
- }, d);
266
+ children: f
267
+ }, p);
268
268
  }
269
- function H(i) {
269
+ function D(i) {
270
270
  return i.type === "doc" ? a ? i.content.map(O) : i.content.map(O).join("") : Array.isArray(i) ? i.map(O) : O(i);
271
271
  }
272
- return { render: H };
272
+ return { render: D };
273
273
  }
274
- let K = !1;
275
- const W = [], He = (e) => new Promise((t, s) => {
274
+ let W = !1;
275
+ const X = [], He = (e) => new Promise((t, s) => {
276
276
  if (typeof window > "u") {
277
277
  s(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
278
278
  return;
@@ -282,23 +282,23 @@ const W = [], He = (e) => new Promise((t, s) => {
282
282
  console.warn("You are not in Draft Mode or in the Visual Editor.");
283
283
  return;
284
284
  }
285
- K ? n() : W.push(n);
285
+ W ? n() : X.push(n);
286
286
  }, document.getElementById("storyblok-javascript-bridge")) {
287
287
  t(void 0);
288
288
  return;
289
289
  }
290
290
  const r = document.createElement("script");
291
291
  r.async = !0, r.src = e, r.id = "storyblok-javascript-bridge", r.onerror = (n) => s(n), r.onload = (n) => {
292
- W.forEach((o) => o()), K = !0, t(n);
292
+ X.forEach((o) => o()), W = !0, t(n);
293
293
  }, document.getElementsByTagName("head")[0].appendChild(r);
294
- }), X = (e = "") => e.includes("/cdn/"), De = (e, t = 25, s = 1) => ({
294
+ }), B = (e = "") => e.includes("/cdn/"), De = (e, t = 25, s = 1) => ({
295
295
  ...e,
296
296
  per_page: t,
297
297
  page: s
298
- }), Ue = (e) => new Promise((t) => setTimeout(t, e)), Be = (e = 0, t) => Array.from({ length: e }, t), Fe = (e = 0, t = e) => {
298
+ }), Ue = (e) => new Promise((t) => setTimeout(t, e)), Be = (e = 0, t) => Array.from({ length: e }, t), qe = (e = 0, t = e) => {
299
299
  const s = Math.abs(t - e) || 0, r = e < t ? 1 : -1;
300
300
  return Be(s, (n, o) => o * r + e);
301
- }, qe = async (e, t) => Promise.all(e.map(t)), Ge = (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], []), G = (e, t, s) => {
301
+ }, Fe = async (e, t) => Promise.all(e.map(t)), Ge = (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], []), V = (e, t, s) => {
302
302
  const r = [];
303
303
  for (const n in e) {
304
304
  if (!Object.prototype.hasOwnProperty.call(e, n)) continue;
@@ -306,7 +306,7 @@ const W = [], He = (e) => new Promise((t, s) => {
306
306
  if (o == null) continue;
307
307
  const l = s ? "" : encodeURIComponent(n);
308
308
  let a;
309
- typeof o == "object" ? a = G(o, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(o)) : a = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(o)}`, r.push(a);
309
+ typeof o == "object" ? a = V(o, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(o)) : a = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(o)}`, r.push(a);
310
310
  }
311
311
  return r.join("&");
312
312
  }, Q = (e) => {
@@ -321,7 +321,7 @@ const W = [], He = (e) => new Promise((t, s) => {
321
321
  };
322
322
  var Ve = class {
323
323
  constructor(e) {
324
- g(this, "baseURL"), g(this, "timeout"), g(this, "headers"), g(this, "responseInterceptor"), g(this, "fetch"), g(this, "ejectInterceptor"), g(this, "url"), g(this, "parameters"), g(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 = {};
324
+ y(this, "baseURL"), y(this, "timeout"), y(this, "headers"), y(this, "responseInterceptor"), y(this, "fetch"), y(this, "ejectInterceptor"), y(this, "url"), y(this, "parameters"), y(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 = {};
325
325
  }
326
326
  /**
327
327
  *
@@ -356,7 +356,7 @@ var Ve = class {
356
356
  }
357
357
  async _methodHandler(e) {
358
358
  let t = `${this.baseURL}${this.url}`, s = null;
359
- e === "get" ? t = `${this.baseURL}${this.url}?${G(this.parameters)}` : s = JSON.stringify(this.parameters);
359
+ e === "get" ? t = `${this.baseURL}${this.url}?${V(this.parameters)}` : s = JSON.stringify(this.parameters);
360
360
  const r = new URL(t), n = new AbortController(), { signal: o } = n;
361
361
  let l = null;
362
362
  this.timeout && (l = setTimeout(() => n.abort(), this.timeout));
@@ -372,7 +372,7 @@ var Ve = class {
372
372
  const c = await this._responseHandler(a);
373
373
  return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(c)) : this._statusHandler(c);
374
374
  } catch (a) {
375
- return { message: a };
375
+ return a.name === "AbortError" ? { message: "Request timeout: The request was aborted due to timeout" } : { message: a.message || a.toString() || "An unknown error occurred" };
376
376
  }
377
377
  }
378
378
  setFetchOptions(e = {}) {
@@ -411,14 +411,14 @@ var Ve = class {
411
411
  });
412
412
  }
413
413
  }, ze = Ve;
414
- const Z = "SB-Agent", U = {
414
+ const Z = "SB-Agent", q = {
415
415
  defaultAgentName: "SB-JS-CLIENT",
416
416
  defaultAgentVersion: "SB-Agent-Version",
417
417
  packageVersion: "7.0.0"
418
418
  }, ie = {
419
419
  DRAFT: "draft",
420
420
  PUBLISHED: "published"
421
- }, Ye = 25, B = {
421
+ }, Ye = 25, F = {
422
422
  SMALL: 25,
423
423
  MEDIUM: 50,
424
424
  LARGE: 75
@@ -427,7 +427,7 @@ const Z = "SB-Agent", U = {
427
427
  MEDIUM: 15,
428
428
  LARGE: 10,
429
429
  VERY_LARGE: 6
430
- }, F = 1e3, q = 3;
430
+ }, G = 1e3, P = 3;
431
431
  function Je(e) {
432
432
  return e.version === ie.DRAFT;
433
433
  }
@@ -436,13 +436,13 @@ function Ke(e, t) {
436
436
  return s && r || n;
437
437
  }
438
438
  function We(e) {
439
- return e <= B.SMALL ? C.SINGLE_OR_SMALL : e <= B.MEDIUM ? C.MEDIUM : e <= B.LARGE ? C.LARGE : C.VERY_LARGE;
439
+ return e <= F.SMALL ? C.SINGLE_OR_SMALL : e <= F.MEDIUM ? C.MEDIUM : e <= F.LARGE ? C.LARGE : C.VERY_LARGE;
440
440
  }
441
- function P(e, t, s = {}, r) {
442
- if (s.userRateLimit !== void 0) return Math.min(s.userRateLimit, F);
443
- if (s.serverHeadersRateLimit !== void 0) return Math.min(s.serverHeadersRateLimit, F);
444
- if (t && !Je(t)) return F;
441
+ function M(e, t, s = {}, r) {
442
+ if (s.userRateLimit !== void 0) return Math.min(s.userRateLimit, G);
443
+ if (s.serverHeadersRateLimit !== void 0) return Math.min(s.serverHeadersRateLimit, G);
445
444
  if (r !== void 0) return r;
445
+ if (t && !Je(t)) return G;
446
446
  if (Ke(e, t)) return C.SINGLE_OR_SMALL;
447
447
  const n = t.per_page || Ye;
448
448
  return We(n);
@@ -481,31 +481,31 @@ function et(e, t, s) {
481
481
  let n = [], o = 0, l = !1;
482
482
  const a = async () => {
483
483
  o++;
484
- const f = r.shift();
485
- if (f) try {
486
- const h = await e(...f.args);
487
- f.resolve(h);
484
+ const d = r.shift();
485
+ if (d) try {
486
+ const h = await e(...d.args);
487
+ d.resolve(h);
488
488
  } catch (h) {
489
- f.reject(h);
489
+ d.reject(h);
490
490
  }
491
- const m = setTimeout(() => {
492
- o--, r.length > 0 && a(), n = n.filter((h) => h !== m);
491
+ const v = setTimeout(() => {
492
+ o--, r.length > 0 && a(), n = n.filter((h) => h !== v);
493
493
  }, s);
494
- n.includes(m) || n.push(m);
495
- }, c = (...f) => l ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((m, h) => {
494
+ n.includes(v) || n.push(v);
495
+ }, c = (...d) => l ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((v, h) => {
496
496
  r.push({
497
- resolve: m,
497
+ resolve: v,
498
498
  reject: h,
499
- args: f
499
+ args: d
500
500
  }), o < t && a();
501
501
  });
502
502
  return c.abort = () => {
503
- l = !0, n.forEach(clearTimeout), n = [], r.forEach((f) => f.reject(() => new Ze("Throttle function aborted"))), r.length = 0;
503
+ l = !0, n.forEach(clearTimeout), n = [], r.forEach((d) => d.reject(() => new Ze("Throttle function aborted"))), r.length = 0;
504
504
  }, c;
505
505
  }
506
506
  var tt = et, st = class {
507
507
  constructor(e, t = 1e3) {
508
- g(this, "queues"), g(this, "interval"), g(this, "throttledRequestFn"), this.queues = /* @__PURE__ */ new Map(), this.interval = t, this.throttledRequestFn = e;
508
+ y(this, "queues"), y(this, "interval"), y(this, "throttledRequestFn"), this.queues = /* @__PURE__ */ new Map(), this.interval = t, this.throttledRequestFn = e;
509
509
  }
510
510
  /**
511
511
  * Gets or creates a throttle queue for the specified rate limit
@@ -536,7 +536,7 @@ var tt = et, st = class {
536
536
  return this.queues.size;
537
537
  }
538
538
  };
539
- let M = {};
539
+ let N = {};
540
540
  const E = {};
541
541
  var rt = class {
542
542
  /**
@@ -545,7 +545,7 @@ var rt = class {
545
545
  * @param pEndpoint string, optional
546
546
  */
547
547
  constructor(e, t) {
548
- g(this, "client"), g(this, "maxRetries"), g(this, "retriesDelay"), g(this, "throttleManager"), g(this, "accessToken"), g(this, "cache"), g(this, "resolveCounter"), g(this, "relations"), g(this, "links"), g(this, "version"), g(this, "rateLimitConfig"), g(this, "richTextResolver"), g(this, "resolveNestedRelations"), g(this, "stringifiedStoriesCache"), g(this, "inlineAssets");
548
+ y(this, "client"), y(this, "maxRetries"), y(this, "retriesDelay"), y(this, "throttleManager"), y(this, "accessToken"), y(this, "cache"), y(this, "resolveCounter"), y(this, "relations"), y(this, "links"), y(this, "version"), y(this, "rateLimitConfig"), y(this, "richTextResolver"), y(this, "resolveNestedRelations"), y(this, "stringifiedStoriesCache"), y(this, "inlineAssets");
549
549
  let s = e.endpoint || t;
550
550
  if (!s) {
551
551
  const n = e.https === !1 ? "http" : "https";
@@ -554,7 +554,7 @@ var rt = class {
554
554
  const r = new Headers();
555
555
  r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([n, o]) => {
556
556
  r.set(n, o);
557
- }), r.has(Z) || (r.set(Z, U.defaultAgentName), r.set(U.defaultAgentVersion, U.packageVersion)), e.oauthToken && r.set("Authorization", e.oauthToken), this.rateLimitConfig = Qe(e.rateLimit, !!e.oauthToken), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttleManager = new st(this.throttledRequest.bind(this), 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || ie.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new ze({
557
+ }), r.has(Z) || (r.set(Z, q.defaultAgentName), r.set(q.defaultAgentVersion, q.packageVersion)), e.oauthToken && r.set("Authorization", e.oauthToken), this.rateLimitConfig = Qe(e.rateLimit, !!e.oauthToken), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttleManager = new st(this.throttledRequest.bind(this), 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || ie.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new ze({
558
558
  baseURL: s,
559
559
  timeout: e.timeout || 0,
560
560
  headers: r,
@@ -566,7 +566,7 @@ var rt = class {
566
566
  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;
567
567
  }
568
568
  factoryParamOptions(e, t) {
569
- return X(e) ? this.parseParams(t) : t;
569
+ return B(e) ? this.parseParams(t) : t;
570
570
  }
571
571
  makeRequest(e, t, s, r, n) {
572
572
  const o = this.factoryParamOptions(e, De(t, s, r));
@@ -575,27 +575,27 @@ var rt = class {
575
575
  get(e, t = {}, s) {
576
576
  t || (t = {});
577
577
  const r = `/${e}`;
578
- X(r) && (t.version = t.version || this.version);
578
+ B(r) && (t.version = t.version || this.version);
579
579
  const n = this.factoryParamOptions(r, t);
580
580
  return this.cacheResponse(r, n, void 0, s);
581
581
  }
582
582
  async getAll(e, t = {}, s, r) {
583
583
  const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`.replace(/\/$/, ""), l = s ?? o.substring(o.lastIndexOf("/") + 1);
584
584
  t.version = t.version || this.version;
585
- const a = 1, c = await this.makeRequest(o, t, n, a, r), f = c.total ? Math.ceil(c.total / (c.perPage || n)) : 1, m = await qe(Fe(a, f), (h) => this.makeRequest(o, t, n, h + 1, r));
586
- return Ge([c, ...m], (h) => Object.values(h.data[l]));
585
+ const a = 1, c = await this.makeRequest(o, t, n, a, r), d = c.total ? Math.ceil(c.total / (c.perPage || n)) : 1, v = await Fe(qe(a, d), (h) => this.makeRequest(o, t, n, h + 1, r));
586
+ return Ge([c, ...v], (h) => Object.values(h.data[l]));
587
587
  }
588
588
  post(e, t = {}, s) {
589
- const r = `/${e}`, n = P(void 0, void 0, this.rateLimitConfig, q);
589
+ const r = `/${e}`, n = M(void 0, void 0, this.rateLimitConfig, P);
590
590
  return this.throttleManager.execute(n, "post", r, t, s);
591
591
  }
592
592
  put(e, t = {}, s) {
593
- const r = `/${e}`, n = P(void 0, void 0, this.rateLimitConfig, q);
593
+ const r = `/${e}`, n = M(void 0, void 0, this.rateLimitConfig, P);
594
594
  return this.throttleManager.execute(n, "put", r, t, s);
595
595
  }
596
596
  delete(e, t = {}, s) {
597
597
  t || (t = {});
598
- const r = `/${e}`, n = P(void 0, void 0, this.rateLimitConfig, q);
598
+ const r = `/${e}`, n = M(void 0, void 0, this.rateLimitConfig, P);
599
599
  return this.throttleManager.execute(n, "delete", r, t, s);
600
600
  }
601
601
  getStories(e = {}, t) {
@@ -763,39 +763,39 @@ var rt = class {
763
763
  }), this.stringifiedStoriesCache = {}, delete this.links[s], delete this.relations[s];
764
764
  }
765
765
  async cacheResponse(e, t, s, r) {
766
- const n = G({
766
+ const n = V({
767
767
  url: e,
768
768
  params: t
769
769
  }), o = this.cacheProvider();
770
770
  if (t.version === "published" && e !== "/cdn/spaces/me") {
771
- const a = await o.get(n);
772
- if (a) return Promise.resolve(a);
771
+ const c = await o.get(n);
772
+ if (c) return Promise.resolve(c);
773
773
  }
774
- const l = P(e, t, this.rateLimitConfig);
775
- return new Promise(async (a, c) => {
776
- var f;
774
+ const l = !B(e) && this.rateLimitConfig.isManagementApi ? P : void 0, a = M(e, t, this.rateLimitConfig, l);
775
+ return new Promise(async (c, d) => {
776
+ var v;
777
777
  try {
778
- const m = await this.throttleManager.execute(l, "get", e, t, r);
779
- if (m.status !== 200) return c(m);
780
- let h = {
781
- data: m.data,
782
- headers: m.headers
778
+ const h = await this.throttleManager.execute(a, "get", e, t, r);
779
+ if (h.status !== 200) return d(h);
780
+ let b = {
781
+ data: h.data,
782
+ headers: h.headers
783
783
  };
784
- const w = Xe(m.headers);
785
- if ((w == null ? void 0 : w.max) !== void 0 && (this.rateLimitConfig.serverHeadersRateLimit = w.max), (f = m.headers) != null && f["per-page"] && (h = Object.assign({}, h, {
786
- perPage: m.headers["per-page"] ? Number.parseInt(m.headers["per-page"]) : 0,
787
- total: m.headers["per-page"] ? Number.parseInt(m.headers.total) : 0
788
- })), h.data.story || h.data.stories) {
789
- const _ = this.resolveCounter = ++this.resolveCounter % 1e3;
790
- await this.resolveStories(h.data, t, `${_}`), h = await this.processInlineAssets(h);
784
+ const L = Xe(h.headers);
785
+ if ((L == null ? void 0 : L.max) !== void 0 && (this.rateLimitConfig.serverHeadersRateLimit = L.max), (v = h.headers) != null && v["per-page"] && (b = Object.assign({}, b, {
786
+ perPage: h.headers["per-page"] ? Number.parseInt(h.headers["per-page"]) : 0,
787
+ total: h.headers["per-page"] ? Number.parseInt(h.headers.total) : 0
788
+ })), b.data.story || b.data.stories) {
789
+ const $ = this.resolveCounter = ++this.resolveCounter % 1e3;
790
+ await this.resolveStories(b.data, t, `${$}`), b = await this.processInlineAssets(b);
791
791
  }
792
- t.version === "published" && e !== "/cdn/spaces/me" && await o.set(n, h);
793
- const L = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
794
- return t.token && h.data.cv && (L && E[t.token] && E[t.token] !== h.data.cv && await this.flushCache(), E[t.token] = h.data.cv), a(h);
795
- } catch (m) {
796
- if (m.response && m.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
797
- return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await Ue(this.retriesDelay), this.cacheResponse(e, t, s).then(a).catch(c);
798
- c(m);
792
+ t.version === "published" && e !== "/cdn/spaces/me" && await o.set(n, b);
793
+ const _ = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
794
+ return t.token && b.data.cv && (_ && E[t.token] && E[t.token] !== b.data.cv && await this.flushCache(), E[t.token] = b.data.cv), c(b);
795
+ } catch (h) {
796
+ if (h.response && h.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
797
+ return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await Ue(this.retriesDelay), this.cacheResponse(e, t, s).then(c).catch(d);
798
+ d(h);
799
799
  }
800
800
  });
801
801
  }
@@ -819,16 +819,16 @@ var rt = class {
819
819
  case "memory":
820
820
  return {
821
821
  get(e) {
822
- return Promise.resolve(M[e]);
822
+ return Promise.resolve(N[e]);
823
823
  },
824
824
  getAll() {
825
- return Promise.resolve(M);
825
+ return Promise.resolve(N);
826
826
  },
827
827
  set(e, t) {
828
- return M[e] = t, Promise.resolve(void 0);
828
+ return N[e] = t, Promise.resolve(void 0);
829
829
  },
830
830
  flush() {
831
- return M = {}, Promise.resolve(void 0);
831
+ return N = {}, Promise.resolve(void 0);
832
832
  }
833
833
  };
834
834
  case "custom":
@@ -922,12 +922,12 @@ const it = (e, t, s = {}) => {
922
922
  } = e;
923
923
  l.accessToken = l.accessToken || n;
924
924
  const c = { bridge: r, apiOptions: l };
925
- let f = {};
925
+ let d = {};
926
926
  o.forEach((h) => {
927
- f = { ...f, ...h(c) };
927
+ d = { ...d, ...h(c) };
928
928
  }), a && (ee = a);
929
- const m = !(typeof window > "u") && ((s = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : s.includes("_storyblok_tk"));
930
- return r !== !1 && m && He(ee), f;
929
+ const v = !(typeof window > "u") && ((s = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : s.includes("_storyblok_tk"));
930
+ return r !== !1 && v && He(ee), d;
931
931
  };
932
932
  function ft(e, t) {
933
933
  return oe(t).render(e);
@@ -939,23 +939,23 @@ const ae = /* @__PURE__ */ te({
939
939
  },
940
940
  setup(e, { expose: t }) {
941
941
  var a;
942
- const s = e, r = N();
942
+ const s = e, r = H();
943
943
  t({
944
944
  value: r
945
945
  });
946
- const n = typeof D(s.blok.component) != "string", o = ve("VueSDKOptions"), l = N((a = s.blok.component) == null ? void 0 : a.replace(/_/g, "-"));
947
- return !n && o && (o.enableFallbackComponent ? (l.value = o.customFallbackComponent ?? "FallbackComponent", typeof D(l.value) == "string" && console.error(
946
+ const n = typeof U(s.blok.component) != "string", o = ve("VueSDKOptions"), l = H((a = s.blok.component) == null ? void 0 : a.replace(/_/g, "-"));
947
+ return !n && o && (o.enableFallbackComponent ? (l.value = o.customFallbackComponent ?? "FallbackComponent", typeof U(l.value) == "string" && console.error(
948
948
  `Is the Fallback component "${l.value}" registered properly?`
949
949
  )) : console.error(
950
950
  `Component could not be found for blok "${s.blok.component}"! Is it defined in main.ts as "app.component("${s.blok.component}", ${s.blok.component});"?`
951
- )), (c, f) => (re(), se(D(l.value), be({
951
+ )), (c, d) => (re(), se(U(l.value), be({
952
952
  ref_key: "blokRef",
953
953
  ref: r
954
954
  }, { ...c.$props, ...c.$attrs }), ke({ _: 2 }, [
955
- Re(c.$slots, (m, h) => ({
955
+ Re(c.$slots, (v, h) => ({
956
956
  name: h,
957
- fn: _e((w) => [
958
- we(c.$slots, h, Te(Ae(w)))
957
+ fn: we((b) => [
958
+ _e(c.$slots, h, Te(Ae(b)))
959
959
  ])
960
960
  }))
961
961
  ]), 1040));
@@ -981,7 +981,7 @@ function ct(e) {
981
981
  textFn: Ee,
982
982
  keyedResolvers: !0,
983
983
  resolvers: {
984
- [k.COMPONENT]: lt,
984
+ [R.COMPONENT]: lt,
985
985
  ...e.resolvers
986
986
  }
987
987
  };
@@ -994,7 +994,7 @@ const ut = /* @__PURE__ */ te({
994
994
  resolvers: {}
995
995
  },
996
996
  setup(e) {
997
- const t = e, s = N(), r = () => s.value;
997
+ const t = e, s = H(), r = () => s.value;
998
998
  return Le([() => t.doc, () => t.resolvers], ([n, o]) => {
999
999
  const { render: l } = ct({
1000
1000
  resolvers: o ?? {}
@@ -1018,7 +1018,7 @@ const ut = /* @__PURE__ */ te({
1018
1018
  };
1019
1019
  let x = null;
1020
1020
  const mt = () => (x || le("useStoryblokApi"), x), yt = async (e, t = {}, s = {}) => {
1021
- const r = N(null);
1021
+ const r = H(null);
1022
1022
  if (s.resolveRelations = s.resolveRelations ?? t.resolve_relations, s.resolveLinks = s.resolveLinks ?? t.resolve_links, $e(() => {
1023
1023
  r.value && r.value.id && it(
1024
1024
  r.value.id,
@@ -1045,7 +1045,7 @@ const mt = () => (x || le("useStoryblokApi"), x), yt = async (e, t = {}, s = {})
1045
1045
  }
1046
1046
  };
1047
1047
  export {
1048
- k as BlockTypes,
1048
+ R as BlockTypes,
1049
1049
  T as MarkTypes,
1050
1050
  nt as StoryblokClient,
1051
1051
  ae as StoryblokComponent,
package/dist/vue.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @storyblok/vue
3
- * (c) 2025
3
+ * (c) 2026
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@storyblok/vue",
3
3
  "type": "module",
4
- "version": "9.4.2",
4
+ "version": "9.4.4",
5
5
  "description": "SDK to integrate Storyblok into your project using Vue.",
6
6
  "author": "Storyblok",
7
7
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "vue": ">=3.4"
32
32
  },
33
33
  "dependencies": {
34
- "@storyblok/js": "4.4.2"
34
+ "@storyblok/js": "4.4.4"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rollup/plugin-typescript": "^12.1.2",