import{g as getDefaultExportFromCjs}from"./copy-to-clipboard-B1uT6SkR.js";import{r as require$$0}from"./node-stdlib-browser-d7cmxmpa.js";import{s as sectionMatter}from"./section-matter-DWrNKXO4.js";import{j as jsYaml}from"./js-yaml-B7yGoGZD.js";import{B as Buffer}from"./vite-plugin-node-polyfills-C8Q2m4YJ.js";import{s as stripBomString}from"./strip-bom-string-BxrG9K6S.js";import{k as kindOf}from"./kind-of-l3izQsJJ.js";var engines$2={exports:{}};(function(module,exports){const yaml=jsYaml,engines=module.exports;engines.yaml={parse:yaml.safeLoad.bind(yaml),stringify:yaml.safeDump.bind(yaml)},engines.json={parse:JSON.parse.bind(JSON),stringify:function(t,n){const e=Object.assign({replacer:null,space:2},n);return JSON.stringify(t,e.replacer,e.space)}},engines.javascript={parse:function parse(str,options,wrap){try{return wrap!==!1&&(str=`(function() {
return `+str.trim()+`;
}());`),eval(str)||{}}catch(t){if(wrap!==!1&&/(unexpected|identifier)/i.test(t.message))return parse(str,options,!1);throw new SyntaxError(t)}},stringify:function(){throw new Error("stringifying JavaScript is not supported")}}})(engines$2);var enginesExports=engines$2.exports,utils$3={};(function(t){const n=stripBomString,e=kindOf;t.define=function(r,s,a){Reflect.defineProperty(r,s,{enumerable:!1,configurable:!0,writable:!0,value:a})},t.isBuffer=function(r){return e(r)==="buffer"},t.isObject=function(r){return e(r)==="object"},t.toBuffer=function(r){return typeof r=="string"?Buffer.from(r):r},t.toString=function(r){if(t.isBuffer(r))return n(String(r));if(typeof r!="string")throw new TypeError("expected input to be a string or buffer");return n(r)},t.arrayify=function(r){return r?Array.isArray(r)?r:[r]:[]},t.startsWith=function(r,s,a){return typeof a!="number"&&(a=s.length),r.slice(0,a)===s}})(utils$3);const engines$1=enginesExports,utils$2=utils$3;var defaults$4=function(t){const n=Object.assign({},t);return n.delimiters=utils$2.arrayify(n.delims||n.delimiters||"---"),n.delimiters.length===1&&n.delimiters.push(n.delimiters[0]),n.language=(n.language||n.lang||"yaml").toLowerCase(),n.engines=Object.assign({},engines$1,n.parsers,n.engines),n},engine=function(t,n){let e=n.engines[t]||n.engines[aliase(t)];if(typeof e>"u")throw new Error('gray-matter engine "'+t+'" is not registered');return typeof e=="function"&&(e={parse:e}),e};function aliase(t){switch(t.toLowerCase()){case"js":case"javascript":return"javascript";case"coffee":case"coffeescript":case"cson":return"coffee";case"yaml":case"yml":return"yaml";default:return t}}const typeOf$1=kindOf,getEngine$1=engine,defaults$3=defaults$4;var stringify$2=function(t,n,e){if(n==null&&e==null)switch(typeOf$1(t)){case"object":n=t.data,e={};break;case"string":return t;default:throw new TypeError("expected file to be a string or object")}const r=t.content,s=defaults$3(e);if(n==null){if(!s.data)return t;n=s.data}const a=t.language||s.language,c=getEngine$1(a,s);if(typeof c.stringify!="function")throw new TypeError('expected "'+a+'.stringify" to be a function');n=Object.assign({},t.data,n);const u=s.delimiters[0],o=s.delimiters[1],i=c.stringify(n,e).trim();let g="";return i!=="{}"&&(g=newline(u)+newline(i)+newline(o)),typeof t.excerpt=="string"&&t.excerpt!==""&&r.indexOf(t.excerpt.trim())===-1&&(g+=newline(t.excerpt)+newline(o)),g+newline(r)};function newline(t){return t.slice(-1)!==`
`?t+`
`:t}const defaults$2=defaults$4;var excerpt$1=function(t,n){const e=defaults$2(n);if(t.data==null&&(t.data={}),typeof e.excerpt=="function")return e.excerpt(t,e);const r=t.data.excerpt_separator||e.excerpt_separator;if(r==null&&(e.excerpt===!1||e.excerpt==null))return t;const s=typeof e.excerpt=="string"?e.excerpt:r||e.delimiters[0],a=t.content.indexOf(s);return a!==-1&&(t.excerpt=t.content.slice(0,a)),t};const typeOf=kindOf,stringify$1=stringify$2,utils$1=utils$3;var toFile$1=function(t){return typeOf(t)!=="object"&&(t={content:t}),typeOf(t.data)!=="object"&&(t.data={}),t.contents&&t.content==null&&(t.content=t.contents),utils$1.define(t,"orig",utils$1.toBuffer(t.content)),utils$1.define(t,"language",t.language||""),utils$1.define(t,"matter",t.matter||""),utils$1.define(t,"stringify",function(n,e){return e&&e.language&&(t.language=e.language),stringify$1(t,n,e)}),t.content=utils$1.toString(t.content),t.isEmpty=!1,t.excerpt="",t};const getEngine=engine,defaults$1=defaults$4;var parse$1=function(t,n,e){const r=defaults$1(e),s=getEngine(t,r);if(typeof s.parse!="function")throw new TypeError('expected "'+t+'.parse" to be a function');return s.parse(n,r)};const fs=require$$0,sections=sectionMatter,defaults=defaults$4,stringify=stringify$2,excerpt=excerpt$1,engines=enginesExports,toFile=toFile$1,parse=parse$1,utils=utils$3;function matter(t,n){if(t==="")return{data:{},content:t,excerpt:"",orig:t};let e=toFile(t);const r=matter.cache[e.content];if(!n){if(r)return e=Object.assign({},r),e.orig=r.orig,e;matter.cache[e.content]=e}return parseMatter(e,n)}function parseMatter(t,n){const e=defaults(n),r=e.delimiters[0],s=`
`+e.delimiters[1];let a=t.content;e.language&&(t.language=e.language);const c=r.length;if(!utils.startsWith(a,r,c))return excerpt(t,e),t;if(a.charAt(c)===r.slice(-1))return t;a=a.slice(c);const u=a.length,o=matter.language(a,e);o.name&&(t.language=o.name,a=a.slice(o.raw.length));let i=a.indexOf(s);return i===-1&&(i=u),t.matter=a.slice(0,i),t.matter.replace(/^\s*#[^\n]+/gm,"").trim()===""?(t.isEmpty=!0,t.empty=t.content,t.data={}):t.data=parse(t.language,t.matter,e),i===u?t.content="":(t.content=a.slice(i+s.length),t.content[0]==="\r"&&(t.content=t.content.slice(1)),t.content[0]===`
`&&(t.content=t.content.slice(1))),excerpt(t,e),(e.sections===!0||typeof e.section=="function")&&sections(t,e.section),t}matter.engines=engines;matter.stringify=function(t,n,e){return typeof t=="string"&&(t=matter(t,e)),stringify(t,n,e)};matter.read=function(t,n){const e=fs.readFileSync(t,"utf8"),r=matter(e,n);return r.path=t,r};matter.test=function(t,n){return utils.startsWith(t,defaults(n).delimiters[0])};matter.language=function(t,n){const r=defaults(n).delimiters[0];matter.test(t)&&(t=t.slice(r.length));const s=t.slice(0,t.search(/\r?\n/));return{raw:s,name:s?s.trim():""}};matter.cache={};matter.clearCache=function(){matter.cache={}};var grayMatter=matter;const matter$1=getDefaultExportFromCjs(grayMatter);export{matter$1 as m};
