@snf/qa-bot-core 0.3.1 → 0.3.3

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.
@@ -5,5 +5,5 @@ import*as e from"react";import t,{forwardRef as n,createContext as r,useContext
5
5
  * Copyright(c) 2015 Andreas Lubbe
6
6
  * Copyright(c) 2015 Tiancheng "Timothy" Gu
7
7
  * MIT Licensed
8
- */var mn,vn;const yn=hn(function(){if(vn)return mn;vn=1;var e=/["'&<>]/;return mn=function(t){var n=""+t,r=e.exec(n);if(!r)return n;var A,o="",i=0,l=0;for(i=r.index;i<n.length;i++){switch(n.charCodeAt(i)){case 34:A="&quot;";break;case 38:A="&amp;";break;case 39:A="&#39;";break;case 60:A="&lt;";break;case 62:A="&gt;";break;default:continue}l!==i&&(o+=n.substring(l,i)),l=i+1,o+=A}return l!==i?o+n.substring(l,i):o}}());function wn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const bn=/(url|image|image-set)\(/i;class En extends gn{attribute(e,t){return"style"===e&&Object.keys(t).forEach(e=>{String(t[e]).match(bn)&&delete t[e]}),t}}const Pn=/^<(!doctype|(html|head|body)(\s|>))/i,Bn=/^(aria-|data-|\w+:)/iu,Dn=/{{{(\w+)\/?}}}/;function Cn(){if(!(typeof window>"u"||typeof document>"u"))return document.implementation.createHTMLDocument("Interweave")}let xn=class{constructor(e,t={},n=[],r=[]){var A;if(wn(this,"allowed",void 0),wn(this,"banned",void 0),wn(this,"blocked",void 0),wn(this,"container",void 0),wn(this,"content",[]),wn(this,"props",void 0),wn(this,"matchers",void 0),wn(this,"filters",void 0),wn(this,"keyIndex",void 0),"production"!==process.env.NODE_ENV&&e&&"string"!=typeof e)throw new TypeError("Interweave parser requires a valid string.");this.props=t,this.matchers=n,this.filters=[...r,new En],this.keyIndex=-1,this.container=this.createContainer(e||""),this.allowed=new Set(null!==(A=t.allowList)&&void 0!==A?A:cn),this.banned=new Set(sn),this.blocked=new Set(t.blockList)}applyAttributeFilters(e,t){return this.filters.reduce((t,n)=>null!==t&&"function"==typeof n.attribute?n.attribute(e,t):t,t)}applyNodeFilters(e,t){return this.filters.reduce((t,n)=>null!==t&&"function"==typeof n.node?n.node(e,t):t,t)}applyMatchers(e,t){const n={},{props:r}=this;let A=e,o=0,i=null;return this.matchers.forEach(e=>{const l=e.asTag().toLowerCase(),a=this.getTagConfig(l);if(r[e.inverseName]||!this.isTagAllowed(l)||!this.canRenderChild(t,a))return;let s="";for(;A&&(i=e.match(A));){const{index:t,length:l,match:a,valid:c,void:u,...d}=i,f=e.propName+String(o);t>0&&(s+=A.slice(0,t)),c?(s+=u?`{{{${f}/}}}`:`{{{${f}}}}${a}{{{/${f}}}}`,this.keyIndex+=1,o+=1,n[f]={children:a,matcher:e,props:{...r,...d,key:this.keyIndex}}):s+=a,e.greedy?(A=s+A.slice(t+l),s=""):A=A.slice(t+(l||a.length))}e.greedy||(A=s+A)}),0===o?e:this.replaceTokens(A,n)}canRenderChild(e,t){return!(!e.tagName||!t.tagName||e.void)&&(e.children.length>0?e.children.includes(t.tagName):!(e.invalid.length>0&&e.invalid.includes(t.tagName))&&(t.parent.length>0?t.parent.includes(e.tagName):!(!e.self&&e.tagName===t.tagName)&&!!(e&&e.content&t.type)))}convertLineBreaks(e){const{noHtml:t,disableLineBreaks:n}=this.props;if(t||n||e.match(/<((?:\/[ a-z]+)|(?:[ a-z]+\/))>/gi))return e;let r=e.replace(/\r\n/g,"\n");return r=r.replace(/\n{3,}/g,"\n\n\n"),r=r.replace(/\n/g,"<br/>"),r}createContainer(e){var t;const n=(typeof global<"u"&&global.INTERWEAVE_SSR_POLYFILL||Cn)();if(!n)return;const r=null!==(t=this.props.containerTagName)&&void 0!==t?t:"body",A="body"===r||"fragment"===r?n.body:n.createElement(r);if(e.match(Pn)){if("production"!==process.env.NODE_ENV)throw new Error("HTML documents as Interweave content are not supported.")}else A.innerHTML=this.convertLineBreaks(this.props.escapeHtml?yn(e):e);return A}extractAttributes(e){const{allowAttributes:t}=this.props,n={};let r=0;return 1===e.nodeType&&e.attributes&&([...e.attributes].forEach(A=>{const{name:o,value:i}=A,l=o.toLowerCase(),a=un[l]||un[o];if(!this.isSafe(e)||!l.match(Bn)&&(!t&&(!a||2===a)||l.startsWith("on")||i.replace(/(\s|\0|&#x0([9AD]);)/,"").match(/(javascript|vbscript|livescript|xss):/i)))return;let s="style"===l?this.extractStyleAttribute(e):i;4===a?s=!0:3===a?s=Number.parseFloat(String(s)):5!==a&&(s=String(s)),n[dn[l]||l]=this.applyAttributeFilters(l,s),r+=1}),0!==r)?n:null}extractStyleAttribute(e){const t={};return Array.from(e.style).forEach(n=>{const r=e.style[n];("string"==typeof r||"number"==typeof r)&&(t[n.replace(/-([a-z])/g,(e,t)=>String(t).toUpperCase())]=r)}),t}getTagConfig(e){const t={children:[],content:0,invalid:[],parent:[],self:!0,tagName:"",type:0,void:!1};return an[e]?{...t,...an[e],tagName:e}:t}isSafe(e){if(typeof HTMLAnchorElement<"u"&&e instanceof HTMLAnchorElement){const t=e.getAttribute("href");if(null!=t&&t.startsWith("#"))return!0;const n=e.protocol.toLowerCase();return":"===n||"http:"===n||"https:"===n||"mailto:"===n||"tel:"===n}return!0}isTagAllowed(e){return!this.banned.has(e)&&!this.blocked.has(e)&&(this.props.allowElements||this.allowed.has(e))}parse(){return this.container?this.parseNode(this.container,this.getTagConfig(this.container.nodeName.toLowerCase())):[]}parseNode(e,n){const{noHtml:r,noHtmlExceptMatchers:A,allowElements:o,transform:i,transformOnlyAllowList:l}=this.props;let a=[],s="";return[...e.childNodes].forEach(e=>{if(1===e.nodeType){const u=e.nodeName.toLowerCase(),d=this.getTagConfig(u);s&&(a.push(s),s="");const f=this.applyNodeFilters(u,e);if(!f)return;let p;if(i&&(!l||this.isTagAllowed(u))){this.keyIndex+=1;const e=this.keyIndex;p=this.parseNode(f,d);const n=i(f,p,d);if(null===n)return;if(typeof n<"u")return void a.push(t.cloneElement(n,{key:e}));this.keyIndex=e-1}if(this.banned.has(u))return;if(r||A&&"br"!==u||!this.isTagAllowed(u)||!o&&!this.canRenderChild(n,d))a=[...a,...this.parseNode(f,d.tagName?d:n)];else{var c;this.keyIndex+=1;const e=this.extractAttributes(f),n={tagName:u};e&&(n.attributes=e),d.void&&(n.selfClose=d.void),a.push(t.createElement(pn,{...n,key:this.keyIndex},null!==(c=p)&&void 0!==c?c:this.parseNode(f,d)))}}else if(3===e.nodeType){const t=r&&!A?e.textContent:this.applyMatchers(e.textContent||"",n);Array.isArray(t)?a=[...a,...t]:s+=t}}),s&&a.push(s),a}replaceTokens(e,t){if(!e.includes("{{{"))return e;const n=[];let r=e,A=null;for(;A=r.match(Dn);){const[e,o]=A,i=A.index,l=e.includes("/");if("production"!==process.env.NODE_ENV&&!t[o])throw new Error(`Token "${o}" found but no matching element to replace with.`);i>0&&(n.push(r.slice(0,i)),r=r.slice(i));const{children:a,matcher:s,props:c}=t[o];let u;if(l)u=e.length,n.push(s.createElement(a,c));else{const A=r.match(new RegExp(`{{{/${o}}}}`));if("production"!==process.env.NODE_ENV&&!A)throw new Error(`Closing token missing for interpolated element "${o}".`);u=A.index+A[0].length,n.push(s.createElement(this.replaceTokens(r.slice(e.length,A.index),t),c))}r=r.slice(u)}return r.length>0&&n.push(r),0===n.length?"":1===n.length&&"string"==typeof n[0]?n[0]:n}};function kn(e){var n;const{attributes:r,className:A,containerTagName:o,content:i,emptyContent:l,parsedContent:a,tagName:s,noWrap:c}=e,u=null!==(n=o??s)&&void 0!==n?n:"span",d="fragment"===u||c;let f;if(a)f=a;else{const t=new xn(i??"",e).parse();t.length>0&&(f=t)}return f||(f=l),d?t.createElement(t.Fragment,null,f):t.createElement(pn,{attributes:r,className:A,tagName:u},f)}function Sn(e){const{attributes:n,className:r,content:A="",disableFilters:o=!1,disableMatchers:i=!1,emptyContent:l=null,filters:a=[],matchers:s=[],onAfterParse:c=null,onBeforeParse:u=null,tagName:d="span",noWrap:f=!1,...p}=e,g=i?[]:s,h=o?[]:a,m=u?[u]:[],v=c?[c]:[];g.forEach(e=>{e.onBeforeParse&&m.push(e.onBeforeParse.bind(e)),e.onAfterParse&&v.push(e.onAfterParse.bind(e))});const y=m.reduce((t,n)=>{const r=n(t,e);if("production"!==process.env.NODE_ENV&&"string"!=typeof r)throw new TypeError("Interweave `onBeforeParse` must return a valid HTML string.");return r},A??""),w=new xn(y,p,g,h),b=v.reduce((t,n)=>{const r=n(t,e);if("production"!==process.env.NODE_ENV&&!Array.isArray(r))throw new TypeError("Interweave `onAfterParse` must return an array of strings and React elements.");return r},w.parse());return t.createElement(kn,{attributes:n,className:r,containerTagName:e.containerTagName,emptyContent:l,noWrap:f,parsedContent:0===b.length?void 0:b,tagName:d})}const Tn=({children:e})=>g("div",{style:{whiteSpace:"normal"},children:g(Sn,{content:"string"==typeof e?e:""})}),In={autoConfig:!0},Qn=(e,t,n)=>{var r;if(!e.detail.currPath)return!1;const A=t[e.detail.currPath];return!!A&&((null==(r=A.renderHtml)?void 0:r.map(e=>e.toUpperCase()).includes(n))??!1)},Mn=e=>{const t=[];let n="",r=!1;for(let A=0;A<e.length;A++){const o=e[A];"<"===o?r?(t.push(n),n=o):(r=!0,n=o):">"===o?(n+=o,t.push(n),n="",r=!1):r?n+=o:t.push(o)}return""!==n&&t.push(n),t},On=e=>{const{getFlow:t}=$t(),{messages:n,replaceMessages:r}=en(),{settings:A}=nn(),{hasChatHistoryLoaded:o}=An(),i={...e,...In},l=i.htmlComponent?i.htmlComponent:Tn;a(()=>{var e,t;if(o){const o=[...n];for(let n=0;n<o.length&&n<((null==(e=A.chatHistory)?void 0:e.maxEntries)??30);n++){const e=o[n];null!=(t=e.tags)&&t.includes("rcb-html-renderer-plugin:parsed")&&(e.contentWrapper=l)}r(o)}},[o]);const s=async e=>{var n;const r=null==(n=e.data.message)?void 0:n.sender.toUpperCase();"string"==typeof e.data.message.content&&Qn(e,t(),r)&&("rcb-start-simulate-stream-message"===e.type&&(e.data.simulateStreamChunker=Mn),e.data.message.contentWrapper=l,e.data.message.tags||(e.data.message.tags=[]),e.data.message.tags.push("rcb-html-renderer-plugin:parsed"))};tn(J.PRE_INJECT_MESSAGE,s),tn(J.CHUNK_STREAM_MESSAGE,s),tn(J.START_STREAM_MESSAGE,s),tn(J.START_SIMULATE_STREAM_MESSAGE,s),tn(J.START_SPEAK_AUDIO,async e=>{Qn(e,t(),"BOT")&&(e.data.textToRead=(e=>typeof window.DOMParser<"u"?(new DOMParser).parseFromString(e,"text/html").body.textContent||"":e.replace(/<\/?[^>]+(>|$)/g,""))(e.data.textToRead))});const c={name:"@rcb-plugins/html-renderer"};return null!=i&&i.autoConfig&&(c.settings={event:{rcbPreInjectMessage:!0,rcbChunkStreamMessage:!0,rcbStartSimulateStreamMessage:!0,rcbStartStreamMessage:!0,rcbStartSpeakAudio:!0}}),c};const Ln=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Nn=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hn={};function Rn(e,t){return(Hn.jsx?Nn:Ln).test(e)}const Fn=/[ \t\n\f\r]/g;function Un(e){return""===e.replace(Fn,"")}class jn{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}}function zn(e,t){const n={},r={};let A=-1;for(;++A<e.length;)Object.assign(n,e[A].property),Object.assign(r,e[A].normal);return new jn(n,r,t)}function _n(e){return e.toLowerCase()}jn.prototype.property={},jn.prototype.normal={},jn.prototype.space=null;class qn{constructor(e,t){this.property=e,this.attribute=t}}qn.prototype.space=null,qn.prototype.boolean=!1,qn.prototype.booleanish=!1,qn.prototype.overloadedBoolean=!1,qn.prototype.number=!1,qn.prototype.commaSeparated=!1,qn.prototype.spaceSeparated=!1,qn.prototype.commaOrSpaceSeparated=!1,qn.prototype.mustUseProperty=!1,qn.prototype.defined=!1;let Gn=0;const Yn=$n(),Wn=$n(),Vn=$n(),Xn=$n(),Kn=$n(),Jn=$n(),Zn=$n();function $n(){return 2**++Gn}const er=Object.freeze(Object.defineProperty({__proto__:null,boolean:Yn,booleanish:Wn,commaOrSpaceSeparated:Zn,commaSeparated:Jn,number:Xn,overloadedBoolean:Vn,spaceSeparated:Kn},Symbol.toStringTag,{value:"Module"})),tr=Object.keys(er);class nr extends qn{constructor(e,t,n,r){let A=-1;if(super(e,t),rr(this,"space",r),"number"==typeof n)for(;++A<tr.length;){const e=tr[A];rr(this,tr[A],(n&er[e])===er[e])}}}function rr(e,t,n){n&&(e[t]=n)}nr.prototype.defined=!0;const Ar={}.hasOwnProperty;function or(e){const t={},n={};let r;for(r in e.properties)if(Ar.call(e.properties,r)){const A=e.properties[r],o=new nr(r,e.transform(e.attributes||{},r),A,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[_n(r)]=r,n[_n(o.attribute)]=r}return new jn(t,n,e.space)}const ir=or({space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),lr=or({space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function ar(e,t){return t in e?e[t]:t}function sr(e,t){return ar(e,t.toLowerCase())}const cr=or({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:sr,properties:{xmlns:null,xmlnsXLink:null}}),ur=or({transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:Wn,ariaAutoComplete:null,ariaBusy:Wn,ariaChecked:Wn,ariaColCount:Xn,ariaColIndex:Xn,ariaColSpan:Xn,ariaControls:Kn,ariaCurrent:null,ariaDescribedBy:Kn,ariaDetails:null,ariaDisabled:Wn,ariaDropEffect:Kn,ariaErrorMessage:null,ariaExpanded:Wn,ariaFlowTo:Kn,ariaGrabbed:Wn,ariaHasPopup:null,ariaHidden:Wn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Kn,ariaLevel:Xn,ariaLive:null,ariaModal:Wn,ariaMultiLine:Wn,ariaMultiSelectable:Wn,ariaOrientation:null,ariaOwns:Kn,ariaPlaceholder:null,ariaPosInSet:Xn,ariaPressed:Wn,ariaReadOnly:Wn,ariaRelevant:null,ariaRequired:Wn,ariaRoleDescription:Kn,ariaRowCount:Xn,ariaRowIndex:Xn,ariaRowSpan:Xn,ariaSelected:Wn,ariaSetSize:Xn,ariaSort:null,ariaValueMax:Xn,ariaValueMin:Xn,ariaValueNow:Xn,ariaValueText:null,role:null}}),dr=or({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:sr,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Jn,acceptCharset:Kn,accessKey:Kn,action:null,allow:null,allowFullScreen:Yn,allowPaymentRequest:Yn,allowUserMedia:Yn,alt:null,as:null,async:Yn,autoCapitalize:null,autoComplete:Kn,autoFocus:Yn,autoPlay:Yn,blocking:Kn,capture:null,charSet:null,checked:Yn,cite:null,className:Kn,cols:Xn,colSpan:null,content:null,contentEditable:Wn,controls:Yn,controlsList:Kn,coords:Xn|Jn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Yn,defer:Yn,dir:null,dirName:null,disabled:Yn,download:Vn,draggable:Wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Yn,formTarget:null,headers:Kn,height:Xn,hidden:Yn,high:Xn,href:null,hrefLang:null,htmlFor:Kn,httpEquiv:Kn,id:null,imageSizes:null,imageSrcSet:null,inert:Yn,inputMode:null,integrity:null,is:null,isMap:Yn,itemId:null,itemProp:Kn,itemRef:Kn,itemScope:Yn,itemType:Kn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Yn,low:Xn,manifest:null,max:null,maxLength:Xn,media:null,method:null,min:null,minLength:Xn,multiple:Yn,muted:Yn,name:null,nonce:null,noModule:Yn,noValidate:Yn,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:Yn,optimum:Xn,pattern:null,ping:Kn,placeholder:null,playsInline:Yn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Yn,referrerPolicy:null,rel:Kn,required:Yn,reversed:Yn,rows:Xn,rowSpan:Xn,sandbox:Kn,scope:null,scoped:Yn,seamless:Yn,selected:Yn,shadowRootClonable:Yn,shadowRootDelegatesFocus:Yn,shadowRootMode:null,shape:null,size:Xn,sizes:null,slot:null,span:Xn,spellCheck:Wn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Xn,step:null,style:null,tabIndex:Xn,target:null,title:null,translate:null,type:null,typeMustMatch:Yn,useMap:null,value:Wn,width:Xn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Kn,axis:null,background:null,bgColor:null,border:Xn,borderColor:null,bottomMargin:Xn,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Yn,declare:Yn,event:null,face:null,frame:null,frameBorder:null,hSpace:Xn,leftMargin:Xn,link:null,longDesc:null,lowSrc:null,marginHeight:Xn,marginWidth:Xn,noResize:Yn,noHref:Yn,noShade:Yn,noWrap:Yn,object:null,profile:null,prompt:null,rev:null,rightMargin:Xn,rules:null,scheme:null,scrolling:Wn,standby:null,summary:null,text:null,topMargin:Xn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Xn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Yn,disableRemotePlayback:Yn,prefix:null,property:null,results:Xn,security:null,unselectable:null}}),fr=or({space:"svg",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"},transform:ar,properties:{about:Zn,accentHeight:Xn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Xn,amplitude:Xn,arabicForm:null,ascent:Xn,attributeName:null,attributeType:null,azimuth:Xn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Xn,by:null,calcMode:null,capHeight:Xn,className:Kn,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:Xn,diffuseConstant:Xn,direction:null,display:null,dur:null,divisor:Xn,dominantBaseline:null,download:Yn,dx:null,dy:null,edgeMode:null,editable:null,elevation:Xn,enableBackground:null,end:null,event:null,exponent:Xn,externalResourcesRequired:null,fill:null,fillOpacity:Xn,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:Jn,g2:Jn,glyphName:Jn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Xn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Xn,horizOriginX:Xn,horizOriginY:Xn,id:null,ideographic:Xn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Xn,k:Xn,k1:Xn,k2:Xn,k3:Xn,k4:Xn,kernelMatrix:Zn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Xn,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:Xn,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:Xn,overlineThickness:Xn,paintOrder:null,panose1:null,path:null,pathLength:Xn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Kn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Xn,pointsAtY:Xn,pointsAtZ:Xn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Zn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Zn,rev:Zn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Zn,requiredFeatures:Zn,requiredFonts:Zn,requiredFormats:Zn,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:Xn,specularExponent:Xn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Xn,strikethroughThickness:Xn,string:null,stroke:null,strokeDashArray:Zn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Xn,strokeOpacity:Xn,strokeWidth:null,style:null,surfaceScale:Xn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Zn,tabIndex:Xn,tableValues:null,target:null,targetX:Xn,targetY:Xn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Zn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Xn,underlineThickness:Xn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Xn,values:null,vAlphabetic:Xn,vMathematical:Xn,vectorEffect:null,vHanging:Xn,vIdeographic:Xn,version:null,vertAdvY:Xn,vertOriginX:Xn,vertOriginY:Xn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Xn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),pr=/^data[-\w.:]+$/i,gr=/-[a-z]/g,hr=/[A-Z]/g;function mr(e){return"-"+e.toLowerCase()}function vr(e){return e.charAt(1).toUpperCase()}const yr={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"},wr=zn([lr,ir,cr,ur,dr],"html"),br=zn([lr,ir,cr,ur,fr],"svg");function Er(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pr,Br,Dr,Cr={};var xr=function(){if(Dr)return Cr;Dr=1;var e=Cr&&Cr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.default=function(e,n){var r=null;if(!e||"string"!=typeof e)return r;var A=(0,t.default)(e),o="function"==typeof n;return A.forEach(function(e){if("declaration"===e.type){var t=e.property,A=e.value;o?n(t,A,e):A&&((r=r||{})[t]=A)}}),r};var t=e(function(){if(Br)return Pr;Br=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,A=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,l=/^\s+|\s+$/g,a="";function s(e){return e?e.replace(l,a):a}return Pr=function(l,c){if("string"!=typeof l)throw new TypeError("First argument must be a string");if(!l)return[];c=c||{};var u=1,d=1;function f(e){var n=e.match(t);n&&(u+=n.length);var r=e.lastIndexOf("\n");d=~r?e.length-r:d+e.length}function p(){var e={line:u,column:d};return function(t){return t.position=new g(e),v(),t}}function g(e){this.start=e,this.end={line:u,column:d},this.source=c.source}function h(e){var t=new Error(c.source+":"+u+":"+d+": "+e);if(t.reason=e,t.filename=c.source,t.line=u,t.column=d,t.source=l,!c.silent)throw t}function m(e){var t=e.exec(l);if(t){var n=t[0];return f(n),l=l.slice(n.length),t}}function v(){m(n)}function y(e){var t;for(e=e||[];t=w();)!1!==t&&e.push(t);return e}function w(){var e=p();if("/"==l.charAt(0)&&"*"==l.charAt(1)){for(var t=2;a!=l.charAt(t)&&("*"!=l.charAt(t)||"/"!=l.charAt(t+1));)++t;if(t+=2,a===l.charAt(t-1))return h("End of comment missing");var n=l.slice(2,t-2);return d+=2,f(n),l=l.slice(t),d+=2,e({type:"comment",comment:n})}}function b(){var t=p(),n=m(r);if(n){if(w(),!m(A))return h("property missing ':'");var l=m(o),c=t({type:"declaration",property:s(n[0].replace(e,a)),value:l?s(l[0].replace(e,a)):a});return m(i),c}}return g.prototype.content=l,v(),function(){var e,t=[];for(y(t);e=b();)!1!==e&&(t.push(e),y(t));return t}()},Pr}());return Cr}();const kr=Er(xr),Sr=kr.default||kr,Tr=Qr("end"),Ir=Qr("start");function Qr(e){return function(t){const n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function Mr(e){return e&&"object"==typeof e?"position"in e||"type"in e?Lr(e.position):"start"in e||"end"in e?Lr(e):"line"in e||"column"in e?Or(e):"":""}function Or(e){return Nr(e&&e.line)+":"+Nr(e&&e.column)}function Lr(e){return Or(e&&e.start)+"-"+Or(e&&e.end)}function Nr(e){return e&&"number"==typeof e?e:1}class Hr extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",A={},o=!1;if(t&&(A="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!A.cause&&e&&(o=!0,r=e.message,A.cause=e),!A.ruleId&&!A.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?A.ruleId=n:(A.source=n.slice(0,e),A.ruleId=n.slice(e+1))}if(!A.place&&A.ancestors&&A.ancestors){const e=A.ancestors[A.ancestors.length-1];e&&(A.place=e.position)}const i=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=i?i.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=i?i.line:void 0,this.name=Mr(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&&"string"==typeof A.cause.stack?A.cause.stack:"",this.actual,this.expected,this.note,this.url}}Hr.prototype.file="",Hr.prototype.name="",Hr.prototype.reason="",Hr.prototype.message="",Hr.prototype.stack="",Hr.prototype.column=void 0,Hr.prototype.line=void 0,Hr.prototype.ancestors=void 0,Hr.prototype.cause=void 0,Hr.prototype.fatal=void 0,Hr.prototype.place=void 0,Hr.prototype.ruleId=void 0,Hr.prototype.source=void 0;const Rr={}.hasOwnProperty,Fr=new Map,Ur=/[A-Z]/g,jr=/-([a-z])/g,zr=new Set(["table","tbody","thead","tfoot","tr"]),_r=new Set(["td","th"]),qr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Gr(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=function(e,t){return n;function n(n,r,A,o){const i=Array.isArray(A.children),l=Ir(n);return t(r,A,o,i,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}(n,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");r=function(e,t,n){return r;function r(e,r,A,o){const i=Array.isArray(A.children)?n:t;return o?i(r,A,o):i(r,A)}}(0,t.jsx,t.jsxs)}const A={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:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?br:wr,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},o=Yr(A,e,void 0);return o&&"string"!=typeof o?o:A.create(e,A.Fragment,{children:o||void 0},void 0)}function Yr(e,t,n){return"element"===t.type?function(e,t,n){const r=e.schema;let A=r;"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(A=br,e.schema=A),e.ancestors.push(t);const o=Jr(e,t.tagName,!1),i=function(e,t){const n={};let r,A;for(A in t.properties)if("children"!==A&&Rr.call(t.properties,A)){const o=Kr(e,A,t.properties[A]);if(o){const[A,i]=o;e.tableCellAlignToStyle&&"align"===A&&"string"==typeof i&&_r.has(t.tagName)?r=i:n[A]=i}}if(r){(n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r}return n}(e,t);let l=Xr(e,t);return zr.has(t.tagName)&&(l=l.filter(function(e){return"string"!=typeof e||!function(e){return"object"==typeof e?"text"===e.type&&Un(e.value):Un(e)}(e)})),Wr(e,i,o,t),Vr(i,l),e.ancestors.pop(),e.schema=r,e.create(t,o,i,n)}(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Zr(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,n){const r=e.schema;let A=r;"svg"===t.name&&"html"===r.space&&(A=br,e.schema=A),e.ancestors.push(t);const o=null===t.name?e.Fragment:Jr(e,t.name,!0),i=function(e,t){const n={};for(const r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){const t=r.data.estree.body[0];t.type;const A=t.expression;A.type;const o=A.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Zr(e,t.position);else{const A=r.name;let o;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){const t=r.value.data.estree.body[0];t.type,o=e.evaluater.evaluateExpression(t.expression)}else Zr(e,t.position);else o=null===r.value||r.value;n[A]=o}return n}(e,t),l=Xr(e,t);return Wr(e,i,o,t),Vr(i,l),e.ancestors.pop(),e.schema=r,e.create(t,o,i,n)}(e,t,n):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zr(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const r={};return Vr(r,Xr(e,t)),e.create(t,e.Fragment,r,n)}(e,t,n):"text"===t.type?function(e,t){return t.value}(0,t):void 0}function Wr(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Xr(e,t){const n=[];let r=-1;const A=e.passKeys?new Map:Fr;for(;++r<t.children.length;){const o=t.children[r];let i;if(e.passKeys){const e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){const t=A.get(e)||0;i=e+"-"+t,A.set(e,t+1)}}const l=Yr(e,o,i);void 0!==l&&n.push(l)}return n}function Kr(e,t,n){const r=function(e,t){const n=_n(t);let r=t,A=qn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&pr.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(gr,vr);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!gr.test(e)){let n=e.replace(hr,mr);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}A=nr}return new A(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?function(e){const t={};return(""===e[e.length-1]?[...e,""]:e).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()}(n):function(e){return e.join(" ").trim()}(n)),"style"===r.property){let t="object"==typeof n?n:function(e,t){const n={};try{Sr(t,r)}catch(t){if(!e.ignoreInvalidStyle){const n=t,r=new Hr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=qr+"#cannot-parse-style-attribute",r}}return n;function r(e,t){let r=e;"--"!==r.slice(0,2)&&("-ms-"===r.slice(0,4)&&(r="ms-"+r.slice(4)),r=r.replace(jr,eA)),n[r]=t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)Rr.call(e,n)&&(t[$r(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?yr[r.property]||r.property:r.attribute,n]}}function Jr(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,A=-1;for(;++A<e.length;){const t=Rn(e[A])?{type:"Identifier",name:e[A]}:{type:"Literal",value:e[A]};n=n?{type:"MemberExpression",object:n,property:t,computed:!(!A||"Literal"!==t.type),optional:!1}:t}r=n}else r=Rn(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){const t=r.value;return Rr.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Zr(e)}function Zr(e,t){const n=new Hr("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=qr+"#cannot-handle-mdx-estrees-without-createevaluater",n}function $r(e){let t=e.replace(Ur,tA);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function eA(e,t){return t.toUpperCase()}function tA(e){return"-"+e.toLowerCase()}const nA={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"]},rA={};function AA(e,t,n){if(function(e){return!(!e||"object"!=typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return oA(e.children,t,n)}return Array.isArray(e)?oA(e,t,n):""}function oA(e,t,n){const r=[];let A=-1;for(;++A<e.length;)r[A]=AA(e[A],t,n);return r.join("")}const iA=document.createElement("i");function lA(e){const t="&"+e+";";iA.innerHTML=t;const n=iA.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}function aA(e,t,n,r){const A=e.length;let o,i=0;if(t=t<0?-t>A?0:A+t:t>A?A: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);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function sA(e,t){return e.length>0?(aA(e,e.length,0,t),e):t}const cA={}.hasOwnProperty;function uA(e){const t={};let n=-1;for(;++n<e.length;)dA(t,e[n]);return t}function dA(e,t){let n;for(n in t){const r=(cA.call(e,n)?e[n]:void 0)||(e[n]={}),A=t[n];let o;if(A)for(o in A){cA.call(r,o)||(r[o]=[]);const e=A[o];fA(r[o],Array.isArray(e)?e:e?[e]:[])}}}function fA(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);aA(e,0,0,r)}function pA(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}function gA(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hA=kA(/[A-Za-z]/),mA=kA(/[\dA-Za-z]/),vA=kA(/[#-'*+\--9=?A-Z^-~]/);function yA(e){return null!==e&&(e<32||127===e)}const wA=kA(/\d/),bA=kA(/[\dA-Fa-f]/),EA=kA(/[!-/:-@[-`{-~]/);function PA(e){return null!==e&&e<-2}function BA(e){return null!==e&&(e<0||32===e)}function DA(e){return-2===e||-1===e||32===e}const CA=kA(new RegExp("\\p{P}|\\p{S}","u")),xA=kA(/\s/);function kA(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function SA(e){const t=[];let n=-1,r=0,A=0;for(;++n<e.length;){const o=e.charCodeAt(n);let i="";if(37===o&&mA(e.charCodeAt(n+1))&&mA(e.charCodeAt(n+2)))A=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(i=String.fromCharCode(o));else if(o>55295&&o<57344){const t=e.charCodeAt(n+1);o<56320&&t>56319&&t<57344?(i=String.fromCharCode(o,t),A=1):i="�"}else i=String.fromCharCode(o);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+A+1,i=""),A&&(n+=A,A=0)}return t.join("")+e.slice(r)}function TA(e,t,n,r){const A=r?r-1:Number.POSITIVE_INFINITY;let o=0;return function(r){return DA(r)?(e.enter(n),i(r)):t(r)};function i(r){return DA(r)&&o++<A?(e.consume(r),i):(e.exit(n),t(r))}}const IA={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,function(n){if(null===n)return void e.consume(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),TA(e,t,"linePrefix")},function(t){return e.enter("paragraph"),r(t)});let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,A(t)}function A(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):PA(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),A)}}};const QA={tokenize:function(e){const t=this,n=[];let r,A,o,i=0;return l;function l(r){if(i<n.length){const A=n[i];return t.containerState=A[1],e.attempt(A[0].continuation,a,s)(r)}return s(r)}function a(e){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&v();const n=t.events.length;let A,o=n;for(;o--;)if("exit"===t.events[o][0]&&"chunkFlow"===t.events[o][1].type){A=t.events[o][1].end;break}m(i);let l=n;for(;l<t.events.length;)t.events[l][1].end={...A},l++;return aA(t.events,o+1,0,t.events.slice(n)),t.events.length=l,s(e)}return l(e)}function s(A){if(i===n.length){if(!r)return d(A);if(r.currentConstruct&&r.currentConstruct.concrete)return p(A);t.interrupt=!(!r.currentConstruct||r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(MA,c,u)(A)}function c(e){return r&&v(),m(i),d(e)}function u(e){return t.parser.lazy[t.now().line]=i!==n.length,o=t.now().offset,p(e)}function d(n){return t.containerState={},e.attempt(MA,f,p)(n)}function f(e){return i++,n.push([t.currentConstruct,t.containerState]),d(e)}function p(n){return null===n?(r&&v(),m(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:A}),g(n))}function g(n){return null===n?(h(e.exit("chunkFlow"),!0),m(0),void e.consume(n)):PA(n)?(e.consume(n),h(e.exit("chunkFlow")),i=0,t.interrupt=void 0,l):(e.consume(n),g)}function h(e,n){const l=t.sliceStream(e);if(n&&l.push(null),e.previous=A,A&&(A.next=e),A=e,r.defineSkip(e.start),r.write(l),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<o&&(!r.events[e][1].end||r.events[e][1].end.offset>o))return;const n=t.events.length;let A,l,a=n;for(;a--;)if("exit"===t.events[a][0]&&"chunkFlow"===t.events[a][1].type){if(A){l=t.events[a][1].end;break}A=!0}for(m(i),e=n;e<t.events.length;)t.events[e][1].end={...l},e++;aA(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function m(r){let A=n.length;for(;A-- >r;){const r=n[A];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){r.write([null]),A=void 0,r=void 0,t.containerState._closeFlow=void 0}}},MA={tokenize:function(e,t,n){return TA(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function OA(e){return null===e||BA(e)||xA(e)?1:CA(e)?2:void 0}function LA(e,t,n){const r=[];let A=-1;for(;++A<e.length;){const o=e[A].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const NA={name:"attention",resolveAll:function(e,t){let n,r,A,o,i,l,a,s,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close)for(n=c;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[n][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;l=e[n][1].end.offset-e[n][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;const u={...e[n][1].end},d={...e[c][1].start};HA(u,-l),HA(d,l),o={type:l>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},i={type:l>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:d},A={type:l>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[c][1].start}},r={type:l>1?"strong":"emphasis",start:{...o.start},end:{...i.end}},e[n][1].end={...o.start},e[c][1].start={...i.end},a=[],e[n][1].end.offset-e[n][1].start.offset&&(a=sA(a,[["enter",e[n][1],t],["exit",e[n][1],t]])),a=sA(a,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",A,t]]),a=sA(a,LA(t.parser.constructs.insideSpan.null,e.slice(n+1,c),t)),a=sA(a,[["exit",A,t],["enter",i,t],["exit",i,t],["exit",r,t]]),e[c][1].end.offset-e[c][1].start.offset?(s=2,a=sA(a,[["enter",e[c][1],t],["exit",e[c][1],t]])):s=0,aA(e,n-1,c-n+3,a),c=n+a.length-s-2;break}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,A=OA(r);let o;return function(t){return o=t,e.enter("attentionSequence"),i(t)};function i(l){if(l===o)return e.consume(l),i;const a=e.exit("attentionSequence"),s=OA(l),c=!s||2===s&&A||n.includes(l),u=!A||2===A&&s||n.includes(r);return a._open=!!(42===o?c:c&&(A||!u)),a._close=!!(42===o?u:u&&(s||!c)),t(l)}}};function HA(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const RA={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),A};function A(t){return hA(t)?(e.consume(t),o):64===t?n(t):a(t)}function o(e){return 43===e||45===e||46===e||mA(e)?(r=1,i(e)):a(e)}function i(t){return 58===t?(e.consume(t),r=0,l):(43===t||45===t||46===t||mA(t))&&r++<32?(e.consume(t),i):(r=0,a(t))}function l(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||yA(r)?n(r):(e.consume(r),l)}function a(t){return 64===t?(e.consume(t),s):vA(t)?(e.consume(t),a):n(t)}function s(e){return mA(e)?c(e):n(e)}function c(n){return 46===n?(e.consume(n),r=0,s):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):u(n)}function u(t){if((45===t||mA(t))&&r++<63){const n=45===t?u:c;return e.consume(t),n}return n(t)}}};const FA={partial:!0,tokenize:function(e,t,n){return function(t){return DA(t)?TA(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||PA(e)?t(e):n(e)}}};const UA={continuation:{tokenize:function(e,t,n){const r=this;return function(t){return DA(t)?TA(e,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):A(t)};function A(r){return e.attempt(UA,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),A}return n(t)};function A(n){return DA(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};const jA={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return EA(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const zA={name:"characterReference",tokenize:function(e,t,n){const r=this;let A,o,i=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),l};function l(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),a):(e.enter("characterReferenceValue"),A=31,o=mA,s(t))}function a(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),A=6,o=bA,s):(e.enter("characterReferenceValue"),A=7,o=wA,s(t))}function s(l){if(59===l&&i){const A=e.exit("characterReferenceValue");return o!==mA||lA(r.sliceSerialize(A))?(e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(l)}return o(l)&&i++<A?(e.consume(l),s):n(l)}}};const _A={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A)};function A(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},qA={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const r=this,A={partial:!0,tokenize:function(e,t,n){let A=0;return i;function i(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a}function a(t){return e.enter("codeFencedFence"),DA(t)?TA(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):s(t)}function s(t){return t===o?(e.enter("codeFencedFenceSequence"),c(t)):n(t)}function c(t){return t===o?(A++,e.consume(t),c):A>=l?(e.exit("codeFencedFenceSequence"),DA(t)?TA(e,u,"whitespace")(t):u(t)):n(t)}function u(r){return null===r||PA(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let o,i=0,l=0;return function(t){return function(t){const n=r.events[r.events.length-1];return i=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,o=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),a(t)}(t)};function a(t){return t===o?(l++,e.consume(t),a):l<3?n(t):(e.exit("codeFencedFenceSequence"),DA(t)?TA(e,s,"whitespace")(t):s(t))}function s(n){return null===n||PA(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(_A,f,v)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),c(n))}function c(t){return null===t||PA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),s(t)):DA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),TA(e,u,"whitespace")(t)):96===t&&t===o?n(t):(e.consume(t),c)}function u(t){return null===t||PA(t)?s(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(t))}function d(t){return null===t||PA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),s(t)):96===t&&t===o?n(t):(e.consume(t),d)}function f(t){return e.attempt(A,v,p)(t)}function p(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),g}function g(t){return i>0&&DA(t)?TA(e,h,"linePrefix",i+1)(t):h(t)}function h(t){return null===t||PA(t)?e.check(_A,f,v)(t):(e.enter("codeFlowValue"),m(t))}function m(t){return null===t||PA(t)?(e.exit("codeFlowValue"),h(t)):(e.consume(t),m)}function v(n){return e.exit("codeFenced"),t(n)}}};const GA={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),TA(e,A,"linePrefix",5)(t)};function A(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return null===t?l(t):PA(t)?e.attempt(YA,o,l)(t):(e.enter("codeFlowValue"),i(t))}function i(t){return null===t||PA(t)?(e.exit("codeFlowValue"),o(t)):(e.consume(t),i)}function l(n){return e.exit("codeIndented"),t(n)}}},YA={partial:!0,tokenize:function(e,t,n){const r=this;return A;function A(t){return r.parser.lazy[r.now().line]?n(t):PA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A):TA(e,o,"linePrefix",5)(t)}function o(e){const o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(e):PA(e)?A(e):n(e)}}};const WA={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,A=3;if(!("lineEnding"!==e[A][1].type&&"space"!==e[A][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=A;++t<r;)if("codeTextData"===e[t][1].type){e[A][1].type="codeTextPadding",e[r][1].type="codeTextPadding",A+=2,r-=2;break}for(t=A-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,A,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),i(t)};function i(t){return 96===t?(e.consume(t),o++,i):(e.exit("codeTextSequence"),l(t))}function l(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),l):96===t?(A=e.enter("codeTextSequence"),r=0,s(t)):PA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l):(e.enter("codeTextData"),a(t))}function a(t){return null===t||32===t||96===t||PA(t)?(e.exit("codeTextData"),l(t)):(e.consume(t),a)}function s(n){return 96===n?(e.consume(n),r++,s):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(A.type="codeTextData",a(n))}}};class VA{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const n=t??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const r=t||0;this.setCursor(Math.trunc(e));const A=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&XA(this.left,n),A.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),XA(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),XA(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);XA(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);XA(this.left,t.reverse())}}}function XA(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 KA(e){const t={};let n,r,A,o,i,l,a,s=-1;const c=new VA(e);for(;++s<c.length;){for(;s in t;)s=t[s];if(n=c.get(s),s&&"chunkFlow"===n[1].type&&"listItemPrefix"===c.get(s-1)[1].type&&(l=n[1]._tokenizer.events,A=0,A<l.length&&"lineEndingBlank"===l[A][1].type&&(A+=2),A<l.length&&"content"===l[A][1].type))for(;++A<l.length&&"content"!==l[A][1].type;)"chunkText"===l[A][1].type&&(l[A][1]._isInFirstContentOfListItem=!0,A++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,JA(c,s)),s=t[s],a=!0);else if(n[1]._container){for(A=s,r=void 0;A--;)if(o=c.get(A),"lineEnding"===o[1].type||"lineEndingBlank"===o[1].type)"enter"===o[0]&&(r&&(c.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=A);else if("linePrefix"!==o[1].type)break;r&&(n[1].end={...c.get(r)[1].start},i=c.slice(r,s),i.unshift(n),c.splice(r,s-r+1,i))}}return aA(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!a}function JA(e,t){const n=e.get(t)[1],r=e.get(t)[2];let A=t-1;const o=[],i=n._tokenizer||r.parser[n.contentType](n.start),l=i.events,a=[],s={};let c,u,d=-1,f=n,p=0,g=0;const h=[g];for(;f;){for(;e.get(++A)[1]!==f;);o.push(A),f._tokenizer||(c=r.sliceStream(f),f.next||c.push(null),u&&i.defineSkip(f.start),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(c),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),u=f,f=f.next}for(f=n;++d<l.length;)"exit"===l[d][0]&&"enter"===l[d-1][0]&&l[d][1].type===l[d-1][1].type&&l[d][1].start.line!==l[d][1].end.line&&(g=d+1,h.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(i.events=[],f?(f._tokenizer=void 0,f.previous=void 0):h.pop(),d=h.length;d--;){const t=l.slice(h[d],h[d+1]),n=o.pop();a.push([n,n+t.length-1]),e.splice(n,2,t)}for(a.reverse(),d=-1;++d<a.length;)s[p+a[d][0]]=p+a[d][1],p+=a[d][1]-a[d][0]-1;return s}const ZA={resolve:function(e){return KA(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?A(t):PA(t)?e.check($A,o,A)(t):(e.consume(t),r)}function A(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function o(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},$A={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),TA(e,A,"linePrefix")};function A(A){if(null===A||PA(A))return n(A);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(A):e.interrupt(r.parser.constructs.flow,n,t)(A)}}};function eo(e,t,n,r,A,o,i,l,a){const s=a||Number.POSITIVE_INFINITY;let c=0;return function(t){return 60===t?(e.enter(r),e.enter(A),e.enter(o),e.consume(t),e.exit(o),u):null===t||32===t||41===t||yA(t)?n(t):(e.enter(r),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),p(t))};function u(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(A),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),d(n))}function d(t){return 62===t?(e.exit("chunkString"),e.exit(l),u(t)):null===t||60===t||PA(t)?n(t):(e.consume(t),92===t?f:d)}function f(t){return 60===t||62===t||92===t?(e.consume(t),d):d(t)}function p(A){return c||null!==A&&41!==A&&!BA(A)?c<s&&40===A?(e.consume(A),c++,p):41===A?(e.consume(A),c--,p):null===A||32===A||40===A||yA(A)?n(A):(e.consume(A),92===A?g:p):(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(r),t(A))}function g(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function to(e,t,n,r,A,o){const i=this;let l,a=0;return function(t){return e.enter(r),e.enter(A),e.consume(t),e.exit(A),e.enter(o),s};function s(u){return a>999||null===u||91===u||93===u&&!l||94===u&&!a&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):93===u?(e.exit(o),e.enter(A),e.consume(u),e.exit(A),e.exit(r),t):PA(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):(e.enter("chunkString",{contentType:"string"}),c(u))}function c(t){return null===t||91===t||93===t||PA(t)||a++>999?(e.exit("chunkString"),s(t)):(e.consume(t),l||(l=!DA(t)),92===t?u:c)}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}}function no(e,t,n,r,A,o){let i;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(A),e.consume(t),e.exit(A),i=40===t?41:t,l):n(t)};function l(n){return n===i?(e.enter(A),e.consume(n),e.exit(A),e.exit(r),t):(e.enter(o),a(n))}function a(t){return t===i?(e.exit(o),l(i)):null===t?n(t):PA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),TA(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),s(t))}function s(t){return t===i||null===t||PA(t)?(e.exit("chunkString"),a(t)):(e.consume(t),92===t?c:s)}function c(t){return t===i||92===t?(e.consume(t),s):s(t)}}function ro(e,t){let n;return function r(A){return PA(A)?(e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),n=!0,r):DA(A)?TA(e,r,n?"linePrefix":"lineSuffix")(A):t(A)}}const Ao={name:"definition",tokenize:function(e,t,n){const r=this;let A;return function(t){return e.enter("definition"),function(t){return to.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function o(t){return A=gA(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),i):n(t)}function i(t){return BA(t)?ro(e,l)(t):l(t)}function l(t){return eo(e,a,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function a(t){return e.attempt(oo,s,s)(t)}function s(t){return DA(t)?TA(e,c,"whitespace")(t):c(t)}function c(o){return null===o||PA(o)?(e.exit("definition"),r.parser.defined.push(A),t(o)):n(o)}}},oo={partial:!0,tokenize:function(e,t,n){return function(t){return BA(t)?ro(e,r)(t):n(t)};function r(t){return no(e,A,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function A(t){return DA(t)?TA(e,o,"whitespace")(t):o(t)}function o(e){return null===e||PA(e)?t(e):n(e)}}};const io={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return PA(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};const lo={name:"headingAtx",resolve:function(e,t){let n,r,A=e.length-2,o=3;return"whitespace"===e[o][1].type&&(o+=2),A-2>o&&"whitespace"===e[A][1].type&&(A-=2),"atxHeadingSequence"===e[A][1].type&&(o===A-1||A-4>o&&"whitespace"===e[A-2][1].type)&&(A-=o+1===A?2:4),A>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[A][1].end},r={type:"chunkText",start:e[o][1].start,end:e[A][1].end,contentType:"text"},aA(e,o,A-o+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),A(t)}(t)};function A(t){return 35===t&&r++<6?(e.consume(t),A):null===t||BA(t)?(e.exit("atxHeadingSequence"),o(t)):n(t)}function o(n){return 35===n?(e.enter("atxHeadingSequence"),i(n)):null===n||PA(n)?(e.exit("atxHeading"),t(n)):DA(n)?TA(e,o,"whitespace")(n):(e.enter("atxHeadingText"),l(n))}function i(t){return 35===t?(e.consume(t),i):(e.exit("atxHeadingSequence"),o(t))}function l(t){return null===t||35===t||BA(t)?(e.exit("atxHeadingText"),o(t)):(e.consume(t),l)}}};const ao=["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"],so=["pre","script","style","textarea"],co={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(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},tokenize:function(e,t,n){const r=this;let A,o,i,l,a;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),s}(t)};function s(l){return 33===l?(e.consume(l),c):47===l?(e.consume(l),o=!0,f):63===l?(e.consume(l),A=3,r.interrupt?t:O):hA(l)?(e.consume(l),i=String.fromCharCode(l),p):n(l)}function c(o){return 45===o?(e.consume(o),A=2,u):91===o?(e.consume(o),A=5,l=0,d):hA(o)?(e.consume(o),A=4,r.interrupt?t:O):n(o)}function u(A){return 45===A?(e.consume(A),r.interrupt?t:O):n(A)}function d(A){const o="CDATA[";return A===o.charCodeAt(l++)?(e.consume(A),6===l?r.interrupt?t:C:d):n(A)}function f(t){return hA(t)?(e.consume(t),i=String.fromCharCode(t),p):n(t)}function p(l){if(null===l||47===l||62===l||BA(l)){const a=47===l,s=i.toLowerCase();return a||o||!so.includes(s)?ao.includes(i.toLowerCase())?(A=6,a?(e.consume(l),g):r.interrupt?t(l):C(l)):(A=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(l):o?h(l):m(l)):(A=1,r.interrupt?t(l):C(l))}return 45===l||mA(l)?(e.consume(l),i+=String.fromCharCode(l),p):n(l)}function g(A){return 62===A?(e.consume(A),r.interrupt?t:C):n(A)}function h(t){return DA(t)?(e.consume(t),h):B(t)}function m(t){return 47===t?(e.consume(t),B):58===t||95===t||hA(t)?(e.consume(t),v):DA(t)?(e.consume(t),m):B(t)}function v(t){return 45===t||46===t||58===t||95===t||mA(t)?(e.consume(t),v):y(t)}function y(t){return 61===t?(e.consume(t),w):DA(t)?(e.consume(t),y):m(t)}function w(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,b):DA(t)?(e.consume(t),w):E(t)}function b(t){return t===a?(e.consume(t),a=null,P):null===t||PA(t)?n(t):(e.consume(t),b)}function E(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||BA(t)?y(t):(e.consume(t),E)}function P(e){return 47===e||62===e||DA(e)?m(e):n(e)}function B(t){return 62===t?(e.consume(t),D):n(t)}function D(t){return null===t||PA(t)?C(t):DA(t)?(e.consume(t),D):n(t)}function C(t){return 45===t&&2===A?(e.consume(t),T):60===t&&1===A?(e.consume(t),I):62===t&&4===A?(e.consume(t),L):63===t&&3===A?(e.consume(t),O):93===t&&5===A?(e.consume(t),M):!PA(t)||6!==A&&7!==A?null===t||PA(t)?(e.exit("htmlFlowData"),x(t)):(e.consume(t),C):(e.exit("htmlFlowData"),e.check(uo,N,x)(t))}function x(t){return e.check(fo,k,N)(t)}function k(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||PA(t)?x(t):(e.enter("htmlFlowData"),C(t))}function T(t){return 45===t?(e.consume(t),O):C(t)}function I(t){return 47===t?(e.consume(t),i="",Q):C(t)}function Q(t){if(62===t){const n=i.toLowerCase();return so.includes(n)?(e.consume(t),L):C(t)}return hA(t)&&i.length<8?(e.consume(t),i+=String.fromCharCode(t),Q):C(t)}function M(t){return 93===t?(e.consume(t),O):C(t)}function O(t){return 62===t?(e.consume(t),L):45===t&&2===A?(e.consume(t),O):C(t)}function L(t){return null===t||PA(t)?(e.exit("htmlFlowData"),N(t)):(e.consume(t),L)}function N(n){return e.exit("htmlFlow"),t(n)}}},uo={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(FA,t,n)}}},fo={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return PA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A):n(t)};function A(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}};const po={name:"htmlText",tokenize:function(e,t,n){const r=this;let A,o,i;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),l};function l(t){return 33===t?(e.consume(t),a):47===t?(e.consume(t),w):63===t?(e.consume(t),v):hA(t)?(e.consume(t),P):n(t)}function a(t){return 45===t?(e.consume(t),s):91===t?(e.consume(t),o=0,f):hA(t)?(e.consume(t),m):n(t)}function s(t){return 45===t?(e.consume(t),d):n(t)}function c(t){return null===t?n(t):45===t?(e.consume(t),u):PA(t)?(i=c,Q(t)):(e.consume(t),c)}function u(t){return 45===t?(e.consume(t),d):c(t)}function d(e){return 62===e?I(e):45===e?u(e):c(e)}function f(t){const r="CDATA[";return t===r.charCodeAt(o++)?(e.consume(t),6===o?p:f):n(t)}function p(t){return null===t?n(t):93===t?(e.consume(t),g):PA(t)?(i=p,Q(t)):(e.consume(t),p)}function g(t){return 93===t?(e.consume(t),h):p(t)}function h(t){return 62===t?I(t):93===t?(e.consume(t),h):p(t)}function m(t){return null===t||62===t?I(t):PA(t)?(i=m,Q(t)):(e.consume(t),m)}function v(t){return null===t?n(t):63===t?(e.consume(t),y):PA(t)?(i=v,Q(t)):(e.consume(t),v)}function y(e){return 62===e?I(e):v(e)}function w(t){return hA(t)?(e.consume(t),b):n(t)}function b(t){return 45===t||mA(t)?(e.consume(t),b):E(t)}function E(t){return PA(t)?(i=E,Q(t)):DA(t)?(e.consume(t),E):I(t)}function P(t){return 45===t||mA(t)?(e.consume(t),P):47===t||62===t||BA(t)?B(t):n(t)}function B(t){return 47===t?(e.consume(t),I):58===t||95===t||hA(t)?(e.consume(t),D):PA(t)?(i=B,Q(t)):DA(t)?(e.consume(t),B):I(t)}function D(t){return 45===t||46===t||58===t||95===t||mA(t)?(e.consume(t),D):C(t)}function C(t){return 61===t?(e.consume(t),x):PA(t)?(i=C,Q(t)):DA(t)?(e.consume(t),C):B(t)}function x(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),A=t,k):PA(t)?(i=x,Q(t)):DA(t)?(e.consume(t),x):(e.consume(t),S)}function k(t){return t===A?(e.consume(t),A=void 0,T):null===t?n(t):PA(t)?(i=k,Q(t)):(e.consume(t),k)}function S(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||BA(t)?B(t):(e.consume(t),S)}function T(e){return 47===e||62===e||BA(e)?B(e):n(e)}function I(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function Q(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),M}function M(t){return DA(t)?TA(e,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):O(t)}function O(t){return e.enter("htmlTextData"),i(t)}}};const go={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){const e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&aA(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,A,o,i=e.length,l=0;for(;i--;)if(n=e[i][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[i][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(A){if("enter"===e[i][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=i,"labelLink"!==n.type)){l=2;break}}else"labelEnd"===n.type&&(A=i);const a={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},s={type:"label",start:{...e[r][1].start},end:{...e[A][1].end}},c={type:"labelText",start:{...e[r+l+2][1].end},end:{...e[A-2][1].start}};return o=[["enter",a,t],["enter",s,t]],o=sA(o,e.slice(r+1,r+l+3)),o=sA(o,[["enter",c,t]]),o=sA(o,LA(t.parser.constructs.insideSpan.null,e.slice(r+l+4,A-3),t)),o=sA(o,[["exit",c,t],e[A-2],e[A-1],["exit",s,t]]),o=sA(o,e.slice(A+1)),o=sA(o,[["exit",a,t]]),aA(e,r,e.length,o),e},tokenize:function(e,t,n){const r=this;let A,o,i=r.events.length;for(;i--;)if(("labelImage"===r.events[i][1].type||"labelLink"===r.events[i][1].type)&&!r.events[i][1]._balanced){A=r.events[i][1];break}return function(t){return A?A._inactive?c(t):(o=r.parser.defined.includes(gA(r.sliceSerialize({start:A.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),l):n(t)};function l(t){return 40===t?e.attempt(ho,s,o?s:c)(t):91===t?e.attempt(mo,s,o?a:c)(t):o?s(t):c(t)}function a(t){return e.attempt(vo,s,c)(t)}function s(e){return t(e)}function c(e){return A._balanced=!0,n(e)}}},ho={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return BA(t)?ro(e,A)(t):A(t)}function A(t){return 41===t?s(t):eo(e,o,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return BA(t)?ro(e,l)(t):s(t)}function i(e){return n(e)}function l(t){return 34===t||39===t||40===t?no(e,a,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):s(t)}function a(t){return BA(t)?ro(e,s)(t):s(t)}function s(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},mo={tokenize:function(e,t,n){const r=this;return function(t){return to.call(r,e,A,o,"reference","referenceMarker","referenceString")(t)};function A(e){return r.parser.defined.includes(gA(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},vo={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}};const yo={name:"labelStartImage",resolveAll:go.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),A};function A(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):n(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const wo={name:"labelStartLink",resolveAll:go.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),A};function A(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const bo={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),TA(e,t,"linePrefix")}}};const Eo={name:"thematicBreak",tokenize:function(e,t,n){let r,A=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,o(e)}(t)};function o(o){return o===r?(e.enter("thematicBreakSequence"),i(o)):A>=3&&(null===o||PA(o))?(e.exit("thematicBreak"),t(o)):n(o)}function i(t){return t===r?(e.consume(t),A++,i):(e.exit("thematicBreakSequence"),DA(t)?TA(e,o,"whitespace")(t):o(t))}}};const Po={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(FA,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,TA(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!DA(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,A(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Do,t,A)(n))});function A(A){return r.containerState._closeFlow=!0,r.interrupt=void 0,TA(e,e.attempt(Po,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const r=this,A=r.events[r.events.length-1];let o=A&&"linePrefix"===A[1].type?A[2].sliceSerialize(A[1],!0).length:0,i=0;return function(t){const A=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===A?!r.containerState.marker||t===r.containerState.marker:wA(t)){if(r.containerState.type||(r.containerState.type=A,e.enter(A,{_container:!0})),"listUnordered"===A)return e.enter("listItemPrefix"),42===t||45===t?e.check(Eo,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(t)}return n(t)};function l(t){return wA(t)&&++i<10?(e.consume(t),l):(!r.interrupt||i<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),a(t)):n(t)}function a(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(FA,r.interrupt?n:s,e.attempt(Bo,u,c))}function s(e){return r.containerState.initialBlankLine=!0,o++,u(e)}function c(t){return DA(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},Bo={partial:!0,tokenize:function(e,t,n){const r=this;return TA(e,function(e){const A=r.events[r.events.length-1];return!DA(e)&&A&&"listItemPrefixWhitespace"===A[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},Do={partial:!0,tokenize:function(e,t,n){const r=this;return TA(e,function(e){const A=r.events[r.events.length-1];return A&&"listItemIndent"===A[1].type&&A[2].sliceSerialize(A[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}};const Co={name:"setextUnderline",resolveTo:function(e,t){let n,r,A,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),!A&&"definition"===e[o][1].type&&(A=o);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",A?(e.splice(r,0,["enter",i,t]),e.splice(A+1,0,["exit",e[n][1],t]),e[n][1].end={...e[A][1].end}):e[n][1]=i,e.push(["exit",i,t]),e},tokenize:function(e,t,n){const r=this;let A;return function(t){let i,l=r.events.length;for(;l--;)if("lineEnding"!==r.events[l][1].type&&"linePrefix"!==r.events[l][1].type&&"content"!==r.events[l][1].type){i="paragraph"===r.events[l][1].type;break}return r.parser.lazy[r.now().line]||!r.interrupt&&!i?n(t):(e.enter("setextHeadingLine"),A=t,function(t){return e.enter("setextHeadingLineSequence"),o(t)}(t))};function o(t){return t===A?(e.consume(t),o):(e.exit("setextHeadingLineSequence"),DA(t)?TA(e,i,"lineSuffix")(t):i(t))}function i(r){return null===r||PA(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};const xo={tokenize:function(e){const t=this,n=e.attempt(FA,function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,TA(e,e.attempt(this.parser.constructs.flow,r,e.attempt(ZA,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}};const ko={resolveAll:Qo()},So=Io("string"),To=Io("text");function Io(e){return{resolveAll:Qo("text"===e?Mo:void 0),tokenize:function(t){const n=this,r=this.parser.constructs[e],A=t.attempt(r,o,i);return o;function o(e){return a(e)?A(e):i(e)}function i(e){if(null!==e)return t.enter("data"),t.consume(e),l;t.consume(e)}function l(e){return a(e)?(t.exit("data"),A(e)):(t.consume(e),l)}function a(e){if(null===e)return!0;const t=r[e];let A=-1;if(t)for(;++A<t.length;){const e=t[A];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function Qo(e){return function(t,n){let r,A=-1;for(;++A<=t.length;)void 0===r?t[A]&&"data"===t[A][1].type&&(r=A,A++):(!t[A]||"data"!==t[A][1].type)&&(A!==r+2&&(t[r][1].end=t[A-1][1].end,t.splice(r+2,A-r-2),A=r+2),r=void 0);return e?e(t,n):t}}function Mo(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],A=t.sliceStream(r);let o,i=A.length,l=-1,a=0;for(;i--;){const e=A[i];if("string"==typeof e){for(l=e.length;32===e.charCodeAt(l-1);)a++,l--;if(l)break;l=-1}else if(-2===e)o=!0,a++;else if(-1!==e){i++;break}}if(a){const A={type:n===e.length||o||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?l:r.start._bufferIndex+l,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...A.start},r.start.offset===r.end.offset?Object.assign(r,A):(e.splice(n,0,["enter",A,t],["exit",A,t]),n+=2)}n++}return e}const Oo={42:Po,43:Po,45:Po,48:Po,49:Po,50:Po,51:Po,52:Po,53:Po,54:Po,55:Po,56:Po,57:Po,62:UA},Lo={91:Ao},No={[-2]:GA,[-1]:GA,32:GA},Ho={35:lo,42:Eo,45:[Co,Eo],60:co,61:Co,95:Eo,96:qA,126:qA},Ro={38:zA,92:jA},Fo={[-5]:bo,[-4]:bo,[-3]:bo,33:yo,38:zA,42:NA,60:[RA,po],91:wo,92:[io,jA],93:go,95:NA,96:WA},Uo={null:[NA,ko]},jo=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:Lo,disable:{null:[]},document:Oo,flow:Ho,flowInitial:No,insideSpan:Uo,string:Ro,text:Fo},Symbol.toStringTag,{value:"Module"}));function zo(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 A={},o=[];let i=[],l=[];const a={attempt:g(function(e,t){h(e,t.from)}),check:g(p),consume:function(e){PA(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,m()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),s.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=d(),s.events.push(["enter",n,s]),l.push(n),n},exit:function(e){const t=l.pop();return t.end=d(),s.events.push(["exit",t,s]),t},interrupt:g(p,{interrupt:!0})},s={code:null,containerState:{},defineSkip:function(e){A[e.line]=e.column,m()},events:[],now:d,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let A;for(;++n<e.length;){const o=e[n];let i;if("string"==typeof o)i=o;else switch(o){case-5:i="\r";break;case-4:i="\n";break;case-3:i="\r\n";break;case-2:i=t?" ":"\t";break;case-1:if(!t&&A)continue;i=" ";break;default:i=String.fromCharCode(o)}A=-2===o,r.push(i)}return r.join("")}(u(e),t)},sliceStream:u,write:function(e){return i=sA(i,e),function(){let e;for(;r._index<i.length;){const t=i[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)f(t.charCodeAt(r._bufferIndex));else f(t)}}(),null!==i[i.length-1]?[]:(h(t,0),s.events=LA(o,s.events,s),s.events)}};let c=t.tokenize.call(s,a);return t.resolveAll&&o.push(t),s;function u(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,A=t.end._index,o=t.end._bufferIndex;let i;if(n===A)i=[e[n].slice(r,o)];else{if(i=e.slice(n,A),r>-1){const e=i[0];"string"==typeof e?i[0]=e.slice(r):i.shift()}o>0&&i.push(e[A].slice(0,o))}return i}(i,e)}function d(){const{_bufferIndex:e,_index:t,line:n,column:A,offset:o}=r;return{_bufferIndex:e,_index:t,line:n,column:A,offset:o}}function f(e){c=c(e)}function p(e,t){t.restore()}function g(e,t){return function(n,A,o){let i,c,u,f;return Array.isArray(n)?p(n):"tokenize"in n?p([n]):function(e){return t;function t(t){const n=null!==t&&e[t],r=null!==t&&e.null;return p([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function p(e){return i=e,c=0,0===e.length?o:g(e[c])}function g(e){return function(n){return f=function(){const e=d(),t=s.previous,n=s.currentConstruct,A=s.events.length,o=Array.from(l);return{from:A,restore:i};function i(){r=e,s.previous=t,s.currentConstruct=n,s.events.length=A,l=o,m()}}(),u=e,e.partial||(s.currentConstruct=e),e.name&&s.parser.constructs.disable.null.includes(e.name)?v():e.tokenize.call(t?Object.assign(Object.create(s),t):s,a,h,v)(n)}}function h(t){return e(u,f),A}function v(e){return f.restore(),++c<i.length?g(i[c]):o}}}function h(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&aA(s.events,t,s.events.length-t,e.resolve(s.events.slice(t),s)),e.resolveTo&&(s.events=e.resolveTo(s.events,s))}function m(){r.line in A&&r.column<2&&(r.column=A[r.line],r.offset+=A[r.line]-1)}}const _o=/[\0\t\n\r]/g;const qo=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Go(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return pA(n.slice(t?2:1),t?16:10)}return lA(n)||e}const Yo={}.hasOwnProperty;function Wo(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(te),autolinkProtocol:D,autolinkEmail:D,atxHeading:o(J),blockQuote:o(Y),characterEscape:D,characterReference:D,codeFenced:o(W),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:o(W,i),codeText:o(V,i),codeTextData:D,data:D,codeFlowValue:D,definition:o(X),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:o(K),hardBreakEscape:o(Z),hardBreakTrailing:o(Z),htmlFlow:o($,i),htmlFlowData:D,htmlText:o($,i),htmlTextData:D,image:o(ee),label:i,link:o(te),listItem:o(re),listItemValue:d,listOrdered:o(ne,u),listUnordered:o(ne),paragraph:o(Ae),reference:F,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:o(J),strong:o(oe),thematicBreak:o(le)},exit:{atxHeading:a(),atxHeadingSequence:b,autolink:a(),autolinkEmail:G,autolinkProtocol:q,blockQuote:a(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:j,characterReferenceMarkerNumeric:j,characterReferenceValue:z,characterReference:_,codeFenced:a(h),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:p,codeFlowValue:C,codeIndented:a(m),codeText:a(I),codeTextData:C,data:C,definition:a(),definitionDestinationString:w,definitionLabelString:v,definitionTitleString:y,emphasis:a(),hardBreakEscape:a(k),hardBreakTrailing:a(k),htmlFlow:a(S),htmlFlowData:C,htmlText:a(T),htmlTextData:C,image:a(M),label:L,labelText:O,lineEnding:x,link:a(Q),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:U,resourceDestinationString:N,resourceTitleString:H,resource:R,setextHeading:a(B),setextHeadingLineSequence:P,setextHeadingText:E,strong:a(),thematicBreak:a()}};Xo(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const o={stack:[r],tokenStack:[],config:t,enter:l,exit:s,buffer:i,resume:c,data:n},a=[];let u=-1;for(;++u<e.length;)if("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)if("enter"===e[u][0])a.push(u);else{u=A(e,a.pop(),u)}for(u=-1;++u<e.length;){const n=t[e[u][0]];Yo.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},o),e[u][1])}if(o.tokenStack.length>0){const e=o.tokenStack[o.tokenStack.length-1];(e[1]||Jo).call(o,void 0,e[0])}for(r.position={start:Vo(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Vo(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)r=t.transforms[u](r)||r;return r}function A(e,t,n){let r,A,o,i,l=t-1,a=-1,s=!1;for(;++l<=n;){const t=e[l];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?a++:a--,i=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(r&&!i&&!a&&!o&&(o=l),i=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:i=void 0}if(!a&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===a&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let i=l;for(A=void 0;i--;){const t=e[i];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;A&&(e[A][1].type="lineEndingBlank",s=!0),t[1].type="lineEnding",A=i}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}o&&(!A||o<A)&&(r._spread=!0),r.end=Object.assign({},A?e[A][1].start:t[1].end),e.splice(A||l,0,["exit",r,t[2]]),l++,n++}if("listItemPrefix"===t[1].type){const A={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=A,e.splice(l,0,["enter",A,t[2]]),l++,n++,o=void 0,i=!0}}}return e[t][1]._spread=s,n}function o(e,t){return n;function n(n){l.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function l(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Vo(t.start),end:void 0}}function a(e){return t;function t(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+Mr({start:e.start,end:e.end})+"): it’s not open");r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Jo).call(this,e,r[0])),n.position.end=Vo(e.end)}function c(){return function(e){return AA(e,"boolean"!=typeof rA.includeImageAlt||rA.includeImageAlt,"boolean"!=typeof rA.includeHtml||rA.includeHtml)}(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function d(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function f(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function p(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function h(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function m(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function v(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gA(this.sliceSerialize(e)).toLowerCase()}function y(){const e=this.resume();this.stack[this.stack.length-1].title=e}function w(){const e=this.resume();this.stack[this.stack.length-1].url=e}function b(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function P(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function D(e){const t=this.stack[this.stack.length-1].children;let n=t[t.length-1];(!n||"text"!==n.type)&&(n=ie(),n.position={start:Vo(e.start),end:void 0},t.push(n)),this.stack.push(n)}function C(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Vo(e.end)}function x(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=Vo(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(D.call(this,e),C.call(this,e))}function k(){this.data.atHardBreak=!0}function S(){const e=this.resume();this.stack[this.stack.length-1].value=e}function T(){const e=this.resume();this.stack[this.stack.length-1].value=e}function I(){const e=this.resume();this.stack[this.stack.length-1].value=e}function Q(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function M(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function O(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=function(e){return e.replace(qo,Go)}(t),n.identifier=gA(t).toLowerCase()}function L(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){const t=e.children;n.children=t}else n.alt=t}function N(){const e=this.resume();this.stack[this.stack.length-1].url=e}function H(){const e=this.resume();this.stack[this.stack.length-1].title=e}function R(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function U(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gA(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function j(e){this.data.characterReferenceType=e.type}function z(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;n?(r=pA(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):r=lA(t);this.stack[this.stack.length-1].value+=r}function _(e){this.stack.pop().position.end=Vo(e.end)}function q(e){C.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function G(e){C.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function Y(){return{type:"blockquote",children:[]}}function W(){return{type:"code",lang:null,meta:null,value:""}}function V(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function K(){return{type:"emphasis",children:[]}}function J(){return{type:"heading",depth:0,children:[]}}function Z(){return{type:"break"}}function $(){return{type:"html",value:""}}function ee(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function ne(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function re(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function Ae(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function ie(){return{type:"text",value:""}}function le(){return{type:"thematicBreak"}}}(n)(function(e){for(;!KA(e););return e}(function(e){const t={constructs:uA([jo,...(e||{}).extensions||[]]),content:n(IA),defined:[],document:n(QA),flow:n(xo),lazy:{},string:n(So),text:n(To)};return t;function n(e){return function(n){return zo(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(A,o,i){const l=[];let a,s,c,u,d;for(A=n+("string"==typeof A?A.toString():new TextDecoder(o||void 0).decode(A)),c=0,n="",r&&(65279===A.charCodeAt(0)&&c++,r=void 0);c<A.length;){if(_o.lastIndex=c,a=_o.exec(A),u=a&&void 0!==a.index?a.index:A.length,d=A.charCodeAt(u),!a){n=A.slice(c);break}if(10===d&&c===u&&e)l.push(-3),e=void 0;else switch(e&&(l.push(-5),e=void 0),c<u&&(l.push(A.slice(c,u)),t+=u-c),d){case 0:l.push(65533),t++;break;case 9:for(s=4*Math.ceil(t/4),l.push(-2);t++<s;)l.push(-1);break;case 10:l.push(-4),t=1;break;default:e=!0,t=1}c=u+1}return i&&(e&&l.push(-5),n&&l.push(n),l.push(null)),l}}()(e,t,!0))))}function Vo(e){return{line:e.line,column:e.column,offset:e.offset}}function Xo(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Xo(e,r):Ko(e,r)}}function Ko(e,t){let n;for(n in t)if(Yo.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 Jo(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Mr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Mr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Mr({start:t.start,end:t.end})+") is still open")}function Zo(e){const t=this;t.parser=function(n){return Wo(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function $o(e,t){const n=t.referenceType;let r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];const A=e.all(t),o=A[0];o&&"text"===o.type?o.value="["+o.value:A.unshift({type:"text",value:"["});const i=A[A.length-1];return i&&"text"===i.type?i.value+=r:A.push({type:"text",value:r}),A}function ei(e){return e.spread??e.children.length>1}function ti(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),A=0;const o=[];for(;r;)o.push(ni(t.slice(A,r.index),A>0,!0),r[0]),A=r.index+r[0].length,r=n.exec(t);return o.push(ni(t.slice(A),A>0,!1)),o.join("")}function ni(e,t,n){let r=0,A=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(A-1);for(;9===t||32===t;)A--,t=e.codePointAt(A-1)}return A>r?e.slice(r,A):""}const ri={blockquote:function(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)},break:function(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){const n=t.value?t.value+"\n":"",r={};t.lang&&(r.className=["language-"+t.lang]);let A={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(A.data={meta:t.meta}),e.patch(t,A),A=e.applyData(t,A),A={type:"element",tagName:"pre",properties:{},children:[A]},e.patch(t,A),A},delete:function(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){const n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),A=SA(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let i,l=e.footnoteCounts.get(r);void 0===l?(l=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=o+1,l+=1,e.footnoteCounts.set(r,l);const a={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+A,id:n+"fnref-"+A+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,a);const s={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,s),e.applyData(t,s)},heading:function(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return $o(e,t);const A={src:SA(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(A.title=r.title);const o={type:"element",tagName:"img",properties:A,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){const n={src:SA(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(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)},linkReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return $o(e,t);const A={href:SA(r.url||"")};null!==r.title&&void 0!==r.title&&(A.title=r.title);const o={type:"element",tagName:"a",properties:A,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){const n={href:SA(t.url)};null!==t.title&&void 0!==t.title&&(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)},listItem:function(e,t,n){const r=e.all(t),A=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=ei(n[r])}return t}(n):ei(t),o={},i=[];if("boolean"==typeof t.checked){const e=r[0];let n;e&&"element"===e.type&&"p"===e.tagName?n=e:(n={type:"element",tagName:"p",properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const e=r[l];(A||0!==l||"element"!==e.type||"p"!==e.tagName)&&i.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||A?i.push(e):i.push(...e.children)}const a=r[r.length-1];a&&(A||"element"!==a.type||"p"!==a.tagName)&&i.push({type:"text",value:"\n"});const s={type:"element",tagName:"li",properties:o,children:i};return e.patch(t,s),e.applyData(t,s)},list:function(e,t){const n={},r=e.all(t);let A=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++A<r.length;){const e=r[A];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)},paragraph:function(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){const n=e.all(t),r=n.shift(),A=[];if(r){const n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),A.push(n)}if(n.length>0){const r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Ir(t.children[1]),i=Tr(t.children[t.children.length-1]);o&&i&&(r.position={start:o,end:i}),A.push(r)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(A,!0)};return e.patch(t,o),e.applyData(t,o)},tableCell:function(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){const r=n?n.children:void 0,A=0===(r?r.indexOf(t):1)?"th":"td",o=n&&"table"===n.type?n.align:void 0,i=o?o.length:t.children.length;let l=-1;const a=[];for(;++l<i;){const n=t.children[l],r={},i=o?o[l]:void 0;i&&(r.align=i);let s={type:"element",tagName:A,properties:r,children:[]};n&&(s.children=e.all(n),e.patch(n,s),s=e.applyData(n,s)),a.push(s)}const s={type:"element",tagName:"tr",properties:{},children:e.wrap(a,!0)};return e.patch(t,s),e.applyData(t,s)},text:function(e,t){const n={type:"text",value:ti(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:Ai,yaml:Ai,definition:Ai,footnoteDefinition:Ai};function Ai(){}const oi="object"==typeof self?self:globalThis,ii=e=>((e,t)=>{const n=(t,n)=>(e.set(n,t),t),r=A=>{if(e.has(A))return e.get(A);const[o,i]=t[A];switch(o){case 0:case-1:return n(i,A);case 1:{const e=n([],A);for(const t of i)e.push(r(t));return e}case 2:{const e=n({},A);for(const[t,n]of i)e[r(t)]=r(n);return e}case 3:return n(new Date(i),A);case 4:{const{source:e,flags:t}=i;return n(new RegExp(e,t),A)}case 5:{const e=n(new Map,A);for(const[t,n]of i)e.set(r(t),r(n));return e}case 6:{const e=n(new Set,A);for(const t of i)e.add(r(t));return e}case 7:{const{name:e,message:t}=i;return n(new oi[e](t),A)}case 8:return n(BigInt(i),A);case"BigInt":return n(Object(BigInt(i)),A);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:e}=new Uint8Array(i);return n(new DataView(e),i)}}return n(new oi[o](i),A)};return r})(new Map,e)(0),li="",{toString:ai}={},{keys:si}=Object,ci=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=ai.call(e).slice(8,-1);switch(n){case"Array":return[1,li];case"Object":return[2,li];case"Date":return[3,li];case"RegExp":return[4,li];case"Map":return[5,li];case"Set":return[6,li];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},ui=([e,t])=>0===e&&("function"===t||"symbol"===t),di=(e,{json:t,lossy:n}={})=>{const r=[];return((e,t,n,r)=>{const A=(e,t)=>{const A=r.push(e)-1;return n.set(t,A),A},o=r=>{if(n.has(r))return n.get(r);let[i,l]=ci(r);switch(i){case 0:{let t=r;switch(l){case"bigint":i=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);t=null;break;case"undefined":return A([-1],r)}return A([i,t],r)}case 1:{if(l){let e=r;return"DataView"===l?e=new Uint8Array(r.buffer):"ArrayBuffer"===l&&(e=new Uint8Array(r)),A([l,[...e]],r)}const e=[],t=A([i,e],r);for(const t of r)e.push(o(t));return t}case 2:{if(l)switch(l){case"BigInt":return A([l,r.toString()],r);case"Boolean":case"Number":case"String":return A([l,r.valueOf()],r)}if(t&&"toJSON"in r)return o(r.toJSON());const n=[],a=A([i,n],r);for(const t of si(r))(e||!ui(ci(r[t])))&&n.push([o(t),o(r[t])]);return a}case 3:return A([i,r.toISOString()],r);case 4:{const{source:e,flags:t}=r;return A([i,{source:e,flags:t}],r)}case 5:{const t=[],n=A([i,t],r);for(const[n,A]of r)(e||!ui(ci(n))&&!ui(ci(A)))&&t.push([o(n),o(A)]);return n}case 6:{const t=[],n=A([i,t],r);for(const n of r)(e||!ui(ci(n)))&&t.push(o(n));return n}}const{message:a}=r;return A([i,{name:l,message:a}],r)};return o})(!(t||n),!!t,new Map,r)(e),r},fi="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?ii(di(e,t)):structuredClone(e):(e,t)=>ii(di(e,t));function pi(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 gi(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const hi=function(e){if(null==e)return vi;if("function"==typeof e)return mi(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=hi(e[n]);return mi(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return mi(n);function n(n){const r=n;let A;for(A in e)if(r[A]!==t[A])return!1;return!0}}(e);if("string"==typeof e)return function(e){return mi(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function mi(e){return function(t,n,r){return!(!function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)||!e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function vi(){return!0}const yi=[],wi=!0,bi=!1;function Ei(e,t,n,r){let A;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):A=t;const o=hi(A),i=r?-1:1;!function e(A,l,a){const s=A&&"object"==typeof A?A:{};if("string"==typeof s.type){const e="string"==typeof s.tagName?s.tagName:"string"==typeof s.name?s.name:void 0;Object.defineProperty(c,"name",{value:"node ("+A.type+(e?"<"+e+">":"")+")"})}return c;function c(){let s,c,u,d=yi;if((!t||o(A,l,a[a.length-1]||void 0))&&(d=function(e){return Array.isArray(e)?e:"number"==typeof e?[wi,e]:null==e?yi:[e]}(n(A,a)),d[0]===bi))return d;if("children"in A&&A.children){const t=A;if(t.children&&"skip"!==d[0])for(c=(r?t.children.length:-1)+i,u=a.concat(t);c>-1&&c<t.children.length;){const n=t.children[c];if(s=e(n,c,u)(),s[0]===bi)return s;c="number"==typeof s[1]?s[1]:c+i}}return d}}(e,void 0,[])()}function Pi(e,t,n,r){let A,o,i;"function"==typeof t?(o=void 0,i=t,A=n):(o=t,i=n,A=r),Ei(e,o,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return i(e,r,n)},A)}const Bi={}.hasOwnProperty,Di={};function Ci(e,t){const n=t||Di,r=new Map,A=new Map,o=new Map,i={...ri,...n.handlers},l={all:function(e){const t=[];if("children"in e){const n=e.children;let r=-1;for(;++r<n.length;){const A=l.one(n[r],e);if(A){if(r&&"break"===n[r-1].type&&(!Array.isArray(A)&&"text"===A.type&&(A.value=Ii(A.value)),!Array.isArray(A)&&"element"===A.type)){const e=A.children[0];e&&"text"===e.type&&(e.value=Ii(e.value))}Array.isArray(A)?t.push(...A):t.push(A)}}}return t},applyData:ki,definitionById:r,footnoteById:A,footnoteCounts:o,footnoteOrder:[],handlers:i,one:function(e,t){const n=e.type,r=l.handlers[n];if(Bi.call(l.handlers,n)&&r)return r(l,e,t);if(l.options.passThrough&&l.options.passThrough.includes(n)){if("children"in e){const{children:t,...n}=e,r=fi(n);return r.children=l.all(e),r}return fi(e)}return(l.options.unknownHandler||Si)(l,e,t)},options:n,patch:xi,wrap:Ti};return Pi(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){const t="definition"===e.type?r:A,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),l}function xi(e,t){e.position&&(t.position=function(e){const t=Ir(e),n=Tr(e);if(t&&n)return{start:t,end:n}}(e))}function ki(e,t){let n=t;if(e&&e.data){const t=e.data.hName,r=e.data.hChildren,A=e.data.hProperties;if("string"==typeof t)if("element"===n.type)n.tagName=t;else{n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}}"element"===n.type&&A&&Object.assign(n.properties,fi(A)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function Si(e,t){const n=t.data||{},r=!("value"in t)||Bi.call(n,"hProperties")||Bi.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:e.all(t)}:{type:"text",value:t.value};return e.patch(t,r),e.applyData(t,r)}function Ti(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function Ii(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function Qi(e,t){const n=Ci(e,t),r=n.one(e,void 0),A=function(e){const t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||pi,r=e.options.footnoteBackLabel||gi,A=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let a=-1;for(;++a<e.footnoteOrder.length;){const A=e.footnoteById.get(e.footnoteOrder[a]);if(!A)continue;const o=e.all(A),i=String(A.identifier).toUpperCase(),s=SA(i.toLowerCase());let c=0;const u=[],d=e.footnoteCounts.get(i);for(;void 0!==d&&++c<=d;){u.length>0&&u.push({type:"text",value:" "});let e="string"==typeof n?n:n(a,c);"string"==typeof e&&(e={type:"text",value:e}),u.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+s+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(a,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}const f=o[o.length-1];if(f&&"element"===f.type&&"p"===f.tagName){const e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...u)}else o.push(...u);const p={type:"element",tagName:"li",properties:{id:t+"fn-"+s},children:e.wrap(o,!0)};e.patch(A,p),l.push(p)}if(0!==l.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...fi(i),id:"footnote-label"},children:[{type:"text",value:A}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:"\n"}]}}(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return A&&o.children.push({type:"text",value:"\n"},A),o}function Mi(e,t){return e&&"run"in e?async function(n,r){const A=Qi(n,{file:r,...t});await e.run(A,r)}:function(n,r){return Qi(n,{file:r,...e||t})}}function Oi(e){if(e)throw e}var Li,Ni;var Hi=function(){if(Ni)return Li;Ni=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,A=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},o=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,A=e.call(n,"constructor"),o=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!A&&!o)return!1;for(r in n);return typeof r>"u"||e.call(n,r)},i=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return Li=function e(){var t,n,r,a,s,c,u=arguments[0],d=1,f=arguments.length,p=!1;for("boolean"==typeof u&&(p=u,u=arguments[1]||{},d=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});d<f;++d)if(null!=(t=arguments[d]))for(n in t)r=l(u,n),u!==(a=l(t,n))&&(p&&a&&(o(a)||(s=A(a)))?(s?(s=!1,c=r&&A(r)?r:[]):c=r&&o(r)?r:{},i(u,{name:n,newValue:e(p,c,a)})):typeof a<"u"&&i(u,{name:n,newValue:a}));return u},Li}();const Ri=Er(Hi);function Fi(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function Ui(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function A(o,...i){const l=e[++n];let a=-1;if(o)r(o);else{for(;++a<t.length;)(null===i[a]||void 0===i[a])&&(i[a]=t[a]);t=i,l?function(e,t){let n;return r;function r(...t){const r=e.length>t.length;let i;r&&t.push(A);try{i=e.apply(this,t)}catch(e){if(r&&n)throw e;return A(e)}r||(i&&i.then&&"function"==typeof i.then?i.then(o,A):i instanceof Error?A(i):o(i))}function A(e,...r){n||(n=!0,t(e,...r))}function o(e){A(null,e)}}(l,A)(...i):r(null,...i)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}const ji={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');zi(e);let n,r=0,A=-1,o=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else A<0&&(n=!0,A=o+1);return A<0?"":e.slice(r,A)}if(t===e)return"";let i=-1,l=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(A=o):(l=-1,A=i));return r===A?A=i:A<0&&(A=e.length),e.slice(r,A)},dirname:function(e){if(zi(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){zi(e);let t,n=e.length,r=-1,A=0,o=-1,i=0;for(;n--;){const l=e.codePointAt(n);if(47!==l)r<0&&(t=!0,r=n+1),46===l?o<0?o=n:1!==i&&(i=1):o>-1&&(i=-1);else if(t){A=n+1;break}}return o<0||r<0||0===i||1===i&&o===r-1&&o===A+1?"":e.slice(o,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)zi(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){zi(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,A="",o=0,i=-1,l=0,a=-1;for(;++a<=e.length;){if(a<e.length)n=e.codePointAt(a);else{if(47===n)break;n=47}if(47===n){if(i!==a-1&&1!==l)if(i!==a-1&&2===l){if(A.length<2||2!==o||46!==A.codePointAt(A.length-1)||46!==A.codePointAt(A.length-2))if(A.length>2){if(r=A.lastIndexOf("/"),r!==A.length-1){r<0?(A="",o=0):(A=A.slice(0,r),o=A.length-1-A.lastIndexOf("/")),i=a,l=0;continue}}else if(A.length>0){A="",o=0,i=a,l=0;continue}t&&(A=A.length>0?A+"/..":"..",o=2)}else A.length>0?A+="/"+e.slice(i+1,a):A=e.slice(i+1,a),o=a-i-1;i=a,l=0}else 46===n&&l>-1?l++:l=-1}return A}(e,!t);return 0===n.length&&!t&&(n="."),n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/"),t?"/"+n:n}(t)},sep:"/"};function zi(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _i={cwd:function(){return"/"}};function qi(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function Gi(e){if("string"==typeof e)e=new URL(e);else if(!qi(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("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const Yi=["history","path","basename","stem","extname","dirname"];class Wi{constructor(e){let t;var n;t=e?qi(e)?{path:e}:"string"==typeof e||(n=e)&&"object"==typeof n&&"byteLength"in n&&"byteOffset"in n?{value:e}:e:{},this.cwd="cwd"in t?"":_i.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r,A=-1;for(;++A<Yi.length;){const e=Yi[A];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)Yi.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?ji.basename(this.path):void 0}set basename(e){Xi(e,"basename"),Vi(e,"basename"),this.path=ji.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?ji.dirname(this.path):void 0}set dirname(e){Ki(this.basename,"dirname"),this.path=ji.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?ji.extname(this.path):void 0}set extname(e){if(Vi(e,"extname"),Ki(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ji.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){qi(e)&&(e=Gi(e)),Xi(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?ji.basename(this.path,this.extname):void 0}set stem(e){Xi(e,"stem"),Vi(e,"stem"),this.path=ji.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new Hr(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Vi(e,t){if(e&&e.includes(ji.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ji.sep+"`")}function Xi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ki(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const Ji=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},Zi={}.hasOwnProperty;class $i extends Ji{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=Ui()}copy(){const e=new $i;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(Ri(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(rl("data",this.frozen),this.namespace[e]=t,this):Zi.call(this.namespace,e)&&this.namespace[e]||void 0:e?(rl("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=il(e),n=this.parser||this.Parser;return tl("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),tl("process",this.parser||this.Parser),nl("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,A){const o=il(e),i=n.parse(o);function l(e,n){e||!n?A(e):r?r(n):t(void 0,n)}n.run(i,o,function(e,t,r){if(e||!t||!r)return l(e);const A=t,o=n.stringify(A,r);var i;"string"==typeof(i=o)||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(i)?r.value=o:r.result=o,l(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),tl("processSync",this.parser||this.Parser),nl("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,Oi(e),t=r}),ol("processSync","process",n),t}run(e,t,n){Al(e),this.freeze();const r=this.transformers;return!n&&"function"==typeof t&&(n=t,t=void 0),n?A(void 0,n):new Promise(A);function A(A,o){const i=il(t);r.run(e,i,function(t,r,i){const l=r||e;t?o(t):A?A(l):n(void 0,l,i)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){Oi(e),n=t,r=!0}),ol("runSync","run",r),n}stringify(e,t){this.freeze();const n=il(t),r=this.compiler||this.Compiler;return nl("stringify",r),Al(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(rl("use",this.frozen),null!=e)if("function"==typeof e)l(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?i(e):o(e)}return this;function A(e){if("function"==typeof e)l(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;l(t,n)}else o(e)}}function o(e){if(!("plugins"in e)&&!("settings"in e))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");i(e.plugins),e.settings&&(r.settings=Ri(!0,r.settings,e.settings))}function i(e){let t=-1;if(null!=e){if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){A(e[t])}}}function l(e,t){let r=-1,A=-1;for(;++r<n.length;)if(n[r][0]===e){A=r;break}if(-1===A)n.push([e,...t]);else if(t.length>0){let[r,...o]=t;const i=n[A][1];Fi(i)&&Fi(r)&&(r=Ri(!0,i,r)),n[A]=[e,r,...o]}}}}const el=(new $i).freeze();function tl(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function nl(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function rl(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 Al(e){if(!Fi(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function ol(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function il(e){return function(e){return!!(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new Wi(e)}const ll=[],al={allowDangerousHtml:!0},sl=/^(https?|ircs?|mailto|xmpp)$/i,cl=[{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:"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 ul(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",A=e.className,o=e.components,i=e.disallowedElements,l=e.rehypePlugins||ll,a=e.remarkPlugins||ll,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...al}:al,c=e.skipHtml,u=e.unwrapDisallowed,d=e.urlTransform||dl,f=el().use(Zo).use(a).use(Mi,s).use(l),p=new Wi;"string"==typeof r&&(p.value=r);for(const t of cl)Object.hasOwn(e,t.from)&&(t.from,t.to&&t.to,t.id);const v=f.parse(p);let y=f.runSync(v,p);return A&&(y={type:"element",tagName:"div",properties:{className:A},children:"root"===y.type?y.children:[y]}),Pi(y,function(e,r,A){if("raw"===e.type&&A&&"number"==typeof r)return c?A.children.splice(r,1):A.children[r]={type:"text",value:e.value},r;if("element"===e.type){let t;for(t in nA)if(Object.hasOwn(nA,t)&&Object.hasOwn(e.properties,t)){const n=e.properties[t],r=nA[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=d(String(n||""),t,e))}}if("element"===e.type){let o=t?!t.includes(e.tagName):!!i&&i.includes(e.tagName);if(!o&&n&&"number"==typeof r&&(o=!n(e,r,A)),o&&A&&"number"==typeof r)return u&&e.children?A.children.splice(r,1,...e.children):A.children.splice(r,1),r}}),Gr(y,{Fragment:m,components:o,ignoreInvalidStyle:!0,jsx:g,jsxs:h,passKeys:!0,passNode:!0})}function dl(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),A=e.indexOf("/");return-1===t||-1!==A&&t>A||-1!==n&&t>n||-1!==r&&t>r||sl.test(e.slice(0,t))?e:""}const fl=({children:e})=>g("div",{style:{whiteSpace:"normal"},children:g(ul,{components:{p:({...e})=>g("p",{style:{margin:0,marginBottom:"0.5em",lineHeight:1.4,textAlign:"left"},children:e.children}),ul:({...e})=>g("ul",{style:{paddingLeft:"clamp(8px, 3.5vw, 16px)",margin:0,listStylePosition:"inside"},children:e.children}),ol:({...e})=>g("ol",{style:{paddingLeft:"clamp(8px, 3.5vw, 16px)",margin:0,listStylePosition:"inside"},children:e.children}),li:({...e})=>g("li",{style:{marginBottom:"1px",lineHeight:1.4},children:e.children}),code:({inline:e,children:t})=>e?g("code",{style:{backgroundColor:"rgba(0, 0, 0, 0.3)",padding:"2px 4px",borderRadius:"4px",fontFamily:"inherit",fontSize:"0.95em"},children:t}):g("pre",{style:{backgroundColor:"rgba(0, 0, 0, 0.3)",padding:"8px",borderRadius:"4px",overflowX:"auto",margin:"0.5em 0",whiteSpace:"pre-wrap"},children:g("code",{children:t})}),blockquote:({...e})=>g("blockquote",{style:{margin:0,paddingLeft:"10px",borderLeft:"2px solid #ccc",color:"#666",fontStyle:"italic"},children:e.children})},children:"string"==typeof e?e:""})}),pl={autoConfig:!0},gl=e=>()=>(e=>{const{getFlow:t}=$t(),{messages:n,replaceMessages:r}=en(),{settings:A}=nn(),{hasChatHistoryLoaded:o}=An(),i={...e,...pl},l=i.markdownComponent?i.markdownComponent:fl;a(()=>{var e,t;if(o){const o=[...n];for(let n=0;n<o.length&&n<((null==(e=A.chatHistory)?void 0:e.maxEntries)??30);n++){const e=o[n];null!=(t=e.tags)&&t.includes("rcb-markdown-renderer-plugin:parsed")&&(e.contentWrapper=l)}r(o)}},[o]);const s=async e=>{var n;const r=null==(n=e.data.message)?void 0:n.sender.toUpperCase();((e,t,n)=>{var r;if("string"!=typeof e.data.message.content||!e.detail.currPath)return!1;const A=t[e.detail.currPath];return!!A&&((null==(r=A.renderMarkdown)?void 0:r.map(e=>e.toUpperCase()).includes(n))??!1)})(e,t(),r)&&(e.data.message.contentWrapper=l,e.data.message.tags||(e.data.message.tags=[]),e.data.message.tags.push("rcb-markdown-renderer-plugin:parsed"))};tn(J.PRE_INJECT_MESSAGE,s),tn(J.CHUNK_STREAM_MESSAGE,s),tn(J.START_STREAM_MESSAGE,s),tn(J.START_SIMULATE_STREAM_MESSAGE,s);const c={name:"@rcb-plugins/markdown-renderer"};return null!=i&&i.autoConfig&&(c.settings={event:{rcbPreInjectMessage:!0,rcbChunkStreamMessage:!0,rcbStartSimulateStreamMessage:!0,rcbStartStreamMessage:!0}}),c})(e),hl={autoConfig:!0,promptBaseColors:{info:"#007bff",warning:"#ffc107",error:"#dc3545",success:"#28a745"},promptHoveredColors:{info:"#0056b3",warning:"#d39e00",error:"#c82333",success:"#218838"},textAreaHighlightColors:{info:"#007bff",warning:"#ffc107",error:"#dc3545",success:"#28a745"}},ml=(e,t,n="validateTextInput")=>{var r;if(null==(r=e.detail)||!r.currPath)return;const A=t[e.detail.currPath];if(!A)return;const o=A[n];return"function"==typeof o?o:void 0},vl=e=>{const{showToast:t}=(()=>{const{showToast:e,dismissToast:t,toasts:n,replaceToasts:r}=ct();return{showToast:e,dismissToast:t,toasts:n,replaceToasts:r}})(),{getFlow:n}=$t(),{styles:r,updateStyles:A,replaceStyles:o}=(()=>{const{styles:e,replaceStyles:t,updateStyles:n}=_t();return{styles:e,replaceStyles:t,updateStyles:n}})(),s=(e=>({...hl,...e,promptBaseColors:{...hl.promptBaseColors},promptHoveredColors:{...hl.promptHoveredColors},textAreaHighlightColors:{...hl.textAreaHighlightColors}}))(e),[c,u]=l(0),d=i({});tn(J.USER_SUBMIT_TEXT,e=>{const o=e,i=ml(o,n(),"validateTextInput");if(!i)return;const l=i(o.data.inputText);if(null!=l&&l.success||e.preventDefault(),!l.promptContent)return;0===c&&(d.current=structuredClone(r));const a=((e,t)=>{const n=e.promptType??"info";let r={};return t.advancedStyles&&(r=t.advancedStyles[n]),t.promptBaseColors&&(r.toastPromptStyle={color:t.promptBaseColors[n],borderColor:t.promptBaseColors[n]}),t.promptHoveredColors&&(r.toastPromptHoveredStyle={color:t.promptHoveredColors[n],borderColor:t.promptHoveredColors[n]}),t.textAreaHighlightColors&&(e.highlightTextArea??!0)&&(r.chatInputAreaStyle={boxShadow:`${t.textAreaHighlightColors[n]} 0px 0px 5px`}),r})(l,s);A(a),t(l.promptContent,l.promptDuration??3e3),u(e=>e+1)}),tn(J.USER_UPLOAD_FILE,e=>{var r,A;const o=e,i=null==(A=null==(r=o.data)?void 0:r.files)?void 0:A[0];if(!i)return console.error("No file uploaded."),void e.preventDefault();const l=ml(o,n(),"validateFileInput");if(!l)return void console.error("Validator not found for file input.");const a=l(i);if(!a.success)return console.error("Validation failed:",a),a.promptContent&&t(a.promptContent,a.promptDuration??3e3),void e.preventDefault();console.log("Validation successful:",a)}),tn(J.DISMISS_TOAST,()=>{u(e=>e-1)}),a(()=>{0===c&&setTimeout(()=>{o(d.current)})},[c,o]);const f={name:"@rcb-plugins/input-validator"};return s.autoConfig&&(f.settings={event:{rcbUserSubmitText:!0,rcbUserUploadFile:!0,rcbDismissToast:!0}}),f},yl=n((e,t)=>{let{embedded:n,currentOpen:r,enabled:A,onSetEnabled:o}=e;const l=en(),s=(()=>{const{isChatWindowOpen:e,toggleChatWindow:t,toggleIsBotTyping:n,scrollToBottom:r,getIsChatBotVisible:A}=Ae();return{isChatWindowOpen:e,toggleChatWindow:t,toggleIsBotTyping:n,scrollToBottom:r,getIsChatBotVisible:A}})(),c=i(!1),u=i(!1);return a(()=>{!n&&s&&s.toggleChatWindow&&(c.current===r||u.current||(setTimeout(()=>{s&&s.toggleChatWindow&&s.toggleChatWindow(r)},0),c.current=null!=r&&r),u.current=!1)},[r,n,s]),a(()=>{const e=()=>{u.current=!0};return window.addEventListener("rcb-toggle-chat-window",e),()=>window.removeEventListener("rcb-toggle-chat-window",e)}),f(t,()=>({addMessage:e=>{l&&l.injectMessage&&l.injectMessage(e)},openChat:()=>{!n&&s&&s.toggleChatWindow&&s.toggleChatWindow(!0)},closeChat:()=>{!n&&s&&s.toggleChatWindow&&s.toggleChatWindow(!1)},toggleChat:()=>{!n&&s&&s.toggleChatWindow&&s.toggleChatWindow()},setBotEnabled:e=>{o&&o(e)}}),[l,s,n,o]),null});yl.displayName="BotController";const wl=r(null),bl=e=>{let{trackEvent:n,children:r}=e;const A=i(n);return A.current=n,t.createElement(wl.Provider,{value:{trackEvent:e=>A.current(e)}},r)},El=()=>{const e=A(wl);return e||{trackEvent:()=>{}}},Pl=e=>{let{loginUrl:n,className:r="",style:A,isHeaderButton:o=!1}=e;const{trackEvent:i}=El(),l=o?{display:"inline-block",padding:"6px 12px",backgroundColor:"transparent",border:"1px solid #ccc",color:"white",textDecoration:"none",borderRadius:"4px",fontWeight:"normal",textAlign:"center",margin:"8px",fontSize:"12px",opacity:.8,transition:"all 0.2s ease"}:{display:"inline-block",padding:"10px 20px",backgroundColor:"white",border:"1px solid var(--primaryColor, #107180)",color:"var(--primaryColor, #107180)",textDecoration:"none",borderRadius:"4px",fontWeight:"bold",textAlign:"center",margin:"18px",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.2)"};return t.createElement(t.Fragment,null,o&&t.createElement("style",null,"\n .rcb-chat-header-container .qa-bot-header-login-button:hover {\n background-color: #0000001a !important;\n opacity: 1 !important;\n }\n "),t.createElement("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:`qa-bot-login-button ${o?"qa-bot-header-login-button":""} ${r}`,style:Object.assign(Object.assign({},l),A),onClick:()=>{i({type:"chatbot_login_clicked",loginUrl:n})}},"Log In"))},Bl=()=>t.createElement("div",{className:"user-login-icon",style:{alignItems:"center",justifyContent:"center",width:"30px",height:"30px",borderRadius:"50%",backgroundColor:"var(--primaryColor, #1a5b6e)",marginRight:"5px",display:"flex"},role:"img","aria-label":"User logged in",title:"User logged in"},t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},t.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),t.createElement("circle",{cx:"12",cy:"7",r:"4"}))),Dl=[];for(let e=0;e<256;++e)Dl.push((e+256).toString(16).slice(1));let Cl;const xl=new Uint8Array(16);var kl={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Sl(e,t,n){if(kl.randomUUID&&!e)return kl.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!Cl){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Cl=crypto.getRandomValues.bind(crypto)}return Cl(xl)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return(Dl[e[t+0]]+Dl[e[t+1]]+Dl[e[t+2]]+Dl[e[t+3]]+"-"+Dl[e[t+4]]+Dl[e[t+5]]+"-"+Dl[e[t+6]]+Dl[e[t+7]]+"-"+Dl[e[t+8]]+Dl[e[t+9]]+"-"+Dl[e[t+10]]+Dl[e[t+11]]+Dl[e[t+12]]+Dl[e[t+13]]+Dl[e[t+14]]+Dl[e[t+15]]).toLowerCase()}(r)}function Tl(){return"undefined"!=typeof localStorage&&"true"===localStorage.getItem("QA_BOT_DEBUG")}const Il="background: #1a5b6e; color: white; padding: 2px 6px; border-radius: 3px;",Ql="background: #7c3aed; color: white; padding: 2px 6px; border-radius: 3px;",Ml="background: #059669; color: white; padding: 2px 6px; border-radius: 3px;",Ol="background: #f97316; color: white; padding: 2px 6px; border-radius: 3px;",Ll="background: #f59e0b; color: #000; padding: 2px 6px; border-radius: 3px 0 0 3px; font-weight: bold;",Nl="background: #fbbf24; color: #000; padding: 2px 6px; border-radius: 0 3px 3px 0;",Hl=()=>{Tl()&&console.log("%c QA Bot Core %c v0.2.35 ",Ll,Nl)},Rl=function(e){if(Tl()){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];console.log(`%c[Session]%c ${e}`,Il,"",...n)}},Fl=function(e){if(Tl()){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];console.log(`%c[History]%c ${e}`,Ql,"",...n)}},Ul=(e,t)=>{Tl()&&console.log(`%c[Message]%c ${e}`,Ml,"",t)},jl=function(e){if(Tl()){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];console.log(`%c[Turnstile]%c ${e}`,Ol,"",...n)}},zl=function(){console.warn(...arguments)},_l=function(){console.error(...arguments)},ql="qa_bot_session_messages",Gl=()=>`qa_bot_session_${Sl()}`,Yl=()=>{try{const e=localStorage.getItem(ql);return e?JSON.parse(e):{}}catch(e){return{}}},Wl=(e,t,n,r,A)=>{const o=Yl();!o[e]&&(o[e]={messages:[],startedAt:(new Date).toISOString(),preview:""},Fl("NEW session created",{sessionId:e.slice(-12)}));if(o[e].messages.some(e=>e.id===t))return void Fl("DUPLICATE message skipped",{sessionId:e.slice(-12),messageId:t.slice(-8),sender:r});const i={id:t,content:n,sender:r,type:A,timestamp:Date.now()};o[e].messages.push(i),Fl("MESSAGE added",{sessionId:e.slice(-12),messageId:t.slice(-8),sender:r,totalInSession:o[e].messages.length});const l=o[e].messages,a=l.find(e=>{var t;return"bot"===e.sender.toLowerCase()&&(null===(t=e.content)||void 0===t?void 0:t.trim())&&e.content.length>=100});if(a){const t=a.content;o[e].preview=t.slice(0,50)+(t.length>50?"...":"")}else{const t=l.find(e=>{var t;return"user"===e.sender.toLowerCase()&&(null===(t=e.content)||void 0===t?void 0:t.trim())});if(t&&!o[e].preview){const n=t.content;o[e].preview=n.slice(0,50)+(n.length>50?"...":"")}}(e=>{var t;const n=()=>Object.values(e).reduce((e,t)=>e+t.messages.length,0);for(;n()>100&&Object.keys(e).length>1;){const n=null===(t=Object.entries(e).sort((e,t)=>{let[,n]=e,[,r]=t;return new Date(n.startedAt).getTime()-new Date(r.startedAt).getTime()})[0])||void 0===t?void 0:t[0];if(!n)break;delete e[n]}localStorage.setItem(ql,JSON.stringify(e))})(o),Fl("STORAGE state",{ourSessions:Object.keys(o).length,ourTotalMessages:Object.values(o).reduce((e,t)=>e+t.messages.length,0)})},Vl=e=>{var t,n;return null!==(n=null===(t=Yl()[e])||void 0===t?void 0:t.messages.length)&&void 0!==n?n:0},Xl=e=>{const t=Yl()[e];return(null==t?void 0:t.startedAt)?Date.now()-new Date(t.startedAt).getTime():0},Kl=r(void 0),Jl=e=>{let{children:n,getSessionId:r,setSessionId:A,resetSession:o,clearResettingFlag:i}=e;return t.createElement(Kl.Provider,{value:{getSessionId:r,setSessionId:A,resetSession:o,clearResettingFlag:i}},n)},Zl=()=>{const e=A(Kl);if(!e)throw new Error("useSession must be used within a SessionProvider");return e},$l=()=>{const[e,n]=l(!1),[r,A]=l([]),[o,s]=l(null),[c,u]=l(0),d=i(null),f=i(null),{replaceMessages:p}=en(),{toggleTextAreaDisabled:g}=rn(),{setSessionId:h,getSessionId:m}=Zl();a(()=>{var t,r;const A=e=>{d.current&&!d.current.contains(e.target)&&f.current&&!f.current.contains(e.target)&&n(!1)},o=null!==(r=null===(t=d.current)||void 0===t?void 0:t.getRootNode())&&void 0!==r?r:document;return e&&o.addEventListener("mousedown",A),()=>{o.removeEventListener("mousedown",A)}},[e]);const v=e=>{var t;const r=m();if(Fl("RESTORE requested",{targetSession:e.slice(-12),currentSession:null==r?void 0:r.slice(-12)}),e===r)return Fl("RESTORE skipped - already on this session"),void n(!1);const A=(e=>{var t;return(null===(t=Yl()[e])||void 0===t?void 0:t.messages)||[]})(e).filter(e=>{var t;return null===(t=e.content)||void 0===t?void 0:t.trim()});Fl("Stored messages from our localStorage",{count:A.length,ids:A.map(e=>e.id.slice(-8))});const o=A.map(e=>({id:e.id,content:e.content,sender:e.sender.toUpperCase(),type:e.type||"string",timestamp:new Date(e.timestamp).toISOString()}));var i;h(e),Fl("Session ID updated",{newSession:e.slice(-12)}),p(o),Fl("replaceMessages called",{count:o.length}),i=null===(t=f.current)||void 0===t?void 0:t.getRootNode(),setTimeout(()=>{const e=(i||document).querySelector(".rcb-chat-body-container");e&&e.querySelectorAll(".rcb-bot-message").forEach(e=>{var t;let n=e.innerHTML,r=!1;n.includes("](")&&(n=n.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),r=!0),n.includes("&lt;a href=")&&(n=n.replace(/&lt;a\s+href=["']([^"']+)["'][^&]*&gt;([^&]+)&lt;\/a&gt;/gi,'<a href="$1" target="_blank" rel="noopener noreferrer">$2</a>'),r=!0),(n.includes("&lt;a ")||(null===(t=e.textContent)||void 0===t?void 0:t.includes("<a href=")))&&(e.textContent||"").includes("<a href=")&&(n=n.replace(/&lt;a\s+href="([^"]+)"[^&]*&gt;([^&]+)&lt;\/a&gt;/gi,'<a href="$1" target="_blank" rel="noopener noreferrer">$2</a>'),r=!0),r&&(e.innerHTML=n)})},50),g(!1),Fl("Chat input enabled after restore"),n(!1)};return t.createElement("div",{style:{position:"relative"}},t.createElement("button",{ref:f,className:"history-button",onClick:()=>{if(!e&&(A((()=>{const e=Yl();return Object.entries(e).map(e=>{let[t,n]=e;return Object.assign({sessionId:t},n)}).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime())})()),f.current)){const e=f.current.closest(".rcb-chat-window");if(e){const t=e.getBoundingClientRect(),n=f.current.getBoundingClientRect();s(t.width+3),u(t.right-n.right-18+4)}}n(!e)},style:{alignItems:"center",justifyContent:"center",width:"30px",height:"30px",borderRadius:"50%",backgroundColor:"var(--primaryColor, #1a5b6e)",marginRight:"18px",display:"flex",border:"none",cursor:"pointer",padding:0},"aria-label":"View chat history",title:"View chat history","aria-expanded":e,"aria-haspopup":"menu"},t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("polyline",{points:"12 6 12 12 16 14"}))),e&&t.createElement("div",{ref:d,role:"menu",style:{position:"absolute",right:c?`-${c}px`:"-18px",top:"100%",marginTop:"8px",width:o?`${o}px`:"550px",backgroundColor:"white",borderRadius:0,borderBottom:"3px solid var(--primaryColor, #1a5b6e)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",maxHeight:"250px",overflowY:"auto",zIndex:1e3}},0===r.length?t.createElement("div",{style:{padding:"12px 16px",color:"#666",fontSize:"14px",textAlign:"center"}},"No chat history"):r.map(e=>t.createElement("button",{key:e.sessionId,role:"menuitem",onClick:()=>v(e.sessionId),style:{width:"100%",padding:"10px 14px",border:"none",backgroundColor:"transparent",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"2px",borderBottom:"1px solid #eee"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f5f5f5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"}},t.createElement("span",{style:{fontSize:"14px",color:"#333",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},e.preview||"New conversation"),t.createElement("span",{style:{fontSize:"12px",color:"#888"}},(e=>{const t=new Date(e),n=(new Date).getTime()-t.getTime(),r=Math.floor(n/864e5);return 0===r?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):1===r?"Yesterday":r<7?t.toLocaleDateString([],{weekday:"short"}):t.toLocaleDateString([],{month:"short",day:"numeric"})})(e.startedAt))))))},ea=e=>{var{width:n=24,height:r=24,color:A="currentColor",children:o}=e,i=b(e,["width","height","color","children"]);return t.createElement("svg",w({xmlns:"http://www.w3.org/2000/svg",width:n,height:r,viewBox:"0 0 24 24",fill:"none",stroke:A,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},i),o)},ta=e=>t.createElement(ea,e,t.createElement("path",{d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})),na=()=>{const{restartFlow:e}=$t(),{setTextAreaValue:n}=rn(),{messages:r}=en(),{getSessionId:A,resetSession:o,clearResettingFlag:i}=Zl(),{trackEvent:l}=El();return t.createElement("button",{onClick:async()=>{const t=A(),r=t?Vl(t):0;l({type:"chatbot_new_chat",previousMessageCount:r}),o(),await n(""),await e(),setTimeout(()=>{i()},100)},tabIndex:0,"aria-label":"New chat conversation",style:{backgroundColor:"var(--primaryColor, #107180)",border:"none",color:"#ffffff",fontSize:"14px",cursor:"pointer",padding:"8px 12px",borderRadius:"4px",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"6px",fontWeight:"500"},onMouseEnter:e=>{e.target.style.backgroundColor="var(--secondaryColor, #0d5f6b)"},onMouseLeave:e=>{e.target.style.backgroundColor="var(--primaryColor, #107180)"}},t.createElement(ta,{width:16,height:16}),"New Chat")};function ra(e){if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(!e)return"";if(Array.isArray(e))return e.map(ra).join("");if("object"==typeof e&&null!==e&&"props"in e){const t=e.props;if(t&&"children"in t)return ra(t.children)}return""}const Aa=()=>{const{getSessionId:e}=Zl(),t=o(t=>{var n;const r=null===(n=t.data)||void 0===n?void 0:n.message;if(!(null==r?void 0:r.id))return;const A=r.sender,o=r.type||"string";let i;if(i="string"==typeof r.content?r.content:ra(r.content),Ul("TRACKED",{id:r.id,sender:A,content:i.substring(0,50)+(i.length>50?"...":"")}),i.includes("rcb-options-container"))return;if(!i.trim())return;const l=e();Wl(l,r.id,i,A,o)},[e]);return a(()=>(window.addEventListener("rcb-pre-inject-message",t),()=>{window.removeEventListener("rcb-pre-inject-message",t)}),[t]),null},oa=()=>(a(()=>{const e=e=>{if(!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter"," ","Home","End"].includes(e.key))return;const n=document.activeElement;if(n&&("INPUT"===n.tagName||"TEXTAREA"===n.tagName||"true"===n.contentEditable||n.classList.contains("rcb-chat-input-textarea")))return;const r=document.querySelector(".rcb-chat-window");if(!r)return;const A=Array.from(r.querySelectorAll(".rcb-message-container, .rcb-bot-message-container, .rcb-user-message-container")).filter(e=>null!==e.offsetParent);if(A.length>0){const t=A[A.length-1].querySelector(".rcb-checkbox-container");if(t&&null!==t.offsetParent){const n=Array.from(t.querySelectorAll(".rcb-checkbox-row-container")),r=t.querySelector(".rcb-checkbox-next-button");if(n.length>0){const t=[...n];return r&&t.push(r),void((e,t)=>{e.preventDefault();let n=-1;for(let e=0;e<t.length;e++)if(t[e]===document.activeElement||t[e].contains(document.activeElement)){n=e;break}-1===n&&(n=0);let r=n;switch(e.key){case"ArrowDown":case"ArrowRight":r=n<t.length-1?n+1:0;break;case"ArrowUp":case"ArrowLeft":r=n>0?n-1:t.length-1;break;case"Home":r=0;break;case"End":r=t.length-1;break;case"Enter":case" ":{const e=t[n],r=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});return void e.dispatchEvent(r)}default:return}t[r].focus(),t[r].setAttribute("tabindex","0"),t[r].classList.add("keyboard-focused"),t.forEach((e,t)=>{t!==r&&(e.setAttribute("tabindex","-1"),e.classList.remove("keyboard-focused"))})})(e,t)}}}let o=[];if(A.length>0){const e=A[A.length-1],t=Array.from(e.querySelectorAll(".rcb-options-container")).filter(e=>null!==e.offsetParent);if(t.length>0){const e=t[t.length-1];o=Array.from(e.querySelectorAll(".rcb-options"))}}if(0===o.length)return;const i=o.findIndex(e=>e===document.activeElement);switch(e.key){case"ArrowDown":case"ArrowRight":{let t;e.preventDefault(),t=i<o.length-1?i+1:0,o[t].setAttribute("tabindex","0"),o.forEach((e,n)=>{n!==t&&(e.setAttribute("tabindex","-1"),e.classList.remove("keyboard-focused"))}),o[t].classList.add("keyboard-focused"),o[t].focus();break}case"ArrowUp":case"ArrowLeft":{let t;e.preventDefault(),t=i>0?i-1:o.length-1,o[t].setAttribute("tabindex","0"),o.forEach((e,n)=>{n!==t&&(e.setAttribute("tabindex","-1"),e.classList.remove("keyboard-focused"))}),o[t].classList.add("keyboard-focused"),o[t].focus();break}case"Enter":case" ":if(e.preventDefault(),document.activeElement&&o.includes(document.activeElement)){const e=document.activeElement;if(e.classList.contains("rcb-checkbox-row-container")||e.closest(".rcb-checkbox-row-container")){const n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});e.dispatchEvent(n);const r=e.querySelector(".rcb-checkbox-label"),A=r?r.textContent:e.textContent||"checkbox",o=e.querySelector(".rcb-checkbox-mark"),i=o&&o.style.backgroundColor?"checked":"unchecked";t(`${A} ${i}`)}else{const n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});e.dispatchEvent(n);const r=e.textContent||e.innerText;t(`Selected: ${r}`)}}break;case"Home":e.preventDefault(),o.length>0&&(o[0].setAttribute("tabindex","0"),o.forEach((e,t)=>{0!==t&&(e.setAttribute("tabindex","-1"),e.classList.remove("keyboard-focused"))}),o[0].classList.add("keyboard-focused"),o[0].focus());break;case"End":if(e.preventDefault(),o.length>0){const e=o.length-1;o[e].setAttribute("tabindex","0"),o.forEach((t,n)=>{n!==e&&(t.setAttribute("tabindex","-1"),t.classList.remove("keyboard-focused"))}),o[e].classList.add("keyboard-focused"),o[e].focus()}}},t=e=>{const t=document.createElement("div");t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="sr-only",t.textContent=e,document.body.appendChild(t),setTimeout(()=>{document.body.contains(t)&&document.body.removeChild(t)},1e3)},n=(e=null)=>{let n=e;if(n||(n=document.querySelector(".rcb-chat-window"),n||(n=document.querySelector('[class*="rcb-chat"]')),n||(n=document.querySelector(".qa-bot"))),!n)return;const r=null!==n.closest(".embedded-qa-bot"),A=Array.from(n.querySelectorAll(".rcb-message-container, .rcb-bot-message-container, .rcb-user-message-container")).filter(e=>null!==e.offsetParent);if(0===A.length)return;const o=A[A.length-1],i=Array.from(o.querySelectorAll(".rcb-options-container")).filter(e=>null!==e.offsetParent);let l=[];if(i.length>0){const e=i[i.length-1];l=Array.from(e.querySelectorAll(".rcb-options"))}if(0===l.length){let e=o.querySelector(".rcb-checkbox-container");if(!e&&n&&(e=n.querySelector(".rcb-checkbox-container")),e&&null!==e.offsetParent){const t=Array.from(e.querySelectorAll(".rcb-checkbox-row-container")).filter(e=>null!==e.offsetParent&&"none"!==e.style.display);if(t.length>0){const n=e.querySelector(".rcb-checkbox-next-button"),A=[...t];if(n&&null!==n.offsetParent&&A.push(n),A.forEach((e,t)=>{e.setAttribute("tabindex",0===t?"0":"-1"),0===t?e.classList.add("keyboard-focused"):e.classList.remove("keyboard-focused")}),t.length>1){e.querySelectorAll(".keyboard-nav-hint").forEach(e=>e.remove());const t=document.createElement("div");t.className="keyboard-nav-hint",t.textContent="Use arrow keys ↕ to navigate, Enter to select/deselect, or click any option",t.style.cssText="font-size: 12px !important; color: #666 !important; margin-bottom: 8px !important; font-style: italic !important; display: block !important;",e.insertBefore(t,e.firstChild)}return void setTimeout(()=>{A[0]&&null!==A[0].offsetParent&&!r&&A[0].focus()},150)}}}if(l.length>0){if(l.forEach((e,t)=>{const n=0===t?"0":"-1";e.setAttribute("tabindex",n),e.setAttribute("role","option"),e.setAttribute("aria-posinset",t+1),e.setAttribute("aria-setsize",l.length),0===t?e.classList.add("keyboard-focused"):e.classList.remove("keyboard-focused")}),l.length>1){const e=i.length>0?i[i.length-1]:null;if(e){e.querySelectorAll(".keyboard-nav-hint").forEach(e=>e.remove());const t=document.createElement("div");t.className="keyboard-nav-hint",t.textContent="Use arrow keys ↕ to navigate, Enter to select, or click any option",t.style.cssText="font-size: 12px !important; color: #666 !important; margin-bottom: 8px !important; font-style: italic !important; display: block !important;",e.insertBefore(t,e.firstChild)}}else{const e=i.length>0?i[i.length-1]:null;if(e){e.querySelectorAll(".keyboard-nav-hint").forEach(e=>e.remove())}}setTimeout(()=>{l[0]&&null!==l[0].offsetParent&&!r&&(l[0].focus(),l.length>1&&t(`${l.length} options available. Use arrow keys to navigate.`))},200)}},r=new MutationObserver(e=>{e.forEach(e=>{if("childList"===e.type){const t=Array.from(e.addedNodes),r=t.some(e=>e.nodeType===Node.ELEMENT_NODE&&(e.classList?.contains("rcb-options-container")||e.classList?.contains("rcb-options")||e.querySelector?.(".rcb-options-container")||e.querySelector?.(".rcb-options"))),A=t.some(e=>e.nodeType===Node.ELEMENT_NODE&&(e.classList?.contains("rcb-checkbox-container")||e.querySelector?.(".rcb-checkbox-container")));if(r||A){let t=e.target;for(;t&&!t.classList?.contains("qa-bot")&&!t.classList?.contains("rcb-chat-window");)t=t.parentElement;(t||document).querySelectorAll(".rcb-options[tabindex], .rcb-checkbox-row-container[tabindex], .rcb-checkbox-next-button[tabindex]").forEach(e=>{e.setAttribute("tabindex","-1"),e.classList.remove("keyboard-focused")}),setTimeout(()=>n(t),100)}}})});r.observe(document.body,{childList:!0,subtree:!0}),document.addEventListener("keydown",e),n();const A=setInterval(()=>{document.querySelectorAll(".qa-bot").forEach(e=>{const t=e.querySelectorAll(".rcb-options-container .rcb-options").length>0,r=e.querySelectorAll(".rcb-checkbox-row-container").length>0;if(t){const t=e.querySelectorAll(".rcb-options[tabindex]").length;e.querySelectorAll(".rcb-options").length>t&&n(e)}if(r){const t=e.querySelectorAll(".rcb-checkbox-row-container[tabindex]").length;e.querySelectorAll(".rcb-checkbox-row-container").length>t&&n(e)}})},1e3);return()=>{document.removeEventListener("keydown",e),r.disconnect(),clearInterval(A)}},[]),null);let ia=!1,la=null;function aa(){return ia?Promise.resolve():la||(la=new Promise((e,t)=>{const n=document.createElement("script");n.src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",n.async=!0,n.onload=()=>{ia=!0,jl("Script loaded"),e()},n.onerror=()=>{la=null,t(new Error("Failed to load Turnstile script"))},document.head.appendChild(n)}),la)}const sa=e=>{if(!e||"string"!=typeof e)return e;let t=e.replace(/\[(https?:\/\/[^\s]+?)\]/gi,"[$1]($1)");return t=t.replace(/(?<!\]\(|href=["']|\[)https?:\/\/[^\s[\]()]+/gi,e=>{let t=e,n="";const r=t.match(/([.,;:!?]+)$/);return r&&(n=r[1],t=t.slice(0,-n.length)),`[${t}](${t})${n}`}),t},ca=e=>{let{siteKey:n,onVerify:r,onError:A,loginUrl:s}=e;const c=i(null),u=i(null),d=i(!1),f=i(null),p=i(null),[g,h]=l(!1),[m,v]=l(0),w=i("widget_error"),b=i(null),E=s&&"/login"!==s,P=o(()=>{const e=window.turnstile;if(f.current&&(null==e?void 0:e.remove)){try{e.remove(f.current)}catch(e){}f.current=null}},[]),B=o(()=>{var e;P(),g?null==A||A(w.current,null!==(e=b.current)&&void 0!==e?e:void 0):null==A||A("user_cancelled")},[A,P,g]);a(()=>()=>{P()},[P]),a(()=>{var e;return p.current=document.activeElement,null===(e=u.current)||void 0===e||e.focus(),()=>{p.current&&"function"==typeof p.current.focus&&p.current.focus()}},[]),a(()=>{const e=e=>{if("Escape"===e.key)return e.preventDefault(),void B();if("Tab"===e.key&&u.current){const t=u.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0===t.length)return;const n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):e.shiftKey||document.activeElement!==r||(e.preventDefault(),n.focus())}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[B]),a(()=>{d.current||!c.current||g||(d.current=!0,aa().then(()=>{const e=window.turnstile;if(!e||!c.current)return _l("Turnstile API not available after script load"),w.current="api_unavailable",void h(!0);f.current=e.render(c.current,{sitekey:n,callback:e=>{jl("Visible challenge completed"),r(e)},"error-callback":e=>(_l("Turnstile challenge failed:",e),b.current=e,w.current="widget_error",P(),h(!0),!0),"expired-callback":()=>{_l("Turnstile token expired"),w.current="token_expired",P(),h(!0)}})}).catch(e=>{_l("Failed to load Turnstile script:",e),w.current="script_load_failed",h(!0)}))},[n,r,g]);const D=t.createElement(t.Fragment,null,t.createElement("div",{"aria-hidden":"true",style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.5)",zIndex:999998}}),t.createElement("div",{ref:u,role:"dialog","aria-modal":"true","aria-labelledby":"qa-bot-turnstile-label",tabIndex:-1,style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:999999,background:"white",padding:"24px",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.3)",maxWidth:"90vw",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'}},t.createElement("span",{id:"qa-bot-turnstile-label",className:"sr-only",style:{position:"absolute",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap"}},"Verification challenge"),g?t.createElement("div",{style:{fontSize:"14px",lineHeight:"1.5",color:"#333"}},0===m?t.createElement("p",{style:{margin:"0 0 16px 0"}},"Verification failed. You can try again",E&&t.createElement(t.Fragment,null,", or"," ",t.createElement("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--primaryColor, #107180)",fontWeight:"bold"}},"log in")," ","to skip verification"),"."):t.createElement(t.Fragment,null,t.createElement("p",{style:{margin:"0 0 8px 0"}},"Verification is still not working. This can be caused by browser extensions (ad blockers, privacy tools) or VPN connections."),t.createElement("p",{style:{margin:"0 0 16px 0"}},"Try disabling extensions, using a private/incognito window,",E&&t.createElement(t.Fragment,null," ",t.createElement("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--primaryColor, #107180)",fontWeight:"bold"}},"logging in"),",")," ","or using a different browser.")),t.createElement("div",{style:{display:"flex",gap:"8px"}},t.createElement("button",{type:"button",onClick:()=>{P(),d.current=!1,v(e=>e+1),h(!1)},style:{padding:"8px 16px",background:"var(--primaryColor, #107180)",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Try again"),t.createElement("button",{type:"button",onClick:B,style:{padding:"8px 16px",background:"#f0f0f0",color:"#333",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Close"))):t.createElement(t.Fragment,null,t.createElement("div",{ref:c,style:{borderRadius:"8px",overflow:"hidden"}}),t.createElement("button",{type:"button",onClick:B,style:{marginTop:"16px",padding:"8px 16px",background:"#f0f0f0",color:"#333",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Cancel"))));return y(D,document.body)};function ua(e){const{confidence:t,tools_used:n,metadata:r}=e;if(!(t||n&&0!==n.length))return"";const A=[];return t&&A.push(`• Confidence: ${t}`),n&&n.length>0&&A.push(`• Tools used: ${n.join(", ")}`),(null==r?void 0:r.agent)&&A.push(`• Agent: ${r.agent}`),`---\n${A.join("\n")}`}function da(e){let{getState:n,onResubmit:r,trackEvent:A,loginUrl:o}=e;var i,l;const[a,s]=t.useState(null),[c,u]=t.useState(0),d=n(),f=null!==(i=import.meta.env)&&void 0!==i?i:{},p="true"===f.VITE_FORCE_TURNSTILE_WIDGET,g=null!==(l=d.siteKey)&&void 0!==l?l:p?f.VITE_TURNSTILE_SITE_KEY:null;return g&&(p||a!==g)?t.createElement(ca,{key:c,siteKey:g,loginUrl:o,onVerify:async e=>{d.token=e,null==A||A({type:"chatbot_turnstile_completed"});"needs_another_challenge"===await r(e)?u(e=>e+1):s(d.siteKey)},onError:(e,t)=>{var n;s(d.siteKey),null==A||A({type:"chatbot_turnstile_error",queryId:null===(n=d.pendingQuery)||void 0===n?void 0:n.queryId,failureReason:e,cloudflareErrorCode:t})}}):null}const fa="#1a5b6e",pa="#107180",ga="Arial, sans-serif",ha="Q&A Bot",ma="/chat-icon.svg",va="Type your question here...",ya="Select an option to continue",wa=!1,ba="Ask me a question!",Ea="/login",Pa={general:{showHeader:!0,showFooter:!0},tooltip:{mode:"CLOSE"},chatInput:{disabled:!1,characterLimit:5e3,showCharacterCount:!1,allowNewline:!0,blockSpam:!1},chatWindow:{defaultOpen:!1,showScrollbar:!1},botBubble:{simulateStream:!0,streamSpeed:10,showAvatar:!1},userBubble:{showAvatar:!1},notification:{disabled:!0,showCount:!1},audio:{disabled:!0},emoji:{disabled:!0},fileAttachment:{disabled:!0}},Ba=n((e,n)=>{var r,A,c;const{apiKey:u,qaEndpoint:d,ratingEndpoint:f,capabilitiesEndpoint:p,agentRatingEndpoint:g,welcomeMessage:h,open:m,onOpenChange:v,isLoggedIn:y,allowAnonAccess:w=!1,actingUser:b,primaryColor:P,secondaryColor:B,botName:D,logo:C,placeholder:x,errorMessage:k,embedded:S,footerText:T,footerLink:I,tooltipText:Q,loginUrl:M,turnstileSiteKey:O,backendId:L,resourceContext:N,customFlow:H,onAnalyticsEvent:R}=e,F=i(`bot_${Math.random().toString(36).substr(2,9)}`);a(()=>{Hl()},[]);const U=i(null);null===U.current&&(U.current=Gl(),Rl("CREATED",U.current));const j=i(!1),z=i({getSessionId:()=>U.current,isResetting:()=>j.current}),_=i(null),q=function(e,t){const[n,r]=l(null),[A,s]=l("idle"),c=i(null),u=i(null),d=i(!0),f=o(()=>{const e=window.turnstile;if(u.current&&(null==e?void 0:e.remove)){try{e.remove(u.current)}catch(e){}u.current=null}c.current&&(c.current.remove(),c.current=null)},[]);return a(()=>{if(d.current=!0,!e)return s("idle"),void r(null);s("loading");const n=document.createElement("div");return n.style.position="fixed",n.style.left="-9999px",n.style.top="-9999px",n.style.width="0",n.style.height="0",n.style.overflow="hidden",n.setAttribute("aria-hidden","true"),document.body.appendChild(n),c.current=n,aa().then(()=>{if(!d.current)return;const n=window.turnstile;if(!n||!c.current)return _l("Turnstile API not available for silent verification"),s("failed"),void(null==t||t({type:"chatbot_turnstile_silent_failed",failureReason:"api_unavailable"}));const A=n.render(c.current,{sitekey:e,execution:"render","refresh-expired":"auto",callback:e=>{d.current&&(jl("Silent verification succeeded"),r(e),s("verified"))},"error-callback":e=>!d.current||(_l("Turnstile silent verification failed:",e),r(null),s("failed"),null==t||t({type:"chatbot_turnstile_silent_failed",failureReason:"widget_error",cloudflareErrorCode:e}),!0),"expired-callback":()=>{d.current&&(jl("Token expired, awaiting refresh"),r(null),s("loading"))}});u.current=A}).catch(e=>{d.current&&(_l("Failed to load Turnstile script for silent verification:",e),s("failed"),null==t||t({type:"chatbot_turnstile_silent_failed",failureReason:"script_load_failed"}))}),()=>{d.current=!1,f()}},[e,f]),{token:n,status:A,reset:o(()=>{const e=window.turnstile;u.current&&(null==e?void 0:e.reset)&&(r(null),s("loading"),e.reset(u.current),jl("Token consumed, resetting widget for fresh token"))},[])}}(O,e=>{var t;null===(t=_.current)||void 0===t||t.call(_,e)}),G=i(null);G.current=q.token;const[Y,W]=l(y);a(()=>{W(y)},[y]);const V=void 0!==S?S:wa,X=o(e=>{var t;R&&R(Object.assign(Object.assign({},e),{timestamp:Date.now(),sessionId:null!==(t=U.current)&&void 0!==t?t:void 0,pageUrl:"undefined"!=typeof window?window.location.href:void 0,isEmbedded:V}))},[R,V]);a(()=>{_.current=e=>X(e)},[X]);const K=s(()=>{const e=Object.assign({},Pa);e.general=Object.assign(Object.assign({},e.general),{primaryColor:P||fa,secondaryColor:B||pa,fontFamily:ga,embedded:V});const n=!1===Y?[t.createElement(Pl,{key:"login-button",loginUrl:M||Ea,isHeaderButton:!0})]:[t.createElement($l,{key:"history-button"}),t.createElement(Bl,{key:"user-icon"})];e.header={title:t.createElement("span",{style:{fontSize:14,fontWeight:500}},D||ha),showAvatar:!0,avatar:C||ma,buttons:[...n,E.CLOSE_CHAT_BUTTON]},e.chatInput=Object.assign(Object.assign({},e.chatInput),{disabled:!1,enabledPlaceholderText:x||va,disabledPlaceholderText:k||ya}),e.tooltip=Object.assign(Object.assign({},e.tooltip),{text:Q||ba});const r=T?I?t.createElement("a",{href:I,target:"_blank",rel:"noopener noreferrer",key:"footer-link"},T):t.createElement("span",{key:"footer-text"},T):null;return e.footer={text:null!=r?r:void 0,buttons:[t.createElement(na,{key:"new-chat-button"})]},e.chatWindow=Object.assign(Object.assign({},e.chatWindow),{defaultOpen:!!V}),e.event={rcbPreInjectMessage:!0,rcbPostInjectMessage:!0,rcbUserSubmitText:!0,rcbChangePath:!0,rcbToggleChatWindow:!0},e},[P,B,D,C,x,k,V,Q,Y,M,T,I]),J=i(null),Z=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(()=>{const n=(t,n)=>{if(e.current){const n=getComputedStyle(e.current).getPropertyValue(t);if(n&&""!==n.trim())return n.trim();if(e.current.parentElement){const n=getComputedStyle(e.current.parentElement).getPropertyValue(t);if(n&&""!==n.trim())return n.trim()}}return n};return{primaryColor:n("--primaryColor",t.primaryColor),secondaryColor:n("--secondaryColor",t.secondaryColor),fontFamily:n("--fontFamily",t.fontFamily)}},[e,t])}(J,K.general);((e,t)=>{a(()=>{t.current&&(e?t.current.classList.add("bot-logged-in"):t.current.classList.remove("bot-logged-in"))},[e,t])})(!1!==Y,J),(e=>{let{settings:n,themeColors:r}=e;a(()=>{r&&(Object.entries(r).forEach(e=>{let[t,n]=e;n&&document.documentElement.style.setProperty(`--${t}`,n)}),r.primaryColor&&document.documentElement.style.setProperty("--rcb-header-background",r.primaryColor),r.secondaryColor&&document.documentElement.style.setProperty("--rcb-header-background-hover",r.secondaryColor))},[r]),a(()=>{var e,r;(null===(e=n.header)||void 0===e?void 0:e.title)&&"string"==typeof n.header.title&&(n.header.title=t.createElement("div",{key:"header-title"},t.createElement("h1",{className:"sr-only"},n.header.title),t.createElement("span",{"aria-hidden":"true"},n.header.title))),n.device={desktopEnabled:!0,mobileEnabled:!0,applyMobileOptimizations:!1},n.chatHistory={disabled:!0},n.chatButton=Object.assign(Object.assign({},n.chatButton),{icon:null===(r=n.header)||void 0===r?void 0:r.avatar}),n.event=Object.assign(Object.assign({},n.event),{rcbToggleChatWindow:!0})},[n])})({settings:K,themeColors:Z});const $=s(()=>{const e=(e=>{let{endpoint:n,ratingEndpoint:r,agentRatingEndpoint:A,apiKey:o,sessionId:i,isResetting:l=()=>!1,isLoggedIn:a,allowAnonAccess:s=!1,loginUrl:c="/login",trackEvent:u,getTurnstileToken:d,resetTurnstileToken:f,backendId:p,resourceContext:g}=e;if(!1===a&&!s)return null==u||u({type:"chatbot_login_prompt_shown"}),{qa_loop:{message:"To ask questions, please log in first.",component:t.createElement(Pl,{loginUrl:c}),chatDisabled:!0,path:"qa_loop"}};let h=null,m=null,v=!1;const y={siteKey:null,token:null,pendingQuery:null,needsChallenge:!1};let w=null;if(!n)throw new Error("Q&A endpoint is required");return{qa_loop:{message:async e=>{var t;w=e.injectMessage.bind(e);const{userInput:a}=e;if((!l||!l())&&a&&""!==a.trim()){if("👍 Helpful"===a||"👎 Not helpful"===a){if(h){const e="👍 Helpful"===a,t="agent"===m?A:r;if(t)try{const n={"Content-Type":"application/json"};o&&(n["X-API-KEY"]=o);const r=i();r&&(n["X-Session-ID"]=r,n["X-Query-ID"]=h);const A="agent"===m?{query_id:h,rating:e?"helpful":"not_helpful",session_id:r}:{sessionId:r,queryId:h,rating:e?1:0};await fetch(t,{method:"POST",headers:n,credentials:"include",body:JSON.stringify(A)}),null==u||u({type:"chatbot_rating_sent",queryId:h,rating:e?"helpful":"not_helpful"})}catch(e){_l("Error sending feedback:",e)}}return"Thanks for the feedback!"}try{const r=Sl();h=r,null==u||u({type:"chatbot_question_sent",queryId:r,questionLength:a.length});const A={"Content-Type":"application/json"};o&&(A["X-API-KEY"]=o);const l=i();l&&(A["X-Session-ID"]=l,A["X-Query-ID"]=r),A["X-Origin"]=g||"access";const s={query:a,question_id:r};l&&(s.session_id=l),p&&(s._backend=p),g&&(s.rp_name=g);const c=null==d?void 0:d();c&&(s.turnstile_token=c),Rl("SENT to API",{session_id:l,question_id:r});const w=Date.now(),b=await fetch(n,{method:"POST",headers:A,credentials:"include",body:JSON.stringify(s)});if(!b.ok)throw new Error(`API returned ${b.status}`);if((b.headers.get("content-type")||"").includes("text/event-stream")){null==f||f();const n=null===(t=b.body)||void 0===t?void 0:t.getReader();if(!n)throw new Error("Response body is not readable");const A=new TextDecoder;let o="",i="",l=!1;try{for(;;){const{done:t,value:r}=await n.read();if(t)break;o+=A.decode(r,{stream:!0});let a=o.indexOf("\n\n");for(;-1!==a;){const t=o.slice(0,a);o=o.slice(a+2);let n,r="",A="";for(const e of t.split("\n"))e.startsWith("event: ")?r=e.slice(7):e.startsWith("data: ")&&(A=e.slice(6));if(r&&A){try{n=JSON.parse(A)}catch(e){zl("Failed to parse SSE data:",A),a=o.indexOf("\n\n");continue}if("status"===r){const t=n.message||"Processing...";await e.streamMessage(`_${t}_`,"BOT"),l=!0}else if("token"===r){i+=n.content||"";const t=sa(i);await e.streamMessage(t,"BOT")}else if("done"===r){const t=n.metadata||{};if(m=t.rating_target||null,v=!0===t.is_final_response,i)console.log("[SSE DEBUG] done: tokenContent exists, skipping streamMessage, calling endStreamMessage"),await e.endStreamMessage("BOT");else{const t=n.response||"";if(t){const n=sa(t);await e.streamMessage(n,"BOT"),l=!0}l&&await e.endStreamMessage("BOT")}}else if("error"===r){const t=n.message||"An error occurred";_l("SSE error event:",t),l?(await e.streamMessage(t,"BOT"),await e.endStreamMessage("BOT")):await e.injectMessage(t)}a=o.indexOf("\n\n")}else a=o.indexOf("\n\n")}}l&&await e.endStreamMessage("BOT")}catch(t){if(_l("Error reading SSE stream:",t),!l)throw t;await e.streamMessage("I had trouble completing the response. Please try again.","BOT"),await e.endStreamMessage("BOT")}const a=Date.now()-w;return void(null==u||u({type:"chatbot_answer_received",queryId:r,responseTimeMs:a,success:!0,responseLength:i.length}))}const E=Date.now()-w,P=await b.json();if(P.requires_turnstile)return null==u||u({type:"chatbot_turnstile_shown",queryId:r}),y.siteKey=P.site_key,y.pendingQuery={query:a,sessionId:l,queryId:r},y.needsChallenge=!0,"One moment — verifying your session…";null==f||f();const B=P.response||P.answer||P.text||P.message;if(!B)throw new Error("Invalid response format from API");const D=P.metadata||{};m=D.rating_target||null,v=!0===D.is_final_response;const C=sa(B),x=Tl()?ua(P):"",k=x?`${C}\n\n${x}`:C;return await e.injectMessage(k),void(null==u||u({type:"chatbot_answer_received",queryId:r,responseTimeMs:E,success:!0,responseLength:B.length,hasMetadata:!!x}))}catch(e){return _l("Error in Q&A flow:",e),null==u||u({type:"chatbot_answer_error",queryId:null!=h?h:void 0,errorType:e instanceof Error?e.message:"unknown"}),"I apologize, but I'm having trouble processing your question. Please try again later."}}},options:e=>l&&l()||"👍 Helpful"===e.userInput||"👎 Not helpful"===e.userInput||y.needsChallenge?[]:v&&m&&("agent"===m?A:r)?["👍 Helpful","👎 Not helpful"]:[],renderMarkdown:["BOT"],chatDisabled:!1,component:t.createElement(da,{getState:()=>y,onResubmit:async e=>{var t;if(!y.pendingQuery||!w)return _l("Turnstile resubmit called without pending query or injectMessage"),"error";try{const r={"Content-Type":"application/json"};o&&(r["X-API-KEY"]=o),y.pendingQuery.sessionId&&(r["X-Session-ID"]=y.pendingQuery.sessionId,r["X-Query-ID"]=y.pendingQuery.queryId),r["X-Origin"]=g||"access";const A={query:y.pendingQuery.query,question_id:y.pendingQuery.queryId,turnstile_token:e};y.pendingQuery.sessionId&&(A.session_id=y.pendingQuery.sessionId),p&&(A._backend=p),g&&(A.rp_name=g);const i=await fetch(n,{method:"POST",headers:r,credentials:"include",body:JSON.stringify(A)}),l=y.pendingQuery.queryId;if(!i.ok)throw new Error(`API returned ${i.status} after Turnstile`);if((i.headers.get("content-type")||"").includes("text/event-stream")){const e=null===(t=i.body)||void 0===t?void 0:t.getReader();if(!e)throw new Error("Response body is not readable");const n=new TextDecoder;let r="",A="",o={};for(;;){const{done:t,value:i}=await e.read();if(t)break;r+=n.decode(i,{stream:!0});let l=r.indexOf("\n\n");for(;-1!==l;){const e=r.slice(0,l);r=r.slice(l+2);let t="",n="";for(const r of e.split("\n"))r.startsWith("event: ")?t=r.slice(7):r.startsWith("data: ")&&(n=r.slice(6));if(t&&n)try{const e=JSON.parse(n);"token"===t?A+=e.content||"":"done"===t&&(o=e.metadata||{})}catch(e){}l=r.indexOf("\n\n")}}if(y.token=null,y.pendingQuery=null,y.needsChallenge=!1,y.siteKey=null,!A)throw new Error("No content received from stream");m=o.rating_target||null,v=!0===o.is_final_response,h=l;const a=sa(A);return await w(a),null==u||u({type:"chatbot_answer_received",queryId:l,success:!0,responseLength:A.length}),"success"}const a=await i.json();if(a.requires_turnstile)return y.siteKey=a.site_key,y.token=null,await w("Still verifying — please complete the challenge again."),"needs_another_challenge";y.token=null,y.pendingQuery=null,y.needsChallenge=!1,y.siteKey=null;const s=a.response||a.answer||a.text||a.message;if(!s)throw new Error("Invalid response format from API");const c=a.metadata||{};m=c.rating_target||null,v=!0===c.is_final_response,h=l;const d=sa(s),f=Tl()?ua(a):"",b=f?`${d}\n\n${f}`:d;return await w(b),null==u||u({type:"chatbot_answer_received",queryId:l,success:!0,responseLength:s.length}),"success"}catch(e){return _l("Error resubmitting after Turnstile:",e),y.token=null,y.pendingQuery=null,y.needsChallenge=!1,y.siteKey=null,await(null==w?void 0:w("I had trouble processing your question after verification. Please try again.")),"error"}},trackEvent:u,loginUrl:c}),path:"qa_loop"}}})({endpoint:d,ratingEndpoint:f,agentRatingEndpoint:g,apiKey:u,sessionId:z.current.getSessionId,isResetting:z.current.isResetting,isLoggedIn:Y,allowAnonAccess:w,loginUrl:M||Ea,trackEvent:X,getTurnstileToken:()=>G.current,resetTurnstileToken:()=>q.reset(),backendId:L,resourceContext:N}),n={message:h,renderMarkdown:["BOT"],transition:{duration:0},path:"qa_loop"};return Object.assign(Object.assign({start:n},e),H||{})},[u,d,f,g,h,Y,w,M,H,b,X,N,L]),ee=s(()=>{return[()=>On(t),gl(),()=>vl(e)];var e,t},[]);return a(()=>{const e=()=>{const e=document.querySelector(".rcb-chat-window");if(!e)return;const t=e.querySelector(".rcb-send-button");t&&(t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.hasAttribute("data-keyboard-enabled")||(t.setAttribute("data-keyboard-enabled","true"),t.addEventListener("keydown",e=>{if("Enter"===e.key||" "===e.key){e.preventDefault();const n=t&&Object.keys(t).find(e=>e.startsWith("__reactProps"));if(n){const r=t[n],A=null==r?void 0:r.onMouseDown;if(A&&"function"==typeof A)return void A(e)}const r=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(r)}})))},t=setInterval(e,1e3);return e(),()=>clearInterval(t)},[]),oa(),a(()=>{const e=J.current;if(!e)return;const t=e=>{var t,n,r;const A=null===(n=(t=e.target).closest)||void 0===n?void 0:n.call(t,"a");A&&A.closest(".rcb-chat-body-container")&&(A.classList.contains("qa-bot-login-button")||A.closest(".rcb-options-container")||X({type:"chatbot_link_clicked",linkUrl:A.href,linkText:(null===(r=A.textContent)||void 0===r?void 0:r.trim())||""}))};return e.addEventListener("click",t),()=>e.removeEventListener("click",t)},[X]),a(()=>{if(!V){const e=e=>{const t=e.data.newState;null==v||v(t);const n=U.current;X(t?{type:"chatbot_open"}:{type:"chatbot_close",messageCount:n?Vl(n):0,durationMs:n?Xl(n):0})};return window.addEventListener("rcb-toggle-chat-window",e),()=>{window.removeEventListener("rcb-toggle-chat-window",e)}}},[V,v,X]),t.createElement("div",{className:"qa-bot "+((null===(r=K.general)||void 0===r?void 0:r.embedded)?"embedded-qa-bot":""),ref:J,role:"region","aria-label":`${D||ha}${(null===(A=K.general)||void 0===A?void 0:A.embedded)?" - Embedded":""}`},t.createElement(Jl,{getSessionId:()=>U.current,setSessionId:e=>{const t=U.current;U.current=e,Rl("RESTORED",`${null==t?void 0:t.slice(-12)} -> ${e.slice(-12)}`)},resetSession:()=>{const e=U.current;j.current=!0,U.current=Gl(),Rl("RESET",`${null==e?void 0:e.slice(-12)} -> ${U.current.slice(-12)}`)},clearResettingFlag:()=>{j.current=!1}},t.createElement(bl,{trackEvent:X},t.createElement(Wt,null,t.createElement("div",null,t.createElement(Aa,null),t.createElement(yl,{ref:n,embedded:(null===(c=K.general)||void 0===c?void 0:c.embedded)||!1,currentOpen:m||!1,enabled:!1!==Y,onSetEnabled:e=>W(!!e&&void 0)}),t.createElement(Jt,{key:`chatbot-${F.current}-${Y}`,settings:K,flow:$,plugins:ee}),t.createElement("div",{role:"status","aria-live":"polite","aria-label":"Bot response updates",className:"sr-only",id:"bot-live-region",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}}),t.createElement("div",{id:"chat-input-help",className:"sr-only",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}},"Type your message and press Enter to send. Use arrow keys to navigate through response options."))))))});Ba.displayName="QABot";const Da=()=>{const[e,t]=l(!1),n=()=>"undefined"!=typeof navigator&&void 0!==navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getDisplayMedia;return{captureScreenshot:async()=>{if(!n())throw new Error("Screen capture is not available in this environment");try{t(!0);const e=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",cursor:"always",width:{ideal:1920},height:{ideal:1080}},audio:!1}),n=document.createElement("video");n.srcObject=e,await new Promise(e=>{n.onloadedmetadata=()=>{n.play(),e()}});const r=document.createElement("canvas");r.width=n.videoWidth,r.height=n.videoHeight;const A=r.getContext("2d");if(!A)throw new Error("Could not get canvas context");A.drawImage(n,0,0,r.width,r.height);const o=await new Promise(e=>r.toBlob(e,"image/png"));if(!o)throw new Error("Could not create image blob");const i=(new Date).toISOString().replace(/[:.]/g,"-"),l=new File([o],`screenshot-${i}.png`,{type:"image/png"});return e.getTracks().forEach(e=>e.stop()),t(!1),l}catch(e){throw _l("Error capturing screenshot:",e),t(!1),e}},isCapturing:e,isScreenCaptureAvailable:n()}},Ca=e=>t.createElement(ea,e,t.createElement("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),t.createElement("polyline",{points:"17 8 12 3 7 8"}),t.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),xa=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{if("string"!=typeof r.result)return void n(new Error(`Failed to read file ${e.name}`));const A=r.result.split(",")[1];t({fileName:e.name,contentType:e.type,size:e.size,fileData:A})},r.onerror=()=>n(new Error(`Failed to read file ${e.name}`)),r.readAsDataURL(e)}),ka=e=>Promise.all(e.map(xa)),Sa=function(e){const t=1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:10)*1024;return e.size<=t},Ta=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`,Ia=e=>{let{onFileUpload:n,maxSizeMB:r=10,acceptedTypes:A="image/*,application/pdf,text/*,.doc,.docx",enableScreenshot:o=!1,className:a}=e;const[s,c]=l(!1),[u,d]=l([]),[f,p]=l(null),g=i(null),{captureScreenshot:h,isCapturing:m,isScreenCaptureAvailable:v}=Da(),y=e=>{const t=document.createElement("div");t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="sr-only",t.textContent=e,document.body.appendChild(t),setTimeout(()=>document.body.removeChild(t),1e3)},w=e=>{if(!e||0===e.length)return void zl("FileUploadComponent: No valid files provided to handleFiles");let t;try{t=Array.from(e)}catch(e){return _l("FileUploadComponent: Error converting files to array:",e),void y("Error processing selected files. Please try again.")}const r=[...u,...t];d(r);const A=t.length,o=t.map(e=>e.name).join(", ");y(`${A} file${A>1?"s":""} selected: ${o}`),setTimeout(()=>{const e=document.querySelector(".rcb-chat-content");e&&(e.scrollTop=e.scrollHeight)},100),n&&n(r)},b=e=>{e.preventDefault(),e.stopPropagation(),"dragenter"===e.type||"dragover"===e.type?c(!0):"dragleave"===e.type&&c(!1)},E=()=>{try{g.current&&g.current.click()}catch(e){_l("FileUploadComponent: Error in handleButtonClick:",e),y("Error opening file selection dialog. Please try again.")}},P=()=>{p(null)},B=o&&v;return t.createElement("div",{className:`file-upload-container ${a||""}`,style:{padding:"16px",margin:"8px 0"}},B&&t.createElement("div",{style:{display:"flex",justifyContent:"center",marginBottom:"10px"}},t.createElement("button",{onClick:e=>{e.preventDefault(),(async()=>{try{const e=await h();w([e]),y("Screenshot captured successfully")}catch(e){y("Error capturing screenshot. Please try again.")}})()},disabled:m,"aria-describedby":"screenshot-help","aria-label":m?"Taking screenshot, please wait":"Take a screenshot to attach",style:{display:"flex",alignItems:"center",gap:"8px",backgroundColor:"#107180",color:"white",border:"none",borderRadius:"5px",padding:"8px 12px",cursor:m?"not-allowed":"pointer",fontSize:"14px",fontWeight:"500",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}},t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("path",{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"}),t.createElement("circle",{cx:"12",cy:"13",r:"4"})),m?"Taking screenshot...":"Take screenshot..."),t.createElement("span",{id:"screenshot-help",className:"sr-only"},"Captures the current screen and adds it as an attachment")),t.createElement("div",{className:"file-upload-dropzone "+(s?"active":""),onDragEnter:b,onDragLeave:b,onDragOver:b,onDrop:e=>{var t;e.preventDefault(),e.stopPropagation(),c(!1);try{(null===(t=e.dataTransfer)||void 0===t?void 0:t.files)&&e.dataTransfer.files.length>0&&w(e.dataTransfer.files)}catch(e){_l("FileUploadComponent: Error in handleDrop:",e),y("Error processing dropped files. Please try again.")}},role:"button",tabIndex:0,"aria-label":"File upload area. Click to select files or drag and drop files here.","aria-describedby":"upload-instructions",onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),E())},style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",backgroundColor:s?"#f0f8ff":"#fafafa",transition:"all 0.3s ease"}},t.createElement("input",{ref:g,type:"file",className:"file-input",onChange:e=>{var t;try{(null===(t=e.target)||void 0===t?void 0:t.files)&&e.target.files.length>0&&w(e.target.files)}catch(e){_l("FileUploadComponent: Error in handleFileSelect:",e),y("Error processing selected files. Please try again.")}},multiple:!0,style:{display:"none"},"aria-label":"Select files to upload",accept:A}),t.createElement("div",{className:"upload-content",onClick:E,style:{cursor:"pointer",flexDirection:"column",alignItems:"center",display:"flex",textAlign:"center",padding:"12px"}},t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}},t.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"}},t.createElement(Ca,null),t.createElement("p",{style:{margin:0,fontWeight:"bold"}},"Upload Files")),t.createElement("p",{id:"upload-instructions",style:{margin:0,fontSize:"14px",color:"#666"}},"Drag and drop files here or click to select. (Max ",r,"MB each)")),u.length>0&&t.createElement("div",{className:"selected-files",style:{display:"flex",flexWrap:"wrap",gap:"8px",marginTop:"12px",alignItems:"center"}},t.createElement("span",{style:{fontWeight:400,color:"#888",fontSize:"13px",marginRight:"8px",alignSelf:"center"}},"Selected files:"),u.map((e,r)=>t.createElement("span",{key:r,style:{background:"#fff",color:"#107180",borderRadius:"5px",padding:"4px 12px",fontSize:"14px",marginRight:"4px",marginBottom:"4px",border:"1px solid #ccc",display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},onClick:t=>{t.stopPropagation(),(e=>{p(e)})(e)}},t.createElement("span",{onClick:e=>{e.stopPropagation(),(e=>{const t=u.filter((t,n)=>n!==e);d(t),n&&n(t)})(r)},style:{cursor:"pointer",color:"#888",fontWeight:"bold",fontSize:"15px",marginRight:"4px",userSelect:"none",lineHeight:1},title:"Remove file","aria-label":`Remove ${e.name}`},"×"),e.name," (",Ta(e.size),")"))))),(()=>{if(!f)return null;const e=f.type.startsWith("image/"),n=f.type.startsWith("text/"),r="application/pdf"===f.type;return t.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3},onClick:P},t.createElement("div",{style:{backgroundColor:"white",padding:"20px",borderRadius:"8px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",position:"relative"},onClick:e=>e.stopPropagation()},t.createElement("button",{onClick:P,style:{position:"absolute",top:"10px",right:"10px",background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#666"}},"×"),t.createElement("h3",{style:{marginTop:0,marginBottom:"16px"}},f.name),e&&t.createElement("img",{src:URL.createObjectURL(f),alt:f.name,style:{maxWidth:"100%",maxHeight:"70vh"}}),n&&t.createElement("pre",{style:{whiteSpace:"pre-wrap",wordWrap:"break-word",maxHeight:"70vh",overflow:"auto",padding:"16px",backgroundColor:"#f5f5f5",borderRadius:"4px"}},URL.createObjectURL(f)),r&&t.createElement("iframe",{src:URL.createObjectURL(f),style:{width:"100%",height:"70vh",border:"none"},title:f.name}),!e&&!n&&!r&&t.createElement("div",{style:{padding:"20px",textAlign:"center"}},"Preview not available for this file type")))})())};function Qa(e,t){if(!t||0===Object.keys(t).length)return e;const n={};for(const[r,A]of Object.entries(e)){let e=Object.assign({},A);if(t.disableOnOptions&&void 0===e.chatDisabled){const t=!(!e.options&&!e.checkboxes);e.chatDisabled=t}n[r]=e}return n}function Ma(e){return async t=>{await t.injectMessage(e)}}function Oa(e){return async t=>{const n=await e(t);await t.injectMessage(n)}}const La=t.forwardRef((e,n)=>{var{defaultOpen:r}=e,A=b(e,["defaultOpen"]);const[o,i]=t.useState(r||!1),l=t.useRef(null);return t.useImperativeHandle(n,()=>({addMessage:e=>{var t;null===(t=l.current)||void 0===t||t.addMessage(e)},setBotEnabled:e=>{var t;null===(t=l.current)||void 0===t||t.setBotEnabled(e)},openChat:()=>{var e;i(!0),null===(e=l.current)||void 0===e||e.openChat()},closeChat:()=>{var e;i(!1),null===(e=l.current)||void 0===e||e.closeChat()},toggleChat:()=>{var e;i(e=>!e),null===(e=l.current)||void 0===e||e.toggleChat()}}),[]),t.createElement(Ba,w({ref:l},A,{open:o,onOpenChange:i}))});function Na(e){if(!(e.target&&e.target instanceof HTMLElement))return void _l("QA Bot: A valid target DOM element is required");const{target:n}=e,r=b(e,["target"]),A=p.createRoot(n),o={current:null};return A.render(t.createElement(t.StrictMode,null,t.createElement(La,w({ref:e=>{o.current=e}},r)))),{addMessage:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.addMessage(e)},setBotEnabled:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.setBotEnabled(e)},openChat:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.openChat()},closeChat:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.closeChat()},toggleChat:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.toggleChat()},destroy:()=>{o.current=null,A.unmount()}}}La.displayName="ProgrammaticQABot";export{Ia as FileUploadComponent,Ba as QABot,Qa as applyFlowSettings,Na as default,xa as fileToBase64,ka as filesToBase64,Ta as formatFileSize,Na as qaBot,Da as useScreenshotCapture,Sa as validateFileSize,Ma as withHistory,Oa as withHistoryFn};
8
+ */var mn,vn;const yn=hn(function(){if(vn)return mn;vn=1;var e=/["'&<>]/;return mn=function(t){var n=""+t,r=e.exec(n);if(!r)return n;var A,o="",i=0,l=0;for(i=r.index;i<n.length;i++){switch(n.charCodeAt(i)){case 34:A="&quot;";break;case 38:A="&amp;";break;case 39:A="&#39;";break;case 60:A="&lt;";break;case 62:A="&gt;";break;default:continue}l!==i&&(o+=n.substring(l,i)),l=i+1,o+=A}return l!==i?o+n.substring(l,i):o}}());function wn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const bn=/(url|image|image-set)\(/i;class En extends gn{attribute(e,t){return"style"===e&&Object.keys(t).forEach(e=>{String(t[e]).match(bn)&&delete t[e]}),t}}const Pn=/^<(!doctype|(html|head|body)(\s|>))/i,Bn=/^(aria-|data-|\w+:)/iu,Dn=/{{{(\w+)\/?}}}/;function Cn(){if(!(typeof window>"u"||typeof document>"u"))return document.implementation.createHTMLDocument("Interweave")}let xn=class{constructor(e,t={},n=[],r=[]){var A;if(wn(this,"allowed",void 0),wn(this,"banned",void 0),wn(this,"blocked",void 0),wn(this,"container",void 0),wn(this,"content",[]),wn(this,"props",void 0),wn(this,"matchers",void 0),wn(this,"filters",void 0),wn(this,"keyIndex",void 0),"production"!==process.env.NODE_ENV&&e&&"string"!=typeof e)throw new TypeError("Interweave parser requires a valid string.");this.props=t,this.matchers=n,this.filters=[...r,new En],this.keyIndex=-1,this.container=this.createContainer(e||""),this.allowed=new Set(null!==(A=t.allowList)&&void 0!==A?A:cn),this.banned=new Set(sn),this.blocked=new Set(t.blockList)}applyAttributeFilters(e,t){return this.filters.reduce((t,n)=>null!==t&&"function"==typeof n.attribute?n.attribute(e,t):t,t)}applyNodeFilters(e,t){return this.filters.reduce((t,n)=>null!==t&&"function"==typeof n.node?n.node(e,t):t,t)}applyMatchers(e,t){const n={},{props:r}=this;let A=e,o=0,i=null;return this.matchers.forEach(e=>{const l=e.asTag().toLowerCase(),a=this.getTagConfig(l);if(r[e.inverseName]||!this.isTagAllowed(l)||!this.canRenderChild(t,a))return;let s="";for(;A&&(i=e.match(A));){const{index:t,length:l,match:a,valid:c,void:u,...d}=i,f=e.propName+String(o);t>0&&(s+=A.slice(0,t)),c?(s+=u?`{{{${f}/}}}`:`{{{${f}}}}${a}{{{/${f}}}}`,this.keyIndex+=1,o+=1,n[f]={children:a,matcher:e,props:{...r,...d,key:this.keyIndex}}):s+=a,e.greedy?(A=s+A.slice(t+l),s=""):A=A.slice(t+(l||a.length))}e.greedy||(A=s+A)}),0===o?e:this.replaceTokens(A,n)}canRenderChild(e,t){return!(!e.tagName||!t.tagName||e.void)&&(e.children.length>0?e.children.includes(t.tagName):!(e.invalid.length>0&&e.invalid.includes(t.tagName))&&(t.parent.length>0?t.parent.includes(e.tagName):!(!e.self&&e.tagName===t.tagName)&&!!(e&&e.content&t.type)))}convertLineBreaks(e){const{noHtml:t,disableLineBreaks:n}=this.props;if(t||n||e.match(/<((?:\/[ a-z]+)|(?:[ a-z]+\/))>/gi))return e;let r=e.replace(/\r\n/g,"\n");return r=r.replace(/\n{3,}/g,"\n\n\n"),r=r.replace(/\n/g,"<br/>"),r}createContainer(e){var t;const n=(typeof global<"u"&&global.INTERWEAVE_SSR_POLYFILL||Cn)();if(!n)return;const r=null!==(t=this.props.containerTagName)&&void 0!==t?t:"body",A="body"===r||"fragment"===r?n.body:n.createElement(r);if(e.match(Pn)){if("production"!==process.env.NODE_ENV)throw new Error("HTML documents as Interweave content are not supported.")}else A.innerHTML=this.convertLineBreaks(this.props.escapeHtml?yn(e):e);return A}extractAttributes(e){const{allowAttributes:t}=this.props,n={};let r=0;return 1===e.nodeType&&e.attributes&&([...e.attributes].forEach(A=>{const{name:o,value:i}=A,l=o.toLowerCase(),a=un[l]||un[o];if(!this.isSafe(e)||!l.match(Bn)&&(!t&&(!a||2===a)||l.startsWith("on")||i.replace(/(\s|\0|&#x0([9AD]);)/,"").match(/(javascript|vbscript|livescript|xss):/i)))return;let s="style"===l?this.extractStyleAttribute(e):i;4===a?s=!0:3===a?s=Number.parseFloat(String(s)):5!==a&&(s=String(s)),n[dn[l]||l]=this.applyAttributeFilters(l,s),r+=1}),0!==r)?n:null}extractStyleAttribute(e){const t={};return Array.from(e.style).forEach(n=>{const r=e.style[n];("string"==typeof r||"number"==typeof r)&&(t[n.replace(/-([a-z])/g,(e,t)=>String(t).toUpperCase())]=r)}),t}getTagConfig(e){const t={children:[],content:0,invalid:[],parent:[],self:!0,tagName:"",type:0,void:!1};return an[e]?{...t,...an[e],tagName:e}:t}isSafe(e){if(typeof HTMLAnchorElement<"u"&&e instanceof HTMLAnchorElement){const t=e.getAttribute("href");if(null!=t&&t.startsWith("#"))return!0;const n=e.protocol.toLowerCase();return":"===n||"http:"===n||"https:"===n||"mailto:"===n||"tel:"===n}return!0}isTagAllowed(e){return!this.banned.has(e)&&!this.blocked.has(e)&&(this.props.allowElements||this.allowed.has(e))}parse(){return this.container?this.parseNode(this.container,this.getTagConfig(this.container.nodeName.toLowerCase())):[]}parseNode(e,n){const{noHtml:r,noHtmlExceptMatchers:A,allowElements:o,transform:i,transformOnlyAllowList:l}=this.props;let a=[],s="";return[...e.childNodes].forEach(e=>{if(1===e.nodeType){const u=e.nodeName.toLowerCase(),d=this.getTagConfig(u);s&&(a.push(s),s="");const f=this.applyNodeFilters(u,e);if(!f)return;let p;if(i&&(!l||this.isTagAllowed(u))){this.keyIndex+=1;const e=this.keyIndex;p=this.parseNode(f,d);const n=i(f,p,d);if(null===n)return;if(typeof n<"u")return void a.push(t.cloneElement(n,{key:e}));this.keyIndex=e-1}if(this.banned.has(u))return;if(r||A&&"br"!==u||!this.isTagAllowed(u)||!o&&!this.canRenderChild(n,d))a=[...a,...this.parseNode(f,d.tagName?d:n)];else{var c;this.keyIndex+=1;const e=this.extractAttributes(f),n={tagName:u};e&&(n.attributes=e),d.void&&(n.selfClose=d.void),a.push(t.createElement(pn,{...n,key:this.keyIndex},null!==(c=p)&&void 0!==c?c:this.parseNode(f,d)))}}else if(3===e.nodeType){const t=r&&!A?e.textContent:this.applyMatchers(e.textContent||"",n);Array.isArray(t)?a=[...a,...t]:s+=t}}),s&&a.push(s),a}replaceTokens(e,t){if(!e.includes("{{{"))return e;const n=[];let r=e,A=null;for(;A=r.match(Dn);){const[e,o]=A,i=A.index,l=e.includes("/");if("production"!==process.env.NODE_ENV&&!t[o])throw new Error(`Token "${o}" found but no matching element to replace with.`);i>0&&(n.push(r.slice(0,i)),r=r.slice(i));const{children:a,matcher:s,props:c}=t[o];let u;if(l)u=e.length,n.push(s.createElement(a,c));else{const A=r.match(new RegExp(`{{{/${o}}}}`));if("production"!==process.env.NODE_ENV&&!A)throw new Error(`Closing token missing for interpolated element "${o}".`);u=A.index+A[0].length,n.push(s.createElement(this.replaceTokens(r.slice(e.length,A.index),t),c))}r=r.slice(u)}return r.length>0&&n.push(r),0===n.length?"":1===n.length&&"string"==typeof n[0]?n[0]:n}};function kn(e){var n;const{attributes:r,className:A,containerTagName:o,content:i,emptyContent:l,parsedContent:a,tagName:s,noWrap:c}=e,u=null!==(n=o??s)&&void 0!==n?n:"span",d="fragment"===u||c;let f;if(a)f=a;else{const t=new xn(i??"",e).parse();t.length>0&&(f=t)}return f||(f=l),d?t.createElement(t.Fragment,null,f):t.createElement(pn,{attributes:r,className:A,tagName:u},f)}function Sn(e){const{attributes:n,className:r,content:A="",disableFilters:o=!1,disableMatchers:i=!1,emptyContent:l=null,filters:a=[],matchers:s=[],onAfterParse:c=null,onBeforeParse:u=null,tagName:d="span",noWrap:f=!1,...p}=e,g=i?[]:s,h=o?[]:a,m=u?[u]:[],v=c?[c]:[];g.forEach(e=>{e.onBeforeParse&&m.push(e.onBeforeParse.bind(e)),e.onAfterParse&&v.push(e.onAfterParse.bind(e))});const y=m.reduce((t,n)=>{const r=n(t,e);if("production"!==process.env.NODE_ENV&&"string"!=typeof r)throw new TypeError("Interweave `onBeforeParse` must return a valid HTML string.");return r},A??""),w=new xn(y,p,g,h),b=v.reduce((t,n)=>{const r=n(t,e);if("production"!==process.env.NODE_ENV&&!Array.isArray(r))throw new TypeError("Interweave `onAfterParse` must return an array of strings and React elements.");return r},w.parse());return t.createElement(kn,{attributes:n,className:r,containerTagName:e.containerTagName,emptyContent:l,noWrap:f,parsedContent:0===b.length?void 0:b,tagName:d})}const Tn=({children:e})=>g("div",{style:{whiteSpace:"normal"},children:g(Sn,{content:"string"==typeof e?e:""})}),In={autoConfig:!0},Qn=(e,t,n)=>{var r;if(!e.detail.currPath)return!1;const A=t[e.detail.currPath];return!!A&&((null==(r=A.renderHtml)?void 0:r.map(e=>e.toUpperCase()).includes(n))??!1)},Mn=e=>{const t=[];let n="",r=!1;for(let A=0;A<e.length;A++){const o=e[A];"<"===o?r?(t.push(n),n=o):(r=!0,n=o):">"===o?(n+=o,t.push(n),n="",r=!1):r?n+=o:t.push(o)}return""!==n&&t.push(n),t},On=e=>{const{getFlow:t}=$t(),{messages:n,replaceMessages:r}=en(),{settings:A}=nn(),{hasChatHistoryLoaded:o}=An(),i={...e,...In},l=i.htmlComponent?i.htmlComponent:Tn;a(()=>{var e,t;if(o){const o=[...n];for(let n=0;n<o.length&&n<((null==(e=A.chatHistory)?void 0:e.maxEntries)??30);n++){const e=o[n];null!=(t=e.tags)&&t.includes("rcb-html-renderer-plugin:parsed")&&(e.contentWrapper=l)}r(o)}},[o]);const s=async e=>{var n;const r=null==(n=e.data.message)?void 0:n.sender.toUpperCase();"string"==typeof e.data.message.content&&Qn(e,t(),r)&&("rcb-start-simulate-stream-message"===e.type&&(e.data.simulateStreamChunker=Mn),e.data.message.contentWrapper=l,e.data.message.tags||(e.data.message.tags=[]),e.data.message.tags.push("rcb-html-renderer-plugin:parsed"))};tn(J.PRE_INJECT_MESSAGE,s),tn(J.CHUNK_STREAM_MESSAGE,s),tn(J.START_STREAM_MESSAGE,s),tn(J.START_SIMULATE_STREAM_MESSAGE,s),tn(J.START_SPEAK_AUDIO,async e=>{Qn(e,t(),"BOT")&&(e.data.textToRead=(e=>typeof window.DOMParser<"u"?(new DOMParser).parseFromString(e,"text/html").body.textContent||"":e.replace(/<\/?[^>]+(>|$)/g,""))(e.data.textToRead))});const c={name:"@rcb-plugins/html-renderer"};return null!=i&&i.autoConfig&&(c.settings={event:{rcbPreInjectMessage:!0,rcbChunkStreamMessage:!0,rcbStartSimulateStreamMessage:!0,rcbStartStreamMessage:!0,rcbStartSpeakAudio:!0}}),c};const Ln=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Nn=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hn={};function Rn(e,t){return(Hn.jsx?Nn:Ln).test(e)}const Fn=/[ \t\n\f\r]/g;function Un(e){return""===e.replace(Fn,"")}class jn{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}}function zn(e,t){const n={},r={};let A=-1;for(;++A<e.length;)Object.assign(n,e[A].property),Object.assign(r,e[A].normal);return new jn(n,r,t)}function _n(e){return e.toLowerCase()}jn.prototype.property={},jn.prototype.normal={},jn.prototype.space=null;class qn{constructor(e,t){this.property=e,this.attribute=t}}qn.prototype.space=null,qn.prototype.boolean=!1,qn.prototype.booleanish=!1,qn.prototype.overloadedBoolean=!1,qn.prototype.number=!1,qn.prototype.commaSeparated=!1,qn.prototype.spaceSeparated=!1,qn.prototype.commaOrSpaceSeparated=!1,qn.prototype.mustUseProperty=!1,qn.prototype.defined=!1;let Gn=0;const Yn=$n(),Wn=$n(),Vn=$n(),Xn=$n(),Kn=$n(),Jn=$n(),Zn=$n();function $n(){return 2**++Gn}const er=Object.freeze(Object.defineProperty({__proto__:null,boolean:Yn,booleanish:Wn,commaOrSpaceSeparated:Zn,commaSeparated:Jn,number:Xn,overloadedBoolean:Vn,spaceSeparated:Kn},Symbol.toStringTag,{value:"Module"})),tr=Object.keys(er);class nr extends qn{constructor(e,t,n,r){let A=-1;if(super(e,t),rr(this,"space",r),"number"==typeof n)for(;++A<tr.length;){const e=tr[A];rr(this,tr[A],(n&er[e])===er[e])}}}function rr(e,t,n){n&&(e[t]=n)}nr.prototype.defined=!0;const Ar={}.hasOwnProperty;function or(e){const t={},n={};let r;for(r in e.properties)if(Ar.call(e.properties,r)){const A=e.properties[r],o=new nr(r,e.transform(e.attributes||{},r),A,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[_n(r)]=r,n[_n(o.attribute)]=r}return new jn(t,n,e.space)}const ir=or({space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),lr=or({space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function ar(e,t){return t in e?e[t]:t}function sr(e,t){return ar(e,t.toLowerCase())}const cr=or({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:sr,properties:{xmlns:null,xmlnsXLink:null}}),ur=or({transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:Wn,ariaAutoComplete:null,ariaBusy:Wn,ariaChecked:Wn,ariaColCount:Xn,ariaColIndex:Xn,ariaColSpan:Xn,ariaControls:Kn,ariaCurrent:null,ariaDescribedBy:Kn,ariaDetails:null,ariaDisabled:Wn,ariaDropEffect:Kn,ariaErrorMessage:null,ariaExpanded:Wn,ariaFlowTo:Kn,ariaGrabbed:Wn,ariaHasPopup:null,ariaHidden:Wn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Kn,ariaLevel:Xn,ariaLive:null,ariaModal:Wn,ariaMultiLine:Wn,ariaMultiSelectable:Wn,ariaOrientation:null,ariaOwns:Kn,ariaPlaceholder:null,ariaPosInSet:Xn,ariaPressed:Wn,ariaReadOnly:Wn,ariaRelevant:null,ariaRequired:Wn,ariaRoleDescription:Kn,ariaRowCount:Xn,ariaRowIndex:Xn,ariaRowSpan:Xn,ariaSelected:Wn,ariaSetSize:Xn,ariaSort:null,ariaValueMax:Xn,ariaValueMin:Xn,ariaValueNow:Xn,ariaValueText:null,role:null}}),dr=or({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:sr,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Jn,acceptCharset:Kn,accessKey:Kn,action:null,allow:null,allowFullScreen:Yn,allowPaymentRequest:Yn,allowUserMedia:Yn,alt:null,as:null,async:Yn,autoCapitalize:null,autoComplete:Kn,autoFocus:Yn,autoPlay:Yn,blocking:Kn,capture:null,charSet:null,checked:Yn,cite:null,className:Kn,cols:Xn,colSpan:null,content:null,contentEditable:Wn,controls:Yn,controlsList:Kn,coords:Xn|Jn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Yn,defer:Yn,dir:null,dirName:null,disabled:Yn,download:Vn,draggable:Wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Yn,formTarget:null,headers:Kn,height:Xn,hidden:Yn,high:Xn,href:null,hrefLang:null,htmlFor:Kn,httpEquiv:Kn,id:null,imageSizes:null,imageSrcSet:null,inert:Yn,inputMode:null,integrity:null,is:null,isMap:Yn,itemId:null,itemProp:Kn,itemRef:Kn,itemScope:Yn,itemType:Kn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Yn,low:Xn,manifest:null,max:null,maxLength:Xn,media:null,method:null,min:null,minLength:Xn,multiple:Yn,muted:Yn,name:null,nonce:null,noModule:Yn,noValidate:Yn,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:Yn,optimum:Xn,pattern:null,ping:Kn,placeholder:null,playsInline:Yn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Yn,referrerPolicy:null,rel:Kn,required:Yn,reversed:Yn,rows:Xn,rowSpan:Xn,sandbox:Kn,scope:null,scoped:Yn,seamless:Yn,selected:Yn,shadowRootClonable:Yn,shadowRootDelegatesFocus:Yn,shadowRootMode:null,shape:null,size:Xn,sizes:null,slot:null,span:Xn,spellCheck:Wn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Xn,step:null,style:null,tabIndex:Xn,target:null,title:null,translate:null,type:null,typeMustMatch:Yn,useMap:null,value:Wn,width:Xn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Kn,axis:null,background:null,bgColor:null,border:Xn,borderColor:null,bottomMargin:Xn,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Yn,declare:Yn,event:null,face:null,frame:null,frameBorder:null,hSpace:Xn,leftMargin:Xn,link:null,longDesc:null,lowSrc:null,marginHeight:Xn,marginWidth:Xn,noResize:Yn,noHref:Yn,noShade:Yn,noWrap:Yn,object:null,profile:null,prompt:null,rev:null,rightMargin:Xn,rules:null,scheme:null,scrolling:Wn,standby:null,summary:null,text:null,topMargin:Xn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Xn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Yn,disableRemotePlayback:Yn,prefix:null,property:null,results:Xn,security:null,unselectable:null}}),fr=or({space:"svg",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"},transform:ar,properties:{about:Zn,accentHeight:Xn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Xn,amplitude:Xn,arabicForm:null,ascent:Xn,attributeName:null,attributeType:null,azimuth:Xn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Xn,by:null,calcMode:null,capHeight:Xn,className:Kn,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:Xn,diffuseConstant:Xn,direction:null,display:null,dur:null,divisor:Xn,dominantBaseline:null,download:Yn,dx:null,dy:null,edgeMode:null,editable:null,elevation:Xn,enableBackground:null,end:null,event:null,exponent:Xn,externalResourcesRequired:null,fill:null,fillOpacity:Xn,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:Jn,g2:Jn,glyphName:Jn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Xn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Xn,horizOriginX:Xn,horizOriginY:Xn,id:null,ideographic:Xn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Xn,k:Xn,k1:Xn,k2:Xn,k3:Xn,k4:Xn,kernelMatrix:Zn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Xn,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:Xn,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:Xn,overlineThickness:Xn,paintOrder:null,panose1:null,path:null,pathLength:Xn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Kn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Xn,pointsAtY:Xn,pointsAtZ:Xn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Zn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Zn,rev:Zn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Zn,requiredFeatures:Zn,requiredFonts:Zn,requiredFormats:Zn,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:Xn,specularExponent:Xn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Xn,strikethroughThickness:Xn,string:null,stroke:null,strokeDashArray:Zn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Xn,strokeOpacity:Xn,strokeWidth:null,style:null,surfaceScale:Xn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Zn,tabIndex:Xn,tableValues:null,target:null,targetX:Xn,targetY:Xn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Zn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Xn,underlineThickness:Xn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Xn,values:null,vAlphabetic:Xn,vMathematical:Xn,vectorEffect:null,vHanging:Xn,vIdeographic:Xn,version:null,vertAdvY:Xn,vertOriginX:Xn,vertOriginY:Xn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Xn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),pr=/^data[-\w.:]+$/i,gr=/-[a-z]/g,hr=/[A-Z]/g;function mr(e){return"-"+e.toLowerCase()}function vr(e){return e.charAt(1).toUpperCase()}const yr={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"},wr=zn([lr,ir,cr,ur,dr],"html"),br=zn([lr,ir,cr,ur,fr],"svg");function Er(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pr,Br,Dr,Cr={};var xr=function(){if(Dr)return Cr;Dr=1;var e=Cr&&Cr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.default=function(e,n){var r=null;if(!e||"string"!=typeof e)return r;var A=(0,t.default)(e),o="function"==typeof n;return A.forEach(function(e){if("declaration"===e.type){var t=e.property,A=e.value;o?n(t,A,e):A&&((r=r||{})[t]=A)}}),r};var t=e(function(){if(Br)return Pr;Br=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,A=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,l=/^\s+|\s+$/g,a="";function s(e){return e?e.replace(l,a):a}return Pr=function(l,c){if("string"!=typeof l)throw new TypeError("First argument must be a string");if(!l)return[];c=c||{};var u=1,d=1;function f(e){var n=e.match(t);n&&(u+=n.length);var r=e.lastIndexOf("\n");d=~r?e.length-r:d+e.length}function p(){var e={line:u,column:d};return function(t){return t.position=new g(e),v(),t}}function g(e){this.start=e,this.end={line:u,column:d},this.source=c.source}function h(e){var t=new Error(c.source+":"+u+":"+d+": "+e);if(t.reason=e,t.filename=c.source,t.line=u,t.column=d,t.source=l,!c.silent)throw t}function m(e){var t=e.exec(l);if(t){var n=t[0];return f(n),l=l.slice(n.length),t}}function v(){m(n)}function y(e){var t;for(e=e||[];t=w();)!1!==t&&e.push(t);return e}function w(){var e=p();if("/"==l.charAt(0)&&"*"==l.charAt(1)){for(var t=2;a!=l.charAt(t)&&("*"!=l.charAt(t)||"/"!=l.charAt(t+1));)++t;if(t+=2,a===l.charAt(t-1))return h("End of comment missing");var n=l.slice(2,t-2);return d+=2,f(n),l=l.slice(t),d+=2,e({type:"comment",comment:n})}}function b(){var t=p(),n=m(r);if(n){if(w(),!m(A))return h("property missing ':'");var l=m(o),c=t({type:"declaration",property:s(n[0].replace(e,a)),value:l?s(l[0].replace(e,a)):a});return m(i),c}}return g.prototype.content=l,v(),function(){var e,t=[];for(y(t);e=b();)!1!==e&&(t.push(e),y(t));return t}()},Pr}());return Cr}();const kr=Er(xr),Sr=kr.default||kr,Tr=Qr("end"),Ir=Qr("start");function Qr(e){return function(t){const n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function Mr(e){return e&&"object"==typeof e?"position"in e||"type"in e?Lr(e.position):"start"in e||"end"in e?Lr(e):"line"in e||"column"in e?Or(e):"":""}function Or(e){return Nr(e&&e.line)+":"+Nr(e&&e.column)}function Lr(e){return Or(e&&e.start)+"-"+Or(e&&e.end)}function Nr(e){return e&&"number"==typeof e?e:1}class Hr extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",A={},o=!1;if(t&&(A="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!A.cause&&e&&(o=!0,r=e.message,A.cause=e),!A.ruleId&&!A.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?A.ruleId=n:(A.source=n.slice(0,e),A.ruleId=n.slice(e+1))}if(!A.place&&A.ancestors&&A.ancestors){const e=A.ancestors[A.ancestors.length-1];e&&(A.place=e.position)}const i=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=i?i.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=i?i.line:void 0,this.name=Mr(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&&"string"==typeof A.cause.stack?A.cause.stack:"",this.actual,this.expected,this.note,this.url}}Hr.prototype.file="",Hr.prototype.name="",Hr.prototype.reason="",Hr.prototype.message="",Hr.prototype.stack="",Hr.prototype.column=void 0,Hr.prototype.line=void 0,Hr.prototype.ancestors=void 0,Hr.prototype.cause=void 0,Hr.prototype.fatal=void 0,Hr.prototype.place=void 0,Hr.prototype.ruleId=void 0,Hr.prototype.source=void 0;const Rr={}.hasOwnProperty,Fr=new Map,Ur=/[A-Z]/g,jr=/-([a-z])/g,zr=new Set(["table","tbody","thead","tfoot","tr"]),_r=new Set(["td","th"]),qr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Gr(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=function(e,t){return n;function n(n,r,A,o){const i=Array.isArray(A.children),l=Ir(n);return t(r,A,o,i,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}(n,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");r=function(e,t,n){return r;function r(e,r,A,o){const i=Array.isArray(A.children)?n:t;return o?i(r,A,o):i(r,A)}}(0,t.jsx,t.jsxs)}const A={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:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?br:wr,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},o=Yr(A,e,void 0);return o&&"string"!=typeof o?o:A.create(e,A.Fragment,{children:o||void 0},void 0)}function Yr(e,t,n){return"element"===t.type?function(e,t,n){const r=e.schema;let A=r;"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(A=br,e.schema=A),e.ancestors.push(t);const o=Jr(e,t.tagName,!1),i=function(e,t){const n={};let r,A;for(A in t.properties)if("children"!==A&&Rr.call(t.properties,A)){const o=Kr(e,A,t.properties[A]);if(o){const[A,i]=o;e.tableCellAlignToStyle&&"align"===A&&"string"==typeof i&&_r.has(t.tagName)?r=i:n[A]=i}}if(r){(n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r}return n}(e,t);let l=Xr(e,t);return zr.has(t.tagName)&&(l=l.filter(function(e){return"string"!=typeof e||!function(e){return"object"==typeof e?"text"===e.type&&Un(e.value):Un(e)}(e)})),Wr(e,i,o,t),Vr(i,l),e.ancestors.pop(),e.schema=r,e.create(t,o,i,n)}(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Zr(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,n){const r=e.schema;let A=r;"svg"===t.name&&"html"===r.space&&(A=br,e.schema=A),e.ancestors.push(t);const o=null===t.name?e.Fragment:Jr(e,t.name,!0),i=function(e,t){const n={};for(const r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){const t=r.data.estree.body[0];t.type;const A=t.expression;A.type;const o=A.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Zr(e,t.position);else{const A=r.name;let o;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){const t=r.value.data.estree.body[0];t.type,o=e.evaluater.evaluateExpression(t.expression)}else Zr(e,t.position);else o=null===r.value||r.value;n[A]=o}return n}(e,t),l=Xr(e,t);return Wr(e,i,o,t),Vr(i,l),e.ancestors.pop(),e.schema=r,e.create(t,o,i,n)}(e,t,n):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zr(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const r={};return Vr(r,Xr(e,t)),e.create(t,e.Fragment,r,n)}(e,t,n):"text"===t.type?function(e,t){return t.value}(0,t):void 0}function Wr(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Xr(e,t){const n=[];let r=-1;const A=e.passKeys?new Map:Fr;for(;++r<t.children.length;){const o=t.children[r];let i;if(e.passKeys){const e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){const t=A.get(e)||0;i=e+"-"+t,A.set(e,t+1)}}const l=Yr(e,o,i);void 0!==l&&n.push(l)}return n}function Kr(e,t,n){const r=function(e,t){const n=_n(t);let r=t,A=qn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&pr.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(gr,vr);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!gr.test(e)){let n=e.replace(hr,mr);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}A=nr}return new A(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?function(e){const t={};return(""===e[e.length-1]?[...e,""]:e).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()}(n):function(e){return e.join(" ").trim()}(n)),"style"===r.property){let t="object"==typeof n?n:function(e,t){const n={};try{Sr(t,r)}catch(t){if(!e.ignoreInvalidStyle){const n=t,r=new Hr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=qr+"#cannot-parse-style-attribute",r}}return n;function r(e,t){let r=e;"--"!==r.slice(0,2)&&("-ms-"===r.slice(0,4)&&(r="ms-"+r.slice(4)),r=r.replace(jr,eA)),n[r]=t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)Rr.call(e,n)&&(t[$r(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?yr[r.property]||r.property:r.attribute,n]}}function Jr(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,A=-1;for(;++A<e.length;){const t=Rn(e[A])?{type:"Identifier",name:e[A]}:{type:"Literal",value:e[A]};n=n?{type:"MemberExpression",object:n,property:t,computed:!(!A||"Literal"!==t.type),optional:!1}:t}r=n}else r=Rn(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){const t=r.value;return Rr.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Zr(e)}function Zr(e,t){const n=new Hr("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=qr+"#cannot-handle-mdx-estrees-without-createevaluater",n}function $r(e){let t=e.replace(Ur,tA);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function eA(e,t){return t.toUpperCase()}function tA(e){return"-"+e.toLowerCase()}const nA={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"]},rA={};function AA(e,t,n){if(function(e){return!(!e||"object"!=typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return oA(e.children,t,n)}return Array.isArray(e)?oA(e,t,n):""}function oA(e,t,n){const r=[];let A=-1;for(;++A<e.length;)r[A]=AA(e[A],t,n);return r.join("")}const iA=document.createElement("i");function lA(e){const t="&"+e+";";iA.innerHTML=t;const n=iA.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}function aA(e,t,n,r){const A=e.length;let o,i=0;if(t=t<0?-t>A?0:A+t:t>A?A: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);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function sA(e,t){return e.length>0?(aA(e,e.length,0,t),e):t}const cA={}.hasOwnProperty;function uA(e){const t={};let n=-1;for(;++n<e.length;)dA(t,e[n]);return t}function dA(e,t){let n;for(n in t){const r=(cA.call(e,n)?e[n]:void 0)||(e[n]={}),A=t[n];let o;if(A)for(o in A){cA.call(r,o)||(r[o]=[]);const e=A[o];fA(r[o],Array.isArray(e)?e:e?[e]:[])}}}function fA(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);aA(e,0,0,r)}function pA(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}function gA(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hA=kA(/[A-Za-z]/),mA=kA(/[\dA-Za-z]/),vA=kA(/[#-'*+\--9=?A-Z^-~]/);function yA(e){return null!==e&&(e<32||127===e)}const wA=kA(/\d/),bA=kA(/[\dA-Fa-f]/),EA=kA(/[!-/:-@[-`{-~]/);function PA(e){return null!==e&&e<-2}function BA(e){return null!==e&&(e<0||32===e)}function DA(e){return-2===e||-1===e||32===e}const CA=kA(new RegExp("\\p{P}|\\p{S}","u")),xA=kA(/\s/);function kA(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function SA(e){const t=[];let n=-1,r=0,A=0;for(;++n<e.length;){const o=e.charCodeAt(n);let i="";if(37===o&&mA(e.charCodeAt(n+1))&&mA(e.charCodeAt(n+2)))A=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(i=String.fromCharCode(o));else if(o>55295&&o<57344){const t=e.charCodeAt(n+1);o<56320&&t>56319&&t<57344?(i=String.fromCharCode(o,t),A=1):i="�"}else i=String.fromCharCode(o);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+A+1,i=""),A&&(n+=A,A=0)}return t.join("")+e.slice(r)}function TA(e,t,n,r){const A=r?r-1:Number.POSITIVE_INFINITY;let o=0;return function(r){return DA(r)?(e.enter(n),i(r)):t(r)};function i(r){return DA(r)&&o++<A?(e.consume(r),i):(e.exit(n),t(r))}}const IA={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,function(n){if(null===n)return void e.consume(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),TA(e,t,"linePrefix")},function(t){return e.enter("paragraph"),r(t)});let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,A(t)}function A(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):PA(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),A)}}};const QA={tokenize:function(e){const t=this,n=[];let r,A,o,i=0;return l;function l(r){if(i<n.length){const A=n[i];return t.containerState=A[1],e.attempt(A[0].continuation,a,s)(r)}return s(r)}function a(e){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&v();const n=t.events.length;let A,o=n;for(;o--;)if("exit"===t.events[o][0]&&"chunkFlow"===t.events[o][1].type){A=t.events[o][1].end;break}m(i);let l=n;for(;l<t.events.length;)t.events[l][1].end={...A},l++;return aA(t.events,o+1,0,t.events.slice(n)),t.events.length=l,s(e)}return l(e)}function s(A){if(i===n.length){if(!r)return d(A);if(r.currentConstruct&&r.currentConstruct.concrete)return p(A);t.interrupt=!(!r.currentConstruct||r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(MA,c,u)(A)}function c(e){return r&&v(),m(i),d(e)}function u(e){return t.parser.lazy[t.now().line]=i!==n.length,o=t.now().offset,p(e)}function d(n){return t.containerState={},e.attempt(MA,f,p)(n)}function f(e){return i++,n.push([t.currentConstruct,t.containerState]),d(e)}function p(n){return null===n?(r&&v(),m(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:A}),g(n))}function g(n){return null===n?(h(e.exit("chunkFlow"),!0),m(0),void e.consume(n)):PA(n)?(e.consume(n),h(e.exit("chunkFlow")),i=0,t.interrupt=void 0,l):(e.consume(n),g)}function h(e,n){const l=t.sliceStream(e);if(n&&l.push(null),e.previous=A,A&&(A.next=e),A=e,r.defineSkip(e.start),r.write(l),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<o&&(!r.events[e][1].end||r.events[e][1].end.offset>o))return;const n=t.events.length;let A,l,a=n;for(;a--;)if("exit"===t.events[a][0]&&"chunkFlow"===t.events[a][1].type){if(A){l=t.events[a][1].end;break}A=!0}for(m(i),e=n;e<t.events.length;)t.events[e][1].end={...l},e++;aA(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function m(r){let A=n.length;for(;A-- >r;){const r=n[A];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){r.write([null]),A=void 0,r=void 0,t.containerState._closeFlow=void 0}}},MA={tokenize:function(e,t,n){return TA(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function OA(e){return null===e||BA(e)||xA(e)?1:CA(e)?2:void 0}function LA(e,t,n){const r=[];let A=-1;for(;++A<e.length;){const o=e[A].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const NA={name:"attention",resolveAll:function(e,t){let n,r,A,o,i,l,a,s,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close)for(n=c;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[n][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;l=e[n][1].end.offset-e[n][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;const u={...e[n][1].end},d={...e[c][1].start};HA(u,-l),HA(d,l),o={type:l>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},i={type:l>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:d},A={type:l>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[c][1].start}},r={type:l>1?"strong":"emphasis",start:{...o.start},end:{...i.end}},e[n][1].end={...o.start},e[c][1].start={...i.end},a=[],e[n][1].end.offset-e[n][1].start.offset&&(a=sA(a,[["enter",e[n][1],t],["exit",e[n][1],t]])),a=sA(a,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",A,t]]),a=sA(a,LA(t.parser.constructs.insideSpan.null,e.slice(n+1,c),t)),a=sA(a,[["exit",A,t],["enter",i,t],["exit",i,t],["exit",r,t]]),e[c][1].end.offset-e[c][1].start.offset?(s=2,a=sA(a,[["enter",e[c][1],t],["exit",e[c][1],t]])):s=0,aA(e,n-1,c-n+3,a),c=n+a.length-s-2;break}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,A=OA(r);let o;return function(t){return o=t,e.enter("attentionSequence"),i(t)};function i(l){if(l===o)return e.consume(l),i;const a=e.exit("attentionSequence"),s=OA(l),c=!s||2===s&&A||n.includes(l),u=!A||2===A&&s||n.includes(r);return a._open=!!(42===o?c:c&&(A||!u)),a._close=!!(42===o?u:u&&(s||!c)),t(l)}}};function HA(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const RA={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),A};function A(t){return hA(t)?(e.consume(t),o):64===t?n(t):a(t)}function o(e){return 43===e||45===e||46===e||mA(e)?(r=1,i(e)):a(e)}function i(t){return 58===t?(e.consume(t),r=0,l):(43===t||45===t||46===t||mA(t))&&r++<32?(e.consume(t),i):(r=0,a(t))}function l(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||yA(r)?n(r):(e.consume(r),l)}function a(t){return 64===t?(e.consume(t),s):vA(t)?(e.consume(t),a):n(t)}function s(e){return mA(e)?c(e):n(e)}function c(n){return 46===n?(e.consume(n),r=0,s):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):u(n)}function u(t){if((45===t||mA(t))&&r++<63){const n=45===t?u:c;return e.consume(t),n}return n(t)}}};const FA={partial:!0,tokenize:function(e,t,n){return function(t){return DA(t)?TA(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||PA(e)?t(e):n(e)}}};const UA={continuation:{tokenize:function(e,t,n){const r=this;return function(t){return DA(t)?TA(e,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):A(t)};function A(r){return e.attempt(UA,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),A}return n(t)};function A(n){return DA(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};const jA={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return EA(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const zA={name:"characterReference",tokenize:function(e,t,n){const r=this;let A,o,i=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),l};function l(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),a):(e.enter("characterReferenceValue"),A=31,o=mA,s(t))}function a(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),A=6,o=bA,s):(e.enter("characterReferenceValue"),A=7,o=wA,s(t))}function s(l){if(59===l&&i){const A=e.exit("characterReferenceValue");return o!==mA||lA(r.sliceSerialize(A))?(e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(l)}return o(l)&&i++<A?(e.consume(l),s):n(l)}}};const _A={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A)};function A(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},qA={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const r=this,A={partial:!0,tokenize:function(e,t,n){let A=0;return i;function i(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a}function a(t){return e.enter("codeFencedFence"),DA(t)?TA(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):s(t)}function s(t){return t===o?(e.enter("codeFencedFenceSequence"),c(t)):n(t)}function c(t){return t===o?(A++,e.consume(t),c):A>=l?(e.exit("codeFencedFenceSequence"),DA(t)?TA(e,u,"whitespace")(t):u(t)):n(t)}function u(r){return null===r||PA(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let o,i=0,l=0;return function(t){return function(t){const n=r.events[r.events.length-1];return i=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,o=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),a(t)}(t)};function a(t){return t===o?(l++,e.consume(t),a):l<3?n(t):(e.exit("codeFencedFenceSequence"),DA(t)?TA(e,s,"whitespace")(t):s(t))}function s(n){return null===n||PA(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(_A,f,v)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),c(n))}function c(t){return null===t||PA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),s(t)):DA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),TA(e,u,"whitespace")(t)):96===t&&t===o?n(t):(e.consume(t),c)}function u(t){return null===t||PA(t)?s(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(t))}function d(t){return null===t||PA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),s(t)):96===t&&t===o?n(t):(e.consume(t),d)}function f(t){return e.attempt(A,v,p)(t)}function p(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),g}function g(t){return i>0&&DA(t)?TA(e,h,"linePrefix",i+1)(t):h(t)}function h(t){return null===t||PA(t)?e.check(_A,f,v)(t):(e.enter("codeFlowValue"),m(t))}function m(t){return null===t||PA(t)?(e.exit("codeFlowValue"),h(t)):(e.consume(t),m)}function v(n){return e.exit("codeFenced"),t(n)}}};const GA={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),TA(e,A,"linePrefix",5)(t)};function A(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return null===t?l(t):PA(t)?e.attempt(YA,o,l)(t):(e.enter("codeFlowValue"),i(t))}function i(t){return null===t||PA(t)?(e.exit("codeFlowValue"),o(t)):(e.consume(t),i)}function l(n){return e.exit("codeIndented"),t(n)}}},YA={partial:!0,tokenize:function(e,t,n){const r=this;return A;function A(t){return r.parser.lazy[r.now().line]?n(t):PA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A):TA(e,o,"linePrefix",5)(t)}function o(e){const o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(e):PA(e)?A(e):n(e)}}};const WA={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,A=3;if(!("lineEnding"!==e[A][1].type&&"space"!==e[A][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=A;++t<r;)if("codeTextData"===e[t][1].type){e[A][1].type="codeTextPadding",e[r][1].type="codeTextPadding",A+=2,r-=2;break}for(t=A-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,A,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),i(t)};function i(t){return 96===t?(e.consume(t),o++,i):(e.exit("codeTextSequence"),l(t))}function l(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),l):96===t?(A=e.enter("codeTextSequence"),r=0,s(t)):PA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l):(e.enter("codeTextData"),a(t))}function a(t){return null===t||32===t||96===t||PA(t)?(e.exit("codeTextData"),l(t)):(e.consume(t),a)}function s(n){return 96===n?(e.consume(n),r++,s):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(A.type="codeTextData",a(n))}}};class VA{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const n=t??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const r=t||0;this.setCursor(Math.trunc(e));const A=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&XA(this.left,n),A.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),XA(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),XA(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);XA(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);XA(this.left,t.reverse())}}}function XA(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 KA(e){const t={};let n,r,A,o,i,l,a,s=-1;const c=new VA(e);for(;++s<c.length;){for(;s in t;)s=t[s];if(n=c.get(s),s&&"chunkFlow"===n[1].type&&"listItemPrefix"===c.get(s-1)[1].type&&(l=n[1]._tokenizer.events,A=0,A<l.length&&"lineEndingBlank"===l[A][1].type&&(A+=2),A<l.length&&"content"===l[A][1].type))for(;++A<l.length&&"content"!==l[A][1].type;)"chunkText"===l[A][1].type&&(l[A][1]._isInFirstContentOfListItem=!0,A++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,JA(c,s)),s=t[s],a=!0);else if(n[1]._container){for(A=s,r=void 0;A--;)if(o=c.get(A),"lineEnding"===o[1].type||"lineEndingBlank"===o[1].type)"enter"===o[0]&&(r&&(c.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=A);else if("linePrefix"!==o[1].type)break;r&&(n[1].end={...c.get(r)[1].start},i=c.slice(r,s),i.unshift(n),c.splice(r,s-r+1,i))}}return aA(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!a}function JA(e,t){const n=e.get(t)[1],r=e.get(t)[2];let A=t-1;const o=[],i=n._tokenizer||r.parser[n.contentType](n.start),l=i.events,a=[],s={};let c,u,d=-1,f=n,p=0,g=0;const h=[g];for(;f;){for(;e.get(++A)[1]!==f;);o.push(A),f._tokenizer||(c=r.sliceStream(f),f.next||c.push(null),u&&i.defineSkip(f.start),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(c),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),u=f,f=f.next}for(f=n;++d<l.length;)"exit"===l[d][0]&&"enter"===l[d-1][0]&&l[d][1].type===l[d-1][1].type&&l[d][1].start.line!==l[d][1].end.line&&(g=d+1,h.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(i.events=[],f?(f._tokenizer=void 0,f.previous=void 0):h.pop(),d=h.length;d--;){const t=l.slice(h[d],h[d+1]),n=o.pop();a.push([n,n+t.length-1]),e.splice(n,2,t)}for(a.reverse(),d=-1;++d<a.length;)s[p+a[d][0]]=p+a[d][1],p+=a[d][1]-a[d][0]-1;return s}const ZA={resolve:function(e){return KA(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?A(t):PA(t)?e.check($A,o,A)(t):(e.consume(t),r)}function A(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function o(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},$A={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),TA(e,A,"linePrefix")};function A(A){if(null===A||PA(A))return n(A);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(A):e.interrupt(r.parser.constructs.flow,n,t)(A)}}};function eo(e,t,n,r,A,o,i,l,a){const s=a||Number.POSITIVE_INFINITY;let c=0;return function(t){return 60===t?(e.enter(r),e.enter(A),e.enter(o),e.consume(t),e.exit(o),u):null===t||32===t||41===t||yA(t)?n(t):(e.enter(r),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),p(t))};function u(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(A),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),d(n))}function d(t){return 62===t?(e.exit("chunkString"),e.exit(l),u(t)):null===t||60===t||PA(t)?n(t):(e.consume(t),92===t?f:d)}function f(t){return 60===t||62===t||92===t?(e.consume(t),d):d(t)}function p(A){return c||null!==A&&41!==A&&!BA(A)?c<s&&40===A?(e.consume(A),c++,p):41===A?(e.consume(A),c--,p):null===A||32===A||40===A||yA(A)?n(A):(e.consume(A),92===A?g:p):(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(r),t(A))}function g(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function to(e,t,n,r,A,o){const i=this;let l,a=0;return function(t){return e.enter(r),e.enter(A),e.consume(t),e.exit(A),e.enter(o),s};function s(u){return a>999||null===u||91===u||93===u&&!l||94===u&&!a&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):93===u?(e.exit(o),e.enter(A),e.consume(u),e.exit(A),e.exit(r),t):PA(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):(e.enter("chunkString",{contentType:"string"}),c(u))}function c(t){return null===t||91===t||93===t||PA(t)||a++>999?(e.exit("chunkString"),s(t)):(e.consume(t),l||(l=!DA(t)),92===t?u:c)}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}}function no(e,t,n,r,A,o){let i;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(A),e.consume(t),e.exit(A),i=40===t?41:t,l):n(t)};function l(n){return n===i?(e.enter(A),e.consume(n),e.exit(A),e.exit(r),t):(e.enter(o),a(n))}function a(t){return t===i?(e.exit(o),l(i)):null===t?n(t):PA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),TA(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),s(t))}function s(t){return t===i||null===t||PA(t)?(e.exit("chunkString"),a(t)):(e.consume(t),92===t?c:s)}function c(t){return t===i||92===t?(e.consume(t),s):s(t)}}function ro(e,t){let n;return function r(A){return PA(A)?(e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),n=!0,r):DA(A)?TA(e,r,n?"linePrefix":"lineSuffix")(A):t(A)}}const Ao={name:"definition",tokenize:function(e,t,n){const r=this;let A;return function(t){return e.enter("definition"),function(t){return to.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function o(t){return A=gA(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),i):n(t)}function i(t){return BA(t)?ro(e,l)(t):l(t)}function l(t){return eo(e,a,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function a(t){return e.attempt(oo,s,s)(t)}function s(t){return DA(t)?TA(e,c,"whitespace")(t):c(t)}function c(o){return null===o||PA(o)?(e.exit("definition"),r.parser.defined.push(A),t(o)):n(o)}}},oo={partial:!0,tokenize:function(e,t,n){return function(t){return BA(t)?ro(e,r)(t):n(t)};function r(t){return no(e,A,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function A(t){return DA(t)?TA(e,o,"whitespace")(t):o(t)}function o(e){return null===e||PA(e)?t(e):n(e)}}};const io={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return PA(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};const lo={name:"headingAtx",resolve:function(e,t){let n,r,A=e.length-2,o=3;return"whitespace"===e[o][1].type&&(o+=2),A-2>o&&"whitespace"===e[A][1].type&&(A-=2),"atxHeadingSequence"===e[A][1].type&&(o===A-1||A-4>o&&"whitespace"===e[A-2][1].type)&&(A-=o+1===A?2:4),A>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[A][1].end},r={type:"chunkText",start:e[o][1].start,end:e[A][1].end,contentType:"text"},aA(e,o,A-o+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),A(t)}(t)};function A(t){return 35===t&&r++<6?(e.consume(t),A):null===t||BA(t)?(e.exit("atxHeadingSequence"),o(t)):n(t)}function o(n){return 35===n?(e.enter("atxHeadingSequence"),i(n)):null===n||PA(n)?(e.exit("atxHeading"),t(n)):DA(n)?TA(e,o,"whitespace")(n):(e.enter("atxHeadingText"),l(n))}function i(t){return 35===t?(e.consume(t),i):(e.exit("atxHeadingSequence"),o(t))}function l(t){return null===t||35===t||BA(t)?(e.exit("atxHeadingText"),o(t)):(e.consume(t),l)}}};const ao=["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"],so=["pre","script","style","textarea"],co={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(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},tokenize:function(e,t,n){const r=this;let A,o,i,l,a;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),s}(t)};function s(l){return 33===l?(e.consume(l),c):47===l?(e.consume(l),o=!0,f):63===l?(e.consume(l),A=3,r.interrupt?t:O):hA(l)?(e.consume(l),i=String.fromCharCode(l),p):n(l)}function c(o){return 45===o?(e.consume(o),A=2,u):91===o?(e.consume(o),A=5,l=0,d):hA(o)?(e.consume(o),A=4,r.interrupt?t:O):n(o)}function u(A){return 45===A?(e.consume(A),r.interrupt?t:O):n(A)}function d(A){const o="CDATA[";return A===o.charCodeAt(l++)?(e.consume(A),6===l?r.interrupt?t:C:d):n(A)}function f(t){return hA(t)?(e.consume(t),i=String.fromCharCode(t),p):n(t)}function p(l){if(null===l||47===l||62===l||BA(l)){const a=47===l,s=i.toLowerCase();return a||o||!so.includes(s)?ao.includes(i.toLowerCase())?(A=6,a?(e.consume(l),g):r.interrupt?t(l):C(l)):(A=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(l):o?h(l):m(l)):(A=1,r.interrupt?t(l):C(l))}return 45===l||mA(l)?(e.consume(l),i+=String.fromCharCode(l),p):n(l)}function g(A){return 62===A?(e.consume(A),r.interrupt?t:C):n(A)}function h(t){return DA(t)?(e.consume(t),h):B(t)}function m(t){return 47===t?(e.consume(t),B):58===t||95===t||hA(t)?(e.consume(t),v):DA(t)?(e.consume(t),m):B(t)}function v(t){return 45===t||46===t||58===t||95===t||mA(t)?(e.consume(t),v):y(t)}function y(t){return 61===t?(e.consume(t),w):DA(t)?(e.consume(t),y):m(t)}function w(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,b):DA(t)?(e.consume(t),w):E(t)}function b(t){return t===a?(e.consume(t),a=null,P):null===t||PA(t)?n(t):(e.consume(t),b)}function E(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||BA(t)?y(t):(e.consume(t),E)}function P(e){return 47===e||62===e||DA(e)?m(e):n(e)}function B(t){return 62===t?(e.consume(t),D):n(t)}function D(t){return null===t||PA(t)?C(t):DA(t)?(e.consume(t),D):n(t)}function C(t){return 45===t&&2===A?(e.consume(t),T):60===t&&1===A?(e.consume(t),I):62===t&&4===A?(e.consume(t),L):63===t&&3===A?(e.consume(t),O):93===t&&5===A?(e.consume(t),M):!PA(t)||6!==A&&7!==A?null===t||PA(t)?(e.exit("htmlFlowData"),x(t)):(e.consume(t),C):(e.exit("htmlFlowData"),e.check(uo,N,x)(t))}function x(t){return e.check(fo,k,N)(t)}function k(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||PA(t)?x(t):(e.enter("htmlFlowData"),C(t))}function T(t){return 45===t?(e.consume(t),O):C(t)}function I(t){return 47===t?(e.consume(t),i="",Q):C(t)}function Q(t){if(62===t){const n=i.toLowerCase();return so.includes(n)?(e.consume(t),L):C(t)}return hA(t)&&i.length<8?(e.consume(t),i+=String.fromCharCode(t),Q):C(t)}function M(t){return 93===t?(e.consume(t),O):C(t)}function O(t){return 62===t?(e.consume(t),L):45===t&&2===A?(e.consume(t),O):C(t)}function L(t){return null===t||PA(t)?(e.exit("htmlFlowData"),N(t)):(e.consume(t),L)}function N(n){return e.exit("htmlFlow"),t(n)}}},uo={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(FA,t,n)}}},fo={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return PA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A):n(t)};function A(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}};const po={name:"htmlText",tokenize:function(e,t,n){const r=this;let A,o,i;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),l};function l(t){return 33===t?(e.consume(t),a):47===t?(e.consume(t),w):63===t?(e.consume(t),v):hA(t)?(e.consume(t),P):n(t)}function a(t){return 45===t?(e.consume(t),s):91===t?(e.consume(t),o=0,f):hA(t)?(e.consume(t),m):n(t)}function s(t){return 45===t?(e.consume(t),d):n(t)}function c(t){return null===t?n(t):45===t?(e.consume(t),u):PA(t)?(i=c,Q(t)):(e.consume(t),c)}function u(t){return 45===t?(e.consume(t),d):c(t)}function d(e){return 62===e?I(e):45===e?u(e):c(e)}function f(t){const r="CDATA[";return t===r.charCodeAt(o++)?(e.consume(t),6===o?p:f):n(t)}function p(t){return null===t?n(t):93===t?(e.consume(t),g):PA(t)?(i=p,Q(t)):(e.consume(t),p)}function g(t){return 93===t?(e.consume(t),h):p(t)}function h(t){return 62===t?I(t):93===t?(e.consume(t),h):p(t)}function m(t){return null===t||62===t?I(t):PA(t)?(i=m,Q(t)):(e.consume(t),m)}function v(t){return null===t?n(t):63===t?(e.consume(t),y):PA(t)?(i=v,Q(t)):(e.consume(t),v)}function y(e){return 62===e?I(e):v(e)}function w(t){return hA(t)?(e.consume(t),b):n(t)}function b(t){return 45===t||mA(t)?(e.consume(t),b):E(t)}function E(t){return PA(t)?(i=E,Q(t)):DA(t)?(e.consume(t),E):I(t)}function P(t){return 45===t||mA(t)?(e.consume(t),P):47===t||62===t||BA(t)?B(t):n(t)}function B(t){return 47===t?(e.consume(t),I):58===t||95===t||hA(t)?(e.consume(t),D):PA(t)?(i=B,Q(t)):DA(t)?(e.consume(t),B):I(t)}function D(t){return 45===t||46===t||58===t||95===t||mA(t)?(e.consume(t),D):C(t)}function C(t){return 61===t?(e.consume(t),x):PA(t)?(i=C,Q(t)):DA(t)?(e.consume(t),C):B(t)}function x(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),A=t,k):PA(t)?(i=x,Q(t)):DA(t)?(e.consume(t),x):(e.consume(t),S)}function k(t){return t===A?(e.consume(t),A=void 0,T):null===t?n(t):PA(t)?(i=k,Q(t)):(e.consume(t),k)}function S(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||BA(t)?B(t):(e.consume(t),S)}function T(e){return 47===e||62===e||BA(e)?B(e):n(e)}function I(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function Q(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),M}function M(t){return DA(t)?TA(e,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):O(t)}function O(t){return e.enter("htmlTextData"),i(t)}}};const go={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){const e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&aA(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,A,o,i=e.length,l=0;for(;i--;)if(n=e[i][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[i][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(A){if("enter"===e[i][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=i,"labelLink"!==n.type)){l=2;break}}else"labelEnd"===n.type&&(A=i);const a={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},s={type:"label",start:{...e[r][1].start},end:{...e[A][1].end}},c={type:"labelText",start:{...e[r+l+2][1].end},end:{...e[A-2][1].start}};return o=[["enter",a,t],["enter",s,t]],o=sA(o,e.slice(r+1,r+l+3)),o=sA(o,[["enter",c,t]]),o=sA(o,LA(t.parser.constructs.insideSpan.null,e.slice(r+l+4,A-3),t)),o=sA(o,[["exit",c,t],e[A-2],e[A-1],["exit",s,t]]),o=sA(o,e.slice(A+1)),o=sA(o,[["exit",a,t]]),aA(e,r,e.length,o),e},tokenize:function(e,t,n){const r=this;let A,o,i=r.events.length;for(;i--;)if(("labelImage"===r.events[i][1].type||"labelLink"===r.events[i][1].type)&&!r.events[i][1]._balanced){A=r.events[i][1];break}return function(t){return A?A._inactive?c(t):(o=r.parser.defined.includes(gA(r.sliceSerialize({start:A.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),l):n(t)};function l(t){return 40===t?e.attempt(ho,s,o?s:c)(t):91===t?e.attempt(mo,s,o?a:c)(t):o?s(t):c(t)}function a(t){return e.attempt(vo,s,c)(t)}function s(e){return t(e)}function c(e){return A._balanced=!0,n(e)}}},ho={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return BA(t)?ro(e,A)(t):A(t)}function A(t){return 41===t?s(t):eo(e,o,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return BA(t)?ro(e,l)(t):s(t)}function i(e){return n(e)}function l(t){return 34===t||39===t||40===t?no(e,a,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):s(t)}function a(t){return BA(t)?ro(e,s)(t):s(t)}function s(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},mo={tokenize:function(e,t,n){const r=this;return function(t){return to.call(r,e,A,o,"reference","referenceMarker","referenceString")(t)};function A(e){return r.parser.defined.includes(gA(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},vo={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}};const yo={name:"labelStartImage",resolveAll:go.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),A};function A(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):n(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const wo={name:"labelStartLink",resolveAll:go.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),A};function A(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const bo={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),TA(e,t,"linePrefix")}}};const Eo={name:"thematicBreak",tokenize:function(e,t,n){let r,A=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,o(e)}(t)};function o(o){return o===r?(e.enter("thematicBreakSequence"),i(o)):A>=3&&(null===o||PA(o))?(e.exit("thematicBreak"),t(o)):n(o)}function i(t){return t===r?(e.consume(t),A++,i):(e.exit("thematicBreakSequence"),DA(t)?TA(e,o,"whitespace")(t):o(t))}}};const Po={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(FA,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,TA(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!DA(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,A(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Do,t,A)(n))});function A(A){return r.containerState._closeFlow=!0,r.interrupt=void 0,TA(e,e.attempt(Po,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const r=this,A=r.events[r.events.length-1];let o=A&&"linePrefix"===A[1].type?A[2].sliceSerialize(A[1],!0).length:0,i=0;return function(t){const A=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===A?!r.containerState.marker||t===r.containerState.marker:wA(t)){if(r.containerState.type||(r.containerState.type=A,e.enter(A,{_container:!0})),"listUnordered"===A)return e.enter("listItemPrefix"),42===t||45===t?e.check(Eo,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(t)}return n(t)};function l(t){return wA(t)&&++i<10?(e.consume(t),l):(!r.interrupt||i<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),a(t)):n(t)}function a(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(FA,r.interrupt?n:s,e.attempt(Bo,u,c))}function s(e){return r.containerState.initialBlankLine=!0,o++,u(e)}function c(t){return DA(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},Bo={partial:!0,tokenize:function(e,t,n){const r=this;return TA(e,function(e){const A=r.events[r.events.length-1];return!DA(e)&&A&&"listItemPrefixWhitespace"===A[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},Do={partial:!0,tokenize:function(e,t,n){const r=this;return TA(e,function(e){const A=r.events[r.events.length-1];return A&&"listItemIndent"===A[1].type&&A[2].sliceSerialize(A[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}};const Co={name:"setextUnderline",resolveTo:function(e,t){let n,r,A,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),!A&&"definition"===e[o][1].type&&(A=o);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",A?(e.splice(r,0,["enter",i,t]),e.splice(A+1,0,["exit",e[n][1],t]),e[n][1].end={...e[A][1].end}):e[n][1]=i,e.push(["exit",i,t]),e},tokenize:function(e,t,n){const r=this;let A;return function(t){let i,l=r.events.length;for(;l--;)if("lineEnding"!==r.events[l][1].type&&"linePrefix"!==r.events[l][1].type&&"content"!==r.events[l][1].type){i="paragraph"===r.events[l][1].type;break}return r.parser.lazy[r.now().line]||!r.interrupt&&!i?n(t):(e.enter("setextHeadingLine"),A=t,function(t){return e.enter("setextHeadingLineSequence"),o(t)}(t))};function o(t){return t===A?(e.consume(t),o):(e.exit("setextHeadingLineSequence"),DA(t)?TA(e,i,"lineSuffix")(t):i(t))}function i(r){return null===r||PA(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};const xo={tokenize:function(e){const t=this,n=e.attempt(FA,function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,TA(e,e.attempt(this.parser.constructs.flow,r,e.attempt(ZA,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}};const ko={resolveAll:Qo()},So=Io("string"),To=Io("text");function Io(e){return{resolveAll:Qo("text"===e?Mo:void 0),tokenize:function(t){const n=this,r=this.parser.constructs[e],A=t.attempt(r,o,i);return o;function o(e){return a(e)?A(e):i(e)}function i(e){if(null!==e)return t.enter("data"),t.consume(e),l;t.consume(e)}function l(e){return a(e)?(t.exit("data"),A(e)):(t.consume(e),l)}function a(e){if(null===e)return!0;const t=r[e];let A=-1;if(t)for(;++A<t.length;){const e=t[A];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function Qo(e){return function(t,n){let r,A=-1;for(;++A<=t.length;)void 0===r?t[A]&&"data"===t[A][1].type&&(r=A,A++):(!t[A]||"data"!==t[A][1].type)&&(A!==r+2&&(t[r][1].end=t[A-1][1].end,t.splice(r+2,A-r-2),A=r+2),r=void 0);return e?e(t,n):t}}function Mo(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],A=t.sliceStream(r);let o,i=A.length,l=-1,a=0;for(;i--;){const e=A[i];if("string"==typeof e){for(l=e.length;32===e.charCodeAt(l-1);)a++,l--;if(l)break;l=-1}else if(-2===e)o=!0,a++;else if(-1!==e){i++;break}}if(a){const A={type:n===e.length||o||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?l:r.start._bufferIndex+l,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...A.start},r.start.offset===r.end.offset?Object.assign(r,A):(e.splice(n,0,["enter",A,t],["exit",A,t]),n+=2)}n++}return e}const Oo={42:Po,43:Po,45:Po,48:Po,49:Po,50:Po,51:Po,52:Po,53:Po,54:Po,55:Po,56:Po,57:Po,62:UA},Lo={91:Ao},No={[-2]:GA,[-1]:GA,32:GA},Ho={35:lo,42:Eo,45:[Co,Eo],60:co,61:Co,95:Eo,96:qA,126:qA},Ro={38:zA,92:jA},Fo={[-5]:bo,[-4]:bo,[-3]:bo,33:yo,38:zA,42:NA,60:[RA,po],91:wo,92:[io,jA],93:go,95:NA,96:WA},Uo={null:[NA,ko]},jo=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:Lo,disable:{null:[]},document:Oo,flow:Ho,flowInitial:No,insideSpan:Uo,string:Ro,text:Fo},Symbol.toStringTag,{value:"Module"}));function zo(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 A={},o=[];let i=[],l=[];const a={attempt:g(function(e,t){h(e,t.from)}),check:g(p),consume:function(e){PA(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,m()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),s.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=d(),s.events.push(["enter",n,s]),l.push(n),n},exit:function(e){const t=l.pop();return t.end=d(),s.events.push(["exit",t,s]),t},interrupt:g(p,{interrupt:!0})},s={code:null,containerState:{},defineSkip:function(e){A[e.line]=e.column,m()},events:[],now:d,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let A;for(;++n<e.length;){const o=e[n];let i;if("string"==typeof o)i=o;else switch(o){case-5:i="\r";break;case-4:i="\n";break;case-3:i="\r\n";break;case-2:i=t?" ":"\t";break;case-1:if(!t&&A)continue;i=" ";break;default:i=String.fromCharCode(o)}A=-2===o,r.push(i)}return r.join("")}(u(e),t)},sliceStream:u,write:function(e){return i=sA(i,e),function(){let e;for(;r._index<i.length;){const t=i[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)f(t.charCodeAt(r._bufferIndex));else f(t)}}(),null!==i[i.length-1]?[]:(h(t,0),s.events=LA(o,s.events,s),s.events)}};let c=t.tokenize.call(s,a);return t.resolveAll&&o.push(t),s;function u(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,A=t.end._index,o=t.end._bufferIndex;let i;if(n===A)i=[e[n].slice(r,o)];else{if(i=e.slice(n,A),r>-1){const e=i[0];"string"==typeof e?i[0]=e.slice(r):i.shift()}o>0&&i.push(e[A].slice(0,o))}return i}(i,e)}function d(){const{_bufferIndex:e,_index:t,line:n,column:A,offset:o}=r;return{_bufferIndex:e,_index:t,line:n,column:A,offset:o}}function f(e){c=c(e)}function p(e,t){t.restore()}function g(e,t){return function(n,A,o){let i,c,u,f;return Array.isArray(n)?p(n):"tokenize"in n?p([n]):function(e){return t;function t(t){const n=null!==t&&e[t],r=null!==t&&e.null;return p([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function p(e){return i=e,c=0,0===e.length?o:g(e[c])}function g(e){return function(n){return f=function(){const e=d(),t=s.previous,n=s.currentConstruct,A=s.events.length,o=Array.from(l);return{from:A,restore:i};function i(){r=e,s.previous=t,s.currentConstruct=n,s.events.length=A,l=o,m()}}(),u=e,e.partial||(s.currentConstruct=e),e.name&&s.parser.constructs.disable.null.includes(e.name)?v():e.tokenize.call(t?Object.assign(Object.create(s),t):s,a,h,v)(n)}}function h(t){return e(u,f),A}function v(e){return f.restore(),++c<i.length?g(i[c]):o}}}function h(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&aA(s.events,t,s.events.length-t,e.resolve(s.events.slice(t),s)),e.resolveTo&&(s.events=e.resolveTo(s.events,s))}function m(){r.line in A&&r.column<2&&(r.column=A[r.line],r.offset+=A[r.line]-1)}}const _o=/[\0\t\n\r]/g;const qo=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Go(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return pA(n.slice(t?2:1),t?16:10)}return lA(n)||e}const Yo={}.hasOwnProperty;function Wo(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(te),autolinkProtocol:D,autolinkEmail:D,atxHeading:o(J),blockQuote:o(Y),characterEscape:D,characterReference:D,codeFenced:o(W),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:o(W,i),codeText:o(V,i),codeTextData:D,data:D,codeFlowValue:D,definition:o(X),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:o(K),hardBreakEscape:o(Z),hardBreakTrailing:o(Z),htmlFlow:o($,i),htmlFlowData:D,htmlText:o($,i),htmlTextData:D,image:o(ee),label:i,link:o(te),listItem:o(re),listItemValue:d,listOrdered:o(ne,u),listUnordered:o(ne),paragraph:o(Ae),reference:F,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:o(J),strong:o(oe),thematicBreak:o(le)},exit:{atxHeading:a(),atxHeadingSequence:b,autolink:a(),autolinkEmail:G,autolinkProtocol:q,blockQuote:a(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:j,characterReferenceMarkerNumeric:j,characterReferenceValue:z,characterReference:_,codeFenced:a(h),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:p,codeFlowValue:C,codeIndented:a(m),codeText:a(I),codeTextData:C,data:C,definition:a(),definitionDestinationString:w,definitionLabelString:v,definitionTitleString:y,emphasis:a(),hardBreakEscape:a(k),hardBreakTrailing:a(k),htmlFlow:a(S),htmlFlowData:C,htmlText:a(T),htmlTextData:C,image:a(M),label:L,labelText:O,lineEnding:x,link:a(Q),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:U,resourceDestinationString:N,resourceTitleString:H,resource:R,setextHeading:a(B),setextHeadingLineSequence:P,setextHeadingText:E,strong:a(),thematicBreak:a()}};Xo(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const o={stack:[r],tokenStack:[],config:t,enter:l,exit:s,buffer:i,resume:c,data:n},a=[];let u=-1;for(;++u<e.length;)if("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)if("enter"===e[u][0])a.push(u);else{u=A(e,a.pop(),u)}for(u=-1;++u<e.length;){const n=t[e[u][0]];Yo.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},o),e[u][1])}if(o.tokenStack.length>0){const e=o.tokenStack[o.tokenStack.length-1];(e[1]||Jo).call(o,void 0,e[0])}for(r.position={start:Vo(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Vo(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)r=t.transforms[u](r)||r;return r}function A(e,t,n){let r,A,o,i,l=t-1,a=-1,s=!1;for(;++l<=n;){const t=e[l];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?a++:a--,i=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(r&&!i&&!a&&!o&&(o=l),i=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:i=void 0}if(!a&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===a&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let i=l;for(A=void 0;i--;){const t=e[i];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;A&&(e[A][1].type="lineEndingBlank",s=!0),t[1].type="lineEnding",A=i}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}o&&(!A||o<A)&&(r._spread=!0),r.end=Object.assign({},A?e[A][1].start:t[1].end),e.splice(A||l,0,["exit",r,t[2]]),l++,n++}if("listItemPrefix"===t[1].type){const A={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=A,e.splice(l,0,["enter",A,t[2]]),l++,n++,o=void 0,i=!0}}}return e[t][1]._spread=s,n}function o(e,t){return n;function n(n){l.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function l(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Vo(t.start),end:void 0}}function a(e){return t;function t(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+Mr({start:e.start,end:e.end})+"): it’s not open");r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Jo).call(this,e,r[0])),n.position.end=Vo(e.end)}function c(){return function(e){return AA(e,"boolean"!=typeof rA.includeImageAlt||rA.includeImageAlt,"boolean"!=typeof rA.includeHtml||rA.includeHtml)}(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function d(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function f(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function p(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function h(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function m(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function v(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gA(this.sliceSerialize(e)).toLowerCase()}function y(){const e=this.resume();this.stack[this.stack.length-1].title=e}function w(){const e=this.resume();this.stack[this.stack.length-1].url=e}function b(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function P(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function D(e){const t=this.stack[this.stack.length-1].children;let n=t[t.length-1];(!n||"text"!==n.type)&&(n=ie(),n.position={start:Vo(e.start),end:void 0},t.push(n)),this.stack.push(n)}function C(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Vo(e.end)}function x(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=Vo(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(D.call(this,e),C.call(this,e))}function k(){this.data.atHardBreak=!0}function S(){const e=this.resume();this.stack[this.stack.length-1].value=e}function T(){const e=this.resume();this.stack[this.stack.length-1].value=e}function I(){const e=this.resume();this.stack[this.stack.length-1].value=e}function Q(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function M(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function O(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=function(e){return e.replace(qo,Go)}(t),n.identifier=gA(t).toLowerCase()}function L(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){const t=e.children;n.children=t}else n.alt=t}function N(){const e=this.resume();this.stack[this.stack.length-1].url=e}function H(){const e=this.resume();this.stack[this.stack.length-1].title=e}function R(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function U(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gA(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function j(e){this.data.characterReferenceType=e.type}function z(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;n?(r=pA(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):r=lA(t);this.stack[this.stack.length-1].value+=r}function _(e){this.stack.pop().position.end=Vo(e.end)}function q(e){C.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function G(e){C.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function Y(){return{type:"blockquote",children:[]}}function W(){return{type:"code",lang:null,meta:null,value:""}}function V(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function K(){return{type:"emphasis",children:[]}}function J(){return{type:"heading",depth:0,children:[]}}function Z(){return{type:"break"}}function $(){return{type:"html",value:""}}function ee(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function ne(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function re(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function Ae(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function ie(){return{type:"text",value:""}}function le(){return{type:"thematicBreak"}}}(n)(function(e){for(;!KA(e););return e}(function(e){const t={constructs:uA([jo,...(e||{}).extensions||[]]),content:n(IA),defined:[],document:n(QA),flow:n(xo),lazy:{},string:n(So),text:n(To)};return t;function n(e){return function(n){return zo(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(A,o,i){const l=[];let a,s,c,u,d;for(A=n+("string"==typeof A?A.toString():new TextDecoder(o||void 0).decode(A)),c=0,n="",r&&(65279===A.charCodeAt(0)&&c++,r=void 0);c<A.length;){if(_o.lastIndex=c,a=_o.exec(A),u=a&&void 0!==a.index?a.index:A.length,d=A.charCodeAt(u),!a){n=A.slice(c);break}if(10===d&&c===u&&e)l.push(-3),e=void 0;else switch(e&&(l.push(-5),e=void 0),c<u&&(l.push(A.slice(c,u)),t+=u-c),d){case 0:l.push(65533),t++;break;case 9:for(s=4*Math.ceil(t/4),l.push(-2);t++<s;)l.push(-1);break;case 10:l.push(-4),t=1;break;default:e=!0,t=1}c=u+1}return i&&(e&&l.push(-5),n&&l.push(n),l.push(null)),l}}()(e,t,!0))))}function Vo(e){return{line:e.line,column:e.column,offset:e.offset}}function Xo(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Xo(e,r):Ko(e,r)}}function Ko(e,t){let n;for(n in t)if(Yo.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 Jo(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Mr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Mr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Mr({start:t.start,end:t.end})+") is still open")}function Zo(e){const t=this;t.parser=function(n){return Wo(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function $o(e,t){const n=t.referenceType;let r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];const A=e.all(t),o=A[0];o&&"text"===o.type?o.value="["+o.value:A.unshift({type:"text",value:"["});const i=A[A.length-1];return i&&"text"===i.type?i.value+=r:A.push({type:"text",value:r}),A}function ei(e){return e.spread??e.children.length>1}function ti(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),A=0;const o=[];for(;r;)o.push(ni(t.slice(A,r.index),A>0,!0),r[0]),A=r.index+r[0].length,r=n.exec(t);return o.push(ni(t.slice(A),A>0,!1)),o.join("")}function ni(e,t,n){let r=0,A=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(A-1);for(;9===t||32===t;)A--,t=e.codePointAt(A-1)}return A>r?e.slice(r,A):""}const ri={blockquote:function(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)},break:function(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){const n=t.value?t.value+"\n":"",r={};t.lang&&(r.className=["language-"+t.lang]);let A={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(A.data={meta:t.meta}),e.patch(t,A),A=e.applyData(t,A),A={type:"element",tagName:"pre",properties:{},children:[A]},e.patch(t,A),A},delete:function(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){const n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),A=SA(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let i,l=e.footnoteCounts.get(r);void 0===l?(l=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=o+1,l+=1,e.footnoteCounts.set(r,l);const a={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+A,id:n+"fnref-"+A+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,a);const s={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,s),e.applyData(t,s)},heading:function(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return $o(e,t);const A={src:SA(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(A.title=r.title);const o={type:"element",tagName:"img",properties:A,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){const n={src:SA(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(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)},linkReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return $o(e,t);const A={href:SA(r.url||"")};null!==r.title&&void 0!==r.title&&(A.title=r.title);const o={type:"element",tagName:"a",properties:A,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){const n={href:SA(t.url)};null!==t.title&&void 0!==t.title&&(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)},listItem:function(e,t,n){const r=e.all(t),A=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=ei(n[r])}return t}(n):ei(t),o={},i=[];if("boolean"==typeof t.checked){const e=r[0];let n;e&&"element"===e.type&&"p"===e.tagName?n=e:(n={type:"element",tagName:"p",properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const e=r[l];(A||0!==l||"element"!==e.type||"p"!==e.tagName)&&i.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||A?i.push(e):i.push(...e.children)}const a=r[r.length-1];a&&(A||"element"!==a.type||"p"!==a.tagName)&&i.push({type:"text",value:"\n"});const s={type:"element",tagName:"li",properties:o,children:i};return e.patch(t,s),e.applyData(t,s)},list:function(e,t){const n={},r=e.all(t);let A=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++A<r.length;){const e=r[A];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)},paragraph:function(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){const n=e.all(t),r=n.shift(),A=[];if(r){const n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),A.push(n)}if(n.length>0){const r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Ir(t.children[1]),i=Tr(t.children[t.children.length-1]);o&&i&&(r.position={start:o,end:i}),A.push(r)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(A,!0)};return e.patch(t,o),e.applyData(t,o)},tableCell:function(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){const r=n?n.children:void 0,A=0===(r?r.indexOf(t):1)?"th":"td",o=n&&"table"===n.type?n.align:void 0,i=o?o.length:t.children.length;let l=-1;const a=[];for(;++l<i;){const n=t.children[l],r={},i=o?o[l]:void 0;i&&(r.align=i);let s={type:"element",tagName:A,properties:r,children:[]};n&&(s.children=e.all(n),e.patch(n,s),s=e.applyData(n,s)),a.push(s)}const s={type:"element",tagName:"tr",properties:{},children:e.wrap(a,!0)};return e.patch(t,s),e.applyData(t,s)},text:function(e,t){const n={type:"text",value:ti(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:Ai,yaml:Ai,definition:Ai,footnoteDefinition:Ai};function Ai(){}const oi="object"==typeof self?self:globalThis,ii=e=>((e,t)=>{const n=(t,n)=>(e.set(n,t),t),r=A=>{if(e.has(A))return e.get(A);const[o,i]=t[A];switch(o){case 0:case-1:return n(i,A);case 1:{const e=n([],A);for(const t of i)e.push(r(t));return e}case 2:{const e=n({},A);for(const[t,n]of i)e[r(t)]=r(n);return e}case 3:return n(new Date(i),A);case 4:{const{source:e,flags:t}=i;return n(new RegExp(e,t),A)}case 5:{const e=n(new Map,A);for(const[t,n]of i)e.set(r(t),r(n));return e}case 6:{const e=n(new Set,A);for(const t of i)e.add(r(t));return e}case 7:{const{name:e,message:t}=i;return n(new oi[e](t),A)}case 8:return n(BigInt(i),A);case"BigInt":return n(Object(BigInt(i)),A);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:e}=new Uint8Array(i);return n(new DataView(e),i)}}return n(new oi[o](i),A)};return r})(new Map,e)(0),li="",{toString:ai}={},{keys:si}=Object,ci=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=ai.call(e).slice(8,-1);switch(n){case"Array":return[1,li];case"Object":return[2,li];case"Date":return[3,li];case"RegExp":return[4,li];case"Map":return[5,li];case"Set":return[6,li];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},ui=([e,t])=>0===e&&("function"===t||"symbol"===t),di=(e,{json:t,lossy:n}={})=>{const r=[];return((e,t,n,r)=>{const A=(e,t)=>{const A=r.push(e)-1;return n.set(t,A),A},o=r=>{if(n.has(r))return n.get(r);let[i,l]=ci(r);switch(i){case 0:{let t=r;switch(l){case"bigint":i=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);t=null;break;case"undefined":return A([-1],r)}return A([i,t],r)}case 1:{if(l){let e=r;return"DataView"===l?e=new Uint8Array(r.buffer):"ArrayBuffer"===l&&(e=new Uint8Array(r)),A([l,[...e]],r)}const e=[],t=A([i,e],r);for(const t of r)e.push(o(t));return t}case 2:{if(l)switch(l){case"BigInt":return A([l,r.toString()],r);case"Boolean":case"Number":case"String":return A([l,r.valueOf()],r)}if(t&&"toJSON"in r)return o(r.toJSON());const n=[],a=A([i,n],r);for(const t of si(r))(e||!ui(ci(r[t])))&&n.push([o(t),o(r[t])]);return a}case 3:return A([i,r.toISOString()],r);case 4:{const{source:e,flags:t}=r;return A([i,{source:e,flags:t}],r)}case 5:{const t=[],n=A([i,t],r);for(const[n,A]of r)(e||!ui(ci(n))&&!ui(ci(A)))&&t.push([o(n),o(A)]);return n}case 6:{const t=[],n=A([i,t],r);for(const n of r)(e||!ui(ci(n)))&&t.push(o(n));return n}}const{message:a}=r;return A([i,{name:l,message:a}],r)};return o})(!(t||n),!!t,new Map,r)(e),r},fi="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?ii(di(e,t)):structuredClone(e):(e,t)=>ii(di(e,t));function pi(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 gi(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const hi=function(e){if(null==e)return vi;if("function"==typeof e)return mi(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=hi(e[n]);return mi(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return mi(n);function n(n){const r=n;let A;for(A in e)if(r[A]!==t[A])return!1;return!0}}(e);if("string"==typeof e)return function(e){return mi(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function mi(e){return function(t,n,r){return!(!function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)||!e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function vi(){return!0}const yi=[],wi=!0,bi=!1;function Ei(e,t,n,r){let A;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):A=t;const o=hi(A),i=r?-1:1;!function e(A,l,a){const s=A&&"object"==typeof A?A:{};if("string"==typeof s.type){const e="string"==typeof s.tagName?s.tagName:"string"==typeof s.name?s.name:void 0;Object.defineProperty(c,"name",{value:"node ("+A.type+(e?"<"+e+">":"")+")"})}return c;function c(){let s,c,u,d=yi;if((!t||o(A,l,a[a.length-1]||void 0))&&(d=function(e){return Array.isArray(e)?e:"number"==typeof e?[wi,e]:null==e?yi:[e]}(n(A,a)),d[0]===bi))return d;if("children"in A&&A.children){const t=A;if(t.children&&"skip"!==d[0])for(c=(r?t.children.length:-1)+i,u=a.concat(t);c>-1&&c<t.children.length;){const n=t.children[c];if(s=e(n,c,u)(),s[0]===bi)return s;c="number"==typeof s[1]?s[1]:c+i}}return d}}(e,void 0,[])()}function Pi(e,t,n,r){let A,o,i;"function"==typeof t?(o=void 0,i=t,A=n):(o=t,i=n,A=r),Ei(e,o,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return i(e,r,n)},A)}const Bi={}.hasOwnProperty,Di={};function Ci(e,t){const n=t||Di,r=new Map,A=new Map,o=new Map,i={...ri,...n.handlers},l={all:function(e){const t=[];if("children"in e){const n=e.children;let r=-1;for(;++r<n.length;){const A=l.one(n[r],e);if(A){if(r&&"break"===n[r-1].type&&(!Array.isArray(A)&&"text"===A.type&&(A.value=Ii(A.value)),!Array.isArray(A)&&"element"===A.type)){const e=A.children[0];e&&"text"===e.type&&(e.value=Ii(e.value))}Array.isArray(A)?t.push(...A):t.push(A)}}}return t},applyData:ki,definitionById:r,footnoteById:A,footnoteCounts:o,footnoteOrder:[],handlers:i,one:function(e,t){const n=e.type,r=l.handlers[n];if(Bi.call(l.handlers,n)&&r)return r(l,e,t);if(l.options.passThrough&&l.options.passThrough.includes(n)){if("children"in e){const{children:t,...n}=e,r=fi(n);return r.children=l.all(e),r}return fi(e)}return(l.options.unknownHandler||Si)(l,e,t)},options:n,patch:xi,wrap:Ti};return Pi(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){const t="definition"===e.type?r:A,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),l}function xi(e,t){e.position&&(t.position=function(e){const t=Ir(e),n=Tr(e);if(t&&n)return{start:t,end:n}}(e))}function ki(e,t){let n=t;if(e&&e.data){const t=e.data.hName,r=e.data.hChildren,A=e.data.hProperties;if("string"==typeof t)if("element"===n.type)n.tagName=t;else{n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}}"element"===n.type&&A&&Object.assign(n.properties,fi(A)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function Si(e,t){const n=t.data||{},r=!("value"in t)||Bi.call(n,"hProperties")||Bi.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:e.all(t)}:{type:"text",value:t.value};return e.patch(t,r),e.applyData(t,r)}function Ti(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function Ii(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function Qi(e,t){const n=Ci(e,t),r=n.one(e,void 0),A=function(e){const t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||pi,r=e.options.footnoteBackLabel||gi,A=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let a=-1;for(;++a<e.footnoteOrder.length;){const A=e.footnoteById.get(e.footnoteOrder[a]);if(!A)continue;const o=e.all(A),i=String(A.identifier).toUpperCase(),s=SA(i.toLowerCase());let c=0;const u=[],d=e.footnoteCounts.get(i);for(;void 0!==d&&++c<=d;){u.length>0&&u.push({type:"text",value:" "});let e="string"==typeof n?n:n(a,c);"string"==typeof e&&(e={type:"text",value:e}),u.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+s+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(a,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}const f=o[o.length-1];if(f&&"element"===f.type&&"p"===f.tagName){const e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...u)}else o.push(...u);const p={type:"element",tagName:"li",properties:{id:t+"fn-"+s},children:e.wrap(o,!0)};e.patch(A,p),l.push(p)}if(0!==l.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...fi(i),id:"footnote-label"},children:[{type:"text",value:A}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:"\n"}]}}(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return A&&o.children.push({type:"text",value:"\n"},A),o}function Mi(e,t){return e&&"run"in e?async function(n,r){const A=Qi(n,{file:r,...t});await e.run(A,r)}:function(n,r){return Qi(n,{file:r,...e||t})}}function Oi(e){if(e)throw e}var Li,Ni;var Hi=function(){if(Ni)return Li;Ni=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,A=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},o=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,A=e.call(n,"constructor"),o=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!A&&!o)return!1;for(r in n);return typeof r>"u"||e.call(n,r)},i=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return Li=function e(){var t,n,r,a,s,c,u=arguments[0],d=1,f=arguments.length,p=!1;for("boolean"==typeof u&&(p=u,u=arguments[1]||{},d=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});d<f;++d)if(null!=(t=arguments[d]))for(n in t)r=l(u,n),u!==(a=l(t,n))&&(p&&a&&(o(a)||(s=A(a)))?(s?(s=!1,c=r&&A(r)?r:[]):c=r&&o(r)?r:{},i(u,{name:n,newValue:e(p,c,a)})):typeof a<"u"&&i(u,{name:n,newValue:a}));return u},Li}();const Ri=Er(Hi);function Fi(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function Ui(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function A(o,...i){const l=e[++n];let a=-1;if(o)r(o);else{for(;++a<t.length;)(null===i[a]||void 0===i[a])&&(i[a]=t[a]);t=i,l?function(e,t){let n;return r;function r(...t){const r=e.length>t.length;let i;r&&t.push(A);try{i=e.apply(this,t)}catch(e){if(r&&n)throw e;return A(e)}r||(i&&i.then&&"function"==typeof i.then?i.then(o,A):i instanceof Error?A(i):o(i))}function A(e,...r){n||(n=!0,t(e,...r))}function o(e){A(null,e)}}(l,A)(...i):r(null,...i)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}const ji={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');zi(e);let n,r=0,A=-1,o=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else A<0&&(n=!0,A=o+1);return A<0?"":e.slice(r,A)}if(t===e)return"";let i=-1,l=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(A=o):(l=-1,A=i));return r===A?A=i:A<0&&(A=e.length),e.slice(r,A)},dirname:function(e){if(zi(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){zi(e);let t,n=e.length,r=-1,A=0,o=-1,i=0;for(;n--;){const l=e.codePointAt(n);if(47!==l)r<0&&(t=!0,r=n+1),46===l?o<0?o=n:1!==i&&(i=1):o>-1&&(i=-1);else if(t){A=n+1;break}}return o<0||r<0||0===i||1===i&&o===r-1&&o===A+1?"":e.slice(o,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)zi(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){zi(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,A="",o=0,i=-1,l=0,a=-1;for(;++a<=e.length;){if(a<e.length)n=e.codePointAt(a);else{if(47===n)break;n=47}if(47===n){if(i!==a-1&&1!==l)if(i!==a-1&&2===l){if(A.length<2||2!==o||46!==A.codePointAt(A.length-1)||46!==A.codePointAt(A.length-2))if(A.length>2){if(r=A.lastIndexOf("/"),r!==A.length-1){r<0?(A="",o=0):(A=A.slice(0,r),o=A.length-1-A.lastIndexOf("/")),i=a,l=0;continue}}else if(A.length>0){A="",o=0,i=a,l=0;continue}t&&(A=A.length>0?A+"/..":"..",o=2)}else A.length>0?A+="/"+e.slice(i+1,a):A=e.slice(i+1,a),o=a-i-1;i=a,l=0}else 46===n&&l>-1?l++:l=-1}return A}(e,!t);return 0===n.length&&!t&&(n="."),n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/"),t?"/"+n:n}(t)},sep:"/"};function zi(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const _i={cwd:function(){return"/"}};function qi(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function Gi(e){if("string"==typeof e)e=new URL(e);else if(!qi(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("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const Yi=["history","path","basename","stem","extname","dirname"];class Wi{constructor(e){let t;var n;t=e?qi(e)?{path:e}:"string"==typeof e||(n=e)&&"object"==typeof n&&"byteLength"in n&&"byteOffset"in n?{value:e}:e:{},this.cwd="cwd"in t?"":_i.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r,A=-1;for(;++A<Yi.length;){const e=Yi[A];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)Yi.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?ji.basename(this.path):void 0}set basename(e){Xi(e,"basename"),Vi(e,"basename"),this.path=ji.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?ji.dirname(this.path):void 0}set dirname(e){Ki(this.basename,"dirname"),this.path=ji.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?ji.extname(this.path):void 0}set extname(e){if(Vi(e,"extname"),Ki(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ji.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){qi(e)&&(e=Gi(e)),Xi(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?ji.basename(this.path,this.extname):void 0}set stem(e){Xi(e,"stem"),Vi(e,"stem"),this.path=ji.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new Hr(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Vi(e,t){if(e&&e.includes(ji.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ji.sep+"`")}function Xi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ki(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const Ji=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},Zi={}.hasOwnProperty;class $i extends Ji{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=Ui()}copy(){const e=new $i;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(Ri(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(rl("data",this.frozen),this.namespace[e]=t,this):Zi.call(this.namespace,e)&&this.namespace[e]||void 0:e?(rl("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=il(e),n=this.parser||this.Parser;return tl("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),tl("process",this.parser||this.Parser),nl("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,A){const o=il(e),i=n.parse(o);function l(e,n){e||!n?A(e):r?r(n):t(void 0,n)}n.run(i,o,function(e,t,r){if(e||!t||!r)return l(e);const A=t,o=n.stringify(A,r);var i;"string"==typeof(i=o)||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(i)?r.value=o:r.result=o,l(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),tl("processSync",this.parser||this.Parser),nl("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,Oi(e),t=r}),ol("processSync","process",n),t}run(e,t,n){Al(e),this.freeze();const r=this.transformers;return!n&&"function"==typeof t&&(n=t,t=void 0),n?A(void 0,n):new Promise(A);function A(A,o){const i=il(t);r.run(e,i,function(t,r,i){const l=r||e;t?o(t):A?A(l):n(void 0,l,i)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){Oi(e),n=t,r=!0}),ol("runSync","run",r),n}stringify(e,t){this.freeze();const n=il(t),r=this.compiler||this.Compiler;return nl("stringify",r),Al(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(rl("use",this.frozen),null!=e)if("function"==typeof e)l(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?i(e):o(e)}return this;function A(e){if("function"==typeof e)l(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;l(t,n)}else o(e)}}function o(e){if(!("plugins"in e)&&!("settings"in e))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");i(e.plugins),e.settings&&(r.settings=Ri(!0,r.settings,e.settings))}function i(e){let t=-1;if(null!=e){if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){A(e[t])}}}function l(e,t){let r=-1,A=-1;for(;++r<n.length;)if(n[r][0]===e){A=r;break}if(-1===A)n.push([e,...t]);else if(t.length>0){let[r,...o]=t;const i=n[A][1];Fi(i)&&Fi(r)&&(r=Ri(!0,i,r)),n[A]=[e,r,...o]}}}}const el=(new $i).freeze();function tl(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function nl(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function rl(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 Al(e){if(!Fi(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function ol(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function il(e){return function(e){return!!(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new Wi(e)}const ll=[],al={allowDangerousHtml:!0},sl=/^(https?|ircs?|mailto|xmpp)$/i,cl=[{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:"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 ul(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",A=e.className,o=e.components,i=e.disallowedElements,l=e.rehypePlugins||ll,a=e.remarkPlugins||ll,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...al}:al,c=e.skipHtml,u=e.unwrapDisallowed,d=e.urlTransform||dl,f=el().use(Zo).use(a).use(Mi,s).use(l),p=new Wi;"string"==typeof r&&(p.value=r);for(const t of cl)Object.hasOwn(e,t.from)&&(t.from,t.to&&t.to,t.id);const v=f.parse(p);let y=f.runSync(v,p);return A&&(y={type:"element",tagName:"div",properties:{className:A},children:"root"===y.type?y.children:[y]}),Pi(y,function(e,r,A){if("raw"===e.type&&A&&"number"==typeof r)return c?A.children.splice(r,1):A.children[r]={type:"text",value:e.value},r;if("element"===e.type){let t;for(t in nA)if(Object.hasOwn(nA,t)&&Object.hasOwn(e.properties,t)){const n=e.properties[t],r=nA[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=d(String(n||""),t,e))}}if("element"===e.type){let o=t?!t.includes(e.tagName):!!i&&i.includes(e.tagName);if(!o&&n&&"number"==typeof r&&(o=!n(e,r,A)),o&&A&&"number"==typeof r)return u&&e.children?A.children.splice(r,1,...e.children):A.children.splice(r,1),r}}),Gr(y,{Fragment:m,components:o,ignoreInvalidStyle:!0,jsx:g,jsxs:h,passKeys:!0,passNode:!0})}function dl(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),A=e.indexOf("/");return-1===t||-1!==A&&t>A||-1!==n&&t>n||-1!==r&&t>r||sl.test(e.slice(0,t))?e:""}const fl=({children:e})=>g("div",{style:{whiteSpace:"normal"},children:g(ul,{components:{p:({...e})=>g("p",{style:{margin:0,marginBottom:"0.5em",lineHeight:1.4,textAlign:"left"},children:e.children}),ul:({...e})=>g("ul",{style:{paddingLeft:"clamp(8px, 3.5vw, 16px)",margin:0,listStylePosition:"inside"},children:e.children}),ol:({...e})=>g("ol",{style:{paddingLeft:"clamp(8px, 3.5vw, 16px)",margin:0,listStylePosition:"inside"},children:e.children}),li:({...e})=>g("li",{style:{marginBottom:"1px",lineHeight:1.4},children:e.children}),code:({inline:e,children:t})=>e?g("code",{style:{backgroundColor:"rgba(0, 0, 0, 0.3)",padding:"2px 4px",borderRadius:"4px",fontFamily:"inherit",fontSize:"0.95em"},children:t}):g("pre",{style:{backgroundColor:"rgba(0, 0, 0, 0.3)",padding:"8px",borderRadius:"4px",overflowX:"auto",margin:"0.5em 0",whiteSpace:"pre-wrap"},children:g("code",{children:t})}),blockquote:({...e})=>g("blockquote",{style:{margin:0,paddingLeft:"10px",borderLeft:"2px solid #ccc",color:"#666",fontStyle:"italic"},children:e.children})},children:"string"==typeof e?e:""})}),pl={autoConfig:!0},gl=e=>()=>(e=>{const{getFlow:t}=$t(),{messages:n,replaceMessages:r}=en(),{settings:A}=nn(),{hasChatHistoryLoaded:o}=An(),i={...e,...pl},l=i.markdownComponent?i.markdownComponent:fl;a(()=>{var e,t;if(o){const o=[...n];for(let n=0;n<o.length&&n<((null==(e=A.chatHistory)?void 0:e.maxEntries)??30);n++){const e=o[n];null!=(t=e.tags)&&t.includes("rcb-markdown-renderer-plugin:parsed")&&(e.contentWrapper=l)}r(o)}},[o]);const s=async e=>{var n;const r=null==(n=e.data.message)?void 0:n.sender.toUpperCase();((e,t,n)=>{var r;if("string"!=typeof e.data.message.content||!e.detail.currPath)return!1;const A=t[e.detail.currPath];return!!A&&((null==(r=A.renderMarkdown)?void 0:r.map(e=>e.toUpperCase()).includes(n))??!1)})(e,t(),r)&&(e.data.message.contentWrapper=l,e.data.message.tags||(e.data.message.tags=[]),e.data.message.tags.push("rcb-markdown-renderer-plugin:parsed"))};tn(J.PRE_INJECT_MESSAGE,s),tn(J.CHUNK_STREAM_MESSAGE,s),tn(J.START_STREAM_MESSAGE,s),tn(J.START_SIMULATE_STREAM_MESSAGE,s);const c={name:"@rcb-plugins/markdown-renderer"};return null!=i&&i.autoConfig&&(c.settings={event:{rcbPreInjectMessage:!0,rcbChunkStreamMessage:!0,rcbStartSimulateStreamMessage:!0,rcbStartStreamMessage:!0}}),c})(e),hl={autoConfig:!0,promptBaseColors:{info:"#007bff",warning:"#ffc107",error:"#dc3545",success:"#28a745"},promptHoveredColors:{info:"#0056b3",warning:"#d39e00",error:"#c82333",success:"#218838"},textAreaHighlightColors:{info:"#007bff",warning:"#ffc107",error:"#dc3545",success:"#28a745"}},ml=(e,t,n="validateTextInput")=>{var r;if(null==(r=e.detail)||!r.currPath)return;const A=t[e.detail.currPath];if(!A)return;const o=A[n];return"function"==typeof o?o:void 0},vl=e=>{const{showToast:t}=(()=>{const{showToast:e,dismissToast:t,toasts:n,replaceToasts:r}=ct();return{showToast:e,dismissToast:t,toasts:n,replaceToasts:r}})(),{getFlow:n}=$t(),{styles:r,updateStyles:A,replaceStyles:o}=(()=>{const{styles:e,replaceStyles:t,updateStyles:n}=_t();return{styles:e,replaceStyles:t,updateStyles:n}})(),s=(e=>({...hl,...e,promptBaseColors:{...hl.promptBaseColors},promptHoveredColors:{...hl.promptHoveredColors},textAreaHighlightColors:{...hl.textAreaHighlightColors}}))(e),[c,u]=l(0),d=i({});tn(J.USER_SUBMIT_TEXT,e=>{const o=e,i=ml(o,n(),"validateTextInput");if(!i)return;const l=i(o.data.inputText);if(null!=l&&l.success||e.preventDefault(),!l.promptContent)return;0===c&&(d.current=structuredClone(r));const a=((e,t)=>{const n=e.promptType??"info";let r={};return t.advancedStyles&&(r=t.advancedStyles[n]),t.promptBaseColors&&(r.toastPromptStyle={color:t.promptBaseColors[n],borderColor:t.promptBaseColors[n]}),t.promptHoveredColors&&(r.toastPromptHoveredStyle={color:t.promptHoveredColors[n],borderColor:t.promptHoveredColors[n]}),t.textAreaHighlightColors&&(e.highlightTextArea??!0)&&(r.chatInputAreaStyle={boxShadow:`${t.textAreaHighlightColors[n]} 0px 0px 5px`}),r})(l,s);A(a),t(l.promptContent,l.promptDuration??3e3),u(e=>e+1)}),tn(J.USER_UPLOAD_FILE,e=>{var r,A;const o=e,i=null==(A=null==(r=o.data)?void 0:r.files)?void 0:A[0];if(!i)return console.error("No file uploaded."),void e.preventDefault();const l=ml(o,n(),"validateFileInput");if(!l)return void console.error("Validator not found for file input.");const a=l(i);if(!a.success)return console.error("Validation failed:",a),a.promptContent&&t(a.promptContent,a.promptDuration??3e3),void e.preventDefault();console.log("Validation successful:",a)}),tn(J.DISMISS_TOAST,()=>{u(e=>e-1)}),a(()=>{0===c&&setTimeout(()=>{o(d.current)})},[c,o]);const f={name:"@rcb-plugins/input-validator"};return s.autoConfig&&(f.settings={event:{rcbUserSubmitText:!0,rcbUserUploadFile:!0,rcbDismissToast:!0}}),f},yl=n((e,t)=>{let{embedded:n,currentOpen:r,enabled:A,onSetEnabled:o}=e;const l=en(),s=(()=>{const{isChatWindowOpen:e,toggleChatWindow:t,toggleIsBotTyping:n,scrollToBottom:r,getIsChatBotVisible:A}=Ae();return{isChatWindowOpen:e,toggleChatWindow:t,toggleIsBotTyping:n,scrollToBottom:r,getIsChatBotVisible:A}})(),c=i(!1),u=i(!1);return a(()=>{!n&&s&&s.toggleChatWindow&&(c.current===r||u.current||(setTimeout(()=>{s&&s.toggleChatWindow&&s.toggleChatWindow(r)},0),c.current=null!=r&&r),u.current=!1)},[r,n,s]),a(()=>{const e=()=>{u.current=!0};return window.addEventListener("rcb-toggle-chat-window",e),()=>window.removeEventListener("rcb-toggle-chat-window",e)}),f(t,()=>({addMessage:e=>{l&&l.injectMessage&&l.injectMessage(e)},openChat:()=>{!n&&s&&s.toggleChatWindow&&s.toggleChatWindow(!0)},closeChat:()=>{!n&&s&&s.toggleChatWindow&&s.toggleChatWindow(!1)},toggleChat:()=>{!n&&s&&s.toggleChatWindow&&s.toggleChatWindow()},setBotEnabled:e=>{o&&o(e)}}),[l,s,n,o]),null});yl.displayName="BotController";const wl=r(null),bl=e=>{let{trackEvent:n,children:r}=e;const A=i(n);return A.current=n,t.createElement(wl.Provider,{value:{trackEvent:e=>A.current(e)}},r)},El=()=>{const e=A(wl);return e||{trackEvent:()=>{}}},Pl=e=>{let{loginUrl:n,className:r="",style:A,isHeaderButton:o=!1}=e;const{trackEvent:i}=El(),l=o?{display:"inline-block",padding:"6px 12px",backgroundColor:"transparent",border:"1px solid #ccc",color:"white",textDecoration:"none",borderRadius:"4px",fontWeight:"normal",textAlign:"center",margin:"8px",fontSize:"12px",opacity:.8,transition:"all 0.2s ease"}:{display:"inline-block",padding:"10px 20px",backgroundColor:"white",border:"1px solid var(--primaryColor, #107180)",color:"var(--primaryColor, #107180)",textDecoration:"none",borderRadius:"4px",fontWeight:"bold",textAlign:"center",margin:"18px",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.2)"};return t.createElement(t.Fragment,null,o&&t.createElement("style",null,"\n .rcb-chat-header-container .qa-bot-header-login-button:hover {\n background-color: #0000001a !important;\n opacity: 1 !important;\n }\n "),t.createElement("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:`qa-bot-login-button ${o?"qa-bot-header-login-button":""} ${r}`,style:Object.assign(Object.assign({},l),A),onClick:()=>{i({type:"chatbot_login_clicked",loginUrl:n})}},"Log In"))},Bl=()=>t.createElement("div",{className:"user-login-icon",style:{alignItems:"center",justifyContent:"center",width:"30px",height:"30px",borderRadius:"50%",backgroundColor:"var(--primaryColor, #1a5b6e)",marginRight:"5px",display:"flex"},role:"img","aria-label":"User logged in",title:"User logged in"},t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},t.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),t.createElement("circle",{cx:"12",cy:"7",r:"4"}))),Dl=[];for(let e=0;e<256;++e)Dl.push((e+256).toString(16).slice(1));let Cl;const xl=new Uint8Array(16);var kl={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Sl(e,t,n){if(kl.randomUUID&&!e)return kl.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!Cl){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Cl=crypto.getRandomValues.bind(crypto)}return Cl(xl)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return(Dl[e[t+0]]+Dl[e[t+1]]+Dl[e[t+2]]+Dl[e[t+3]]+"-"+Dl[e[t+4]]+Dl[e[t+5]]+"-"+Dl[e[t+6]]+Dl[e[t+7]]+"-"+Dl[e[t+8]]+Dl[e[t+9]]+"-"+Dl[e[t+10]]+Dl[e[t+11]]+Dl[e[t+12]]+Dl[e[t+13]]+Dl[e[t+14]]+Dl[e[t+15]]).toLowerCase()}(r)}function Tl(){return"undefined"!=typeof localStorage&&"true"===localStorage.getItem("QA_BOT_DEBUG")}const Il="background: #1a5b6e; color: white; padding: 2px 6px; border-radius: 3px;",Ql="background: #7c3aed; color: white; padding: 2px 6px; border-radius: 3px;",Ml="background: #059669; color: white; padding: 2px 6px; border-radius: 3px;",Ol="background: #f97316; color: white; padding: 2px 6px; border-radius: 3px;",Ll="background: #f59e0b; color: #000; padding: 2px 6px; border-radius: 3px 0 0 3px; font-weight: bold;",Nl="background: #fbbf24; color: #000; padding: 2px 6px; border-radius: 0 3px 3px 0;",Hl=()=>{Tl()&&console.log("%c QA Bot Core %c v0.2.35 ",Ll,Nl)},Rl=function(e){if(Tl()){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];console.log(`%c[Session]%c ${e}`,Il,"",...n)}},Fl=function(e){if(Tl()){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];console.log(`%c[History]%c ${e}`,Ql,"",...n)}},Ul=(e,t)=>{Tl()&&console.log(`%c[Message]%c ${e}`,Ml,"",t)},jl=function(e){if(Tl()){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];console.log(`%c[Turnstile]%c ${e}`,Ol,"",...n)}},zl=function(){console.warn(...arguments)},_l=function(){console.error(...arguments)},ql="qa_bot_session_messages",Gl=()=>`qa_bot_session_${Sl()}`,Yl=()=>{try{const e=localStorage.getItem(ql);return e?JSON.parse(e):{}}catch(e){return{}}},Wl=(e,t,n,r,A)=>{const o=Yl();!o[e]&&(o[e]={messages:[],startedAt:(new Date).toISOString(),preview:""},Fl("NEW session created",{sessionId:e.slice(-12)}));if(o[e].messages.some(e=>e.id===t))return void Fl("DUPLICATE message skipped",{sessionId:e.slice(-12),messageId:t.slice(-8),sender:r});const i={id:t,content:n,sender:r,type:A,timestamp:Date.now()};o[e].messages.push(i),Fl("MESSAGE added",{sessionId:e.slice(-12),messageId:t.slice(-8),sender:r,totalInSession:o[e].messages.length});const l=o[e].messages,a=l.find(e=>{var t;return"bot"===e.sender.toLowerCase()&&(null===(t=e.content)||void 0===t?void 0:t.trim())&&e.content.length>=100});if(a){const t=a.content;o[e].preview=t.slice(0,50)+(t.length>50?"...":"")}else{const t=l.find(e=>{var t;return"user"===e.sender.toLowerCase()&&(null===(t=e.content)||void 0===t?void 0:t.trim())});if(t&&!o[e].preview){const n=t.content;o[e].preview=n.slice(0,50)+(n.length>50?"...":"")}}(e=>{var t;const n=()=>Object.values(e).reduce((e,t)=>e+t.messages.length,0);for(;n()>100&&Object.keys(e).length>1;){const n=null===(t=Object.entries(e).sort((e,t)=>{let[,n]=e,[,r]=t;return new Date(n.startedAt).getTime()-new Date(r.startedAt).getTime()})[0])||void 0===t?void 0:t[0];if(!n)break;delete e[n]}localStorage.setItem(ql,JSON.stringify(e))})(o),Fl("STORAGE state",{ourSessions:Object.keys(o).length,ourTotalMessages:Object.values(o).reduce((e,t)=>e+t.messages.length,0)})},Vl=e=>{var t,n;return null!==(n=null===(t=Yl()[e])||void 0===t?void 0:t.messages.length)&&void 0!==n?n:0},Xl=e=>{const t=Yl()[e];return(null==t?void 0:t.startedAt)?Date.now()-new Date(t.startedAt).getTime():0},Kl=r(void 0),Jl=e=>{let{children:n,getSessionId:r,setSessionId:A,resetSession:o,clearResettingFlag:i}=e;return t.createElement(Kl.Provider,{value:{getSessionId:r,setSessionId:A,resetSession:o,clearResettingFlag:i}},n)},Zl=()=>{const e=A(Kl);if(!e)throw new Error("useSession must be used within a SessionProvider");return e},$l=()=>{const[e,n]=l(!1),[r,A]=l([]),[o,s]=l(null),[c,u]=l(0),d=i(null),f=i(null),{replaceMessages:p}=en(),{toggleTextAreaDisabled:g}=rn(),{setSessionId:h,getSessionId:m}=Zl();a(()=>{var t,r;const A=e=>{d.current&&!d.current.contains(e.target)&&f.current&&!f.current.contains(e.target)&&n(!1)},o=null!==(r=null===(t=d.current)||void 0===t?void 0:t.getRootNode())&&void 0!==r?r:document;return e&&o.addEventListener("mousedown",A),()=>{o.removeEventListener("mousedown",A)}},[e]);const v=e=>{var t;const r=m();if(Fl("RESTORE requested",{targetSession:e.slice(-12),currentSession:null==r?void 0:r.slice(-12)}),e===r)return Fl("RESTORE skipped - already on this session"),void n(!1);const A=(e=>{var t;return(null===(t=Yl()[e])||void 0===t?void 0:t.messages)||[]})(e).filter(e=>{var t;return null===(t=e.content)||void 0===t?void 0:t.trim()});Fl("Stored messages from our localStorage",{count:A.length,ids:A.map(e=>e.id.slice(-8))});const o=A.map(e=>({id:e.id,content:e.content,sender:e.sender.toUpperCase(),type:e.type||"string",timestamp:new Date(e.timestamp).toISOString()}));var i;h(e),Fl("Session ID updated",{newSession:e.slice(-12)}),p(o),Fl("replaceMessages called",{count:o.length}),i=null===(t=f.current)||void 0===t?void 0:t.getRootNode(),setTimeout(()=>{const e=(i||document).querySelector(".rcb-chat-body-container");e&&e.querySelectorAll(".rcb-bot-message").forEach(e=>{var t;let n=e.innerHTML,r=!1;n.includes("](")&&(n=n.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),r=!0),n.includes("&lt;a href=")&&(n=n.replace(/&lt;a\s+href=["']([^"']+)["'][^&]*&gt;([^&]+)&lt;\/a&gt;/gi,'<a href="$1" target="_blank" rel="noopener noreferrer">$2</a>'),r=!0),(n.includes("&lt;a ")||(null===(t=e.textContent)||void 0===t?void 0:t.includes("<a href=")))&&(e.textContent||"").includes("<a href=")&&(n=n.replace(/&lt;a\s+href="([^"]+)"[^&]*&gt;([^&]+)&lt;\/a&gt;/gi,'<a href="$1" target="_blank" rel="noopener noreferrer">$2</a>'),r=!0),r&&(e.innerHTML=n)})},50),g(!1),Fl("Chat input enabled after restore"),n(!1)};return t.createElement("div",{style:{position:"relative"}},t.createElement("button",{ref:f,className:"history-button",onClick:()=>{if(!e&&(A((()=>{const e=Yl();return Object.entries(e).map(e=>{let[t,n]=e;return Object.assign({sessionId:t},n)}).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime())})()),f.current)){const e=f.current.closest(".rcb-chat-window");if(e){const t=e.getBoundingClientRect(),n=f.current.getBoundingClientRect();s(t.width+3),u(t.right-n.right-18+4)}}n(!e)},style:{alignItems:"center",justifyContent:"center",width:"30px",height:"30px",borderRadius:"50%",backgroundColor:"var(--primaryColor, #1a5b6e)",marginRight:"18px",display:"flex",border:"none",cursor:"pointer",padding:0},"aria-label":"View chat history",title:"View chat history","aria-expanded":e,"aria-haspopup":"menu"},t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("polyline",{points:"12 6 12 12 16 14"}))),e&&t.createElement("div",{ref:d,role:"menu",style:{position:"absolute",right:c?`-${c}px`:"-18px",top:"100%",marginTop:"8px",width:o?`${o}px`:"550px",backgroundColor:"white",borderRadius:0,borderBottom:"3px solid var(--primaryColor, #1a5b6e)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",maxHeight:"250px",overflowY:"auto",zIndex:1e3}},0===r.length?t.createElement("div",{style:{padding:"12px 16px",color:"#666",fontSize:"14px",textAlign:"center"}},"No chat history"):r.map(e=>t.createElement("button",{key:e.sessionId,role:"menuitem",onClick:()=>v(e.sessionId),style:{width:"100%",padding:"10px 14px",border:"none",backgroundColor:"transparent",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"2px",borderBottom:"1px solid #eee"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f5f5f5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"}},t.createElement("span",{style:{fontSize:"14px",color:"#333",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},e.preview||"New conversation"),t.createElement("span",{style:{fontSize:"12px",color:"#888"}},(e=>{const t=new Date(e),n=(new Date).getTime()-t.getTime(),r=Math.floor(n/864e5);return 0===r?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):1===r?"Yesterday":r<7?t.toLocaleDateString([],{weekday:"short"}):t.toLocaleDateString([],{month:"short",day:"numeric"})})(e.startedAt))))))},ea=e=>{var{width:n=24,height:r=24,color:A="currentColor",children:o}=e,i=b(e,["width","height","color","children"]);return t.createElement("svg",w({xmlns:"http://www.w3.org/2000/svg",width:n,height:r,viewBox:"0 0 24 24",fill:"none",stroke:A,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},i),o)},ta=e=>t.createElement(ea,e,t.createElement("path",{d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})),na=()=>{const{restartFlow:e}=$t(),{setTextAreaValue:n}=rn(),{messages:r}=en(),{getSessionId:A,resetSession:o,clearResettingFlag:i}=Zl(),{trackEvent:l}=El();return t.createElement("button",{onClick:async()=>{const t=A(),r=t?Vl(t):0;l({type:"chatbot_new_chat",previousMessageCount:r}),o(),await n(""),await e(),setTimeout(()=>{i()},100)},tabIndex:0,"aria-label":"New chat conversation",style:{backgroundColor:"var(--primaryColor, #107180)",border:"none",color:"#ffffff",fontSize:"14px",cursor:"pointer",padding:"8px 12px",borderRadius:"4px",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"6px",fontWeight:"500"},onMouseEnter:e=>{e.target.style.backgroundColor="var(--secondaryColor, #0d5f6b)"},onMouseLeave:e=>{e.target.style.backgroundColor="var(--primaryColor, #107180)"}},t.createElement(ta,{width:16,height:16}),"New Chat")};function ra(e){if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(!e)return"";if(Array.isArray(e))return e.map(ra).join("");if("object"==typeof e&&null!==e&&"props"in e){const t=e.props;if(t&&"children"in t)return ra(t.children)}return""}const Aa=()=>{const{getSessionId:e}=Zl(),t=o(t=>{var n;const r=null===(n=t.data)||void 0===n?void 0:n.message;if(!(null==r?void 0:r.id))return;const A=r.sender,o=r.type||"string";let i;if(i="string"==typeof r.content?r.content:ra(r.content),Ul("TRACKED",{id:r.id,sender:A,content:i.substring(0,50)+(i.length>50?"...":"")}),i.includes("rcb-options-container"))return;if(!i.trim())return;const l=e();Wl(l,r.id,i,A,o)},[e]);return a(()=>(window.addEventListener("rcb-pre-inject-message",t),()=>{window.removeEventListener("rcb-pre-inject-message",t)}),[t]),null},oa=()=>(a(()=>{const e=e=>{if(!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter"," ","Home","End"].includes(e.key))return;const n=document.activeElement;if(n&&("INPUT"===n.tagName||"TEXTAREA"===n.tagName||"true"===n.contentEditable||n.classList.contains("rcb-chat-input-textarea")))return;const r=document.querySelector(".rcb-chat-window");if(!r)return;const A=Array.from(r.querySelectorAll(".rcb-message-container, .rcb-bot-message-container, .rcb-user-message-container")).filter(e=>null!==e.offsetParent);if(A.length>0){const t=A[A.length-1].querySelector(".rcb-checkbox-container");if(t&&null!==t.offsetParent){const n=Array.from(t.querySelectorAll(".rcb-checkbox-row-container")),r=t.querySelector(".rcb-checkbox-next-button");if(n.length>0){const t=[...n];return r&&t.push(r),void((e,t)=>{e.preventDefault();let n=-1;for(let e=0;e<t.length;e++)if(t[e]===document.activeElement||t[e].contains(document.activeElement)){n=e;break}-1===n&&(n=0);let r=n;switch(e.key){case"ArrowDown":case"ArrowRight":r=n<t.length-1?n+1:0;break;case"ArrowUp":case"ArrowLeft":r=n>0?n-1:t.length-1;break;case"Home":r=0;break;case"End":r=t.length-1;break;case"Enter":case" ":{const e=t[n],r=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});return void e.dispatchEvent(r)}default:return}t[r].focus(),t[r].setAttribute("tabindex","0"),t[r].classList.add("keyboard-focused"),t.forEach((e,t)=>{t!==r&&(e.setAttribute("tabindex","-1"),e.classList.remove("keyboard-focused"))})})(e,t)}}}let o=[];if(A.length>0){const e=A[A.length-1],t=Array.from(e.querySelectorAll(".rcb-options-container")).filter(e=>null!==e.offsetParent);if(t.length>0){const e=t[t.length-1];o=Array.from(e.querySelectorAll(".rcb-options"))}}if(0===o.length)return;const i=o.findIndex(e=>e===document.activeElement);switch(e.key){case"ArrowDown":case"ArrowRight":{let t;e.preventDefault(),t=i<o.length-1?i+1:0,o[t].setAttribute("tabindex","0"),o.forEach((e,n)=>{n!==t&&(e.setAttribute("tabindex","-1"),e.classList.remove("keyboard-focused"))}),o[t].classList.add("keyboard-focused"),o[t].focus();break}case"ArrowUp":case"ArrowLeft":{let t;e.preventDefault(),t=i>0?i-1:o.length-1,o[t].setAttribute("tabindex","0"),o.forEach((e,n)=>{n!==t&&(e.setAttribute("tabindex","-1"),e.classList.remove("keyboard-focused"))}),o[t].classList.add("keyboard-focused"),o[t].focus();break}case"Enter":case" ":if(e.preventDefault(),document.activeElement&&o.includes(document.activeElement)){const e=document.activeElement;if(e.classList.contains("rcb-checkbox-row-container")||e.closest(".rcb-checkbox-row-container")){const n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});e.dispatchEvent(n);const r=e.querySelector(".rcb-checkbox-label"),A=r?r.textContent:e.textContent||"checkbox",o=e.querySelector(".rcb-checkbox-mark"),i=o&&o.style.backgroundColor?"checked":"unchecked";t(`${A} ${i}`)}else{const n=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});e.dispatchEvent(n);const r=e.textContent||e.innerText;t(`Selected: ${r}`)}}break;case"Home":e.preventDefault(),o.length>0&&(o[0].setAttribute("tabindex","0"),o.forEach((e,t)=>{0!==t&&(e.setAttribute("tabindex","-1"),e.classList.remove("keyboard-focused"))}),o[0].classList.add("keyboard-focused"),o[0].focus());break;case"End":if(e.preventDefault(),o.length>0){const e=o.length-1;o[e].setAttribute("tabindex","0"),o.forEach((t,n)=>{n!==e&&(t.setAttribute("tabindex","-1"),t.classList.remove("keyboard-focused"))}),o[e].classList.add("keyboard-focused"),o[e].focus()}}},t=e=>{const t=document.createElement("div");t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="sr-only",t.textContent=e,document.body.appendChild(t),setTimeout(()=>{document.body.contains(t)&&document.body.removeChild(t)},1e3)},n=(e=null)=>{let n=e;if(n||(n=document.querySelector(".rcb-chat-window"),n||(n=document.querySelector('[class*="rcb-chat"]')),n||(n=document.querySelector(".qa-bot"))),!n)return;const r=null!==n.closest(".embedded-qa-bot"),A=Array.from(n.querySelectorAll(".rcb-message-container, .rcb-bot-message-container, .rcb-user-message-container")).filter(e=>null!==e.offsetParent);if(0===A.length)return;const o=A[A.length-1],i=Array.from(o.querySelectorAll(".rcb-options-container")).filter(e=>null!==e.offsetParent);let l=[];if(i.length>0){const e=i[i.length-1];l=Array.from(e.querySelectorAll(".rcb-options"))}if(0===l.length){let e=o.querySelector(".rcb-checkbox-container");if(!e&&n&&(e=n.querySelector(".rcb-checkbox-container")),e&&null!==e.offsetParent){const t=Array.from(e.querySelectorAll(".rcb-checkbox-row-container")).filter(e=>null!==e.offsetParent&&"none"!==e.style.display);if(t.length>0){const n=e.querySelector(".rcb-checkbox-next-button"),A=[...t];if(n&&null!==n.offsetParent&&A.push(n),A.forEach((e,t)=>{e.setAttribute("tabindex",0===t?"0":"-1"),0===t?e.classList.add("keyboard-focused"):e.classList.remove("keyboard-focused")}),t.length>1){e.querySelectorAll(".keyboard-nav-hint").forEach(e=>e.remove());const t=document.createElement("div");t.className="keyboard-nav-hint",t.textContent="Use arrow keys ↕ to navigate, Enter to select/deselect, or click any option",t.style.cssText="font-size: 12px !important; color: #666 !important; margin-bottom: 8px !important; font-style: italic !important; display: block !important;",e.insertBefore(t,e.firstChild)}return void setTimeout(()=>{A[0]&&null!==A[0].offsetParent&&!r&&A[0].focus()},150)}}}if(l.length>0){if(l.forEach((e,t)=>{const n=0===t?"0":"-1";e.setAttribute("tabindex",n),e.setAttribute("role","option"),e.setAttribute("aria-posinset",t+1),e.setAttribute("aria-setsize",l.length),0===t?e.classList.add("keyboard-focused"):e.classList.remove("keyboard-focused")}),l.length>1){const e=i.length>0?i[i.length-1]:null;if(e){e.querySelectorAll(".keyboard-nav-hint").forEach(e=>e.remove());const t=document.createElement("div");t.className="keyboard-nav-hint",t.textContent="Use arrow keys ↕ to navigate, Enter to select, or click any option",t.style.cssText="font-size: 12px !important; color: #666 !important; margin-bottom: 8px !important; font-style: italic !important; display: block !important;",e.insertBefore(t,e.firstChild)}}else{const e=i.length>0?i[i.length-1]:null;if(e){e.querySelectorAll(".keyboard-nav-hint").forEach(e=>e.remove())}}setTimeout(()=>{l[0]&&null!==l[0].offsetParent&&!r&&(l[0].focus(),l.length>1&&t(`${l.length} options available. Use arrow keys to navigate.`))},200)}},r=new MutationObserver(e=>{e.forEach(e=>{if("childList"===e.type){const t=Array.from(e.addedNodes),r=t.some(e=>e.nodeType===Node.ELEMENT_NODE&&(e.classList?.contains("rcb-options-container")||e.classList?.contains("rcb-options")||e.querySelector?.(".rcb-options-container")||e.querySelector?.(".rcb-options"))),A=t.some(e=>e.nodeType===Node.ELEMENT_NODE&&(e.classList?.contains("rcb-checkbox-container")||e.querySelector?.(".rcb-checkbox-container")));if(r||A){let t=e.target;for(;t&&!t.classList?.contains("qa-bot")&&!t.classList?.contains("rcb-chat-window");)t=t.parentElement;(t||document).querySelectorAll(".rcb-options[tabindex], .rcb-checkbox-row-container[tabindex], .rcb-checkbox-next-button[tabindex]").forEach(e=>{e.setAttribute("tabindex","-1"),e.classList.remove("keyboard-focused")}),setTimeout(()=>n(t),100)}}})});r.observe(document.body,{childList:!0,subtree:!0}),document.addEventListener("keydown",e),n();const A=setInterval(()=>{document.querySelectorAll(".qa-bot").forEach(e=>{const t=e.querySelectorAll(".rcb-options-container .rcb-options").length>0,r=e.querySelectorAll(".rcb-checkbox-row-container").length>0;if(t){const t=e.querySelectorAll(".rcb-options[tabindex]").length;e.querySelectorAll(".rcb-options").length>t&&n(e)}if(r){const t=e.querySelectorAll(".rcb-checkbox-row-container[tabindex]").length;e.querySelectorAll(".rcb-checkbox-row-container").length>t&&n(e)}})},1e3);return()=>{document.removeEventListener("keydown",e),r.disconnect(),clearInterval(A)}},[]),null);let ia=!1,la=null;function aa(){return ia?Promise.resolve():la||(la=new Promise((e,t)=>{const n=document.createElement("script");n.src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",n.async=!0,n.onload=()=>{ia=!0,jl("Script loaded"),e()},n.onerror=()=>{la=null,t(new Error("Failed to load Turnstile script"))},document.head.appendChild(n)}),la)}const sa=e=>{if(!e||"string"!=typeof e)return e;let t=e.replace(/\[(https?:\/\/[^\s]+?)\]/gi,"[$1]($1)");return t=t.replace(/(?<!\]\(|href=["']|\[)https?:\/\/[^\s[\]()]+/gi,e=>{let t=e,n="";const r=t.match(/([.,;:!?]+)$/);return r&&(n=r[1],t=t.slice(0,-n.length)),`[${t}](${t})${n}`}),t},ca=e=>{let{siteKey:n,onVerify:r,onError:A,loginUrl:s}=e;const c=i(null),u=i(null),d=i(!1),f=i(null),p=i(null),[g,h]=l(!1),[m,v]=l(0),w=i("widget_error"),b=i(null),E=s&&"/login"!==s,P=o(()=>{const e=window.turnstile;if(f.current&&(null==e?void 0:e.remove)){try{e.remove(f.current)}catch(e){}f.current=null}},[]),B=o(()=>{var e;P(),g?null==A||A(w.current,null!==(e=b.current)&&void 0!==e?e:void 0):null==A||A("user_cancelled")},[A,P,g]);a(()=>()=>{P()},[P]),a(()=>{var e;return p.current=document.activeElement,null===(e=u.current)||void 0===e||e.focus(),()=>{p.current&&"function"==typeof p.current.focus&&p.current.focus()}},[]),a(()=>{const e=e=>{if("Escape"===e.key)return e.preventDefault(),void B();if("Tab"===e.key&&u.current){const t=u.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0===t.length)return;const n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):e.shiftKey||document.activeElement!==r||(e.preventDefault(),n.focus())}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[B]),a(()=>{d.current||!c.current||g||(d.current=!0,aa().then(()=>{const e=window.turnstile;if(!e||!c.current)return _l("Turnstile API not available after script load"),w.current="api_unavailable",void h(!0);f.current=e.render(c.current,{sitekey:n,callback:e=>{jl("Visible challenge completed"),r(e)},"error-callback":e=>(_l("Turnstile challenge failed:",e),b.current=e,w.current="widget_error",P(),h(!0),!0),"expired-callback":()=>{_l("Turnstile token expired"),w.current="token_expired",P(),h(!0)}})}).catch(e=>{_l("Failed to load Turnstile script:",e),w.current="script_load_failed",h(!0)}))},[n,r,g]);const D=t.createElement(t.Fragment,null,t.createElement("div",{"aria-hidden":"true",style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.5)",zIndex:999998}}),t.createElement("div",{ref:u,role:"dialog","aria-modal":"true","aria-labelledby":"qa-bot-turnstile-label",tabIndex:-1,style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:999999,background:"white",padding:"24px",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.3)",maxWidth:"90vw",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'}},t.createElement("span",{id:"qa-bot-turnstile-label",className:"sr-only",style:{position:"absolute",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap"}},"Verification challenge"),g?t.createElement("div",{style:{fontSize:"14px",lineHeight:"1.5",color:"#333"}},0===m?t.createElement("p",{style:{margin:"0 0 16px 0"}},"Verification failed. You can try again",E&&t.createElement(t.Fragment,null,", or"," ",t.createElement("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--primaryColor, #107180)",fontWeight:"bold"}},"log in")," ","to skip verification"),"."):t.createElement(t.Fragment,null,t.createElement("p",{style:{margin:"0 0 8px 0"}},"Verification is still not working. This can be caused by browser extensions (ad blockers, privacy tools) or VPN connections."),t.createElement("p",{style:{margin:"0 0 16px 0"}},"Try disabling extensions, using a private/incognito window,",E&&t.createElement(t.Fragment,null," ",t.createElement("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--primaryColor, #107180)",fontWeight:"bold"}},"logging in"),",")," ","or using a different browser.")),t.createElement("div",{style:{display:"flex",gap:"8px"}},t.createElement("button",{type:"button",onClick:()=>{P(),d.current=!1,v(e=>e+1),h(!1)},style:{padding:"8px 16px",background:"var(--primaryColor, #107180)",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Try again"),t.createElement("button",{type:"button",onClick:B,style:{padding:"8px 16px",background:"#f0f0f0",color:"#333",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Close"))):t.createElement(t.Fragment,null,t.createElement("div",{ref:c,style:{borderRadius:"8px",overflow:"hidden"}}),t.createElement("button",{type:"button",onClick:B,style:{marginTop:"16px",padding:"8px 16px",background:"#f0f0f0",color:"#333",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Cancel"))));return y(D,document.body)};function ua(e){const{confidence:t,tools_used:n,metadata:r}=e;if(!(t||n&&0!==n.length))return"";const A=[];return t&&A.push(`• Confidence: ${t}`),n&&n.length>0&&A.push(`• Tools used: ${n.join(", ")}`),(null==r?void 0:r.agent)&&A.push(`• Agent: ${r.agent}`),`---\n${A.join("\n")}`}function da(e){let{getState:n,onResubmit:r,trackEvent:A,loginUrl:o}=e;var i,l;const[a,s]=t.useState(null),[c,u]=t.useState(0),d=n(),f=null!==(i=import.meta.env)&&void 0!==i?i:{},p="true"===f.VITE_FORCE_TURNSTILE_WIDGET,g=null!==(l=d.siteKey)&&void 0!==l?l:p?f.VITE_TURNSTILE_SITE_KEY:null;return g&&(p||a!==g)?t.createElement(ca,{key:c,siteKey:g,loginUrl:o,onVerify:async e=>{const t=g;d.token=e,null==A||A({type:"chatbot_turnstile_completed"});"needs_another_challenge"===await r(e)?u(e=>e+1):s(t)},onError:(e,t)=>{var n;const r=null===(n=d.pendingQuery)||void 0===n?void 0:n.queryId,o=g;d.token=null,d.pendingQuery=null,d.needsChallenge=!1,d.siteKey=null,s(o),null==A||A({type:"chatbot_turnstile_error",queryId:r,failureReason:e,cloudflareErrorCode:t})}}):null}const fa="#1a5b6e",pa="#107180",ga="Arial, sans-serif",ha="Q&A Bot",ma="/chat-icon.svg",va="Type your question here...",ya="Select an option to continue",wa=!1,ba="Ask me a question!",Ea="/login",Pa={general:{showHeader:!0,showFooter:!0},tooltip:{mode:"CLOSE"},chatInput:{disabled:!1,characterLimit:5e3,showCharacterCount:!1,allowNewline:!0,blockSpam:!1},chatWindow:{defaultOpen:!1,showScrollbar:!1},botBubble:{simulateStream:!0,streamSpeed:10,showAvatar:!1},userBubble:{showAvatar:!1},notification:{disabled:!0,showCount:!1},audio:{disabled:!0},emoji:{disabled:!0},fileAttachment:{disabled:!0}},Ba=n((e,n)=>{var r,A,c;const{apiKey:u,qaEndpoint:d,ratingEndpoint:f,capabilitiesEndpoint:p,agentRatingEndpoint:g,welcomeMessage:h,open:m,onOpenChange:v,isLoggedIn:y,allowAnonAccess:w=!1,actingUser:b,primaryColor:P,secondaryColor:B,botName:D,logo:C,placeholder:x,errorMessage:k,embedded:S,footerText:T,footerLink:I,tooltipText:Q,loginUrl:M,turnstileSiteKey:O,backendId:L,resourceContext:N,customFlow:H,onAnalyticsEvent:R}=e,F=i(`bot_${Math.random().toString(36).substr(2,9)}`);a(()=>{Hl()},[]);const U=i(null);null===U.current&&(U.current=Gl(),Rl("CREATED",U.current));const j=i(!1),z=i({getSessionId:()=>U.current,isResetting:()=>j.current}),_=i(null),q=function(e,t){const[n,r]=l(null),[A,s]=l("idle"),c=i(null),u=i(null),d=i(!0),f=o(()=>{const e=window.turnstile;if(u.current&&(null==e?void 0:e.remove)){try{e.remove(u.current)}catch(e){}u.current=null}c.current&&(c.current.remove(),c.current=null)},[]);return a(()=>{if(d.current=!0,!e)return s("idle"),void r(null);s("loading");const n=document.createElement("div");return n.style.position="fixed",n.style.left="-9999px",n.style.top="-9999px",n.style.width="0",n.style.height="0",n.style.overflow="hidden",n.setAttribute("aria-hidden","true"),document.body.appendChild(n),c.current=n,aa().then(()=>{if(!d.current)return;const n=window.turnstile;if(!n||!c.current)return _l("Turnstile API not available for silent verification"),s("failed"),void(null==t||t({type:"chatbot_turnstile_silent_failed",failureReason:"api_unavailable"}));const A=n.render(c.current,{sitekey:e,execution:"render","refresh-expired":"auto",callback:e=>{d.current&&(jl("Silent verification succeeded"),r(e),s("verified"))},"error-callback":e=>!d.current||(_l("Turnstile silent verification failed:",e),r(null),s("failed"),null==t||t({type:"chatbot_turnstile_silent_failed",failureReason:"widget_error",cloudflareErrorCode:e}),!0),"expired-callback":()=>{d.current&&(jl("Token expired, awaiting refresh"),r(null),s("loading"))}});u.current=A}).catch(e=>{d.current&&(_l("Failed to load Turnstile script for silent verification:",e),s("failed"),null==t||t({type:"chatbot_turnstile_silent_failed",failureReason:"script_load_failed"}))}),()=>{d.current=!1,f()}},[e,f]),{token:n,status:A,reset:o(()=>{const e=window.turnstile;u.current&&(null==e?void 0:e.reset)&&(r(null),s("loading"),e.reset(u.current),jl("Token consumed, resetting widget for fresh token"))},[])}}(O,e=>{var t;null===(t=_.current)||void 0===t||t.call(_,e)}),G=i(null);G.current=q.token;const[Y,W]=l(y);a(()=>{W(y)},[y]);const V=void 0!==S?S:wa,X=o(e=>{var t;R&&R(Object.assign(Object.assign({},e),{timestamp:Date.now(),sessionId:null!==(t=U.current)&&void 0!==t?t:void 0,pageUrl:"undefined"!=typeof window?window.location.href:void 0,isEmbedded:V}))},[R,V]);a(()=>{_.current=e=>X(e)},[X]);const K=s(()=>{const e=Object.assign({},Pa);e.general=Object.assign(Object.assign({},e.general),{primaryColor:P||fa,secondaryColor:B||pa,fontFamily:ga,embedded:V});const n=!1===Y?[t.createElement(Pl,{key:"login-button",loginUrl:M||Ea,isHeaderButton:!0})]:[t.createElement($l,{key:"history-button"}),t.createElement(Bl,{key:"user-icon"})];e.header={title:t.createElement("span",{style:{fontSize:14,fontWeight:500}},D||ha),showAvatar:!0,avatar:C||ma,buttons:[...n,E.CLOSE_CHAT_BUTTON]},e.chatInput=Object.assign(Object.assign({},e.chatInput),{disabled:!1,enabledPlaceholderText:x||va,disabledPlaceholderText:k||ya}),e.tooltip=Object.assign(Object.assign({},e.tooltip),{text:Q||ba});const r=T?I?t.createElement("a",{href:I,target:"_blank",rel:"noopener noreferrer",key:"footer-link"},T):t.createElement("span",{key:"footer-text"},T):null;return e.footer={text:null!=r?r:void 0,buttons:[t.createElement(na,{key:"new-chat-button"})]},e.chatWindow=Object.assign(Object.assign({},e.chatWindow),{defaultOpen:!!V}),e.event={rcbPreInjectMessage:!0,rcbPostInjectMessage:!0,rcbUserSubmitText:!0,rcbChangePath:!0,rcbToggleChatWindow:!0},e},[P,B,D,C,x,k,V,Q,Y,M,T,I]),J=i(null),Z=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s(()=>{const n=(t,n)=>{if(e.current){const n=getComputedStyle(e.current).getPropertyValue(t);if(n&&""!==n.trim())return n.trim();if(e.current.parentElement){const n=getComputedStyle(e.current.parentElement).getPropertyValue(t);if(n&&""!==n.trim())return n.trim()}}return n};return{primaryColor:n("--primaryColor",t.primaryColor),secondaryColor:n("--secondaryColor",t.secondaryColor),fontFamily:n("--fontFamily",t.fontFamily)}},[e,t])}(J,K.general);((e,t)=>{a(()=>{t.current&&(e?t.current.classList.add("bot-logged-in"):t.current.classList.remove("bot-logged-in"))},[e,t])})(!1!==Y,J),(e=>{let{settings:n,themeColors:r}=e;a(()=>{r&&(Object.entries(r).forEach(e=>{let[t,n]=e;n&&document.documentElement.style.setProperty(`--${t}`,n)}),r.primaryColor&&document.documentElement.style.setProperty("--rcb-header-background",r.primaryColor),r.secondaryColor&&document.documentElement.style.setProperty("--rcb-header-background-hover",r.secondaryColor))},[r]),a(()=>{var e,r;(null===(e=n.header)||void 0===e?void 0:e.title)&&"string"==typeof n.header.title&&(n.header.title=t.createElement("div",{key:"header-title"},t.createElement("h1",{className:"sr-only"},n.header.title),t.createElement("span",{"aria-hidden":"true"},n.header.title))),n.device={desktopEnabled:!0,mobileEnabled:!0,applyMobileOptimizations:!1},n.chatHistory={disabled:!0},n.chatButton=Object.assign(Object.assign({},n.chatButton),{icon:null===(r=n.header)||void 0===r?void 0:r.avatar}),n.event=Object.assign(Object.assign({},n.event),{rcbToggleChatWindow:!0})},[n])})({settings:K,themeColors:Z});const $=s(()=>{const e=(e=>{let{endpoint:n,ratingEndpoint:r,agentRatingEndpoint:A,apiKey:o,sessionId:i,isResetting:l=()=>!1,isLoggedIn:a,allowAnonAccess:s=!1,loginUrl:c="/login",trackEvent:u,getTurnstileToken:d,resetTurnstileToken:f,backendId:p,resourceContext:g}=e;if(!1===a&&!s)return null==u||u({type:"chatbot_login_prompt_shown"}),{qa_loop:{message:"To ask questions, please log in first.",component:t.createElement(Pl,{loginUrl:c}),chatDisabled:!0,path:"qa_loop"}};let h=null,m=null,v=!1;const y={siteKey:null,token:null,pendingQuery:null,needsChallenge:!1};let w=null;if(!n)throw new Error("Q&A endpoint is required");return{qa_loop:{message:async e=>{var t;w=e.injectMessage.bind(e);const{userInput:a}=e;if((!l||!l())&&a&&""!==a.trim()){if("👍 Helpful"===a||"👎 Not helpful"===a){if(h){const e="👍 Helpful"===a,t="agent"===m?A:r;if(t)try{const n={"Content-Type":"application/json"};o&&(n["X-API-KEY"]=o);const r=i();r&&(n["X-Session-ID"]=r,n["X-Query-ID"]=h);const A="agent"===m?{query_id:h,rating:e?"helpful":"not_helpful",session_id:r}:{sessionId:r,queryId:h,rating:e?1:0};await fetch(t,{method:"POST",headers:n,credentials:"include",body:JSON.stringify(A)}),null==u||u({type:"chatbot_rating_sent",queryId:h,rating:e?"helpful":"not_helpful"})}catch(e){_l("Error sending feedback:",e)}}return"Thanks for the feedback!"}try{const r=Sl();h=r,null==u||u({type:"chatbot_question_sent",queryId:r,questionLength:a.length});const A={"Content-Type":"application/json"};o&&(A["X-API-KEY"]=o);const l=i();l&&(A["X-Session-ID"]=l,A["X-Query-ID"]=r),A["X-Origin"]=g||"access";const s={query:a,question_id:r};l&&(s.session_id=l),p&&(s._backend=p),g&&(s.rp_name=g,s.resource_context=g);const c=null==d?void 0:d();c&&(s.turnstile_token=c),Rl("SENT to API",{session_id:l,question_id:r});const w=Date.now(),b=await fetch(n,{method:"POST",headers:A,credentials:"include",body:JSON.stringify(s)});if(!b.ok)throw new Error(`API returned ${b.status}`);if((b.headers.get("content-type")||"").includes("text/event-stream")){null==f||f();const n=null===(t=b.body)||void 0===t?void 0:t.getReader();if(!n)throw new Error("Response body is not readable");const A=new TextDecoder;let o="",i="",l=!1;try{for(;;){const{done:t,value:r}=await n.read();if(t)break;o+=A.decode(r,{stream:!0});let a=o.indexOf("\n\n");for(;-1!==a;){const t=o.slice(0,a);o=o.slice(a+2);let n,r="",A="";for(const e of t.split("\n"))e.startsWith("event: ")?r=e.slice(7):e.startsWith("data: ")&&(A=e.slice(6));if(r&&A){try{n=JSON.parse(A)}catch(e){zl("Failed to parse SSE data:",A),a=o.indexOf("\n\n");continue}if("status"===r){const t=n.message||"Processing...";await e.streamMessage(`_${t}_`,"BOT"),l=!0}else if("token"===r){i+=n.content||"";const t=sa(i);await e.streamMessage(t,"BOT")}else if("done"===r){const t=n.metadata||{};if(m=t.rating_target||null,v=!0===t.is_final_response,i)console.log("[SSE DEBUG] done: tokenContent exists, skipping streamMessage, calling endStreamMessage"),await e.endStreamMessage("BOT");else{const t=n.response||"";if(t){const n=sa(t);await e.streamMessage(n,"BOT"),l=!0}l&&await e.endStreamMessage("BOT")}}else if("error"===r){const t=n.message||"An error occurred";_l("SSE error event:",t),l?(await e.streamMessage(t,"BOT"),await e.endStreamMessage("BOT")):await e.injectMessage(t)}a=o.indexOf("\n\n")}else a=o.indexOf("\n\n")}}l&&await e.endStreamMessage("BOT")}catch(t){if(_l("Error reading SSE stream:",t),!l)throw t;await e.streamMessage("I had trouble completing the response. Please try again.","BOT"),await e.endStreamMessage("BOT")}const a=Date.now()-w;return void(null==u||u({type:"chatbot_answer_received",queryId:r,responseTimeMs:a,success:!0,responseLength:i.length}))}const E=Date.now()-w,P=await b.json();if(P.requires_turnstile)return null==u||u({type:"chatbot_turnstile_shown",queryId:r}),y.siteKey=P.site_key,y.pendingQuery={query:a,sessionId:l,queryId:r},y.needsChallenge=!0,"One moment — verifying your session…";null==f||f();const B=P.response||P.answer||P.text||P.message;if(!B)throw new Error("Invalid response format from API");const D=P.metadata||{};m=D.rating_target||null,v=!0===D.is_final_response;const C=sa(B),x=Tl()?ua(P):"",k=x?`${C}\n\n${x}`:C;return await e.injectMessage(k),void(null==u||u({type:"chatbot_answer_received",queryId:r,responseTimeMs:E,success:!0,responseLength:B.length,hasMetadata:!!x}))}catch(e){return _l("Error in Q&A flow:",e),null==u||u({type:"chatbot_answer_error",queryId:null!=h?h:void 0,errorType:e instanceof Error?e.message:"unknown"}),"I apologize, but I'm having trouble processing your question. Please try again later."}}},options:e=>l&&l()||"👍 Helpful"===e.userInput||"👎 Not helpful"===e.userInput||y.needsChallenge?[]:v&&m&&("agent"===m?A:r)?["👍 Helpful","👎 Not helpful"]:[],renderMarkdown:["BOT"],chatDisabled:!1,component:t.createElement(da,{getState:()=>y,onResubmit:async e=>{var t;if(!y.pendingQuery||!w)return _l("Turnstile resubmit called without pending query or injectMessage"),"error";try{const r={"Content-Type":"application/json"};o&&(r["X-API-KEY"]=o),y.pendingQuery.sessionId&&(r["X-Session-ID"]=y.pendingQuery.sessionId,r["X-Query-ID"]=y.pendingQuery.queryId),r["X-Origin"]=g||"access";const A={query:y.pendingQuery.query,question_id:y.pendingQuery.queryId,turnstile_token:e};y.pendingQuery.sessionId&&(A.session_id=y.pendingQuery.sessionId),p&&(A._backend=p),g&&(A.rp_name=g,A.resource_context=g);const i=await fetch(n,{method:"POST",headers:r,credentials:"include",body:JSON.stringify(A)}),l=y.pendingQuery.queryId;if(!i.ok)throw new Error(`API returned ${i.status} after Turnstile`);if((i.headers.get("content-type")||"").includes("text/event-stream")){const e=null===(t=i.body)||void 0===t?void 0:t.getReader();if(!e)throw new Error("Response body is not readable");const n=new TextDecoder;let r="",A="",o={};for(;;){const{done:t,value:i}=await e.read();if(t)break;r+=n.decode(i,{stream:!0});let l=r.indexOf("\n\n");for(;-1!==l;){const e=r.slice(0,l);r=r.slice(l+2);let t="",n="";for(const r of e.split("\n"))r.startsWith("event: ")?t=r.slice(7):r.startsWith("data: ")&&(n=r.slice(6));if(t&&n)try{const e=JSON.parse(n);"token"===t?A+=e.content||"":"done"===t&&(o=e.metadata||{})}catch(e){}l=r.indexOf("\n\n")}}if(y.token=null,y.pendingQuery=null,y.needsChallenge=!1,y.siteKey=null,!A)throw new Error("No content received from stream");m=o.rating_target||null,v=!0===o.is_final_response,h=l;const a=sa(A);return await w(a),null==u||u({type:"chatbot_answer_received",queryId:l,success:!0,responseLength:A.length}),"success"}const a=await i.json();if(a.requires_turnstile)return y.siteKey=a.site_key,y.token=null,await w("Still verifying — please complete the challenge again."),"needs_another_challenge";y.token=null,y.pendingQuery=null,y.needsChallenge=!1,y.siteKey=null;const s=a.response||a.answer||a.text||a.message;if(!s)throw new Error("Invalid response format from API");const c=a.metadata||{};m=c.rating_target||null,v=!0===c.is_final_response,h=l;const d=sa(s),f=Tl()?ua(a):"",b=f?`${d}\n\n${f}`:d;return await w(b),null==u||u({type:"chatbot_answer_received",queryId:l,success:!0,responseLength:s.length}),"success"}catch(e){return _l("Error resubmitting after Turnstile:",e),y.token=null,y.pendingQuery=null,y.needsChallenge=!1,y.siteKey=null,await(null==w?void 0:w("I had trouble processing your question after verification. Please try again.")),"error"}},trackEvent:u,loginUrl:c}),path:"qa_loop"}}})({endpoint:d,ratingEndpoint:f,agentRatingEndpoint:g,apiKey:u,sessionId:z.current.getSessionId,isResetting:z.current.isResetting,isLoggedIn:Y,allowAnonAccess:w,loginUrl:M||Ea,trackEvent:X,getTurnstileToken:()=>G.current,resetTurnstileToken:()=>q.reset(),backendId:L,resourceContext:N}),n={message:h,renderMarkdown:["BOT"],transition:{duration:0},path:"qa_loop"};return Object.assign(Object.assign({start:n},e),H||{})},[u,d,f,g,h,Y,w,M,H,b,X,N,L]),ee=s(()=>{return[()=>On(t),gl(),()=>vl(e)];var e,t},[]);return a(()=>{const e=()=>{const e=document.querySelector(".rcb-chat-window");if(!e)return;const t=e.querySelector(".rcb-send-button");t&&(t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.hasAttribute("data-keyboard-enabled")||(t.setAttribute("data-keyboard-enabled","true"),t.addEventListener("keydown",e=>{if("Enter"===e.key||" "===e.key){e.preventDefault();const n=t&&Object.keys(t).find(e=>e.startsWith("__reactProps"));if(n){const r=t[n],A=null==r?void 0:r.onMouseDown;if(A&&"function"==typeof A)return void A(e)}const r=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(r)}})))},t=setInterval(e,1e3);return e(),()=>clearInterval(t)},[]),oa(),a(()=>{const e=J.current;if(!e)return;const t=e=>{var t,n,r;const A=null===(n=(t=e.target).closest)||void 0===n?void 0:n.call(t,"a");A&&A.closest(".rcb-chat-body-container")&&(A.classList.contains("qa-bot-login-button")||A.closest(".rcb-options-container")||X({type:"chatbot_link_clicked",linkUrl:A.href,linkText:(null===(r=A.textContent)||void 0===r?void 0:r.trim())||""}))};return e.addEventListener("click",t),()=>e.removeEventListener("click",t)},[X]),a(()=>{if(!V){const e=e=>{const t=e.data.newState;null==v||v(t);const n=U.current;X(t?{type:"chatbot_open"}:{type:"chatbot_close",messageCount:n?Vl(n):0,durationMs:n?Xl(n):0})};return window.addEventListener("rcb-toggle-chat-window",e),()=>{window.removeEventListener("rcb-toggle-chat-window",e)}}},[V,v,X]),t.createElement("div",{className:"qa-bot "+((null===(r=K.general)||void 0===r?void 0:r.embedded)?"embedded-qa-bot":""),ref:J,role:"region","aria-label":`${D||ha}${(null===(A=K.general)||void 0===A?void 0:A.embedded)?" - Embedded":""}`},t.createElement(Jl,{getSessionId:()=>U.current,setSessionId:e=>{const t=U.current;U.current=e,Rl("RESTORED",`${null==t?void 0:t.slice(-12)} -> ${e.slice(-12)}`)},resetSession:()=>{const e=U.current;j.current=!0,U.current=Gl(),Rl("RESET",`${null==e?void 0:e.slice(-12)} -> ${U.current.slice(-12)}`)},clearResettingFlag:()=>{j.current=!1}},t.createElement(bl,{trackEvent:X},t.createElement(Wt,null,t.createElement("div",null,t.createElement(Aa,null),t.createElement(yl,{ref:n,embedded:(null===(c=K.general)||void 0===c?void 0:c.embedded)||!1,currentOpen:m||!1,enabled:!1!==Y,onSetEnabled:e=>W(!!e&&void 0)}),t.createElement(Jt,{key:`chatbot-${F.current}-${Y}`,settings:K,flow:$,plugins:ee}),t.createElement("div",{role:"status","aria-live":"polite","aria-label":"Bot response updates",className:"sr-only",id:"bot-live-region",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}}),t.createElement("div",{id:"chat-input-help",className:"sr-only",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}},"Type your message and press Enter to send. Use arrow keys to navigate through response options."))))))});Ba.displayName="QABot";const Da=()=>{const[e,t]=l(!1),n=()=>"undefined"!=typeof navigator&&void 0!==navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getDisplayMedia;return{captureScreenshot:async()=>{if(!n())throw new Error("Screen capture is not available in this environment");try{t(!0);const e=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",cursor:"always",width:{ideal:1920},height:{ideal:1080}},audio:!1}),n=document.createElement("video");n.srcObject=e,await new Promise(e=>{n.onloadedmetadata=()=>{n.play(),e()}});const r=document.createElement("canvas");r.width=n.videoWidth,r.height=n.videoHeight;const A=r.getContext("2d");if(!A)throw new Error("Could not get canvas context");A.drawImage(n,0,0,r.width,r.height);const o=await new Promise(e=>r.toBlob(e,"image/png"));if(!o)throw new Error("Could not create image blob");const i=(new Date).toISOString().replace(/[:.]/g,"-"),l=new File([o],`screenshot-${i}.png`,{type:"image/png"});return e.getTracks().forEach(e=>e.stop()),t(!1),l}catch(e){throw _l("Error capturing screenshot:",e),t(!1),e}},isCapturing:e,isScreenCaptureAvailable:n()}},Ca=e=>t.createElement(ea,e,t.createElement("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),t.createElement("polyline",{points:"17 8 12 3 7 8"}),t.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),xa=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{if("string"!=typeof r.result)return void n(new Error(`Failed to read file ${e.name}`));const A=r.result.split(",")[1];t({fileName:e.name,contentType:e.type,size:e.size,fileData:A})},r.onerror=()=>n(new Error(`Failed to read file ${e.name}`)),r.readAsDataURL(e)}),ka=e=>Promise.all(e.map(xa)),Sa=function(e){const t=1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:10)*1024;return e.size<=t},Ta=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`,Ia=e=>{let{onFileUpload:n,maxSizeMB:r=10,acceptedTypes:A="image/*,application/pdf,text/*,.doc,.docx",enableScreenshot:o=!1,className:a}=e;const[s,c]=l(!1),[u,d]=l([]),[f,p]=l(null),g=i(null),{captureScreenshot:h,isCapturing:m,isScreenCaptureAvailable:v}=Da(),y=e=>{const t=document.createElement("div");t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="sr-only",t.textContent=e,document.body.appendChild(t),setTimeout(()=>document.body.removeChild(t),1e3)},w=e=>{if(!e||0===e.length)return void zl("FileUploadComponent: No valid files provided to handleFiles");let t;try{t=Array.from(e)}catch(e){return _l("FileUploadComponent: Error converting files to array:",e),void y("Error processing selected files. Please try again.")}const r=[...u,...t];d(r);const A=t.length,o=t.map(e=>e.name).join(", ");y(`${A} file${A>1?"s":""} selected: ${o}`),setTimeout(()=>{const e=document.querySelector(".rcb-chat-content");e&&(e.scrollTop=e.scrollHeight)},100),n&&n(r)},b=e=>{e.preventDefault(),e.stopPropagation(),"dragenter"===e.type||"dragover"===e.type?c(!0):"dragleave"===e.type&&c(!1)},E=()=>{try{g.current&&g.current.click()}catch(e){_l("FileUploadComponent: Error in handleButtonClick:",e),y("Error opening file selection dialog. Please try again.")}},P=()=>{p(null)},B=o&&v;return t.createElement("div",{className:`file-upload-container ${a||""}`,style:{padding:"16px",margin:"8px 0"}},B&&t.createElement("div",{style:{display:"flex",justifyContent:"center",marginBottom:"10px"}},t.createElement("button",{onClick:e=>{e.preventDefault(),(async()=>{try{const e=await h();w([e]),y("Screenshot captured successfully")}catch(e){y("Error capturing screenshot. Please try again.")}})()},disabled:m,"aria-describedby":"screenshot-help","aria-label":m?"Taking screenshot, please wait":"Take a screenshot to attach",style:{display:"flex",alignItems:"center",gap:"8px",backgroundColor:"#107180",color:"white",border:"none",borderRadius:"5px",padding:"8px 12px",cursor:m?"not-allowed":"pointer",fontSize:"14px",fontWeight:"500",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}},t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("path",{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"}),t.createElement("circle",{cx:"12",cy:"13",r:"4"})),m?"Taking screenshot...":"Take screenshot..."),t.createElement("span",{id:"screenshot-help",className:"sr-only"},"Captures the current screen and adds it as an attachment")),t.createElement("div",{className:"file-upload-dropzone "+(s?"active":""),onDragEnter:b,onDragLeave:b,onDragOver:b,onDrop:e=>{var t;e.preventDefault(),e.stopPropagation(),c(!1);try{(null===(t=e.dataTransfer)||void 0===t?void 0:t.files)&&e.dataTransfer.files.length>0&&w(e.dataTransfer.files)}catch(e){_l("FileUploadComponent: Error in handleDrop:",e),y("Error processing dropped files. Please try again.")}},role:"button",tabIndex:0,"aria-label":"File upload area. Click to select files or drag and drop files here.","aria-describedby":"upload-instructions",onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),E())},style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",backgroundColor:s?"#f0f8ff":"#fafafa",transition:"all 0.3s ease"}},t.createElement("input",{ref:g,type:"file",className:"file-input",onChange:e=>{var t;try{(null===(t=e.target)||void 0===t?void 0:t.files)&&e.target.files.length>0&&w(e.target.files)}catch(e){_l("FileUploadComponent: Error in handleFileSelect:",e),y("Error processing selected files. Please try again.")}},multiple:!0,style:{display:"none"},"aria-label":"Select files to upload",accept:A}),t.createElement("div",{className:"upload-content",onClick:E,style:{cursor:"pointer",flexDirection:"column",alignItems:"center",display:"flex",textAlign:"center",padding:"12px"}},t.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}},t.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"}},t.createElement(Ca,null),t.createElement("p",{style:{margin:0,fontWeight:"bold"}},"Upload Files")),t.createElement("p",{id:"upload-instructions",style:{margin:0,fontSize:"14px",color:"#666"}},"Drag and drop files here or click to select. (Max ",r,"MB each)")),u.length>0&&t.createElement("div",{className:"selected-files",style:{display:"flex",flexWrap:"wrap",gap:"8px",marginTop:"12px",alignItems:"center"}},t.createElement("span",{style:{fontWeight:400,color:"#888",fontSize:"13px",marginRight:"8px",alignSelf:"center"}},"Selected files:"),u.map((e,r)=>t.createElement("span",{key:r,style:{background:"#fff",color:"#107180",borderRadius:"5px",padding:"4px 12px",fontSize:"14px",marginRight:"4px",marginBottom:"4px",border:"1px solid #ccc",display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},onClick:t=>{t.stopPropagation(),(e=>{p(e)})(e)}},t.createElement("span",{onClick:e=>{e.stopPropagation(),(e=>{const t=u.filter((t,n)=>n!==e);d(t),n&&n(t)})(r)},style:{cursor:"pointer",color:"#888",fontWeight:"bold",fontSize:"15px",marginRight:"4px",userSelect:"none",lineHeight:1},title:"Remove file","aria-label":`Remove ${e.name}`},"×"),e.name," (",Ta(e.size),")"))))),(()=>{if(!f)return null;const e=f.type.startsWith("image/"),n=f.type.startsWith("text/"),r="application/pdf"===f.type;return t.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3},onClick:P},t.createElement("div",{style:{backgroundColor:"white",padding:"20px",borderRadius:"8px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",position:"relative"},onClick:e=>e.stopPropagation()},t.createElement("button",{onClick:P,style:{position:"absolute",top:"10px",right:"10px",background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#666"}},"×"),t.createElement("h3",{style:{marginTop:0,marginBottom:"16px"}},f.name),e&&t.createElement("img",{src:URL.createObjectURL(f),alt:f.name,style:{maxWidth:"100%",maxHeight:"70vh"}}),n&&t.createElement("pre",{style:{whiteSpace:"pre-wrap",wordWrap:"break-word",maxHeight:"70vh",overflow:"auto",padding:"16px",backgroundColor:"#f5f5f5",borderRadius:"4px"}},URL.createObjectURL(f)),r&&t.createElement("iframe",{src:URL.createObjectURL(f),style:{width:"100%",height:"70vh",border:"none"},title:f.name}),!e&&!n&&!r&&t.createElement("div",{style:{padding:"20px",textAlign:"center"}},"Preview not available for this file type")))})())};function Qa(e,t){if(!t||0===Object.keys(t).length)return e;const n={};for(const[r,A]of Object.entries(e)){let e=Object.assign({},A);if(t.disableOnOptions&&void 0===e.chatDisabled){const t=!(!e.options&&!e.checkboxes);e.chatDisabled=t}n[r]=e}return n}function Ma(e){return async t=>{await t.injectMessage(e)}}function Oa(e){return async t=>{const n=await e(t);await t.injectMessage(n)}}const La=t.forwardRef((e,n)=>{var{defaultOpen:r}=e,A=b(e,["defaultOpen"]);const[o,i]=t.useState(r||!1),l=t.useRef(null);return t.useImperativeHandle(n,()=>({addMessage:e=>{var t;null===(t=l.current)||void 0===t||t.addMessage(e)},setBotEnabled:e=>{var t;null===(t=l.current)||void 0===t||t.setBotEnabled(e)},openChat:()=>{var e;i(!0),null===(e=l.current)||void 0===e||e.openChat()},closeChat:()=>{var e;i(!1),null===(e=l.current)||void 0===e||e.closeChat()},toggleChat:()=>{var e;i(e=>!e),null===(e=l.current)||void 0===e||e.toggleChat()}}),[]),t.createElement(Ba,w({ref:l},A,{open:o,onOpenChange:i}))});function Na(e){if(!(e.target&&e.target instanceof HTMLElement))return void _l("QA Bot: A valid target DOM element is required");const{target:n}=e,r=b(e,["target"]),A=p.createRoot(n),o={current:null};return A.render(t.createElement(t.StrictMode,null,t.createElement(La,w({ref:e=>{o.current=e}},r)))),{addMessage:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.addMessage(e)},setBotEnabled:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.setBotEnabled(e)},openChat:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.openChat()},closeChat:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.closeChat()},toggleChat:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.toggleChat()},destroy:()=>{o.current=null,A.unmount()}}}La.displayName="ProgrammaticQABot";export{Ia as FileUploadComponent,Ba as QABot,Qa as applyFlowSettings,Na as default,xa as fileToBase64,ka as filesToBase64,Ta as formatFileSize,Na as qaBot,Da as useScreenshotCapture,Sa as validateFileSize,Ma as withHistory,Oa as withHistoryFn};
9
9
  //# sourceMappingURL=qa-bot-core.js.map