// ==UserScript==// @name ChatGPT Conversation Export// @author iy// @version 1.0.0// @description Export ChatGPT Conversation to .md// @match https://chat.openai.com/*// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==// @icon64 data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==// @run-at document-idle// ==/UserScript== (function () { "use strict"; var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; function getDefaultExportFromCjs(x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; } var dist = { exports: {} }; (function (module, exports) { !(function (t, e) { module.exports = e(); })(commonjsGlobal, function () { return (function (t) { var e = {}; function r(n) { if (e[n]) return e[n].exports; var o = (e[n] = { i: n, l: !1, exports: {} }); return t[n].call(o.exports, o, o.exports, r), (o.l = !0), o.exports; } return ( (r.m = t), (r.c = e), (r.d = function (t, e, n) { r.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: n }); }), (r.r = function (t) { "undefined" !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t, "__esModule", { value: !0 }); }), (r.t = function (t, e) { if ((1 & e && (t = r(t)), 8 & e)) return t; if (4 & e && "object" === typeof t && t && t.__esModule) return t; var n = Object.create(null); if ( (r.r(n), Object.defineProperty(n, "default", { enumerable: !0, value: t }), 2 & e && "string" != typeof t) ) for (var o in t) r.d( n, o, function (e) { return t[e]; }.bind(null, o) ); return n; }), (r.n = function (t) { var e = t && t.__esModule ? function () { return t.default; } : function () { return t; }; return r.d(e, "a", e), e; }), (r.o = function (t, e) { return Object.prototype.hasOwnProperty.call(t, e); }), (r.p = ""), r((r.s = 45)) ); })([ function (t, e, r) { Object.defineProperty(e, "__esModule", { value: !0 }); var n = r(1), o = r(9), i = r(12), a = r(6), c = r(2), u = (function () { function t(t, e, r) { var n = void 0 === r ? {} : r, o = n.keepSpace, i = void 0 !== o && o, a = n.prevTagName, c = void 0 === a ? "" : a, u = n.nextTagName, s = void 0 === u ? "" : u, l = n.prevTagStr, p = void 0 === l ? "" : l, f = n.nextTagStr, h = void 0 === f ? "" : f, d = n.parentTag, _ = void 0 === d ? "" : d, y = n.isFirstSubTag, v = void 0 === y || y, g = n.calcLeading, b = void 0 !== g && g, m = n.leadingSpace, O = void 0 === m ? "" : m, T = n.layer, S = void 0 === T ? 1 : T, x = n.noWrap, j = void 0 !== x && x, w = n.match, P = void 0 === w ? null : w, M = n.indentSpace, C = void 0 === M ? "" : M, N = n.language, E = void 0 === N ? "" : N, L = n.count, k = void 0 === L ? 1 : L, A = n.tableColumnCount, V = void 0 === A ? 0 : A, W = n.noExtraLine, R = void 0 !== W && W, I = n.inTable, H = void 0 !== I && I; if ( ((this.tagName = e), (this.rawStr = t), (this.parentTag = _), (this.prevTagName = c), (this.nextTagName = s), (this.prevTagStr = p), (this.nextTagStr = h), (this.isFirstSubTag = v), (this.calcLeading = b), (this.leadingSpace = O), (this.layer = S), (this.noWrap = j), (this.match = P), (this.indentSpace = C), (this.language = E), (this.count = k), (this.inTable = H), (this.tableColumnCount = V), (this.noExtraLine = R), (this.keepSpace = i), !this.__detectStr__(t, this.tagName)) ) return (this.attrs = {}), void (this.innerHTML = ""); var q = this.__fetchTagAttrAndInnerHTML__(t), F = q.attr, G = q.innerHTML; (this.attrs = F), (this.innerHTML = G); } return ( (t.prototype.__detectStr__ = function (t, e) { if ("<" !== t[0]) return ( console.error( "Not a valid tag, current tag name: " .concat(this.tagName, ", tag content: ") .concat(t) ), !1 ); for ( var r = "", n = !1, o = 1; o < t.length && ">" !== t[o]; o++ ) !n && /(\s|\/)/.test(t[o]) && (n = !0), n || (r += t[o]); return ( r === e || (console.warn( "Tag is not match tagName, tagName in str is " + r + ", which tagName passed from parent is " + e ), !1) ); }), (t.prototype.__fetchTagAttrAndInnerHTML__ = function (t) { for (var e = "", r = 1; r < t.length && ">" !== t[r]; r++) e += t[r]; for ( var o = t.slice(r + 1), i = "", a = -1, c = o.length - 1; c >= 0; c-- ) if ((i = o[c] + i).startsWith("</")) { i.startsWith("</" + this.tagName + ">") && (a = c); break; } -1 === a && (0, n.isSelfClosing)(this.tagName) && console.warn( "There detect a self close tag, which name is:", this.tagName ); var u = (0, n.getTagAttributes)(e); return ( this.tagName && delete u[this.tagName], { attr: u, innerHTML: o.slice(0, a) } ); }), (t.prototype.__onlyLeadingSpace__ = function (t) { t = t.trim(); for (var e = 0; e < t.length; e++) if (t[e] !== i.SINGLE) return !1; return !0; }), (t.prototype.__isEmpty__ = function (t) { return ( !this.keepSpace && (("" === t && "td" !== this.tagName) || (this.calcLeading && this.__onlyLeadingSpace__(t))) ); }), (t.prototype.getValidSubTagName = function (t) { return t; }), (t.prototype.beforeParse = function () { var t = c.default.get().tagListener; if (t) { var e = t(this.tagName, { parentTag: this.parentTag, prevTagName: this.prevTagName, nextTagName: this.nextTagName, isFirstSubTag: this.isFirstSubTag, attrs: this.attrs, innerHTML: this.innerHTML, language: this.language, match: this.match, isSelfClosing: !1, }), r = e.attrs, n = e.language, o = e.match; (this.attrs = r), "string" === typeof n && (this.language = n), "undefined" !== typeof o && (this.match = o); } return ""; }), (t.prototype.parseValidSubTag = function (t, e, r) { return new ((0, n.getTagConstructor)(e))(t, e, r).exec(); }), (t.prototype.parseOnlyString = function (t, e, r) { return new o.default(t, e, r).exec(); }), (t.prototype.afterParsed = function (t) { return t; }), (t.prototype.slim = function (t) { return this.keepSpace ? t : t.trim(); }), (t.prototype.beforeMergeSpace = function (t) { return t; }), (t.prototype.mergeSpace = function (t, e, r) { return this.keepSpace && "pre" !== this.tagName ? t.endsWith("\n") ? t : t + r.replace(/\n+/g, "\n") : e + t + r; }), (t.prototype.afterMergeSpace = function (t) { return t; }), (t.prototype.beforeReturn = function (t) { return t; }), (t.prototype.exec = function (t, e) { void 0 === t && (t = ""), void 0 === e && (e = ""); for ( var r = this.beforeParse(), o = (0, n.generateGetNextValidTag)(this.innerHTML), i = o(), c = i[0], u = i[1], s = null; "" !== u; ) { var l = o(), p = l[0], f = l[1], h = { parentTag: this.tagName, nextTagName: p, nextTagStr: f, prevTagName: s, prevTagStr: r, leadingSpace: this.leadingSpace, layer: this.layer, keepSpace: this.keepSpace, inTable: this.inTable, }, d = void 0; d = null != c ? this.parseValidSubTag(u, c, h) : this.parseOnlyString(u, c, h); var _ = this.getValidSubTagName(c); (c = p), (u = f), (null == _ && this.__isEmpty__(d)) || ((s = _), (this.isFirstSubTag = !1), (r += d)); } return ( (r = this.afterParsed(r)), (r = this.slim(r)), this.__isEmpty__(r) ? "" : ((r = this.beforeMergeSpace(r)), !this.noExtraLine && (0, a.default)(this.tagName) && this.prevTagName && !r.startsWith("\n") && !(0, a.default)(this.prevTagName) && this.parentTag && (t = "\n\n"), (r = this.mergeSpace(r, t, e)), this.noWrap && !this.keepSpace && (r = r.replace(/\s+/g, " ")), (r = this.afterMergeSpace(r)), (r = this.beforeReturn(r))) ); }), t ); })(); e.default = u; }, function (t, e, r) { Object.defineProperty(e, "__esModule", { value: !0 }), (e.shouldRenderRawInside = e.isIndependentTag = e.clearComment = e.getLanguage = e.getTableAlign = e.getTagAttributes = e.isSelfClosing = e.generateGetNextValidTag = e.getTagConstructor = e.getRealTagName = e.unescapeStr = e.extraEscape = void 0); var n = r(46); Object.defineProperty(e, "extraEscape", { enumerable: !0, get: function () { return n.extraEscape; }, }), Object.defineProperty(e, "unescapeStr", { enumerable: !0, get: function () { return n.unescapeStr; }, }); var o = r(47); e.generateGetNextValidTag = o.default; var i = r(48); e.getTagConstructor = i.default; var a = r(11); e.isSelfClosing = a.default; var c = r(51); e.getTagAttributes = c.default; var u = r(52); e.getLanguage = u.default; var s = r(53); e.clearComment = s.default; var l = r(17); e.getRealTagName = l.default; var p = r(6); e.isIndependentTag = p.default; var f = r(54); e.getTableAlign = f.default; var h = r(55); e.shouldRenderRawInside = h.default; }, function (t, e, r) { Object.defineProperty(e, "__esModule", { value: !0 }); var n = (function () { function t(t) { var e = void 0 === t ? {} : t, r = e.skipTags, n = void 0 === r ? [] : r, o = e.emptyTags, i = void 0 === o ? [] : o, a = e.ignoreTags, c = void 0 === a ? [] : a, u = e.aliasTags, s = void 0 === u ? {} : u, l = e.renderCustomTags, p = void 0 === l || l, f = e.tagListener, h = void 0 === f ? function (t, e) { return e; } : f; this.options = { skipTags: n, emptyTags: i, ignoreTags: c, aliasTags: s, renderCustomTags: p, tagListener: h, }; } return ( (t.prototype.get = function () { return this.options; }), (t.prototype.clear = function () { this.options = {}; }), (t.prototype.set = function (t, e) { var r = this; t && "[object Object]" === Object.prototype.toString.call(t) && Object.keys(t).forEach(function (n) { e ? (r.options[n] = t[n]) : (function (t, e, r) { if (!(r in t)) return void (t[r] = e[r]); var n = Array.isArray(t[r]), o = "[object Object]" === Object.prototype.toString.call(t[r]); t[r] = n ? t[r].concat(e[r]) : o ? Object.assign(t[r], e[r]) : e[r]; })(r.options, t, n); }); }), (t.prototype.reset = function () { (this.options = JSON.parse(JSON.stringify(o))), (this.options.tagListener = function (t, e) { return e; }); }), t ); })(); var o = { ignoreTags: [ "", "style", "head", "!doctype", "form", "svg", "noscript", "script", "meta", ], skipTags: [ "div", "html", "body", "nav", "section", "footer", "main", "aside", "article", "header", ], emptyTags: [], aliasTags: { figure: "p", dl: "p", dd: "p", dt: "p", figcaption: "p", }, renderCustomTags: !0, }, i = new n(); i.reset(), (e.default = i); }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r) { void 0 === r && (r = "h1"); var n = t.call(this, e, r) || this; return (n.match = "#"), n; } return ( n(e, t), (e.prototype.beforeMergeSpace = function (t) { return this.match + " " + t; }), (e.prototype.exec = function (e, r) { return ( e || (e = "\n"), r || (r = "\n"), t.prototype.exec.call(this, e, r) ); }), e ); })(r(0).default); e.default = o; }, function (t, e, r) { Object.defineProperty(e, "__esModule", { value: !0 }); var n = r(1), o = r(2), i = (function () { function t(t, e, r) { var n = void 0 === r ? {} : r, o = n.parentTag, i = void 0 === o ? "" : o, a = n.leadingSpace, c = void 0 === a ? "" : a, u = n.layer, s = void 0 === u ? 1 : u, l = n.isFirstSubTag, p = void 0 !== l && l, f = n.inTable, h = void 0 !== f && f, d = n.match, _ = void 0 === d ? null : d, y = n.prevTagName, v = void 0 === y ? "" : y, g = n.nextTagName, b = void 0 === g ? "" : g; if ( ((this.tagName = e), (this.rawStr = t), (this.parentTag = i), (this.isFirstSubTag = p), (this.prevTagName = v), (this.nextTagName = b), (this.leadingSpace = c), (this.layer = s), (this.innerHTML = ""), (this.match = _), (this.inTable = h), this.__detectStr__(t, this.tagName)) ) { var m = this.__fetchTagAttr__(t).attr; this.attrs = m; } else this.attrs = {}; } return ( (t.prototype.__detectStr__ = function (t, e) { if ("<" !== t[0]) return ( console.error( "Not a valid tag, current tag name: " .concat(this.tagName, ", tag content: ") .concat(t) ), !1 ); for ( var r = "", n = !1, o = 1; o < t.length && ">" !== t[o]; o++ ) !n && /(\s|\/)/.test(t[o]) && (n = !0), n || (r += t[o]); return ( r === e || (console.warn( "Tag is not match tagName, tagName in str is " + r + ", which tagName passed from parent is " + e ), !1) ); }), (t.prototype.__fetchTagAttr__ = function (t) { for (var e = "", r = 1; r < t.length && ">" !== t[r]; r++) e += t[r]; return { attr: (0, n.getTagAttributes)(e) }; }), (t.prototype.beforeParse = function () { var t = o.default.get().tagListener; if (t) { var e = t(this.tagName, { parentTag: this.parentTag, prevTagName: this.prevTagName, nextTagName: this.nextTagName, isFirstSubTag: this.isFirstSubTag, attrs: this.attrs, innerHTML: this.innerHTML, match: this.match, isSelfClosing: !0, }), r = e.attrs, n = e.match; (this.attrs = r), (this.match = n); } return ""; }), (t.prototype.beforeMergeSpace = function (t) { return t; }), (t.prototype.afterMergeSpace = function (t) { return t; }), (t.prototype.beforeReturn = function (t) { return t; }), (t.prototype.exec = function (t, e) { void 0 === t && (t = ""), void 0 === e && (e = ""); var r = this.beforeParse(); return ( (r = t + (r = this.beforeMergeSpace(r)) + e), (r = this.afterMergeSpace(r)), (r = this.beforeReturn(r)) ); }), t ); })(); e.default = i; }, function (t, e, r) { Object.defineProperty(e, "__esModule", { value: !0 }); var n = (function () { function t() {} return ( (t.prototype.exec = function () { return ""; }), t ); })(); e.default = n; }, function (t, e, r) { Object.defineProperty(e, "__esModule", { value: !0 }); var n = r(17), o = { html: !0, body: !0, p: !0, div: !0, pre: !0, section: !0, blockquote: !0, aside: !0, li: !0, ul: !0, ol: !0, form: !0, hr: !0, h1: !0, h2: !0, h3: !0, h4: !0, h5: !0, h6: !0, dl: !0, dd: !0, dt: !0, br: !0, }; e.default = function (t) { if (!t) return !1; var e = (0, n.default)(t); return !!e && !!o[e]; }; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(), o = (this && this.__assign) || function () { return (o = Object.assign || function (t) { for (var e, r = 1, n = arguments.length; r < n; r++) for (var o in (e = arguments[r])) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]); return t; }).apply(this, arguments); }; Object.defineProperty(e, "__esModule", { value: !0 }), (e.__EmptySelfClose__ = e.__Empty__ = void 0); var i = r(0), a = r(4), c = (function (t) { function e(e, r, n) { return ( void 0 === r && (r = "__empty__"), t.call(this, e, r, n) || this ); } return ( n(e, t), (e.prototype.slim = function (t) { return t; }), (e.prototype.parseValidSubTag = function (t, r, n) { return new e(t, r, o({}, n)).exec(); }), (e.prototype.parseOnlyString = function (t, e, r) { return t; }), (e.prototype.exec = function () { return t.prototype.exec.call(this, "", ""); }), e ); })(i.default); e.__Empty__ = c; var u = (function (t) { function e(e, r) { void 0 === r && (r = "__emptyselfclose__"); var n = t.call(this, e, r) || this; return (n.tagName = r), n; } return ( n(e, t), (e.prototype.exec = function () { return t.prototype.exec.call(this, "", ""); }), e ); })(a.default); e.__EmptySelfClose__ = u; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }), (e.__SkipSelfClose__ = e.__Skip__ = void 0); var o = r(0), i = r(4), a = r(1), c = (function (t) { function e(e, r, n) { void 0 === r && (r = "__skip__"); var o = t.call(this, e, r, n) || this; return (o.noNeedWrap = ["td", "th"]), o; } return ( n(e, t), (e.prototype.exec = function () { var e = (0, a.isIndependentTag)( (0, a.getRealTagName)(this.tagName) ) && (!this.parentTag || !this.noNeedWrap.includes(this.parentTag)), r = e ? "\n" : "", n = e ? "\n" : ""; return t.prototype.exec.call(this, r, n); }), e ); })(o.default); e.__Skip__ = c; var u = (function (t) { function e(e, r, n) { return ( void 0 === r && (r = "__skipselfclose__"), t.call(this, e, r, n) || this ); } return ( n(e, t), (e.prototype.exec = function () { return ""; }), e ); })(i.default); e.__SkipSelfClose__ = u; }, function (t, e, r) { Object.defineProperty(e, "__esModule", { value: !0 }); var n = r(1), o = r(6), i = (function () { function t(t, e, r) { void 0 === e && (e = "__nomatch__"); var n = void 0 === r ? {} : r, o = n.keepSpace, i = void 0 !== o && o, a = n.prevTagName, c = void 0 === a ? "" : a, u = n.nextTagName, s = void 0 === u ? "" : u, l = n.parentTag, p = void 0 === l ? "" : l, f = n.calcLeading, h = void 0 !== f && f, d = n.layer, _ = void 0 === d ? 1 : d, y = n.leadingSpace, v = void 0 === y ? "" : y, g = n.inTable, b = void 0 !== g && g; (this.tagName = e), (this.nextTagName = s), (this.prevTagName = c), (this.parentTag = p), (this.keepSpace = i), (this.calcLeading = h), (this.leadingSpace = v), (this.layer = _), (this.rawStr = t), (this.inTable = b); } return ( (t.prototype.slim = function (t) { if (this.keepSpace) return t; var e = t.replace(/\s+/g, " "); return ( (0, o.default)(this.prevTagName) && (e = e.trimLeft()), (0, o.default)(this.nextTagName) && (e = e.trimRight()), e ); }), (t.prototype.beforeReturn = function (t) { if (this.keepSpace) return t; if (this.calcLeading) return this.leadingSpace + (0, n.extraEscape)(t); var e = (0, n.extraEscape)(t); return this.inTable && (e = e.replace(/\|/g, "\\|")), e; }), (t.prototype.exec = function () { var t = this.rawStr; return (t = this.slim(t)), (t = this.beforeReturn(t)); }), t ); })(); e.default = i; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }), (e.__NoMatchSelfClose__ = e.__NoMatch__ = void 0); var o = r(0), i = r(4), a = (function (t) { function e(e, r) { return ( void 0 === r && (r = "__nomatch__"), t.call(this, e, r) || this ); } return ( n(e, t), (e.prototype.beforeMergeSpace = function (t) { return "<" .concat(this.tagName, ">") .concat(t, "</") .concat(this.tagName, ">"); }), (e.prototype.exec = function () { return t.prototype.exec.call(this, "", ""); }), e ); })(o.default); e.__NoMatch__ = a; var c = (function (t) { function e(e, r) { return ( void 0 === r && (r = "__nomatchselfclose__"), t.call(this, e, r) || this ); } return ( n(e, t), (e.prototype.exec = function () { return "<".concat(this.tagName, " />"); }), e ); })(i.default); e.__NoMatchSelfClose__ = c; }, function (t, e, r) { Object.defineProperty(e, "__esModule", { value: !0 }); var n = { img: !0, hr: !0, input: !0, br: !0, meta: !0, link: !0, "!doctype": !0, base: !0, col: !0, area: !0, param: !0, object: !0, embed: !0, keygen: !0, source: !0, }; e.default = function (t) { return null != t && !!n[t.toLowerCase()]; }; }, function (t, e, r) { Object.defineProperty(e, "__esModule", { value: !0 }), (e.TRIPLE = e.DOUBLE = e.SINGLE = void 0); e.SINGLE = "\u2608"; e.DOUBLE = "\u2608\u2608"; e.TRIPLE = "\u2608\u2608\u2608"; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r, n) { void 0 === r && (r = "strong"); var o = t.call(this, e, r, n) || this; return (o.layer = 1), (o.match = o.match || "**"), o; } return ( n(e, t), (e.prototype.beforeMergeSpace = function (t) { return this.match + t + this.match; }), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = ""), void 0 === r && (r = ""), null != this.match && this.prevTagStr && !this.prevTagStr.endsWith("\\" + this.match[0]) && this.prevTagStr.endsWith(this.match[0]) && (e = " "), t.prototype.exec.call(this, e, r) ); }), e ); })(r(0).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r) { void 0 === r && (r = "del"); var n = t.call(this, e, r) || this; return (n.match = n.match || "~~"), n; } return ( n(e, t), (e.prototype.beforeMergeSpace = function (t) { return this.match + t + this.match; }), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = ""), void 0 === r && (r = ""), t.prototype.exec.call(this, e, r) ); }), e ); })(r(0).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r, n) { void 0 === r && (r = "em"); var o = t.call(this, e, r, n) || this; return (o.match = o.match || "*"), o; } return ( n(e, t), (e.prototype.beforeMergeSpace = function (t) { return this.match + t + this.match; }), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = ""), void 0 === r && (r = ""), "strong" === this.parentTag && this.nextTagStr && (r = " "), null != this.match && this.prevTagStr && !this.prevTagStr.endsWith("\\" + this.match) && this.prevTagStr.endsWith(this.match) && (e = " "), t.prototype.exec.call(this, e, r) ); }), e ); })(r(0).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r, n) { void 0 === r && (r = "th"); var o = t.call(this, e, r, n) || this; return (o.tagName = r), o; } return ( n(e, t), (e.prototype.beforeMergeSpace = function (t) { return t + "|"; }), (e.prototype.parseValidSubTag = function (e, r, n) { return "ul" === r || "ol" === r || "table" === r || "pre" === r ? e.replace(/([\n\r])/g, "") : t.prototype.parseValidSubTag.call(this, e, r, n); }), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = ""), void 0 === r && (r = ""), t.prototype.exec.call(this, e, r) ); }), e ); })(r(0).default); e.default = o; }, function (t, e, r) { Object.defineProperty(e, "__esModule", { value: !0 }); var n = r(2); e.default = function (t) { if (!t) return t; var e = n.default.get().aliasTags; return null != (null === e || void 0 === e ? void 0 : e[t]) ? e[t] : t; }; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r, n) { return void 0 === r && (r = "a"), t.call(this, e, r, n) || this; } return ( n(e, t), (e.prototype.beforeMergeSpace = function (t) { var e = this.attrs, r = e.href, n = e.title, o = r || ""; return n ? "[".concat(t, "](").concat(o, ' "').concat(n, '")') : "[".concat(t, "](").concat(o, ")"); }), (e.prototype.parseOnlyString = function (e, r, n) { return "tbody" === this.parentTag || "thead" === this.parentTag ? e : t.prototype.parseOnlyString.call(this, e, r, n); }), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = ""), void 0 === r && (r = ""), t.prototype.exec.call(this, e, r) ); }), e ); })(r(0).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r, n) { return void 0 === r && (r = "b"), t.call(this, e, r, n) || this; } return ( n(e, t), (e.prototype.exec = function (e, r) { return t.prototype.exec.call(this, e, r); }), e ); })(r(13).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(), o = (this && this.__assign) || function () { return (o = Object.assign || function (t) { for (var e, r = 1, n = arguments.length; r < n; r++) for (var o in (e = arguments[r])) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]); return t; }).apply(this, arguments); }; Object.defineProperty(e, "__esModule", { value: !0 }); var i = r(6), a = r(0), c = r(1), u = (function (t) { function e(e, r, n) { void 0 === r && (r = "blockquote"); var o = t.call(this, e, r, n) || this; return ( (o.match = o.match || ">"), (o.fillPerLine = o.fillPerLine.bind(o)), o ); } return ( n(e, t), (e.prototype.beforeMergeSpace = function (t) { if ("" === t.trim()) return ""; var e = this.match + " " + t; return this.calcLeading ? this.leadingSpace + e : e; }), (e.prototype.afterMergeSpace = function (t) { for ( var e = this, r = t.split("\n"), n = r.length - 1; n >= 0; n-- ) n < r.length - 1 && ">" === r[n].trim() && ">" === r[n + 1].trim() && r.splice(n, 1); return (r = r.map(function (t) { return "" === t ? "" : e.fillPerLine(t); })).join("\n"); }), (e.prototype.beforeReturn = function (t) { return t.replace("\n\n", "\n"); }), (e.prototype.fillPerLine = function (t) { var e = ">"; if ( (this.calcLeading && (e = this.leadingSpace + ">"), !t.startsWith(e)) ) { var r = this.match + " " + t; return this.calcLeading ? this.leadingSpace + r : r; } return t; }), (e.prototype.parseValidSubTag = function (t, e, r) { var n; "blockquote" === e ? (n = new ((0, c.getTagConstructor)(e))( t, e, o(o({}, r), { calcLeading: this.calcLeading, match: this.match + ">", noExtraLine: !0, }) )) : (n = new ((0, c.getTagConstructor)(e))( t, e, o(o({}, r), { noExtraLine: !0 }) )); var a = n.exec(), u = ""; this.calcLeading && (u = this.leadingSpace); var s = (0, i.default)(r.prevTagName) && "br" !== r.prevTagName, l = (0, i.default)(r.nextTagName) && "br" !== r.nextTagName, p = (0, i.default)(e) && "br" !== e; return this.isFirstSubTag ? a.trimLeft().replace(u, "") : p ? ((a = u + this.match + a), s || (a = "\n" + a), !l && r.nextTagStr && r.nextTagStr.trim() && (a += this.match + "\n"), a) : s ? u + this.match + "\n" + a : a; }), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = "\n"), void 0 === r && (r = "\n"), t.prototype.exec.call(this, e, r) ); }), e ); })(a.default); e.default = u; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r, n) { return void 0 === r && (r = "b"), t.call(this, e, r, n) || this; } return ( n(e, t), (e.prototype.exec = function (t, e) { return void 0 === e && (e = "\n"), this.inTable ? "" : " " + e; }), e ); })(r(4).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(), o = (this && this.__assign) || function () { return (o = Object.assign || function (t) { for (var e, r = 1, n = arguments.length; r < n; r++) for (var o in (e = arguments[r])) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]); return t; }).apply(this, arguments); }; Object.defineProperty(e, "__esModule", { value: !0 }); var i = r(0), a = r(1), c = (function (t) { function e(e, r, n) { void 0 === r && (r = "code"); var o = t.call(this, e, r, n) || this; return ( (o.match = null == o.match ? "`" : o.match), (o.noWrap = "`" === o.match), (o.layer = 1), o ); } return ( n(e, t), (e.prototype.beforeMergeSpace = function (t) { var e, r; return ( "" !== this.match && "`" !== this.match ? ((e = this.match + " "), (r = " " + this.match)) : ((e = this.match), (r = this.match)), e + t + r ); }), (e.prototype.parseValidSubTag = function (t, e, r) { return "pre" === e ? new ((0, a.getTagConstructor)(e))( t, e, o(o({}, r), { language: "", match: "" }) ).exec("", "\n") : new ((0, a.getTagConstructor)(e))( t, e, o(o({}, r), { keepSpace: this.keepSpace, noWrap: this.noWrap, }) ).exec("", ""); }), (e.prototype.parseOnlyString = function (t) { if ("" !== this.match && t) { var e = 1; (t.startsWith("`") || t.endsWith("`")) && ((e = 2), (t.startsWith("``") || t.endsWith("``")) && (e = 3)), (this.match = "`".repeat(e)); } return (0, a.unescapeStr)(t); }), (e.prototype.slim = function (t) { return this.keepSpace ? t : t.trim(); }), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = ""), void 0 === r && (r = ""), t.prototype.exec.call(this, e, r) ); }), e ); })(i.default); e.default = c; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r) { void 0 === r && (r = "h1"); var n = t.call(this, e, r) || this; return (n.match = "#"), n; } return ( n(e, t), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = "\n"), void 0 === r && (r = "\n"), t.prototype.exec.call(this, e, r) ); }), e ); })(r(3).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r) { void 0 === r && (r = "h2"); var n = t.call(this, e, r) || this; return (n.match = "##"), n; } return ( n(e, t), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = "\n"), void 0 === r && (r = "\n"), t.prototype.exec.call(this, e, r) ); }), e ); })(r(3).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r) { void 0 === r && (r = "h3"); var n = t.call(this, e, r) || this; return (n.match = "###"), n; } return ( n(e, t), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = "\n"), void 0 === r && (r = "\n"), t.prototype.exec.call(this, e, r) ); }), e ); })(r(3).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r) { void 0 === r && (r = "h4"); var n = t.call(this, e, r) || this; return (n.match = "####"), n; } return ( n(e, t), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = "\n"), void 0 === r && (r = "\n"), t.prototype.exec.call(this, e, r) ); }), e ); })(r(3).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r) { void 0 === r && (r = "h5"); var n = t.call(this, e, r) || this; return (n.match = "#####"), n; } return ( n(e, t), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = "\n"), void 0 === r && (r = "\n"), t.prototype.exec.call(this, e, r) ); }), e ); })(r(3).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r) { void 0 === r && (r = "h6"); var n = t.call(this, e, r) || this; return (n.match = "######"), n; } return ( n(e, t), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = "\n"), void 0 === r && (r = "\n"), t.prototype.exec.call(this, e, r) ); }), e ); })(r(3).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r, n) { void 0 === r && (r = "hr"); var o = t.call(this, e, r, n) || this; return (o.match = "---"), o; } return ( n(e, t), (e.prototype.beforeMergeSpace = function () { return this.leadingSpace + this.match; }), (e.prototype.beforeReturn = function (t) { return ( t.replace(/^(?:\n\s*)/, "\n\n").replace(/(?:\n\s*)$/, "\n\n"), t ); }), (e.prototype.exec = function (e, r) { return ( void 0 === e && (e = "\n"), void 0 === r && (r = "\n"), t.prototype.exec.call(this, e, r) ); }), e ); })(r(4).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r, n) { return void 0 === r && (r = "i"), t.call(this, e, r, n) || this; } return ( n(e, t), (e.prototype.exec = function (e, r) { return t.prototype.exec.call(this, e, r); }), e ); })(r(15).default); e.default = o; }, function (t, e, r) { var n = (this && this.__extends) || (function () { var t = function (e, r) { return (t = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; }) || function (t, e) { for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); })(e, r); }; return function (e, r) { if ("function" !== typeof r && null !== r) throw new TypeError( "Class extends value " + String(r) + " is not a constructor or null" ); function n() { this.constructor = e; } t(e, r), (e.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n())); }; })(); Object.defineProperty(e, "__esModule", { value: !0 }); var o = (function (t) { function e(e, r, n) { return void 0 === r && (r = "