tia-gpc-widget 2.0.9 → 2.1.0
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.
- package/dist/Images/logo.png +0 -0
- package/dist/loader.js +2 -2
- package/dist/loader.min.js +2 -2
- package/dist/tia-gpc-widget.standalone.js +22 -22
- package/dist/tia-gpc-widget.standalone.js.map +1 -1
- package/dist/tia-gpc.cjs.js +19 -19
- package/dist/tia-gpc.cjs.js.map +1 -1
- package/dist/tia-gpc.es.js +2830 -2829
- package/dist/tia-gpc.es.js.map +1 -1
- package/dist/version.json +14 -14
- package/package.json +1 -1
package/dist/tia-gpc.cjs.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),I=require("react"),ue=require("react-i18next"),ie=require("lucide-react"),Pe=require("react-hot-toast"),Pi=require("axios"),gt=require("i18next"),Di=require("i18next-browser-languagedetector"),ot="2.0.9",Li=30,zi=Li*24*60*60*1e3,Ue={VERIFIED:"gpc_captcha_verified",TIMESTAMP:"gpc_captcha_timestamp"},Ri=["honeypot_field_1","honeypot_field_2","hp_field"];process.env.NODE_ENV;const ji=({onClick:e,unreadCount:t=0,widgetConfig:n})=>{const{t:r}=ue.useTranslation(),i=n?.widget_customization?.branding?.company_name||r("widget.title"),a=o=>{o.preventDefault(),o.stopPropagation(),e()};return y.jsxs("button",{type:"button",onClick:a,className:"gpc-floating-button gpc-floating-button-with-text gpc-animate-fade-in","aria-label":r("chat.title"),title:r("chat.title"),children:[y.jsxs("div",{className:"gpc-floating-content",children:[y.jsx(ie.MessageCircle,{className:"gpc-floating-icon"}),y.jsxs("span",{className:"gpc-floating-text",children:[r("widget.questionsTo")," ",i]})]}),t>0&&y.jsx("span",{className:"gpc-notification-badge",children:t>9?"9+":t})]})},Mi=({theme:e,onToggle:t})=>{const{t:n}=ue.useTranslation(),r=i=>{i.preventDefault(),i.stopPropagation(),t()};return y.jsx("button",{type:"button",onClick:r,className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":n("theme.toggle"),title:n("theme.toggle"),children:e==="light"?y.jsx(ie.Moon,{className:"gpc-icon"}):y.jsx(ie.Sun,{className:"gpc-icon"})})},Oi=()=>{const{i18n:e,t}=ue.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]=I.useState(!1),a=I.useRef(null),o=n.find(l=>l.code===e.language)||n[0],s=(l,u)=>{l.preventDefault(),l.stopPropagation(),e.changeLanguage(u),i(!1)};return I.useEffect(()=>{const l=u=>{a.current&&!a.current.contains(u.target)&&i(!1)};return r&&document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[r]),y.jsxs("div",{className:"gpc-language-selector",ref:a,children:[y.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:y.jsx(ie.Globe,{className:"gpc-icon"})}),r&&y.jsx("div",{className:"gpc-language-dropdown",children:n.map(l=>y.jsxs("button",{type:"button",onClick:u=>s(u,l.code),className:`gpc-language-option ${l.code===o.code?"gpc-language-option-active":""}`,children:[y.jsx("span",{className:"gpc-language-flag",children:l.flag}),y.jsx("span",{className:"gpc-language-label",children:l.label})]},l.code))})]})},Fi=({onClose:e,theme:t,onToggleTheme:n,showBranding:r=!0,widgetConfig:i=null,onToggleConversations:a,showConversations:o=!1,conversationsCount:s=0,onToggleAbout:l,showAbout:u=!1,version:h=ot})=>{const{t:c}=ue.useTranslation(),f=i?.widget_customization?.branding?.company_name||c("widget.title"),p=i?.widget_customization?.branding?.custom_title,m=i?.widget_customization?.branding?.company_logo_base64,w=p||f,v=m?.startsWith("data:")?m:m?`data:image/png;base64,${m}`:null,k=i?.widget_customization?.colors?.header_background,S=i?.widget_customization?.colors?.header_text,E={};return k&&(E.backgroundColor=k),S&&(E.color=S),y.jsxs("div",{className:"gpc-chat-header",style:E,children:[y.jsxs("div",{className:"gpc-header-content",children:[v&&y.jsx("div",{className:"gpc-header-logo",children:y.jsx("img",{src:v,alt:f,className:"gpc-company-logo"})}),y.jsx("div",{className:"gpc-header-text",children:y.jsx("h2",{className:"gpc-header-title",style:S?{color:S}:{},children:w})})]}),y.jsxs("div",{className:"gpc-header-actions",children:[a&&y.jsxs("button",{type:"button",onClick:N=>{N.preventDefault(),N.stopPropagation(),a()},className:`gpc-header-button gpc-focus-visible gpc-transition relative ${o?"bg-blue-500 text-white":""}`,"aria-label":c("conversations.toggle","Toggle conversations"),title:c("conversations.toggle","Toggle conversations"),children:[y.jsx(ie.MessageSquare,{className:"gpc-icon",size:20}),s>0&&y.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})]}),y.jsx(Oi,{}),y.jsx(Mi,{theme:t,onToggle:n}),l&&y.jsx("button",{type:"button",onClick:N=>{N.preventDefault(),N.stopPropagation(),l()},className:`gpc-header-button gpc-focus-visible gpc-transition ${u?"bg-blue-500 text-white":""}`,"aria-label":c("about.title"),title:c("about.title"),children:y.jsx(ie.Info,{className:"gpc-icon",size:20})}),y.jsx("button",{type:"button",onClick:N=>{N.preventDefault(),N.stopPropagation(),e()},className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":c("chat.close"),title:c("chat.close"),children:y.jsx(ie.ChevronDown,{className:"gpc-icon"})})]})]})};function Bi(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Vi=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ui=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hi={};function Sn(e,t){return(Hi.jsx?Ui:Vi).test(e)}const $i=/[ \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($i,"")===""}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 qt(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 U=je(),ae=je(),Wt=je(),_=je(),J=je(),He=je(),ye=je();function je(){return 2**++Wi}const Gt=Object.freeze(Object.defineProperty({__proto__:null,boolean:U,booleanish:ae,commaOrSpaceSeparated:ye,commaSeparated:He,number:_,overloadedBoolean:Wt,spaceSeparated:J},Symbol.toStringTag,{value:"Module"})),It=Object.keys(Gt);class nn extends me{constructor(t,n,r,i){let a=-1;if(super(t,n),Tn(this,"space",i),typeof r=="number")for(;++a<It.length;){const o=It[a];Tn(this,It[a],(r&Gt[o])===Gt[o])}}}nn.prototype.defined=!0;function Tn(e,t,n){n&&(e[t]=n)}function qe(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const a=new nn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[qt(r)]=r,n[qt(a.attribute)]=r}return new at(t,n,e.space)}const mr=qe({properties:{ariaActiveDescendant:null,ariaAtomic:ae,ariaAutoComplete:null,ariaBusy:ae,ariaChecked:ae,ariaColCount:_,ariaColIndex:_,ariaColSpan:_,ariaControls:J,ariaCurrent:null,ariaDescribedBy:J,ariaDetails:null,ariaDisabled:ae,ariaDropEffect:J,ariaErrorMessage:null,ariaExpanded:ae,ariaFlowTo:J,ariaGrabbed:ae,ariaHasPopup:null,ariaHidden:ae,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:J,ariaLevel:_,ariaLive:null,ariaModal:ae,ariaMultiLine:ae,ariaMultiSelectable:ae,ariaOrientation:null,ariaOwns:J,ariaPlaceholder:null,ariaPosInSet:_,ariaPressed:ae,ariaReadOnly:ae,ariaRelevant:null,ariaRequired:ae,ariaRoleDescription:J,ariaRowCount:_,ariaRowIndex:_,ariaRowSpan:_,ariaSelected:ae,ariaSetSize:_,ariaSort:null,ariaValueMax:_,ariaValueMin:_,ariaValueNow:_,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 Gi=qe({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:He,acceptCharset:J,accessKey:J,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:J,autoFocus:U,autoPlay:U,blocking:J,capture:null,charSet:null,checked:U,cite:null,className:J,cols:_,colSpan:null,content:null,contentEditable:ae,controls:U,controlsList:J,coords:_|He,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:Wt,draggable:ae,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:J,height:_,hidden:Wt,high:_,href:null,hrefLang:null,htmlFor:J,httpEquiv:J,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:J,itemRef:J,itemScope:U,itemType:J,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:_,manifest:null,max:null,maxLength:_,media:null,method:null,min:null,minLength:_,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,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:U,optimum:_,pattern:null,ping:J,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:J,required:U,reversed:U,rows:_,rowSpan:_,sandbox:J,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:_,sizes:null,slot:null,span:_,spellCheck:ae,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_,step:null,style:null,tabIndex:_,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:ae,width:_,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:J,axis:null,background:null,bgColor:null,border:_,borderColor:null,bottomMargin:_,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:_,leftMargin:_,link:null,longDesc:null,lowSrc:null,marginHeight:_,marginWidth:_,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:_,rules:null,scheme:null,scrolling:ae,standby:null,summary:null,text:null,topMargin:_,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:U,disableRemotePlayback:U,prefix:null,property:null,results:_,security:null,unselectable:null},space:"html",transform:yr}),Ki=qe({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:ye,accentHeight:_,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_,amplitude:_,arabicForm:null,ascent:_,attributeName:null,attributeType:null,azimuth:_,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_,by:null,calcMode:null,capHeight:_,className:J,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:_,diffuseConstant:_,direction:null,display:null,dur:null,divisor:_,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:_,enableBackground:null,end:null,event:null,exponent:_,externalResourcesRequired:null,fill:null,fillOpacity:_,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:He,g2:He,glyphName:He,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_,horizOriginX:_,horizOriginY:_,id:null,ideographic:_,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_,k:_,k1:_,k2:_,k3:_,k4:_,kernelMatrix:ye,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_,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:_,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:_,overlineThickness:_,paintOrder:null,panose1:null,path:null,pathLength:_,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:J,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_,pointsAtY:_,pointsAtZ:_,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ye,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ye,rev:ye,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ye,requiredFeatures:ye,requiredFonts:ye,requiredFormats:ye,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:_,specularExponent:_,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_,strikethroughThickness:_,string:null,stroke:null,strokeDashArray:ye,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_,strokeOpacity:_,strokeWidth:null,style:null,surfaceScale:_,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ye,tabIndex:_,tableValues:null,target:null,targetX:_,targetY:_,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ye,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:_,underlineThickness:_,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_,values:null,vAlphabetic:_,vMathematical:_,vectorEffect:null,vHanging:_,vIdeographic:_,version:null,vertAdvY:_,vertOriginX:_,vertOriginY:_,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:gr}),xr=qe({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=qe({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yr}),br=qe({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Xi={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,In=/-[a-z]/g,Ji=/^data[-\w.:]+$/i;function Qi(e,t){const n=qt(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 a=t.slice(5).replace(In,eo);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!In.test(a)){let o=a.replace(Yi,Zi);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=nn}return new i(r,t)}function Zi(e){return"-"+e.toLowerCase()}function eo(e){return e.charAt(1).toUpperCase()}const to=dr([mr,Gi,xr,kr,br],"html"),rn=dr([mr,Ki,xr,kr,br],"svg");function no(e){return e.join(" ").trim()}function wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fe={},At,An;function ro(){if(An)return At;An=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
|
|
2
|
-
`,u="/",h="*",c="",f="comment",p="declaration";At=function(w,v){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];v=v||{};var k=1,S=1;function E(R){var L=R.match(t);L&&(k+=L.length);var j=R.lastIndexOf(l);S=~j?R.length-j:S+R.length}function N(){var R={line:k,column:S};return function(L){return L.position=new A(R),O(),L}}function A(R){this.start=R,this.end={line:k,column:S},this.source=v.source}A.prototype.content=w;function b(R){var L=new Error(v.source+":"+k+":"+S+": "+R);if(L.reason=R,L.filename=v.source,L.line=k,L.column=S,L.source=w,!v.silent)throw L}function D(R){var L=R.exec(w);if(L){var j=L[0];return E(j),w=w.slice(j.length),L}}function O(){D(n)}function F(R){var L;for(R=R||[];L=x();)L!==!1&&R.push(L);return R}function x(){var R=N();if(!(u!=w.charAt(0)||h!=w.charAt(1))){for(var L=2;c!=w.charAt(L)&&(h!=w.charAt(L)||u!=w.charAt(L+1));)++L;if(L+=2,c===w.charAt(L-1))return b("End of comment missing");var j=w.slice(2,L-2);return S+=2,E(j),w=w.slice(L),S+=2,R({type:f,comment:j})}}function T(){var R=N(),L=D(r);if(L){if(x(),!D(i))return b("property missing ':'");var j=D(a),G=R({type:p,property:m(L[0].replace(e,c)),value:j?m(j[0].replace(e,c)):c});return D(o),G}}function z(){var R=[];F(R);for(var L;L=T();)L!==!1&&(R.push(L),F(R));return R}return O(),z()};function m(w){return w?w.replace(s,c):c}return At}var _n;function io(){if(_n)return Fe;_n=1;var e=Fe&&Fe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.default=n;const t=e(ro());function n(r,i){let a=null;if(!r||typeof r!="string")return a;const o=(0,t.default)(r),s=typeof i=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:h}=l;s?i(u,h,l):h&&(a=a||{},a[u]=h)}),a}return Fe}var Ye={},Nn;function oo(){if(Nn)return Ye;Nn=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(u){return!u||n.test(u)||e.test(u)},o=function(u,h){return h.toUpperCase()},s=function(u,h){return"".concat(h,"-")},l=function(u,h){return h===void 0&&(h={}),a(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(i,s):u=u.replace(r,s),u.replace(t,o))};return Ye.camelCase=l,Ye}var Je,Pn;function ao(){if(Pn)return Je;Pn=1;var e=Je&&Je.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(io()),n=oo();function r(i,a){var o={};return!i||typeof i!="string"||(0,t.default)(i,function(s,l){s&&l&&(o[(0,n.camelCase)(s,a)]=l)}),o}return r.default=r,Je=r,Je}var so=ao();const lo=wr(so),vr=Cr("end"),on=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 uo(e){const t=on(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?Dn(e.position):"start"in e||"end"in e?Dn(e):"line"in e||"column"in e?Kt(e):""}function Kt(e){return Ln(e&&e.line)+":"+Ln(e&&e.column)}function Dn(e){return Kt(e&&e.start)+"-"+Kt(e&&e.end)}function Ln(e){return e&&typeof e=="number"?e:1}class pe extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},o=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(o=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?a.ruleId=r:(a.source=r.slice(0,l),a.ruleId=r.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){const l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.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(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}pe.prototype.file="";pe.prototype.name="";pe.prototype.reason="";pe.prototype.message="";pe.prototype.stack="";pe.prototype.column=void 0;pe.prototype.line=void 0;pe.prototype.ancestors=void 0;pe.prototype.cause=void 0;pe.prototype.fatal=void 0;pe.prototype.place=void 0;pe.prototype.ruleId=void 0;pe.prototype.source=void 0;const an={}.hasOwnProperty,co=new Map,ho=/[A-Z]/g,po=new Set(["table","tbody","thead","tfoot","tr"]),fo=new Set(["td","th"]),Sr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function mo(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=Co(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=vo(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:to,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Er(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Er(e,t,n){if(t.type==="element")return go(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return yo(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ko(e,t,n);if(t.type==="mdxjsEsm")return xo(e,t);if(t.type==="root")return bo(e,t,n);if(t.type==="text")return wo(e,t)}function go(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 a=Ir(e,t.tagName,!1),o=So(e,t);let s=ln(e,t);return po.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!qi(l):!0})),Tr(e,o,a,t),sn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function yo(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 xo(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);rt(e,t.position)}function ko(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 a=t.name===null?e.Fragment:Ir(e,t.name,!0),o=Eo(e,t),s=ln(e,t);return Tr(e,o,a,t),sn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function bo(e,t,n){const r={};return sn(r,ln(e,t)),e.create(t,e.Fragment,r,n)}function wo(e,t){return t.value}function Tr(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 vo(e,t,n){return r;function r(i,a,o,s){const u=Array.isArray(o.children)?n:t;return s?u(a,o,s):u(a,o)}}function Co(e,t){return n;function n(r,i,a,o){const s=Array.isArray(a.children),l=on(r);return t(i,a,o,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function So(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&an.call(t.properties,i)){const a=To(e,i,t.properties[i]);if(a){const[o,s]=a;e.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&fo.has(t.tagName)?r=s:n[o]=s}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Eo(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const o=a.expression;o.type;const s=o.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else rt(e,t.position);else{const i=r.name;let a;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,a=e.evaluater.evaluateExpression(s.expression)}else rt(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function ln(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:co;for(;++r<t.children.length;){const a=t.children[r];let o;if(e.passKeys){const l=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(l){const u=i.get(l)||0;o=l+"-"+u,i.set(l,u+1)}}const s=Er(e,a,o);s!==void 0&&n.push(s)}return n}function To(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?Bi(n):no(n)),r.property==="style"){let i=typeof n=="object"?n:Io(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Ao(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Xi[r.property]||r.property:r.attribute,n]}}function Io(e,t){try{return lo(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new pe("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 Ir(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let a=-1,o;for(;++a<i.length;){const s=Sn(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};o=o?{type:"MemberExpression",object:o,property:s,computed:!!(a&&s.type==="Literal"),optional:!1}:s}r=o}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 pe("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 Ao(e){const t={};let n;for(n in e)an.call(e,n)&&(t[_o(n)]=e[n]);return t}function _o(e){let t=e.replace(ho,No);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function No(e){return"-"+e.toLowerCase()}const _t={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"]},Po={};function un(e,t){const n=Po,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ar(e,r,i)}function Ar(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]=Ar(e[i],t,n);return r.join("")}function Do(e){return!!(e&&typeof e=="object")}const Rn=document.createElement("i");function cn(e){const t="&"+e+";";Rn.innerHTML=t;const n=Rn.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function xe(e,t,n,r){const i=e.length;let a=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function ke(e,t){return e.length>0?(xe(e,e.length,0,t),e):t}const jn={}.hasOwnProperty;function _r(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=(jn.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let o;if(a)for(o in a){jn.call(i,o)||(i[o]=[]);const s=a[o];zo(i[o],Array.isArray(s)?s:s?[s]:[])}}}function zo(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);xe(e,0,0,r)}function Nr(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=De(/[A-Za-z]/),he=De(/[\dA-Za-z]/),Ro=De(/[#-'*+\--9=?A-Z^-~]/);function xt(e){return e!==null&&(e<32||e===127)}const Xt=De(/\d/),jo=De(/[\dA-Fa-f]/),Mo=De(/[!-/:-@[-`{-~]/);function M(e){return e!==null&&e<-2}function Y(e){return e!==null&&(e<0||e===32)}function H(e){return e===-2||e===-1||e===32}const vt=De(new RegExp("\\p{P}|\\p{S}","u")),Re=De(/\s/);function De(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function We(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const a=e.charCodeAt(n);let o="";if(a===37&&he(e.charCodeAt(n+1))&&he(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){const s=e.charCodeAt(n+1);a<56320&&s>56319&&s<57344?(o=String.fromCharCode(a,s),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function W(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return o;function o(l){return H(l)?(e.enter(n),s(l)):t(l)}function s(l){return H(l)&&a++<i?(e.consume(l),s):(e.exit(n),t(l))}}const Oo={tokenize:Fo};function Fo(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"),W(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),a(s)}function a(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return M(s)?(e.consume(s),e.exit("chunkText"),a):(e.consume(s),o)}}const Bo={tokenize:Vo},Mn={tokenize:Uo};function Vo(e){const t=this,n=[];let r=0,i,a,o;return s;function s(E){if(r<n.length){const N=n[r];return t.containerState=N[1],e.attempt(N[0].continuation,l,u)(E)}return u(E)}function l(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&S();const N=t.events.length;let A=N,b;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){b=t.events[A][1].end;break}k(r);let D=N;for(;D<t.events.length;)t.events[D][1].end={...b},D++;return xe(t.events,A+1,0,t.events.slice(N)),t.events.length=D,u(E)}return s(E)}function u(E){if(r===n.length){if(!i)return f(E);if(i.currentConstruct&&i.currentConstruct.concrete)return m(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Mn,h,c)(E)}function h(E){return i&&S(),k(r),f(E)}function c(E){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(E)}function f(E){return t.containerState={},e.attempt(Mn,p,m)(E)}function p(E){return r++,n.push([t.currentConstruct,t.containerState]),f(E)}function m(E){if(E===null){i&&S(),k(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),w(E)}function w(E){if(E===null){v(e.exit("chunkFlow"),!0),k(0),e.consume(E);return}return M(E)?(e.consume(E),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(E),w)}function v(E,N){const A=t.sliceStream(E);if(N&&A.push(null),E.previous=a,a&&(a.next=E),a=E,i.defineSkip(E.start),i.write(A),t.parser.lazy[E.start.line]){let b=i.events.length;for(;b--;)if(i.events[b][1].start.offset<o&&(!i.events[b][1].end||i.events[b][1].end.offset>o))return;const D=t.events.length;let O=D,F,x;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(F){x=t.events[O][1].end;break}F=!0}for(k(r),b=D;b<t.events.length;)t.events[b][1].end={...x},b++;xe(t.events,O+1,0,t.events.slice(D)),t.events.length=b}}function k(E){let N=n.length;for(;N-- >E;){const A=n[N];t.containerState=A[1],A[0].exit.call(t,e)}n.length=E}function S(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Uo(e,t,n){return W(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $e(e){if(e===null||Y(e)||Re(e))return 1;if(vt(e))return 2}function Ct(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Yt={name:"attention",resolveAll:Ho,tokenize:$o};function Ho(e,t){let n=-1,r,i,a,o,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),o={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},a={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[r][1].end={...o.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",o,t],["exit",o,t],["enter",a,t]]),u=ke(u,Ct(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ke(u,[["exit",a,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,xe(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 $o(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=$e(r);let a;return o;function o(l){return a=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===a)return e.consume(l),s;const u=e.exit("attentionSequence"),h=$e(l),c=!h||h===2&&i||n.includes(l),f=!i||i===2&&h||n.includes(r);return u._open=!!(a===42?c:c&&(i||!f)),u._close=!!(a===42?f:f&&(h||!c)),t(l)}}function On(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"),a}function a(p){return fe(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||he(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||he(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):Ro(p)?(e.consume(p),u):n(p)}function h(p){return he(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||he(p))&&r++<63){const m=p===45?f:c;return e.consume(p),m}return n(p)}}const st={partial:!0,tokenize:Go};function Go(e,t,n){return r;function r(a){return H(a)?W(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||M(a)?t(a):n(a)}}const Pr={continuation:{tokenize:Xo},exit:Yo,name:"blockQuote",tokenize:Ko};function Ko(e,t,n){const r=this;return i;function i(o){if(o===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),a}return n(o)}function a(o){return H(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Xo(e,t,n){const r=this;return i;function i(o){return H(o)?W(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return e.attempt(Pr,t,n)(o)}}function Yo(e){e.exit("blockQuote")}const Dr={name:"characterEscape",tokenize:Jo};function Jo(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return Mo(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const Lr={name:"characterReference",tokenize:Qo};function Qo(e,t,n){const r=this;let i=0,a,o;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"),a=31,o=he,h(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,o=jo,h):(e.enter("characterReferenceValue"),a=7,o=Xt,h(c))}function h(c){if(c===59&&i){const f=e.exit("characterReferenceValue");return o===he&&!cn(r.sliceSerialize(f))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(c)&&i++<a?(e.consume(c),h):n(c)}}const Fn={partial:!0,tokenize:ea},Bn={concrete:!0,name:"codeFenced",tokenize:Zo};function Zo(e,t,n){const r=this,i={partial:!0,tokenize:A};let a=0,o=0,s;return l;function l(b){return u(b)}function u(b){const D=r.events[r.events.length-1];return a=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,s=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(b)}function h(b){return b===s?(o++,e.consume(b),h):o<3?n(b):(e.exit("codeFencedFenceSequence"),H(b)?W(e,c,"whitespace")(b):c(b))}function c(b){return b===null||M(b)?(e.exit("codeFencedFence"),r.interrupt?t(b):e.check(Fn,w,N)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===null||M(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(b)):H(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),W(e,p,"whitespace")(b)):b===96&&b===s?n(b):(e.consume(b),f)}function p(b){return b===null||M(b)?c(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||M(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(b)):b===96&&b===s?n(b):(e.consume(b),m)}function w(b){return e.attempt(i,N,v)(b)}function v(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),k}function k(b){return a>0&&H(b)?W(e,S,"linePrefix",a+1)(b):S(b)}function S(b){return b===null||M(b)?e.check(Fn,w,N)(b):(e.enter("codeFlowValue"),E(b))}function E(b){return b===null||M(b)?(e.exit("codeFlowValue"),S(b)):(e.consume(b),E)}function N(b){return e.exit("codeFenced"),t(b)}function A(b,D,O){let F=0;return x;function x(j){return b.enter("lineEnding"),b.consume(j),b.exit("lineEnding"),T}function T(j){return b.enter("codeFencedFence"),H(j)?W(b,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):z(j)}function z(j){return j===s?(b.enter("codeFencedFenceSequence"),R(j)):O(j)}function R(j){return j===s?(F++,b.consume(j),R):F>=o?(b.exit("codeFencedFenceSequence"),H(j)?W(b,L,"whitespace")(j):L(j)):O(j)}function L(j){return j===null||M(j)?(b.exit("codeFencedFence"),D(j)):O(j)}}}function ea(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Nt={name:"codeIndented",tokenize:na},ta={partial:!0,tokenize:ra};function na(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),W(e,a,"linePrefix",5)(u)}function a(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):M(u)?e.attempt(ta,o,l)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||M(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),s)}function l(u){return e.exit("codeIndented"),t(u)}}function ra(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):M(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):W(e,a,"linePrefix",5)(o)}function a(o){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):M(o)?i(o):n(o)}}const ia={name:"codeText",previous:aa,resolve:oa,tokenize:sa};function oa(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 aa(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sa(e,t,n){let r=0,i,a;return o;function o(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?(a=e.enter("codeTextSequence"),i=0,h(c)):M(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||M(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)):(a.type="codeTextData",u(c))}}class la{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 a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Qe(this.left,r),a.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),Qe(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Qe(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);Qe(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Qe(this.left,n.reverse())}}}function Qe(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,a,o,s,l,u;const h=new la(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,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,ua(h,n)),n=t[n],u=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=h.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=a);else if(!(o[1].type==="linePrefix"||o[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 xe(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!u}function ua(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const s=o.events,l=[],u={};let h,c,f=-1,p=n,m=0,w=0;const v=[w];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(h=r.sliceStream(p),p.next||h.push(null),c&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),p._isInFirstContentOfListItem&&(o._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&&(w=f+1,v.push(w),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.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]),S=a.pop();l.push([S,S+k.length-1]),e.splice(S,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 ca={resolve:pa,tokenize:fa},ha={partial:!0,tokenize:da};function pa(e){return zr(e),e}function fa(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?a(s):M(s)?e.check(ha,o,a)(s):(e.consume(s),i)}function a(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function o(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function da(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),W(e,a,"linePrefix")}function a(o){if(o===null||M(o))return n(o);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(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Rr(e,t,n,r,i,a,o,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(a),e.consume(k),e.exit(a),f):k===null||k===32||k===41||xt(k)?n(k):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),w(k))}function f(k){return k===62?(e.enter(a),e.consume(k),e.exit(a),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||M(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 w(k){return!h&&(k===null||k===41||Y(k))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(k)):h<u&&k===40?(e.consume(k),h++,w):k===41?(e.consume(k),h--,w):k===null||k===32||k===40||xt(k)?n(k):(e.consume(k),k===92?v:w)}function v(k){return k===40||k===41||k===92?(e.consume(k),w):w(k)}}function jr(e,t,n,r,i,a){const o=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(a),h}function h(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(a),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):M(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||M(p)||s++>999?(e.exit("chunkString"),h(p)):(e.consume(p),l||(l=!H(p)),p===92?f:c)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,c):c(p)}}function Mr(e,t,n,r,i,a){let o;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(a),u(f))}function u(f){return f===o?(e.exit(a),l(o)):f===null?n(f):M(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),W(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===o||f===null||M(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?c:h)}function c(f){return f===o||f===92?(e.consume(f),h):h(f)}}function tt(e,t){let n;return r;function r(i){return M(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):H(i)?W(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const ma={name:"definition",tokenize:ya},ga={partial:!0,tokenize:xa};function ya(e,t,n){const r=this;let i;return a;function a(p){return e.enter("definition"),o(p)}function o(p){return jr.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 Y(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(ga,c,c)(p)}function c(p){return H(p)?W(e,f,"whitespace")(p):f(p)}function f(p){return p===null||M(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function xa(e,t,n){return r;function r(s){return Y(s)?tt(e,i)(s):n(s)}function i(s){return Mr(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return H(s)?W(e,o,"whitespace")(s):o(s)}function o(s){return s===null||M(s)?t(s):n(s)}}const ka={name:"hardBreakEscape",tokenize:ba};function ba(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return M(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const wa={name:"headingAtx",resolve:va,tokenize:Ca};function va(e,t){let n=e.length-2,r=3,i,a;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},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},xe(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function Ca(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),a(h)}function a(h){return e.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&r++<6?(e.consume(h),o):h===null||Y(h)?(e.exit("atxHeadingSequence"),s(h)):n(h)}function s(h){return h===35?(e.enter("atxHeadingSequence"),l(h)):h===null||M(h)?(e.exit("atxHeading"),t(h)):H(h)?W(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||Y(h)?(e.exit("atxHeadingText"),s(h)):(e.consume(h),u)}}const Sa=["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"],Vn=["pre","script","style","textarea"],Ea={concrete:!0,name:"htmlFlow",resolveTo:Aa,tokenize:_a},Ta={partial:!0,tokenize:Pa},Ia={partial:!0,tokenize:Na};function Aa(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 _a(e,t,n){const r=this;let i,a,o,s,l;return u;function u(g){return h(g)}function h(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),f):g===47?(e.consume(g),a=!0,w):g===63?(e.consume(g),i=3,r.interrupt?t:d):fe(g)?(e.consume(g),o=String.fromCharCode(g),v):n(g)}function f(g){return g===45?(e.consume(g),i=2,p):g===91?(e.consume(g),i=5,s=0,m):fe(g)?(e.consume(g),i=4,r.interrupt?t:d):n(g)}function p(g){return g===45?(e.consume(g),r.interrupt?t:d):n(g)}function m(g){const ce="CDATA[";return g===ce.charCodeAt(s++)?(e.consume(g),s===ce.length?r.interrupt?t:z:m):n(g)}function w(g){return fe(g)?(e.consume(g),o=String.fromCharCode(g),v):n(g)}function v(g){if(g===null||g===47||g===62||Y(g)){const ce=g===47,be=o.toLowerCase();return!ce&&!a&&Vn.includes(be)?(i=1,r.interrupt?t(g):z(g)):Sa.includes(o.toLowerCase())?(i=6,ce?(e.consume(g),k):r.interrupt?t(g):z(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(g):a?S(g):E(g))}return g===45||he(g)?(e.consume(g),o+=String.fromCharCode(g),v):n(g)}function k(g){return g===62?(e.consume(g),r.interrupt?t:z):n(g)}function S(g){return H(g)?(e.consume(g),S):x(g)}function E(g){return g===47?(e.consume(g),x):g===58||g===95||fe(g)?(e.consume(g),N):H(g)?(e.consume(g),E):x(g)}function N(g){return g===45||g===46||g===58||g===95||he(g)?(e.consume(g),N):A(g)}function A(g){return g===61?(e.consume(g),b):H(g)?(e.consume(g),A):E(g)}function b(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),l=g,D):H(g)?(e.consume(g),b):O(g)}function D(g){return g===l?(e.consume(g),l=null,F):g===null||M(g)?n(g):(e.consume(g),D)}function O(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||Y(g)?A(g):(e.consume(g),O)}function F(g){return g===47||g===62||H(g)?E(g):n(g)}function x(g){return g===62?(e.consume(g),T):n(g)}function T(g){return g===null||M(g)?z(g):H(g)?(e.consume(g),T):n(g)}function z(g){return g===45&&i===2?(e.consume(g),G):g===60&&i===1?(e.consume(g),ne):g===62&&i===4?(e.consume(g),Z):g===63&&i===3?(e.consume(g),d):g===93&&i===5?(e.consume(g),B):M(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Ta,se,R)(g)):g===null||M(g)?(e.exit("htmlFlowData"),R(g)):(e.consume(g),z)}function R(g){return e.check(Ia,L,se)(g)}function L(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),j}function j(g){return g===null||M(g)?R(g):(e.enter("htmlFlowData"),z(g))}function G(g){return g===45?(e.consume(g),d):z(g)}function ne(g){return g===47?(e.consume(g),o="",re):z(g)}function re(g){if(g===62){const ce=o.toLowerCase();return Vn.includes(ce)?(e.consume(g),Z):z(g)}return fe(g)&&o.length<8?(e.consume(g),o+=String.fromCharCode(g),re):z(g)}function B(g){return g===93?(e.consume(g),d):z(g)}function d(g){return g===62?(e.consume(g),Z):g===45&&i===2?(e.consume(g),d):z(g)}function Z(g){return g===null||M(g)?(e.exit("htmlFlowData"),se(g)):(e.consume(g),Z)}function se(g){return e.exit("htmlFlow"),t(g)}}function Na(e,t,n){const r=this;return i;function i(o){return M(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):n(o)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Pa(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,a,o;return s;function s(d){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(d),l}function l(d){return d===33?(e.consume(d),u):d===47?(e.consume(d),A):d===63?(e.consume(d),E):fe(d)?(e.consume(d),O):n(d)}function u(d){return d===45?(e.consume(d),h):d===91?(e.consume(d),a=0,m):fe(d)?(e.consume(d),S):n(d)}function h(d){return d===45?(e.consume(d),p):n(d)}function c(d){return d===null?n(d):d===45?(e.consume(d),f):M(d)?(o=c,ne(d)):(e.consume(d),c)}function f(d){return d===45?(e.consume(d),p):c(d)}function p(d){return d===62?G(d):d===45?f(d):c(d)}function m(d){const Z="CDATA[";return d===Z.charCodeAt(a++)?(e.consume(d),a===Z.length?w:m):n(d)}function w(d){return d===null?n(d):d===93?(e.consume(d),v):M(d)?(o=w,ne(d)):(e.consume(d),w)}function v(d){return d===93?(e.consume(d),k):w(d)}function k(d){return d===62?G(d):d===93?(e.consume(d),k):w(d)}function S(d){return d===null||d===62?G(d):M(d)?(o=S,ne(d)):(e.consume(d),S)}function E(d){return d===null?n(d):d===63?(e.consume(d),N):M(d)?(o=E,ne(d)):(e.consume(d),E)}function N(d){return d===62?G(d):E(d)}function A(d){return fe(d)?(e.consume(d),b):n(d)}function b(d){return d===45||he(d)?(e.consume(d),b):D(d)}function D(d){return M(d)?(o=D,ne(d)):H(d)?(e.consume(d),D):G(d)}function O(d){return d===45||he(d)?(e.consume(d),O):d===47||d===62||Y(d)?F(d):n(d)}function F(d){return d===47?(e.consume(d),G):d===58||d===95||fe(d)?(e.consume(d),x):M(d)?(o=F,ne(d)):H(d)?(e.consume(d),F):G(d)}function x(d){return d===45||d===46||d===58||d===95||he(d)?(e.consume(d),x):T(d)}function T(d){return d===61?(e.consume(d),z):M(d)?(o=T,ne(d)):H(d)?(e.consume(d),T):F(d)}function z(d){return d===null||d===60||d===61||d===62||d===96?n(d):d===34||d===39?(e.consume(d),i=d,R):M(d)?(o=z,ne(d)):H(d)?(e.consume(d),z):(e.consume(d),L)}function R(d){return d===i?(e.consume(d),i=void 0,j):d===null?n(d):M(d)?(o=R,ne(d)):(e.consume(d),R)}function L(d){return d===null||d===34||d===39||d===60||d===61||d===96?n(d):d===47||d===62||Y(d)?F(d):(e.consume(d),L)}function j(d){return d===47||d===62||Y(d)?F(d):n(d)}function G(d){return d===62?(e.consume(d),e.exit("htmlTextData"),e.exit("htmlText"),t):n(d)}function ne(d){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),re}function re(d){return H(d)?W(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):B(d)}function B(d){return e.enter("htmlTextData"),o(d)}}const hn={name:"labelEnd",resolveAll:Ma,resolveTo:Oa,tokenize:Fa},za={tokenize:Ba},Ra={tokenize:Va},ja={tokenize:Ua};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&&xe(e,0,e.length,n),e}function Oa(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},h={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[["enter",l,t],["enter",u,t]],s=ke(s,e.slice(a+1,a+r+3)),s=ke(s,[["enter",h,t]]),s=ke(s,Ct(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=ke(s,[["exit",h,t],e[o-2],e[o-1],["exit",u,t]]),s=ke(s,e.slice(o+1)),s=ke(s,[["exit",l,t]]),xe(e,a,e.length,s),e}function Fa(e,t,n){const r=this;let i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(f){return a?a._inactive?c(f):(o=r.parser.defined.includes(ve(r.sliceSerialize({start:a.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(za,h,o?h:c)(f):f===91?e.attempt(Ra,h,o?u:c)(f):o?h(f):c(f)}function u(f){return e.attempt(ja,h,c)(f)}function h(f){return t(f)}function c(f){return a._balanced=!0,n(f)}}function Ba(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 Y(c)?tt(e,a)(c):a(c)}function a(c){return c===41?h(c):Rr(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function o(c){return Y(c)?tt(e,l)(c):h(c)}function s(c){return n(c)}function l(c){return c===34||c===39||c===40?Mr(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):h(c)}function u(c){return Y(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 Va(e,t,n){const r=this;return i;function i(s){return jr.call(r,e,a,o,"reference","referenceMarker","referenceString")(s)}function a(s){return r.parser.defined.includes(ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function Ua(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const Ha={name:"labelStartImage",resolveAll:hn.resolveAll,tokenize:$a};function $a(e,t,n){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),a}function a(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):n(s)}function o(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(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Pt={name:"lineEnding",tokenize:Ga};function Ga(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),W(e,t,"linePrefix")}}const yt={name:"thematicBreak",tokenize:Ka};function Ka(e,t,n){let r=0,i;return a;function a(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,s(u)}function s(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||M(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),H(u)?W(e,s,"whitespace")(u):s(u))}}const de={continuation:{tokenize:Qa},exit:es,name:"list",tokenize:Ja},Xa={partial:!0,tokenize:ts},Ya={partial:!0,tokenize:Za};function Ja(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=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:Xt(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 Xt(p)&&++o<10?(e.consume(p),l):(!r.interrupt||o<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(Xa,f,c))}function h(p){return r.containerState.initialBlankLine=!0,a++,f(p)}function c(p){return H(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=a+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,a);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,W(e,t,"listItemIndent",r.containerState.size+1)(s)}function a(s){return r.containerState.furtherBlankLines||!H(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ya,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,W(e,e.attempt(de,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Za(e,t,n){const r=this;return W(e,i,"listItemIndent",r.containerState.size+1);function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(a):n(a)}}function es(e){e.exit(this.containerState.type)}function ts(e,t,n){const r=this;return W(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const o=r.events[r.events.length-1];return!H(a)&&o&&o[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Un={name:"setextUnderline",resolveTo:ns,tokenize:rs};function ns(e,t){let n=e.length,r,i,a;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),!a&&e[n][1].type==="definition"&&(a=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function rs(e,t,n){const r=this;let i;return a;function a(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,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),H(u)?W(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||M(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const is={tokenize:os};function os(e){const t=this,n=e.attempt(st,r,e.attempt(this.parser.constructs.flowInitial,i,W(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ca,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const as={resolveAll:Fr()},ss=Or("string"),ls=Or("text");function Or(e){return{resolveAll:Fr(e==="text"?us:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,o,s);return o;function o(h){return u(h)?a(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"),a(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 Fr(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function us(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 a=i.length,o=-1,s=0,l;for(;a--;){const u=i[a];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(u===-2)l=!0,s++;else if(u!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,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 cs={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},hs={91:ma},ps={[-2]:Nt,[-1]:Nt,32:Nt},fs={35:wa,42:yt,45:[Un,yt],60:Ea,61:Un,95:yt,96:Bn,126:Bn},ds={38:Lr,92:Dr},ms={[-5]:Pt,[-4]:Pt,[-3]:Pt,33:Ha,38:Lr,42:Yt,60:[qo,Da],91:qa,92:[ka,Dr],93:hn,95:Yt,96:ia},gs={null:[Yt,as]},ys={null:[42,95]},xs={null:[]},ks=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ys,contentInitial:hs,disable:xs,document:cs,flow:fs,flowInitial:ps,insideSpan:gs,string:ds,text:ms},Symbol.toStringTag,{value:"Module"}));function bs(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={},a=[];let o=[],s=[];const l={attempt:D(A),check:D(b),consume:S,enter:E,exit:N,interrupt:D(b,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:c};let h=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function c(T){return o=ke(o,T),v(),o[o.length-1]!==null?[]:(O(t,0),u.events=Ct(a,u.events,u),u.events)}function f(T,z){return vs(p(T),z)}function p(T){return ws(o,T)}function m(){const{_bufferIndex:T,_index:z,line:R,column:L,offset:j}=r;return{_bufferIndex:T,_index:z,line:R,column:L,offset:j}}function w(T){i[T.line]=T.column,x()}function v(){let T;for(;r._index<o.length;){const z=o[r._index];if(typeof z=="string")for(T=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===T&&r._bufferIndex<z.length;)k(z.charCodeAt(r._bufferIndex));else k(z)}}function k(T){h=h(T)}function S(T){M(T)?(r.line++,r.column=1,r.offset+=T===-3?2:1,x()):T!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=T}function E(T,z){const R=z||{};return R.type=T,R.start=m(),u.events.push(["enter",R,u]),s.push(R),R}function N(T){const z=s.pop();return z.end=m(),u.events.push(["exit",z,u]),z}function A(T,z){O(T,z.from)}function b(T,z){z.restore()}function D(T,z){return R;function R(L,j,G){let ne,re,B,d;return Array.isArray(L)?se(L):"tokenize"in L?se([L]):Z(L);function Z($){return ee;function ee(K){const le=K!==null&&$[K],te=K!==null&&$.null,Q=[...Array.isArray(le)?le:le?[le]:[],...Array.isArray(te)?te:te?[te]:[]];return se(Q)(K)}}function se($){return ne=$,re=0,$.length===0?G:g($[re])}function g($){return ee;function ee(K){return d=F(),B=$,$.partial||(u.currentConstruct=$),$.name&&u.parser.constructs.disable.null.includes($.name)?be():$.tokenize.call(z?Object.assign(Object.create(u),z):u,l,ce,be)(K)}}function ce($){return T(B,d),j}function be($){return d.restore(),++re<ne.length?g(ne[re]):G}}}function O(T,z){T.resolveAll&&!a.includes(T)&&a.push(T),T.resolve&&xe(u.events,z,u.events.length-z,T.resolve(u.events.slice(z),u)),T.resolveTo&&(u.events=T.resolveTo(u.events,u))}function F(){const T=m(),z=u.previous,R=u.currentConstruct,L=u.events.length,j=Array.from(s);return{from:L,restore:G};function G(){r=T,u.previous=z,u.currentConstruct=R,u.events.length=L,s=j,x()}}function x(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ws(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){const s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function vs(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),A=require("react"),ue=require("react-i18next"),oe=require("lucide-react"),Pe=require("react-hot-toast"),Pi=require("axios"),gt=require("i18next"),Li=require("i18next-browser-languagedetector"),ot="2.1.0",zi=30,ji=zi*24*60*60*1e3,qe={VERIFIED:"gpc_captcha_verified",TIMESTAMP:"gpc_captcha_timestamp"},Ri=["honeypot_field_1","honeypot_field_2","hp_field"];process.env.NODE_ENV;const Mi=({onClick:e,unreadCount:t=0,widgetConfig:n})=>{const{t:r}=ue.useTranslation(),i=n?.widget_customization?.branding?.company_name||r("widget.title"),a=o=>{o.preventDefault(),o.stopPropagation(),e()};return y.jsxs("button",{type:"button",onClick:a,className:"gpc-floating-button gpc-floating-button-with-text gpc-animate-fade-in","aria-label":r("chat.title"),title:r("chat.title"),children:[y.jsxs("div",{className:"gpc-floating-content",children:[y.jsx(oe.MessageCircle,{className:"gpc-floating-icon"}),y.jsxs("span",{className:"gpc-floating-text",children:[r("widget.questionsTo")," ",i]})]}),t>0&&y.jsx("span",{className:"gpc-notification-badge",children:t>9?"9+":t})]})},Oi=({theme:e,onToggle:t})=>{const{t:n}=ue.useTranslation(),r=i=>{i.preventDefault(),i.stopPropagation(),t()};return y.jsx("button",{type:"button",onClick:r,className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":n("theme.toggle"),title:n("theme.toggle"),children:e==="light"?y.jsx(oe.Moon,{className:"gpc-icon"}):y.jsx(oe.Sun,{className:"gpc-icon"})})},Fi=()=>{const{i18n:e,t}=ue.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),a=A.useRef(null),o=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=>{a.current&&!a.current.contains(u.target)&&i(!1)};return r&&document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[r]),y.jsxs("div",{className:"gpc-language-selector",ref:a,children:[y.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:y.jsx(oe.Globe,{className:"gpc-icon"})}),r&&y.jsx("div",{className:"gpc-language-dropdown",children:n.map(l=>y.jsxs("button",{type:"button",onClick:u=>s(u,l.code),className:`gpc-language-option ${l.code===o.code?"gpc-language-option-active":""}`,children:[y.jsx("span",{className:"gpc-language-flag",children:l.flag}),y.jsx("span",{className:"gpc-language-label",children:l.label})]},l.code))})]})},_i=({onClose:e,theme:t,onToggleTheme:n,showBranding:r=!0,widgetConfig:i=null,onToggleConversations:a,showConversations:o=!1,conversationsCount:s=0,onToggleAbout:l,showAbout:u=!1,version:h=ot})=>{const{t:c}=ue.useTranslation(),p=i?.widget_customization?.branding?.company_name||c("widget.title"),f=i?.widget_customization?.branding?.custom_title,m=i?.widget_customization?.branding?.company_logo_base64,w=f||p,v=m?.startsWith("data:")?m:m?`data:image/png;base64,${m}`:null,b=i?.widget_customization?.colors?.header_background,S=i?.widget_customization?.colors?.header_text,E={};return b&&(E.backgroundColor=b),S&&(E.color=S),y.jsxs("div",{className:"gpc-chat-header",style:E,children:[y.jsxs("div",{className:"gpc-header-content",children:[v&&y.jsx("div",{className:"gpc-header-logo",children:y.jsx("img",{src:v,alt:p,className:"gpc-company-logo"})}),y.jsx("div",{className:"gpc-header-text",children:y.jsx("h2",{className:"gpc-header-title",style:S?{color:S}:{},children:w})})]}),y.jsxs("div",{className:"gpc-header-actions",children:[a&&y.jsxs("button",{type:"button",onClick:D=>{D.preventDefault(),D.stopPropagation(),a()},className:`gpc-header-button gpc-focus-visible gpc-transition relative ${o?"bg-blue-500 text-white":""}`,"aria-label":c("conversations.toggle","Toggle conversations"),title:c("conversations.toggle","Toggle conversations"),children:[y.jsx(oe.MessageSquare,{className:"gpc-icon",size:20}),s>0&&y.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})]}),y.jsx(Fi,{}),y.jsx(Oi,{theme:t,onToggle:n}),l&&y.jsx("button",{type:"button",onClick:D=>{D.preventDefault(),D.stopPropagation(),l()},className:`gpc-header-button gpc-focus-visible gpc-transition ${u?"bg-blue-500 text-white":""}`,"aria-label":c("about.title"),title:c("about.title"),children:y.jsx(oe.Info,{className:"gpc-icon",size:20})}),y.jsx("button",{type:"button",onClick:D=>{D.preventDefault(),D.stopPropagation(),e()},className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":c("chat.close"),title:c("chat.close"),children:y.jsx(oe.ChevronDown,{className:"gpc-icon"})})]})]})};function Bi(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Hi=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ui=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qi={};function Sn(e,t){return(qi.jsx?Ui:Hi).test(e)}const Wi=/[ \t\n\f\r]/g;function Vi(e){return typeof e=="object"?e.type==="text"?En(e.value):!1:En(e)}function En(e){return e.replace(Wi,"")===""}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 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 Gi=0;const U=Oe(),ae=Oe(),Gt=Oe(),N=Oe(),K=Oe(),We=Oe(),ye=Oe();function Oe(){return 2**++Gi}const Yt=Object.freeze(Object.defineProperty({__proto__:null,boolean:U,booleanish:ae,commaOrSpaceSeparated:ye,commaSeparated:We,number:N,overloadedBoolean:Gt,spaceSeparated:K},Symbol.toStringTag,{value:"Module"})),At=Object.keys(Yt);class nn extends me{constructor(t,n,r,i){let a=-1;if(super(t,n),Tn(this,"space",i),typeof r=="number")for(;++a<At.length;){const o=At[a];Tn(this,At[a],(r&Yt[o])===Yt[o])}}}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 a=new nn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Vt(r)]=r,n[Vt(a.attribute)]=r}return new at(t,n,e.space)}const mr=Ge({properties:{ariaActiveDescendant:null,ariaAtomic:ae,ariaAutoComplete:null,ariaBusy:ae,ariaChecked:ae,ariaColCount:N,ariaColIndex:N,ariaColSpan:N,ariaControls:K,ariaCurrent:null,ariaDescribedBy:K,ariaDetails:null,ariaDisabled:ae,ariaDropEffect:K,ariaErrorMessage:null,ariaExpanded:ae,ariaFlowTo:K,ariaGrabbed:ae,ariaHasPopup:null,ariaHidden:ae,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:K,ariaLevel:N,ariaLive:null,ariaModal:ae,ariaMultiLine:ae,ariaMultiSelectable:ae,ariaOrientation:null,ariaOwns:K,ariaPlaceholder:null,ariaPosInSet:N,ariaPressed:ae,ariaReadOnly:ae,ariaRelevant:null,ariaRequired:ae,ariaRoleDescription:K,ariaRowCount:N,ariaRowIndex:N,ariaRowSpan:N,ariaSelected:ae,ariaSetSize:N,ariaSort:null,ariaValueMax:N,ariaValueMin:N,ariaValueNow:N,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 Yi=Ge({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:We,acceptCharset:K,accessKey:K,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:K,autoFocus:U,autoPlay:U,blocking:K,capture:null,charSet:null,checked:U,cite:null,className:K,cols:N,colSpan:null,content:null,contentEditable:ae,controls:U,controlsList:K,coords:N|We,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:Gt,draggable:ae,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:K,height:N,hidden:Gt,high:N,href:null,hrefLang:null,htmlFor:K,httpEquiv:K,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:K,itemRef:K,itemScope:U,itemType:K,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:N,manifest:null,max:null,maxLength:N,media:null,method:null,min:null,minLength:N,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,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:U,optimum:N,pattern:null,ping:K,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:K,required:U,reversed:U,rows:N,rowSpan:N,sandbox:K,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:N,sizes:null,slot:null,span:N,spellCheck:ae,src:null,srcDoc:null,srcLang:null,srcSet:null,start:N,step:null,style:null,tabIndex:N,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:ae,width:N,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:K,axis:null,background:null,bgColor:null,border:N,borderColor:null,bottomMargin:N,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:N,leftMargin:N,link:null,longDesc:null,lowSrc:null,marginHeight:N,marginWidth:N,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:N,rules:null,scheme:null,scrolling:ae,standby:null,summary:null,text:null,topMargin:N,valueType:null,version:null,vAlign:null,vLink:null,vSpace:N,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:U,disableRemotePlayback:U,prefix:null,property:null,results:N,security:null,unselectable:null},space:"html",transform:yr}),Zi=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:ye,accentHeight:N,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:N,amplitude:N,arabicForm:null,ascent:N,attributeName:null,attributeType:null,azimuth:N,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:N,by:null,calcMode:null,capHeight:N,className:K,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:N,diffuseConstant:N,direction:null,display:null,dur:null,divisor:N,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:N,enableBackground:null,end:null,event:null,exponent:N,externalResourcesRequired:null,fill:null,fillOpacity:N,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:N,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:N,horizOriginX:N,horizOriginY:N,id:null,ideographic:N,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:N,k:N,k1:N,k2:N,k3:N,k4:N,kernelMatrix:ye,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:N,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:N,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:N,overlineThickness:N,paintOrder:null,panose1:null,path:null,pathLength:N,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:K,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:N,pointsAtY:N,pointsAtZ:N,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ye,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ye,rev:ye,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ye,requiredFeatures:ye,requiredFonts:ye,requiredFormats:ye,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:N,specularExponent:N,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:N,strikethroughThickness:N,string:null,stroke:null,strokeDashArray:ye,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:N,strokeOpacity:N,strokeWidth:null,style:null,surfaceScale:N,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ye,tabIndex:N,tableValues:null,target:null,targetX:N,targetY:N,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ye,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:N,underlineThickness:N,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:N,values:null,vAlphabetic:N,vMathematical:N,vectorEffect:null,vHanging:N,vIdeographic:N,version:null,vertAdvY:N,vertOriginX:N,vertOriginY:N,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:N,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()}}),br=Ge({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yr}),kr=Ge({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Qi={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"},Ji=/[A-Z]/g,An=/-[a-z]/g,Xi=/^data[-\w.:]+$/i;function Ki(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"&&Xi.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(An,eo);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!An.test(a)){let o=a.replace(Ji,$i);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=nn}return new i(r,t)}function $i(e){return"-"+e.toLowerCase()}function eo(e){return e.charAt(1).toUpperCase()}const to=dr([mr,Yi,xr,br,kr],"html"),rn=dr([mr,Zi,xr,br,kr],"svg");function no(e){return e.join(" ").trim()}function wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Be={},It,In;function ro(){if(In)return It;In=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
|
|
2
|
+
`,u="/",h="*",c="",p="comment",f="declaration";It=function(w,v){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];v=v||{};var b=1,S=1;function E(R){var z=R.match(t);z&&(b+=z.length);var M=R.lastIndexOf(l);S=~M?R.length-M:S+R.length}function D(){var R={line:b,column:S};return function(z){return z.position=new I(R),F(),z}}function I(R){this.start=R,this.end={line:b,column:S},this.source=v.source}I.prototype.content=w;function k(R){var z=new Error(v.source+":"+b+":"+S+": "+R);if(z.reason=R,z.filename=v.source,z.line=b,z.column=S,z.source=w,!v.silent)throw z}function L(R){var z=R.exec(w);if(z){var M=z[0];return E(M),w=w.slice(M.length),z}}function F(){L(n)}function _(R){var z;for(R=R||[];z=x();)z!==!1&&R.push(z);return R}function x(){var R=D();if(!(u!=w.charAt(0)||h!=w.charAt(1))){for(var z=2;c!=w.charAt(z)&&(h!=w.charAt(z)||u!=w.charAt(z+1));)++z;if(z+=2,c===w.charAt(z-1))return k("End of comment missing");var M=w.slice(2,z-2);return S+=2,E(M),w=w.slice(z),S+=2,R({type:p,comment:M})}}function T(){var R=D(),z=L(r);if(z){if(x(),!L(i))return k("property missing ':'");var M=L(a),Y=R({type:f,property:m(z[0].replace(e,c)),value:M?m(M[0].replace(e,c)):c});return L(o),Y}}function j(){var R=[];_(R);for(var z;z=T();)z!==!1&&(R.push(z),_(R));return R}return F(),j()};function m(w){return w?w.replace(s,c):c}return It}var Nn;function io(){if(Nn)return Be;Nn=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(ro());function n(r,i){let a=null;if(!r||typeof r!="string")return a;const o=(0,t.default)(r),s=typeof i=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:h}=l;s?i(u,h,l):h&&(a=a||{},a[u]=h)}),a}return Be}var Je={},Dn;function oo(){if(Dn)return Je;Dn=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(u){return!u||n.test(u)||e.test(u)},o=function(u,h){return h.toUpperCase()},s=function(u,h){return"".concat(h,"-")},l=function(u,h){return h===void 0&&(h={}),a(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(i,s):u=u.replace(r,s),u.replace(t,o))};return Je.camelCase=l,Je}var Xe,Pn;function ao(){if(Pn)return Xe;Pn=1;var e=Xe&&Xe.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(io()),n=oo();function r(i,a){var o={};return!i||typeof i!="string"||(0,t.default)(i,function(s,l){s&&l&&(o[(0,n.camelCase)(s,a)]=l)}),o}return r.default=r,Xe=r,Xe}var so=ao();const lo=wr(so),vr=Cr("end"),on=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 uo(e){const t=on(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?Zt(e):""}function Zt(e){return zn(e&&e.line)+":"+zn(e&&e.column)}function Ln(e){return Zt(e&&e.start)+"-"+Zt(e&&e.end)}function zn(e){return e&&typeof e=="number"?e:1}class fe extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},o=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(o=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?a.ruleId=r:(a.source=r.slice(0,l),a.ruleId=r.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){const l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.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(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}fe.prototype.file="";fe.prototype.name="";fe.prototype.reason="";fe.prototype.message="";fe.prototype.stack="";fe.prototype.column=void 0;fe.prototype.line=void 0;fe.prototype.ancestors=void 0;fe.prototype.cause=void 0;fe.prototype.fatal=void 0;fe.prototype.place=void 0;fe.prototype.ruleId=void 0;fe.prototype.source=void 0;const an={}.hasOwnProperty,co=new Map,ho=/[A-Z]/g,fo=new Set(["table","tbody","thead","tfoot","tr"]),po=new Set(["td","th"]),Sr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function mo(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=Co(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=vo(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:to,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Er(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Er(e,t,n){if(t.type==="element")return go(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return yo(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return bo(e,t,n);if(t.type==="mdxjsEsm")return xo(e,t);if(t.type==="root")return ko(e,t,n);if(t.type==="text")return wo(e,t)}function go(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 a=Ar(e,t.tagName,!1),o=So(e,t);let s=ln(e,t);return fo.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!Vi(l):!0})),Tr(e,o,a,t),sn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function yo(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 xo(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);rt(e,t.position)}function bo(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 a=t.name===null?e.Fragment:Ar(e,t.name,!0),o=Eo(e,t),s=ln(e,t);return Tr(e,o,a,t),sn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ko(e,t,n){const r={};return sn(r,ln(e,t)),e.create(t,e.Fragment,r,n)}function wo(e,t){return t.value}function Tr(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 vo(e,t,n){return r;function r(i,a,o,s){const u=Array.isArray(o.children)?n:t;return s?u(a,o,s):u(a,o)}}function Co(e,t){return n;function n(r,i,a,o){const s=Array.isArray(a.children),l=on(r);return t(i,a,o,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function So(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&an.call(t.properties,i)){const a=To(e,i,t.properties[i]);if(a){const[o,s]=a;e.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&po.has(t.tagName)?r=s:n[o]=s}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Eo(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const o=a.expression;o.type;const s=o.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else rt(e,t.position);else{const i=r.name;let a;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,a=e.evaluater.evaluateExpression(s.expression)}else rt(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function ln(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:co;for(;++r<t.children.length;){const a=t.children[r];let o;if(e.passKeys){const l=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(l){const u=i.get(l)||0;o=l+"-"+u,i.set(l,u+1)}}const s=Er(e,a,o);s!==void 0&&n.push(s)}return n}function To(e,t,n){const r=Ki(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Bi(n):no(n)),r.property==="style"){let i=typeof n=="object"?n:Ao(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Io(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Qi[r.property]||r.property:r.attribute,n]}}function Ao(e,t){try{return lo(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new fe("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 a=-1,o;for(;++a<i.length;){const s=Sn(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};o=o?{type:"MemberExpression",object:o,property:s,computed:!!(a&&s.type==="Literal"),optional:!1}:s}r=o}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 fe("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 Io(e){const t={};let n;for(n in e)an.call(e,n)&&(t[No(n)]=e[n]);return t}function No(e){let t=e.replace(ho,Do);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Do(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"]},Po={};function un(e,t){const n=Po,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(Lo(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 Lo(e){return!!(e&&typeof e=="object")}const Rn=document.createElement("i");function cn(e){const t="&"+e+";";Rn.innerHTML=t;const n=Rn.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function xe(e,t,n,r){const i=e.length;let a=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function be(e,t){return e.length>0?(xe(e,e.length,0,t),e):t}const Mn={}.hasOwnProperty;function Nr(e){const t={};let n=-1;for(;++n<e.length;)zo(t,e[n]);return t}function zo(e,t){let n;for(n in t){const i=(Mn.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let o;if(a)for(o in a){Mn.call(i,o)||(i[o]=[]);const s=a[o];jo(i[o],Array.isArray(s)?s:s?[s]:[])}}}function jo(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);xe(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 pe=Le(/[A-Za-z]/),he=Le(/[\dA-Za-z]/),Ro=Le(/[#-'*+\--9=?A-Z^-~]/);function xt(e){return e!==null&&(e<32||e===127)}const Qt=Le(/\d/),Mo=Le(/[\dA-Fa-f]/),Oo=Le(/[!-/:-@[-`{-~]/);function O(e){return e!==null&&e<-2}function X(e){return e!==null&&(e<0||e===32)}function q(e){return e===-2||e===-1||e===32}const vt=Le(new RegExp("\\p{P}|\\p{S}","u")),Me=Le(/\s/);function Le(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 a=e.charCodeAt(n);let o="";if(a===37&&he(e.charCodeAt(n+1))&&he(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){const s=e.charCodeAt(n+1);a<56320&&s>56319&&s<57344?(o=String.fromCharCode(a,s),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function G(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return o;function o(l){return q(l)?(e.enter(n),s(l)):t(l)}function s(l){return q(l)&&a++<i?(e.consume(l),s):(e.exit(n),t(l))}}const Fo={tokenize:_o};function _o(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"),G(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),a(s)}function a(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return O(s)?(e.consume(s),e.exit("chunkText"),a):(e.consume(s),o)}}const Bo={tokenize:Ho},On={tokenize:Uo};function Ho(e){const t=this,n=[];let r=0,i,a,o;return s;function s(E){if(r<n.length){const D=n[r];return t.containerState=D[1],e.attempt(D[0].continuation,l,u)(E)}return u(E)}function l(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&S();const D=t.events.length;let I=D,k;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){k=t.events[I][1].end;break}b(r);let L=D;for(;L<t.events.length;)t.events[L][1].end={...k},L++;return xe(t.events,I+1,0,t.events.slice(D)),t.events.length=L,u(E)}return s(E)}function u(E){if(r===n.length){if(!i)return p(E);if(i.currentConstruct&&i.currentConstruct.concrete)return m(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(On,h,c)(E)}function h(E){return i&&S(),b(r),p(E)}function c(E){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(E)}function p(E){return t.containerState={},e.attempt(On,f,m)(E)}function f(E){return r++,n.push([t.currentConstruct,t.containerState]),p(E)}function m(E){if(E===null){i&&S(),b(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),w(E)}function w(E){if(E===null){v(e.exit("chunkFlow"),!0),b(0),e.consume(E);return}return O(E)?(e.consume(E),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(E),w)}function v(E,D){const I=t.sliceStream(E);if(D&&I.push(null),E.previous=a,a&&(a.next=E),a=E,i.defineSkip(E.start),i.write(I),t.parser.lazy[E.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const L=t.events.length;let F=L,_,x;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(_){x=t.events[F][1].end;break}_=!0}for(b(r),k=L;k<t.events.length;)t.events[k][1].end={...x},k++;xe(t.events,F+1,0,t.events.slice(L)),t.events.length=k}}function b(E){let D=n.length;for(;D-- >E;){const I=n[D];t.containerState=I[1],I[0].exit.call(t,e)}n.length=E}function S(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Uo(e,t,n){return G(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||X(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 a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Jt={name:"attention",resolveAll:qo,tokenize:Wo};function qo(e,t){let n=-1,r,i,a,o,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},p={...e[n][1].start};Fn(c,-l),Fn(p,l),o={type:l>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},a={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[r][1].end={...o.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",o,t],["exit",o,t],["enter",a,t]]),u=be(u,Ct(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=be(u,[["exit",a,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,xe(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 Wo(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ve(r);let a;return o;function o(l){return a=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===a)return e.consume(l),s;const u=e.exit("attentionSequence"),h=Ve(l),c=!h||h===2&&i||n.includes(l),p=!i||i===2&&h||n.includes(r);return u._open=!!(a===42?c:c&&(i||!p)),u._close=!!(a===42?p:p&&(h||!c)),t(l)}}function Fn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Vo={name:"autolink",tokenize:Go};function Go(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(f){return pe(f)?(e.consume(f),o):f===64?n(f):u(f)}function o(f){return f===43||f===45||f===46||he(f)?(r=1,s(f)):u(f)}function s(f){return f===58?(e.consume(f),r=0,l):(f===43||f===45||f===46||he(f))&&r++<32?(e.consume(f),s):(r=0,u(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||xt(f)?n(f):(e.consume(f),l)}function u(f){return f===64?(e.consume(f),h):Ro(f)?(e.consume(f),u):n(f)}function h(f){return he(f)?c(f):n(f)}function c(f){return f===46?(e.consume(f),r=0,h):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||he(f))&&r++<63){const m=f===45?p:c;return e.consume(f),m}return n(f)}}const st={partial:!0,tokenize:Yo};function Yo(e,t,n){return r;function r(a){return q(a)?G(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||O(a)?t(a):n(a)}}const Pr={continuation:{tokenize:Qo},exit:Jo,name:"blockQuote",tokenize:Zo};function Zo(e,t,n){const r=this;return i;function i(o){if(o===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),a}return n(o)}function a(o){return q(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Qo(e,t,n){const r=this;return i;function i(o){return q(o)?G(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return e.attempt(Pr,t,n)(o)}}function Jo(e){e.exit("blockQuote")}const Lr={name:"characterEscape",tokenize:Xo};function Xo(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return Oo(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const zr={name:"characterReference",tokenize:Ko};function Ko(e,t,n){const r=this;let i=0,a,o;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"),a=31,o=he,h(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,o=Mo,h):(e.enter("characterReferenceValue"),a=7,o=Qt,h(c))}function h(c){if(c===59&&i){const p=e.exit("characterReferenceValue");return o===he&&!cn(r.sliceSerialize(p))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(c)&&i++<a?(e.consume(c),h):n(c)}}const _n={partial:!0,tokenize:ea},Bn={concrete:!0,name:"codeFenced",tokenize:$o};function $o(e,t,n){const r=this,i={partial:!0,tokenize:I};let a=0,o=0,s;return l;function l(k){return u(k)}function u(k){const L=r.events[r.events.length-1];return a=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,s=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(k)}function h(k){return k===s?(o++,e.consume(k),h):o<3?n(k):(e.exit("codeFencedFenceSequence"),q(k)?G(e,c,"whitespace")(k):c(k))}function c(k){return k===null||O(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(_n,w,D)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||O(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(k)):q(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),G(e,f,"whitespace")(k)):k===96&&k===s?n(k):(e.consume(k),p)}function f(k){return k===null||O(k)?c(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||O(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(k)):k===96&&k===s?n(k):(e.consume(k),m)}function w(k){return e.attempt(i,D,v)(k)}function v(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),b}function b(k){return a>0&&q(k)?G(e,S,"linePrefix",a+1)(k):S(k)}function S(k){return k===null||O(k)?e.check(_n,w,D)(k):(e.enter("codeFlowValue"),E(k))}function E(k){return k===null||O(k)?(e.exit("codeFlowValue"),S(k)):(e.consume(k),E)}function D(k){return e.exit("codeFenced"),t(k)}function I(k,L,F){let _=0;return x;function x(M){return k.enter("lineEnding"),k.consume(M),k.exit("lineEnding"),T}function T(M){return k.enter("codeFencedFence"),q(M)?G(k,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):j(M)}function j(M){return M===s?(k.enter("codeFencedFenceSequence"),R(M)):F(M)}function R(M){return M===s?(_++,k.consume(M),R):_>=o?(k.exit("codeFencedFenceSequence"),q(M)?G(k,z,"whitespace")(M):z(M)):F(M)}function z(M){return M===null||O(M)?(k.exit("codeFencedFence"),L(M)):F(M)}}}function ea(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Dt={name:"codeIndented",tokenize:na},ta={partial:!0,tokenize:ra};function na(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),G(e,a,"linePrefix",5)(u)}function a(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):O(u)?e.attempt(ta,o,l)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||O(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),s)}function l(u){return e.exit("codeIndented"),t(u)}}function ra(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):O(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):G(e,a,"linePrefix",5)(o)}function a(o){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):O(o)?i(o):n(o)}}const ia={name:"codeText",previous:aa,resolve:oa,tokenize:sa};function oa(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 aa(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sa(e,t,n){let r=0,i,a;return o;function o(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?(a=e.enter("codeTextSequence"),i=0,h(c)):O(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||O(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)):(a.type="codeTextData",u(c))}}class la{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 a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ke(this.left,r),a.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 jr(e){const t={};let n=-1,r,i,a,o,s,l,u;const h=new la(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,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,ua(h,n)),n=t[n],u=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=h.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=a);else if(!(o[1].type==="linePrefix"||o[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 xe(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!u}function ua(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const s=o.events,l=[],u={};let h,c,p=-1,f=n,m=0,w=0;const v=[w];for(;f;){for(;e.get(++i)[1]!==f;);a.push(i),f._tokenizer||(h=r.sliceStream(f),f.next||h.push(null),c&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),c=f,f=f.next}for(f=n;++p<s.length;)s[p][0]==="exit"&&s[p-1][0]==="enter"&&s[p][1].type===s[p-1][1].type&&s[p][1].start.line!==s[p][1].end.line&&(w=p+1,v.push(w),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),p=v.length;p--;){const b=s.slice(v[p],v[p+1]),S=a.pop();l.push([S,S+b.length-1]),e.splice(S,2,b)}for(l.reverse(),p=-1;++p<l.length;)u[m+l[p][0]]=m+l[p][1],m+=l[p][1]-l[p][0]-1;return u}const ca={resolve:fa,tokenize:pa},ha={partial:!0,tokenize:da};function fa(e){return jr(e),e}function pa(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?a(s):O(s)?e.check(ha,o,a)(s):(e.consume(s),i)}function a(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function o(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function da(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),G(e,a,"linePrefix")}function a(o){if(o===null||O(o))return n(o);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(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Rr(e,t,n,r,i,a,o,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(a),e.consume(b),e.exit(a),p):b===null||b===32||b===41||xt(b)?n(b):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),w(b))}function p(b){return b===62?(e.enter(a),e.consume(b),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===62?(e.exit("chunkString"),e.exit(s),p(b)):b===null||b===60||O(b)?n(b):(e.consume(b),b===92?m:f)}function m(b){return b===60||b===62||b===92?(e.consume(b),f):f(b)}function w(b){return!h&&(b===null||b===41||X(b))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(b)):h<u&&b===40?(e.consume(b),h++,w):b===41?(e.consume(b),h--,w):b===null||b===32||b===40||xt(b)?n(b):(e.consume(b),b===92?v:w)}function v(b){return b===40||b===41||b===92?(e.consume(b),w):w(b)}}function Mr(e,t,n,r,i,a){const o=this;let s=0,l;return u;function u(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(a),h}function h(f){return s>999||f===null||f===91||f===93&&!l||f===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(a),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):O(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===null||f===91||f===93||O(f)||s++>999?(e.exit("chunkString"),h(f)):(e.consume(f),l||(l=!q(f)),f===92?p:c)}function p(f){return f===91||f===92||f===93?(e.consume(f),s++,c):c(f)}}function Or(e,t,n,r,i,a){let o;return s;function s(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),o=p===40?41:p,l):n(p)}function l(p){return p===o?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(a),u(p))}function u(p){return p===o?(e.exit(a),l(o)):p===null?n(p):O(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),G(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===o||p===null||O(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?c:h)}function c(p){return p===o||p===92?(e.consume(p),h):h(p)}}function tt(e,t){let n;return r;function r(i){return O(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):q(i)?G(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const ma={name:"definition",tokenize:ya},ga={partial:!0,tokenize:xa};function ya(e,t,n){const r=this;let i;return a;function a(f){return e.enter("definition"),o(f)}function o(f){return Mr.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function s(f){return i=ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return X(f)?tt(e,u)(f):u(f)}function u(f){return Rr(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function h(f){return e.attempt(ga,c,c)(f)}function c(f){return q(f)?G(e,p,"whitespace")(f):p(f)}function p(f){return f===null||O(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function xa(e,t,n){return r;function r(s){return X(s)?tt(e,i)(s):n(s)}function i(s){return Or(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return q(s)?G(e,o,"whitespace")(s):o(s)}function o(s){return s===null||O(s)?t(s):n(s)}}const ba={name:"hardBreakEscape",tokenize:ka};function ka(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return O(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const wa={name:"headingAtx",resolve:va,tokenize:Ca};function va(e,t){let n=e.length-2,r=3,i,a;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},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},xe(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function Ca(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),a(h)}function a(h){return e.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&r++<6?(e.consume(h),o):h===null||X(h)?(e.exit("atxHeadingSequence"),s(h)):n(h)}function s(h){return h===35?(e.enter("atxHeadingSequence"),l(h)):h===null||O(h)?(e.exit("atxHeading"),t(h)):q(h)?G(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||X(h)?(e.exit("atxHeadingText"),s(h)):(e.consume(h),u)}}const Sa=["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"],Ea={concrete:!0,name:"htmlFlow",resolveTo:Ia,tokenize:Na},Ta={partial:!0,tokenize:Pa},Aa={partial:!0,tokenize:Da};function Ia(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 Na(e,t,n){const r=this;let i,a,o,s,l;return u;function u(g){return h(g)}function h(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),p):g===47?(e.consume(g),a=!0,w):g===63?(e.consume(g),i=3,r.interrupt?t:d):pe(g)?(e.consume(g),o=String.fromCharCode(g),v):n(g)}function p(g){return g===45?(e.consume(g),i=2,f):g===91?(e.consume(g),i=5,s=0,m):pe(g)?(e.consume(g),i=4,r.interrupt?t:d):n(g)}function f(g){return g===45?(e.consume(g),r.interrupt?t:d):n(g)}function m(g){const ce="CDATA[";return g===ce.charCodeAt(s++)?(e.consume(g),s===ce.length?r.interrupt?t:j:m):n(g)}function w(g){return pe(g)?(e.consume(g),o=String.fromCharCode(g),v):n(g)}function v(g){if(g===null||g===47||g===62||X(g)){const ce=g===47,ke=o.toLowerCase();return!ce&&!a&&Hn.includes(ke)?(i=1,r.interrupt?t(g):j(g)):Sa.includes(o.toLowerCase())?(i=6,ce?(e.consume(g),b):r.interrupt?t(g):j(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(g):a?S(g):E(g))}return g===45||he(g)?(e.consume(g),o+=String.fromCharCode(g),v):n(g)}function b(g){return g===62?(e.consume(g),r.interrupt?t:j):n(g)}function S(g){return q(g)?(e.consume(g),S):x(g)}function E(g){return g===47?(e.consume(g),x):g===58||g===95||pe(g)?(e.consume(g),D):q(g)?(e.consume(g),E):x(g)}function D(g){return g===45||g===46||g===58||g===95||he(g)?(e.consume(g),D):I(g)}function I(g){return g===61?(e.consume(g),k):q(g)?(e.consume(g),I):E(g)}function k(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),l=g,L):q(g)?(e.consume(g),k):F(g)}function L(g){return g===l?(e.consume(g),l=null,_):g===null||O(g)?n(g):(e.consume(g),L)}function F(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||X(g)?I(g):(e.consume(g),F)}function _(g){return g===47||g===62||q(g)?E(g):n(g)}function x(g){return g===62?(e.consume(g),T):n(g)}function T(g){return g===null||O(g)?j(g):q(g)?(e.consume(g),T):n(g)}function j(g){return g===45&&i===2?(e.consume(g),Y):g===60&&i===1?(e.consume(g),ne):g===62&&i===4?(e.consume(g),$):g===63&&i===3?(e.consume(g),d):g===93&&i===5?(e.consume(g),B):O(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Ta,se,R)(g)):g===null||O(g)?(e.exit("htmlFlowData"),R(g)):(e.consume(g),j)}function R(g){return e.check(Aa,z,se)(g)}function z(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),M}function M(g){return g===null||O(g)?R(g):(e.enter("htmlFlowData"),j(g))}function Y(g){return g===45?(e.consume(g),d):j(g)}function ne(g){return g===47?(e.consume(g),o="",re):j(g)}function re(g){if(g===62){const ce=o.toLowerCase();return Hn.includes(ce)?(e.consume(g),$):j(g)}return pe(g)&&o.length<8?(e.consume(g),o+=String.fromCharCode(g),re):j(g)}function B(g){return g===93?(e.consume(g),d):j(g)}function d(g){return g===62?(e.consume(g),$):g===45&&i===2?(e.consume(g),d):j(g)}function $(g){return g===null||O(g)?(e.exit("htmlFlowData"),se(g)):(e.consume(g),$)}function se(g){return e.exit("htmlFlow"),t(g)}}function Da(e,t,n){const r=this;return i;function i(o){return O(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):n(o)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Pa(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(st,t,n)}}const La={name:"htmlText",tokenize:za};function za(e,t,n){const r=this;let i,a,o;return s;function s(d){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(d),l}function l(d){return d===33?(e.consume(d),u):d===47?(e.consume(d),I):d===63?(e.consume(d),E):pe(d)?(e.consume(d),F):n(d)}function u(d){return d===45?(e.consume(d),h):d===91?(e.consume(d),a=0,m):pe(d)?(e.consume(d),S):n(d)}function h(d){return d===45?(e.consume(d),f):n(d)}function c(d){return d===null?n(d):d===45?(e.consume(d),p):O(d)?(o=c,ne(d)):(e.consume(d),c)}function p(d){return d===45?(e.consume(d),f):c(d)}function f(d){return d===62?Y(d):d===45?p(d):c(d)}function m(d){const $="CDATA[";return d===$.charCodeAt(a++)?(e.consume(d),a===$.length?w:m):n(d)}function w(d){return d===null?n(d):d===93?(e.consume(d),v):O(d)?(o=w,ne(d)):(e.consume(d),w)}function v(d){return d===93?(e.consume(d),b):w(d)}function b(d){return d===62?Y(d):d===93?(e.consume(d),b):w(d)}function S(d){return d===null||d===62?Y(d):O(d)?(o=S,ne(d)):(e.consume(d),S)}function E(d){return d===null?n(d):d===63?(e.consume(d),D):O(d)?(o=E,ne(d)):(e.consume(d),E)}function D(d){return d===62?Y(d):E(d)}function I(d){return pe(d)?(e.consume(d),k):n(d)}function k(d){return d===45||he(d)?(e.consume(d),k):L(d)}function L(d){return O(d)?(o=L,ne(d)):q(d)?(e.consume(d),L):Y(d)}function F(d){return d===45||he(d)?(e.consume(d),F):d===47||d===62||X(d)?_(d):n(d)}function _(d){return d===47?(e.consume(d),Y):d===58||d===95||pe(d)?(e.consume(d),x):O(d)?(o=_,ne(d)):q(d)?(e.consume(d),_):Y(d)}function x(d){return d===45||d===46||d===58||d===95||he(d)?(e.consume(d),x):T(d)}function T(d){return d===61?(e.consume(d),j):O(d)?(o=T,ne(d)):q(d)?(e.consume(d),T):_(d)}function j(d){return d===null||d===60||d===61||d===62||d===96?n(d):d===34||d===39?(e.consume(d),i=d,R):O(d)?(o=j,ne(d)):q(d)?(e.consume(d),j):(e.consume(d),z)}function R(d){return d===i?(e.consume(d),i=void 0,M):d===null?n(d):O(d)?(o=R,ne(d)):(e.consume(d),R)}function z(d){return d===null||d===34||d===39||d===60||d===61||d===96?n(d):d===47||d===62||X(d)?_(d):(e.consume(d),z)}function M(d){return d===47||d===62||X(d)?_(d):n(d)}function Y(d){return d===62?(e.consume(d),e.exit("htmlTextData"),e.exit("htmlText"),t):n(d)}function ne(d){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),re}function re(d){return q(d)?G(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):B(d)}function B(d){return e.enter("htmlTextData"),o(d)}}const hn={name:"labelEnd",resolveAll:Oa,resolveTo:Fa,tokenize:_a},ja={tokenize:Ba},Ra={tokenize:Ha},Ma={tokenize:Ua};function Oa(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&&xe(e,0,e.length,n),e}function Fa(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},h={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[["enter",l,t],["enter",u,t]],s=be(s,e.slice(a+1,a+r+3)),s=be(s,[["enter",h,t]]),s=be(s,Ct(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=be(s,[["exit",h,t],e[o-2],e[o-1],["exit",u,t]]),s=be(s,e.slice(o+1)),s=be(s,[["exit",l,t]]),xe(e,a,e.length,s),e}function _a(e,t,n){const r=this;let i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(p){return a?a._inactive?c(p):(o=r.parser.defined.includes(ve(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(ja,h,o?h:c)(p):p===91?e.attempt(Ra,h,o?u:c)(p):o?h(p):c(p)}function u(p){return e.attempt(Ma,h,c)(p)}function h(p){return t(p)}function c(p){return a._balanced=!0,n(p)}}function Ba(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 X(c)?tt(e,a)(c):a(c)}function a(c){return c===41?h(c):Rr(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function o(c){return X(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 X(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 Ha(e,t,n){const r=this;return i;function i(s){return Mr.call(r,e,a,o,"reference","referenceMarker","referenceString")(s)}function a(s){return r.parser.defined.includes(ve(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function Ua(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const qa={name:"labelStartImage",resolveAll:hn.resolveAll,tokenize:Wa};function Wa(e,t,n){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),a}function a(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):n(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Va={name:"labelStartLink",resolveAll:hn.resolveAll,tokenize:Ga};function Ga(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Pt={name:"lineEnding",tokenize:Ya};function Ya(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),G(e,t,"linePrefix")}}const yt={name:"thematicBreak",tokenize:Za};function Za(e,t,n){let r=0,i;return a;function a(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,s(u)}function s(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||O(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),q(u)?G(e,s,"whitespace")(u):s(u))}}const de={continuation:{tokenize:Ka},exit:es,name:"list",tokenize:Xa},Qa={partial:!0,tokenize:ts},Ja={partial:!0,tokenize:$a};function Xa(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(f){const m=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Qt(f)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(yt,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return Qt(f)&&++o<10?(e.consume(f),l):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(st,r.interrupt?n:h,e.attempt(Qa,p,c))}function h(f){return r.containerState.initialBlankLine=!0,a++,p(f)}function c(f){return q(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Ka(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(st,i,a);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,G(e,t,"listItemIndent",r.containerState.size+1)(s)}function a(s){return r.containerState.furtherBlankLines||!q(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ja,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,G(e,e.attempt(de,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function $a(e,t,n){const r=this;return G(e,i,"listItemIndent",r.containerState.size+1);function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(a):n(a)}}function es(e){e.exit(this.containerState.type)}function ts(e,t,n){const r=this;return G(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const o=r.events[r.events.length-1];return!q(a)&&o&&o[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Un={name:"setextUnderline",resolveTo:ns,tokenize:rs};function ns(e,t){let n=e.length,r,i,a;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),!a&&e[n][1].type==="definition"&&(a=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function rs(e,t,n){const r=this;let i;return a;function a(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,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),q(u)?G(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||O(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const is={tokenize:os};function os(e){const t=this,n=e.attempt(st,r,e.attempt(this.parser.constructs.flowInitial,i,G(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ca,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const as={resolveAll:_r()},ss=Fr("string"),ls=Fr("text");function Fr(e){return{resolveAll:_r(e==="text"?us:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,o,s);return o;function o(h){return u(h)?a(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"),a(h)):(n.consume(h),l)}function u(h){if(h===null)return!0;const c=i[h];let p=-1;if(c)for(;++p<c.length;){const f=c[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function _r(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function us(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 a=i.length,o=-1,s=0,l;for(;a--;){const u=i[a];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(u===-2)l=!0,s++;else if(u!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const u={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,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 cs={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},hs={91:ma},fs={[-2]:Dt,[-1]:Dt,32:Dt},ps={35:wa,42:yt,45:[Un,yt],60:Ea,61:Un,95:yt,96:Bn,126:Bn},ds={38:zr,92:Lr},ms={[-5]:Pt,[-4]:Pt,[-3]:Pt,33:qa,38:zr,42:Jt,60:[Vo,La],91:Va,92:[ba,Lr],93:hn,95:Jt,96:ia},gs={null:[Jt,as]},ys={null:[42,95]},xs={null:[]},bs=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ys,contentInitial:hs,disable:xs,document:cs,flow:ps,flowInitial:fs,insideSpan:gs,string:ds,text:ms},Symbol.toStringTag,{value:"Module"}));function ks(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={},a=[];let o=[],s=[];const l={attempt:L(I),check:L(k),consume:S,enter:E,exit:D,interrupt:L(k,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:m,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:c};let h=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function c(T){return o=be(o,T),v(),o[o.length-1]!==null?[]:(F(t,0),u.events=Ct(a,u.events,u),u.events)}function p(T,j){return vs(f(T),j)}function f(T){return ws(o,T)}function m(){const{_bufferIndex:T,_index:j,line:R,column:z,offset:M}=r;return{_bufferIndex:T,_index:j,line:R,column:z,offset:M}}function w(T){i[T.line]=T.column,x()}function v(){let T;for(;r._index<o.length;){const j=o[r._index];if(typeof j=="string")for(T=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===T&&r._bufferIndex<j.length;)b(j.charCodeAt(r._bufferIndex));else b(j)}}function b(T){h=h(T)}function S(T){O(T)?(r.line++,r.column=1,r.offset+=T===-3?2:1,x()):T!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=T}function E(T,j){const R=j||{};return R.type=T,R.start=m(),u.events.push(["enter",R,u]),s.push(R),R}function D(T){const j=s.pop();return j.end=m(),u.events.push(["exit",j,u]),j}function I(T,j){F(T,j.from)}function k(T,j){j.restore()}function L(T,j){return R;function R(z,M,Y){let ne,re,B,d;return Array.isArray(z)?se(z):"tokenize"in z?se([z]):$(z);function $(W){return ee;function ee(Z){const le=Z!==null&&W[Z],te=Z!==null&&W.null,Q=[...Array.isArray(le)?le:le?[le]:[],...Array.isArray(te)?te:te?[te]:[]];return se(Q)(Z)}}function se(W){return ne=W,re=0,W.length===0?Y:g(W[re])}function g(W){return ee;function ee(Z){return d=_(),B=W,W.partial||(u.currentConstruct=W),W.name&&u.parser.constructs.disable.null.includes(W.name)?ke():W.tokenize.call(j?Object.assign(Object.create(u),j):u,l,ce,ke)(Z)}}function ce(W){return T(B,d),M}function ke(W){return d.restore(),++re<ne.length?g(ne[re]):Y}}}function F(T,j){T.resolveAll&&!a.includes(T)&&a.push(T),T.resolve&&xe(u.events,j,u.events.length-j,T.resolve(u.events.slice(j),u)),T.resolveTo&&(u.events=T.resolveTo(u.events,u))}function _(){const T=m(),j=u.previous,R=u.currentConstruct,z=u.events.length,M=Array.from(s);return{from:z,restore:Y};function Y(){r=T,u.previous=j,u.currentConstruct=R,u.events.length=z,s=M,x()}}function x(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ws(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){const s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function vs(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
|
|
3
3
|
`;break}case-3:{o=`\r
|
|
4
|
-
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join("")}function Cs(e){const r={constructs:_r([ks,...(e||{}).extensions||[]]),content:i(Oo),defined:[],document:i(Bo),flow:i(is),lazy:{},string:i(ss),text:i(ls)};return r;function i(a){return o;function o(s){return bs(r,a,s)}}}function Ss(e){for(;!zr(e););return e}const Hn=/[\0\t\n\r]/g;function Es(){let e=1,t="",n=!0,r;return i;function i(a,o,s){const l=[];let u,h,c,f,p;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),c=0,t="",n&&(a.charCodeAt(0)===65279&&c++,n=void 0);c<a.length;){if(Hn.lastIndex=c,u=Hn.exec(a),f=u&&u.index!==void 0?u.index:a.length,p=a.charCodeAt(f),!u){t=a.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(a.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 Ts=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Is(e){return e.replace(Ts,As)}function As(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return Nr(n.slice(a?2:1),a?16:10)}return cn(n)||e}const Br={}.hasOwnProperty;function _s(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Ns(n)(Ss(Cs(n).document().write(Es()(e,t,!0))))}function Ns(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(vn),autolinkProtocol:F,autolinkEmail:F,atxHeading:a(ut),blockQuote:a(te),characterEscape:F,characterReference:F,codeFenced:a(Q),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(Q,o),codeText:a(oe,o),codeTextData:F,data:F,codeFlowValue:F,definition:a(Ee),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Ge),hardBreakEscape:a(Me),hardBreakTrailing:a(Me),htmlFlow:a(ct,o),htmlFlowData:F,htmlText:a(ct,o),htmlTextData:F,image:a(Ei),label:o,link:a(vn),listItem:a(Ti),listItemValue:f,listOrdered:a(Cn,c),listUnordered:a(Cn),paragraph:a(Ii),reference:g,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ut),strong:a(Ai),thematicBreak:a(Ni)},exit:{atxHeading:l(),atxHeadingSequence:A,autolink:l(),autolinkEmail:le,autolinkProtocol:K,blockQuote:l(),characterEscapeValue:x,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:$,characterReference:ee,codeFenced:l(v),codeFencedFence:w,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:x,codeIndented:l(k),codeText:l(j),codeTextData:x,data:x,definition:l(),definitionDestinationString:N,definitionLabelString:S,definitionTitleString:E,emphasis:l(),hardBreakEscape:l(z),hardBreakTrailing:l(z),htmlFlow:l(R),htmlFlowData:x,htmlText:l(L),htmlTextData:x,image:l(ne),label:B,labelText:re,lineEnding:T,link:l(G),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ce,resourceDestinationString:d,resourceTitleString:Z,resource:se,setextHeading:l(O),setextHeadingLineSequence:D,setextHeadingText:b,strong:l(),thematicBreak:l()}};Vr(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(C){let P={type:"root",children:[]};const V={stack:[P],tokenStack:[],config:t,enter:s,exit:u,buffer:o,resume:h,data:n},q=[];let X=-1;for(;++X<C.length;)if(C[X][1].type==="listOrdered"||C[X][1].type==="listUnordered")if(C[X][0]==="enter")q.push(X);else{const we=q.pop();X=i(C,we,X)}for(X=-1;++X<C.length;){const we=t[C[X][0]];Br.call(we,C[X][1].type)&&we[C[X][1].type].call(Object.assign({sliceSerialize:C[X][2].sliceSerialize},V),C[X][1])}if(V.tokenStack.length>0){const we=V.tokenStack[V.tokenStack.length-1];(we[1]||$n).call(V,void 0,we[0])}for(P.position={start:_e(C.length>0?C[0][1].start:{line:1,column:1,offset:0}),end:_e(C.length>0?C[C.length-2][1].end:{line:1,column:1,offset:0})},X=-1;++X<t.transforms.length;)P=t.transforms[X](P)||P;return P}function i(C,P,V){let q=P-1,X=-1,we=!1,Le,Te,Ke,Xe;for(;++q<=V;){const ge=C[q];switch(ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ge[0]==="enter"?X++:X--,Xe=void 0;break}case"lineEndingBlank":{ge[0]==="enter"&&(Le&&!Xe&&!X&&!Ke&&(Ke=q),Xe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Xe=void 0}if(!X&&ge[0]==="enter"&&ge[1].type==="listItemPrefix"||X===-1&&ge[0]==="exit"&&(ge[1].type==="listUnordered"||ge[1].type==="listOrdered")){if(Le){let Oe=q;for(Te=void 0;Oe--;){const Ie=C[Oe];if(Ie[1].type==="lineEnding"||Ie[1].type==="lineEndingBlank"){if(Ie[0]==="exit")continue;Te&&(C[Te][1].type="lineEndingBlank",we=!0),Ie[1].type="lineEnding",Te=Oe}else if(!(Ie[1].type==="linePrefix"||Ie[1].type==="blockQuotePrefix"||Ie[1].type==="blockQuotePrefixWhitespace"||Ie[1].type==="blockQuoteMarker"||Ie[1].type==="listItemIndent"))break}Ke&&(!Te||Ke<Te)&&(Le._spread=!0),Le.end=Object.assign({},Te?C[Te][1].start:ge[1].end),C.splice(Te||q,0,["exit",Le,ge[2]]),q++,V++}if(ge[1].type==="listItemPrefix"){const Oe={type:"listItem",_spread:!1,start:Object.assign({},ge[1].start),end:void 0};Le=Oe,C.splice(q,0,["enter",Oe,ge[2]]),q++,V++,Ke=void 0,Xe=!0}}}return C[P][1]._spread=we,V}function a(C,P){return V;function V(q){s.call(this,C(q),q),P&&P.call(this,q)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(C,P,V){this.stack[this.stack.length-1].children.push(C),this.stack.push(C),this.tokenStack.push([P,V||void 0]),C.position={start:_e(P.start),end:void 0}}function l(C){return P;function P(V){C&&C.call(this,V),u.call(this,V)}}function u(C,P){const V=this.stack.pop(),q=this.tokenStack.pop();if(q)q[0].type!==C.type&&(P?P.call(this,C,q[0]):(q[1]||$n).call(this,C,q[0]));else throw new Error("Cannot close `"+C.type+"` ("+et({start:C.start,end:C.end})+"): it’s not open");V.position.end=_e(C.end)}function h(){return un(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function f(C){if(this.data.expectingFirstListItemValue){const P=this.stack[this.stack.length-2];P.start=Number.parseInt(this.sliceSerialize(C),10),this.data.expectingFirstListItemValue=void 0}}function p(){const C=this.resume(),P=this.stack[this.stack.length-1];P.lang=C}function m(){const C=this.resume(),P=this.stack[this.stack.length-1];P.meta=C}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const C=this.resume(),P=this.stack[this.stack.length-1];P.value=C.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const C=this.resume(),P=this.stack[this.stack.length-1];P.value=C.replace(/(\r?\n|\r)$/g,"")}function S(C){const P=this.resume(),V=this.stack[this.stack.length-1];V.label=P,V.identifier=ve(this.sliceSerialize(C)).toLowerCase()}function E(){const C=this.resume(),P=this.stack[this.stack.length-1];P.title=C}function N(){const C=this.resume(),P=this.stack[this.stack.length-1];P.url=C}function A(C){const P=this.stack[this.stack.length-1];if(!P.depth){const V=this.sliceSerialize(C).length;P.depth=V}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function D(C){const P=this.stack[this.stack.length-1];P.depth=this.sliceSerialize(C).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function F(C){const V=this.stack[this.stack.length-1].children;let q=V[V.length-1];(!q||q.type!=="text")&&(q=_i(),q.position={start:_e(C.start),end:void 0},V.push(q)),this.stack.push(q)}function x(C){const P=this.stack.pop();P.value+=this.sliceSerialize(C),P.position.end=_e(C.end)}function T(C){const P=this.stack[this.stack.length-1];if(this.data.atHardBreak){const V=P.children[P.children.length-1];V.position.end=_e(C.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(P.type)&&(F.call(this,C),x.call(this,C))}function z(){this.data.atHardBreak=!0}function R(){const C=this.resume(),P=this.stack[this.stack.length-1];P.value=C}function L(){const C=this.resume(),P=this.stack[this.stack.length-1];P.value=C}function j(){const C=this.resume(),P=this.stack[this.stack.length-1];P.value=C}function G(){const C=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";C.type+="Reference",C.referenceType=P,delete C.url,delete C.title}else delete C.identifier,delete C.label;this.data.referenceType=void 0}function ne(){const C=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";C.type+="Reference",C.referenceType=P,delete C.url,delete C.title}else delete C.identifier,delete C.label;this.data.referenceType=void 0}function re(C){const P=this.sliceSerialize(C),V=this.stack[this.stack.length-2];V.label=Is(P),V.identifier=ve(P).toLowerCase()}function B(){const C=this.stack[this.stack.length-1],P=this.resume(),V=this.stack[this.stack.length-1];if(this.data.inReference=!0,V.type==="link"){const q=C.children;V.children=q}else V.alt=P}function d(){const C=this.resume(),P=this.stack[this.stack.length-1];P.url=C}function Z(){const C=this.resume(),P=this.stack[this.stack.length-1];P.title=C}function se(){this.data.inReference=void 0}function g(){this.data.referenceType="collapsed"}function ce(C){const P=this.resume(),V=this.stack[this.stack.length-1];V.label=P,V.identifier=ve(this.sliceSerialize(C)).toLowerCase(),this.data.referenceType="full"}function be(C){this.data.characterReferenceType=C.type}function $(C){const P=this.sliceSerialize(C),V=this.data.characterReferenceType;let q;V?(q=Nr(P,V==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):q=cn(P);const X=this.stack[this.stack.length-1];X.value+=q}function ee(C){const P=this.stack.pop();P.position.end=_e(C.end)}function K(C){x.call(this,C);const P=this.stack[this.stack.length-1];P.url=this.sliceSerialize(C)}function le(C){x.call(this,C);const P=this.stack[this.stack.length-1];P.url="mailto:"+this.sliceSerialize(C)}function te(){return{type:"blockquote",children:[]}}function Q(){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 Ge(){return{type:"emphasis",children:[]}}function ut(){return{type:"heading",depth:0,children:[]}}function Me(){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(C){return{type:"list",ordered:C.type==="listOrdered",start:null,spread:C._spread,children:[]}}function Ti(C){return{type:"listItem",spread:C._spread,checked:null,children:[]}}function Ii(){return{type:"paragraph",children:[]}}function Ai(){return{type:"strong",children:[]}}function _i(){return{type:"text",value:""}}function Ni(){return{type:"thematicBreak"}}}function _e(e){return{line:e.line,column:e.column,offset:e.offset}}function Vr(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Vr(e,r):Ps(e,r)}}function Ps(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 $n(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 _s(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 zs(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
4
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join("")}function Cs(e){const r={constructs:Nr([bs,...(e||{}).extensions||[]]),content:i(Fo),defined:[],document:i(Bo),flow:i(is),lazy:{},string:i(ss),text:i(ls)};return r;function i(a){return o;function o(s){return ks(r,a,s)}}}function Ss(e){for(;!jr(e););return e}const qn=/[\0\t\n\r]/g;function Es(){let e=1,t="",n=!0,r;return i;function i(a,o,s){const l=[];let u,h,c,p,f;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),c=0,t="",n&&(a.charCodeAt(0)===65279&&c++,n=void 0);c<a.length;){if(qn.lastIndex=c,u=qn.exec(a),p=u&&u.index!==void 0?u.index:a.length,f=a.charCodeAt(p),!u){t=a.slice(c);break}if(f===10&&c===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),c<p&&(l.push(a.slice(c,p)),e+=p-c),f){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=p+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Ts=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function As(e){return e.replace(Ts,Is)}function Is(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return Dr(n.slice(a?2:1),a?16:10)}return cn(n)||e}const Br={}.hasOwnProperty;function Ns(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Ds(n)(Ss(Cs(n).document().write(Es()(e,t,!0))))}function Ds(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(vn),autolinkProtocol:_,autolinkEmail:_,atxHeading:a(ut),blockQuote:a(te),characterEscape:_,characterReference:_,codeFenced:a(Q),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(Q,o),codeText:a(ie,o),codeTextData:_,data:_,codeFlowValue:_,definition:a(Ee),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ze),hardBreakEscape:a(Fe),hardBreakTrailing:a(Fe),htmlFlow:a(ct,o),htmlFlowData:_,htmlText:a(ct,o),htmlTextData:_,image:a(Ei),label:o,link:a(vn),listItem:a(Ti),listItemValue:p,listOrdered:a(Cn,c),listUnordered:a(Cn),paragraph:a(Ai),reference:g,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ut),strong:a(Ii),thematicBreak:a(Di)},exit:{atxHeading:l(),atxHeadingSequence:I,autolink:l(),autolinkEmail:le,autolinkProtocol:Z,blockQuote:l(),characterEscapeValue:x,characterReferenceMarkerHexadecimal:ke,characterReferenceMarkerNumeric:ke,characterReferenceValue:W,characterReference:ee,codeFenced:l(v),codeFencedFence:w,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:x,codeIndented:l(b),codeText:l(M),codeTextData:x,data:x,definition:l(),definitionDestinationString:D,definitionLabelString:S,definitionTitleString:E,emphasis:l(),hardBreakEscape:l(j),hardBreakTrailing:l(j),htmlFlow:l(R),htmlFlowData:x,htmlText:l(z),htmlTextData:x,image:l(ne),label:B,labelText:re,lineEnding:T,link:l(Y),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ce,resourceDestinationString:d,resourceTitleString:$,resource:se,setextHeading:l(F),setextHeadingLineSequence:L,setextHeadingText:k,strong:l(),thematicBreak:l()}};Hr(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(C){let P={type:"root",children:[]};const H={stack:[P],tokenStack:[],config:t,enter:s,exit:u,buffer:o,resume:h,data:n},V=[];let J=-1;for(;++J<C.length;)if(C[J][1].type==="listOrdered"||C[J][1].type==="listUnordered")if(C[J][0]==="enter")V.push(J);else{const we=V.pop();J=i(C,we,J)}for(J=-1;++J<C.length;){const we=t[C[J][0]];Br.call(we,C[J][1].type)&&we[C[J][1].type].call(Object.assign({sliceSerialize:C[J][2].sliceSerialize},H),C[J][1])}if(H.tokenStack.length>0){const we=H.tokenStack[H.tokenStack.length-1];(we[1]||Wn).call(H,void 0,we[0])}for(P.position={start:Ne(C.length>0?C[0][1].start:{line:1,column:1,offset:0}),end:Ne(C.length>0?C[C.length-2][1].end:{line:1,column:1,offset:0})},J=-1;++J<t.transforms.length;)P=t.transforms[J](P)||P;return P}function i(C,P,H){let V=P-1,J=-1,we=!1,je,Te,Ze,Qe;for(;++V<=H;){const ge=C[V];switch(ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ge[0]==="enter"?J++:J--,Qe=void 0;break}case"lineEndingBlank":{ge[0]==="enter"&&(je&&!Qe&&!J&&!Ze&&(Ze=V),Qe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qe=void 0}if(!J&&ge[0]==="enter"&&ge[1].type==="listItemPrefix"||J===-1&&ge[0]==="exit"&&(ge[1].type==="listUnordered"||ge[1].type==="listOrdered")){if(je){let _e=V;for(Te=void 0;_e--;){const Ae=C[_e];if(Ae[1].type==="lineEnding"||Ae[1].type==="lineEndingBlank"){if(Ae[0]==="exit")continue;Te&&(C[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?C[Te][1].start:ge[1].end),C.splice(Te||V,0,["exit",je,ge[2]]),V++,H++}if(ge[1].type==="listItemPrefix"){const _e={type:"listItem",_spread:!1,start:Object.assign({},ge[1].start),end:void 0};je=_e,C.splice(V,0,["enter",_e,ge[2]]),V++,H++,Ze=void 0,Qe=!0}}}return C[P][1]._spread=we,H}function a(C,P){return H;function H(V){s.call(this,C(V),V),P&&P.call(this,V)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(C,P,H){this.stack[this.stack.length-1].children.push(C),this.stack.push(C),this.tokenStack.push([P,H||void 0]),C.position={start:Ne(P.start),end:void 0}}function l(C){return P;function P(H){C&&C.call(this,H),u.call(this,H)}}function u(C,P){const H=this.stack.pop(),V=this.tokenStack.pop();if(V)V[0].type!==C.type&&(P?P.call(this,C,V[0]):(V[1]||Wn).call(this,C,V[0]));else throw new Error("Cannot close `"+C.type+"` ("+et({start:C.start,end:C.end})+"): it’s not open");H.position.end=Ne(C.end)}function h(){return un(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function p(C){if(this.data.expectingFirstListItemValue){const P=this.stack[this.stack.length-2];P.start=Number.parseInt(this.sliceSerialize(C),10),this.data.expectingFirstListItemValue=void 0}}function f(){const C=this.resume(),P=this.stack[this.stack.length-1];P.lang=C}function m(){const C=this.resume(),P=this.stack[this.stack.length-1];P.meta=C}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const C=this.resume(),P=this.stack[this.stack.length-1];P.value=C.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const C=this.resume(),P=this.stack[this.stack.length-1];P.value=C.replace(/(\r?\n|\r)$/g,"")}function S(C){const P=this.resume(),H=this.stack[this.stack.length-1];H.label=P,H.identifier=ve(this.sliceSerialize(C)).toLowerCase()}function E(){const C=this.resume(),P=this.stack[this.stack.length-1];P.title=C}function D(){const C=this.resume(),P=this.stack[this.stack.length-1];P.url=C}function I(C){const P=this.stack[this.stack.length-1];if(!P.depth){const H=this.sliceSerialize(C).length;P.depth=H}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function L(C){const P=this.stack[this.stack.length-1];P.depth=this.sliceSerialize(C).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function _(C){const H=this.stack[this.stack.length-1].children;let V=H[H.length-1];(!V||V.type!=="text")&&(V=Ni(),V.position={start:Ne(C.start),end:void 0},H.push(V)),this.stack.push(V)}function x(C){const P=this.stack.pop();P.value+=this.sliceSerialize(C),P.position.end=Ne(C.end)}function T(C){const P=this.stack[this.stack.length-1];if(this.data.atHardBreak){const H=P.children[P.children.length-1];H.position.end=Ne(C.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(P.type)&&(_.call(this,C),x.call(this,C))}function j(){this.data.atHardBreak=!0}function R(){const C=this.resume(),P=this.stack[this.stack.length-1];P.value=C}function z(){const C=this.resume(),P=this.stack[this.stack.length-1];P.value=C}function M(){const C=this.resume(),P=this.stack[this.stack.length-1];P.value=C}function Y(){const C=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";C.type+="Reference",C.referenceType=P,delete C.url,delete C.title}else delete C.identifier,delete C.label;this.data.referenceType=void 0}function ne(){const C=this.stack[this.stack.length-1];if(this.data.inReference){const P=this.data.referenceType||"shortcut";C.type+="Reference",C.referenceType=P,delete C.url,delete C.title}else delete C.identifier,delete C.label;this.data.referenceType=void 0}function re(C){const P=this.sliceSerialize(C),H=this.stack[this.stack.length-2];H.label=As(P),H.identifier=ve(P).toLowerCase()}function B(){const C=this.stack[this.stack.length-1],P=this.resume(),H=this.stack[this.stack.length-1];if(this.data.inReference=!0,H.type==="link"){const V=C.children;H.children=V}else H.alt=P}function d(){const C=this.resume(),P=this.stack[this.stack.length-1];P.url=C}function $(){const C=this.resume(),P=this.stack[this.stack.length-1];P.title=C}function se(){this.data.inReference=void 0}function g(){this.data.referenceType="collapsed"}function ce(C){const P=this.resume(),H=this.stack[this.stack.length-1];H.label=P,H.identifier=ve(this.sliceSerialize(C)).toLowerCase(),this.data.referenceType="full"}function ke(C){this.data.characterReferenceType=C.type}function W(C){const P=this.sliceSerialize(C),H=this.data.characterReferenceType;let V;H?(V=Dr(P,H==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):V=cn(P);const J=this.stack[this.stack.length-1];J.value+=V}function ee(C){const P=this.stack.pop();P.position.end=Ne(C.end)}function Z(C){x.call(this,C);const P=this.stack[this.stack.length-1];P.url=this.sliceSerialize(C)}function le(C){x.call(this,C);const P=this.stack[this.stack.length-1];P.url="mailto:"+this.sliceSerialize(C)}function te(){return{type:"blockquote",children:[]}}function Q(){return{type:"code",lang:null,meta:null,value:""}}function ie(){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 Fe(){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(C){return{type:"list",ordered:C.type==="listOrdered",start:null,spread:C._spread,children:[]}}function Ti(C){return{type:"listItem",spread:C._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 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):Ps(e,r)}}function Ps(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 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 Ls(e){const t=this;t.parser=n;function n(r){return Ns(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function zs(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 js(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
5
5
|
`}]}function Rs(e,t){const n=t.value?t.value+`
|
|
6
|
-
`:"",r={};t.lang&&(r.className=["language-"+t.lang]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function
|
|
6
|
+
`:"",r={};t.lang&&(r.className=["language-"+t.lang]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Ms(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Os(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fs(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Ye(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+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(o)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function _s(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 Bs(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),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function Hs(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 a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Us(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 qs(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 Ws(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 a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Vs(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 Gs(e,t,n){const r=e.all(t),i=n?Ys(n):qr(t),a={},o=[];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:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<r.length;){const h=r[s];(i||s!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
|
|
7
7
|
`}),h.type==="element"&&h.tagName==="p"&&!i?o.push(...h.children):o.push(h)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
8
|
-
`});const u={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,u),e.applyData(t,u)}function
|
|
8
|
+
`});const u={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,u),e.applyData(t,u)}function Ys(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 Zs(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 o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Qs(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Js(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Xs(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ks(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=on(t.children[1]),l=vr(t.children[t.children.length-1]);s&&l&&(o.position={start:s,end:l}),i.push(o)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function $s(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,s=o?o.length:t.children.length;let l=-1;const u=[];for(;++l<s;){const c=t.children[l],p={},f=o?o[l]:void 0;f&&(p.align=f);let m={type:"element",tagName:a,properties:p,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 el(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 tl(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const a=[];for(;r;)a.push(Yn(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Yn(t.slice(i),i>0,!1)),a.join("")}function Yn(e,t,n){let r=0,i=e.length;if(t){let a=e.codePointAt(r);for(;a===Vn||a===Gn;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(i-1);for(;a===Vn||a===Gn;)i--,a=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function nl(e,t){const n={type:"text",value:tl(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function rl(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const il={blockquote:zs,break:js,code:Rs,delete:Ms,emphasis:Os,footnoteReference:Fs,heading:_s,html:Bs,imageReference:Hs,image:Us,inlineCode:qs,linkReference:Ws,link:Vs,listItem:Gs,list:Zs,paragraph:Qs,root:Js,strong:Xs,table:Ks,tableCell:el,tableRow:$s,text:nl,thematicBreak:rl,toml:ht,yaml:ht,definition:ht,footnoteDefinition:ht};function ht(){}const Wr=-1,St=0,nt=1,bt=2,fn=3,pn=4,dn=5,mn=6,Vr=7,Gr=8,Zn=typeof self=="object"?self:globalThis,ol=(e,t)=>{const n=(i,a)=>(e.set(a,i),i),r=i=>{if(e.has(i))return e.get(i);const[a,o]=t[i];switch(a){case St:case Wr:return n(o,i);case nt:{const s=n([],i);for(const l of o)s.push(r(l));return s}case bt:{const s=n({},i);for(const[l,u]of o)s[r(l)]=r(u);return s}case fn:return n(new Date(o),i);case pn:{const{source:s,flags:l}=o;return n(new RegExp(s,l),i)}case dn:{const s=n(new Map,i);for(const[l,u]of o)s.set(r(l),r(u));return s}case mn:{const s=n(new Set,i);for(const l of o)s.add(r(l));return s}case Vr:{const{name:s,message:l}=o;return n(new Zn[s](l),i)}case Gr:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:s}=new Uint8Array(o);return n(new DataView(s),o)}}return n(new Zn[a](o),i)};return r},Qn=e=>ol(new Map,e)(0),He="",{toString:al}={},{keys:sl}=Object,$e=e=>{const t=typeof e;if(t!=="object"||!e)return[St,t];const n=al.call(e).slice(8,-1);switch(n){case"Array":return[nt,He];case"Object":return[bt,He];case"Date":return[fn,He];case"RegExp":return[pn,He];case"Map":return[dn,He];case"Set":return[mn,He];case"DataView":return[nt,n]}return n.includes("Array")?[nt,n]:n.includes("Error")?[Vr,n]:[bt,n]},ft=([e,t])=>e===St&&(t==="function"||t==="symbol"),ll=(e,t,n,r)=>{const i=(o,s)=>{const l=r.push(o)-1;return n.set(s,l),l},a=o=>{if(n.has(o))return n.get(o);let[s,l]=$e(o);switch(s){case St:{let h=o;switch(l){case"bigint":s=Gr,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);h=null;break;case"undefined":return i([Wr],o)}return i([s,h],o)}case nt:{if(l){let p=o;return l==="DataView"?p=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(o)),i([l,[...p]],o)}const h=[],c=i([s,h],o);for(const p of o)h.push(a(p));return c}case bt:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(t&&"toJSON"in o)return a(o.toJSON());const h=[],c=i([s,h],o);for(const p of sl(o))(e||!ft($e(o[p])))&&h.push([a(p),a(o[p])]);return c}case fn:return i([s,o.toISOString()],o);case pn:{const{source:h,flags:c}=o;return i([s,{source:h,flags:c}],o)}case dn:{const h=[],c=i([s,h],o);for(const[p,f]of o)(e||!(ft($e(p))||ft($e(f))))&&h.push([a(p),a(f)]);return c}case mn:{const h=[],c=i([s,h],o);for(const p of o)(e||!ft($e(p)))&&h.push(a(p));return c}}const{message:u}=o;return i([s,{name:l,message:u}],o)};return a},Jn=(e,{json:t,lossy:n}={})=>{const r=[];return ll(!(t||n),!!t,new Map,r)(e),r},kt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Qn(Jn(e,t)):structuredClone(e):(e,t)=>Qn(Jn(e,t));function ul(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 cl(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function hl(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ul,r=e.options.footnoteBackLabel||cl,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=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(),p=Ye(c.toLowerCase());let f=0;const m=[],w=e.footnoteCounts.get(c);for(;w!==void 0&&++f<=w;){m.length>0&&m.push({type:"text",value:" "});let S=typeof n=="string"?n:n(l,f);typeof S=="string"&&(S={type:"text",value:S}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,f),className:["data-footnote-backref"]},children:Array.isArray(S)?S:[S]})}const v=h[h.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const S=v.children[v.children.length-1];S&&S.type==="text"?S.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-"+p},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:a,properties:{...kt(o),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 ml;if(typeof e=="function")return Tt(e);if(typeof e=="object")return Array.isArray(e)?
|
|
10
|
+
`}]}}const Et=(function(e){if(e==null)return ml;if(typeof e=="function")return Tt(e);if(typeof e=="object")return Array.isArray(e)?fl(e):pl(e);if(typeof e=="string")return dl(e);throw new Error("Expected function, string, or object as test")});function fl(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Et(e[n]);return Tt(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function pl(e){const t=e;return Tt(n);function n(r){const i=r;let a;for(a in e)if(i[a]!==t[a])return!1;return!0}}function dl(e){return Tt(t);function t(n){return n&&n.type===e}}function Tt(e){return t;function t(n,r,i){return!!(gl(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function ml(){return!0}function gl(e){return e!==null&&typeof e=="object"&&"type"in e}const Yr=[],yl=!0,Xt=!1,xl="skip";function Zr(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const a=Et(i),o=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 f=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=Yr,m,w,v;if((!t||a(l,u,h[h.length-1]||void 0))&&(f=bl(n(l,h)),f[0]===Xt))return f;if("children"in l&&l.children){const b=l;if(b.children&&f[0]!==xl)for(w=(r?b.children.length:-1)+o,v=h.concat(b);w>-1&&w<b.children.length;){const S=b.children[w];if(m=s(S,w,v)(),m[0]===Xt)return m;w=typeof m[1]=="number"?m[1]:w+o}}return f}}}function bl(e){return Array.isArray(e)?e:typeof e=="number"?[yl,e]:e==null?Yr:[e]}function gn(e,t,n,r){let i,a,o;typeof t=="function"&&typeof n!="function"?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Zr(e,a,s,i);function s(l,u){const h=u[u.length-1],c=h?h.children.indexOf(l):void 0;return o(l,c,h)}}const Kt={}.hasOwnProperty,kl={};function wl(e,t){const n=t||kl,r=new Map,i=new Map,a=new Map,o={...il,...n.handlers},s={all:u,applyData:Cl,definitionById:r,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:o,one:l,options:n,patch:vl,wrap:El};return gn(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const c=h.type==="definition"?r:i,p=String(h.identifier).toUpperCase();c.has(p)||c.set(p,h)}}),s;function l(h,c){const p=h.type,f=s.handlers[p];if(Kt.call(s.handlers,p)&&f)return f(s,h,c);if(s.options.passThrough&&s.options.passThrough.includes(p)){if("children"in h){const{children:w,...v}=h,b=kt(v);return b.children=s.all(h),b}return kt(h)}return(s.options.unknownHandler||Sl)(s,h,c)}function u(h){const c=[];if("children"in h){const p=h.children;let f=-1;for(;++f<p.length;){const m=s.one(p[f],h);if(m){if(f&&p[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Xn(m.value)),!Array.isArray(m)&&m.type==="element")){const w=m.children[0];w&&w.type==="text"&&(w.value=Xn(w.value))}Array.isArray(m)?c.push(...m):c.push(m)}}}return c}}function vl(e,t){e.position&&(t.position=uo(e))}function Cl(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&a&&Object.assign(n.properties,kt(a)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function Sl(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 El(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
|
|
14
|
-
`},i),a}function Tl(e,t){return e&&"run"in e?async function(n,r){const i=Qn(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Qn(n,{file:r,...e||t})}}function Zn(e){if(e)throw e}var Dt,er;function Il(){if(er)return Dt;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]"},a=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)},o=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 Dt=function l(){var u,h,c,f,p,m,w=arguments[0],v=1,k=arguments.length,S=!1;for(typeof w=="boolean"&&(S=w,w=arguments[1]||{},v=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});v<k;++v)if(u=arguments[v],u!=null)for(h in u)c=s(w,h),f=s(u,h),w!==f&&(S&&f&&(a(f)||(p=i(f)))?(p?(p=!1,m=c&&i(c)?c:[]):m=c&&a(c)?c:{},o(w,{name:h,newValue:l(S,m,f)})):typeof f<"u"&&o(w,{name:h,newValue:f}));return w},Dt}var Al=Il();const Lt=wr(Al);function Zt(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 _l(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...i);function s(l,...u){const h=e[++a];let c=-1;if(l){o(l);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,h?Nl(h,s)(...u):o(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 Nl(e,t){let n;return r;function r(...o){const s=e.length>o.length;let l;s&&o.push(i);try{l=e.apply(this,o)}catch(u){const h=u;if(s&&n)throw h;return i(h)}s||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(o,...s){n||(n=!0,t(o,...s))}function a(o){i(null,o)}}const Ce={basename:Pl,dirname:Dl,extname:Ll,join:zl,sep:"/"};function Pl(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,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o: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,a=0,o;for(;t--;){const s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function zl(...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?".":Rl(n)}function Rl(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,a=0,o=-1,s,l;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else{if(s===47)break;s=47}if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===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=o,a=0;continue}}else if(n.length>0){n="",r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-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:Ol};function Ol(){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 Fl(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 Bl(e)}function Bl(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 Xr{constructor(t){let n;t?en(t)?n={path:t}:typeof t=="string"||Vl(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 a=zt[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}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){jt(t,"basename"),Rt(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(Rt(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=Fl(t)),jt(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){jt(t,"stem"),Rt(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 pe(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 Rt(e,t){if(e&&e.includes(Ce.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ce.sep+"`")}function jt(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 Vl(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ul=(function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),Hl={}.hasOwnProperty;class yn extends Ul{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=_l()}copy(){const t=new yn;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Lt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ft("data",this.frozen),this.namespace[t]=n,this):Hl.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ft("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 Mt("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Mt("process",this.parser||this.Parser),Ot("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,o){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?o(h):a?a(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Mt("processSync",this.parser||this.Parser),Ot("processSync",this.compiler||this.Compiler),this.process(t,i),rr("processSync","process",n),r;function i(a,o){n=!0,Zn(a),r=o}}run(t,n,r){nr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(o,s){const l=ft(n);i.run(t,l,u);function u(h,c,f){const p=c||t;h?s(h):o?o(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),rr("runSync","run",r),i;function a(o,s){Zn(o),i=s,r=!0}}stringify(t,n){this.freeze();const r=ft(n),i=this.compiler||this.Compiler;return Ot("stringify",i),nr(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Ft("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?s(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[h,...c]=u;l(h,c)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(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=Lt(!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];a(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 w=r[f][1];Zt(w)&&Zt(p)&&(p=Lt(!0,w,p)),r[f]=[u,p,...m]}}}}const $l=new yn().freeze();function Mt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ot(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ft(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(!Zt(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 Xr(e)}function ql(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Wl(e){return typeof e=="string"||Gl(e)}function Gl(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Kl="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ir=[],or={allowDangerousHtml:!0},Xl=/^(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 Jl(e){const t=Ql(e),n=Zl(e);return eu(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 $l().use(Ds).use(n).use(Tl,r).use(t)}function Zl(e){const t=e.children||"",n=new Xr;return typeof t=="string"&&(n.value=t),n}function eu(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||tu;for(const h of Yl)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+Kl+h.id,void 0);return gn(e,u),mo(e,{Fragment:y.Fragment,components:i,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function u(h,c,f){if(h.type==="raw"&&f&&typeof c=="number")return o?f.children.splice(c,1):f.children[c]={type:"text",value:h.value},c;if(h.type==="element"){let p;for(p in _t)if(Object.hasOwn(_t,p)&&Object.hasOwn(h.properties,p)){const m=h.properties[p],w=_t[p];(w===null||w.includes(h.tagName))&&(h.properties[p]=l(String(m||""),p,h))}}if(h.type==="element"){let p=n?!n.includes(h.tagName):a?a.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 tu(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||Xl.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 nu(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ru(e,t,n){const i=Et((n||{}).ignore||[]),a=iu(t);let o=-1;for(;++o<a.length;)Kr(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=a[o][0],p=a[o][1];let m=0;const v=c.children.indexOf(u);let k=!1,S=[];f.lastIndex=0;let E=f.exec(u.value);for(;E;){const N=E.index,A={index:E.index,input:E.input,stack:[...h,u]};let b=p(...E,A);if(typeof b=="string"&&(b=b.length>0?{type:"text",value:b}:void 0),b===!1?f.lastIndex=N+1:(m!==N&&S.push({type:"text",value:u.value.slice(m,N)}),Array.isArray(b)?S.push(...b):b&&S.push(b),m=N+E[0].length,k=!0),!f.global)break;E=f.exec(u.value)}return k?(m<u.value.length&&S.push({type:"text",value:u.value.slice(m)}),c.children.splice(v,1,...S)):S=[u],v+S.length}}function iu(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([ou(i[0]),au(i[1])])}return t}function ou(e){return typeof e=="string"?new RegExp(nu(e),"g"):e}function au(e){return typeof e=="function"?e:function(){return e}}const Bt="phrasing",Vt=["autolink","link","image","label"];function su(){return{transforms:[du],enter:{literalAutolink:uu,literalAutolinkEmail:Ut,literalAutolinkHttp:Ut,literalAutolinkWww:Ut},exit:{literalAutolink:fu,literalAutolinkEmail:pu,literalAutolinkHttp:cu,literalAutolinkWww:hu}}}function lu(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Bt,notInConstruct:Vt},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Bt,notInConstruct:Vt},{character:":",before:"[ps]",after:"\\/",inConstruct:Bt,notInConstruct:Vt}]}}function uu(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ut(e){this.config.enter.autolinkProtocol.call(this,e)}function cu(e){this.config.exit.autolinkProtocol.call(this,e)}function hu(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 pu(e){this.config.exit.autolinkEmail.call(this,e)}function fu(e){this.exit(e)}function du(e){ru(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,mu],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),gu]],{ignore:["link","linkReference"]})}function mu(e,t,n,r,i){let a="";if(!Yr(i)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!yu(n)))return!1;const o=xu(n+r);if(!o[0])return!1;const s={type:"link",title:null,url:a+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[s,{type:"text",value:o[1]}]:s}function gu(e,t,n,r){return!Yr(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function yu(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 xu(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 a=ar(e,")");for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function Yr(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Re(n)||vt(n))&&(!t||n!==47)}Jr.peek=Iu;function ku(){this.buffer()}function bu(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function wu(){this.buffer()}function vu(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},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(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 Tu(e){this.exit(e)}function Iu(){return"["}function Jr(e,t,n,r){const i=n.createTracker(r);let a=i.move("[^");const o=n.enter("footnoteReference"),s=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]"),a}function Au(){return{enter:{gfmFootnoteCallString:ku,gfmFootnoteCall:bu,gfmFootnoteDefinitionLabelString:wu,gfmFootnoteDefinition:vu},exit:{gfmFootnoteCallString:Cu,gfmFootnoteCall:Su,gfmFootnoteDefinitionLabelString:Eu,gfmFootnoteDefinition:Tu}}}function _u(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Jr},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,a,o){const s=a.createTracker(o);let l=s.move("[^");const u=a.enter("footnoteDefinition"),h=a.enter("label");return l+=s.move(a.safe(a.associationId(r),{before:l,after:"]"})),h(),l+=s.move("]:"),r.children&&r.children.length>0&&(s.shift(4),l+=s.move((t?`
|
|
15
|
-
`:" ")+a.indentLines(a.containerFlow(r,s.current()),t?
|
|
16
|
-
`)}function
|
|
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=wl(e,t),r=n.one(e,void 0),i=hl(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&a.children.push({type:"text",value:`
|
|
14
|
+
`},i),a}function Tl(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 Lt,er;function Al(){if(er)return Lt;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]"},a=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 p;for(p in u);return typeof p>"u"||e.call(u,p)},o=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 Lt=function l(){var u,h,c,p,f,m,w=arguments[0],v=1,b=arguments.length,S=!1;for(typeof w=="boolean"&&(S=w,w=arguments[1]||{},v=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});v<b;++v)if(u=arguments[v],u!=null)for(h in u)c=s(w,h),p=s(u,h),w!==p&&(S&&p&&(a(p)||(f=i(p)))?(f?(f=!1,m=c&&i(c)?c:[]):m=c&&a(c)?c:{},o(w,{name:h,newValue:l(S,m,p)})):typeof p<"u"&&o(w,{name:h,newValue:p}));return w},Lt}var Il=Al();const zt=wr(Il);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 Nl(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...i);function s(l,...u){const h=e[++a];let c=-1;if(l){o(l);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,h?Dl(h,s)(...u):o(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 Dl(e,t){let n;return r;function r(...o){const s=e.length>o.length;let l;s&&o.push(i);try{l=e.apply(this,o)}catch(u){const h=u;if(s&&n)throw h;return i(h)}s||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(o,...s){n||(n=!0,t(o,...s))}function a(o){i(null,o)}}const Ce={basename:Pl,dirname:Ll,extname:zl,join:jl,sep:"/"};function Pl(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,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Ll(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 zl(e){lt(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){const s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function jl(...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?".":Rl(n)}function Rl(e){lt(e);const t=e.codePointAt(0)===47;let n=Ml(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Ml(e,t){let n="",r=0,i=-1,a=0,o=-1,s,l;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else{if(s===47)break;s=47}if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===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=o,a=0;continue}}else if(n.length>0){n="",r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function lt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Ol={cwd:Fl};function Fl(){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 _l(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 Bl(e)}function Bl(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 jt=["history","path","basename","stem","extname","dirname"];class Qr{constructor(t){let n;t?en(t)?n={path:t}:typeof t=="string"||Hl(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Ol.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<jt.length;){const a=jt[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)jt.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ce.basename(this.path):void 0}set basename(t){Mt(t,"basename"),Rt(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(Rt(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=_l(t)),Mt(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){Mt(t,"stem"),Rt(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 fe(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 Rt(e,t){if(e&&e.includes(Ce.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ce.sep+"`")}function Mt(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 Hl(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ul=(function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),ql={}.hasOwnProperty;class yn extends Ul{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=Nl()}copy(){const t=new yn;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(zt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(_t("data",this.frozen),this.namespace[t]=n,this):ql.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=pt(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(a,o){const s=pt(t),l=r.parse(s);r.run(l,s,function(h,c,p){if(h||!c||!p)return u(h);const f=c,m=r.stringify(f,p);Gl(m)?p.value=m:p.result=m,u(h,p)});function u(h,c){h||!c?o(h):a?a(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(a,o){n=!0,$n(a),r=o}}run(t,n,r){nr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(o,s){const l=pt(n);i.run(t,l,u);function u(h,c,p){const f=c||t;h?s(h):o?o(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),rr("runSync","run",r),i;function a(o,s){$n(o),i=s,r=!0}}stringify(t,n){this.freeze();const r=pt(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):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[h,...c]=u;l(h,c)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(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=zt(!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];a(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,h){let c=-1,p=-1;for(;++c<r.length;)if(r[c][0]===u){p=c;break}if(p===-1)r.push([u,...h]);else if(h.length>0){let[f,...m]=h;const w=r[p][1];$t(w)&&$t(f)&&(f=zt(!0,w,f)),r[p]=[u,f,...m]}}}}const Wl=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 pt(e){return Vl(e)?e:new Qr(e)}function Vl(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Gl(e){return typeof e=="string"||Yl(e)}function Yl(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Zl="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ir=[],or={allowDangerousHtml:!0},Ql=/^(https?|ircs?|mailto|xmpp)$/i,Jl=[{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 Xl(e){const t=Kl(e),n=$l(e);return eu(t.runSync(t.parse(n),n),e)}function Kl(e){const t=e.rehypePlugins||ir,n=e.remarkPlugins||ir,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...or}:or;return Wl().use(Ls).use(n).use(Tl,r).use(t)}function $l(e){const t=e.children||"",n=new Qr;return typeof t=="string"&&(n.value=t),n}function eu(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||tu;for(const h of Jl)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+Zl+h.id,void 0);return gn(e,u),mo(e,{Fragment:y.Fragment,components:i,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function u(h,c,p){if(h.type==="raw"&&p&&typeof c=="number")return o?p.children.splice(c,1):p.children[c]={type:"text",value:h.value},c;if(h.type==="element"){let f;for(f in Nt)if(Object.hasOwn(Nt,f)&&Object.hasOwn(h.properties,f)){const m=h.properties[f],w=Nt[f];(w===null||w.includes(h.tagName))&&(h.properties[f]=l(String(m||""),f,h))}}if(h.type==="element"){let f=n?!n.includes(h.tagName):a?a.includes(h.tagName):!1;if(!f&&r&&typeof c=="number"&&(f=!r(h,c,p)),f&&p&&typeof c=="number")return s&&h.children?p.children.splice(c,1,...h.children):p.children.splice(c,1),c}}}function tu(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||Ql.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 nu(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ru(e,t,n){const i=Et((n||{}).ignore||[]),a=iu(t);let o=-1;for(;++o<a.length;)Zr(e,"text",s);function s(u,h){let c=-1,p;for(;++c<h.length;){const f=h[c],m=p?p.children:void 0;if(i(f,m?m.indexOf(f):void 0,p))return;p=f}if(p)return l(u,h)}function l(u,h){const c=h[h.length-1],p=a[o][0],f=a[o][1];let m=0;const v=c.children.indexOf(u);let b=!1,S=[];p.lastIndex=0;let E=p.exec(u.value);for(;E;){const D=E.index,I={index:E.index,input:E.input,stack:[...h,u]};let k=f(...E,I);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?p.lastIndex=D+1:(m!==D&&S.push({type:"text",value:u.value.slice(m,D)}),Array.isArray(k)?S.push(...k):k&&S.push(k),m=D+E[0].length,b=!0),!p.global)break;E=p.exec(u.value)}return b?(m<u.value.length&&S.push({type:"text",value:u.value.slice(m)}),c.children.splice(v,1,...S)):S=[u],v+S.length}}function iu(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([ou(i[0]),au(i[1])])}return t}function ou(e){return typeof e=="string"?new RegExp(nu(e),"g"):e}function au(e){return typeof e=="function"?e:function(){return e}}const Bt="phrasing",Ht=["autolink","link","image","label"];function su(){return{transforms:[du],enter:{literalAutolink:uu,literalAutolinkEmail:Ut,literalAutolinkHttp:Ut,literalAutolinkWww:Ut},exit:{literalAutolink:pu,literalAutolinkEmail:fu,literalAutolinkHttp:cu,literalAutolinkWww:hu}}}function lu(){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 uu(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ut(e){this.config.enter.autolinkProtocol.call(this,e)}function cu(e){this.config.exit.autolinkProtocol.call(this,e)}function hu(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 fu(e){this.config.exit.autolinkEmail.call(this,e)}function pu(e){this.exit(e)}function du(e){ru(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,mu],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),gu]],{ignore:["link","linkReference"]})}function mu(e,t,n,r,i){let a="";if(!Jr(i)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!yu(n)))return!1;const o=xu(n+r);if(!o[0])return!1;const s={type:"link",title:null,url:a+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[s,{type:"text",value:o[1]}]:s}function gu(e,t,n,r){return!Jr(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function yu(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 xu(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 a=ar(e,")");for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function Jr(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Me(n)||vt(n))&&(!t||n!==47)}Xr.peek=Au;function bu(){this.buffer()}function ku(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function wu(){this.buffer()}function vu(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},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(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 Tu(e){this.exit(e)}function Au(){return"["}function Xr(e,t,n,r){const i=n.createTracker(r);let a=i.move("[^");const o=n.enter("footnoteReference"),s=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]"),a}function Iu(){return{enter:{gfmFootnoteCallString:bu,gfmFootnoteCall:ku,gfmFootnoteDefinitionLabelString:wu,gfmFootnoteDefinition:vu},exit:{gfmFootnoteCallString:Cu,gfmFootnoteCall:Su,gfmFootnoteDefinitionLabelString:Eu,gfmFootnoteDefinition:Tu}}}function Nu(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,a,o){const s=a.createTracker(o);let l=s.move("[^");const u=a.enter("footnoteDefinition"),h=a.enter("label");return l+=s.move(a.safe(a.associationId(r),{before:l,after:"]"})),h(),l+=s.move("]:"),r.children&&r.children.length>0&&(s.shift(4),l+=s.move((t?`
|
|
15
|
+
`:" ")+a.indentLines(a.containerFlow(r,s.current()),t?Kr:Du))),u(),l}}function Du(e,t,n){return t===0?e:Kr(e,t,n)}function Kr(e,t,n){return(n?"":" ")+e}const Pu=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];$r.peek=Mu;function Lu(){return{canContainEols:["delete"],enter:{strikethrough:ju},exit:{strikethrough:Ru}}}function zu(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Pu}],handlers:{delete:$r}}}function ju(e){this.enter({type:"delete",children:[]},e)}function Ru(e){this.exit(e)}function $r(e,t,n,r){const i=n.createTracker(r),a=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function Mu(){return"~"}function Ou(e){return e.length}function Fu(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Ou,a=[],o=[],s=[],l=[];let u=0,h=-1;for(;++h<e.length;){const w=[],v=[];let b=-1;for(e[h].length>u&&(u=e[h].length);++b<e[h].length;){const S=_u(e[h][b]);if(n.alignDelimiters!==!1){const E=i(S);v[b]=E,(l[b]===void 0||E>l[b])&&(l[b]=E)}w.push(S)}o[h]=w,s[h]=v}let c=-1;if(typeof r=="object"&&"length"in r)for(;++c<u;)a[c]=sr(r[c]);else{const w=sr(r);for(;++c<u;)a[c]=w}c=-1;const p=[],f=[];for(;++c<u;){const w=a[c];let v="",b="";w===99?(v=":",b=":"):w===108?v=":":w===114&&(b=":");let S=n.alignDelimiters===!1?1:Math.max(1,l[c]-v.length-b.length);const E=v+"-".repeat(S)+b;n.alignDelimiters!==!1&&(S=v.length+S+b.length,S>l[c]&&(l[c]=S),f[c]=S),p[c]=E}o.splice(1,0,p),s.splice(1,0,f),h=-1;const m=[];for(;++h<o.length;){const w=o[h],v=s[h];c=-1;const b=[];for(;++c<u;){const S=w[c]||"";let E="",D="";if(n.alignDelimiters!==!1){const I=l[c]-(v[c]||0),k=a[c];k===114?E=" ".repeat(I):k===99?I%2?(E=" ".repeat(I/2+.5),D=" ".repeat(I/2-.5)):(E=" ".repeat(I/2),D=E):D=" ".repeat(I)}n.delimiterStart!==!1&&!c&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&S==="")&&(n.delimiterStart!==!1||c)&&b.push(" "),n.alignDelimiters!==!1&&b.push(E),b.push(S),n.alignDelimiters!==!1&&b.push(D),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 _u(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 Bu(e,t,n,r){const i=n.enter("blockquote"),a=n.createTracker(r);a.move("> "),a.shift(2);const o=n.indentLines(n.containerFlow(e,a.current()),Hu);return i(),o}function Hu(e,t,n){return">"+(n?"":" ")+e}function Uu(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
17
|
`&&Uu(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
18
|
-
`}function
|
|
18
|
+
`}function qu(e,t){const n=String(e);let r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function Wu(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 Vu(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 Gu(e,t,n,r){const i=Vu(n),a=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(Wu(e,n)){const c=n.enter("codeIndented"),p=n.indentLines(a,Yu);return c(),p}const s=n.createTracker(r),l=i.repeat(Math.max(qu(a,i)+1,3)),u=n.enter("codeFenced");let h=s.move(l);if(e.lang){const c=n.enter(`codeFencedLang${o}`);h+=s.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...s.current()})),c()}if(e.lang&&e.meta){const c=n.enter(`codeFencedMeta${o}`);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
|
`),a&&(h+=s.move(a+`
|
|
21
|
-
`)),h+=s.move(l),u(),h}function
|
|
22
|
-
`,...l.current()}))),s(),e.title&&(s=n.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),o(),u}function
|
|
21
|
+
`)),h+=s.move(l),u(),h}function Yu(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 Zu(e,t,n,r){const i=xn(n),a=i==='"'?"Quote":"Apostrophe",o=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${a}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),o(),u}function Qu(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=Ju;function ei(e,t,n,r){const i=Qu(n),a=n.enter("emphasis"),o=n.createTracker(r),s=o.move(i);let l=o.move(n.containerPhrasing(e,{after:i,before:s,...o.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),p=wt(r.after.charCodeAt(0),c,i);p.inside&&(l=l.slice(0,-1)+it(c));const f=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},s+l+f}function Ju(e,t,n){return n.options.emphasis||"*"}function Xu(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 Ku(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(Xu(e,n)){const h=n.enter("headingSetext"),c=n.enter("phrasing"),p=n.containerPhrasing(e,{...a.current(),before:`
|
|
23
23
|
`,after:`
|
|
24
|
-
`});return c(),h(),
|
|
25
|
-
`+(i===1?"=":"-").repeat(
|
|
24
|
+
`});return c(),h(),p+`
|
|
25
|
+
`+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
|
|
26
26
|
`))+1))}const o="#".repeat(i),s=n.enter("headingAtx"),l=n.enter("phrasing");a.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
27
|
-
`,...a.current()});return/^[\t ]/.test(u)&&(u=it(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),s(),u}ti.peek
|
|
28
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:
|
|
29
|
-
`))}function l(p,m,w,v){const k=w.enter("tableCell"),S=w.enter("phrasing"),E=w.containerPhrasing(p,{...v,before:a,after:a});return S(),k(),E}function u(p,m){return Ou(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function h(p,m,w){const v=p.children;let k=-1;const S=[],E=m.enter("table");for(;++k<v.length;)S[k]=c(v[k],m,w);return E(),S}function c(p,m,w){const v=p.children;let k=-1;const S=[],E=m.enter("tableRow");for(;++k<v.length;)S[k]=l(v[k],p,m,w);return E(),S}function f(p,m,w){let v=ci.inlineCode(p,m,w);return w.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function Ec(){return{exit:{taskListCheckValueChecked:hr,taskListCheckValueUnchecked:hr,paragraph:Ic}}}function Tc(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Ac}}}function hr(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Ic(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 a=-1,o;for(;++a<i.length;){const s=i[a];if(s.type==="paragraph"){o=s;break}}o===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 Ac(e,t,n,r){const i=e.children[0],a=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);a&&s.move(o);let l=ci.listItem(e,t,n,{...r,...s.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(h){return h+o}}function _c(){return[su(),Au(),Du(),xc(),Ec()]}function Nc(e){return{extensions:[lu(),_u(e),Lu(),Sc(e),Tc()]}}const Pc={tokenize:Mc,partial:!0},hi={tokenize:Oc,partial:!0},pi={tokenize:Fc,partial:!0},fi={tokenize:Bc,partial:!0},Dc={tokenize:Vc,partial:!0},di={name:"wwwAutolink",tokenize:Rc,previous:gi},mi={name:"protocolAutolink",tokenize:jc,previous:yi},Ae={name:"emailAutolink",tokenize:zc,previous:xi},Se={};function Lc(){return{text:Se}}let ze=48;for(;ze<123;)Se[ze]=Ae,ze++,ze===58?ze=65:ze===91&&(ze=97);Se[43]=Ae;Se[45]=Ae;Se[46]=Ae;Se[95]=Ae;Se[72]=[Ae,mi];Se[104]=[Ae,mi];Se[87]=[Ae,di];Se[119]=[Ae,di];function zc(e,t,n){const r=this;let i,a;return o;function o(c){return!tn(c)||!xi.call(r,r.previous)||bn(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||he(c)?(a=!0,e.consume(c),l):h(c)}function u(c){return e.consume(c),i=!0,l}function h(c){return a&&i&&fe(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function Rc(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!gi.call(r,r.previous)||bn(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Pc,e.attempt(hi,e.attempt(pi,a),n),n)(o))}function a(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function jc(e,t,n){const r=this;let i="",a=!1;return o;function o(c){return(c===72||c===104)&&yi.call(r,r.previous)&&!bn(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),a?u:(a=!0,l)):n(c)}function u(c){return c===null||xt(c)||Y(c)||Re(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 Mc(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),a):n(o)}function a(o){return o===null?n(o):t(o)}}function Oc(e,t,n){let r,i,a;return o;function o(u){return u===46||u===95?e.check(fi,l,s)(u):u===null||Y(u)||Re(u)||u!==45&&vt(u)?l(u):(a=!0,e.consume(u),o)}function s(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),o}function l(u){return i||r||!a?n(u):t(u)}}function Fc(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(fi,t,a)(o):o===null||Y(o)||Re(o)?t(o):(e.consume(o),i)}function a(o){return o===41&&r++,e.consume(o),i}}function Bc(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),a):s===93?(e.consume(s),i):s===60||s===null||Y(s)||Re(s)?t(s):n(s)}function i(s){return s===null||s===40||s===91||Y(s)||Re(s)?t(s):r(s)}function a(s){return fe(s)?o(s):n(s)}function o(s){return s===59?(e.consume(s),r):fe(s)?(e.consume(s),o):n(s)}}function Vc(e,t,n){return r;function r(a){return e.consume(a),i}function i(a){return he(a)?n(a):t(a)}}function gi(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Y(e)}function yi(e){return!fe(e)}function xi(e){return!(e===47||tn(e))}function tn(e){return e===43||e===45||e===46||e===95||he(e)}function bn(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 Uc={tokenize:Yc,partial:!0};function Hc(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Gc,continuation:{tokenize:Kc},exit:Xc}},text:{91:{name:"gfmFootnoteCall",tokenize:Wc},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:$c,resolveTo:qc}}}}function $c(e,t,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=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(!o||!o._balanced)return n(l);const u=ve(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!a.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 a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,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 a=0,o;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(a>999||c===93&&!o||c===null||c===91||Y(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 Y(c)||(o=!0),a++,e.consume(c),c===92?h:u}function h(c){return c===91||c===92||c===93?(e.consume(c),a++,u):u(c)}}function Gc(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,o=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(o>999||m===93&&!s||m===null||m===91||Y(m))return n(m);if(m===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return a=ve(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Y(m)||(s=!0),o++,e.consume(m),m===92?c:h}function c(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(a)||i.push(a),W(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function Kc(e,t,n){return e.check(st,t,e.attempt(Uc,t,n))}function Xc(e){e.exit("gfmFootnoteDefinition")}function Yc(e,t,n){const r=this;return W(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(a):n(a)}}function Jc(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,s){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let u=l;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[l][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},c={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",h,s],["enter",o[u][1],s],["exit",o[u][1],s],["enter",c,s]],p=s.parser.constructs.insideSpan.null;p&&xe(f,f.length,0,Ct(p,o.slice(u+1,l),s)),xe(f,f.length,0,[["exit",c,s],["enter",o[l][1],s],["exit",o[l][1],s],["exit",h,s]]),xe(o,u-1,l-u+3,f),l=u+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function a(o,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):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const w=$e(u);if(m===126)return c>1?l(m):(o.consume(m),c++,p);if(c<2&&!n)return l(m);const v=o.exit("strikethroughSequenceTemporary"),k=$e(m);return v._open=!k||k===2&&!!w,v._close=!w||w===2&&!!k,s(m)}}}class Qc{constructor(){this.map=[]}add(t,n,r){Zc(this,t,n,r)}consume(t){if(this.map.sort(function(a,o){return a[0]-o[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 a of i)t.push(a);i=r.pop()}this.map.length=0}}function Zc(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 eh(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 a=r.length-1;r[a]=r[a]==="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 th(){return{flow:{null:{name:"table",tokenize:nh,resolveAll:rh}}}}function nh(e,t,n){const r=this;let i=0,a=0,o;return s;function s(x){let T=r.events.length-1;for(;T>-1;){const L=r.events[T][1].type;if(L==="lineEnding"||L==="linePrefix")T--;else break}const z=T>-1?r.events[T][1].type:null,R=z==="tableHead"||z==="tableRow"?b:l;return R===b&&r.parser.lazy[r.now().line]?n(x):R(x)}function l(x){return e.enter("tableHead"),e.enter("tableRow"),u(x)}function u(x){return x===124||(o=!0,a+=1),h(x)}function h(x){return x===null?n(x):M(x)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):n(x):H(x)?W(e,h,"whitespace")(x):(a+=1,o&&(o=!1,i+=1),x===124?(e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),c(x)))}function c(x){return x===null||x===124||Y(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"),o=!1,H(x)?W(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?(o=!0,e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),w):A(x)}function w(x){return H(x)?W(e,v,"whitespace")(x):v(x)}function v(x){return x===58?(a+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(x),e.exit("tableDelimiterMarker"),k):x===45?(a+=1,k(x)):x===null||M(x)?N(x):A(x)}function k(x){return x===45?(e.enter("tableDelimiterFiller"),S(x)):A(x)}function S(x){return x===45?(e.consume(x),S):x===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(x),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(x))}function E(x){return H(x)?W(e,N,"whitespace")(x):N(x)}function N(x){return x===124?m(x):x===null||M(x)?!o||i!==a?A(x):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(x)):A(x)}function A(x){return n(x)}function b(x){return e.enter("tableRow"),D(x)}function D(x){return x===124?(e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),D):x===null||M(x)?(e.exit("tableRow"),t(x)):H(x)?W(e,D,"whitespace")(x):(e.enter("data"),O(x))}function O(x){return x===null||x===124||Y(x)?(e.exit("data"),D(x)):(e.consume(x),x===92?F:O)}function F(x){return x===92||x===124?(e.consume(x),O):O(x)}}function rh(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[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,a=[0,0,0,0],o=[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,o[2]===0&&(a[1]!==0&&(o[0]=o[1],c=dt(f,t,a,i,void 0,c),a=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],c=dt(f,t,a,i,void 0,c)),a=o,o=[a[1],n,0,0])):m.type==="tableHead"?(s=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,a[1]!==0?(o[0]=o[1],c=dt(f,t,a,i,n,c)):o[1]!==0&&(c=dt(f,t,o,i,n,c)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[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=eh(t.events,n))}return e}function dt(e,t,n,r,i,a){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(a.end=Object.assign({},Ve(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const l=Ve(t.events,n[1]);if(a={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const u=Ve(t.events,n[2]),h=Ve(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,w=n[3]-n[2]-1;e.add(m,w,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(a.end=Object.assign({},Ve(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function pr(e,t,n,r,i){const a=[],o=Ve(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function Ve(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const ih={name:"tasklistCheck",tokenize:ah};function oh(){return{text:{91:ih}}}function ah(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"),a)}function a(l){return Y(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(l)}function s(l){return M(l)?t(l):H(l)?e.check({tokenize:sh},t,n)(l):n(l)}}function sh(e,t,n){return W(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function lh(e){return _r([Lc(),Hc(),Jc(e),th(),oh()])}const uh={};function ch(e){const t=this,n=e||uh,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(lh(n)),a.push(_c()),o.push(Nc(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"},hh={MOBILE:640},Ne={theme:wi.AUTO,position:bi.BOTTOM_RIGHT,language:vi.ENGLISH,width:"400px",height:"600px",autoOpen:!1,showBranding:!0,mobileFullscreen:!0},ph={API_REQUEST:3e4},fr={MAX_LENGTH:2e3},fh=()=>window.innerWidth<hh.MOBILE,dh=e=>{try{return new Date(e).toLocaleTimeString("es-ES",{hour:"2-digit",minute:"2-digit"})}catch{return""}},mh=e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`,$t=()=>crypto.randomUUID(),gh=()=>window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",yh=e=>e.trim().slice(0,2e3),xh=()=>{const{t:e}=ue.useTranslation();return y.jsxs("div",{className:"gpc-typing-indicator",role:"status","aria-label":e("ui.typingIndicator.typing"),children:[y.jsx("span",{className:"gpc-typing-dot"}),y.jsx("span",{className:"gpc-typing-dot"}),y.jsx("span",{className:"gpc-typing-dot"})]})},kh=({message:e,showMetadata:t=!1,messageRef:n=null})=>{const{t:r}=ue.useTranslation(),i=e.role==="user",a=!i&&e.isStreaming&&!e.content,[o,s]=I.useState(!1),l=async()=>{try{await navigator.clipboard.writeText(e.content),s(!0),setTimeout(()=>s(!1),2e3)}catch(u){console.error("Error al copiar:",u)}};return y.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:[y.jsx("div",{className:"gpc-message-content",children:a?y.jsx(xh,{}):i?e.content.trim():y.jsx(Jl,{remarkPlugins:[ch],components:{table:({node:u,...h})=>y.jsx("div",{className:"gpc-table-wrapper",children:y.jsx("table",{className:"gpc-table",...h})}),thead:({node:u,...h})=>y.jsx("thead",{className:"gpc-table-head",...h}),tbody:({node:u,...h})=>y.jsx("tbody",{className:"gpc-table-body",...h}),tr:({node:u,...h})=>y.jsx("tr",{className:"gpc-table-row",...h}),th:({node:u,...h})=>y.jsx("th",{className:"gpc-table-header",...h}),td:({node:u,...h})=>y.jsx("td",{className:"gpc-table-cell",...h})},children:e.content})}),y.jsxs("div",{className:`gpc-message-timestamp ${i?"gpc-message-timestamp-user":""}`,children:[!i&&e.metadata?.modelUsed&&y.jsx("span",{className:"gpc-model-badge",children:e.metadata.modelUsed}),y.jsxs("span",{className:"gpc-timestamp-right",children:[y.jsx("span",{children:dh(e.timestamp)}),!a&&e.content&&y.jsx("button",{onClick:l,className:"gpc-copy-button","aria-label":o?"Copiado":"Copiar mensaje",children:o?y.jsx(ie.Check,{size:14}):y.jsx(ie.Copy,{size:14})})]})]}),!i&&t&&e.metadata&&y.jsxs("div",{className:"gpc-message-metadata",children:[e.metadata.tokensUsed&&y.jsxs("div",{className:"gpc-metadata-item",children:[y.jsxs("strong",{children:[r("metadata.tokensUsed"),":"]})," ",e.metadata.tokensUsed]}),e.metadata.responseTimeMs&&y.jsxs("div",{className:"gpc-metadata-item",children:[y.jsxs("strong",{children:[r("metadata.responseTime"),":"]})," ",mh(e.metadata.responseTimeMs)]}),e.metadata.modelUsed&&y.jsxs("div",{className:"gpc-metadata-item",children:[y.jsxs("strong",{children:[r("metadata.model"),":"]})," ",e.metadata.modelUsed]})]})]})},bh=({messages:e,isLoading:t,showMetadata:n=!1,widgetConfig:r=null,hasMoreMessages:i=!1,isLoadingMoreMessages:a=!1,onLoadMoreMessages:o=null})=>{const{t:s}=ue.useTranslation(),l=I.useRef(null),u=I.useRef(null),h=I.useRef(0),c=I.useRef(!1),f=I.useRef(null),p=I.useRef(null),m=I.useRef(0);I.useLayoutEffect(()=>{e.length>0&&!c.current&&(l.current?.scrollIntoView({behavior:"instant"}),c.current=!0,h.current=e.length)},[e.length]),I.useEffect(()=>{if(!o)return;const N=new IntersectionObserver(A=>{A[0].isIntersecting&&i&&!a&&(f.current&&(m.current=f.current.scrollHeight),o())},{threshold:1});return p.current&&N.observe(p.current),()=>{p.current&&N.unobserve(p.current)}},[i,a,o]),I.useEffect(()=>{if(a===!1&&m.current>0&&f.current){const A=f.current.scrollHeight-m.current;f.current.scrollTop=A,m.current=0}},[a]),I.useEffect(()=>{const N=e.length,A=h.current,b=e[N-1],D=N>A+1;N>0&&c.current&&(D?setTimeout(()=>{l.current?.scrollIntoView({behavior:"instant"})},150):N>A&&b&&(b.role==="user"?l.current?.scrollIntoView({behavior:"smooth"}):b.role==="assistant"&&b.isStreaming&&setTimeout(()=>{u.current?.scrollIntoView({behavior:"smooth",block:"start"})},100))),h.current=N},[e]);const w=r?.widget_customization?.branding?.company_name||"TIA GPC",v=r?.widget_customization?.branding?.company_logo_base64,k=r?.widget_customization?.welcome_message,S=v?.startsWith("data:")?v:v?`data:image/png;base64,${v}`:null,E=k||s("chat.welcome",{companyName:w});return e.length===0&&!t?y.jsx("div",{className:"gpc-messages-container",children:y.jsxs("div",{className:"gpc-empty-state",children:[S?y.jsx("div",{className:"gpc-welcome-logo",children:y.jsx("img",{src:S,alt:w,className:"gpc-welcome-company-logo"})}):y.jsx(ie.MessageSquare,{className:"gpc-empty-icon"}),y.jsx("h3",{className:"gpc-empty-title",children:E}),y.jsx("p",{className:"gpc-empty-text",children:s("chat.emptyState")})]})}):y.jsxs("div",{ref:f,className:"gpc-messages-container gpc-scrollbar gpc-smooth-scroll",children:[i&&y.jsx("div",{style:{textAlign:"center",padding:"10px"},children:a?y.jsxs("div",{className:"gpc-loading-more-messages",children:[y.jsx("div",{className:"gpc-loading-spinner"}),y.jsx("span",{children:s("chat.loadingMore","Loading older messages...")})]}):y.jsx("div",{ref:p,style:{height:"1px"}})}),e.map((N,A)=>y.jsx(kh,{message:N,showMetadata:n,messageRef:A===e.length-1?u:null},N.id)),y.jsx("div",{ref:l})]})},wh=1.2,vh=2e3,Ch=({onTranscript:e,isLoading:t,disabled:n,onRecordingStateChange:r,onAnalyserChange:i})=>{const{t:a}=ue.useTranslation(),[o,s]=I.useState(!1),[l,u]=I.useState(!1),h=I.useRef(null),c=I.useRef([]),f=I.useRef(null),p=I.useRef(null),m=I.useRef(null),w=I.useRef(null),v=I.useRef(null);I.useEffect(()=>()=>{h.current?.state==="recording"&&h.current.stop(),f.current&&f.current.state!=="closed"&&f.current.close(),v.current&&clearInterval(v.current)},[]),I.useEffect(()=>{r&&r(o||l)},[o,l,r]),I.useEffect(()=>{i&&i(p.current)},[p.current,i]);const k=()=>{if(!p.current||!m.current)return;p.current.getByteTimeDomainData(m.current);let D=0;for(let x=0;x<m.current.length;x++){const T=(m.current[x]-128)/128;D+=T*T}if(Math.sqrt(D/m.current.length)*100<wh){if(w.current||(w.current=Date.now()),Date.now()-w.current>vh){E();return}}else w.current=null},S=async()=>{try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){alert(a("voice.unsupported"));return}const D=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(D).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(D,{mimeType:"audio/webm;codecs=opus"});h.current=x,c.current=[],w.current=null,x.ondataavailable=T=>{T.data.size>0&&c.current.push(T.data)},x.onstop=async()=>{if(v.current&&(clearInterval(v.current),v.current=null),f.current&&f.current.state!=="closed"&&f.current.close(),w.current=null,c.current.length===0){console.warn("No audio data recorded");return}const T=new Blob(c.current,{type:"audio/webm"});u(!0);try{await e(T)}catch(z){console.error("Transcription error:",z),alert(a("voice.error"))}finally{u(!1),c.current=[]}},x.start(100),s(!0),v.current=setInterval(()=>{k()},100)}catch(D){console.error("Error accessing microphone:",D),D.name==="NotAllowedError"||D.name==="PermissionDeniedError"?alert(a("voice.permissionDenied")):alert(a("voice.unsupported"))}},E=()=>{!o&&h.current?.state!=="recording"||(h.current&&h.current.state==="recording"&&h.current.stop(),v.current&&(clearInterval(v.current),v.current=null),w.current=null,s(!1),h.current&&h.current.stream&&h.current.stream.getTracks().forEach(D=>D.stop()))},N=D=>{D.preventDefault(),D.stopPropagation(),o?E():S()},A=n||t||l,b=a(l?"voice.processing":o?"voice.stop":"voice.record");return y.jsx("button",{type:"button",onClick:N,disabled:A,className:`gpc-voice-button ${o?"gpc-voice-recording":""}`,"aria-label":b,title:b,children:l?y.jsx("span",{className:"gpc-spinner"}):o?y.jsx(ie.MicOff,{className:"gpc-icon gpc-voice-icon-active"}):y.jsx(ie.Mic,{className:"gpc-icon"})})},Sh=({analyser:e,isRecording:t})=>{const n=I.useRef(null),r=I.useRef(null);return I.useEffect(()=>{if(!t||!e||!n.current)return;const i=n.current,a=i.getContext("2d"),o=e.frequencyBinCount,s=new Uint8Array(o),l=window.devicePixelRatio||1,u=i.getBoundingClientRect();i.width=u.width*l,i.height=u.height*l,a.scale(l,l);const h=u.width,c=u.height,f=40,p=3,m=2,w=()=>{if(!t)return;r.current=requestAnimationFrame(w),e.getByteFrequencyData(s),a.clearRect(0,0,h,c);const v=f*(p+m),k=(h-v)/2;for(let S=0;S<f;S++){const E=Math.floor(S*o/f),A=s[E]/255,b=Math.max(2,A*c*.8),D=k+S*(p+m),O=(c-b)/2,F=a.createLinearGradient(0,O,0,O+b);F.addColorStop(0,"rgba(59, 130, 246, 0.8)"),F.addColorStop(1,"rgba(96, 165, 250, 0.6)"),a.fillStyle=F,a.fillRect(D,O,p,b)}};return w(),()=>{r.current&&cancelAnimationFrame(r.current)}},[e,t]),t?y.jsx("div",{className:"gpc-audio-waveform-container",children:y.jsx("canvas",{ref:n,className:"gpc-audio-waveform-canvas","aria-label":"Audio waveform visualization"})}):null},Eh=({onSendMessage:e,isLoading:t,disabled:n,gpcService:r,showBranding:i=!0})=>{const{t:a}=ue.useTranslation(),[o,s]=I.useState(""),[l,u]=I.useState(!1),[h,c]=I.useState(null),f=I.useRef(null);I.useEffect(()=>{!n&&!t&&!l&&f.current?.focus()},[n,t,l]),I.useEffect(()=>{f.current&&(f.current.style.height="auto",f.current.style.height=`${Math.min(f.current.scrollHeight,120)}px`)},[o]);const p=async A=>{A.preventDefault();const b=yh(o);if(!(!b||t||n||l))try{await e(b),s(""),f.current&&(f.current.style.height="auto")}catch(D){console.error("Error sending message:",D)}},m=A=>{A.key==="Enter"&&!A.shiftKey&&!l&&(A.preventDefault(),p(A))},w=async A=>{if(!r)throw new Error(a("toast.gpcServiceNotAvailable"));const b=await r.transcribeAudio(A);b.success&&b.text&&(s(b.text),f.current?.focus())},v=A=>{u(A)},k=A=>{c(A)},S=o.trim().length>0&&!t&&!n&&!l,E=t||n||l,N=n||o.trim().length>0;return y.jsxs("form",{onSubmit:p,className:"gpc-input-container",children:[y.jsxs("div",{className:"gpc-input-wrapper",children:[y.jsx("textarea",{ref:f,value:o,onChange:A=>s(A.target.value),onKeyDown:m,placeholder:l?"":a("chat.placeholder"),disabled:E,maxLength:fr.MAX_LENGTH,className:`gpc-input gpc-textarea ${l?"gpc-input-recording":""}`,"aria-label":a("chat.placeholder"),"aria-describedby":"chat-input-help",rows:1}),y.jsx(Sh,{analyser:h,isRecording:l})]}),y.jsxs("div",{className:"gpc-input-actions-right",children:[y.jsx(Ch,{onTranscript:w,isLoading:t,disabled:N,onRecordingStateChange:v,onAnalyserChange:k}),y.jsx("button",{type:"submit",disabled:!S,className:"gpc-send-button","aria-label":a("chat.send"),title:a("chat.send"),children:t?y.jsx("span",{className:"gpc-spinner"}):y.jsx(ie.Send,{className:"gpc-icon"})})]}),y.jsxs("div",{className:"gpc-footer-container",children:[y.jsx("span",{className:"gpc-ai-disclaimer",children:a("chat.aiDisclaimer")}),i&&y.jsx("span",{className:"gpc-powered-by",children:a("widget.poweredBy")})]}),y.jsxs("span",{id:"chat-input-help",className:"gpc-sr-only",children:[a("chat.placeholder"),"."," ",a("input.maxCharacters",{count:fr.MAX_LENGTH})]})]})},Th=({isOpen:e,onClose:t,onConfirm:n,message:r,confirmText:i,cancelText:a,variant:o="danger"})=>{const{t:s}=ue.useTranslation();if(!e)return null;const l=h=>{h.preventDefault(),h.stopPropagation(),n(),t()},u=h=>{h.preventDefault(),h.stopPropagation(),t()};return y.jsx("div",{className:"gpc-confirm-toast-container gpc-animate-slide-down",children:y.jsxs("div",{className:`gpc-confirm-toast ${o==="danger"?"gpc-confirm-toast-danger":""}`,children:[y.jsx("p",{className:"gpc-confirm-toast-message",children:r}),y.jsxs("div",{className:"gpc-confirm-toast-actions",children:[y.jsx("button",{type:"button",onClick:u,className:"gpc-confirm-toast-button gpc-confirm-toast-button-cancel gpc-focus-visible gpc-transition",children:a||s("conversations.cancel","Cancel")}),y.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")})]})]})})},Ih=({conversations:e,totalConversations:t,currentConversationId:n,onSelectConversation:r,onNewConversation:i,onRenameConversation:a,onDeleteConversation:o,isLoadingHistory:s,hasMoreConversations:l,isLoadingMoreConversations:u,onLoadMore:h})=>{const{t:c}=ue.useTranslation(),f=I.useRef(null),[p,m]=I.useState(null),[w,v]=I.useState(""),[k,S]=I.useState({isOpen:!1,id:null,title:""});I.useEffect(()=>{const x=new IntersectionObserver(T=>{T[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 E=x=>{const T=new Date(x),R=new Date-T,L=Math.floor(R/6e4),j=Math.floor(R/36e5),G=Math.floor(R/864e5);return L<1?c("time.justNow","Just now"):L<60?c("time.minutesAgo",`${L} min ago`,{count:L}):j<24?c("time.hoursAgo",`${j}h ago`,{count:j}):G<7?c("time.daysAgo",`${G}d ago`,{count:G}):T.toLocaleDateString()},N=x=>{m(x.conversation_id),v(x.title||"")},A=()=>{m(null),v("")},b=x=>{w.trim()&&a&&(a(x,w.trim()),m(null),v(""))},D=(x,T)=>{S({isOpen:!0,id:x,title:T||c("conversations.untitled","Untitled conversation")})},O=()=>{k.id&&o&&o(k.id),S({isOpen:!1,id:null,title:""})},F=()=>{S({isOpen:!1,id:null,title:""})};return y.jsxs("div",{className:"gpc-conversations-container",children:[y.jsxs("div",{className:"gpc-conversations-header",children:[y.jsx("h3",{className:"gpc-conversations-title",children:c("conversations.title","Conversations")}),y.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:[y.jsx(ie.MessageSquare,{size:16}),y.jsx("span",{children:c("conversations.new","New")})]})]}),y.jsx("div",{className:"gpc-conversations-list",children:e.length===0?y.jsxs("div",{className:"gpc-conversations-empty",children:[y.jsx(ie.MessageSquare,{size:48,className:"gpc-conversations-empty-icon"}),y.jsx("p",{className:"gpc-conversations-empty-text",children:c("conversations.empty","No conversations yet")}),y.jsx("p",{className:"gpc-conversations-empty-hint",children:c("conversations.emptyHint","Start a conversation to see it here")})]}):y.jsxs("div",{className:"gpc-conversations-items",children:[e.map(x=>y.jsx("div",{className:`gpc-conversation-item gpc-animate-fade-in ${n===x.conversation_id?"gpc-conversation-item-active":""} ${s?"gpc-conversation-item-disabled":""}`,children:y.jsx("div",{className:"gpc-conversation-content gpc-transition",onClick:()=>p!==x.conversation_id&&!s&&r(x.conversation_id),children:p===x.conversation_id?y.jsxs("div",{className:"gpc-conversation-edit",children:[y.jsx("input",{type:"text",value:w,onChange:T=>v(T.target.value),onKeyDown:T=>{T.key==="Enter"&&b(x.conversation_id),T.key==="Escape"&&A()},className:"gpc-conversation-edit-input gpc-focus-visible",placeholder:c("conversations.untitled","Untitled conversation"),autoFocus:!0,maxLength:200}),y.jsxs("div",{className:"gpc-conversation-edit-actions",children:[y.jsx("button",{type:"button",onClick:T=>{T.preventDefault(),T.stopPropagation(),b(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:y.jsx(ie.Check,{size:16})}),y.jsx("button",{type:"button",onClick:T=>{T.preventDefault(),T.stopPropagation(),A()},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:y.jsx(ie.X,{size:16})})]})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"gpc-conversation-header",children:[y.jsx("h4",{className:"gpc-conversation-title",children:x.title||c("conversations.untitled","Untitled conversation")}),y.jsxs("div",{className:"gpc-conversation-actions",children:[y.jsx("button",{type:"button",onClick:T=>{T.preventDefault(),T.stopPropagation(),N(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:y.jsx(ie.Pencil,{size:16})}),y.jsx("button",{type:"button",onClick:T=>{T.preventDefault(),T.stopPropagation(),D(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:y.jsx(ie.Trash2,{size:16})})]})]}),y.jsxs("div",{className:"gpc-conversation-metadata",children:[y.jsxs("div",{className:"gpc-conversation-meta-item",children:[y.jsx(ie.MessageSquare,{size:12}),y.jsx("span",{children:x.total_messages})]}),y.jsxs("div",{className:"gpc-conversation-meta-item",children:[y.jsx(ie.Clock,{size:12}),y.jsx("span",{children:E(x.last_modification_date)})]})]})]})})},x.conversation_id)),u&&y.jsxs("div",{className:"gpc-conversations-loading",children:[y.jsx("div",{className:"gpc-loading-spinner"}),y.jsx("span",{children:c("conversations.loadingMore","Loading more...")})]}),l&&!u&&y.jsx("div",{ref:f,style:{height:"1px"}})]})}),y.jsx(Th,{isOpen:k.isOpen,onClose:F,onConfirm:O,message:c("conversations.confirmDelete",{title:k.title,defaultValue:`Delete "${k.title}"?`}),confirmText:c("conversations.delete","Delete"),cancelText:c("conversations.cancel","Cancel"),variant:"danger"})]})},Ah=({version:e=ot})=>{const{t}=ue.useTranslation();return y.jsxs("div",{className:"gpc-conversations-container",children:[y.jsx("div",{className:"gpc-conversations-header",children:y.jsx("h3",{className:"gpc-conversations-title",children:t("about.title")})}),y.jsxs("div",{className:"gpc-about-panel-content",children:[y.jsx("div",{className:"gpc-about-panel-logo",children:y.jsx(ie.Info,{size:48,className:"gpc-about-panel-icon"})}),y.jsxs("div",{className:"gpc-about-panel-items",children:[y.jsxs("div",{className:"gpc-about-panel-item",children:[y.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.product"),":"]}),y.jsx("span",{className:"gpc-about-panel-value",children:"TIA GPC"}),y.jsx("a",{href:"https://www.landing.softiabot.com",target:"_blank",rel:"noopener noreferrer",className:"gpc-about-panel-link",children:"www.landing.softiabot.com"})]}),y.jsxs("div",{className:"gpc-about-panel-item",children:[y.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.version"),":"]}),y.jsx("span",{className:"gpc-about-panel-value",children:e})]}),y.jsxs("div",{className:"gpc-about-panel-item",children:[y.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.creator"),":"]}),y.jsx("span",{className:"gpc-about-panel-value",children:"SOFTIA Technologies Inc."}),y.jsx("a",{href:"https://www.softia.ca",target:"_blank",rel:"noopener noreferrer",className:"gpc-about-panel-link",children:"Softia.ca"})]}),y.jsx("div",{className:"gpc-about-panel-footer",children:y.jsx("p",{className:"gpc-about-panel-rights",children:t("about.rights")})})]})]})]})},_h=(e,t)=>{const{t:n}=ue.useTranslation(),[r,i]=I.useState([]),[a,o]=I.useState(!1),[s,l]=I.useState(null),[u,h]=I.useState(null),[c,f]=I.useState([]),[p,m]=I.useState(0),[w,v]=I.useState(!1),[k,S]=I.useState(!0),[E,N]=I.useState(0),[A,b]=I.useState(!0),[D,O]=I.useState(!1),[F,x]=I.useState(0),[T,z]=I.useState(!1),[R,L]=I.useState(!1),j=I.useCallback(async $=>{if(!$.trim()||a)return;const ee={id:$t(),role:"user",content:$.trim(),timestamp:new Date().toISOString()};i(te=>[...te,ee]),o(!0),l(null);const K=$t(),le={id:K,role:"assistant",content:"",timestamp:new Date().toISOString(),isStreaming:!0};i(te=>[...te,le]);try{const te=await e.sendMessage($,Q=>{i(oe=>oe.map(Ee=>Ee.id===K?{...Ee,content:Ee.content+Q}:Ee))},u);i(Q=>Q.map(oe=>oe.id===K?{id:te.data.message_id,role:"assistant",content:te.data.response,timestamp:te.data.created_at,isStreaming:!1,metadata:{responseTimeMs:te.data.response_time_ms,modelUsed:te.data.model_used}}:oe)),te.data.conversation_id&&h(te.data.conversation_id),B()}catch(te){i(Me=>Me.filter(ct=>ct.id!==K));let Q;try{Q=JSON.parse(te.message)}catch{Q={statusCode:500,message:te.message}}let oe;const Ee=Q.statusCode||500,Ge=Q.errorCode||"";switch(Ee===401&&Ge==="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:Ge.includes("DOMAIN")||Ge.includes("UNAUTHORIZED")?oe=n("errors.domainUnauthorized"):oe=n("errors.validation");break;case 422: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),Pe.error(oe,{duration:4e3,position:"top-center"});const ut={id:$t(),role:"assistant",content:oe,timestamp:new Date().toISOString()};i(Me=>[...Me,ut])}finally{o(!1)}},[e,a,n,t,u]),G=I.useCallback(()=>{i([]),l(null)},[]),ne=I.useCallback(()=>{l(null)},[]),re=I.useCallback(async($,ee=!0)=>{if(!(!e||!$)){v(!0);try{const K=ee?0:F,le=await e.getConversationHistory($,50,K);if(le.success&&le.data.messages){const te=le.data.messages.flatMap(Q=>[{id:`${Q.message_id}-question`,role:"user",content:Q.question,timestamp:Q.creation_date},{id:Q.message_id,role:"assistant",content:Q.answer,timestamp:Q.creation_date,metadata:{modelUsed:Q.model}}]);ee?(i(te),x(le.data.count)):(i(Q=>[...te,...Q]),x(Q=>Q+le.data.count)),z(le.data.has_more),h($)}}catch(K){console.error("Error loading conversation history:",K),Pe.error(n("toast.failedLoadHistory"))}finally{v(!1)}}},[e,n,F]),B=I.useCallback(async($=!0)=>{if(e)try{const ee=$?0:E,K=await e.listConversations(20,ee);K.success&&K.data.conversations&&($?(f(K.data.conversations),N(K.data.count)):(f(le=>[...le,...K.data.conversations]),N(le=>le+K.data.count)),b(K.data.has_more),m(K.data.total||0))}catch(ee){console.error("Error loading conversations:",ee)}},[e,E]),d=I.useCallback(async()=>{if(!(!e||D||!A)){O(!0);try{await B(!1)}finally{O(!1)}}},[e,D,A,B]),Z=I.useCallback(async()=>{if(!(!e||!u||R||!T)){L(!0);try{await re(u,!1)}finally{L(!1)}}},[e,u,R,T,re]),se=I.useCallback(()=>{i([]),h(null),l(null),e&&e.clearLastConversation(),Pe.success(n("toast.newConversationStarted"))},[n,e]),g=I.useCallback(async $=>{await re($)},[re]),ce=I.useCallback(async($,ee)=>{if(e)try{await e.updateConversationTitle($,ee),await B(!0),Pe.success(n("toast.conversationRenamed"))}catch(K){console.error("Error renaming conversation:",K),Pe.error(n("toast.failedRenameConversation"))}},[e,B,n]),be=I.useCallback(async $=>{if(e)try{await e.deleteConversation($),$===u&&(i([]),h(null)),await B(!0),Pe.success(n("toast.conversationDeleted"))}catch(ee){console.error("Error deleting conversation:",ee),Pe.error(n("toast.failedDeleteConversation"))}},[e,u,B,n]);return I.useEffect(()=>{(async()=>{if(!e){S(!1);return}try{const ee=e.getLastConversation();ee&&(i(ee.messages),h(ee.conversationId))}catch(ee){console.error("[TIA GPC] Error restaurando conversación:",ee)}finally{S(!1)}})()},[e]),I.useEffect(()=>{e&&!k&&B()},[e,B,k]),I.useEffect(()=>{e&&r.length>0&&!k&&e.saveLastConversation(u,r)},[e,r,u,k]),{messages:r,isLoading:a,error:s,sendMessage:j,clearMessages:G,clearError:ne,currentConversationId:u,conversations:c,totalConversations:p,isLoadingHistory:w,loadConversationHistory:re,loadConversations:B,startNewConversation:se,switchConversation:g,renameConversation:ce,deleteConversation:be,isRestoringConversation:k,hasMoreConversations:A,isLoadingMoreConversations:D,loadMoreConversations:d,hasMoreMessages:T,isLoadingMoreMessages:R,loadMoreMessages:Z}},Nh=(e="auto")=>{const[t,n]=I.useState(e),[r,i]=I.useState("light");return I.useEffect(()=>{n(e)},[e]),I.useEffect(()=>{if(i(t==="auto"?gh():t),t==="auto"){const s=window.matchMedia("(prefers-color-scheme: dark)"),l=u=>{i(u.matches?"dark":"light")};return s.addEventListener("change",l),()=>{s.removeEventListener("change",l)}}},[t]),{theme:r,themeMode:t,setThemeMode:n,toggleTheme:()=>{n(o=>o==="auto"?r==="light"?"dark":"light":o==="light"?"dark":"light")}}},Ph=({gpcService:e,licenseToken:t,widgetConfig:n,onClose:r,themeMode:i,showBranding:a=!0,showMetadata:o=!1,onError:s,version:l=ot})=>{const{t:u}=ue.useTranslation(),[h,c]=I.useState(!1),[f,p]=I.useState(!1),{theme:m,toggleTheme:w}=Nh(i),v=I.useCallback(()=>{},[]),{messages:k,isLoading:S,sendMessage:E,currentConversationId:N,conversations:A,totalConversations:b,isLoadingHistory:D,startNewConversation:O,switchConversation:F,renameConversation:x,deleteConversation:T,isRestoringConversation:z,hasMoreConversations:R,isLoadingMoreConversations:L,loadMoreConversations:j,hasMoreMessages:G,isLoadingMoreMessages:ne,loadMoreMessages:re}=_h(e,v),B=I.useCallback(()=>{c(g=>!g),p(!1)},[]),d=I.useCallback(()=>{p(g=>!g),c(!1)},[]),Z=I.useCallback(g=>{F(g),c(!1)},[F]),se=I.useCallback(()=>{O(),c(!1)},[O]);return I.useEffect(()=>()=>{e&&e.releaseSession().catch(g=>{console.error("Failed to release session:",g)})},[e]),y.jsxs("div",{className:`gpc-chat-window gpc-animate-fade-in ${m==="dark"?"gpc-dark":""}`,children:[y.jsx(Fi,{onClose:r,theme:m,onToggleTheme:w,showBranding:a,widgetConfig:n,onToggleConversations:B,showConversations:h,conversationsCount:b,onToggleAbout:d,showAbout:f,version:l}),y.jsx(bh,{messages:k,isLoading:S||D||z,showMetadata:o,widgetConfig:n,hasMoreMessages:G,isLoadingMoreMessages:ne,onLoadMoreMessages:re}),y.jsx(Eh,{onSendMessage:E,isLoading:S||z,disabled:z,gpcService:e,showBranding:a}),h&&y.jsx("div",{className:"gpc-conversations-overlay",children:y.jsx(Ih,{conversations:A,totalConversations:b,currentConversationId:N,onSelectConversation:Z,onNewConversation:se,onRenameConversation:x,onDeleteConversation:T,isLoadingHistory:D,hasMoreConversations:R,isLoadingMoreConversations:L,onLoadMore:j})}),f&&y.jsx("div",{className:"gpc-conversations-overlay",children:y.jsx(Ah,{version:l})}),y.jsx(Pe.Toaster,{position:"top-center"})]})},Dh=({gpcService:e,onSuccess:t,onError:n})=>{const{t:r}=ue.useTranslation(),[i,a]=I.useState(null),[o,s]=I.useState(null),[l,u]=I.useState(""),[h,c]=I.useState(""),[f,p]=I.useState(!1),[m,w]=I.useState(!0),[v,k]=I.useState(null);I.useEffect(()=>{S()},[]);const S=async()=>{w(!0),c(""),u("");try{const A=await e.generateCaptchaChallenge();if(A.success&&A.challenge_id)a(A.question),s(A.challenge_id);else throw new Error("Failed to generate challenge")}catch(A){c(r("captcha.errorGenerating","Error generating challenge. Please try again.")),n&&n(A)}finally{w(!1)}},E=async A=>{A.preventDefault(),c(""),p(!0);try{const b=parseInt(l,10);if(isNaN(b)){c(r("captcha.invalidNumber")),p(!1);return}const D=await e.verifyCaptchaAnswer(o,b);if(D.success)localStorage.setItem(Ue.VERIFIED,"true"),localStorage.setItem(Ue.TIMESTAMP,Date.now().toString()),t&&t();else{const O=D.attempts_remaining;k(O),O!==void 0&&O>0?c(r("captcha.incorrectAnswerWithAttempts",{attempts:O,defaultValue:"Incorrect answer. {{attempts}} attempts remaining"})):c(r("captcha.incorrectAnswer")),u(""),p(!1)}}catch(b){switch(b.error_code){case"CHALLENGE_NOT_FOUND":case"CHALLENGE_EXPIRED":c(r("captcha.challengeExpired","Challenge expired. Generating a new one...")),setTimeout(()=>S(),2e3);break;case"MAX_ATTEMPTS_EXCEEDED":c(r("captcha.maxAttemptsExceeded","Maximum attempts exceeded. Generating a new challenge...")),setTimeout(()=>S(),2e3);break;case"INVALID_SESSION":c(r("captcha.invalidSession","Invalid session. Please refresh the page."));break;default:c(r("captcha.error"))}p(!1),n&&n(b)}},N=A=>{const b=A.target.value;(b===""||/^\d+$/.test(b))&&(u(b),c(""))};return m||!i?y.jsxs("div",{className:"gpc-captcha-loading",children:[y.jsx("div",{className:"gpc-spinner"}),y.jsx("p",{children:r("captcha.loading","Loading challenge...")})]}):y.jsx("div",{className:"gpc-captcha-container",children:y.jsxs("div",{className:"gpc-captcha-content",children:[y.jsxs("div",{className:"gpc-captcha-header",children:[y.jsx("svg",{className:"gpc-captcha-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:y.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"})}),y.jsx("h3",{className:"gpc-captcha-title",children:r("captcha.title")}),y.jsx("p",{className:"gpc-captcha-subtitle",children:r("captcha.subtitle")})]}),y.jsxs("form",{onSubmit:E,className:"gpc-captcha-form",children:[y.jsxs("div",{className:"gpc-captcha-question",children:[y.jsx("label",{htmlFor:"captcha-answer",className:"gpc-captcha-label",children:r("captcha.question")}),y.jsxs("div",{className:"gpc-captcha-challenge",children:[y.jsx("span",{className:"gpc-captcha-math",children:i}),y.jsx("span",{className:"gpc-captcha-equals",children:"="}),y.jsx("input",{id:"captcha-answer",type:"text",inputMode:"numeric",pattern:"[0-9]*",value:l,onChange:N,placeholder:"?",className:`gpc-captcha-input ${h?"gpc-captcha-input-error":""}`,disabled:f,autoFocus:!0,autoComplete:"off"})]})]}),h&&y.jsxs("div",{className:"gpc-captcha-error",children:[y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[y.jsx("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),y.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12",strokeWidth:2,strokeLinecap:"round"}),y.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16",strokeWidth:2,strokeLinecap:"round"})]}),y.jsx("span",{children:h})]}),v!==null&&v>0&&y.jsx("div",{className:"gpc-captcha-attempts",children:r("captcha.attemptsLeft",{count:v,defaultValue:"{{count}} attempts remaining"})}),y.jsx("button",{type:"submit",className:"gpc-captcha-button",disabled:f||!l,children:f?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"gpc-spinner gpc-button-spinner"}),r("captcha.verifying")]}):r("captcha.verify")})]}),y.jsx("p",{className:"gpc-captcha-info",children:r("captcha.info")})]})})};class Lh{constructor(t,n){this.licenseToken=n,this.baseURL=t||ki,this.client=Pi.create({baseURL:this.baseURL,timeout:ph.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 zh{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,a=Date.now(),o=1440*60*1e3;return r&&a-i<o}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 Rh{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 Ri.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 a=`${this.httpClient.baseURL}/ask`,o=jh(),s={message:t,session_token:this.sessionToken,request_metadata:o};r&&(s.conversation_id=r);try{const l=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.licenseToken}`},body:JSON.stringify(s)});if(!l.ok){const u=await l.json().catch(()=>({}));throw new Error(JSON.stringify({statusCode:l.status,errorCode:u.error_code||"UNKNOWN_ERROR",message:u.message||"Request failed",retryAfter:u.retry_after_seconds||null}))}return await this._processSSEResponse(l,n)}catch(l){throw l.message.startsWith("{")?l:new Error(JSON.stringify({statusCode:500,errorCode:"NETWORK_ERROR",message:l.message,retryAfter:null}))}}async _processSSEResponse(t,n){const r=t.body.getReader(),i=new TextDecoder;let a="",o="",s=null,l=null;for(;;){const{done:u,value:h}=await r.read();if(u)break;a+=i.decode(h,{stream:!0});const c=a.split(`
|
|
30
|
-
`);a=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")o+=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:o,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 zh(n,this.httpClient),this.conversationService=new Rh(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 Oh=(e,t)=>((!mt||t&&mt.licenseToken!==t)&&(mt=new wn(e,t)),mt),Fh={title:"TIA GPC",poweredBy:"Desarrollado por SOFTIA.ca",questionsTo:"Preguntas a",validatingSession:"Validando sesión..."},Bh={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..."},Vh={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"},Uh={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?"},$h={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"},Gh={languageSelector:{label:"Cambiar idioma"},spinner:{loading:"Cargando"},typingIndicator:{typing:"Escribiendo"},message:{userMessage:"Mensaje del usuario",assistantMessage:"Mensaje del asistente"}},Kh={english:"English",spanish:"Español",french:"Français"},Xh={maxCharacters:"Máximo {{count}} caracteres"},Yh={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:"Acerca de",product:"Producto",version:"Versión",creator:"Creador",rights:"Todos los derechos reservados.",close:"Cerrar"},Zh={widget:Fh,chat:Bh,voice:Vh,theme:Uh,errors:Hh,metadata:$h,conversations:qh,time:Wh,ui:Gh,languages:Kh,input:Xh,captcha:Yh,toast:Jh,about:Qh},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"},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:"About",product:"Product",version:"Version",creator:"Creator",rights:"All rights reserved.",close:"Close"},dp={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,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"},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"},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"},Ap={title:"À propos",product:"Produit",version:"Version",creator:"Créateur",rights:"Tous droits réservés.",close:"Fermer"},_p={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:Ip,about:Ap};gt.use(Di).use(ue.initReactI18next).init({resources:{en:{translation:dp},es:{translation:Zh},fr:{translation:_p}},fallbackLng:"en",supportedLngs:["en","es","fr"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});const Si=({token:e,theme:t=Ne.theme,position:n=Ne.position,language:r=Ne.language,primaryColor:i,width:a=Ne.width,height:o=Ne.height,apiUrl:s=ki,onReady:l,onError:u,onClose:h,autoOpen:c=Ne.autoOpen,showBranding:f=Ne.showBranding,mobileFullscreen:p=Ne.mobileFullscreen,...m})=>{const[w,v]=I.useState(!1),[k,S]=I.useState(null),[E,N]=I.useState(!0),[A,b]=I.useState(!1),[D,O]=I.useState(!1);k?.widget_customization?.behavior?.auto_open;const[F,x]=I.useState(!1),T=I.useMemo(()=>new wn(s,e),[s,e]);if(I.useEffect(()=>{const B=()=>{v(fh())};B(),window.addEventListener("resize",B);const d=localStorage.getItem(Ue.VERIFIED),Z=localStorage.getItem(Ue.TIMESTAMP);return d==="true"&&Z&&(Date.now()-parseInt(Z,10)<zi?b(!0):(localStorage.removeItem(Ue.VERIFIED),localStorage.removeItem(Ue.TIMESTAMP))),()=>window.removeEventListener("resize",B)},[]),I.useEffect(()=>{const B=k?.widget_customization?.language||r;B&>.changeLanguage&>.changeLanguage(B)},[r,k]),I.useEffect(()=>{(async()=>{if(!e){N(!1);return}try{const d=await T.getInitConfig();d.success&&(S(d.data),(d.data?.widget_customization?.behavior?.auto_open??c)&&x(!0),l&&l(d.data))}catch(d){console.error("[TIA GPC Widget] Error loading config:",d),u&&u(d)}finally{N(!1)}})()},[e,T,l,u,c]),I.useEffect(()=>{const B=()=>{if(!T)return;const d=T.getSessionToken(),Z=T.httpClient.baseURL,se=T.licenseToken;fetch(`${Z}/release-session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${se}`},body:JSON.stringify({session_token:d}),keepalive:!0}).catch(()=>{})};return window.addEventListener("beforeunload",B),()=>{window.removeEventListener("beforeunload",B)}},[T]),!e)return console.error('[TIA GPC Widget] Error: "token" prop is required'),null;const z=()=>{x(!1),O(!1),h?.()},R=()=>{A||O(!0),x(!0)},L=()=>{b(!0),O(!1)},j=B=>{console.error("[TIA GPC Widget] CAPTCHA error:",B),u&&u(B)},G=()=>{const B=k?.widget_customization?.position||n,d=k?.widget_customization?.behavior?.mobile_fullscreen??p;return w&&d?"gpc-position-bottom-right":`gpc-position-${B}`},ne=()=>{const B={},d=k?.widget_customization?.colors?.primary||i,Z=k?.widget_customization?.colors?.header_background,se=k?.widget_customization?.colors?.header_text;d&&(B["--gpc-color-primary"]=d),Z&&(B["--gpc-header-bg"]=Z),se&&(B["--gpc-header-text"]=se);const g=k?.widget_customization?.dimensions?.width||a,ce=k?.widget_customization?.dimensions?.height||o,be=k?.widget_customization?.behavior?.mobile_fullscreen??p;return(!w||!be)&&(g&&(B["--gpc-widget-width"]=g),ce&&(B["--gpc-widget-height"]=ce)),B},re=k?.widget_customization?.theme||t;return y.jsx(ue.I18nextProvider,{i18n:gt,children:y.jsxs("div",{className:`gpc-widget gpc-widget-container ${G()} ${re==="dark"?"gpc-dark":""}`,style:ne(),children:[!F&&y.jsx(ji,{onClick:R,widgetConfig:k}),F&&!E&&y.jsx(y.Fragment,{children:D&&!A?y.jsx("div",{className:"gpc-chat-window gpc-animate-fade-in",children:y.jsx(Dh,{gpcService:T,onSuccess:L,onError:j})}):y.jsx(Ph,{gpcService:T,licenseToken:e,widgetConfig:k,onClose:z,themeMode:re,showBranding:f,showMetadata:m.showMetadata||!1,onError:u,version:ot})})]})})};Si.defaultProps={theme:"auto",position:"bottom-right",language:"en",width:"400px",height:"600px",autoOpen:!1,showBranding:!0,mobileFullscreen:!0};exports.GPCService=wn;exports.LANGUAGES=vi;exports.THEMES=wi;exports.TiaGPCWidget=Si;exports.WIDGET_POSITIONS=bi;exports.WIDGET_VERSION=ot;exports.getGPCService=Oh;
|
|
27
|
+
`,...a.current()});return/^[\t ]/.test(u)&&(u=it(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),s(),u}ti.peek=$u;function ti(e){return e.value||""}function $u(){return"<"}ni.peek=ec;function ni(e,t,n,r){const i=xn(n),a=i==='"'?"Quote":"Apostrophe",o=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${a}`),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(")"),o(),u}function ec(){return"!"}ri.peek=tc;function ri(e,t,n,r){const i=e.referenceType,a=n.enter("imageReference");let o=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+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return o(),n.stack=h,a(),i==="full"||!u||u!==c?l+=s.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function tc(){return"!"}ii.peek=nc;function ii(e,t,n){let r=e.value||"",i="`",a=-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+" ");++a<n.unsafe.length;){const o=n.unsafe[a],s=n.compilePattern(o);let l;if(o.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 nc(){return"`"}function oi(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))}ai.peek=rc;function ai(e,t,n,r){const i=xn(n),a=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let s,l;if(oi(e,n)){const h=n.stack;n.stack=[],s=n.enter("autolink");let c=o.move("<");return c+=o.move(n.containerPhrasing(e,{before:c,after:">",...o.current()})),c+=o.move(">"),s(),n.stack=h,c}s=n.enter("link"),l=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${a}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),u+=o.move(")"),s(),u}function rc(e,t,n){return oi(e,n)?"<":"["}si.peek=ic;function si(e,t,n,r){const i=e.referenceType,a=n.enter("linkReference");let o=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+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return o(),n.stack=h,a(),i==="full"||!u||u!==c?l+=s.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function ic(){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 oc(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 ac(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 sc(e,t,n,r){const i=n.enter("list"),a=n.bulletCurrent;let o=e.ordered?ac(n):bn(n);const s=e.ordered?o==="."?")":".":oc(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&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)===o&&h){let c=-1;for(;++c<e.children.length;){const p=e.children[c];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=s),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),u}function lc(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 uc(e,t,n,r){const i=lc(n);let a=n.bulletCurrent||bn(n);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const s=n.createTracker(r);s.move(a+" ".repeat(o-a.length)),s.shift(o);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,s.current()),h);return l(),u;function h(c,p,f){return p?(f?"":" ".repeat(o))+c:(f?a:a+" ".repeat(o-a.length))+c}}function cc(e,t,n,r){const i=n.enter("paragraph"),a=n.enter("phrasing"),o=n.containerPhrasing(e,r);return a(),i(),o}const hc=Et(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function fc(e,t,n,r){return(e.children.some(function(o){return hc(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function pc(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=dc;function ui(e,t,n,r){const i=pc(n),a=n.enter("strong"),o=n.createTracker(r),s=o.move(i+i);let l=o.move(n.containerPhrasing(e,{after:i,before:s,...o.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),p=wt(r.after.charCodeAt(0),c,i);p.inside&&(l=l.slice(0,-1)+it(c));const f=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},s+l+f}function dc(e,t,n){return n.options.strong||"*"}function mc(e,t,n,r){return n.safe(e.value,r)}function gc(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 yc(e,t,n){const r=(li(n)+(n.options.ruleSpaces?" ":"")).repeat(gc(n));return n.options.ruleSpaces?r.slice(0,-1):r}const ci={blockquote:Bu,break:ur,code:Gu,definition:Zu,emphasis:ei,hardBreak:ur,heading:Ku,html:ti,image:ni,imageReference:ri,inlineCode:ii,link:ai,linkReference:si,list:sc,listItem:uc,paragraph:cc,root:fc,strong:ui,text:mc,thematicBreak:yc};function xc(){return{enter:{table:bc,tableData:cr,tableHeader:cr,tableRow:wc},exit:{codeText:vc,table:kc,tableData:qt,tableHeader:qt,tableRow:qt}}}function bc(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 kc(e){this.exit(e),this.data.inTable=void 0}function wc(e){this.enter({type:"tableRow",children:[]},e)}function qt(e){this.exit(e)}function cr(e){this.enter({type:"tableCell",children:[]},e)}function vc(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Cc));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Cc(e,t){return t==="|"?t:e}function Sc(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=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:p,table:o,tableCell:l,tableRow:s}};function o(f,m,w,v){return u(h(f,w,v),f.align)}function s(f,m,w,v){const b=c(f,w,v),S=u([b]);return S.slice(0,S.indexOf(`
|
|
29
|
+
`))}function l(f,m,w,v){const b=w.enter("tableCell"),S=w.enter("phrasing"),E=w.containerPhrasing(f,{...v,before:a,after:a});return S(),b(),E}function u(f,m){return Fu(f,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function h(f,m,w){const v=f.children;let b=-1;const S=[],E=m.enter("table");for(;++b<v.length;)S[b]=c(v[b],m,w);return E(),S}function c(f,m,w){const v=f.children;let b=-1;const S=[],E=m.enter("tableRow");for(;++b<v.length;)S[b]=l(v[b],f,m,w);return E(),S}function p(f,m,w){let v=ci.inlineCode(f,m,w);return w.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function Ec(){return{exit:{taskListCheckValueChecked:hr,taskListCheckValueUnchecked:hr,paragraph:Ac}}}function Tc(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Ic}}}function hr(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Ac(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 a=-1,o;for(;++a<i.length;){const s=i[a];if(s.type==="paragraph"){o=s;break}}o===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 Ic(e,t,n,r){const i=e.children[0],a=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);a&&s.move(o);let l=ci.listItem(e,t,n,{...r,...s.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(h){return h+o}}function Nc(){return[su(),Iu(),Lu(),xc(),Ec()]}function Dc(e){return{extensions:[lu(),Nu(e),zu(),Sc(e),Tc()]}}const Pc={tokenize:Oc,partial:!0},hi={tokenize:Fc,partial:!0},fi={tokenize:_c,partial:!0},pi={tokenize:Bc,partial:!0},Lc={tokenize:Hc,partial:!0},di={name:"wwwAutolink",tokenize:Rc,previous:gi},mi={name:"protocolAutolink",tokenize:Mc,previous:yi},Ie={name:"emailAutolink",tokenize:jc,previous:xi},Se={};function zc(){return{text:Se}}let Re=48;for(;Re<123;)Se[Re]=Ie,Re++,Re===58?Re=65:Re===91&&(Re=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 jc(e,t,n){const r=this;let i,a;return o;function o(c){return!tn(c)||!xi.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(Lc,h,u)(c):c===45||c===95||he(c)?(a=!0,e.consume(c),l):h(c)}function u(c){return e.consume(c),i=!0,l}function h(c){return a&&i&&pe(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function Rc(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!gi.call(r,r.previous)||kn(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Pc,e.attempt(hi,e.attempt(fi,a),n),n)(o))}function a(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function Mc(e,t,n){const r=this;let i="",a=!1;return o;function o(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(pe(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),s;if(c===58){const p=i.toLowerCase();if(p==="http"||p==="https")return e.consume(c),l}return n(c)}function l(c){return c===47?(e.consume(c),a?u:(a=!0,l)):n(c)}function u(c){return c===null||xt(c)||X(c)||Me(c)||vt(c)?n(c):e.attempt(hi,e.attempt(fi,h),n)(c)}function h(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function Oc(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),a):n(o)}function a(o){return o===null?n(o):t(o)}}function Fc(e,t,n){let r,i,a;return o;function o(u){return u===46||u===95?e.check(pi,l,s)(u):u===null||X(u)||Me(u)||u!==45&&vt(u)?l(u):(a=!0,e.consume(u),o)}function s(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),o}function l(u){return i||r||!a?n(u):t(u)}}function _c(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(pi,t,a)(o):o===null||X(o)||Me(o)?t(o):(e.consume(o),i)}function a(o){return o===41&&r++,e.consume(o),i}}function Bc(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),a):s===93?(e.consume(s),i):s===60||s===null||X(s)||Me(s)?t(s):n(s)}function i(s){return s===null||s===40||s===91||X(s)||Me(s)?t(s):r(s)}function a(s){return pe(s)?o(s):n(s)}function o(s){return s===59?(e.consume(s),r):pe(s)?(e.consume(s),o):n(s)}}function Hc(e,t,n){return r;function r(a){return e.consume(a),i}function i(a){return he(a)?n(a):t(a)}}function gi(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||X(e)}function yi(e){return!pe(e)}function xi(e){return!(e===47||tn(e))}function tn(e){return e===43||e===45||e===46||e===95||he(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 Uc={tokenize:Jc,partial:!0};function qc(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Yc,continuation:{tokenize:Zc},exit:Qc}},text:{91:{name:"gfmFootnoteCall",tokenize:Gc},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Wc,resolveTo:Vc}}}}function Wc(e,t,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=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(!o||!o._balanced)return n(l);const u=ve(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Vc(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 a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function Gc(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,o;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(a>999||c===93&&!o||c===null||c===91||X(c))return n(c);if(c===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return i.includes(ve(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return X(c)||(o=!0),a++,e.consume(c),c===92?h:u}function h(c){return c===91||c===92||c===93?(e.consume(c),a++,u):u(c)}}function Yc(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,o=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(o>999||m===93&&!s||m===null||m===91||X(m))return n(m);if(m===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return a=ve(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return X(m)||(s=!0),o++,e.consume(m),m===92?c:h}function c(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}function p(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(a)||i.push(a),G(e,f,"gfmFootnoteDefinitionWhitespace")):n(m)}function f(m){return t(m)}}function Zc(e,t,n){return e.check(st,t,e.attempt(Uc,t,n))}function Qc(e){e.exit("gfmFootnoteDefinition")}function Jc(e,t,n){const r=this;return G(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(a):n(a)}}function Xc(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,s){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let u=l;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[l][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},c={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},p=[["enter",h,s],["enter",o[u][1],s],["exit",o[u][1],s],["enter",c,s]],f=s.parser.constructs.insideSpan.null;f&&xe(p,p.length,0,Ct(f,o.slice(u+1,l),s)),xe(p,p.length,0,[["exit",c,s],["enter",o[l][1],s],["exit",o[l][1],s],["exit",h,s]]),xe(o,u-1,l-u+3,p),l=u+p.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function a(o,s,l){const u=this.previous,h=this.events;let c=0;return p;function p(m){return u===126&&h[h.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const w=Ve(u);if(m===126)return c>1?l(m):(o.consume(m),c++,f);if(c<2&&!n)return l(m);const v=o.exit("strikethroughSequenceTemporary"),b=Ve(m);return v._open=!b||b===2&&!!w,v._close=!w||w===2&&!!b,s(m)}}}class Kc{constructor(){this.map=[]}add(t,n,r){$c(this,t,n,r)}consume(t){if(this.map.sort(function(a,o){return a[0]-o[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 a of i)t.push(a);i=r.pop()}this.map.length=0}}function $c(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 eh(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 a=r.length-1;r[a]=r[a]==="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 th(){return{flow:{null:{name:"table",tokenize:nh,resolveAll:rh}}}}function nh(e,t,n){const r=this;let i=0,a=0,o;return s;function s(x){let T=r.events.length-1;for(;T>-1;){const z=r.events[T][1].type;if(z==="lineEnding"||z==="linePrefix")T--;else break}const j=T>-1?r.events[T][1].type:null,R=j==="tableHead"||j==="tableRow"?k:l;return R===k&&r.parser.lazy[r.now().line]?n(x):R(x)}function l(x){return e.enter("tableHead"),e.enter("tableRow"),u(x)}function u(x){return x===124||(o=!0,a+=1),h(x)}function h(x){return x===null?n(x):O(x)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),f):n(x):q(x)?G(e,h,"whitespace")(x):(a+=1,o&&(o=!1,i+=1),x===124?(e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),c(x)))}function c(x){return x===null||x===124||X(x)?(e.exit("data"),h(x)):(e.consume(x),x===92?p:c)}function p(x){return x===92||x===124?(e.consume(x),c):c(x)}function f(x){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(x):(e.enter("tableDelimiterRow"),o=!1,q(x)?G(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?(o=!0,e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),w):I(x)}function w(x){return q(x)?G(e,v,"whitespace")(x):v(x)}function v(x){return x===58?(a+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(x),e.exit("tableDelimiterMarker"),b):x===45?(a+=1,b(x)):x===null||O(x)?D(x):I(x)}function b(x){return x===45?(e.enter("tableDelimiterFiller"),S(x)):I(x)}function S(x){return x===45?(e.consume(x),S):x===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(x),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(x))}function E(x){return q(x)?G(e,D,"whitespace")(x):D(x)}function D(x){return x===124?m(x):x===null||O(x)?!o||i!==a?I(x):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(x)):I(x)}function I(x){return n(x)}function k(x){return e.enter("tableRow"),L(x)}function L(x){return x===124?(e.enter("tableCellDivider"),e.consume(x),e.exit("tableCellDivider"),L):x===null||O(x)?(e.exit("tableRow"),t(x)):q(x)?G(e,L,"whitespace")(x):(e.enter("data"),F(x))}function F(x){return x===null||x===124||X(x)?(e.exit("data"),L(x)):(e.consume(x),x===92?_:F)}function _(x){return x===92||x===124?(e.consume(x),F):F(x)}}function rh(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,l=0,u,h,c;const p=new Kc;for(;++n<e.length;){const f=e[n],m=f[1];f[0]==="enter"?m.type==="tableHead"?(s=!1,l!==0&&(fr(p,t,l,u,h),h=void 0,l=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,c=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,h={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.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,o[2]===0&&(a[1]!==0&&(o[0]=o[1],c=dt(p,t,a,i,void 0,c),a=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],c=dt(p,t,a,i,void 0,c)),a=o,o=[a[1],n,0,0])):m.type==="tableHead"?(s=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,a[1]!==0?(o[0]=o[1],c=dt(p,t,a,i,n,c)):o[1]!==0&&(c=dt(p,t,o,i,n,c)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&fr(p,t,l,u,h),p.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=eh(t.events,n))}return e}function dt(e,t,n,r,i,a){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(a.end=Object.assign({},Ue(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const l=Ue(t.events,n[1]);if(a={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const u=Ue(t.events,n[2]),h=Ue(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 p=t.events[n[2]],f=t.events[n[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,w=n[3]-n[2]-1;e.add(m,w,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(a.end=Object.assign({},Ue(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function fr(e,t,n,r,i){const a=[],o=Ue(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function Ue(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const ih={name:"tasklistCheck",tokenize:ah};function oh(){return{text:{91:ih}}}function ah(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"),a)}function a(l){return X(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(l)}function s(l){return O(l)?t(l):q(l)?e.check({tokenize:sh},t,n)(l):n(l)}}function sh(e,t,n){return G(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function lh(e){return Nr([zc(),qc(),Xc(e),th(),oh()])}const uh={};function ch(e){const t=this,n=e||uh,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(lh(n)),a.push(Nc()),o.push(Dc(n))}const bi="https://www.tiagpctest.softiabot.com",ki={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"},hh={MOBILE:640},De={theme:wi.AUTO,position:ki.BOTTOM_RIGHT,language:vi.ENGLISH,width:"400px",height:"600px",autoOpen:!1,showBranding:!0,mobileFullscreen:!0},fh={API_REQUEST:3e4},pr={MAX_LENGTH:2e3},ph=()=>window.innerWidth<hh.MOBILE,dh=e=>{try{return new Date(e).toLocaleTimeString("es-ES",{hour:"2-digit",minute:"2-digit"})}catch{return""}},mh=e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`,Wt=()=>crypto.randomUUID(),gh=()=>window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",yh=e=>e.trim().slice(0,2e3),xh=()=>{const{t:e}=ue.useTranslation();return y.jsxs("div",{className:"gpc-typing-indicator",role:"status","aria-label":e("ui.typingIndicator.typing"),children:[y.jsx("span",{className:"gpc-typing-dot"}),y.jsx("span",{className:"gpc-typing-dot"}),y.jsx("span",{className:"gpc-typing-dot"})]})},bh=({message:e,showMetadata:t=!1,messageRef:n=null})=>{const{t:r}=ue.useTranslation(),i=e.role==="user",a=!i&&e.isStreaming&&!e.content,[o,s]=A.useState(!1),l=async()=>{try{await navigator.clipboard.writeText(e.content),s(!0),setTimeout(()=>s(!1),2e3)}catch(u){console.error("Error al copiar:",u)}};return y.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:[y.jsx("div",{className:"gpc-message-content",children:a?y.jsx(xh,{}):i?e.content.trim():y.jsx(Xl,{remarkPlugins:[ch],components:{a:({node:u,...h})=>y.jsx("a",{target:"_blank",rel:"noopener noreferrer",...h}),table:({node:u,...h})=>y.jsx("div",{className:"gpc-table-wrapper",children:y.jsx("table",{className:"gpc-table",...h})}),thead:({node:u,...h})=>y.jsx("thead",{className:"gpc-table-head",...h}),tbody:({node:u,...h})=>y.jsx("tbody",{className:"gpc-table-body",...h}),tr:({node:u,...h})=>y.jsx("tr",{className:"gpc-table-row",...h}),th:({node:u,...h})=>y.jsx("th",{className:"gpc-table-header",...h}),td:({node:u,...h})=>y.jsx("td",{className:"gpc-table-cell",...h})},children:e.content})}),y.jsxs("div",{className:`gpc-message-timestamp ${i?"gpc-message-timestamp-user":""}`,children:[!i&&e.metadata?.modelUsed&&y.jsx("span",{className:"gpc-model-badge",children:e.metadata.modelUsed}),y.jsxs("span",{className:"gpc-timestamp-right",children:[y.jsx("span",{children:dh(e.timestamp)}),!a&&e.content&&y.jsx("button",{onClick:l,className:"gpc-copy-button","aria-label":o?"Copiado":"Copiar mensaje",children:o?y.jsx(oe.Check,{size:14}):y.jsx(oe.Copy,{size:14})})]})]}),!i&&t&&e.metadata&&y.jsxs("div",{className:"gpc-message-metadata",children:[e.metadata.tokensUsed&&y.jsxs("div",{className:"gpc-metadata-item",children:[y.jsxs("strong",{children:[r("metadata.tokensUsed"),":"]})," ",e.metadata.tokensUsed]}),e.metadata.responseTimeMs&&y.jsxs("div",{className:"gpc-metadata-item",children:[y.jsxs("strong",{children:[r("metadata.responseTime"),":"]})," ",mh(e.metadata.responseTimeMs)]}),e.metadata.modelUsed&&y.jsxs("div",{className:"gpc-metadata-item",children:[y.jsxs("strong",{children:[r("metadata.model"),":"]})," ",e.metadata.modelUsed]})]})]})},kh=({messages:e,isLoading:t,showMetadata:n=!1,widgetConfig:r=null,hasMoreMessages:i=!1,isLoadingMoreMessages:a=!1,onLoadMoreMessages:o=null})=>{const{t:s}=ue.useTranslation(),l=A.useRef(null),u=A.useRef(null),h=A.useRef(0),c=A.useRef(!1),p=A.useRef(null),f=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(!o)return;const D=new IntersectionObserver(I=>{I[0].isIntersecting&&i&&!a&&(p.current&&(m.current=p.current.scrollHeight),o())},{threshold:1});return f.current&&D.observe(f.current),()=>{f.current&&D.unobserve(f.current)}},[i,a,o]),A.useEffect(()=>{if(a===!1&&m.current>0&&p.current){const I=p.current.scrollHeight-m.current;p.current.scrollTop=I,m.current=0}},[a]),A.useEffect(()=>{const D=e.length,I=h.current,k=e[D-1],L=D>I+1;D>0&&c.current&&(L?setTimeout(()=>{l.current?.scrollIntoView({behavior:"instant"})},150):D>I&&k&&(k.role==="user"?l.current?.scrollIntoView({behavior:"smooth"}):k.role==="assistant"&&k.isStreaming&&setTimeout(()=>{u.current?.scrollIntoView({behavior:"smooth",block:"start"})},100))),h.current=D},[e]);const w=r?.widget_customization?.branding?.company_name||"TIA GPC",v=r?.widget_customization?.branding?.company_logo_base64,b=r?.widget_customization?.welcome_message,S=v?.startsWith("data:")?v:v?`data:image/png;base64,${v}`:null,E=b||s("chat.welcome",{companyName:w});return e.length===0&&!t?y.jsx("div",{className:"gpc-messages-container",children:y.jsxs("div",{className:"gpc-empty-state",children:[S?y.jsx("div",{className:"gpc-welcome-logo",children:y.jsx("img",{src:S,alt:w,className:"gpc-welcome-company-logo"})}):y.jsx(oe.MessageSquare,{className:"gpc-empty-icon"}),y.jsx("h3",{className:"gpc-empty-title",children:E}),y.jsx("p",{className:"gpc-empty-text",children:s("chat.emptyState")})]})}):y.jsxs("div",{ref:p,className:"gpc-messages-container gpc-scrollbar gpc-smooth-scroll",children:[i&&y.jsx("div",{style:{textAlign:"center",padding:"10px"},children:a?y.jsxs("div",{className:"gpc-loading-more-messages",children:[y.jsx("div",{className:"gpc-loading-spinner"}),y.jsx("span",{children:s("chat.loadingMore","Loading older messages...")})]}):y.jsx("div",{ref:f,style:{height:"1px"}})}),e.map((D,I)=>y.jsx(bh,{message:D,showMetadata:n,messageRef:I===e.length-1?u:null},D.id)),y.jsx("div",{ref:l})]})},wh=1.2,vh=2e3,Ch=({onTranscript:e,isLoading:t,disabled:n,onRecordingStateChange:r,onAnalyserChange:i})=>{const{t:a}=ue.useTranslation(),[o,s]=A.useState(!1),[l,u]=A.useState(!1),h=A.useRef(null),c=A.useRef([]),p=A.useRef(null),f=A.useRef(null),m=A.useRef(null),w=A.useRef(null),v=A.useRef(null);A.useEffect(()=>()=>{h.current?.state==="recording"&&h.current.stop(),p.current&&p.current.state!=="closed"&&p.current.close(),v.current&&clearInterval(v.current)},[]),A.useEffect(()=>{r&&r(o||l)},[o,l,r]),A.useEffect(()=>{i&&i(f.current)},[f.current,i]);const b=()=>{if(!f.current||!m.current)return;f.current.getByteTimeDomainData(m.current);let L=0;for(let x=0;x<m.current.length;x++){const T=(m.current[x]-128)/128;L+=T*T}if(Math.sqrt(L/m.current.length)*100<wh){if(w.current||(w.current=Date.now()),Date.now()-w.current>vh){E();return}}else w.current=null},S=async()=>{try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){alert(a("voice.unsupported"));return}const L=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:48e3,channelCount:1}});p.current=new(window.AudioContext||window.webkitAudioContext),f.current=p.current.createAnalyser(),p.current.createMediaStreamSource(L).connect(f.current),f.current.fftSize=1024,f.current.smoothingTimeConstant=.4,f.current.minDecibels=-85,f.current.maxDecibels=-15;const _=f.current.frequencyBinCount;m.current=new Uint8Array(_);const x=new MediaRecorder(L,{mimeType:"audio/webm;codecs=opus"});h.current=x,c.current=[],w.current=null,x.ondataavailable=T=>{T.data.size>0&&c.current.push(T.data)},x.onstop=async()=>{if(v.current&&(clearInterval(v.current),v.current=null),p.current&&p.current.state!=="closed"&&p.current.close(),w.current=null,c.current.length===0){console.warn("No audio data recorded");return}const T=new Blob(c.current,{type:"audio/webm"});u(!0);try{await e(T)}catch(j){console.error("Transcription error:",j),alert(a("voice.error"))}finally{u(!1),c.current=[]}},x.start(100),s(!0),v.current=setInterval(()=>{b()},100)}catch(L){console.error("Error accessing microphone:",L),L.name==="NotAllowedError"||L.name==="PermissionDeniedError"?alert(a("voice.permissionDenied")):alert(a("voice.unsupported"))}},E=()=>{!o&&h.current?.state!=="recording"||(h.current&&h.current.state==="recording"&&h.current.stop(),v.current&&(clearInterval(v.current),v.current=null),w.current=null,s(!1),h.current&&h.current.stream&&h.current.stream.getTracks().forEach(L=>L.stop()))},D=L=>{L.preventDefault(),L.stopPropagation(),o?E():S()},I=n||t||l,k=a(l?"voice.processing":o?"voice.stop":"voice.record");return y.jsx("button",{type:"button",onClick:D,disabled:I,className:`gpc-voice-button ${o?"gpc-voice-recording":""}`,"aria-label":k,title:k,children:l?y.jsx("span",{className:"gpc-spinner"}):o?y.jsx(oe.MicOff,{className:"gpc-icon gpc-voice-icon-active"}):y.jsx(oe.Mic,{className:"gpc-icon"})})},Sh=({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,a=i.getContext("2d"),o=e.frequencyBinCount,s=new Uint8Array(o),l=window.devicePixelRatio||1,u=i.getBoundingClientRect();i.width=u.width*l,i.height=u.height*l,a.scale(l,l);const h=u.width,c=u.height,p=40,f=3,m=2,w=()=>{if(!t)return;r.current=requestAnimationFrame(w),e.getByteFrequencyData(s),a.clearRect(0,0,h,c);const v=p*(f+m),b=(h-v)/2;for(let S=0;S<p;S++){const E=Math.floor(S*o/p),I=s[E]/255,k=Math.max(2,I*c*.8),L=b+S*(f+m),F=(c-k)/2,_=a.createLinearGradient(0,F,0,F+k);_.addColorStop(0,"rgba(59, 130, 246, 0.8)"),_.addColorStop(1,"rgba(96, 165, 250, 0.6)"),a.fillStyle=_,a.fillRect(L,F,f,k)}};return w(),()=>{r.current&&cancelAnimationFrame(r.current)}},[e,t]),t?y.jsx("div",{className:"gpc-audio-waveform-container",children:y.jsx("canvas",{ref:n,className:"gpc-audio-waveform-canvas","aria-label":"Audio waveform visualization"})}):null},Eh=({onSendMessage:e,isLoading:t,disabled:n,gpcService:r,showBranding:i=!0})=>{const{t:a}=ue.useTranslation(),[o,s]=A.useState(""),[l,u]=A.useState(!1),[h,c]=A.useState(null),p=A.useRef(null);A.useEffect(()=>{!n&&!t&&!l&&p.current?.focus()},[n,t,l]),A.useEffect(()=>{p.current&&(p.current.style.height="auto",p.current.style.height=`${Math.min(p.current.scrollHeight,120)}px`)},[o]);const f=async I=>{I.preventDefault();const k=yh(o);if(!(!k||t||n||l))try{await e(k),s(""),p.current&&(p.current.style.height="auto")}catch(L){console.error("Error sending message:",L)}},m=I=>{I.key==="Enter"&&!I.shiftKey&&!l&&(I.preventDefault(),f(I))},w=async I=>{if(!r)throw new Error(a("toast.gpcServiceNotAvailable"));const k=await r.transcribeAudio(I);k.success&&k.text&&(s(k.text),p.current?.focus())},v=I=>{u(I)},b=I=>{c(I)},S=o.trim().length>0&&!t&&!n&&!l,E=t||n||l,D=n||o.trim().length>0;return y.jsxs("form",{onSubmit:f,className:"gpc-input-container",children:[y.jsxs("div",{className:"gpc-input-wrapper",children:[y.jsx("textarea",{ref:p,value:o,onChange:I=>s(I.target.value),onKeyDown:m,placeholder:l?"":a("chat.placeholder"),disabled:E,maxLength:pr.MAX_LENGTH,className:`gpc-input gpc-textarea ${l?"gpc-input-recording":""}`,"aria-label":a("chat.placeholder"),"aria-describedby":"chat-input-help",rows:1}),y.jsx(Sh,{analyser:h,isRecording:l})]}),y.jsxs("div",{className:"gpc-input-actions-right",children:[y.jsx(Ch,{onTranscript:w,isLoading:t,disabled:D,onRecordingStateChange:v,onAnalyserChange:b}),y.jsx("button",{type:"submit",disabled:!S,className:"gpc-send-button","aria-label":a("chat.send"),title:a("chat.send"),children:t?y.jsx("span",{className:"gpc-spinner"}):y.jsx(oe.Send,{className:"gpc-icon"})})]}),y.jsxs("div",{className:"gpc-footer-container",children:[y.jsx("span",{className:"gpc-ai-disclaimer",children:a("chat.aiDisclaimer")}),i&&y.jsx("span",{className:"gpc-powered-by",children:a("widget.poweredBy")})]}),y.jsxs("span",{id:"chat-input-help",className:"gpc-sr-only",children:[a("chat.placeholder"),"."," ",a("input.maxCharacters",{count:pr.MAX_LENGTH})]})]})},Th=({isOpen:e,onClose:t,onConfirm:n,message:r,confirmText:i,cancelText:a,variant:o="danger"})=>{const{t:s}=ue.useTranslation();if(!e)return null;const l=h=>{h.preventDefault(),h.stopPropagation(),n(),t()},u=h=>{h.preventDefault(),h.stopPropagation(),t()};return y.jsx("div",{className:"gpc-confirm-toast-container gpc-animate-slide-down",children:y.jsxs("div",{className:`gpc-confirm-toast ${o==="danger"?"gpc-confirm-toast-danger":""}`,children:[y.jsx("p",{className:"gpc-confirm-toast-message",children:r}),y.jsxs("div",{className:"gpc-confirm-toast-actions",children:[y.jsx("button",{type:"button",onClick:u,className:"gpc-confirm-toast-button gpc-confirm-toast-button-cancel gpc-focus-visible gpc-transition",children:a||s("conversations.cancel","Cancel")}),y.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")})]})]})})},Ah=({conversations:e,totalConversations:t,currentConversationId:n,onSelectConversation:r,onNewConversation:i,onRenameConversation:a,onDeleteConversation:o,isLoadingHistory:s,hasMoreConversations:l,isLoadingMoreConversations:u,onLoadMore:h})=>{const{t:c}=ue.useTranslation(),p=A.useRef(null),[f,m]=A.useState(null),[w,v]=A.useState(""),[b,S]=A.useState({isOpen:!1,id:null,title:""});A.useEffect(()=>{const x=new IntersectionObserver(T=>{T[0].isIntersecting&&l&&!u&&!s&&h()},{threshold:1});return p.current&&x.observe(p.current),()=>{p.current&&x.unobserve(p.current)}},[l,u,s,h]);const E=x=>{const T=new Date(x),R=new Date-T,z=Math.floor(R/6e4),M=Math.floor(R/36e5),Y=Math.floor(R/864e5);return z<1?c("time.justNow","Just now"):z<60?c("time.minutesAgo",`${z} min ago`,{count:z}):M<24?c("time.hoursAgo",`${M}h ago`,{count:M}):Y<7?c("time.daysAgo",`${Y}d ago`,{count:Y}):T.toLocaleDateString()},D=x=>{m(x.conversation_id),v(x.title||"")},I=()=>{m(null),v("")},k=x=>{w.trim()&&a&&(a(x,w.trim()),m(null),v(""))},L=(x,T)=>{S({isOpen:!0,id:x,title:T||c("conversations.untitled","Untitled conversation")})},F=()=>{b.id&&o&&o(b.id),S({isOpen:!1,id:null,title:""})},_=()=>{S({isOpen:!1,id:null,title:""})};return y.jsxs("div",{className:"gpc-conversations-container",children:[y.jsxs("div",{className:"gpc-conversations-header",children:[y.jsx("h3",{className:"gpc-conversations-title",children:c("conversations.title","Conversations")}),y.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:[y.jsx(oe.MessageSquare,{size:16}),y.jsx("span",{children:c("conversations.new","New")})]})]}),y.jsx("div",{className:"gpc-conversations-list",children:e.length===0?y.jsxs("div",{className:"gpc-conversations-empty",children:[y.jsx(oe.MessageSquare,{size:48,className:"gpc-conversations-empty-icon"}),y.jsx("p",{className:"gpc-conversations-empty-text",children:c("conversations.empty","No conversations yet")}),y.jsx("p",{className:"gpc-conversations-empty-hint",children:c("conversations.emptyHint","Start a conversation to see it here")})]}):y.jsxs("div",{className:"gpc-conversations-items",children:[e.map(x=>y.jsx("div",{className:`gpc-conversation-item gpc-animate-fade-in ${n===x.conversation_id?"gpc-conversation-item-active":""} ${s?"gpc-conversation-item-disabled":""}`,children:y.jsx("div",{className:"gpc-conversation-content gpc-transition",onClick:()=>f!==x.conversation_id&&!s&&r(x.conversation_id),children:f===x.conversation_id?y.jsxs("div",{className:"gpc-conversation-edit",children:[y.jsx("input",{type:"text",value:w,onChange:T=>v(T.target.value),onKeyDown:T=>{T.key==="Enter"&&k(x.conversation_id),T.key==="Escape"&&I()},className:"gpc-conversation-edit-input gpc-focus-visible",placeholder:c("conversations.untitled","Untitled conversation"),autoFocus:!0,maxLength:200}),y.jsxs("div",{className:"gpc-conversation-edit-actions",children:[y.jsx("button",{type:"button",onClick:T=>{T.preventDefault(),T.stopPropagation(),k(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:y.jsx(oe.Check,{size:16})}),y.jsx("button",{type:"button",onClick:T=>{T.preventDefault(),T.stopPropagation(),I()},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:y.jsx(oe.X,{size:16})})]})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"gpc-conversation-header",children:[y.jsx("h4",{className:"gpc-conversation-title",children:x.title||c("conversations.untitled","Untitled conversation")}),y.jsxs("div",{className:"gpc-conversation-actions",children:[y.jsx("button",{type:"button",onClick:T=>{T.preventDefault(),T.stopPropagation(),D(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:y.jsx(oe.Pencil,{size:16})}),y.jsx("button",{type:"button",onClick:T=>{T.preventDefault(),T.stopPropagation(),L(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:y.jsx(oe.Trash2,{size:16})})]})]}),y.jsxs("div",{className:"gpc-conversation-metadata",children:[y.jsxs("div",{className:"gpc-conversation-meta-item",children:[y.jsx(oe.MessageSquare,{size:12}),y.jsx("span",{children:x.total_messages})]}),y.jsxs("div",{className:"gpc-conversation-meta-item",children:[y.jsx(oe.Clock,{size:12}),y.jsx("span",{children:E(x.last_modification_date)})]})]})]})})},x.conversation_id)),u&&y.jsxs("div",{className:"gpc-conversations-loading",children:[y.jsx("div",{className:"gpc-loading-spinner"}),y.jsx("span",{children:c("conversations.loadingMore","Loading more...")})]}),l&&!u&&y.jsx("div",{ref:p,style:{height:"1px"}})]})}),y.jsx(Th,{isOpen:b.isOpen,onClose:_,onConfirm:F,message:c("conversations.confirmDelete",{title:b.title,defaultValue:`Delete "${b.title}"?`}),confirmText:c("conversations.delete","Delete"),cancelText:c("conversations.cancel","Cancel"),variant:"danger"})]})},Ih="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOsAAADJCAYAAADCbsXoAAABN2lDQ1BBZG9iZSBSR0IgKDE5OTgpAAAokZWPv0rDUBSHvxtFxaFWCOLgcCdRUGzVwYxJW4ogWKtDkq1JQ5ViEm6uf/oQjm4dXNx9AidHwUHxCXwDxamDQ4QMBYvf9J3fORzOAaNi152GUYbzWKt205Gu58vZF2aYAoBOmKV2q3UAECdxxBjf7wiA10277jTG+38yH6ZKAyNguxtlIYgK0L/SqQYxBMygn2oQD4CpTto1EE9AqZf7G1AKcv8ASsr1fBBfgNlzPR+MOcAMcl8BTB1da4Bakg7UWe9Uy6plWdLuJkEkjweZjs4zuR+HiUoT1dFRF8jvA2AxH2w3HblWtay99X/+PRHX82Vun0cIQCw9F1lBeKEuf1UYO5PrYsdwGQ7vYXpUZLs3cLcBC7dFtlqF8hY8Dn8AwMZP/fNTP8gAAAAJcEhZcwAACxMAAAsTAQCanBgAAAa9aVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA2LjAtYzAwNSA3OS4xNjQ1OTAsIDIwMjAvMTIvMDktMTE6NTc6NDQgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi4xIChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjUtMDctMDlUMTg6Mzc6MjAtMDU6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDI1LTA3LTEwVDE3OjA4OjU3LTA1OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDI1LTA3LTEwVDE3OjA4OjU3LTA1OjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgcGhvdG9zaG9wOklDQ1Byb2ZpbGU9IkFkb2JlIFJHQiAoMTk5OCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OGNiZjk1NDQtOTNkOC0xZTQzLWJkYTItYzFmNTc2NjA3NGNjIiB4bXBNTTpEb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6OTU2MTBmYjUtNTU3NS1mNTQ1LWFmOGEtZDM0YTlmMjI4NTUwIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6NGEzMmM4MDMtZDA2YS0yYjRiLWI1YzEtZDA1ZWQ3MzFhYTlkIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo0YTMyYzgwMy1kMDZhLTJiNGItYjVjMS1kMDVlZDczMWFhOWQiIHN0RXZ0OndoZW49IjIwMjUtMDctMDlUMTg6Mzc6MjAtMDU6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyMi4xIChXaW5kb3dzKSIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MjE0MzlhOTgtOWNkNS1lYzRjLWFhNjAtZjgxNGNmZWVlNmNkIiBzdEV2dDp3aGVuPSIyMDI1LTA3LTA5VDE4OjU0OjE4LTA1OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjIuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjhjYmY5NTQ0LTkzZDgtMWU0My1iZGEyLWMxZjU3NjYwNzRjYyIgc3RFdnQ6d2hlbj0iMjAyNS0wNy0xMFQxNzowODo1Ny0wNTowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDIyLjEgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pl30aR8AACBpSURBVHic7Z15mBbFncc/PcAMYETkBtGAGiUGYhYliGFXJBoP1HCpicEQnNkY8TZq4nqFGI0RXaMoxuwMLEI8UMQo4hHvIISorBtYj6CAyn2M3McMTO8f9b5Md7/Vx/u+XX28b32e533e7urqX/3q+PZR3V1lmKaJRqNJPhVxO6DRaIKhxarRpISWYRozDjsvTHPlTgXQA+gF9M78OgEdM79OwMFAa6BNZp+DMvs1AVsyYbuA3cCXwEZgk+W3DFgOrABWZ/bThID5+czQbYYqVk1BGAghfhPoZ/nvDVQWaLMCIWQs/340IIS7GPhH5n8xQtC6YyMBaLFGTxtgAPCvwKDMr0OsHgkqgaMzv9GW8HpgQeb3V+AdxNlaEzFarNHQDzgdOAshzlbxupMXHYBhmR9AI0K4czO/xTH5VXYYYT660fes+2kJDEWcoc4AesbrjlJWAi8As4BXgb3xupMM9D1rsmkBDAHOBUYhOoDKgZ7Av2d+G4GngZnAG8C++NwqPbRYi+cw4CJgXGa5nOkE/DTz+wKYCtQBn8fpVKmgn7MWRgUwAnHPthy4FS1UJ4cCtyDKZy6ivHR7KwJdePnRFrgE+BhxuXcGugz9qECU09OIcrsEUY6aPNENLRgdgAnAZ8Bk4Mh43UktRyLK7zNEeSbhkVVq0GL15iDEJe4yxCVduXQaqaYTojyXAb9ClLPGBy1WOW2AX6Ibk2qsB8MbaH5tUiNBi9WOAfwQ+Aj4LfoyLSo6AHcgyv2HiHrQONBibeYEYD7wKLpnNy4OQ5T/fER9aCxosUJ74GF0A0kS2QPnHxH1o0GLdQTwf4iH+PrSK1kYiLei/g8YGbMviaBcxdoV8S7r04hvRjXJpQeirmYh6q1sKUexnon4XlMfrdPFSES9DfOLWKqUk1jbAA8Ac4AuMfuiKYwuwHOIeiy7xzzlItY+wLvApeh707RjIOrxXUS9lg3lINZRwN+BY+J2RBMqxyDqdVTcjkRFKYu1BXAn8CRwYMy+aNRwIKJ+70LUd0lTqmI9CPFZ1i/Ql72ljgFchxitoqRfCy1FsR4GzAO+F7cjmkg5FVHvJfv2WamJ9Tjgb0DfuB3RxEJfYCGiHZQcpSTW7wFvAt3jdkQTK90Q7aDkrqxKRazDEc/fDojZD00yOADRHobH7EeolIJYL0D0CBY6er2mNKlEtIsL4nYkLNI+umE14ouZaLrtu53BoNPGMeFcGHgUtGsdSaqRs2wtHHFiDezdGrcrxdISeATxtlNdzL4UTZrF+hPEJ1Tqrw46D+HpyeMZMVB5Song8G6wfGEtvQeWhGBbINrJPuC/43WlONIq1vOAWqIQ6qDHMJ8o+eftOfTqDCvfqaXngJIQbAWivewCnojZl4JJo1hPB6YTxaWvQ6gfroJj/v1TWHo/7FmjPPm4mP7oTMYMhkM6QudTa9nwQklMi9ICcUm8BXgxZl8KIm0dTAMQ3zWq70zqdoZNqKffDsd8ZwwsuaGkhQqwalPz8vqH4Wsjw5+3JSYqEe0nlTc0aRJrT8TH4pEMEP36tHH7l8++C156+Dxoaogi6dhZ57jq/efv4bgLSkawbYGnSOFkYWkRa/Zd32gKuOf5DPm6WPxwFcyZPCaSZJPC2i9zw969EwaNLRnB9kS0p1S9S5wGsbZAHAn7RZXgqcOav7o65mfryuaMmmXFBnn4/NvgtItLRrD9EO0qNb2HaRDrHcApUSZ43dmWlaUTo0w6EWzc5r7txRvh/KtmQkVJvINyCqJ9pYKki3UU4vOnSBlwhGVl99qok48d2WWwlcevgZ9cN6NUBHsdKfmAPcli/Tpifs/Iv0dtb33DuMwugQG27Wi0re9pzI0z9VIYf0tJCNYApiDaW6JJqljbIO4n9AgPcbDTPvfxouVgnPlpTrQHL4Jf3F4Sgm2HaG+JHoQtqWKdiB4zKT4a6m2r3Q8GltyAcdo/ME3Ttu3OH8GEu2dARVWEDirhGES7SyxJFOtZwPi4nShrTPt1b9fsA44Pf0PFKX/PEewto+HeB6aXgmDHI9pfIkmaWLsi3uHU4ybFyS77G1ptrFe5S++h4rtv5Aj2qrPgwYdTL1gD0f66xe2IjKSJdTJlPkVCImjcnhtmFeEnD1Ex5KWcjqfxp8G0adOhRaq7GroCD8bthIwkiXUkekqLZLBP8qDVcHQiLZ9C65Nm5Qj2xyfBU4/WQct26vxTTyLbYlLE2h6YFLcTmgx7JWdWQ3JnsvIJWp84ja277cGjBsHTj9WmXbCTSNh0k0kR6+/Qs7klB9mz5cr28rjrnueg7zycI9gRA+H5p2qhqlPo7kVED8Tg4YkhCWI9ATEPpyYpyD429+o42vAqB534ABs224PP7A+vzZ4MVanthqghQRNsxy3WCsTlhu79TRL79uSGtfQZOHLjW3Q5+V7W2B/RcnJfmP/8JKhK5QixBqJ9xq0TIH4nxgLHx+yDJod9uUEtArzcs2kBPYbcaft4HWDQUfDey/dB21QOln88op3GTpxibQv8Jsb0NW7slZxZgz4/3byIniffkfOZXf/esPiVu6Ftr6Ldi4HfENGgB17EKdYr0Z1KycQs8uOFze/T+6SbcwTbtyd89Ppd8JWvFWc/enog2musxCXWdsC1MaWtKYSqPI+r2z+m90k38rFjuKqju8PyN2+HdqmbjuhaYh5ZIi6xXg10iCltjS+mf5QgbF9Kn5OvZ9Fye3CvzrDyzVugff9w0omGDsBVcToQh1g7IMSqSSphfsO7cwXHnXEtC/5pDz6kI6x/65fQIVUDDcZ6kolDrFeRsoGqNECbIh697PycE4ddyRsf2oM7t4f1b/wcOg4qyrUIOYgYz67qxWr/MPkrwKUB4+aGuS0X6k+YH01XVDbbC2I3n/he5RLERjatPPLrfMHBNw3Zdqtve9Zw8jmX8/oSe5TO7eHLeVdD5++62/fzPd96lLUBtzRy83QZoh0XlnYRhC9Wa8OoqHReUo0DOuQUjLPhyvZ3FkpTQ24BByl45yWeX2P3smndZvUz65tsfy+fvfxx7pdNw/rvjJuN39TgfmnrcvDaIRnKRbqPjx2br41fMnTEeOYusm9ufwBsefti6Hxqrk1n2QY5KMmWnf545cfZ/uzrBwMX2cpWtp8CwhWrszFZwyoqK6iovMKWSWuBOBuUsxCcFSYrLGt6zkKWiSbovZnVRz+xOf122+aWT+e/TIjWf6sNN0G7+Wxd9zowArTtnruPmy0n1rDGrQw7fzyzFtijtGsNO98eCz3Pz61fZ/m51aszvXwOmrK8W/e32q6ovByo8DwgKEDdZXBu4Z0NHOm6PegZR5aO11kviI9eZ09nOn72/WwECfOL41d2QdJzK7NMWL3kwxtp2kHScdK4ldE/qmHGPHtwm0rY/eYo6Hmed3pByadN5Fc3RyLac2F+FUiUHUw/jTAtTZGsdgxHWhH2q4JNu7nwxzXUvWYPrmoFu18/B3rVhJte+ETenqMS62GI2d80KWHhx/b14d9WkEjTbmqqq5n8kj24qhU0vX4SHHG5gkRD43Tgq1EmGJVYL4owLU0I/Pdf7ev3/BiUfBxl7uHSn1Xzuz/bgw3DoOmVb8PR14efZjhUIDpMI00wijQuiiAdTYisfGeabb1XZ2h30nRl6f3y2vE8Pt8eZhgG5kvfhH53KEu3SC4iwrlyophMeQhwaATpaMJkwyssWj6W/r2bg7ZMg7GTZ/DI0++I4UqrukKLKiraisn9DusMrVrCIe3Fpezh3aCqBfToKDqPenUWR+4jukMrQ7zFVNXK3xXzucMwht8L7yfuxbdDEe371SgSM5xDShZlrJd0asQ/ABeHlkgEmCtm7F92yVN5cMTlmK8m53XAftfBkicTVx//haSzydqGwkL1ZXBLUjLpj0bCp5M46Za4nWhm8UQYeEH4IiiSEUCA64PiUS3WoUBqR8zSwFuPjKHF+fLJqeLgb3dAr7MSJdhOiHauHNX3rOcqtq+JgKaFY2h97FfpOeR27h8L3z1WhG/cDJt3iSkid+2BNVthx25YtxW27sj8b4d1W8Tri2s3w959+2DnGmjcAY2bYd8uaNgETXtgzzphuHGbWG/cDjSKkSvMBswVooPrxRuhz5wYCsKd0cBLvrGKRKVYDeBMhfY1UbLzM1bOHcPIuXE7Ij5gTxjnIPplmlQmovIyuC962BZNedAFGKA6EZViHabQtkaTNE71j1IcKsX6PYW2NZqkoby9qxJrG+A7imxrNElkIIqHK1Ul1gFANN8NaTTJoBLFA9arEqs+q2rKkcEqjWuxajThobTdq3g32AA2krRxgVu1gz7/wdXn9eSMY2HgUWIoEU36MU2T/1lhMHM+/O7xlfDRHdAomQlPPfWIN5pMFe8GqxBrb2BZaEaLxoB+d7N6Wle6J+vwoVHEmnroMXYdLL6W0AYsD87hwPK0vMj/TQU2C6OiNRPuno75nBZqOdG9A5jPdWXC3dOhIvLLp2+pMqxCrMcqsJk/RhW1tbXcMjpuRzRxcctoqK2tBSPgDHjh0E+V4ZDfDTYAs599+A+vyxDDEscIENeUrMvSMvi3C+uo9vgWYutu8SK6jMO7NS8vW+vhkiZS3OqlU3v3/ofqofDIhXW89Uj2O1hru3G2pyzO7X7bbGHKxKrgntX4EOjTHGoVlDVTTrG5CQ9HuCyuY1uP0Zjzh+ds2bAZuozbCUtugMZ6+z6WtLJfdzTnyeqHWx68fILgDUS27tdo/ML96gCXZb9yl+XFbT9nPDd/3crRdAwKcKF9c6sOcOztrK/9Cp3b5+5tnPgMrJ4ltZvrl1d5y7bbfP8IzK+n4J7VaAkc4QiTLDv/ncvZdUMSLotr3/bUPcNzQj9eA10G/xr+52Jo3JSzj3da1m1+/+5+eaflte4VP0i4Xx24LTsJUkdBytDLX7dy9Cnfxnp49xK6DP51zjSTgLRN2H0LEua23eb7ERkdhE7Y96yHEtFX864c3J9RjnmOTNOkz/enwvalmRA/YWlSy/al9DnrYZxXjKMGAQdHMsVkK8TQu6ETtlgPD9le3nQ6LndQrcumGrD+NUlsTUmyaZ6ocwedvx3ZgGtKdBC2WJUcUfLh2rNzwyZPeTZ6RzSxMrn2mZywn0c3FIKS0TzDvrbuGbK9vDlH9ir1ur9E7ocVa4eVKmr+AHV3ik6X2inTbT3hfa6Ej/98ocue7tz02+nc9sPm9UXL4biT87cTCxteBobbgs45Hn4ZTepKdBD2mbVjyPbypldn+/quBsRYP5r8aN3VJlSA/r2hzWD1B55QaNzG1t32oMO7RJa6kkECwxZrZ/8oamnj+DBv3ZZ4/Eg7R592tzR8UormVqjfZl8PMqB4SKRCrHrY0RLh0avk4dVDgR7DI/QklSjRQdj3rLFfBieRnAf4LrQZPJ2djmfpQfcNlSOvsE2bUfcatnvg6h+Pou7OZyJ3K0UoeRM97DOrfl2+BLip2j5QX80d79jWJ5wLtO4aoUepQ8lJK2yxHhCyPU3UODqWVm0CPrmfmx9rDjuko/s9bZJoFd8ko0pmlgs7O5F+3hCEGCssb1pGNnmgO33Ptovw1ifF/2+e2GALd7unTRKNSofc9qSdCqNhN+UDQ7anCYFWeQxdN228fb3uxYxI379GnGUz9O8NfOs/i/ZNJTEeqJW8zxp2dlJ0HtPk4OhYWrQceP+a/evj/mCPXntF7E/qkoqS20EtLs1+nB1LYyfbt//l+Wds69VDierl+LSRiq9uNGmldfecN5aWvHKvPWD1LOYusgedOjqyl+PTxF4VRsMWa3y39Jqi6Hv2Xbb1uteALxflxPvBffb1aZcArZM3rVvM7FBhNGyxbvOPokkizo6lmvs3SONtW3g9ayyDbHTvAAcOvEsat4xRMqRi2GLdA4Dh0v3oDM+uu4W74be9GIq17ZanMNLzKyejMr90s3EdHUtr6rF1LNn22b2Gm2fagx+/MliS+21Y/4PGz5dC9vPaJz+/lQxaHLZYm0//1sxll80G+7YsznC3eFlb1u1BG6hXQ7f6mrXtFc+Zttv+sjhePrn57dzfWQ5WW07/ndsltib8zN6x9L3fusTP2K57yv5G05n9gSOv8C8fpy8yf7zy7JUfv7J2EsQ/2XazIbfOc+Pv83cgf8IVq1FZLy1gawadRyhZuNe6dd+sbWs8uV/etp1x3HA7iGTDnBUpi+MlPr90nWkHadRWG7JtVR1zhmvd37Hkltanf8jpaLqpekBu/mUHrnzy4rThRNYO/JD5YbVlrUe3PLj534xzkK9QCPvMKncyyJEuX4KIK8y0ghy1VfkShl0XG9KOpc1LfM394jH7+m0/JPcxTqFXE874Qc+U+doNsq2wsq/3j5I/YT8P2hiyPY1inB1L1UOhenldQbb6nnI1S56qDsGr1KNEB2GfWeVdiJpk8rXLbR1LxfLyDeHZSjmpEKuSa3WNGib89Fuh2uveAQ78t8LOyiVGKsS6MmR7GlVIOpbC4N6x4dtMIUp0EPY96+ch29MowtmxtKYeehyX//1m39F1LJ7YvF49FGoO+T6s+nOxLqaZL1QYDfvMmqB5WTVeODuWxj1UmJ0lz99oe6MJ4JJx5xRmrHRQooOwxfoF0BiyTU3YSDqWXnqhwIHQd63lttn2oMnVQJtu0uhlQCOKrjDDFute4NOQbWpC5pLzv2Vbn7uIoi5bH3ri/ZywvsNuL9heyvmUlHx1A+D/RF0TH226iTOfBecLDnmzdJL4UN2C8zK7jFDW/lWIdbECm5qQcJ7x1tSL+85icX6o3r83cNx90rgljrL2r0Ks/6vApiYknGe822YDu4qf3l0m+NrxXynabgpJlVj/ocBmYPY4urc6tQMMPR8rIO1Ykt1vFsSutfz6KXuQGPblX8KxXwAdHMP3OduGIt5XZViFWFeg6EXmQIk73h2pagVUto/DlbxRfUhxdiwtWg4snRSa/Vsf356b5qWXhWY/L6oOzpn3yNk2FFCPaP9KUCFWE1jgulXlWc4weOE9SXi3s9SlmRT8ylXSseS8zyzIrnX7e1fmPHO9eQTxPMbpMSwnSNo2nOTbPu3x/4aiUSIg7DeYmh2fj2kOwzDANO0Zyq5b/3P3t8d3puEMs8S970W4yqHNq6uHcO+tM+Tpu6Xj5pNfPKtdt7iyfU2TrW9VYzhfrHcrO1m6mfWamhpqJPGN3tXy8vMKyycumbegZD561ZssH364iSqz/9XjTs7ZNPkVFzuyNL3yKfsXvJ1XHvIk/DOrcHReToYsjckR1/tolq3o7M9n24q/T80xcc8YE7qckptudtnqh9cBwy2eNY9ejdyZD9myzAe3xiQrD9m67N8tr05hOfeVxfMqF786c/NBFt+JW7l0PVXUuYOl86fmlkG2zpx1YRWhc5vsX/gzLycsRMIXq3D0HaBBmllrPFkhBE3DrZI3vs2sBc5gg49m/wAO+oa7YPwOGLJ0gwrPr0H65dGrgeRjzyvcL29u6XsdSPP1wcsfv/2yHPQNPpr9AwzHtlkLgI1vu6fnZjt4u2zAMN4NGrkQVI0bvAuYr8i2L6NvfD0n7OjusP71q6kYUKuHzixFWnenYkAt61+/mqMl1StrEyGzENipMgElI4dneAkYotC+Oyv+xPi6k3M6VDq3h31PANzG1t25M2PLWL6wVoGDmmKx1kuHA6Fda/e44+uAFX9S7dLLqhMwzBBvho3Da6yr/YjzmWuLA5g+9T7GDI7NA00CmDEPLhx3JexTMu62lRMQZ1cAzGXhH+RVTp+xBFgdqsV8Diz7dnDhuCuZ+FyoHmhSxMTnIhPqekQ/jVLCFau1Z9A0TUxzrq0n1fqz7uP8t9uR9656hWf/927n+mvG024sbNgcWi41CWfDZmg3Fq6/Zjzs3Z7blqzLsjaU3e61j51nMU3lU8eoObM2Z+ZJx7o9jkyocjvy/ZxhMjt797DtrWq6nHAtxoid3PwYfLgqr9xoUsCHq+Dmx8AYsZMuJ1zLtreqYe+e5giyE4QVmXi99rHHfyonTAHh3rP2zhkWpCWwBugUWiIRYFqG4pTkSRMTCa2XjUAPHIMumAUO5+qF6ikf9wKzFKeh0cTJbCIaHSWK+Vln+kfRaFLLE1ElFIVY30DRaG8aTcx8gWjfkRCFWJuAKRGko9FEzRRAyYxxMqIQK4hM6VnRNaVEE5D71YhCohLr58CLEaWl0UTBi8BnUSYYlVgB/hhhWhqNaiJvz1GK9TngkwjT02hU8QmiPUdKlGJtAu4HxGzSfjNVB4kj20e2HDZZ234+WuP5+VVoXmX7Of0qtCyC1kEYZe20oar+wvF1ErI+GJVtDlWfyMmcFjNIT8Vs+BXQwRbPOSW82/TzsunlreGyWardpqP32+aM4zUbttu09l5xZHn2ypuXTeu/zHe3+E5fnPtl48rqwJqel49u8fz89Ztx3C9uvrac/ri3wS+BKdIyUEy4YvU/y2wHHgRu9twv37OP21nG7azj7WP+24L45rUcdH+v7fnGK/Rsn8/+XvEKLc9C4hbSLtzL5AFEO5bnR+HZNcrL4Cy/B7bEkK5GUyxbEO03FuIQaz1wbwzpajTFci8xjokdh1gh5kxrNAVQT4xnVYhPrFuBu2NKW6MphLuJ+fYtLrEC3EfYw75oNGpYjWivsRKnWHcCN8WYvkYTlJtQPMxoEOIUK8A0QOnAyBpNkbyLaKexE7dYm4DLQd1kPhpNEZiI9pmIL8biFiuImbf+K24nNBoJtYj2mQiSIFaAX6A7mzTJYjVwfdxOWEmKWDcjLjc0mqRwOaJdJoakiBXg6cxPo4mbRLbFCMTq1nckDR8PrBPbvPqcnNus8Z3/hfiWb5wg+8j8yyePXnG80svHZhB/TJewfOsrH7zakMyffNO32VkH5qV5uRfYj+JQJFaZ824Ny7RuXwdmjVgxHNtM3O0alnXD8e/li9UftwZnkOu/zK7TH2d+nWGGw2+ZXdm6zFdZWTnjuYUF2W4tY1n61nC3OG5id/Pbul02R6qzXN3Kxm/ZWhemCdSAsdbdP1lazrJRQ8hi9TvCyCojZ/scYLJ/poNUQlDfgvgs22a16+WDl7CDVm7QfHnt6xbmt90rnbDK2RnuJXyv9P38cAszQbS7OfmXqVvdhEuS7lmtXAd8ELcTmrLiA0S7SyxJFesuYDQQYLpjjaZotiLa2664HfEiqWIF+BAYh+prCwmrNlnXZPdLmsgxqvYvbt0dqmUTuAjR3hJNksUKYlKriVEn+nfrGIxte0WdvEZGmx77F98Ld4zMiaRk8rSkixXgP4BXokxwypuWlaNviDJpjRtHXbF/8f4XQrP6CqJ9pYI0iHUf4n5icVQJznm+efKAxZPa2i7BNDFgVLH4gc77V5+Z81IYVhcj2lVkc9UUSxrECuIL/TOBlZGk9tmfmP+xWOzbE0ZeFv7EuJrgjLysjr49xfKCfwKfzSjW5EpEe0rVwH1pESuIAh5JJB8Bm3xnXPNtzKyfw/BLZ+gzbNQYVQy/dAazft4cdOJPZlFkn+NOxBk1mgN/iKRJrADvAKMAtUOfA6yeTdsxzauzr4MP5tVBv3ugdQ90L7EqDFG+/e7hg3l1zLY8+Ww7Blg9uxjjDYj2s7AoF2PCMM3wnowYvcb4RwqH84BHgRaqEzrkjBmsfEh1Kho/Dh0PK+cW1b72AT8iopnKzRVFX6rnkLYza5aZQA0RfMG/6oUxGCc8zpxFqlPSyJizCIwTHi9WqE2I9hKJUFWR1jNrlmrgYSI4w4IBPc/lrHPO4YrTYeBR0K61+lTLja27YeE/4f4XYc6zz8LKJynyHnUfcDEQaS+hijNr2sUKcAFiQCs1k2xp0sxeYCzililS9GWwnEeBc4mi00mTJhoQ7SJyoaqiFMQK8AxwNrAjZj80yWAHoj08E7MfoVIqYgV4GTgJWBO3I5pYWYtoBy/H7UjYlJJYAd4DTgCWxO2IJhaWAAMR7aDkiEasTT63k87t1vXsclOD/efO58BgghxZ3dLJdx+3dWu4cz8vO0HTl/kj2+6XN1l4kLy5pRUkHS9fC6mDpoa/0NQwGFH/wevGL06+bSSfusyT8HtQmxqgotK7sCoq7XGt2ysqc/d32swuV1Ta4zRvy75LfDti7Nfm141kvsl8DJoXN7+dPjq3Ofd188UvfaufbtutNvJtaMUI2asMZFjLxa0cc/NhImZ4uwHYtz+uV7l5tR9ZuQdpL0HLuAjCfXRz2Hmh2QqRUcBU4MC4HdGEzjbEAAWJ+x7V/Hxm6DZL7Z5Vxizg2+gxnUqNDxD1mjihqqIcxArwEXA88CAxDBOjCRUTUY/HI+q1bCgXsYIYDOsy4Cxgfcy+aApjPeL56WUkfHAzFZSTWLPMBb5JAqdH0HjyNKLeno/bkbgoR7ECrEN0PI1Ez16XdFYj6moUot7KlnIVa5bZwDeAP6LvZZOGiZi39xvoqyBAixXEtH4XAyeSoIlzy5y/IerjpyRs2sU40WJtJttALiD7Fowmaj5HlL8+cErQYrVjAo8BfRBvxNTH607ZUI8Yv7cPovz1LYkELVY5u4A7gcOBX5GyIStTxBZgAqKcf0sZPo7JBy1Wb6yN6dfAxnjdKRk2IspTHwzzQIs1GPXArcBXEbOzhzvbSvnwCaL8voooT32bkQdarPmxE3gIOBr4PuIFC+UjLKacJkQ5jUCU20NEMlB76aEHGSuMJuDZzO8wxJSB4zLLGsEXwJTMT/euh0A5fCIXFS2AIYhBukYBnWL1Jh42Il5gmAm8QYomfQobFZ/IabGqoSUwFDGnyhlAz3jdUcpK4AXEp2qvIob/LHtUiFVfBqthL2JYmezQMv2A0xFf/AwCWsXkVxg0AgsQ96FziXAqznJHizUaFmd+E4E2wADgXxHCHQR0iM81X+oR4lwA/BUxOZh+HhoDWqzRswt4K/MDMT5Ub8TnX/0s/70ByeBMymgAliMOKv+g+QCzDP1GUSLQYo0fEyGIZdgHpa4AegC9EMLtjei06pj5dQIOBqqAtpl9DkTU6V7E+EQgHpPsAb5EdABtsvyWIQS6AvEpmn4MlWBC7WDSaDTq0C9FaDQpQYtVo0kJ/w8Jp0VM/2YtjwAAAABJRU5ErkJggg==",Nh=({version:e=ot})=>{const{t}=ue.useTranslation();return y.jsxs("div",{className:"gpc-conversations-container",children:[y.jsx("div",{className:"gpc-conversations-header",children:y.jsx("h3",{className:"gpc-conversations-title",children:t("about.title")})}),y.jsxs("div",{className:"gpc-about-panel-content",children:[y.jsx("div",{className:"gpc-about-panel-logo",children:y.jsx("img",{src:Ih,alt:"TIA GPC Logo",className:"gpc-about-panel-icon",style:{width:"80px",height:"auto"}})}),y.jsxs("div",{className:"gpc-about-panel-items",children:[y.jsxs("div",{className:"gpc-about-panel-item",children:[y.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.product"),":"]}),y.jsx("span",{className:"gpc-about-panel-value",children:"TIA GPC"}),y.jsx("a",{href:"https://www.landing.softiabot.com",target:"_blank",rel:"noopener noreferrer",className:"gpc-about-panel-link",children:"www.landing.softiabot.com"})]}),y.jsxs("div",{className:"gpc-about-panel-item",children:[y.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.version"),":"]}),y.jsx("span",{className:"gpc-about-panel-value",children:e})]}),y.jsxs("div",{className:"gpc-about-panel-item",children:[y.jsxs("span",{className:"gpc-about-panel-label",children:[t("about.creator"),":"]}),y.jsx("span",{className:"gpc-about-panel-value",children:"SOFTIA Technologies Inc."}),y.jsx("a",{href:"https://www.softia.ca",target:"_blank",rel:"noopener noreferrer",className:"gpc-about-panel-link",children:"Softia.ca"})]}),y.jsx("div",{className:"gpc-about-panel-footer",children:y.jsx("p",{className:"gpc-about-panel-rights",children:t("about.rights")})})]})]})]})},Dh=(e,t)=>{const{t:n}=ue.useTranslation(),[r,i]=A.useState([]),[a,o]=A.useState(!1),[s,l]=A.useState(null),[u,h]=A.useState(null),[c,p]=A.useState([]),[f,m]=A.useState(0),[w,v]=A.useState(!1),[b,S]=A.useState(!0),[E,D]=A.useState(0),[I,k]=A.useState(!0),[L,F]=A.useState(!1),[_,x]=A.useState(0),[T,j]=A.useState(!1),[R,z]=A.useState(!1),M=A.useCallback(async W=>{if(!W.trim()||a)return;const ee={id:Wt(),role:"user",content:W.trim(),timestamp:new Date().toISOString()};i(te=>[...te,ee]),o(!0),l(null);const Z=Wt(),le={id:Z,role:"assistant",content:"",timestamp:new Date().toISOString(),isStreaming:!0};i(te=>[...te,le]);try{const te=await e.sendMessage(W,Q=>{i(ie=>ie.map(Ee=>Ee.id===Z?{...Ee,content:Ee.content+Q}:Ee))},u);i(Q=>Q.map(ie=>ie.id===Z?{id:te.data.message_id,role:"assistant",content:te.data.response,timestamp:te.data.created_at,isStreaming:!1,metadata:{responseTimeMs:te.data.response_time_ms,modelUsed:te.data.model_used}}:ie)),te.data.conversation_id&&h(te.data.conversation_id),B()}catch(te){i(Fe=>Fe.filter(ct=>ct.id!==Z));let Q;try{Q=JSON.parse(te.message)}catch{Q={statusCode:500,message:te.message}}let ie;const Ee=Q.statusCode||500,ze=Q.errorCode||"";switch(Ee===401&&ze==="SESSION_EXPIRED"&&(ie=n("toast.sessionExpired"),t&&t()),Ee){case 401:ie||(ie=n("errors.unauthorized"));break;case 402:ie=n("errors.insufficientCredits");break;case 403:ze.includes("DOMAIN")||ze.includes("UNAUTHORIZED")?ie=n("errors.domainUnauthorized"):ie=n("errors.validation");break;case 422:ze==="LOW_RELEVANCE_SCORE"&&Q.message?ie=Q.message:ie=n("errors.noKnowledgeAvailable");break;case 429:ie=n("errors.rateLimit");break;case 503:case 502:case 504:ie=n("errors.aiServiceUnavailable");break;case 500:ie=n("errors.serverError");break;default:ie=n("errors.generic")}l(ie),ze!=="LOW_RELEVANCE_SCORE"&&Pe.error(ie,{duration:4e3,position:"top-center"});const ut={id:Wt(),role:"assistant",content:ie,timestamp:new Date().toISOString()};i(Fe=>[...Fe,ut])}finally{o(!1)}},[e,a,n,t,u]),Y=A.useCallback(()=>{i([]),l(null)},[]),ne=A.useCallback(()=>{l(null)},[]),re=A.useCallback(async(W,ee=!0)=>{if(!(!e||!W)){v(!0);try{const Z=ee?0:_,le=await e.getConversationHistory(W,50,Z);if(le.success&&le.data.messages){const te=le.data.messages.flatMap(Q=>[{id:`${Q.message_id}-question`,role:"user",content:Q.question,timestamp:Q.creation_date},{id:Q.message_id,role:"assistant",content:Q.answer,timestamp:Q.creation_date,metadata:{modelUsed:Q.model}}]);ee?(i(te),x(le.data.count)):(i(Q=>[...te,...Q]),x(Q=>Q+le.data.count)),j(le.data.has_more),h(W)}}catch(Z){console.error("Error loading conversation history:",Z),Pe.error(n("toast.failedLoadHistory"))}finally{v(!1)}}},[e,n,_]),B=A.useCallback(async(W=!0)=>{if(e)try{const ee=W?0:E,Z=await e.listConversations(20,ee);Z.success&&Z.data.conversations&&(W?(p(Z.data.conversations),D(Z.data.count)):(p(le=>[...le,...Z.data.conversations]),D(le=>le+Z.data.count)),k(Z.data.has_more),m(Z.data.total||0))}catch(ee){console.error("Error loading conversations:",ee)}},[e,E]),d=A.useCallback(async()=>{if(!(!e||L||!I)){F(!0);try{await B(!1)}finally{F(!1)}}},[e,L,I,B]),$=A.useCallback(async()=>{if(!(!e||!u||R||!T)){z(!0);try{await re(u,!1)}finally{z(!1)}}},[e,u,R,T,re]),se=A.useCallback(()=>{i([]),h(null),l(null),e&&e.clearLastConversation(),Pe.success(n("toast.newConversationStarted"))},[n,e]),g=A.useCallback(async W=>{await re(W)},[re]),ce=A.useCallback(async(W,ee)=>{if(e)try{await e.updateConversationTitle(W,ee),await B(!0),Pe.success(n("toast.conversationRenamed"))}catch(Z){console.error("Error renaming conversation:",Z),Pe.error(n("toast.failedRenameConversation"))}},[e,B,n]),ke=A.useCallback(async W=>{if(e)try{await e.deleteConversation(W),W===u&&(i([]),h(null)),await B(!0),Pe.success(n("toast.conversationDeleted"))}catch(ee){console.error("Error deleting conversation:",ee),Pe.error(n("toast.failedDeleteConversation"))}},[e,u,B,n]);return A.useEffect(()=>{(async()=>{if(!e){S(!1);return}try{const ee=e.getLastConversation();ee&&(i(ee.messages),h(ee.conversationId))}catch(ee){console.error("[TIA GPC] Error restaurando conversación:",ee)}finally{S(!1)}})()},[e]),A.useEffect(()=>{e&&!b&&B()},[e,B,b]),A.useEffect(()=>{e&&r.length>0&&!b&&e.saveLastConversation(u,r)},[e,r,u,b]),{messages:r,isLoading:a,error:s,sendMessage:M,clearMessages:Y,clearError:ne,currentConversationId:u,conversations:c,totalConversations:f,isLoadingHistory:w,loadConversationHistory:re,loadConversations:B,startNewConversation:se,switchConversation:g,renameConversation:ce,deleteConversation:ke,isRestoringConversation:b,hasMoreConversations:I,isLoadingMoreConversations:L,loadMoreConversations:d,hasMoreMessages:T,isLoadingMoreMessages:R,loadMoreMessages:$}},Ph=(e="auto")=>{const[t,n]=A.useState(e),[r,i]=A.useState("light");return A.useEffect(()=>{n(e)},[e]),A.useEffect(()=>{if(i(t==="auto"?gh():t),t==="auto"){const s=window.matchMedia("(prefers-color-scheme: dark)"),l=u=>{i(u.matches?"dark":"light")};return s.addEventListener("change",l),()=>{s.removeEventListener("change",l)}}},[t]),{theme:r,themeMode:t,setThemeMode:n,toggleTheme:()=>{n(o=>o==="auto"?r==="light"?"dark":"light":o==="light"?"dark":"light")}}},Lh=({gpcService:e,licenseToken:t,widgetConfig:n,onClose:r,themeMode:i,showBranding:a=!0,showMetadata:o=!1,onError:s,version:l=ot})=>{const{t:u}=ue.useTranslation(),[h,c]=A.useState(!1),[p,f]=A.useState(!1),{theme:m,toggleTheme:w}=Ph(i),v=A.useCallback(()=>{},[]),{messages:b,isLoading:S,sendMessage:E,currentConversationId:D,conversations:I,totalConversations:k,isLoadingHistory:L,startNewConversation:F,switchConversation:_,renameConversation:x,deleteConversation:T,isRestoringConversation:j,hasMoreConversations:R,isLoadingMoreConversations:z,loadMoreConversations:M,hasMoreMessages:Y,isLoadingMoreMessages:ne,loadMoreMessages:re}=Dh(e,v),B=A.useCallback(()=>{c(g=>!g),f(!1)},[]),d=A.useCallback(()=>{f(g=>!g),c(!1)},[]),$=A.useCallback(g=>{_(g),c(!1)},[_]),se=A.useCallback(()=>{F(),c(!1)},[F]);return A.useEffect(()=>()=>{e&&e.releaseSession().catch(g=>{console.error("Failed to release session:",g)})},[e]),y.jsxs("div",{className:`gpc-chat-window gpc-animate-fade-in ${m==="dark"?"gpc-dark":""}`,children:[y.jsx(_i,{onClose:r,theme:m,onToggleTheme:w,showBranding:a,widgetConfig:n,onToggleConversations:B,showConversations:h,conversationsCount:k,onToggleAbout:d,showAbout:p,version:l}),y.jsx(kh,{messages:b,isLoading:S||L||j,showMetadata:o,widgetConfig:n,hasMoreMessages:Y,isLoadingMoreMessages:ne,onLoadMoreMessages:re}),y.jsx(Eh,{onSendMessage:E,isLoading:S||j,disabled:j,gpcService:e,showBranding:a}),h&&y.jsx("div",{className:"gpc-conversations-overlay",children:y.jsx(Ah,{conversations:I,totalConversations:k,currentConversationId:D,onSelectConversation:$,onNewConversation:se,onRenameConversation:x,onDeleteConversation:T,isLoadingHistory:L,hasMoreConversations:R,isLoadingMoreConversations:z,onLoadMore:M})}),p&&y.jsx("div",{className:"gpc-conversations-overlay",children:y.jsx(Nh,{version:l})}),y.jsx(Pe.Toaster,{position:"top-center"})]})},zh=({gpcService:e,onSuccess:t,onError:n})=>{const{t:r}=ue.useTranslation(),[i,a]=A.useState(null),[o,s]=A.useState(null),[l,u]=A.useState(""),[h,c]=A.useState(""),[p,f]=A.useState(!1),[m,w]=A.useState(!0),[v,b]=A.useState(null);A.useEffect(()=>{S()},[]);const S=async()=>{w(!0),c(""),u("");try{const I=await e.generateCaptchaChallenge();if(I.success&&I.challenge_id)a(I.question),s(I.challenge_id);else throw new Error("Failed to generate challenge")}catch(I){c(r("captcha.errorGenerating","Error generating challenge. Please try again.")),n&&n(I)}finally{w(!1)}},E=async I=>{I.preventDefault(),c(""),f(!0);try{const k=parseInt(l,10);if(isNaN(k)){c(r("captcha.invalidNumber")),f(!1);return}const L=await e.verifyCaptchaAnswer(o,k);if(L.success)localStorage.setItem(qe.VERIFIED,"true"),localStorage.setItem(qe.TIMESTAMP,Date.now().toString()),t&&t();else{const F=L.attempts_remaining;b(F),F!==void 0&&F>0?c(r("captcha.incorrectAnswerWithAttempts",{attempts:F,defaultValue:"Incorrect answer. {{attempts}} attempts remaining"})):c(r("captcha.incorrectAnswer")),u(""),f(!1)}}catch(k){switch(k.error_code){case"CHALLENGE_NOT_FOUND":case"CHALLENGE_EXPIRED":c(r("captcha.challengeExpired","Challenge expired. Generating a new one...")),setTimeout(()=>S(),2e3);break;case"MAX_ATTEMPTS_EXCEEDED":c(r("captcha.maxAttemptsExceeded","Maximum attempts exceeded. Generating a new challenge...")),setTimeout(()=>S(),2e3);break;case"INVALID_SESSION":c(r("captcha.invalidSession","Invalid session. Please refresh the page."));break;default:c(r("captcha.error"))}f(!1),n&&n(k)}},D=I=>{const k=I.target.value;(k===""||/^\d+$/.test(k))&&(u(k),c(""))};return m||!i?y.jsxs("div",{className:"gpc-captcha-loading",children:[y.jsx("div",{className:"gpc-spinner"}),y.jsx("p",{children:r("captcha.loading","Loading challenge...")})]}):y.jsx("div",{className:"gpc-captcha-container",children:y.jsxs("div",{className:"gpc-captcha-content",children:[y.jsxs("div",{className:"gpc-captcha-header",children:[y.jsx("svg",{className:"gpc-captcha-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:y.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"})}),y.jsx("h3",{className:"gpc-captcha-title",children:r("captcha.title")}),y.jsx("p",{className:"gpc-captcha-subtitle",children:r("captcha.subtitle")})]}),y.jsxs("form",{onSubmit:E,className:"gpc-captcha-form",children:[y.jsxs("div",{className:"gpc-captcha-question",children:[y.jsx("label",{htmlFor:"captcha-answer",className:"gpc-captcha-label",children:r("captcha.question")}),y.jsxs("div",{className:"gpc-captcha-challenge",children:[y.jsx("span",{className:"gpc-captcha-math",children:i}),y.jsx("span",{className:"gpc-captcha-equals",children:"="}),y.jsx("input",{id:"captcha-answer",type:"text",inputMode:"numeric",pattern:"[0-9]*",value:l,onChange:D,placeholder:"?",className:`gpc-captcha-input ${h?"gpc-captcha-input-error":""}`,disabled:p,autoFocus:!0,autoComplete:"off"})]})]}),h&&y.jsxs("div",{className:"gpc-captcha-error",children:[y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[y.jsx("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),y.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12",strokeWidth:2,strokeLinecap:"round"}),y.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16",strokeWidth:2,strokeLinecap:"round"})]}),y.jsx("span",{children:h})]}),v!==null&&v>0&&y.jsx("div",{className:"gpc-captcha-attempts",children:r("captcha.attemptsLeft",{count:v,defaultValue:"{{count}} attempts remaining"})}),y.jsx("button",{type:"submit",className:"gpc-captcha-button",disabled:p||!l,children:p?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"gpc-spinner gpc-button-spinner"}),r("captcha.verifying")]}):r("captcha.verify")})]}),y.jsx("p",{className:"gpc-captcha-info",children:r("captcha.info")})]})})};class jh{constructor(t,n){this.licenseToken=n,this.baseURL=t||bi,this.client=Pi.create({baseURL:this.baseURL,timeout:fh.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 Rh{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,a=Date.now(),o=1440*60*1e3;return r&&a-i<o}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 Mh{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 Oh(){const e={};return Ri.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 Fh{constructor(t,n,r){this.licenseToken=t,this.sessionToken=n,this.httpClient=r}async sendMessage(t,n,r=null){const a=`${this.httpClient.baseURL}/ask`,o=Oh(),s={message:t,session_token:this.sessionToken,request_metadata:o};r&&(s.conversation_id=r);try{const l=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.licenseToken}`},body:JSON.stringify(s)});if(!l.ok){const u=await l.json().catch(()=>({}));throw new Error(JSON.stringify({statusCode:l.status,errorCode:u.error_code||"UNKNOWN_ERROR",message:u.message||"Request failed",retryAfter:u.retry_after_seconds||null}))}return await this._processSSEResponse(l,n)}catch(l){throw l.message.startsWith("{")?l:new Error(JSON.stringify({statusCode:500,errorCode:"NETWORK_ERROR",message:l.message,retryAfter:null}))}}async _processSSEResponse(t,n){const r=t.body.getReader(),i=new TextDecoder;let a="",o="",s=null,l=null;for(;;){const{done:u,value:h}=await r.read();if(u)break;a+=i.decode(h,{stream:!0});const c=a.split(`
|
|
30
|
+
`);a=c.pop();for(const p of c){if(!p.trim()||!p.startsWith("data: "))continue;const f=p.replace("data: ","").trim();if(f!=="[DONE]")try{const m=JSON.parse(f);if(m.type==="content")o+=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:o,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 jh(t,n),this.sessionService=new Rh(n,this.httpClient),this.conversationService=new Mh(n,this.sessionService.getSessionToken(),this.httpClient),this.messageService=new Fh(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 _h=(e,t)=>((!mt||t&&mt.licenseToken!==t)&&(mt=new wn(e,t)),mt),Bh={title:"TIA GPC",poweredBy:"Desarrollado por SOFTIA.ca",questionsTo:"Preguntas a",validatingSession:"Validando sesión..."},Hh={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..."},Uh={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"},qh={light:"Claro",dark:"Oscuro",toggle:"Cambiar tema"},Wh={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?"},Vh={tokensUsed:"Tokens usados",responseTime:"Tiempo de respuesta",model:"Modelo"},Gh={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}}"?'},Yh={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"},Zh={languageSelector:{label:"Cambiar idioma"},spinner:{loading:"Cargando"},typingIndicator:{typing:"Escribiendo"},message:{userMessage:"Mensaje del usuario",assistantMessage:"Mensaje del asistente"}},Qh={english:"English",spanish:"Español",french:"Français"},Jh={maxCharacters:"Máximo {{count}} caracteres"},Xh={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"},Kh={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"},$h={title:"Acerca de",product:"Producto",version:"Versión",creator:"Creador",rights:"Todos los derechos reservados.",close:"Cerrar"},ef={widget:Bh,chat:Hh,voice:Uh,theme:qh,errors:Wh,metadata:Vh,conversations:Gh,time:Yh,ui:Zh,languages:Qh,input:Jh,captcha:Xh,toast:Kh,about:$h},tf={title:"TIA GPC",poweredBy:"Powered by SOFTIA.ca",questionsTo:"Questions to",validatingSession:"Validating session..."},nf={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..."},rf={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"},of={light:"Light",dark:"Dark",toggle:"Toggle theme"},af={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?"},sf={tokensUsed:"Tokens used",responseTime:"Response time",model:"Model"},lf={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}}"?'},uf={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"},cf={languageSelector:{label:"Change language"},spinner:{loading:"Loading"},typingIndicator:{typing:"Typing"},message:{userMessage:"User message",assistantMessage:"Assistant message"}},hf={english:"English",spanish:"Español",french:"Français"},ff={maxCharacters:"Maximum {{count}} characters"},pf={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"},df={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"},mf={title:"About",product:"Product",version:"Version",creator:"Creator",rights:"All rights reserved.",close:"Close"},gf={widget:tf,chat:nf,voice:rf,theme:of,errors:af,metadata:sf,conversations:lf,time:uf,ui:cf,languages:hf,input:ff,captcha:pf,toast:df,about:mf},yf={title:"TIA GPC",poweredBy:"Propulsé par SOFTIA.ca",questionsTo:"Questions à",validatingSession:"Validation de la session..."},xf={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..."},bf={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"},kf={light:"Clair",dark:"Sombre",toggle:"Changer de thème"},wf={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 ?"},vf={tokensUsed:"Tokens utilisés",responseTime:"Temps de réponse",model:"Modèle"},Cf={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}}" ?'},Sf={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"},Ef={languageSelector:{label:"Changer de langue"},spinner:{loading:"Chargement"},typingIndicator:{typing:"Écriture en cours"},message:{userMessage:"Message de l'utilisateur",assistantMessage:"Message de l'assistant"}},Tf={english:"English",spanish:"Español",french:"Français"},Af={maxCharacters:"Maximum {{count}} caractères"},If={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"},Nf={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"},Df={title:"À propos",product:"Produit",version:"Version",creator:"Créateur",rights:"Tous droits réservés.",close:"Fermer"},Pf={widget:yf,chat:xf,voice:bf,theme:kf,errors:wf,metadata:vf,conversations:Cf,time:Sf,ui:Ef,languages:Tf,input:Af,captcha:If,toast:Nf,about:Df};gt.use(Li).use(ue.initReactI18next).init({resources:{en:{translation:gf},es:{translation:ef},fr:{translation:Pf}},fallbackLng:"en",supportedLngs:["en","es","fr"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});const Si=({token:e,theme:t=De.theme,position:n=De.position,language:r=De.language,primaryColor:i,width:a=De.width,height:o=De.height,apiUrl:s=bi,onReady:l,onError:u,onClose:h,autoOpen:c=De.autoOpen,showBranding:p=De.showBranding,mobileFullscreen:f=De.mobileFullscreen,...m})=>{const[w,v]=A.useState(!1),[b,S]=A.useState(null),[E,D]=A.useState(!0),[I,k]=A.useState(!1),[L,F]=A.useState(!1);b?.widget_customization?.behavior?.auto_open;const[_,x]=A.useState(!1),T=A.useMemo(()=>new wn(s,e),[s,e]);if(A.useEffect(()=>{const B=()=>{v(ph())};B(),window.addEventListener("resize",B);const d=localStorage.getItem(qe.VERIFIED),$=localStorage.getItem(qe.TIMESTAMP);return d==="true"&&$&&(Date.now()-parseInt($,10)<ji?k(!0):(localStorage.removeItem(qe.VERIFIED),localStorage.removeItem(qe.TIMESTAMP))),()=>window.removeEventListener("resize",B)},[]),A.useEffect(()=>{const B=b?.widget_customization?.language||r;B&>.changeLanguage&>.changeLanguage(B)},[r,b]),A.useEffect(()=>{(async()=>{if(!e){D(!1);return}try{const d=await T.getInitConfig();d.success&&(S(d.data),(d.data?.widget_customization?.behavior?.auto_open??c)&&x(!0),l&&l(d.data))}catch(d){console.error("[TIA GPC Widget] Error loading config:",d),u&&u(d)}finally{D(!1)}})()},[e,T,l,u,c]),A.useEffect(()=>{const B=()=>{if(!T)return;const d=T.getSessionToken(),$=T.httpClient.baseURL,se=T.licenseToken;fetch(`${$}/release-session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${se}`},body:JSON.stringify({session_token:d}),keepalive:!0}).catch(()=>{})};return window.addEventListener("beforeunload",B),()=>{window.removeEventListener("beforeunload",B)}},[T]),!e)return console.error('[TIA GPC Widget] Error: "token" prop is required'),null;const j=()=>{x(!1),F(!1),h?.()},R=()=>{I||F(!0),x(!0)},z=()=>{k(!0),F(!1)},M=B=>{console.error("[TIA GPC Widget] CAPTCHA error:",B),u&&u(B)},Y=()=>{const B=b?.widget_customization?.position||n,d=b?.widget_customization?.behavior?.mobile_fullscreen??f;return w&&d?"gpc-position-bottom-right":`gpc-position-${B}`},ne=()=>{const B={},d=b?.widget_customization?.colors?.primary||i,$=b?.widget_customization?.colors?.header_background,se=b?.widget_customization?.colors?.header_text;d&&(B["--gpc-color-primary"]=d),$&&(B["--gpc-header-bg"]=$),se&&(B["--gpc-header-text"]=se);const g=b?.widget_customization?.dimensions?.width||a,ce=b?.widget_customization?.dimensions?.height||o,ke=b?.widget_customization?.behavior?.mobile_fullscreen??f;return(!w||!ke)&&(g&&(B["--gpc-widget-width"]=g),ce&&(B["--gpc-widget-height"]=ce)),B},re=b?.widget_customization?.theme||t;return y.jsx(ue.I18nextProvider,{i18n:gt,children:y.jsxs("div",{className:`gpc-widget gpc-widget-container ${Y()} ${re==="dark"?"gpc-dark":""}`,style:ne(),children:[!_&&y.jsx(Mi,{onClick:R,widgetConfig:b}),_&&!E&&y.jsx(y.Fragment,{children:L&&!I?y.jsx("div",{className:"gpc-chat-window gpc-animate-fade-in",children:y.jsx(zh,{gpcService:T,onSuccess:z,onError:M})}):y.jsx(Lh,{gpcService:T,licenseToken:e,widgetConfig:b,onClose:j,themeMode:re,showBranding:p,showMetadata:m.showMetadata||!1,onError:u,version:ot})})]})})};Si.defaultProps={theme:"auto",position:"bottom-right",language:"en",width:"400px",height:"600px",autoOpen:!1,showBranding:!0,mobileFullscreen:!0};exports.GPCService=wn;exports.LANGUAGES=vi;exports.THEMES=wi;exports.TiaGPCWidget=Si;exports.WIDGET_POSITIONS=ki;exports.WIDGET_VERSION=ot;exports.getGPCService=_h;
|
|
31
31
|
//# sourceMappingURL=tia-gpc.cjs.js.map
|