@storyblok/vue 10.1.8 → 10.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ import { Directive, GlobalDirectives } from 'vue';
2
+ /**
3
+ * Compile-time regression test for https://github.com/storyblok/monoblok/issues/620
4
+ * `v-editable` must be declared in Vue's `GlobalDirectives` so that
5
+ * vue-tsc/Volar recognize it in templates under `strictTemplates`.
6
+ */
7
+ export type VEditableIsGloballyDeclared = GlobalDirectives['vEditable'] extends Directive<HTMLElement> ? true : never;
@@ -76,5 +76,5 @@ ${o}
76
76
  `,wh="️",Ih="‍",_s="";let Sa=null,Ta=null;function Ch(t=[]){const e={};de.groups=e;const o=new de;Sa==null&&(Sa=Zl(vh)),Ta==null&&(Ta=Zl(kh)),y(o,"'",va),y(o,"{",Zt),y(o,"}",eo),y(o,"[",na),y(o,"]",sa),y(o,"(",ia),y(o,")",ra),y(o,"<",la),y(o,">",pa),y(o,"(",ca),y(o,")",ma),y(o,"「",ua),y(o,"」",da),y(o,"『",ga),y(o,"』",fa),y(o,"<",ha),y(o,">",ba),y(o,"&",ja),y(o,"*",ka),y(o,"@",Qe),y(o,"`",Fa),y(o,"^",_a),y(o,":",Ze),y(o,",",hs),y(o,"$",Da),y(o,".",xe),y(o,"=",wa),y(o,"!",bs),y(o,"-",ye),y(o,"%",to),y(o,"|",Ia),y(o,"+",Ca),y(o,"#",Ea),y(o,"?",oo),y(o,'"',js),y(o,"/",Ae),y(o,";",vs),y(o,"~",ao),y(o,"_",xa),y(o,"\\",ya),y(o,"・",Jl);const a=X(o,Le,ds,{[ss]:!0});X(a,Le,a);const n=X(a,Re,Kl,{[Xt]:!0}),s=X(a,no,Vl,{[Yt]:!0}),i=X(o,Re,Be,{[is]:!0});X(i,Le,n),X(i,Re,i),X(n,Le,n),X(n,Re,n);const r=X(o,no,cs,{[rs]:!0});X(r,Re),X(r,Le,s),X(r,no,r),X(s,Le,s),X(s,Re),X(s,no,s);const l=y(o,Fs,fs,{[ps]:!0}),p=y(o,Yl,gs,{[ps]:!0}),c=X(o,ys,gs,{[ps]:!0});y(o,_s,c),y(p,Fs,l),y(p,_s,c),X(p,ys,c),y(c,Yl),y(c,Fs),X(c,ys,c),y(c,_s,c);const m=X(o,ks,Gl,{[Wl]:!0});y(m,"#"),X(m,ks,m),y(m,wh,m);const u=y(m,Ih);y(u,"#"),X(u,ks,m);const d=[[Re,i],[Le,n]],g=[[Re,null],[no,r],[Le,s]];for(let f=0;f<Sa.length;f++)et(o,Sa[f],ms,Be,d);for(let f=0;f<Ta.length;f++)et(o,Ta[f],us,cs,g);bt(ms,{tld:!0,ascii:!0},e),bt(us,{utld:!0,alpha:!0},e),et(o,"file",aa,Be,d),et(o,"mailto",aa,Be,d),et(o,"http",At,Be,d),et(o,"https",At,Be,d),et(o,"ftp",At,Be,d),et(o,"ftps",At,Be,d),bt(aa,{scheme:!0,ascii:!0},e),bt(At,{slashscheme:!0,ascii:!0},e),t=t.sort((f,h)=>f[0]>h[0]?1:-1);for(let f=0;f<t.length;f++){const h=t[f][0],k=t[f][1]?{[yh]:!0}:{[Fh]:!0};h.indexOf("-")>=0?k[ls]=!0:Re.test(h)?Le.test(h)?k[Xt]=!0:k[is]=!0:k[ss]=!0,Ul(o,h,h,k)}return Ul(o,"localhost",Qt,{ascii:!0}),o.jd=new de(Aa),{start:o,tokens:Object.assign({groups:e},Xl)}}function Ql(t,e){const o=Eh(e.replace(/[A-Z]/g,r=>r.toLowerCase())),a=o.length,n=[];let s=0,i=0;for(;i<a;){let r=t,l=null,p=0,c=null,m=-1,u=-1;for(;i<a&&(l=r.go(o[i]));)r=l,r.accepts()?(m=0,u=0,c=r):m>=0&&(m+=o[i].length,u++),p+=o[i].length,s+=o[i].length,i++;s-=m,i-=u,p-=m,n.push({t:c.t,v:e.slice(s-p,s),s:s-p,e:s})}return n}function Eh(t){const e=[],o=t.length;let a=0;for(;a<o;){let n=t.charCodeAt(a),s,i=n<55296||n>56319||a+1===o||(s=t.charCodeAt(a+1))<56320||s>57343?t[a]:t.slice(a,a+2);e.push(i),a+=i.length}return e}function et(t,e,o,a,n){let s;const i=e.length;for(let r=0;r<i-1;r++){const l=e[r];t.j[l]?s=t.j[l]:(s=new de(a),s.jr=n.slice(),t.j[l]=s),t=s}return s=new de(o),s.jr=n.slice(),t.j[e[i-1]]=s,s}function Zl(t){const e=[],o=[];let a=0,n="0123456789";for(;a<t.length;){let s=0;for(;n.indexOf(t[a+s])>=0;)s++;if(s>0){e.push(o.join(""));for(let i=parseInt(t.substring(a,a+s),10);i>0;i--)o.pop();a+=s}else o.push(t[a]),a++}return e}const so={defaultProtocol:"http",events:null,format:ep,formatHref:ep,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ds(t,e=null){let o=Object.assign({},so);t&&(o=Object.assign(o,t instanceof Ds?t.o:t));const a=o.ignoreTags,n=[];for(let s=0;s<a.length;s++)n.push(a[s].toUpperCase());this.o=o,e&&(this.defaultRender=e),this.ignoreTags=n}Ds.prototype={o:so,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,o){const a=e!=null;let n=this.o[t];return n&&(typeof n=="object"?(n=o.t in n?n[o.t]:so[t],typeof n=="function"&&a&&(n=n(e,o))):typeof n=="function"&&a&&(n=n(e,o.t,o)),n)},getObj(t,e,o){let a=this.o[t];return typeof a=="function"&&e!=null&&(a=a(e,o.t,o)),a},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function ep(t){return t}function tp(t,e){this.t="token",this.v=t,this.tk=e}tp.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),o=t.get("truncate",e,this),a=t.get("format",e,this);return o&&a.length>o?a.substring(0,o)+"…":a},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=so.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,o=this.toHref(t.get("defaultProtocol")),a=t.get("formatHref",o,this),n=t.get("tagName",o,e),s=this.toFormattedString(t),i={},r=t.get("className",o,e),l=t.get("target",o,e),p=t.get("rel",o,e),c=t.getObj("attributes",o,e),m=t.getObj("events",o,e);return i.href=a,r&&(i.class=r),l&&(i.target=l),p&&(i.rel=p),c&&Object.assign(i,c),{tagName:n,attributes:i,content:s,eventListeners:m}}};function Ma(t,e){class o extends tp{constructor(n,s){super(n,s),this.t=t}}for(const a in e)o.prototype[a]=e[a];return o.t=t,o}const op=Ma("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ap=Ma("text"),xh=Ma("nl"),Ba=Ma("url",{isLink:!0,toHref(t=so.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Qt&&t[1].t===Ze}}),Fe=t=>new de(t);function Ah({groups:t}){const e=t.domain.concat([ja,ka,Qe,ya,Fa,_a,Da,wa,ye,ds,to,Ia,Ca,Ea,Ae,Aa,ao,xa]),o=[va,Ze,hs,xe,bs,to,oo,js,vs,la,pa,Zt,eo,sa,na,ia,ra,ca,ma,ua,da,ga,fa,ha,ba],a=[ja,va,ka,ya,Fa,_a,Da,wa,ye,Zt,eo,to,Ia,Ca,Ea,oo,Ae,Aa,ao,xa],n=Fe(),s=y(n,ao);R(s,a,s),R(s,t.domain,s);const i=Fe(),r=Fe(),l=Fe();R(n,t.domain,i),R(n,t.scheme,r),R(n,t.slashscheme,l),R(i,a,s),R(i,t.domain,i);const p=y(i,Qe);y(s,Qe,p),y(r,Qe,p),y(l,Qe,p);const c=y(s,xe);R(c,a,s),R(c,t.domain,s);const m=Fe();R(p,t.domain,m),R(m,t.domain,m);const u=y(m,xe);R(u,t.domain,m);const d=Fe(op);R(u,t.tld,d),R(u,t.utld,d),y(p,Qt,d);const g=y(m,ye);y(g,ye,g),R(g,t.domain,m),R(d,t.domain,m),y(d,xe,u),y(d,ye,g);const f=y(d,Ze);R(f,t.numeric,op);const h=y(i,ye),b=y(i,xe);y(h,ye,h),R(h,t.domain,i),R(b,a,s),R(b,t.domain,i);const k=Fe(Ba);R(b,t.tld,k),R(b,t.utld,k),R(k,t.domain,i),R(k,a,s),y(k,xe,b),y(k,ye,h),y(k,Qe,p);const j=y(k,Ze),F=Fe(Ba);R(j,t.numeric,F);const _=Fe(Ba),w=Fe();R(_,e,_),R(_,o,w),R(w,e,_),R(w,o,w),y(k,Ae,_),y(F,Ae,_);const T=y(r,Ze),N=y(l,Ze),P=y(N,Ae),I=y(P,Ae);R(r,t.domain,i),y(r,xe,b),y(r,ye,h),R(l,t.domain,i),y(l,xe,b),y(l,ye,h),R(T,t.domain,_),y(T,Ae,_),y(T,oo,_),R(I,t.domain,_),R(I,e,_),y(I,Ae,_);const M=[[Zt,eo],[na,sa],[ia,ra],[la,pa],[ca,ma],[ua,da],[ga,fa],[ha,ba]];for(let O=0;O<M.length;O++){const[L,x]=M[O],B=y(_,L);y(w,L,B),y(B,x,_);const Y=Fe(Ba);R(B,e,Y);const ce=Fe();R(B,o),R(Y,e,Y),R(Y,o,ce),R(ce,e,Y),R(ce,o,ce),y(Y,x,_),y(ce,x,_)}return y(n,Qt,k),y(n,fs,xh),{start:n,tokens:Xl}}function Sh(t,e,o){let a=o.length,n=0,s=[],i=[];for(;n<a;){let r=t,l=null,p=null,c=0,m=null,u=-1;for(;n<a&&!(l=r.go(o[n].t));)i.push(o[n++]);for(;n<a&&(p=l||r.go(o[n].t));)l=null,r=p,r.accepts()?(u=0,m=r):u>=0&&u++,n++,c++;if(u<0)n-=c,n<a&&(i.push(o[n]),n++);else{i.length>0&&(s.push(ws(ap,e,i)),i=[]),n-=u,c-=u;const d=m.t,g=o.slice(n-c,n);s.push(ws(d,e,g))}}return i.length>0&&s.push(ws(ap,e,i)),s}function ws(t,e,o){const a=o[0].s,n=o[o.length-1].e,s=e.slice(a,n);return new t(s,o)}const Th=typeof console<"u"&&console&&console.warn||(()=>{}),Mh="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",U={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Bh(){return de.groups={},U.scanner=null,U.parser=null,U.tokenQueue=[],U.pluginQueue=[],U.customSchemes=[],U.initialized=!1,U}function np(t,e=!1){if(U.initialized&&Th(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Mh}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
77
77
  1. Must only contain digits, lowercase ASCII letters or "-"
78
78
  2. Cannot start or end with "-"
