@parcility/kennel
Version:
A comprehensive, easy-to-use native depiction renderer.
23 lines • 467 kB
JavaScript
(function(G,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(G=typeof globalThis<"u"?globalThis:G||self,Z(G.Kennel={}))})(this,function(G){"use strict";var cr=Object.defineProperty;var ur=(G,Z,V)=>Z in G?cr(G,Z,{enumerable:!0,configurable:!0,writable:!0,value:V}):G[Z]=V;var o=(G,Z,V)=>(ur(G,typeof Z!="symbol"?Z+"":Z,V),V);const Z="";/*! @license DOMPurify 2.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.0/LICENSE */function V(r){return V=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(r)}function qe(r,t){return qe=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},qe(r,t)}function Wn(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Me(r,t,e){return Wn()?Me=Reflect.construct:Me=function(i,s,l){var c=[null];c.push.apply(c,s);var h=Function.bind.apply(i,c),w=new h;return l&&qe(w,l.prototype),w},Me.apply(null,arguments)}function Q(r){return jn(r)||Gn(r)||qn(r)||Zn()}function jn(r){if(Array.isArray(r))return Ze(r)}function Gn(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function qn(r,t){if(!!r){if(typeof r=="string")return Ze(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Ze(r,t)}}function Ze(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function Zn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Yn=Object.hasOwnProperty,It=Object.setPrototypeOf,Qn=Object.isFrozen,Xn=Object.getPrototypeOf,Kn=Object.getOwnPropertyDescriptor,F=Object.freeze,ee=Object.seal,Jn=Object.create,Mt=typeof Reflect<"u"&&Reflect,Le=Mt.apply,Ye=Mt.construct;Le||(Le=function(t,e,n){return t.apply(e,n)}),F||(F=function(t){return t}),ee||(ee=function(t){return t}),Ye||(Ye=function(t,e){return Me(t,Q(e))});var ei=X(Array.prototype.forEach),Lt=X(Array.prototype.pop),Te=X(Array.prototype.push),Ne=X(String.prototype.toLowerCase),ti=X(String.prototype.match),ce=X(String.prototype.replace),ni=X(String.prototype.indexOf),ii=X(String.prototype.trim),B=X(RegExp.prototype.test),Qe=ri(TypeError);function X(r){return function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return Le(r,t,n)}}function ri(r){return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Ye(r,e)}}function x(r,t,e){e=e||Ne,It&&It(r,null);for(var n=t.length;n--;){var i=t[n];if(typeof i=="string"){var s=e(i);s!==i&&(Qn(t)||(t[n]=s),i=s)}r[i]=!0}return r}function he(r){var t=Jn(null),e;for(e in r)Le(Yn,r,[e])&&(t[e]=r[e]);return t}function Oe(r,t){for(;r!==null;){var e=Kn(r,t);if(e){if(e.get)return X(e.get);if(typeof e.value=="function")return X(e.value)}r=Xn(r)}function n(i){return console.warn("fallback value for",i),null}return n}var Nt=F(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Xe=F(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ke=F(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),si=F(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Je=F(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),ai=F(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ot=F(["#text"]),zt=F(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),et=F(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),$t=F(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ze=F(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),li=ee(/\{\{[\w\W]*|[\w\W]*\}\}/gm),oi=ee(/<%[\w\W]*|[\w\W]*%>/gm),ci=ee(/^data-[\-\w.\u00B7-\uFFFF]/),ui=ee(/^aria-[\-\w]+$/),hi=ee(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pi=ee(/^(?:\w+script|data):/i),fi=ee(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),mi=ee(/^html$/i),gi=function(){return typeof window>"u"?null:window},di=function(t,e){if(V(t)!=="object"||typeof t.createPolicy!="function")return null;var n=null,i="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(i)&&(n=e.currentScript.getAttribute(i));var s="dompurify"+(n?"#"+n:"");try{return t.createPolicy(s,{createHTML:function(c){return c},createScriptURL:function(c){return c}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}};function Pt(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gi(),t=function(a){return Pt(a)};if(t.version="2.4.0",t.removed=[],!r||!r.document||r.document.nodeType!==9)return t.isSupported=!1,t;var e=r.document,n=r.document,i=r.DocumentFragment,s=r.HTMLTemplateElement,l=r.Node,c=r.Element,h=r.NodeFilter,w=r.NamedNodeMap,b=w===void 0?r.NamedNodeMap||r.MozNamedAttrMap:w,H=r.HTMLFormElement,E=r.DOMParser,g=r.trustedTypes,J=c.prototype,q=Oe(J,"cloneNode"),ne=Oe(J,"nextSibling"),S=Oe(J,"childNodes"),D=Oe(J,"parentNode");if(typeof s=="function"){var ae=n.createElement("template");ae.content&&ae.content.ownerDocument&&(n=ae.content.ownerDocument)}var I=di(g,e),Y=I?I.createHTML(""):"",W=n,ie=W.implementation,pe=W.createNodeIterator,mt=W.createDocumentFragment,Qi=W.getElementsByTagName,Xi=e.importNode,vn={};try{vn=he(n).documentMode?n.documentMode:{}}catch{}var re={};t.isSupported=typeof D=="function"&&ie&&typeof ie.createHTMLDocument<"u"&&vn!==9;var gt=li,dt=oi,Ki=ci,Ji=ui,er=pi,_n=fi,bt=hi,L=null,Tn=x({},[].concat(Q(Nt),Q(Xe),Q(Ke),Q(Je),Q(Ot))),z=null,An=x({},[].concat(Q(zt),Q(et),Q($t),Q(ze))),C=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),De=null,wt=null,En=!0,kt=!0,Sn=!1,we=!1,fe=!1,xt=!1,yt=!1,ke=!1,He=!1,Ve=!1,Rn=!0,Dn=!1,tr="user-content-",vt=!0,Ce=!1,xe={},ye=null,Cn=x({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),In=null,Mn=x({},["audio","video","img","source","image","track"]),_t=null,Ln=x({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Tt="http://www.w3.org/1998/Math/MathML",At="http://www.w3.org/2000/svg",ue="http://www.w3.org/1999/xhtml",We=ue,Et=!1,ve,nr=["application/xhtml+xml","text/html"],ir="text/html",N,_e=null,rr=n.createElement("form"),Nn=function(a){return a instanceof RegExp||a instanceof Function},St=function(a){_e&&_e===a||((!a||V(a)!=="object")&&(a={}),a=he(a),ve=nr.indexOf(a.PARSER_MEDIA_TYPE)===-1?ve=ir:ve=a.PARSER_MEDIA_TYPE,N=ve==="application/xhtml+xml"?function(u){return u}:Ne,L="ALLOWED_TAGS"in a?x({},a.ALLOWED_TAGS,N):Tn,z="ALLOWED_ATTR"in a?x({},a.ALLOWED_ATTR,N):An,_t="ADD_URI_SAFE_ATTR"in a?x(he(Ln),a.ADD_URI_SAFE_ATTR,N):Ln,In="ADD_DATA_URI_TAGS"in a?x(he(Mn),a.ADD_DATA_URI_TAGS,N):Mn,ye="FORBID_CONTENTS"in a?x({},a.FORBID_CONTENTS,N):Cn,De="FORBID_TAGS"in a?x({},a.FORBID_TAGS,N):{},wt="FORBID_ATTR"in a?x({},a.FORBID_ATTR,N):{},xe="USE_PROFILES"in a?a.USE_PROFILES:!1,En=a.ALLOW_ARIA_ATTR!==!1,kt=a.ALLOW_DATA_ATTR!==!1,Sn=a.ALLOW_UNKNOWN_PROTOCOLS||!1,we=a.SAFE_FOR_TEMPLATES||!1,fe=a.WHOLE_DOCUMENT||!1,ke=a.RETURN_DOM||!1,He=a.RETURN_DOM_FRAGMENT||!1,Ve=a.RETURN_TRUSTED_TYPE||!1,yt=a.FORCE_BODY||!1,Rn=a.SANITIZE_DOM!==!1,Dn=a.SANITIZE_NAMED_PROPS||!1,vt=a.KEEP_CONTENT!==!1,Ce=a.IN_PLACE||!1,bt=a.ALLOWED_URI_REGEXP||bt,We=a.NAMESPACE||ue,a.CUSTOM_ELEMENT_HANDLING&&Nn(a.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(C.tagNameCheck=a.CUSTOM_ELEMENT_HANDLING.tagNameCheck),a.CUSTOM_ELEMENT_HANDLING&&Nn(a.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(C.attributeNameCheck=a.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),a.CUSTOM_ELEMENT_HANDLING&&typeof a.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(C.allowCustomizedBuiltInElements=a.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),we&&(kt=!1),He&&(ke=!0),xe&&(L=x({},Q(Ot)),z=[],xe.html===!0&&(x(L,Nt),x(z,zt)),xe.svg===!0&&(x(L,Xe),x(z,et),x(z,ze)),xe.svgFilters===!0&&(x(L,Ke),x(z,et),x(z,ze)),xe.mathMl===!0&&(x(L,Je),x(z,$t),x(z,ze))),a.ADD_TAGS&&(L===Tn&&(L=he(L)),x(L,a.ADD_TAGS,N)),a.ADD_ATTR&&(z===An&&(z=he(z)),x(z,a.ADD_ATTR,N)),a.ADD_URI_SAFE_ATTR&&x(_t,a.ADD_URI_SAFE_ATTR,N),a.FORBID_CONTENTS&&(ye===Cn&&(ye=he(ye)),x(ye,a.FORBID_CONTENTS,N)),vt&&(L["#text"]=!0),fe&&x(L,["html","head","body"]),L.table&&(x(L,["tbody"]),delete De.tbody),F&&F(a),_e=a)},On=x({},["mi","mo","mn","ms","mtext"]),zn=x({},["foreignobject","desc","title","annotation-xml"]),sr=x({},["title","style","font","a","script"]),je=x({},Xe);x(je,Ke),x(je,si);var Rt=x({},Je);x(Rt,ai);var ar=function(a){var u=D(a);(!u||!u.tagName)&&(u={namespaceURI:ue,tagName:"template"});var p=Ne(a.tagName),_=Ne(u.tagName);return a.namespaceURI===At?u.namespaceURI===ue?p==="svg":u.namespaceURI===Tt?p==="svg"&&(_==="annotation-xml"||On[_]):Boolean(je[p]):a.namespaceURI===Tt?u.namespaceURI===ue?p==="math":u.namespaceURI===At?p==="math"&&zn[_]:Boolean(Rt[p]):a.namespaceURI===ue?u.namespaceURI===At&&!zn[_]||u.namespaceURI===Tt&&!On[_]?!1:!Rt[p]&&(sr[p]||!je[p]):!1},le=function(a){Te(t.removed,{element:a});try{a.parentNode.removeChild(a)}catch{try{a.outerHTML=Y}catch{a.remove()}}},Dt=function(a,u){try{Te(t.removed,{attribute:u.getAttributeNode(a),from:u})}catch{Te(t.removed,{attribute:null,from:u})}if(u.removeAttribute(a),a==="is"&&!z[a])if(ke||He)try{le(u)}catch{}else try{u.setAttribute(a,"")}catch{}},$n=function(a){var u,p;if(yt)a="<remove></remove>"+a;else{var _=ti(a,/^[\r\n\t ]+/);p=_&&_[0]}ve==="application/xhtml+xml"&&(a='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+a+"</body></html>");var j=I?I.createHTML(a):a;if(We===ue)try{u=new E().parseFromString(j,ve)}catch{}if(!u||!u.documentElement){u=ie.createDocument(We,"template",null);try{u.documentElement.innerHTML=Et?"":j}catch{}}var P=u.body||u.documentElement;return a&&p&&P.insertBefore(n.createTextNode(p),P.childNodes[0]||null),We===ue?Qi.call(u,fe?"html":"body")[0]:fe?u.documentElement:P},Pn=function(a){return pe.call(a.ownerDocument||a,a,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT,null,!1)},lr=function(a){return a instanceof H&&(typeof a.nodeName!="string"||typeof a.textContent!="string"||typeof a.removeChild!="function"||!(a.attributes instanceof b)||typeof a.removeAttribute!="function"||typeof a.setAttribute!="function"||typeof a.namespaceURI!="string"||typeof a.insertBefore!="function")},Ie=function(a){return V(l)==="object"?a instanceof l:a&&V(a)==="object"&&typeof a.nodeType=="number"&&typeof a.nodeName=="string"},oe=function(a,u,p){!re[a]||ei(re[a],function(_){_.call(t,u,p,_e)})},Un=function(a){var u;if(oe("beforeSanitizeElements",a,null),lr(a)||B(/[\u0080-\uFFFF]/,a.nodeName))return le(a),!0;var p=N(a.nodeName);if(oe("uponSanitizeElement",a,{tagName:p,allowedTags:L}),a.hasChildNodes()&&!Ie(a.firstElementChild)&&(!Ie(a.content)||!Ie(a.content.firstElementChild))&&B(/<[/\w]/g,a.innerHTML)&&B(/<[/\w]/g,a.textContent)||p==="select"&&B(/<template/i,a.innerHTML))return le(a),!0;if(!L[p]||De[p]){if(!De[p]&&Bn(p)&&(C.tagNameCheck instanceof RegExp&&B(C.tagNameCheck,p)||C.tagNameCheck instanceof Function&&C.tagNameCheck(p)))return!1;if(vt&&!ye[p]){var _=D(a)||a.parentNode,j=S(a)||a.childNodes;if(j&&_)for(var P=j.length,$=P-1;$>=0;--$)_.insertBefore(q(j[$],!0),ne(a))}return le(a),!0}return a instanceof c&&!ar(a)||(p==="noscript"||p==="noembed")&&B(/<\/no(script|embed)/i,a.innerHTML)?(le(a),!0):(we&&a.nodeType===3&&(u=a.textContent,u=ce(u,gt," "),u=ce(u,dt," "),a.textContent!==u&&(Te(t.removed,{element:a.cloneNode()}),a.textContent=u)),oe("afterSanitizeElements",a,null),!1)},Fn=function(a,u,p){if(Rn&&(u==="id"||u==="name")&&(p in n||p in rr))return!1;if(!(kt&&!wt[u]&&B(Ki,u))){if(!(En&&B(Ji,u))){if(!z[u]||wt[u]){if(!(Bn(a)&&(C.tagNameCheck instanceof RegExp&&B(C.tagNameCheck,a)||C.tagNameCheck instanceof Function&&C.tagNameCheck(a))&&(C.attributeNameCheck instanceof RegExp&&B(C.attributeNameCheck,u)||C.attributeNameCheck instanceof Function&&C.attributeNameCheck(u))||u==="is"&&C.allowCustomizedBuiltInElements&&(C.tagNameCheck instanceof RegExp&&B(C.tagNameCheck,p)||C.tagNameCheck instanceof Function&&C.tagNameCheck(p))))return!1}else if(!_t[u]){if(!B(bt,ce(p,_n,""))){if(!((u==="src"||u==="xlink:href"||u==="href")&&a!=="script"&&ni(p,"data:")===0&&In[a])){if(!(Sn&&!B(er,ce(p,_n,"")))){if(p)return!1}}}}}}return!0},Bn=function(a){return a.indexOf("-")>0},Hn=function(a){var u,p,_,j;oe("beforeSanitizeAttributes",a,null);var P=a.attributes;if(!!P){var $={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z};for(j=P.length;j--;){u=P[j];var Ge=u,U=Ge.name,Ct=Ge.namespaceURI;if(p=U==="value"?u.value:ii(u.value),_=N(U),$.attrName=_,$.attrValue=p,$.keepAttr=!0,$.forceKeepAttr=void 0,oe("uponSanitizeAttribute",a,$),p=$.attrValue,!$.forceKeepAttr&&(Dt(U,a),!!$.keepAttr)){if(B(/\/>/i,p)){Dt(U,a);continue}we&&(p=ce(p,gt," "),p=ce(p,dt," "));var Vn=N(a.nodeName);if(!!Fn(Vn,_,p)){if(Dn&&(_==="id"||_==="name")&&(Dt(U,a),p=tr+p),I&&V(g)==="object"&&typeof g.getAttributeType=="function"&&!Ct)switch(g.getAttributeType(Vn,_)){case"TrustedHTML":p=I.createHTML(p);break;case"TrustedScriptURL":p=I.createScriptURL(p);break}try{Ct?a.setAttributeNS(Ct,U,p):a.setAttribute(U,p),Lt(t.removed)}catch{}}}}oe("afterSanitizeAttributes",a,null)}},or=function m(a){var u,p=Pn(a);for(oe("beforeSanitizeShadowDOM",a,null);u=p.nextNode();)oe("uponSanitizeShadowNode",u,null),!Un(u)&&(u.content instanceof i&&m(u.content),Hn(u));oe("afterSanitizeShadowDOM",a,null)};return t.sanitize=function(m){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u,p,_,j,P;if(Et=!m,Et&&(m="<!-->"),typeof m!="string"&&!Ie(m)){if(typeof m.toString!="function")throw Qe("toString is not a function");if(m=m.toString(),typeof m!="string")throw Qe("dirty is not a string, aborting")}if(!t.isSupported){if(V(r.toStaticHTML)==="object"||typeof r.toStaticHTML=="function"){if(typeof m=="string")return r.toStaticHTML(m);if(Ie(m))return r.toStaticHTML(m.outerHTML)}return m}if(xt||St(a),t.removed=[],typeof m=="string"&&(Ce=!1),Ce){if(m.nodeName){var $=N(m.nodeName);if(!L[$]||De[$])throw Qe("root node is forbidden and cannot be sanitized in-place")}}else if(m instanceof l)u=$n("<!---->"),p=u.ownerDocument.importNode(m,!0),p.nodeType===1&&p.nodeName==="BODY"||p.nodeName==="HTML"?u=p:u.appendChild(p);else{if(!ke&&!we&&!fe&&m.indexOf("<")===-1)return I&&Ve?I.createHTML(m):m;if(u=$n(m),!u)return ke?null:Ve?Y:""}u&&yt&&le(u.firstChild);for(var Ge=Pn(Ce?m:u);_=Ge.nextNode();)_.nodeType===3&&_===j||Un(_)||(_.content instanceof i&&or(_.content),Hn(_),j=_);if(j=null,Ce)return m;if(ke){if(He)for(P=mt.call(u.ownerDocument);u.firstChild;)P.appendChild(u.firstChild);else P=u;return z.shadowroot&&(P=Xi.call(e,P,!0)),P}var U=fe?u.outerHTML:u.innerHTML;return fe&&L["!doctype"]&&u.ownerDocument&&u.ownerDocument.doctype&&u.ownerDocument.doctype.name&&B(mi,u.ownerDocument.doctype.name)&&(U="<!DOCTYPE "+u.ownerDocument.doctype.name+`>
`+U),we&&(U=ce(U,gt," "),U=ce(U,dt," ")),I&&Ve?I.createHTML(U):U},t.setConfig=function(m){St(m),xt=!0},t.clearConfig=function(){_e=null,xt=!1},t.isValidAttribute=function(m,a,u){_e||St({});var p=N(m),_=N(a);return Fn(p,_,u)},t.addHook=function(m,a){typeof a=="function"&&(re[m]=re[m]||[],Te(re[m],a))},t.removeHook=function(m){if(re[m])return Lt(re[m])},t.removeHooks=function(m){re[m]&&(re[m]=[])},t.removeAllHooks=function(){re={}},t}var Ut=Pt();class R{constructor(t){o(this,"tintColor");t&&(this.tintColor=be(t.tintColor,"color"))}}o(R,"viewName","DepictionBaseView");class Ft extends R{constructor(e){super(e);o(this,"views",[]);o(this,"viewWidths");o(this,"horizontalSpacing");o(this,"backgroundColor");let n=v(e.views,"array");this.horizontalSpacing=v(e.horizontalSpacing,"number");for(let i of n){v(i.class,"string"),v(i.preferredWidth,"number");let s=ge(i);if(!s)throw new Error("Invalid view");this.views.push(s)}this.viewWidths=n.map(i=>i.preferredWidth),this.backgroundColor=be(e.backgroundColor,"color")}async make(){let e=await Re(this.views),n=y("div",{class:"nd-auto-stack"},e),i={"grid-template-columns":this.viewWidths.map(s=>s+"px").join(" "),"column-gap":this.horizontalSpacing};return this.backgroundColor&&(i["background-color"]=this.backgroundColor),O(n,i),n}}o(Ft,"viewName","DepictionAutoStackView");class Bt extends R{constructor(e){super(e);o(this,"text");o(this,"children");o(this,"action");o(this,"isLink");o(this,"yPadding");o(this,"openExternal");this.isLink=A(e.isLink,"boolean",!1),this.yPadding=A(e.yPadding,"number",0),this.action=v(e.action,"string"),this.openExternal=A(e.openExternal,"boolean",!1);let n=e.view;if(typeof n=="object"&&(this.children=ge(n)),!this.children){let i=e.text;typeof i=="string"&&(this.text=i)}}async make(){let e=y("a");Be(e,["nd-button",this.isLink?"nd-button-link":"nd-button-not-link"]);let n={};if(this.tintColor&&(n["--kennel-tint-color"]=this.tintColor),wn(e,this.action,this.text),this.isLink?n.color="var(--kennel-tint-color)":(n["background-color"]="var(--kennel-tint-color)",n.color="white"),this.openExternal&&(e.attributes.target="_blank"),this.children){this.children;let i=await de(this.children);i.attributes.pointerEvents="none",e.children=[i]}else this.text&&(e.children=[this.text]);return O(e,n),e}}o(Bt,"viewName","DepictionButtonView");class tt extends R{constructor(e){super(e);o(this,"title");o(this,"useMargins");o(this,"useBottomMargin");o(this,"bold");o(this,"textColor");o(this,"alignment");typeof e.title=="string"&&(this.title=e.title),this.useMargins=A(e.useMargins,"boolean",!0),this.useBottomMargin=A(e.useBottomMargin,"boolean",!0),this.bold=A(e.useBoldText,"boolean",!0),this.bold||(this.textColor="rgb(175, 175, 175)"),this.alignment=lt(e.alignment)}async make(){const e=y("p",{},[this.title]);Be(e,["nd-header",this.bold&&"nd-header-bold",this.useMargins&&"nd-header-margins",this.useBottomMargin&&"nd-header-bottom-margin"]);let n={"text-align":this.alignment};return this.textColor&&(n.color=this.textColor),O(e,n),e}}o(tt,"viewName","DepictionHeaderView");class Ht extends R{constructor(e){super(e);o(this,"alignment");o(this,"url");o(this,"width");o(this,"height");o(this,"xPadding");o(this,"borderRadius");if(this.url=v(e.URL,"string"),this.width=A(e.width,"number",0),this.height=A(e.height,"number",0),this.width===0||this.height===0)throw new Se("Invalid image size");this.borderRadius=v(e.cornerRadius,"number"),this.alignment=at(A(e.alignment,"number",0)),this.xPadding=A(e.xPadding,"number",0)}async make(){const e=y("img",{class:"nd-image",src:this.url,loading:"lazy"});return O(e,{width:`${this.width}px`,height:`${this.height}px`,"border-radius":`${this.borderRadius}px`,"object-fit":"cover",padding:`0 ${this.xPadding}px`}),ot(e,this.alignment),e}}o(Ht,"viewName","DepictionImageView");class Vt extends R{constructor(e){super(e);o(this,"text");o(this,"margins",{left:0,right:0,top:0,bottom:0});o(this,"textColor");o(this,"weight");o(this,"alignment");o(this,"isActionable");o(this,"isHighlighted");o(this,"fontSize");typeof e.text=="string"&&(this.text=e.text);let n=e.margins;if(typeof n=="string"){let[c,h,w,b]=bn(n);this.margins={left:h,right:b,top:c,bottom:w}}this.margins.left===0&&(this.margins.left=16),this.margins.right===0&&(this.margins.right=16);let i=A(e.useMargins,"boolean",!0),s=A(e.usePadding,"boolean",!0);i?s||(this.margins.top=0,this.margins.bottom=0):this.margins={left:0,right:0,top:0,bottom:0};let l=A(e.fontWeight,"string","normal");this.fontSize=A(e.fontSize,"number",14),this.textColor=be(e.textColor,"color"),this.weight=Hi(l),this.alignment=lt(e.alignment)}async make(){const e=y("p",{class:"nd-label"},[this.text]);let n={"text-align":this.alignment,"font-weight":this.weight,"font-size":`${this.fontSize}px`,"margin-top":this.margins.top+"px","margin-right":this.margins.right+"px","margin-left":this.margins.left+"px","margin-bottom":this.margins.bottom+"px"};return this.textColor&&(n.color=this.textColor),this.tintColor&&(n["--kennel-tint-color"]=this.tintColor),this.textColor||this.isActionable&&(this.isHighlighted?n.filter="saturation(75%)":n.color="var(--kennel-tint-color)"),O(e,n),e}}o(Vt,"viewName","DepictionLabelView");class Wt extends R{constructor(e){super(e);o(this,"views");let n=v(e.views,"array");this.views=ct(n)}async make(){const e=y("div",{class:"nd-layer"});return e.children=await Re(this.views),e}static hydrate(e){let i=Array.from(e.children).reduce((s,l)=>{let c=l.getBoundingClientRect().height;return c>s?c:s},0);e.style.height=i+"px"}}o(Wt,"viewName","DepictionLayerView");function jt(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let me=jt();function bi(r){me=r}const wi=/[&<>"']/,ki=/[&<>"']/g,xi=/[<>"']|&(?!#?\w+;)/,yi=/[<>"']|&(?!#?\w+;)/g,vi={"&":"&","<":"<",">":">",'"':""","'":"'"},Gt=r=>vi[r];function M(r,t){if(t){if(wi.test(r))return r.replace(ki,Gt)}else if(xi.test(r))return r.replace(yi,Gt);return r}const _i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function qt(r){return r.replace(_i,(t,e)=>(e=e.toLowerCase(),e==="colon"?":":e.charAt(0)==="#"?e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}const Ti=/(^|[^\[])\^/g;function T(r,t){r=typeof r=="string"?r:r.source,t=t||"";const e={replace:(n,i)=>(i=i.source||i,i=i.replace(Ti,"$1"),r=r.replace(n,i),e),getRegex:()=>new RegExp(r,t)};return e}const Ai=/[^\w:]/g,Ei=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Zt(r,t,e){if(r){let n;try{n=decodeURIComponent(qt(e)).replace(Ai,"").toLowerCase()}catch{return null}if(n.indexOf("javascript:")===0||n.indexOf("vbscript:")===0||n.indexOf("data:")===0)return null}t&&!Ei.test(e)&&(e=Ci(t,e));try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const $e={},Si=/^[^:]+:\/*[^/]*$/,Ri=/^([^:]+:)[\s\S]*$/,Di=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Ci(r,t){$e[" "+r]||(Si.test(r)?$e[" "+r]=r+"/":$e[" "+r]=Ue(r,"/",!0)),r=$e[" "+r];const e=r.indexOf(":")===-1;return t.substring(0,2)==="//"?e?t:r.replace(Ri,"$1")+t:t.charAt(0)==="/"?e?t:r.replace(Di,"$1")+t:r+t}const Pe={exec:function(){}};function K(r){let t=1,e,n;for(;t<arguments.length;t++){e=arguments[t];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r}function Yt(r,t){const e=r.replace(/\|/g,(s,l,c)=>{let h=!1,w=l;for(;--w>=0&&c[w]==="\\";)h=!h;return h?"|":" |"}),n=e.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function Ue(r,t,e){const n=r.length;if(n===0)return"";let i=0;for(;i<n;){const s=r.charAt(n-i-1);if(s===t&&!e)i++;else if(s!==t&&e)i++;else break}return r.slice(0,n-i)}function Ii(r,t){if(r.indexOf(t[1])===-1)return-1;const e=r.length;let n=0,i=0;for(;i<e;i++)if(r[i]==="\\")i++;else if(r[i]===t[0])n++;else if(r[i]===t[1]&&(n--,n<0))return i;return-1}function Qt(r){r&&r.sanitize&&!r.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function Xt(r,t){if(t<1)return"";let e="";for(;t>1;)t&1&&(e+=r),t>>=1,r+=r;return e+r}function Kt(r,t,e,n){const i=t.href,s=t.title?M(t.title):null,l=r[1].replace(/\\([\[\]])/g,"$1");if(r[0].charAt(0)!=="!"){n.state.inLink=!0;const c={type:"link",raw:e,href:i,title:s,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,c}return{type:"image",raw:e,href:i,title:s,text:M(l)}}function Mi(r,t){const e=r.match(/^(\s+)(?:```)/);if(e===null)return t;const n=e[1];return t.split(`
`).map(i=>{const s=i.match(/^\s+/);if(s===null)return i;const[l]=s;return l.length>=n.length?i.slice(n.length):i}).join(`
`)}class nt{constructor(t){this.options=t||me}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ue(n,`
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],i=Mi(n,e[3]||"");return{type:"code",raw:n,lang:e[2]?e[2].trim():e[2],text:i}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(/#$/.test(n)){const i=Ue(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){const n=e[0].replace(/^ *>[ \t]?/gm,"");return{type:"blockquote",raw:e[0],tokens:this.lexer.blockTokens(n,[]),text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n,i,s,l,c,h,w,b,H,E,g,J,q=e[1].trim();const ne=q.length>1,S={type:"list",raw:"",ordered:ne,start:ne?+q.slice(0,-1):"",loose:!1,items:[]};q=ne?`\\d{1,9}\\${q.slice(-1)}`:`\\${q}`,this.options.pedantic&&(q=ne?q:"[*+-]");const D=new RegExp(`^( {0,3}${q})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;t&&(J=!1,!(!(e=D.exec(t))||this.rules.block.hr.test(t)));){if(n=e[0],t=t.substring(n.length),b=e[2].split(`
`,1)[0],H=t.split(`
`,1)[0],this.options.pedantic?(l=2,g=b.trimLeft()):(l=e[2].search(/[^ ]/),l=l>4?1:l,g=b.slice(l),l+=e[1].length),h=!1,!b&&/^ *$/.test(H)&&(n+=H+`
`,t=t.substring(H.length+1),J=!0),!J){const I=new RegExp(`^ {0,${Math.min(3,l-1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))`),Y=new RegExp(`^ {0,${Math.min(3,l-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),W=new RegExp(`^ {0,${Math.min(3,l-1)}}(?:\`\`\`|~~~)`),ie=new RegExp(`^ {0,${Math.min(3,l-1)}}#`);for(;t&&(E=t.split(`
`,1)[0],b=E,this.options.pedantic&&(b=b.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(W.test(b)||ie.test(b)||I.test(b)||Y.test(t)));){if(b.search(/[^ ]/)>=l||!b.trim())g+=`
`+b.slice(l);else if(!h)g+=`
`+b;else break;!h&&!b.trim()&&(h=!0),n+=E+`
`,t=t.substring(E.length+1)}}S.loose||(w?S.loose=!0:/\n *\n *$/.test(n)&&(w=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(g),i&&(s=i[0]!=="[ ] ",g=g.replace(/^\[[ xX]\] +/,""))),S.items.push({type:"list_item",raw:n,task:!!i,checked:s,loose:!1,text:g}),S.raw+=n}S.items[S.items.length-1].raw=n.trimRight(),S.items[S.items.length-1].text=g.trimRight(),S.raw=S.raw.trimRight();const ae=S.items.length;for(c=0;c<ae;c++){this.lexer.state.top=!1,S.items[c].tokens=this.lexer.blockTokens(S.items[c].text,[]);const I=S.items[c].tokens.filter(W=>W.type==="space"),Y=I.every(W=>{const ie=W.raw.split("");let pe=0;for(const mt of ie)if(mt===`
`&&(pe+=1),pe>1)return!0;return!1});!S.loose&&I.length&&Y&&(S.loose=!0,S.items[c].loose=!0)}return S}}html(t){const e=this.rules.block.html.exec(t);if(e){const n={type:"html",raw:e[0],pre:!this.options.sanitizer&&(e[1]==="pre"||e[1]==="script"||e[1]==="style"),text:e[0]};if(this.options.sanitize){const i=this.options.sanitizer?this.options.sanitizer(e[0]):M(e[0]);n.type="paragraph",n.text=i,n.tokens=this.lexer.inline(i)}return n}}def(t){const e=this.rules.block.def.exec(t);if(e){e[3]&&(e[3]=e[3].substring(1,e[3].length-1));const n=e[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:n,raw:e[0],href:e[2],title:e[3]}}}table(t){const e=this.rules.block.table.exec(t);if(e){const n={type:"table",header:Yt(e[1]).map(i=>({text:i})),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
`):[]};if(n.header.length===n.align.length){n.raw=e[0];let i=n.align.length,s,l,c,h;for(s=0;s<i;s++)/^ *-+: *$/.test(n.align[s])?n.align[s]="right":/^ *:-+: *$/.test(n.align[s])?n.align[s]="center":/^ *:-+ *$/.test(n.align[s])?n.align[s]="left":n.align[s]=null;for(i=n.rows.length,s=0;s<i;s++)n.rows[s]=Yt(n.rows[s],n.header.length).map(w=>({text:w}));for(i=n.header.length,l=0;l<i;l++)n.header[l].tokens=this.lexer.inline(n.header[l].text);for(i=n.rows.length,l=0;l<i;l++)for(h=n.rows[l],c=0;c<h.length;c++)h[c].tokens=this.lexer.inline(h[c].text);return n}}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:M(e[1])}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&/^<a /i.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):M(e[0]):e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const l=Ue(n.slice(0,-1),"\\");if((n.length-l.length)%2===0)return}else{const l=Ii(e[2],"()");if(l>-1){const h=(e[0].indexOf("!")===0?5:4)+e[1].length+l;e[2]=e[2].substring(0,l),e[0]=e[0].substring(0,h).trim(),e[3]=""}}let i=e[2],s="";if(this.options.pedantic){const l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);l&&(i=l[1],s=l[3])}else s=e[3]?e[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),Kt(e,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:s&&s.replace(this.rules.inline._escapes,"$1")},e[0],this.lexer)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let i=(n[2]||n[1]).replace(/\s+/g," ");if(i=e[i.toLowerCase()],!i||!i.href){const s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return Kt(n,i,n[0],this.lexer)}}emStrong(t,e,n=""){let i=this.rules.inline.emStrong.lDelim.exec(t);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;const s=i[1]||i[2]||"";if(!s||s&&(n===""||this.rules.inline.punctuation.exec(n))){const l=i[0].length-1;let c,h,w=l,b=0;const H=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(H.lastIndex=0,e=e.slice(-1*t.length+l);(i=H.exec(e))!=null;){if(c=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!c)continue;if(h=c.length,i[3]||i[4]){w+=h;continue}else if((i[5]||i[6])&&l%3&&!((l+h)%3)){b+=h;continue}if(w-=h,w>0)continue;if(h=Math.min(h,h+w+b),Math.min(l,h)%2){const g=t.slice(1,l+i.index+h);return{type:"em",raw:t.slice(0,l+i.index+h+1),text:g,tokens:this.lexer.inlineTokens(g)}}const E=t.slice(2,l+i.index+h-1);return{type:"strong",raw:t.slice(0,l+i.index+h+1),text:E,tokens:this.lexer.inlineTokens(E)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(/\n/g," ");const i=/[^ ]/.test(n),s=/^ /.test(n)&&/ $/.test(n);return i&&s&&(n=n.substring(1,n.length-1)),n=M(n,!0),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t,e){const n=this.rules.inline.autolink.exec(t);if(n){let i,s;return n[2]==="@"?(i=M(this.options.mangle?e(n[1]):n[1]),s="mailto:"+i):(i=M(n[1]),s=i),{type:"link",raw:n[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(t,e){let n;if(n=this.rules.inline.url.exec(t)){let i,s;if(n[2]==="@")i=M(this.options.mangle?e(n[0]):n[0]),s="mailto:"+i;else{let l;do l=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0];while(l!==n[0]);i=M(n[0]),n[1]==="www."?s="http://"+i:s=i}return{type:"link",raw:n[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t,e){const n=this.rules.inline.text.exec(t);if(n){let i;return this.lexer.state.inRawBlock?i=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):M(n[0]):n[0]:i=M(this.options.smartypants?e(n[0]):n[0]),{type:"text",raw:n[0],text:i}}}}const d={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Pe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};d._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/,d._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,d.def=T(d.def).replace("label",d._label).replace("title",d._title).getRegex(),d.bullet=/(?:[*+-]|\d{1,9}[.)])/,d.listItemStart=T(/^( *)(bull) */).replace("bull",d.bullet).getRegex(),d.list=T(d.list).replace(/bull/g,d.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+d.def.source+")").getRegex(),d._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",d._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,d.html=T(d.html,"i").replace("comment",d._comment).replace("tag",d._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),d.paragraph=T(d._paragraph).replace("hr",d.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",d._tag).getRegex(),d.blockquote=T(d.blockquote).replace("paragraph",d.paragraph).getRegex(),d.normal=K({},d),d.gfm=K({},d.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),d.gfm.table=T(d.gfm.table).replace("hr",d.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",d._tag).getRegex(),d.gfm.paragraph=T(d._paragraph).replace("hr",d.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",d.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",d._tag).getRegex(),d.pedantic=K({},d.normal,{html:T(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",d._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Pe,paragraph:T(d.normal._paragraph).replace("hr",d.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",d.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const f={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Pe,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[^*]+(?=[^*])|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Pe,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};f._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",f.punctuation=T(f.punctuation).replace(/punctuation/g,f._punctuation).getRegex(),f.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,f.escapedEmSt=/\\\*|\\_/g,f._comment=T(d._comment).replace("(?:-->|$)","-->").getRegex(),f.emStrong.lDelim=T(f.emStrong.lDelim).replace(/punct/g,f._punctuation).getRegex(),f.emStrong.rDelimAst=T(f.emStrong.rDelimAst,"g").replace(/punct/g,f._punctuation).getRegex(),f.emStrong.rDelimUnd=T(f.emStrong.rDelimUnd,"g").replace(/punct/g,f._punctuation).getRegex(),f._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,f._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,f._email=/[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])?)+(?![-_])/,f.autolink=T(f.autolink).replace("scheme",f._scheme).replace("email",f._email).getRegex(),f._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,f.tag=T(f.tag).replace("comment",f._comment).replace("attribute",f._attribute).getRegex(),f._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,f._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,f._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,f.link=T(f.link).replace("label",f._label).replace("href",f._href).replace("title",f._title).getRegex(),f.reflink=T(f.reflink).replace("label",f._label).replace("ref",d._label).getRegex(),f.nolink=T(f.nolink).replace("ref",d._label).getRegex(),f.reflinkSearch=T(f.reflinkSearch,"g").replace("reflink",f.reflink).replace("nolink",f.nolink).getRegex(),f.normal=K({},f),f.pedantic=K({},f.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:T(/^!?\[(label)\]\((.*?)\)/).replace("label",f._label).getRegex(),reflink:T(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",f._label).getRegex()}),f.gfm=K({},f.normal,{escape:T(f.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),f.gfm.url=T(f.gfm.url,"i").replace("email",f.gfm._extended_email).getRegex(),f.breaks=K({},f.gfm,{br:T(f.br).replace("{2,}","*").getRegex(),text:T(f.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});function Li(r){return r.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Jt(r){let t="",e,n;const i=r.length;for(e=0;e<i;e++)n=r.charCodeAt(e),Math.random()>.5&&(n="x"+n.toString(16)),t+="&#"+n+";";return t}class se{constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||me,this.options.tokenizer=this.options.tokenizer||new nt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const e={block:d.normal,inline:f.normal};this.options.pedantic?(e.block=d.pedantic,e.inline=f.pedantic):this.options.gfm&&(e.block=d.gfm,this.options.breaks?e.inline=f.breaks:e.inline=f.gfm),this.tokenizer.rules=e}static get rules(){return{block:d,inline:f}}static lex(t,e){return new se(e).lex(t)}static lexInline(t,e){return new se(e).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
`),this.blockTokens(t,this.tokens);let e;for(;e=this.inlineQueue.shift();)this.inlineTokens(e.src,e.tokens);return this.tokens}blockTokens(t,e=[]){this.options.pedantic?t=t.replace(/\t/g," ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(c,h,w)=>h+" ".repeat(w.length));let n,i,s,l;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(c=>(n=c.call({lexer:this},t,e))?(t=t.substring(n.raw.length),e.push(n),!0):!1))){if(n=this.tokenizer.space(t)){t=t.substring(n.raw.length),n.raw.length===1&&e.length>0?e[e.length-1].raw+=`
`:e.push(n);continue}if(n=this.tokenizer.code(t)){t=t.substring(n.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+n.raw,i.text+=`
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):e.push(n);continue}if(n=this.tokenizer.fences(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.heading(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.hr(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.blockquote(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.list(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.html(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.def(t)){t=t.substring(n.raw.length),i=e[e.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+n.raw,i.text+=`
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.lheading(t)){t=t.substring(n.raw.length),e.push(n);continue}if(s