tia-gpc-widget 3.0.2 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,31 +1,31 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),A=require("react"),ce=require("react-i18next"),ie=require("lucide-react"),Ie=require("react-hot-toast"),Li=require("axios"),gt=require("i18next"),Pi=require("i18next-browser-languagedetector"),ot="3.0.2",ji=30,dr=ji*24*60*60*1e3,Pe={VERIFIED:"gpc_captcha_verified",TIMESTAMP:"gpc_captcha_timestamp"},zi=["honeypot_field_1","honeypot_field_2","hp_field"];process.env.NODE_ENV;const Mi=({onClick:e,unreadCount:t=0,widgetConfig:n})=>{const{t:r}=ce.useTranslation(),i=n?.widget_customization?.branding?.company_name||r("widget.title"),o=a=>{a.preventDefault(),a.stopPropagation(),e()};return d.jsxs("button",{type:"button",onClick:o,className:"gpc-floating-button gpc-floating-button-with-text gpc-animate-fade-in","aria-label":r("chat.title"),title:r("chat.title"),children:[d.jsxs("div",{className:"gpc-floating-content",children:[d.jsx(ie.MessageCircle,{className:"gpc-floating-icon"}),d.jsxs("span",{className:"gpc-floating-text",children:[r("widget.questionsTo")," ",i]})]}),t>0&&d.jsx("span",{className:"gpc-notification-badge",children:t>9?"9+":t})]})},Ri=()=>{const{i18n:e,t}=ce.useTranslation(),n=[{code:"en",label:t("languages.english"),flag:"🇬🇧"},{code:"es",label:t("languages.spanish"),flag:"🇪🇸"},{code:"fr",label:t("languages.french"),flag:"🇫🇷"}],[r,i]=A.useState(!1),o=A.useRef(null),a=n.find(l=>l.code===e.language)||n[0],s=(l,u)=>{l.preventDefault(),l.stopPropagation(),e.changeLanguage(u),i(!1)};return A.useEffect(()=>{const l=u=>{o.current&&!o.current.contains(u.target)&&i(!1)};return r&&document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[r]),d.jsxs("div",{className:"gpc-language-selector",ref:o,children:[d.jsx("button",{type:"button",onClick:l=>{l.preventDefault(),l.stopPropagation(),i(!r)},className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":t("ui.languageSelector.label"),title:t("ui.languageSelector.label"),children:d.jsx(ie.Globe,{className:"gpc-icon"})}),r&&d.jsx("div",{className:"gpc-language-dropdown",children:n.map(l=>d.jsxs("button",{type:"button",onClick:u=>s(u,l.code),className:`gpc-language-option ${l.code===a.code?"gpc-language-option-active":""}`,children:[d.jsx("span",{className:"gpc-language-flag",children:l.flag}),d.jsx("span",{className:"gpc-language-label",children:l.label})]},l.code))})]})},Oi=({onClose:e,theme:t,onToggleTheme:n,showBranding:r=!0,widgetConfig:i=null,onToggleConversations:o,showConversations:a=!1,conversationsCount:s=0,onToggleAbout:l,showAbout:u=!1,version:h=ot,onToggleMcpLogin:c,showMcpLogin:f=!1,mcpLoggedIn:p=!1})=>{const{t:m}=ce.useTranslation(),[k,v]=A.useState(!1),b=A.useRef(null);A.useEffect(()=>{const C=z=>{b.current&&!b.current.contains(z.target)&&v(!1)};return k&&document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[k]);const E=i?.widget_customization?.branding?.company_name||m("widget.title"),T=i?.widget_customization?.branding?.custom_title,M=i?.widget_customization?.branding?.company_logo_base64,D=T||E,w=M?.startsWith("data:")?M:M?`data:image/png;base64,${M}`:null,R=i?.widget_customization?.colors?.header_background,_=i?.widget_customization?.colors?.header_text,F={};R&&(F.backgroundColor=R),_&&(F.color=_);const x=(C,z)=>{C.preventDefault(),C.stopPropagation(),v(!1),z()};return d.jsxs("div",{className:"gpc-chat-header",style:F,children:[d.jsxs("div",{className:"gpc-header-content",children:[w&&d.jsx("div",{className:"gpc-header-logo",children:d.jsx("img",{src:w,alt:E,className:"gpc-company-logo"})}),d.jsx("div",{className:"gpc-header-text",children:d.jsx("h2",{className:"gpc-header-title",style:_?{color:_}:{},children:D})})]}),d.jsxs("div",{className:"gpc-header-actions",children:[o&&d.jsxs("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),o()},className:`gpc-header-button gpc-focus-visible gpc-transition relative ${a?"bg-blue-500 text-white":""}`,"aria-label":m("conversations.toggle","Toggle conversations"),title:m("conversations.toggle","Toggle conversations"),children:[d.jsx(ie.MessageSquare,{className:"gpc-icon",size:20}),s>0&&d.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full w-4 h-4 flex items-center justify-center",children:s>9?"9+":s})]}),d.jsx(Ri,{}),d.jsxs("div",{className:"gpc-header-menu",ref:b,children:[d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),v(z=>!z)},className:`gpc-header-button gpc-focus-visible gpc-transition ${k?"bg-blue-500 text-white":""}`,"aria-label":m("ui.menu"),title:m("ui.menu"),children:d.jsx(ie.MoreVertical,{className:"gpc-icon",size:20})}),k&&d.jsxs("div",{className:"gpc-header-dropdown",children:[d.jsxs("button",{type:"button",className:"gpc-header-dropdown-item",onClick:C=>x(C,n),children:[t==="light"?d.jsx(ie.Moon,{size:16,className:"gpc-header-dropdown-icon"}):d.jsx(ie.Sun,{size:16,className:"gpc-header-dropdown-icon"}),d.jsx("span",{children:m("theme.toggle")})]}),l&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"gpc-header-dropdown-divider"}),d.jsxs("button",{type:"button",className:`gpc-header-dropdown-item ${u?"gpc-header-dropdown-item-active":""}`,onClick:C=>x(C,l),children:[d.jsx(ie.Info,{size:16,className:"gpc-header-dropdown-icon"}),d.jsx("span",{children:m("about.title")})]})]}),c&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"gpc-header-dropdown-divider"}),d.jsxs("button",{type:"button",className:"gpc-header-dropdown-item",onClick:C=>x(C,c),children:[p?d.jsx(ie.LogOut,{size:16,className:"gpc-header-dropdown-icon"}):d.jsx(ie.LogIn,{size:16,className:"gpc-header-dropdown-icon"}),d.jsx("span",{children:m(p?"moodle.logout":"moodle.login")})]})]})]})]}),d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),e()},className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":m("chat.close"),title:m("chat.close"),children:d.jsx(ie.ChevronDown,{className:"gpc-icon"})})]})]})};function Fi(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const _i=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bi=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hi={};function Sn(e,t){return(Hi.jsx?Bi:_i).test(e)}const Ui=/[ \t\n\f\r]/g;function qi(e){return typeof e=="object"?e.type==="text"?En(e.value):!1:En(e)}function En(e){return e.replace(Ui,"")===""}class at{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}at.prototype.normal={};at.prototype.property={};at.prototype.space=void 0;function mr(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new at(n,r,t)}function Vt(e){return e.toLowerCase()}class me{constructor(t,n){this.attribute=n,this.property=t}}me.prototype.attribute="";me.prototype.booleanish=!1;me.prototype.boolean=!1;me.prototype.commaOrSpaceSeparated=!1;me.prototype.commaSeparated=!1;me.prototype.defined=!1;me.prototype.mustUseProperty=!1;me.prototype.number=!1;me.prototype.overloadedBoolean=!1;me.prototype.property="";me.prototype.spaceSeparated=!1;me.prototype.space=void 0;let Wi=0;const q=Fe(),ae=Fe(),Gt=Fe(),I=Fe(),te=Fe(),We=Fe(),xe=Fe();function Fe(){return 2**++Wi}const Yt=Object.freeze(Object.defineProperty({__proto__:null,boolean:q,booleanish:ae,commaOrSpaceSeparated:xe,commaSeparated:We,number:I,overloadedBoolean:Gt,spaceSeparated:te},Symbol.toStringTag,{value:"Module"})),At=Object.keys(Yt);class nn extends me{constructor(t,n,r,i){let o=-1;if(super(t,n),Tn(this,"space",i),typeof r=="number")for(;++o<At.length;){const a=At[o];Tn(this,At[o],(r&Yt[a])===Yt[a])}}}nn.prototype.defined=!0;function Tn(e,t,n){n&&(e[t]=n)}function Ge(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new nn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Vt(r)]=r,n[Vt(o.attribute)]=r}return new at(t,n,e.space)}const gr=Ge({properties:{ariaActiveDescendant:null,ariaAtomic:ae,ariaAutoComplete:null,ariaBusy:ae,ariaChecked:ae,ariaColCount:I,ariaColIndex:I,ariaColSpan:I,ariaControls:te,ariaCurrent:null,ariaDescribedBy:te,ariaDetails:null,ariaDisabled:ae,ariaDropEffect:te,ariaErrorMessage:null,ariaExpanded:ae,ariaFlowTo:te,ariaGrabbed:ae,ariaHasPopup:null,ariaHidden:ae,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:te,ariaLevel:I,ariaLive:null,ariaModal:ae,ariaMultiLine:ae,ariaMultiSelectable:ae,ariaOrientation:null,ariaOwns:te,ariaPlaceholder:null,ariaPosInSet:I,ariaPressed:ae,ariaReadOnly:ae,ariaRelevant:null,ariaRequired:ae,ariaRoleDescription:te,ariaRowCount:I,ariaRowIndex:I,ariaRowSpan:I,ariaSelected:ae,ariaSetSize:I,ariaSort:null,ariaValueMax:I,ariaValueMin:I,ariaValueNow:I,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function yr(e,t){return t in e?e[t]:t}function xr(e,t){return yr(e,t.toLowerCase())}const Vi=Ge({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:We,acceptCharset:te,accessKey:te,action:null,allow:null,allowFullScreen:q,allowPaymentRequest:q,allowUserMedia:q,alt:null,as:null,async:q,autoCapitalize:null,autoComplete:te,autoFocus:q,autoPlay:q,blocking:te,capture:null,charSet:null,checked:q,cite:null,className:te,cols:I,colSpan:null,content:null,contentEditable:ae,controls:q,controlsList:te,coords:I|We,crossOrigin:null,data:null,dateTime:null,decoding:null,default:q,defer:q,dir:null,dirName:null,disabled:q,download:Gt,draggable:ae,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:q,formTarget:null,headers:te,height:I,hidden:Gt,high:I,href:null,hrefLang:null,htmlFor:te,httpEquiv:te,id:null,imageSizes:null,imageSrcSet:null,inert:q,inputMode:null,integrity:null,is:null,isMap:q,itemId:null,itemProp:te,itemRef:te,itemScope:q,itemType:te,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:q,low:I,manifest:null,max:null,maxLength:I,media:null,method:null,min:null,minLength:I,multiple:q,muted:q,name:null,nonce:null,noModule:q,noValidate:q,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:q,optimum:I,pattern:null,ping:te,placeholder:null,playsInline:q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:q,referrerPolicy:null,rel:te,required:q,reversed:q,rows:I,rowSpan:I,sandbox:te,scope:null,scoped:q,seamless:q,selected:q,shadowRootClonable:q,shadowRootDelegatesFocus:q,shadowRootMode:null,shape:null,size:I,sizes:null,slot:null,span:I,spellCheck:ae,src:null,srcDoc:null,srcLang:null,srcSet:null,start:I,step:null,style:null,tabIndex:I,target:null,title:null,translate:null,type:null,typeMustMatch:q,useMap:null,value:ae,width:I,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:te,axis:null,background:null,bgColor:null,border:I,borderColor:null,bottomMargin:I,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:q,declare:q,event:null,face:null,frame:null,frameBorder:null,hSpace:I,leftMargin:I,link:null,longDesc:null,lowSrc:null,marginHeight:I,marginWidth:I,noResize:q,noHref:q,noShade:q,noWrap:q,object:null,profile:null,prompt:null,rev:null,rightMargin:I,rules:null,scheme:null,scrolling:ae,standby:null,summary:null,text:null,topMargin:I,valueType:null,version:null,vAlign:null,vLink:null,vSpace:I,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:q,disableRemotePlayback:q,prefix:null,property:null,results:I,security:null,unselectable:null},space:"html",transform:xr}),Gi=Ge({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:xe,accentHeight:I,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:I,amplitude:I,arabicForm:null,ascent:I,attributeName:null,attributeType:null,azimuth:I,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:I,by:null,calcMode:null,capHeight:I,className:te,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:I,diffuseConstant:I,direction:null,display:null,dur:null,divisor:I,dominantBaseline:null,download:q,dx:null,dy:null,edgeMode:null,editable:null,elevation:I,enableBackground:null,end:null,event:null,exponent:I,externalResourcesRequired:null,fill:null,fillOpacity:I,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:We,g2:We,glyphName:We,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:I,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:I,horizOriginX:I,horizOriginY:I,id:null,ideographic:I,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:I,k:I,k1:I,k2:I,k3:I,k4:I,kernelMatrix:xe,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:I,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:I,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:I,overlineThickness:I,paintOrder:null,panose1:null,path:null,pathLength:I,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:te,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:I,pointsAtY:I,pointsAtZ:I,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:xe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:xe,rev:xe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:xe,requiredFeatures:xe,requiredFonts:xe,requiredFormats:xe,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:I,specularExponent:I,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:I,strikethroughThickness:I,string:null,stroke:null,strokeDashArray:xe,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:I,strokeOpacity:I,strokeWidth:null,style:null,surfaceScale:I,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:xe,tabIndex:I,tableValues:null,target:null,targetX:I,targetY:I,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:xe,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:I,underlineThickness:I,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:I,values:null,vAlphabetic:I,vMathematical:I,vectorEffect:null,vHanging:I,vIdeographic:I,version:null,vertAdvY:I,vertOriginX:I,vertOriginY:I,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:I,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:yr}),br=Ge({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),kr=Ge({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:xr}),wr=Ge({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Yi={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Zi=/[A-Z]/g,An=/-[a-z]/g,Ji=/^data[-\w.:]+$/i;function Qi(e,t){const n=Vt(t);let r=t,i=me;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Ji.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(An,Ki);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!An.test(o)){let a=o.replace(Zi,Xi);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=nn}return new i(r,t)}function Xi(e){return"-"+e.toLowerCase()}function Ki(e){return e.charAt(1).toUpperCase()}const $i=mr([gr,Vi,br,kr,wr],"html"),rn=mr([gr,Gi,br,kr,wr],"svg");function eo(e){return e.join(" ").trim()}function vr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var He={},It,In;function to(){if(In)return It;In=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
2
- `,u="/",h="*",c="",f="comment",p="declaration";It=function(k,v){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];v=v||{};var b=1,E=1;function T(j){var N=j.match(t);N&&(b+=N.length);var L=j.lastIndexOf(l);E=~L?j.length-L:E+j.length}function M(){var j={line:b,column:E};return function(N){return N.position=new D(j),_(),N}}function D(j){this.start=j,this.end={line:b,column:E},this.source=v.source}D.prototype.content=k;function w(j){var N=new Error(v.source+":"+b+":"+E+": "+j);if(N.reason=j,N.filename=v.source,N.line=b,N.column=E,N.source=k,!v.silent)throw N}function R(j){var N=j.exec(k);if(N){var L=N[0];return T(L),k=k.slice(L.length),N}}function _(){R(n)}function F(j){var N;for(j=j||[];N=x();)N!==!1&&j.push(N);return j}function x(){var j=M();if(!(u!=k.charAt(0)||h!=k.charAt(1))){for(var N=2;c!=k.charAt(N)&&(h!=k.charAt(N)||u!=k.charAt(N+1));)++N;if(N+=2,c===k.charAt(N-1))return w("End of comment missing");var L=k.slice(2,N-2);return E+=2,T(L),k=k.slice(N),E+=2,j({type:f,comment:L})}}function C(){var j=M(),N=R(r);if(N){if(x(),!R(i))return w("property missing ':'");var L=R(o),W=j({type:p,property:m(N[0].replace(e,c)),value:L?m(L[0].replace(e,c)):c});return R(a),W}}function z(){var j=[];F(j);for(var N;N=C();)N!==!1&&(j.push(N),F(j));return j}return _(),z()};function m(k){return k?k.replace(s,c):c}return It}var Nn;function no(){if(Nn)return He;Nn=1;var e=He&&He.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(He,"__esModule",{value:!0}),He.default=n;const t=e(to());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),s=typeof i=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:h}=l;s?i(u,h,l):h&&(o=o||{},o[u]=h)}),o}return He}var Qe={},Dn;function ro(){if(Dn)return Qe;Dn=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(u){return!u||n.test(u)||e.test(u)},a=function(u,h){return h.toUpperCase()},s=function(u,h){return"".concat(h,"-")},l=function(u,h){return h===void 0&&(h={}),o(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(i,s):u=u.replace(r,s),u.replace(t,a))};return Qe.camelCase=l,Qe}var Xe,Ln;function io(){if(Ln)return Xe;Ln=1;var e=Xe&&Xe.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(no()),n=ro();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(s,l){s&&l&&(a[(0,n.camelCase)(s,o)]=l)}),a}return r.default=r,Xe=r,Xe}var oo=io();const ao=vr(oo),Cr=Sr("end"),on=Sr("start");function Sr(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function so(e){const t=on(e),n=Cr(e);if(t&&n)return{start:t,end:n}}function et(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Pn(e.position):"start"in e||"end"in e?Pn(e):"line"in e||"column"in e?Zt(e):""}function Zt(e){return jn(e&&e.line)+":"+jn(e&&e.column)}function Pn(e){return Zt(e&&e.start)+"-"+Zt(e&&e.end)}function jn(e){return e&&typeof e=="number"?e:1}class he extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=et(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}he.prototype.file="";he.prototype.name="";he.prototype.reason="";he.prototype.message="";he.prototype.stack="";he.prototype.column=void 0;he.prototype.line=void 0;he.prototype.ancestors=void 0;he.prototype.cause=void 0;he.prototype.fatal=void 0;he.prototype.place=void 0;he.prototype.ruleId=void 0;he.prototype.source=void 0;const an={}.hasOwnProperty,lo=new Map,uo=/[A-Z]/g,co=new Set(["table","tbody","thead","tfoot","tr"]),ho=new Set(["td","th"]),Er="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function po(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=wo(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=ko(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?rn:$i,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Tr(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function Tr(e,t,n){if(t.type==="element")return fo(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return mo(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return yo(e,t,n);if(t.type==="mdxjsEsm")return go(e,t);if(t.type==="root")return xo(e,t,n);if(t.type==="text")return bo(e,t)}function fo(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=rn,e.schema=i),e.ancestors.push(t);const o=Ir(e,t.tagName,!1),a=vo(e,t);let s=ln(e,t);return co.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!qi(l):!0})),Ar(e,a,o,t),sn(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function mo(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}rt(e,t.position)}function go(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);rt(e,t.position)}function yo(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=rn,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:Ir(e,t.name,!0),a=Co(e,t),s=ln(e,t);return Ar(e,a,o,t),sn(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function xo(e,t,n){const r={};return sn(r,ln(e,t)),e.create(t,e.Fragment,r,n)}function bo(e,t){return t.value}function Ar(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function sn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ko(e,t,n){return r;function r(i,o,a,s){const u=Array.isArray(a.children)?n:t;return s?u(o,a,s):u(o,a)}}function wo(e,t){return n;function n(r,i,o,a){const s=Array.isArray(o.children),l=on(r);return t(i,o,a,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function vo(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&an.call(t.properties,i)){const o=So(e,i,t.properties[i]);if(o){const[a,s]=o;e.tableCellAlignToStyle&&a==="align"&&typeof s=="string"&&ho.has(t.tagName)?r=s:n[a]=s}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Co(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const s=a.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else rt(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,o=e.evaluater.evaluateExpression(s.expression)}else rt(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function ln(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:lo;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){const u=i.get(l)||0;a=l+"-"+u,i.set(l,u+1)}}const s=Tr(e,o,a);s!==void 0&&n.push(s)}return n}function So(e,t,n){const r=Qi(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Fi(n):eo(n)),r.property==="style"){let i=typeof n=="object"?n:Eo(e,String(n));return e.stylePropertyNameCase==="css"&&(i=To(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Yi[r.property]||r.property:r.attribute,n]}}function Eo(e,t){try{return ao(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new he("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Er+"#cannot-parse-style-attribute",i}}function Ir(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,a;for(;++o<i.length;){const s=Sn(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};a=a?{type:"MemberExpression",object:a,property:s,computed:!!(o&&s.type==="Literal"),optional:!1}:s}r=a}else r=Sn(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return an.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);rt(e)}function rt(e,t){const n=new he("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Er+"#cannot-handle-mdx-estrees-without-createevaluater",n}function To(e){const t={};let n;for(n in e)an.call(e,n)&&(t[Ao(n)]=e[n]);return t}function Ao(e){let t=e.replace(uo,Io);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Io(e){return"-"+e.toLowerCase()}const Nt={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},No={};function un(e,t){const n=No,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Nr(e,r,i)}function Nr(e,t,n){if(Do(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return zn(e.children,t,n)}return Array.isArray(e)?zn(e,t,n):""}function zn(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Nr(e[i],t,n);return r.join("")}function Do(e){return!!(e&&typeof e=="object")}const Mn=document.createElement("i");function cn(e){const t="&"+e+";";Mn.innerHTML=t;const n=Mn.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function be(e,t,n,r){const i=e.length;let o=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function ke(e,t){return e.length>0?(be(e,e.length,0,t),e):t}const Rn={}.hasOwnProperty;function Dr(e){const t={};let n=-1;for(;++n<e.length;)Lo(t,e[n]);return t}function Lo(e,t){let n;for(n in t){const i=(Rn.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){Rn.call(i,a)||(i[a]=[]);const s=o[a];Po(i[a],Array.isArray(s)?s:s?[s]:[])}}}function Po(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);be(e,0,0,r)}function Lr(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ve(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const fe=je(/[A-Za-z]/),ue=je(/[\dA-Za-z]/),jo=je(/[#-'*+\--9=?A-Z^-~]/);function xt(e){return e!==null&&(e<32||e===127)}const Jt=je(/\d/),zo=je(/[\dA-Fa-f]/),Mo=je(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function ee(e){return e!==null&&(e<0||e===32)}function G(e){return e===-2||e===-1||e===32}const vt=je(new RegExp("\\p{P}|\\p{S}","u")),Oe=je(/\s/);function je(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ye(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&ue(e.charCodeAt(n+1))&&ue(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const s=e.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Z(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return G(l)?(e.enter(n),s(l)):t(l)}function s(l){return G(l)&&o++<i?(e.consume(l),s):(e.exit(n),t(l))}}const Ro={tokenize:Oo};function Oo(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Z(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),o(s)}function o(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(s)}function a(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return B(s)?(e.consume(s),e.exit("chunkText"),o):(e.consume(s),a)}}const Fo={tokenize:_o},On={tokenize:Bo};function _o(e){const t=this,n=[];let r=0,i,o,a;return s;function s(T){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,l,u)(T)}return u(T)}function l(T){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&E();const M=t.events.length;let D=M,w;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){w=t.events[D][1].end;break}b(r);let R=M;for(;R<t.events.length;)t.events[R][1].end={...w},R++;return be(t.events,D+1,0,t.events.slice(M)),t.events.length=R,u(T)}return s(T)}function u(T){if(r===n.length){if(!i)return f(T);if(i.currentConstruct&&i.currentConstruct.concrete)return m(T);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(On,h,c)(T)}function h(T){return i&&E(),b(r),f(T)}function c(T){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,m(T)}function f(T){return t.containerState={},e.attempt(On,p,m)(T)}function p(T){return r++,n.push([t.currentConstruct,t.containerState]),f(T)}function m(T){if(T===null){i&&E(),b(0),e.consume(T);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),k(T)}function k(T){if(T===null){v(e.exit("chunkFlow"),!0),b(0),e.consume(T);return}return B(T)?(e.consume(T),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(T),k)}function v(T,M){const D=t.sliceStream(T);if(M&&D.push(null),T.previous=o,o&&(o.next=T),o=T,i.defineSkip(T.start),i.write(D),t.parser.lazy[T.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<a&&(!i.events[w][1].end||i.events[w][1].end.offset>a))return;const R=t.events.length;let _=R,F,x;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(F){x=t.events[_][1].end;break}F=!0}for(b(r),w=R;w<t.events.length;)t.events[w][1].end={...x},w++;be(t.events,_+1,0,t.events.slice(R)),t.events.length=w}}function b(T){let M=n.length;for(;M-- >T;){const D=n[M];t.containerState=D[1],D[0].exit.call(t,e)}n.length=T}function E(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Bo(e,t,n){return Z(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ve(e){if(e===null||ee(e)||Oe(e))return 1;if(vt(e))return 2}function Ct(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Qt={name:"attention",resolveAll:Ho,tokenize:Uo};function Ho(e,t){let n=-1,r,i,o,a,s,l,u,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},f={...e[n][1].start};Fn(c,-l),Fn(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},e[r][1].end={...a.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ke(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ke(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",o,t]]),u=ke(u,Ct(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ke(u,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,u=ke(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,be(e,r-1,n-r+3,u),n=r+u.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Uo(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ve(r);let o;return a;function a(l){return o=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===o)return e.consume(l),s;const u=e.exit("attentionSequence"),h=Ve(l),c=!h||h===2&&i||n.includes(l),f=!i||i===2&&h||n.includes(r);return u._open=!!(o===42?c:c&&(i||!f)),u._close=!!(o===42?f:f&&(h||!c)),t(l)}}function Fn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const qo={name:"autolink",tokenize:Wo};function Wo(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return fe(p)?(e.consume(p),a):p===64?n(p):u(p)}function a(p){return p===43||p===45||p===46||ue(p)?(r=1,s(p)):u(p)}function s(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||ue(p))&&r++<32?(e.consume(p),s):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||xt(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),h):jo(p)?(e.consume(p),u):n(p)}function h(p){return ue(p)?c(p):n(p)}function c(p){return p===46?(e.consume(p),r=0,h):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||ue(p))&&r++<63){const m=p===45?f:c;return e.consume(p),m}return n(p)}}const st={partial:!0,tokenize:Vo};function Vo(e,t,n){return r;function r(o){return G(o)?Z(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||B(o)?t(o):n(o)}}const Pr={continuation:{tokenize:Yo},exit:Zo,name:"blockQuote",tokenize:Go};function Go(e,t,n){const r=this;return i;function i(a){if(a===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return n(a)}function o(a){return G(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function Yo(e,t,n){const r=this;return i;function i(a){return G(a)?Z(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(Pr,t,n)(a)}}function Zo(e){e.exit("blockQuote")}const jr={name:"characterEscape",tokenize:Jo};function Jo(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return Mo(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const zr={name:"characterReference",tokenize:Qo};function Qo(e,t,n){const r=this;let i=0,o,a;return s;function s(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),l}function l(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),o=31,a=ue,h(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=zo,h):(e.enter("characterReferenceValue"),o=7,a=Jt,h(c))}function h(c){if(c===59&&i){const f=e.exit("characterReferenceValue");return a===ue&&!cn(r.sliceSerialize(f))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(c)&&i++<o?(e.consume(c),h):n(c)}}const _n={partial:!0,tokenize:Ko},Bn={concrete:!0,name:"codeFenced",tokenize:Xo};function Xo(e,t,n){const r=this,i={partial:!0,tokenize:D};let o=0,a=0,s;return l;function l(w){return u(w)}function u(w){const R=r.events[r.events.length-1];return o=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,s=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(w)}function h(w){return w===s?(a++,e.consume(w),h):a<3?n(w):(e.exit("codeFencedFenceSequence"),G(w)?Z(e,c,"whitespace")(w):c(w))}function c(w){return w===null||B(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(_n,k,M)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===null||B(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(w)):G(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Z(e,p,"whitespace")(w)):w===96&&w===s?n(w):(e.consume(w),f)}function p(w){return w===null||B(w)?c(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||B(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(w)):w===96&&w===s?n(w):(e.consume(w),m)}function k(w){return e.attempt(i,M,v)(w)}function v(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),b}function b(w){return o>0&&G(w)?Z(e,E,"linePrefix",o+1)(w):E(w)}function E(w){return w===null||B(w)?e.check(_n,k,M)(w):(e.enter("codeFlowValue"),T(w))}function T(w){return w===null||B(w)?(e.exit("codeFlowValue"),E(w)):(e.consume(w),T)}function M(w){return e.exit("codeFenced"),t(w)}function D(w,R,_){let F=0;return x;function x(L){return w.enter("lineEnding"),w.consume(L),w.exit("lineEnding"),C}function C(L){return w.enter("codeFencedFence"),G(L)?Z(w,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):z(L)}function z(L){return L===s?(w.enter("codeFencedFenceSequence"),j(L)):_(L)}function j(L){return L===s?(F++,w.consume(L),j):F>=a?(w.exit("codeFencedFenceSequence"),G(L)?Z(w,N,"whitespace")(L):N(L)):_(L)}function N(L){return L===null||B(L)?(w.exit("codeFencedFence"),R(L)):_(L)}}}function Ko(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Dt={name:"codeIndented",tokenize:ea},$o={partial:!0,tokenize:ta};function ea(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Z(e,o,"linePrefix",5)(u)}function o(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):B(u)?e.attempt($o,a,l)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||B(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),s)}function l(u){return e.exit("codeIndented"),t(u)}}function ta(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):B(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):Z(e,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):B(a)?i(a):n(a)}}const na={name:"codeText",previous:ia,resolve:ra,tokenize:oa};function ra(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ia(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function oa(e,t,n){let r=0,i,o;return a;function a(c){return e.enter("codeText"),e.enter("codeTextSequence"),s(c)}function s(c){return c===96?(e.consume(c),r++,s):(e.exit("codeTextSequence"),l(c))}function l(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),l):c===96?(o=e.enter("codeTextSequence"),i=0,h(c)):B(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||B(c)?(e.exit("codeTextData"),l(c)):(e.consume(c),u)}function h(c){return c===96?(e.consume(c),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(o.type="codeTextData",u(c))}}class aa{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ke(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ke(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ke(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ke(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ke(this.left,n.reverse())}}}function Ke(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Mr(e){const t={};let n=-1,r,i,o,a,s,l,u;const h=new aa(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,sa(h,n)),n=t[n],u=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(a=h.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},s=h.slice(i,n),s.unshift(r),h.splice(i,n-i+1,s))}}return be(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!u}function sa(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const s=a.events,l=[],u={};let h,c,f=-1,p=n,m=0,k=0;const v=[k];for(;p;){for(;e.get(++i)[1]!==p;);o.push(i),p._tokenizer||(h=r.sliceStream(p),p.next||h.push(null),c&&a.defineSkip(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(h),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),c=p,p=p.next}for(p=n;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(k=f+1,v.push(k),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):v.pop(),f=v.length;f--;){const b=s.slice(v[f],v[f+1]),E=o.pop();l.push([E,E+b.length-1]),e.splice(E,2,b)}for(l.reverse(),f=-1;++f<l.length;)u[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return u}const la={resolve:ca,tokenize:ha},ua={partial:!0,tokenize:pa};function ca(e){return Mr(e),e}function ha(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?o(s):B(s)?e.check(ua,a,o)(s):(e.consume(s),i)}function o(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function a(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function pa(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Z(e,o,"linePrefix")}function o(a){if(a===null||B(a))return n(a);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function Rr(e,t,n,r,i,o,a,s,l){const u=l||Number.POSITIVE_INFINITY;let h=0;return c;function c(b){return b===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(b),e.exit(o),f):b===null||b===32||b===41||xt(b)?n(b):(e.enter(r),e.enter(a),e.enter(s),e.enter("chunkString",{contentType:"string"}),k(b))}function f(b){return b===62?(e.enter(o),e.consume(b),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(s),f(b)):b===null||b===60||B(b)?n(b):(e.consume(b),b===92?m:p)}function m(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function k(b){return!h&&(b===null||b===41||ee(b))?(e.exit("chunkString"),e.exit(s),e.exit(a),e.exit(r),t(b)):h<u&&b===40?(e.consume(b),h++,k):b===41?(e.consume(b),h--,k):b===null||b===32||b===40||xt(b)?n(b):(e.consume(b),b===92?v:k)}function v(b){return b===40||b===41||b===92?(e.consume(b),k):k(b)}}function Or(e,t,n,r,i,o){const a=this;let s=0,l;return u;function u(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(o),h}function h(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):B(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===null||p===91||p===93||B(p)||s++>999?(e.exit("chunkString"),h(p)):(e.consume(p),l||(l=!G(p)),p===92?f:c)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,c):c(p)}}function Fr(e,t,n,r,i,o){let a;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),a=f===40?41:f,l):n(f)}function l(f){return f===a?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(o),u(f))}function u(f){return f===a?(e.exit(o),l(a)):f===null?n(f):B(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Z(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===a||f===null||B(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?c:h)}function c(f){return f===a||f===92?(e.consume(f),h):h(f)}}function tt(e,t){let n;return r;function r(i){return B(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):G(i)?Z(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const fa={name:"definition",tokenize:ma},da={partial:!0,tokenize:ga};function ma(e,t,n){const r=this;let i;return o;function o(p){return e.enter("definition"),a(p)}function a(p){return Or.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ee(p)?tt(e,u)(p):u(p)}function u(p){return Rr(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return e.attempt(da,c,c)(p)}function c(p){return G(p)?Z(e,f,"whitespace")(p):f(p)}function f(p){return p===null||B(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function ga(e,t,n){return r;function r(s){return ee(s)?tt(e,i)(s):n(s)}function i(s){return Fr(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return G(s)?Z(e,a,"whitespace")(s):a(s)}function a(s){return s===null||B(s)?t(s):n(s)}}const ya={name:"hardBreakEscape",tokenize:xa};function xa(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return B(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const ba={name:"headingAtx",resolve:ka,tokenize:wa};function ka(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},be(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function wa(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),o(h)}function o(h){return e.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(e.consume(h),a):h===null||ee(h)?(e.exit("atxHeadingSequence"),s(h)):n(h)}function s(h){return h===35?(e.enter("atxHeadingSequence"),l(h)):h===null||B(h)?(e.exit("atxHeading"),t(h)):G(h)?Z(e,s,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function l(h){return h===35?(e.consume(h),l):(e.exit("atxHeadingSequence"),s(h))}function u(h){return h===null||h===35||ee(h)?(e.exit("atxHeadingText"),s(h)):(e.consume(h),u)}}const va=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Hn=["pre","script","style","textarea"],Ca={concrete:!0,name:"htmlFlow",resolveTo:Ta,tokenize:Aa},Sa={partial:!0,tokenize:Na},Ea={partial:!0,tokenize:Ia};function Ta(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Aa(e,t,n){const r=this;let i,o,a,s,l;return u;function u(y){return h(y)}function h(y){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(y),c}function c(y){return y===33?(e.consume(y),f):y===47?(e.consume(y),o=!0,k):y===63?(e.consume(y),i=3,r.interrupt?t:g):fe(y)?(e.consume(y),a=String.fromCharCode(y),v):n(y)}function f(y){return y===45?(e.consume(y),i=2,p):y===91?(e.consume(y),i=5,s=0,m):fe(y)?(e.consume(y),i=4,r.interrupt?t:g):n(y)}function p(y){return y===45?(e.consume(y),r.interrupt?t:g):n(y)}function m(y){const se="CDATA[";return y===se.charCodeAt(s++)?(e.consume(y),s===se.length?r.interrupt?t:z:m):n(y)}function k(y){return fe(y)?(e.consume(y),a=String.fromCharCode(y),v):n(y)}function v(y){if(y===null||y===47||y===62||ee(y)){const se=y===47,ge=a.toLowerCase();return!se&&!o&&Hn.includes(ge)?(i=1,r.interrupt?t(y):z(y)):va.includes(a.toLowerCase())?(i=6,se?(e.consume(y),b):r.interrupt?t(y):z(y)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(y):o?E(y):T(y))}return y===45||ue(y)?(e.consume(y),a+=String.fromCharCode(y),v):n(y)}function b(y){return y===62?(e.consume(y),r.interrupt?t:z):n(y)}function E(y){return G(y)?(e.consume(y),E):x(y)}function T(y){return y===47?(e.consume(y),x):y===58||y===95||fe(y)?(e.consume(y),M):G(y)?(e.consume(y),T):x(y)}function M(y){return y===45||y===46||y===58||y===95||ue(y)?(e.consume(y),M):D(y)}function D(y){return y===61?(e.consume(y),w):G(y)?(e.consume(y),D):T(y)}function w(y){return y===null||y===60||y===61||y===62||y===96?n(y):y===34||y===39?(e.consume(y),l=y,R):G(y)?(e.consume(y),w):_(y)}function R(y){return y===l?(e.consume(y),l=null,F):y===null||B(y)?n(y):(e.consume(y),R)}function _(y){return y===null||y===34||y===39||y===47||y===60||y===61||y===62||y===96||ee(y)?D(y):(e.consume(y),_)}function F(y){return y===47||y===62||G(y)?T(y):n(y)}function x(y){return y===62?(e.consume(y),C):n(y)}function C(y){return y===null||B(y)?z(y):G(y)?(e.consume(y),C):n(y)}function z(y){return y===45&&i===2?(e.consume(y),W):y===60&&i===1?(e.consume(y),Q):y===62&&i===4?(e.consume(y),le):y===63&&i===3?(e.consume(y),g):y===93&&i===5?(e.consume(y),ne):B(y)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Sa,pe,j)(y)):y===null||B(y)?(e.exit("htmlFlowData"),j(y)):(e.consume(y),z)}function j(y){return e.check(Ea,N,pe)(y)}function N(y){return e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),L}function L(y){return y===null||B(y)?j(y):(e.enter("htmlFlowData"),z(y))}function W(y){return y===45?(e.consume(y),g):z(y)}function Q(y){return y===47?(e.consume(y),a="",oe):z(y)}function oe(y){if(y===62){const se=a.toLowerCase();return Hn.includes(se)?(e.consume(y),le):z(y)}return fe(y)&&a.length<8?(e.consume(y),a+=String.fromCharCode(y),oe):z(y)}function ne(y){return y===93?(e.consume(y),g):z(y)}function g(y){return y===62?(e.consume(y),le):y===45&&i===2?(e.consume(y),g):z(y)}function le(y){return y===null||B(y)?(e.exit("htmlFlowData"),pe(y)):(e.consume(y),le)}function pe(y){return e.exit("htmlFlow"),t(y)}}function Ia(e,t,n){const r=this;return i;function i(a){return B(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Na(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(st,t,n)}}const Da={name:"htmlText",tokenize:La};function La(e,t,n){const r=this;let i,o,a;return s;function s(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),l}function l(g){return g===33?(e.consume(g),u):g===47?(e.consume(g),D):g===63?(e.consume(g),T):fe(g)?(e.consume(g),_):n(g)}function u(g){return g===45?(e.consume(g),h):g===91?(e.consume(g),o=0,m):fe(g)?(e.consume(g),E):n(g)}function h(g){return g===45?(e.consume(g),p):n(g)}function c(g){return g===null?n(g):g===45?(e.consume(g),f):B(g)?(a=c,Q(g)):(e.consume(g),c)}function f(g){return g===45?(e.consume(g),p):c(g)}function p(g){return g===62?W(g):g===45?f(g):c(g)}function m(g){const le="CDATA[";return g===le.charCodeAt(o++)?(e.consume(g),o===le.length?k:m):n(g)}function k(g){return g===null?n(g):g===93?(e.consume(g),v):B(g)?(a=k,Q(g)):(e.consume(g),k)}function v(g){return g===93?(e.consume(g),b):k(g)}function b(g){return g===62?W(g):g===93?(e.consume(g),b):k(g)}function E(g){return g===null||g===62?W(g):B(g)?(a=E,Q(g)):(e.consume(g),E)}function T(g){return g===null?n(g):g===63?(e.consume(g),M):B(g)?(a=T,Q(g)):(e.consume(g),T)}function M(g){return g===62?W(g):T(g)}function D(g){return fe(g)?(e.consume(g),w):n(g)}function w(g){return g===45||ue(g)?(e.consume(g),w):R(g)}function R(g){return B(g)?(a=R,Q(g)):G(g)?(e.consume(g),R):W(g)}function _(g){return g===45||ue(g)?(e.consume(g),_):g===47||g===62||ee(g)?F(g):n(g)}function F(g){return g===47?(e.consume(g),W):g===58||g===95||fe(g)?(e.consume(g),x):B(g)?(a=F,Q(g)):G(g)?(e.consume(g),F):W(g)}function x(g){return g===45||g===46||g===58||g===95||ue(g)?(e.consume(g),x):C(g)}function C(g){return g===61?(e.consume(g),z):B(g)?(a=C,Q(g)):G(g)?(e.consume(g),C):F(g)}function z(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),i=g,j):B(g)?(a=z,Q(g)):G(g)?(e.consume(g),z):(e.consume(g),N)}function j(g){return g===i?(e.consume(g),i=void 0,L):g===null?n(g):B(g)?(a=j,Q(g)):(e.consume(g),j)}function N(g){return g===null||g===34||g===39||g===60||g===61||g===96?n(g):g===47||g===62||ee(g)?F(g):(e.consume(g),N)}function L(g){return g===47||g===62||ee(g)?F(g):n(g)}function W(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),t):n(g)}function Q(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),oe}function oe(g){return G(g)?Z(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):ne(g)}function ne(g){return e.enter("htmlTextData"),a(g)}}const hn={name:"labelEnd",resolveAll:Ma,resolveTo:Ra,tokenize:Oa},Pa={tokenize:Fa},ja={tokenize:_a},za={tokenize:Ba};function Ma(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&be(e,0,e.length,n),e}function Ra(e,t){let n=e.length,r=0,i,o,a,s;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const l={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},h={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return s=[["enter",l,t],["enter",u,t]],s=ke(s,e.slice(o+1,o+r+3)),s=ke(s,[["enter",h,t]]),s=ke(s,Ct(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),s=ke(s,[["exit",h,t],e[a-2],e[a-1],["exit",u,t]]),s=ke(s,e.slice(a+1)),s=ke(s,[["exit",l,t]]),be(e,o,e.length,s),e}function Oa(e,t,n){const r=this;let i=r.events.length,o,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return s;function s(f){return o?o._inactive?c(f):(a=r.parser.defined.includes(ve(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(Pa,h,a?h:c)(f):f===91?e.attempt(ja,h,a?u:c)(f):a?h(f):c(f)}function u(f){return e.attempt(za,h,c)(f)}function h(f){return t(f)}function c(f){return o._balanced=!0,n(f)}}function Fa(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return ee(c)?tt(e,o)(c):o(c)}function o(c){return c===41?h(c):Rr(e,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function a(c){return ee(c)?tt(e,l)(c):h(c)}function s(c){return n(c)}function l(c){return c===34||c===39||c===40?Fr(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):h(c)}function u(c){return ee(c)?tt(e,h)(c):h(c)}function h(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function _a(e,t,n){const r=this;return i;function i(s){return Or.call(r,e,o,a,"reference","referenceMarker","referenceString")(s)}function o(s){return r.parser.defined.includes(ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function a(s){return n(s)}}function Ba(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const Ha={name:"labelStartImage",resolveAll:hn.resolveAll,tokenize:Ua};function Ua(e,t,n){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),o}function o(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),a):n(s)}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const qa={name:"labelStartLink",resolveAll:hn.resolveAll,tokenize:Wa};function Wa(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Lt={name:"lineEnding",tokenize:Va};function Va(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Z(e,t,"linePrefix")}}const yt={name:"thematicBreak",tokenize:Ga};function Ga(e,t,n){let r=0,i;return o;function o(u){return e.enter("thematicBreak"),a(u)}function a(u){return i=u,s(u)}function s(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||B(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),G(u)?Z(e,s,"whitespace")(u):s(u))}}const de={continuation:{tokenize:Qa},exit:Ka,name:"list",tokenize:Ja},Ya={partial:!0,tokenize:$a},Za={partial:!0,tokenize:Xa};function Ja(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Jt(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(yt,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Jt(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(st,r.interrupt?n:h,e.attempt(Ya,f,c))}function h(p){return r.containerState.initialBlankLine=!0,o++,f(p)}function c(p){return G(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Qa(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(st,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Z(e,t,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!G(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Za,t,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,Z(e,e.attempt(de,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Xa(e,t,n){const r=this;return Z(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function Ka(e){e.exit(this.containerState.type)}function $a(e,t,n){const r=this;return Z(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!G(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Un={name:"setextUnderline",resolveTo:es,tokenize:ts};function es(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function ts(e,t,n){const r=this;let i;return o;function o(u){let h=r.events.length,c;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){c=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),G(u)?Z(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||B(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ns={tokenize:rs};function rs(e){const t=this,n=e.attempt(st,r,e.attempt(this.parser.constructs.flowInitial,i,Z(e,e.attempt(this.parser.constructs.flow,i,e.attempt(la,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const is={resolveAll:Br()},os=_r("string"),as=_r("text");function _r(e){return{resolveAll:Br(e==="text"?ss:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,a,s);return a;function a(h){return u(h)?o(h):s(h)}function s(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),l}function l(h){return u(h)?(n.exit("data"),o(h)):(n.consume(h),l)}function u(h){if(h===null)return!0;const c=i[h];let f=-1;if(c)for(;++f<c.length;){const p=c[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Br(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function ss(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,a=-1,s=0,l;for(;o--;){const u=i[o];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)s++,a--;if(a)break;a=-1}else if(u===-2)l=!0,s++;else if(u!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const ls={42:de,43:de,45:de,48:de,49:de,50:de,51:de,52:de,53:de,54:de,55:de,56:de,57:de,62:Pr},us={91:fa},cs={[-2]:Dt,[-1]:Dt,32:Dt},hs={35:ba,42:yt,45:[Un,yt],60:Ca,61:Un,95:yt,96:Bn,126:Bn},ps={38:zr,92:jr},fs={[-5]:Lt,[-4]:Lt,[-3]:Lt,33:Ha,38:zr,42:Qt,60:[qo,Da],91:qa,92:[ya,jr],93:hn,95:Qt,96:na},ds={null:[Qt,is]},ms={null:[42,95]},gs={null:[]},ys=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ms,contentInitial:us,disable:gs,document:ls,flow:hs,flowInitial:cs,insideSpan:ds,string:ps,text:fs},Symbol.toStringTag,{value:"Module"}));function xs(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let a=[],s=[];const l={attempt:R(D),check:R(w),consume:E,enter:T,exit:M,interrupt:R(w,{interrupt:!0})},u={code:null,containerState:{},defineSkip:k,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:c};let h=t.tokenize.call(u,l);return t.resolveAll&&o.push(t),u;function c(C){return a=ke(a,C),v(),a[a.length-1]!==null?[]:(_(t,0),u.events=Ct(o,u.events,u),u.events)}function f(C,z){return ks(p(C),z)}function p(C){return bs(a,C)}function m(){const{_bufferIndex:C,_index:z,line:j,column:N,offset:L}=r;return{_bufferIndex:C,_index:z,line:j,column:N,offset:L}}function k(C){i[C.line]=C.column,x()}function v(){let C;for(;r._index<a.length;){const z=a[r._index];if(typeof z=="string")for(C=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===C&&r._bufferIndex<z.length;)b(z.charCodeAt(r._bufferIndex));else b(z)}}function b(C){h=h(C)}function E(C){B(C)?(r.line++,r.column=1,r.offset+=C===-3?2:1,x()):C!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=C}function T(C,z){const j=z||{};return j.type=C,j.start=m(),u.events.push(["enter",j,u]),s.push(j),j}function M(C){const z=s.pop();return z.end=m(),u.events.push(["exit",z,u]),z}function D(C,z){_(C,z.from)}function w(C,z){z.restore()}function R(C,z){return j;function j(N,L,W){let Q,oe,ne,g;return Array.isArray(N)?pe(N):"tokenize"in N?pe([N]):le(N);function le(O){return H;function H(V){const J=V!==null&&O[V],K=V!==null&&O.null,X=[...Array.isArray(J)?J:J?[J]:[],...Array.isArray(K)?K:K?[K]:[]];return pe(X)(V)}}function pe(O){return Q=O,oe=0,O.length===0?W:y(O[oe])}function y(O){return H;function H(V){return g=F(),ne=O,O.partial||(u.currentConstruct=O),O.name&&u.parser.constructs.disable.null.includes(O.name)?ge():O.tokenize.call(z?Object.assign(Object.create(u),z):u,l,se,ge)(V)}}function se(O){return C(ne,g),L}function ge(O){return g.restore(),++oe<Q.length?y(Q[oe]):W}}}function _(C,z){C.resolveAll&&!o.includes(C)&&o.push(C),C.resolve&&be(u.events,z,u.events.length-z,C.resolve(u.events.slice(z),u)),C.resolveTo&&(u.events=C.resolveTo(u.events,u))}function F(){const C=m(),z=u.previous,j=u.currentConstruct,N=u.events.length,L=Array.from(s);return{from:N,restore:W};function W(){r=C,u.previous=z,u.currentConstruct=j,u.events.length=N,s=L,x()}}function x(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function bs(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,o)];else{if(a=e.slice(n,i),r>-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function ks(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),A=require("react"),ce=require("react-i18next"),ie=require("lucide-react"),Di=require("axios"),gt=require("i18next"),Li=require("i18next-browser-languagedetector"),ot="3.0.4",Pi=30,fr=Pi*24*60*60*1e3,Le={VERIFIED:"gpc_captcha_verified",TIMESTAMP:"gpc_captcha_timestamp"},ji=["honeypot_field_1","honeypot_field_2","hp_field"];process.env.NODE_ENV;const zi=({onClick:e,unreadCount:t=0,widgetConfig:n})=>{const{t:r}=ce.useTranslation(),i=n?.widget_customization?.branding?.company_name||r("widget.title"),o=a=>{a.preventDefault(),a.stopPropagation(),e()};return d.jsxs("button",{type:"button",onClick:o,className:"gpc-floating-button gpc-floating-button-with-text gpc-animate-fade-in","aria-label":r("chat.title"),title:r("chat.title"),children:[d.jsxs("div",{className:"gpc-floating-content",children:[d.jsx(ie.MessageCircle,{className:"gpc-floating-icon"}),d.jsxs("span",{className:"gpc-floating-text",children:[r("widget.questionsTo")," ",i]})]}),t>0&&d.jsx("span",{className:"gpc-notification-badge",children:t>9?"9+":t})]})},Mi=()=>{const{i18n:e,t}=ce.useTranslation(),n=[{code:"en",label:t("languages.english"),flag:"🇬🇧"},{code:"es",label:t("languages.spanish"),flag:"🇪🇸"},{code:"fr",label:t("languages.french"),flag:"🇫🇷"}],[r,i]=A.useState(!1),o=A.useRef(null),a=n.find(l=>l.code===e.language)||n[0],s=(l,u)=>{l.preventDefault(),l.stopPropagation(),e.changeLanguage(u),i(!1)};return A.useEffect(()=>{const l=u=>{o.current&&!o.current.contains(u.target)&&i(!1)};return r&&document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[r]),d.jsxs("div",{className:"gpc-language-selector",ref:o,children:[d.jsx("button",{type:"button",onClick:l=>{l.preventDefault(),l.stopPropagation(),i(!r)},className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":t("ui.languageSelector.label"),title:t("ui.languageSelector.label"),children:d.jsx(ie.Globe,{className:"gpc-icon"})}),r&&d.jsx("div",{className:"gpc-language-dropdown",children:n.map(l=>d.jsxs("button",{type:"button",onClick:u=>s(u,l.code),className:`gpc-language-option ${l.code===a.code?"gpc-language-option-active":""}`,children:[d.jsx("span",{className:"gpc-language-flag",children:l.flag}),d.jsx("span",{className:"gpc-language-label",children:l.label})]},l.code))})]})},Ri=({onClose:e,theme:t,onToggleTheme:n,showBranding:r=!0,widgetConfig:i=null,onToggleConversations:o,showConversations:a=!1,conversationsCount:s=0,onToggleAbout:l,showAbout:u=!1,version:h=ot,onToggleMcpLogin:c,showMcpLogin:f=!1,mcpLoggedIn:p=!1})=>{const{t:m}=ce.useTranslation(),[b,v]=A.useState(!1),k=A.useRef(null);A.useEffect(()=>{const C=z=>{k.current&&!k.current.contains(z.target)&&v(!1)};return b&&document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[b]);const E=i?.widget_customization?.branding?.company_name||m("widget.title"),T=i?.widget_customization?.branding?.custom_title,M=i?.widget_customization?.branding?.company_logo_base64,D=T||E,w=M?.startsWith("data:")?M:M?`data:image/png;base64,${M}`:null,R=i?.widget_customization?.colors?.header_background,_=i?.widget_customization?.colors?.header_text,F={};R&&(F.backgroundColor=R),_&&(F.color=_);const x=(C,z)=>{C.preventDefault(),C.stopPropagation(),v(!1),z()};return d.jsxs("div",{className:"gpc-chat-header",style:F,children:[d.jsxs("div",{className:"gpc-header-content",children:[w&&d.jsx("div",{className:"gpc-header-logo",children:d.jsx("img",{src:w,alt:E,className:"gpc-company-logo"})}),d.jsx("div",{className:"gpc-header-text",children:d.jsx("h2",{className:"gpc-header-title",style:_?{color:_}:{},children:D})})]}),d.jsxs("div",{className:"gpc-header-actions",children:[o&&d.jsxs("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),o()},className:`gpc-header-button gpc-focus-visible gpc-transition relative ${a?"bg-blue-500 text-white":""}`,"aria-label":m("conversations.toggle","Toggle conversations"),title:m("conversations.toggle","Toggle conversations"),children:[d.jsx(ie.MessageSquare,{className:"gpc-icon",size:20}),s>0&&d.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full w-4 h-4 flex items-center justify-center",children:s>9?"9+":s})]}),d.jsx(Mi,{}),d.jsxs("div",{className:"gpc-header-menu",ref:k,children:[d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),v(z=>!z)},className:`gpc-header-button gpc-focus-visible gpc-transition ${b?"bg-blue-500 text-white":""}`,"aria-label":m("ui.menu"),title:m("ui.menu"),children:d.jsx(ie.MoreVertical,{className:"gpc-icon",size:20})}),b&&d.jsxs("div",{className:"gpc-header-dropdown",children:[d.jsxs("button",{type:"button",className:"gpc-header-dropdown-item",onClick:C=>x(C,n),children:[t==="light"?d.jsx(ie.Moon,{size:16,className:"gpc-header-dropdown-icon"}):d.jsx(ie.Sun,{size:16,className:"gpc-header-dropdown-icon"}),d.jsx("span",{children:m("theme.toggle")})]}),l&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"gpc-header-dropdown-divider"}),d.jsxs("button",{type:"button",className:`gpc-header-dropdown-item ${u?"gpc-header-dropdown-item-active":""}`,onClick:C=>x(C,l),children:[d.jsx(ie.Info,{size:16,className:"gpc-header-dropdown-icon"}),d.jsx("span",{children:m("about.title")})]})]}),c&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"gpc-header-dropdown-divider"}),d.jsxs("button",{type:"button",className:"gpc-header-dropdown-item",onClick:C=>x(C,c),children:[p?d.jsx(ie.LogOut,{size:16,className:"gpc-header-dropdown-icon"}):d.jsx(ie.LogIn,{size:16,className:"gpc-header-dropdown-icon"}),d.jsx("span",{children:m(p?"moodle.logout":"moodle.login")})]})]})]})]}),d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),e()},className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":m("chat.close"),title:m("chat.close"),children:d.jsx(ie.ChevronDown,{className:"gpc-icon"})})]})]})};function Oi(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Fi=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_i=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bi={};function Cn(e,t){return(Bi.jsx?_i:Fi).test(e)}const Hi=/[ \t\n\f\r]/g;function Ui(e){return typeof e=="object"?e.type==="text"?Sn(e.value):!1:Sn(e)}function Sn(e){return e.replace(Hi,"")===""}class at{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}at.prototype.normal={};at.prototype.property={};at.prototype.space=void 0;function dr(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new at(n,r,t)}function Wt(e){return e.toLowerCase()}class me{constructor(t,n){this.attribute=n,this.property=t}}me.prototype.attribute="";me.prototype.booleanish=!1;me.prototype.boolean=!1;me.prototype.commaOrSpaceSeparated=!1;me.prototype.commaSeparated=!1;me.prototype.defined=!1;me.prototype.mustUseProperty=!1;me.prototype.number=!1;me.prototype.overloadedBoolean=!1;me.prototype.property="";me.prototype.spaceSeparated=!1;me.prototype.space=void 0;let qi=0;const V=Re(),ae=Re(),Vt=Re(),I=Re(),te=Re(),We=Re(),xe=Re();function Re(){return 2**++qi}const Gt=Object.freeze(Object.defineProperty({__proto__:null,boolean:V,booleanish:ae,commaOrSpaceSeparated:xe,commaSeparated:We,number:I,overloadedBoolean:Vt,spaceSeparated:te},Symbol.toStringTag,{value:"Module"})),At=Object.keys(Gt);class tn extends me{constructor(t,n,r,i){let o=-1;if(super(t,n),En(this,"space",i),typeof r=="number")for(;++o<At.length;){const a=At[o];En(this,At[o],(r&Gt[a])===Gt[a])}}}tn.prototype.defined=!0;function En(e,t,n){n&&(e[t]=n)}function Ge(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new tn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Wt(r)]=r,n[Wt(o.attribute)]=r}return new at(t,n,e.space)}const mr=Ge({properties:{ariaActiveDescendant:null,ariaAtomic:ae,ariaAutoComplete:null,ariaBusy:ae,ariaChecked:ae,ariaColCount:I,ariaColIndex:I,ariaColSpan:I,ariaControls:te,ariaCurrent:null,ariaDescribedBy:te,ariaDetails:null,ariaDisabled:ae,ariaDropEffect:te,ariaErrorMessage:null,ariaExpanded:ae,ariaFlowTo:te,ariaGrabbed:ae,ariaHasPopup:null,ariaHidden:ae,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:te,ariaLevel:I,ariaLive:null,ariaModal:ae,ariaMultiLine:ae,ariaMultiSelectable:ae,ariaOrientation:null,ariaOwns:te,ariaPlaceholder:null,ariaPosInSet:I,ariaPressed:ae,ariaReadOnly:ae,ariaRelevant:null,ariaRequired:ae,ariaRoleDescription:te,ariaRowCount:I,ariaRowIndex:I,ariaRowSpan:I,ariaSelected:ae,ariaSetSize:I,ariaSort:null,ariaValueMax:I,ariaValueMin:I,ariaValueNow:I,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function gr(e,t){return t in e?e[t]:t}function yr(e,t){return gr(e,t.toLowerCase())}const Wi=Ge({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:We,acceptCharset:te,accessKey:te,action:null,allow:null,allowFullScreen:V,allowPaymentRequest:V,allowUserMedia:V,alt:null,as:null,async:V,autoCapitalize:null,autoComplete:te,autoFocus:V,autoPlay:V,blocking:te,capture:null,charSet:null,checked:V,cite:null,className:te,cols:I,colSpan:null,content:null,contentEditable:ae,controls:V,controlsList:te,coords:I|We,crossOrigin:null,data:null,dateTime:null,decoding:null,default:V,defer:V,dir:null,dirName:null,disabled:V,download:Vt,draggable:ae,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:V,formTarget:null,headers:te,height:I,hidden:Vt,high:I,href:null,hrefLang:null,htmlFor:te,httpEquiv:te,id:null,imageSizes:null,imageSrcSet:null,inert:V,inputMode:null,integrity:null,is:null,isMap:V,itemId:null,itemProp:te,itemRef:te,itemScope:V,itemType:te,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:V,low:I,manifest:null,max:null,maxLength:I,media:null,method:null,min:null,minLength:I,multiple:V,muted:V,name:null,nonce:null,noModule:V,noValidate:V,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:V,optimum:I,pattern:null,ping:te,placeholder:null,playsInline:V,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:V,referrerPolicy:null,rel:te,required:V,reversed:V,rows:I,rowSpan:I,sandbox:te,scope:null,scoped:V,seamless:V,selected:V,shadowRootClonable:V,shadowRootDelegatesFocus:V,shadowRootMode:null,shape:null,size:I,sizes:null,slot:null,span:I,spellCheck:ae,src:null,srcDoc:null,srcLang:null,srcSet:null,start:I,step:null,style:null,tabIndex:I,target:null,title:null,translate:null,type:null,typeMustMatch:V,useMap:null,value:ae,width:I,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:te,axis:null,background:null,bgColor:null,border:I,borderColor:null,bottomMargin:I,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:V,declare:V,event:null,face:null,frame:null,frameBorder:null,hSpace:I,leftMargin:I,link:null,longDesc:null,lowSrc:null,marginHeight:I,marginWidth:I,noResize:V,noHref:V,noShade:V,noWrap:V,object:null,profile:null,prompt:null,rev:null,rightMargin:I,rules:null,scheme:null,scrolling:ae,standby:null,summary:null,text:null,topMargin:I,valueType:null,version:null,vAlign:null,vLink:null,vSpace:I,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:V,disableRemotePlayback:V,prefix:null,property:null,results:I,security:null,unselectable:null},space:"html",transform:yr}),Vi=Ge({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:xe,accentHeight:I,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:I,amplitude:I,arabicForm:null,ascent:I,attributeName:null,attributeType:null,azimuth:I,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:I,by:null,calcMode:null,capHeight:I,className:te,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:I,diffuseConstant:I,direction:null,display:null,dur:null,divisor:I,dominantBaseline:null,download:V,dx:null,dy:null,edgeMode:null,editable:null,elevation:I,enableBackground:null,end:null,event:null,exponent:I,externalResourcesRequired:null,fill:null,fillOpacity:I,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:We,g2:We,glyphName:We,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:I,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:I,horizOriginX:I,horizOriginY:I,id:null,ideographic:I,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:I,k:I,k1:I,k2:I,k3:I,k4:I,kernelMatrix:xe,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:I,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:I,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:I,overlineThickness:I,paintOrder:null,panose1:null,path:null,pathLength:I,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:te,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:I,pointsAtY:I,pointsAtZ:I,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:xe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:xe,rev:xe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:xe,requiredFeatures:xe,requiredFonts:xe,requiredFormats:xe,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:I,specularExponent:I,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:I,strikethroughThickness:I,string:null,stroke:null,strokeDashArray:xe,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:I,strokeOpacity:I,strokeWidth:null,style:null,surfaceScale:I,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:xe,tabIndex:I,tableValues:null,target:null,targetX:I,targetY:I,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:xe,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:I,underlineThickness:I,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:I,values:null,vAlphabetic:I,vMathematical:I,vectorEffect:null,vHanging:I,vIdeographic:I,version:null,vertAdvY:I,vertOriginX:I,vertOriginY:I,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:I,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:gr}),xr=Ge({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),kr=Ge({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yr}),br=Ge({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Gi={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Yi=/[A-Z]/g,Tn=/-[a-z]/g,Zi=/^data[-\w.:]+$/i;function Ji(e,t){const n=Wt(t);let r=t,i=me;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Zi.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Tn,Xi);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Tn.test(o)){let a=o.replace(Yi,Qi);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=tn}return new i(r,t)}function Qi(e){return"-"+e.toLowerCase()}function Xi(e){return e.charAt(1).toUpperCase()}const Ki=dr([mr,Wi,xr,kr,br],"html"),nn=dr([mr,Vi,xr,kr,br],"svg");function $i(e){return e.join(" ").trim()}function wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Be={},It,An;function eo(){if(An)return It;An=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
2
+ `,u="/",h="*",c="",f="comment",p="declaration";It=function(b,v){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];v=v||{};var k=1,E=1;function T(j){var N=j.match(t);N&&(k+=N.length);var L=j.lastIndexOf(l);E=~L?j.length-L:E+j.length}function M(){var j={line:k,column:E};return function(N){return N.position=new D(j),_(),N}}function D(j){this.start=j,this.end={line:k,column:E},this.source=v.source}D.prototype.content=b;function w(j){var N=new Error(v.source+":"+k+":"+E+": "+j);if(N.reason=j,N.filename=v.source,N.line=k,N.column=E,N.source=b,!v.silent)throw N}function R(j){var N=j.exec(b);if(N){var L=N[0];return T(L),b=b.slice(L.length),N}}function _(){R(n)}function F(j){var N;for(j=j||[];N=x();)N!==!1&&j.push(N);return j}function x(){var j=M();if(!(u!=b.charAt(0)||h!=b.charAt(1))){for(var N=2;c!=b.charAt(N)&&(h!=b.charAt(N)||u!=b.charAt(N+1));)++N;if(N+=2,c===b.charAt(N-1))return w("End of comment missing");var L=b.slice(2,N-2);return E+=2,T(L),b=b.slice(N),E+=2,j({type:f,comment:L})}}function C(){var j=M(),N=R(r);if(N){if(x(),!R(i))return w("property missing ':'");var L=R(o),H=j({type:p,property:m(N[0].replace(e,c)),value:L?m(L[0].replace(e,c)):c});return R(a),H}}function z(){var j=[];F(j);for(var N;N=C();)N!==!1&&(j.push(N),F(j));return j}return _(),z()};function m(b){return b?b.replace(s,c):c}return It}var In;function to(){if(In)return Be;In=1;var e=Be&&Be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Be,"__esModule",{value:!0}),Be.default=n;const t=e(eo());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),s=typeof i=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:h}=l;s?i(u,h,l):h&&(o=o||{},o[u]=h)}),o}return Be}var Qe={},Nn;function no(){if(Nn)return Qe;Nn=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(u){return!u||n.test(u)||e.test(u)},a=function(u,h){return h.toUpperCase()},s=function(u,h){return"".concat(h,"-")},l=function(u,h){return h===void 0&&(h={}),o(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(i,s):u=u.replace(r,s),u.replace(t,a))};return Qe.camelCase=l,Qe}var Xe,Dn;function ro(){if(Dn)return Xe;Dn=1;var e=Xe&&Xe.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(to()),n=no();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(s,l){s&&l&&(a[(0,n.camelCase)(s,o)]=l)}),a}return r.default=r,Xe=r,Xe}var io=ro();const oo=wr(io),vr=Cr("end"),rn=Cr("start");function Cr(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ao(e){const t=rn(e),n=vr(e);if(t&&n)return{start:t,end:n}}function et(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ln(e.position):"start"in e||"end"in e?Ln(e):"line"in e||"column"in e?Yt(e):""}function Yt(e){return Pn(e&&e.line)+":"+Pn(e&&e.column)}function Ln(e){return Yt(e&&e.start)+"-"+Yt(e&&e.end)}function Pn(e){return e&&typeof e=="number"?e:1}class he extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=et(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}he.prototype.file="";he.prototype.name="";he.prototype.reason="";he.prototype.message="";he.prototype.stack="";he.prototype.column=void 0;he.prototype.line=void 0;he.prototype.ancestors=void 0;he.prototype.cause=void 0;he.prototype.fatal=void 0;he.prototype.place=void 0;he.prototype.ruleId=void 0;he.prototype.source=void 0;const on={}.hasOwnProperty,so=new Map,lo=/[A-Z]/g,uo=new Set(["table","tbody","thead","tfoot","tr"]),co=new Set(["td","th"]),Sr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ho(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=bo(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=ko(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?nn:Ki,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Er(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function Er(e,t,n){if(t.type==="element")return po(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return fo(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return go(e,t,n);if(t.type==="mdxjsEsm")return mo(e,t);if(t.type==="root")return yo(e,t,n);if(t.type==="text")return xo(e,t)}function po(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=nn,e.schema=i),e.ancestors.push(t);const o=Ar(e,t.tagName,!1),a=wo(e,t);let s=sn(e,t);return uo.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!Ui(l):!0})),Tr(e,a,o,t),an(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function fo(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}rt(e,t.position)}function mo(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);rt(e,t.position)}function go(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=nn,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:Ar(e,t.name,!0),a=vo(e,t),s=sn(e,t);return Tr(e,a,o,t),an(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function yo(e,t,n){const r={};return an(r,sn(e,t)),e.create(t,e.Fragment,r,n)}function xo(e,t){return t.value}function Tr(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function an(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ko(e,t,n){return r;function r(i,o,a,s){const u=Array.isArray(a.children)?n:t;return s?u(o,a,s):u(o,a)}}function bo(e,t){return n;function n(r,i,o,a){const s=Array.isArray(o.children),l=rn(r);return t(i,o,a,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function wo(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&on.call(t.properties,i)){const o=Co(e,i,t.properties[i]);if(o){const[a,s]=o;e.tableCellAlignToStyle&&a==="align"&&typeof s=="string"&&co.has(t.tagName)?r=s:n[a]=s}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function vo(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const s=a.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else rt(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,o=e.evaluater.evaluateExpression(s.expression)}else rt(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function sn(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:so;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){const u=i.get(l)||0;a=l+"-"+u,i.set(l,u+1)}}const s=Er(e,o,a);s!==void 0&&n.push(s)}return n}function Co(e,t,n){const r=Ji(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Oi(n):$i(n)),r.property==="style"){let i=typeof n=="object"?n:So(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Eo(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Gi[r.property]||r.property:r.attribute,n]}}function So(e,t){try{return oo(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new he("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Sr+"#cannot-parse-style-attribute",i}}function Ar(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,a;for(;++o<i.length;){const s=Cn(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};a=a?{type:"MemberExpression",object:a,property:s,computed:!!(o&&s.type==="Literal"),optional:!1}:s}r=a}else r=Cn(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return on.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);rt(e)}function rt(e,t){const n=new he("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Sr+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Eo(e){const t={};let n;for(n in e)on.call(e,n)&&(t[To(n)]=e[n]);return t}function To(e){let t=e.replace(lo,Ao);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Ao(e){return"-"+e.toLowerCase()}const Nt={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Io={};function ln(e,t){const n=Io,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ir(e,r,i)}function Ir(e,t,n){if(No(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return jn(e.children,t,n)}return Array.isArray(e)?jn(e,t,n):""}function jn(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Ir(e[i],t,n);return r.join("")}function No(e){return!!(e&&typeof e=="object")}const zn=document.createElement("i");function un(e){const t="&"+e+";";zn.innerHTML=t;const n=zn.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ke(e,t,n,r){const i=e.length;let o=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function be(e,t){return e.length>0?(ke(e,e.length,0,t),e):t}const Mn={}.hasOwnProperty;function Nr(e){const t={};let n=-1;for(;++n<e.length;)Do(t,e[n]);return t}function Do(e,t){let n;for(n in t){const i=(Mn.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){Mn.call(i,a)||(i[a]=[]);const s=o[a];Lo(i[a],Array.isArray(s)?s:s?[s]:[])}}}function Lo(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ke(e,0,0,r)}function Dr(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ve(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const fe=Pe(/[A-Za-z]/),ue=Pe(/[\dA-Za-z]/),Po=Pe(/[#-'*+\--9=?A-Z^-~]/);function xt(e){return e!==null&&(e<32||e===127)}const Zt=Pe(/\d/),jo=Pe(/[\dA-Fa-f]/),zo=Pe(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function ee(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}const vt=Pe(new RegExp("\\p{P}|\\p{S}","u")),Me=Pe(/\s/);function Pe(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ye(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&ue(e.charCodeAt(n+1))&&ue(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const s=e.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Q(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return Y(l)?(e.enter(n),s(l)):t(l)}function s(l){return Y(l)&&o++<i?(e.consume(l),s):(e.exit(n),t(l))}}const Mo={tokenize:Ro};function Ro(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Q(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),o(s)}function o(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(s)}function a(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return B(s)?(e.consume(s),e.exit("chunkText"),o):(e.consume(s),a)}}const Oo={tokenize:Fo},Rn={tokenize:_o};function Fo(e){const t=this,n=[];let r=0,i,o,a;return s;function s(T){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,l,u)(T)}return u(T)}function l(T){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&E();const M=t.events.length;let D=M,w;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){w=t.events[D][1].end;break}k(r);let R=M;for(;R<t.events.length;)t.events[R][1].end={...w},R++;return ke(t.events,D+1,0,t.events.slice(M)),t.events.length=R,u(T)}return s(T)}function u(T){if(r===n.length){if(!i)return f(T);if(i.currentConstruct&&i.currentConstruct.concrete)return m(T);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Rn,h,c)(T)}function h(T){return i&&E(),k(r),f(T)}function c(T){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,m(T)}function f(T){return t.containerState={},e.attempt(Rn,p,m)(T)}function p(T){return r++,n.push([t.currentConstruct,t.containerState]),f(T)}function m(T){if(T===null){i&&E(),k(0),e.consume(T);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),b(T)}function b(T){if(T===null){v(e.exit("chunkFlow"),!0),k(0),e.consume(T);return}return B(T)?(e.consume(T),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(T),b)}function v(T,M){const D=t.sliceStream(T);if(M&&D.push(null),T.previous=o,o&&(o.next=T),o=T,i.defineSkip(T.start),i.write(D),t.parser.lazy[T.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<a&&(!i.events[w][1].end||i.events[w][1].end.offset>a))return;const R=t.events.length;let _=R,F,x;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(F){x=t.events[_][1].end;break}F=!0}for(k(r),w=R;w<t.events.length;)t.events[w][1].end={...x},w++;ke(t.events,_+1,0,t.events.slice(R)),t.events.length=w}}function k(T){let M=n.length;for(;M-- >T;){const D=n[M];t.containerState=D[1],D[0].exit.call(t,e)}n.length=T}function E(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function _o(e,t,n){return Q(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ve(e){if(e===null||ee(e)||Me(e))return 1;if(vt(e))return 2}function Ct(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Jt={name:"attention",resolveAll:Bo,tokenize:Ho};function Bo(e,t){let n=-1,r,i,o,a,s,l,u,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},f={...e[n][1].start};On(c,-l),On(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},e[r][1].end={...a.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=be(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=be(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",o,t]]),u=be(u,Ct(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=be(u,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,u=be(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,ke(e,r-1,n-r+3,u),n=r+u.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Ho(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ve(r);let o;return a;function a(l){return o=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===o)return e.consume(l),s;const u=e.exit("attentionSequence"),h=Ve(l),c=!h||h===2&&i||n.includes(l),f=!i||i===2&&h||n.includes(r);return u._open=!!(o===42?c:c&&(i||!f)),u._close=!!(o===42?f:f&&(h||!c)),t(l)}}function On(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Uo={name:"autolink",tokenize:qo};function qo(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return fe(p)?(e.consume(p),a):p===64?n(p):u(p)}function a(p){return p===43||p===45||p===46||ue(p)?(r=1,s(p)):u(p)}function s(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||ue(p))&&r++<32?(e.consume(p),s):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||xt(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),h):Po(p)?(e.consume(p),u):n(p)}function h(p){return ue(p)?c(p):n(p)}function c(p){return p===46?(e.consume(p),r=0,h):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||ue(p))&&r++<63){const m=p===45?f:c;return e.consume(p),m}return n(p)}}const st={partial:!0,tokenize:Wo};function Wo(e,t,n){return r;function r(o){return Y(o)?Q(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||B(o)?t(o):n(o)}}const Lr={continuation:{tokenize:Go},exit:Yo,name:"blockQuote",tokenize:Vo};function Vo(e,t,n){const r=this;return i;function i(a){if(a===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return n(a)}function o(a){return Y(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function Go(e,t,n){const r=this;return i;function i(a){return Y(a)?Q(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(Lr,t,n)(a)}}function Yo(e){e.exit("blockQuote")}const Pr={name:"characterEscape",tokenize:Zo};function Zo(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return zo(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const jr={name:"characterReference",tokenize:Jo};function Jo(e,t,n){const r=this;let i=0,o,a;return s;function s(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),l}function l(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),o=31,a=ue,h(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=jo,h):(e.enter("characterReferenceValue"),o=7,a=Zt,h(c))}function h(c){if(c===59&&i){const f=e.exit("characterReferenceValue");return a===ue&&!un(r.sliceSerialize(f))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(c)&&i++<o?(e.consume(c),h):n(c)}}const Fn={partial:!0,tokenize:Xo},_n={concrete:!0,name:"codeFenced",tokenize:Qo};function Qo(e,t,n){const r=this,i={partial:!0,tokenize:D};let o=0,a=0,s;return l;function l(w){return u(w)}function u(w){const R=r.events[r.events.length-1];return o=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,s=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(w)}function h(w){return w===s?(a++,e.consume(w),h):a<3?n(w):(e.exit("codeFencedFenceSequence"),Y(w)?Q(e,c,"whitespace")(w):c(w))}function c(w){return w===null||B(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(Fn,b,M)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===null||B(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(w)):Y(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Q(e,p,"whitespace")(w)):w===96&&w===s?n(w):(e.consume(w),f)}function p(w){return w===null||B(w)?c(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||B(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(w)):w===96&&w===s?n(w):(e.consume(w),m)}function b(w){return e.attempt(i,M,v)(w)}function v(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),k}function k(w){return o>0&&Y(w)?Q(e,E,"linePrefix",o+1)(w):E(w)}function E(w){return w===null||B(w)?e.check(Fn,b,M)(w):(e.enter("codeFlowValue"),T(w))}function T(w){return w===null||B(w)?(e.exit("codeFlowValue"),E(w)):(e.consume(w),T)}function M(w){return e.exit("codeFenced"),t(w)}function D(w,R,_){let F=0;return x;function x(L){return w.enter("lineEnding"),w.consume(L),w.exit("lineEnding"),C}function C(L){return w.enter("codeFencedFence"),Y(L)?Q(w,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):z(L)}function z(L){return L===s?(w.enter("codeFencedFenceSequence"),j(L)):_(L)}function j(L){return L===s?(F++,w.consume(L),j):F>=a?(w.exit("codeFencedFenceSequence"),Y(L)?Q(w,N,"whitespace")(L):N(L)):_(L)}function N(L){return L===null||B(L)?(w.exit("codeFencedFence"),R(L)):_(L)}}}function Xo(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Dt={name:"codeIndented",tokenize:$o},Ko={partial:!0,tokenize:ea};function $o(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Q(e,o,"linePrefix",5)(u)}function o(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):B(u)?e.attempt(Ko,a,l)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||B(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),s)}function l(u){return e.exit("codeIndented"),t(u)}}function ea(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):B(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):Q(e,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):B(a)?i(a):n(a)}}const ta={name:"codeText",previous:ra,resolve:na,tokenize:ia};function na(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ra(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ia(e,t,n){let r=0,i,o;return a;function a(c){return e.enter("codeText"),e.enter("codeTextSequence"),s(c)}function s(c){return c===96?(e.consume(c),r++,s):(e.exit("codeTextSequence"),l(c))}function l(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),l):c===96?(o=e.enter("codeTextSequence"),i=0,h(c)):B(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||B(c)?(e.exit("codeTextData"),l(c)):(e.consume(c),u)}function h(c){return c===96?(e.consume(c),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(o.type="codeTextData",u(c))}}class oa{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ke(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ke(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ke(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ke(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ke(this.left,n.reverse())}}}function Ke(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function zr(e){const t={};let n=-1,r,i,o,a,s,l,u;const h=new oa(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,aa(h,n)),n=t[n],u=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(a=h.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},s=h.slice(i,n),s.unshift(r),h.splice(i,n-i+1,s))}}return ke(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!u}function aa(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const s=a.events,l=[],u={};let h,c,f=-1,p=n,m=0,b=0;const v=[b];for(;p;){for(;e.get(++i)[1]!==p;);o.push(i),p._tokenizer||(h=r.sliceStream(p),p.next||h.push(null),c&&a.defineSkip(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(h),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),c=p,p=p.next}for(p=n;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(b=f+1,v.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):v.pop(),f=v.length;f--;){const k=s.slice(v[f],v[f+1]),E=o.pop();l.push([E,E+k.length-1]),e.splice(E,2,k)}for(l.reverse(),f=-1;++f<l.length;)u[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return u}const sa={resolve:ua,tokenize:ca},la={partial:!0,tokenize:ha};function ua(e){return zr(e),e}function ca(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?o(s):B(s)?e.check(la,a,o)(s):(e.consume(s),i)}function o(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function a(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function ha(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Q(e,o,"linePrefix")}function o(a){if(a===null||B(a))return n(a);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function Mr(e,t,n,r,i,o,a,s,l){const u=l||Number.POSITIVE_INFINITY;let h=0;return c;function c(k){return k===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(k),e.exit(o),f):k===null||k===32||k===41||xt(k)?n(k):(e.enter(r),e.enter(a),e.enter(s),e.enter("chunkString",{contentType:"string"}),b(k))}function f(k){return k===62?(e.enter(o),e.consume(k),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===62?(e.exit("chunkString"),e.exit(s),f(k)):k===null||k===60||B(k)?n(k):(e.consume(k),k===92?m:p)}function m(k){return k===60||k===62||k===92?(e.consume(k),p):p(k)}function b(k){return!h&&(k===null||k===41||ee(k))?(e.exit("chunkString"),e.exit(s),e.exit(a),e.exit(r),t(k)):h<u&&k===40?(e.consume(k),h++,b):k===41?(e.consume(k),h--,b):k===null||k===32||k===40||xt(k)?n(k):(e.consume(k),k===92?v:b)}function v(k){return k===40||k===41||k===92?(e.consume(k),b):b(k)}}function Rr(e,t,n,r,i,o){const a=this;let s=0,l;return u;function u(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(o),h}function h(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):B(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===null||p===91||p===93||B(p)||s++>999?(e.exit("chunkString"),h(p)):(e.consume(p),l||(l=!Y(p)),p===92?f:c)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,c):c(p)}}function Or(e,t,n,r,i,o){let a;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),a=f===40?41:f,l):n(f)}function l(f){return f===a?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(o),u(f))}function u(f){return f===a?(e.exit(o),l(a)):f===null?n(f):B(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Q(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===a||f===null||B(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?c:h)}function c(f){return f===a||f===92?(e.consume(f),h):h(f)}}function tt(e,t){let n;return r;function r(i){return B(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Y(i)?Q(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const pa={name:"definition",tokenize:da},fa={partial:!0,tokenize:ma};function da(e,t,n){const r=this;let i;return o;function o(p){return e.enter("definition"),a(p)}function a(p){return Rr.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ee(p)?tt(e,u)(p):u(p)}function u(p){return Mr(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return e.attempt(fa,c,c)(p)}function c(p){return Y(p)?Q(e,f,"whitespace")(p):f(p)}function f(p){return p===null||B(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function ma(e,t,n){return r;function r(s){return ee(s)?tt(e,i)(s):n(s)}function i(s){return Or(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return Y(s)?Q(e,a,"whitespace")(s):a(s)}function a(s){return s===null||B(s)?t(s):n(s)}}const ga={name:"hardBreakEscape",tokenize:ya};function ya(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return B(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const xa={name:"headingAtx",resolve:ka,tokenize:ba};function ka(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ke(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function ba(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),o(h)}function o(h){return e.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(e.consume(h),a):h===null||ee(h)?(e.exit("atxHeadingSequence"),s(h)):n(h)}function s(h){return h===35?(e.enter("atxHeadingSequence"),l(h)):h===null||B(h)?(e.exit("atxHeading"),t(h)):Y(h)?Q(e,s,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function l(h){return h===35?(e.consume(h),l):(e.exit("atxHeadingSequence"),s(h))}function u(h){return h===null||h===35||ee(h)?(e.exit("atxHeadingText"),s(h)):(e.consume(h),u)}}const wa=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Bn=["pre","script","style","textarea"],va={concrete:!0,name:"htmlFlow",resolveTo:Ea,tokenize:Ta},Ca={partial:!0,tokenize:Ia},Sa={partial:!0,tokenize:Aa};function Ea(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Ta(e,t,n){const r=this;let i,o,a,s,l;return u;function u(y){return h(y)}function h(y){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(y),c}function c(y){return y===33?(e.consume(y),f):y===47?(e.consume(y),o=!0,b):y===63?(e.consume(y),i=3,r.interrupt?t:g):fe(y)?(e.consume(y),a=String.fromCharCode(y),v):n(y)}function f(y){return y===45?(e.consume(y),i=2,p):y===91?(e.consume(y),i=5,s=0,m):fe(y)?(e.consume(y),i=4,r.interrupt?t:g):n(y)}function p(y){return y===45?(e.consume(y),r.interrupt?t:g):n(y)}function m(y){const se="CDATA[";return y===se.charCodeAt(s++)?(e.consume(y),s===se.length?r.interrupt?t:z:m):n(y)}function b(y){return fe(y)?(e.consume(y),a=String.fromCharCode(y),v):n(y)}function v(y){if(y===null||y===47||y===62||ee(y)){const se=y===47,ge=a.toLowerCase();return!se&&!o&&Bn.includes(ge)?(i=1,r.interrupt?t(y):z(y)):wa.includes(a.toLowerCase())?(i=6,se?(e.consume(y),k):r.interrupt?t(y):z(y)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(y):o?E(y):T(y))}return y===45||ue(y)?(e.consume(y),a+=String.fromCharCode(y),v):n(y)}function k(y){return y===62?(e.consume(y),r.interrupt?t:z):n(y)}function E(y){return Y(y)?(e.consume(y),E):x(y)}function T(y){return y===47?(e.consume(y),x):y===58||y===95||fe(y)?(e.consume(y),M):Y(y)?(e.consume(y),T):x(y)}function M(y){return y===45||y===46||y===58||y===95||ue(y)?(e.consume(y),M):D(y)}function D(y){return y===61?(e.consume(y),w):Y(y)?(e.consume(y),D):T(y)}function w(y){return y===null||y===60||y===61||y===62||y===96?n(y):y===34||y===39?(e.consume(y),l=y,R):Y(y)?(e.consume(y),w):_(y)}function R(y){return y===l?(e.consume(y),l=null,F):y===null||B(y)?n(y):(e.consume(y),R)}function _(y){return y===null||y===34||y===39||y===47||y===60||y===61||y===62||y===96||ee(y)?D(y):(e.consume(y),_)}function F(y){return y===47||y===62||Y(y)?T(y):n(y)}function x(y){return y===62?(e.consume(y),C):n(y)}function C(y){return y===null||B(y)?z(y):Y(y)?(e.consume(y),C):n(y)}function z(y){return y===45&&i===2?(e.consume(y),H):y===60&&i===1?(e.consume(y),J):y===62&&i===4?(e.consume(y),le):y===63&&i===3?(e.consume(y),g):y===93&&i===5?(e.consume(y),re):B(y)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Ca,pe,j)(y)):y===null||B(y)?(e.exit("htmlFlowData"),j(y)):(e.consume(y),z)}function j(y){return e.check(Sa,N,pe)(y)}function N(y){return e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),L}function L(y){return y===null||B(y)?j(y):(e.enter("htmlFlowData"),z(y))}function H(y){return y===45?(e.consume(y),g):z(y)}function J(y){return y===47?(e.consume(y),a="",ne):z(y)}function ne(y){if(y===62){const se=a.toLowerCase();return Bn.includes(se)?(e.consume(y),le):z(y)}return fe(y)&&a.length<8?(e.consume(y),a+=String.fromCharCode(y),ne):z(y)}function re(y){return y===93?(e.consume(y),g):z(y)}function g(y){return y===62?(e.consume(y),le):y===45&&i===2?(e.consume(y),g):z(y)}function le(y){return y===null||B(y)?(e.exit("htmlFlowData"),pe(y)):(e.consume(y),le)}function pe(y){return e.exit("htmlFlow"),t(y)}}function Aa(e,t,n){const r=this;return i;function i(a){return B(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Ia(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(st,t,n)}}const Na={name:"htmlText",tokenize:Da};function Da(e,t,n){const r=this;let i,o,a;return s;function s(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),l}function l(g){return g===33?(e.consume(g),u):g===47?(e.consume(g),D):g===63?(e.consume(g),T):fe(g)?(e.consume(g),_):n(g)}function u(g){return g===45?(e.consume(g),h):g===91?(e.consume(g),o=0,m):fe(g)?(e.consume(g),E):n(g)}function h(g){return g===45?(e.consume(g),p):n(g)}function c(g){return g===null?n(g):g===45?(e.consume(g),f):B(g)?(a=c,J(g)):(e.consume(g),c)}function f(g){return g===45?(e.consume(g),p):c(g)}function p(g){return g===62?H(g):g===45?f(g):c(g)}function m(g){const le="CDATA[";return g===le.charCodeAt(o++)?(e.consume(g),o===le.length?b:m):n(g)}function b(g){return g===null?n(g):g===93?(e.consume(g),v):B(g)?(a=b,J(g)):(e.consume(g),b)}function v(g){return g===93?(e.consume(g),k):b(g)}function k(g){return g===62?H(g):g===93?(e.consume(g),k):b(g)}function E(g){return g===null||g===62?H(g):B(g)?(a=E,J(g)):(e.consume(g),E)}function T(g){return g===null?n(g):g===63?(e.consume(g),M):B(g)?(a=T,J(g)):(e.consume(g),T)}function M(g){return g===62?H(g):T(g)}function D(g){return fe(g)?(e.consume(g),w):n(g)}function w(g){return g===45||ue(g)?(e.consume(g),w):R(g)}function R(g){return B(g)?(a=R,J(g)):Y(g)?(e.consume(g),R):H(g)}function _(g){return g===45||ue(g)?(e.consume(g),_):g===47||g===62||ee(g)?F(g):n(g)}function F(g){return g===47?(e.consume(g),H):g===58||g===95||fe(g)?(e.consume(g),x):B(g)?(a=F,J(g)):Y(g)?(e.consume(g),F):H(g)}function x(g){return g===45||g===46||g===58||g===95||ue(g)?(e.consume(g),x):C(g)}function C(g){return g===61?(e.consume(g),z):B(g)?(a=C,J(g)):Y(g)?(e.consume(g),C):F(g)}function z(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),i=g,j):B(g)?(a=z,J(g)):Y(g)?(e.consume(g),z):(e.consume(g),N)}function j(g){return g===i?(e.consume(g),i=void 0,L):g===null?n(g):B(g)?(a=j,J(g)):(e.consume(g),j)}function N(g){return g===null||g===34||g===39||g===60||g===61||g===96?n(g):g===47||g===62||ee(g)?F(g):(e.consume(g),N)}function L(g){return g===47||g===62||ee(g)?F(g):n(g)}function H(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),t):n(g)}function J(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),ne}function ne(g){return Y(g)?Q(e,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):re(g)}function re(g){return e.enter("htmlTextData"),a(g)}}const cn={name:"labelEnd",resolveAll:za,resolveTo:Ma,tokenize:Ra},La={tokenize:Oa},Pa={tokenize:Fa},ja={tokenize:_a};function za(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&ke(e,0,e.length,n),e}function Ma(e,t){let n=e.length,r=0,i,o,a,s;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const l={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},h={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return s=[["enter",l,t],["enter",u,t]],s=be(s,e.slice(o+1,o+r+3)),s=be(s,[["enter",h,t]]),s=be(s,Ct(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),s=be(s,[["exit",h,t],e[a-2],e[a-1],["exit",u,t]]),s=be(s,e.slice(a+1)),s=be(s,[["exit",l,t]]),ke(e,o,e.length,s),e}function Ra(e,t,n){const r=this;let i=r.events.length,o,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return s;function s(f){return o?o._inactive?c(f):(a=r.parser.defined.includes(ve(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(La,h,a?h:c)(f):f===91?e.attempt(Pa,h,a?u:c)(f):a?h(f):c(f)}function u(f){return e.attempt(ja,h,c)(f)}function h(f){return t(f)}function c(f){return o._balanced=!0,n(f)}}function Oa(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return ee(c)?tt(e,o)(c):o(c)}function o(c){return c===41?h(c):Mr(e,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function a(c){return ee(c)?tt(e,l)(c):h(c)}function s(c){return n(c)}function l(c){return c===34||c===39||c===40?Or(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):h(c)}function u(c){return ee(c)?tt(e,h)(c):h(c)}function h(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function Fa(e,t,n){const r=this;return i;function i(s){return Rr.call(r,e,o,a,"reference","referenceMarker","referenceString")(s)}function o(s){return r.parser.defined.includes(ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function a(s){return n(s)}}function _a(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const Ba={name:"labelStartImage",resolveAll:cn.resolveAll,tokenize:Ha};function Ha(e,t,n){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),o}function o(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),a):n(s)}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Ua={name:"labelStartLink",resolveAll:cn.resolveAll,tokenize:qa};function qa(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Lt={name:"lineEnding",tokenize:Wa};function Wa(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Q(e,t,"linePrefix")}}const yt={name:"thematicBreak",tokenize:Va};function Va(e,t,n){let r=0,i;return o;function o(u){return e.enter("thematicBreak"),a(u)}function a(u){return i=u,s(u)}function s(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||B(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Y(u)?Q(e,s,"whitespace")(u):s(u))}}const de={continuation:{tokenize:Ja},exit:Xa,name:"list",tokenize:Za},Ga={partial:!0,tokenize:Ka},Ya={partial:!0,tokenize:Qa};function Za(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Zt(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(yt,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Zt(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(st,r.interrupt?n:h,e.attempt(Ga,f,c))}function h(p){return r.containerState.initialBlankLine=!0,o++,f(p)}function c(p){return Y(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Ja(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(st,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Q(e,t,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!Y(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ya,t,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,Q(e,e.attempt(de,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Qa(e,t,n){const r=this;return Q(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function Xa(e){e.exit(this.containerState.type)}function Ka(e,t,n){const r=this;return Q(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!Y(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Hn={name:"setextUnderline",resolveTo:$a,tokenize:es};function $a(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function es(e,t,n){const r=this;let i;return o;function o(u){let h=r.events.length,c;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){c=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),Y(u)?Q(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||B(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ts={tokenize:ns};function ns(e){const t=this,n=e.attempt(st,r,e.attempt(this.parser.constructs.flowInitial,i,Q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(sa,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const rs={resolveAll:_r()},is=Fr("string"),os=Fr("text");function Fr(e){return{resolveAll:_r(e==="text"?as:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,a,s);return a;function a(h){return u(h)?o(h):s(h)}function s(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),l}function l(h){return u(h)?(n.exit("data"),o(h)):(n.consume(h),l)}function u(h){if(h===null)return!0;const c=i[h];let f=-1;if(c)for(;++f<c.length;){const p=c[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function _r(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function as(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,a=-1,s=0,l;for(;o--;){const u=i[o];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)s++,a--;if(a)break;a=-1}else if(u===-2)l=!0,s++;else if(u!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const ss={42:de,43:de,45:de,48:de,49:de,50:de,51:de,52:de,53:de,54:de,55:de,56:de,57:de,62:Lr},ls={91:pa},us={[-2]:Dt,[-1]:Dt,32:Dt},cs={35:xa,42:yt,45:[Hn,yt],60:va,61:Hn,95:yt,96:_n,126:_n},hs={38:jr,92:Pr},ps={[-5]:Lt,[-4]:Lt,[-3]:Lt,33:Ba,38:jr,42:Jt,60:[Uo,Na],91:Ua,92:[ga,Pr],93:cn,95:Jt,96:ta},fs={null:[Jt,rs]},ds={null:[42,95]},ms={null:[]},gs=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ds,contentInitial:ls,disable:ms,document:ss,flow:cs,flowInitial:us,insideSpan:fs,string:hs,text:ps},Symbol.toStringTag,{value:"Module"}));function ys(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let a=[],s=[];const l={attempt:R(D),check:R(w),consume:E,enter:T,exit:M,interrupt:R(w,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:c};let h=t.tokenize.call(u,l);return t.resolveAll&&o.push(t),u;function c(C){return a=be(a,C),v(),a[a.length-1]!==null?[]:(_(t,0),u.events=Ct(o,u.events,u),u.events)}function f(C,z){return ks(p(C),z)}function p(C){return xs(a,C)}function m(){const{_bufferIndex:C,_index:z,line:j,column:N,offset:L}=r;return{_bufferIndex:C,_index:z,line:j,column:N,offset:L}}function b(C){i[C.line]=C.column,x()}function v(){let C;for(;r._index<a.length;){const z=a[r._index];if(typeof z=="string")for(C=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===C&&r._bufferIndex<z.length;)k(z.charCodeAt(r._bufferIndex));else k(z)}}function k(C){h=h(C)}function E(C){B(C)?(r.line++,r.column=1,r.offset+=C===-3?2:1,x()):C!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=C}function T(C,z){const j=z||{};return j.type=C,j.start=m(),u.events.push(["enter",j,u]),s.push(j),j}function M(C){const z=s.pop();return z.end=m(),u.events.push(["exit",z,u]),z}function D(C,z){_(C,z.from)}function w(C,z){z.restore()}function R(C,z){return j;function j(N,L,H){let J,ne,re,g;return Array.isArray(N)?pe(N):"tokenize"in N?pe([N]):le(N);function le(O){return U;function U(W){const G=W!==null&&O[W],K=W!==null&&O.null,X=[...Array.isArray(G)?G:G?[G]:[],...Array.isArray(K)?K:K?[K]:[]];return pe(X)(W)}}function pe(O){return J=O,ne=0,O.length===0?H:y(O[ne])}function y(O){return U;function U(W){return g=F(),re=O,O.partial||(u.currentConstruct=O),O.name&&u.parser.constructs.disable.null.includes(O.name)?ge():O.tokenize.call(z?Object.assign(Object.create(u),z):u,l,se,ge)(W)}}function se(O){return C(re,g),L}function ge(O){return g.restore(),++ne<J.length?y(J[ne]):H}}}function _(C,z){C.resolveAll&&!o.includes(C)&&o.push(C),C.resolve&&ke(u.events,z,u.events.length-z,C.resolve(u.events.slice(z),u)),C.resolveTo&&(u.events=C.resolveTo(u.events,u))}function F(){const C=m(),z=u.previous,j=u.currentConstruct,N=u.events.length,L=Array.from(s);return{from:N,restore:H};function H(){r=C,u.previous=z,u.currentConstruct=j,u.events.length=N,s=L,x()}}function x(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function xs(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,o)];else{if(a=e.slice(n,i),r>-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function ks(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
3
3
  `;break}case-3:{a=`\r
4
- `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}function ws(e){const r={constructs:Dr([ys,...(e||{}).extensions||[]]),content:i(Ro),defined:[],document:i(Fo),flow:i(ns),lazy:{},string:i(os),text:i(as)};return r;function i(o){return a;function a(s){return xs(r,o,s)}}}function vs(e){for(;!Mr(e););return e}const qn=/[\0\t\n\r]/g;function Cs(){let e=1,t="",n=!0,r;return i;function i(o,a,s){const l=[];let u,h,c,f,p;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),c=0,t="",n&&(o.charCodeAt(0)===65279&&c++,n=void 0);c<o.length;){if(qn.lastIndex=c,u=qn.exec(o),f=u&&u.index!==void 0?u.index:o.length,p=o.charCodeAt(f),!u){t=o.slice(c);break}if(p===10&&c===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),c<f&&(l.push(o.slice(c,f)),e+=f-c),p){case 0:{l.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,l.push(-2);e++<h;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}c=f+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Ss=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Es(e){return e.replace(Ss,Ts)}function Ts(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return Lr(n.slice(o?2:1),o?16:10)}return cn(n)||e}const Hr={}.hasOwnProperty;function As(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Is(n)(vs(ws(n).document().write(Cs()(e,t,!0))))}function Is(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(vn),autolinkProtocol:F,autolinkEmail:F,atxHeading:o(ut),blockQuote:o(K),characterEscape:F,characterReference:F,codeFenced:o(X),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(X,a),codeText:o(re,a),codeTextData:F,data:F,codeFlowValue:F,definition:o(Ee),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(ze),hardBreakEscape:o(_e),hardBreakTrailing:o(_e),htmlFlow:o(ct,a),htmlFlowData:F,htmlText:o(ct,a),htmlTextData:F,image:o(Ei),label:a,link:o(vn),listItem:o(Ti),listItemValue:f,listOrdered:o(Cn,c),listUnordered:o(Cn),paragraph:o(Ai),reference:y,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(ut),strong:o(Ii),thematicBreak:o(Di)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:J,autolinkProtocol:V,blockQuote:l(),characterEscapeValue:x,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:O,characterReference:H,codeFenced:l(v),codeFencedFence:k,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:x,codeIndented:l(b),codeText:l(L),codeTextData:x,data:x,definition:l(),definitionDestinationString:M,definitionLabelString:E,definitionTitleString:T,emphasis:l(),hardBreakEscape:l(z),hardBreakTrailing:l(z),htmlFlow:l(j),htmlFlowData:x,htmlText:l(N),htmlTextData:x,image:l(Q),label:ne,labelText:oe,lineEnding:C,link:l(W),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:g,resourceTitleString:le,resource:pe,setextHeading:l(_),setextHeadingLineSequence:R,setextHeadingText:w,strong:l(),thematicBreak:l()}};Ur(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(S){let P={type:"root",children:[]};const U={stack:[P],tokenStack:[],config:t,enter:s,exit:u,buffer:a,resume:h,data:n},Y=[];let $=-1;for(;++$<S.length;)if(S[$][1].type==="listOrdered"||S[$][1].type==="listUnordered")if(S[$][0]==="enter")Y.push($);else{const we=Y.pop();$=i(S,we,$)}for($=-1;++$<S.length;){const we=t[S[$][0]];Hr.call(we,S[$][1].type)&&we[S[$][1].type].call(Object.assign({sliceSerialize:S[$][2].sliceSerialize},U),S[$][1])}if(U.tokenStack.length>0){const we=U.tokenStack[U.tokenStack.length-1];(we[1]||Wn).call(U,void 0,we[0])}for(P.position={start:De(S.length>0?S[0][1].start:{line:1,column:1,offset:0}),end:De(S.length>0?S[S.length-2][1].end:{line:1,column:1,offset:0})},$=-1;++$<t.transforms.length;)P=t.transforms[$](P)||P;return P}function i(S,P,U){let Y=P-1,$=-1,we=!1,Me,Te,Ze,Je;for(;++Y<=U;){const ye=S[Y];switch(ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ye[0]==="enter"?$++:$--,Je=void 0;break}case"lineEndingBlank":{ye[0]==="enter"&&(Me&&!Je&&!$&&!Ze&&(Ze=Y),Je=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Je=void 0}if(!$&&ye[0]==="enter"&&ye[1].type==="listItemPrefix"||$===-1&&ye[0]==="exit"&&(ye[1].type==="listUnordered"||ye[1].type==="listOrdered")){if(Me){let Be=Y;for(Te=void 0;Be--;){const Ae=S[Be];if(Ae[1].type==="lineEnding"||Ae[1].type==="lineEndingBlank"){if(Ae[0]==="exit")continue;Te&&(S[Te][1].type="lineEndingBlank",we=!0),Ae[1].type="lineEnding",Te=Be}else if(!(Ae[1].type==="linePrefix"||Ae[1].type==="blockQuotePrefix"||Ae[1].type==="blockQuotePrefixWhitespace"||Ae[1].type==="blockQuoteMarker"||Ae[1].type==="listItemIndent"))break}Ze&&(!Te||Ze<Te)&&(Me._spread=!0),Me.end=Object.assign({},Te?S[Te][1].start:ye[1].end),S.splice(Te||Y,0,["exit",Me,ye[2]]),Y++,U++}if(ye[1].type==="listItemPrefix"){const Be={type:"listItem",_spread:!1,start:Object.assign({},ye[1].start),end:void 0};Me=Be,S.splice(Y,0,["enter",Be,ye[2]]),Y++,U++,Ze=void 0,Je=!0}}}return S[P][1]._spread=we,U}function o(S,P){return U;function U(Y){s.call(this,S(Y),Y),P&&P.call(this,Y)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(S,P,U){this.stack[this.stack.length-1].children.push(S),this.stack.push(S),this.tokenStack.push([P,U||void 0]),S.position={start:De(P.start),end:void 0}}function l(S){return P;function P(U){S&&S.call(this,U),u.call(this,U)}}function u(S,P){const U=this.stack.pop(),Y=this.tokenStack.pop();if(Y)Y[0].type!==S.type&&(P?P.call(this,S,Y[0]):(Y[1]||Wn).call(this,S,Y[0]));else throw new Error("Cannot close `"+S.type+"` ("+et({start:S.start,end:S.end})+"): it’s not open");U.position.end=De(S.end)}function h(){return un(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function f(S){if(this.data.expectingFirstListItemValue){const P=this.stack[this.stack.length-2];P.start=Number.parseInt(this.sliceSerialize(S),10),this.data.expectingFirstListItemValue=void 0}}function p(){const S=this.resume(),P=this.stack[this.stack.length-1];P.lang=S}function m(){const S=this.resume(),P=this.stack[this.stack.length-1];P.meta=S}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const S=this.resume(),P=this.stack[this.stack.length-1];P.value=S.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const S=this.resume(),P=this.stack[this.stack.length-1];P.value=S.replace(/(\r?\n|\r)$/g,"")}function E(S){const P=this.resume(),U=this.stack[this.stack.length-1];U.label=P,U.identifier=ve(this.sliceSerialize(S)).toLowerCase()}function T(){const S=this.resume(),P=this.stack[this.stack.length-1];P.title=S}function M(){const S=this.resume(),P=this.stack[this.stack.length-1];P.url=S}function D(S){const P=this.stack[this.stack.length-1];if(!P.depth){const U=this.sliceSerialize(S).length;P.depth=U}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function R(S){const P=this.stack[this.stack.length-1];P.depth=this.sliceSerialize(S).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function F(S){const U=this.stack[this.stack.length-1].children;let Y=U[U.length-1];(!Y||Y.type!=="text")&&(Y=Ni(),Y.position={start:De(S.start),end:void 0},U.push(Y)),this.stack.push(Y)}function x(S){const P=this.stack.pop();P.value+=this.sliceSerialize(S),P.position.end=De(S.end)}function C(S){const P=this.stack[this.stack.length-1];if(this.data.atHardBreak){const U=P.children[P.children.length-1];U.position.end=De(S.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(P.type)&&(F.call(this,S),x.call(this,S))}function z(){this.data.atHardBreak=!0}function j(){const S=this.resume(),P=this.stack[this.stack.length-1];P.value=S}function N(){const S=this.resume(),P=this.stack[this.stack.length-1];P.value=S}function L(){const S=this.resume(),P=this.stack[this.stack.length-1];P.value=S}function W(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=P,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function Q(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=P,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function oe(S){const P=this.sliceSerialize(S),U=this.stack[this.stack.length-2];U.label=Es(P),U.identifier=ve(P).toLowerCase()}function ne(){const S=this.stack[this.stack.length-1],P=this.resume(),U=this.stack[this.stack.length-1];if(this.data.inReference=!0,U.type==="link"){const Y=S.children;U.children=Y}else U.alt=P}function g(){const S=this.resume(),P=this.stack[this.stack.length-1];P.url=S}function le(){const S=this.resume(),P=this.stack[this.stack.length-1];P.title=S}function pe(){this.data.inReference=void 0}function y(){this.data.referenceType="collapsed"}function se(S){const P=this.resume(),U=this.stack[this.stack.length-1];U.label=P,U.identifier=ve(this.sliceSerialize(S)).toLowerCase(),this.data.referenceType="full"}function ge(S){this.data.characterReferenceType=S.type}function O(S){const P=this.sliceSerialize(S),U=this.data.characterReferenceType;let Y;U?(Y=Lr(P,U==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Y=cn(P);const $=this.stack[this.stack.length-1];$.value+=Y}function H(S){const P=this.stack.pop();P.position.end=De(S.end)}function V(S){x.call(this,S);const P=this.stack[this.stack.length-1];P.url=this.sliceSerialize(S)}function J(S){x.call(this,S);const P=this.stack[this.stack.length-1];P.url="mailto:"+this.sliceSerialize(S)}function K(){return{type:"blockquote",children:[]}}function X(){return{type:"code",lang:null,meta:null,value:""}}function re(){return{type:"inlineCode",value:""}}function Ee(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ze(){return{type:"emphasis",children:[]}}function ut(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function ct(){return{type:"html",value:""}}function Ei(){return{type:"image",title:null,url:"",alt:null}}function vn(){return{type:"link",title:null,url:"",children:[]}}function Cn(S){return{type:"list",ordered:S.type==="listOrdered",start:null,spread:S._spread,children:[]}}function Ti(S){return{type:"listItem",spread:S._spread,checked:null,children:[]}}function Ai(){return{type:"paragraph",children:[]}}function Ii(){return{type:"strong",children:[]}}function Ni(){return{type:"text",value:""}}function Di(){return{type:"thematicBreak"}}}function De(e){return{line:e.line,column:e.column,offset:e.offset}}function Ur(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Ur(e,r):Ns(e,r)}}function Ns(e,t){let n;for(n in t)if(Hr.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Wn(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+et({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+et({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+et({start:t.start,end:t.end})+") is still open")}function Ds(e){const t=this;t.parser=n;function n(r){return As(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Ls(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Ps(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
5
- `}]}function js(e,t){const n=t.value?t.value+`
6
- `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function zs(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ms(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Rs(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Ye(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let a,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=o+1,s+=1,e.footnoteCounts.set(r,s);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function Os(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fs(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function qr(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function _s(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return qr(e,t);const i={src:Ye(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function Bs(e,t){const n={src:Ye(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Hs(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Us(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return qr(e,t);const i={href:Ye(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function qs(e,t){const n={href:Ye(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Ws(e,t,n){const r=e.all(t),i=n?Vs(n):Wr(t),o={},a=[];if(typeof t.checked=="boolean"){const h=r[0];let c;h&&h.type==="element"&&h.tagName==="p"?c=h:(c={type:"element",tagName:"p",properties:{},children:[]},r.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let s=-1;for(;++s<r.length;){const h=r[s];(i||s!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
4
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}function bs(e){const r={constructs:Nr([gs,...(e||{}).extensions||[]]),content:i(Mo),defined:[],document:i(Oo),flow:i(ts),lazy:{},string:i(is),text:i(os)};return r;function i(o){return a;function a(s){return ys(r,o,s)}}}function ws(e){for(;!zr(e););return e}const Un=/[\0\t\n\r]/g;function vs(){let e=1,t="",n=!0,r;return i;function i(o,a,s){const l=[];let u,h,c,f,p;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),c=0,t="",n&&(o.charCodeAt(0)===65279&&c++,n=void 0);c<o.length;){if(Un.lastIndex=c,u=Un.exec(o),f=u&&u.index!==void 0?u.index:o.length,p=o.charCodeAt(f),!u){t=o.slice(c);break}if(p===10&&c===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),c<f&&(l.push(o.slice(c,f)),e+=f-c),p){case 0:{l.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,l.push(-2);e++<h;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}c=f+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Cs=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ss(e){return e.replace(Cs,Es)}function Es(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return Dr(n.slice(o?2:1),o?16:10)}return un(n)||e}const Br={}.hasOwnProperty;function Ts(e,t,n){return typeof t!="string"&&(n=t,t=void 0),As(n)(ws(bs(n).document().write(vs()(e,t,!0))))}function As(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(wn),autolinkProtocol:F,autolinkEmail:F,atxHeading:o(ut),blockQuote:o(K),characterEscape:F,characterReference:F,codeFenced:o(X),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(X,a),codeText:o(oe,a),codeTextData:F,data:F,codeFlowValue:F,definition:o(Ee),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(Oe),hardBreakEscape:o(Fe),hardBreakTrailing:o(Fe),htmlFlow:o(ct,a),htmlFlowData:F,htmlText:o(ct,a),htmlTextData:F,image:o(Si),label:a,link:o(wn),listItem:o(Ei),listItemValue:f,listOrdered:o(vn,c),listUnordered:o(vn),paragraph:o(Ti),reference:y,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(ut),strong:o(Ai),thematicBreak:o(Ni)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:G,autolinkProtocol:W,blockQuote:l(),characterEscapeValue:x,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:O,characterReference:U,codeFenced:l(v),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:x,codeIndented:l(k),codeText:l(L),codeTextData:x,data:x,definition:l(),definitionDestinationString:M,definitionLabelString:E,definitionTitleString:T,emphasis:l(),hardBreakEscape:l(z),hardBreakTrailing:l(z),htmlFlow:l(j),htmlFlowData:x,htmlText:l(N),htmlTextData:x,image:l(J),label:re,labelText:ne,lineEnding:C,link:l(H),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:g,resourceTitleString:le,resource:pe,setextHeading:l(_),setextHeadingLineSequence:R,setextHeadingText:w,strong:l(),thematicBreak:l()}};Hr(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(S){let P={type:"root",children:[]};const q={stack:[P],tokenStack:[],config:t,enter:s,exit:u,buffer:a,resume:h,data:n},Z=[];let $=-1;for(;++$<S.length;)if(S[$][1].type==="listOrdered"||S[$][1].type==="listUnordered")if(S[$][0]==="enter")Z.push($);else{const we=Z.pop();$=i(S,we,$)}for($=-1;++$<S.length;){const we=t[S[$][0]];Br.call(we,S[$][1].type)&&we[S[$][1].type].call(Object.assign({sliceSerialize:S[$][2].sliceSerialize},q),S[$][1])}if(q.tokenStack.length>0){const we=q.tokenStack[q.tokenStack.length-1];(we[1]||qn).call(q,void 0,we[0])}for(P.position={start:Ne(S.length>0?S[0][1].start:{line:1,column:1,offset:0}),end:Ne(S.length>0?S[S.length-2][1].end:{line:1,column:1,offset:0})},$=-1;++$<t.transforms.length;)P=t.transforms[$](P)||P;return P}function i(S,P,q){let Z=P-1,$=-1,we=!1,je,Te,Ze,Je;for(;++Z<=q;){const ye=S[Z];switch(ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ye[0]==="enter"?$++:$--,Je=void 0;break}case"lineEndingBlank":{ye[0]==="enter"&&(je&&!Je&&!$&&!Ze&&(Ze=Z),Je=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Je=void 0}if(!$&&ye[0]==="enter"&&ye[1].type==="listItemPrefix"||$===-1&&ye[0]==="exit"&&(ye[1].type==="listUnordered"||ye[1].type==="listOrdered")){if(je){let _e=Z;for(Te=void 0;_e--;){const Ae=S[_e];if(Ae[1].type==="lineEnding"||Ae[1].type==="lineEndingBlank"){if(Ae[0]==="exit")continue;Te&&(S[Te][1].type="lineEndingBlank",we=!0),Ae[1].type="lineEnding",Te=_e}else if(!(Ae[1].type==="linePrefix"||Ae[1].type==="blockQuotePrefix"||Ae[1].type==="blockQuotePrefixWhitespace"||Ae[1].type==="blockQuoteMarker"||Ae[1].type==="listItemIndent"))break}Ze&&(!Te||Ze<Te)&&(je._spread=!0),je.end=Object.assign({},Te?S[Te][1].start:ye[1].end),S.splice(Te||Z,0,["exit",je,ye[2]]),Z++,q++}if(ye[1].type==="listItemPrefix"){const _e={type:"listItem",_spread:!1,start:Object.assign({},ye[1].start),end:void 0};je=_e,S.splice(Z,0,["enter",_e,ye[2]]),Z++,q++,Ze=void 0,Je=!0}}}return S[P][1]._spread=we,q}function o(S,P){return q;function q(Z){s.call(this,S(Z),Z),P&&P.call(this,Z)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(S,P,q){this.stack[this.stack.length-1].children.push(S),this.stack.push(S),this.tokenStack.push([P,q||void 0]),S.position={start:Ne(P.start),end:void 0}}function l(S){return P;function P(q){S&&S.call(this,q),u.call(this,q)}}function u(S,P){const q=this.stack.pop(),Z=this.tokenStack.pop();if(Z)Z[0].type!==S.type&&(P?P.call(this,S,Z[0]):(Z[1]||qn).call(this,S,Z[0]));else throw new Error("Cannot close `"+S.type+"` ("+et({start:S.start,end:S.end})+"): it’s not open");q.position.end=Ne(S.end)}function h(){return ln(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function f(S){if(this.data.expectingFirstListItemValue){const P=this.stack[this.stack.length-2];P.start=Number.parseInt(this.sliceSerialize(S),10),this.data.expectingFirstListItemValue=void 0}}function p(){const S=this.resume(),P=this.stack[this.stack.length-1];P.lang=S}function m(){const S=this.resume(),P=this.stack[this.stack.length-1];P.meta=S}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const S=this.resume(),P=this.stack[this.stack.length-1];P.value=S.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const S=this.resume(),P=this.stack[this.stack.length-1];P.value=S.replace(/(\r?\n|\r)$/g,"")}function E(S){const P=this.resume(),q=this.stack[this.stack.length-1];q.label=P,q.identifier=ve(this.sliceSerialize(S)).toLowerCase()}function T(){const S=this.resume(),P=this.stack[this.stack.length-1];P.title=S}function M(){const S=this.resume(),P=this.stack[this.stack.length-1];P.url=S}function D(S){const P=this.stack[this.stack.length-1];if(!P.depth){const q=this.sliceSerialize(S).length;P.depth=q}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function R(S){const P=this.stack[this.stack.length-1];P.depth=this.sliceSerialize(S).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function F(S){const q=this.stack[this.stack.length-1].children;let Z=q[q.length-1];(!Z||Z.type!=="text")&&(Z=Ii(),Z.position={start:Ne(S.start),end:void 0},q.push(Z)),this.stack.push(Z)}function x(S){const P=this.stack.pop();P.value+=this.sliceSerialize(S),P.position.end=Ne(S.end)}function C(S){const P=this.stack[this.stack.length-1];if(this.data.atHardBreak){const q=P.children[P.children.length-1];q.position.end=Ne(S.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(P.type)&&(F.call(this,S),x.call(this,S))}function z(){this.data.atHardBreak=!0}function j(){const S=this.resume(),P=this.stack[this.stack.length-1];P.value=S}function N(){const S=this.resume(),P=this.stack[this.stack.length-1];P.value=S}function L(){const S=this.resume(),P=this.stack[this.stack.length-1];P.value=S}function H(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=P,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function J(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=P,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function ne(S){const P=this.sliceSerialize(S),q=this.stack[this.stack.length-2];q.label=Ss(P),q.identifier=ve(P).toLowerCase()}function re(){const S=this.stack[this.stack.length-1],P=this.resume(),q=this.stack[this.stack.length-1];if(this.data.inReference=!0,q.type==="link"){const Z=S.children;q.children=Z}else q.alt=P}function g(){const S=this.resume(),P=this.stack[this.stack.length-1];P.url=S}function le(){const S=this.resume(),P=this.stack[this.stack.length-1];P.title=S}function pe(){this.data.inReference=void 0}function y(){this.data.referenceType="collapsed"}function se(S){const P=this.resume(),q=this.stack[this.stack.length-1];q.label=P,q.identifier=ve(this.sliceSerialize(S)).toLowerCase(),this.data.referenceType="full"}function ge(S){this.data.characterReferenceType=S.type}function O(S){const P=this.sliceSerialize(S),q=this.data.characterReferenceType;let Z;q?(Z=Dr(P,q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Z=un(P);const $=this.stack[this.stack.length-1];$.value+=Z}function U(S){const P=this.stack.pop();P.position.end=Ne(S.end)}function W(S){x.call(this,S);const P=this.stack[this.stack.length-1];P.url=this.sliceSerialize(S)}function G(S){x.call(this,S);const P=this.stack[this.stack.length-1];P.url="mailto:"+this.sliceSerialize(S)}function K(){return{type:"blockquote",children:[]}}function X(){return{type:"code",lang:null,meta:null,value:""}}function oe(){return{type:"inlineCode",value:""}}function Ee(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Oe(){return{type:"emphasis",children:[]}}function ut(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function ct(){return{type:"html",value:""}}function Si(){return{type:"image",title:null,url:"",alt:null}}function wn(){return{type:"link",title:null,url:"",children:[]}}function vn(S){return{type:"list",ordered:S.type==="listOrdered",start:null,spread:S._spread,children:[]}}function Ei(S){return{type:"listItem",spread:S._spread,checked:null,children:[]}}function Ti(){return{type:"paragraph",children:[]}}function Ai(){return{type:"strong",children:[]}}function Ii(){return{type:"text",value:""}}function Ni(){return{type:"thematicBreak"}}}function Ne(e){return{line:e.line,column:e.column,offset:e.offset}}function Hr(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Hr(e,r):Is(e,r)}}function Is(e,t){let n;for(n in t)if(Br.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function qn(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+et({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+et({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+et({start:t.start,end:t.end})+") is still open")}function Ns(e){const t=this;t.parser=n;function n(r){return Ts(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Ds(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Ls(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
5
+ `}]}function Ps(e,t){const n=t.value?t.value+`
6
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function js(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zs(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ms(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Ye(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let a,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=o+1,s+=1,e.footnoteCounts.set(r,s);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function Rs(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Os(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ur(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function Fs(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ur(e,t);const i={src:Ye(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function _s(e,t){const n={src:Ye(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Bs(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Hs(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ur(e,t);const i={href:Ye(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function Us(e,t){const n={href:Ye(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function qs(e,t,n){const r=e.all(t),i=n?Ws(n):qr(t),o={},a=[];if(typeof t.checked=="boolean"){const h=r[0];let c;h&&h.type==="element"&&h.tagName==="p"?c=h:(c={type:"element",tagName:"p",properties:{},children:[]},r.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let s=-1;for(;++s<r.length;){const h=r[s];(i||s!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
7
7
  `}),h.type==="element"&&h.tagName==="p"&&!i?a.push(...h.children):a.push(h)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
8
- `});const u={type:"element",tagName:"li",properties:o,children:a};return e.patch(t,u),e.applyData(t,u)}function Vs(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Wr(n[r])}return t}function Wr(e){const t=e.spread;return t??e.children.length>1}function Gs(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function Ys(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Zs(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Js(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Qs(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=on(t.children[1]),l=Cr(t.children[t.children.length-1]);s&&l&&(a.position={start:s,end:l}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function Xs(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,s=a?a.length:t.children.length;let l=-1;const u=[];for(;++l<s;){const c=t.children[l],f={},p=a?a[l]:void 0;p&&(f.align=p);let m={type:"element",tagName:o,properties:f,children:[]};c&&(m.children=e.all(c),e.patch(c,m),m=e.applyData(c,m)),u.push(m)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,h),e.applyData(t,h)}function Ks(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Vn=9,Gn=32;function $s(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(Yn(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(Yn(t.slice(i),i>0,!1)),o.join("")}function Yn(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===Vn||o===Gn;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===Vn||o===Gn;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function el(e,t){const n={type:"text",value:$s(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function tl(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const nl={blockquote:Ls,break:Ps,code:js,delete:zs,emphasis:Ms,footnoteReference:Rs,heading:Os,html:Fs,imageReference:_s,image:Bs,inlineCode:Hs,linkReference:Us,link:qs,listItem:Ws,list:Gs,paragraph:Ys,root:Zs,strong:Js,table:Qs,tableCell:Ks,tableRow:Xs,text:el,thematicBreak:tl,toml:ht,yaml:ht,definition:ht,footnoteDefinition:ht};function ht(){}const Vr=-1,St=0,nt=1,bt=2,pn=3,fn=4,dn=5,mn=6,Gr=7,Yr=8,Zn=typeof self=="object"?self:globalThis,rl=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,a]=t[i];switch(o){case St:case Vr:return n(a,i);case nt:{const s=n([],i);for(const l of a)s.push(r(l));return s}case bt:{const s=n({},i);for(const[l,u]of a)s[r(l)]=r(u);return s}case pn:return n(new Date(a),i);case fn:{const{source:s,flags:l}=a;return n(new RegExp(s,l),i)}case dn:{const s=n(new Map,i);for(const[l,u]of a)s.set(r(l),r(u));return s}case mn:{const s=n(new Set,i);for(const l of a)s.add(r(l));return s}case Gr:{const{name:s,message:l}=a;return n(new Zn[s](l),i)}case Yr:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:s}=new Uint8Array(a);return n(new DataView(s),a)}}return n(new Zn[o](a),i)};return r},Jn=e=>rl(new Map,e)(0),Ue="",{toString:il}={},{keys:ol}=Object,$e=e=>{const t=typeof e;if(t!=="object"||!e)return[St,t];const n=il.call(e).slice(8,-1);switch(n){case"Array":return[nt,Ue];case"Object":return[bt,Ue];case"Date":return[pn,Ue];case"RegExp":return[fn,Ue];case"Map":return[dn,Ue];case"Set":return[mn,Ue];case"DataView":return[nt,n]}return n.includes("Array")?[nt,n]:n.includes("Error")?[Gr,n]:[bt,n]},pt=([e,t])=>e===St&&(t==="function"||t==="symbol"),al=(e,t,n,r)=>{const i=(a,s)=>{const l=r.push(a)-1;return n.set(s,l),l},o=a=>{if(n.has(a))return n.get(a);let[s,l]=$e(a);switch(s){case St:{let h=a;switch(l){case"bigint":s=Yr,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);h=null;break;case"undefined":return i([Vr],a)}return i([s,h],a)}case nt:{if(l){let f=a;return l==="DataView"?f=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(a)),i([l,[...f]],a)}const h=[],c=i([s,h],a);for(const f of a)h.push(o(f));return c}case bt:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(t&&"toJSON"in a)return o(a.toJSON());const h=[],c=i([s,h],a);for(const f of ol(a))(e||!pt($e(a[f])))&&h.push([o(f),o(a[f])]);return c}case pn:return i([s,a.toISOString()],a);case fn:{const{source:h,flags:c}=a;return i([s,{source:h,flags:c}],a)}case dn:{const h=[],c=i([s,h],a);for(const[f,p]of a)(e||!(pt($e(f))||pt($e(p))))&&h.push([o(f),o(p)]);return c}case mn:{const h=[],c=i([s,h],a);for(const f of a)(e||!pt($e(f)))&&h.push(o(f));return c}}const{message:u}=a;return i([s,{name:l,message:u}],a)};return o},Qn=(e,{json:t,lossy:n}={})=>{const r=[];return al(!(t||n),!!t,new Map,r)(e),r},kt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Jn(Qn(e,t)):structuredClone(e):(e,t)=>Jn(Qn(e,t));function sl(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function ll(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function ul(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||sl,r=e.options.footnoteBackLabel||ll,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const h=e.all(u),c=String(u.identifier).toUpperCase(),f=Ye(c.toLowerCase());let p=0;const m=[],k=e.footnoteCounts.get(c);for(;k!==void 0&&++p<=k;){m.length>0&&m.push({type:"text",value:" "});let E=typeof n=="string"?n:n(l,p);typeof E=="string"&&(E={type:"text",value:E}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const v=h[h.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const E=v.children[v.children.length-1];E&&E.type==="text"?E.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...m)}else h.push(...m);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(h,!0)};e.patch(u,b),s.push(b)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...kt(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
8
+ `});const u={type:"element",tagName:"li",properties:o,children:a};return e.patch(t,u),e.applyData(t,u)}function Ws(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=qr(n[r])}return t}function qr(e){const t=e.spread;return t??e.children.length>1}function Vs(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function Gs(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ys(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Zs(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Js(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=rn(t.children[1]),l=vr(t.children[t.children.length-1]);s&&l&&(a.position={start:s,end:l}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function Qs(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,s=a?a.length:t.children.length;let l=-1;const u=[];for(;++l<s;){const c=t.children[l],f={},p=a?a[l]:void 0;p&&(f.align=p);let m={type:"element",tagName:o,properties:f,children:[]};c&&(m.children=e.all(c),e.patch(c,m),m=e.applyData(c,m)),u.push(m)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,h),e.applyData(t,h)}function Xs(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Wn=9,Vn=32;function Ks(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(Gn(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(Gn(t.slice(i),i>0,!1)),o.join("")}function Gn(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===Wn||o===Vn;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===Wn||o===Vn;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function $s(e,t){const n={type:"text",value:Ks(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function el(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const tl={blockquote:Ds,break:Ls,code:Ps,delete:js,emphasis:zs,footnoteReference:Ms,heading:Rs,html:Os,imageReference:Fs,image:_s,inlineCode:Bs,linkReference:Hs,link:Us,listItem:qs,list:Vs,paragraph:Gs,root:Ys,strong:Zs,table:Js,tableCell:Xs,tableRow:Qs,text:$s,thematicBreak:el,toml:ht,yaml:ht,definition:ht,footnoteDefinition:ht};function ht(){}const Wr=-1,St=0,nt=1,kt=2,hn=3,pn=4,fn=5,dn=6,Vr=7,Gr=8,Yn=typeof self=="object"?self:globalThis,nl=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,a]=t[i];switch(o){case St:case Wr:return n(a,i);case nt:{const s=n([],i);for(const l of a)s.push(r(l));return s}case kt:{const s=n({},i);for(const[l,u]of a)s[r(l)]=r(u);return s}case hn:return n(new Date(a),i);case pn:{const{source:s,flags:l}=a;return n(new RegExp(s,l),i)}case fn:{const s=n(new Map,i);for(const[l,u]of a)s.set(r(l),r(u));return s}case dn:{const s=n(new Set,i);for(const l of a)s.add(r(l));return s}case Vr:{const{name:s,message:l}=a;return n(new Yn[s](l),i)}case Gr:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:s}=new Uint8Array(a);return n(new DataView(s),a)}}return n(new Yn[o](a),i)};return r},Zn=e=>nl(new Map,e)(0),He="",{toString:rl}={},{keys:il}=Object,$e=e=>{const t=typeof e;if(t!=="object"||!e)return[St,t];const n=rl.call(e).slice(8,-1);switch(n){case"Array":return[nt,He];case"Object":return[kt,He];case"Date":return[hn,He];case"RegExp":return[pn,He];case"Map":return[fn,He];case"Set":return[dn,He];case"DataView":return[nt,n]}return n.includes("Array")?[nt,n]:n.includes("Error")?[Vr,n]:[kt,n]},pt=([e,t])=>e===St&&(t==="function"||t==="symbol"),ol=(e,t,n,r)=>{const i=(a,s)=>{const l=r.push(a)-1;return n.set(s,l),l},o=a=>{if(n.has(a))return n.get(a);let[s,l]=$e(a);switch(s){case St:{let h=a;switch(l){case"bigint":s=Gr,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);h=null;break;case"undefined":return i([Wr],a)}return i([s,h],a)}case nt:{if(l){let f=a;return l==="DataView"?f=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(a)),i([l,[...f]],a)}const h=[],c=i([s,h],a);for(const f of a)h.push(o(f));return c}case kt:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(t&&"toJSON"in a)return o(a.toJSON());const h=[],c=i([s,h],a);for(const f of il(a))(e||!pt($e(a[f])))&&h.push([o(f),o(a[f])]);return c}case hn:return i([s,a.toISOString()],a);case pn:{const{source:h,flags:c}=a;return i([s,{source:h,flags:c}],a)}case fn:{const h=[],c=i([s,h],a);for(const[f,p]of a)(e||!(pt($e(f))||pt($e(p))))&&h.push([o(f),o(p)]);return c}case dn:{const h=[],c=i([s,h],a);for(const f of a)(e||!pt($e(f)))&&h.push(o(f));return c}}const{message:u}=a;return i([s,{name:l,message:u}],a)};return o},Jn=(e,{json:t,lossy:n}={})=>{const r=[];return ol(!(t||n),!!t,new Map,r)(e),r},bt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Zn(Jn(e,t)):structuredClone(e):(e,t)=>Zn(Jn(e,t));function al(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function sl(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function ll(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||al,r=e.options.footnoteBackLabel||sl,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const h=e.all(u),c=String(u.identifier).toUpperCase(),f=Ye(c.toLowerCase());let p=0;const m=[],b=e.footnoteCounts.get(c);for(;b!==void 0&&++p<=b;){m.length>0&&m.push({type:"text",value:" "});let E=typeof n=="string"?n:n(l,p);typeof E=="string"&&(E={type:"text",value:E}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const v=h[h.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const E=v.children[v.children.length-1];E&&E.type==="text"?E.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...m)}else h.push(...m);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(h,!0)};e.patch(u,k),s.push(k)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...bt(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
9
9
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:`
10
- `}]}}const Et=(function(e){if(e==null)return fl;if(typeof e=="function")return Tt(e);if(typeof e=="object")return Array.isArray(e)?cl(e):hl(e);if(typeof e=="string")return pl(e);throw new Error("Expected function, string, or object as test")});function cl(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Et(e[n]);return Tt(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function hl(e){const t=e;return Tt(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function pl(e){return Tt(t);function t(n){return n&&n.type===e}}function Tt(e){return t;function t(n,r,i){return!!(dl(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function fl(){return!0}function dl(e){return e!==null&&typeof e=="object"&&"type"in e}const Zr=[],ml=!0,Xt=!1,gl="skip";function Jr(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Et(i),a=r?-1:1;s(e,void 0,[])();function s(l,u,h){const c=l&&typeof l=="object"?l:{};if(typeof c.type=="string"){const p=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=Zr,m,k,v;if((!t||o(l,u,h[h.length-1]||void 0))&&(p=yl(n(l,h)),p[0]===Xt))return p;if("children"in l&&l.children){const b=l;if(b.children&&p[0]!==gl)for(k=(r?b.children.length:-1)+a,v=h.concat(b);k>-1&&k<b.children.length;){const E=b.children[k];if(m=s(E,k,v)(),m[0]===Xt)return m;k=typeof m[1]=="number"?m[1]:k+a}}return p}}}function yl(e){return Array.isArray(e)?e:typeof e=="number"?[ml,e]:e==null?Zr:[e]}function gn(e,t,n,r){let i,o,a;typeof t=="function"&&typeof n!="function"?(o=void 0,a=t,i=n):(o=t,a=n,i=r),Jr(e,o,s,i);function s(l,u){const h=u[u.length-1],c=h?h.children.indexOf(l):void 0;return a(l,c,h)}}const Kt={}.hasOwnProperty,xl={};function bl(e,t){const n=t||xl,r=new Map,i=new Map,o=new Map,a={...nl,...n.handlers},s={all:u,applyData:wl,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:a,one:l,options:n,patch:kl,wrap:Cl};return gn(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const c=h.type==="definition"?r:i,f=String(h.identifier).toUpperCase();c.has(f)||c.set(f,h)}}),s;function l(h,c){const f=h.type,p=s.handlers[f];if(Kt.call(s.handlers,f)&&p)return p(s,h,c);if(s.options.passThrough&&s.options.passThrough.includes(f)){if("children"in h){const{children:k,...v}=h,b=kt(v);return b.children=s.all(h),b}return kt(h)}return(s.options.unknownHandler||vl)(s,h,c)}function u(h){const c=[];if("children"in h){const f=h.children;let p=-1;for(;++p<f.length;){const m=s.one(f[p],h);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Xn(m.value)),!Array.isArray(m)&&m.type==="element")){const k=m.children[0];k&&k.type==="text"&&(k.value=Xn(k.value))}Array.isArray(m)?c.push(...m):c.push(m)}}}return c}}function kl(e,t){e.position&&(t.position=so(e))}function wl(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&o&&Object.assign(n.properties,kt(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function vl(e,t){const n=t.data||{},r="value"in t&&!(Kt.call(n,"hProperties")||Kt.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Cl(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
10
+ `}]}}const Et=(function(e){if(e==null)return pl;if(typeof e=="function")return Tt(e);if(typeof e=="object")return Array.isArray(e)?ul(e):cl(e);if(typeof e=="string")return hl(e);throw new Error("Expected function, string, or object as test")});function ul(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Et(e[n]);return Tt(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function cl(e){const t=e;return Tt(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function hl(e){return Tt(t);function t(n){return n&&n.type===e}}function Tt(e){return t;function t(n,r,i){return!!(fl(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function pl(){return!0}function fl(e){return e!==null&&typeof e=="object"&&"type"in e}const Yr=[],dl=!0,Qt=!1,ml="skip";function Zr(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Et(i),a=r?-1:1;s(e,void 0,[])();function s(l,u,h){const c=l&&typeof l=="object"?l:{};if(typeof c.type=="string"){const p=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=Yr,m,b,v;if((!t||o(l,u,h[h.length-1]||void 0))&&(p=gl(n(l,h)),p[0]===Qt))return p;if("children"in l&&l.children){const k=l;if(k.children&&p[0]!==ml)for(b=(r?k.children.length:-1)+a,v=h.concat(k);b>-1&&b<k.children.length;){const E=k.children[b];if(m=s(E,b,v)(),m[0]===Qt)return m;b=typeof m[1]=="number"?m[1]:b+a}}return p}}}function gl(e){return Array.isArray(e)?e:typeof e=="number"?[dl,e]:e==null?Yr:[e]}function mn(e,t,n,r){let i,o,a;typeof t=="function"&&typeof n!="function"?(o=void 0,a=t,i=n):(o=t,a=n,i=r),Zr(e,o,s,i);function s(l,u){const h=u[u.length-1],c=h?h.children.indexOf(l):void 0;return a(l,c,h)}}const Xt={}.hasOwnProperty,yl={};function xl(e,t){const n=t||yl,r=new Map,i=new Map,o=new Map,a={...tl,...n.handlers},s={all:u,applyData:bl,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:a,one:l,options:n,patch:kl,wrap:vl};return mn(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const c=h.type==="definition"?r:i,f=String(h.identifier).toUpperCase();c.has(f)||c.set(f,h)}}),s;function l(h,c){const f=h.type,p=s.handlers[f];if(Xt.call(s.handlers,f)&&p)return p(s,h,c);if(s.options.passThrough&&s.options.passThrough.includes(f)){if("children"in h){const{children:b,...v}=h,k=bt(v);return k.children=s.all(h),k}return bt(h)}return(s.options.unknownHandler||wl)(s,h,c)}function u(h){const c=[];if("children"in h){const f=h.children;let p=-1;for(;++p<f.length;){const m=s.one(f[p],h);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Qn(m.value)),!Array.isArray(m)&&m.type==="element")){const b=m.children[0];b&&b.type==="text"&&(b.value=Qn(b.value))}Array.isArray(m)?c.push(...m):c.push(m)}}}return c}}function kl(e,t){e.position&&(t.position=ao(e))}function bl(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&o&&Object.assign(n.properties,bt(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function wl(e,t){const n=t.data||{},r="value"in t&&!(Xt.call(n,"hProperties")||Xt.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function vl(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
11
11
  `});++r<e.length;)r&&n.push({type:"text",value:`
12
12
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
13
- `}),n}function Xn(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Kn(e,t){const n=bl(e,t),r=n.one(e,void 0),i=ul(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
14
- `},i),o}function Sl(e,t){return e&&"run"in e?async function(n,r){const i=Kn(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Kn(n,{file:r,...e||t})}}function $n(e){if(e)throw e}var Pt,er;function El(){if(er)return Pt;er=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},o=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var h=e.call(u,"constructor"),c=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!h&&!c)return!1;var f;for(f in u);return typeof f>"u"||e.call(u,f)},a=function(u,h){n&&h.name==="__proto__"?n(u,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):u[h.name]=h.newValue},s=function(u,h){if(h==="__proto__")if(e.call(u,h)){if(r)return r(u,h).value}else return;return u[h]};return Pt=function l(){var u,h,c,f,p,m,k=arguments[0],v=1,b=arguments.length,E=!1;for(typeof k=="boolean"&&(E=k,k=arguments[1]||{},v=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});v<b;++v)if(u=arguments[v],u!=null)for(h in u)c=s(k,h),f=s(u,h),k!==f&&(E&&f&&(o(f)||(p=i(f)))?(p?(p=!1,m=c&&i(c)?c:[]):m=c&&o(c)?c:{},a(k,{name:h,newValue:l(E,m,f)})):typeof f<"u"&&a(k,{name:h,newValue:f}));return k},Pt}var Tl=El();const jt=vr(Tl);function $t(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Al(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);s(null,...i);function s(l,...u){const h=e[++o];let c=-1;if(l){a(l);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,h?Il(h,s)(...u):a(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Il(e,t){let n;return r;function r(...a){const s=e.length>a.length;let l;s&&a.push(i);try{l=e.apply(this,a)}catch(u){const h=u;if(s&&n)throw h;return i(h)}s||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(a,...s){n||(n=!0,t(a,...s))}function o(a){i(null,a)}}const Ce={basename:Nl,dirname:Dl,extname:Ll,join:Pl,sep:"/"};function Nl(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');lt(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function Dl(e){if(lt(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Ll(e){lt(e);let t=e.length,n=-1,r=0,i=-1,o=0,a;for(;t--;){const s=e.codePointAt(t);if(s===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),s===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Pl(...e){let t=-1,n;for(;++t<e.length;)lt(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":jl(n)}function jl(e){lt(e);const t=e.codePointAt(0)===47;let n=zl(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function zl(e,t){let n="",r=0,i=-1,o=0,a=-1,s,l;for(;++a<=e.length;){if(a<e.length)s=e.codePointAt(a);else{if(s===47)break;s=47}if(s===47){if(!(i===a-1||o===1))if(i!==a-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,o=0}else s===46&&o>-1?o++:o=-1}return n}function lt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Ml={cwd:Rl};function Rl(){return"/"}function en(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ol(e){if(typeof e=="string")e=new URL(e);else if(!en(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Fl(e)}function Fl(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const zt=["history","path","basename","stem","extname","dirname"];class Qr{constructor(t){let n;t?en(t)?n={path:t}:typeof t=="string"||_l(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Ml.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<zt.length;){const o=zt[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)zt.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ce.basename(this.path):void 0}set basename(t){Rt(t,"basename"),Mt(t,"basename"),this.path=Ce.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ce.dirname(this.path):void 0}set dirname(t){tr(this.basename,"dirname"),this.path=Ce.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ce.extname(this.path):void 0}set extname(t){if(Mt(t,"extname"),tr(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ce.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){en(t)&&(t=Ol(t)),Rt(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ce.basename(this.path,this.extname):void 0}set stem(t){Rt(t,"stem"),Mt(t,"stem"),this.path=Ce.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new he(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Mt(e,t){if(e&&e.includes(Ce.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ce.sep+"`")}function Rt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function tr(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function _l(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Bl=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),Hl={}.hasOwnProperty;class yn extends Bl{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Al()}copy(){const t=new yn;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(jt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(_t("data",this.frozen),this.namespace[t]=n,this):Hl.call(this.namespace,t)&&this.namespace[t]||void 0:t?(_t("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ft(t),r=this.parser||this.Parser;return Ot("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ot("process",this.parser||this.Parser),Ft("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,a){const s=ft(t),l=r.parse(s);r.run(l,s,function(h,c,f){if(h||!c||!f)return u(h);const p=c,m=r.stringify(p,f);Wl(m)?f.value=m:f.result=m,u(h,f)});function u(h,c){h||!c?a(h):o?o(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Ot("processSync",this.parser||this.Parser),Ft("processSync",this.compiler||this.Compiler),this.process(t,i),rr("processSync","process",n),r;function i(o,a){n=!0,$n(o),r=a}}run(t,n,r){nr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(a,s){const l=ft(n);i.run(t,l,u);function u(h,c,f){const p=c||t;h?s(h):a?a(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),rr("runSync","run",r),i;function o(a,s){$n(a),i=s,r=!0}}stringify(t,n){this.freeze();const r=ft(n),i=this.compiler||this.Compiler;return Ft("stringify",i),nr(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(_t("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?s(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[h,...c]=u;l(h,c)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(u.plugins),u.settings&&(i.settings=jt(!0,i.settings,u.settings))}function s(u){let h=-1;if(u!=null)if(Array.isArray(u))for(;++h<u.length;){const c=u[h];o(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,h){let c=-1,f=-1;for(;++c<r.length;)if(r[c][0]===u){f=c;break}if(f===-1)r.push([u,...h]);else if(h.length>0){let[p,...m]=h;const k=r[f][1];$t(k)&&$t(p)&&(p=jt(!0,k,p)),r[f]=[u,p,...m]}}}}const Ul=new yn().freeze();function Ot(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ft(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function _t(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function nr(e){if(!$t(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function rr(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ft(e){return ql(e)?e:new Qr(e)}function ql(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Wl(e){return typeof e=="string"||Vl(e)}function Vl(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Gl="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ir=[],or={allowDangerousHtml:!0},Yl=/^(https?|ircs?|mailto|xmpp)$/i,Zl=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Jl(e){const t=Ql(e),n=Xl(e);return Kl(t.runSync(t.parse(n),n),e)}function Ql(e){const t=e.rehypePlugins||ir,n=e.remarkPlugins||ir,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...or}:or;return Ul().use(Ds).use(n).use(Sl,r).use(t)}function Xl(e){const t=e.children||"",n=new Qr;return typeof t=="string"&&(n.value=t),n}function Kl(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,a=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||$l;for(const h of Zl)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+Gl+h.id,void 0);return gn(e,u),po(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function u(h,c,f){if(h.type==="raw"&&f&&typeof c=="number")return a?f.children.splice(c,1):f.children[c]={type:"text",value:h.value},c;if(h.type==="element"){let p;for(p in Nt)if(Object.hasOwn(Nt,p)&&Object.hasOwn(h.properties,p)){const m=h.properties[p],k=Nt[p];(k===null||k.includes(h.tagName))&&(h.properties[p]=l(String(m||""),p,h))}}if(h.type==="element"){let p=n?!n.includes(h.tagName):o?o.includes(h.tagName):!1;if(!p&&r&&typeof c=="number"&&(p=!r(h,c,f)),p&&f&&typeof c=="number")return s&&h.children?f.children.splice(c,1,...h.children):f.children.splice(c,1),c}}}function $l(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Yl.test(e.slice(0,t))?e:""}function ar(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function eu(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function tu(e,t,n){const i=Et((n||{}).ignore||[]),o=nu(t);let a=-1;for(;++a<o.length;)Jr(e,"text",s);function s(u,h){let c=-1,f;for(;++c<h.length;){const p=h[c],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return l(u,h)}function l(u,h){const c=h[h.length-1],f=o[a][0],p=o[a][1];let m=0;const v=c.children.indexOf(u);let b=!1,E=[];f.lastIndex=0;let T=f.exec(u.value);for(;T;){const M=T.index,D={index:T.index,input:T.input,stack:[...h,u]};let w=p(...T,D);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?f.lastIndex=M+1:(m!==M&&E.push({type:"text",value:u.value.slice(m,M)}),Array.isArray(w)?E.push(...w):w&&E.push(w),m=M+T[0].length,b=!0),!f.global)break;T=f.exec(u.value)}return b?(m<u.value.length&&E.push({type:"text",value:u.value.slice(m)}),c.children.splice(v,1,...E)):E=[u],v+E.length}}function nu(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([ru(i[0]),iu(i[1])])}return t}function ru(e){return typeof e=="string"?new RegExp(eu(e),"g"):e}function iu(e){return typeof e=="function"?e:function(){return e}}const Bt="phrasing",Ht=["autolink","link","image","label"];function ou(){return{transforms:[pu],enter:{literalAutolink:su,literalAutolinkEmail:Ut,literalAutolinkHttp:Ut,literalAutolinkWww:Ut},exit:{literalAutolink:hu,literalAutolinkEmail:cu,literalAutolinkHttp:lu,literalAutolinkWww:uu}}}function au(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Bt,notInConstruct:Ht},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Bt,notInConstruct:Ht},{character:":",before:"[ps]",after:"\\/",inConstruct:Bt,notInConstruct:Ht}]}}function su(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ut(e){this.config.enter.autolinkProtocol.call(this,e)}function lu(e){this.config.exit.autolinkProtocol.call(this,e)}function uu(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function cu(e){this.config.exit.autolinkEmail.call(this,e)}function hu(e){this.exit(e)}function pu(e){tu(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,fu],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),du]],{ignore:["link","linkReference"]})}function fu(e,t,n,r,i){let o="";if(!Xr(i)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!mu(n)))return!1;const a=gu(n+r);if(!a[0])return!1;const s={type:"link",title:null,url:o+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[s,{type:"text",value:a[1]}]:s}function du(e,t,n,r){return!Xr(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function mu(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function gu(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=ar(e,"(");let o=ar(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function Xr(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Oe(n)||vt(n))&&(!t||n!==47)}Kr.peek=Eu;function yu(){this.buffer()}function xu(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bu(){this.buffer()}function ku(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function wu(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ve(this.sliceSerialize(e)).toLowerCase(),n.label=t}function vu(e){this.exit(e)}function Cu(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ve(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Su(e){this.exit(e)}function Eu(){return"["}function Kr(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const a=n.enter("footnoteReference"),s=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),s(),a(),o+=i.move("]"),o}function Tu(){return{enter:{gfmFootnoteCallString:yu,gfmFootnoteCall:xu,gfmFootnoteDefinitionLabelString:bu,gfmFootnoteDefinition:ku},exit:{gfmFootnoteCallString:wu,gfmFootnoteCall:vu,gfmFootnoteDefinitionLabelString:Cu,gfmFootnoteDefinition:Su}}}function Au(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Kr},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,a){const s=o.createTracker(a);let l=s.move("[^");const u=o.enter("footnoteDefinition"),h=o.enter("label");return l+=s.move(o.safe(o.associationId(r),{before:l,after:"]"})),h(),l+=s.move("]:"),r.children&&r.children.length>0&&(s.shift(4),l+=s.move((t?`
15
- `:" ")+o.indentLines(o.containerFlow(r,s.current()),t?$r:Iu))),u(),l}}function Iu(e,t,n){return t===0?e:$r(e,t,n)}function $r(e,t,n){return(n?"":" ")+e}const Nu=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ei.peek=zu;function Du(){return{canContainEols:["delete"],enter:{strikethrough:Pu},exit:{strikethrough:ju}}}function Lu(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Nu}],handlers:{delete:ei}}}function Pu(e){this.enter({type:"delete",children:[]},e)}function ju(e){this.exit(e)}function ei(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),o(),a}function zu(){return"~"}function Mu(e){return e.length}function Ru(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Mu,o=[],a=[],s=[],l=[];let u=0,h=-1;for(;++h<e.length;){const k=[],v=[];let b=-1;for(e[h].length>u&&(u=e[h].length);++b<e[h].length;){const E=Ou(e[h][b]);if(n.alignDelimiters!==!1){const T=i(E);v[b]=T,(l[b]===void 0||T>l[b])&&(l[b]=T)}k.push(E)}a[h]=k,s[h]=v}let c=-1;if(typeof r=="object"&&"length"in r)for(;++c<u;)o[c]=sr(r[c]);else{const k=sr(r);for(;++c<u;)o[c]=k}c=-1;const f=[],p=[];for(;++c<u;){const k=o[c];let v="",b="";k===99?(v=":",b=":"):k===108?v=":":k===114&&(b=":");let E=n.alignDelimiters===!1?1:Math.max(1,l[c]-v.length-b.length);const T=v+"-".repeat(E)+b;n.alignDelimiters!==!1&&(E=v.length+E+b.length,E>l[c]&&(l[c]=E),p[c]=E),f[c]=T}a.splice(1,0,f),s.splice(1,0,p),h=-1;const m=[];for(;++h<a.length;){const k=a[h],v=s[h];c=-1;const b=[];for(;++c<u;){const E=k[c]||"";let T="",M="";if(n.alignDelimiters!==!1){const D=l[c]-(v[c]||0),w=o[c];w===114?T=" ".repeat(D):w===99?D%2?(T=" ".repeat(D/2+.5),M=" ".repeat(D/2-.5)):(T=" ".repeat(D/2),M=T):M=" ".repeat(D)}n.delimiterStart!==!1&&!c&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||c)&&b.push(" "),n.alignDelimiters!==!1&&b.push(T),b.push(E),n.alignDelimiters!==!1&&b.push(M),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||c!==u-1)&&b.push("|")}m.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return m.join(`
16
- `)}function Ou(e){return e==null?"":String(e)}function sr(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Fu(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),_u);return i(),a}function _u(e,t,n){return">"+(n?"":" ")+e}function Bu(e,t){return lr(e,t.inConstruct,!0)&&!lr(e,t.notInConstruct,!1)}function lr(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function ur(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
17
- `&&Bu(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
18
- `}function Hu(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>a&&(a=o):o=1,i=r+t.length,r=n.indexOf(t,i);return a}function Uu(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function qu(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Wu(e,t,n,r){const i=qu(n),o=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(Uu(e,n)){const c=n.enter("codeIndented"),f=n.indentLines(o,Vu);return c(),f}const s=n.createTracker(r),l=i.repeat(Math.max(Hu(o,i)+1,3)),u=n.enter("codeFenced");let h=s.move(l);if(e.lang){const c=n.enter(`codeFencedLang${a}`);h+=s.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...s.current()})),c()}if(e.lang&&e.meta){const c=n.enter(`codeFencedMeta${a}`);h+=s.move(" "),h+=s.move(n.safe(e.meta,{before:h,after:`
13
+ `}),n}function Qn(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Xn(e,t){const n=xl(e,t),r=n.one(e,void 0),i=ll(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
14
+ `},i),o}function Cl(e,t){return e&&"run"in e?async function(n,r){const i=Xn(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Xn(n,{file:r,...e||t})}}function Kn(e){if(e)throw e}var Pt,$n;function Sl(){if($n)return Pt;$n=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},o=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var h=e.call(u,"constructor"),c=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!h&&!c)return!1;var f;for(f in u);return typeof f>"u"||e.call(u,f)},a=function(u,h){n&&h.name==="__proto__"?n(u,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):u[h.name]=h.newValue},s=function(u,h){if(h==="__proto__")if(e.call(u,h)){if(r)return r(u,h).value}else return;return u[h]};return Pt=function l(){var u,h,c,f,p,m,b=arguments[0],v=1,k=arguments.length,E=!1;for(typeof b=="boolean"&&(E=b,b=arguments[1]||{},v=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});v<k;++v)if(u=arguments[v],u!=null)for(h in u)c=s(b,h),f=s(u,h),b!==f&&(E&&f&&(o(f)||(p=i(f)))?(p?(p=!1,m=c&&i(c)?c:[]):m=c&&o(c)?c:{},a(b,{name:h,newValue:l(E,m,f)})):typeof f<"u"&&a(b,{name:h,newValue:f}));return b},Pt}var El=Sl();const jt=wr(El);function Kt(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Tl(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);s(null,...i);function s(l,...u){const h=e[++o];let c=-1;if(l){a(l);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,h?Al(h,s)(...u):a(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Al(e,t){let n;return r;function r(...a){const s=e.length>a.length;let l;s&&a.push(i);try{l=e.apply(this,a)}catch(u){const h=u;if(s&&n)throw h;return i(h)}s||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(a,...s){n||(n=!0,t(a,...s))}function o(a){i(null,a)}}const Ce={basename:Il,dirname:Nl,extname:Dl,join:Ll,sep:"/"};function Il(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');lt(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function Nl(e){if(lt(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Dl(e){lt(e);let t=e.length,n=-1,r=0,i=-1,o=0,a;for(;t--;){const s=e.codePointAt(t);if(s===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),s===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Ll(...e){let t=-1,n;for(;++t<e.length;)lt(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Pl(n)}function Pl(e){lt(e);const t=e.codePointAt(0)===47;let n=jl(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function jl(e,t){let n="",r=0,i=-1,o=0,a=-1,s,l;for(;++a<=e.length;){if(a<e.length)s=e.codePointAt(a);else{if(s===47)break;s=47}if(s===47){if(!(i===a-1||o===1))if(i!==a-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,o=0}else s===46&&o>-1?o++:o=-1}return n}function lt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const zl={cwd:Ml};function Ml(){return"/"}function $t(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Rl(e){if(typeof e=="string")e=new URL(e);else if(!$t(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Ol(e)}function Ol(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const zt=["history","path","basename","stem","extname","dirname"];class Jr{constructor(t){let n;t?$t(t)?n={path:t}:typeof t=="string"||Fl(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":zl.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<zt.length;){const o=zt[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)zt.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ce.basename(this.path):void 0}set basename(t){Rt(t,"basename"),Mt(t,"basename"),this.path=Ce.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ce.dirname(this.path):void 0}set dirname(t){er(this.basename,"dirname"),this.path=Ce.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ce.extname(this.path):void 0}set extname(t){if(Mt(t,"extname"),er(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ce.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){$t(t)&&(t=Rl(t)),Rt(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ce.basename(this.path,this.extname):void 0}set stem(t){Rt(t,"stem"),Mt(t,"stem"),this.path=Ce.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new he(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Mt(e,t){if(e&&e.includes(Ce.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ce.sep+"`")}function Rt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function er(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Fl(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const _l=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),Bl={}.hasOwnProperty;class gn extends _l{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Tl()}copy(){const t=new gn;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(jt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(_t("data",this.frozen),this.namespace[t]=n,this):Bl.call(this.namespace,t)&&this.namespace[t]||void 0:t?(_t("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ft(t),r=this.parser||this.Parser;return Ot("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ot("process",this.parser||this.Parser),Ft("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,a){const s=ft(t),l=r.parse(s);r.run(l,s,function(h,c,f){if(h||!c||!f)return u(h);const p=c,m=r.stringify(p,f);ql(m)?f.value=m:f.result=m,u(h,f)});function u(h,c){h||!c?a(h):o?o(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Ot("processSync",this.parser||this.Parser),Ft("processSync",this.compiler||this.Compiler),this.process(t,i),nr("processSync","process",n),r;function i(o,a){n=!0,Kn(o),r=a}}run(t,n,r){tr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(a,s){const l=ft(n);i.run(t,l,u);function u(h,c,f){const p=c||t;h?s(h):a?a(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),nr("runSync","run",r),i;function o(a,s){Kn(a),i=s,r=!0}}stringify(t,n){this.freeze();const r=ft(n),i=this.compiler||this.Compiler;return Ft("stringify",i),tr(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(_t("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?s(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[h,...c]=u;l(h,c)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(u.plugins),u.settings&&(i.settings=jt(!0,i.settings,u.settings))}function s(u){let h=-1;if(u!=null)if(Array.isArray(u))for(;++h<u.length;){const c=u[h];o(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,h){let c=-1,f=-1;for(;++c<r.length;)if(r[c][0]===u){f=c;break}if(f===-1)r.push([u,...h]);else if(h.length>0){let[p,...m]=h;const b=r[f][1];Kt(b)&&Kt(p)&&(p=jt(!0,b,p)),r[f]=[u,p,...m]}}}}const Hl=new gn().freeze();function Ot(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ft(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function _t(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function tr(e){if(!Kt(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function nr(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ft(e){return Ul(e)?e:new Jr(e)}function Ul(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ql(e){return typeof e=="string"||Wl(e)}function Wl(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vl="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",rr=[],ir={allowDangerousHtml:!0},Gl=/^(https?|ircs?|mailto|xmpp)$/i,Yl=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Zl(e){const t=Jl(e),n=Ql(e);return Xl(t.runSync(t.parse(n),n),e)}function Jl(e){const t=e.rehypePlugins||rr,n=e.remarkPlugins||rr,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ir}:ir;return Hl().use(Ns).use(n).use(Cl,r).use(t)}function Ql(e){const t=e.children||"",n=new Jr;return typeof t=="string"&&(n.value=t),n}function Xl(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,a=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||Kl;for(const h of Yl)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+Vl+h.id,void 0);return mn(e,u),ho(e,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function u(h,c,f){if(h.type==="raw"&&f&&typeof c=="number")return a?f.children.splice(c,1):f.children[c]={type:"text",value:h.value},c;if(h.type==="element"){let p;for(p in Nt)if(Object.hasOwn(Nt,p)&&Object.hasOwn(h.properties,p)){const m=h.properties[p],b=Nt[p];(b===null||b.includes(h.tagName))&&(h.properties[p]=l(String(m||""),p,h))}}if(h.type==="element"){let p=n?!n.includes(h.tagName):o?o.includes(h.tagName):!1;if(!p&&r&&typeof c=="number"&&(p=!r(h,c,f)),p&&f&&typeof c=="number")return s&&h.children?f.children.splice(c,1,...h.children):f.children.splice(c,1),c}}}function Kl(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Gl.test(e.slice(0,t))?e:""}function or(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function $l(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function eu(e,t,n){const i=Et((n||{}).ignore||[]),o=tu(t);let a=-1;for(;++a<o.length;)Zr(e,"text",s);function s(u,h){let c=-1,f;for(;++c<h.length;){const p=h[c],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return l(u,h)}function l(u,h){const c=h[h.length-1],f=o[a][0],p=o[a][1];let m=0;const v=c.children.indexOf(u);let k=!1,E=[];f.lastIndex=0;let T=f.exec(u.value);for(;T;){const M=T.index,D={index:T.index,input:T.input,stack:[...h,u]};let w=p(...T,D);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?f.lastIndex=M+1:(m!==M&&E.push({type:"text",value:u.value.slice(m,M)}),Array.isArray(w)?E.push(...w):w&&E.push(w),m=M+T[0].length,k=!0),!f.global)break;T=f.exec(u.value)}return k?(m<u.value.length&&E.push({type:"text",value:u.value.slice(m)}),c.children.splice(v,1,...E)):E=[u],v+E.length}}function tu(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([nu(i[0]),ru(i[1])])}return t}function nu(e){return typeof e=="string"?new RegExp($l(e),"g"):e}function ru(e){return typeof e=="function"?e:function(){return e}}const Bt="phrasing",Ht=["autolink","link","image","label"];function iu(){return{transforms:[hu],enter:{literalAutolink:au,literalAutolinkEmail:Ut,literalAutolinkHttp:Ut,literalAutolinkWww:Ut},exit:{literalAutolink:cu,literalAutolinkEmail:uu,literalAutolinkHttp:su,literalAutolinkWww:lu}}}function ou(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Bt,notInConstruct:Ht},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Bt,notInConstruct:Ht},{character:":",before:"[ps]",after:"\\/",inConstruct:Bt,notInConstruct:Ht}]}}function au(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ut(e){this.config.enter.autolinkProtocol.call(this,e)}function su(e){this.config.exit.autolinkProtocol.call(this,e)}function lu(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function uu(e){this.config.exit.autolinkEmail.call(this,e)}function cu(e){this.exit(e)}function hu(e){eu(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,pu],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),fu]],{ignore:["link","linkReference"]})}function pu(e,t,n,r,i){let o="";if(!Qr(i)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!du(n)))return!1;const a=mu(n+r);if(!a[0])return!1;const s={type:"link",title:null,url:o+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[s,{type:"text",value:a[1]}]:s}function fu(e,t,n,r){return!Qr(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function du(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function mu(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=or(e,"(");let o=or(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function Qr(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Me(n)||vt(n))&&(!t||n!==47)}Xr.peek=Su;function gu(){this.buffer()}function yu(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function xu(){this.buffer()}function ku(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bu(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ve(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wu(e){this.exit(e)}function vu(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ve(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Cu(e){this.exit(e)}function Su(){return"["}function Xr(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const a=n.enter("footnoteReference"),s=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),s(),a(),o+=i.move("]"),o}function Eu(){return{enter:{gfmFootnoteCallString:gu,gfmFootnoteCall:yu,gfmFootnoteDefinitionLabelString:xu,gfmFootnoteDefinition:ku},exit:{gfmFootnoteCallString:bu,gfmFootnoteCall:wu,gfmFootnoteDefinitionLabelString:vu,gfmFootnoteDefinition:Cu}}}function Tu(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Xr},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,a){const s=o.createTracker(a);let l=s.move("[^");const u=o.enter("footnoteDefinition"),h=o.enter("label");return l+=s.move(o.safe(o.associationId(r),{before:l,after:"]"})),h(),l+=s.move("]:"),r.children&&r.children.length>0&&(s.shift(4),l+=s.move((t?`
15
+ `:" ")+o.indentLines(o.containerFlow(r,s.current()),t?Kr:Au))),u(),l}}function Au(e,t,n){return t===0?e:Kr(e,t,n)}function Kr(e,t,n){return(n?"":" ")+e}const Iu=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];$r.peek=ju;function Nu(){return{canContainEols:["delete"],enter:{strikethrough:Lu},exit:{strikethrough:Pu}}}function Du(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Iu}],handlers:{delete:$r}}}function Lu(e){this.enter({type:"delete",children:[]},e)}function Pu(e){this.exit(e)}function $r(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),o(),a}function ju(){return"~"}function zu(e){return e.length}function Mu(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||zu,o=[],a=[],s=[],l=[];let u=0,h=-1;for(;++h<e.length;){const b=[],v=[];let k=-1;for(e[h].length>u&&(u=e[h].length);++k<e[h].length;){const E=Ru(e[h][k]);if(n.alignDelimiters!==!1){const T=i(E);v[k]=T,(l[k]===void 0||T>l[k])&&(l[k]=T)}b.push(E)}a[h]=b,s[h]=v}let c=-1;if(typeof r=="object"&&"length"in r)for(;++c<u;)o[c]=ar(r[c]);else{const b=ar(r);for(;++c<u;)o[c]=b}c=-1;const f=[],p=[];for(;++c<u;){const b=o[c];let v="",k="";b===99?(v=":",k=":"):b===108?v=":":b===114&&(k=":");let E=n.alignDelimiters===!1?1:Math.max(1,l[c]-v.length-k.length);const T=v+"-".repeat(E)+k;n.alignDelimiters!==!1&&(E=v.length+E+k.length,E>l[c]&&(l[c]=E),p[c]=E),f[c]=T}a.splice(1,0,f),s.splice(1,0,p),h=-1;const m=[];for(;++h<a.length;){const b=a[h],v=s[h];c=-1;const k=[];for(;++c<u;){const E=b[c]||"";let T="",M="";if(n.alignDelimiters!==!1){const D=l[c]-(v[c]||0),w=o[c];w===114?T=" ".repeat(D):w===99?D%2?(T=" ".repeat(D/2+.5),M=" ".repeat(D/2-.5)):(T=" ".repeat(D/2),M=T):M=" ".repeat(D)}n.delimiterStart!==!1&&!c&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||c)&&k.push(" "),n.alignDelimiters!==!1&&k.push(T),k.push(E),n.alignDelimiters!==!1&&k.push(M),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||c!==u-1)&&k.push("|")}m.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return m.join(`
16
+ `)}function Ru(e){return e==null?"":String(e)}function ar(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Ou(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const a=n.indentLines(n.containerFlow(e,o.current()),Fu);return i(),a}function Fu(e,t,n){return">"+(n?"":" ")+e}function _u(e,t){return sr(e,t.inConstruct,!0)&&!sr(e,t.notInConstruct,!1)}function sr(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function lr(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
17
+ `&&_u(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
18
+ `}function Bu(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>a&&(a=o):o=1,i=r+t.length,r=n.indexOf(t,i);return a}function Hu(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Uu(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function qu(e,t,n,r){const i=Uu(n),o=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(Hu(e,n)){const c=n.enter("codeIndented"),f=n.indentLines(o,Wu);return c(),f}const s=n.createTracker(r),l=i.repeat(Math.max(Bu(o,i)+1,3)),u=n.enter("codeFenced");let h=s.move(l);if(e.lang){const c=n.enter(`codeFencedLang${a}`);h+=s.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...s.current()})),c()}if(e.lang&&e.meta){const c=n.enter(`codeFencedMeta${a}`);h+=s.move(" "),h+=s.move(n.safe(e.meta,{before:h,after:`
19
19
  `,encode:["`"],...s.current()})),c()}return h+=s.move(`
20
20
  `),o&&(h+=s.move(o+`
21
- `)),h+=s.move(l),u(),h}function Vu(e,t,n){return(n?"":" ")+e}function xn(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Gu(e,t,n,r){const i=xn(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let s=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
22
- `,...l.current()}))),s(),e.title&&(s=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),a(),u}function Yu(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function it(e){return"&#x"+e.toString(16).toUpperCase()+";"}function wt(e,t,n){const r=Ve(e),i=Ve(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ti.peek=Zu;function ti(e,t,n,r){const i=Yu(n),o=n.enter("emphasis"),a=n.createTracker(r),s=a.move(i);let l=a.move(n.containerPhrasing(e,{after:i,before:s,...a.current()}));const u=l.charCodeAt(0),h=wt(r.before.charCodeAt(r.before.length-1),u,i);h.inside&&(l=it(u)+l.slice(1));const c=l.charCodeAt(l.length-1),f=wt(r.after.charCodeAt(0),c,i);f.inside&&(l=l.slice(0,-1)+it(c));const p=a.move(i);return o(),n.attentionEncodeSurroundingInfo={after:f.outside,before:h.outside},s+l+p}function Zu(e,t,n){return n.options.emphasis||"*"}function Ju(e,t){let n=!1;return gn(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Xt}),!!((!e.depth||e.depth<3)&&un(e)&&(t.options.setext||n))}function Qu(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(Ju(e,n)){const h=n.enter("headingSetext"),c=n.enter("phrasing"),f=n.containerPhrasing(e,{...o.current(),before:`
21
+ `)),h+=s.move(l),u(),h}function Wu(e,t,n){return(n?"":" ")+e}function yn(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Vu(e,t,n,r){const i=yn(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let s=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
22
+ `,...l.current()}))),s(),e.title&&(s=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),a(),u}function Gu(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function it(e){return"&#x"+e.toString(16).toUpperCase()+";"}function wt(e,t,n){const r=Ve(e),i=Ve(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ei.peek=Yu;function ei(e,t,n,r){const i=Gu(n),o=n.enter("emphasis"),a=n.createTracker(r),s=a.move(i);let l=a.move(n.containerPhrasing(e,{after:i,before:s,...a.current()}));const u=l.charCodeAt(0),h=wt(r.before.charCodeAt(r.before.length-1),u,i);h.inside&&(l=it(u)+l.slice(1));const c=l.charCodeAt(l.length-1),f=wt(r.after.charCodeAt(0),c,i);f.inside&&(l=l.slice(0,-1)+it(c));const p=a.move(i);return o(),n.attentionEncodeSurroundingInfo={after:f.outside,before:h.outside},s+l+p}function Yu(e,t,n){return n.options.emphasis||"*"}function Zu(e,t){let n=!1;return mn(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Qt}),!!((!e.depth||e.depth<3)&&ln(e)&&(t.options.setext||n))}function Ju(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(Zu(e,n)){const h=n.enter("headingSetext"),c=n.enter("phrasing"),f=n.containerPhrasing(e,{...o.current(),before:`
23
23
  `,after:`
24
24
  `});return c(),h(),f+`
25
25
  `+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
26
26
  `))+1))}const a="#".repeat(i),s=n.enter("headingAtx"),l=n.enter("phrasing");o.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
27
- `,...o.current()});return/^[\t ]/.test(u)&&(u=it(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),l(),s(),u}ni.peek=Xu;function ni(e){return e.value||""}function Xu(){return"<"}ri.peek=Ku;function ri(e,t,n,r){const i=xn(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let s=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),s(),e.title&&(s=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),u+=l.move(")"),a(),u}function Ku(){return"!"}ii.peek=$u;function ii(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const s=n.createTracker(r);let l=s.move("![");const u=n.safe(e.alt,{before:l,after:"]",...s.current()});l+=s.move(u+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return a(),n.stack=h,o(),i==="full"||!u||u!==c?l+=s.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function $u(){return"!"}oi.peek=ec;function oi(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],s=n.compilePattern(a);let l;if(a.atBreak)for(;l=s.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return i+r+i}function ec(){return"`"}function ai(e,t){const n=un(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}si.peek=tc;function si(e,t,n,r){const i=xn(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let s,l;if(ai(e,n)){const h=n.stack;n.stack=[],s=n.enter("autolink");let c=a.move("<");return c+=a.move(n.containerPhrasing(e,{before:c,after:">",...a.current()})),c+=a.move(">"),s(),n.stack=h,c}s=n.enter("link"),l=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(l=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${o}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),l()),u+=a.move(")"),s(),u}function tc(e,t,n){return ai(e,n)?"<":"["}li.peek=nc;function li(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const s=n.createTracker(r);let l=s.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...s.current()});l+=s.move(u+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return a(),n.stack=h,o(),i==="full"||!u||u!==c?l+=s.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function nc(){return"["}function bn(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function rc(e){const t=bn(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function ic(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ui(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function oc(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?ic(n):bn(n);const s=e.ordered?a==="."?")":".":rc(n);let l=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),ui(n)===a&&h){let c=-1;for(;++c<e.children.length;){const f=e.children[c];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(a=s),n.bulletCurrent=a;const u=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=o,i(),u}function ac(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function sc(e,t,n,r){const i=ac(n);let o=n.bulletCurrent||bn(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const s=n.createTracker(r);s.move(o+" ".repeat(a-o.length)),s.shift(a);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,s.current()),h);return l(),u;function h(c,f,p){return f?(p?"":" ".repeat(a))+c:(p?o:o+" ".repeat(a-o.length))+c}}function lc(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(e,r);return o(),i(),a}const uc=Et(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function cc(e,t,n,r){return(e.children.some(function(a){return uc(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function hc(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}ci.peek=pc;function ci(e,t,n,r){const i=hc(n),o=n.enter("strong"),a=n.createTracker(r),s=a.move(i+i);let l=a.move(n.containerPhrasing(e,{after:i,before:s,...a.current()}));const u=l.charCodeAt(0),h=wt(r.before.charCodeAt(r.before.length-1),u,i);h.inside&&(l=it(u)+l.slice(1));const c=l.charCodeAt(l.length-1),f=wt(r.after.charCodeAt(0),c,i);f.inside&&(l=l.slice(0,-1)+it(c));const p=a.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:f.outside,before:h.outside},s+l+p}function pc(e,t,n){return n.options.strong||"*"}function fc(e,t,n,r){return n.safe(e.value,r)}function dc(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function mc(e,t,n){const r=(ui(n)+(n.options.ruleSpaces?" ":"")).repeat(dc(n));return n.options.ruleSpaces?r.slice(0,-1):r}const hi={blockquote:Fu,break:ur,code:Wu,definition:Gu,emphasis:ti,hardBreak:ur,heading:Qu,html:ni,image:ri,imageReference:ii,inlineCode:oi,link:si,linkReference:li,list:oc,listItem:sc,paragraph:lc,root:cc,strong:ci,text:fc,thematicBreak:mc};function gc(){return{enter:{table:yc,tableData:cr,tableHeader:cr,tableRow:bc},exit:{codeText:kc,table:xc,tableData:qt,tableHeader:qt,tableRow:qt}}}function yc(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function xc(e){this.exit(e),this.data.inTable=void 0}function bc(e){this.enter({type:"tableRow",children:[]},e)}function qt(e){this.exit(e)}function cr(e){this.enter({type:"tableCell",children:[]},e)}function kc(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,wc));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function wc(e,t){return t==="|"?t:e}function vc(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
28
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:a,tableCell:l,tableRow:s}};function a(p,m,k,v){return u(h(p,k,v),p.align)}function s(p,m,k,v){const b=c(p,k,v),E=u([b]);return E.slice(0,E.indexOf(`
29
- `))}function l(p,m,k,v){const b=k.enter("tableCell"),E=k.enter("phrasing"),T=k.containerPhrasing(p,{...v,before:o,after:o});return E(),b(),T}function u(p,m){return Ru(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function h(p,m,k){const v=p.children;let b=-1;const E=[],T=m.enter("table");for(;++b<v.length;)E[b]=c(v[b],m,k);return T(),E}function c(p,m,k){const v=p.children;let b=-1;const E=[],T=m.enter("tableRow");for(;++b<v.length;)E[b]=l(v[b],p,m,k);return T(),E}function f(p,m,k){let v=hi.inlineCode(p,m,k);return k.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function Cc(){return{exit:{taskListCheckValueChecked:hr,taskListCheckValueUnchecked:hr,paragraph:Ec}}}function Sc(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Tc}}}function hr(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Ec(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const s=i[o];if(s.type==="paragraph"){a=s;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Tc(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);o&&s.move(a);let l=hi.listItem(e,t,n,{...r,...s.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(h){return h+a}}function Ac(){return[ou(),Tu(),Du(),gc(),Cc()]}function Ic(e){return{extensions:[au(),Au(e),Lu(),vc(e),Sc()]}}const Nc={tokenize:Mc,partial:!0},pi={tokenize:Rc,partial:!0},fi={tokenize:Oc,partial:!0},di={tokenize:Fc,partial:!0},Dc={tokenize:_c,partial:!0},mi={name:"wwwAutolink",tokenize:jc,previous:yi},gi={name:"protocolAutolink",tokenize:zc,previous:xi},Ne={name:"emailAutolink",tokenize:Pc,previous:bi},Se={};function Lc(){return{text:Se}}let Re=48;for(;Re<123;)Se[Re]=Ne,Re++,Re===58?Re=65:Re===91&&(Re=97);Se[43]=Ne;Se[45]=Ne;Se[46]=Ne;Se[95]=Ne;Se[72]=[Ne,gi];Se[104]=[Ne,gi];Se[87]=[Ne,mi];Se[119]=[Ne,mi];function Pc(e,t,n){const r=this;let i,o;return a;function a(c){return!tn(c)||!bi.call(r,r.previous)||kn(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(c))}function s(c){return tn(c)?(e.consume(c),s):c===64?(e.consume(c),l):n(c)}function l(c){return c===46?e.check(Dc,h,u)(c):c===45||c===95||ue(c)?(o=!0,e.consume(c),l):h(c)}function u(c){return e.consume(c),i=!0,l}function h(c){return o&&i&&fe(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function jc(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!yi.call(r,r.previous)||kn(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Nc,e.attempt(pi,e.attempt(fi,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function zc(e,t,n){const r=this;let i="",o=!1;return a;function a(c){return(c===72||c===104)&&xi.call(r,r.previous)&&!kn(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),s):n(c)}function s(c){if(fe(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),s;if(c===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(c),l}return n(c)}function l(c){return c===47?(e.consume(c),o?u:(o=!0,l)):n(c)}function u(c){return c===null||xt(c)||ee(c)||Oe(c)||vt(c)?n(c):e.attempt(pi,e.attempt(fi,h),n)(c)}function h(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function Mc(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function Rc(e,t,n){let r,i,o;return a;function a(u){return u===46||u===95?e.check(di,l,s)(u):u===null||ee(u)||Oe(u)||u!==45&&vt(u)?l(u):(o=!0,e.consume(u),a)}function s(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),a}function l(u){return i||r||!o?n(u):t(u)}}function Oc(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(di,t,o)(a):a===null||ee(a)||Oe(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function Fc(e,t,n){return r;function r(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(e.consume(s),r):s===38?(e.consume(s),o):s===93?(e.consume(s),i):s===60||s===null||ee(s)||Oe(s)?t(s):n(s)}function i(s){return s===null||s===40||s===91||ee(s)||Oe(s)?t(s):r(s)}function o(s){return fe(s)?a(s):n(s)}function a(s){return s===59?(e.consume(s),r):fe(s)?(e.consume(s),a):n(s)}}function _c(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return ue(o)?n(o):t(o)}}function yi(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ee(e)}function xi(e){return!fe(e)}function bi(e){return!(e===47||tn(e))}function tn(e){return e===43||e===45||e===46||e===95||ue(e)}function kn(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Bc={tokenize:Zc,partial:!0};function Hc(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Vc,continuation:{tokenize:Gc},exit:Yc}},text:{91:{name:"gfmFootnoteCall",tokenize:Wc},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Uc,resolveTo:qc}}}}function Uc(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!a||!a._balanced)return n(l);const u=ve(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function qc(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function Wc(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;return s;function s(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),l}function l(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(o>999||c===93&&!a||c===null||c===91||ee(c))return n(c);if(c===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(ve(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return ee(c)||(a=!0),o++,e.consume(c),c===92?h:u}function h(c){return c===91||c===92||c===93?(e.consume(c),o++,u):u(c)}}function Vc(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,s;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(m)}function h(m){if(a>999||m===93&&!s||m===null||m===91||ee(m))return n(m);if(m===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=ve(r.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return ee(m)||(s=!0),a++,e.consume(m),m===92?c:h}function c(m){return m===91||m===92||m===93?(e.consume(m),a++,h):h(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(o)||i.push(o),Z(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function Gc(e,t,n){return e.check(st,t,e.attempt(Bc,t,n))}function Yc(e){e.exit("gfmFootnoteDefinition")}function Zc(e,t,n){const r=this;return Z(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function Jc(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,s){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let u=l;for(;u--;)if(a[u][0]==="exit"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[u][1].end.offset-a[u][1].start.offset){a[l][1].type="strikethroughSequence",a[u][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[u][1].start),end:Object.assign({},a[l][1].end)},c={type:"strikethroughText",start:Object.assign({},a[u][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",h,s],["enter",a[u][1],s],["exit",a[u][1],s],["enter",c,s]],p=s.parser.constructs.insideSpan.null;p&&be(f,f.length,0,Ct(p,a.slice(u+1,l),s)),be(f,f.length,0,[["exit",c,s],["enter",a[l][1],s],["exit",a[l][1],s],["exit",h,s]]),be(a,u-1,l-u+3,f),l=u+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function o(a,s,l){const u=this.previous,h=this.events;let c=0;return f;function f(m){return u===126&&h[h.length-1][1].type!=="characterEscape"?l(m):(a.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const k=Ve(u);if(m===126)return c>1?l(m):(a.consume(m),c++,p);if(c<2&&!n)return l(m);const v=a.exit("strikethroughSequenceTemporary"),b=Ve(m);return v._open=!b||b===2&&!!k,v._close=!k||k===2&&!!b,s(m)}}}class Qc{constructor(){this.map=[]}add(t,n,r){Xc(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function Xc(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Kc(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function $c(){return{flow:{null:{name:"table",tokenize:eh,resolveAll:th}}}}function eh(e,t,n){const r=this;let i=0,o=0,a;return s;function s(x){let C=r.events.length-1;for(;C>-1;){const N=r.events[C][1].type;if(N==="lineEnding"||N==="linePrefix")C--;else break}const z=C>-1?r.events[C][1].type:null,j=z==="tableHead"||z==="tableRow"?w:l;return j===w&&r.parser.lazy[r.now().line]?n(x):j(x)}function l(x){return e.enter("tableHead"),e.enter("tableRow"),u(x)}function u(x){return x===124||(a=!0,o+=1),h(x)}function h(x){return x===null?n(x):B(x)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):n(x):G(x)?Z(e,h,"whitespace")(x):(o+=1,a&&(a=!1,i+=1),x===124?(e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),c(x)))}function c(x){return x===null||x===124||ee(x)?(e.exit("data"),h(x)):(e.consume(x),x===92?f:c)}function f(x){return x===92||x===124?(e.consume(x),c):c(x)}function p(x){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(x):(e.enter("tableDelimiterRow"),a=!1,G(x)?Z(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):m(x))}function m(x){return x===45||x===58?v(x):x===124?(a=!0,e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),k):D(x)}function k(x){return G(x)?Z(e,v,"whitespace")(x):v(x)}function v(x){return x===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(x),e.exit("tableDelimiterMarker"),b):x===45?(o+=1,b(x)):x===null||B(x)?M(x):D(x)}function b(x){return x===45?(e.enter("tableDelimiterFiller"),E(x)):D(x)}function E(x){return x===45?(e.consume(x),E):x===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(x),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(x))}function T(x){return G(x)?Z(e,M,"whitespace")(x):M(x)}function M(x){return x===124?m(x):x===null||B(x)?!a||i!==o?D(x):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(x)):D(x)}function D(x){return n(x)}function w(x){return e.enter("tableRow"),R(x)}function R(x){return x===124?(e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),R):x===null||B(x)?(e.exit("tableRow"),t(x)):G(x)?Z(e,R,"whitespace")(x):(e.enter("data"),_(x))}function _(x){return x===null||x===124||ee(x)?(e.exit("data"),R(x)):(e.consume(x),x===92?F:_)}function F(x){return x===92||x===124?(e.consume(x),_):_(x)}}function th(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],s=!1,l=0,u,h,c;const f=new Qc;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(s=!1,l!==0&&(pr(f,t,l,u,h),h=void 0,l=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,c=void 0,o=[0,0,0,0],a=[0,n+1,0,0],s&&(s=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",h,t]])),i=m.type==="tableDelimiterRow"?2:h?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],c=dt(f,t,o,i,void 0,c),o=[0,0,0,0]),a[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],c=dt(f,t,o,i,void 0,c)),o=a,a=[o[1],n,0,0])):m.type==="tableHead"?(s=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,o[1]!==0?(a[0]=a[1],c=dt(f,t,o,i,n,c)):a[1]!==0&&(c=dt(f,t,a,i,n,c)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&pr(f,t,l,u,h),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=Kc(t.events,n))}return e}function dt(e,t,n,r,i,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(o.end=Object.assign({},qe(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const l=qe(t.events,n[1]);if(o={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const u=qe(t.events,n[2]),h=qe(t.events,n[3]),c={type:s,start:Object.assign({},u),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",c,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,k=n[3]-n[2]-1;e.add(m,k,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(o.end=Object.assign({},qe(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function pr(e,t,n,r,i){const o=[],a=qe(t.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function qe(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const nh={name:"tasklistCheck",tokenize:ih};function rh(){return{text:{91:nh}}}function ih(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),o)}function o(l){return ee(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(l)}function s(l){return B(l)?t(l):G(l)?e.check({tokenize:oh},t,n)(l):n(l)}}function oh(e,t,n){return Z(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function ah(e){return Dr([Lc(),Hc(),Jc(e),$c(),rh()])}const sh={};function lh(e){const t=this,n=e||sh,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(ah(n)),o.push(Ac()),a.push(Ic(n))}const ki="https://www.tiagpctest.softiabot.com",wi={BOTTOM_RIGHT:"bottom-right",BOTTOM_LEFT:"bottom-left",TOP_RIGHT:"top-right",TOP_LEFT:"top-left"},vi={LIGHT:"light",DARK:"dark",AUTO:"auto"},Ci={SPANISH:"es",ENGLISH:"en",FRANCES:"fr"},uh={MOBILE:640},Le={theme:vi.AUTO,position:wi.BOTTOM_RIGHT,language:Ci.ENGLISH,width:"400px",height:"600px",autoOpen:!1,showBranding:!0,mobileFullscreen:!0},ch={API_REQUEST:3e4},fr={MAX_LENGTH:2e3},hh=()=>window.innerWidth<uh.MOBILE,ph=e=>{try{return new Date(e).toLocaleTimeString("es-ES",{hour:"2-digit",minute:"2-digit"})}catch{return""}},fh=e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`,Wt=()=>crypto.randomUUID(),dh=()=>window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",mh=e=>e.trim().slice(0,2e3),gh=()=>{const{t:e}=ce.useTranslation();return d.jsxs("div",{className:"gpc-typing-indicator",role:"status","aria-label":e("ui.typingIndicator.typing"),children:[d.jsx("span",{className:"gpc-typing-dot"}),d.jsx("span",{className:"gpc-typing-dot"}),d.jsx("span",{className:"gpc-typing-dot"})]})},yh=({message:e,showMetadata:t=!1,messageRef:n=null})=>{const{t:r}=ce.useTranslation(),i=e.role==="user",o=!i&&e.isStreaming&&!e.content,[a,s]=A.useState(!1),l=async u=>{u.preventDefault(),u.stopPropagation();try{await navigator.clipboard.writeText(e.content),s(!0),setTimeout(()=>s(!1),2e3)}catch(h){console.error("Error al copiar:",h)}};return d.jsxs("div",{ref:n,className:`gpc-message ${i?"gpc-message-user":"gpc-message-assistant"}`,role:"article","aria-label":r(i?"ui.message.userMessage":"ui.message.assistantMessage"),children:[d.jsx("div",{className:"gpc-message-content",children:o?d.jsx(gh,{}):i?e.content.trim():d.jsx(Jl,{remarkPlugins:[lh],components:{a:({node:u,...h})=>d.jsx("a",{target:"_blank",rel:"noopener noreferrer",...h}),table:({node:u,...h})=>d.jsx("div",{className:"gpc-table-wrapper",children:d.jsx("table",{className:"gpc-table",...h})}),thead:({node:u,...h})=>d.jsx("thead",{className:"gpc-table-head",...h}),tbody:({node:u,...h})=>d.jsx("tbody",{className:"gpc-table-body",...h}),tr:({node:u,...h})=>d.jsx("tr",{className:"gpc-table-row",...h}),th:({node:u,...h})=>d.jsx("th",{className:"gpc-table-header",...h}),td:({node:u,...h})=>d.jsx("td",{className:"gpc-table-cell",...h})},children:e.content})}),d.jsxs("div",{className:`gpc-message-timestamp ${i?"gpc-message-timestamp-user":""}`,children:[!i&&e.metadata?.modelUsed&&d.jsx("span",{className:"gpc-model-badge",children:e.metadata.modelUsed}),d.jsxs("span",{className:"gpc-timestamp-right",children:[d.jsx("span",{children:ph(e.timestamp)}),!o&&e.content&&d.jsx("button",{type:"button",onClick:l,className:"gpc-copy-button","aria-label":a?"Copiado":"Copiar mensaje",children:a?d.jsx(ie.Check,{size:14}):d.jsx(ie.Copy,{size:14})})]})]}),!i&&t&&e.metadata&&d.jsxs("div",{className:"gpc-message-metadata",children:[e.metadata.tokensUsed&&d.jsxs("div",{className:"gpc-metadata-item",children:[d.jsxs("strong",{children:[r("metadata.tokensUsed"),":"]})," ",e.metadata.tokensUsed]}),e.metadata.responseTimeMs&&d.jsxs("div",{className:"gpc-metadata-item",children:[d.jsxs("strong",{children:[r("metadata.responseTime"),":"]})," ",fh(e.metadata.responseTimeMs)]}),e.metadata.modelUsed&&d.jsxs("div",{className:"gpc-metadata-item",children:[d.jsxs("strong",{children:[r("metadata.model"),":"]})," ",e.metadata.modelUsed]})]})]})},xh=({messages:e,isLoading:t,showMetadata:n=!1,widgetConfig:r=null,hasMoreMessages:i=!1,isLoadingMoreMessages:o=!1,onLoadMoreMessages:a=null})=>{const{t:s}=ce.useTranslation(),l=A.useRef(null),u=A.useRef(null),h=A.useRef(0),c=A.useRef(!1),f=A.useRef(null),p=A.useRef(null),m=A.useRef(0);A.useLayoutEffect(()=>{e.length>0&&!c.current&&(l.current?.scrollIntoView({behavior:"instant"}),c.current=!0,h.current=e.length)},[e.length]),A.useEffect(()=>{if(!a)return;const M=new IntersectionObserver(D=>{D[0].isIntersecting&&i&&!o&&(f.current&&(m.current=f.current.scrollHeight),a())},{threshold:1});return p.current&&M.observe(p.current),()=>{p.current&&M.unobserve(p.current)}},[i,o,a]),A.useEffect(()=>{if(o===!1&&m.current>0&&f.current){const D=f.current.scrollHeight-m.current;f.current.scrollTop=D,m.current=0}},[o]),A.useEffect(()=>{const M=e.length,D=h.current,w=e[M-1],R=M>D+1;M>0&&c.current&&(R?setTimeout(()=>{l.current?.scrollIntoView({behavior:"instant"})},150):M>D&&w&&(w.role==="user"?l.current?.scrollIntoView({behavior:"smooth"}):w.role==="assistant"&&w.isStreaming&&setTimeout(()=>{u.current?.scrollIntoView({behavior:"smooth",block:"start"})},100))),h.current=M},[e]);const k=r?.widget_customization?.branding?.company_name||"TIA GPC",v=r?.widget_customization?.branding?.company_logo_base64,b=r?.widget_customization?.welcome_message,E=v?.startsWith("data:")?v:v?`data:image/png;base64,${v}`:null,T=b||s("chat.welcome",{companyName:k});return e.length===0&&!t?d.jsx("div",{className:"gpc-messages-container",children:d.jsxs("div",{className:"gpc-empty-state",children:[E?d.jsx("div",{className:"gpc-welcome-logo",children:d.jsx("img",{src:E,alt:k,className:"gpc-welcome-company-logo"})}):d.jsx(ie.MessageSquare,{className:"gpc-empty-icon"}),d.jsx("h3",{className:"gpc-empty-title",children:T}),d.jsx("p",{className:"gpc-empty-text",children:s("chat.emptyState")})]})}):d.jsxs("div",{ref:f,className:"gpc-messages-container gpc-scrollbar gpc-smooth-scroll",children:[i&&d.jsx("div",{style:{textAlign:"center",padding:"10px"},children:o?d.jsxs("div",{className:"gpc-loading-more-messages",children:[d.jsx("div",{className:"gpc-loading-spinner"}),d.jsx("span",{children:s("chat.loadingMore","Loading older messages...")})]}):d.jsx("div",{ref:p,style:{height:"1px"}})}),e.map((M,D)=>d.jsx(yh,{message:M,showMetadata:n,messageRef:D===e.length-1?u:null},M.id)),d.jsx("div",{ref:l})]})},bh=1.2,kh=2e3,wh=({onTranscript:e,isLoading:t,disabled:n,onRecordingStateChange:r,onAnalyserChange:i})=>{const{t:o}=ce.useTranslation(),[a,s]=A.useState(!1),[l,u]=A.useState(!1),h=A.useRef(null),c=A.useRef([]),f=A.useRef(null),p=A.useRef(null),m=A.useRef(null),k=A.useRef(null),v=A.useRef(null);A.useEffect(()=>()=>{h.current?.state==="recording"&&h.current.stop(),f.current&&f.current.state!=="closed"&&f.current.close(),v.current&&clearInterval(v.current)},[]),A.useEffect(()=>{r&&r(a||l)},[a,l,r]),A.useEffect(()=>{i&&i(p.current)},[p.current,i]);const b=()=>{if(!p.current||!m.current)return;p.current.getByteTimeDomainData(m.current);let R=0;for(let x=0;x<m.current.length;x++){const C=(m.current[x]-128)/128;R+=C*C}if(Math.sqrt(R/m.current.length)*100<bh){if(k.current||(k.current=Date.now()),Date.now()-k.current>kh){T();return}}else k.current=null},E=async()=>{try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){alert(o("voice.unsupported"));return}const R=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:48e3,channelCount:1}});f.current=new(window.AudioContext||window.webkitAudioContext),p.current=f.current.createAnalyser(),f.current.createMediaStreamSource(R).connect(p.current),p.current.fftSize=1024,p.current.smoothingTimeConstant=.4,p.current.minDecibels=-85,p.current.maxDecibels=-15;const F=p.current.frequencyBinCount;m.current=new Uint8Array(F);const x=new MediaRecorder(R,{mimeType:"audio/webm;codecs=opus"});h.current=x,c.current=[],k.current=null,x.ondataavailable=C=>{C.data.size>0&&c.current.push(C.data)},x.onstop=async()=>{if(v.current&&(clearInterval(v.current),v.current=null),f.current&&f.current.state!=="closed"&&f.current.close(),k.current=null,c.current.length===0){console.warn("No audio data recorded");return}const C=new Blob(c.current,{type:"audio/webm"});u(!0);try{await e(C)}catch(z){console.error("Transcription error:",z),alert(o("voice.error"))}finally{u(!1),c.current=[]}},x.start(100),s(!0),v.current=setInterval(()=>{b()},100)}catch(R){console.error("Error accessing microphone:",R),R.name==="NotAllowedError"||R.name==="PermissionDeniedError"?alert(o("voice.permissionDenied")):alert(o("voice.unsupported"))}},T=()=>{!a&&h.current?.state!=="recording"||(h.current&&h.current.state==="recording"&&h.current.stop(),v.current&&(clearInterval(v.current),v.current=null),k.current=null,s(!1),h.current&&h.current.stream&&h.current.stream.getTracks().forEach(R=>R.stop()))},M=R=>{R.preventDefault(),R.stopPropagation(),a?T():E()},D=n||t||l,w=o(l?"voice.processing":a?"voice.stop":"voice.record");return d.jsx("button",{type:"button",onClick:M,disabled:D,className:`gpc-voice-button ${a?"gpc-voice-recording":""}`,"aria-label":w,title:w,children:l?d.jsx("span",{className:"gpc-spinner"}):a?d.jsx(ie.MicOff,{className:"gpc-icon gpc-voice-icon-active"}):d.jsx(ie.Mic,{className:"gpc-icon"})})},vh=({analyser:e,isRecording:t})=>{const n=A.useRef(null),r=A.useRef(null);return A.useEffect(()=>{if(!t||!e||!n.current)return;const i=n.current,o=i.getContext("2d"),a=e.frequencyBinCount,s=new Uint8Array(a),l=window.devicePixelRatio||1,u=i.getBoundingClientRect();i.width=u.width*l,i.height=u.height*l,o.scale(l,l);const h=u.width,c=u.height,f=40,p=3,m=2,k=()=>{if(!t)return;r.current=requestAnimationFrame(k),e.getByteFrequencyData(s),o.clearRect(0,0,h,c);const v=f*(p+m),b=(h-v)/2;for(let E=0;E<f;E++){const T=Math.floor(E*a/f),D=s[T]/255,w=Math.max(2,D*c*.8),R=b+E*(p+m),_=(c-w)/2,F=o.createLinearGradient(0,_,0,_+w);F.addColorStop(0,"rgba(59, 130, 246, 0.8)"),F.addColorStop(1,"rgba(96, 165, 250, 0.6)"),o.fillStyle=F,o.fillRect(R,_,p,w)}};return k(),()=>{r.current&&cancelAnimationFrame(r.current)}},[e,t]),t?d.jsx("div",{className:"gpc-audio-waveform-container",children:d.jsx("canvas",{ref:n,className:"gpc-audio-waveform-canvas","aria-label":"Audio waveform visualization"})}):null},Ch=({onSendMessage:e,isLoading:t,disabled:n,gpcService:r,showBranding:i=!0})=>{const{t:o}=ce.useTranslation(),[a,s]=A.useState(""),[l,u]=A.useState(!1),[h,c]=A.useState(null),f=A.useRef(null);A.useEffect(()=>{!n&&!t&&!l&&f.current?.focus()},[n,t,l]),A.useEffect(()=>{f.current&&(f.current.style.height="auto",f.current.style.height=`${Math.min(f.current.scrollHeight,120)}px`)},[a]);const p=async D=>{D.preventDefault();const w=mh(a);if(!(!w||t||n||l))try{await e(w),s(""),f.current&&(f.current.style.height="auto")}catch(R){console.error("Error sending message:",R)}},m=D=>{D.key==="Enter"&&!D.shiftKey&&!l&&(D.preventDefault(),p(D))},k=async D=>{if(!r)throw new Error(o("toast.gpcServiceNotAvailable"));const w=await r.transcribeAudio(D);w.success&&w.text&&(s(w.text),f.current?.focus())},v=D=>{u(D)},b=D=>{c(D)},E=a.trim().length>0&&!t&&!n&&!l,T=t||n||l,M=n||a.trim().length>0;return d.jsxs("form",{onSubmit:p,className:"gpc-input-container",children:[d.jsxs("div",{className:"gpc-input-wrapper",children:[d.jsx("textarea",{ref:f,value:a,onChange:D=>s(D.target.value),onKeyDown:m,placeholder:l?"":o("chat.placeholder"),disabled:T,maxLength:fr.MAX_LENGTH,className:`gpc-input gpc-textarea ${l?"gpc-input-recording":""}`,"aria-label":o("chat.placeholder"),"aria-describedby":"chat-input-help",rows:1}),d.jsx(vh,{analyser:h,isRecording:l})]}),d.jsxs("div",{className:"gpc-input-actions-right",children:[d.jsx(wh,{onTranscript:k,isLoading:t,disabled:M,onRecordingStateChange:v,onAnalyserChange:b}),d.jsx("button",{type:"submit",disabled:!E,className:"gpc-send-button","aria-label":o("chat.send"),title:o("chat.send"),children:t?d.jsx("span",{className:"gpc-spinner"}):d.jsx(ie.Send,{className:"gpc-icon"})})]}),d.jsxs("div",{className:"gpc-footer-container",children:[d.jsx("span",{className:"gpc-ai-disclaimer",children:o("chat.aiDisclaimer")}),i&&d.jsx("span",{className:"gpc-powered-by",children:o("widget.poweredBy")})]}),d.jsxs("span",{id:"chat-input-help",className:"gpc-sr-only",children:[o("chat.placeholder"),"."," ",o("input.maxCharacters",{count:fr.MAX_LENGTH})]})]})},Sh=({isOpen:e,onClose:t,onConfirm:n,message:r,confirmText:i,cancelText:o,variant:a="danger"})=>{const{t:s}=ce.useTranslation();if(!e)return null;const l=h=>{h.preventDefault(),h.stopPropagation(),n(),t()},u=h=>{h.preventDefault(),h.stopPropagation(),t()};return d.jsx("div",{className:"gpc-confirm-toast-container gpc-animate-slide-down",children:d.jsxs("div",{className:`gpc-confirm-toast ${a==="danger"?"gpc-confirm-toast-danger":""}`,children:[d.jsx("p",{className:"gpc-confirm-toast-message",children:r}),d.jsxs("div",{className:"gpc-confirm-toast-actions",children:[d.jsx("button",{type:"button",onClick:u,className:"gpc-confirm-toast-button gpc-confirm-toast-button-cancel gpc-focus-visible gpc-transition",children:o||s("conversations.cancel","Cancel")}),d.jsx("button",{type:"button",onClick:l,className:"gpc-confirm-toast-button gpc-confirm-toast-button-confirm gpc-focus-visible gpc-transition",children:i||s("conversations.delete","Delete")})]})]})})},Eh=({conversations:e,totalConversations:t,currentConversationId:n,onSelectConversation:r,onNewConversation:i,onRenameConversation:o,onDeleteConversation:a,isLoadingHistory:s,hasMoreConversations:l,isLoadingMoreConversations:u,onLoadMore:h})=>{const{t:c}=ce.useTranslation(),f=A.useRef(null),[p,m]=A.useState(null),[k,v]=A.useState(""),[b,E]=A.useState({isOpen:!1,id:null,title:""});A.useEffect(()=>{const x=new IntersectionObserver(C=>{C[0].isIntersecting&&l&&!u&&!s&&h()},{threshold:1});return f.current&&x.observe(f.current),()=>{f.current&&x.unobserve(f.current)}},[l,u,s,h]);const T=x=>{const C=new Date(x),j=new Date-C,N=Math.floor(j/6e4),L=Math.floor(j/36e5),W=Math.floor(j/864e5);return N<1?c("time.justNow","Just now"):N<60?c("time.minutesAgo",`${N} min ago`,{count:N}):L<24?c("time.hoursAgo",`${L}h ago`,{count:L}):W<7?c("time.daysAgo",`${W}d ago`,{count:W}):C.toLocaleDateString()},M=x=>{m(x.conversation_id),v(x.title||"")},D=()=>{m(null),v("")},w=x=>{k.trim()&&o&&(o(x,k.trim()),m(null),v(""))},R=(x,C)=>{E({isOpen:!0,id:x,title:C||c("conversations.untitled","Untitled conversation")})},_=()=>{b.id&&a&&a(b.id),E({isOpen:!1,id:null,title:""})},F=()=>{E({isOpen:!1,id:null,title:""})};return d.jsxs("div",{className:"gpc-conversations-container",children:[d.jsxs("div",{className:"gpc-conversations-header",children:[d.jsx("h3",{className:"gpc-conversations-title",children:c("conversations.title","Conversations")}),d.jsxs("button",{type:"button",onClick:x=>{x.preventDefault(),x.stopPropagation(),i()},className:"gpc-new-conversation-button gpc-focus-visible gpc-transition",disabled:s,"aria-label":c("conversations.new","New"),children:[d.jsx(ie.MessageSquare,{size:16}),d.jsx("span",{children:c("conversations.new","New")})]})]}),d.jsx("div",{className:"gpc-conversations-list",children:e.length===0?d.jsxs("div",{className:"gpc-conversations-empty",children:[d.jsx(ie.MessageSquare,{size:48,className:"gpc-conversations-empty-icon"}),d.jsx("p",{className:"gpc-conversations-empty-text",children:c("conversations.empty","No conversations yet")}),d.jsx("p",{className:"gpc-conversations-empty-hint",children:c("conversations.emptyHint","Start a conversation to see it here")})]}):d.jsxs("div",{className:"gpc-conversations-items",children:[e.map(x=>d.jsx("div",{className:`gpc-conversation-item gpc-animate-fade-in ${n===x.conversation_id?"gpc-conversation-item-active":""} ${s?"gpc-conversation-item-disabled":""}`,children:d.jsx("div",{className:"gpc-conversation-content gpc-transition",onClick:()=>p!==x.conversation_id&&!s&&r(x.conversation_id),children:p===x.conversation_id?d.jsxs("div",{className:"gpc-conversation-edit",children:[d.jsx("input",{type:"text",value:k,onChange:C=>v(C.target.value),onKeyDown:C=>{C.key==="Enter"&&w(x.conversation_id),C.key==="Escape"&&D()},className:"gpc-conversation-edit-input gpc-focus-visible",placeholder:c("conversations.untitled","Untitled conversation"),autoFocus:!0,maxLength:200}),d.jsxs("div",{className:"gpc-conversation-edit-actions",children:[d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),w(x.conversation_id)},className:"gpc-conversation-action-button gpc-conversation-action-save gpc-focus-visible gpc-transition",title:c("conversations.save","Save"),"aria-label":c("conversations.save","Save"),children:d.jsx(ie.Check,{size:16})}),d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),D()},className:"gpc-conversation-action-button gpc-conversation-action-cancel gpc-focus-visible gpc-transition",title:c("conversations.cancel","Cancel"),"aria-label":c("conversations.cancel","Cancel"),children:d.jsx(ie.X,{size:16})})]})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"gpc-conversation-header",children:[d.jsx("h4",{className:"gpc-conversation-title",children:x.title||c("conversations.untitled","Untitled conversation")}),d.jsxs("div",{className:"gpc-conversation-actions",children:[d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),M(x)},className:"gpc-conversation-action-button gpc-focus-visible gpc-transition",disabled:s,title:c("conversations.rename","Rename"),"aria-label":c("conversations.rename","Rename"),children:d.jsx(ie.Pencil,{size:16})}),d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),R(x.conversation_id,x.title||c("conversations.untitled","Untitled conversation"))},className:"gpc-conversation-action-button gpc-conversation-action-delete gpc-focus-visible gpc-transition",disabled:s,title:c("conversations.delete","Delete"),"aria-label":c("conversations.delete","Delete"),children:d.jsx(ie.Trash2,{size:16})})]})]}),d.jsxs("div",{className:"gpc-conversation-metadata",children:[d.jsxs("div",{className:"gpc-conversation-meta-item",children:[d.jsx(ie.MessageSquare,{size:12}),d.jsx("span",{children:x.total_messages})]}),d.jsxs("div",{className:"gpc-conversation-meta-item",children:[d.jsx(ie.Clock,{size:12}),d.jsx("span",{children:T(x.last_modification_date)})]})]})]})})},x.conversation_id)),u&&d.jsxs("div",{className:"gpc-conversations-loading",children:[d.jsx("div",{className:"gpc-loading-spinner"}),d.jsx("span",{children:c("conversations.loadingMore","Loading more...")})]}),l&&!u&&d.jsx("div",{ref:f,style:{height:"1px"}})]})}),d.jsx(Sh,{isOpen:b.isOpen,onClose:F,onConfirm:_,message:c("conversations.confirmDelete",{title:b.title,defaultValue:`Delete "${b.title}"?`}),confirmText:c("conversations.delete","Delete"),cancelText:c("conversations.cancel","Cancel"),variant:"danger"})]})},Th="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOsAAADJCAYAAADCbsXoAAABN2lDQ1BBZG9iZSBSR0IgKDE5OTgpAAAokZWPv0rDUBSHvxtFxaFWCOLgcCdRUGzVwYxJW4ogWKtDkq1JQ5ViEm6uf/oQjm4dXNx9AidHwUHxCXwDxamDQ4QMBYvf9J3fORzOAaNi152GUYbzWKt205Gu58vZF2aYAoBOmKV2q3UAECdxxBjf7wiA10277jTG+38yH6ZKAyNguxtlIYgK0L/SqQYxBMygn2oQD4CpTto1EE9AqZf7G1AKcv8ASsr1fBBfgNlzPR+MOcAMcl8BTB1da4Bakg7UWe9Uy6plWdLuJkEkjweZjs4zuR+HiUoT1dFRF8jvA2AxH2w3HblWtay99X/+PRHX82Vun0cIQCw9F1lBeKEuf1UYO5PrYsdwGQ7vYXpUZLs3cLcBC7dFtlqF8hY8Dn8AwMZP/fNTP8gAAAAJcEhZcwAACxMAAAsTAQCanBgAAAa9aVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA2LjAtYzAwNSA3OS4xNjQ1OTAsIDIwMjAvMTIvMDktMTE6NTc6NDQgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi4xIChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjUtMDctMDlUMTg6Mzc6MjAtMDU6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDI1LTA3LTEwVDE3OjA4OjU3LTA1OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDI1LTA3LTEwVDE3OjA4OjU3LTA1OjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgcGhvdG9zaG9wOklDQ1Byb2ZpbGU9IkFkb2JlIFJHQiAoMTk5OCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OGNiZjk1NDQtOTNkOC0xZTQzLWJkYTItYzFmNTc2NjA3NGNjIiB4bXBNTTpEb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6OTU2MTBmYjUtNTU3NS1mNTQ1LWFmOGEtZDM0YTlmMjI4NTUwIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6NGEzMmM4MDMtZDA2YS0yYjRiLWI1YzEtZDA1ZWQ3MzFhYTlkIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo0YTMyYzgwMy1kMDZhLTJiNGItYjVjMS1kMDVlZDczMWFhOWQiIHN0RXZ0OndoZW49IjIwMjUtMDctMDlUMTg6Mzc6MjAtMDU6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyMi4xIChXaW5kb3dzKSIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MjE0MzlhOTgtOWNkNS1lYzRjLWFhNjAtZjgxNGNmZWVlNmNkIiBzdEV2dDp3aGVuPSIyMDI1LTA3LTA5VDE4OjU0OjE4LTA1OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjIuMSAoV2luZG93cykiIHN0RXZ0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",Ah=({version:e=ot})=>{const{t}=ce.useTranslation();return d.jsxs("div",{className:"gpc-conversations-container",children:[d.jsx("div",{className:"gpc-conversations-header",children:d.jsx("h3",{className:"gpc-conversations-title",children:t("about.title")})}),d.jsxs("div",{className:"gpc-about-panel-content",children:[d.jsx("div",{className:"gpc-about-panel-logo",children:d.jsx("img",{src:Th,alt:"TIA GPC Logo",className:"gpc-about-panel-icon",style:{width:"80px",height:"auto"}})}),d.jsxs("div",{className:"gpc-about-panel-items",children:[d.jsxs("div",{className:"gpc-about-panel-item",children:[d.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.product"),":"]}),d.jsx("span",{className:"gpc-about-panel-value",children:"TIA GPC"}),d.jsx("a",{href:"https://www.softiabot.com",target:"_blank",rel:"noopener noreferrer",className:"gpc-about-panel-link",children:"www.softiabot.com"})]}),d.jsxs("div",{className:"gpc-about-panel-item",children:[d.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.version"),":"]}),d.jsx("span",{className:"gpc-about-panel-value",children:e})]}),d.jsxs("div",{className:"gpc-about-panel-item",children:[d.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.creator"),":"]}),d.jsx("span",{className:"gpc-about-panel-value",children:"SOFTIA Technologies Inc."}),d.jsx("a",{href:"https://www.softia.ca",target:"_blank",rel:"noopener noreferrer",className:"gpc-about-panel-link",children:"Softia.ca"})]}),d.jsx("div",{className:"gpc-about-panel-footer",children:d.jsx("p",{className:"gpc-about-panel-rights",children:t("about.rights")})})]})]})]})},Ih=(e,t)=>{const{t:n}=ce.useTranslation(),[r,i]=A.useState([]),[o,a]=A.useState(!1),[s,l]=A.useState(null),[u,h]=A.useState(null),[c,f]=A.useState([]),[p,m]=A.useState(0),[k,v]=A.useState(!1),[b,E]=A.useState(!0),[T,M]=A.useState(0),[D,w]=A.useState(!0),[R,_]=A.useState(!1),[F,x]=A.useState(0),[C,z]=A.useState(!1),[j,N]=A.useState(!1),L=A.useCallback(async O=>{if(!O.trim()||o)return;const H={id:Wt(),role:"user",content:O.trim(),timestamp:new Date().toISOString()};i(K=>[...K,H]),a(!0),l(null);const V=Wt(),J={id:V,role:"assistant",content:"",timestamp:new Date().toISOString(),isStreaming:!0};i(K=>[...K,J]);try{const K=await e.sendMessage(O,X=>{i(re=>re.map(Ee=>Ee.id===V?{...Ee,content:Ee.content+X}:Ee))},u);i(X=>X.map(re=>re.id===V?{id:K.data.message_id,role:"assistant",content:K.data.response,timestamp:K.data.created_at,isStreaming:!1,metadata:{responseTimeMs:K.data.response_time_ms,modelUsed:K.data.model_used}}:re)),K.data.conversation_id&&h(K.data.conversation_id),ne()}catch(K){i(_e=>_e.filter(ct=>ct.id!==V));let X;try{X=JSON.parse(K.message)}catch{X={statusCode:500,message:K.message}}let re;const Ee=X.statusCode||500,ze=X.errorCode||"";switch(Ee===401&&ze==="SESSION_EXPIRED"&&(re=n("toast.sessionExpired"),t&&t()),Ee){case 401:re||(re=n("errors.unauthorized"));break;case 402:re=n("errors.insufficientCredits");break;case 403:ze.includes("DOMAIN")||ze.includes("UNAUTHORIZED")?re=n("errors.domainUnauthorized"):re=n("errors.validation");break;case 422:ze==="LOW_RELEVANCE_SCORE"&&X.message?re=X.message:re=n("errors.noKnowledgeAvailable");break;case 429:re=n("errors.rateLimit");break;case 503:case 502:case 504:re=n("errors.aiServiceUnavailable");break;case 500:re=n("errors.serverError");break;default:re=n("errors.generic")}l(re),ze!=="LOW_RELEVANCE_SCORE"&&Ie.error(re,{duration:4e3,position:"top-center"});const ut={id:Wt(),role:"assistant",content:re,timestamp:new Date().toISOString()};i(_e=>[..._e,ut])}finally{a(!1)}},[e,o,n,t,u]),W=A.useCallback(()=>{i([]),l(null)},[]),Q=A.useCallback(()=>{l(null)},[]),oe=A.useCallback(async(O,H=!0)=>{if(!(!e||!O)){v(!0);try{const V=H?0:F,J=await e.getConversationHistory(O,50,V);if(J.success&&J.data.messages){const K=J.data.messages.flatMap(X=>[{id:`${X.message_id}-question`,role:"user",content:X.question,timestamp:X.creation_date},{id:X.message_id,role:"assistant",content:X.answer,timestamp:X.creation_date,metadata:{modelUsed:X.model}}]);H?(i(K),x(J.data.count)):(i(X=>[...K,...X]),x(X=>X+J.data.count)),z(J.data.has_more),h(O)}}catch(V){console.error("Error loading conversation history:",V),Ie.error(n("toast.failedLoadHistory"))}finally{v(!1)}}},[e,n,F]),ne=A.useCallback(async(O=!0)=>{if(e)try{const H=O?0:T,V=await e.listConversations(20,H);V.success&&V.data.conversations&&(O?(f(V.data.conversations),M(V.data.count)):(f(J=>[...J,...V.data.conversations]),M(J=>J+V.data.count)),w(V.data.has_more),m(V.data.total||0))}catch(H){console.error("Error loading conversations:",H)}},[e,T]),g=A.useCallback(async()=>{if(!(!e||R||!D)){_(!0);try{await ne(!1)}finally{_(!1)}}},[e,R,D,ne]),le=A.useCallback(async()=>{if(!(!e||!u||j||!C)){N(!0);try{await oe(u,!1)}finally{N(!1)}}},[e,u,j,C,oe]),pe=A.useCallback(()=>{i([]),h(null),l(null),e&&e.clearLastConversation(),Ie.success(n("toast.newConversationStarted"))},[n,e]),y=A.useCallback(async O=>{await oe(O)},[oe]),se=A.useCallback(async(O,H)=>{if(e)try{await e.updateConversationTitle(O,H),await ne(!0),Ie.success(n("toast.conversationRenamed"))}catch(V){console.error("Error renaming conversation:",V),Ie.error(n("toast.failedRenameConversation"))}},[e,ne,n]),ge=A.useCallback(async O=>{if(e)try{await e.deleteConversation(O),O===u&&(i([]),h(null)),await ne(!0),Ie.success(n("toast.conversationDeleted"))}catch(H){console.error("Error deleting conversation:",H),Ie.error(n("toast.failedDeleteConversation"))}},[e,u,ne,n]);return A.useEffect(()=>{(async()=>{if(!e){E(!1);return}try{const H=e.getLastConversation();H&&(i(H.messages),h(H.conversationId))}catch(H){console.error("[TIA GPC] Error restaurando conversación:",H)}finally{E(!1)}})()},[e]),A.useEffect(()=>{e&&!b&&ne()},[e,ne,b]),A.useEffect(()=>{e&&r.length>0&&!b&&e.saveLastConversation(u,r)},[e,r,u,b]),{messages:r,isLoading:o,error:s,sendMessage:L,clearMessages:W,clearError:Q,currentConversationId:u,conversations:c,totalConversations:p,isLoadingHistory:k,loadConversationHistory:oe,loadConversations:ne,startNewConversation:pe,switchConversation:y,renameConversation:se,deleteConversation:ge,isRestoringConversation:b,hasMoreConversations:D,isLoadingMoreConversations:R,loadMoreConversations:g,hasMoreMessages:C,isLoadingMoreMessages:j,loadMoreMessages:le}},Nh=({gpcService:e,licenseToken:t,widgetConfig:n,onClose:r,themeMode:i,onToggleTheme:o,showBranding:a=!0,showMetadata:s=!1,onError:l,version:u=ot,onRequestMcpLogin:h,mcpLoggedIn:c=!1})=>{const{t:f}=ce.useTranslation(),[p,m]=A.useState(!1),[k,v]=A.useState(!1),b=n?.mcp?.enabled&&n?.mcp?.auth_mode==="credentials",E=i,T=o,M=A.useCallback(()=>{},[]),{messages:D,isLoading:w,sendMessage:R,currentConversationId:_,conversations:F,totalConversations:x,isLoadingHistory:C,startNewConversation:z,switchConversation:j,renameConversation:N,deleteConversation:L,isRestoringConversation:W,hasMoreConversations:Q,isLoadingMoreConversations:oe,loadMoreConversations:ne,hasMoreMessages:g,isLoadingMoreMessages:le,loadMoreMessages:pe}=Ih(e,M),y=A.useCallback(()=>{m(J=>!J),v(!1)},[]),se=A.useCallback(()=>{v(J=>!J),m(!1)},[]),ge=A.useCallback(()=>{h?.(c?"logout":"login")},[c,h]),O=A.useCallback(J=>{j(J),m(!1)},[j]),H=A.useCallback(()=>{z(),m(!1)},[z]);A.useEffect(()=>()=>{e&&e.releaseSession().catch(J=>{console.error("Failed to release session:",J)})},[e]);const V=d.jsx(Oi,{onClose:r,theme:E,onToggleTheme:T,showBranding:a,widgetConfig:n,onToggleConversations:y,showConversations:p,conversationsCount:x,onToggleAbout:se,showAbout:k,version:u,onToggleMcpLogin:b?ge:void 0,showMcpLogin:!1,mcpLoggedIn:c});return p||k?d.jsxs("div",{className:`gpc-chat-window gpc-animate-fade-in ${E==="dark"?"gpc-dark":""}`,children:[V,d.jsxs("div",{className:"gpc-conversations-overlay-body",children:[p&&d.jsx(Eh,{conversations:F,totalConversations:x,currentConversationId:_,onSelectConversation:O,onNewConversation:H,onRenameConversation:N,onDeleteConversation:L,isLoadingHistory:C,hasMoreConversations:Q,isLoadingMoreConversations:oe,onLoadMore:ne}),k&&d.jsx(Ah,{version:u})]}),d.jsx(Ie.Toaster,{position:"top-center"})]}):d.jsxs("div",{className:`gpc-chat-window gpc-animate-fade-in ${E==="dark"?"gpc-dark":""}`,children:[V,d.jsx(xh,{messages:D,isLoading:w||C||W,showMetadata:s,widgetConfig:n,hasMoreMessages:g,isLoadingMoreMessages:le,onLoadMoreMessages:pe}),d.jsx(Ch,{onSendMessage:R,isLoading:w||W,disabled:W,gpcService:e,showBranding:a}),d.jsx(Ie.Toaster,{position:"top-center"})]})},Dh=({gpcService:e,mcpConfig:t,onSuccess:n,onSkip:r,onError:i})=>{const{t:o}=ce.useTranslation(),[a,s]=A.useState(null),[l,u]=A.useState(null),[h,c]=A.useState(""),[f,p]=A.useState(""),[m,k]=A.useState(!1),[v,b]=A.useState(!0),[E,T]=A.useState(null),[M,D]=A.useState("captcha"),[w,R]=A.useState({}),_=t?.enabled&&t?.auth_mode==="credentials",F=t?.login_fields?.length?t.login_fields:[{key:"username",label:"Usuario",type:"text"},{key:"password",label:"Contraseña",type:"password"}];A.useEffect(()=>{const N=localStorage.getItem(Pe.VERIFIED),L=localStorage.getItem(Pe.TIMESTAMP),W=N==="true"&&L&&Date.now()-parseInt(L,10)<dr;_&&W?(D("mcp"),b(!1)):x()},[]);const x=async()=>{b(!0),p(""),c("");try{const N=await e.generateCaptchaChallenge();if(N.success&&N.challenge_id)s(N.question),u(N.challenge_id);else throw new Error("Failed to generate challenge")}catch(N){p(o("captcha.errorGenerating","Error generating challenge. Please try again.")),i&&i(N)}finally{b(!1)}},C=async N=>{N.preventDefault(),p(""),k(!0);try{const L=parseInt(h,10);if(isNaN(L)){p(o("captcha.invalidNumber")),k(!1);return}const W=await e.verifyCaptchaAnswer(l,L);if(W.success)localStorage.setItem(Pe.VERIFIED,"true"),localStorage.setItem(Pe.TIMESTAMP,Date.now().toString()),_?D("mcp"):n&&n();else{const Q=W.attempts_remaining;T(Q),Q!==void 0&&Q>0?p(o("captcha.incorrectAnswerWithAttempts",{attempts:Q,defaultValue:"Incorrect answer. {{attempts}} attempts remaining"})):p(o("captcha.incorrectAnswer")),c(""),k(!1)}}catch(L){switch(L.error_code){case"CHALLENGE_NOT_FOUND":case"CHALLENGE_EXPIRED":p(o("captcha.challengeExpired","Challenge expired. Generating a new one...")),setTimeout(()=>x(),2e3);break;case"MAX_ATTEMPTS_EXCEEDED":p(o("captcha.maxAttemptsExceeded","Maximum attempts exceeded. Generating a new challenge...")),setTimeout(()=>x(),2e3);break;case"INVALID_SESSION":p(o("captcha.invalidSession","Invalid session. Please refresh the page."));break;default:p(o("captcha.error"))}k(!1),i&&i(L)}},z=N=>{const L=N.target.value;(L===""||/^\d+$/.test(L))&&(c(L),p(""))},j=N=>{if(N.preventDefault(),!F.every(W=>w[W.key]?.trim())){p(o("moodle.requiredFields"));return}sessionStorage.setItem("mcp_login_data",JSON.stringify(w)),n&&n()};if(M==="mcp"){const N=t?.display_name||o("moodle.title");return d.jsx("div",{className:"gpc-captcha-container",children:d.jsxs("div",{className:"gpc-captcha-content",children:[d.jsxs("div",{className:"gpc-captcha-header",children:[d.jsx("svg",{className:"gpc-captcha-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),d.jsx("h3",{className:"gpc-captcha-title",children:N}),d.jsx("p",{className:"gpc-captcha-subtitle",children:o("moodle.subtitle")})]}),d.jsxs("form",{onSubmit:j,className:"gpc-captcha-form",children:[d.jsx("div",{className:"gpc-captcha-fields-scroll",children:F.map((L,W)=>d.jsxs("div",{className:"gpc-captcha-question",children:[d.jsx("label",{className:"gpc-captcha-label",children:L.label}),d.jsx("input",{type:L.type||"text",value:w[L.key]||"",onChange:Q=>{R(oe=>({...oe,[L.key]:Q.target.value})),p("")},className:"gpc-captcha-text-input",autoFocus:W===0,autoComplete:L.type==="password"?"current-password":L.key})]},L.key))}),f&&d.jsxs("div",{className:"gpc-captcha-error",children:[d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),d.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12",strokeWidth:2,strokeLinecap:"round"}),d.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16",strokeWidth:2,strokeLinecap:"round"})]}),d.jsx("span",{children:f})]}),d.jsx("button",{type:"submit",className:"gpc-captcha-button",disabled:!F.every(L=>w[L.key]?.trim()),children:o("moodle.submit")})]}),r&&d.jsx("button",{type:"button",className:"gpc-captcha-skip",onClick:r,children:o("moodle.skip")})]})})}return v||!a?d.jsxs("div",{className:"gpc-captcha-loading",children:[d.jsx("div",{className:"gpc-spinner"}),d.jsx("p",{children:o("captcha.loading","Loading challenge...")})]}):d.jsx("div",{className:"gpc-captcha-container",children:d.jsxs("div",{className:"gpc-captcha-content",children:[d.jsxs("div",{className:"gpc-captcha-header",children:[d.jsx("svg",{className:"gpc-captcha-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),d.jsx("h3",{className:"gpc-captcha-title",children:o("captcha.title")}),d.jsx("p",{className:"gpc-captcha-subtitle",children:o("captcha.subtitle")})]}),d.jsxs("form",{onSubmit:C,className:"gpc-captcha-form",children:[d.jsxs("div",{className:"gpc-captcha-question",children:[d.jsx("label",{htmlFor:"captcha-answer",className:"gpc-captcha-label",children:o("captcha.question")}),d.jsxs("div",{className:"gpc-captcha-challenge",children:[d.jsx("span",{className:"gpc-captcha-math",children:a}),d.jsx("span",{className:"gpc-captcha-equals",children:"="}),d.jsx("input",{id:"captcha-answer",type:"text",inputMode:"numeric",pattern:"[0-9]*",value:h,onChange:z,placeholder:"?",className:`gpc-captcha-input ${f?"gpc-captcha-input-error":""}`,disabled:m,autoFocus:!0,autoComplete:"off"})]})]}),f&&d.jsxs("div",{className:"gpc-captcha-error",children:[d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),d.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12",strokeWidth:2,strokeLinecap:"round"}),d.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16",strokeWidth:2,strokeLinecap:"round"})]}),d.jsx("span",{children:f})]}),E!==null&&E>0&&d.jsx("div",{className:"gpc-captcha-attempts",children:o("captcha.attemptsLeft",{count:E,defaultValue:"{{count}} attempts remaining"})}),d.jsx("button",{type:"submit",className:"gpc-captcha-button",disabled:m||!h,children:m?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"gpc-spinner gpc-button-spinner"}),o("captcha.verifying")]}):o("captcha.verify")})]}),d.jsx("p",{className:"gpc-captcha-info",children:o("captcha.info")})]})})};class Lh{constructor(t,n){this.licenseToken=n,this.baseURL=t||ki,this.client=Li.create({baseURL:this.baseURL,timeout:ch.API_REQUEST,headers:{"Content-Type":"application/json"}}),this.client.interceptors.request.use(r=>(this.licenseToken&&(r.headers.Authorization=`Bearer ${this.licenseToken}`),r))}handleError(t){if(t.response){const n=t.response.data,i={statusCode:t.response.status,errorCode:n.error_code||"UNKNOWN_ERROR",message:n.message||"Request failed",retryAfter:n.retry_after_seconds||null};throw new Error(JSON.stringify(i))}else throw t.request?new Error(JSON.stringify({statusCode:503,errorCode:"NETWORK_ERROR",message:"No response from server",retryAfter:null})):new Error(JSON.stringify({statusCode:500,errorCode:"INTERNAL_ERROR",message:t.message,retryAfter:null}))}async get(t,n={}){try{return(await this.client.get(t,n)).data}catch(r){this.handleError(r)}}async post(t,n,r={}){try{return(await this.client.post(t,n,r)).data}catch(i){this.handleError(i)}}async put(t,n,r={}){try{return(await this.client.put(t,n,r)).data}catch(i){this.handleError(i)}}async patch(t,n,r={}){try{return(await this.client.patch(t,n,r)).data}catch(i){this.handleError(i)}}async delete(t,n={}){try{return(await this.client.delete(t,n)).data}catch(r){this.handleError(r)}}getClient(){return this.client}}class Si{constructor(t="tiagpc"){this.prefix=t}_getKey(t){return`${this.prefix}_${t}`}set(t,n){try{const r=this._getKey(t),i=JSON.stringify(n);return localStorage.setItem(r,i),!0}catch(r){return console.warn(`[StorageService] Error guardando ${t}:`,r),!1}}get(t){try{const n=this._getKey(t),r=localStorage.getItem(n);return r===null?null:JSON.parse(r)}catch(n){return console.warn(`[StorageService] Error leyendo ${t}:`,n),this.remove(t),null}}remove(t){try{const n=this._getKey(t);return localStorage.removeItem(n),!0}catch(n){return console.warn(`[StorageService] Error eliminando ${t}:`,n),!1}}has(t){const n=this._getKey(t);return localStorage.getItem(n)!==null}clear(){try{return Object.keys(localStorage).filter(r=>r.startsWith(`${this.prefix}_`)).forEach(r=>{localStorage.removeItem(r)}),!0}catch(t){return console.warn("[StorageService] Error limpiando datos:",t),!1}}setWithTimestamp(t,n){return this.set(t,{data:n,timestamp:Date.now()})}getWithExpiry(t,n){const r=this.get(t);return!r||!r.timestamp?null:Date.now()-r.timestamp>n?(this.remove(t),null):r.data}}class Ph{constructor(t,n){this.licenseToken=t,this.httpClient=n,this.storage=new Si("tiagpc"),this.sessionToken=this._getOrCreateSessionToken()}_generateSessionToken(){return"session_"+Array.from(crypto.getRandomValues(new Uint8Array(28))).map(t=>t.toString(16).padStart(2,"0")).join("")}_getSessionKey(){return`session_${this.licenseToken.substring(0,16)}`}_getOrCreateSessionToken(){const t=this._getSessionKey(),n=this.storage.get(t);if(n&&n.sessionToken)return n.sessionToken;const r=this._generateSessionToken();return this._saveSessionToken(r,!1),r}_saveSessionToken(t,n=!1){const r=this._getSessionKey();this.storage.set(r,{sessionToken:t,timestamp:Date.now(),validated:n})}hasValidCachedSession(){const t=this._getSessionKey(),n=this.storage.get(t);if(!n)return!1;const{validated:r,timestamp:i}=n,o=Date.now(),a=1440*60*1e3;return r&&o-i<a}async validateSession(){try{return await this.httpClient.post("/validate-session",{session_token:this.sessionToken})}catch{return this.clearSession(),{success:!1,valid:!1}}}validateSessionLocally(){this._saveSessionToken(this.sessionToken,!0)}resetValidation(){this._saveSessionToken(this.sessionToken,!1)}getSessionToken(){return this.sessionToken}renewSessionToken(){const t=this._generateSessionToken();return this.sessionToken=t,this._saveSessionToken(t,!1),t}clearSession(){const t=this._getSessionKey();this.storage.remove(t)}async releaseSession(){if(!this.licenseToken){console.warn("[SessionService] No license token available to release session");return}try{return await this.httpClient.post("/release-session",{session_token:this.sessionToken})}catch(t){console.error("[SessionService] Failed to release session:",t.message)}}}class jh{constructor(t,n,r){this.licenseToken=t,this.sessionToken=n,this.httpClient=r,this.storage=new Si("tiagpc")}_getLastConversationKey(){return`last_conversation_${this.licenseToken.substring(0,16)}`}async listConversations(t=20,n=0){return await this.httpClient.get("/conversations",{params:{limit:t,offset:n},headers:{"X-Session-Token":this.sessionToken}})}async getConversationHistory(t,n=50,r=0){return await this.httpClient.get(`/conversation/${t}/history`,{params:{limit:n,offset:r}})}async getCurrentConversation(){return await this.httpClient.get("/conversation/current",{headers:{"X-Session-Token":this.sessionToken}})}saveLastConversation(t,n){const r=this._getLastConversationKey();return this.storage.setWithTimestamp(r,{conversationId:t,messages:n})}getLastConversation(t=1440*60*1e3){const n=this._getLastConversationKey();return this.storage.getWithExpiry(n,t)}clearLastConversation(){const t=this._getLastConversationKey();return this.storage.remove(t)}hasLastConversation(){const t=this._getLastConversationKey();return this.storage.has(t)}async updateConversationTitle(t,n){return await this.httpClient.patch(`/conversation/${t}/title`,{new_title:n},{headers:{"X-Session-Token":this.sessionToken}})}async deleteConversation(t){return await this.httpClient.delete(`/conversation/${t}`,{headers:{"X-Session-Token":this.sessionToken}})}}function zh(){const e={};return zi.forEach(t=>{e[t]=""}),{...e,client_timestamp:Date.now()/1e3,screen_resolution:`${window.screen.width}x${window.screen.height}`,timezone:-new Date().getTimezoneOffset()/60,platform:navigator.platform||"unknown",language:navigator.language||"unknown",color_depth:window.screen.colorDepth||"unknown"}}class Mh{constructor(t,n,r){this.licenseToken=t,this.sessionToken=n,this.httpClient=r}async sendMessage(t,n,r=null){const o=`${this.httpClient.baseURL}/ask`,a=zh(),s={message:t,session_token:this.sessionToken,request_metadata:a};r&&(s.conversation_id=r);const l=sessionStorage.getItem("mcp_login_data");if(l)try{s.mcp_login_data=JSON.parse(l)}catch{sessionStorage.removeItem("mcp_login_data")}try{const u=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.licenseToken}`},body:JSON.stringify(s)});if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(JSON.stringify({statusCode:u.status,errorCode:h.error_code||"UNKNOWN_ERROR",message:h.message||"Request failed",retryAfter:h.retry_after_seconds||null}))}return await this._processSSEResponse(u,n)}catch(u){throw u.message.startsWith("{")?u:new Error(JSON.stringify({statusCode:500,errorCode:"NETWORK_ERROR",message:u.message,retryAfter:null}))}}async _processSSEResponse(t,n){const r=t.body.getReader(),i=new TextDecoder;let o="",a="",s=null,l=null;for(;;){const{done:u,value:h}=await r.read();if(u)break;o+=i.decode(h,{stream:!0});const c=o.split(`
30
- `);o=c.pop();for(const f of c){if(!f.trim()||!f.startsWith("data: "))continue;const p=f.replace("data: ","").trim();if(p!=="[DONE]")try{const m=JSON.parse(p);if(m.type==="content")a+=m.text,n&&n(m.text);else if(m.type==="metadata")s=m;else if(m.type==="summary")l=m;else if(m.type==="error")throw new Error(JSON.stringify({statusCode:m.status_code||500,errorCode:m.error_code,message:m.message,retryAfter:null}))}catch(m){if(m.message&&m.message.startsWith("{"))throw m;console.error("[MessageService] Error parsing SSE event:",m)}}}if(!l)throw new Error("No summary received from server");return{success:!0,data:{message_id:l.message_id,conversation_id:l.conversation_id,response:a,response_time_ms:l.response_time_ms,model_used:l.model_used,created_at:l.created_at}}}async transcribeAudio(t){const n=new FormData;return n.append("file",t,"audio.webm"),(await this.httpClient.getClient().post("/transcribe",n,{headers:{"Content-Type":"multipart/form-data"}})).data}}class wn{constructor(t,n){if(!n)throw new Error("License token is required");this.licenseToken=n,this.httpClient=new Lh(t,n),this.sessionService=new Ph(n,this.httpClient),this.conversationService=new jh(n,this.sessionService.getSessionToken(),this.httpClient),this.messageService=new Mh(n,this.sessionService.getSessionToken(),this.httpClient)}getSessionToken(){return this.sessionService.getSessionToken()}hasValidCachedSession(){return this.sessionService.hasValidCachedSession()}async validateSession(){return await this.sessionService.validateSession()}validateSessionLocally(){this.sessionService.validateSessionLocally()}renewSessionToken(){const t=this.sessionService.renewSessionToken();return this.conversationService.sessionToken=t,this.messageService.sessionToken=t,t}async releaseSession(){return await this.sessionService.releaseSession()}async listConversations(t=20){return await this.conversationService.listConversations(t)}async getConversationHistory(t,n=50){return await this.conversationService.getConversationHistory(t,n)}async getCurrentConversation(){return await this.conversationService.getCurrentConversation()}saveLastConversation(t,n){return this.conversationService.saveLastConversation(t,n)}getLastConversation(t=1440*60*1e3){return this.conversationService.getLastConversation(t)}clearLastConversation(){return this.conversationService.clearLastConversation()}async updateConversationTitle(t,n){return await this.conversationService.updateConversationTitle(t,n)}async deleteConversation(t){return await this.conversationService.deleteConversation(t)}async sendMessage(t,n,r=null){if(!this.licenseToken)throw new Error("License token is required.");return await this.messageService.sendMessage(t,n,r)}async transcribeAudio(t){if(!this.licenseToken)throw new Error("License token is required.");return await this.messageService.transcribeAudio(t)}async getInitConfig(){if(!this.licenseToken)throw new Error("License token is required.");return await this.httpClient.get("/init")}async checkHealth(){try{return await this.httpClient.get("/health")}catch(t){return{status:"unhealthy",error:t.message}}}async generateCaptchaChallenge(){if(!this.licenseToken)throw new Error("License token is required.");return await this.httpClient.post("/captcha/challenge",{session_token:this.getSessionToken()})}async verifyCaptchaAnswer(t,n){if(!this.licenseToken)throw new Error("License token is required.");return await this.httpClient.post("/captcha/verify",{challenge_id:t,answer:parseInt(n,10),session_token:this.getSessionToken()})}}let mt=null;const Rh=(e,t)=>((!mt||t&&mt.licenseToken!==t)&&(mt=new wn(e,t)),mt),Oh=(e="auto")=>{const[t,n]=A.useState(e),[r,i]=A.useState("light"),o=A.useRef(!1);return A.useEffect(()=>{o.current||n(e)},[e]),A.useEffect(()=>{if(i(t==="auto"?dh():t),t==="auto"){const l=window.matchMedia("(prefers-color-scheme: dark)"),u=h=>{i(h.matches?"dark":"light")};return l.addEventListener("change",u),()=>{l.removeEventListener("change",u)}}},[t]),{theme:r,themeMode:t,setThemeMode:n,toggleTheme:()=>{o.current=!0,n(s=>s==="auto"?r==="light"?"dark":"light":s==="light"?"dark":"light")}}},Fh={title:"TIA GPC",poweredBy:"Desarrollado por SOFTIA.ca",questionsTo:"Preguntas a",validatingSession:"Validando sesión..."},_h={title:"Asistente",placeholder:"Escribe tu pregunta...",send:"Enviar",close:"Cerrar",aiDisclaimer:"La IA puede cometer errores. Considera verificar la información importante.",welcome:"¡Hola! Bienvenido a {{companyName}}. ¿En qué puedo ayudarte hoy?",emptyState:"Inicia una conversación escribiendo tu pregunta",validation:"Verificando seguridad...",retry:"Reintentar",loadingMore:"Cargando mensajes anteriores..."},Bh={record:"Grabar audio",recording:"Grabando...",stop:"Detener grabación",processing:"Transcribiendo audio...",error:"Error al transcribir audio",unsupported:"Tu navegador no soporta grabación de audio",permissionDenied:"Permiso de micrófono denegado"},Hh={light:"Claro",dark:"Oscuro",toggle:"Cambiar tema"},Uh={unauthorized:"Autenticación fallida. Por favor, verifica tu token de licencia e intenta nuevamente.",validation:"Verificación anti-bot fallida. Por favor, recarga la página e intenta nuevamente.",network:"No se pudo conectar al servidor. Verifica tu conexión a internet.",rateLimit:"Has realizado demasiadas consultas o se alcanzó el límite de usuarios concurrentes. Por favor, espera un momento antes de continuar.",session:"Tu sesión ha expirado por inactividad. Por favor, recarga la página para continuar.",insufficientCredits:"Créditos insuficientes. Por favor, recarga créditos desde tu panel de administración para continuar usando TIA GPC.",generic:"Ha ocurrido un error inesperado. Por favor, intenta nuevamente.",aiServiceUnavailable:"El asistente está temporalmente no disponible. Por favor, intenta de nuevo en unos momentos.",serverError:"El servidor encontró un problema. Por favor, intenta de nuevo más tarde.",domainUnauthorized:"Este dominio no está autorizado para usar este widget. Por favor, contacta a tu administrador.",noKnowledgeAvailable:"Lo siento, no tengo respuesta para tu consulta. ¿Podrías darme un poco más de detalle o decirlo de otra forma?"},qh={tokensUsed:"Tokens usados",responseTime:"Tiempo de respuesta",model:"Modelo"},Wh={title:"Conversaciones",new:"Nueva",empty:"No hay conversaciones aún",emptyHint:"Inicia una conversación para verla aquí",untitled:"Conversación sin título",loadingMore:"Cargando más...",toggle:"Alternar conversaciones",rename:"Renombrar",delete:"Eliminar",save:"Guardar",cancel:"Cancelar",confirmDelete:'¿Eliminar "{{title}}"?'},Vh={justNow:"Justo ahora",minutesAgo:"hace {{count}} min",minutesAgo_one:"hace 1 min",minutesAgo_other:"hace {{count}} min",hoursAgo:"hace {{count}}h",hoursAgo_one:"hace 1h",hoursAgo_other:"hace {{count}}h",daysAgo:"hace {{count}}d",daysAgo_one:"hace 1d",daysAgo_other:"hace {{count}}d"},Gh={languageSelector:{label:"Cambiar idioma"},menu:"Más opciones",spinner:{loading:"Cargando"},typingIndicator:{typing:"Escribiendo"},message:{userMessage:"Mensaje del usuario",assistantMessage:"Mensaje del asistente"}},Yh={english:"English",spanish:"Español",french:"Français"},Zh={maxCharacters:"Máximo {{count}} caracteres"},Jh={title:"Verificación de seguridad",subtitle:"Por favor, resuelve esta operación matemática para continuar",question:"¿Cuánto es?",verify:"Verificar",verifying:"Verificando...",loading:"Cargando desafío...",incorrectAnswer:"Respuesta incorrecta. Inténtalo de nuevo",incorrectAnswerWithAttempts:"Respuesta incorrecta. Te quedan {{attempts}} intentos",invalidNumber:"Por favor, ingresa un número válido",error:"Error al verificar. Por favor, intenta nuevamente",errorGenerating:"Error al generar el desafío. Por favor, intenta nuevamente",challengeExpired:"El desafío ha expirado. Generando uno nuevo...",maxAttemptsExceeded:"Se excedió el número máximo de intentos. Generando un nuevo desafío...",invalidSession:"Sesión inválida. Por favor, recarga la página",attemptsLeft:"Te quedan {{count}} intentos",info:"Esta verificación se realiza solo una vez para proteger el servicio"},Qh={antiBotValidationPending:"Validación anti-bot pendiente",newConversationStarted:"Nueva conversación iniciada",failedLoadHistory:"No se pudo cargar el historial de la conversación",sessionExpired:"Sesión expirada, por favor verifica nuevamente",gpcServiceNotAvailable:"Servicio GPC no disponible",conversationRenamed:"Conversación renombrada exitosamente",failedRenameConversation:"No se pudo renombrar la conversación",conversationDeleted:"Conversación eliminada exitosamente",failedDeleteConversation:"No se pudo eliminar la conversación"},Xh={title:"Acceso a Moodle",subtitle:"Ingresa tus credenciales para acceder a tu contenido personalizado",username:"Usuario",password:"Contraseña",submit:"Ingresar",requiredFields:"Usuario y contraseña son requeridos",skip:"Continuar sin iniciar sesión",login:"Iniciar sesión en Moodle",logout:"Cerrar sesión de Moodle"},Kh={title:"Acerca de",product:"Producto",version:"Versión",creator:"Creador",rights:"Todos los derechos reservados.",close:"Cerrar"},$h={widget:Fh,chat:_h,voice:Bh,theme:Hh,errors:Uh,metadata:qh,conversations:Wh,time:Vh,ui:Gh,languages:Yh,input:Zh,captcha:Jh,toast:Qh,moodle:Xh,about:Kh},ep={title:"TIA GPC",poweredBy:"Powered by SOFTIA.ca",questionsTo:"Questions to",validatingSession:"Validating session..."},tp={title:"Assistant",placeholder:"Type your question...",send:"Send",close:"Close",aiDisclaimer:"AI can make mistakes. Consider verifying important information.",welcome:"Hello! Welcome to {{companyName}}. How can I help you today?",emptyState:"Start a conversation by typing your question",validation:"Verifying security...",retry:"Retry",loadingMore:"Loading older messages..."},np={record:"Record audio",recording:"Recording...",stop:"Stop recording",processing:"Transcribing audio...",error:"Error transcribing audio",unsupported:"Your browser does not support audio recording",permissionDenied:"Microphone permission denied"},rp={light:"Light",dark:"Dark",toggle:"Toggle theme"},ip={unauthorized:"Authentication failed. Please check your license token and try again.",validation:"Bot verification failed. Please reload the page and try again.",network:"Unable to connect to the server. Please check your internet connection.",rateLimit:"You've made too many requests or the concurrent user limit has been reached. Please wait a moment before continuing.",session:"Your session has expired due to inactivity. Please reload the page to continue.",insufficientCredits:"Insufficient credits. Please reload credits from your admin panel to continue using TIA GPC.",generic:"An unexpected error has occurred. Please try again.",aiServiceUnavailable:"The assistant is temporarily unavailable. Please try again in a few moments.",serverError:"The server encountered a problem. Please try again later.",domainUnauthorized:"This domain is not authorized to use this widget. Please contact your administrator.",noKnowledgeAvailable:"Sorry, I don't have an answer for your query. Could you provide a bit more detail or phrase it differently?"},op={tokensUsed:"Tokens used",responseTime:"Response time",model:"Model"},ap={title:"Conversations",new:"New",empty:"No conversations yet",emptyHint:"Start a conversation to see it here",untitled:"Untitled conversation",loadingMore:"Loading more...",toggle:"Toggle conversations",rename:"Rename",delete:"Delete",save:"Save",cancel:"Cancel",confirmDelete:'Delete "{{title}}"?'},sp={justNow:"Just now",minutesAgo:"{{count}} min ago",minutesAgo_one:"1 min ago",minutesAgo_other:"{{count}} min ago",hoursAgo:"{{count}}h ago",hoursAgo_one:"1h ago",hoursAgo_other:"{{count}}h ago",daysAgo:"{{count}}d ago",daysAgo_one:"1d ago",daysAgo_other:"{{count}}d ago"},lp={languageSelector:{label:"Change language"},menu:"More options",spinner:{loading:"Loading"},typingIndicator:{typing:"Typing"},message:{userMessage:"User message",assistantMessage:"Assistant message"}},up={english:"English",spanish:"Español",french:"Français"},cp={maxCharacters:"Maximum {{count}} characters"},hp={title:"Security verification",subtitle:"Please solve this math problem to continue",question:"What is?",verify:"Verify",verifying:"Verifying...",loading:"Loading challenge...",incorrectAnswer:"Incorrect answer. Please try again",incorrectAnswerWithAttempts:"Incorrect answer. {{attempts}} attempts remaining",invalidNumber:"Please enter a valid number",error:"Error verifying. Please try again",errorGenerating:"Error generating challenge. Please try again",challengeExpired:"Challenge expired. Generating a new one...",maxAttemptsExceeded:"Maximum attempts exceeded. Generating a new challenge...",invalidSession:"Invalid session. Please refresh the page",attemptsLeft:"{{count}} attempts remaining",info:"This verification is done only once to protect the service"},pp={antiBotValidationPending:"Anti-bot validation pending",newConversationStarted:"New conversation started",failedLoadHistory:"Failed to load conversation history",sessionExpired:"Session expired, please verify again",gpcServiceNotAvailable:"GPC Service not available",conversationRenamed:"Conversation renamed successfully",failedRenameConversation:"Failed to rename conversation",conversationDeleted:"Conversation deleted successfully",failedDeleteConversation:"Failed to delete conversation"},fp={title:"Moodle Access",subtitle:"Enter your credentials to access your personalized content",username:"Username",password:"Password",submit:"Sign in",requiredFields:"Username and password are required",skip:"Continue without signing in",login:"Sign in to Moodle",logout:"Sign out of Moodle"},dp={title:"About",product:"Product",version:"Version",creator:"Creator",rights:"All rights reserved.",close:"Close"},mp={widget:ep,chat:tp,voice:np,theme:rp,errors:ip,metadata:op,conversations:ap,time:sp,ui:lp,languages:up,input:cp,captcha:hp,toast:pp,moodle:fp,about:dp},gp={title:"TIA GPC",poweredBy:"Propulsé par SOFTIA.ca",questionsTo:"Questions à",validatingSession:"Validation de la session..."},yp={title:"Assistant",placeholder:"Tapez votre question...",send:"Envoyer",close:"Fermer",aiDisclaimer:"L'IA peut faire des erreurs. Pensez à vérifier les informations importantes.",welcome:"Bonjour ! Bienvenue à {{companyName}}. Comment puis-je vous aider aujourd'hui ?",emptyState:"Commencez une conversation en tapant votre question",validation:"Vérification de sécurité...",retry:"Réessayer",loadingMore:"Chargement des messages précédents..."},xp={record:"Enregistrer audio",recording:"Enregistrement...",stop:"Arrêter l'enregistrement",processing:"Transcription audio...",error:"Erreur de transcription audio",unsupported:"Votre navigateur ne prend pas en charge l'enregistrement audio",permissionDenied:"Permission du microphone refusée"},bp={light:"Clair",dark:"Sombre",toggle:"Changer de thème"},kp={unauthorized:"Échec de l'authentification. Veuillez vérifier votre jeton de licence et réessayer.",validation:"La vérification anti-bot a échoué. Veuillez recharger la page et réessayer.",network:"Impossible de se connecter au serveur. Veuillez vérifier votre connexion internet.",rateLimit:"Vous avez fait trop de demandes ou la limite d'utilisateurs concurrents a été atteinte. Veuillez patienter un moment avant de continuer.",session:"Votre session a expiré en raison d'inactivité. Veuillez recharger la page pour continuer.",insufficientCredits:"Crédits insuffisants. Veuillez recharger des crédits depuis votre panneau d'administration pour continuer à utiliser TIA GPC.",generic:"Une erreur inattendue s'est produite. Veuillez réessayer.",aiServiceUnavailable:"L'assistant est temporairement indisponible. Veuillez réessayer dans quelques instants.",serverError:"Le serveur a rencontré un problème. Veuillez réessayer plus tard.",domainUnauthorized:"Ce domaine n'est pas autorisé à utiliser ce widget. Veuillez contacter votre administrateur.",noKnowledgeAvailable:"Désolé, je n'ai pas de réponse à votre requête. Pourriez-vous me donner un peu plus de détails ou le formuler autrement ?"},wp={tokensUsed:"Tokens utilisés",responseTime:"Temps de réponse",model:"Modèle"},vp={title:"Conversations",new:"Nouvelle",empty:"Aucune conversation pour le moment",emptyHint:"Démarrez une conversation pour la voir ici",untitled:"Conversation sans titre",loadingMore:"Chargement...",toggle:"Basculer les conversations",rename:"Renommer",delete:"Supprimer",save:"Enregistrer",cancel:"Annuler",confirmDelete:'Supprimer "{{title}}" ?'},Cp={justNow:"À l'instant",minutesAgo:"il y a {{count}} min",minutesAgo_one:"il y a 1 min",minutesAgo_other:"il y a {{count}} min",hoursAgo:"il y a {{count}}h",hoursAgo_one:"il y a 1h",hoursAgo_other:"il y a {{count}}h",daysAgo:"il y a {{count}}j",daysAgo_one:"il y a 1j",daysAgo_other:"il y a {{count}}j"},Sp={languageSelector:{label:"Changer de langue"},menu:"Plus d'options",spinner:{loading:"Chargement"},typingIndicator:{typing:"Écriture en cours"},message:{userMessage:"Message de l'utilisateur",assistantMessage:"Message de l'assistant"}},Ep={english:"English",spanish:"Español",french:"Français"},Tp={maxCharacters:"Maximum {{count}} caractères"},Ap={title:"Vérification de sécurité",subtitle:"Veuillez résoudre ce problème mathématique pour continuer",question:"Combien fait?",verify:"Vérifier",verifying:"Vérification...",loading:"Chargement du défi...",incorrectAnswer:"Réponse incorrecte. Veuillez réessayer",incorrectAnswerWithAttempts:"Réponse incorrecte. {{attempts}} tentatives restantes",invalidNumber:"Veuillez entrer un nombre valide",error:"Erreur de vérification. Veuillez réessayer",errorGenerating:"Erreur lors de la génération du défi. Veuillez réessayer",challengeExpired:"Le défi a expiré. Génération d'un nouveau...",maxAttemptsExceeded:"Nombre maximum de tentatives dépassé. Génération d'un nouveau défi...",invalidSession:"Session invalide. Veuillez actualiser la page",attemptsLeft:"{{count}} tentatives restantes",info:"Cette vérification n'est effectuée qu'une seule fois pour protéger le service"},Ip={antiBotValidationPending:"Validation anti-bot en attente",newConversationStarted:"Nouvelle conversation démarrée",failedLoadHistory:"Échec du chargement de l'historique de la conversation",sessionExpired:"Session expirée, veuillez vérifier à nouveau",gpcServiceNotAvailable:"Service GPC non disponible",conversationRenamed:"Conversation renommée avec succès",failedRenameConversation:"Échec du renommage de la conversation",conversationDeleted:"Conversation supprimée avec succès",failedDeleteConversation:"Échec de la suppression de la conversation"},Np={title:"Accès Moodle",subtitle:"Entrez vos identifiants pour accéder à votre contenu personnalisé",username:"Nom d'utilisateur",password:"Mot de passe",submit:"Se connecter",requiredFields:"Le nom d'utilisateur et le mot de passe sont requis",skip:"Continuer sans se connecter",login:"Se connecter à Moodle",logout:"Se déconnecter de Moodle"},Dp={title:"À propos",product:"Produit",version:"Version",creator:"Créateur",rights:"Tous droits réservés.",close:"Fermer"},Lp={widget:gp,chat:yp,voice:xp,theme:bp,errors:kp,metadata:wp,conversations:vp,time:Cp,ui:Sp,languages:Ep,input:Tp,captcha:Ap,toast:Ip,moodle:Np,about:Dp};gt.use(Pi).use(ce.initReactI18next).init({resources:{en:{translation:mp},es:{translation:$h},fr:{translation:Lp}},fallbackLng:"en",supportedLngs:["en","es","fr"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});const Pp=({token:e,theme:t=Le.theme,position:n=Le.position,language:r=Le.language,primaryColor:i,width:o=Le.width,height:a=Le.height,apiUrl:s=ki,onReady:l,onError:u,onClose:h,autoOpen:c=Le.autoOpen,showBranding:f=Le.showBranding,mobileFullscreen:p=Le.mobileFullscreen,...m})=>{const[k,v]=A.useState(!1),[b,E]=A.useState(null),[T,M]=A.useState(!0),[D,w]=A.useState(!1),[R,_]=A.useState(!1),[F,x]=A.useState(!!sessionStorage.getItem("mcp_login_data"));b?.widget_customization?.behavior?.auto_open;const[C,z]=A.useState(!1),j=A.useMemo(()=>new wn(s,e),[s,e]);if(A.useEffect(()=>{const O=()=>{v(hh())};O(),window.addEventListener("resize",O);const H=localStorage.getItem(Pe.VERIFIED),V=localStorage.getItem(Pe.TIMESTAMP);return H==="true"&&V&&(Date.now()-parseInt(V,10)<dr?w(!0):(localStorage.removeItem(Pe.VERIFIED),localStorage.removeItem(Pe.TIMESTAMP))),()=>window.removeEventListener("resize",O)},[]),A.useEffect(()=>{const O=b?.widget_customization?.language||r;O&&gt.changeLanguage&&gt.changeLanguage(O)},[r,b]),A.useEffect(()=>{(async()=>{if(!e){M(!1);return}try{const H=await j.getInitConfig();H.success&&(E(H.data),(H.data?.widget_customization?.behavior?.auto_open??c)&&z(!0),l&&l(H.data))}catch(H){console.error("[TIA GPC Widget] Error loading config:",H),u&&u(H)}finally{M(!1)}})()},[e,j,l,u,c]),A.useEffect(()=>{const O=()=>{if(!j)return;const H=j.getSessionToken(),V=j.httpClient.baseURL,J=j.licenseToken;fetch(`${V}/release-session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J}`},body:JSON.stringify({session_token:H}),keepalive:!0}).catch(()=>{})};return window.addEventListener("beforeunload",O),()=>{window.removeEventListener("beforeunload",O)}},[j]),!e)return console.error('[TIA GPC Widget] Error: "token" prop is required'),null;const N=()=>{z(!1),_(!1),h?.()},L=()=>{const O=b?.mcp;return!O?.enabled||O?.auth_mode!=="credentials"?!0:!!sessionStorage.getItem("mcp_login_data")},W=()=>{(!D||!L())&&_(!0),z(!0)},Q=()=>{w(!0),_(!1),x(!!sessionStorage.getItem("mcp_login_data"))},oe=()=>{_(!1)},ne=O=>{O==="logout"?(sessionStorage.removeItem("mcp_login_data"),x(!1)):_(!0)},g=O=>{console.error("[TIA GPC Widget] CAPTCHA error:",O),u&&u(O)},le=()=>{const O=b?.widget_customization?.position||n,H=b?.widget_customization?.behavior?.mobile_fullscreen??p;return k&&H?"gpc-position-bottom-right":`gpc-position-${O}`},pe=()=>{const O={},H=b?.widget_customization?.colors?.primary||i,V=b?.widget_customization?.colors?.header_background,J=b?.widget_customization?.colors?.header_text;H&&(O["--gpc-color-primary"]=H),V&&(O["--gpc-header-bg"]=V),J&&(O["--gpc-header-text"]=J);const K=b?.widget_customization?.dimensions?.width||o,X=b?.widget_customization?.dimensions?.height||a,re=b?.widget_customization?.behavior?.mobile_fullscreen??p;return(!k||!re)&&(K&&(O["--gpc-widget-width"]=K),X&&(O["--gpc-widget-height"]=X)),O},y=b?.widget_customization?.theme||t,{theme:se,toggleTheme:ge}=Oh(y);return d.jsx(ce.I18nextProvider,{i18n:gt,children:d.jsxs("div",{className:`gpc-widget gpc-widget-container ${le()} ${se==="dark"?"gpc-dark":""}`,style:pe(),children:[!C&&d.jsx(Mi,{onClick:W,widgetConfig:b}),C&&!T&&d.jsx(d.Fragment,{children:R&&(!D||!L())?d.jsx("div",{className:"gpc-chat-window gpc-animate-fade-in",children:d.jsx(Dh,{gpcService:j,mcpConfig:b?.mcp,onSuccess:Q,onSkip:oe,onError:g})}):d.jsx(Nh,{gpcService:j,licenseToken:e,widgetConfig:b,onClose:N,themeMode:se,onToggleTheme:ge,showBranding:f,showMetadata:m.showMetadata||!1,onError:u,version:ot,onRequestMcpLogin:ne,mcpLoggedIn:F})})]})})};exports.GPCService=wn;exports.LANGUAGES=Ci;exports.THEMES=vi;exports.TiaGPCWidget=Pp;exports.WIDGET_POSITIONS=wi;exports.WIDGET_VERSION=ot;exports.getGPCService=Rh;
27
+ `,...o.current()});return/^[\t ]/.test(u)&&(u=it(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),l(),s(),u}ti.peek=Qu;function ti(e){return e.value||""}function Qu(){return"<"}ni.peek=Xu;function ni(e,t,n,r){const i=yn(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let s=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),s(),e.title&&(s=n.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),u+=l.move(")"),a(),u}function Xu(){return"!"}ri.peek=Ku;function ri(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const s=n.createTracker(r);let l=s.move("![");const u=n.safe(e.alt,{before:l,after:"]",...s.current()});l+=s.move(u+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return a(),n.stack=h,o(),i==="full"||!u||u!==c?l+=s.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function Ku(){return"!"}ii.peek=$u;function ii(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],s=n.compilePattern(a);let l;if(a.atBreak)for(;l=s.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return i+r+i}function $u(){return"`"}function oi(e,t){const n=ln(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}ai.peek=ec;function ai(e,t,n,r){const i=yn(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let s,l;if(oi(e,n)){const h=n.stack;n.stack=[],s=n.enter("autolink");let c=a.move("<");return c+=a.move(n.containerPhrasing(e,{before:c,after:">",...a.current()})),c+=a.move(">"),s(),n.stack=h,c}s=n.enter("link"),l=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(l=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${o}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),l()),u+=a.move(")"),s(),u}function ec(e,t,n){return oi(e,n)?"<":"["}si.peek=tc;function si(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const s=n.createTracker(r);let l=s.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...s.current()});l+=s.move(u+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return a(),n.stack=h,o(),i==="full"||!u||u!==c?l+=s.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function tc(){return"["}function xn(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function nc(e){const t=xn(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function rc(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function li(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function ic(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?rc(n):xn(n);const s=e.ordered?a==="."?")":".":nc(n);let l=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),li(n)===a&&h){let c=-1;for(;++c<e.children.length;){const f=e.children[c];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(a=s),n.bulletCurrent=a;const u=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=o,i(),u}function oc(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function ac(e,t,n,r){const i=oc(n);let o=n.bulletCurrent||xn(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const s=n.createTracker(r);s.move(o+" ".repeat(a-o.length)),s.shift(a);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,s.current()),h);return l(),u;function h(c,f,p){return f?(p?"":" ".repeat(a))+c:(p?o:o+" ".repeat(a-o.length))+c}}function sc(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(e,r);return o(),i(),a}const lc=Et(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function uc(e,t,n,r){return(e.children.some(function(a){return lc(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function cc(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}ui.peek=hc;function ui(e,t,n,r){const i=cc(n),o=n.enter("strong"),a=n.createTracker(r),s=a.move(i+i);let l=a.move(n.containerPhrasing(e,{after:i,before:s,...a.current()}));const u=l.charCodeAt(0),h=wt(r.before.charCodeAt(r.before.length-1),u,i);h.inside&&(l=it(u)+l.slice(1));const c=l.charCodeAt(l.length-1),f=wt(r.after.charCodeAt(0),c,i);f.inside&&(l=l.slice(0,-1)+it(c));const p=a.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:f.outside,before:h.outside},s+l+p}function hc(e,t,n){return n.options.strong||"*"}function pc(e,t,n,r){return n.safe(e.value,r)}function fc(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function dc(e,t,n){const r=(li(n)+(n.options.ruleSpaces?" ":"")).repeat(fc(n));return n.options.ruleSpaces?r.slice(0,-1):r}const ci={blockquote:Ou,break:lr,code:qu,definition:Vu,emphasis:ei,hardBreak:lr,heading:Ju,html:ti,image:ni,imageReference:ri,inlineCode:ii,link:ai,linkReference:si,list:ic,listItem:ac,paragraph:sc,root:uc,strong:ui,text:pc,thematicBreak:dc};function mc(){return{enter:{table:gc,tableData:ur,tableHeader:ur,tableRow:xc},exit:{codeText:kc,table:yc,tableData:qt,tableHeader:qt,tableRow:qt}}}function gc(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function yc(e){this.exit(e),this.data.inTable=void 0}function xc(e){this.enter({type:"tableRow",children:[]},e)}function qt(e){this.exit(e)}function ur(e){this.enter({type:"tableCell",children:[]},e)}function kc(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,bc));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function bc(e,t){return t==="|"?t:e}function wc(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
28
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:a,tableCell:l,tableRow:s}};function a(p,m,b,v){return u(h(p,b,v),p.align)}function s(p,m,b,v){const k=c(p,b,v),E=u([k]);return E.slice(0,E.indexOf(`
29
+ `))}function l(p,m,b,v){const k=b.enter("tableCell"),E=b.enter("phrasing"),T=b.containerPhrasing(p,{...v,before:o,after:o});return E(),k(),T}function u(p,m){return Mu(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function h(p,m,b){const v=p.children;let k=-1;const E=[],T=m.enter("table");for(;++k<v.length;)E[k]=c(v[k],m,b);return T(),E}function c(p,m,b){const v=p.children;let k=-1;const E=[],T=m.enter("tableRow");for(;++k<v.length;)E[k]=l(v[k],p,m,b);return T(),E}function f(p,m,b){let v=ci.inlineCode(p,m,b);return b.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function vc(){return{exit:{taskListCheckValueChecked:cr,taskListCheckValueUnchecked:cr,paragraph:Sc}}}function Cc(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Ec}}}function cr(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Sc(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const s=i[o];if(s.type==="paragraph"){a=s;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Ec(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);o&&s.move(a);let l=ci.listItem(e,t,n,{...r,...s.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(h){return h+a}}function Tc(){return[iu(),Eu(),Nu(),mc(),vc()]}function Ac(e){return{extensions:[ou(),Tu(e),Du(),wc(e),Cc()]}}const Ic={tokenize:zc,partial:!0},hi={tokenize:Mc,partial:!0},pi={tokenize:Rc,partial:!0},fi={tokenize:Oc,partial:!0},Nc={tokenize:Fc,partial:!0},di={name:"wwwAutolink",tokenize:Pc,previous:gi},mi={name:"protocolAutolink",tokenize:jc,previous:yi},Ie={name:"emailAutolink",tokenize:Lc,previous:xi},Se={};function Dc(){return{text:Se}}let ze=48;for(;ze<123;)Se[ze]=Ie,ze++,ze===58?ze=65:ze===91&&(ze=97);Se[43]=Ie;Se[45]=Ie;Se[46]=Ie;Se[95]=Ie;Se[72]=[Ie,mi];Se[104]=[Ie,mi];Se[87]=[Ie,di];Se[119]=[Ie,di];function Lc(e,t,n){const r=this;let i,o;return a;function a(c){return!en(c)||!xi.call(r,r.previous)||kn(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(c))}function s(c){return en(c)?(e.consume(c),s):c===64?(e.consume(c),l):n(c)}function l(c){return c===46?e.check(Nc,h,u)(c):c===45||c===95||ue(c)?(o=!0,e.consume(c),l):h(c)}function u(c){return e.consume(c),i=!0,l}function h(c){return o&&i&&fe(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function Pc(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!gi.call(r,r.previous)||kn(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Ic,e.attempt(hi,e.attempt(pi,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function jc(e,t,n){const r=this;let i="",o=!1;return a;function a(c){return(c===72||c===104)&&yi.call(r,r.previous)&&!kn(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),s):n(c)}function s(c){if(fe(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),s;if(c===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(c),l}return n(c)}function l(c){return c===47?(e.consume(c),o?u:(o=!0,l)):n(c)}function u(c){return c===null||xt(c)||ee(c)||Me(c)||vt(c)?n(c):e.attempt(hi,e.attempt(pi,h),n)(c)}function h(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function zc(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function Mc(e,t,n){let r,i,o;return a;function a(u){return u===46||u===95?e.check(fi,l,s)(u):u===null||ee(u)||Me(u)||u!==45&&vt(u)?l(u):(o=!0,e.consume(u),a)}function s(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),a}function l(u){return i||r||!o?n(u):t(u)}}function Rc(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(fi,t,o)(a):a===null||ee(a)||Me(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function Oc(e,t,n){return r;function r(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(e.consume(s),r):s===38?(e.consume(s),o):s===93?(e.consume(s),i):s===60||s===null||ee(s)||Me(s)?t(s):n(s)}function i(s){return s===null||s===40||s===91||ee(s)||Me(s)?t(s):r(s)}function o(s){return fe(s)?a(s):n(s)}function a(s){return s===59?(e.consume(s),r):fe(s)?(e.consume(s),a):n(s)}}function Fc(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return ue(o)?n(o):t(o)}}function gi(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ee(e)}function yi(e){return!fe(e)}function xi(e){return!(e===47||en(e))}function en(e){return e===43||e===45||e===46||e===95||ue(e)}function kn(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const _c={tokenize:Yc,partial:!0};function Bc(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Wc,continuation:{tokenize:Vc},exit:Gc}},text:{91:{name:"gfmFootnoteCall",tokenize:qc},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Hc,resolveTo:Uc}}}}function Hc(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!a||!a._balanced)return n(l);const u=ve(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Uc(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function qc(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;return s;function s(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),l}function l(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(o>999||c===93&&!a||c===null||c===91||ee(c))return n(c);if(c===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(ve(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return ee(c)||(a=!0),o++,e.consume(c),c===92?h:u}function h(c){return c===91||c===92||c===93?(e.consume(c),o++,u):u(c)}}function Wc(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,s;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(m)}function h(m){if(a>999||m===93&&!s||m===null||m===91||ee(m))return n(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return o=ve(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return ee(m)||(s=!0),a++,e.consume(m),m===92?c:h}function c(m){return m===91||m===92||m===93?(e.consume(m),a++,h):h(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(o)||i.push(o),Q(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function Vc(e,t,n){return e.check(st,t,e.attempt(_c,t,n))}function Gc(e){e.exit("gfmFootnoteDefinition")}function Yc(e,t,n){const r=this;return Q(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function Zc(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,s){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let u=l;for(;u--;)if(a[u][0]==="exit"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[u][1].end.offset-a[u][1].start.offset){a[l][1].type="strikethroughSequence",a[u][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[u][1].start),end:Object.assign({},a[l][1].end)},c={type:"strikethroughText",start:Object.assign({},a[u][1].end),end:Object.assign({},a[l][1].start)},f=[["enter",h,s],["enter",a[u][1],s],["exit",a[u][1],s],["enter",c,s]],p=s.parser.constructs.insideSpan.null;p&&ke(f,f.length,0,Ct(p,a.slice(u+1,l),s)),ke(f,f.length,0,[["exit",c,s],["enter",a[l][1],s],["exit",a[l][1],s],["exit",h,s]]),ke(a,u-1,l-u+3,f),l=u+f.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function o(a,s,l){const u=this.previous,h=this.events;let c=0;return f;function f(m){return u===126&&h[h.length-1][1].type!=="characterEscape"?l(m):(a.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const b=Ve(u);if(m===126)return c>1?l(m):(a.consume(m),c++,p);if(c<2&&!n)return l(m);const v=a.exit("strikethroughSequenceTemporary"),k=Ve(m);return v._open=!k||k===2&&!!b,v._close=!b||b===2&&!!k,s(m)}}}class Jc{constructor(){this.map=[]}add(t,n,r){Qc(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function Qc(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Xc(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Kc(){return{flow:{null:{name:"table",tokenize:$c,resolveAll:eh}}}}function $c(e,t,n){const r=this;let i=0,o=0,a;return s;function s(x){let C=r.events.length-1;for(;C>-1;){const N=r.events[C][1].type;if(N==="lineEnding"||N==="linePrefix")C--;else break}const z=C>-1?r.events[C][1].type:null,j=z==="tableHead"||z==="tableRow"?w:l;return j===w&&r.parser.lazy[r.now().line]?n(x):j(x)}function l(x){return e.enter("tableHead"),e.enter("tableRow"),u(x)}function u(x){return x===124||(a=!0,o+=1),h(x)}function h(x){return x===null?n(x):B(x)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):n(x):Y(x)?Q(e,h,"whitespace")(x):(o+=1,a&&(a=!1,i+=1),x===124?(e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),c(x)))}function c(x){return x===null||x===124||ee(x)?(e.exit("data"),h(x)):(e.consume(x),x===92?f:c)}function f(x){return x===92||x===124?(e.consume(x),c):c(x)}function p(x){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(x):(e.enter("tableDelimiterRow"),a=!1,Y(x)?Q(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):m(x))}function m(x){return x===45||x===58?v(x):x===124?(a=!0,e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),b):D(x)}function b(x){return Y(x)?Q(e,v,"whitespace")(x):v(x)}function v(x){return x===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(x),e.exit("tableDelimiterMarker"),k):x===45?(o+=1,k(x)):x===null||B(x)?M(x):D(x)}function k(x){return x===45?(e.enter("tableDelimiterFiller"),E(x)):D(x)}function E(x){return x===45?(e.consume(x),E):x===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(x),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(x))}function T(x){return Y(x)?Q(e,M,"whitespace")(x):M(x)}function M(x){return x===124?m(x):x===null||B(x)?!a||i!==o?D(x):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(x)):D(x)}function D(x){return n(x)}function w(x){return e.enter("tableRow"),R(x)}function R(x){return x===124?(e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),R):x===null||B(x)?(e.exit("tableRow"),t(x)):Y(x)?Q(e,R,"whitespace")(x):(e.enter("data"),_(x))}function _(x){return x===null||x===124||ee(x)?(e.exit("data"),R(x)):(e.consume(x),x===92?F:_)}function F(x){return x===92||x===124?(e.consume(x),_):_(x)}}function eh(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],s=!1,l=0,u,h,c;const f=new Jc;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(s=!1,l!==0&&(hr(f,t,l,u,h),h=void 0,l=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,c=void 0,o=[0,0,0,0],a=[0,n+1,0,0],s&&(s=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",h,t]])),i=m.type==="tableDelimiterRow"?2:h?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],c=dt(f,t,o,i,void 0,c),o=[0,0,0,0]),a[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],c=dt(f,t,o,i,void 0,c)),o=a,a=[o[1],n,0,0])):m.type==="tableHead"?(s=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,o[1]!==0?(a[0]=a[1],c=dt(f,t,o,i,n,c)):a[1]!==0&&(c=dt(f,t,a,i,n,c)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&hr(f,t,l,u,h),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=Xc(t.events,n))}return e}function dt(e,t,n,r,i,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(o.end=Object.assign({},qe(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const l=qe(t.events,n[1]);if(o={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const u=qe(t.events,n[2]),h=qe(t.events,n[3]),c={type:s,start:Object.assign({},u),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",c,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,b=n[3]-n[2]-1;e.add(m,b,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(o.end=Object.assign({},qe(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function hr(e,t,n,r,i){const o=[],a=qe(t.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function qe(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const th={name:"tasklistCheck",tokenize:rh};function nh(){return{text:{91:th}}}function rh(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),o)}function o(l){return ee(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(l)}function s(l){return B(l)?t(l):Y(l)?e.check({tokenize:ih},t,n)(l):n(l)}}function ih(e,t,n){return Q(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function oh(e){return Nr([Dc(),Bc(),Zc(e),Kc(),nh()])}const ah={};function sh(e){const t=this,n=e||ah,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(oh(n)),o.push(Tc()),a.push(Ac(n))}const ki="https://www.tiagpctest.softiabot.com",bi={BOTTOM_RIGHT:"bottom-right",BOTTOM_LEFT:"bottom-left",TOP_RIGHT:"top-right",TOP_LEFT:"top-left"},wi={LIGHT:"light",DARK:"dark",AUTO:"auto"},vi={SPANISH:"es",ENGLISH:"en",FRANCES:"fr"},lh={MOBILE:640},De={theme:wi.AUTO,position:bi.BOTTOM_RIGHT,language:vi.ENGLISH,width:"400px",height:"600px",autoOpen:!1,showBranding:!0,mobileFullscreen:!0},uh={API_REQUEST:3e4},pr={MAX_LENGTH:2e3},ch=()=>window.innerWidth<lh.MOBILE,hh=e=>{try{return new Date(e).toLocaleTimeString("es-ES",{hour:"2-digit",minute:"2-digit"})}catch{return""}},ph=e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`,Ue=()=>crypto.randomUUID(),fh=()=>window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",dh=e=>e.trim().slice(0,2e3),mh=()=>{const{t:e}=ce.useTranslation();return d.jsxs("div",{className:"gpc-typing-indicator",role:"status","aria-label":e("ui.typingIndicator.typing"),children:[d.jsx("span",{className:"gpc-typing-dot"}),d.jsx("span",{className:"gpc-typing-dot"}),d.jsx("span",{className:"gpc-typing-dot"})]})},gh=({message:e,showMetadata:t=!1,messageRef:n=null})=>{const{t:r}=ce.useTranslation(),i=e.role==="user",o=!i&&e.isStreaming&&!e.content,[a,s]=A.useState(!1),l=async u=>{u.preventDefault(),u.stopPropagation();try{await navigator.clipboard.writeText(e.content),s(!0),setTimeout(()=>s(!1),2e3)}catch(h){console.error("Error al copiar:",h)}};return d.jsxs("div",{ref:n,className:`gpc-message ${i?"gpc-message-user":"gpc-message-assistant"}`,role:"article","aria-label":r(i?"ui.message.userMessage":"ui.message.assistantMessage"),children:[d.jsx("div",{className:"gpc-message-content",children:o?d.jsx(mh,{}):i?e.content.trim():d.jsx(Zl,{remarkPlugins:[[sh,{autoLinkLiterals:!0}]],components:{a:({node:u,...h})=>d.jsx("a",{target:"_blank",rel:"noopener noreferrer",...h}),table:({node:u,...h})=>d.jsx("div",{className:"gpc-table-wrapper",children:d.jsx("table",{className:"gpc-table",...h})}),thead:({node:u,...h})=>d.jsx("thead",{className:"gpc-table-head",...h}),tbody:({node:u,...h})=>d.jsx("tbody",{className:"gpc-table-body",...h}),tr:({node:u,...h})=>d.jsx("tr",{className:"gpc-table-row",...h}),th:({node:u,...h})=>d.jsx("th",{className:"gpc-table-header",...h}),td:({node:u,...h})=>d.jsx("td",{className:"gpc-table-cell",...h})},children:e.content})}),d.jsxs("div",{className:`gpc-message-timestamp ${i?"gpc-message-timestamp-user":""}`,children:[!i&&e.metadata?.modelUsed&&d.jsx("span",{className:"gpc-model-badge",children:e.metadata.modelUsed}),d.jsxs("span",{className:"gpc-timestamp-right",children:[d.jsx("span",{children:hh(e.timestamp)}),!o&&e.content&&d.jsx("button",{type:"button",onClick:l,className:"gpc-copy-button","aria-label":a?"Copiado":"Copiar mensaje",children:a?d.jsx(ie.Check,{size:14}):d.jsx(ie.Copy,{size:14})})]})]}),!i&&t&&e.metadata&&d.jsxs("div",{className:"gpc-message-metadata",children:[e.metadata.tokensUsed&&d.jsxs("div",{className:"gpc-metadata-item",children:[d.jsxs("strong",{children:[r("metadata.tokensUsed"),":"]})," ",e.metadata.tokensUsed]}),e.metadata.responseTimeMs&&d.jsxs("div",{className:"gpc-metadata-item",children:[d.jsxs("strong",{children:[r("metadata.responseTime"),":"]})," ",ph(e.metadata.responseTimeMs)]}),e.metadata.modelUsed&&d.jsxs("div",{className:"gpc-metadata-item",children:[d.jsxs("strong",{children:[r("metadata.model"),":"]})," ",e.metadata.modelUsed]})]})]})},yh=({messages:e,isLoading:t,showMetadata:n=!1,widgetConfig:r=null,hasMoreMessages:i=!1,isLoadingMoreMessages:o=!1,onLoadMoreMessages:a=null})=>{const{t:s}=ce.useTranslation(),l=A.useRef(null),u=A.useRef(null),h=A.useRef(0),c=A.useRef(!1),f=A.useRef(null),p=A.useRef(null),m=A.useRef(0);A.useLayoutEffect(()=>{e.length>0&&!c.current&&(l.current?.scrollIntoView({behavior:"instant"}),c.current=!0,h.current=e.length)},[e.length]),A.useEffect(()=>{if(!a)return;const M=new IntersectionObserver(D=>{D[0].isIntersecting&&i&&!o&&(f.current&&(m.current=f.current.scrollHeight),a())},{threshold:1});return p.current&&M.observe(p.current),()=>{p.current&&M.unobserve(p.current)}},[i,o,a]),A.useEffect(()=>{if(o===!1&&m.current>0&&f.current){const D=f.current.scrollHeight-m.current;f.current.scrollTop=D,m.current=0}},[o]),A.useEffect(()=>{const M=e.length,D=h.current,w=e[M-1],R=M>D+1;M>0&&c.current&&(R?setTimeout(()=>{l.current?.scrollIntoView({behavior:"instant"})},150):M>D&&w&&(w.role==="user"?l.current?.scrollIntoView({behavior:"smooth"}):w.role==="assistant"&&w.isStreaming&&setTimeout(()=>{u.current?.scrollIntoView({behavior:"smooth",block:"start"})},100))),h.current=M},[e]);const b=r?.widget_customization?.branding?.company_name||"TIA GPC",v=r?.widget_customization?.branding?.company_logo_base64,k=r?.widget_customization?.welcome_message,E=v?.startsWith("data:")?v:v?`data:image/png;base64,${v}`:null,T=k||s("chat.welcome",{companyName:b});return e.length===0&&!t?d.jsx("div",{className:"gpc-messages-container",children:d.jsxs("div",{className:"gpc-empty-state",children:[E?d.jsx("div",{className:"gpc-welcome-logo",children:d.jsx("img",{src:E,alt:b,className:"gpc-welcome-company-logo"})}):d.jsx(ie.MessageSquare,{className:"gpc-empty-icon"}),d.jsx("h3",{className:"gpc-empty-title",children:T}),d.jsx("p",{className:"gpc-empty-text",children:s("chat.emptyState")})]})}):d.jsxs("div",{ref:f,className:"gpc-messages-container gpc-scrollbar gpc-smooth-scroll",children:[i&&d.jsx("div",{style:{textAlign:"center",padding:"10px"},children:o?d.jsxs("div",{className:"gpc-loading-more-messages",children:[d.jsx("div",{className:"gpc-loading-spinner"}),d.jsx("span",{children:s("chat.loadingMore","Loading older messages...")})]}):d.jsx("div",{ref:p,style:{height:"1px"}})}),e.map((M,D)=>d.jsx(gh,{message:M,showMetadata:n,messageRef:D===e.length-1?u:null},M.id)),d.jsx("div",{ref:l})]})},xh=1.2,kh=2e3,bh=({onTranscript:e,isLoading:t,disabled:n,onRecordingStateChange:r,onAnalyserChange:i})=>{const{t:o}=ce.useTranslation(),[a,s]=A.useState(!1),[l,u]=A.useState(!1),h=A.useRef(null),c=A.useRef([]),f=A.useRef(null),p=A.useRef(null),m=A.useRef(null),b=A.useRef(null),v=A.useRef(null);A.useEffect(()=>()=>{h.current?.state==="recording"&&h.current.stop(),f.current&&f.current.state!=="closed"&&f.current.close(),v.current&&clearInterval(v.current)},[]),A.useEffect(()=>{r&&r(a||l)},[a,l,r]),A.useEffect(()=>{i&&i(p.current)},[p.current,i]);const k=()=>{if(!p.current||!m.current)return;p.current.getByteTimeDomainData(m.current);let R=0;for(let x=0;x<m.current.length;x++){const C=(m.current[x]-128)/128;R+=C*C}if(Math.sqrt(R/m.current.length)*100<xh){if(b.current||(b.current=Date.now()),Date.now()-b.current>kh){T();return}}else b.current=null},E=async()=>{try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){alert(o("voice.unsupported"));return}const R=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:48e3,channelCount:1}});f.current=new(window.AudioContext||window.webkitAudioContext),p.current=f.current.createAnalyser(),f.current.createMediaStreamSource(R).connect(p.current),p.current.fftSize=1024,p.current.smoothingTimeConstant=.4,p.current.minDecibels=-85,p.current.maxDecibels=-15;const F=p.current.frequencyBinCount;m.current=new Uint8Array(F);const x=new MediaRecorder(R,{mimeType:"audio/webm;codecs=opus"});h.current=x,c.current=[],b.current=null,x.ondataavailable=C=>{C.data.size>0&&c.current.push(C.data)},x.onstop=async()=>{if(v.current&&(clearInterval(v.current),v.current=null),f.current&&f.current.state!=="closed"&&f.current.close(),b.current=null,c.current.length===0){console.warn("No audio data recorded");return}const C=new Blob(c.current,{type:"audio/webm"});u(!0);try{await e(C)}catch(z){console.error("Transcription error:",z),alert(o("voice.error"))}finally{u(!1),c.current=[]}},x.start(100),s(!0),v.current=setInterval(()=>{k()},100)}catch(R){console.error("Error accessing microphone:",R),R.name==="NotAllowedError"||R.name==="PermissionDeniedError"?alert(o("voice.permissionDenied")):alert(o("voice.unsupported"))}},T=()=>{!a&&h.current?.state!=="recording"||(h.current&&h.current.state==="recording"&&h.current.stop(),v.current&&(clearInterval(v.current),v.current=null),b.current=null,s(!1),h.current&&h.current.stream&&h.current.stream.getTracks().forEach(R=>R.stop()))},M=R=>{R.preventDefault(),R.stopPropagation(),a?T():E()},D=n||t||l,w=o(l?"voice.processing":a?"voice.stop":"voice.record");return d.jsx("button",{type:"button",onClick:M,disabled:D,className:`gpc-voice-button ${a?"gpc-voice-recording":""}`,"aria-label":w,title:w,children:l?d.jsx("span",{className:"gpc-spinner"}):a?d.jsx(ie.MicOff,{className:"gpc-icon gpc-voice-icon-active"}):d.jsx(ie.Mic,{className:"gpc-icon"})})},wh=({analyser:e,isRecording:t})=>{const n=A.useRef(null),r=A.useRef(null);return A.useEffect(()=>{if(!t||!e||!n.current)return;const i=n.current,o=i.getContext("2d"),a=e.frequencyBinCount,s=new Uint8Array(a),l=window.devicePixelRatio||1,u=i.getBoundingClientRect();i.width=u.width*l,i.height=u.height*l,o.scale(l,l);const h=u.width,c=u.height,f=40,p=3,m=2,b=()=>{if(!t)return;r.current=requestAnimationFrame(b),e.getByteFrequencyData(s),o.clearRect(0,0,h,c);const v=f*(p+m),k=(h-v)/2;for(let E=0;E<f;E++){const T=Math.floor(E*a/f),D=s[T]/255,w=Math.max(2,D*c*.8),R=k+E*(p+m),_=(c-w)/2,F=o.createLinearGradient(0,_,0,_+w);F.addColorStop(0,"rgba(59, 130, 246, 0.8)"),F.addColorStop(1,"rgba(96, 165, 250, 0.6)"),o.fillStyle=F,o.fillRect(R,_,p,w)}};return b(),()=>{r.current&&cancelAnimationFrame(r.current)}},[e,t]),t?d.jsx("div",{className:"gpc-audio-waveform-container",children:d.jsx("canvas",{ref:n,className:"gpc-audio-waveform-canvas","aria-label":"Audio waveform visualization"})}):null},vh=({onSendMessage:e,isLoading:t,disabled:n,gpcService:r,showBranding:i=!0})=>{const{t:o}=ce.useTranslation(),[a,s]=A.useState(""),[l,u]=A.useState(!1),[h,c]=A.useState(null),f=A.useRef(null);A.useEffect(()=>{!n&&!t&&!l&&f.current?.focus()},[n,t,l]),A.useEffect(()=>{f.current&&(f.current.style.height="auto",f.current.style.height=`${Math.min(f.current.scrollHeight,120)}px`)},[a]);const p=async D=>{D.preventDefault();const w=dh(a);if(!(!w||t||n||l))try{await e(w),s(""),f.current&&(f.current.style.height="auto")}catch(R){console.error("Error sending message:",R)}},m=D=>{D.key==="Enter"&&!D.shiftKey&&!l&&(D.preventDefault(),p(D))},b=async D=>{if(!r)throw new Error(o("toast.gpcServiceNotAvailable"));const w=await r.transcribeAudio(D);w.success&&w.text&&(s(w.text),f.current?.focus())},v=D=>{u(D)},k=D=>{c(D)},E=a.trim().length>0&&!t&&!n&&!l,T=t||n||l,M=n||a.trim().length>0;return d.jsxs("form",{onSubmit:p,className:"gpc-input-container",children:[d.jsxs("div",{className:"gpc-input-wrapper",children:[d.jsx("textarea",{ref:f,value:a,onChange:D=>s(D.target.value),onKeyDown:m,placeholder:l?"":o("chat.placeholder"),disabled:T,maxLength:pr.MAX_LENGTH,className:`gpc-input gpc-textarea ${l?"gpc-input-recording":""}`,"aria-label":o("chat.placeholder"),"aria-describedby":"chat-input-help",rows:1}),d.jsx(wh,{analyser:h,isRecording:l})]}),d.jsxs("div",{className:"gpc-input-actions-right",children:[d.jsx(bh,{onTranscript:b,isLoading:t,disabled:M,onRecordingStateChange:v,onAnalyserChange:k}),d.jsx("button",{type:"submit",disabled:!E,className:"gpc-send-button","aria-label":o("chat.send"),title:o("chat.send"),children:t?d.jsx("span",{className:"gpc-spinner"}):d.jsx(ie.Send,{className:"gpc-icon"})})]}),d.jsxs("div",{className:"gpc-footer-container",children:[d.jsx("span",{className:"gpc-ai-disclaimer",children:o("chat.aiDisclaimer")}),i&&d.jsx("span",{className:"gpc-powered-by",children:o("widget.poweredBy")})]}),d.jsxs("span",{id:"chat-input-help",className:"gpc-sr-only",children:[o("chat.placeholder"),"."," ",o("input.maxCharacters",{count:pr.MAX_LENGTH})]})]})},Ch=({isOpen:e,onClose:t,onConfirm:n,message:r,confirmText:i,cancelText:o,variant:a="danger"})=>{const{t:s}=ce.useTranslation();if(!e)return null;const l=h=>{h.preventDefault(),h.stopPropagation(),n(),t()},u=h=>{h.preventDefault(),h.stopPropagation(),t()};return d.jsx("div",{className:"gpc-confirm-toast-container gpc-animate-slide-down",children:d.jsxs("div",{className:`gpc-confirm-toast ${a==="danger"?"gpc-confirm-toast-danger":""}`,children:[d.jsx("p",{className:"gpc-confirm-toast-message",children:r}),d.jsxs("div",{className:"gpc-confirm-toast-actions",children:[d.jsx("button",{type:"button",onClick:u,className:"gpc-confirm-toast-button gpc-confirm-toast-button-cancel gpc-focus-visible gpc-transition",children:o||s("conversations.cancel","Cancel")}),d.jsx("button",{type:"button",onClick:l,className:"gpc-confirm-toast-button gpc-confirm-toast-button-confirm gpc-focus-visible gpc-transition",children:i||s("conversations.delete","Delete")})]})]})})},Sh=({conversations:e,totalConversations:t,currentConversationId:n,onSelectConversation:r,onNewConversation:i,onRenameConversation:o,onDeleteConversation:a,isLoadingHistory:s,hasMoreConversations:l,isLoadingMoreConversations:u,onLoadMore:h})=>{const{t:c}=ce.useTranslation(),f=A.useRef(null),[p,m]=A.useState(null),[b,v]=A.useState(""),[k,E]=A.useState({isOpen:!1,id:null,title:""});A.useEffect(()=>{const x=new IntersectionObserver(C=>{C[0].isIntersecting&&l&&!u&&!s&&h()},{threshold:1});return f.current&&x.observe(f.current),()=>{f.current&&x.unobserve(f.current)}},[l,u,s,h]);const T=x=>{const C=new Date(x),j=new Date-C,N=Math.floor(j/6e4),L=Math.floor(j/36e5),H=Math.floor(j/864e5);return N<1?c("time.justNow","Just now"):N<60?c("time.minutesAgo",`${N} min ago`,{count:N}):L<24?c("time.hoursAgo",`${L}h ago`,{count:L}):H<7?c("time.daysAgo",`${H}d ago`,{count:H}):C.toLocaleDateString()},M=x=>{m(x.conversation_id),v(x.title||"")},D=()=>{m(null),v("")},w=x=>{b.trim()&&o&&(o(x,b.trim()),m(null),v(""))},R=(x,C)=>{E({isOpen:!0,id:x,title:C||c("conversations.untitled","Untitled conversation")})},_=()=>{k.id&&a&&a(k.id),E({isOpen:!1,id:null,title:""})},F=()=>{E({isOpen:!1,id:null,title:""})};return d.jsxs("div",{className:"gpc-conversations-container",children:[d.jsxs("div",{className:"gpc-conversations-header",children:[d.jsx("h3",{className:"gpc-conversations-title",children:c("conversations.title","Conversations")}),d.jsxs("button",{type:"button",onClick:x=>{x.preventDefault(),x.stopPropagation(),i()},className:"gpc-new-conversation-button gpc-focus-visible gpc-transition",disabled:s,"aria-label":c("conversations.new","New"),children:[d.jsx(ie.MessageSquare,{size:16}),d.jsx("span",{children:c("conversations.new","New")})]})]}),d.jsx("div",{className:"gpc-conversations-list",children:e.length===0?d.jsxs("div",{className:"gpc-conversations-empty",children:[d.jsx(ie.MessageSquare,{size:48,className:"gpc-conversations-empty-icon"}),d.jsx("p",{className:"gpc-conversations-empty-text",children:c("conversations.empty","No conversations yet")}),d.jsx("p",{className:"gpc-conversations-empty-hint",children:c("conversations.emptyHint","Start a conversation to see it here")})]}):d.jsxs("div",{className:"gpc-conversations-items",children:[e.map(x=>d.jsx("div",{className:`gpc-conversation-item gpc-animate-fade-in ${n===x.conversation_id?"gpc-conversation-item-active":""} ${s?"gpc-conversation-item-disabled":""}`,children:d.jsx("div",{className:"gpc-conversation-content gpc-transition",onClick:()=>p!==x.conversation_id&&!s&&r(x.conversation_id),children:p===x.conversation_id?d.jsxs("div",{className:"gpc-conversation-edit",children:[d.jsx("input",{type:"text",value:b,onChange:C=>v(C.target.value),onKeyDown:C=>{C.key==="Enter"&&w(x.conversation_id),C.key==="Escape"&&D()},className:"gpc-conversation-edit-input gpc-focus-visible",placeholder:c("conversations.untitled","Untitled conversation"),autoFocus:!0,maxLength:200}),d.jsxs("div",{className:"gpc-conversation-edit-actions",children:[d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),w(x.conversation_id)},className:"gpc-conversation-action-button gpc-conversation-action-save gpc-focus-visible gpc-transition",title:c("conversations.save","Save"),"aria-label":c("conversations.save","Save"),children:d.jsx(ie.Check,{size:16})}),d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),D()},className:"gpc-conversation-action-button gpc-conversation-action-cancel gpc-focus-visible gpc-transition",title:c("conversations.cancel","Cancel"),"aria-label":c("conversations.cancel","Cancel"),children:d.jsx(ie.X,{size:16})})]})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"gpc-conversation-header",children:[d.jsx("h4",{className:"gpc-conversation-title",children:x.title||c("conversations.untitled","Untitled conversation")}),d.jsxs("div",{className:"gpc-conversation-actions",children:[d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),M(x)},className:"gpc-conversation-action-button gpc-focus-visible gpc-transition",disabled:s,title:c("conversations.rename","Rename"),"aria-label":c("conversations.rename","Rename"),children:d.jsx(ie.Pencil,{size:16})}),d.jsx("button",{type:"button",onClick:C=>{C.preventDefault(),C.stopPropagation(),R(x.conversation_id,x.title||c("conversations.untitled","Untitled conversation"))},className:"gpc-conversation-action-button gpc-conversation-action-delete gpc-focus-visible gpc-transition",disabled:s,title:c("conversations.delete","Delete"),"aria-label":c("conversations.delete","Delete"),children:d.jsx(ie.Trash2,{size:16})})]})]}),d.jsxs("div",{className:"gpc-conversation-metadata",children:[d.jsxs("div",{className:"gpc-conversation-meta-item",children:[d.jsx(ie.MessageSquare,{size:12}),d.jsx("span",{children:x.total_messages})]}),d.jsxs("div",{className:"gpc-conversation-meta-item",children:[d.jsx(ie.Clock,{size:12}),d.jsx("span",{children:T(x.last_modification_date)})]})]})]})})},x.conversation_id)),u&&d.jsxs("div",{className:"gpc-conversations-loading",children:[d.jsx("div",{className:"gpc-loading-spinner"}),d.jsx("span",{children:c("conversations.loadingMore","Loading more...")})]}),l&&!u&&d.jsx("div",{ref:f,style:{height:"1px"}})]})}),d.jsx(Ch,{isOpen:k.isOpen,onClose:F,onConfirm:_,message:c("conversations.confirmDelete",{title:k.title,defaultValue:`Delete "${k.title}"?`}),confirmText:c("conversations.delete","Delete"),cancelText:c("conversations.cancel","Cancel"),variant:"danger"})]})},Eh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOsAAADJCAYAAADCbsXoAAABN2lDQ1BBZG9iZSBSR0IgKDE5OTgpAAAokZWPv0rDUBSHvxtFxaFWCOLgcCdRUGzVwYxJW4ogWKtDkq1JQ5ViEm6uf/oQjm4dXNx9AidHwUHxCXwDxamDQ4QMBYvf9J3fORzOAaNi152GUYbzWKt205Gu58vZF2aYAoBOmKV2q3UAECdxxBjf7wiA10277jTG+38yH6ZKAyNguxtlIYgK0L/SqQYxBMygn2oQD4CpTto1EE9AqZf7G1AKcv8ASsr1fBBfgNlzPR+MOcAMcl8BTB1da4Bakg7UWe9Uy6plWdLuJkEkjweZjs4zuR+HiUoT1dFRF8jvA2AxH2w3HblWtay99X/+PRHX82Vun0cIQCw9F1lBeKEuf1UYO5PrYsdwGQ7vYXpUZLs3cLcBC7dFtlqF8hY8Dn8AwMZP/fNTP8gAAAAJcEhZcwAACxMAAAsTAQCanBgAAAa9aVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA2LjAtYzAwNSA3OS4xNjQ1OTAsIDIwMjAvMTIvMDktMTE6NTc6NDQgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi4xIChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjUtMDctMDlUMTg6Mzc6MjAtMDU6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDI1LTA3LTEwVDE3OjA4OjU3LTA1OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDI1LTA3LTEwVDE3OjA4OjU3LTA1OjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgcGhvdG9zaG9wOklDQ1Byb2ZpbGU9IkFkb2JlIFJHQiAoMTk5OCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OGNiZjk1NDQtOTNkOC0xZTQzLWJkYTItYzFmNTc2NjA3NGNjIiB4bXBNTTpEb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6OTU2MTBmYjUtNTU3NS1mNTQ1LWFmOGEtZDM0YTlmMjI4NTUwIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6NGEzMmM4MDMtZDA2YS0yYjRiLWI1YzEtZDA1ZWQ3MzFhYTlkIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo0YTMyYzgwMy1kMDZhLTJiNGItYjVjMS1kMDVlZDczMWFhOWQiIHN0RXZ0OndoZW49IjIwMjUtMDctMDlUMTg6Mzc6MjAtMDU6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyMi4xIChXaW5kb3dzKSIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MjE0MzlhOTgtOWNkNS1lYzRjLWFhNjAtZjgxNGNmZWVlNmNkIiBzdEV2dDp3aGVuPSIyMDI1LTA3LTA5VDE4OjU0OjE4LTA1OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjIuMSAoV2luZG93cykiIHN0RXZ0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",Th=({version:e=ot})=>{const{t}=ce.useTranslation();return d.jsxs("div",{className:"gpc-conversations-container",children:[d.jsx("div",{className:"gpc-conversations-header",children:d.jsx("h3",{className:"gpc-conversations-title",children:t("about.title")})}),d.jsxs("div",{className:"gpc-about-panel-content",children:[d.jsx("div",{className:"gpc-about-panel-logo",children:d.jsx("img",{src:Eh,alt:"TIA GPC Logo",className:"gpc-about-panel-icon",style:{width:"80px",height:"auto"}})}),d.jsxs("div",{className:"gpc-about-panel-items",children:[d.jsxs("div",{className:"gpc-about-panel-item",children:[d.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.product"),":"]}),d.jsx("span",{className:"gpc-about-panel-value",children:"TIA GPC"}),d.jsx("a",{href:"https://www.softiabot.com",target:"_blank",rel:"noopener noreferrer",className:"gpc-about-panel-link",children:"www.softiabot.com"})]}),d.jsxs("div",{className:"gpc-about-panel-item",children:[d.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.version"),":"]}),d.jsx("span",{className:"gpc-about-panel-value",children:e})]}),d.jsxs("div",{className:"gpc-about-panel-item",children:[d.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.creator"),":"]}),d.jsx("span",{className:"gpc-about-panel-value",children:"SOFTIA Technologies Inc."}),d.jsx("a",{href:"https://www.softia.ca",target:"_blank",rel:"noopener noreferrer",className:"gpc-about-panel-link",children:"Softia.ca"})]}),d.jsx("div",{className:"gpc-about-panel-footer",children:d.jsx("p",{className:"gpc-about-panel-rights",children:t("about.rights")})})]})]})]})},Ah=(e,t)=>{const{t:n}=ce.useTranslation(),[r,i]=A.useState([]),[o,a]=A.useState(!1),[s,l]=A.useState(null),[u,h]=A.useState(null),[c,f]=A.useState([]),[p,m]=A.useState(0),[b,v]=A.useState(!1),[k,E]=A.useState(!0),[T,M]=A.useState(0),[D,w]=A.useState(!0),[R,_]=A.useState(!1),[F,x]=A.useState(0),[C,z]=A.useState(!1),[j,N]=A.useState(!1),L=A.useCallback(async O=>{if(!O.trim()||o)return;const U={id:Ue(),role:"user",content:O.trim(),timestamp:new Date().toISOString()};i(K=>[...K,U]),a(!0),l(null);const W=Ue(),G={id:W,role:"assistant",content:"",timestamp:new Date().toISOString(),isStreaming:!0};i(K=>[...K,G]);try{const K=await e.sendMessage(O,X=>{i(oe=>oe.map(Ee=>Ee.id===W?{...Ee,content:Ee.content+X}:Ee))},u);i(X=>X.map(oe=>oe.id===W?{id:K.data.message_id,role:"assistant",content:K.data.response,timestamp:K.data.created_at,isStreaming:!1,metadata:{responseTimeMs:K.data.response_time_ms,modelUsed:K.data.model_used}}:oe)),K.data.conversation_id&&h(K.data.conversation_id),re()}catch(K){i(Fe=>Fe.filter(ct=>ct.id!==W));let X;try{X=JSON.parse(K.message)}catch{X={statusCode:500,message:K.message}}let oe;const Ee=X.statusCode||500,Oe=X.errorCode||"";switch(Ee===401&&Oe==="SESSION_EXPIRED"&&(oe=n("toast.sessionExpired"),t&&t()),Ee){case 401:oe||(oe=n("errors.unauthorized"));break;case 402:oe=n("errors.insufficientCredits");break;case 403:Oe.includes("DOMAIN")||Oe.includes("UNAUTHORIZED")?oe=n("errors.domainUnauthorized"):oe=n("errors.validation");break;case 422:Oe==="LOW_RELEVANCE_SCORE"&&X.message?oe=X.message:oe=n("errors.noKnowledgeAvailable");break;case 429:oe=n("errors.rateLimit");break;case 503:case 502:case 504:oe=n("errors.aiServiceUnavailable");break;case 500:oe=n("errors.serverError");break;default:oe=n("errors.generic")}l(oe);const ut={id:Ue(),role:"assistant",content:oe,timestamp:new Date().toISOString()};i(Fe=>[...Fe,ut])}finally{a(!1)}},[e,o,n,t,u]),H=A.useCallback(()=>{i([]),l(null)},[]),J=A.useCallback(()=>{l(null)},[]),ne=A.useCallback(async(O,U=!0)=>{if(!(!e||!O)){v(!0);try{const W=U?0:F,G=await e.getConversationHistory(O,50,W);if(G.success&&G.data.messages){const K=G.data.messages.flatMap(X=>[{id:`${X.message_id}-question`,role:"user",content:X.question,timestamp:X.creation_date},{id:X.message_id,role:"assistant",content:X.answer,timestamp:X.creation_date,metadata:{modelUsed:X.model}}]);U?(i(K),x(G.data.count)):(i(X=>[...K,...X]),x(X=>X+G.data.count)),z(G.data.has_more),h(O)}}catch(W){console.error("Error loading conversation history:",W),i(G=>[...G,{id:Ue(),role:"assistant",content:n("toast.failedLoadHistory"),timestamp:new Date().toISOString()}])}finally{v(!1)}}},[e,n,F]),re=A.useCallback(async(O=!0)=>{if(e)try{const U=O?0:T,W=await e.listConversations(20,U);W.success&&W.data.conversations&&(O?(f(W.data.conversations),M(W.data.count)):(f(G=>[...G,...W.data.conversations]),M(G=>G+W.data.count)),w(W.data.has_more),m(W.data.total||0))}catch(U){console.error("Error loading conversations:",U)}},[e,T]),g=A.useCallback(async()=>{if(!(!e||R||!D)){_(!0);try{await re(!1)}finally{_(!1)}}},[e,R,D,re]),le=A.useCallback(async()=>{if(!(!e||!u||j||!C)){N(!0);try{await ne(u,!1)}finally{N(!1)}}},[e,u,j,C,ne]),pe=A.useCallback(()=>{i([]),h(null),l(null),e&&e.clearLastConversation()},[n,e]),y=A.useCallback(async O=>{await ne(O)},[ne]),se=A.useCallback(async(O,U)=>{if(e)try{await e.updateConversationTitle(O,U),await re(!0)}catch(W){console.error("Error renaming conversation:",W),i(G=>[...G,{id:Ue(),role:"assistant",content:n("toast.failedRenameConversation"),timestamp:new Date().toISOString()}])}},[e,re,n]),ge=A.useCallback(async O=>{if(e)try{await e.deleteConversation(O),O===u&&(i([]),h(null)),await re(!0)}catch(U){console.error("Error deleting conversation:",U),i(W=>[...W,{id:Ue(),role:"assistant",content:n("toast.failedDeleteConversation"),timestamp:new Date().toISOString()}])}},[e,u,re,n]);return A.useEffect(()=>{(async()=>{if(!e){E(!1);return}try{const U=e.getLastConversation();U&&(i(U.messages),h(U.conversationId))}catch(U){console.error("[TIA GPC] Error restaurando conversación:",U)}finally{E(!1)}})()},[e]),A.useEffect(()=>{e&&!k&&re()},[e,re,k]),A.useEffect(()=>{e&&r.length>0&&!k&&e.saveLastConversation(u,r)},[e,r,u,k]),{messages:r,isLoading:o,error:s,sendMessage:L,clearMessages:H,clearError:J,currentConversationId:u,conversations:c,totalConversations:p,isLoadingHistory:b,loadConversationHistory:ne,loadConversations:re,startNewConversation:pe,switchConversation:y,renameConversation:se,deleteConversation:ge,isRestoringConversation:k,hasMoreConversations:D,isLoadingMoreConversations:R,loadMoreConversations:g,hasMoreMessages:C,isLoadingMoreMessages:j,loadMoreMessages:le}},Ih=({gpcService:e,licenseToken:t,widgetConfig:n,onClose:r,themeMode:i,onToggleTheme:o,showBranding:a=!0,showMetadata:s=!1,onError:l,version:u=ot,onRequestMcpLogin:h,mcpLoggedIn:c=!1})=>{const{t:f}=ce.useTranslation(),[p,m]=A.useState(!1),[b,v]=A.useState(!1),k=n?.mcp?.enabled&&n?.mcp?.auth_mode==="credentials",E=i,T=o,M=A.useCallback(()=>{},[]),{messages:D,isLoading:w,sendMessage:R,currentConversationId:_,conversations:F,totalConversations:x,isLoadingHistory:C,startNewConversation:z,switchConversation:j,renameConversation:N,deleteConversation:L,isRestoringConversation:H,hasMoreConversations:J,isLoadingMoreConversations:ne,loadMoreConversations:re,hasMoreMessages:g,isLoadingMoreMessages:le,loadMoreMessages:pe}=Ah(e,M),y=A.useCallback(()=>{m(G=>!G),v(!1)},[]),se=A.useCallback(()=>{v(G=>!G),m(!1)},[]),ge=A.useCallback(()=>{h?.(c?"logout":"login")},[c,h]),O=A.useCallback(G=>{j(G),m(!1)},[j]),U=A.useCallback(()=>{z(),m(!1)},[z]);A.useEffect(()=>()=>{e&&e.releaseSession().catch(G=>{console.error("Failed to release session:",G)})},[e]);const W=d.jsx(Ri,{onClose:r,theme:E,onToggleTheme:T,showBranding:a,widgetConfig:n,onToggleConversations:y,showConversations:p,conversationsCount:x,onToggleAbout:se,showAbout:b,version:u,onToggleMcpLogin:k?ge:void 0,showMcpLogin:!1,mcpLoggedIn:c});return p||b?d.jsxs("div",{className:`gpc-chat-window gpc-animate-fade-in ${E==="dark"?"gpc-dark":""}`,children:[W,d.jsxs("div",{className:"gpc-conversations-overlay-body",children:[p&&d.jsx(Sh,{conversations:F,totalConversations:x,currentConversationId:_,onSelectConversation:O,onNewConversation:U,onRenameConversation:N,onDeleteConversation:L,isLoadingHistory:C,hasMoreConversations:J,isLoadingMoreConversations:ne,onLoadMore:re}),b&&d.jsx(Th,{version:u})]})]}):d.jsxs("div",{className:`gpc-chat-window gpc-animate-fade-in ${E==="dark"?"gpc-dark":""}`,children:[W,d.jsx(yh,{messages:D,isLoading:w||C||H,showMetadata:s,widgetConfig:n,hasMoreMessages:g,isLoadingMoreMessages:le,onLoadMoreMessages:pe}),d.jsx(vh,{onSendMessage:R,isLoading:w||H,disabled:H,gpcService:e,showBranding:a})]})},Nh=({gpcService:e,mcpConfig:t,onSuccess:n,onSkip:r,onError:i})=>{const{t:o}=ce.useTranslation(),[a,s]=A.useState(null),[l,u]=A.useState(null),[h,c]=A.useState(""),[f,p]=A.useState(""),[m,b]=A.useState(!1),[v,k]=A.useState(!0),[E,T]=A.useState(null),[M,D]=A.useState("captcha"),[w,R]=A.useState({}),_=t?.enabled&&t?.auth_mode==="credentials",F=t?.login_fields?.length?t.login_fields:[{key:"username",label:"Usuario",type:"text"},{key:"password",label:"Contraseña",type:"password"}];A.useEffect(()=>{const N=localStorage.getItem(Le.VERIFIED),L=localStorage.getItem(Le.TIMESTAMP),H=N==="true"&&L&&Date.now()-parseInt(L,10)<fr;_&&H?(D("mcp"),k(!1)):x()},[]);const x=async()=>{k(!0),p(""),c("");try{const N=await e.generateCaptchaChallenge();if(N.success&&N.challenge_id)s(N.question),u(N.challenge_id);else throw new Error("Failed to generate challenge")}catch(N){p(o("captcha.errorGenerating","Error generating challenge. Please try again.")),i&&i(N)}finally{k(!1)}},C=async N=>{N.preventDefault(),p(""),b(!0);try{const L=parseInt(h,10);if(isNaN(L)){p(o("captcha.invalidNumber")),b(!1);return}const H=await e.verifyCaptchaAnswer(l,L);if(H.success)localStorage.setItem(Le.VERIFIED,"true"),localStorage.setItem(Le.TIMESTAMP,Date.now().toString()),_?D("mcp"):n&&n();else{const J=H.attempts_remaining;T(J),J!==void 0&&J>0?p(o("captcha.incorrectAnswerWithAttempts",{attempts:J,defaultValue:"Incorrect answer. {{attempts}} attempts remaining"})):p(o("captcha.incorrectAnswer")),c(""),b(!1)}}catch(L){switch(L.error_code){case"CHALLENGE_NOT_FOUND":case"CHALLENGE_EXPIRED":p(o("captcha.challengeExpired","Challenge expired. Generating a new one...")),setTimeout(()=>x(),2e3);break;case"MAX_ATTEMPTS_EXCEEDED":p(o("captcha.maxAttemptsExceeded","Maximum attempts exceeded. Generating a new challenge...")),setTimeout(()=>x(),2e3);break;case"INVALID_SESSION":p(o("captcha.invalidSession","Invalid session. Please refresh the page."));break;default:p(o("captcha.error"))}b(!1),i&&i(L)}},z=N=>{const L=N.target.value;(L===""||/^\d+$/.test(L))&&(c(L),p(""))},j=async N=>{if(N.preventDefault(),!F.every(H=>w[H.key]?.trim())){p(o("moodle.requiredFields"));return}b(!0),p("");try{(await e.verifyMcpCredentials(w)).success?(sessionStorage.setItem("mcp_login_data",JSON.stringify(w)),n&&n()):p(o("moodle.invalidCredentials","Credenciales incorrectas. Intenta nuevamente."))}catch(H){let J={};try{J=JSON.parse(H.message)}catch{}J.errorCode==="INVALID_CREDENTIALS"?p(o("moodle.invalidCredentials","Credenciales incorrectas. Intenta nuevamente.")):J.errorCode==="NETWORK_ERROR"?p(o("moodle.networkError","Error de conexión. Verifica tu red e intenta nuevamente.")):p(o("moodle.verificationError","Error al verificar. Intenta nuevamente.")),i&&i(H)}finally{b(!1)}};if(M==="mcp"){const N=t?.display_name||o("moodle.title");return d.jsx("div",{className:"gpc-captcha-container",children:d.jsxs("div",{className:"gpc-captcha-content",children:[d.jsxs("div",{className:"gpc-captcha-header",children:[d.jsx("svg",{className:"gpc-captcha-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),d.jsx("h3",{className:"gpc-captcha-title",children:N}),d.jsx("p",{className:"gpc-captcha-subtitle",children:o("moodle.subtitle")})]}),d.jsxs("form",{onSubmit:j,className:"gpc-captcha-form",children:[d.jsx("div",{className:"gpc-captcha-fields-scroll",children:F.map((L,H)=>d.jsxs("div",{className:"gpc-captcha-question",children:[d.jsx("label",{className:"gpc-captcha-label",children:L.label}),d.jsx("input",{type:L.type||"text",value:w[L.key]||"",onChange:J=>{R(ne=>({...ne,[L.key]:J.target.value})),p("")},className:"gpc-captcha-text-input",autoFocus:H===0,autoComplete:L.type==="password"?"current-password":L.key})]},L.key))}),f&&d.jsxs("div",{className:"gpc-captcha-error",children:[d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),d.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12",strokeWidth:2,strokeLinecap:"round"}),d.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16",strokeWidth:2,strokeLinecap:"round"})]}),d.jsx("span",{children:f})]}),d.jsx("button",{type:"submit",className:"gpc-captcha-button",disabled:m||!F.every(L=>w[L.key]?.trim()),children:m?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"gpc-spinner gpc-button-spinner"}),o("captcha.verifying")]}):o("moodle.submit")})]}),r&&d.jsx("button",{type:"button",className:"gpc-captcha-skip",onClick:r,children:o("moodle.skip")})]})})}return v||!a?d.jsxs("div",{className:"gpc-captcha-loading",children:[d.jsx("div",{className:"gpc-spinner"}),d.jsx("p",{children:o("captcha.loading","Loading challenge...")})]}):d.jsx("div",{className:"gpc-captcha-container",children:d.jsxs("div",{className:"gpc-captcha-content",children:[d.jsxs("div",{className:"gpc-captcha-header",children:[d.jsx("svg",{className:"gpc-captcha-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),d.jsx("h3",{className:"gpc-captcha-title",children:o("captcha.title")}),d.jsx("p",{className:"gpc-captcha-subtitle",children:o("captcha.subtitle")})]}),d.jsxs("form",{onSubmit:C,className:"gpc-captcha-form",children:[d.jsxs("div",{className:"gpc-captcha-question",children:[d.jsx("label",{htmlFor:"captcha-answer",className:"gpc-captcha-label",children:o("captcha.question")}),d.jsxs("div",{className:"gpc-captcha-challenge",children:[d.jsx("span",{className:"gpc-captcha-math",children:a}),d.jsx("span",{className:"gpc-captcha-equals",children:"="}),d.jsx("input",{id:"captcha-answer",type:"text",inputMode:"numeric",pattern:"[0-9]*",value:h,onChange:z,placeholder:"?",className:`gpc-captcha-input ${f?"gpc-captcha-input-error":""}`,disabled:m,autoFocus:!0,autoComplete:"off"})]})]}),f&&d.jsxs("div",{className:"gpc-captcha-error",children:[d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),d.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12",strokeWidth:2,strokeLinecap:"round"}),d.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16",strokeWidth:2,strokeLinecap:"round"})]}),d.jsx("span",{children:f})]}),E!==null&&E>0&&d.jsx("div",{className:"gpc-captcha-attempts",children:o("captcha.attemptsLeft",{count:E,defaultValue:"{{count}} attempts remaining"})}),d.jsx("button",{type:"submit",className:"gpc-captcha-button",disabled:m||!h,children:m?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"gpc-spinner gpc-button-spinner"}),o("captcha.verifying")]}):o("captcha.verify")})]}),d.jsx("p",{className:"gpc-captcha-info",children:o("captcha.info")})]})})};class Dh{constructor(t,n){this.licenseToken=n,this.baseURL=t||ki,this.client=Di.create({baseURL:this.baseURL,timeout:uh.API_REQUEST,headers:{"Content-Type":"application/json"}}),this.client.interceptors.request.use(r=>(this.licenseToken&&(r.headers.Authorization=`Bearer ${this.licenseToken}`),r))}handleError(t){if(t.response){const n=t.response.data,i={statusCode:t.response.status,errorCode:n.error_code||"UNKNOWN_ERROR",message:n.message||"Request failed",retryAfter:n.retry_after_seconds||null};throw new Error(JSON.stringify(i))}else throw t.request?new Error(JSON.stringify({statusCode:503,errorCode:"NETWORK_ERROR",message:"No response from server",retryAfter:null})):new Error(JSON.stringify({statusCode:500,errorCode:"INTERNAL_ERROR",message:t.message,retryAfter:null}))}async get(t,n={}){try{return(await this.client.get(t,n)).data}catch(r){this.handleError(r)}}async post(t,n,r={}){try{return(await this.client.post(t,n,r)).data}catch(i){this.handleError(i)}}async put(t,n,r={}){try{return(await this.client.put(t,n,r)).data}catch(i){this.handleError(i)}}async patch(t,n,r={}){try{return(await this.client.patch(t,n,r)).data}catch(i){this.handleError(i)}}async delete(t,n={}){try{return(await this.client.delete(t,n)).data}catch(r){this.handleError(r)}}getClient(){return this.client}}class Ci{constructor(t="tiagpc"){this.prefix=t}_getKey(t){return`${this.prefix}_${t}`}set(t,n){try{const r=this._getKey(t),i=JSON.stringify(n);return localStorage.setItem(r,i),!0}catch(r){return console.warn(`[StorageService] Error guardando ${t}:`,r),!1}}get(t){try{const n=this._getKey(t),r=localStorage.getItem(n);return r===null?null:JSON.parse(r)}catch(n){return console.warn(`[StorageService] Error leyendo ${t}:`,n),this.remove(t),null}}remove(t){try{const n=this._getKey(t);return localStorage.removeItem(n),!0}catch(n){return console.warn(`[StorageService] Error eliminando ${t}:`,n),!1}}has(t){const n=this._getKey(t);return localStorage.getItem(n)!==null}clear(){try{return Object.keys(localStorage).filter(r=>r.startsWith(`${this.prefix}_`)).forEach(r=>{localStorage.removeItem(r)}),!0}catch(t){return console.warn("[StorageService] Error limpiando datos:",t),!1}}setWithTimestamp(t,n){return this.set(t,{data:n,timestamp:Date.now()})}getWithExpiry(t,n){const r=this.get(t);return!r||!r.timestamp?null:Date.now()-r.timestamp>n?(this.remove(t),null):r.data}}class Lh{constructor(t,n){this.licenseToken=t,this.httpClient=n,this.storage=new Ci("tiagpc"),this.sessionToken=this._getOrCreateSessionToken()}_generateSessionToken(){return"session_"+Array.from(crypto.getRandomValues(new Uint8Array(28))).map(t=>t.toString(16).padStart(2,"0")).join("")}_getSessionKey(){return`session_${this.licenseToken.substring(0,16)}`}_getOrCreateSessionToken(){const t=this._getSessionKey(),n=this.storage.get(t);if(n&&n.sessionToken)return n.sessionToken;const r=this._generateSessionToken();return this._saveSessionToken(r,!1),r}_saveSessionToken(t,n=!1){const r=this._getSessionKey();this.storage.set(r,{sessionToken:t,timestamp:Date.now(),validated:n})}hasValidCachedSession(){const t=this._getSessionKey(),n=this.storage.get(t);if(!n)return!1;const{validated:r,timestamp:i}=n,o=Date.now(),a=1440*60*1e3;return r&&o-i<a}async validateSession(){try{return await this.httpClient.post("/validate-session",{session_token:this.sessionToken})}catch{return this.clearSession(),{success:!1,valid:!1}}}validateSessionLocally(){this._saveSessionToken(this.sessionToken,!0)}resetValidation(){this._saveSessionToken(this.sessionToken,!1)}getSessionToken(){return this.sessionToken}renewSessionToken(){const t=this._generateSessionToken();return this.sessionToken=t,this._saveSessionToken(t,!1),t}clearSession(){const t=this._getSessionKey();this.storage.remove(t)}async releaseSession(){if(!this.licenseToken){console.warn("[SessionService] No license token available to release session");return}try{return await this.httpClient.post("/release-session",{session_token:this.sessionToken})}catch(t){console.error("[SessionService] Failed to release session:",t.message)}}}class Ph{constructor(t,n,r){this.licenseToken=t,this.sessionToken=n,this.httpClient=r,this.storage=new Ci("tiagpc")}_getLastConversationKey(){return`last_conversation_${this.licenseToken.substring(0,16)}`}async listConversations(t=20,n=0){return await this.httpClient.get("/conversations",{params:{limit:t,offset:n},headers:{"X-Session-Token":this.sessionToken}})}async getConversationHistory(t,n=50,r=0){return await this.httpClient.get(`/conversation/${t}/history`,{params:{limit:n,offset:r}})}async getCurrentConversation(){return await this.httpClient.get("/conversation/current",{headers:{"X-Session-Token":this.sessionToken}})}saveLastConversation(t,n){const r=this._getLastConversationKey();return this.storage.setWithTimestamp(r,{conversationId:t,messages:n})}getLastConversation(t=1440*60*1e3){const n=this._getLastConversationKey();return this.storage.getWithExpiry(n,t)}clearLastConversation(){const t=this._getLastConversationKey();return this.storage.remove(t)}hasLastConversation(){const t=this._getLastConversationKey();return this.storage.has(t)}async updateConversationTitle(t,n){return await this.httpClient.patch(`/conversation/${t}/title`,{new_title:n},{headers:{"X-Session-Token":this.sessionToken}})}async deleteConversation(t){return await this.httpClient.delete(`/conversation/${t}`,{headers:{"X-Session-Token":this.sessionToken}})}}function jh(){const e={};return ji.forEach(t=>{e[t]=""}),{...e,client_timestamp:Date.now()/1e3,screen_resolution:`${window.screen.width}x${window.screen.height}`,timezone:-new Date().getTimezoneOffset()/60,platform:navigator.platform||"unknown",language:navigator.language||"unknown",color_depth:window.screen.colorDepth||"unknown"}}class zh{constructor(t,n,r){this.licenseToken=t,this.sessionToken=n,this.httpClient=r}async sendMessage(t,n,r=null){const o=`${this.httpClient.baseURL}/ask`,a=jh(),s={message:t,session_token:this.sessionToken,request_metadata:a};r&&(s.conversation_id=r);const l=sessionStorage.getItem("mcp_login_data");if(l)try{s.mcp_login_data=JSON.parse(l)}catch{sessionStorage.removeItem("mcp_login_data")}try{const u=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.licenseToken}`},body:JSON.stringify(s)});if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(JSON.stringify({statusCode:u.status,errorCode:h.error_code||"UNKNOWN_ERROR",message:h.message||"Request failed",retryAfter:h.retry_after_seconds||null}))}return await this._processSSEResponse(u,n)}catch(u){throw u.message.startsWith("{")?u:new Error(JSON.stringify({statusCode:500,errorCode:"NETWORK_ERROR",message:u.message,retryAfter:null}))}}async _processSSEResponse(t,n){const r=t.body.getReader(),i=new TextDecoder;let o="",a="",s=null,l=null;for(;;){const{done:u,value:h}=await r.read();if(u)break;o+=i.decode(h,{stream:!0});const c=o.split(`
30
+ `);o=c.pop();for(const f of c){if(!f.trim()||!f.startsWith("data: "))continue;const p=f.replace("data: ","").trim();if(p!=="[DONE]")try{const m=JSON.parse(p);if(m.type==="content")a+=m.text,n&&n(m.text);else if(m.type==="metadata")s=m;else if(m.type==="summary")l=m;else if(m.type==="error")throw new Error(JSON.stringify({statusCode:m.status_code||500,errorCode:m.error_code,message:m.message,retryAfter:null}))}catch(m){if(m.message&&m.message.startsWith("{"))throw m;console.error("[MessageService] Error parsing SSE event:",m)}}}if(!l)throw new Error("No summary received from server");return{success:!0,data:{message_id:l.message_id,conversation_id:l.conversation_id,response:a,response_time_ms:l.response_time_ms,model_used:l.model_used,created_at:l.created_at}}}async transcribeAudio(t){const n=new FormData;return n.append("file",t,"audio.webm"),(await this.httpClient.getClient().post("/transcribe",n,{headers:{"Content-Type":"multipart/form-data"}})).data}}class bn{constructor(t,n){if(!n)throw new Error("License token is required");this.licenseToken=n,this.httpClient=new Dh(t,n),this.sessionService=new Lh(n,this.httpClient),this.conversationService=new Ph(n,this.sessionService.getSessionToken(),this.httpClient),this.messageService=new zh(n,this.sessionService.getSessionToken(),this.httpClient)}getSessionToken(){return this.sessionService.getSessionToken()}hasValidCachedSession(){return this.sessionService.hasValidCachedSession()}async validateSession(){return await this.sessionService.validateSession()}validateSessionLocally(){this.sessionService.validateSessionLocally()}renewSessionToken(){const t=this.sessionService.renewSessionToken();return this.conversationService.sessionToken=t,this.messageService.sessionToken=t,t}async releaseSession(){return await this.sessionService.releaseSession()}async listConversations(t=20){return await this.conversationService.listConversations(t)}async getConversationHistory(t,n=50){return await this.conversationService.getConversationHistory(t,n)}async getCurrentConversation(){return await this.conversationService.getCurrentConversation()}saveLastConversation(t,n){return this.conversationService.saveLastConversation(t,n)}getLastConversation(t=1440*60*1e3){return this.conversationService.getLastConversation(t)}clearLastConversation(){return this.conversationService.clearLastConversation()}async updateConversationTitle(t,n){return await this.conversationService.updateConversationTitle(t,n)}async deleteConversation(t){return await this.conversationService.deleteConversation(t)}async sendMessage(t,n,r=null){if(!this.licenseToken)throw new Error("License token is required.");return await this.messageService.sendMessage(t,n,r)}async transcribeAudio(t){if(!this.licenseToken)throw new Error("License token is required.");return await this.messageService.transcribeAudio(t)}async getInitConfig(){if(!this.licenseToken)throw new Error("License token is required.");return await this.httpClient.get("/init")}async checkHealth(){try{return await this.httpClient.get("/health")}catch(t){return{status:"unhealthy",error:t.message}}}async generateCaptchaChallenge(){if(!this.licenseToken)throw new Error("License token is required.");return await this.httpClient.post("/captcha/challenge",{session_token:this.getSessionToken()})}async verifyCaptchaAnswer(t,n){if(!this.licenseToken)throw new Error("License token is required.");return await this.httpClient.post("/captcha/verify",{challenge_id:t,answer:parseInt(n,10),session_token:this.getSessionToken()})}async verifyMcpCredentials(t){if(!this.licenseToken)throw new Error("License token is required.");return await this.httpClient.post("/mcp/verify-credentials",{login_data:t,session_token:this.getSessionToken()})}}let mt=null;const Mh=(e,t)=>((!mt||t&&mt.licenseToken!==t)&&(mt=new bn(e,t)),mt),Rh=(e="auto")=>{const[t,n]=A.useState(e),[r,i]=A.useState("light"),o=A.useRef(!1);return A.useEffect(()=>{o.current||n(e)},[e]),A.useEffect(()=>{if(i(t==="auto"?fh():t),t==="auto"){const l=window.matchMedia("(prefers-color-scheme: dark)"),u=h=>{i(h.matches?"dark":"light")};return l.addEventListener("change",u),()=>{l.removeEventListener("change",u)}}},[t]),{theme:r,themeMode:t,setThemeMode:n,toggleTheme:()=>{o.current=!0,n(s=>s==="auto"?r==="light"?"dark":"light":s==="light"?"dark":"light")}}},Oh={title:"TIA GPC",poweredBy:"Desarrollado por SOFTIA.ca",questionsTo:"Preguntas a",validatingSession:"Validando sesión..."},Fh={title:"Asistente",placeholder:"Escribe tu pregunta...",send:"Enviar",close:"Cerrar",aiDisclaimer:"La IA puede cometer errores. Considera verificar la información importante.",welcome:"¡Hola! Bienvenido a {{companyName}}. ¿En qué puedo ayudarte hoy?",emptyState:"Inicia una conversación escribiendo tu pregunta",validation:"Verificando seguridad...",retry:"Reintentar",loadingMore:"Cargando mensajes anteriores..."},_h={record:"Grabar audio",recording:"Grabando...",stop:"Detener grabación",processing:"Transcribiendo audio...",error:"Error al transcribir audio",unsupported:"Tu navegador no soporta grabación de audio",permissionDenied:"Permiso de micrófono denegado"},Bh={light:"Claro",dark:"Oscuro",toggle:"Cambiar tema"},Hh={unauthorized:"Autenticación fallida. Por favor, verifica tu token de licencia e intenta nuevamente.",validation:"Verificación anti-bot fallida. Por favor, recarga la página e intenta nuevamente.",network:"No se pudo conectar al servidor. Verifica tu conexión a internet.",rateLimit:"Has realizado demasiadas consultas o se alcanzó el límite de usuarios concurrentes. Por favor, espera un momento antes de continuar.",session:"Tu sesión ha expirado por inactividad. Por favor, recarga la página para continuar.",insufficientCredits:"Créditos insuficientes. Por favor, recarga créditos desde tu panel de administración para continuar usando TIA GPC.",generic:"Ha ocurrido un error inesperado. Por favor, intenta nuevamente.",aiServiceUnavailable:"El asistente está temporalmente no disponible. Por favor, intenta de nuevo en unos momentos.",serverError:"El servidor encontró un problema. Por favor, intenta de nuevo más tarde.",domainUnauthorized:"Este dominio no está autorizado para usar este widget. Por favor, contacta a tu administrador.",noKnowledgeAvailable:"Lo siento, no tengo respuesta para tu consulta. ¿Podrías darme un poco más de detalle o decirlo de otra forma?"},Uh={tokensUsed:"Tokens usados",responseTime:"Tiempo de respuesta",model:"Modelo"},qh={title:"Conversaciones",new:"Nueva",empty:"No hay conversaciones aún",emptyHint:"Inicia una conversación para verla aquí",untitled:"Conversación sin título",loadingMore:"Cargando más...",toggle:"Alternar conversaciones",rename:"Renombrar",delete:"Eliminar",save:"Guardar",cancel:"Cancelar",confirmDelete:'¿Eliminar "{{title}}"?'},Wh={justNow:"Justo ahora",minutesAgo:"hace {{count}} min",minutesAgo_one:"hace 1 min",minutesAgo_other:"hace {{count}} min",hoursAgo:"hace {{count}}h",hoursAgo_one:"hace 1h",hoursAgo_other:"hace {{count}}h",daysAgo:"hace {{count}}d",daysAgo_one:"hace 1d",daysAgo_other:"hace {{count}}d"},Vh={languageSelector:{label:"Cambiar idioma"},menu:"Más opciones",spinner:{loading:"Cargando"},typingIndicator:{typing:"Escribiendo"},message:{userMessage:"Mensaje del usuario",assistantMessage:"Mensaje del asistente"}},Gh={english:"English",spanish:"Español",french:"Français"},Yh={maxCharacters:"Máximo {{count}} caracteres"},Zh={title:"Verificación de seguridad",subtitle:"Por favor, resuelve esta operación matemática para continuar",question:"¿Cuánto es?",verify:"Verificar",verifying:"Verificando...",loading:"Cargando desafío...",incorrectAnswer:"Respuesta incorrecta. Inténtalo de nuevo",incorrectAnswerWithAttempts:"Respuesta incorrecta. Te quedan {{attempts}} intentos",invalidNumber:"Por favor, ingresa un número válido",error:"Error al verificar. Por favor, intenta nuevamente",errorGenerating:"Error al generar el desafío. Por favor, intenta nuevamente",challengeExpired:"El desafío ha expirado. Generando uno nuevo...",maxAttemptsExceeded:"Se excedió el número máximo de intentos. Generando un nuevo desafío...",invalidSession:"Sesión inválida. Por favor, recarga la página",attemptsLeft:"Te quedan {{count}} intentos",info:"Esta verificación se realiza solo una vez para proteger el servicio"},Jh={antiBotValidationPending:"Validación anti-bot pendiente",newConversationStarted:"Nueva conversación iniciada",failedLoadHistory:"No se pudo cargar el historial de la conversación",sessionExpired:"Sesión expirada, por favor verifica nuevamente",gpcServiceNotAvailable:"Servicio GPC no disponible",conversationRenamed:"Conversación renombrada exitosamente",failedRenameConversation:"No se pudo renombrar la conversación",conversationDeleted:"Conversación eliminada exitosamente",failedDeleteConversation:"No se pudo eliminar la conversación"},Qh={title:"Acceso a Moodle",subtitle:"Ingresa tus credenciales para acceder a tu contenido personalizado",username:"Usuario",password:"Contraseña",submit:"Ingresar",requiredFields:"Usuario y contraseña son requeridos",skip:"Continuar sin iniciar sesión",login:"Iniciar sesión en Moodle",logout:"Cerrar sesión de Moodle"},Xh={title:"Acerca de",product:"Producto",version:"Versión",creator:"Creador",rights:"Todos los derechos reservados.",close:"Cerrar"},Kh={widget:Oh,chat:Fh,voice:_h,theme:Bh,errors:Hh,metadata:Uh,conversations:qh,time:Wh,ui:Vh,languages:Gh,input:Yh,captcha:Zh,toast:Jh,moodle:Qh,about:Xh},$h={title:"TIA GPC",poweredBy:"Powered by SOFTIA.ca",questionsTo:"Questions to",validatingSession:"Validating session..."},ep={title:"Assistant",placeholder:"Type your question...",send:"Send",close:"Close",aiDisclaimer:"AI can make mistakes. Consider verifying important information.",welcome:"Hello! Welcome to {{companyName}}. How can I help you today?",emptyState:"Start a conversation by typing your question",validation:"Verifying security...",retry:"Retry",loadingMore:"Loading older messages..."},tp={record:"Record audio",recording:"Recording...",stop:"Stop recording",processing:"Transcribing audio...",error:"Error transcribing audio",unsupported:"Your browser does not support audio recording",permissionDenied:"Microphone permission denied"},np={light:"Light",dark:"Dark",toggle:"Toggle theme"},rp={unauthorized:"Authentication failed. Please check your license token and try again.",validation:"Bot verification failed. Please reload the page and try again.",network:"Unable to connect to the server. Please check your internet connection.",rateLimit:"You've made too many requests or the concurrent user limit has been reached. Please wait a moment before continuing.",session:"Your session has expired due to inactivity. Please reload the page to continue.",insufficientCredits:"Insufficient credits. Please reload credits from your admin panel to continue using TIA GPC.",generic:"An unexpected error has occurred. Please try again.",aiServiceUnavailable:"The assistant is temporarily unavailable. Please try again in a few moments.",serverError:"The server encountered a problem. Please try again later.",domainUnauthorized:"This domain is not authorized to use this widget. Please contact your administrator.",noKnowledgeAvailable:"Sorry, I don't have an answer for your query. Could you provide a bit more detail or phrase it differently?"},ip={tokensUsed:"Tokens used",responseTime:"Response time",model:"Model"},op={title:"Conversations",new:"New",empty:"No conversations yet",emptyHint:"Start a conversation to see it here",untitled:"Untitled conversation",loadingMore:"Loading more...",toggle:"Toggle conversations",rename:"Rename",delete:"Delete",save:"Save",cancel:"Cancel",confirmDelete:'Delete "{{title}}"?'},ap={justNow:"Just now",minutesAgo:"{{count}} min ago",minutesAgo_one:"1 min ago",minutesAgo_other:"{{count}} min ago",hoursAgo:"{{count}}h ago",hoursAgo_one:"1h ago",hoursAgo_other:"{{count}}h ago",daysAgo:"{{count}}d ago",daysAgo_one:"1d ago",daysAgo_other:"{{count}}d ago"},sp={languageSelector:{label:"Change language"},menu:"More options",spinner:{loading:"Loading"},typingIndicator:{typing:"Typing"},message:{userMessage:"User message",assistantMessage:"Assistant message"}},lp={english:"English",spanish:"Español",french:"Français"},up={maxCharacters:"Maximum {{count}} characters"},cp={title:"Security verification",subtitle:"Please solve this math problem to continue",question:"What is?",verify:"Verify",verifying:"Verifying...",loading:"Loading challenge...",incorrectAnswer:"Incorrect answer. Please try again",incorrectAnswerWithAttempts:"Incorrect answer. {{attempts}} attempts remaining",invalidNumber:"Please enter a valid number",error:"Error verifying. Please try again",errorGenerating:"Error generating challenge. Please try again",challengeExpired:"Challenge expired. Generating a new one...",maxAttemptsExceeded:"Maximum attempts exceeded. Generating a new challenge...",invalidSession:"Invalid session. Please refresh the page",attemptsLeft:"{{count}} attempts remaining",info:"This verification is done only once to protect the service"},hp={antiBotValidationPending:"Anti-bot validation pending",newConversationStarted:"New conversation started",failedLoadHistory:"Failed to load conversation history",sessionExpired:"Session expired, please verify again",gpcServiceNotAvailable:"GPC Service not available",conversationRenamed:"Conversation renamed successfully",failedRenameConversation:"Failed to rename conversation",conversationDeleted:"Conversation deleted successfully",failedDeleteConversation:"Failed to delete conversation"},pp={title:"Moodle Access",subtitle:"Enter your credentials to access your personalized content",username:"Username",password:"Password",submit:"Sign in",requiredFields:"Username and password are required",skip:"Continue without signing in",login:"Sign in to Moodle",logout:"Sign out of Moodle"},fp={title:"About",product:"Product",version:"Version",creator:"Creator",rights:"All rights reserved.",close:"Close"},dp={widget:$h,chat:ep,voice:tp,theme:np,errors:rp,metadata:ip,conversations:op,time:ap,ui:sp,languages:lp,input:up,captcha:cp,toast:hp,moodle:pp,about:fp},mp={title:"TIA GPC",poweredBy:"Propulsé par SOFTIA.ca",questionsTo:"Questions à",validatingSession:"Validation de la session..."},gp={title:"Assistant",placeholder:"Tapez votre question...",send:"Envoyer",close:"Fermer",aiDisclaimer:"L'IA peut faire des erreurs. Pensez à vérifier les informations importantes.",welcome:"Bonjour ! Bienvenue à {{companyName}}. Comment puis-je vous aider aujourd'hui ?",emptyState:"Commencez une conversation en tapant votre question",validation:"Vérification de sécurité...",retry:"Réessayer",loadingMore:"Chargement des messages précédents..."},yp={record:"Enregistrer audio",recording:"Enregistrement...",stop:"Arrêter l'enregistrement",processing:"Transcription audio...",error:"Erreur de transcription audio",unsupported:"Votre navigateur ne prend pas en charge l'enregistrement audio",permissionDenied:"Permission du microphone refusée"},xp={light:"Clair",dark:"Sombre",toggle:"Changer de thème"},kp={unauthorized:"Échec de l'authentification. Veuillez vérifier votre jeton de licence et réessayer.",validation:"La vérification anti-bot a échoué. Veuillez recharger la page et réessayer.",network:"Impossible de se connecter au serveur. Veuillez vérifier votre connexion internet.",rateLimit:"Vous avez fait trop de demandes ou la limite d'utilisateurs concurrents a été atteinte. Veuillez patienter un moment avant de continuer.",session:"Votre session a expiré en raison d'inactivité. Veuillez recharger la page pour continuer.",insufficientCredits:"Crédits insuffisants. Veuillez recharger des crédits depuis votre panneau d'administration pour continuer à utiliser TIA GPC.",generic:"Une erreur inattendue s'est produite. Veuillez réessayer.",aiServiceUnavailable:"L'assistant est temporairement indisponible. Veuillez réessayer dans quelques instants.",serverError:"Le serveur a rencontré un problème. Veuillez réessayer plus tard.",domainUnauthorized:"Ce domaine n'est pas autorisé à utiliser ce widget. Veuillez contacter votre administrateur.",noKnowledgeAvailable:"Désolé, je n'ai pas de réponse à votre requête. Pourriez-vous me donner un peu plus de détails ou le formuler autrement ?"},bp={tokensUsed:"Tokens utilisés",responseTime:"Temps de réponse",model:"Modèle"},wp={title:"Conversations",new:"Nouvelle",empty:"Aucune conversation pour le moment",emptyHint:"Démarrez une conversation pour la voir ici",untitled:"Conversation sans titre",loadingMore:"Chargement...",toggle:"Basculer les conversations",rename:"Renommer",delete:"Supprimer",save:"Enregistrer",cancel:"Annuler",confirmDelete:'Supprimer "{{title}}" ?'},vp={justNow:"À l'instant",minutesAgo:"il y a {{count}} min",minutesAgo_one:"il y a 1 min",minutesAgo_other:"il y a {{count}} min",hoursAgo:"il y a {{count}}h",hoursAgo_one:"il y a 1h",hoursAgo_other:"il y a {{count}}h",daysAgo:"il y a {{count}}j",daysAgo_one:"il y a 1j",daysAgo_other:"il y a {{count}}j"},Cp={languageSelector:{label:"Changer de langue"},menu:"Plus d'options",spinner:{loading:"Chargement"},typingIndicator:{typing:"Écriture en cours"},message:{userMessage:"Message de l'utilisateur",assistantMessage:"Message de l'assistant"}},Sp={english:"English",spanish:"Español",french:"Français"},Ep={maxCharacters:"Maximum {{count}} caractères"},Tp={title:"Vérification de sécurité",subtitle:"Veuillez résoudre ce problème mathématique pour continuer",question:"Combien fait?",verify:"Vérifier",verifying:"Vérification...",loading:"Chargement du défi...",incorrectAnswer:"Réponse incorrecte. Veuillez réessayer",incorrectAnswerWithAttempts:"Réponse incorrecte. {{attempts}} tentatives restantes",invalidNumber:"Veuillez entrer un nombre valide",error:"Erreur de vérification. Veuillez réessayer",errorGenerating:"Erreur lors de la génération du défi. Veuillez réessayer",challengeExpired:"Le défi a expiré. Génération d'un nouveau...",maxAttemptsExceeded:"Nombre maximum de tentatives dépassé. Génération d'un nouveau défi...",invalidSession:"Session invalide. Veuillez actualiser la page",attemptsLeft:"{{count}} tentatives restantes",info:"Cette vérification n'est effectuée qu'une seule fois pour protéger le service"},Ap={antiBotValidationPending:"Validation anti-bot en attente",newConversationStarted:"Nouvelle conversation démarrée",failedLoadHistory:"Échec du chargement de l'historique de la conversation",sessionExpired:"Session expirée, veuillez vérifier à nouveau",gpcServiceNotAvailable:"Service GPC non disponible",conversationRenamed:"Conversation renommée avec succès",failedRenameConversation:"Échec du renommage de la conversation",conversationDeleted:"Conversation supprimée avec succès",failedDeleteConversation:"Échec de la suppression de la conversation"},Ip={title:"Accès Moodle",subtitle:"Entrez vos identifiants pour accéder à votre contenu personnalisé",username:"Nom d'utilisateur",password:"Mot de passe",submit:"Se connecter",requiredFields:"Le nom d'utilisateur et le mot de passe sont requis",skip:"Continuer sans se connecter",login:"Se connecter à Moodle",logout:"Se déconnecter de Moodle"},Np={title:"À propos",product:"Produit",version:"Version",creator:"Créateur",rights:"Tous droits réservés.",close:"Fermer"},Dp={widget:mp,chat:gp,voice:yp,theme:xp,errors:kp,metadata:bp,conversations:wp,time:vp,ui:Cp,languages:Sp,input:Ep,captcha:Tp,toast:Ap,moodle:Ip,about:Np};gt.use(Li).use(ce.initReactI18next).init({resources:{en:{translation:dp},es:{translation:Kh},fr:{translation:Dp}},fallbackLng:"en",supportedLngs:["en","es","fr"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});const Lp=({token:e,theme:t=De.theme,position:n=De.position,language:r=De.language,primaryColor:i,width:o=De.width,height:a=De.height,apiUrl:s=ki,onReady:l,onError:u,onClose:h,autoOpen:c=De.autoOpen,showBranding:f=De.showBranding,mobileFullscreen:p=De.mobileFullscreen,...m})=>{const[b,v]=A.useState(!1),[k,E]=A.useState(null),[T,M]=A.useState(!0),[D,w]=A.useState(!1),[R,_]=A.useState(!1),[F,x]=A.useState(!!sessionStorage.getItem("mcp_login_data"));k?.widget_customization?.behavior?.auto_open;const[C,z]=A.useState(!1),j=A.useMemo(()=>new bn(s,e),[s,e]);if(A.useEffect(()=>{const O=()=>{v(ch())};O(),window.addEventListener("resize",O);const U=localStorage.getItem(Le.VERIFIED),W=localStorage.getItem(Le.TIMESTAMP);return U==="true"&&W&&(Date.now()-parseInt(W,10)<fr?w(!0):(localStorage.removeItem(Le.VERIFIED),localStorage.removeItem(Le.TIMESTAMP))),()=>window.removeEventListener("resize",O)},[]),A.useEffect(()=>{const O=k?.widget_customization?.language||r;O&&gt.changeLanguage&&gt.changeLanguage(O)},[r,k]),A.useEffect(()=>{(async()=>{if(!e){M(!1);return}try{const U=await j.getInitConfig();U.success&&(E(U.data),(U.data?.widget_customization?.behavior?.auto_open??c)&&z(!0),l&&l(U.data))}catch(U){console.error("[TIA GPC Widget] Error loading config:",U),u&&u(U)}finally{M(!1)}})()},[e,j,l,u,c]),A.useEffect(()=>{const O=()=>{if(!j)return;const U=j.getSessionToken(),W=j.httpClient.baseURL,G=j.licenseToken;fetch(`${W}/release-session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${G}`},body:JSON.stringify({session_token:U}),keepalive:!0}).catch(()=>{})};return window.addEventListener("beforeunload",O),()=>{window.removeEventListener("beforeunload",O)}},[j]),!e)return console.error('[TIA GPC Widget] Error: "token" prop is required'),null;const N=()=>{z(!1),_(!1),h?.()},L=()=>{const O=k?.mcp;return!O?.enabled||O?.auth_mode!=="credentials"?!0:!!sessionStorage.getItem("mcp_login_data")},H=()=>{(!D||!L())&&_(!0),z(!0)},J=()=>{w(!0),_(!1),x(!!sessionStorage.getItem("mcp_login_data"))},ne=()=>{_(!1)},re=O=>{O==="logout"?(sessionStorage.removeItem("mcp_login_data"),x(!1)):_(!0)},g=O=>{console.error("[TIA GPC Widget] CAPTCHA error:",O),u&&u(O)},le=()=>{const O=k?.widget_customization?.position||n,U=k?.widget_customization?.behavior?.mobile_fullscreen??p;return b&&U?"gpc-position-bottom-right":`gpc-position-${O}`},pe=()=>{const O={},U=k?.widget_customization?.colors?.primary||i,W=k?.widget_customization?.colors?.header_background,G=k?.widget_customization?.colors?.header_text;U&&(O["--gpc-color-primary"]=U),W&&(O["--gpc-header-bg"]=W),G&&(O["--gpc-header-text"]=G);const K=k?.widget_customization?.dimensions?.width||o,X=k?.widget_customization?.dimensions?.height||a,oe=k?.widget_customization?.behavior?.mobile_fullscreen??p;return(!b||!oe)&&(K&&(O["--gpc-widget-width"]=K),X&&(O["--gpc-widget-height"]=X)),O},y=k?.widget_customization?.theme||t,{theme:se,toggleTheme:ge}=Rh(y);return d.jsx(ce.I18nextProvider,{i18n:gt,children:d.jsxs("div",{className:`gpc-widget gpc-widget-container ${le()} ${se==="dark"?"gpc-dark":""}`,style:pe(),children:[!C&&d.jsx(zi,{onClick:H,widgetConfig:k}),C&&!T&&d.jsx(d.Fragment,{children:R&&(!D||!L())?d.jsx("div",{className:"gpc-chat-window gpc-animate-fade-in",children:d.jsx(Nh,{gpcService:j,mcpConfig:k?.mcp,onSuccess:J,onSkip:ne,onError:g})}):d.jsx(Ih,{gpcService:j,licenseToken:e,widgetConfig:k,onClose:N,themeMode:se,onToggleTheme:ge,showBranding:f,showMetadata:m.showMetadata||!1,onError:u,version:ot,onRequestMcpLogin:re,mcpLoggedIn:F})})]})})};exports.GPCService=bn;exports.LANGUAGES=vi;exports.THEMES=wi;exports.TiaGPCWidget=Lp;exports.WIDGET_POSITIONS=bi;exports.WIDGET_VERSION=ot;exports.getGPCService=Mh;
31
31
  //# sourceMappingURL=tia-gpc.cjs.js.map