Spaces:
Running
Running
Update assets/index-Btti6dN2.js
Browse files- assets/index-Btti6dN2.js +1 -1
assets/index-Btti6dN2.js
CHANGED
|
@@ -93,4 +93,4 @@ ${s}</tr>
|
|
| 93 |
`}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${Zt(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:o,tokens:a}){const f=this.parser.parseInline(a),p=Kc(s);if(p===null)return f;s=p;let y='<a href="'+s+'"';return o&&(y+=' title="'+Zt(o)+'"'),y+=">"+f+"</a>",y}image({href:s,title:o,text:a}){const f=Kc(s);if(f===null)return Zt(a);s=f;let p=`<img src="${s}" alt="${a}"`;return o&&(p+=` title="${Zt(o)}"`),p+=">",p}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:Zt(s.text)}}class hu{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}}class At{constructor(s){Te(this,"options");Te(this,"renderer");Te(this,"textRenderer");this.options=s||hr,this.options.renderer=this.options.renderer||new so,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new hu}static parse(s,o){return new At(o).parse(s)}static parseInline(s,o){return new At(o).parseInline(s)}parse(s,o=!0){var f,p;let a="";for(let y=0;y<s.length;y++){const k=s[y];if((p=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&p[k.type]){const T=k,S=this.options.extensions.renderers[T.type].call({parser:this},T);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(T.type)){a+=S||"";continue}}const _=k;switch(_.type){case"space":{a+=this.renderer.space(_);continue}case"hr":{a+=this.renderer.hr(_);continue}case"heading":{a+=this.renderer.heading(_);continue}case"code":{a+=this.renderer.code(_);continue}case"table":{a+=this.renderer.table(_);continue}case"blockquote":{a+=this.renderer.blockquote(_);continue}case"list":{a+=this.renderer.list(_);continue}case"html":{a+=this.renderer.html(_);continue}case"paragraph":{a+=this.renderer.paragraph(_);continue}case"text":{let T=_,S=this.renderer.text(T);for(;y+1<s.length&&s[y+1].type==="text";)T=s[++y],S+=`
|
| 94 |
`+this.renderer.text(T);o?a+=this.renderer.paragraph({type:"paragraph",raw:S,text:S,tokens:[{type:"text",raw:S,text:S,escaped:!0}]}):a+=S;continue}default:{const T='Token with "'+_.type+'" type was not found.';if(this.options.silent)return console.error(T),"";throw new Error(T)}}}return a}parseInline(s,o=this.renderer){var f,p;let a="";for(let y=0;y<s.length;y++){const k=s[y];if((p=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&p[k.type]){const T=this.options.extensions.renderers[k.type].call({parser:this},k);if(T!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(k.type)){a+=T||"";continue}}const _=k;switch(_.type){case"escape":{a+=o.text(_);break}case"html":{a+=o.html(_);break}case"link":{a+=o.link(_);break}case"image":{a+=o.image(_);break}case"strong":{a+=o.strong(_);break}case"em":{a+=o.em(_);break}case"codespan":{a+=o.codespan(_);break}case"br":{a+=o.br(_);break}case"del":{a+=o.del(_);break}case"text":{a+=o.text(_);break}default:{const T='Token with "'+_.type+'" type was not found.';if(this.options.silent)return console.error(T),"";throw new Error(T)}}}return a}}class Hl{constructor(s){Te(this,"options");Te(this,"block");this.options=s||hr}preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}provideLexer(){return this.block?Pt.lex:Pt.lexInline}provideParser(){return this.block?At.parse:At.parseInline}}Te(Hl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class ih{constructor(...s){Te(this,"defaults",su());Te(this,"options",this.setOptions);Te(this,"parse",this.parseMarkdown(!0));Te(this,"parseInline",this.parseMarkdown(!1));Te(this,"Parser",At);Te(this,"Renderer",so);Te(this,"TextRenderer",hu);Te(this,"Lexer",Pt);Te(this,"Tokenizer",oo);Te(this,"Hooks",Hl);this.use(...s)}walkTokens(s,o){var f,p;let a=[];for(const y of s)switch(a=a.concat(o.call(this,y)),y.type){case"table":{const k=y;for(const _ of k.header)a=a.concat(this.walkTokens(_.tokens,o));for(const _ of k.rows)for(const T of _)a=a.concat(this.walkTokens(T.tokens,o));break}case"list":{const k=y;a=a.concat(this.walkTokens(k.items,o));break}default:{const k=y;(p=(f=this.defaults.extensions)==null?void 0:f.childTokens)!=null&&p[k.type]?this.defaults.extensions.childTokens[k.type].forEach(_=>{const T=k[_].flat(1/0);a=a.concat(this.walkTokens(T,o))}):k.tokens&&(a=a.concat(this.walkTokens(k.tokens,o)))}}return a}use(...s){const o=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(a=>{const f={...a};if(f.async=this.defaults.async||f.async||!1,a.extensions&&(a.extensions.forEach(p=>{if(!p.name)throw new Error("extension name required");if("renderer"in p){const y=o.renderers[p.name];y?o.renderers[p.name]=function(...k){let _=p.renderer.apply(this,k);return _===!1&&(_=y.apply(this,k)),_}:o.renderers[p.name]=p.renderer}if("tokenizer"in p){if(!p.level||p.level!=="block"&&p.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const y=o[p.level];y?y.unshift(p.tokenizer):o[p.level]=[p.tokenizer],p.start&&(p.level==="block"?o.startBlock?o.startBlock.push(p.start):o.startBlock=[p.start]:p.level==="inline"&&(o.startInline?o.startInline.push(p.start):o.startInline=[p.start]))}"childTokens"in p&&p.childTokens&&(o.childTokens[p.name]=p.childTokens)}),f.extensions=o),a.renderer){const p=this.defaults.renderer||new so(this.defaults);for(const y in a.renderer){if(!(y in p))throw new Error(`renderer '${y}' does not exist`);if(["options","parser"].includes(y))continue;const k=y,_=a.renderer[k],T=p[k];p[k]=(...S)=>{let O=_.apply(p,S);return O===!1&&(O=T.apply(p,S)),O||""}}f.renderer=p}if(a.tokenizer){const p=this.defaults.tokenizer||new oo(this.defaults);for(const y in a.tokenizer){if(!(y in p))throw new Error(`tokenizer '${y}' does not exist`);if(["options","rules","lexer"].includes(y))continue;const k=y,_=a.tokenizer[k],T=p[k];p[k]=(...S)=>{let O=_.apply(p,S);return O===!1&&(O=T.apply(p,S)),O}}f.tokenizer=p}if(a.hooks){const p=this.defaults.hooks||new Hl;for(const y in a.hooks){if(!(y in p))throw new Error(`hook '${y}' does not exist`);if(["options","block"].includes(y))continue;const k=y,_=a.hooks[k],T=p[k];Hl.passThroughHooks.has(y)?p[k]=S=>{if(this.defaults.async)return Promise.resolve(_.call(p,S)).then(M=>T.call(p,M));const O=_.call(p,S);return T.call(p,O)}:p[k]=(...S)=>{let O=_.apply(p,S);return O===!1&&(O=T.apply(p,S)),O}}f.hooks=p}if(a.walkTokens){const p=this.defaults.walkTokens,y=a.walkTokens;f.walkTokens=function(k){let _=[];return _.push(y.call(this,k)),p&&(_=_.concat(p.call(this,k))),_}}this.defaults={...this.defaults,...f}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,o){return Pt.lex(s,o??this.defaults)}parser(s,o){return At.parse(s,o??this.defaults)}parseMarkdown(s){return(a,f)=>{const p={...f},y={...this.defaults,...p},k=this.onError(!!y.silent,!!y.async);if(this.defaults.async===!0&&p.async===!1)return k(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof a>"u"||a===null)return k(new Error("marked(): input parameter is undefined or null"));if(typeof a!="string")return k(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(a)+", string expected"));y.hooks&&(y.hooks.options=y,y.hooks.block=s);const _=y.hooks?y.hooks.provideLexer():s?Pt.lex:Pt.lexInline,T=y.hooks?y.hooks.provideParser():s?At.parse:At.parseInline;if(y.async)return Promise.resolve(y.hooks?y.hooks.preprocess(a):a).then(S=>_(S,y)).then(S=>y.hooks?y.hooks.processAllTokens(S):S).then(S=>y.walkTokens?Promise.all(this.walkTokens(S,y.walkTokens)).then(()=>S):S).then(S=>T(S,y)).then(S=>y.hooks?y.hooks.postprocess(S):S).catch(k);try{y.hooks&&(a=y.hooks.preprocess(a));let S=_(a,y);y.hooks&&(S=y.hooks.processAllTokens(S)),y.walkTokens&&this.walkTokens(S,y.walkTokens);let O=T(S,y);return y.hooks&&(O=y.hooks.postprocess(O)),O}catch(S){return k(S)}}}onError(s,o){return a=>{if(a.message+=`
|
| 95 |
Please report this to https://github.com/markedjs/marked.`,s){const f="<p>An error occurred:</p><pre>"+Zt(a.message+"",!0)+"</pre>";return o?Promise.resolve(f):f}if(o)return Promise.reject(a);throw a}}}const pr=new ih;function we(d,s){return pr.parse(d,s)}we.options=we.setOptions=function(d){return pr.setOptions(d),we.defaults=pr.defaults,hf(we.defaults),we};we.getDefaults=su;we.defaults=hr;we.use=function(...d){return pr.use(...d),we.defaults=pr.defaults,hf(we.defaults),we};we.walkTokens=function(d,s){return pr.walkTokens(d,s)};we.parseInline=pr.parseInline;we.Parser=At;we.parser=At.parse;we.Renderer=so;we.TextRenderer=hu;we.Lexer=Pt;we.lexer=Pt.lex;we.Tokenizer=oo;we.Hooks=Hl;we.parse=we;we.options;we.setOptions;we.use;we.walkTokens;we.parseInline;At.parse;Pt.lex;/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */const{entries:Ef,setPrototypeOf:qc,isFrozen:oh,getPrototypeOf:sh,getOwnPropertyDescriptor:uh}=Object;let{freeze:ot,seal:Mt,create:_f}=Object,{apply:nu,construct:ru}=typeof Reflect<"u"&&Reflect;ot||(ot=function(s){return s});Mt||(Mt=function(s){return s});nu||(nu=function(s,o,a){return s.apply(o,a)});ru||(ru=function(s,o){return new s(...o)});const no=st(Array.prototype.forEach),ah=st(Array.prototype.lastIndexOf),Jc=st(Array.prototype.pop),zl=st(Array.prototype.push),ch=st(Array.prototype.splice),lo=st(String.prototype.toLowerCase),Xs=st(String.prototype.toString),ef=st(String.prototype.match),Ol=st(String.prototype.replace),fh=st(String.prototype.indexOf),dh=st(String.prototype.trim),Ht=st(Object.prototype.hasOwnProperty),lt=st(RegExp.prototype.test),Il=ph(TypeError);function st(d){return function(s){for(var o=arguments.length,a=new Array(o>1?o-1:0),f=1;f<o;f++)a[f-1]=arguments[f];return nu(d,s,a)}}function ph(d){return function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];return ru(d,o)}}function se(d,s){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:lo;qc&&qc(d,null);let a=s.length;for(;a--;){let f=s[a];if(typeof f=="string"){const p=o(f);p!==f&&(oh(s)||(s[a]=p),f=p)}d[f]=!0}return d}function hh(d){for(let s=0;s<d.length;s++)Ht(d,s)||(d[s]=null);return d}function dr(d){const s=_f(null);for(const[o,a]of Ef(d))Ht(d,o)&&(Array.isArray(a)?s[o]=hh(a):a&&typeof a=="object"&&a.constructor===Object?s[o]=dr(a):s[o]=a);return s}function Dl(d,s){for(;d!==null;){const a=uh(d,s);if(a){if(a.get)return st(a.get);if(typeof a.value=="function")return st(a.value)}d=sh(d)}function o(){return null}return o}const tf=ot(["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"]),Zs=ot(["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"]),qs=ot(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),mh=ot(["animate","color-profile","cursor","discard","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"]),Js=ot(["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","mprescripts"]),gh=ot(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),nf=ot(["#text"]),rf=ot(["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","popover","popovertarget","popovertargetaction","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","wrap","xmlns","slot"]),eu=ot(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","exponent","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","intercept","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","slope","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","tablevalues","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"]),lf=ot(["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"]),ro=ot(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),yh=Mt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),vh=Mt(/<%[\w\W]*|[\w\W]*%>/gm),kh=Mt(/\$\{[\w\W]*/gm),wh=Mt(/^data-[\-\w.\u00B7-\uFFFF]+$/),xh=Mt(/^aria-[\-\w]+$/),Tf=Mt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Sh=Mt(/^(?:\w+script|data):/i),Eh=Mt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Cf=Mt(/^html$/i),_h=Mt(/^[a-z][.\w]*(-[.\w]+)+$/i);var of=Object.freeze({__proto__:null,ARIA_ATTR:xh,ATTR_WHITESPACE:Eh,CUSTOM_ELEMENT:_h,DATA_ATTR:wh,DOCTYPE_NAME:Cf,ERB_EXPR:vh,IS_ALLOWED_URI:Tf,IS_SCRIPT_OR_DATA:Sh,MUSTACHE_EXPR:yh,TMPLIT_EXPR:kh});const jl={element:1,text:3,progressingInstruction:7,comment:8,document:9},Th=function(){return typeof window>"u"?null:window},Ch=function(s,o){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let a=null;const f="data-tt-policy-suffix";o&&o.hasAttribute(f)&&(a=o.getAttribute(f));const p="dompurify"+(a?"#"+a:"");try{return s.createPolicy(p,{createHTML(y){return y},createScriptURL(y){return y}})}catch{return console.warn("TrustedTypes policy "+p+" could not be created."),null}},sf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Rf(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Th();const s=Q=>Rf(Q);if(s.version="3.2.4",s.removed=[],!d||!d.document||d.document.nodeType!==jl.document||!d.Element)return s.isSupported=!1,s;let{document:o}=d;const a=o,f=a.currentScript,{DocumentFragment:p,HTMLTemplateElement:y,Node:k,Element:_,NodeFilter:T,NamedNodeMap:S=d.NamedNodeMap||d.MozNamedAttrMap,HTMLFormElement:O,DOMParser:M,trustedTypes:D}=d,G=_.prototype,j=Dl(G,"cloneNode"),b=Dl(G,"remove"),ce=Dl(G,"nextSibling"),ye=Dl(G,"childNodes"),Ce=Dl(G,"parentNode");if(typeof y=="function"){const Q=o.createElement("template");Q.content&&Q.content.ownerDocument&&(o=Q.content.ownerDocument)}let ee,fe="";const{implementation:te,createNodeIterator:xe,createDocumentFragment:de,getElementsByTagName:wt}=o,{importNode:ne}=a;let ue=sf();s.isSupported=typeof Ef=="function"&&typeof Ce=="function"&&te&&te.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:_e,ERB_EXPR:ve,TMPLIT_EXPR:ze,DATA_ATTR:ut,ARIA_ATTR:We,IS_SCRIPT_OR_DATA:Re,ATTR_WHITESPACE:I,CUSTOM_ELEMENT:K}=of;let{IS_ALLOWED_URI:F}=of,v=null;const R=se({},[...tf,...Zs,...qs,...Js,...nf]);let Y=null;const re=se({},[...rf,...eu,...lf,...ro]);let X=Object.seal(_f(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}})),ie=null,ge=null,pe=!0,Se=!0,Xe=!1,Vn=!0,qt=!1,pn=!0,zt=!1,mr=!1,gr=!1,Wt=!1,Qn=!1,hn=!1,mn=!0,Jt=!1;const Qr="user-content-";let yr=!0,gn=!1,en={},tn=null;const vr=se({},["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"]);let Gn=null;const Gr=se({},["audio","video","img","source","image","track"]);let nn=null;const yn=se({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kr="http://www.w3.org/1998/Math/MathML",Yn="http://www.w3.org/2000/svg",xt="http://www.w3.org/1999/xhtml";let vn=xt,bn=!1,Kn=null;const Yr=se({},[kr,Yn,xt],Xs);let kn=se({},["mi","mo","mn","ms","mtext"]),wn=se({},["annotation-xml"]);const xn=se({},["title","style","font","a","script"]);let St=null;const Vl=["application/xhtml+xml","text/html"],Ql="text/html";let je=null,rn=null;const Gl=o.createElement("form"),wr=function(m){return m instanceof RegExp||m instanceof Function},xr=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(rn&&rn===m)){if((!m||typeof m!="object")&&(m={}),m=dr(m),St=Vl.indexOf(m.PARSER_MEDIA_TYPE)===-1?Ql:m.PARSER_MEDIA_TYPE,je=St==="application/xhtml+xml"?Xs:lo,v=Ht(m,"ALLOWED_TAGS")?se({},m.ALLOWED_TAGS,je):R,Y=Ht(m,"ALLOWED_ATTR")?se({},m.ALLOWED_ATTR,je):re,Kn=Ht(m,"ALLOWED_NAMESPACES")?se({},m.ALLOWED_NAMESPACES,Xs):Yr,nn=Ht(m,"ADD_URI_SAFE_ATTR")?se(dr(yn),m.ADD_URI_SAFE_ATTR,je):yn,Gn=Ht(m,"ADD_DATA_URI_TAGS")?se(dr(Gr),m.ADD_DATA_URI_TAGS,je):Gr,tn=Ht(m,"FORBID_CONTENTS")?se({},m.FORBID_CONTENTS,je):vr,ie=Ht(m,"FORBID_TAGS")?se({},m.FORBID_TAGS,je):{},ge=Ht(m,"FORBID_ATTR")?se({},m.FORBID_ATTR,je):{},en=Ht(m,"USE_PROFILES")?m.USE_PROFILES:!1,pe=m.ALLOW_ARIA_ATTR!==!1,Se=m.ALLOW_DATA_ATTR!==!1,Xe=m.ALLOW_UNKNOWN_PROTOCOLS||!1,Vn=m.ALLOW_SELF_CLOSE_IN_ATTR!==!1,qt=m.SAFE_FOR_TEMPLATES||!1,pn=m.SAFE_FOR_XML!==!1,zt=m.WHOLE_DOCUMENT||!1,Wt=m.RETURN_DOM||!1,Qn=m.RETURN_DOM_FRAGMENT||!1,hn=m.RETURN_TRUSTED_TYPE||!1,gr=m.FORCE_BODY||!1,mn=m.SANITIZE_DOM!==!1,Jt=m.SANITIZE_NAMED_PROPS||!1,yr=m.KEEP_CONTENT!==!1,gn=m.IN_PLACE||!1,F=m.ALLOWED_URI_REGEXP||Tf,vn=m.NAMESPACE||xt,kn=m.MATHML_TEXT_INTEGRATION_POINTS||kn,wn=m.HTML_INTEGRATION_POINTS||wn,X=m.CUSTOM_ELEMENT_HANDLING||{},m.CUSTOM_ELEMENT_HANDLING&&wr(m.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(X.tagNameCheck=m.CUSTOM_ELEMENT_HANDLING.tagNameCheck),m.CUSTOM_ELEMENT_HANDLING&&wr(m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(X.attributeNameCheck=m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),m.CUSTOM_ELEMENT_HANDLING&&typeof m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(X.allowCustomizedBuiltInElements=m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),qt&&(Se=!1),Qn&&(Wt=!0),en&&(v=se({},nf),Y=[],en.html===!0&&(se(v,tf),se(Y,rf)),en.svg===!0&&(se(v,Zs),se(Y,eu),se(Y,ro)),en.svgFilters===!0&&(se(v,qs),se(Y,eu),se(Y,ro)),en.mathMl===!0&&(se(v,Js),se(Y,lf),se(Y,ro))),m.ADD_TAGS&&(v===R&&(v=dr(v)),se(v,m.ADD_TAGS,je)),m.ADD_ATTR&&(Y===re&&(Y=dr(Y)),se(Y,m.ADD_ATTR,je)),m.ADD_URI_SAFE_ATTR&&se(nn,m.ADD_URI_SAFE_ATTR,je),m.FORBID_CONTENTS&&(tn===vr&&(tn=dr(tn)),se(tn,m.FORBID_CONTENTS,je)),yr&&(v["#text"]=!0),zt&&se(v,["html","head","body"]),v.table&&(se(v,["tbody"]),delete ie.tbody),m.TRUSTED_TYPES_POLICY){if(typeof m.TRUSTED_TYPES_POLICY.createHTML!="function")throw Il('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof m.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Il('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ee=m.TRUSTED_TYPES_POLICY,fe=ee.createHTML("")}else ee===void 0&&(ee=Ch(D,f)),ee!==null&&typeof fe=="string"&&(fe=ee.createHTML(""));ot&&ot(m),rn=m}},Sn=se({},[...Zs,...qs,...mh]),Sr=se({},[...Js,...gh]),Xn=function(m){let A=Ce(m);(!A||!A.tagName)&&(A={namespaceURI:vn,tagName:"template"});const H=lo(m.tagName),Ne=lo(A.tagName);return Kn[m.namespaceURI]?m.namespaceURI===Yn?A.namespaceURI===xt?H==="svg":A.namespaceURI===kr?H==="svg"&&(Ne==="annotation-xml"||kn[Ne]):!!Sn[H]:m.namespaceURI===kr?A.namespaceURI===xt?H==="math":A.namespaceURI===Yn?H==="math"&&wn[Ne]:!!Sr[H]:m.namespaceURI===xt?A.namespaceURI===Yn&&!wn[Ne]||A.namespaceURI===kr&&!kn[Ne]?!1:!Sr[H]&&(xn[H]||!Sn[H]):!!(St==="application/xhtml+xml"&&Kn[m.namespaceURI]):!1},Et=function(m){zl(s.removed,{element:m});try{Ce(m).removeChild(m)}catch{b(m)}},Vt=function(m,A){try{zl(s.removed,{attribute:A.getAttributeNode(m),from:A})}catch{zl(s.removed,{attribute:null,from:A})}if(A.removeAttribute(m),m==="is")if(Wt||Qn)try{Et(A)}catch{}else try{A.setAttribute(m,"")}catch{}},Zn=function(m){let A=null,H=null;if(gr)m="<remove></remove>"+m;else{const le=ef(m,/^[\r\n\t ]+/);H=le&&le[0]}St==="application/xhtml+xml"&&vn===xt&&(m='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+m+"</body></html>");const Ne=ee?ee.createHTML(m):m;if(vn===xt)try{A=new M().parseFromString(Ne,St)}catch{}if(!A||!A.documentElement){A=te.createDocument(vn,"template",null);try{A.documentElement.innerHTML=bn?fe:Ne}catch{}}const Ve=A.body||A.documentElement;return m&&H&&Ve.insertBefore(o.createTextNode(H),Ve.childNodes[0]||null),vn===xt?wt.call(A,zt?"html":"body")[0]:zt?A.documentElement:Ve},qn=function(m){return xe.call(m.ownerDocument||m,m,T.SHOW_ELEMENT|T.SHOW_COMMENT|T.SHOW_TEXT|T.SHOW_PROCESSING_INSTRUCTION|T.SHOW_CDATA_SECTION,null)},Jn=function(m){return m instanceof O&&(typeof m.nodeName!="string"||typeof m.textContent!="string"||typeof m.removeChild!="function"||!(m.attributes instanceof S)||typeof m.removeAttribute!="function"||typeof m.setAttribute!="function"||typeof m.namespaceURI!="string"||typeof m.insertBefore!="function"||typeof m.hasChildNodes!="function")},Yl=function(m){return typeof k=="function"&&m instanceof k};function Ot(Q,m,A){no(Q,H=>{H.call(s,m,A,rn)})}const bl=function(m){let A=null;if(Ot(ue.beforeSanitizeElements,m,null),Jn(m))return Et(m),!0;const H=je(m.nodeName);if(Ot(ue.uponSanitizeElement,m,{tagName:H,allowedTags:v}),m.hasChildNodes()&&!Yl(m.firstElementChild)&<(/<[/\w]/g,m.innerHTML)&<(/<[/\w]/g,m.textContent)||m.nodeType===jl.progressingInstruction||pn&&m.nodeType===jl.comment&<(/<[/\w]/g,m.data))return Et(m),!0;if(!v[H]||ie[H]){if(!ie[H]&&br(H)&&(X.tagNameCheck instanceof RegExp&<(X.tagNameCheck,H)||X.tagNameCheck instanceof Function&&X.tagNameCheck(H)))return!1;if(yr&&!tn[H]){const Ne=Ce(m)||m.parentNode,Ve=ye(m)||m.childNodes;if(Ve&&Ne){const le=Ve.length;for(let Ze=le-1;Ze>=0;--Ze){const at=j(Ve[Ze],!0);at.__removalCount=(m.__removalCount||0)+1,Ne.insertBefore(at,ce(m))}}}return Et(m),!0}return m instanceof _&&!Xn(m)||(H==="noscript"||H==="noembed"||H==="noframes")&<(/<\/no(script|embed|frames)/i,m.innerHTML)?(Et(m),!0):(qt&&m.nodeType===jl.text&&(A=m.textContent,no([_e,ve,ze],Ne=>{A=Ol(A,Ne," ")}),m.textContent!==A&&(zl(s.removed,{element:m.cloneNode()}),m.textContent=A)),Ot(ue.afterSanitizeElements,m,null),!1)},Qt=function(m,A,H){if(mn&&(A==="id"||A==="name")&&(H in o||H in Gl))return!1;if(!(Se&&!ge[A]&<(ut,A))){if(!(pe&<(We,A))){if(!Y[A]||ge[A]){if(!(br(m)&&(X.tagNameCheck instanceof RegExp&<(X.tagNameCheck,m)||X.tagNameCheck instanceof Function&&X.tagNameCheck(m))&&(X.attributeNameCheck instanceof RegExp&<(X.attributeNameCheck,A)||X.attributeNameCheck instanceof Function&&X.attributeNameCheck(A))||A==="is"&&X.allowCustomizedBuiltInElements&&(X.tagNameCheck instanceof RegExp&<(X.tagNameCheck,H)||X.tagNameCheck instanceof Function&&X.tagNameCheck(H))))return!1}else if(!nn[A]){if(!lt(F,Ol(H,I,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&m!=="script"&&fh(H,"data:")===0&&Gn[m])){if(!(Xe&&!lt(Re,Ol(H,I,"")))){if(H)return!1}}}}}}return!0},br=function(m){return m!=="annotation-xml"&&ef(m,K)},Kr=function(m){Ot(ue.beforeSanitizeAttributes,m,null);const{attributes:A}=m;if(!A||Jn(m))return;const H={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let Ne=A.length;for(;Ne--;){const Ve=A[Ne],{name:le,namespaceURI:Ze,value:at}=Ve,En=je(le);let Ue=le==="value"?at:dh(at);if(H.attrName=En,H.attrValue=Ue,H.keepAttr=!0,H.forceKeepAttr=void 0,Ot(ue.uponSanitizeAttribute,m,H),Ue=H.attrValue,Jt&&(En==="id"||En==="name")&&(Vt(le,m),Ue=Qr+Ue),pn&<(/((--!?|])>)|<\/(style|title)/i,Ue)){Vt(le,m);continue}if(H.forceKeepAttr||(Vt(le,m),!H.keepAttr))continue;if(!Vn&<(/\/>/i,Ue)){Vt(le,m);continue}qt&&no([_e,ve,ze],Xr=>{Ue=Ol(Ue,Xr," ")});const Kl=je(m.nodeName);if(Qt(Kl,En,Ue)){if(ee&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!Ze)switch(D.getAttributeType(Kl,En)){case"TrustedHTML":{Ue=ee.createHTML(Ue);break}case"TrustedScriptURL":{Ue=ee.createScriptURL(Ue);break}}try{Ze?m.setAttributeNS(Ze,le,Ue):m.setAttribute(le,Ue),Jn(m)?Et(m):Jc(s.removed)}catch{}}}Ot(ue.afterSanitizeAttributes,m,null)},co=function Q(m){let A=null;const H=qn(m);for(Ot(ue.beforeSanitizeShadowDOM,m,null);A=H.nextNode();)Ot(ue.uponSanitizeShadowNode,A,null),bl(A),Kr(A),A.content instanceof p&&Q(A.content);Ot(ue.afterSanitizeShadowDOM,m,null)};return s.sanitize=function(Q){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,H=null,Ne=null,Ve=null;if(bn=!Q,bn&&(Q="<!-->"),typeof Q!="string"&&!Yl(Q))if(typeof Q.toString=="function"){if(Q=Q.toString(),typeof Q!="string")throw Il("dirty is not a string, aborting")}else throw Il("toString is not a function");if(!s.isSupported)return Q;if(mr||xr(m),s.removed=[],typeof Q=="string"&&(gn=!1),gn){if(Q.nodeName){const at=je(Q.nodeName);if(!v[at]||ie[at])throw Il("root node is forbidden and cannot be sanitized in-place")}}else if(Q instanceof k)A=Zn("<!---->"),H=A.ownerDocument.importNode(Q,!0),H.nodeType===jl.element&&H.nodeName==="BODY"||H.nodeName==="HTML"?A=H:A.appendChild(H);else{if(!Wt&&!qt&&!zt&&Q.indexOf("<")===-1)return ee&&hn?ee.createHTML(Q):Q;if(A=Zn(Q),!A)return Wt?null:hn?fe:""}A&&gr&&Et(A.firstChild);const le=qn(gn?Q:A);for(;Ne=le.nextNode();)bl(Ne),Kr(Ne),Ne.content instanceof p&&co(Ne.content);if(gn)return Q;if(Wt){if(Qn)for(Ve=de.call(A.ownerDocument);A.firstChild;)Ve.appendChild(A.firstChild);else Ve=A;return(Y.shadowroot||Y.shadowrootmode)&&(Ve=ne.call(a,Ve,!0)),Ve}let Ze=zt?A.outerHTML:A.innerHTML;return zt&&v["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&<(Cf,A.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
| 96 |
-
`+Ze),qt&&no([_e,ve,ze],at=>{Ze=Ol(Ze,at," ")}),ee&&hn?ee.createHTML(Ze):Ze},s.setConfig=function(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xr(Q),mr=!0},s.clearConfig=function(){rn=null,mr=!1},s.isValidAttribute=function(Q,m,A){rn||xr({});const H=je(Q),Ne=je(m);return Qt(H,Ne,A)},s.addHook=function(Q,m){typeof m=="function"&&zl(ue[Q],m)},s.removeHook=function(Q,m){if(m!==void 0){const A=ah(ue[Q],m);return A===-1?void 0:ch(ue[Q],A,1)[0]}return Jc(ue[Q])},s.removeHooks=function(Q){ue[Q]=[]},s.removeAllHooks=function(){ue=sf()},s}var Rh=Rf();function Nh(d){return C.jsxs("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("path",{d:"M12 8V4H8"}),C.jsx("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),C.jsx("path",{d:"M2 14h2"}),C.jsx("path",{d:"M20 14h2"}),C.jsx("path",{d:"M15 13v2"}),C.jsx("path",{d:"M9 13v2"})]})}function Lh(d){return C.jsx("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:C.jsx("path",{className:"stroke-gray-600 dark:stroke-gray-400",d:"M16 6v3.33M16 6c0-2.65 3.25-4.3 5.4-2.62 1.2.95 1.6 2.65.95 4.04a3.63 3.63 0 0 1 4.61.16 3.45 3.45 0 0 1 .46 4.37 5.32 5.32 0 0 1 1.87 4.75c-.22 1.66-1.39 3.6-3.07 4.14M16 6c0-2.65-3.25-4.3-5.4-2.62a3.37 3.37 0 0 0-.95 4.04 3.65 3.65 0 0 0-4.6.16 3.37 3.37 0 0 0-.49 4.27 5.57 5.57 0 0 0-1.85 4.85 5.3 5.3 0 0 0 3.07 4.15M16 9.33v17.34m0-17.34c0 2.18 1.82 4 4 4m6.22 7.5c.67 1.3.56 2.91-.27 4.11a4.05 4.05 0 0 1-4.62 1.5c0 1.53-1.05 2.9-2.66 2.9A2.7 2.7 0 0 1 16 26.66m10.22-5.83a4.05 4.05 0 0 0-3.55-2.17m-16.9 2.18a4.05 4.05 0 0 0 .28 4.1c1 1.44 2.92 2.09 4.59 1.5 0 1.52 1.12 2.88 2.7 2.88A2.7 2.7 0 0 0 16 26.67M5.78 20.85a4.04 4.04 0 0 1 3.55-2.18"})})}function Ph(d){return C.jsxs("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),C.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}var lu=function(){return(lu=Object.assign||function(d){for(var s,o=1,a=arguments.length;o<a;o++)for(var f in s=arguments[o])Object.prototype.hasOwnProperty.call(s,f)&&(d[f]=s[f]);return d}).apply(this,arguments)},Fl,Ul,iu=me.createContext(void 0),uf="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=TeX-MML-AM_CHTML",af="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js",Ah=function(S){var s=S.config,o=S.version,o=o===void 0?3:o,a=S.src,a=a===void 0?o===2?uf:af:a,f=S.onStartup,p=S.onLoad,y=S.onError,k=S.typesettingOptions,_=S.renderMode,_=_===void 0?"post":_,T=S.hideUntilTypeset,S=S.children,M=me.useContext(iu);if((M==null?void 0:M.version)!==void 0&&(M==null?void 0:M.version)!==o)throw Error("Cannot nest MathJaxContexts with different versions. MathJaxContexts should not be nested at all but if they are, they cannot have different versions. Stick with one version of MathJax in your app and avoid using more than one MathJaxContext.");if(o===2&&Ul!==void 0||o===3&&Fl!==void 0)throw Error("Cannot use MathJax versions 2 and 3 simultaneously in the same app due to how MathJax is set up in the browser; either you have multiple MathJaxContexts with different versions or you have mounted and unmounted MathJaxContexts with different versions. Please stick with one version of MathJax in your app. File an issue in the project Github page if you need this feature.");var O=me.useRef(M),M=me.useRef((M==null?void 0:M.version)||null);if(M.current===null)M.current=o;else if(M.current!==o)throw Error("Cannot change version of MathJax in a MathJaxContext after it has mounted. Reload the page with a new version when this must happen.");var D=a||(o===2?uf:af);function G(j,b){s&&(window.MathJax=s);var ce=document.createElement("script");ce.type="text/javascript",ce.src=D,ce.async=!1,ce.addEventListener("load",function(){var ye=window.MathJax;f&&f(ye),j(ye),p&&p()}),ce.addEventListener("error",function(ye){return b(ye)}),document.getElementsByTagName("head")[0].appendChild(ce)}return O.current===void 0&&(M={typesettingOptions:k,renderMode:_,hideUntilTypeset:T},o===2?Fl===void 0&&(typeof window<"u"?(Fl=new Promise(G)).catch(function(j){if(!y)throw Error("Failed to download MathJax version 2 from '".concat(D,"' due to: ").concat(j));y(j)}):(Fl=Promise.reject()).catch(function(j){})):Ul===void 0&&(typeof window<"u"?(Ul=new Promise(G)).catch(function(j){if(!y)throw Error("Failed to download MathJax version 3 from '".concat(D,"' due to: ").concat(j));y(j)}):(Ul=Promise.reject()).catch(function(j){})),O.current=lu(lu({},M),o===2?{version:2,promise:Fl}:{version:3,promise:Ul})),pf.createElement(iu.Provider,{value:O.current},S)},Wn=function(){return(Wn=Object.assign||function(d){for(var s,o=1,a=arguments.length;o<a;o++)for(var f in s=arguments[o])Object.prototype.hasOwnProperty.call(s,f)&&(d[f]=s[f]);return d}).apply(this,arguments)},Mh=function(d,s){var o={};for(f in d)Object.prototype.hasOwnProperty.call(d,f)&&s.indexOf(f)<0&&(o[f]=d[f]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,f=Object.getOwnPropertySymbols(d);a<f.length;a++)s.indexOf(f[a])<0&&Object.prototype.propertyIsEnumerable.call(d,f[a])&&(o[f[a]]=d[f[a]]);return o},$l=function(d){return"Typesetting failed: ".concat(d.message!==void 0?d.message:d.toString())},cf=function(d){function s(){var fe;j==="every"&&ye&&b==="post"&&D.current!==null&&(D.current.style.visibility=(fe=(fe=O.style)==null?void 0:fe.visibility)!=null?fe:"visible"),Ce.current||(j==="first"&&D.current!==null&&(D.current.style.visibility="visible"),f&&f(),Ce.current=!0),p&&p(),ee.current=!1}var a=d.inline,o=a!==void 0&&a,a=d.hideUntilTypeset,f=d.onInitTypeset,p=d.onTypeset,y=d.text,k=d.dynamic,_=d.typesettingOptions,T=d.renderMode,S=d.children,O=Mh(d,["inline","hideUntilTypeset","onInitTypeset","onTypeset","text","dynamic","typesettingOptions","renderMode","children"]),M=me.useRef(""),D=me.useRef(null),G=me.useContext(iu),j=a??(G==null?void 0:G.hideUntilTypeset),b=T??(G==null?void 0:G.renderMode),ce=_??(G==null?void 0:G.typesettingOptions),ye=k!==!1&&(k||!1),Ce=me.useRef(!1),ee=me.useRef(!1);return!ee.current&&D.current!==null&&ye&&j==="every"&&b==="post"&&(D.current.style.visibility="hidden"),(typeof window<"u"?me.useLayoutEffect:me.useEffect)(function(){if((ye||!Ce.current)&&D.current!==null){if(!G)throw Error("MathJax was not loaded, did you use the MathJax component outside of a MathJaxContext?");if(b==="pre"){if(!(typeof(fe=y)=="string"&&0<fe.length))throw Error(`Render mode 'pre' requires text prop to be set and non-empty, which was currently "`.concat(y,'"'));if(!_||!_.fn)throw Error("Render mode 'pre' requires 'typesettingOptions' prop with 'fn' property to be set on MathJax element or in the MathJaxContext");if(G.version===2)throw Error("Render mode 'pre' only available with MathJax 3, and version 2 is currently in use")}b!=="post"&&y===M.current||ee.current||(ee.current=!0,G.version===3?G.promise.then(function(te){var xe;b==="pre"?(xe=function(de){M.current=y,te.startup.document.clear(),te.startup.document.updateDocument(),D.current!==null&&(D.current.innerHTML=de.outerHTML),s()},_.fn.endsWith("Promise")?te.startup.promise.then(function(){return te[ce.fn](y,Wn(Wn({},(ce==null?void 0:ce.options)||{}),{display:!o}))}).then(xe).catch(function(de){throw s(),Error($l(de))}):te.startup.promise.then(function(){var de=te[ce.fn](y,Wn(Wn({},(ce==null?void 0:ce.options)||{}),{display:!o}));xe(de)}).catch(function(de){throw s(),Error($l(de))})):te.startup.promise.then(function(){return te.typesetClear([D.current]),te.typesetPromise([D.current])}).then(s).catch(function(de){throw s(),Error($l(de))})}).catch(function(te){throw s(),Error($l(te))}):G.promise.then(function(te){te.Hub.Queue(["Typeset",te.Hub,D.current]),te.Hub.Queue(s)}).catch(function(te){throw s(),Error($l(te))}))}var fe}),pf.createElement("span",Wn({},O,{style:Wn(Wn({display:o?"inline":"block"},O.style),{visibility:j?"hidden":(d=O.style)==null?void 0:d.visibility}),ref:D}),S)};function ff(d){return d=d.replace(/\\([\[\]\(\)])/g,"\\\\$1"),Rh.sanitize(we.parse(d,{async:!1,breaks:!0}))}function zh({role:d,content:s,answerIndex:o}){const a=o!==void 0?s.slice(0,o):s,f=o!==void 0?s.slice(o):"",[p,y]=me.useState(!1),k=o===0||f.length>0;return C.jsx("div",{className:"flex items-start space-x-4",children:d==="assistant"?C.jsxs(C.Fragment,{children:[C.jsx(Nh,{className:"h-6 w-6 min-h-6 min-w-6 my-3 text-gray-500 dark:text-gray-300"}),C.jsx("div",{className:"bg-gray-200 dark:bg-gray-700 rounded-lg p-4",children:C.jsx("div",{className:"min-h-6 text-gray-800 dark:text-gray-200 overflow-wrap-anywhere",children:o===0||a.length>0?C.jsxs(C.Fragment,{children:[a.length>0&&C.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg flex flex-col mb-2",children:[C.jsxs("button",{className:"flex items-center gap-2 cursor-pointer p-4 hover:bg-gray-50 dark:hover:bg-gray-900 rounded-lg ",onClick:()=>y(_=>!_),style:{width:p?"100%":"auto"},children:[C.jsx(Lh,{className:k?"":"animate-pulse"}),C.jsx("span",{children:k?"View reasoning.":"Thinking..."}),C.jsx("span",{className:"ml-auto text-gray-700",children:p?"▲":"▼"})]}),p&&C.jsx(cf,{className:"border-t border-gray-200 dark:border-gray-700 px-4 py-2",dynamic:!0,children:C.jsx("span",{className:"markdown",dangerouslySetInnerHTML:{__html:ff(a)}})})]}),k&&C.jsx(cf,{dynamic:!0,children:C.jsx("span",{className:"markdown",dangerouslySetInnerHTML:{__html:ff(f)}})})]}):C.jsxs("span",{className:"h-6 flex items-center gap-1",children:[C.jsx("span",{className:"w-2.5 h-2.5 bg-gray-600 dark:bg-gray-300 rounded-full animate-pulse"}),C.jsx("span",{className:"w-2.5 h-2.5 bg-gray-600 dark:bg-gray-300 rounded-full animate-pulse animation-delay-200"}),C.jsx("span",{className:"w-2.5 h-2.5 bg-gray-600 dark:bg-gray-300 rounded-full animate-pulse animation-delay-400"})]})})})]}):C.jsxs(C.Fragment,{children:[C.jsx(Ph,{className:"h-6 w-6 min-h-6 min-w-6 my-3 text-gray-500 dark:text-gray-300"}),C.jsx("div",{className:"bg-blue-500 text-white rounded-lg p-4",children:C.jsx("p",{className:"min-h-6 overflow-wrap-anywhere",children:s})})]})})}function Oh({messages:d}){const s=d.length===0;return C.jsx("div",{className:`flex-1 p-6 max-w-[960px] w-full ${s?"flex flex-col items-center justify-end":"space-y-4"}`,children:C.jsx(Ah,{children:s?C.jsx("div",{className:"text-xl",children:"Sélectionnez un Prompt ou saissez votre demande. C'est à vous de jouez."}):d.map((o,a)=>C.jsx(zh,{...o},`message-${a}`))})})}function df(d){return C.jsxs("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("path",{d:"M5 12h14"}),C.jsx("path",{d:"m12 5 7 7-7 7"})]})}function Ih(d){return C.jsxs("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("path",{d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}),C.jsx("path",{fill:"currentColor",d:"M9 9.563C9 9.252 9.252 9 9.563 9h4.874c.311 0 .563.252.563.563v4.874c0 .311-.252.563-.563.563H9.564A.562.562 0 0 1 9 14.437V9.564Z"})]})}function Dh(d){const s=d==0?0:Math.floor(Math.log(d)/Math.log(1024));return+(d/Math.pow(1024,s)).toFixed(2)*1+["B","kB","MB","GB","TB"][s]}function jh({text:d,percentage:s,total:o}){return s??(s=0),C.jsx("div",{className:"w-full bg-gray-100 dark:bg-gray-700 text-left rounded-lg overflow-hidden mb-0.5",children:C.jsxs("div",{className:"bg-blue-400 whitespace-nowrap px-1 text-sm",style:{width:`${s}%`},children:[d," (",s.toFixed(2),"%",isNaN(o)?"":` of ${Dh(o)}`,")"]})})}function Fh(d){return C.jsx("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:C.jsx("path",{d:"M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18"})})}const Uh=!!navigator.gpu,$h=120,Bh=["Solve the equation x^2 - 3x + 2 = 0","Partis en voyage organisé, un groupe de randonneurs est composé de 63 marcheurs, parmi lesquels on retrouve à la fois des hommes, des femmes et des enfants. Sachant que le nombre d'enfants est deux fois supérieur au nombre total d'adultes et qu'il y a, dans le groupe, deux fois plus de femmes que d'hommes, retrouve le nombre total d'hommes sans utiliser d'équation ?","Écrivez un code Python permettant de calculer le n-ième nombre de Fibonacci."];function Hh(){const d=me.useRef(null),s=me.useRef(null),o=me.useRef(null),[a,f]=me.useState(null),[p,y]=me.useState(null),[k,_]=me.useState(""),[T,S]=me.useState([]),[O,M]=me.useState(!1),[D,G]=me.useState(""),[j,b]=me.useState([]),[ce,ye]=me.useState(null),[Ce,ee]=me.useState(null),[fe,te]=me.useState(!1);function xe(ne){b(ue=>[...ue,{role:"user",content:ne}]),ye(null),M(!0),G("")}function de(){d.current.postMessage({type:"interrupt"})}me.useEffect(()=>{wt()},[D]);function wt(){if(!s.current)return;const ne=s.current;ne.style.height="auto";const ue=Math.min(Math.max(ne.scrollHeight,24),200);ne.style.height=`${ue}px`}return me.useEffect(()=>{d.current||(d.current=new Worker(new URL("/assets/worker-CGHCbKK3.js",import.meta.url),{type:"module"}),d.current.postMessage({type:"check"}));const ne=_e=>{switch(_e.data.status){case"loading":f("loading"),_(_e.data.data);break;case"initiate":S(ve=>[...ve,_e.data]);break;case"progress":S(ve=>ve.map(ze=>ze.file===_e.data.file?{...ze,..._e.data}:ze));break;case"done":S(ve=>ve.filter(ze=>ze.file!==_e.data.file));break;case"ready":f("ready");break;case"start":b(ve=>[...ve,{role:"assistant",content:""}]);break;case"update":{const{output:ve,tps:ze,numTokens:ut,state:We}=_e.data;ye(ze),ee(ut),b(Re=>{const I=[...Re],K=I.at(-1),F={...K,content:K.content+ve};return F.answerIndex===void 0&&We==="answering"&&(F.answerIndex=K.content.length),I[I.length-1]=F,I})}break;case"complete":M(!1);break;case"error":y(_e.data.data);break}},ue=_e=>{console.error("Worker error:",_e)};return d.current.addEventListener("message",ne),d.current.addEventListener("error",ue),()=>{d.current.removeEventListener("message",ne),d.current.removeEventListener("error",ue)}},[]),me.useEffect(()=>{j.filter(ne=>ne.role==="user").length!==0&&j.at(-1).role!=="assistant"&&(ye(null),d.current.postMessage({type:"generate",data:{messages:j,reasonEnabled:fe}}))},[j,O]),me.useEffect(()=>{if(!o.current||!O)return;const ne=o.current;ne.scrollHeight-ne.scrollTop-ne.clientHeight<$h&&(ne.scrollTop=ne.scrollHeight)},[j,O]),Uh?C.jsxs("div",{className:"flex flex-col h-screen mx-auto items justify-end text-gray-800 dark:text-gray-200 bg-white dark:bg-gray-900",children:[a===null&&j.length===0&&C.jsxs("div",{className:"h-full overflow-auto scrollbar-thin flex justify-center items-center flex-col relative",children:[C.jsxs("div",{className:"flex flex-col items-center mb-1 max-w-[360px] text-center",children:[C.jsx("img",{src:"logo.png",width:"80%",height:"auto",className:"block drop-shadow-lg bg-transparent"}),C.jsx("h1",{className:"text-4xl font-bold my-1",children:"Qwen3 WebGPU"}),C.jsx("h2",{className:"font-semibold",children:"A hybrid reasoning model that runs locally in your browser with WebGPU acceleration."})]}),C.jsxs("div",{className:"flex flex-col items-center px-4",children:[C.jsxs("p",{className:"max-w-[480px] mb-4",children:[C.jsx("br",{}),"You are about to load"," ",C.jsx("a",{href:"https://huggingface.co/onnx-community/Qwen3-0.6B-ONNX",target:"_blank",rel:"noreferrer",className:"font-medium underline",children:"Qwen3-0.6B"}),", a 0.6B parameter reasoning LLM optimized for in-browser inference. Everything runs entirely in your browser with"," ",C.jsx("a",{href:"https://huggingface.co/docs/transformers.js",target:"_blank",rel:"noreferrer",className:"underline",children:"🤗 Transformers.js"})," ","and ONNX Runtime Web, meaning no data is sent to a server. Once loaded, it can even be used offline. The source code for the demo is available on"," ",C.jsx("a",{href:"https://github.com/huggingface/transformers.js-examples/tree/main/qwen3-webgpu",target:"_blank",rel:"noreferrer",className:"font-medium underline",children:"GitHub"}),"."]}),p&&C.jsxs("div",{className:"text-red-500 text-center mb-2",children:[C.jsx("p",{className:"mb-1",children:"Unable to load model due to the following error:"}),C.jsx("p",{className:"text-sm",children:p})]}),C.jsx("button",{className:"border px-4 py-2 rounded-lg bg-blue-400 text-white hover:bg-blue-500 disabled:bg-blue-100 cursor-pointer disabled:cursor-not-allowed select-none",onClick:()=>{d.current.postMessage({type:"load"}),f("loading")},disabled:a!==null||p!==null,children:"Load model"})]})]}),a==="loading"&&C.jsx(C.Fragment,{children:C.jsxs("div",{className:"w-full max-w-[500px] text-left mx-auto p-4 bottom-0 mt-auto",children:[C.jsx("p",{className:"text-center mb-1",children:k}),T.map(({file:ne,progress:ue,total:_e},ve)=>C.jsx(jh,{text:ne,percentage:ue,total:_e},ve))]})}),a==="ready"&&C.jsxs("div",{ref:o,className:"overflow-y-auto scrollbar-thin w-full flex flex-col items-center h-full",children:[C.jsx(Oh,{messages:j}),j.length===0&&C.jsx("div",{children:Bh.map((ne,ue)=>C.jsx("div",{className:"m-1 border border-gray-300 dark:border-gray-600 rounded-md p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer max-w-[500px]",onClick:()=>xe(ne),children:ne},ue))}),C.jsx("p",{className:"text-center text-sm min-h-6 text-gray-500 dark:text-gray-300",children:ce&&j.length>0&&C.jsxs(C.Fragment,{children:[!O&&C.jsxs("span",{children:["Generated ",Ce," tokens in"," ",(Ce/ce).toFixed(2)," seconds ("]}),C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"font-medium text-center mr-1 text-black dark:text-white",children:ce.toFixed(2)}),C.jsx("span",{className:"text-gray-500 dark:text-gray-300",children:"tokens/second"})]}),!O&&C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"mr-1",children:")."}),C.jsx("span",{className:"underline cursor-pointer",onClick:()=>{d.current.postMessage({type:"reset"}),b([])},children:"Reset"})]})]})})]}),C.jsxs("div",{className:"w-[600px] max-w-[80%] mx-auto mt-2 mb-3",children:[C.jsxs("div",{className:"border border-gray-300 dark:border-gray-500 dark:bg-gray-700 rounded-lg max-h-[200px] relative flex",children:[C.jsx("textarea",{ref:s,className:"scrollbar-thin w-[550px] px-3 py-4 rounded-lg bg-transparent border-none outline-hidden text-gray-800 disabled:text-gray-400 dark:text-gray-200 placeholder-gray-500 dark:placeholder-gray-300 disabled:placeholder-gray-200 dark:disabled:placeholder-gray-500 resize-none disabled:cursor-not-allowed",placeholder:"Type your message...",type:"text",rows:1,value:D,disabled:a!=="ready",title:a==="ready"?"Model is ready":"Model not loaded yet",onKeyDown:ne=>{D.length>0&&!O&&ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),xe(D))},onInput:ne=>G(ne.target.value)}),O?C.jsx("div",{className:"cursor-pointer",onClick:de,children:C.jsx(Ih,{className:"h-8 w-8 p-1 rounded-md text-gray-800 dark:text-gray-100 absolute right-3 bottom-3"})}):D.length>0?C.jsx("div",{className:"cursor-pointer",onClick:()=>xe(D),children:C.jsx(df,{className:"h-8 w-8 p-1 bg-gray-800 dark:bg-gray-100 text-white dark:text-black rounded-md absolute right-3 bottom-3"})}):C.jsx("div",{children:C.jsx(df,{className:"h-8 w-8 p-1 bg-gray-200 dark:bg-gray-600 text-gray-50 dark:text-gray-800 rounded-md absolute right-3 bottom-3"})})]}),C.jsx("div",{className:"flex justify-end",children:C.jsxs("div",{className:`border pointer-curson mt-1 inline-flex items-center p-2 gap-1 rounded-xl text-sm cursor-pointer ${fe?"border-blue-500 bg-blue-100 text-blue-500 dark:bg-blue-600 dark:text-gray-200":"dark:border-gray-700 bg-gray-800 text-gray-200 dark:text-gray-400"}`,onClick:()=>te(ne=>!ne),children:[C.jsx(Fh,{className:`h-4 w-4 ${fe?"":"stroke-gray-600 dark:stroke-gray-400"}`}),"Reason"]})})]}),C.jsx("p",{className:"text-xs text-gray-400 text-center mb-3",children:"Disclaimer: Generated content may be inaccurate or false."})]}):C.jsxs("div",{className:"fixed w-screen h-screen bg-black z-10 bg-opacity-[92%] text-white text-2xl font-semibold flex justify-center items-center text-center",children:["WebGPU is not supported",C.jsx("br",{}),"by this browser :("]})}_p.createRoot(document.getElementById("root")).render(C.jsx(me.StrictMode,{children:C.jsx(Hh,{})}));
|
|
|
|
| 93 |
`}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${Zt(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:o,tokens:a}){const f=this.parser.parseInline(a),p=Kc(s);if(p===null)return f;s=p;let y='<a href="'+s+'"';return o&&(y+=' title="'+Zt(o)+'"'),y+=">"+f+"</a>",y}image({href:s,title:o,text:a}){const f=Kc(s);if(f===null)return Zt(a);s=f;let p=`<img src="${s}" alt="${a}"`;return o&&(p+=` title="${Zt(o)}"`),p+=">",p}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:Zt(s.text)}}class hu{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}}class At{constructor(s){Te(this,"options");Te(this,"renderer");Te(this,"textRenderer");this.options=s||hr,this.options.renderer=this.options.renderer||new so,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new hu}static parse(s,o){return new At(o).parse(s)}static parseInline(s,o){return new At(o).parseInline(s)}parse(s,o=!0){var f,p;let a="";for(let y=0;y<s.length;y++){const k=s[y];if((p=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&p[k.type]){const T=k,S=this.options.extensions.renderers[T.type].call({parser:this},T);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(T.type)){a+=S||"";continue}}const _=k;switch(_.type){case"space":{a+=this.renderer.space(_);continue}case"hr":{a+=this.renderer.hr(_);continue}case"heading":{a+=this.renderer.heading(_);continue}case"code":{a+=this.renderer.code(_);continue}case"table":{a+=this.renderer.table(_);continue}case"blockquote":{a+=this.renderer.blockquote(_);continue}case"list":{a+=this.renderer.list(_);continue}case"html":{a+=this.renderer.html(_);continue}case"paragraph":{a+=this.renderer.paragraph(_);continue}case"text":{let T=_,S=this.renderer.text(T);for(;y+1<s.length&&s[y+1].type==="text";)T=s[++y],S+=`
|
| 94 |
`+this.renderer.text(T);o?a+=this.renderer.paragraph({type:"paragraph",raw:S,text:S,tokens:[{type:"text",raw:S,text:S,escaped:!0}]}):a+=S;continue}default:{const T='Token with "'+_.type+'" type was not found.';if(this.options.silent)return console.error(T),"";throw new Error(T)}}}return a}parseInline(s,o=this.renderer){var f,p;let a="";for(let y=0;y<s.length;y++){const k=s[y];if((p=(f=this.options.extensions)==null?void 0:f.renderers)!=null&&p[k.type]){const T=this.options.extensions.renderers[k.type].call({parser:this},k);if(T!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(k.type)){a+=T||"";continue}}const _=k;switch(_.type){case"escape":{a+=o.text(_);break}case"html":{a+=o.html(_);break}case"link":{a+=o.link(_);break}case"image":{a+=o.image(_);break}case"strong":{a+=o.strong(_);break}case"em":{a+=o.em(_);break}case"codespan":{a+=o.codespan(_);break}case"br":{a+=o.br(_);break}case"del":{a+=o.del(_);break}case"text":{a+=o.text(_);break}default:{const T='Token with "'+_.type+'" type was not found.';if(this.options.silent)return console.error(T),"";throw new Error(T)}}}return a}}class Hl{constructor(s){Te(this,"options");Te(this,"block");this.options=s||hr}preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}provideLexer(){return this.block?Pt.lex:Pt.lexInline}provideParser(){return this.block?At.parse:At.parseInline}}Te(Hl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class ih{constructor(...s){Te(this,"defaults",su());Te(this,"options",this.setOptions);Te(this,"parse",this.parseMarkdown(!0));Te(this,"parseInline",this.parseMarkdown(!1));Te(this,"Parser",At);Te(this,"Renderer",so);Te(this,"TextRenderer",hu);Te(this,"Lexer",Pt);Te(this,"Tokenizer",oo);Te(this,"Hooks",Hl);this.use(...s)}walkTokens(s,o){var f,p;let a=[];for(const y of s)switch(a=a.concat(o.call(this,y)),y.type){case"table":{const k=y;for(const _ of k.header)a=a.concat(this.walkTokens(_.tokens,o));for(const _ of k.rows)for(const T of _)a=a.concat(this.walkTokens(T.tokens,o));break}case"list":{const k=y;a=a.concat(this.walkTokens(k.items,o));break}default:{const k=y;(p=(f=this.defaults.extensions)==null?void 0:f.childTokens)!=null&&p[k.type]?this.defaults.extensions.childTokens[k.type].forEach(_=>{const T=k[_].flat(1/0);a=a.concat(this.walkTokens(T,o))}):k.tokens&&(a=a.concat(this.walkTokens(k.tokens,o)))}}return a}use(...s){const o=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(a=>{const f={...a};if(f.async=this.defaults.async||f.async||!1,a.extensions&&(a.extensions.forEach(p=>{if(!p.name)throw new Error("extension name required");if("renderer"in p){const y=o.renderers[p.name];y?o.renderers[p.name]=function(...k){let _=p.renderer.apply(this,k);return _===!1&&(_=y.apply(this,k)),_}:o.renderers[p.name]=p.renderer}if("tokenizer"in p){if(!p.level||p.level!=="block"&&p.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const y=o[p.level];y?y.unshift(p.tokenizer):o[p.level]=[p.tokenizer],p.start&&(p.level==="block"?o.startBlock?o.startBlock.push(p.start):o.startBlock=[p.start]:p.level==="inline"&&(o.startInline?o.startInline.push(p.start):o.startInline=[p.start]))}"childTokens"in p&&p.childTokens&&(o.childTokens[p.name]=p.childTokens)}),f.extensions=o),a.renderer){const p=this.defaults.renderer||new so(this.defaults);for(const y in a.renderer){if(!(y in p))throw new Error(`renderer '${y}' does not exist`);if(["options","parser"].includes(y))continue;const k=y,_=a.renderer[k],T=p[k];p[k]=(...S)=>{let O=_.apply(p,S);return O===!1&&(O=T.apply(p,S)),O||""}}f.renderer=p}if(a.tokenizer){const p=this.defaults.tokenizer||new oo(this.defaults);for(const y in a.tokenizer){if(!(y in p))throw new Error(`tokenizer '${y}' does not exist`);if(["options","rules","lexer"].includes(y))continue;const k=y,_=a.tokenizer[k],T=p[k];p[k]=(...S)=>{let O=_.apply(p,S);return O===!1&&(O=T.apply(p,S)),O}}f.tokenizer=p}if(a.hooks){const p=this.defaults.hooks||new Hl;for(const y in a.hooks){if(!(y in p))throw new Error(`hook '${y}' does not exist`);if(["options","block"].includes(y))continue;const k=y,_=a.hooks[k],T=p[k];Hl.passThroughHooks.has(y)?p[k]=S=>{if(this.defaults.async)return Promise.resolve(_.call(p,S)).then(M=>T.call(p,M));const O=_.call(p,S);return T.call(p,O)}:p[k]=(...S)=>{let O=_.apply(p,S);return O===!1&&(O=T.apply(p,S)),O}}f.hooks=p}if(a.walkTokens){const p=this.defaults.walkTokens,y=a.walkTokens;f.walkTokens=function(k){let _=[];return _.push(y.call(this,k)),p&&(_=_.concat(p.call(this,k))),_}}this.defaults={...this.defaults,...f}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,o){return Pt.lex(s,o??this.defaults)}parser(s,o){return At.parse(s,o??this.defaults)}parseMarkdown(s){return(a,f)=>{const p={...f},y={...this.defaults,...p},k=this.onError(!!y.silent,!!y.async);if(this.defaults.async===!0&&p.async===!1)return k(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof a>"u"||a===null)return k(new Error("marked(): input parameter is undefined or null"));if(typeof a!="string")return k(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(a)+", string expected"));y.hooks&&(y.hooks.options=y,y.hooks.block=s);const _=y.hooks?y.hooks.provideLexer():s?Pt.lex:Pt.lexInline,T=y.hooks?y.hooks.provideParser():s?At.parse:At.parseInline;if(y.async)return Promise.resolve(y.hooks?y.hooks.preprocess(a):a).then(S=>_(S,y)).then(S=>y.hooks?y.hooks.processAllTokens(S):S).then(S=>y.walkTokens?Promise.all(this.walkTokens(S,y.walkTokens)).then(()=>S):S).then(S=>T(S,y)).then(S=>y.hooks?y.hooks.postprocess(S):S).catch(k);try{y.hooks&&(a=y.hooks.preprocess(a));let S=_(a,y);y.hooks&&(S=y.hooks.processAllTokens(S)),y.walkTokens&&this.walkTokens(S,y.walkTokens);let O=T(S,y);return y.hooks&&(O=y.hooks.postprocess(O)),O}catch(S){return k(S)}}}onError(s,o){return a=>{if(a.message+=`
|
| 95 |
Please report this to https://github.com/markedjs/marked.`,s){const f="<p>An error occurred:</p><pre>"+Zt(a.message+"",!0)+"</pre>";return o?Promise.resolve(f):f}if(o)return Promise.reject(a);throw a}}}const pr=new ih;function we(d,s){return pr.parse(d,s)}we.options=we.setOptions=function(d){return pr.setOptions(d),we.defaults=pr.defaults,hf(we.defaults),we};we.getDefaults=su;we.defaults=hr;we.use=function(...d){return pr.use(...d),we.defaults=pr.defaults,hf(we.defaults),we};we.walkTokens=function(d,s){return pr.walkTokens(d,s)};we.parseInline=pr.parseInline;we.Parser=At;we.parser=At.parse;we.Renderer=so;we.TextRenderer=hu;we.Lexer=Pt;we.lexer=Pt.lex;we.Tokenizer=oo;we.Hooks=Hl;we.parse=we;we.options;we.setOptions;we.use;we.walkTokens;we.parseInline;At.parse;Pt.lex;/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */const{entries:Ef,setPrototypeOf:qc,isFrozen:oh,getPrototypeOf:sh,getOwnPropertyDescriptor:uh}=Object;let{freeze:ot,seal:Mt,create:_f}=Object,{apply:nu,construct:ru}=typeof Reflect<"u"&&Reflect;ot||(ot=function(s){return s});Mt||(Mt=function(s){return s});nu||(nu=function(s,o,a){return s.apply(o,a)});ru||(ru=function(s,o){return new s(...o)});const no=st(Array.prototype.forEach),ah=st(Array.prototype.lastIndexOf),Jc=st(Array.prototype.pop),zl=st(Array.prototype.push),ch=st(Array.prototype.splice),lo=st(String.prototype.toLowerCase),Xs=st(String.prototype.toString),ef=st(String.prototype.match),Ol=st(String.prototype.replace),fh=st(String.prototype.indexOf),dh=st(String.prototype.trim),Ht=st(Object.prototype.hasOwnProperty),lt=st(RegExp.prototype.test),Il=ph(TypeError);function st(d){return function(s){for(var o=arguments.length,a=new Array(o>1?o-1:0),f=1;f<o;f++)a[f-1]=arguments[f];return nu(d,s,a)}}function ph(d){return function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];return ru(d,o)}}function se(d,s){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:lo;qc&&qc(d,null);let a=s.length;for(;a--;){let f=s[a];if(typeof f=="string"){const p=o(f);p!==f&&(oh(s)||(s[a]=p),f=p)}d[f]=!0}return d}function hh(d){for(let s=0;s<d.length;s++)Ht(d,s)||(d[s]=null);return d}function dr(d){const s=_f(null);for(const[o,a]of Ef(d))Ht(d,o)&&(Array.isArray(a)?s[o]=hh(a):a&&typeof a=="object"&&a.constructor===Object?s[o]=dr(a):s[o]=a);return s}function Dl(d,s){for(;d!==null;){const a=uh(d,s);if(a){if(a.get)return st(a.get);if(typeof a.value=="function")return st(a.value)}d=sh(d)}function o(){return null}return o}const tf=ot(["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"]),Zs=ot(["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"]),qs=ot(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),mh=ot(["animate","color-profile","cursor","discard","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"]),Js=ot(["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","mprescripts"]),gh=ot(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),nf=ot(["#text"]),rf=ot(["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","popover","popovertarget","popovertargetaction","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","wrap","xmlns","slot"]),eu=ot(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","exponent","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","intercept","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","slope","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","tablevalues","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"]),lf=ot(["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"]),ro=ot(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),yh=Mt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),vh=Mt(/<%[\w\W]*|[\w\W]*%>/gm),kh=Mt(/\$\{[\w\W]*/gm),wh=Mt(/^data-[\-\w.\u00B7-\uFFFF]+$/),xh=Mt(/^aria-[\-\w]+$/),Tf=Mt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Sh=Mt(/^(?:\w+script|data):/i),Eh=Mt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Cf=Mt(/^html$/i),_h=Mt(/^[a-z][.\w]*(-[.\w]+)+$/i);var of=Object.freeze({__proto__:null,ARIA_ATTR:xh,ATTR_WHITESPACE:Eh,CUSTOM_ELEMENT:_h,DATA_ATTR:wh,DOCTYPE_NAME:Cf,ERB_EXPR:vh,IS_ALLOWED_URI:Tf,IS_SCRIPT_OR_DATA:Sh,MUSTACHE_EXPR:yh,TMPLIT_EXPR:kh});const jl={element:1,text:3,progressingInstruction:7,comment:8,document:9},Th=function(){return typeof window>"u"?null:window},Ch=function(s,o){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let a=null;const f="data-tt-policy-suffix";o&&o.hasAttribute(f)&&(a=o.getAttribute(f));const p="dompurify"+(a?"#"+a:"");try{return s.createPolicy(p,{createHTML(y){return y},createScriptURL(y){return y}})}catch{return console.warn("TrustedTypes policy "+p+" could not be created."),null}},sf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Rf(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Th();const s=Q=>Rf(Q);if(s.version="3.2.4",s.removed=[],!d||!d.document||d.document.nodeType!==jl.document||!d.Element)return s.isSupported=!1,s;let{document:o}=d;const a=o,f=a.currentScript,{DocumentFragment:p,HTMLTemplateElement:y,Node:k,Element:_,NodeFilter:T,NamedNodeMap:S=d.NamedNodeMap||d.MozNamedAttrMap,HTMLFormElement:O,DOMParser:M,trustedTypes:D}=d,G=_.prototype,j=Dl(G,"cloneNode"),b=Dl(G,"remove"),ce=Dl(G,"nextSibling"),ye=Dl(G,"childNodes"),Ce=Dl(G,"parentNode");if(typeof y=="function"){const Q=o.createElement("template");Q.content&&Q.content.ownerDocument&&(o=Q.content.ownerDocument)}let ee,fe="";const{implementation:te,createNodeIterator:xe,createDocumentFragment:de,getElementsByTagName:wt}=o,{importNode:ne}=a;let ue=sf();s.isSupported=typeof Ef=="function"&&typeof Ce=="function"&&te&&te.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:_e,ERB_EXPR:ve,TMPLIT_EXPR:ze,DATA_ATTR:ut,ARIA_ATTR:We,IS_SCRIPT_OR_DATA:Re,ATTR_WHITESPACE:I,CUSTOM_ELEMENT:K}=of;let{IS_ALLOWED_URI:F}=of,v=null;const R=se({},[...tf,...Zs,...qs,...Js,...nf]);let Y=null;const re=se({},[...rf,...eu,...lf,...ro]);let X=Object.seal(_f(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}})),ie=null,ge=null,pe=!0,Se=!0,Xe=!1,Vn=!0,qt=!1,pn=!0,zt=!1,mr=!1,gr=!1,Wt=!1,Qn=!1,hn=!1,mn=!0,Jt=!1;const Qr="user-content-";let yr=!0,gn=!1,en={},tn=null;const vr=se({},["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"]);let Gn=null;const Gr=se({},["audio","video","img","source","image","track"]);let nn=null;const yn=se({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kr="http://www.w3.org/1998/Math/MathML",Yn="http://www.w3.org/2000/svg",xt="http://www.w3.org/1999/xhtml";let vn=xt,bn=!1,Kn=null;const Yr=se({},[kr,Yn,xt],Xs);let kn=se({},["mi","mo","mn","ms","mtext"]),wn=se({},["annotation-xml"]);const xn=se({},["title","style","font","a","script"]);let St=null;const Vl=["application/xhtml+xml","text/html"],Ql="text/html";let je=null,rn=null;const Gl=o.createElement("form"),wr=function(m){return m instanceof RegExp||m instanceof Function},xr=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(rn&&rn===m)){if((!m||typeof m!="object")&&(m={}),m=dr(m),St=Vl.indexOf(m.PARSER_MEDIA_TYPE)===-1?Ql:m.PARSER_MEDIA_TYPE,je=St==="application/xhtml+xml"?Xs:lo,v=Ht(m,"ALLOWED_TAGS")?se({},m.ALLOWED_TAGS,je):R,Y=Ht(m,"ALLOWED_ATTR")?se({},m.ALLOWED_ATTR,je):re,Kn=Ht(m,"ALLOWED_NAMESPACES")?se({},m.ALLOWED_NAMESPACES,Xs):Yr,nn=Ht(m,"ADD_URI_SAFE_ATTR")?se(dr(yn),m.ADD_URI_SAFE_ATTR,je):yn,Gn=Ht(m,"ADD_DATA_URI_TAGS")?se(dr(Gr),m.ADD_DATA_URI_TAGS,je):Gr,tn=Ht(m,"FORBID_CONTENTS")?se({},m.FORBID_CONTENTS,je):vr,ie=Ht(m,"FORBID_TAGS")?se({},m.FORBID_TAGS,je):{},ge=Ht(m,"FORBID_ATTR")?se({},m.FORBID_ATTR,je):{},en=Ht(m,"USE_PROFILES")?m.USE_PROFILES:!1,pe=m.ALLOW_ARIA_ATTR!==!1,Se=m.ALLOW_DATA_ATTR!==!1,Xe=m.ALLOW_UNKNOWN_PROTOCOLS||!1,Vn=m.ALLOW_SELF_CLOSE_IN_ATTR!==!1,qt=m.SAFE_FOR_TEMPLATES||!1,pn=m.SAFE_FOR_XML!==!1,zt=m.WHOLE_DOCUMENT||!1,Wt=m.RETURN_DOM||!1,Qn=m.RETURN_DOM_FRAGMENT||!1,hn=m.RETURN_TRUSTED_TYPE||!1,gr=m.FORCE_BODY||!1,mn=m.SANITIZE_DOM!==!1,Jt=m.SANITIZE_NAMED_PROPS||!1,yr=m.KEEP_CONTENT!==!1,gn=m.IN_PLACE||!1,F=m.ALLOWED_URI_REGEXP||Tf,vn=m.NAMESPACE||xt,kn=m.MATHML_TEXT_INTEGRATION_POINTS||kn,wn=m.HTML_INTEGRATION_POINTS||wn,X=m.CUSTOM_ELEMENT_HANDLING||{},m.CUSTOM_ELEMENT_HANDLING&&wr(m.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(X.tagNameCheck=m.CUSTOM_ELEMENT_HANDLING.tagNameCheck),m.CUSTOM_ELEMENT_HANDLING&&wr(m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(X.attributeNameCheck=m.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),m.CUSTOM_ELEMENT_HANDLING&&typeof m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(X.allowCustomizedBuiltInElements=m.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),qt&&(Se=!1),Qn&&(Wt=!0),en&&(v=se({},nf),Y=[],en.html===!0&&(se(v,tf),se(Y,rf)),en.svg===!0&&(se(v,Zs),se(Y,eu),se(Y,ro)),en.svgFilters===!0&&(se(v,qs),se(Y,eu),se(Y,ro)),en.mathMl===!0&&(se(v,Js),se(Y,lf),se(Y,ro))),m.ADD_TAGS&&(v===R&&(v=dr(v)),se(v,m.ADD_TAGS,je)),m.ADD_ATTR&&(Y===re&&(Y=dr(Y)),se(Y,m.ADD_ATTR,je)),m.ADD_URI_SAFE_ATTR&&se(nn,m.ADD_URI_SAFE_ATTR,je),m.FORBID_CONTENTS&&(tn===vr&&(tn=dr(tn)),se(tn,m.FORBID_CONTENTS,je)),yr&&(v["#text"]=!0),zt&&se(v,["html","head","body"]),v.table&&(se(v,["tbody"]),delete ie.tbody),m.TRUSTED_TYPES_POLICY){if(typeof m.TRUSTED_TYPES_POLICY.createHTML!="function")throw Il('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof m.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Il('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ee=m.TRUSTED_TYPES_POLICY,fe=ee.createHTML("")}else ee===void 0&&(ee=Ch(D,f)),ee!==null&&typeof fe=="string"&&(fe=ee.createHTML(""));ot&&ot(m),rn=m}},Sn=se({},[...Zs,...qs,...mh]),Sr=se({},[...Js,...gh]),Xn=function(m){let A=Ce(m);(!A||!A.tagName)&&(A={namespaceURI:vn,tagName:"template"});const H=lo(m.tagName),Ne=lo(A.tagName);return Kn[m.namespaceURI]?m.namespaceURI===Yn?A.namespaceURI===xt?H==="svg":A.namespaceURI===kr?H==="svg"&&(Ne==="annotation-xml"||kn[Ne]):!!Sn[H]:m.namespaceURI===kr?A.namespaceURI===xt?H==="math":A.namespaceURI===Yn?H==="math"&&wn[Ne]:!!Sr[H]:m.namespaceURI===xt?A.namespaceURI===Yn&&!wn[Ne]||A.namespaceURI===kr&&!kn[Ne]?!1:!Sr[H]&&(xn[H]||!Sn[H]):!!(St==="application/xhtml+xml"&&Kn[m.namespaceURI]):!1},Et=function(m){zl(s.removed,{element:m});try{Ce(m).removeChild(m)}catch{b(m)}},Vt=function(m,A){try{zl(s.removed,{attribute:A.getAttributeNode(m),from:A})}catch{zl(s.removed,{attribute:null,from:A})}if(A.removeAttribute(m),m==="is")if(Wt||Qn)try{Et(A)}catch{}else try{A.setAttribute(m,"")}catch{}},Zn=function(m){let A=null,H=null;if(gr)m="<remove></remove>"+m;else{const le=ef(m,/^[\r\n\t ]+/);H=le&&le[0]}St==="application/xhtml+xml"&&vn===xt&&(m='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+m+"</body></html>");const Ne=ee?ee.createHTML(m):m;if(vn===xt)try{A=new M().parseFromString(Ne,St)}catch{}if(!A||!A.documentElement){A=te.createDocument(vn,"template",null);try{A.documentElement.innerHTML=bn?fe:Ne}catch{}}const Ve=A.body||A.documentElement;return m&&H&&Ve.insertBefore(o.createTextNode(H),Ve.childNodes[0]||null),vn===xt?wt.call(A,zt?"html":"body")[0]:zt?A.documentElement:Ve},qn=function(m){return xe.call(m.ownerDocument||m,m,T.SHOW_ELEMENT|T.SHOW_COMMENT|T.SHOW_TEXT|T.SHOW_PROCESSING_INSTRUCTION|T.SHOW_CDATA_SECTION,null)},Jn=function(m){return m instanceof O&&(typeof m.nodeName!="string"||typeof m.textContent!="string"||typeof m.removeChild!="function"||!(m.attributes instanceof S)||typeof m.removeAttribute!="function"||typeof m.setAttribute!="function"||typeof m.namespaceURI!="string"||typeof m.insertBefore!="function"||typeof m.hasChildNodes!="function")},Yl=function(m){return typeof k=="function"&&m instanceof k};function Ot(Q,m,A){no(Q,H=>{H.call(s,m,A,rn)})}const bl=function(m){let A=null;if(Ot(ue.beforeSanitizeElements,m,null),Jn(m))return Et(m),!0;const H=je(m.nodeName);if(Ot(ue.uponSanitizeElement,m,{tagName:H,allowedTags:v}),m.hasChildNodes()&&!Yl(m.firstElementChild)&<(/<[/\w]/g,m.innerHTML)&<(/<[/\w]/g,m.textContent)||m.nodeType===jl.progressingInstruction||pn&&m.nodeType===jl.comment&<(/<[/\w]/g,m.data))return Et(m),!0;if(!v[H]||ie[H]){if(!ie[H]&&br(H)&&(X.tagNameCheck instanceof RegExp&<(X.tagNameCheck,H)||X.tagNameCheck instanceof Function&&X.tagNameCheck(H)))return!1;if(yr&&!tn[H]){const Ne=Ce(m)||m.parentNode,Ve=ye(m)||m.childNodes;if(Ve&&Ne){const le=Ve.length;for(let Ze=le-1;Ze>=0;--Ze){const at=j(Ve[Ze],!0);at.__removalCount=(m.__removalCount||0)+1,Ne.insertBefore(at,ce(m))}}}return Et(m),!0}return m instanceof _&&!Xn(m)||(H==="noscript"||H==="noembed"||H==="noframes")&<(/<\/no(script|embed|frames)/i,m.innerHTML)?(Et(m),!0):(qt&&m.nodeType===jl.text&&(A=m.textContent,no([_e,ve,ze],Ne=>{A=Ol(A,Ne," ")}),m.textContent!==A&&(zl(s.removed,{element:m.cloneNode()}),m.textContent=A)),Ot(ue.afterSanitizeElements,m,null),!1)},Qt=function(m,A,H){if(mn&&(A==="id"||A==="name")&&(H in o||H in Gl))return!1;if(!(Se&&!ge[A]&<(ut,A))){if(!(pe&<(We,A))){if(!Y[A]||ge[A]){if(!(br(m)&&(X.tagNameCheck instanceof RegExp&<(X.tagNameCheck,m)||X.tagNameCheck instanceof Function&&X.tagNameCheck(m))&&(X.attributeNameCheck instanceof RegExp&<(X.attributeNameCheck,A)||X.attributeNameCheck instanceof Function&&X.attributeNameCheck(A))||A==="is"&&X.allowCustomizedBuiltInElements&&(X.tagNameCheck instanceof RegExp&<(X.tagNameCheck,H)||X.tagNameCheck instanceof Function&&X.tagNameCheck(H))))return!1}else if(!nn[A]){if(!lt(F,Ol(H,I,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&m!=="script"&&fh(H,"data:")===0&&Gn[m])){if(!(Xe&&!lt(Re,Ol(H,I,"")))){if(H)return!1}}}}}}return!0},br=function(m){return m!=="annotation-xml"&&ef(m,K)},Kr=function(m){Ot(ue.beforeSanitizeAttributes,m,null);const{attributes:A}=m;if(!A||Jn(m))return;const H={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let Ne=A.length;for(;Ne--;){const Ve=A[Ne],{name:le,namespaceURI:Ze,value:at}=Ve,En=je(le);let Ue=le==="value"?at:dh(at);if(H.attrName=En,H.attrValue=Ue,H.keepAttr=!0,H.forceKeepAttr=void 0,Ot(ue.uponSanitizeAttribute,m,H),Ue=H.attrValue,Jt&&(En==="id"||En==="name")&&(Vt(le,m),Ue=Qr+Ue),pn&<(/((--!?|])>)|<\/(style|title)/i,Ue)){Vt(le,m);continue}if(H.forceKeepAttr||(Vt(le,m),!H.keepAttr))continue;if(!Vn&<(/\/>/i,Ue)){Vt(le,m);continue}qt&&no([_e,ve,ze],Xr=>{Ue=Ol(Ue,Xr," ")});const Kl=je(m.nodeName);if(Qt(Kl,En,Ue)){if(ee&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!Ze)switch(D.getAttributeType(Kl,En)){case"TrustedHTML":{Ue=ee.createHTML(Ue);break}case"TrustedScriptURL":{Ue=ee.createScriptURL(Ue);break}}try{Ze?m.setAttributeNS(Ze,le,Ue):m.setAttribute(le,Ue),Jn(m)?Et(m):Jc(s.removed)}catch{}}}Ot(ue.afterSanitizeAttributes,m,null)},co=function Q(m){let A=null;const H=qn(m);for(Ot(ue.beforeSanitizeShadowDOM,m,null);A=H.nextNode();)Ot(ue.uponSanitizeShadowNode,A,null),bl(A),Kr(A),A.content instanceof p&&Q(A.content);Ot(ue.afterSanitizeShadowDOM,m,null)};return s.sanitize=function(Q){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,H=null,Ne=null,Ve=null;if(bn=!Q,bn&&(Q="<!-->"),typeof Q!="string"&&!Yl(Q))if(typeof Q.toString=="function"){if(Q=Q.toString(),typeof Q!="string")throw Il("dirty is not a string, aborting")}else throw Il("toString is not a function");if(!s.isSupported)return Q;if(mr||xr(m),s.removed=[],typeof Q=="string"&&(gn=!1),gn){if(Q.nodeName){const at=je(Q.nodeName);if(!v[at]||ie[at])throw Il("root node is forbidden and cannot be sanitized in-place")}}else if(Q instanceof k)A=Zn("<!---->"),H=A.ownerDocument.importNode(Q,!0),H.nodeType===jl.element&&H.nodeName==="BODY"||H.nodeName==="HTML"?A=H:A.appendChild(H);else{if(!Wt&&!qt&&!zt&&Q.indexOf("<")===-1)return ee&&hn?ee.createHTML(Q):Q;if(A=Zn(Q),!A)return Wt?null:hn?fe:""}A&&gr&&Et(A.firstChild);const le=qn(gn?Q:A);for(;Ne=le.nextNode();)bl(Ne),Kr(Ne),Ne.content instanceof p&&co(Ne.content);if(gn)return Q;if(Wt){if(Qn)for(Ve=de.call(A.ownerDocument);A.firstChild;)Ve.appendChild(A.firstChild);else Ve=A;return(Y.shadowroot||Y.shadowrootmode)&&(Ve=ne.call(a,Ve,!0)),Ve}let Ze=zt?A.outerHTML:A.innerHTML;return zt&&v["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&<(Cf,A.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
| 96 |
+
`+Ze),qt&&no([_e,ve,ze],at=>{Ze=Ol(Ze,at," ")}),ee&&hn?ee.createHTML(Ze):Ze},s.setConfig=function(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xr(Q),mr=!0},s.clearConfig=function(){rn=null,mr=!1},s.isValidAttribute=function(Q,m,A){rn||xr({});const H=je(Q),Ne=je(m);return Qt(H,Ne,A)},s.addHook=function(Q,m){typeof m=="function"&&zl(ue[Q],m)},s.removeHook=function(Q,m){if(m!==void 0){const A=ah(ue[Q],m);return A===-1?void 0:ch(ue[Q],A,1)[0]}return Jc(ue[Q])},s.removeHooks=function(Q){ue[Q]=[]},s.removeAllHooks=function(){ue=sf()},s}var Rh=Rf();function Nh(d){return C.jsxs("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("path",{d:"M12 8V4H8"}),C.jsx("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),C.jsx("path",{d:"M2 14h2"}),C.jsx("path",{d:"M20 14h2"}),C.jsx("path",{d:"M15 13v2"}),C.jsx("path",{d:"M9 13v2"})]})}function Lh(d){return C.jsx("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:C.jsx("path",{className:"stroke-gray-600 dark:stroke-gray-400",d:"M16 6v3.33M16 6c0-2.65 3.25-4.3 5.4-2.62 1.2.95 1.6 2.65.95 4.04a3.63 3.63 0 0 1 4.61.16 3.45 3.45 0 0 1 .46 4.37 5.32 5.32 0 0 1 1.87 4.75c-.22 1.66-1.39 3.6-3.07 4.14M16 6c0-2.65-3.25-4.3-5.4-2.62a3.37 3.37 0 0 0-.95 4.04 3.65 3.65 0 0 0-4.6.16 3.37 3.37 0 0 0-.49 4.27 5.57 5.57 0 0 0-1.85 4.85 5.3 5.3 0 0 0 3.07 4.15M16 9.33v17.34m0-17.34c0 2.18 1.82 4 4 4m6.22 7.5c.67 1.3.56 2.91-.27 4.11a4.05 4.05 0 0 1-4.62 1.5c0 1.53-1.05 2.9-2.66 2.9A2.7 2.7 0 0 1 16 26.66m10.22-5.83a4.05 4.05 0 0 0-3.55-2.17m-16.9 2.18a4.05 4.05 0 0 0 .28 4.1c1 1.44 2.92 2.09 4.59 1.5 0 1.52 1.12 2.88 2.7 2.88A2.7 2.7 0 0 0 16 26.67M5.78 20.85a4.04 4.04 0 0 1 3.55-2.18"})})}function Ph(d){return C.jsxs("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),C.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}var lu=function(){return(lu=Object.assign||function(d){for(var s,o=1,a=arguments.length;o<a;o++)for(var f in s=arguments[o])Object.prototype.hasOwnProperty.call(s,f)&&(d[f]=s[f]);return d}).apply(this,arguments)},Fl,Ul,iu=me.createContext(void 0),uf="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=TeX-MML-AM_CHTML",af="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js",Ah=function(S){var s=S.config,o=S.version,o=o===void 0?3:o,a=S.src,a=a===void 0?o===2?uf:af:a,f=S.onStartup,p=S.onLoad,y=S.onError,k=S.typesettingOptions,_=S.renderMode,_=_===void 0?"post":_,T=S.hideUntilTypeset,S=S.children,M=me.useContext(iu);if((M==null?void 0:M.version)!==void 0&&(M==null?void 0:M.version)!==o)throw Error("Cannot nest MathJaxContexts with different versions. MathJaxContexts should not be nested at all but if they are, they cannot have different versions. Stick with one version of MathJax in your app and avoid using more than one MathJaxContext.");if(o===2&&Ul!==void 0||o===3&&Fl!==void 0)throw Error("Cannot use MathJax versions 2 and 3 simultaneously in the same app due to how MathJax is set up in the browser; either you have multiple MathJaxContexts with different versions or you have mounted and unmounted MathJaxContexts with different versions. Please stick with one version of MathJax in your app. File an issue in the project Github page if you need this feature.");var O=me.useRef(M),M=me.useRef((M==null?void 0:M.version)||null);if(M.current===null)M.current=o;else if(M.current!==o)throw Error("Cannot change version of MathJax in a MathJaxContext after it has mounted. Reload the page with a new version when this must happen.");var D=a||(o===2?uf:af);function G(j,b){s&&(window.MathJax=s);var ce=document.createElement("script");ce.type="text/javascript",ce.src=D,ce.async=!1,ce.addEventListener("load",function(){var ye=window.MathJax;f&&f(ye),j(ye),p&&p()}),ce.addEventListener("error",function(ye){return b(ye)}),document.getElementsByTagName("head")[0].appendChild(ce)}return O.current===void 0&&(M={typesettingOptions:k,renderMode:_,hideUntilTypeset:T},o===2?Fl===void 0&&(typeof window<"u"?(Fl=new Promise(G)).catch(function(j){if(!y)throw Error("Failed to download MathJax version 2 from '".concat(D,"' due to: ").concat(j));y(j)}):(Fl=Promise.reject()).catch(function(j){})):Ul===void 0&&(typeof window<"u"?(Ul=new Promise(G)).catch(function(j){if(!y)throw Error("Failed to download MathJax version 3 from '".concat(D,"' due to: ").concat(j));y(j)}):(Ul=Promise.reject()).catch(function(j){})),O.current=lu(lu({},M),o===2?{version:2,promise:Fl}:{version:3,promise:Ul})),pf.createElement(iu.Provider,{value:O.current},S)},Wn=function(){return(Wn=Object.assign||function(d){for(var s,o=1,a=arguments.length;o<a;o++)for(var f in s=arguments[o])Object.prototype.hasOwnProperty.call(s,f)&&(d[f]=s[f]);return d}).apply(this,arguments)},Mh=function(d,s){var o={};for(f in d)Object.prototype.hasOwnProperty.call(d,f)&&s.indexOf(f)<0&&(o[f]=d[f]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,f=Object.getOwnPropertySymbols(d);a<f.length;a++)s.indexOf(f[a])<0&&Object.prototype.propertyIsEnumerable.call(d,f[a])&&(o[f[a]]=d[f[a]]);return o},$l=function(d){return"Typesetting failed: ".concat(d.message!==void 0?d.message:d.toString())},cf=function(d){function s(){var fe;j==="every"&&ye&&b==="post"&&D.current!==null&&(D.current.style.visibility=(fe=(fe=O.style)==null?void 0:fe.visibility)!=null?fe:"visible"),Ce.current||(j==="first"&&D.current!==null&&(D.current.style.visibility="visible"),f&&f(),Ce.current=!0),p&&p(),ee.current=!1}var a=d.inline,o=a!==void 0&&a,a=d.hideUntilTypeset,f=d.onInitTypeset,p=d.onTypeset,y=d.text,k=d.dynamic,_=d.typesettingOptions,T=d.renderMode,S=d.children,O=Mh(d,["inline","hideUntilTypeset","onInitTypeset","onTypeset","text","dynamic","typesettingOptions","renderMode","children"]),M=me.useRef(""),D=me.useRef(null),G=me.useContext(iu),j=a??(G==null?void 0:G.hideUntilTypeset),b=T??(G==null?void 0:G.renderMode),ce=_??(G==null?void 0:G.typesettingOptions),ye=k!==!1&&(k||!1),Ce=me.useRef(!1),ee=me.useRef(!1);return!ee.current&&D.current!==null&&ye&&j==="every"&&b==="post"&&(D.current.style.visibility="hidden"),(typeof window<"u"?me.useLayoutEffect:me.useEffect)(function(){if((ye||!Ce.current)&&D.current!==null){if(!G)throw Error("MathJax was not loaded, did you use the MathJax component outside of a MathJaxContext?");if(b==="pre"){if(!(typeof(fe=y)=="string"&&0<fe.length))throw Error(`Render mode 'pre' requires text prop to be set and non-empty, which was currently "`.concat(y,'"'));if(!_||!_.fn)throw Error("Render mode 'pre' requires 'typesettingOptions' prop with 'fn' property to be set on MathJax element or in the MathJaxContext");if(G.version===2)throw Error("Render mode 'pre' only available with MathJax 3, and version 2 is currently in use")}b!=="post"&&y===M.current||ee.current||(ee.current=!0,G.version===3?G.promise.then(function(te){var xe;b==="pre"?(xe=function(de){M.current=y,te.startup.document.clear(),te.startup.document.updateDocument(),D.current!==null&&(D.current.innerHTML=de.outerHTML),s()},_.fn.endsWith("Promise")?te.startup.promise.then(function(){return te[ce.fn](y,Wn(Wn({},(ce==null?void 0:ce.options)||{}),{display:!o}))}).then(xe).catch(function(de){throw s(),Error($l(de))}):te.startup.promise.then(function(){var de=te[ce.fn](y,Wn(Wn({},(ce==null?void 0:ce.options)||{}),{display:!o}));xe(de)}).catch(function(de){throw s(),Error($l(de))})):te.startup.promise.then(function(){return te.typesetClear([D.current]),te.typesetPromise([D.current])}).then(s).catch(function(de){throw s(),Error($l(de))})}).catch(function(te){throw s(),Error($l(te))}):G.promise.then(function(te){te.Hub.Queue(["Typeset",te.Hub,D.current]),te.Hub.Queue(s)}).catch(function(te){throw s(),Error($l(te))}))}var fe}),pf.createElement("span",Wn({},O,{style:Wn(Wn({display:o?"inline":"block"},O.style),{visibility:j?"hidden":(d=O.style)==null?void 0:d.visibility}),ref:D}),S)};function ff(d){return d=d.replace(/\\([\[\]\(\)])/g,"\\\\$1"),Rh.sanitize(we.parse(d,{async:!1,breaks:!0}))}function zh({role:d,content:s,answerIndex:o}){const a=o!==void 0?s.slice(0,o):s,f=o!==void 0?s.slice(o):"",[p,y]=me.useState(!1),k=o===0||f.length>0;return C.jsx("div",{className:"flex items-start space-x-4",children:d==="assistant"?C.jsxs(C.Fragment,{children:[C.jsx(Nh,{className:"h-6 w-6 min-h-6 min-w-6 my-3 text-gray-500 dark:text-gray-300"}),C.jsx("div",{className:"bg-gray-200 dark:bg-gray-700 rounded-lg p-4",children:C.jsx("div",{className:"min-h-6 text-gray-800 dark:text-gray-200 overflow-wrap-anywhere",children:o===0||a.length>0?C.jsxs(C.Fragment,{children:[a.length>0&&C.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg flex flex-col mb-2",children:[C.jsxs("button",{className:"flex items-center gap-2 cursor-pointer p-4 hover:bg-gray-50 dark:hover:bg-gray-900 rounded-lg ",onClick:()=>y(_=>!_),style:{width:p?"100%":"auto"},children:[C.jsx(Lh,{className:k?"":"animate-pulse"}),C.jsx("span",{children:k?"View reasoning.":"Thinking..."}),C.jsx("span",{className:"ml-auto text-gray-700",children:p?"▲":"▼"})]}),p&&C.jsx(cf,{className:"border-t border-gray-200 dark:border-gray-700 px-4 py-2",dynamic:!0,children:C.jsx("span",{className:"markdown",dangerouslySetInnerHTML:{__html:ff(a)}})})]}),k&&C.jsx(cf,{dynamic:!0,children:C.jsx("span",{className:"markdown",dangerouslySetInnerHTML:{__html:ff(f)}})})]}):C.jsxs("span",{className:"h-6 flex items-center gap-1",children:[C.jsx("span",{className:"w-2.5 h-2.5 bg-gray-600 dark:bg-gray-300 rounded-full animate-pulse"}),C.jsx("span",{className:"w-2.5 h-2.5 bg-gray-600 dark:bg-gray-300 rounded-full animate-pulse animation-delay-200"}),C.jsx("span",{className:"w-2.5 h-2.5 bg-gray-600 dark:bg-gray-300 rounded-full animate-pulse animation-delay-400"})]})})})]}):C.jsxs(C.Fragment,{children:[C.jsx(Ph,{className:"h-6 w-6 min-h-6 min-w-6 my-3 text-gray-500 dark:text-gray-300"}),C.jsx("div",{className:"bg-blue-500 text-white rounded-lg p-4",children:C.jsx("p",{className:"min-h-6 overflow-wrap-anywhere",children:s})})]})})}function Oh({messages:d}){const s=d.length===0;return C.jsx("div",{className:`flex-1 p-6 max-w-[960px] w-full ${s?"flex flex-col items-center justify-end":"space-y-4"}`,children:C.jsx(Ah,{children:s?C.jsx("div",{className:"text-xl",children:"Sélectionnez un Prompt ou saissez votre demande. C'est à vous de jouez."}):d.map((o,a)=>C.jsx(zh,{...o},`message-${a}`))})})}function df(d){return C.jsxs("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("path",{d:"M5 12h14"}),C.jsx("path",{d:"m12 5 7 7-7 7"})]})}function Ih(d){return C.jsxs("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[C.jsx("path",{d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}),C.jsx("path",{fill:"currentColor",d:"M9 9.563C9 9.252 9.252 9 9.563 9h4.874c.311 0 .563.252.563.563v4.874c0 .311-.252.563-.563.563H9.564A.562.562 0 0 1 9 14.437V9.564Z"})]})}function Dh(d){const s=d==0?0:Math.floor(Math.log(d)/Math.log(1024));return+(d/Math.pow(1024,s)).toFixed(2)*1+["B","kB","MB","GB","TB"][s]}function jh({text:d,percentage:s,total:o}){return s??(s=0),C.jsx("div",{className:"w-full bg-gray-100 dark:bg-gray-700 text-left rounded-lg overflow-hidden mb-0.5",children:C.jsxs("div",{className:"bg-blue-400 whitespace-nowrap px-1 text-sm",style:{width:`${s}%`},children:[d," (",s.toFixed(2),"%",isNaN(o)?"":` of ${Dh(o)}`,")"]})})}function Fh(d){return C.jsx("svg",{...d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:C.jsx("path",{d:"M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18"})})}const Uh=!!navigator.gpu,$h=120,Bh=["Solve the equation x^2 - 3x + 2 = 0","Partis en voyage organisé, un groupe de randonneurs est composé de 63 marcheurs, parmi lesquels on retrouve à la fois des hommes, des femmes et des enfants. Sachant que le nombre d'enfants est deux fois supérieur au nombre total d'adultes et qu'il y a, dans le groupe, deux fois plus de femmes que d'hommes, retrouve le nombre total d'hommes sans utiliser d'équation ?","Écrivez un code Python permettant de calculer le n-ième nombre de Fibonacci."];function Hh(){const d=me.useRef(null),s=me.useRef(null),o=me.useRef(null),[a,f]=me.useState(null),[p,y]=me.useState(null),[k,_]=me.useState(""),[T,S]=me.useState([]),[O,M]=me.useState(!1),[D,G]=me.useState(""),[j,b]=me.useState([]),[ce,ye]=me.useState(null),[Ce,ee]=me.useState(null),[fe,te]=me.useState(!1);function xe(ne){b(ue=>[...ue,{role:"user",content:ne}]),ye(null),M(!0),G("")}function de(){d.current.postMessage({type:"interrupt"})}me.useEffect(()=>{wt()},[D]);function wt(){if(!s.current)return;const ne=s.current;ne.style.height="auto";const ue=Math.min(Math.max(ne.scrollHeight,24),200);ne.style.height=`${ue}px`}return me.useEffect(()=>{d.current||(d.current=new Worker(new URL("/assets/worker-CGHCbKK3.js",import.meta.url),{type:"module"}),d.current.postMessage({type:"check"}));const ne=_e=>{switch(_e.data.status){case"loading":f("loading"),_(_e.data.data);break;case"initiate":S(ve=>[...ve,_e.data]);break;case"progress":S(ve=>ve.map(ze=>ze.file===_e.data.file?{...ze,..._e.data}:ze));break;case"done":S(ve=>ve.filter(ze=>ze.file!==_e.data.file));break;case"ready":f("ready");break;case"start":b(ve=>[...ve,{role:"assistant",content:""}]);break;case"update":{const{output:ve,tps:ze,numTokens:ut,state:We}=_e.data;ye(ze),ee(ut),b(Re=>{const I=[...Re],K=I.at(-1),F={...K,content:K.content+ve};return F.answerIndex===void 0&&We==="answering"&&(F.answerIndex=K.content.length),I[I.length-1]=F,I})}break;case"complete":M(!1);break;case"error":y(_e.data.data);break}},ue=_e=>{console.error("Worker error:",_e)};return d.current.addEventListener("message",ne),d.current.addEventListener("error",ue),()=>{d.current.removeEventListener("message",ne),d.current.removeEventListener("error",ue)}},[]),me.useEffect(()=>{j.filter(ne=>ne.role==="user").length!==0&&j.at(-1).role!=="assistant"&&(ye(null),d.current.postMessage({type:"generate",data:{messages:j,reasonEnabled:fe}}))},[j,O]),me.useEffect(()=>{if(!o.current||!O)return;const ne=o.current;ne.scrollHeight-ne.scrollTop-ne.clientHeight<$h&&(ne.scrollTop=ne.scrollHeight)},[j,O]),Uh?C.jsxs("div",{className:"flex flex-col h-screen mx-auto items justify-end text-gray-800 dark:text-gray-200 bg-white dark:bg-gray-900",children:[a===null&&j.length===0&&C.jsxs("div",{className:"h-full overflow-auto scrollbar-thin flex justify-center items-center flex-col relative",children:[C.jsxs("div",{className:"flex flex-col items-center mb-1 max-w-[360px] text-center",children:[C.jsx("img",{src:"logo.png",width:"80%",height:"auto",className:"block drop-shadow-lg bg-transparent"}),C.jsx("h1",{className:"text-4xl font-bold my-1",children:"Qwen3 WebGPU"}),C.jsx("h2",{className:"font-semibold",children:"Un modèle de raisonnement hybride s'exécutant localement dans votre navigateur avec accélération WebGPU."})]}),C.jsxs("div",{className:"flex flex-col items-center px-4",children:[C.jsxs("p",{className:"max-w-[480px] mb-4",children:[C.jsx("br",{}),"Pour utiliser l’IA sans connexion internet, vous devez charger "," ",C.jsx("a",{href:"https://huggingface.co/onnx-community/Qwen3-0.6B-ONNX",target:"_blank",rel:"noreferrer",className:"font-medium underline",children:"Qwen3-0.6B"}),", un LLM de raisonnement à 0,6 milliard de paramètres optimisé pour l'inférence depuis votre navigateur Web. Cet outil utilise"," ",C.jsx("a",{href:"https://huggingface.co/docs/transformers.js",target:"_blank",rel:"noreferrer",className:"underline",children:"🤗 Transformers.js"})," « , »et ONNX Runtime Web Localement, donc aucune donnée n'est stockée ou envoyée à un serveur. Une fois chargé, il peut même être utilisé hors ligne. Le code source de la démo est disponible sur"," ",C.jsx("a",{href:"https://github.com/huggingface/transformers.js-examples/tree/main/qwen3-webgpu",target:"_blank",rel:"noreferrer",className:"font-medium underline",children:"GitHub"}),"."]}),p&&C.jsxs("div",{className:"text-red-500 text-center mb-2",children:[C.jsx("p",{className:"mb-1",children:"Unable to load model due to the following error:"}),C.jsx("p",{className:"text-sm",children:p})]}),C.jsx("button",{className:"border px-4 py-2 rounded-lg bg-blue-400 text-white hover:bg-blue-500 disabled:bg-blue-100 cursor-pointer disabled:cursor-not-allowed select-none",onClick:()=>{d.current.postMessage({type:"load"}),f("loading")},disabled:a!==null||p!==null,children:"Charger le model"})]})]}),a==="loading"&&C.jsx(C.Fragment,{children:C.jsxs("div",{className:"w-full max-w-[500px] text-left mx-auto p-4 bottom-0 mt-auto",children:[C.jsx("p",{className:"text-center mb-1",children:k}),T.map(({file:ne,progress:ue,total:_e},ve)=>C.jsx(jh,{text:ne,percentage:ue,total:_e},ve))]})}),a==="ready"&&C.jsxs("div",{ref:o,className:"overflow-y-auto scrollbar-thin w-full flex flex-col items-center h-full",children:[C.jsx(Oh,{messages:j}),j.length===0&&C.jsx("div",{children:Bh.map((ne,ue)=>C.jsx("div",{className:"m-1 border border-gray-300 dark:border-gray-600 rounded-md p-2 bg-gray-100 dark:bg-gray-700 cursor-pointer max-w-[500px]",onClick:()=>xe(ne),children:ne},ue))}),C.jsx("p",{className:"text-center text-sm min-h-6 text-gray-500 dark:text-gray-300",children:ce&&j.length>0&&C.jsxs(C.Fragment,{children:[!O&&C.jsxs("span",{children:["Generated ",Ce," tokens in"," ",(Ce/ce).toFixed(2)," seconds ("]}),C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"font-medium text-center mr-1 text-black dark:text-white",children:ce.toFixed(2)}),C.jsx("span",{className:"text-gray-500 dark:text-gray-300",children:"tokens/second"})]}),!O&&C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"mr-1",children:")."}),C.jsx("span",{className:"underline cursor-pointer",onClick:()=>{d.current.postMessage({type:"reset"}),b([])},children:"Reset"})]})]})})]}),C.jsxs("div",{className:"w-[600px] max-w-[80%] mx-auto mt-2 mb-3",children:[C.jsxs("div",{className:"border border-gray-300 dark:border-gray-500 dark:bg-gray-700 rounded-lg max-h-[200px] relative flex",children:[C.jsx("textarea",{ref:s,className:"scrollbar-thin w-[550px] px-3 py-4 rounded-lg bg-transparent border-none outline-hidden text-gray-800 disabled:text-gray-400 dark:text-gray-200 placeholder-gray-500 dark:placeholder-gray-300 disabled:placeholder-gray-200 dark:disabled:placeholder-gray-500 resize-none disabled:cursor-not-allowed",placeholder:"Type your message...",type:"text",rows:1,value:D,disabled:a!=="ready",title:a==="ready"?"Model is ready":"Model not loaded yet",onKeyDown:ne=>{D.length>0&&!O&&ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),xe(D))},onInput:ne=>G(ne.target.value)}),O?C.jsx("div",{className:"cursor-pointer",onClick:de,children:C.jsx(Ih,{className:"h-8 w-8 p-1 rounded-md text-gray-800 dark:text-gray-100 absolute right-3 bottom-3"})}):D.length>0?C.jsx("div",{className:"cursor-pointer",onClick:()=>xe(D),children:C.jsx(df,{className:"h-8 w-8 p-1 bg-gray-800 dark:bg-gray-100 text-white dark:text-black rounded-md absolute right-3 bottom-3"})}):C.jsx("div",{children:C.jsx(df,{className:"h-8 w-8 p-1 bg-gray-200 dark:bg-gray-600 text-gray-50 dark:text-gray-800 rounded-md absolute right-3 bottom-3"})})]}),C.jsx("div",{className:"flex justify-end",children:C.jsxs("div",{className:`border pointer-curson mt-1 inline-flex items-center p-2 gap-1 rounded-xl text-sm cursor-pointer ${fe?"border-blue-500 bg-blue-100 text-blue-500 dark:bg-blue-600 dark:text-gray-200":"dark:border-gray-700 bg-gray-800 text-gray-200 dark:text-gray-400"}`,onClick:()=>te(ne=>!ne),children:[C.jsx(Fh,{className:`h-4 w-4 ${fe?"":"stroke-gray-600 dark:stroke-gray-400"}`}),"Reason"]})})]}),C.jsx("p",{className:"text-xs text-gray-400 text-center mb-3",children:"Disclaimer: Generated content may be inaccurate or false."})]}):C.jsxs("div",{className:"fixed w-screen h-screen bg-black z-10 bg-opacity-[92%] text-white text-2xl font-semibold flex justify-center items-center text-center",children:["WebGPU is not supported",C.jsx("br",{}),"by this browser :("]})}_p.createRoot(document.getElementById("root")).render(C.jsx(me.StrictMode,{children:C.jsx(Hh,{})}));
|