webhook/node_modules/prettier/parser-markdown.js

20 lines
147 KiB
JavaScript
Raw Normal View History

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).prettierPlugins=e.prettierPlugins||{},e.prettierPlugins.markdown=t())}(this,(function(){"use strict";var e=function(){for(var e={},r=0;r<arguments.length;r++){var n=arguments[r];for(var u in n)t.call(n,u)&&(e[u]=n[u])}return e},t=Object.prototype.hasOwnProperty;function r(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}function n(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u=Object.freeze({__proto__:null,default:{}}),i=r((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),o=n(u),a=r((function(e){try{var t=o;if("function"!=typeof t.inherits)throw"";e.exports=t.inherits}catch(t){e.exports=i}})),c=function(t){var r,n,u;for(n in a(o,t),a(i,o),r=o.prototype)(u=r[n])&&"object"==typeof u&&(r[n]="concat"in u?u.concat():e(u));return o;function i(e){return t.apply(this,e)}function o(){return this instanceof o?t.apply(this,arguments):new i(arguments)}};var s=function(e,t,r){return function(){var n=r||this,u=n[e];return n[e]=!t,i;function i(){n[e]=u}}};var l=function(e){var t=function(e){var t=[],r=e.indexOf("\n");for(;-1!==r;)t.push(r+1),r=e.indexOf("\n",r+1);return t.push(e.length+1),t}(String(e));return{toPosition:f(t),toOffset:D(t)}};function f(e){return function(t){var r=-1,n=e.length;if(t<0)return{};for(;++r<n;)if(e[r]>t)return{line:r+1,column:t-(e[r-1]||0)+1,offset:t};return{}}}function D(e){return function(t){var r=t&&t.line,n=t&&t.column;if(!isNaN(r)&&!isNaN(n)&&r-1 in e)return(e[r-2]||0)+n-1||0;return-1}}var p=function(e,t){return function(r){var n,u=0,i=r.indexOf(d),o=e[t],a=[];for(;-1!==i;)a.push(r.slice(u,i)),u=i+1,(n=r.charAt(u))&&-1!==o.indexOf(n)||a.push(d),i=r.indexOf(d,u+1);return a.push(r.slice(u)),a.join("")}},d="\\";var h={AElig:"\xc6",AMP:"&",Aacute:"\xc1",Acirc:"\xc2",Agrave:"\xc0",Aring:"\xc5",Atilde:"\xc3",Auml:"\xc4",COPY:"\xa9",Ccedil:"\xc7",ETH:"\xd0",Eacute:"\xc9",Ecirc:"\xca",Egrave:"\xc8",Euml:"\xcb",GT:">",Iacute:"\xcd",Icirc:"\xce",Igrave:"\xcc",Iuml:"\xcf",LT:"<",Ntilde:"\xd1",Oacute:"\xd3",Ocirc:"\xd4",Ograve:"\xd2",Oslash:"\xd8",Otilde:"\xd5",Ouml:"\xd6",QUOT:'"',REG:"\xae",THORN:"\xde",Uacute:"\xda",Ucirc:"\xdb",Ugrave:"\xd9",Uuml:"\xdc",Yacute:"\xdd",aacute:"\xe1",acirc:"\xe2",acute:"\xb4",aelig:"\xe6",agrave:"\xe0",amp:"&",aring:"\xe5",atilde:"\xe3",auml:"\xe4",brvbar:"\xa6",ccedil:"\xe7",cedil:"\xb8",cent:"\xa2",copy:"\xa9",curren:"\xa4",deg:"\xb0",divide:"\xf7",eacute:"\xe9",ecirc:"\xea",egrave:"\xe8",eth:"\xf0",euml:"\xeb",frac12:"\xbd",frac14:"\xbc",frac34:"\xbe",gt:">",iacute:"\xed",icirc:"\xee",iexcl:"\xa1",igrave:"\xec",iquest:"\xbf",iuml:"\xef",laquo:"\xab",lt:"<",macr:"\xaf",micro:"\xb5",middot:"\xb7",nbsp:"\xa0",not:"\xac",ntilde:"\xf1",oacute:"\xf3",ocirc:"\xf4",ograve:"\xf2",ordf:"\xaa",ordm:"\xba",oslash:"\xf8",otilde:"\xf5",ouml:"\xf6",para:"\xb6",plusmn:"\xb1",pound:"\xa3",quot:'"',raquo:"\xbb",reg:"\xae",sect:"\xa7",shy:"\xad",sup1:"\xb9",sup2:"\xb2",sup3:"\xb3",szlig:"\xdf",thorn:"\xfe",times:"\xd7",uacute:"\xfa",ucirc:"\xfb",ugrave:"\xf9",uml:"\xa8",uuml:"\xfc",yacute:"\xfd",yen:"\xa5",yuml:"\xff"},g={0:"\ufffd",128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"},m=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=48&&t<
/*!
* repeat-string <https://github.com/jonschlinkert/repeat-string>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/;var me,Ee="",Ce=function(e,t){if("string"!=typeof e)throw new TypeError("expected a string");if(1===t)return e;if(2===t)return e+e;var r=e.length*t;if(me!==e||void 0===me)me=e,Ee="";else if(Ee.length>=r)return Ee.substr(0,r);for(;r>Ee.length&&t>1;)1&t&&(Ee+=e),t>>=1,e+=e;return Ee=(Ee+=e).substr(0,r)};var be=function(e){var t=String(e),r=t.length;for(;"\n"===t.charAt(--r););return t.slice(0,r+1)};var ve=function(e,t,r){var n,u,i,o=-1,a=t.length,c="",s="",l="",f="";for(;++o<a;)if(n=t.charAt(o),i)if(i=!1,c+=l,s+=f,l="",f="","\n"===n)l=n,f=n;else for(c+=n,s+=n;++o<a;){if(!(n=t.charAt(o))||"\n"===n){f=n,l=n;break}c+=n,s+=n}else if(" "===n&&t.charAt(o+1)===n&&t.charAt(o+2)===n&&t.charAt(o+3)===n)l+=Fe,o+=3,i=!0;else if("\t"===n)l+=n,i=!0;else{for(u="";"\t"===n||" "===n;)u+=n,n=t.charAt(++o);if("\n"!==n)break;l+=u+n,f+=n}if(s)return!!r||e(c)({type:"code",lang:null,meta:null,value:be(s)})},Fe=Ce(" ",4);var Ae=function(e,t,r){var n,u,i,o,a,c,s,l,f,D,p,d,h,g=this,m=g.options.gfm,E=t.length+1,C=0,b="";if(!m)return;for(;C<E&&((i=t.charAt(C))===ke||i===we);)b+=i,C++;if(d=C,"~"!==(i=t.charAt(C))&&"`"!==i)return;C++,u=i,n=1,b+=i;for(;C<E&&(i=t.charAt(C))===u;)b+=i,n++,C++;if(n<3)return;for(;C<E&&((i=t.charAt(C))===ke||i===we);)b+=i,C++;o="",s="";for(;C<E&&(i=t.charAt(C))!==ye&&("`"!==u||i!==u);)i===ke||i===we?s+=i:(o+=s+i,s=""),C++;if((i=t.charAt(C))&&i!==ye)return;if(r)return!0;(h=e.now()).column+=b.length,h.offset+=b.length,b+=o,o=g.decode.raw(g.unescape(o),h),s&&(b+=s);s="",D="",p="",l="",f="";var v=!0;for(;C<E;)if(i=t.charAt(C),l+=D,f+=p,D="",p="",i===ye){for(v?(b+=i,v=!1):(D+=i,p+=i),s="",C++;C<E&&(i=t.charAt(C))===ke;)s+=i,C++;if(D+=s,p+=s.slice(d),!(s.length>=4)){for(s="";C<E&&(i=t.charAt(C))===u;)s+=i,C++;if(D+=s,p+=s,!(s.length<n)){for(s="";C<E&&((i=t.charAt(C))===ke||i===we);)D+=i,p+=i,C++;if(!i||i===ye)break}}}else l+=i,p+=i,C++;b+=l+D,C=-1,E=o.length;for(;++C<E;)if((i=o.charAt(C))===ke||i===we)a||(a=o.slice(0,C));else if(a){c=o.slice(C);break}return e(b)({type:"code",lang:a||o||null,meta:c||null,value:f})},ye="\n",we="\t",ke=" ";var xe=r((function(e,t){(t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}})),Oe=function(e,t,r,n){var u,i,o=e.length,a=-1;for(;++a<o;)if(u=e[a],(void 0===(i=u[1]||{}).pedantic||i.pedantic===r.options.pedantic)&&(void 0===i.commonmark||i.commonmark===r.options.commonmark)&&t[u[0]].apply(r,n))return!0;return!1};var Le=function(e,t,r){var n,u,i,o,a,c,s,l,f,D=this,p=D.offset,d=D.blockTokenizers,h=D.interruptBlockquote,g=e.now(),m=g.line,E=t.length,C=[],b=[],v=[],F=0;for(;F<E&&(" "===(u=t.charAt(F))||"\t"===u);)F++;if(">"!==t.charAt(F))return;if(r)return!0;F=0;for(;F<E;){for(o=t.indexOf("\n",F),s=F,l=!1,-1===o&&(o=E);F<E&&(" "===(u=t.charAt(F))||"\t"===u);)F++;if(">"===t.charAt(F)?(F++,l=!0," "===t.charAt(F)&&F++):F=s,a=t.slice(F,o),!l&&!xe(a)){F=s;break}if(!l&&(i=t.slice(F),Oe(h,d,D,[e,i,!0])))break;c=s===F?a:t.slice(s,o),v.push(F-s),C.push(c),b.push(a),F=o+1}F=-1,E=v.length,n=e(C.join("\n"));for(;++F<E;)p[m]=(p[m]||0)+v[F],m++;return f=D.enterBlock(),b=D.tokenizeBlock(b.join("\n"),g),f(),n({type:"blockquote",children:b})};var Be=function(e,t,r){var n,u,i,o=this.options.pedantic,a=t.length+1,c=-1,s=e.now(),l="",f="";for(;++c<a;){if((n=t.charAt(c))!==Ne&&n!==Te){c--;break}l+=n}i=0;for(;++c<=a;){if((n=t.charAt(c))!==Se){c--;break}l+=n,i++}if(i>6)return;if(!i||!o&&t.charAt(c+1)===Se)return;a=t.length+1,u="";for(;++c<a;){if((n=t.charAt(c))!==Ne&&n!==Te){c--;break}u+=n}if(!o&&0===u.length&&n&&"\n"!==n)return;if(r)return!0;l+=u,u="",f="";for(;++c<a&&(n=t.charAt(c))&&"\n"!==n;)if(n===Ne||n===Te||n===Se){for(;n===Ne||n===Te;)u+=n,n=t.charAt(++c);if(o||!f||u||n!==Se){for(;n===Se;)u+=n,n=t.charAt(++c);for(;n===Ne||n===Te;)u+=n,n=t.charAt(++c);c--}else f+=n}else f+=u+n,u="";return s.column+=l.length,s.offset+=l.length,e(l+=f+u)({type:"heading",depth:i,children:this.tokenizeInline(f,s)})},Te="\t",Ne=" ",Se="#";var Ie=function(e,t,r){var n,u,i,o,a=-1,c=t.length+1,s="";for(;++a<c&&("\t"===(n=t.charAt(a)
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/;var Pr=Object.prototype.hasOwnProperty,jr=Object.prototype.toString,zr=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,Mr=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===jr.call(e)},Gr=function(e){if(!e||"[object Object]"!==jr.call(e))return!1;var t,r=Pr.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&Pr.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;for(t in e);return void 0===t||Pr.call(e,t)},Vr=function(e,t){zr&&"__proto__"===t.name?zr(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},_r=function(e,t){if("__proto__"===t){if(!Pr.call(e,t))return;if(Ur)return Ur(e,t).value}return e[t]},$r=function e(){var t,r,n,u,i,o,a=arguments[0],c=1,s=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[1]||{},c=2),(null==a||"object"!=typeof a&&"function"!=typeof a)&&(a={});c<s;++c)if(null!=(t=arguments[c]))for(r in t)n=_r(a,r),a!==(u=_r(t,r))&&(l&&u&&(Gr(u)||(i=Mr(u)))?(i?(i=!1,o=n&&Mr(n)?n:[]):o=n&&Gr(n)?n:{},Vr(a,{name:r,newValue:e(l,o,u)})):void 0!==u&&Vr(a,{name:r,newValue:u}));return a},Hr=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},Xr=[].slice,Wr=function(e,t){var r;return function(){var t,i=Xr.call(arguments,0),o=e.length>i.length;o&&i.push(n);try{t=e.apply(null,i)}catch(e){if(o&&r)throw e;return n(e)}o||(t&&"function"==typeof t.then?t.then(u,n):t instanceof Error?n(t):u(t))};function n(){r||(r=!0,t.apply(null,arguments))}function u(e){n(null,e)}};var Yr=Jr;Jr.wrap=Wr;var Zr=[].slice;function Jr(){var e=[],t={run:function(){var t=-1,r=Zr.call(arguments,0,-1),n=arguments[arguments.length-1];if("function"!=typeof n)throw new Error("Expected function as last argument, not "+n);function u(i){var o=e[++t],a=Zr.call(arguments,0),c=a.slice(1),s=r.length,l=-1;if(i)n(i);else{for(;++l<s;)null!==c[l]&&void 0!==c[l]||(c[l]=r[l]);r=c,o?Wr(o,u).apply(null,r):n.apply(null,[null].concat(r))}}u.apply(null,[null].concat(r))},use:function(r){if("function"!=typeof r)throw new Error("Expected `fn` to be a function, not "+r);return e.push(r),t}};return t}var Kr={}.hasOwnProperty,Qr=function(e){if(!e||"object"!=typeof e)return"";if(Kr.call(e,"position")||Kr.call(e,"type"))return tn(e.position);if(Kr.call(e,"start")||Kr.call(e,"end"))return tn(e);if(Kr.call(e,"line")||Kr.call(e,"column"))return en(e);return""};function en(e){return e&&"object"==typeof e||(e={}),rn(e.line)+":"+rn(e.column)}function tn(e){return e&&"object"==typeof e||(e={}),en(e.start)+"-"+en(e.end)}function rn(e){return e&&"number"==typeof e?e:1}var nn=an;function un(){}un.prototype=Error.prototype,an.prototype=new un;var on=an.prototype;function an(e,t,r){var n,u,i;"string"==typeof t&&(r=t,t=null),n=function(e){var t,r=[null,null];"string"==typeof e&&(-1===(t=e.indexOf(":"))?r[1]=e:(r[0]=e.slice(0,t),r[1]=e.slice(t+1)));return r}(r),u=Qr(t)||"1:1",i={start:{line:null,column:null},end:{line:null,column:null}},t&&t.position&&(t=t.position),t&&(t.start?(i=t,t=t.start):i.start=t),e.stack&&(this.stack=e.stack,e=e.message),this.message=e,this.name=u,this.reason=e,this.line=t?t.line:null,this.column=t?t.column:null,this.location=i,this.source=n[0],this.ruleId=n[1]}on.file="",on.name="",on.reason="",on.message="",on.stack="",on.fatal=null,on.column=null,on.line=null;var cn="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function sn(){throw new Error("setTimeout has not been defined")}function ln(){throw new Error("clearTimeout has not been defined")}var fn=sn,Dn=ln;function pn(e){if(fn===setTimeout)return setTimeout(e,0);if((fn===sn||!fn)&&setTimeout)return fn=setTimeout,setTimeout(e,0);try{return fn(e,0)}catch(t){try{return fn.call(null,e,0)}catch(t){return fn.call(this,e,0)}}}"function"==typeof cn.setTimeout&&(fn=setTimeout),"function"==typeof cn.clearTimeout&&(Dn=clearTimeout);var dn,hn=[],gn=!1,mn=-1;function En(){gn&&dn&&(gn=!1,dn.length?hn=dn.concat(hn):mn=-1,hn.length&&Cn())}fu
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/function _n(e){var t,r,n;if(e){if("string"==typeof e||zn(e))e={contents:e};else if("message"in e&&"messages"in e)return e}else e={};if(!(this instanceof _n))return new _n(e);for(this.data={},this.messages=[],this.history=[],this.cwd=Nn.cwd(),r=-1,n=Vn.length;++r<n;)t=Vn[r],Mn.call(e,t)&&(this[t]=e[t]);for(t in e)-1===Vn.indexOf(t)&&(this[t]=e[t])}function $n(e,t){if(-1!==e.indexOf(Pn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Pn.sep+"`")}function Hn(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Xn(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}Gn.toString=function(e){var t=this.contents||"";return zn(t)?t.toString(e):String(t)},Object.defineProperty(Gn,"path",{get:function(){return this.history[this.history.length-1]},set:function(e){Hn(e,"path"),e!==this.path&&this.history.push(e)}}),Object.defineProperty(Gn,"dirname",{get:function(){return"string"==typeof this.path?Pn.dirname(this.path):void 0},set:function(e){Xn(this.path,"dirname"),this.path=Pn.join(e||"",this.basename)}}),Object.defineProperty(Gn,"basename",{get:function(){return"string"==typeof this.path?Pn.basename(this.path):void 0},set:function(e){Hn(e,"basename"),$n(e,"basename"),this.path=Pn.join(this.dirname||"",e)}}),Object.defineProperty(Gn,"extname",{get:function(){return"string"==typeof this.path?Pn.extname(this.path):void 0},set:function(e){var t=e||"";if($n(t,"extname"),Xn(this.path,"extname"),t){if("."!==t.charAt(0))throw new Error("`extname` must start with `.`");if(-1!==t.indexOf(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=jn(this.path,t)}}),Object.defineProperty(Gn,"stem",{get:function(){return"string"==typeof this.path?Pn.basename(this.path,this.extname):void 0},set:function(e){Hn(e,"stem"),$n(e,"stem"),this.path=Pn.join(this.dirname||"",e+(this.extname||""))}});var Wn=Un,Yn=Un.prototype;Yn.message=function(e,t,r){var n=this.path,u=new nn(e,t,r);n&&(u.name=n+":"+u.name,u.file=n);return u.fatal=!1,this.messages.push(u),u},Yn.info=function(){var e=this.message.apply(this,arguments);return e.fatal=null,e},Yn.fail=function(){var e=this.message.apply(this,arguments);throw e.fatal=!0,e};var Zn=function e(){var t=[],r=Yr(),n={},u=!1,i=-1;return o.data=function(e,t){if("string"==typeof e)return 2===arguments.length?(nu("data",u),n[e]=t,o):Kn.call(n,e)&&n[e]||null;if(e)return nu("data",u),n=e,o;return n},o.freeze=a,o.attachers=t,o.use=function(e){var r;if(nu("use",u),null==e);else if("function"==typeof e)l.apply(null,arguments);else{if("object"!=typeof e)throw new Error("Expected usable value, not `"+e+"`");"length"in e?s(e):i(e)}r&&(n.settings=$r(n.settings||{},r));return o;function i(e){s(e.plugins),e.settings&&(r=$r(r||{},e.settings))}function a(e){if("function"==typeof e)l(e);else{if("object"!=typeof e)throw new Error("Expected usable value, not `"+e+"`");"length"in e?l.apply(null,e):i(e)}}function s(e){var t,r;if(null==e);else{if("object"!=typeof e||!("length"in e))throw new Error("Expected a list of plugins, not `"+e+"`");for(t=e.length,r=-1;++r<t;)a(e[r])}}function l(e,r){var n=c(e);n?(Hr(n[1])&&Hr(r)&&(r=$r(n[1],r)),n[1]=r):t.push(Jn.call(arguments))}},o.parse=function(e){var t,r=Wn(e);if(a(),tu("parse",t=o.Parser),eu(t,"parse"))return new t(String(r),r).parse();return t(String(r),r)},o.stringify=function(e,t){var r,n=Wn(t);if(a(),ru("stringify",r=o.Compiler),uu(e),eu(r,"compile"))return new r(e,n).compile();return r(e,n)},o.run=s,o.runSync=function(e,t){var r,n=!1;return s(e,t,u),iu("runSync","run",n),r;function u(e,t){n=!0,qr(e),r=t}},o.process=l,o.processSync=f,o;function o(){for(var r=e(),u=t.length,i=-1;++i<u;)r.use.apply(null,t[i]);return r.data($r(!0,{},n)),r}function a(){var e,n,a,c;if(u)return o;for(;++i<t.length;)n=(e=t[i])[0],null,!1!==(a=e[1])&&(!0===a&&(e[1]=void 0),"function"==typeof(c=n.apply(o,e.slice(1)))&&r.use(c));return u=!0,i=1/0,o}function c(e){for(var r,n=t.length,u=-1;++u<n;)if((r=t[u])[0]===e)return r}function s(e,t,n){if(uu(e),a(),n||"function"!=typeof t||(n=t,t=null),!n)return new Promise(u);function u(u,i){r.run(e,W