@m2s2/vue-lib 2.5.1 → 2.5.2
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.
- package/dist/index16.cjs +1 -1
- package/dist/index16.mjs +1 -1
- package/dist/index24.cjs +1 -1
- package/dist/index24.mjs +1 -1
- package/dist/index26.cjs +1 -1
- package/dist/index26.mjs +3 -3
- package/dist/index28.cjs +1 -1
- package/dist/index28.mjs +1 -1
- package/dist/index30.cjs +1 -1
- package/dist/index30.mjs +1 -1
- package/dist/index75.cjs +1 -1
- package/dist/index75.mjs +51 -4
- package/dist/index76.cjs +59 -1
- package/dist/index76.mjs +1146 -18
- package/dist/index77.cjs +1 -1
- package/dist/index77.mjs +21 -5
- package/dist/index78.cjs +5 -59
- package/dist/index78.mjs +19 -1150
- package/dist/index79.cjs +1 -5
- package/dist/index79.mjs +6 -19
- package/dist/index80.cjs +1 -1
- package/dist/index80.mjs +4 -51
- package/dist/index81.cjs +1 -1
- package/dist/index81.mjs +1 -1
- package/package.json +4 -1
package/dist/index77.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e){const[t,a,n]=e.split("-").map(Number);return new Date(t,a-1,n).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function o(){return new Date().toISOString().split("T")[0]}function i(e){return e.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-")}function l(e){const t=e.trim().split(/\s+/).filter(Boolean).length;return Math.max(1,Math.ceil(t/200))}exports.calcReadingTime=l;exports.formatBlogDate=r;exports.generateSlug=i;exports.todayAsIsoDate=o;
|
package/dist/index77.mjs
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return
|
|
1
|
+
function a(e) {
|
|
2
|
+
const [t, n, r] = e.split("-").map(Number);
|
|
3
|
+
return new Date(t, n - 1, r).toLocaleDateString("en-US", {
|
|
4
|
+
year: "numeric",
|
|
5
|
+
month: "long",
|
|
6
|
+
day: "numeric"
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function o() {
|
|
10
|
+
return (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
11
|
+
}
|
|
12
|
+
function i(e) {
|
|
13
|
+
return e.toLowerCase().replace(/[^a-z0-9\s-]/g, "").trim().replace(/\s+/g, "-").replace(/-+/g, "-");
|
|
14
|
+
}
|
|
15
|
+
function c(e) {
|
|
16
|
+
const t = e.trim().split(/\s+/).filter(Boolean).length;
|
|
17
|
+
return Math.max(1, Math.ceil(t / 200));
|
|
4
18
|
}
|
|
5
19
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
20
|
+
c as calcReadingTime,
|
|
21
|
+
a as formatBlogDate,
|
|
22
|
+
i as generateSlug,
|
|
23
|
+
o as todayAsIsoDate
|
|
8
24
|
};
|
package/dist/index78.cjs
CHANGED
|
@@ -1,59 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`
|
|
6
|
-
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=L(e[0],`
|
|
7
|
-
`).split(`
|
|
8
|
-
`),s="",n="",i=[];for(;t.length>0;){let a=!1,l=[],h;for(h=0;h<t.length;h++)if(this.rules.other.blockquoteStart.test(t[h]))l.push(t[h]),a=!0;else if(!a)l.push(t[h]);else break;t=t.slice(h);let o=l.join(`
|
|
9
|
-
`),p=o.replace(this.rules.other.blockquoteSetextReplace,`
|
|
10
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
11
|
-
${o}`:o,n=n?`${n}
|
|
12
|
-
${p}`:p;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,i,!0),this.lexer.state.top=g,t.length===0)break;let u=i.at(-1);if((u==null?void 0:u.type)==="code")break;if((u==null?void 0:u.type)==="blockquote"){let c=u,b=c.raw+`
|
|
13
|
-
`+t.join(`
|
|
14
|
-
`),k=this.blockquote(b);i[i.length-1]=k,s=s.substring(0,s.length-c.raw.length)+k.raw,n=n.substring(0,n.length-c.text.length)+k.text;break}else if((u==null?void 0:u.type)==="list"){let c=u,b=c.raw+`
|
|
15
|
-
`+t.join(`
|
|
16
|
-
`),k=this.list(b);i[i.length-1]=k,s=s.substring(0,s.length-u.raw.length)+k.raw,n=n.substring(0,n.length-c.raw.length)+k.raw,t=b.substring(i.at(-1).raw.length).split(`
|
|
17
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:n}}}list(r){var t,s;let e=this.rules.block.list.exec(r);if(e){let n=e[1].trim(),i=n.length>1,a={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let l=this.rules.other.listItemRegex(n),h=!1;for(;r;){let p=!1,g="",u="";if(!(e=l.exec(r))||this.rules.block.hr.test(r))break;g=e[0],r=r.substring(g.length);let c=at(e[2].split(`
|
|
18
|
-
`,1)[0],e[1].length),b=r.split(`
|
|
19
|
-
`,1)[0],k=!c.trim(),w=0;if(this.options.pedantic?(w=2,u=c.trimStart()):k?w=e[1].length+1:(w=c.search(this.rules.other.nonSpaceChar),w=w>4?1:w,u=c.slice(w),w+=e[1].length),k&&this.rules.other.blankLine.test(b)&&(g+=b+`
|
|
20
|
-
`,r=r.substring(b.length+1),p=!0),!p){let z=this.rules.other.nextBulletRegex(w),E=this.rules.other.hrRegex(w),ee=this.rules.other.fencesBeginRegex(w),te=this.rules.other.headingBeginRegex(w),we=this.rules.other.htmlBeginRegex(w),me=this.rules.other.blockquoteBeginRegex(w);for(;r;){let N=r.split(`
|
|
21
|
-
`,1)[0],_;if(b=N,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),_=b):_=b.replace(this.rules.other.tabCharGlobal," "),ee.test(b)||te.test(b)||we.test(b)||me.test(b)||z.test(b)||E.test(b))break;if(_.search(this.rules.other.nonSpaceChar)>=w||!b.trim())u+=`
|
|
22
|
-
`+_.slice(w);else{if(k||c.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ee.test(c)||te.test(c)||E.test(c))break;u+=`
|
|
23
|
-
`+b}k=!b.trim(),g+=N+`
|
|
24
|
-
`,r=r.substring(N.length+1),c=_.slice(w)}}a.loose||(h?a.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(h=!0)),a.items.push({type:"list_item",raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),a.raw+=g}let o=a.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let p of a.items){if(this.lexer.state.top=!1,p.tokens=this.lexer.blockTokens(p.text,[]),p.task){if(p.text=p.text.replace(this.rules.other.listReplaceTask,""),((t=p.tokens[0])==null?void 0:t.type)==="text"||((s=p.tokens[0])==null?void 0:s.type)==="paragraph"){p.tokens[0].raw=p.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),p.tokens[0].text=p.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let g=this.rules.other.listTaskCheckbox.exec(p.raw);if(g){let u={type:"checkbox",raw:g[0]+" ",checked:g[0]!=="[ ]"};p.checked=u.checked,a.loose?p.tokens[0]&&["paragraph","text"].includes(p.tokens[0].type)&&"tokens"in p.tokens[0]&&p.tokens[0].tokens?(p.tokens[0].raw=u.raw+p.tokens[0].raw,p.tokens[0].text=u.raw+p.tokens[0].text,p.tokens[0].tokens.unshift(u)):p.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):p.tokens.unshift(u)}}if(!a.loose){let g=p.tokens.filter(c=>c.type==="space"),u=g.length>0&&g.some(c=>this.rules.other.anyLine.test(c.raw));a.loose=u}}if(a.loose)for(let p of a.items){p.loose=!0;for(let g of p.tokens)g.type==="text"&&(g.type="paragraph")}return a}}html(r){let e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:s,title:n}}}table(r){var a;let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=ie(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=(a=e[3])!=null&&a.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
25
|
-
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(let l of n)i.rows.push(ie(l,i.header.length).map((h,o)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:i.align[o]})));return i}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
26
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=L(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=it(e[2],"()");if(i===-2)return;if(i>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let s=e[2],n="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],n=i[3])}else n=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),ae(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[s.toLowerCase()];if(!n){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return ae(t,n,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,i,a,l=n,h=0,o=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(o.lastIndex=0,e=e.slice(-1*r.length+n);(s=o.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(a=[...i].length,s[3]||s[4]){l+=a;continue}else if((s[5]||s[6])&&n%3&&!((n+a)%3)){h+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+h);let p=[...s[0]][0].length,g=r.slice(0,n+s.index+p+a);if(Math.min(n,a)%2){let c=g.slice(1,-1);return{type:"em",raw:g,text:c,tokens:this.lexer.inlineTokens(c)}}let u=g.slice(2,-2);return{type:"strong",raw:g,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,i,a,l=n,h=this.rules.inline.delRDelim;for(h.lastIndex=0,e=e.slice(-1*r.length+n);(s=h.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(a=[...i].length,a!==n))continue;if(s[3]||s[4]){l+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l);let o=[...s[0]][0].length,p=r.slice(0,n+s.index+o+a),g=p.slice(n,-n);return{type:"del",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){var t;let e;if(e=this.rules.inline.url.exec(r)){let s,n;if(e[2]==="@")s=e[0],n="mailto:"+s;else{let i;do i=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(i!==e[0]);s=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},y=class G{constructor(e){x(this,"tokens");x(this,"options");x(this,"state");x(this,"inlineQueue");x(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||exports.defaults,this.options.tokenizer=this.options.tokenizer||new B,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:m,block:v.normal,inline:I.normal};this.options.pedantic?(t.block=v.pedantic,t.inline=I.pedantic):this.options.gfm&&(t.block=v.gfm,this.options.breaks?t.inline=I.breaks:t.inline=I.gfm),this.tokenizer.rules=t}static get rules(){return{block:v,inline:I}}static lex(e,t){return new G(t).lex(e)}static lexInline(e,t){return new G(t).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
|
|
27
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){var n,i,a;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));e;){let l;if((i=(n=this.options.extensions)==null?void 0:n.block)!=null&&i.some(o=>(l=o.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);let o=t.at(-1);l.raw.length===1&&o!==void 0?o.raw+=`
|
|
28
|
-
`:t.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);let o=t.at(-1);(o==null?void 0:o.type)==="paragraph"||(o==null?void 0:o.type)==="text"?(o.raw+=(o.raw.endsWith(`
|
|
29
|
-
`)?"":`
|
|
30
|
-
`)+l.raw,o.text+=`
|
|
31
|
-
`+l.text,this.inlineQueue.at(-1).src=o.text):t.push(l);continue}if(l=this.tokenizer.fences(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.heading(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.hr(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.blockquote(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.list(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.html(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.def(e)){e=e.substring(l.raw.length);let o=t.at(-1);(o==null?void 0:o.type)==="paragraph"||(o==null?void 0:o.type)==="text"?(o.raw+=(o.raw.endsWith(`
|
|
32
|
-
`)?"":`
|
|
33
|
-
`)+l.raw,o.text+=`
|
|
34
|
-
`+l.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},t.push(l));continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),t.push(l);continue}let h=e;if((a=this.options.extensions)!=null&&a.startBlock){let o=1/0,p=e.slice(1),g;this.options.extensions.startBlock.forEach(u=>{g=u.call({lexer:this},p),typeof g=="number"&&g>=0&&(o=Math.min(o,g))}),o<1/0&&o>=0&&(h=e.substring(0,o+1))}if(this.state.top&&(l=this.tokenizer.paragraph(h))){let o=t.at(-1);s&&(o==null?void 0:o.type)==="paragraph"?(o.raw+=(o.raw.endsWith(`
|
|
35
|
-
`)?"":`
|
|
36
|
-
`)+l.raw,o.text+=`
|
|
37
|
-
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(l),s=h.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);let o=t.at(-1);(o==null?void 0:o.type)==="text"?(o.raw+=(o.raw.endsWith(`
|
|
38
|
-
`)?"":`
|
|
39
|
-
`)+l.raw,o.text+=`
|
|
40
|
-
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(l);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var h,o,p,g,u;this.tokenizer.lexer=this;let s=e,n=null;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)c.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,n.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(n=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)i=n[2]?n[2].length:0,s=s.slice(0,n.index+i)+"["+"a".repeat(n[0].length-i-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=((o=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:o.call({lexer:this},s))??s;let a=!1,l="";for(;e;){a||(l=""),a=!1;let c;if((g=(p=this.options.extensions)==null?void 0:p.inline)!=null&&g.some(k=>(c=k.call({lexer:this},e,t))?(e=e.substring(c.raw.length),t.push(c),!0):!1))continue;if(c=this.tokenizer.escape(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.tag(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.link(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(c.raw.length);let k=t.at(-1);c.type==="text"&&(k==null?void 0:k.type)==="text"?(k.raw+=c.raw,k.text+=c.text):t.push(c);continue}if(c=this.tokenizer.emStrong(e,s,l)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.codespan(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.br(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.del(e,s,l)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.autolink(e)){e=e.substring(c.raw.length),t.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(e))){e=e.substring(c.raw.length),t.push(c);continue}let b=e;if((u=this.options.extensions)!=null&&u.startInline){let k=1/0,w=e.slice(1),z;this.options.extensions.startInline.forEach(E=>{z=E.call({lexer:this},w),typeof z=="number"&&z>=0&&(k=Math.min(k,z))}),k<1/0&&k>=0&&(b=e.substring(0,k+1))}if(c=this.tokenizer.inlineText(b)){e=e.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(l=c.raw.slice(-1)),a=!0;let k=t.at(-1);(k==null?void 0:k.type)==="text"?(k.raw+=c.raw,k.text+=c.text):t.push(c);continue}if(e){let k="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(k);break}else throw new Error(k)}}return t}},C=class{constructor(r){x(this,"options");x(this,"parser");this.options=r||exports.defaults}space(r){return""}code({text:r,lang:e,escaped:t}){var i;let s=(i=(e||"").match(m.notSpaceStart))==null?void 0:i[0],n=r.replace(m.endingNewline,"")+`
|
|
41
|
-
`;return s?'<pre><code class="language-'+S(s)+'">'+(t?n:S(n,!0))+`</code></pre>
|
|
42
|
-
`:"<pre><code>"+(t?n:S(n,!0))+`</code></pre>
|
|
43
|
-
`}blockquote({tokens:r}){return`<blockquote>
|
|
44
|
-
${this.parser.parse(r)}</blockquote>
|
|
45
|
-
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
46
|
-
`}hr(r){return`<hr>
|
|
47
|
-
`}list(r){let e=r.ordered,t=r.start,s="";for(let a=0;a<r.items.length;a++){let l=r.items[a];s+=this.listitem(l)}let n=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+n+i+`>
|
|
48
|
-
`+s+"</"+n+`>
|
|
49
|
-
`}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
|
|
50
|
-
`}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
|
|
51
|
-
`}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let i=r.rows[n];t="";for(let a=0;a<i.length;a++)t+=this.tablecell(i[a]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
52
|
-
<thead>
|
|
53
|
-
`+e+`</thead>
|
|
54
|
-
`+s+`</table>
|
|
55
|
-
`}tablerow({text:r}){return`<tr>
|
|
56
|
-
${r}</tr>
|
|
57
|
-
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
|
58
|
-
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${S(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),n=le(r);if(n===null)return s;r=n;let i='<a href="'+r+'"';return e&&(i+=' title="'+S(e)+'"'),i+=">"+s+"</a>",i}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let n=le(r);if(n===null)return S(t);r=n;let i=`<img src="${r}" alt="${S(t)}"`;return e&&(i+=` title="${S(e)}"`),i+=">",i}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:S(r.text)}},j=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},R=class X{constructor(e){x(this,"options");x(this,"renderer");x(this,"textRenderer");this.options=e||exports.defaults,this.options.renderer=this.options.renderer||new C,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new j}static parse(e,t){return new X(t).parse(e)}static parseInline(e,t){return new X(t).parseInline(e)}parse(e){var s,n;this.renderer.parser=this;let t="";for(let i=0;i<e.length;i++){let a=e[i];if((n=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&n[a.type]){let h=a,o=this.options.extensions.renderers[h.type].call({parser:this},h);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.type)){t+=o||"";continue}}let l=a;switch(l.type){case"space":{t+=this.renderer.space(l);break}case"hr":{t+=this.renderer.hr(l);break}case"heading":{t+=this.renderer.heading(l);break}case"code":{t+=this.renderer.code(l);break}case"table":{t+=this.renderer.table(l);break}case"blockquote":{t+=this.renderer.blockquote(l);break}case"list":{t+=this.renderer.list(l);break}case"checkbox":{t+=this.renderer.checkbox(l);break}case"html":{t+=this.renderer.html(l);break}case"def":{t+=this.renderer.def(l);break}case"paragraph":{t+=this.renderer.paragraph(l);break}case"text":{t+=this.renderer.text(l);break}default:{let h='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return t}parseInline(e,t=this.renderer){var n,i;this.renderer.parser=this;let s="";for(let a=0;a<e.length;a++){let l=e[a];if((i=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&i[l.type]){let o=this.options.extensions.renderers[l.type].call({parser:this},l);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){s+=o||"";continue}}let h=l;switch(h.type){case"escape":{s+=t.text(h);break}case"html":{s+=t.html(h);break}case"link":{s+=t.link(h);break}case"image":{s+=t.image(h);break}case"checkbox":{s+=t.checkbox(h);break}case"strong":{s+=t.strong(h);break}case"em":{s+=t.em(h);break}case"codespan":{s+=t.codespan(h);break}case"br":{s+=t.br(h);break}case"del":{s+=t.del(h);break}case"text":{s+=t.text(h);break}default:{let o='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},Z,A=(Z=class{constructor(r){x(this,"options");x(this,"block");this.options=r||exports.defaults}preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?y.lex:y.lexInline}provideParser(r=this.block){return r?R.parse:R.parseInline}},x(Z,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),x(Z,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Z),be=class{constructor(...r){x(this,"defaults",M());x(this,"options",this.setOptions);x(this,"parse",this.parseMarkdown(!0));x(this,"parseInline",this.parseMarkdown(!1));x(this,"Parser",R);x(this,"Renderer",C);x(this,"TextRenderer",j);x(this,"Lexer",y);x(this,"Tokenizer",B);x(this,"Hooks",A);this.use(...r)}walkTokens(r,e){var s,n;let t=[];for(let i of r)switch(t=t.concat(e.call(this,i)),i.type){case"table":{let a=i;for(let l of a.header)t=t.concat(this.walkTokens(l.tokens,e));for(let l of a.rows)for(let h of l)t=t.concat(this.walkTokens(h.tokens,e));break}case"list":{let a=i;t=t.concat(this.walkTokens(a.items,e));break}default:{let a=i;(n=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&n[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let h=a[l].flat(1/0);t=t.concat(this.walkTokens(h,e))}):a.tokens&&(t=t.concat(this.walkTokens(a.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let i=e.renderers[n.name];i?e.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=i.apply(this,a)),l}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[n.level];i?i.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),t.renderer){let n=this.defaults.renderer||new C(this.defaults);for(let i in t.renderer){if(!(i in n))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,l=t.renderer[a],h=n[a];n[a]=(...o)=>{let p=l.apply(n,o);return p===!1&&(p=h.apply(n,o)),p||""}}s.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new B(this.defaults);for(let i in t.tokenizer){if(!(i in n))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,l=t.tokenizer[a],h=n[a];n[a]=(...o)=>{let p=l.apply(n,o);return p===!1&&(p=h.apply(n,o)),p}}s.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new A;for(let i in t.hooks){if(!(i in n))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,l=t.hooks[a],h=n[a];A.passThroughHooks.has(i)?n[a]=o=>{if(this.defaults.async&&A.passThroughHooksRespectAsync.has(i))return(async()=>{let g=await l.call(n,o);return h.call(n,g)})();let p=l.call(n,o);return h.call(n,p)}:n[a]=(...o)=>{if(this.defaults.async)return(async()=>{let g=await l.apply(n,o);return g===!1&&(g=await h.apply(n,o)),g})();let p=l.apply(n,o);return p===!1&&(p=h.apply(n,o)),p}}s.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(a){let l=[];return l.push(i.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return y.lex(r,e??this.defaults)}parser(r,e){return R.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},n={...this.defaults,...s},i=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=r),n.async)return(async()=>{let a=n.hooks?await n.hooks.preprocess(e):e,l=await(n.hooks?await n.hooks.provideLexer(r):r?y.lex:y.lexInline)(a,n),h=n.hooks?await n.hooks.processAllTokens(l):l;n.walkTokens&&await Promise.all(this.walkTokens(h,n.walkTokens));let o=await(n.hooks?await n.hooks.provideParser(r):r?R.parse:R.parseInline)(h,n);return n.hooks?await n.hooks.postprocess(o):o})().catch(i);try{n.hooks&&(e=n.hooks.preprocess(e));let a=(n.hooks?n.hooks.provideLexer(r):r?y.lex:y.lexInline)(e,n);n.hooks&&(a=n.hooks.processAllTokens(a)),n.walkTokens&&this.walkTokens(a,n.walkTokens);let l=(n.hooks?n.hooks.provideParser(r):r?R.parse:R.parseInline)(a,n);return n.hooks&&(l=n.hooks.postprocess(l)),l}catch(a){return i(a)}}}onError(r,e){return t=>{if(t.message+=`
|
|
59
|
-
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+S(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},T=new be;function d(r,e){return T.parse(r,e)}d.options=d.setOptions=function(r){return T.setOptions(r),d.defaults=T.defaults,oe(d.defaults),d};d.getDefaults=M;d.defaults=exports.defaults;d.use=function(...r){return T.use(...r),d.defaults=T.defaults,oe(d.defaults),d};d.walkTokens=function(r,e){return T.walkTokens(r,e)};d.parseInline=T.parseInline;d.Parser=R;d.parser=R.parse;d.Renderer=C;d.TextRenderer=j;d.Lexer=y;d.lexer=y.lex;d.Tokenizer=B;d.Hooks=A;d.parse=d;d.options;d.setOptions;d.use;d.walkTokens;d.parseInline;R.parse;y.lex;exports.Hooks=A;exports.Lexer=y;exports.Marked=be;exports.Parser=R;exports.Renderer=C;exports.TextRenderer=j;exports.Tokenizer=B;exports.getDefaults=M;exports.marked=d;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=[{label:"Heading 2",icon:"H2",prefix:"## "},{label:"Heading 3",icon:"H3",prefix:"### "},{label:"Bold",icon:"B",wrap:["**","**"]},{label:"Italic",icon:"I",wrap:["*","*"]},{label:"Inline code",icon:"`",wrap:["`","`"]},{label:"Code block",icon:"{ }",block:"\n```\n\n```\n"},{label:"Blockquote",icon:"❝",prefix:"> "},{label:"Link",icon:"⇗",wrap:["[","](url)"]},{label:"Image",icon:"⬚",block:`
|
|
2
|
+
`},{label:"Bullet list",icon:"•–",prefix:"- "},{label:"Numbered list",icon:"1.",prefix:"1. "},{label:"Divider",icon:"—",block:`
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
`}];exports.BLOG_EDITOR_TOOLBAR=l;
|