UNPKG

@venuecms/sdk-next

Version:

This is a work in progress and is heavily in flux until we launch 1.0 in February.

5 lines 3 kB
"use client"; import{a as p,b as o,c as $}from"./chunk-FYEJBDO3.mjs";import{a as n}from"./chunk-VFP3KDXI.mjs";import{a as C,b as P}from"./chunk-KOFBA5QM.mjs";var w=C((z,u)=>{"use strict";u.exports=function(r,e){e=e||{},e.listUnicodeChar=e.hasOwnProperty("listUnicodeChar")?e.listUnicodeChar:!1,e.stripListLeaders=e.hasOwnProperty("stripListLeaders")?e.stripListLeaders:!0,e.gfm=e.hasOwnProperty("gfm")?e.gfm:!0,e.useImgAltText=e.hasOwnProperty("useImgAltText")?e.useImgAltText:!0,e.abbr=e.hasOwnProperty("abbr")?e.abbr:!1,e.replaceLinksWithURL=e.hasOwnProperty("replaceLinksWithURL")?e.replaceLinksWithURL:!1,e.htmlTagsToSkip=e.hasOwnProperty("htmlTagsToSkip")?e.htmlTagsToSkip:[],e.throwError=e.hasOwnProperty("throwError")?e.throwError:!1;var t=r||"";t=t.replace(/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/gm,"");try{e.stripListLeaders&&(e.listUnicodeChar?t=t.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,e.listUnicodeChar+" $1"):t=t.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,"$1")),e.gfm&&(t=t.replace(/\n={2,}/g,` `).replace(/~{3}.*\n/g,"").replace(/~~/g,"").replace(/`{3}.*\n/g,"")),e.abbr&&(t=t.replace(/\*\[.*\]:.*\n/,""));let a=/<[^>]*>/g;if(e.htmlTagsToSkip&&e.htmlTagsToSkip.length>0){let g=e.htmlTagsToSkip.join("|");a=new RegExp(`<(?!/?(${g})(?=>|s[^>]*>))[^>]*>`,"g")}t=t.replace(a,"").replace(/^[=\-]{2,}\s*$/g,"").replace(/\[\^.+?\](\: .*?$)?/g,"").replace(/\s{0,2}\[.*?\]: .*?$/g,"").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g,e.useImgAltText?"$1":"").replace(/\[([^\]]*?)\][\[\(].*?[\]\)]/g,e.replaceLinksWithURL?"$2":"$1").replace(/^(\n)?\s{0,3}>\s?/gm,"$1").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g,"").replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm,"$1$3$4$6").replace(/([\*]+)(\S)(.*?\S)??\1/g,"$2$3").replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g,"$1$3$4$5").replace(/(`{3,})(.*?)\1/gm,"$2").replace(/`(.+?)`/g,"$1").replace(/~(.*?)~/g,"$1")}catch(a){if(e.throwError)throw a;return console.error("remove-markdown encountered error: %s",a),r}return t}});var m=P(w());var S=({locale:r,item:e,site:t,overrides:a={}})=>{let{content:g}=e?.localizedContent?p(e?.localizedContent,r):{},{title:i,content:l,shortContent:c,metaTitle:y,metaDescription:d,keywords:L}=g??a,f=s=>{let h=s?.image&&n(s.image),T=t.image&&n(t.image),k=l?(0,m.default)(l).split(` `)[0]:void 0;return{title:y||i,description:d||c||k,siteName:t.name,...s?.image&&h?{images:[{width:s.image.metadata?.width,height:s.image.metadata?.height,url:h}]}:{images:[{width:t.image?.metadata?.width,height:t.image?.metadata?.height,url:T}]},locale:r,type:"website",...a}};return{title:`${t.name}${i?` - ${i}`:""}`,description:d||c||(l?(0,m.default)(l):void 0),keywords:L?.split(", "),openGraph:f(e),...a}},x=r=>async({params:e})=>{try{let{siteKey:t,slug:a,locale:g}=await e;o({siteKey:t});let[{data:i},{data:l}]=await Promise.all([$(),r({slug:a})]);return!i||!l?{}:S({locale:g,item:l,site:i})}catch{return{}}};export{S as a,x as b}; //# sourceMappingURL=chunk-6FCE5D6M.mjs.map