79
- 3. "-" cannot repeat`);U.customSchemes.push([t,e])}function Rh(){U.scanner=Ch(U.customSchemes);for(let t=0;t<U.tokenQueue.length;t++)U.tokenQueue[t][1]({scanner:U.scanner});U.parser=Ah(U.scanner.tokens);for(let t=0;t<U.pluginQueue.length;t++)U.pluginQueue[t][1]({scanner:U.scanner,parser:U.parser});return U.initialized=!0,U}function Is(t){return U.initialized||Rh(),Sh(U.parser.start,t,Ql(U.scanner.start,t))}Is.scan=Ql;function sp(t,e=null,o=null){if(e&&typeof e=="object"){if(o)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);o=e,e=null}const a=new Ds(o),n=Is(t),s=[];for(let i=0;i<n.length;i++){const r=n[i];r.isLink&&(!e||r.t===e)&&a.check(r)&&s.push(r.toFormattedObject(a))}return s}var Cs="[\0-   ᠎ -\u2029  ]",Lh=new RegExp(Cs),Nh=new RegExp(`${Cs}$`),zh=new RegExp(Cs,"g");function Oh(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function $h(t){return new ie({key:new te("autolink"),appendTransaction:(e,o,a)=>{const n=e.some(p=>p.docChanged)&&!o.doc.eq(a.doc),s=e.some(p=>p.getMeta("preventAutolink"));if(!n||s)return;const{tr:i}=a,r=En(o.doc,[...e]);if(An(r).forEach(({newRange:p})=>{const c=Wr(a.doc,p,d=>d.isTextblock);let m,u;if(c.length>1)m=c[0],u=a.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(c.length){const d=a.doc.textBetween(p.from,p.to," "," ");if(!Nh.test(d))return;m=c[0],u=a.doc.textBetween(m.pos,p.to,void 0," ")}if(m&&u){const d=u.split(Lh).filter(Boolean);if(d.length<=0)return!1;const g=d[d.length-1],f=m.pos+u.lastIndexOf(g);if(!g)return!1;const h=Is(g).map(b=>b.toObject(t.defaultProtocol));if(!Oh(h))return!1;h.filter(b=>b.isLink).map(b=>({...b,from:f+b.start+1,to:f+b.end+1})).filter(b=>a.schema.marks.code?!a.doc.rangeHasMark(b.from,b.to,a.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Sn(b.from,b.to,a.doc).some(k=>k.mark.type===t.type)||i.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!i.steps.length)return i}})}function Ph(t){return new ie({key:new te("handleClickLink"),props:{handleClick:(e,o,a)=>{var n,s;if(a.button!==0||!e.editable)return!1;let i=null;if(a.target instanceof HTMLAnchorElement)i=a.target;else{const l=a.target;if(!l)return!1;const p=t.editor.view.dom;i=l.closest("a"),i&&!p.contains(i)&&(i=null)}if(!i)return!1;let r=!1;if(t.enableClickSelection&&(r=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=qu(e.state,t.type.name),p=(n=i.href)!=null?n:l.href,c=(s=i.target)!=null?s:l.target;p&&(window.open(p,c),r=!0)}return r}}})}function Hh(t){return new ie({key:new te("handlePasteLink"),props:{handlePaste:(e,o,a)=>{const{shouldAutoLink:n}=t,{state:s}=e,{selection:i}=s,{empty:r}=i;if(r)return!1;let l="";a.content.forEach(c=>{l+=c.textContent});const p=sp(l,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!p||n!==void 0&&!n(p.value)?!1:t.editor.commands.setMark(t.type,{href:p.href})}}})}function jt(t,e){const o=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(a=>{const n=typeof a=="string"?a:a.scheme;n&&o.push(n)}),!t||t.replace(zh,"").match(new RegExp(`^(?:(?:${o.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var qh=ue.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){np(t);return}np(t.scheme,t.optionalSlashes)})},onDestroy(){Bh()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!jt(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),o=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||o&&!t.includes("@"))return!0;const n=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(n)||!/\./.test(n))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:o=>!!jt(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!jt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",$(this.options.HTMLAttributes,t),0]:["a",$(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var o,a,n,s;const i=(a=(o=t.attrs)==null?void 0:o.href)!=null?a:"",r=(s=(n=t.attrs)==null?void 0:n.title)!=null?s:"",l=e.renderChildren(t);return r?`[${l}](${i} "${r}")`:`[${l}](${i})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:o}=t;return this.options.isAllowedUri(o,{defaultValidate:a=>!!jt(a,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:o}=t||{};return o&&!this.options.isAllowedUri(o,{defaultValidate:a=>!!jt(a,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Xe({find:t=>{const e=[];if(t){const{protocols:o,defaultProtocol:a}=this.options,n=sp(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:i=>!!jt(i,o),protocols:o,defaultProtocol:a}));n.length&&n.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:o}=this.options;return this.options.autolink&&t.push($h({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:a=>this.options.isAllowedUri(a,{defaultValidate:n=>!!jt(n,e),protocols:e,defaultProtocol:o}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Ph({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Hh({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Wh=qh,Uh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Kh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Vh=ue.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",$(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[gt({find:Uh,type:this.type})]},addPasteRules(){return[Xe({find:Kh,type:this.type})]}}),Jh=Vh,Gh=ue.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",$(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),Xh=Gh,Yh=ue.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",$(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),Qh=Yh,Zh=20,ip=(t,e=0)=>{const o=[];return!t.children.length||e>Zh||Array.from(t.children).forEach(a=>{a.tagName==="SPAN"?o.push(a):a.children.length&&o.push(...ip(a,e+1))}),o},e1=t=>{if(!t.children.length)return;const e=ip(t);e&&e.forEach(o=>{var a,n;const s=o.getAttribute("style"),i=(n=(a=o.parentElement)==null?void 0:a.closest("span"))==null?void 0:n.getAttribute("style");o.setAttribute("style",`${i};${s}`)})},t1=ue.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&e1(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",$(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(o,a)=>{if(o.isTextblock)return!0;o.marks.filter(n=>n.type===this.type).some(n=>Object.values(n.attrs).some(s=>!!s))||t.removeMark(a,a+o.nodeSize,this.type)}),!0}}}}),o1=ee.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const o=t.getAttribute("style");if(o){const a=o.split(";").map(n=>n.trim()).filter(Boolean);for(let n=a.length-1;n>=0;n-=1){const s=a[n].split(":");if(s.length>=2){const i=s[0].trim().toLowerCase(),r=s.slice(1).join(":").trim();if(i==="background-color")return r.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),a1=ee.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const o=t.getAttribute("style");if(o){const a=o.split(";").map(n=>n.trim()).filter(Boolean);for(let n=a.length-1;n>=0;n-=1){const s=a[n].split(":");if(s.length>=2){const i=s[0].trim().toLowerCase(),r=s.slice(1).join(":").trim();if(i==="color")return r.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),n1=ee.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),s1=ee.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),i1=ee.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ee.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(o1.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(a1.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(n1.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(s1.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(i1.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(t1.configure(this.options.textStyle)),t}});var r1=ue.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",$(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,o){const n=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!n)return;const s=n[2].trim();return{type:"underline",raw:n[0],text:s,tokens:o.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),l1=r1;function p1(t,e){if(!e)return{src:t,attrs:{}};let o=0,a=0;const n={},s=[];function i(l,p,c,m,u){typeof l!="number"||l<=p||l>=c?console.warn(`[StoryblokRichText] - ${m.charAt(0).toUpperCase()+m.slice(1)} value must be a number between ${p} and ${c} (inclusive)`):u.push(`${m}(${l})`)}if(typeof e=="object"){if(e.width!==void 0&&(typeof e.width=="number"&&e.width>=0?(n.width=e.width,o=e.width):console.warn("[StoryblokRichText] - Width value must be a number greater than or equal to 0")),e.height!==void 0&&(typeof e.height=="number"&&e.height>=0?(n.height=e.height,a=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than or equal to 0")),e.height===0&&e.width===0&&(delete n.width,delete n.height,console.warn("[StoryblokRichText] - Width and height values cannot both be 0")),e.loading&&["lazy","eager"].includes(e.loading)&&(n.loading=e.loading),e.class&&(n.class=e.class),e.filters){const{filters:l}=e||{},{blur:p,brightness:c,fill:m,format:u,grayscale:d,quality:g,rotate:f}=l||{};p&&i(p,0,100,"blur",s),g&&i(g,0,100,"quality",s),c&&i(c,0,100,"brightness",s),m&&s.push(`fill(${m})`),d&&s.push("grayscale()"),f&&[0,90,180,270].includes(e.filters.rotate||0)&&s.push(`rotate(${f})`),u&&["webp","png","jpeg"].includes(u)&&s.push(`format(${u})`)}e.srcset&&(n.srcset=e.srcset.map(l=>{if(typeof l=="number")return`${t}/m/${l}x0/${s.length>0?`filters:${s.join(":")}`:""} ${l}w`;if(Array.isArray(l)&&l.length===2){const[p,c]=l;return`${t}/m/${p}x${c}/${s.length>0?`filters:${s.join(":")}`:""} ${p}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),e.sizes&&(n.sizes=e.sizes.join(", "))}let r=`${t}/m/`;return(o>0||a>0)&&(r=`${r}${o}x${a}/`),s.length>0&&(r=`${r}filters:${s.join(":")}`),{src:r,attrs:n}}function Es(t,e){if(t===e)return!0;if(t==null||e===null||e===void 0)return t===e;if(typeof t!=typeof e||typeof t!="object"||Array.isArray(t)!==Array.isArray(e))return!1;if(Array.isArray(t))return t.length!==e.length?!1:t.every((n,s)=>Es(n,e[s]));const o=Object.keys(t),a=Object.keys(e);return o.length!==a.length?!1:o.every(n=>Object.prototype.hasOwnProperty.call(e,n)&&Es(t[n],e[n]))}function rp(t,e){return t.type===e.type&&Es(t.attrs,e.attrs)}function lp(t){var e;return t.type==="text"&&!!((e=t.marks)!=null&&e.length)}function c1(t,e){const o=t.filter(a=>!e.some(n=>rp(n,a)));return o.length?o:void 0}function m1(t,e){const o=t[e];if(!lp(o))return null;const a=[o];let n=o.marks,s=e+1;for(;s<t.length;){const i=t[s];if(!lp(i))break;const r=n.filter(l=>i.marks.some(p=>rp(l,p)));if(r.length===0)break;n=r,a.push(i),s++}return{group:a,shared:n,endIndex:s}}const u1=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],d1=(t={})=>{const{custom:e,...o}=t,a={...o,...e};return Object.keys(a).filter(n=>a[n]!=null).map(n=>`${n}="${String(a[n]).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}"`).join(" ")},pp=(t={})=>Object.keys(t).map(e=>`${e}: ${t[e]}`).join("; ");function g1(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const vt=t=>Object.fromEntries(Object.entries(t).filter(([e,o])=>o!=null));let f1=(function(t){return t.DOCUMENT="doc",t.HEADING="heading",t.PARAGRAPH="paragraph",t.QUOTE="blockquote",t.OL_LIST="ordered_list",t.UL_LIST="bullet_list",t.LIST_ITEM="list_item",t.CODE_BLOCK="code_block",t.HR="horizontal_rule",t.BR="hard_break",t.IMAGE="image",t.EMOJI="emoji",t.COMPONENT="blok",t.TABLE="table",t.TABLE_ROW="tableRow",t.TABLE_CELL="tableCell",t.TABLE_HEADER="tableHeader",t})({}),h1=(function(t){return t.BOLD="bold",t.STRONG="strong",t.STRIKE="strike",t.UNDERLINE="underline",t.ITALIC="italic",t.CODE="code",t.LINK="link",t.ANCHOR="anchor",t.STYLED="styled",t.SUPERSCRIPT="superscript",t.SUBSCRIPT="subscript",t.TEXT_STYLE="textStyle",t.HIGHLIGHT="highlight",t})({}),b1=(function(t){return t.TEXT="text",t})({}),io=(function(t){return t.URL="url",t.STORY="story",t.ASSET="asset",t.EMAIL="email",t})({});function Ne(t={}){const{textAlign:e,class:o,id:a,style:n,...s}=t,i=[];return n&&i.push(n.endsWith(";")?n:`${n};`),e&&i.push(`text-align: ${e};`),vt({...s,class:o,id:a,...i.length>0?{style:i.join(" ")}:{}})}function j1(t={}){const{linktype:e,href:o,anchor:a,uuid:n,custom:s,...i}=t;let r=o??"";switch(e){case io.ASSET:case io.URL:break;case io.EMAIL:r&&!r.startsWith("mailto:")&&(r=`mailto:${r}`);break;case io.STORY:a&&(r=`${r}#${a}`);break}return{href:r,rest:{...i,...s||{}}}}function cp(t={}){const{colspan:e,rowspan:o,colwidth:a,backgroundColor:n,textAlign:s,...i}=t,r=[];return a&&r.push(`width: ${a}px;`),n&&r.push(`background-color: ${n};`),s&&r.push(`text-align: ${s};`),vt({...i,...e>1?{colspan:e}:{},...o>1?{rowspan:o}:{},...r.length>0?{style:r.join(" ")}:{}})}const xs={a:["href","target","data-uuid","data-anchor","data-linktype"],img:["alt","src","title"],span:["class"]};function mp(t,{allowedStyles:e}){const o=(t.getAttribute("class")||"").split(" ").filter(Boolean);if(!o.length)return[];const a=o.filter(n=>!e.includes(n));for(const n of a)console.warn(`[StoryblokRichText] - \`class\` "${n}" on \`<${t.tagName.toLowerCase()}>\` can not be transformed to rich text.`);return e.filter(n=>o.includes(n))}const v1=Qf.configure({types:["heading","paragraph"]}),k1=ff.extend({renderHTML({HTMLAttributes:t}){return["blockquote",Ne(t),0]}}),y1=Jf.extend({renderHTML({HTMLAttributes:t}){return["p",Ne(t),0]}}),F1=Pf.extend({renderHTML({node:t,HTMLAttributes:e}){const{level:o,...a}=e;return[`h${t.attrs.level}`,Ne(a),0]}}),_1=Ol.extend({renderHTML({HTMLAttributes:t}){return["tr",Ne(t),0]}}),D1=ol.extend({name:"bullet_list",addOptions(){return{...this.parent(),itemTypeName:"list_item"}},renderHTML({HTMLAttributes:t}){return["ul",Ne(t),0]}}),w1=dl.extend({name:"ordered_list",addAttributes(){return{order:{default:1}}},addOptions(){return{...this.parent(),itemTypeName:"list_item"}},renderHTML({HTMLAttributes:t}){return["ol",Ne(t),0]}}),I1=al.extend({name:"list_item",addOptions(){return{...this.parent(),bulletListTypeName:"bullet_list",orderedListTypeName:"ordered_list"}},renderHTML({HTMLAttributes:t}){return["li",Ne(t),0]}}),C1=vf.extend({name:"code_block",addAttributes(){return{class:{default:null}}},renderHTML({node:t,HTMLAttributes:e}){const{language:o,...a}=e,n=Ne(a),s=t.attrs.language;return["pre",n,["code",s?{class:`language-${s}`}:{},0]]}}),E1=Of.extend({name:"hard_break"}),x1=qf.extend({name:"horizontal_rule"}),A1=Hl.extend({renderHTML({HTMLAttributes:t}){return["table",Ne(t),0]}}),S1=Nl.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const o=e.getAttribute("colwidth");return o?o.split(",").map(Number):null}},backgroundColor:{default:null}}},renderHTML({HTMLAttributes:t}){return["td",cp(t),0]}}),T1=zl.extend({renderHTML({HTMLAttributes:t}){return["th",cp(t),0]}}),up=Kf.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),optimizeImages:!1}},renderHTML({HTMLAttributes:t}){const{src:e,alt:o,title:a,srcset:n,sizes:s}=t;let i=e,r={};if(this.options.optimizeImages){const l=p1(e,this.options.optimizeImages);i=l.src,r=l.attrs}return["img",vt({src:i,alt:o,title:a,srcset:n,sizes:s,...r})]}}),M1=Nf.extend({renderHTML({HTMLAttributes:t}){return["img",{"data-emoji":t.emoji,"data-name":t.name,src:t.fallbackImage,alt:t.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"}]}}),As=V.create({name:"blok",group:"block",atom:!0,addOptions(){return{renderComponent:null}},addAttributes(){return{id:{default:null},body:{default:[]}}},parseHTML(){return[{tag:"div[data-blok]"}]},renderHTML({HTMLAttributes:t}){var e;return console.warn("[StoryblokRichText] - BLOK resolver is not available for vanilla usage. Configure `renderComponent` option on the blok tiptapExtension."),["span",vt({"data-blok":JSON.stringify(((e=t==null?void 0:t.body)==null?void 0:e[0])??null),"data-blok-id":t==null?void 0:t.id,style:"display: none"})]}}),B1=uh.extend({addAttributes(){return{color:{default:null}}}}),Ss=Wh.extend({addAttributes(){return{href:{parseHTML:t=>t.getAttribute("href")},uuid:{default:null,parseHTML:t=>t.getAttribute("data-uuid")||null},anchor:{default:null,parseHTML:t=>t.getAttribute("data-anchor")||null},target:{parseHTML:t=>t.getAttribute("target")||null},linktype:{default:"url",parseHTML:t=>t.getAttribute("data-linktype")||"url"}}},renderHTML({HTMLAttributes:t}){const{href:e,rest:o}=j1(t);return["a",vt({...e?{href:e}:{},...o}),0]}}),R1=Ss.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),custom:{default:null,parseHTML:e=>{const o=xs.a,a=e.getAttributeNames().filter(s=>!o.includes(s)),n={};for(const s of a)n[s]=e.getAttribute(s);return Object.keys(n).length?n:null}}}}}),L1=ue.create({name:"anchor",addAttributes(){return{id:{default:null}}},parseHTML(){return[{tag:"span[id]"}]},renderHTML({HTMLAttributes:t}){return["span",{id:t.id},0]}}),dp=ue.create({name:"styled",addAttributes(){return{class:{parseHTML:t=>{const e=mp(t,{allowedStyles:this.options.allowedStyles||[]});return e.length?e.join(" "):null}}}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>mp(t,{allowedStyles:this.options.allowedStyles||[]}).length?null:!1}]},renderHTML({HTMLAttributes:t}){const{class:e,...o}=t;return["span",vt({class:e,style:pp(o)||void 0}),0]}}),N1=ue.create({name:"textStyle",addAttributes(){return{class:{default:null},id:{default:null},color:{default:null}}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>{const e=t.getAttribute("style");return e&&/color/i.test(e)?null:!1}}]},renderHTML({HTMLAttributes:t}){const{class:e,id:o,...a}=t;return["span",vt({class:e,id:o,style:pp(a)||void 0}),0]}}),gp=ue.create({name:"reporter",priority:0,addOptions(){return{allowCustomAttributes:!1}},parseHTML(){return[{tag:"*",consuming:!1,getAttrs:t=>{const e=t.tagName.toLowerCase();if(e==="a"&&this.options.allowCustomAttributes)return!1;const o=t.getAttributeNames().filter(a=>!(e in xs?xs[e]:[]).includes(a));for(const a of o)console.warn(`[StoryblokRichText] - \`${a}\` "${t.getAttribute(a)}" on \`<${e}>\` can not be transformed to rich text.`);return!1}}]}}),z1={document:yf,text:Xf,paragraph:y1,blockquote:k1,heading:F1,bulletList:D1,orderedList:w1,listItem:I1,codeBlock:C1,hardBreak:E1,horizontalRule:x1,image:up,emoji:M1,table:A1,tableRow:_1,tableCell:S1,tableHeader:T1,blok:As,details:tg,detailsContent:og,detailsSummary:ag,bold:nh,italic:jh,strike:Jh,underline:l1,code:lh,superscript:Qh,subscript:Xh,highlight:B1,textStyle:N1,link:Ss,anchor:L1,styled:dp,reporter:gp,textAlign:v1};function O1(t={}){var o;const e=t.allowCustomAttributes?R1:Ss;return{...z1,image:up.configure({optimizeImages:t.optimizeImages||!1}),link:e,styled:dp.configure({allowedStyles:(o=t.styleOptions)==null?void 0:o.map(a=>a.value)}),reporter:gp.configure({allowCustomAttributes:t.allowCustomAttributes})}}function fp(t,e={},o){const a=d1(e),n=a?`${t} ${a}`:t,s=Array.isArray(o)?o.join(""):o||"";if(t){if(u1.includes(t))return`<${n}>`}else return s;return`<${n}>${s}</${t}>`}function ro(t,e,o){const[a,...n]=t;let s={},i=n;if(i.length>0&&i[0]!==null&&i[0]!==void 0&&typeof i[0]=="object"&&!Array.isArray(i[0])&&typeof i[0]!="number"&&(s=i[0],i=i.slice(1)),i=i.filter(l=>l!=null),i.length===0)return e(a,s);if(i.length===1&&i[0]===0)return e(a,s,o);const r=i.map(l=>l===0?o:Array.isArray(l)?ro(l,e,o):l);return e(a,s,r.length===1?r[0]:r)}function Ra(t,e,o){const a={options:t.options||{},name:t.name,type:t.type};return e==="node"?t.config.renderHTML.call(a,{node:{attrs:o},HTMLAttributes:o}):t.config.renderHTML.call(a,{mark:{attrs:o},HTMLAttributes:o})}function Ts(t={}){const e=new Map,{renderFn:o=fp,textFn:a=g1,optimizeImages:n=!1,keyedResolvers:s=!1,tiptapExtensions:i}=t,r=o!==fp,l=O1({optimizeImages:n}),p=i?{...l,...i}:l,c=Object.values(p),m=new Map,u=new Map;for(const j of c)j.type==="node"?m.set(j.name,j):j.type==="mark"&&u.set(j.name,j);const d=(j,F={},_)=>{if(s&&j){const w=e.get(j)||0;e.set(j,w+1),F={...F,key:`${j}-${w}`}}return r&&typeof j!="string"&&_!==void 0?o(j,F,(()=>_)):o(j,F,_)};function g(j,F){var T;const _=j.map(N=>b({...N,marks:c1(N.marks||[],F)}));let w=r?_:_.join("");for(const N of F){const P=u.get(N.type);(T=P==null?void 0:P.config)!=null&&T.renderHTML&&(w=ro(Ra(P,"mark",N.attrs||{}),d,w))}return w}function f(j){const F=[];let _=0;for(;_<j.length;){const w=m1(j,_);if(!w){F.push(k(j[_])),_++;continue}w.group.length===1?F.push(b(w.group[0])):F.push(g(w.group,w.shared)),_=w.endIndex}return F}function h(j){var w,T,N,P,I,M;if(j.type==="text")return b(j);if(j.type==="doc")return k(j);const F=m.get(j.type);if(!((w=F==null?void 0:F.config)!=null&&w.renderHTML))return console.error("<Storyblok>",`No extension found for node type ${j.type}`),"";if((T=F.options)!=null&&T.renderComponent){const O=(N=j.attrs)==null?void 0:N.body,L=(P=j.attrs)==null?void 0:P.id;if(!Array.isArray(O)||O.length===0)return r?[]:"";const x=O.map(B=>F.options.renderComponent(B,L));return r?x:x.filter(B=>B!=null).join("")}if(j.type==="table"&&((I=j.content)!=null&&I.length)){const O=[],L=[];for(const Y of j.content)L.length===0&&((M=Y.content)!=null&&M.every(ce=>ce.type==="tableHeader"))?O.push(Y):L.push(Y);const x=Ra(F,"node",j.attrs||{}),B=[];return O.length>0&&B.push(d("thead",{},O.map(k))),L.length>0&&B.push(d("tbody",{},L.map(k))),ro(x,d,B)}const _=j.content?f(j.content):void 0;return ro(Ra(F,"node",j.attrs||{}),d,_)}function b(j){const{marks:F,..._}=j;if(F!=null&&F.length){const T=(()=>{const N={};if(s){const P=e.get("txt")||0;e.set("txt",P+1),N.key=`txt-${P}`}return a(_.text,N)})();return F.reduce((N,P)=>{var M;const I=u.get(P.type);return(M=I==null?void 0:I.config)!=null&&M.renderHTML?ro(Ra(I,"mark",P.attrs||{}),d,N):(console.error("<Storyblok>",`No extension found for node type ${P.type}`),N)},T)}const w=j.attrs||{};if(s){const T=e.get("txt")||0;e.set("txt",T+1),w.key=`txt-${T}`}return a(_.text,w)}function k(j){const F=j;return F.type==="doc"?r?F.content.map(h):F.content.map(h).join(""):Array.isArray(F)?F.map(h):h(F)}return{render:k}}function $1(t){return t}const Ms=(t="")=>t.includes("/cdn/"),P1=(t,e=25,o=1)=>({...t,per_page:e,page:o}),H1=t=>new Promise(e=>setTimeout(e,t)),q1=(t=0,e)=>Array.from({length:t},e),W1=(t=0,e=t)=>{const o=Math.abs(e-t)||0,a=t<e?1:-1;return q1(o,(n,s)=>s*a+t)},U1=async(t,e)=>Promise.all(t.map(e)),K1=(t=[],e)=>t.map(e).reduce((o,a)=>[...o,...a],[]),hp=t=>{if(/%[0-9A-F]{2}/i.test(t))try{return decodeURIComponent(t)}catch{return t}return t},Bs=(t,e,o)=>{const a=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const s=t[n];if(s==null)continue;const i=o?"":encodeURIComponent(n);let r;typeof s=="object"?r=Bs(s,e?e+encodeURIComponent(`[${i}]`):i,Array.isArray(s)):r=`${e?e+encodeURIComponent(`[${i}]`):i}=${encodeURIComponent(s)}`,a.push(r)}return a.join("&")},bp=t=>{const e={eu:"api.storyblok.com",us:"api-us.storyblok.com",cn:"app.storyblokchina.cn",ap:"api-ap.storyblok.com",ca:"api-ca.storyblok.com"};return e[t]??e.eu};var V1=class{constructor(t){q(this,"baseURL");q(this,"timeout");q(this,"headers");q(this,"responseInterceptor");q(this,"fetch");q(this,"ejectInterceptor");q(this,"url");q(this,"parameters");q(this,"fetchOptions");this.baseURL=t.baseURL,this.headers=t.headers||new Headers,this.timeout=t!=null&&t.timeout?t.timeout*1e3:0,this.responseInterceptor=t.responseInterceptor,this.fetch=(...e)=>t.fetch?t.fetch(...e):fetch(...e),this.ejectInterceptor=!1,this.url="",this.parameters={},this.fetchOptions={}}get(t,e){return this.url=t,this.parameters=e,this._methodHandler("get")}post(t,e){return this.url=t,this.parameters=e,this._methodHandler("post")}put(t,e){return this.url=t,this.parameters=e,this._methodHandler("put")}patch(t,e){return this.url=t,this.parameters=e,this._methodHandler("patch")}delete(t,e){return this.url=t,this.parameters=e??{},this._methodHandler("delete")}async _responseHandler(t){const e=[],o={data:{},headers:{},status:0,statusText:""};t.status!==204&&await t.json().then(a=>{o.data=a});for(const a of t.headers.entries())e[a[0]]=a[1];return o.headers={...e},o.status=t.status,o.statusText=t.statusText,o}async _methodHandler(t){let e=`${this.baseURL}${this.url}`,o=null;t==="get"?e=`${this.baseURL}${this.url}?${Bs(this.parameters)}`:o=JSON.stringify(this.parameters);const a=new URL(e),n=new AbortController,{signal:s}=n;let i=null;this.timeout&&(i=setTimeout(()=>n.abort(),this.timeout));try{const r=await this.fetch(`${a}`,{method:t,headers:this.headers,body:o,signal:s,...this.fetchOptions});this.timeout&&i&&clearTimeout(i);const l=await this._responseHandler(r);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(l)):this._statusHandler(l)}catch(r){return r.name==="AbortError"?{message:"Request timeout: The request was aborted due to timeout"}:{message:r.message||r.toString()||"An unknown error occurred"}}}setFetchOptions(t={}){Object.keys(t).length>0&&"method"in t&&delete t.method,this.fetchOptions={...t}}eject(){this.ejectInterceptor=!0}_normalizeErrorMessage(t){if(Array.isArray(t))return t[0]||"Unknown error";if(t&&typeof t=="object"){if(t.error)return t.error;for(const e in t){if(Array.isArray(t[e]))return`${e}: ${t[e][0]}`;if(typeof t[e]=="string")return`${e}: ${t[e]}`}if(t.slug)return t.slug}return"Unknown error"}_statusHandler(t){const e=/20[0-6]/g;return new Promise((o,a)=>{if(e.test(`${t.status}`))return o(t);a({message:this._normalizeErrorMessage(t.data),status:t.status,response:t})})}};const J1={PUBLISHED:"published"},G1=25,Rs={SMALL:25,MEDIUM:50,LARGE:75},St={SINGLE_OR_SMALL:50,MEDIUM:15,LARGE:10,VERY_LARGE:6},jp=1e3,lo=3;function X1(t,e){const o=t.includes("/cdn/stories/"),a=t.split("/").length>3&&!t.endsWith("/cdn/stories"),n="find_by"in e;return o&&a||n}function Y1(t){return t<=Rs.SMALL?St.SINGLE_OR_SMALL:t<=Rs.MEDIUM?St.MEDIUM:t<=Rs.LARGE?St.LARGE:St.VERY_LARGE}function po(t,e,o={},a){return o.userRateLimit!==void 0?Math.min(o.userRateLimit,jp):o.serverHeadersRateLimit!==void 0?Math.min(o.serverHeadersRateLimit,jp):a!==void 0?a:!t||!e||X1(t,e)?St.SINGLE_OR_SMALL:Y1(e.per_page||G1)}function Q1(t){if(!t)return null;const e=t["x-ratelimit"]||t["X-RateLimit"],o=t["x-ratelimit-policy"]||t["X-RateLimit-Policy"];if(!e&&!o)return null;const a={};if(e){const n=e.match(/r=(\d+)/);n&&(a.remaining=Number.parseInt(n[1],10))}if(o){const n=o.match(/q=(\d+)/);n&&(a.max=Number.parseInt(n[1],10))}return Object.keys(a).length>0?a:null}function Z1(t,e=!1){return{userRateLimit:t,serverHeadersRateLimit:void 0,isManagementApi:e}}var eb=class extends Error{constructor(t){super(t),this.name="AbortError"}};function tb(t,e,o){if(!Number.isFinite(e))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(o))throw new TypeError("Expected `interval` to be a finite number");const a=[];let n=[],s=0,i=!1;const r=async()=>{s++;const p=a.shift();if(p)try{const m=await t(...p.args);p.resolve(m)}catch(m){p.reject(m)}const c=setTimeout(()=>{s--,a.length>0&&r(),n=n.filter(m=>m!==c)},o);n.includes(c)||n.push(c)},l=(...p)=>i?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((c,m)=>{a.push({resolve:c,reject:m,args:p}),s<e&&r()});return l.abort=()=>{i=!0,n.forEach(clearTimeout),n=[],a.forEach(p=>p.reject(()=>new eb("Throttle function aborted"))),a.length=0},l}var ob=class{constructor(t,e=1e3){q(this,"queues");q(this,"interval");q(this,"throttledRequestFn");this.queues=new Map,this.interval=e,this.throttledRequestFn=t}getQueue(t){let e=this.queues.get(t);return e||(e=tb(this.throttledRequestFn,t,this.interval),this.queues.set(t,e)),e}execute(t,...e){return this.getQueue(t)(...e)}abortAll(){this.queues.forEach(t=>{var e;(e=t.abort)==null||e.call(t)}),this.queues.clear()}getQueueCount(){return this.queues.size}};let La={};const tt={};var vp=class{constructor(t,e){q(this,"client");q(this,"maxRetries");q(this,"retriesDelay");q(this,"throttleManager");q(this,"accessToken");q(this,"cache");q(this,"resolveCounter");q(this,"relations");q(this,"links");q(this,"version");q(this,"rateLimitConfig");q(this,"cvMode");q(this,"richTextResolver");q(this,"resolveNestedRelations");q(this,"stringifiedStoriesCache");q(this,"inlineAssets");var n;let o=t.endpoint||e;if(!o){const s=t.https===!1?"http":"https";t.oauthToken?o=`${s}://${bp(t.region)}/v1`:o=`${s}://${bp(t.region)}/v2`}const a=new Headers;!t.oauthToken&&typeof window<"u"||a.set("Content-Type","application/json"),a.set("Accept","application/json"),t.headers&&(t.headers.constructor.name==="Headers"?t.headers.entries().toArray():Object.entries(t.headers)).forEach(([s,i])=>{a.set(s,i)}),t.oauthToken&&a.set("Authorization",t.oauthToken),this.rateLimitConfig=Z1(t.rateLimit,!!t.oauthToken),this.maxRetries=t.maxRetries||10,this.retriesDelay=300,this.throttleManager=new ob(this.throttledRequest.bind(this),1e3),this.accessToken=t.accessToken||"",this.relations={},this.links={},this.cache=t.cache||{clear:"manual"},this.cvMode=((n=t.cache)==null?void 0:n.cv)??"auto",this.resolveCounter=0,this.resolveNestedRelations=t.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.version=t.version||J1.PUBLISHED,this.inlineAssets=t.inlineAssets||!1,this.client=new V1({baseURL:o,timeout:t.timeout||0,headers:a,responseInterceptor:t.responseInterceptor,fetch:t.fetch})}parseParams(t){return t.token||(t.token=this.getToken()),!t.cv&&this.cvMode==="auto"&&(t.cv=tt[t.token]),Array.isArray(t.resolve_relations)?t.resolve_relations=t.resolve_relations.map(hp).join(","):typeof t.resolve_relations=="string"&&(t.resolve_relations=hp(t.resolve_relations)),typeof t.resolve_relations<"u"&&(t.resolve_level=2),t}factoryParamOptions(t,e){return Ms(t)?this.parseParams(e):e}makeRequest(t,e,o,a,n){const s=this.factoryParamOptions(t,P1(e,o,a));return this.cacheResponse(t,s,void 0,n)}get(t,e={},o){e||(e={});const a=`/${t}`;Ms(a)&&(e.version=e.version||this.version);const n=this.factoryParamOptions(a,e);return this.cacheResponse(a,n,void 0,o)}async getAll(t,e={},o,a){const n=(e==null?void 0:e.per_page)||25,s=`/${t}`.replace(/\/$/,""),i=o??s.substring(s.lastIndexOf("/")+1);e.version=e.version||this.version;const r=1,l=await this.makeRequest(s,e,n,r,a);return K1([l,...await U1(W1(r,l.total?Math.ceil(l.total/(l.perPage||n)):1),p=>this.makeRequest(s,e,n,p+1,a))],p=>Object.values(p.data[i]))}post(t,e={},o){const a=`/${t}`,n=po(void 0,void 0,this.rateLimitConfig,lo);return this.throttleManager.execute(n,"post",a,e,o)}put(t,e={},o){const a=`/${t}`,n=po(void 0,void 0,this.rateLimitConfig,lo);return this.throttleManager.execute(n,"put",a,e,o)}patch(t,e={},o){const a=`/${t}`,n=po(void 0,void 0,this.rateLimitConfig,lo);return this.throttleManager.execute(n,"patch",a,e,o)}delete(t,e={},o){e||(e={});const a=`/${t}`,n=po(void 0,void 0,this.rateLimitConfig,lo);return this.throttleManager.execute(n,"delete",a,e,o)}getStories(t={},e){return this._addResolveLevel(t),this.get("cdn/stories",t,e)}getStory(t,e={},o){return this._addResolveLevel(e),this.get(`cdn/stories/${t}`,e,o)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_addResolveLevel(t){typeof t.resolve_relations<"u"&&(t.resolve_level=2)}_cleanCopy(t){return JSON.parse(JSON.stringify(t))}_insertLinks(t,e,o){const a=t[e];a&&a.fieldtype==="multilink"&&a.linktype==="story"&&typeof a.id=="string"&&this.links[o][a.id]?a.story=this._cleanCopy(this.links[o][a.id]):a&&a.linktype==="story"&&typeof a.uuid=="string"&&this.links[o][a.uuid]&&(a.story=this._cleanCopy(this.links[o][a.uuid]))}getStoryReference(t,e){return this.relations[t][e]?JSON.parse(this.stringifiedStoriesCache[e]||JSON.stringify(this.relations[t][e])):e}_resolveField(t,e,o){const a=t[e];typeof a=="string"?t[e]=this.getStoryReference(o,a):Array.isArray(a)&&(t[e]=a.map(n=>this.getStoryReference(o,n)).filter(Boolean))}_insertRelations(t,e,o,a){if(Array.isArray(o)?o.find(s=>s.endsWith(`.${e}`)):o.endsWith(`.${e}`)){this._resolveField(t,e,a);return}const n=t.component?`${t.component}.${e}`:e;(Array.isArray(o)?o.includes(n):o===n)&&this._resolveField(t,e,a)}iterateTree(t,e,o){const a=(n,s="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((i,r)=>a(i,`${s}[${r}]`));else if(typeof n=="object")for(const i in n){const r=s?`${s}.${i}`:i;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,i,e,o),this._insertLinks(n,i,o)),a(n[i],r)}}};a(t.content)}async resolveLinks(t,e,o){let a=[];if(t.link_uuids){const n=t.link_uuids.length,s=[],i=50;for(let r=0;r<n;r+=i){const l=Math.min(n,r+i);s.push(t.link_uuids.slice(r,l))}for(let r=0;r<s.length;r++)(await this.getStories({per_page:i,language:e.language,version:e.version,starts_with:e.starts_with,by_uuids:s[r].join(",")})).data.stories.forEach(l=>{a.push(l)})}else a=t.links;a.forEach(n=>{this.links[o][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(t,e,o){let a=[];if(t.rel_uuids){const n=t.rel_uuids.length,s=[],i=50;for(let r=0;r<n;r+=i){const l=Math.min(n,r+i);s.push(t.rel_uuids.slice(r,l))}for(let r=0;r<s.length;r++)(await this.getStories({per_page:i,language:e.language,version:e.version,starts_with:e.starts_with,by_uuids:s[r].join(","),excluding_fields:e.excluding_fields})).data.stories.forEach(l=>{a.push(l)});a.length>0&&(t.rels=a,delete t.rel_uuids)}else a=t.rels;a&&a.length>0&&a.forEach(n=>{this.relations[o][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(t,e,o){var n,s;let a=[];if(this.links[o]={},this.relations[o]={},typeof e.resolve_relations<"u"&&e.resolve_relations.length>0&&(typeof e.resolve_relations=="string"&&(a=e.resolve_relations.split(",")),await this.resolveRelations(t,e,o)),e.resolve_links&&["1","story","url","link"].includes(e.resolve_links)&&((n=t.links)!=null&&n.length||(s=t.link_uuids)!=null&&s.length)&&await this.resolveLinks(t,e,o),this.resolveNestedRelations)for(const i in this.relations[o])this.iterateTree(this.relations[o][i],a,o);t.story?this.iterateTree(t.story,a,o):t.stories.forEach(i=>{this.iterateTree(i,a,o)}),this.stringifiedStoriesCache={},delete this.links[o],delete this.relations[o]}async cacheResponse(t,e,o,a){const n=Bs({url:t,params:e}),s=this.cacheProvider();if(e.version==="published"&&t!=="/cdn/spaces/me"){const l=await s.get(n);if(l)return Promise.resolve(l)}const i=!Ms(t)&&this.rateLimitConfig.isManagementApi?lo:void 0,r=po(t,e,this.rateLimitConfig,i);return new Promise(async(l,p)=>{var c;try{const m=await this.throttleManager.execute(r,"get",t,e,a);if(m.status!==200)return p(m);let u={data:m.data,headers:m.headers};const d=Q1(m.headers);if((d==null?void 0:d.max)!==void 0&&(this.rateLimitConfig.serverHeadersRateLimit=d.max),(c=m.headers)!=null&&c["per-page"]&&(u=Object.assign({},u,{perPage:m.headers["per-page"]?Number.parseInt(m.headers["per-page"]):0,total:m.headers["per-page"]?Number.parseInt(m.headers.total):0})),u.data.story||u.data.stories){const f=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(u.data,e,`${f}`),u=await this.processInlineAssets(u)}e.version==="published"&&t!=="/cdn/spaces/me"&&await s.set(n,u);const g=this.cache.clear==="onpreview"&&e.version==="draft"||this.cache.clear==="auto";return e.token&&u.data.cv&&(g&&tt[e.token]&&tt[e.token]!==u.data.cv&&await this.flushCache(),tt[e.token]=u.data.cv),l(u)}catch(m){if(m.response&&m.status===429&&(o=typeof o>"u"?0:o+1,o<this.maxRetries))return console.log(`Hit rate limit. Retrying in ${this.retriesDelay/1e3} seconds.`),await H1(this.retriesDelay),this.cacheResponse(t,e,o).then(l).catch(p);p(m)}})}throttledRequest(t,e,o,a){return this.client.setFetchOptions(a),this.client[t](e,o)}cacheVersions(){return tt}cacheVersion(){return tt[this.accessToken]}setCacheVersion(t){this.accessToken&&(tt[this.accessToken]=t)}clearCacheVersion(){this.accessToken&&(tt[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(t){return Promise.resolve(La[t])},getAll(){return Promise.resolve(La)},set(t,e){return La[t]=e,Promise.resolve(void 0)},flush(){return La={},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(t){if(!this.inlineAssets)return t;const e=o=>{if(!o||typeof o!="object")return o;if(Array.isArray(o))return o.map(n=>e(n));let a={...o};a.fieldtype==="asset"&&Array.isArray(t.data.assets)&&(a={...t.data.assets.find(n=>n.id===a.id),...a});for(const n in a)typeof a[n]=="object"&&(a[n]=e(a[n]));return a};return t.data.story&&(t.data.story.content=e(t.data.story.content)),t.data.stories&&(t.data.stories=t.data.stories.map(o=>(o.content=e(o.content),o))),t}};let kp=!1;const yp=[],ab=t=>new Promise((e,o)=>{if(typeof window>"u"){o(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}kp?n():yp.push(n)},document.getElementById("storyblok-javascript-bridge")){e(void 0);return}const a=document.createElement("script");a.async=!0,a.src=t,a.id="storyblok-javascript-bridge",a.onerror=n=>o(n),a.onload=n=>{yp.forEach(s=>s()),kp=!0,e(n)},document.getElementsByTagName("head")[0].appendChild(a)}),nb=(t={})=>{const{apiOptions:e}=t;if(!e||!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new vp(e)}},sb=t=>{if(typeof t!="object"||typeof t._editable>"u")return{};try{const e=JSON.parse(t._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":`${e.id}-${e.uid}`}:{}}catch{return{}}};let Fp="https://app.storyblok.com/f/storyblok-v2-latest.js";const _p=(t,e,o={})=>{var a;const n=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",s=new URL((a=window.location)==null?void 0:a.href).searchParams.get("_storyblok"),i=s!==null&&+s===t;if(!(!n||!i)){if(!t){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(o).on(["input","published","change"],r=>{var l;r&&(r.action==="input"&&((l=r.story)==null?void 0:l.id)===t?e(r.story):(r.action==="change"||r.action==="published")&&r.storyId===t&&window.location.reload())})})}},ib=(t={})=>{var e,o;const{bridge:a,accessToken:n,use:s=[],apiOptions:i={},bridgeUrl:r}=t;i.accessToken=i.accessToken||n;const l={bridge:a,apiOptions:i};let p={};s.forEach(m=>{p={...p,...m(l)}}),r&&(Fp=r);const c=!(typeof window>"u")&&((o=(e=window.location)==null?void 0:e.search)==null?void 0:o.includes("_storyblok_tk"));return a!==!1&&c&&ab(Fp),p};function rb(t,e){return Ts(e).render(t)}const Ls=S.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(t,{expose:e}){var r;const o=t,a=S.ref();e({value:a});const n=typeof S.resolveDynamicComponent(o.blok.component)!="string",s=S.inject("VueSDKOptions"),i=S.ref((r=o.blok.component)==null?void 0:r.replace(/_/g,"-"));return!n&&s&&(s.enableFallbackComponent?(i.value=s.customFallbackComponent??"FallbackComponent",typeof S.resolveDynamicComponent(i.value)=="string"&&console.error(`Is the Fallback component "${i.value}" registered properly?`)):console.error(`Component could not be found for blok "${o.blok.component}"! Is it defined in main.ts as "app.component("${o.blok.component}", ${o.blok.component});"?`)),(l,p)=>(S.openBlock(),S.createBlock(S.resolveDynamicComponent(i.value),S.mergeProps({ref_key:"blokRef",ref:a},{...l.$props,...l.$attrs}),S.createSlots({_:2},[S.renderList(l.$slots,(c,m)=>({name:m,fn:S.withCtx(u=>[S.renderSlot(l.$slots,m,S.normalizeProps(S.guardReactiveProps(u)))])}))]),1040))}});function Dp(t){const{tiptapExtensions:e,...o}=t,a={renderFn:S.h,textFn:S.createTextVNode,keyedResolvers:!0,...o,tiptapExtensions:{blok:As.configure({renderComponent:(n,s)=>S.h(Ls,{blok:n,id:s})}),...e}};return Ts(a)}const wp=S.defineComponent({__name:"StoryblokRichText",props:{doc:{},tiptapExtensions:{}},setup(t){const e=t,o=S.ref(),a=()=>o.value;return S.watch([()=>e.doc,()=>e.tiptapExtensions],([n,s])=>{const{render:i}=Dp({tiptapExtensions:s});o.value=i(n)},{immediate:!0,deep:!0}),(n,s)=>(S.openBlock(),S.createBlock(a))}}),lb={beforeMount(t,e){if(e.value){const o=sb(e.value);Object.keys(o).length>0&&(t.setAttribute("data-blok-c",o["data-blok-c"]),t.setAttribute("data-blok-uid",o["data-blok-uid"]),t.classList.add("storyblok__outline"))}}},Ip=t=>{console.error(`You can't use ${t} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
79
+ 3. "-" cannot repeat`);U.customSchemes.push([t,e])}function Rh(){U.scanner=Ch(U.customSchemes);for(let t=0;t<U.tokenQueue.length;t++)U.tokenQueue[t][1]({scanner:U.scanner});U.parser=Ah(U.scanner.tokens);for(let t=0;t<U.pluginQueue.length;t++)U.pluginQueue[t][1]({scanner:U.scanner,parser:U.parser});return U.initialized=!0,U}function Is(t){return U.initialized||Rh(),Sh(U.parser.start,t,Ql(U.scanner.start,t))}Is.scan=Ql;function sp(t,e=null,o=null){if(e&&typeof e=="object"){if(o)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);o=e,e=null}const a=new Ds(o),n=Is(t),s=[];for(let i=0;i<n.length;i++){const r=n[i];r.isLink&&(!e||r.t===e)&&a.check(r)&&s.push(r.toFormattedObject(a))}return s}var Cs="[\0-   ᠎ -\u2029  ]",Lh=new RegExp(Cs),Nh=new RegExp(`${Cs}$`),zh=new RegExp(Cs,"g");function Oh(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function $h(t){return new ie({key:new te("autolink"),appendTransaction:(e,o,a)=>{const n=e.some(p=>p.docChanged)&&!o.doc.eq(a.doc),s=e.some(p=>p.getMeta("preventAutolink"));if(!n||s)return;const{tr:i}=a,r=En(o.doc,[...e]);if(An(r).forEach(({newRange:p})=>{const c=Wr(a.doc,p,d=>d.isTextblock);let m,u;if(c.length>1)m=c[0],u=a.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(c.length){const d=a.doc.textBetween(p.from,p.to," "," ");if(!Nh.test(d))return;m=c[0],u=a.doc.textBetween(m.pos,p.to,void 0," ")}if(m&&u){const d=u.split(Lh).filter(Boolean);if(d.length<=0)return!1;const g=d[d.length-1],f=m.pos+u.lastIndexOf(g);if(!g)return!1;const h=Is(g).map(b=>b.toObject(t.defaultProtocol));if(!Oh(h))return!1;h.filter(b=>b.isLink).map(b=>({...b,from:f+b.start+1,to:f+b.end+1})).filter(b=>a.schema.marks.code?!a.doc.rangeHasMark(b.from,b.to,a.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{Sn(b.from,b.to,a.doc).some(k=>k.mark.type===t.type)||i.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!i.steps.length)return i}})}function Ph(t){return new ie({key:new te("handleClickLink"),props:{handleClick:(e,o,a)=>{var n,s;if(a.button!==0||!e.editable)return!1;let i=null;if(a.target instanceof HTMLAnchorElement)i=a.target;else{const l=a.target;if(!l)return!1;const p=t.editor.view.dom;i=l.closest("a"),i&&!p.contains(i)&&(i=null)}if(!i)return!1;let r=!1;if(t.enableClickSelection&&(r=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=qu(e.state,t.type.name),p=(n=i.href)!=null?n:l.href,c=(s=i.target)!=null?s:l.target;p&&(window.open(p,c),r=!0)}return r}}})}function Hh(t){return new ie({key:new te("handlePasteLink"),props:{handlePaste:(e,o,a)=>{const{shouldAutoLink:n}=t,{state:s}=e,{selection:i}=s,{empty:r}=i;if(r)return!1;let l="";a.content.forEach(c=>{l+=c.textContent});const p=sp(l,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!p||n!==void 0&&!n(p.value)?!1:t.editor.commands.setMark(t.type,{href:p.href})}}})}function jt(t,e){const o=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(a=>{const n=typeof a=="string"?a:a.scheme;n&&o.push(n)}),!t||t.replace(zh,"").match(new RegExp(`^(?:(?:${o.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var qh=ue.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){np(t);return}np(t.scheme,t.optionalSlashes)})},onDestroy(){Bh()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!jt(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),o=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||o&&!t.includes("@"))return!0;const n=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(n)||!/\./.test(n))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:o=>!!jt(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!jt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",$(this.options.HTMLAttributes,t),0]:["a",$(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var o,a,n,s;const i=(a=(o=t.attrs)==null?void 0:o.href)!=null?a:"",r=(s=(n=t.attrs)==null?void 0:n.title)!=null?s:"",l=e.renderChildren(t);return r?`[${l}](${i} "${r}")`:`[${l}](${i})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:o}=t;return this.options.isAllowedUri(o,{defaultValidate:a=>!!jt(a,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:o}=t||{};return o&&!this.options.isAllowedUri(o,{defaultValidate:a=>!!jt(a,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Xe({find:t=>{const e=[];if(t){const{protocols:o,defaultProtocol:a}=this.options,n=sp(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:i=>!!jt(i,o),protocols:o,defaultProtocol:a}));n.length&&n.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:o}=this.options;return this.options.autolink&&t.push($h({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:a=>this.options.isAllowedUri(a,{defaultValidate:n=>!!jt(n,e),protocols:e,defaultProtocol:o}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Ph({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Hh({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Wh=qh,Uh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Kh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Vh=ue.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",$(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[gt({find:Uh,type:this.type})]},addPasteRules(){return[Xe({find:Kh,type:this.type})]}}),Jh=Vh,Gh=ue.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",$(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),Xh=Gh,Yh=ue.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",$(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),Qh=Yh,Zh=20,ip=(t,e=0)=>{const o=[];return!t.children.length||e>Zh||Array.from(t.children).forEach(a=>{a.tagName==="SPAN"?o.push(a):a.children.length&&o.push(...ip(a,e+1))}),o},e1=t=>{if(!t.children.length)return;const e=ip(t);e&&e.forEach(o=>{var a,n;const s=o.getAttribute("style"),i=(n=(a=o.parentElement)==null?void 0:a.closest("span"))==null?void 0:n.getAttribute("style");o.setAttribute("style",`${i};${s}`)})},t1=ue.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&e1(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",$(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(o,a)=>{if(o.isTextblock)return!0;o.marks.filter(n=>n.type===this.type).some(n=>Object.values(n.attrs).some(s=>!!s))||t.removeMark(a,a+o.nodeSize,this.type)}),!0}}}}),o1=ee.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const o=t.getAttribute("style");if(o){const a=o.split(";").map(n=>n.trim()).filter(Boolean);for(let n=a.length-1;n>=0;n-=1){const s=a[n].split(":");if(s.length>=2){const i=s[0].trim().toLowerCase(),r=s.slice(1).join(":").trim();if(i==="background-color")return r.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),a1=ee.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const o=t.getAttribute("style");if(o){const a=o.split(";").map(n=>n.trim()).filter(Boolean);for(let n=a.length-1;n>=0;n-=1){const s=a[n].split(":");if(s.length>=2){const i=s[0].trim().toLowerCase(),r=s.slice(1).join(":").trim();if(i==="color")return r.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),n1=ee.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),s1=ee.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),i1=ee.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ee.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(o1.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(a1.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(n1.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(s1.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(i1.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(t1.configure(this.options.textStyle)),t}});var r1=ue.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",$(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,o){const n=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!n)return;const s=n[2].trim();return{type:"underline",raw:n[0],text:s,tokens:o.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),l1=r1;function p1(t,e){if(!e)return{src:t,attrs:{}};let o=0,a=0;const n={},s=[];function i(l,p,c,m,u){typeof l!="number"||l<=p||l>=c?console.warn(`[StoryblokRichText] - ${m.charAt(0).toUpperCase()+m.slice(1)} value must be a number between ${p} and ${c} (inclusive)`):u.push(`${m}(${l})`)}if(typeof e=="object"){if(e.width!==void 0&&(typeof e.width=="number"&&e.width>=0?(n.width=e.width,o=e.width):console.warn("[StoryblokRichText] - Width value must be a number greater than or equal to 0")),e.height!==void 0&&(typeof e.height=="number"&&e.height>=0?(n.height=e.height,a=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than or equal to 0")),e.height===0&&e.width===0&&(delete n.width,delete n.height,console.warn("[StoryblokRichText] - Width and height values cannot both be 0")),e.loading&&["lazy","eager"].includes(e.loading)&&(n.loading=e.loading),e.class&&(n.class=e.class),e.filters){const{filters:l}=e||{},{blur:p,brightness:c,fill:m,format:u,grayscale:d,quality:g,rotate:f}=l||{};p&&i(p,0,100,"blur",s),g&&i(g,0,100,"quality",s),c&&i(c,0,100,"brightness",s),m&&s.push(`fill(${m})`),d&&s.push("grayscale()"),f&&[0,90,180,270].includes(e.filters.rotate||0)&&s.push(`rotate(${f})`),u&&["webp","png","jpeg"].includes(u)&&s.push(`format(${u})`)}e.srcset&&(n.srcset=e.srcset.map(l=>{if(typeof l=="number")return`${t}/m/${l}x0/${s.length>0?`filters:${s.join(":")}`:""} ${l}w`;if(Array.isArray(l)&&l.length===2){const[p,c]=l;return`${t}/m/${p}x${c}/${s.length>0?`filters:${s.join(":")}`:""} ${p}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),e.sizes&&(n.sizes=e.sizes.join(", "))}let r=`${t}/m/`;return(o>0||a>0)&&(r=`${r}${o}x${a}/`),s.length>0&&(r=`${r}filters:${s.join(":")}`),{src:r,attrs:n}}function Es(t,e){if(t===e)return!0;if(t==null||e===null||e===void 0)return t===e;if(typeof t!=typeof e||typeof t!="object"||Array.isArray(t)!==Array.isArray(e))return!1;if(Array.isArray(t))return t.length!==e.length?!1:t.every((n,s)=>Es(n,e[s]));const o=Object.keys(t),a=Object.keys(e);return o.length!==a.length?!1:o.every(n=>Object.prototype.hasOwnProperty.call(e,n)&&Es(t[n],e[n]))}function rp(t,e){return t.type===e.type&&Es(t.attrs,e.attrs)}function lp(t){var e;return t.type==="text"&&!!((e=t.marks)!=null&&e.length)}function c1(t,e){const o=t.filter(a=>!e.some(n=>rp(n,a)));return o.length?o:void 0}function m1(t,e){const o=t[e];if(!lp(o))return null;const a=[o];let n=o.marks,s=e+1;for(;s<t.length;){const i=t[s];if(!lp(i))break;const r=n.filter(l=>i.marks.some(p=>rp(l,p)));if(r.length===0)break;n=r,a.push(i),s++}return{group:a,shared:n,endIndex:s}}const u1=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],d1=(t={})=>{const{custom:e,...o}=t,a={...o,...e};return Object.keys(a).filter(n=>a[n]!=null).map(n=>`${n}="${String(a[n]).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}"`).join(" ")},pp=(t={})=>Object.keys(t).map(e=>`${e}: ${t[e]}`).join("; ");function g1(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const vt=t=>Object.fromEntries(Object.entries(t).filter(([e,o])=>o!=null));let f1=(function(t){return t.DOCUMENT="doc",t.HEADING="heading",t.PARAGRAPH="paragraph",t.QUOTE="blockquote",t.OL_LIST="ordered_list",t.UL_LIST="bullet_list",t.LIST_ITEM="list_item",t.CODE_BLOCK="code_block",t.HR="horizontal_rule",t.BR="hard_break",t.IMAGE="image",t.EMOJI="emoji",t.COMPONENT="blok",t.TABLE="table",t.TABLE_ROW="tableRow",t.TABLE_CELL="tableCell",t.TABLE_HEADER="tableHeader",t})({}),h1=(function(t){return t.BOLD="bold",t.STRONG="strong",t.STRIKE="strike",t.UNDERLINE="underline",t.ITALIC="italic",t.CODE="code",t.LINK="link",t.ANCHOR="anchor",t.STYLED="styled",t.SUPERSCRIPT="superscript",t.SUBSCRIPT="subscript",t.TEXT_STYLE="textStyle",t.HIGHLIGHT="highlight",t})({}),b1=(function(t){return t.TEXT="text",t})({}),io=(function(t){return t.URL="url",t.STORY="story",t.ASSET="asset",t.EMAIL="email",t})({});function Ne(t={}){const{textAlign:e,class:o,id:a,style:n,...s}=t,i=[];return n&&i.push(n.endsWith(";")?n:`${n};`),e&&i.push(`text-align: ${e};`),vt({...s,class:o,id:a,...i.length>0?{style:i.join(" ")}:{}})}function j1(t={}){const{linktype:e,href:o,anchor:a,uuid:n,custom:s,...i}=t;let r=o??"";switch(e){case io.ASSET:case io.URL:break;case io.EMAIL:r&&!r.startsWith("mailto:")&&(r=`mailto:${r}`);break;case io.STORY:a&&(r=`${r}#${a}`);break}return{href:r,rest:{...i,...s||{}}}}function cp(t={}){const{colspan:e,rowspan:o,colwidth:a,backgroundColor:n,textAlign:s,...i}=t,r=[];return a&&r.push(`width: ${a}px;`),n&&r.push(`background-color: ${n};`),s&&r.push(`text-align: ${s};`),vt({...i,...e>1?{colspan:e}:{},...o>1?{rowspan:o}:{},...r.length>0?{style:r.join(" ")}:{}})}const xs={a:["href","target","data-uuid","data-anchor","data-linktype"],img:["alt","src","title"],span:["class"]};function mp(t,{allowedStyles:e}){const o=(t.getAttribute("class")||"").split(" ").filter(Boolean);if(!o.length)return[];const a=o.filter(n=>!e.includes(n));for(const n of a)console.warn(`[StoryblokRichText] - \`class\` "${n}" on \`<${t.tagName.toLowerCase()}>\` can not be transformed to rich text.`);return e.filter(n=>o.includes(n))}const v1=Qf.configure({types:["heading","paragraph"]}),k1=ff.extend({renderHTML({HTMLAttributes:t}){return["blockquote",Ne(t),0]}}),y1=Jf.extend({renderHTML({HTMLAttributes:t}){return["p",Ne(t),0]}}),F1=Pf.extend({renderHTML({node:t,HTMLAttributes:e}){const{level:o,...a}=e;return[`h${t.attrs.level}`,Ne(a),0]}}),_1=Ol.extend({renderHTML({HTMLAttributes:t}){return["tr",Ne(t),0]}}),D1=ol.extend({name:"bullet_list",addOptions(){return{...this.parent(),itemTypeName:"list_item"}},renderHTML({HTMLAttributes:t}){return["ul",Ne(t),0]}}),w1=dl.extend({name:"ordered_list",addAttributes(){return{order:{default:1}}},addOptions(){return{...this.parent(),itemTypeName:"list_item"}},renderHTML({HTMLAttributes:t}){return["ol",Ne(t),0]}}),I1=al.extend({name:"list_item",addOptions(){return{...this.parent(),bulletListTypeName:"bullet_list",orderedListTypeName:"ordered_list"}},renderHTML({HTMLAttributes:t}){return["li",Ne(t),0]}}),C1=vf.extend({name:"code_block",addAttributes(){return{class:{default:null}}},renderHTML({node:t,HTMLAttributes:e}){const{language:o,...a}=e,n=Ne(a),s=t.attrs.language;return["pre",n,["code",s?{class:`language-${s}`}:{},0]]}}),E1=Of.extend({name:"hard_break"}),x1=qf.extend({name:"horizontal_rule"}),A1=Hl.extend({renderHTML({HTMLAttributes:t}){return["table",Ne(t),0]}}),S1=Nl.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const o=e.getAttribute("colwidth");return o?o.split(",").map(Number):null}},backgroundColor:{default:null}}},renderHTML({HTMLAttributes:t}){return["td",cp(t),0]}}),T1=zl.extend({renderHTML({HTMLAttributes:t}){return["th",cp(t),0]}}),up=Kf.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),optimizeImages:!1}},renderHTML({HTMLAttributes:t}){const{src:e,alt:o,title:a,srcset:n,sizes:s}=t;let i=e,r={};if(this.options.optimizeImages){const l=p1(e,this.options.optimizeImages);i=l.src,r=l.attrs}return["img",vt({src:i,alt:o,title:a,srcset:n,sizes:s,...r})]}}),M1=Nf.extend({renderHTML({HTMLAttributes:t}){return["img",{"data-emoji":t.emoji,"data-name":t.name,src:t.fallbackImage,alt:t.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"}]}}),As=V.create({name:"blok",group:"block",atom:!0,addOptions(){return{renderComponent:null}},addAttributes(){return{id:{default:null},body:{default:[]}}},parseHTML(){return[{tag:"div[data-blok]"}]},renderHTML({HTMLAttributes:t}){var e;return console.warn("[StoryblokRichText] - BLOK resolver is not available for vanilla usage. Configure `renderComponent` option on the blok tiptapExtension."),["span",vt({"data-blok":JSON.stringify(((e=t==null?void 0:t.body)==null?void 0:e[0])??null),"data-blok-id":t==null?void 0:t.id,style:"display: none"})]}}),B1=uh.extend({addAttributes(){return{color:{default:null}}}}),Ss=Wh.extend({addAttributes(){return{href:{parseHTML:t=>t.getAttribute("href")},uuid:{default:null,parseHTML:t=>t.getAttribute("data-uuid")||null},anchor:{default:null,parseHTML:t=>t.getAttribute("data-anchor")||null},target:{parseHTML:t=>t.getAttribute("target")||null},linktype:{default:"url",parseHTML:t=>t.getAttribute("data-linktype")||"url"}}},renderHTML({HTMLAttributes:t}){const{href:e,rest:o}=j1(t);return["a",vt({...e?{href:e}:{},...o}),0]}}),R1=Ss.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),custom:{default:null,parseHTML:e=>{const o=xs.a,a=e.getAttributeNames().filter(s=>!o.includes(s)),n={};for(const s of a)n[s]=e.getAttribute(s);return Object.keys(n).length?n:null}}}}}),L1=ue.create({name:"anchor",addAttributes(){return{id:{default:null}}},parseHTML(){return[{tag:"span[id]"}]},renderHTML({HTMLAttributes:t}){return["span",{id:t.id},0]}}),dp=ue.create({name:"styled",addAttributes(){return{class:{parseHTML:t=>{const e=mp(t,{allowedStyles:this.options.allowedStyles||[]});return e.length?e.join(" "):null}}}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>mp(t,{allowedStyles:this.options.allowedStyles||[]}).length?null:!1}]},renderHTML({HTMLAttributes:t}){const{class:e,...o}=t;return["span",vt({class:e,style:pp(o)||void 0}),0]}}),N1=ue.create({name:"textStyle",addAttributes(){return{class:{default:null},id:{default:null},color:{default:null}}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>{const e=t.getAttribute("style");return e&&/color/i.test(e)?null:!1}}]},renderHTML({HTMLAttributes:t}){const{class:e,id:o,...a}=t;return["span",vt({class:e,id:o,style:pp(a)||void 0}),0]}}),gp=ue.create({name:"reporter",priority:0,addOptions(){return{allowCustomAttributes:!1}},parseHTML(){return[{tag:"*",consuming:!1,getAttrs:t=>{const e=t.tagName.toLowerCase();if(e==="a"&&this.options.allowCustomAttributes)return!1;const o=t.getAttributeNames().filter(a=>!(e in xs?xs[e]:[]).includes(a));for(const a of o)console.warn(`[StoryblokRichText] - \`${a}\` "${t.getAttribute(a)}" on \`<${e}>\` can not be transformed to rich text.`);return!1}}]}}),z1={document:yf,text:Xf,paragraph:y1,blockquote:k1,heading:F1,bulletList:D1,orderedList:w1,listItem:I1,codeBlock:C1,hardBreak:E1,horizontalRule:x1,image:up,emoji:M1,table:A1,tableRow:_1,tableCell:S1,tableHeader:T1,blok:As,details:tg,detailsContent:og,detailsSummary:ag,bold:nh,italic:jh,strike:Jh,underline:l1,code:lh,superscript:Qh,subscript:Xh,highlight:B1,textStyle:N1,link:Ss,anchor:L1,styled:dp,reporter:gp,textAlign:v1};function O1(t={}){var o;const e=t.allowCustomAttributes?R1:Ss;return{...z1,image:up.configure({optimizeImages:t.optimizeImages||!1}),link:e,styled:dp.configure({allowedStyles:(o=t.styleOptions)==null?void 0:o.map(a=>a.value)}),reporter:gp.configure({allowCustomAttributes:t.allowCustomAttributes})}}function fp(t,e={},o){const a=d1(e),n=a?`${t} ${a}`:t,s=Array.isArray(o)?o.join(""):o||"";if(t){if(u1.includes(t))return`<${n}>`}else return s;return`<${n}>${s}</${t}>`}function ro(t,e,o){const[a,...n]=t;let s={},i=n;if(i.length>0&&i[0]!==null&&i[0]!==void 0&&typeof i[0]=="object"&&!Array.isArray(i[0])&&typeof i[0]!="number"&&(s=i[0],i=i.slice(1)),i=i.filter(l=>l!=null),i.length===0)return e(a,s);if(i.length===1&&i[0]===0)return e(a,s,o);const r=i.map(l=>l===0?o:Array.isArray(l)?ro(l,e,o):l);return e(a,s,r.length===1?r[0]:r)}function Ra(t,e,o){const a={options:t.options||{},name:t.name,type:t.type};return e==="node"?t.config.renderHTML.call(a,{node:{attrs:o},HTMLAttributes:o}):t.config.renderHTML.call(a,{mark:{attrs:o},HTMLAttributes:o})}function Ts(t={}){const e=new Map,{renderFn:o=fp,textFn:a=g1,optimizeImages:n=!1,keyedResolvers:s=!1,tiptapExtensions:i}=t,r=o!==fp,l=O1({optimizeImages:n}),p=i?{...l,...i}:l,c=Object.values(p),m=new Map,u=new Map;for(const j of c)j.type==="node"?m.set(j.name,j):j.type==="mark"&&u.set(j.name,j);const d=(j,F={},_)=>{if(s&&j){const w=e.get(j)||0;e.set(j,w+1),F={...F,key:`${j}-${w}`}}return r&&typeof j!="string"&&_!==void 0?o(j,F,(()=>_)):o(j,F,_)};function g(j,F){var T;const _=j.map(N=>b({...N,marks:c1(N.marks||[],F)}));let w=r?_:_.join("");for(const N of F){const P=u.get(N.type);(T=P==null?void 0:P.config)!=null&&T.renderHTML&&(w=ro(Ra(P,"mark",N.attrs||{}),d,w))}return w}function f(j){const F=[];let _=0;for(;_<j.length;){const w=m1(j,_);if(!w){F.push(k(j[_])),_++;continue}w.group.length===1?F.push(b(w.group[0])):F.push(g(w.group,w.shared)),_=w.endIndex}return F}function h(j){var w,T,N,P,I,M;if(j.type==="text")return b(j);if(j.type==="doc")return k(j);const F=m.get(j.type);if(!((w=F==null?void 0:F.config)!=null&&w.renderHTML))return console.error("<Storyblok>",`No extension found for node type ${j.type}`),"";if((T=F.options)!=null&&T.renderComponent){const O=(N=j.attrs)==null?void 0:N.body,L=(P=j.attrs)==null?void 0:P.id;if(!Array.isArray(O)||O.length===0)return r?[]:"";const x=O.map(B=>F.options.renderComponent(B,L));return r?x:x.filter(B=>B!=null).join("")}if(j.type==="table"&&((I=j.content)!=null&&I.length)){const O=[],L=[];for(const Y of j.content)L.length===0&&((M=Y.content)!=null&&M.every(ce=>ce.type==="tableHeader"))?O.push(Y):L.push(Y);const x=Ra(F,"node",j.attrs||{}),B=[];return O.length>0&&B.push(d("thead",{},O.map(k))),L.length>0&&B.push(d("tbody",{},L.map(k))),ro(x,d,B)}const _=j.content?f(j.content):void 0;return ro(Ra(F,"node",j.attrs||{}),d,_)}function b(j){const{marks:F,..._}=j;if(F!=null&&F.length){const T=(()=>{const N={};if(s){const P=e.get("txt")||0;e.set("txt",P+1),N.key=`txt-${P}`}return a(_.text,N)})();return F.reduce((N,P)=>{var M;const I=u.get(P.type);return(M=I==null?void 0:I.config)!=null&&M.renderHTML?ro(Ra(I,"mark",P.attrs||{}),d,N):(console.error("<Storyblok>",`No extension found for node type ${P.type}`),N)},T)}const w=j.attrs||{};if(s){const T=e.get("txt")||0;e.set("txt",T+1),w.key=`txt-${T}`}return a(_.text,w)}function k(j){const F=j;return F.type==="doc"?r?F.content.map(h):F.content.map(h).join(""):Array.isArray(F)?F.map(h):h(F)}return{render:k}}function $1(t){return t}const Ms=(t="")=>t.includes("/cdn/"),P1=(t,e=25,o=1)=>({...t,per_page:e,page:o}),H1=t=>new Promise(e=>setTimeout(e,t)),q1=(t=0,e)=>Array.from({length:t},e),W1=(t=0,e=t)=>{const o=Math.abs(e-t)||0,a=t<e?1:-1;return q1(o,(n,s)=>s*a+t)},U1=async(t,e)=>Promise.all(t.map(e)),K1=(t=[],e)=>t.map(e).reduce((o,a)=>[...o,...a],[]),hp=t=>{if(/%[0-9A-F]{2}/i.test(t))try{return decodeURIComponent(t)}catch{return t}return t},Bs=(t,e,o)=>{const a=[];for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const s=t[n];if(s==null)continue;const i=o?"":encodeURIComponent(n);let r;typeof s=="object"?r=Bs(s,e?e+encodeURIComponent(`[${i}]`):i,Array.isArray(s)):r=`${e?e+encodeURIComponent(`[${i}]`):i}=${encodeURIComponent(s)}`,a.push(r)}return a.join("&")},bp=t=>{const e={eu:"api.storyblok.com",us:"api-us.storyblok.com",cn:"app.storyblokchina.cn",ap:"api-ap.storyblok.com",ca:"api-ca.storyblok.com"};return e[t]??e.eu};var V1=class{constructor(t){q(this,"baseURL");q(this,"timeout");q(this,"headers");q(this,"responseInterceptor");q(this,"fetch");q(this,"ejectInterceptor");q(this,"url");q(this,"parameters");q(this,"fetchOptions");this.baseURL=t.baseURL,this.headers=t.headers||new Headers,this.timeout=t!=null&&t.timeout?t.timeout*1e3:0,this.responseInterceptor=t.responseInterceptor,this.fetch=(...e)=>t.fetch?t.fetch(...e):fetch(...e),this.ejectInterceptor=!1,this.url="",this.parameters={},this.fetchOptions={}}get(t,e){return this.url=t,this.parameters=e,this._methodHandler("get")}post(t,e){return this.url=t,this.parameters=e,this._methodHandler("post")}put(t,e){return this.url=t,this.parameters=e,this._methodHandler("put")}patch(t,e){return this.url=t,this.parameters=e,this._methodHandler("patch")}delete(t,e){return this.url=t,this.parameters=e??{},this._methodHandler("delete")}async _responseHandler(t){const e=[],o={data:{},headers:{},status:0,statusText:""};t.status!==204&&await t.json().then(a=>{o.data=a});for(const a of t.headers.entries())e[a[0]]=a[1];return o.headers={...e},o.status=t.status,o.statusText=t.statusText,o}async _methodHandler(t){let e=`${this.baseURL}${this.url}`,o=null;t==="get"?e=`${this.baseURL}${this.url}?${Bs(this.parameters)}`:o=JSON.stringify(this.parameters);const a=new URL(e),n=new AbortController,{signal:s}=n;let i=null;this.timeout&&(i=setTimeout(()=>n.abort(),this.timeout));try{const r=await this.fetch(`${a}`,{method:t,headers:this.headers,body:o,signal:s,...this.fetchOptions});this.timeout&&i&&clearTimeout(i);const l=await this._responseHandler(r);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(l)):this._statusHandler(l)}catch(r){return r.name==="AbortError"?{message:"Request timeout: The request was aborted due to timeout"}:{message:r.message||r.toString()||"An unknown error occurred"}}}setFetchOptions(t={}){Object.keys(t).length>0&&"method"in t&&delete t.method,this.fetchOptions={...t}}eject(){this.ejectInterceptor=!0}_normalizeErrorMessage(t){if(Array.isArray(t))return t[0]||"Unknown error";if(t&&typeof t=="object"){if(t.error)return t.error;for(const e in t){if(Array.isArray(t[e]))return`${e}: ${t[e][0]}`;if(typeof t[e]=="string")return`${e}: ${t[e]}`}if(t.slug)return t.slug}return"Unknown error"}_statusHandler(t){const e=/20[0-6]/g;return new Promise((o,a)=>{if(e.test(`${t.status}`))return o(t);a({message:this._normalizeErrorMessage(t.data),status:t.status,response:t})})}};const J1={PUBLISHED:"published"},G1=25,Rs={SMALL:25,MEDIUM:50,LARGE:75},St={SINGLE_OR_SMALL:50,MEDIUM:15,LARGE:10,VERY_LARGE:6},jp=1e3,lo=3;function X1(t,e){const o=t.includes("/cdn/stories/"),a=t.split("/").length>3&&!t.endsWith("/cdn/stories"),n="find_by"in e;return o&&a||n}function Y1(t){return t<=Rs.SMALL?St.SINGLE_OR_SMALL:t<=Rs.MEDIUM?St.MEDIUM:t<=Rs.LARGE?St.LARGE:St.VERY_LARGE}function po(t,e,o={},a){return o.userRateLimit!==void 0?Math.min(o.userRateLimit,jp):o.serverHeadersRateLimit!==void 0?Math.min(o.serverHeadersRateLimit,jp):a!==void 0?a:!t||!e||X1(t,e)?St.SINGLE_OR_SMALL:Y1(e.per_page||G1)}function Q1(t){if(!t)return null;const e=t["x-ratelimit"]||t["X-RateLimit"],o=t["x-ratelimit-policy"]||t["X-RateLimit-Policy"];if(!e&&!o)return null;const a={};if(e){const n=e.match(/r=(\d+)/);n&&(a.remaining=Number.parseInt(n[1],10))}if(o){const n=o.match(/q=(\d+)/);n&&(a.max=Number.parseInt(n[1],10))}return Object.keys(a).length>0?a:null}function Z1(t,e=!1){return{userRateLimit:t,serverHeadersRateLimit:void 0,isManagementApi:e}}var eb=class extends Error{constructor(t){super(t),this.name="AbortError"}};function tb(t,e,o){if(!Number.isFinite(e))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(o))throw new TypeError("Expected `interval` to be a finite number");const a=[];let n=[],s=0,i=!1;const r=async()=>{s++;const p=a.shift();if(p)try{const m=await t(...p.args);p.resolve(m)}catch(m){p.reject(m)}const c=setTimeout(()=>{s--,a.length>0&&r(),n=n.filter(m=>m!==c)},o);n.includes(c)||n.push(c)},l=(...p)=>i?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((c,m)=>{a.push({resolve:c,reject:m,args:p}),s<e&&r()});return l.abort=()=>{i=!0,n.forEach(clearTimeout),n=[],a.forEach(p=>p.reject(()=>new eb("Throttle function aborted"))),a.length=0},l}var ob=class{constructor(t,e=1e3){q(this,"queues");q(this,"interval");q(this,"throttledRequestFn");this.queues=new Map,this.interval=e,this.throttledRequestFn=t}getQueue(t){let e=this.queues.get(t);return e||(e=tb(this.throttledRequestFn,t,this.interval),this.queues.set(t,e)),e}execute(t,...e){return this.getQueue(t)(...e)}abortAll(){this.queues.forEach(t=>{var e;(e=t.abort)==null||e.call(t)}),this.queues.clear()}getQueueCount(){return this.queues.size}};let La={};const tt={};var vp=class{constructor(t,e){q(this,"client");q(this,"maxRetries");q(this,"retriesDelay");q(this,"throttleManager");q(this,"accessToken");q(this,"cache");q(this,"resolveCounter");q(this,"relations");q(this,"links");q(this,"version");q(this,"rateLimitConfig");q(this,"cvMode");q(this,"richTextResolver");q(this,"resolveNestedRelations");q(this,"stringifiedStoriesCache");q(this,"inlineAssets");var n;let o=t.endpoint||e;if(!o){const s=t.https===!1?"http":"https";t.oauthToken?o=`${s}://${bp(t.region)}/v1`:o=`${s}://${bp(t.region)}/v2`}const a=new Headers;!t.oauthToken&&typeof window<"u"||a.set("Content-Type","application/json"),a.set("Accept","application/json"),t.headers&&(t.headers.constructor.name==="Headers"?t.headers.entries().toArray():Object.entries(t.headers)).forEach(([s,i])=>{a.set(s,i)}),t.oauthToken&&a.set("Authorization",t.oauthToken),this.rateLimitConfig=Z1(t.rateLimit,!!t.oauthToken),this.maxRetries=t.maxRetries||10,this.retriesDelay=t.retriesDelay??300,this.throttleManager=new ob(this.throttledRequest.bind(this),1e3),this.accessToken=t.accessToken||"",this.relations={},this.links={},this.cache=t.cache||{clear:"manual"},this.cvMode=((n=t.cache)==null?void 0:n.cv)??"auto",this.resolveCounter=0,this.resolveNestedRelations=t.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.version=t.version||J1.PUBLISHED,this.inlineAssets=t.inlineAssets||!1,this.client=new V1({baseURL:o,timeout:t.timeout||0,headers:a,responseInterceptor:t.responseInterceptor,fetch:t.fetch})}parseParams(t){return t.token||(t.token=this.getToken()),!t.cv&&this.cvMode==="auto"&&(t.cv=tt[t.token]),Array.isArray(t.resolve_relations)?t.resolve_relations=t.resolve_relations.map(hp).join(","):typeof t.resolve_relations=="string"&&(t.resolve_relations=hp(t.resolve_relations)),typeof t.resolve_relations<"u"&&(t.resolve_level=2),t}factoryParamOptions(t,e){return Ms(t)?this.parseParams(e):e}makeRequest(t,e,o,a,n){const s=this.factoryParamOptions(t,P1(e,o,a));return this.cacheResponse(t,s,void 0,n)}get(t,e={},o){e||(e={});const a=`/${t}`;Ms(a)&&(e.version=e.version||this.version);const n=this.factoryParamOptions(a,e);return this.cacheResponse(a,n,void 0,o)}async getAll(t,e={},o,a){const n=(e==null?void 0:e.per_page)||25,s=`/${t}`.replace(/\/$/,""),i=o??s.substring(s.lastIndexOf("/")+1);e.version=e.version||this.version;const r=1,l=await this.makeRequest(s,e,n,r,a);return K1([l,...await U1(W1(r,l.total?Math.ceil(l.total/(l.perPage||n)):1),p=>this.makeRequest(s,e,n,p+1,a))],p=>Object.values(p.data[i]))}post(t,e={},o){const a=`/${t}`,n=po(void 0,void 0,this.rateLimitConfig,lo);return this.throttleManager.execute(n,"post",a,e,o)}put(t,e={},o){const a=`/${t}`,n=po(void 0,void 0,this.rateLimitConfig,lo);return this.throttleManager.execute(n,"put",a,e,o)}patch(t,e={},o){const a=`/${t}`,n=po(void 0,void 0,this.rateLimitConfig,lo);return this.throttleManager.execute(n,"patch",a,e,o)}delete(t,e={},o){e||(e={});const a=`/${t}`,n=po(void 0,void 0,this.rateLimitConfig,lo);return this.throttleManager.execute(n,"delete",a,e,o)}getStories(t={},e){return this._addResolveLevel(t),this.get("cdn/stories",t,e)}getStory(t,e={},o){return this._addResolveLevel(e),this.get(`cdn/stories/${t}`,e,o)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_addResolveLevel(t){typeof t.resolve_relations<"u"&&(t.resolve_level=2)}_cleanCopy(t){return JSON.parse(JSON.stringify(t))}_insertLinks(t,e,o){const a=t[e];a&&a.fieldtype==="multilink"&&a.linktype==="story"&&typeof a.id=="string"&&this.links[o][a.id]?a.story=this._cleanCopy(this.links[o][a.id]):a&&a.linktype==="story"&&typeof a.uuid=="string"&&this.links[o][a.uuid]&&(a.story=this._cleanCopy(this.links[o][a.uuid]))}getStoryReference(t,e){return this.relations[t][e]?JSON.parse(this.stringifiedStoriesCache[e]||JSON.stringify(this.relations[t][e])):e}_resolveField(t,e,o){const a=t[e];typeof a=="string"?t[e]=this.getStoryReference(o,a):Array.isArray(a)&&(t[e]=a.map(n=>this.getStoryReference(o,n)).filter(Boolean))}_insertRelations(t,e,o,a){if(Array.isArray(o)?o.find(s=>s.endsWith(`.${e}`)):o.endsWith(`.${e}`)){this._resolveField(t,e,a);return}const n=t.component?`${t.component}.${e}`:e;(Array.isArray(o)?o.includes(n):o===n)&&this._resolveField(t,e,a)}iterateTree(t,e,o){const a=(n,s="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((i,r)=>a(i,`${s}[${r}]`));else if(typeof n=="object")for(const i in n){const r=s?`${s}.${i}`:i;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,i,e,o),this._insertLinks(n,i,o)),a(n[i],r)}}};a(t.content)}async resolveLinks(t,e,o){let a=[];if(t.link_uuids){const n=t.link_uuids.length,s=[],i=50;for(let r=0;r<n;r+=i){const l=Math.min(n,r+i);s.push(t.link_uuids.slice(r,l))}for(let r=0;r<s.length;r++)(await this.getStories({per_page:i,language:e.language,version:e.version,starts_with:e.starts_with,by_uuids:s[r].join(",")})).data.stories.forEach(l=>{a.push(l)})}else a=t.links;a.forEach(n=>{this.links[o][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(t,e,o){let a=[];if(t.rel_uuids){const n=t.rel_uuids.length,s=[],i=50;for(let r=0;r<n;r+=i){const l=Math.min(n,r+i);s.push(t.rel_uuids.slice(r,l))}for(let r=0;r<s.length;r++)(await this.getStories({per_page:i,language:e.language,version:e.version,starts_with:e.starts_with,by_uuids:s[r].join(","),excluding_fields:e.excluding_fields})).data.stories.forEach(l=>{a.push(l)});a.length>0&&(t.rels=a,delete t.rel_uuids)}else a=t.rels;a&&a.length>0&&a.forEach(n=>{this.relations[o][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(t,e,o){var n,s;let a=[];if(this.links[o]={},this.relations[o]={},typeof e.resolve_relations<"u"&&e.resolve_relations.length>0&&(typeof e.resolve_relations=="string"&&(a=e.resolve_relations.split(",")),await this.resolveRelations(t,e,o)),e.resolve_links&&["1","story","url","link"].includes(e.resolve_links)&&((n=t.links)!=null&&n.length||(s=t.link_uuids)!=null&&s.length)&&await this.resolveLinks(t,e,o),this.resolveNestedRelations)for(const i in this.relations[o])this.iterateTree(this.relations[o][i],a,o);t.story?this.iterateTree(t.story,a,o):t.stories.forEach(i=>{this.iterateTree(i,a,o)}),this.stringifiedStoriesCache={},delete this.links[o],delete this.relations[o]}async cacheResponse(t,e,o,a){const n=Bs({url:t,params:e}),s=this.cacheProvider();if(e.version==="published"&&t!=="/cdn/spaces/me"){const l=await s.get(n);if(l)return Promise.resolve(l)}const i=!Ms(t)&&this.rateLimitConfig.isManagementApi?lo:void 0,r=po(t,e,this.rateLimitConfig,i);return new Promise(async(l,p)=>{var c;try{const m=await this.throttleManager.execute(r,"get",t,e,a);if(m.status!==200)return p(m);let u={data:m.data,headers:m.headers};const d=Q1(m.headers);if((d==null?void 0:d.max)!==void 0&&(this.rateLimitConfig.serverHeadersRateLimit=d.max),(c=m.headers)!=null&&c["per-page"]&&(u=Object.assign({},u,{perPage:m.headers["per-page"]?Number.parseInt(m.headers["per-page"]):0,total:m.headers["per-page"]?Number.parseInt(m.headers.total):0})),u.data.story||u.data.stories){const f=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(u.data,e,`${f}`),u=await this.processInlineAssets(u)}e.version==="published"&&t!=="/cdn/spaces/me"&&await s.set(n,u);const g=this.cache.clear==="onpreview"&&e.version==="draft"||this.cache.clear==="auto";return e.token&&u.data.cv&&(g&&tt[e.token]&&tt[e.token]!==u.data.cv&&await this.flushCache(),tt[e.token]=u.data.cv),l(u)}catch(m){if(m.response&&m.status===429&&(o=typeof o>"u"?0:o+1,o<this.maxRetries))return console.log(`Hit rate limit. Retrying in ${this.retriesDelay/1e3} seconds.`),await H1(this.retriesDelay),this.cacheResponse(t,e,o).then(l).catch(p);p(m)}})}throttledRequest(t,e,o,a){return this.client.setFetchOptions(a),this.client[t](e,o)}cacheVersions(){return tt}cacheVersion(){return tt[this.accessToken]}setCacheVersion(t){this.accessToken&&(tt[this.accessToken]=t)}clearCacheVersion(){this.accessToken&&(tt[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(t){return Promise.resolve(La[t])},getAll(){return Promise.resolve(La)},set(t,e){return La[t]=e,Promise.resolve(void 0)},flush(){return La={},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(t){if(!this.inlineAssets)return t;const e=o=>{if(!o||typeof o!="object")return o;if(Array.isArray(o))return o.map(n=>e(n));let a={...o};a.fieldtype==="asset"&&Array.isArray(t.data.assets)&&(a={...t.data.assets.find(n=>n.id===a.id),...a});for(const n in a)typeof a[n]=="object"&&(a[n]=e(a[n]));return a};return t.data.story&&(t.data.story.content=e(t.data.story.content)),t.data.stories&&(t.data.stories=t.data.stories.map(o=>(o.content=e(o.content),o))),t}};let kp=!1;const yp=[],ab=t=>new Promise((e,o)=>{if(typeof window>"u"){o(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}kp?n():yp.push(n)},document.getElementById("storyblok-javascript-bridge")){e(void 0);return}const a=document.createElement("script");a.async=!0,a.src=t,a.id="storyblok-javascript-bridge",a.onerror=n=>o(n),a.onload=n=>{yp.forEach(s=>s()),kp=!0,e(n)},document.getElementsByTagName("head")[0].appendChild(a)}),nb=(t={})=>{const{apiOptions:e}=t;if(!e||!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new vp(e)}},sb=t=>{if(typeof t!="object"||typeof t._editable>"u")return{};try{const e=JSON.parse(t._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":`${e.id}-${e.uid}`}:{}}catch{return{}}};let Fp="https://app.storyblok.com/f/storyblok-v2-latest.js";const _p=(t,e,o={})=>{var a;const n=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",s=new URL((a=window.location)==null?void 0:a.href).searchParams.get("_storyblok"),i=s!==null&&+s===t;if(!(!n||!i)){if(!t){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(o).on(["input","published","change"],r=>{var l;r&&(r.action==="input"&&((l=r.story)==null?void 0:l.id)===t?e(r.story):(r.action==="change"||r.action==="published")&&r.storyId===t&&window.location.reload())})})}},ib=(t={})=>{var e,o;const{bridge:a,accessToken:n,use:s=[],apiOptions:i={},bridgeUrl:r}=t;i.accessToken=i.accessToken||n;const l={bridge:a,apiOptions:i};let p={};s.forEach(m=>{p={...p,...m(l)}}),r&&(Fp=r);const c=!(typeof window>"u")&&((o=(e=window.location)==null?void 0:e.search)==null?void 0:o.includes("_storyblok_tk"));return a!==!1&&c&&ab(Fp),p};function rb(t,e){return Ts(e).render(t)}const Ls=S.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(t,{expose:e}){var r;const o=t,a=S.ref();e({value:a});const n=typeof S.resolveDynamicComponent(o.blok.component)!="string",s=S.inject("VueSDKOptions"),i=S.ref((r=o.blok.component)==null?void 0:r.replace(/_/g,"-"));return!n&&s&&(s.enableFallbackComponent?(i.value=s.customFallbackComponent??"FallbackComponent",typeof S.resolveDynamicComponent(i.value)=="string"&&console.error(`Is the Fallback component "${i.value}" registered properly?`)):console.error(`Component could not be found for blok "${o.blok.component}"! Is it defined in main.ts as "app.component("${o.blok.component}", ${o.blok.component});"?`)),(l,p)=>(S.openBlock(),S.createBlock(S.resolveDynamicComponent(i.value),S.mergeProps({ref_key:"blokRef",ref:a},{...l.$props,...l.$attrs}),S.createSlots({_:2},[S.renderList(l.$slots,(c,m)=>({name:m,fn:S.withCtx(u=>[S.renderSlot(l.$slots,m,S.normalizeProps(S.guardReactiveProps(u)))])}))]),1040))}});function Dp(t){const{tiptapExtensions:e,...o}=t,a={renderFn:S.h,textFn:S.createTextVNode,keyedResolvers:!0,...o,tiptapExtensions:{blok:As.configure({renderComponent:(n,s)=>S.h(Ls,{blok:n,id:s})}),...e}};return Ts(a)}const wp=S.defineComponent({__name:"StoryblokRichText",props:{doc:{},tiptapExtensions:{}},setup(t){const e=t,o=S.ref(),a=()=>o.value;return S.watch([()=>e.doc,()=>e.tiptapExtensions],([n,s])=>{const{render:i}=Dp({tiptapExtensions:s});o.value=i(n)},{immediate:!0,deep:!0}),(n,s)=>(S.openBlock(),S.createBlock(a))}}),lb={beforeMount(t,e){if(e.value){const o=sb(e.value);Object.keys(o).length>0&&(t.setAttribute("data-blok-c",o["data-blok-c"]),t.setAttribute("data-blok-uid",o["data-blok-uid"]),t.classList.add("storyblok__outline"))}}},Ip=t=>{console.error(`You can't use ${t} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
80
80
  `)};let co=null;const pb=()=>(co||Ip("useStoryblokApi"),co),cb=async(t,e={},o={})=>{const a=S.ref(null);if(o.resolveRelations=o.resolveRelations??e.resolve_relations,o.resolveLinks=o.resolveLinks??e.resolve_links,S.onMounted(()=>{a.value&&a.value.id&&_p(a.value.id,n=>a.value=n,o)}),co){const{data:n}=await co.get(`cdn/stories/${t}`,e);a.value=n.story}else Ip("useStoryblok");return a},mb={install(t,e={}){t.directive("editable",lb),t.component("StoryblokComponent",Ls),t.component("StoryblokRichText",wp),e.enableFallbackComponent&&!e.customFallbackComponent&&t.component("FallbackComponent",S.defineAsyncComponent(()=>Promise.resolve().then(()=>gb)));const{storyblokApi:o}=ib(e);co=o||null,t.provide("VueSDKOptions",e)}},ub={class:"fallback-component"},db={class:"component"},gb=Object.freeze(Object.defineProperty({__proto__:null,default:((t,e)=>{const o=t.__vccOpts||t;for(const[a,n]of e)o[a]=n;return o})(S.defineComponent({__name:"FallbackComponent",props:{blok:{}},setup(t){return(e,o)=>(S.openBlock(),S.createElementBlock("div",ub,[S.createElementVNode("p",null,[o[0]||(o[0]=S.createTextVNode(" Component could not be found for blok ",-1)),S.createElementVNode("span",db,S.toDisplayString(t.blok.component),1),o[1]||(o[1]=S.createTextVNode("! Is it configured correctly? ",-1))])]))}}),[["__scopeId","data-v-9abcd1f2"]])},Symbol.toStringTag,{value:"Module"}));H.BlockTypes=f1,H.ComponentBlok=As,H.LinkTypes=io,H.MarkTypes=h1,H.StoryblokClient=vp,H.StoryblokComponent=Ls,H.StoryblokRichText=wp,H.StoryblokVue=mb,H.TextTypes=b1,H.apiPlugin=nb,H.asTag=$1,H.renderRichText=rb,H.richTextResolver=Ts,H.useStoryblok=cb,H.useStoryblokApi=pb,H.useStoryblokBridge=_p,H.useStoryblokRichText=Dp,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));
@@ -37945,7 +37945,7 @@ var gb = class {
37945
37945
  const a = new Headers();
37946
37946
  !t.oauthToken && typeof window < "u" || a.set("Content-Type", "application/json"), a.set("Accept", "application/json"), t.headers && (t.headers.constructor.name === "Headers" ? t.headers.entries().toArray() : Object.entries(t.headers)).forEach(([s, i]) => {
37947
37947
  a.set(s, i);
37948
- }), t.oauthToken && a.set("Authorization", t.oauthToken), this.rateLimitConfig = cb(t.rateLimit, !!t.oauthToken), this.maxRetries = t.maxRetries || 10, this.retriesDelay = 300, this.throttleManager = new db(this.throttledRequest.bind(this), 1e3), this.accessToken = t.accessToken || "", this.relations = {}, this.links = {}, this.cache = t.cache || { clear: "manual" }, this.cvMode = ((n = t.cache) == null ? void 0 : n.cv) ?? "auto", this.resolveCounter = 0, this.resolveNestedRelations = t.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = t.version || sb.PUBLISHED, this.inlineAssets = t.inlineAssets || !1, this.client = new nb({
37948
+ }), t.oauthToken && a.set("Authorization", t.oauthToken), this.rateLimitConfig = cb(t.rateLimit, !!t.oauthToken), this.maxRetries = t.maxRetries || 10, this.retriesDelay = t.retriesDelay ?? 300, this.throttleManager = new db(this.throttledRequest.bind(this), 1e3), this.accessToken = t.accessToken || "", this.relations = {}, this.links = {}, this.cache = t.cache || { clear: "manual" }, this.cvMode = ((n = t.cache) == null ? void 0 : n.cv) ?? "auto", this.resolveCounter = 0, this.resolveNestedRelations = t.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = t.version || sb.PUBLISHED, this.inlineAssets = t.inlineAssets || !1, this.client = new nb({
37949
37949
  baseURL: o,
37950
37950
  timeout: t.timeout || 0,
37951
37951
  headers: a,
package/dist/types.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  import { SbBlokData, SbSDKOptions, StoryblokRichTextDocumentNode, StoryblokRichTextOptions } from '@storyblok/js';
2
2
  import { default as StoryblokComponent } from './components/StoryblokComponent.vue';
3
- import { VNode } from 'vue';
3
+ import { Directive, VNode } from 'vue';
4
4
  declare module 'vue' {
5
5
  interface GlobalComponents {
6
6
  StoryblokComponent: typeof StoryblokComponent;
7
7
  }
8
+ interface GlobalDirectives {
9
+ vEditable: Directive<HTMLElement>;
10
+ }
8
11
  }
9
12
  export type { ArrayFn, AsyncFn, ISbAlternateObject, ISbCache, ISbConfig, ISbContentMangmntAPI, ISbDimensions, ISbError, ISbManagmentApiResult, ISbResponse, ISbResult, ISbSchema, ISbStories, ISbStoriesParams, ISbStory, ISbStoryData, ISbStoryParams, SbBlokData, SbBlokKeyDataTypes, SbSDKOptions, StoryblokBridgeConfigV2, StoryblokBridgeV2, StoryblokClient, StoryblokComponentType, StoryblokRichTextDocumentNode, StoryblokRichTextImageOptimizationOptions, StoryblokRichTextNode, StoryblokRichTextNodeTypes, } from '@storyblok/js';
10
13
  export interface SbVueSDKOptions extends SbSDKOptions {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@storyblok/vue",
3
3
  "type": "module",
4
- "version": "10.1.8",
4
+ "version": "10.1.10",
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": "5.1.8"
34
+ "@storyblok/js": "5.1.10"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rollup/plugin-typescript": "^12.1.2",
@@ -51,7 +51,7 @@
51
51
  "vue": "^3.5.13",
52
52
  "vue-router": "^4.5.0",
53
53
  "vue-tsc": "^2.2.0",
54
- "@storyblok/eslint-config": "0.5.0"
54
+ "@storyblok/eslint-config": "0.5.1"
55
55
  },
56
56
  "release": {
57
57
  "branches": [