=4)return!1;let s=e.src.charCodeAt(r);if(s!==35||r>=i)return!1;let o=1;for(s=e.src.charCodeAt(++r);s===35&&r6||rr&&ae(e.src.charCodeAt(c-1))&&(i=c),e.line=t+1;const l=e.push("heading_open","h"+String(o),1);l.markup="########".slice(0,o),l.map=[t,e.line];const a=e.push("inline","",0);a.content=e.src.slice(r,i).trim(),a.map=[t,e.line],a.children=[];const f=e.push("heading_close","h"+String(o),-1);return f.markup="########".slice(0,o),!0}function jg(e,t,u){const n=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const r=e.parentType;e.parentType="paragraph";let i=0,s,o=t+1;for(;o3)continue;if(e.sCount[o]>=e.blkIndent){let d=e.bMarks[o]+e.tShift[o];const p=e.eMarks[o];if(d=p))){i=s===61?1:2;break}}if(e.sCount[o]<0)continue;let h=!1;for(let d=0,p=n.length;d
3||e.sCount[i]<0)continue;let l=!1;for(let a=0,f=n.length;a=u||e.sCount[s]=i){e.line=u;break}const c=e.line;let l=!1;for(let a=0;a=e.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");e.tight=!o,e.isEmpty(e.line-1)&&(o=!0),s=e.line,s0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],r={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(r),n};cr.prototype.scanDelims=function(e,t){const u=this.posMax,n=this.src.charCodeAt(e),r=e>0?this.src.charCodeAt(e-1):32;let i=e;for(;i0)return!1;const u=e.pos,n=e.posMax;if(u+3>n||e.src.charCodeAt(u)!==58||e.src.charCodeAt(u+1)!==47||e.src.charCodeAt(u+2)!==47)return!1;const r=e.pending.match(Gg);if(!r)return!1;const i=r[1],s=e.md.linkify.matchAtStart(e.src.slice(u-i.length));if(!s)return!1;let o=s.url;if(o.length<=i.length)return!1;o=o.replace(/\*+$/,"");const c=e.md.normalizeLink(o);if(!e.md.validateLink(c))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);const l=e.push("link_open","a",1);l.attrs=[["href",c]],l.markup="linkify",l.info="auto";const a=e.push("text","",0);a.content=e.md.normalizeLinkText(o);const f=e.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return e.pos+=o.length-i.length,!0}function Jg(e,t){let u=e.pos;if(e.src.charCodeAt(u)!==10)return!1;const n=e.pending.length-1,r=e.posMax;if(!t)if(n>=0&&e.pending.charCodeAt(n)===32)if(n>=1&&e.pending.charCodeAt(n-1)===32){let i=n-1;for(;i>=1&&e.pending.charCodeAt(i-1)===32;)i--;e.pending=e.pending.slice(0,i),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(u++;u?@[]^_`{|}~-".split("").forEach(function(e){Yo[e.charCodeAt(0)]=1});function Yg(e,t){let u=e.pos;const n=e.posMax;if(e.src.charCodeAt(u)!==92||(u++,u>=n))return!1;let r=e.src.charCodeAt(u);if(r===10){for(t||e.push("hardbreak","br",0),u++;u=55296&&r<=56319&&u+1=56320&&o<=57343&&(i+=e.src[u+1],u++)}const s="\\"+i;if(!t){const o=e.push("text_special","",0);r<256&&Yo[r]!==0?o.content=i:o.content=s,o.markup=s,o.info="escape"}return e.pos=u+1,!0}function Xg(e,t){let u=e.pos;if(e.src.charCodeAt(u)!==96)return!1;const r=u;u++;const i=e.posMax;for(;u=0;n--){const r=t[n];if(r.marker!==95&&r.marker!==42||r.end===-1)continue;const i=t[r.end],s=n>0&&t[n-1].end===r.end+1&&t[n-1].marker===r.marker&&t[n-1].token===r.token-1&&t[r.end+1].token===i.token+1,o=String.fromCharCode(r.marker),c=e.tokens[r.token];c.type=s?"strong_open":"em_open",c.tag=s?"strong":"em",c.nesting=1,c.markup=s?o+o:o,c.content="";const l=e.tokens[i.token];l.type=s?"strong_close":"em_close",l.tag=s?"strong":"em",l.nesting=-1,l.markup=s?o+o:o,l.content="",s&&(e.tokens[t[n-1].token].content="",e.tokens[t[r.end+1].token].content="",n--)}}function u3(e){const t=e.tokens_meta,u=e.tokens_meta.length;Al(e,e.delimiters);for(let n=0;n=f)return!1;if(c=p,r=e.md.helpers.parseLinkDestination(e.src,p,e.posMax),r.ok){for(s=e.md.normalizeLink(r.str),e.md.validateLink(s)?p=r.pos:s="",c=p;p=f||e.src.charCodeAt(p)!==41)&&(l=!0),p++}if(l){if(typeof e.env.references>"u")return!1;if(p=0?n=e.src.slice(c,p++):p=d+1):p=d+1,n||(n=e.src.slice(h,d)),i=e.env.references[Mi(n)],!i)return e.pos=a,!1;s=i.href,o=i.title}if(!t){e.pos=h,e.posMax=d;const _=e.push("link_open","a",1),D=[["href",s]];_.attrs=D,o&&D.push(["title",o]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=p,e.posMax=f,!0}function r3(e,t){let u,n,r,i,s,o,c,l,a="";const f=e.pos,h=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const d=e.pos+2,p=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(p<0)return!1;if(i=p+1,i=h)return!1;for(l=i,o=e.md.helpers.parseLinkDestination(e.src,i,e.posMax),o.ok&&(a=e.md.normalizeLink(o.str),e.md.validateLink(a)?i=o.pos:a=""),l=i;i=h||e.src.charCodeAt(i)!==41)return e.pos=f,!1;i++}else{if(typeof e.env.references>"u")return!1;if(i=0?r=e.src.slice(l,i++):i=p+1):i=p+1,r||(r=e.src.slice(d,p)),s=e.env.references[Mi(r)],!s)return e.pos=f,!1;a=s.href,c=s.title}if(!t){n=e.src.slice(d,p);const _=[];e.md.inline.parse(n,e.md,e.env,_);const D=e.push("image","img",0),S=[["src",a],["alt",""]];D.attrs=S,D.children=_,D.content=n,c&&S.push(["title",c])}return e.pos=i,e.posMax=h,!0}const i3=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,s3=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function o3(e,t){let u=e.pos;if(e.src.charCodeAt(u)!==60)return!1;const n=e.pos,r=e.posMax;for(;;){if(++u>=r)return!1;const s=e.src.charCodeAt(u);if(s===60)return!1;if(s===62)break}const i=e.src.slice(n+1,u);if(s3.test(i)){const s=e.md.normalizeLink(i);if(!e.md.validateLink(s))return!1;if(!t){const o=e.push("link_open","a",1);o.attrs=[["href",s]],o.markup="autolink",o.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(i);const l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=i.length+2,!0}if(i3.test(i)){const s=e.md.normalizeLink("mailto:"+i);if(!e.md.validateLink(s))return!1;if(!t){const o=e.push("link_open","a",1);o.attrs=[["href",s]],o.markup="autolink",o.info="auto";const c=e.push("text","",0);c.content=e.md.normalizeLinkText(i);const l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=i.length+2,!0}return!1}function c3(e){return/^\s]/i.test(e)}function l3(e){return/^<\/a\s*>/i.test(e)}function a3(e){const t=e|32;return t>=97&&t<=122}function f3(e,t){if(!e.md.options.html)return!1;const u=e.posMax,n=e.pos;if(e.src.charCodeAt(n)!==60||n+2>=u)return!1;const r=e.src.charCodeAt(n+1);if(r!==33&&r!==63&&r!==47&&!a3(r))return!1;const i=e.src.slice(n).match($g);if(!i)return!1;if(!t){const s=e.push("html_inline","",0);s.content=i[0],c3(s.content)&&e.linkLevel++,l3(s.content)&&e.linkLevel--}return e.pos+=i[0].length,!0}const d3=/^((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,h3=/^&([a-z][a-z0-9]{1,31});/i;function p3(e,t){const u=e.pos,n=e.posMax;if(e.src.charCodeAt(u)!==38||u+1>=n)return!1;if(e.src.charCodeAt(u+1)===35){const i=e.src.slice(u).match(d3);if(i){if(!t){const s=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),o=e.push("text_special","",0);o.content=Zo(s)?si(s):si(65533),o.markup=i[0],o.info="entity"}return e.pos+=i[0].length,!0}}else{const i=e.src.slice(u).match(h3);if(i){const s=wf(i[0]);if(s!==i[0]){if(!t){const o=e.push("text_special","",0);o.content=s,o.markup=i[0],o.info="entity"}return e.pos+=i[0].length,!0}}}return!1}function vl(e){const t={},u=e.length;if(!u)return;let n=0,r=-2;const i=[];for(let s=0;sc;l-=i[l]+1){const f=e[l];if(f.marker===o.marker&&f.open&&f.end<0){let h=!1;if((f.close||o.open)&&(f.length+o.length)%3===0&&(f.length%3!==0||o.length%3!==0)&&(h=!0),!h){const d=l>0&&!e[l-1].open?i[l-1]+1:0;i[s]=s-l+d,i[l]=d,o.open=!1,f.end=s,f.close=!1,a=-1,r=-2;break}}}a!==-1&&(t[o.marker][(o.open?3:0)+(o.length||0)%3]=a)}}function m3(e){const t=e.tokens_meta,u=e.tokens_meta.length;vl(e.delimiters);for(let n=0;n0&&n++,r[t].type==="text"&&t+1=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;s||e.pos++,i[t]=e.pos};lr.prototype.tokenize=function(e){const t=this.ruler.getRules(""),u=t.length,n=e.posMax,r=e.md.options.maxNesting;for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(s){if(e.pos>=n)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};lr.prototype.parse=function(e,t,u,n){const r=new this.State(e,t,u,n);this.tokenize(r);const i=this.ruler2.getRules(""),s=i.length;for(let o=0;o|$))",t.tpl_email_fuzzy="(^|"+u+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}function Us(e){return Array.prototype.slice.call(arguments,1).forEach(function(u){u&&Object.keys(u).forEach(function(n){e[n]=u[n]})}),e}function Li(e){return Object.prototype.toString.call(e)}function _3(e){return Li(e)==="[object String]"}function y3(e){return Li(e)==="[object Object]"}function x3(e){return Li(e)==="[object RegExp]"}function Dl(e){return Li(e)==="[object Function]"}function E3(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const Bf={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function C3(e){return Object.keys(e||{}).reduce(function(t,u){return t||Bf.hasOwnProperty(u)},!1)}const k3={"http:":{validate:function(e,t,u){const n=e.slice(t);return u.re.http||(u.re.http=new RegExp("^\\/\\/"+u.re.src_auth+u.re.src_host_port_strict+u.re.src_path,"i")),u.re.http.test(n)?n.match(u.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,u){const n=e.slice(t);return u.re.no_http||(u.re.no_http=new RegExp("^"+u.re.src_auth+"(?:localhost|(?:(?:"+u.re.src_domain+")\\.)+"+u.re.src_domain_root+")"+u.re.src_port+u.re.src_host_terminator+u.re.src_path,"i")),u.re.no_http.test(n)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:n.match(u.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,u){const n=e.slice(t);return u.re.mailto||(u.re.mailto=new RegExp("^"+u.re.src_email_name+"@"+u.re.src_host_strict,"i")),u.re.mailto.test(n)?n.match(u.re.mailto)[0].length:0}}},S3="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",A3="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function v3(e){e.__index__=-1,e.__text_cache__=""}function D3(e){return function(t,u){const n=t.slice(u);return e.test(n)?n.match(e)[0].length:0}}function Tl(){return function(e,t){t.normalize(e)}}function oi(e){const t=e.re=g3(e.__opts__),u=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||u.push(S3),u.push(t.src_xn),t.src_tlds=u.join("|");function n(o){return o.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(n(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(n(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(n(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(n(t.tpl_host_fuzzy_test),"i");const r=[];e.__compiled__={};function i(o,c){throw new Error('(LinkifyIt) Invalid schema "'+o+'": '+c)}Object.keys(e.__schemas__).forEach(function(o){const c=e.__schemas__[o];if(c===null)return;const l={validate:null,link:null};if(e.__compiled__[o]=l,y3(c)){x3(c.validate)?l.validate=D3(c.validate):Dl(c.validate)?l.validate=c.validate:i(o,c),Dl(c.normalize)?l.normalize=c.normalize:c.normalize?i(o,c):l.normalize=Tl();return}if(_3(c)){r.push(o);return}i(o,c)}),r.forEach(function(o){e.__compiled__[e.__schemas__[o]]&&(e.__compiled__[o].validate=e.__compiled__[e.__schemas__[o]].validate,e.__compiled__[o].normalize=e.__compiled__[e.__schemas__[o]].normalize)}),e.__compiled__[""]={validate:null,normalize:Tl()};const s=Object.keys(e.__compiled__).filter(function(o){return o.length>0&&e.__compiled__[o]}).map(E3).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+s+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+s+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),v3(e)}function T3(e,t){const u=e.__index__,n=e.__last_index__,r=e.__text_cache__.slice(u,n);this.schema=e.__schema__.toLowerCase(),this.index=u+t,this.lastIndex=n+t,this.raw=r,this.text=r,this.url=r}function qs(e,t){const u=new T3(e,t);return e.__compiled__[u.schema].normalize(u,e),u}function nt(e,t){if(!(this instanceof nt))return new nt(e,t);t||C3(e)&&(t=e,e={}),this.__opts__=Us({},Bf,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Us({},k3,e),this.__compiled__={},this.__tlds__=A3,this.__tlds_replaced__=!1,this.re={},oi(this)}nt.prototype.add=function(t,u){return this.__schemas__[t]=u,oi(this),this};nt.prototype.set=function(t){return this.__opts__=Us(this.__opts__,t),this};nt.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let u,n,r,i,s,o,c,l,a;if(this.re.schema_test.test(t)){for(c=this.re.schema_search,c.lastIndex=0;(u=c.exec(t))!==null;)if(i=this.testSchemaAt(t,u[2],c.lastIndex),i){this.__schema__=u[2],this.__index__=u.index+u[1].length,this.__last_index__=u.index+u[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=t.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l=0&&(r=t.match(this.re.email_fuzzy))!==null&&(s=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||sthis.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=o))),this.__index__>=0};nt.prototype.pretest=function(t){return this.re.pretest.test(t)};nt.prototype.testSchemaAt=function(t,u,n){return this.__compiled__[u.toLowerCase()]?this.__compiled__[u.toLowerCase()].validate(t,n,this):0};nt.prototype.match=function(t){const u=[];let n=0;this.__index__>=0&&this.__text_cache__===t&&(u.push(qs(this,n)),n=this.__last_index__);let r=n?t.slice(n):t;for(;this.test(r);)u.push(qs(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return u.length?u:null};nt.prototype.matchAtStart=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return null;const u=this.re.schema_at_start.exec(t);if(!u)return null;const n=this.testSchemaAt(t,u[2],u[0].length);return n?(this.__schema__=u[2],this.__index__=u.index+u[1].length,this.__last_index__=u.index+u[0].length+n,qs(this,0)):null};nt.prototype.tlds=function(t,u){return t=Array.isArray(t)?t:[t],u?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(n,r,i){return n!==i[r-1]}).reverse(),oi(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,oi(this),this)};nt.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};nt.prototype.onCompile=function(){};const Ku=2147483647,St=36,Xo=1,Jn=26,w3=38,F3=700,Vf=72,$f=128,Hf="-",I3=/^xn--/,O3=/[^\0-\x7F]/,N3=/[\x2E\u3002\uFF0E\uFF61]/g,R3={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ls=St-Xo,At=Math.floor,as=String.fromCharCode;function Qt(e){throw new RangeError(R3[e])}function M3(e,t){const u=[];let n=e.length;for(;n--;)u[n]=t(e[n]);return u}function Uf(e,t){const u=e.split("@");let n="";u.length>1&&(n=u[0]+"@",e=u[1]),e=e.replace(N3,".");const r=e.split("."),i=M3(r,t).join(".");return n+i}function qf(e){const t=[];let u=0;const n=e.length;for(;u=55296&&r<=56319&&uString.fromCodePoint(...e),L3=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:St},wl=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},jf=function(e,t,u){let n=0;for(e=u?At(e/F3):e>>1,e+=At(e/t);e>ls*Jn>>1;n+=St)e=At(e/ls);return At(n+(ls+1)*e/(e+w3))},zf=function(e){const t=[],u=e.length;let n=0,r=$f,i=Vf,s=e.lastIndexOf(Hf);s<0&&(s=0);for(let o=0;o=128&&Qt("not-basic"),t.push(e.charCodeAt(o));for(let o=s>0?s+1:0;o=u&&Qt("invalid-input");const h=L3(e.charCodeAt(o++));h>=St&&Qt("invalid-input"),h>At((Ku-n)/a)&&Qt("overflow"),n+=h*a;const d=f<=i?Xo:f>=i+Jn?Jn:f-i;if(hAt(Ku/p)&&Qt("overflow"),a*=p}const l=t.length+1;i=jf(n-c,l,c==0),At(n/l)>Ku-r&&Qt("overflow"),r+=At(n/l),n%=l,t.splice(n++,0,r)}return String.fromCodePoint(...t)},Kf=function(e){const t=[];e=qf(e);const u=e.length;let n=$f,r=0,i=Vf;for(const c of e)c<128&&t.push(as(c));const s=t.length;let o=s;for(s&&t.push(Hf);o=n&&aAt((Ku-r)/l)&&Qt("overflow"),r+=(c-n)*l,n=c;for(const a of e)if(aKu&&Qt("overflow"),a===n){let f=r;for(let h=St;;h+=St){const d=h<=i?Xo:h>=i+Jn?Jn:h-i;if(f=0))try{t.hostname=Wf.toASCII(t.hostname)}catch{}return or(zo(t))}function G3(e){const t=Ko(e,!0);if(t.hostname&&(!t.protocol||Gf.indexOf(t.protocol)>=0))try{t.hostname=Wf.toUnicode(t.hostname)}catch{}return nn(zo(t),nn.defaultChars+"%")}function at(e,t){if(!(this instanceof at))return new at(e,t);t||Go(e)||(t=e||{},e="default"),this.inline=new lr,this.block=new Pi,this.core=new Jo,this.renderer=new an,this.linkify=new nt,this.validateLink=K3,this.normalizeLink=W3,this.normalizeLinkText=G3,this.utils=Jb,this.helpers=Ri({},eg),this.options={},this.configure(e),t&&this.set(t)}at.prototype.set=function(e){return Ri(this.options,e),this};at.prototype.configure=function(e){const t=this;if(Go(e)){const u=e;if(e=q3[u],!e)throw new Error('Wrong `markdown-it` preset "'+u+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(u){e.components[u].rules&&t[u].ruler.enableOnly(e.components[u].rules),e.components[u].rules2&&t[u].ruler2.enableOnly(e.components[u].rules2)}),this};at.prototype.enable=function(e,t){let u=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(r){u=u.concat(this[r].ruler.enable(e,!0))},this),u=u.concat(this.inline.ruler2.enable(e,!0));const n=e.filter(function(r){return u.indexOf(r)<0});if(n.length&&!t)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this};at.prototype.disable=function(e,t){let u=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(r){u=u.concat(this[r].ruler.disable(e,!0))},this),u=u.concat(this.inline.ruler2.disable(e,!0));const n=e.filter(function(r){return u.indexOf(r)<0});if(n.length&&!t)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this};at.prototype.use=function(e){const t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this};at.prototype.parse=function(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const u=new this.core.State(e,this,t);return this.core.process(u),u.tokens};at.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)};at.prototype.parseInline=function(e,t){const u=new this.core.State(e,this,t);return u.inlineMode=!0,this.core.process(u),u.tokens};at.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};var Yn,Xn,Wu,_u,Qn,js;class Z3 extends TransformStream{constructor(u){super({transform:(n,r)=>Ui(this,Qn,js).call(this,n,r),flush:n=>Ui(this,Qn,js).call(this,`\r
`,n)});Ru(this,Qn);Ru(this,Yn,"");Ru(this,Xn,!1);Ru(this,Wu,!1);Ru(this,_u,u=>u);hn(this,Xn,(u==null?void 0:u.allowCR)??!1),hn(this,Wu,(u==null?void 0:u.returnEmptyLines)??!1),hn(this,_u,(u==null?void 0:u.mapperFun)??qt(this,_u))}}Yn=new WeakMap,Xn=new WeakMap,Wu=new WeakMap,_u=new WeakMap,Qn=new WeakSet,js=function(u,n){for(u=qt(this,Yn)+u;;){const r=u.indexOf(`
-`);if(qt(this,Xn)){const i=u.indexOf("\r");if(i!==-1&&i!==u.length-1&&(r===-1||r-1>i)){const s=qt(this,_u).call(this,u.slice(0,crOrLfIndex));(qt(this,Wu)||s)&&n.enqueue(s),u=u.slice(i+1);continue}}if(r!==-1){let i=r;u[r-1]==="\r"&&i--;const s=qt(this,_u).call(this,u.slice(0,i));(qt(this,Wu)||s)&&n.enqueue(s),u=u.slice(r+1);continue}break}hn(this,Yn,u)};const J3=e=>!!e.toLowerCase,Y3=e=>e===!0||e===!1,X3=e=>!J3(e)&&!isNaN(e)&&!Y3(e),Q3=e=>e.replace(/>/g,">").replace(/"/g,"""),Zf=e=>navigator.clipboard.writeText(e),e_=localStorage.getItem("base")||new URL(".",document.baseURI).href.toString(),ci={apiKey:"",systemMessage:"You are a helpful assistant.",showTokensPerSecond:!1,samplers:"dkypmxt",temperature:.8,dynatemp_range:0,dynatemp_exponent:1,top_k:40,top_p:.95,min_p:.05,xtc_probability:0,xtc_threshold:.1,typical_p:1,repeat_last_n:64,repeat_penalty:1,presence_penalty:0,frequency_penalty:0,dry_multiplier:0,dry_base:1.75,dry_allowed_length:2,dry_penalty_last_n:-1,max_tokens:-1,custom:""},t_={apiKey:"Set the API Key if you are using --api-key option for the server.",systemMessage:"The starting message that defines how model should behave.",samplers:'The order at which samplers are applied, in simplified way. Default is "dkypmxt": dry->top_k->typ_p->top_p->min_p->xtc->temperature',temperature:"Controls the randomness of the generated text by affecting the probability distribution of the output tokens. Higher = more random, lower = more focused.",dynatemp_range:"Addon for the temperature sampler. The added value to the range of dynamic temperature, which adjusts probabilities by entropy of tokens.",dynatemp_exponent:"Addon for the temperature sampler. Smoothes out the probability redistribution based on the most probable token.",top_k:"Keeps only k top tokens.",top_p:"Limits tokens to those that together have a cumulative probability of at least p",min_p:"Limits tokens based on the minimum probability for a token to be considered, relative to the probability of the most likely token.",xtc_probability:"XTC sampler cuts out top tokens; this parameter controls the chance of cutting tokens at all. 0 disables XTC.",xtc_threshold:"XTC sampler cuts out top tokens; this parameter controls the token probability that is required to cut that token.",typical_p:"Sorts and limits tokens based on the difference between log-probability and entropy.",repeat_last_n:"Last n tokens to consider for penalizing repetition",repeat_penalty:"Controls the repetition of token sequences in the generated text",presence_penalty:"Limits tokens based on whether they appear in the output or not.",frequency_penalty:"Limits tokens based on how often they appear in the output.",dry_multiplier:"DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the DRY sampling multiplier.",dry_base:"DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the DRY sampling base value.",dry_allowed_length:"DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the allowed length for DRY sampling.",dry_penalty_last_n:"DRY sampling reduces repetition in generated text even across long contexts. This parameter sets DRY penalty for the last n tokens.",max_tokens:"The maximum number of token per output.",custom:""},u_=Object.entries(ci).filter(e=>X3(e[1])).map(e=>e[0]),n_=["light","dark","cupcake","bumblebee","emerald","corporate","synthwave","retro","cyberpunk","valentine","halloween","garden","forest","aqua","lofi","pastel","fantasy","wireframe","black","luxury","dracula","cmyk","autumn","business","acid","lemonade","night","coffee","winter","dim","nord","sunset"],Jf=ln(e=>{const t=to(new at({breaks:!0})),u=t.value.renderer.rules.fence;t.value.renderer.rules.fence=(r,i,...s)=>{const o=r[i].content,c=u(r,i,...s);return`
+`);if(qt(this,Xn)){const i=u.indexOf("\r");if(i!==-1&&i!==u.length-1&&(r===-1||r-1>i)){const s=qt(this,_u).call(this,u.slice(0,crOrLfIndex));(qt(this,Wu)||s)&&n.enqueue(s),u=u.slice(i+1);continue}}if(r!==-1){let i=r;u[r-1]==="\r"&&i--;const s=qt(this,_u).call(this,u.slice(0,i));(qt(this,Wu)||s)&&n.enqueue(s),u=u.slice(r+1);continue}break}hn(this,Yn,u)};const J3=e=>!!e.toLowerCase,Y3=e=>e===!0||e===!1,X3=e=>!J3(e)&&!isNaN(e)&&!Y3(e),Q3=e=>e.replace(/>/g,">").replace(/"/g,"""),Zf=e=>navigator.clipboard.writeText(e),e_=localStorage.getItem("base")||new URL(".",document.baseURI).href.toString().replace(/\/$/,""),ci={apiKey:"",systemMessage:"You are a helpful assistant.",showTokensPerSecond:!1,samplers:"dkypmxt",temperature:.8,dynatemp_range:0,dynatemp_exponent:1,top_k:40,top_p:.95,min_p:.05,xtc_probability:0,xtc_threshold:.1,typical_p:1,repeat_last_n:64,repeat_penalty:1,presence_penalty:0,frequency_penalty:0,dry_multiplier:0,dry_base:1.75,dry_allowed_length:2,dry_penalty_last_n:-1,max_tokens:-1,custom:""},t_={apiKey:"Set the API Key if you are using --api-key option for the server.",systemMessage:"The starting message that defines how model should behave.",samplers:'The order at which samplers are applied, in simplified way. Default is "dkypmxt": dry->top_k->typ_p->top_p->min_p->xtc->temperature',temperature:"Controls the randomness of the generated text by affecting the probability distribution of the output tokens. Higher = more random, lower = more focused.",dynatemp_range:"Addon for the temperature sampler. The added value to the range of dynamic temperature, which adjusts probabilities by entropy of tokens.",dynatemp_exponent:"Addon for the temperature sampler. Smoothes out the probability redistribution based on the most probable token.",top_k:"Keeps only k top tokens.",top_p:"Limits tokens to those that together have a cumulative probability of at least p",min_p:"Limits tokens based on the minimum probability for a token to be considered, relative to the probability of the most likely token.",xtc_probability:"XTC sampler cuts out top tokens; this parameter controls the chance of cutting tokens at all. 0 disables XTC.",xtc_threshold:"XTC sampler cuts out top tokens; this parameter controls the token probability that is required to cut that token.",typical_p:"Sorts and limits tokens based on the difference between log-probability and entropy.",repeat_last_n:"Last n tokens to consider for penalizing repetition",repeat_penalty:"Controls the repetition of token sequences in the generated text",presence_penalty:"Limits tokens based on whether they appear in the output or not.",frequency_penalty:"Limits tokens based on how often they appear in the output.",dry_multiplier:"DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the DRY sampling multiplier.",dry_base:"DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the DRY sampling base value.",dry_allowed_length:"DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the allowed length for DRY sampling.",dry_penalty_last_n:"DRY sampling reduces repetition in generated text even across long contexts. This parameter sets DRY penalty for the last n tokens.",max_tokens:"The maximum number of token per output.",custom:""},u_=Object.entries(ci).filter(e=>X3(e[1])).map(e=>e[0]),n_=["light","dark","cupcake","bumblebee","emerald","corporate","synthwave","retro","cyberpunk","valentine","halloween","garden","forest","aqua","lofi","pastel","fantasy","wireframe","black","luxury","dracula","cmyk","autumn","business","acid","lemonade","night","coffee","winter","dim","nord","sunset"],Jf=ln(e=>{const t=to(new at({breaks:!0})),u=t.value.renderer.rules.fence;t.value.renderer.rules.fence=(r,i,...s)=>{const o=r[i].content,c=u(r,i,...s);return`
diff --git a/examples/server/webui/src/main.js b/examples/server/webui/src/main.js
index 53adfb159..94a428eb3 100644
--- a/examples/server/webui/src/main.js
+++ b/examples/server/webui/src/main.js
@@ -14,7 +14,7 @@ const copyStr = (str) => navigator.clipboard.writeText(str);
// constants
const BASE_URL = localStorage.getItem('base') // for debugging
- || (new URL('.', document.baseURI).href).toString(); // for production
+ || (new URL('.', document.baseURI).href).toString().replace(/\/$/, ''); // for production
const CONFIG_DEFAULT = {
// Note: in order not to introduce breaking changes, please keep the same data type (number, string, etc) if you want to change the default value. Do not use null or undefined for default value.
apiKey: '',