@snf/qa-bot-core 0.3.2 → 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.
- package/dist/qa-bot-core.css +1 -1
- package/dist/qa-bot-core.js +1 -1
- package/dist/qa-bot-core.js.map +1 -1
- package/dist/qa-bot-core.standalone.js +1 -1
- package/dist/qa-bot-core.standalone.js.map +1 -1
- package/dist/qa-bot-core.umd.cjs +1 -1
- package/dist/qa-bot-core.umd.cjs.map +1 -1
- package/package.json +10 -1
package/dist/qa-bot-core.umd.cjs
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Copyright(c) 2015 Andreas Lubbe
|
|
6
6
|
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
|
7
7
|
* MIT Licensed
|
|
8
|
-
*/var rn,An;const on=nn(function(){if(An)return rn;An=1;var e=/["'&<>]/;return rn=function(t){var n=""+t,r=e.exec(n);if(!r)return n;var A,o="",i=0,s=0;for(i=r.index;i<n.length;i++){switch(n.charCodeAt(i)){case 34:A=""";break;case 38:A="&";break;case 39:A="'";break;case 60:A="<";break;case 62:A=">";break;default:continue}s!==i&&(o+=n.substring(s,i)),s=i+1,o+=A}return s!==i?o+n.substring(s,i):o}}());function sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const an=/(url|image|image-set)\(/i;class ln extends tn{attribute(e,t){return"style"===e&&Object.keys(t).forEach(e=>{String(t[e]).match(an)&&delete t[e]}),t}}const cn=/^<(!doctype|(html|head|body)(\s|>))/i,un=/^(aria-|data-|\w+:)/iu,dn=/{{{(\w+)\/?}}}/;function fn(){if(!(typeof window>"u"||typeof document>"u"))return document.implementation.createHTMLDocument("Interweave")}let pn=class{constructor(e,t={},n=[],r=[]){var A;if(sn(this,"allowed",void 0),sn(this,"banned",void 0),sn(this,"blocked",void 0),sn(this,"container",void 0),sn(this,"content",[]),sn(this,"props",void 0),sn(this,"matchers",void 0),sn(this,"filters",void 0),sn(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 ln],this.keyIndex=-1,this.container=this.createContainer(e||""),this.allowed=new Set(null!==(A=t.allowList)&&void 0!==A?A:Kt),this.banned=new Set(Xt),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 s=e.asTag().toLowerCase(),a=this.getTagConfig(s);if(r[e.inverseName]||!this.isTagAllowed(s)||!this.canRenderChild(t,a))return;let l="";for(;A&&(i=e.match(A));){const{index:t,length:s,match:a,valid:c,void:u,...d}=i,f=e.propName+String(o);t>0&&(l+=A.slice(0,t)),c?(l+=u?`{{{${f}/}}}`:`{{{${f}}}}${a}{{{/${f}}}}`,this.keyIndex+=1,o+=1,n[f]={children:a,matcher:e,props:{...r,...d,key:this.keyIndex}}):l+=a,e.greedy?(A=l+A.slice(t+s),l=""):A=A.slice(t+(s||a.length))}e.greedy||(A=l+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||fn)();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(cn)){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?on(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,s=o.toLowerCase(),a=Jt[s]||Jt[o];if(!this.isSafe(e)||!s.match(un)&&(!t&&(!a||2===a)||s.startsWith("on")||i.replace(/(\s|\0|�([9AD]);)/,"").match(/(javascript|vbscript|livescript|xss):/i)))return;let l="style"===s?this.extractStyleAttribute(e):i;4===a?l=!0:3===a?l=Number.parseFloat(String(l)):5!==a&&(l=String(l)),n[Zt[s]||s]=this.applyAttributeFilters(s,l),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 Vt[e]?{...t,...Vt[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(t,n){const{noHtml:r,noHtmlExceptMatchers:A,allowElements:o,transform:i,transformOnlyAllowList:s}=this.props;let a=[],l="";return[...t.childNodes].forEach(t=>{if(1===t.nodeType){const u=t.nodeName.toLowerCase(),d=this.getTagConfig(u);l&&(a.push(l),l="");const f=this.applyNodeFilters(u,t);if(!f)return;let p;if(i&&(!s||this.isTagAllowed(u))){this.keyIndex+=1;const t=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(e.cloneElement(n,{key:t}));this.keyIndex=t-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 t=this.extractAttributes(f),n={tagName:u};t&&(n.attributes=t),d.void&&(n.selfClose=d.void),a.push(e.createElement(en,{...n,key:this.keyIndex},null!==(c=p)&&void 0!==c?c:this.parseNode(f,d)))}}else if(3===t.nodeType){const e=r&&!A?t.textContent:this.applyMatchers(t.textContent||"",n);Array.isArray(e)?a=[...a,...e]:l+=e}}),l&&a.push(l),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,s=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:l,props:c}=t[o];let u;if(s)u=e.length,n.push(l.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(l.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 gn(t){var n;const{attributes:r,className:A,containerTagName:o,content:i,emptyContent:s,parsedContent:a,tagName:l,noWrap:c}=t,u=null!==(n=o??l)&&void 0!==n?n:"span",d="fragment"===u||c;let f;if(a)f=a;else{const e=new pn(i??"",t).parse();e.length>0&&(f=e)}return f||(f=s),d?e.createElement(e.Fragment,null,f):e.createElement(en,{attributes:r,className:A,tagName:u},f)}function hn(t){const{attributes:n,className:r,content:A="",disableFilters:o=!1,disableMatchers:i=!1,emptyContent:s=null,filters:a=[],matchers:l=[],onAfterParse:c=null,onBeforeParse:u=null,tagName:d="span",noWrap:f=!1,...p}=t,g=i?[]:l,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((e,n)=>{const r=n(e,t);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 pn(y,p,g,h),b=v.reduce((e,n)=>{const r=n(e,t);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 e.createElement(gn,{attributes:n,className:r,containerTagName:t.containerTagName,emptyContent:s,noWrap:f,parsedContent:0===b.length?void 0:b,tagName:d})}const mn=({children:e})=>n.jsx("div",{style:{whiteSpace:"normal"},children:n.jsx(hn,{content:"string"==typeof e?e:""})}),vn={autoConfig:!0},yn=(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)},wn=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},bn=t=>{const{getFlow:n}=Ft(),{messages:r,replaceMessages:A}=Ut(),{settings:o}=_t(),{hasChatHistoryLoaded:i}=Gt(),s={...t,...vn},a=s.htmlComponent?s.htmlComponent:mn;e.useEffect(()=>{var e,t;if(i){const n=[...r];for(let r=0;r<n.length&&r<((null==(e=o.chatHistory)?void 0:e.maxEntries)??30);r++){const e=n[r];null!=(t=e.tags)&&t.includes("rcb-html-renderer-plugin:parsed")&&(e.contentWrapper=a)}A(n)}},[i]);const l=async e=>{var t;const r=null==(t=e.data.message)?void 0:t.sender.toUpperCase();"string"==typeof e.data.message.content&&yn(e,n(),r)&&("rcb-start-simulate-stream-message"===e.type&&(e.data.simulateStreamChunker=wn),e.data.message.contentWrapper=a,e.data.message.tags||(e.data.message.tags=[]),e.data.message.tags.push("rcb-html-renderer-plugin:parsed"))};zt(N.PRE_INJECT_MESSAGE,l),zt(N.CHUNK_STREAM_MESSAGE,l),zt(N.START_STREAM_MESSAGE,l),zt(N.START_SIMULATE_STREAM_MESSAGE,l),zt(N.START_SPEAK_AUDIO,async e=>{yn(e,n(),"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!=s&&s.autoConfig&&(c.settings={event:{rcbPreInjectMessage:!0,rcbChunkStreamMessage:!0,rcbStartSimulateStreamMessage:!0,rcbStartStreamMessage:!0,rcbStartSpeakAudio:!0}}),c};const En=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xn=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pn={};function Bn(e,t){return(Pn.jsx?xn:En).test(e)}const Cn=/[ \t\n\f\r]/g;function Dn(e){return""===e.replace(Cn,"")}class kn{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}}function Sn(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 kn(n,r,t)}function Tn(e){return e.toLowerCase()}kn.prototype.property={},kn.prototype.normal={},kn.prototype.space=null;class In{constructor(e,t){this.property=e,this.attribute=t}}In.prototype.space=null,In.prototype.boolean=!1,In.prototype.booleanish=!1,In.prototype.overloadedBoolean=!1,In.prototype.number=!1,In.prototype.commaSeparated=!1,In.prototype.spaceSeparated=!1,In.prototype.commaOrSpaceSeparated=!1,In.prototype.mustUseProperty=!1,In.prototype.defined=!1;let Qn=0;const Mn=Fn(),On=Fn(),Ln=Fn(),jn=Fn(),Rn=Fn(),Nn=Fn(),Hn=Fn();function Fn(){return 2**++Qn}const Un=Object.freeze(Object.defineProperty({__proto__:null,boolean:Mn,booleanish:On,commaOrSpaceSeparated:Hn,commaSeparated:Nn,number:jn,overloadedBoolean:Ln,spaceSeparated:Rn},Symbol.toStringTag,{value:"Module"})),zn=Object.keys(Un);class _n extends In{constructor(e,t,n,r){let A=-1;if(super(e,t),qn(this,"space",r),"number"==typeof n)for(;++A<zn.length;){const e=zn[A];qn(this,zn[A],(n&Un[e])===Un[e])}}}function qn(e,t,n){n&&(e[t]=n)}_n.prototype.defined=!0;const Gn={}.hasOwnProperty;function Yn(e){const t={},n={};let r;for(r in e.properties)if(Gn.call(e.properties,r)){const A=e.properties[r],o=new _n(r,e.transform(e.attributes||{},r),A,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Tn(r)]=r,n[Tn(o.attribute)]=r}return new kn(t,n,e.space)}const Wn=Yn({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}}),Vn=Yn({space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Xn(e,t){return t in e?e[t]:t}function Kn(e,t){return Xn(e,t.toLowerCase())}const Jn=Yn({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:Kn,properties:{xmlns:null,xmlnsXLink:null}}),Zn=Yn({transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:On,ariaAutoComplete:null,ariaBusy:On,ariaChecked:On,ariaColCount:jn,ariaColIndex:jn,ariaColSpan:jn,ariaControls:Rn,ariaCurrent:null,ariaDescribedBy:Rn,ariaDetails:null,ariaDisabled:On,ariaDropEffect:Rn,ariaErrorMessage:null,ariaExpanded:On,ariaFlowTo:Rn,ariaGrabbed:On,ariaHasPopup:null,ariaHidden:On,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rn,ariaLevel:jn,ariaLive:null,ariaModal:On,ariaMultiLine:On,ariaMultiSelectable:On,ariaOrientation:null,ariaOwns:Rn,ariaPlaceholder:null,ariaPosInSet:jn,ariaPressed:On,ariaReadOnly:On,ariaRelevant:null,ariaRequired:On,ariaRoleDescription:Rn,ariaRowCount:jn,ariaRowIndex:jn,ariaRowSpan:jn,ariaSelected:On,ariaSetSize:jn,ariaSort:null,ariaValueMax:jn,ariaValueMin:jn,ariaValueNow:jn,ariaValueText:null,role:null}}),$n=Yn({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:Kn,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Nn,acceptCharset:Rn,accessKey:Rn,action:null,allow:null,allowFullScreen:Mn,allowPaymentRequest:Mn,allowUserMedia:Mn,alt:null,as:null,async:Mn,autoCapitalize:null,autoComplete:Rn,autoFocus:Mn,autoPlay:Mn,blocking:Rn,capture:null,charSet:null,checked:Mn,cite:null,className:Rn,cols:jn,colSpan:null,content:null,contentEditable:On,controls:Mn,controlsList:Rn,coords:jn|Nn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Mn,defer:Mn,dir:null,dirName:null,disabled:Mn,download:Ln,draggable:On,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Mn,formTarget:null,headers:Rn,height:jn,hidden:Mn,high:jn,href:null,hrefLang:null,htmlFor:Rn,httpEquiv:Rn,id:null,imageSizes:null,imageSrcSet:null,inert:Mn,inputMode:null,integrity:null,is:null,isMap:Mn,itemId:null,itemProp:Rn,itemRef:Rn,itemScope:Mn,itemType:Rn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Mn,low:jn,manifest:null,max:null,maxLength:jn,media:null,method:null,min:null,minLength:jn,multiple:Mn,muted:Mn,name:null,nonce:null,noModule:Mn,noValidate:Mn,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:Mn,optimum:jn,pattern:null,ping:Rn,placeholder:null,playsInline:Mn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Mn,referrerPolicy:null,rel:Rn,required:Mn,reversed:Mn,rows:jn,rowSpan:jn,sandbox:Rn,scope:null,scoped:Mn,seamless:Mn,selected:Mn,shadowRootClonable:Mn,shadowRootDelegatesFocus:Mn,shadowRootMode:null,shape:null,size:jn,sizes:null,slot:null,span:jn,spellCheck:On,src:null,srcDoc:null,srcLang:null,srcSet:null,start:jn,step:null,style:null,tabIndex:jn,target:null,title:null,translate:null,type:null,typeMustMatch:Mn,useMap:null,value:On,width:jn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rn,axis:null,background:null,bgColor:null,border:jn,borderColor:null,bottomMargin:jn,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Mn,declare:Mn,event:null,face:null,frame:null,frameBorder:null,hSpace:jn,leftMargin:jn,link:null,longDesc:null,lowSrc:null,marginHeight:jn,marginWidth:jn,noResize:Mn,noHref:Mn,noShade:Mn,noWrap:Mn,object:null,profile:null,prompt:null,rev:null,rightMargin:jn,rules:null,scheme:null,scrolling:On,standby:null,summary:null,text:null,topMargin:jn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:jn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Mn,disableRemotePlayback:Mn,prefix:null,property:null,results:jn,security:null,unselectable:null}}),er=Yn({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:Xn,properties:{about:Hn,accentHeight:jn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:jn,amplitude:jn,arabicForm:null,ascent:jn,attributeName:null,attributeType:null,azimuth:jn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:jn,by:null,calcMode:null,capHeight:jn,className:Rn,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:jn,diffuseConstant:jn,direction:null,display:null,dur:null,divisor:jn,dominantBaseline:null,download:Mn,dx:null,dy:null,edgeMode:null,editable:null,elevation:jn,enableBackground:null,end:null,event:null,exponent:jn,externalResourcesRequired:null,fill:null,fillOpacity:jn,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:Nn,g2:Nn,glyphName:Nn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:jn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:jn,horizOriginX:jn,horizOriginY:jn,id:null,ideographic:jn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:jn,k:jn,k1:jn,k2:jn,k3:jn,k4:jn,kernelMatrix:Hn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:jn,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:jn,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:jn,overlineThickness:jn,paintOrder:null,panose1:null,path:null,pathLength:jn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:jn,pointsAtY:jn,pointsAtZ:jn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Hn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Hn,rev:Hn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Hn,requiredFeatures:Hn,requiredFonts:Hn,requiredFormats:Hn,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:jn,specularExponent:jn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:jn,strikethroughThickness:jn,string:null,stroke:null,strokeDashArray:Hn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:jn,strokeOpacity:jn,strokeWidth:null,style:null,surfaceScale:jn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Hn,tabIndex:jn,tableValues:null,target:null,targetX:jn,targetY:jn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Hn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:jn,underlineThickness:jn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:jn,values:null,vAlphabetic:jn,vMathematical:jn,vectorEffect:null,vHanging:jn,vIdeographic:jn,version:null,vertAdvY:jn,vertOriginX:jn,vertOriginY:jn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:jn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),tr=/^data[-\w.:]+$/i,nr=/-[a-z]/g,rr=/[A-Z]/g;function Ar(e){return"-"+e.toLowerCase()}function or(e){return e.charAt(1).toUpperCase()}const ir={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"},sr=Sn([Vn,Wn,Jn,Zn,$n],"html"),ar=Sn([Vn,Wn,Jn,Zn,er],"svg");function lr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cr,ur,dr,fr={};var pr=function(){if(dr)return fr;dr=1;var e=fr&&fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fr,"__esModule",{value:!0}),fr.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(ur)return cr;ur=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,A=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,s=/^\s+|\s+$/g,a="";function l(e){return e?e.replace(s,a):a}return cr=function(s,c){if("string"!=typeof s)throw new TypeError("First argument must be a string");if(!s)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=s,!c.silent)throw t}function m(e){var t=e.exec(s);if(t){var n=t[0];return f(n),s=s.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("/"==s.charAt(0)&&"*"==s.charAt(1)){for(var t=2;a!=s.charAt(t)&&("*"!=s.charAt(t)||"/"!=s.charAt(t+1));)++t;if(t+=2,a===s.charAt(t-1))return h("End of comment missing");var n=s.slice(2,t-2);return d+=2,f(n),s=s.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 s=m(o),c=t({type:"declaration",property:l(n[0].replace(e,a)),value:s?l(s[0].replace(e,a)):a});return m(i),c}}return g.prototype.content=s,v(),function(){var e,t=[];for(y(t);e=b();)!1!==e&&(t.push(e),y(t));return t}()},cr}());return fr}();const gr=lr(pr),hr=gr.default||gr,mr=yr("end"),vr=yr("start");function yr(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 wr(e){return e&&"object"==typeof e?"position"in e||"type"in e?Er(e.position):"start"in e||"end"in e?Er(e):"line"in e||"column"in e?br(e):"":""}function br(e){return xr(e&&e.line)+":"+xr(e&&e.column)}function Er(e){return br(e&&e.start)+"-"+br(e&&e.end)}function xr(e){return e&&"number"==typeof e?e:1}class Pr 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=wr(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}}Pr.prototype.file="",Pr.prototype.name="",Pr.prototype.reason="",Pr.prototype.message="",Pr.prototype.stack="",Pr.prototype.column=void 0,Pr.prototype.line=void 0,Pr.prototype.ancestors=void 0,Pr.prototype.cause=void 0,Pr.prototype.fatal=void 0,Pr.prototype.place=void 0,Pr.prototype.ruleId=void 0,Pr.prototype.source=void 0;const Br={}.hasOwnProperty,Cr=new Map,Dr=/[A-Z]/g,kr=/-([a-z])/g,Sr=new Set(["table","tbody","thead","tfoot","tr"]),Tr=new Set(["td","th"]),Ir="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Qr(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),s=vr(n);return t(r,A,o,i,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.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?ar:sr,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},o=Mr(A,e,void 0);return o&&"string"!=typeof o?o:A.create(e,A.Fragment,{children:o||void 0},void 0)}function Mr(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=ar,e.schema=A),e.ancestors.push(t);const o=Nr(e,t.tagName,!1),i=function(e,t){const n={};let r,A;for(A in t.properties)if("children"!==A&&Br.call(t.properties,A)){const o=Rr(e,A,t.properties[A]);if(o){const[A,i]=o;e.tableCellAlignToStyle&&"align"===A&&"string"==typeof i&&Tr.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 s=jr(e,t);return Sr.has(t.tagName)&&(s=s.filter(function(e){return"string"!=typeof e||!function(e){return"object"==typeof e?"text"===e.type&&Dn(e.value):Dn(e)}(e)})),Or(e,i,o,t),Lr(i,s),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)}Hr(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=ar,e.schema=A),e.ancestors.push(t);const o=null===t.name?e.Fragment:Nr(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 Hr(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 Hr(e,t.position);else o=null===r.value||r.value;n[A]=o}return n}(e,t),s=jr(e,t);return Or(e,i,o,t),Lr(i,s),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);Hr(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const r={};return Lr(r,jr(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 Or(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Lr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function jr(e,t){const n=[];let r=-1;const A=e.passKeys?new Map:Cr;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 s=Mr(e,o,i);void 0!==s&&n.push(s)}return n}function Rr(e,t,n){const r=function(e,t){const n=Tn(t);let r=t,A=In;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&tr.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(nr,or);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!nr.test(e)){let n=e.replace(rr,Ar);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}A=_n}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{hr(t,r)}catch(t){if(!e.ignoreInvalidStyle){const n=t,r=new Pr("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=Ir+"#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(kr,Ur)),n[r]=t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)Br.call(e,n)&&(t[Fr(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?ir[r.property]||r.property:r.attribute,n]}}function Nr(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,A=-1;for(;++A<e.length;){const t=Bn(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=Bn(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 Br.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Hr(e)}function Hr(e,t){const n=new Pr("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=Ir+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Fr(e){let t=e.replace(Dr,zr);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function Ur(e,t){return t.toUpperCase()}function zr(e){return"-"+e.toLowerCase()}const _r={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"]},qr={};function Gr(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 Yr(e.children,t,n)}return Array.isArray(e)?Yr(e,t,n):""}function Yr(e,t,n){const r=[];let A=-1;for(;++A<e.length;)r[A]=Gr(e[A],t,n);return r.join("")}const Wr=document.createElement("i");function Vr(e){const t="&"+e+";";Wr.innerHTML=t;const n=Wr.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}function Xr(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 Kr(e,t){return e.length>0?(Xr(e,e.length,0,t),e):t}const Jr={}.hasOwnProperty;function Zr(e){const t={};let n=-1;for(;++n<e.length;)$r(t,e[n]);return t}function $r(e,t){let n;for(n in t){const r=(Jr.call(e,n)?e[n]:void 0)||(e[n]={}),A=t[n];let o;if(A)for(o in A){Jr.call(r,o)||(r[o]=[]);const e=A[o];eA(r[o],Array.isArray(e)?e:e?[e]:[])}}}function eA(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);Xr(e,0,0,r)}function tA(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 nA(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rA=gA(/[A-Za-z]/),AA=gA(/[\dA-Za-z]/),oA=gA(/[#-'*+\--9=?A-Z^-~]/);function iA(e){return null!==e&&(e<32||127===e)}const sA=gA(/\d/),aA=gA(/[\dA-Fa-f]/),lA=gA(/[!-/:-@[-`{-~]/);function cA(e){return null!==e&&e<-2}function uA(e){return null!==e&&(e<0||32===e)}function dA(e){return-2===e||-1===e||32===e}const fA=gA(new RegExp("\\p{P}|\\p{S}","u")),pA=gA(/\s/);function gA(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function hA(e){const t=[];let n=-1,r=0,A=0;for(;++n<e.length;){const o=e.charCodeAt(n);let i="";if(37===o&&AA(e.charCodeAt(n+1))&&AA(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 mA(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 vA={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"),mA(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)):cA(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),A)}}};const yA={tokenize:function(e){const t=this,n=[];let r,A,o,i=0;return s;function s(r){if(i<n.length){const A=n[i];return t.containerState=A[1],e.attempt(A[0].continuation,a,l)(r)}return l(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 s=n;for(;s<t.events.length;)t.events[s][1].end={...A},s++;return Xr(t.events,o+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(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(wA,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(wA,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)):cA(n)?(e.consume(n),h(e.exit("chunkFlow")),i=0,t.interrupt=void 0,s):(e.consume(n),g)}function h(e,n){const s=t.sliceStream(e);if(n&&s.push(null),e.previous=A,A&&(A.next=e),A=e,r.defineSkip(e.start),r.write(s),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,s,a=n;for(;a--;)if("exit"===t.events[a][0]&&"chunkFlow"===t.events[a][1].type){if(A){s=t.events[a][1].end;break}A=!0}for(m(i),e=n;e<t.events.length;)t.events[e][1].end={...s},e++;Xr(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}}},wA={tokenize:function(e,t,n){return mA(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function bA(e){return null===e||uA(e)||pA(e)?1:fA(e)?2:void 0}function EA(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 xA={name:"attention",resolveAll:function(e,t){let n,r,A,o,i,s,a,l,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;s=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};PA(u,-s),PA(d,s),o={type:s>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},i={type:s>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:d},A={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[c][1].start}},r={type:s>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=Kr(a,[["enter",e[n][1],t],["exit",e[n][1],t]])),a=Kr(a,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",A,t]]),a=Kr(a,EA(t.parser.constructs.insideSpan.null,e.slice(n+1,c),t)),a=Kr(a,[["exit",A,t],["enter",i,t],["exit",i,t],["exit",r,t]]),e[c][1].end.offset-e[c][1].start.offset?(l=2,a=Kr(a,[["enter",e[c][1],t],["exit",e[c][1],t]])):l=0,Xr(e,n-1,c-n+3,a),c=n+a.length-l-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=bA(r);let o;return function(t){return o=t,e.enter("attentionSequence"),i(t)};function i(s){if(s===o)return e.consume(s),i;const a=e.exit("attentionSequence"),l=bA(s),c=!l||2===l&&A||n.includes(s),u=!A||2===A&&l||n.includes(r);return a._open=!!(42===o?c:c&&(A||!u)),a._close=!!(42===o?u:u&&(l||!c)),t(s)}}};function PA(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const BA={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 rA(t)?(e.consume(t),o):64===t?n(t):a(t)}function o(e){return 43===e||45===e||46===e||AA(e)?(r=1,i(e)):a(e)}function i(t){return 58===t?(e.consume(t),r=0,s):(43===t||45===t||46===t||AA(t))&&r++<32?(e.consume(t),i):(r=0,a(t))}function s(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||iA(r)?n(r):(e.consume(r),s)}function a(t){return 64===t?(e.consume(t),l):oA(t)?(e.consume(t),a):n(t)}function l(e){return AA(e)?c(e):n(e)}function c(n){return 46===n?(e.consume(n),r=0,l):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||AA(t))&&r++<63){const n=45===t?u:c;return e.consume(t),n}return n(t)}}};const CA={partial:!0,tokenize:function(e,t,n){return function(t){return dA(t)?mA(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||cA(e)?t(e):n(e)}}};const DA={continuation:{tokenize:function(e,t,n){const r=this;return function(t){return dA(t)?mA(e,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):A(t)};function A(r){return e.attempt(DA,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 kA={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 lA(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const SA={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"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),a):(e.enter("characterReferenceValue"),A=31,o=AA,l(t))}function a(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),A=6,o=aA,l):(e.enter("characterReferenceValue"),A=7,o=sA,l(t))}function l(s){if(59===s&&i){const A=e.exit("characterReferenceValue");return o!==AA||Vr(r.sliceSerialize(A))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(s)}return o(s)&&i++<A?(e.consume(s),l):n(s)}}};const TA={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)}}},IA={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)?mA(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===o?(e.enter("codeFencedFenceSequence"),c(t)):n(t)}function c(t){return t===o?(A++,e.consume(t),c):A>=s?(e.exit("codeFencedFenceSequence"),dA(t)?mA(e,u,"whitespace")(t):u(t)):n(t)}function u(r){return null===r||cA(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let o,i=0,s=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?(s++,e.consume(t),a):s<3?n(t):(e.exit("codeFencedFenceSequence"),dA(t)?mA(e,l,"whitespace")(t):l(t))}function l(n){return null===n||cA(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(TA,f,v)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),c(n))}function c(t){return null===t||cA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(t)):dA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),mA(e,u,"whitespace")(t)):96===t&&t===o?n(t):(e.consume(t),c)}function u(t){return null===t||cA(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(t))}function d(t){return null===t||cA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(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)?mA(e,h,"linePrefix",i+1)(t):h(t)}function h(t){return null===t||cA(t)?e.check(TA,f,v)(t):(e.enter("codeFlowValue"),m(t))}function m(t){return null===t||cA(t)?(e.exit("codeFlowValue"),h(t)):(e.consume(t),m)}function v(n){return e.exit("codeFenced"),t(n)}}};const QA={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),mA(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?s(t):cA(t)?e.attempt(MA,o,s)(t):(e.enter("codeFlowValue"),i(t))}function i(t){return null===t||cA(t)?(e.exit("codeFlowValue"),o(t)):(e.consume(t),i)}function s(n){return e.exit("codeIndented"),t(n)}}},MA={partial:!0,tokenize:function(e,t,n){const r=this;return A;function A(t){return r.parser.lazy[r.now().line]?n(t):cA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A):mA(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):cA(e)?A(e):n(e)}}};const OA={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"),s(t))}function s(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),s):96===t?(A=e.enter("codeTextSequence"),r=0,l(t)):cA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s):(e.enter("codeTextData"),a(t))}function a(t){return null===t||32===t||96===t||cA(t)?(e.exit("codeTextData"),s(t)):(e.consume(t),a)}function l(n){return 96===n?(e.consume(n),r++,l):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(A.type="codeTextData",a(n))}}};class LA{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&&jA(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),jA(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),jA(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);jA(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);jA(this.left,t.reverse())}}}function jA(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 RA(e){const t={};let n,r,A,o,i,s,a,l=-1;const c=new LA(e);for(;++l<c.length;){for(;l in t;)l=t[l];if(n=c.get(l),l&&"chunkFlow"===n[1].type&&"listItemPrefix"===c.get(l-1)[1].type&&(s=n[1]._tokenizer.events,A=0,A<s.length&&"lineEndingBlank"===s[A][1].type&&(A+=2),A<s.length&&"content"===s[A][1].type))for(;++A<s.length&&"content"!==s[A][1].type;)"chunkText"===s[A][1].type&&(s[A][1]._isInFirstContentOfListItem=!0,A++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,NA(c,l)),l=t[l],a=!0);else if(n[1]._container){for(A=l,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,l),i.unshift(n),c.splice(r,l-r+1,i))}}return Xr(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!a}function NA(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),s=i.events,a=[],l={};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<s.length;)"exit"===s[d][0]&&"enter"===s[d-1][0]&&s[d][1].type===s[d-1][1].type&&s[d][1].start.line!==s[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=s.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;)l[p+a[d][0]]=p+a[d][1],p+=a[d][1]-a[d][0]-1;return l}const HA={resolve:function(e){return RA(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):cA(t)?e.check(FA,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}}},FA={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"),mA(e,A,"linePrefix")};function A(A){if(null===A||cA(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 UA(e,t,n,r,A,o,i,s,a){const l=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||iA(t)?n(t):(e.enter(r),e.enter(i),e.enter(s),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(s),e.enter("chunkString",{contentType:"string"}),d(n))}function d(t){return 62===t?(e.exit("chunkString"),e.exit(s),u(t)):null===t||60===t||cA(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&&!uA(A)?c<l&&40===A?(e.consume(A),c++,p):41===A?(e.consume(A),c--,p):null===A||32===A||40===A||iA(A)?n(A):(e.consume(A),92===A?g:p):(e.exit("chunkString"),e.exit(s),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 zA(e,t,n,r,A,o){const i=this;let s,a=0;return function(t){return e.enter(r),e.enter(A),e.consume(t),e.exit(A),e.enter(o),l};function l(u){return a>999||null===u||91===u||93===u&&!s||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):cA(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):(e.enter("chunkString",{contentType:"string"}),c(u))}function c(t){return null===t||91===t||93===t||cA(t)||a++>999?(e.exit("chunkString"),l(t)):(e.consume(t),s||(s=!dA(t)),92===t?u:c)}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}}function _A(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,s):n(t)};function s(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),s(i)):null===t?n(t):cA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),mA(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),l(t))}function l(t){return t===i||null===t||cA(t)?(e.exit("chunkString"),a(t)):(e.consume(t),92===t?c:l)}function c(t){return t===i||92===t?(e.consume(t),l):l(t)}}function qA(e,t){let n;return function r(A){return cA(A)?(e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),n=!0,r):dA(A)?mA(e,r,n?"linePrefix":"lineSuffix")(A):t(A)}}const GA={name:"definition",tokenize:function(e,t,n){const r=this;let A;return function(t){return e.enter("definition"),function(t){return zA.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function o(t){return A=nA(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 uA(t)?qA(e,s)(t):s(t)}function s(t){return UA(e,a,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function a(t){return e.attempt(YA,l,l)(t)}function l(t){return dA(t)?mA(e,c,"whitespace")(t):c(t)}function c(o){return null===o||cA(o)?(e.exit("definition"),r.parser.defined.push(A),t(o)):n(o)}}},YA={partial:!0,tokenize:function(e,t,n){return function(t){return uA(t)?qA(e,r)(t):n(t)};function r(t){return _A(e,A,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function A(t){return dA(t)?mA(e,o,"whitespace")(t):o(t)}function o(e){return null===e||cA(e)?t(e):n(e)}}};const WA={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return cA(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};const VA={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"},Xr(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||uA(t)?(e.exit("atxHeadingSequence"),o(t)):n(t)}function o(n){return 35===n?(e.enter("atxHeadingSequence"),i(n)):null===n||cA(n)?(e.exit("atxHeading"),t(n)):dA(n)?mA(e,o,"whitespace")(n):(e.enter("atxHeadingText"),s(n))}function i(t){return 35===t?(e.consume(t),i):(e.exit("atxHeadingSequence"),o(t))}function s(t){return null===t||35===t||uA(t)?(e.exit("atxHeadingText"),o(t)):(e.consume(t),s)}}};const XA=["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"],KA=["pre","script","style","textarea"],JA={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,s,a;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),l}(t)};function l(s){return 33===s?(e.consume(s),c):47===s?(e.consume(s),o=!0,f):63===s?(e.consume(s),A=3,r.interrupt?t:O):rA(s)?(e.consume(s),i=String.fromCharCode(s),p):n(s)}function c(o){return 45===o?(e.consume(o),A=2,u):91===o?(e.consume(o),A=5,s=0,d):rA(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(s++)?(e.consume(A),6===s?r.interrupt?t:C:d):n(A)}function f(t){return rA(t)?(e.consume(t),i=String.fromCharCode(t),p):n(t)}function p(s){if(null===s||47===s||62===s||uA(s)){const a=47===s,l=i.toLowerCase();return a||o||!KA.includes(l)?XA.includes(i.toLowerCase())?(A=6,a?(e.consume(s),g):r.interrupt?t(s):C(s)):(A=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):o?h(s):m(s)):(A=1,r.interrupt?t(s):C(s))}return 45===s||AA(s)?(e.consume(s),i+=String.fromCharCode(s),p):n(s)}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):P(t)}function m(t){return 47===t?(e.consume(t),P):58===t||95===t||rA(t)?(e.consume(t),v):dA(t)?(e.consume(t),m):P(t)}function v(t){return 45===t||46===t||58===t||95===t||AA(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,x):null===t||cA(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||uA(t)?y(t):(e.consume(t),E)}function x(e){return 47===e||62===e||dA(e)?m(e):n(e)}function P(t){return 62===t?(e.consume(t),B):n(t)}function B(t){return null===t||cA(t)?C(t):dA(t)?(e.consume(t),B):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):!cA(t)||6!==A&&7!==A?null===t||cA(t)?(e.exit("htmlFlowData"),D(t)):(e.consume(t),C):(e.exit("htmlFlowData"),e.check(ZA,j,D)(t))}function D(t){return e.check($A,k,j)(t)}function k(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||cA(t)?D(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 KA.includes(n)?(e.consume(t),L):C(t)}return rA(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||cA(t)?(e.exit("htmlFlowData"),j(t)):(e.consume(t),L)}function j(n){return e.exit("htmlFlow"),t(n)}}},ZA={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(CA,t,n)}}},$A={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return cA(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 eo={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),s};function s(t){return 33===t?(e.consume(t),a):47===t?(e.consume(t),w):63===t?(e.consume(t),v):rA(t)?(e.consume(t),x):n(t)}function a(t){return 45===t?(e.consume(t),l):91===t?(e.consume(t),o=0,f):rA(t)?(e.consume(t),m):n(t)}function l(t){return 45===t?(e.consume(t),d):n(t)}function c(t){return null===t?n(t):45===t?(e.consume(t),u):cA(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):cA(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):cA(t)?(i=m,Q(t)):(e.consume(t),m)}function v(t){return null===t?n(t):63===t?(e.consume(t),y):cA(t)?(i=v,Q(t)):(e.consume(t),v)}function y(e){return 62===e?I(e):v(e)}function w(t){return rA(t)?(e.consume(t),b):n(t)}function b(t){return 45===t||AA(t)?(e.consume(t),b):E(t)}function E(t){return cA(t)?(i=E,Q(t)):dA(t)?(e.consume(t),E):I(t)}function x(t){return 45===t||AA(t)?(e.consume(t),x):47===t||62===t||uA(t)?P(t):n(t)}function P(t){return 47===t?(e.consume(t),I):58===t||95===t||rA(t)?(e.consume(t),B):cA(t)?(i=P,Q(t)):dA(t)?(e.consume(t),P):I(t)}function B(t){return 45===t||46===t||58===t||95===t||AA(t)?(e.consume(t),B):C(t)}function C(t){return 61===t?(e.consume(t),D):cA(t)?(i=C,Q(t)):dA(t)?(e.consume(t),C):P(t)}function D(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),A=t,k):cA(t)?(i=D,Q(t)):dA(t)?(e.consume(t),D):(e.consume(t),S)}function k(t){return t===A?(e.consume(t),A=void 0,T):null===t?n(t):cA(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||uA(t)?P(t):(e.consume(t),S)}function T(e){return 47===e||62===e||uA(e)?P(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)?mA(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 to={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&&Xr(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,A,o,i=e.length,s=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)){s=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}},l={type:"label",start:{...e[r][1].start},end:{...e[A][1].end}},c={type:"labelText",start:{...e[r+s+2][1].end},end:{...e[A-2][1].start}};return o=[["enter",a,t],["enter",l,t]],o=Kr(o,e.slice(r+1,r+s+3)),o=Kr(o,[["enter",c,t]]),o=Kr(o,EA(t.parser.constructs.insideSpan.null,e.slice(r+s+4,A-3),t)),o=Kr(o,[["exit",c,t],e[A-2],e[A-1],["exit",l,t]]),o=Kr(o,e.slice(A+1)),o=Kr(o,[["exit",a,t]]),Xr(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(nA(r.sliceSerialize({start:A.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):n(t)};function s(t){return 40===t?e.attempt(no,l,o?l:c)(t):91===t?e.attempt(ro,l,o?a:c)(t):o?l(t):c(t)}function a(t){return e.attempt(Ao,l,c)(t)}function l(e){return t(e)}function c(e){return A._balanced=!0,n(e)}}},no={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 uA(t)?qA(e,A)(t):A(t)}function A(t){return 41===t?l(t):UA(e,o,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return uA(t)?qA(e,s)(t):l(t)}function i(e){return n(e)}function s(t){return 34===t||39===t||40===t?_A(e,a,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):l(t)}function a(t){return uA(t)?qA(e,l)(t):l(t)}function l(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},ro={tokenize:function(e,t,n){const r=this;return function(t){return zA.call(r,e,A,o,"reference","referenceMarker","referenceString")(t)};function A(e){return r.parser.defined.includes(nA(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},Ao={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 oo={name:"labelStartImage",resolveAll:to.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 io={name:"labelStartLink",resolveAll:to.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 so={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),mA(e,t,"linePrefix")}}};const ao={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||cA(o))?(e.exit("thematicBreak"),t(o)):n(o)}function i(t){return t===r?(e.consume(t),A++,i):(e.exit("thematicBreakSequence"),dA(t)?mA(e,o,"whitespace")(t):o(t))}}};const lo={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(CA,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,mA(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(uo,t,A)(n))});function A(A){return r.containerState._closeFlow=!0,r.interrupt=void 0,mA(e,e.attempt(lo,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:sA(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(ao,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(t)}return n(t)};function s(t){return sA(t)&&++i<10?(e.consume(t),s):(!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(CA,r.interrupt?n:l,e.attempt(co,u,c))}function l(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)}}},co={partial:!0,tokenize:function(e,t,n){const r=this;return mA(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)}},uo={partial:!0,tokenize:function(e,t,n){const r=this;return mA(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 fo={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,s=r.events.length;for(;s--;)if("lineEnding"!==r.events[s][1].type&&"linePrefix"!==r.events[s][1].type&&"content"!==r.events[s][1].type){i="paragraph"===r.events[s][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)?mA(e,i,"lineSuffix")(t):i(t))}function i(r){return null===r||cA(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};const po={tokenize:function(e){const t=this,n=e.attempt(CA,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,mA(e,e.attempt(this.parser.constructs.flow,r,e.attempt(HA,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 go={resolveAll:yo()},ho=vo("string"),mo=vo("text");function vo(e){return{resolveAll:yo("text"===e?wo: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),s;t.consume(e)}function s(e){return a(e)?(t.exit("data"),A(e)):(t.consume(e),s)}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 yo(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 wo(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,s=-1,a=0;for(;i--;){const e=A[i];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)a++,s--;if(s)break;s=-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?s:r.start._bufferIndex+s,_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 bo={42:lo,43:lo,45:lo,48:lo,49:lo,50:lo,51:lo,52:lo,53:lo,54:lo,55:lo,56:lo,57:lo,62:DA},Eo={91:GA},xo={[-2]:QA,[-1]:QA,32:QA},Po={35:VA,42:ao,45:[fo,ao],60:JA,61:fo,95:ao,96:IA,126:IA},Bo={38:SA,92:kA},Co={[-5]:so,[-4]:so,[-3]:so,33:oo,38:SA,42:xA,60:[BA,eo],91:io,92:[WA,kA],93:to,95:xA,96:OA},Do={null:[xA,go]},ko=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:Eo,disable:{null:[]},document:bo,flow:Po,flowInitial:xo,insideSpan:Do,string:Bo,text:Co},Symbol.toStringTag,{value:"Module"}));function So(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=[],s=[];const a={attempt:g(function(e,t){h(e,t.from)}),check:g(p),consume:function(e){cA(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++)),l.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=d(),l.events.push(["enter",n,l]),s.push(n),n},exit:function(e){const t=s.pop();return t.end=d(),l.events.push(["exit",t,l]),t},interrupt:g(p,{interrupt:!0})},l={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=Kr(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),l.events=EA(o,l.events,l),l.events)}};let c=t.tokenize.call(l,a);return t.resolveAll&&o.push(t),l;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=l.previous,n=l.currentConstruct,A=l.events.length,o=Array.from(s);return{from:A,restore:i};function i(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=A,s=o,m()}}(),u=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?v():e.tokenize.call(t?Object.assign(Object.create(l),t):l,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&&Xr(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function m(){r.line in A&&r.column<2&&(r.column=A[r.line],r.offset+=A[r.line]-1)}}const To=/[\0\t\n\r]/g;const Io=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qo(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return tA(n.slice(t?2:1),t?16:10)}return Vr(n)||e}const Mo={}.hasOwnProperty;function Oo(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:B,autolinkEmail:B,atxHeading:o(J),blockQuote:o(Y),characterEscape:B,characterReference:B,codeFenced:o(W),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:o(W,i),codeText:o(V,i),codeTextData:B,data:B,codeFlowValue:B,definition:o(X),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:o(K),hardBreakEscape:o(Z),hardBreakTrailing:o(Z),htmlFlow:o($,i),htmlFlowData:B,htmlText:o($,i),htmlTextData:B,image:o(ee),label:i,link:o(te),listItem:o(re),listItemValue:d,listOrdered:o(ne,u),listUnordered:o(ne),paragraph:o(Ae),reference:H,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:o(J),strong:o(oe),thematicBreak:o(se)},exit:{atxHeading:a(),atxHeadingSequence:b,autolink:a(),autolinkEmail:G,autolinkProtocol:q,blockQuote:a(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,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:D,link:a(Q),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:F,resourceDestinationString:j,resourceTitleString:R,resource:N,setextHeading:a(P),setextHeadingLineSequence:x,setextHeadingText:E,strong:a(),thematicBreak:a()}};jo(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const o={stack:[r],tokenStack:[],config:t,enter:s,exit:l,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]];Mo.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]||No).call(o,void 0,e[0])}for(r.position={start:Lo(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Lo(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,s=t-1,a=-1,l=!1;for(;++s<=n;){const t=e[s];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=s),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=s;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",l=!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||s,0,["exit",r,t[2]]),s++,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(s,0,["enter",A,t[2]]),s++,n++,o=void 0,i=!0}}}return e[t][1]._spread=l,n}function o(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function s(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:Lo(t.start),end:void 0}}function a(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+wr({start:e.start,end:e.end})+"): it’s not open");r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||No).call(this,e,r[0])),n.position.end=Lo(e.end)}function c(){return function(e){return Gr(e,"boolean"!=typeof qr.includeImageAlt||qr.includeImageAlt,"boolean"!=typeof qr.includeHtml||qr.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=nA(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 x(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function B(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:Lo(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=Lo(e.end)}function D(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=Lo(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(B.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(Io,Qo)}(t),n.identifier=nA(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 j(){const e=this.resume();this.stack[this.stack.length-1].url=e}function R(){const e=this.resume();this.stack[this.stack.length-1].title=e}function N(){this.data.inReference=void 0}function H(){this.data.referenceType="collapsed"}function F(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=nA(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function U(e){this.data.characterReferenceType=e.type}function z(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;n?(r=tA(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):r=Vr(t);this.stack[this.stack.length-1].value+=r}function _(e){this.stack.pop().position.end=Lo(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 se(){return{type:"thematicBreak"}}}(n)(function(e){for(;!RA(e););return e}(function(e){const t={constructs:Zr([ko,...(e||{}).extensions||[]]),content:n(vA),defined:[],document:n(yA),flow:n(po),lazy:{},string:n(ho),text:n(mo)};return t;function n(e){return function(n){return So(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(A,o,i){const s=[];let a,l,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(To.lastIndex=c,a=To.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)s.push(-3),e=void 0;else switch(e&&(s.push(-5),e=void 0),c<u&&(s.push(A.slice(c,u)),t+=u-c),d){case 0:s.push(65533),t++;break;case 9:for(l=4*Math.ceil(t/4),s.push(-2);t++<l;)s.push(-1);break;case 10:s.push(-4),t=1;break;default:e=!0,t=1}c=u+1}return i&&(e&&s.push(-5),n&&s.push(n),s.push(null)),s}}()(e,t,!0))))}function Lo(e){return{line:e.line,column:e.column,offset:e.offset}}function jo(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?jo(e,r):Ro(e,r)}}function Ro(e,t){let n;for(n in t)if(Mo.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 No(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+wr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+wr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+wr({start:t.start,end:t.end})+") is still open")}function Ho(e){const t=this;t.parser=function(n){return Oo(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Fo(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 Uo(e){return e.spread??e.children.length>1}function zo(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),A=0;const o=[];for(;r;)o.push(_o(t.slice(A,r.index),A>0,!0),r[0]),A=r.index+r[0].length,r=n.exec(t);return o.push(_o(t.slice(A),A>0,!1)),o.join("")}function _o(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 qo={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=hA(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let i,s=e.footnoteCounts.get(r);void 0===s?(s=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=o+1,s+=1,e.footnoteCounts.set(r,s);const a={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+A,id:n+"fnref-"+A+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,a);const l={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,l),e.applyData(t,l)},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 Fo(e,t);const A={src:hA(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:hA(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 Fo(e,t);const A={href:hA(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:hA(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=Uo(n[r])}return t}(n):Uo(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 s=-1;for(;++s<r.length;){const e=r[s];(A||0!==s||"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 l={type:"element",tagName:"li",properties:o,children:i};return e.patch(t,l),e.applyData(t,l)},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=vr(t.children[1]),i=mr(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 s=-1;const a=[];for(;++s<i;){const n=t.children[s],r={},i=o?o[s]:void 0;i&&(r.align=i);let l={type:"element",tagName:A,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),a.push(l)}const l={type:"element",tagName:"tr",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)},text:function(e,t){const n={type:"text",value:zo(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:Go,yaml:Go,definition:Go,footnoteDefinition:Go};function Go(){}const Yo="object"==typeof self?self:globalThis,Wo=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 Yo[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 Yo[o](i),A)};return r})(new Map,e)(0),Vo="",{toString:Xo}={},{keys:Ko}=Object,Jo=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=Xo.call(e).slice(8,-1);switch(n){case"Array":return[1,Vo];case"Object":return[2,Vo];case"Date":return[3,Vo];case"RegExp":return[4,Vo];case"Map":return[5,Vo];case"Set":return[6,Vo];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Zo=([e,t])=>0===e&&("function"===t||"symbol"===t),$o=(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,s]=Jo(r);switch(i){case 0:{let t=r;switch(s){case"bigint":i=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+s);t=null;break;case"undefined":return A([-1],r)}return A([i,t],r)}case 1:{if(s){let e=r;return"DataView"===s?e=new Uint8Array(r.buffer):"ArrayBuffer"===s&&(e=new Uint8Array(r)),A([s,[...e]],r)}const e=[],t=A([i,e],r);for(const t of r)e.push(o(t));return t}case 2:{if(s)switch(s){case"BigInt":return A([s,r.toString()],r);case"Boolean":case"Number":case"String":return A([s,r.valueOf()],r)}if(t&&"toJSON"in r)return o(r.toJSON());const n=[],a=A([i,n],r);for(const t of Ko(r))(e||!Zo(Jo(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||!Zo(Jo(n))&&!Zo(Jo(A)))&&t.push([o(n),o(A)]);return n}case 6:{const t=[],n=A([i,t],r);for(const n of r)(e||!Zo(Jo(n)))&&t.push(o(n));return n}}const{message:a}=r;return A([i,{name:s,message:a}],r)};return o})(!(t||n),!!t,new Map,r)(e),r},ei="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?Wo($o(e,t)):structuredClone(e):(e,t)=>Wo($o(e,t));function ti(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 ni(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const ri=function(e){if(null==e)return oi;if("function"==typeof e)return Ai(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ri(e[n]);return Ai(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 Ai(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 Ai(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function Ai(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 oi(){return!0}const ii=[],si=!0,ai=!1;function li(e,t,n,r){let A;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):A=t;const o=ri(A),i=r?-1:1;!function e(A,s,a){const l=A&&"object"==typeof A?A:{};if("string"==typeof l.type){const e="string"==typeof l.tagName?l.tagName:"string"==typeof l.name?l.name:void 0;Object.defineProperty(c,"name",{value:"node ("+A.type+(e?"<"+e+">":"")+")"})}return c;function c(){let l,c,u,d=ii;if((!t||o(A,s,a[a.length-1]||void 0))&&(d=function(e){return Array.isArray(e)?e:"number"==typeof e?[si,e]:null==e?ii:[e]}(n(A,a)),d[0]===ai))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(l=e(n,c,u)(),l[0]===ai)return l;c="number"==typeof l[1]?l[1]:c+i}}return d}}(e,void 0,[])()}function ci(e,t,n,r){let A,o,i;"function"==typeof t?(o=void 0,i=t,A=n):(o=t,i=n,A=r),li(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 ui={}.hasOwnProperty,di={};function fi(e,t){const n=t||di,r=new Map,A=new Map,o=new Map,i={...qo,...n.handlers},s={all:function(e){const t=[];if("children"in e){const n=e.children;let r=-1;for(;++r<n.length;){const A=s.one(n[r],e);if(A){if(r&&"break"===n[r-1].type&&(!Array.isArray(A)&&"text"===A.type&&(A.value=vi(A.value)),!Array.isArray(A)&&"element"===A.type)){const e=A.children[0];e&&"text"===e.type&&(e.value=vi(e.value))}Array.isArray(A)?t.push(...A):t.push(A)}}}return t},applyData:gi,definitionById:r,footnoteById:A,footnoteCounts:o,footnoteOrder:[],handlers:i,one:function(e,t){const n=e.type,r=s.handlers[n];if(ui.call(s.handlers,n)&&r)return r(s,e,t);if(s.options.passThrough&&s.options.passThrough.includes(n)){if("children"in e){const{children:t,...n}=e,r=ei(n);return r.children=s.all(e),r}return ei(e)}return(s.options.unknownHandler||hi)(s,e,t)},options:n,patch:pi,wrap:mi};return ci(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)}}),s}function pi(e,t){e.position&&(t.position=function(e){const t=vr(e),n=mr(e);if(t&&n)return{start:t,end:n}}(e))}function gi(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,ei(A)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function hi(e,t){const n=t.data||{},r=!("value"in t)||ui.call(n,"hProperties")||ui.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 mi(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 vi(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function yi(e,t){const n=fi(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||ti,r=e.options.footnoteBackLabel||ni,A=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[];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(),l=hA(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-"+l+(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-"+l},children:e.wrap(o,!0)};e.patch(A,p),s.push(p)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ei(i),id:"footnote-label"},children:[{type:"text",value:A}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!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 wi(e,t){return e&&"run"in e?async function(n,r){const A=yi(n,{file:r,...t});await e.run(A,r)}:function(n,r){return yi(n,{file:r,...e||t})}}function bi(e){if(e)throw e}var Ei,xi;var Pi=function(){if(xi)return Ei;xi=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},s=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return Ei=function e(){var t,n,r,a,l,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=s(u,n),u!==(a=s(t,n))&&(p&&a&&(o(a)||(l=A(a)))?(l?(l=!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},Ei}();const Bi=lr(Pi);function Ci(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 Di(){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 s=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,s?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)}}(s,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 ki={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');Si(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,s=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1),s>-1&&(e.codePointAt(o)===t.codePointAt(s--)?s<0&&(A=o):(s=-1,A=i));return r===A?A=i:A<0&&(A=e.length),e.slice(r,A)},dirname:function(e){if(Si(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){Si(e);let t,n=e.length,r=-1,A=0,o=-1,i=0;for(;n--;){const s=e.codePointAt(n);if(47!==s)r<0&&(t=!0,r=n+1),46===s?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;)Si(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){Si(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,A="",o=0,i=-1,s=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!==s)if(i!==a-1&&2===s){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,s=0;continue}}else if(A.length>0){A="",o=0,i=a,s=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,s=0}else 46===n&&s>-1?s++:s=-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 Si(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Ti={cwd:function(){return"/"}};function Ii(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function Qi(e){if("string"==typeof e)e=new URL(e);else if(!Ii(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 Mi=["history","path","basename","stem","extname","dirname"];class Oi{constructor(e){let t;var n;t=e?Ii(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?"":Ti.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r,A=-1;for(;++A<Mi.length;){const e=Mi[A];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)Mi.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?ki.basename(this.path):void 0}set basename(e){ji(e,"basename"),Li(e,"basename"),this.path=ki.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?ki.dirname(this.path):void 0}set dirname(e){Ri(this.basename,"dirname"),this.path=ki.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?ki.extname(this.path):void 0}set extname(e){if(Li(e,"extname"),Ri(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=ki.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Ii(e)&&(e=Qi(e)),ji(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?ki.basename(this.path,this.extname):void 0}set stem(e){ji(e,"stem"),Li(e,"stem"),this.path=ki.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 Pr(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 Li(e,t){if(e&&e.includes(ki.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ki.sep+"`")}function ji(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ri(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const Ni=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},Hi={}.hasOwnProperty;class Fi extends Ni{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=Di()}copy(){const e=new Fi;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(Bi(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(qi("data",this.frozen),this.namespace[e]=t,this):Hi.call(this.namespace,e)&&this.namespace[e]||void 0:e?(qi("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=Wi(e),n=this.parser||this.Parser;return zi("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),zi("process",this.parser||this.Parser),_i("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,A){const o=Wi(e),i=n.parse(o);function s(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 s(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,s(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),zi("processSync",this.parser||this.Parser),_i("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,bi(e),t=r}),Yi("processSync","process",n),t}run(e,t,n){Gi(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=Wi(t);r.run(e,i,function(t,r,i){const s=r||e;t?o(t):A?A(s):n(void 0,s,i)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){bi(e),n=t,r=!0}),Yi("runSync","run",r),n}stringify(e,t){this.freeze();const n=Wi(t),r=this.compiler||this.Compiler;return _i("stringify",r),Gi(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(qi("use",this.frozen),null!=e)if("function"==typeof e)s(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)s(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;s(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=Bi(!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 s(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];Ci(i)&&Ci(r)&&(r=Bi(!0,i,r)),n[A]=[e,r,...o]}}}}const Ui=(new Fi).freeze();function zi(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function _i(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function qi(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 Gi(e){if(!Ci(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function Yi(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Wi(e){return function(e){return!!(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new Oi(e)}const Vi=[],Xi={allowDangerousHtml:!0},Ki=/^(https?|ircs?|mailto|xmpp)$/i,Ji=[{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 Zi(e){const t=e.allowedElements,r=e.allowElement,A=e.children||"",o=e.className,i=e.components,s=e.disallowedElements,a=e.rehypePlugins||Vi,l=e.remarkPlugins||Vi,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Xi}:Xi,u=e.skipHtml,d=e.unwrapDisallowed,f=e.urlTransform||$i,p=Ui().use(Ho).use(l).use(wi,c).use(a),g=new Oi;"string"==typeof A&&(g.value=A);for(const t of Ji)Object.hasOwn(e,t.from)&&(t.from,t.to&&t.to,t.id);const h=p.parse(g);let m=p.runSync(h,g);return o&&(m={type:"element",tagName:"div",properties:{className:o},children:"root"===m.type?m.children:[m]}),ci(m,function(e,n,A){if("raw"===e.type&&A&&"number"==typeof n)return u?A.children.splice(n,1):A.children[n]={type:"text",value:e.value},n;if("element"===e.type){let t;for(t in _r)if(Object.hasOwn(_r,t)&&Object.hasOwn(e.properties,t)){const n=e.properties[t],r=_r[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=f(String(n||""),t,e))}}if("element"===e.type){let o=t?!t.includes(e.tagName):!!s&&s.includes(e.tagName);if(!o&&r&&"number"==typeof n&&(o=!r(e,n,A)),o&&A&&"number"==typeof n)return d&&e.children?A.children.splice(n,1,...e.children):A.children.splice(n,1),n}}),Qr(m,{Fragment:n.Fragment,components:i,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0})}function $i(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||Ki.test(e.slice(0,t))?e:""}const es=({children:e})=>n.jsx("div",{style:{whiteSpace:"normal"},children:n.jsx(Zi,{components:{p:({...e})=>n.jsx("p",{style:{margin:0,marginBottom:"0.5em",lineHeight:1.4,textAlign:"left"},children:e.children}),ul:({...e})=>n.jsx("ul",{style:{paddingLeft:"clamp(8px, 3.5vw, 16px)",margin:0,listStylePosition:"inside"},children:e.children}),ol:({...e})=>n.jsx("ol",{style:{paddingLeft:"clamp(8px, 3.5vw, 16px)",margin:0,listStylePosition:"inside"},children:e.children}),li:({...e})=>n.jsx("li",{style:{marginBottom:"1px",lineHeight:1.4},children:e.children}),code:({inline:e,children:t})=>e?n.jsx("code",{style:{backgroundColor:"rgba(0, 0, 0, 0.3)",padding:"2px 4px",borderRadius:"4px",fontFamily:"inherit",fontSize:"0.95em"},children:t}):n.jsx("pre",{style:{backgroundColor:"rgba(0, 0, 0, 0.3)",padding:"8px",borderRadius:"4px",overflowX:"auto",margin:"0.5em 0",whiteSpace:"pre-wrap"},children:n.jsx("code",{children:t})}),blockquote:({...e})=>n.jsx("blockquote",{style:{margin:0,paddingLeft:"10px",borderLeft:"2px solid #ccc",color:"#666",fontStyle:"italic"},children:e.children})},children:"string"==typeof e?e:""})}),ts={autoConfig:!0},ns=t=>()=>(t=>{const{getFlow:n}=Ft(),{messages:r,replaceMessages:A}=Ut(),{settings:o}=_t(),{hasChatHistoryLoaded:i}=Gt(),s={...t,...ts},a=s.markdownComponent?s.markdownComponent:es;e.useEffect(()=>{var e,t;if(i){const n=[...r];for(let r=0;r<n.length&&r<((null==(e=o.chatHistory)?void 0:e.maxEntries)??30);r++){const e=n[r];null!=(t=e.tags)&&t.includes("rcb-markdown-renderer-plugin:parsed")&&(e.contentWrapper=a)}A(n)}},[i]);const l=async e=>{var t;const r=null==(t=e.data.message)?void 0:t.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,n(),r)&&(e.data.message.contentWrapper=a,e.data.message.tags||(e.data.message.tags=[]),e.data.message.tags.push("rcb-markdown-renderer-plugin:parsed"))};zt(N.PRE_INJECT_MESSAGE,l),zt(N.CHUNK_STREAM_MESSAGE,l),zt(N.START_STREAM_MESSAGE,l),zt(N.START_SIMULATE_STREAM_MESSAGE,l);const c={name:"@rcb-plugins/markdown-renderer"};return null!=s&&s.autoConfig&&(c.settings={event:{rcbPreInjectMessage:!0,rcbChunkStreamMessage:!0,rcbStartSimulateStreamMessage:!0,rcbStartStreamMessage:!0}}),c})(t),rs={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"}},As=(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},os=t=>{const{showToast:n}=(()=>{const{showToast:e,dismissToast:t,toasts:n,replaceToasts:r}=Je();return{showToast:e,dismissToast:t,toasts:n,replaceToasts:r}})(),{getFlow:r}=Ft(),{styles:A,updateStyles:o,replaceStyles:i}=(()=>{const{styles:e,replaceStyles:t,updateStyles:n}=Tt();return{styles:e,replaceStyles:t,updateStyles:n}})(),s=(e=>({...rs,...e,promptBaseColors:{...rs.promptBaseColors},promptHoveredColors:{...rs.promptHoveredColors},textAreaHighlightColors:{...rs.textAreaHighlightColors}}))(t),[a,l]=e.useState(0),c=e.useRef({});zt(N.USER_SUBMIT_TEXT,e=>{const t=e,i=As(t,r(),"validateTextInput");if(!i)return;const u=i(t.data.inputText);if(null!=u&&u.success||e.preventDefault(),!u.promptContent)return;0===a&&(c.current=structuredClone(A));const d=((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})(u,s);o(d),n(u.promptContent,u.promptDuration??3e3),l(e=>e+1)}),zt(N.USER_UPLOAD_FILE,e=>{var t,A;const o=e,i=null==(A=null==(t=o.data)?void 0:t.files)?void 0:A[0];if(!i)return console.error("No file uploaded."),void e.preventDefault();const s=As(o,r(),"validateFileInput");if(!s)return void console.error("Validator not found for file input.");const a=s(i);if(!a.success)return console.error("Validation failed:",a),a.promptContent&&n(a.promptContent,a.promptDuration??3e3),void e.preventDefault();console.log("Validation successful:",a)}),zt(N.DISMISS_TOAST,()=>{l(e=>e-1)}),e.useEffect(()=>{0===a&&setTimeout(()=>{i(c.current)})},[a,i]);const u={name:"@rcb-plugins/input-validator"};return s.autoConfig&&(u.settings={event:{rcbUserSubmitText:!0,rcbUserUploadFile:!0,rcbDismissToast:!0}}),u},is=e.forwardRef((t,n)=>{let{embedded:r,currentOpen:A,enabled:o,onSetEnabled:i}=t;const s=Ut(),a=(()=>{const{isChatWindowOpen:e,toggleChatWindow:t,toggleIsBotTyping:n,scrollToBottom:r,getIsChatBotVisible:A}=G();return{isChatWindowOpen:e,toggleChatWindow:t,toggleIsBotTyping:n,scrollToBottom:r,getIsChatBotVisible:A}})(),l=e.useRef(!1),c=e.useRef(!1);return e.useEffect(()=>{!r&&a&&a.toggleChatWindow&&(l.current===A||c.current||(setTimeout(()=>{a&&a.toggleChatWindow&&a.toggleChatWindow(A)},0),l.current=null!=A&&A),c.current=!1)},[A,r,a]),e.useEffect(()=>{const e=()=>{c.current=!0};return window.addEventListener("rcb-toggle-chat-window",e),()=>window.removeEventListener("rcb-toggle-chat-window",e)}),e.useImperativeHandle(n,()=>({addMessage:e=>{s&&s.injectMessage&&s.injectMessage(e)},openChat:()=>{!r&&a&&a.toggleChatWindow&&a.toggleChatWindow(!0)},closeChat:()=>{!r&&a&&a.toggleChatWindow&&a.toggleChatWindow(!1)},toggleChat:()=>{!r&&a&&a.toggleChatWindow&&a.toggleChatWindow()},setBotEnabled:e=>{i&&i(e)}}),[s,a,r,i]),null});is.displayName="BotController";const ss=e.createContext(null),as=t=>{let{trackEvent:n,children:r}=t;const A=e.useRef(n);return A.current=n,e.createElement(ss.Provider,{value:{trackEvent:e=>A.current(e)}},r)},ls=()=>{const t=e.useContext(ss);return t||{trackEvent:()=>{}}},cs=t=>{let{loginUrl:n,className:r="",style:A,isHeaderButton:o=!1}=t;const{trackEvent:i}=ls(),s=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 e.createElement(e.Fragment,null,o&&e.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 "),e.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({},s),A),onClick:()=>{i({type:"chatbot_login_clicked",loginUrl:n})}},"Log In"))},us=()=>e.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"},e.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"},e.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),e.createElement("circle",{cx:"12",cy:"7",r:"4"}))),ds=[];for(let e=0;e<256;++e)ds.push((e+256).toString(16).slice(1));let fs;const ps=new Uint8Array(16);var gs={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hs(e,t,n){if(gs.randomUUID&&!e)return gs.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!fs){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");fs=crypto.getRandomValues.bind(crypto)}return fs(ps)}();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(ds[e[t+0]]+ds[e[t+1]]+ds[e[t+2]]+ds[e[t+3]]+"-"+ds[e[t+4]]+ds[e[t+5]]+"-"+ds[e[t+6]]+ds[e[t+7]]+"-"+ds[e[t+8]]+ds[e[t+9]]+"-"+ds[e[t+10]]+ds[e[t+11]]+ds[e[t+12]]+ds[e[t+13]]+ds[e[t+14]]+ds[e[t+15]]).toLowerCase()}(r)}function ms(){return"undefined"!=typeof localStorage&&"true"===localStorage.getItem("QA_BOT_DEBUG")}const vs="background: #1a5b6e; color: white; padding: 2px 6px; border-radius: 3px;",ys="background: #7c3aed; color: white; padding: 2px 6px; border-radius: 3px;",ws="background: #059669; color: white; padding: 2px 6px; border-radius: 3px;",bs="background: #f97316; color: white; padding: 2px 6px; border-radius: 3px;",Es="background: #f59e0b; color: #000; padding: 2px 6px; border-radius: 3px 0 0 3px; font-weight: bold;",xs="background: #fbbf24; color: #000; padding: 2px 6px; border-radius: 0 3px 3px 0;",Ps=()=>{ms()&&console.log("%c QA Bot Core %c v0.2.35 ",Es,xs)},Bs=function(e){if(ms()){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}`,vs,"",...n)}},Cs=function(e){if(ms()){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}`,ys,"",...n)}},Ds=(e,t)=>{ms()&&console.log(`%c[Message]%c ${e}`,ws,"",t)},ks=function(e){if(ms()){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}`,bs,"",...n)}},Ss=function(){console.warn(...arguments)},Ts=function(){console.error(...arguments)},Is="qa_bot_session_messages",Qs=()=>`qa_bot_session_${hs()}`,Ms=()=>{try{const e=localStorage.getItem(Is);return e?JSON.parse(e):{}}catch(e){return{}}},Os=(e,t,n,r,A)=>{const o=Ms();!o[e]&&(o[e]={messages:[],startedAt:(new Date).toISOString(),preview:""},Cs("NEW session created",{sessionId:e.slice(-12)}));if(o[e].messages.some(e=>e.id===t))return void Cs("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),Cs("MESSAGE added",{sessionId:e.slice(-12),messageId:t.slice(-8),sender:r,totalInSession:o[e].messages.length});const s=o[e].messages,a=s.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=s.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(Is,JSON.stringify(e))})(o),Cs("STORAGE state",{ourSessions:Object.keys(o).length,ourTotalMessages:Object.values(o).reduce((e,t)=>e+t.messages.length,0)})},Ls=e=>{var t,n;return null!==(n=null===(t=Ms()[e])||void 0===t?void 0:t.messages.length)&&void 0!==n?n:0},js=e=>{const t=Ms()[e];return(null==t?void 0:t.startedAt)?Date.now()-new Date(t.startedAt).getTime():0},Rs=e.createContext(void 0),Ns=t=>{let{children:n,getSessionId:r,setSessionId:A,resetSession:o,clearResettingFlag:i}=t;return e.createElement(Rs.Provider,{value:{getSessionId:r,setSessionId:A,resetSession:o,clearResettingFlag:i}},n)},Hs=()=>{const t=e.useContext(Rs);if(!t)throw new Error("useSession must be used within a SessionProvider");return t},Fs=()=>{const[t,n]=e.useState(!1),[r,A]=e.useState([]),[o,i]=e.useState(null),[s,a]=e.useState(0),l=e.useRef(null),c=e.useRef(null),{replaceMessages:u}=Ut(),{toggleTextAreaDisabled:d}=qt(),{setSessionId:f,getSessionId:p}=Hs();e.useEffect(()=>{var e,r;const A=e=>{l.current&&!l.current.contains(e.target)&&c.current&&!c.current.contains(e.target)&&n(!1)},o=null!==(r=null===(e=l.current)||void 0===e?void 0:e.getRootNode())&&void 0!==r?r:document;return t&&o.addEventListener("mousedown",A),()=>{o.removeEventListener("mousedown",A)}},[t]);const g=e=>{var t;const r=p();if(Cs("RESTORE requested",{targetSession:e.slice(-12),currentSession:null==r?void 0:r.slice(-12)}),e===r)return Cs("RESTORE skipped - already on this session"),void n(!1);const A=(e=>{var t;return(null===(t=Ms()[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()});Cs("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;f(e),Cs("Session ID updated",{newSession:e.slice(-12)}),u(o),Cs("replaceMessages called",{count:o.length}),i=null===(t=c.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("<a href=")&&(n=n.replace(/<a\s+href=["']([^"']+)["'][^&]*>([^&]+)<\/a>/gi,'<a href="$1" target="_blank" rel="noopener noreferrer">$2</a>'),r=!0),(n.includes("<a ")||(null===(t=e.textContent)||void 0===t?void 0:t.includes("<a href=")))&&(e.textContent||"").includes("<a href=")&&(n=n.replace(/<a\s+href="([^"]+)"[^&]*>([^&]+)<\/a>/gi,'<a href="$1" target="_blank" rel="noopener noreferrer">$2</a>'),r=!0),r&&(e.innerHTML=n)})},50),d(!1),Cs("Chat input enabled after restore"),n(!1)};return e.createElement("div",{style:{position:"relative"}},e.createElement("button",{ref:c,className:"history-button",onClick:()=>{if(!t&&(A((()=>{const e=Ms();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())})()),c.current)){const e=c.current.closest(".rcb-chat-window");if(e){const t=e.getBoundingClientRect(),n=c.current.getBoundingClientRect();i(t.width+3),a(t.right-n.right-18+4)}}n(!t)},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":t,"aria-haspopup":"menu"},e.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"},e.createElement("circle",{cx:"12",cy:"12",r:"10"}),e.createElement("polyline",{points:"12 6 12 12 16 14"}))),t&&e.createElement("div",{ref:l,role:"menu",style:{position:"absolute",right:s?`-${s}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?e.createElement("div",{style:{padding:"12px 16px",color:"#666",fontSize:"14px",textAlign:"center"}},"No chat history"):r.map(t=>e.createElement("button",{key:t.sessionId,role:"menuitem",onClick:()=>g(t.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"}},e.createElement("span",{style:{fontSize:"14px",color:"#333",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.preview||"New conversation"),e.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"})})(t.startedAt))))))},Us=t=>{var{width:n=24,height:r=24,color:A="currentColor",children:o}=t,i=a(t,["width","height","color","children"]);return e.createElement("svg",s({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)},zs=t=>e.createElement(Us,t,e.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"})),_s=()=>{const{restartFlow:t}=Ft(),{setTextAreaValue:n}=qt(),{messages:r}=Ut(),{getSessionId:A,resetSession:o,clearResettingFlag:i}=Hs(),{trackEvent:s}=ls();return e.createElement("button",{onClick:async()=>{const e=A(),r=e?Ls(e):0;s({type:"chatbot_new_chat",previousMessageCount:r}),o(),await n(""),await t(),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)"}},e.createElement(zs,{width:16,height:16}),"New Chat")};function qs(e){if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(!e)return"";if(Array.isArray(e))return e.map(qs).join("");if("object"==typeof e&&null!==e&&"props"in e){const t=e.props;if(t&&"children"in t)return qs(t.children)}return""}const Gs=()=>{const{getSessionId:t}=Hs(),n=e.useCallback(e=>{var n;const r=null===(n=e.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:qs(r.content),Ds("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 s=t();Os(s,r.id,i,A,o)},[t]);return e.useEffect(()=>(window.addEventListener("rcb-pre-inject-message",n),()=>{window.removeEventListener("rcb-pre-inject-message",n)}),[n]),null},Ys=()=>(e.useEffect(()=>{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 s=[];if(i.length>0){const e=i[i.length-1];s=Array.from(e.querySelectorAll(".rcb-options"))}if(0===s.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(s.length>0){if(s.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",s.length),0===t?e.classList.add("keyboard-focused"):e.classList.remove("keyboard-focused")}),s.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(()=>{s[0]&&null!==s[0].offsetParent&&!r&&(s[0].focus(),s.length>1&&t(`${s.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 Ws=!1,Vs=null;function Xs(){return Ws?Promise.resolve():Vs||(Vs=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=()=>{Ws=!0,ks("Script loaded"),e()},n.onerror=()=>{Vs=null,t(new Error("Failed to load Turnstile script"))},document.head.appendChild(n)}),Vs)}const Ks=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},Js=t=>{let{siteKey:n,onVerify:r,onError:o,loginUrl:i}=t;const s=e.useRef(null),a=e.useRef(null),l=e.useRef(!1),c=e.useRef(null),u=e.useRef(null),[d,f]=e.useState(!1),[p,g]=e.useState(0),h=e.useRef("widget_error"),m=e.useRef(null),v=i&&"/login"!==i,y=e.useCallback(()=>{const e=window.turnstile;if(c.current&&(null==e?void 0:e.remove)){try{e.remove(c.current)}catch(e){}c.current=null}},[]),w=e.useCallback(()=>{var e;y(),d?null==o||o(h.current,null!==(e=m.current)&&void 0!==e?e:void 0):null==o||o("user_cancelled")},[o,y,d]);e.useEffect(()=>()=>{y()},[y]),e.useEffect(()=>{var e;return u.current=document.activeElement,null===(e=a.current)||void 0===e||e.focus(),()=>{u.current&&"function"==typeof u.current.focus&&u.current.focus()}},[]),e.useEffect(()=>{const e=e=>{if("Escape"===e.key)return e.preventDefault(),void w();if("Tab"===e.key&&a.current){const t=a.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)},[w]),e.useEffect(()=>{l.current||!s.current||d||(l.current=!0,Xs().then(()=>{const e=window.turnstile;if(!e||!s.current)return Ts("Turnstile API not available after script load"),h.current="api_unavailable",void f(!0);c.current=e.render(s.current,{sitekey:n,callback:e=>{ks("Visible challenge completed"),r(e)},"error-callback":e=>(Ts("Turnstile challenge failed:",e),m.current=e,h.current="widget_error",y(),f(!0),!0),"expired-callback":()=>{Ts("Turnstile token expired"),h.current="token_expired",y(),f(!0)}})}).catch(e=>{Ts("Failed to load Turnstile script:",e),h.current="script_load_failed",f(!0)}))},[n,r,d]);const b=e.createElement(e.Fragment,null,e.createElement("div",{"aria-hidden":"true",style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.5)",zIndex:999998}}),e.createElement("div",{ref:a,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'}},e.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"),d?e.createElement("div",{style:{fontSize:"14px",lineHeight:"1.5",color:"#333"}},0===p?e.createElement("p",{style:{margin:"0 0 16px 0"}},"Verification failed. You can try again",v&&e.createElement(e.Fragment,null,", or"," ",e.createElement("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--primaryColor, #107180)",fontWeight:"bold"}},"log in")," ","to skip verification"),"."):e.createElement(e.Fragment,null,e.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."),e.createElement("p",{style:{margin:"0 0 16px 0"}},"Try disabling extensions, using a private/incognito window,",v&&e.createElement(e.Fragment,null," ",e.createElement("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--primaryColor, #107180)",fontWeight:"bold"}},"logging in"),",")," ","or using a different browser.")),e.createElement("div",{style:{display:"flex",gap:"8px"}},e.createElement("button",{type:"button",onClick:()=>{y(),l.current=!1,g(e=>e+1),f(!1)},style:{padding:"8px 16px",background:"var(--primaryColor, #107180)",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Try again"),e.createElement("button",{type:"button",onClick:w,style:{padding:"8px 16px",background:"#f0f0f0",color:"#333",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Close"))):e.createElement(e.Fragment,null,e.createElement("div",{ref:s,style:{borderRadius:"8px",overflow:"hidden"}}),e.createElement("button",{type:"button",onClick:w,style:{marginTop:"16px",padding:"8px 16px",background:"#f0f0f0",color:"#333",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Cancel"))));return A.createPortal(b,document.body)};function Zs(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 $s(t){let{getState:n,onResubmit:r,trackEvent:A,loginUrl:o}=t;var i;const[s,a]=e.useState(null),[l,c]=e.useState(0),u=n(),d={},f="true"===d.VITE_FORCE_TURNSTILE_WIDGET,p=null!==(i=u.siteKey)&&void 0!==i?i:f?d.VITE_TURNSTILE_SITE_KEY:null;return p&&(f||s!==p)?e.createElement(Js,{key:l,siteKey:p,loginUrl:o,onVerify:async e=>{const t=p;u.token=e,null==A||A({type:"chatbot_turnstile_completed"});"needs_another_challenge"===await r(e)?c(e=>e+1):a(t)},onError:(e,t)=>{var n;const r=null===(n=u.pendingQuery)||void 0===n?void 0:n.queryId,o=p;u.token=null,u.pendingQuery=null,u.needsChallenge=!1,u.siteKey=null,a(o),null==A||A({type:"chatbot_turnstile_error",queryId:r,failureReason:e,cloudflareErrorCode:t})}}):null}const ea="#1a5b6e",ta="#107180",na="Arial, sans-serif",ra="Q&A Bot",Aa="/chat-icon.svg",oa="Type your question here...",ia="Select an option to continue",sa=!1,aa="Ask me a question!",la="/login",ca={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}},ua=e.forwardRef((t,n)=>{var r,A,o;const{apiKey:i,qaEndpoint:s,ratingEndpoint:a,capabilitiesEndpoint:c,agentRatingEndpoint:u,welcomeMessage:d,open:f,onOpenChange:p,isLoggedIn:g,allowAnonAccess:h=!1,actingUser:m,primaryColor:v,secondaryColor:y,botName:w,logo:b,placeholder:E,errorMessage:x,embedded:P,footerText:B,footerLink:C,tooltipText:D,loginUrl:k,turnstileSiteKey:S,backendId:T,resourceContext:I,customFlow:Q,onAnalyticsEvent:M}=t,O=e.useRef(`bot_${Math.random().toString(36).substr(2,9)}`);e.useEffect(()=>{Ps()},[]);const L=e.useRef(null);null===L.current&&(L.current=Qs(),Bs("CREATED",L.current));const j=e.useRef(!1),R=e.useRef({getSessionId:()=>L.current,isResetting:()=>j.current}),N=e.useRef(null),H=function(t,n){const[r,A]=e.useState(null),[o,i]=e.useState("idle"),s=e.useRef(null),a=e.useRef(null),l=e.useRef(!0),c=e.useCallback(()=>{const e=window.turnstile;if(a.current&&(null==e?void 0:e.remove)){try{e.remove(a.current)}catch(e){}a.current=null}s.current&&(s.current.remove(),s.current=null)},[]);return e.useEffect(()=>{if(l.current=!0,!t)return i("idle"),void A(null);i("loading");const e=document.createElement("div");return e.style.position="fixed",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0",e.style.height="0",e.style.overflow="hidden",e.setAttribute("aria-hidden","true"),document.body.appendChild(e),s.current=e,Xs().then(()=>{if(!l.current)return;const e=window.turnstile;if(!e||!s.current)return Ts("Turnstile API not available for silent verification"),i("failed"),void(null==n||n({type:"chatbot_turnstile_silent_failed",failureReason:"api_unavailable"}));const r=e.render(s.current,{sitekey:t,execution:"render","refresh-expired":"auto",callback:e=>{l.current&&(ks("Silent verification succeeded"),A(e),i("verified"))},"error-callback":e=>!l.current||(Ts("Turnstile silent verification failed:",e),A(null),i("failed"),null==n||n({type:"chatbot_turnstile_silent_failed",failureReason:"widget_error",cloudflareErrorCode:e}),!0),"expired-callback":()=>{l.current&&(ks("Token expired, awaiting refresh"),A(null),i("loading"))}});a.current=r}).catch(e=>{l.current&&(Ts("Failed to load Turnstile script for silent verification:",e),i("failed"),null==n||n({type:"chatbot_turnstile_silent_failed",failureReason:"script_load_failed"}))}),()=>{l.current=!1,c()}},[t,c]),{token:r,status:o,reset:e.useCallback(()=>{const e=window.turnstile;a.current&&(null==e?void 0:e.reset)&&(A(null),i("loading"),e.reset(a.current),ks("Token consumed, resetting widget for fresh token"))},[])}}(S,e=>{var t;null===(t=N.current)||void 0===t||t.call(N,e)}),F=e.useRef(null);F.current=H.token;const[U,z]=e.useState(g);e.useEffect(()=>{z(g)},[g]);const _=void 0!==P?P:sa,q=e.useCallback(e=>{var t;M&&M(Object.assign(Object.assign({},e),{timestamp:Date.now(),sessionId:null!==(t=L.current)&&void 0!==t?t:void 0,pageUrl:"undefined"!=typeof window?window.location.href:void 0,isEmbedded:_}))},[M,_]);e.useEffect(()=>{N.current=e=>q(e)},[q]);const G=e.useMemo(()=>{const t=Object.assign({},ca);t.general=Object.assign(Object.assign({},t.general),{primaryColor:v||ea,secondaryColor:y||ta,fontFamily:na,embedded:_});const n=!1===U?[e.createElement(cs,{key:"login-button",loginUrl:k||la,isHeaderButton:!0})]:[e.createElement(Fs,{key:"history-button"}),e.createElement(us,{key:"user-icon"})];t.header={title:e.createElement("span",{style:{fontSize:14,fontWeight:500}},w||ra),showAvatar:!0,avatar:b||Aa,buttons:[...n,l.CLOSE_CHAT_BUTTON]},t.chatInput=Object.assign(Object.assign({},t.chatInput),{disabled:!1,enabledPlaceholderText:E||oa,disabledPlaceholderText:x||ia}),t.tooltip=Object.assign(Object.assign({},t.tooltip),{text:D||aa});const r=B?C?e.createElement("a",{href:C,target:"_blank",rel:"noopener noreferrer",key:"footer-link"},B):e.createElement("span",{key:"footer-text"},B):null;return t.footer={text:null!=r?r:void 0,buttons:[e.createElement(_s,{key:"new-chat-button"})]},t.chatWindow=Object.assign(Object.assign({},t.chatWindow),{defaultOpen:!!_}),t.event={rcbPreInjectMessage:!0,rcbPostInjectMessage:!0,rcbUserSubmitText:!0,rcbChangePath:!0,rcbToggleChatWindow:!0},t},[v,y,w,b,E,x,_,D,U,k,B,C]),Y=e.useRef(null),W=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.useMemo(()=>{const e=(e,n)=>{if(t.current){const n=getComputedStyle(t.current).getPropertyValue(e);if(n&&""!==n.trim())return n.trim();if(t.current.parentElement){const n=getComputedStyle(t.current.parentElement).getPropertyValue(e);if(n&&""!==n.trim())return n.trim()}}return n};return{primaryColor:e("--primaryColor",n.primaryColor),secondaryColor:e("--secondaryColor",n.secondaryColor),fontFamily:e("--fontFamily",n.fontFamily)}},[t,n])}(Y,G.general);((t,n)=>{e.useEffect(()=>{n.current&&(t?n.current.classList.add("bot-logged-in"):n.current.classList.remove("bot-logged-in"))},[t,n])})(!1!==U,Y),(t=>{let{settings:n,themeColors:r}=t;e.useEffect(()=>{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]),e.useEffect(()=>{var t,r;(null===(t=n.header)||void 0===t?void 0:t.title)&&"string"==typeof n.header.title&&(n.header.title=e.createElement("div",{key:"header-title"},e.createElement("h1",{className:"sr-only"},n.header.title),e.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:G,themeColors:W});const V=e.useMemo(()=>{const t=(t=>{let{endpoint:n,ratingEndpoint:r,agentRatingEndpoint:A,apiKey:o,sessionId:i,isResetting:s=()=>!1,isLoggedIn:a,allowAnonAccess:l=!1,loginUrl:c="/login",trackEvent:u,getTurnstileToken:d,resetTurnstileToken:f,backendId:p,resourceContext:g}=t;if(!1===a&&!l)return null==u||u({type:"chatbot_login_prompt_shown"}),{qa_loop:{message:"To ask questions, please log in first.",component:e.createElement(cs,{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((!s||!s())&&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){Ts("Error sending feedback:",e)}}return"Thanks for the feedback!"}try{const r=hs();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 s=i();s&&(A["X-Session-ID"]=s,A["X-Query-ID"]=r),A["X-Origin"]=g||"access";const l={query:a,question_id:r};s&&(l.session_id=s),p&&(l._backend=p),g&&(l.rp_name=g);const c=null==d?void 0:d();c&&(l.turnstile_token=c),Bs("SENT to API",{session_id:s,question_id:r});const w=Date.now(),b=await fetch(n,{method:"POST",headers:A,credentials:"include",body:JSON.stringify(l)});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="",s=!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){Ss("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"),s=!0}else if("token"===r){i+=n.content||"";const t=Ks(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=Ks(t);await e.streamMessage(n,"BOT"),s=!0}s&&await e.endStreamMessage("BOT")}}else if("error"===r){const t=n.message||"An error occurred";Ts("SSE error event:",t),s?(await e.streamMessage(t,"BOT"),await e.endStreamMessage("BOT")):await e.injectMessage(t)}a=o.indexOf("\n\n")}else a=o.indexOf("\n\n")}}s&&await e.endStreamMessage("BOT")}catch(t){if(Ts("Error reading SSE stream:",t),!s)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,x=await b.json();if(x.requires_turnstile)return null==u||u({type:"chatbot_turnstile_shown",queryId:r}),y.siteKey=x.site_key,y.pendingQuery={query:a,sessionId:s,queryId:r},y.needsChallenge=!0,"One moment — verifying your session…";null==f||f();const P=x.response||x.answer||x.text||x.message;if(!P)throw new Error("Invalid response format from API");const B=x.metadata||{};m=B.rating_target||null,v=!0===B.is_final_response;const C=Ks(P),D=ms()?Zs(x):"",k=D?`${C}\n\n${D}`:C;return await e.injectMessage(k),void(null==u||u({type:"chatbot_answer_received",queryId:r,responseTimeMs:E,success:!0,responseLength:P.length,hasMetadata:!!D}))}catch(e){return Ts("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=>s&&s()||"👍 Helpful"===e.userInput||"👎 Not helpful"===e.userInput||y.needsChallenge?[]:v&&m&&("agent"===m?A:r)?["👍 Helpful","👎 Not helpful"]:[],renderMarkdown:["BOT"],chatDisabled:!1,component:e.createElement($s,{getState:()=>y,onResubmit:async e=>{var t;if(!y.pendingQuery||!w)return Ts("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)}),s=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 s=r.indexOf("\n\n");for(;-1!==s;){const e=r.slice(0,s);r=r.slice(s+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){}s=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=s;const a=Ks(A);return await w(a),null==u||u({type:"chatbot_answer_received",queryId:s,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 l=a.response||a.answer||a.text||a.message;if(!l)throw new Error("Invalid response format from API");const c=a.metadata||{};m=c.rating_target||null,v=!0===c.is_final_response,h=s;const d=Ks(l),f=ms()?Zs(a):"",b=f?`${d}\n\n${f}`:d;return await w(b),null==u||u({type:"chatbot_answer_received",queryId:s,success:!0,responseLength:l.length}),"success"}catch(e){return Ts("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:s,ratingEndpoint:a,agentRatingEndpoint:u,apiKey:i,sessionId:R.current.getSessionId,isResetting:R.current.isResetting,isLoggedIn:U,allowAnonAccess:h,loginUrl:k||la,trackEvent:q,getTurnstileToken:()=>F.current,resetTurnstileToken:()=>H.reset(),backendId:T,resourceContext:I}),n={message:d,renderMarkdown:["BOT"],transition:{duration:0},path:"qa_loop"};return Object.assign(Object.assign({start:n},t),Q||{})},[i,s,a,u,d,U,h,k,Q,m,q,I,T]),X=e.useMemo(()=>{return[()=>bn(t),ns(),()=>os(e)];var e,t},[]);return e.useEffect(()=>{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)},[]),Ys(),e.useEffect(()=>{const e=Y.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")||q({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)},[q]),e.useEffect(()=>{if(!_){const e=e=>{const t=e.data.newState;null==p||p(t);const n=L.current;q(t?{type:"chatbot_open"}:{type:"chatbot_close",messageCount:n?Ls(n):0,durationMs:n?js(n):0})};return window.addEventListener("rcb-toggle-chat-window",e),()=>{window.removeEventListener("rcb-toggle-chat-window",e)}}},[_,p,q]),e.createElement("div",{className:"qa-bot "+((null===(r=G.general)||void 0===r?void 0:r.embedded)?"embedded-qa-bot":""),ref:Y,role:"region","aria-label":`${w||ra}${(null===(A=G.general)||void 0===A?void 0:A.embedded)?" - Embedded":""}`},e.createElement(Ns,{getSessionId:()=>L.current,setSessionId:e=>{const t=L.current;L.current=e,Bs("RESTORED",`${null==t?void 0:t.slice(-12)} -> ${e.slice(-12)}`)},resetSession:()=>{const e=L.current;j.current=!0,L.current=Qs(),Bs("RESET",`${null==e?void 0:e.slice(-12)} -> ${L.current.slice(-12)}`)},clearResettingFlag:()=>{j.current=!1}},e.createElement(as,{trackEvent:q},e.createElement(Ot,null,e.createElement("div",null,e.createElement(Gs,null),e.createElement(is,{ref:n,embedded:(null===(o=G.general)||void 0===o?void 0:o.embedded)||!1,currentOpen:f||!1,enabled:!1!==U,onSetEnabled:e=>z(!!e&&void 0)}),e.createElement(Nt,{key:`chatbot-${O.current}-${U}`,settings:G,flow:V,plugins:X}),e.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}}),e.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."))))))});ua.displayName="QABot";const da=()=>{const[t,n]=e.useState(!1),r=()=>"undefined"!=typeof navigator&&void 0!==navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getDisplayMedia;return{captureScreenshot:async()=>{if(!r())throw new Error("Screen capture is not available in this environment");try{n(!0);const e=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",cursor:"always",width:{ideal:1920},height:{ideal:1080}},audio:!1}),t=document.createElement("video");t.srcObject=e,await new Promise(e=>{t.onloadedmetadata=()=>{t.play(),e()}});const r=document.createElement("canvas");r.width=t.videoWidth,r.height=t.videoHeight;const A=r.getContext("2d");if(!A)throw new Error("Could not get canvas context");A.drawImage(t,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,"-"),s=new File([o],`screenshot-${i}.png`,{type:"image/png"});return e.getTracks().forEach(e=>e.stop()),n(!1),s}catch(e){throw Ts("Error capturing screenshot:",e),n(!1),e}},isCapturing:t,isScreenCaptureAvailable:r()}},fa=t=>e.createElement(Us,t,e.createElement("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.createElement("polyline",{points:"17 8 12 3 7 8"}),e.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),pa=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)}),ga=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`;const ha=e.forwardRef((t,n)=>{var{defaultOpen:r}=t,A=a(t,["defaultOpen"]);const[o,i]=e.useState(r||!1),l=e.useRef(null);return e.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()}}),[]),e.createElement(ua,s({ref:l},A,{open:o,onOpenChange:i}))});function ma(n){if(!(n.target&&n.target instanceof HTMLElement))return void Ts("QA Bot: A valid target DOM element is required");const{target:r}=n,A=a(n,["target"]),o=t.createRoot(r),i={current:null};return o.render(e.createElement(e.StrictMode,null,e.createElement(ha,s({ref:e=>{i.current=e}},A)))),{addMessage:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.addMessage(e)},setBotEnabled:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.setBotEnabled(e)},openChat:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.openChat()},closeChat:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.closeChat()},toggleChat:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.toggleChat()},destroy:()=>{i.current=null,o.unmount()}}}ha.displayName="ProgrammaticQABot",exports.FileUploadComponent=t=>{let{onFileUpload:n,maxSizeMB:r=10,acceptedTypes:A="image/*,application/pdf,text/*,.doc,.docx",enableScreenshot:o=!1,className:i}=t;const[s,a]=e.useState(!1),[l,c]=e.useState([]),[u,d]=e.useState(null),f=e.useRef(null),{captureScreenshot:p,isCapturing:g,isScreenCaptureAvailable:h}=da(),m=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)},v=e=>{if(!e||0===e.length)return void Ss("FileUploadComponent: No valid files provided to handleFiles");let t;try{t=Array.from(e)}catch(e){return Ts("FileUploadComponent: Error converting files to array:",e),void m("Error processing selected files. Please try again.")}const r=[...l,...t];c(r);const A=t.length,o=t.map(e=>e.name).join(", ");m(`${A} file${A>1?"s":""} selected: ${o}`),setTimeout(()=>{const e=document.querySelector(".rcb-chat-content");e&&(e.scrollTop=e.scrollHeight)},100),n&&n(r)},y=e=>{e.preventDefault(),e.stopPropagation(),"dragenter"===e.type||"dragover"===e.type?a(!0):"dragleave"===e.type&&a(!1)},w=()=>{try{f.current&&f.current.click()}catch(e){Ts("FileUploadComponent: Error in handleButtonClick:",e),m("Error opening file selection dialog. Please try again.")}},b=()=>{d(null)},E=o&&h;return e.createElement("div",{className:`file-upload-container ${i||""}`,style:{padding:"16px",margin:"8px 0"}},E&&e.createElement("div",{style:{display:"flex",justifyContent:"center",marginBottom:"10px"}},e.createElement("button",{onClick:e=>{e.preventDefault(),(async()=>{try{const e=await p();v([e]),m("Screenshot captured successfully")}catch(e){m("Error capturing screenshot. Please try again.")}})()},disabled:g,"aria-describedby":"screenshot-help","aria-label":g?"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:g?"not-allowed":"pointer",fontSize:"14px",fontWeight:"500",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}},e.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"},e.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"}),e.createElement("circle",{cx:"12",cy:"13",r:"4"})),g?"Taking screenshot...":"Take screenshot..."),e.createElement("span",{id:"screenshot-help",className:"sr-only"},"Captures the current screen and adds it as an attachment")),e.createElement("div",{className:"file-upload-dropzone "+(s?"active":""),onDragEnter:y,onDragLeave:y,onDragOver:y,onDrop:e=>{var t;e.preventDefault(),e.stopPropagation(),a(!1);try{(null===(t=e.dataTransfer)||void 0===t?void 0:t.files)&&e.dataTransfer.files.length>0&&v(e.dataTransfer.files)}catch(e){Ts("FileUploadComponent: Error in handleDrop:",e),m("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(),w())},style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",backgroundColor:s?"#f0f8ff":"#fafafa",transition:"all 0.3s ease"}},e.createElement("input",{ref:f,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&&v(e.target.files)}catch(e){Ts("FileUploadComponent: Error in handleFileSelect:",e),m("Error processing selected files. Please try again.")}},multiple:!0,style:{display:"none"},"aria-label":"Select files to upload",accept:A}),e.createElement("div",{className:"upload-content",onClick:w,style:{cursor:"pointer",flexDirection:"column",alignItems:"center",display:"flex",textAlign:"center",padding:"12px"}},e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"}},e.createElement(fa,null),e.createElement("p",{style:{margin:0,fontWeight:"bold"}},"Upload Files")),e.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)")),l.length>0&&e.createElement("div",{className:"selected-files",style:{display:"flex",flexWrap:"wrap",gap:"8px",marginTop:"12px",alignItems:"center"}},e.createElement("span",{style:{fontWeight:400,color:"#888",fontSize:"13px",marginRight:"8px",alignSelf:"center"}},"Selected files:"),l.map((t,r)=>e.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:e=>{e.stopPropagation(),(e=>{d(e)})(t)}},e.createElement("span",{onClick:e=>{e.stopPropagation(),(e=>{const t=l.filter((t,n)=>n!==e);c(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 ${t.name}`},"×"),t.name," (",ga(t.size),")"))))),(()=>{if(!u)return null;const t=u.type.startsWith("image/"),n=u.type.startsWith("text/"),r="application/pdf"===u.type;return e.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:b},e.createElement("div",{style:{backgroundColor:"white",padding:"20px",borderRadius:"8px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{onClick:b,style:{position:"absolute",top:"10px",right:"10px",background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#666"}},"×"),e.createElement("h3",{style:{marginTop:0,marginBottom:"16px"}},u.name),t&&e.createElement("img",{src:URL.createObjectURL(u),alt:u.name,style:{maxWidth:"100%",maxHeight:"70vh"}}),n&&e.createElement("pre",{style:{whiteSpace:"pre-wrap",wordWrap:"break-word",maxHeight:"70vh",overflow:"auto",padding:"16px",backgroundColor:"#f5f5f5",borderRadius:"4px"}},URL.createObjectURL(u)),r&&e.createElement("iframe",{src:URL.createObjectURL(u),style:{width:"100%",height:"70vh",border:"none"},title:u.name}),!t&&!n&&!r&&e.createElement("div",{style:{padding:"20px",textAlign:"center"}},"Preview not available for this file type")))})())},exports.QABot=ua,exports.applyFlowSettings=function(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},exports.default=ma,exports.fileToBase64=pa,exports.filesToBase64=e=>Promise.all(e.map(pa)),exports.formatFileSize=ga,exports.qaBot=ma,exports.useScreenshotCapture=da,exports.validateFileSize=function(e){const t=1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:10)*1024;return e.size<=t},exports.withHistory=function(e){return async t=>{await t.injectMessage(e)}},exports.withHistoryFn=function(e){return async t=>{const n=await e(t);await t.injectMessage(n)}};
|
|
8
|
+
*/var rn,An;const on=nn(function(){if(An)return rn;An=1;var e=/["'&<>]/;return rn=function(t){var n=""+t,r=e.exec(n);if(!r)return n;var A,o="",i=0,s=0;for(i=r.index;i<n.length;i++){switch(n.charCodeAt(i)){case 34:A=""";break;case 38:A="&";break;case 39:A="'";break;case 60:A="<";break;case 62:A=">";break;default:continue}s!==i&&(o+=n.substring(s,i)),s=i+1,o+=A}return s!==i?o+n.substring(s,i):o}}());function sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const an=/(url|image|image-set)\(/i;class ln extends tn{attribute(e,t){return"style"===e&&Object.keys(t).forEach(e=>{String(t[e]).match(an)&&delete t[e]}),t}}const cn=/^<(!doctype|(html|head|body)(\s|>))/i,un=/^(aria-|data-|\w+:)/iu,dn=/{{{(\w+)\/?}}}/;function fn(){if(!(typeof window>"u"||typeof document>"u"))return document.implementation.createHTMLDocument("Interweave")}let pn=class{constructor(e,t={},n=[],r=[]){var A;if(sn(this,"allowed",void 0),sn(this,"banned",void 0),sn(this,"blocked",void 0),sn(this,"container",void 0),sn(this,"content",[]),sn(this,"props",void 0),sn(this,"matchers",void 0),sn(this,"filters",void 0),sn(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 ln],this.keyIndex=-1,this.container=this.createContainer(e||""),this.allowed=new Set(null!==(A=t.allowList)&&void 0!==A?A:Kt),this.banned=new Set(Xt),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 s=e.asTag().toLowerCase(),a=this.getTagConfig(s);if(r[e.inverseName]||!this.isTagAllowed(s)||!this.canRenderChild(t,a))return;let l="";for(;A&&(i=e.match(A));){const{index:t,length:s,match:a,valid:c,void:u,...d}=i,f=e.propName+String(o);t>0&&(l+=A.slice(0,t)),c?(l+=u?`{{{${f}/}}}`:`{{{${f}}}}${a}{{{/${f}}}}`,this.keyIndex+=1,o+=1,n[f]={children:a,matcher:e,props:{...r,...d,key:this.keyIndex}}):l+=a,e.greedy?(A=l+A.slice(t+s),l=""):A=A.slice(t+(s||a.length))}e.greedy||(A=l+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||fn)();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(cn)){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?on(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,s=o.toLowerCase(),a=Jt[s]||Jt[o];if(!this.isSafe(e)||!s.match(un)&&(!t&&(!a||2===a)||s.startsWith("on")||i.replace(/(\s|\0|�([9AD]);)/,"").match(/(javascript|vbscript|livescript|xss):/i)))return;let l="style"===s?this.extractStyleAttribute(e):i;4===a?l=!0:3===a?l=Number.parseFloat(String(l)):5!==a&&(l=String(l)),n[Zt[s]||s]=this.applyAttributeFilters(s,l),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 Vt[e]?{...t,...Vt[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(t,n){const{noHtml:r,noHtmlExceptMatchers:A,allowElements:o,transform:i,transformOnlyAllowList:s}=this.props;let a=[],l="";return[...t.childNodes].forEach(t=>{if(1===t.nodeType){const u=t.nodeName.toLowerCase(),d=this.getTagConfig(u);l&&(a.push(l),l="");const f=this.applyNodeFilters(u,t);if(!f)return;let p;if(i&&(!s||this.isTagAllowed(u))){this.keyIndex+=1;const t=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(e.cloneElement(n,{key:t}));this.keyIndex=t-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 t=this.extractAttributes(f),n={tagName:u};t&&(n.attributes=t),d.void&&(n.selfClose=d.void),a.push(e.createElement(en,{...n,key:this.keyIndex},null!==(c=p)&&void 0!==c?c:this.parseNode(f,d)))}}else if(3===t.nodeType){const e=r&&!A?t.textContent:this.applyMatchers(t.textContent||"",n);Array.isArray(e)?a=[...a,...e]:l+=e}}),l&&a.push(l),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,s=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:l,props:c}=t[o];let u;if(s)u=e.length,n.push(l.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(l.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 gn(t){var n;const{attributes:r,className:A,containerTagName:o,content:i,emptyContent:s,parsedContent:a,tagName:l,noWrap:c}=t,u=null!==(n=o??l)&&void 0!==n?n:"span",d="fragment"===u||c;let f;if(a)f=a;else{const e=new pn(i??"",t).parse();e.length>0&&(f=e)}return f||(f=s),d?e.createElement(e.Fragment,null,f):e.createElement(en,{attributes:r,className:A,tagName:u},f)}function hn(t){const{attributes:n,className:r,content:A="",disableFilters:o=!1,disableMatchers:i=!1,emptyContent:s=null,filters:a=[],matchers:l=[],onAfterParse:c=null,onBeforeParse:u=null,tagName:d="span",noWrap:f=!1,...p}=t,g=i?[]:l,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((e,n)=>{const r=n(e,t);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 pn(y,p,g,h),b=v.reduce((e,n)=>{const r=n(e,t);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 e.createElement(gn,{attributes:n,className:r,containerTagName:t.containerTagName,emptyContent:s,noWrap:f,parsedContent:0===b.length?void 0:b,tagName:d})}const mn=({children:e})=>n.jsx("div",{style:{whiteSpace:"normal"},children:n.jsx(hn,{content:"string"==typeof e?e:""})}),vn={autoConfig:!0},yn=(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)},wn=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},bn=t=>{const{getFlow:n}=Ft(),{messages:r,replaceMessages:A}=Ut(),{settings:o}=_t(),{hasChatHistoryLoaded:i}=Gt(),s={...t,...vn},a=s.htmlComponent?s.htmlComponent:mn;e.useEffect(()=>{var e,t;if(i){const n=[...r];for(let r=0;r<n.length&&r<((null==(e=o.chatHistory)?void 0:e.maxEntries)??30);r++){const e=n[r];null!=(t=e.tags)&&t.includes("rcb-html-renderer-plugin:parsed")&&(e.contentWrapper=a)}A(n)}},[i]);const l=async e=>{var t;const r=null==(t=e.data.message)?void 0:t.sender.toUpperCase();"string"==typeof e.data.message.content&&yn(e,n(),r)&&("rcb-start-simulate-stream-message"===e.type&&(e.data.simulateStreamChunker=wn),e.data.message.contentWrapper=a,e.data.message.tags||(e.data.message.tags=[]),e.data.message.tags.push("rcb-html-renderer-plugin:parsed"))};zt(N.PRE_INJECT_MESSAGE,l),zt(N.CHUNK_STREAM_MESSAGE,l),zt(N.START_STREAM_MESSAGE,l),zt(N.START_SIMULATE_STREAM_MESSAGE,l),zt(N.START_SPEAK_AUDIO,async e=>{yn(e,n(),"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!=s&&s.autoConfig&&(c.settings={event:{rcbPreInjectMessage:!0,rcbChunkStreamMessage:!0,rcbStartSimulateStreamMessage:!0,rcbStartStreamMessage:!0,rcbStartSpeakAudio:!0}}),c};const En=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xn=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pn={};function Bn(e,t){return(Pn.jsx?xn:En).test(e)}const Cn=/[ \t\n\f\r]/g;function Dn(e){return""===e.replace(Cn,"")}class kn{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}}function Sn(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 kn(n,r,t)}function Tn(e){return e.toLowerCase()}kn.prototype.property={},kn.prototype.normal={},kn.prototype.space=null;class In{constructor(e,t){this.property=e,this.attribute=t}}In.prototype.space=null,In.prototype.boolean=!1,In.prototype.booleanish=!1,In.prototype.overloadedBoolean=!1,In.prototype.number=!1,In.prototype.commaSeparated=!1,In.prototype.spaceSeparated=!1,In.prototype.commaOrSpaceSeparated=!1,In.prototype.mustUseProperty=!1,In.prototype.defined=!1;let Qn=0;const Mn=Fn(),On=Fn(),Ln=Fn(),jn=Fn(),Rn=Fn(),Nn=Fn(),Hn=Fn();function Fn(){return 2**++Qn}const Un=Object.freeze(Object.defineProperty({__proto__:null,boolean:Mn,booleanish:On,commaOrSpaceSeparated:Hn,commaSeparated:Nn,number:jn,overloadedBoolean:Ln,spaceSeparated:Rn},Symbol.toStringTag,{value:"Module"})),zn=Object.keys(Un);class _n extends In{constructor(e,t,n,r){let A=-1;if(super(e,t),qn(this,"space",r),"number"==typeof n)for(;++A<zn.length;){const e=zn[A];qn(this,zn[A],(n&Un[e])===Un[e])}}}function qn(e,t,n){n&&(e[t]=n)}_n.prototype.defined=!0;const Gn={}.hasOwnProperty;function Yn(e){const t={},n={};let r;for(r in e.properties)if(Gn.call(e.properties,r)){const A=e.properties[r],o=new _n(r,e.transform(e.attributes||{},r),A,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Tn(r)]=r,n[Tn(o.attribute)]=r}return new kn(t,n,e.space)}const Wn=Yn({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}}),Vn=Yn({space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Xn(e,t){return t in e?e[t]:t}function Kn(e,t){return Xn(e,t.toLowerCase())}const Jn=Yn({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:Kn,properties:{xmlns:null,xmlnsXLink:null}}),Zn=Yn({transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:On,ariaAutoComplete:null,ariaBusy:On,ariaChecked:On,ariaColCount:jn,ariaColIndex:jn,ariaColSpan:jn,ariaControls:Rn,ariaCurrent:null,ariaDescribedBy:Rn,ariaDetails:null,ariaDisabled:On,ariaDropEffect:Rn,ariaErrorMessage:null,ariaExpanded:On,ariaFlowTo:Rn,ariaGrabbed:On,ariaHasPopup:null,ariaHidden:On,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rn,ariaLevel:jn,ariaLive:null,ariaModal:On,ariaMultiLine:On,ariaMultiSelectable:On,ariaOrientation:null,ariaOwns:Rn,ariaPlaceholder:null,ariaPosInSet:jn,ariaPressed:On,ariaReadOnly:On,ariaRelevant:null,ariaRequired:On,ariaRoleDescription:Rn,ariaRowCount:jn,ariaRowIndex:jn,ariaRowSpan:jn,ariaSelected:On,ariaSetSize:jn,ariaSort:null,ariaValueMax:jn,ariaValueMin:jn,ariaValueNow:jn,ariaValueText:null,role:null}}),$n=Yn({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:Kn,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Nn,acceptCharset:Rn,accessKey:Rn,action:null,allow:null,allowFullScreen:Mn,allowPaymentRequest:Mn,allowUserMedia:Mn,alt:null,as:null,async:Mn,autoCapitalize:null,autoComplete:Rn,autoFocus:Mn,autoPlay:Mn,blocking:Rn,capture:null,charSet:null,checked:Mn,cite:null,className:Rn,cols:jn,colSpan:null,content:null,contentEditable:On,controls:Mn,controlsList:Rn,coords:jn|Nn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Mn,defer:Mn,dir:null,dirName:null,disabled:Mn,download:Ln,draggable:On,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Mn,formTarget:null,headers:Rn,height:jn,hidden:Mn,high:jn,href:null,hrefLang:null,htmlFor:Rn,httpEquiv:Rn,id:null,imageSizes:null,imageSrcSet:null,inert:Mn,inputMode:null,integrity:null,is:null,isMap:Mn,itemId:null,itemProp:Rn,itemRef:Rn,itemScope:Mn,itemType:Rn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Mn,low:jn,manifest:null,max:null,maxLength:jn,media:null,method:null,min:null,minLength:jn,multiple:Mn,muted:Mn,name:null,nonce:null,noModule:Mn,noValidate:Mn,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:Mn,optimum:jn,pattern:null,ping:Rn,placeholder:null,playsInline:Mn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Mn,referrerPolicy:null,rel:Rn,required:Mn,reversed:Mn,rows:jn,rowSpan:jn,sandbox:Rn,scope:null,scoped:Mn,seamless:Mn,selected:Mn,shadowRootClonable:Mn,shadowRootDelegatesFocus:Mn,shadowRootMode:null,shape:null,size:jn,sizes:null,slot:null,span:jn,spellCheck:On,src:null,srcDoc:null,srcLang:null,srcSet:null,start:jn,step:null,style:null,tabIndex:jn,target:null,title:null,translate:null,type:null,typeMustMatch:Mn,useMap:null,value:On,width:jn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rn,axis:null,background:null,bgColor:null,border:jn,borderColor:null,bottomMargin:jn,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Mn,declare:Mn,event:null,face:null,frame:null,frameBorder:null,hSpace:jn,leftMargin:jn,link:null,longDesc:null,lowSrc:null,marginHeight:jn,marginWidth:jn,noResize:Mn,noHref:Mn,noShade:Mn,noWrap:Mn,object:null,profile:null,prompt:null,rev:null,rightMargin:jn,rules:null,scheme:null,scrolling:On,standby:null,summary:null,text:null,topMargin:jn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:jn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Mn,disableRemotePlayback:Mn,prefix:null,property:null,results:jn,security:null,unselectable:null}}),er=Yn({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:Xn,properties:{about:Hn,accentHeight:jn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:jn,amplitude:jn,arabicForm:null,ascent:jn,attributeName:null,attributeType:null,azimuth:jn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:jn,by:null,calcMode:null,capHeight:jn,className:Rn,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:jn,diffuseConstant:jn,direction:null,display:null,dur:null,divisor:jn,dominantBaseline:null,download:Mn,dx:null,dy:null,edgeMode:null,editable:null,elevation:jn,enableBackground:null,end:null,event:null,exponent:jn,externalResourcesRequired:null,fill:null,fillOpacity:jn,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:Nn,g2:Nn,glyphName:Nn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:jn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:jn,horizOriginX:jn,horizOriginY:jn,id:null,ideographic:jn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:jn,k:jn,k1:jn,k2:jn,k3:jn,k4:jn,kernelMatrix:Hn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:jn,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:jn,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:jn,overlineThickness:jn,paintOrder:null,panose1:null,path:null,pathLength:jn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:jn,pointsAtY:jn,pointsAtZ:jn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Hn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Hn,rev:Hn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Hn,requiredFeatures:Hn,requiredFonts:Hn,requiredFormats:Hn,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:jn,specularExponent:jn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:jn,strikethroughThickness:jn,string:null,stroke:null,strokeDashArray:Hn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:jn,strokeOpacity:jn,strokeWidth:null,style:null,surfaceScale:jn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Hn,tabIndex:jn,tableValues:null,target:null,targetX:jn,targetY:jn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Hn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:jn,underlineThickness:jn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:jn,values:null,vAlphabetic:jn,vMathematical:jn,vectorEffect:null,vHanging:jn,vIdeographic:jn,version:null,vertAdvY:jn,vertOriginX:jn,vertOriginY:jn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:jn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),tr=/^data[-\w.:]+$/i,nr=/-[a-z]/g,rr=/[A-Z]/g;function Ar(e){return"-"+e.toLowerCase()}function or(e){return e.charAt(1).toUpperCase()}const ir={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"},sr=Sn([Vn,Wn,Jn,Zn,$n],"html"),ar=Sn([Vn,Wn,Jn,Zn,er],"svg");function lr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cr,ur,dr,fr={};var pr=function(){if(dr)return fr;dr=1;var e=fr&&fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fr,"__esModule",{value:!0}),fr.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(ur)return cr;ur=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,A=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,s=/^\s+|\s+$/g,a="";function l(e){return e?e.replace(s,a):a}return cr=function(s,c){if("string"!=typeof s)throw new TypeError("First argument must be a string");if(!s)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=s,!c.silent)throw t}function m(e){var t=e.exec(s);if(t){var n=t[0];return f(n),s=s.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("/"==s.charAt(0)&&"*"==s.charAt(1)){for(var t=2;a!=s.charAt(t)&&("*"!=s.charAt(t)||"/"!=s.charAt(t+1));)++t;if(t+=2,a===s.charAt(t-1))return h("End of comment missing");var n=s.slice(2,t-2);return d+=2,f(n),s=s.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 s=m(o),c=t({type:"declaration",property:l(n[0].replace(e,a)),value:s?l(s[0].replace(e,a)):a});return m(i),c}}return g.prototype.content=s,v(),function(){var e,t=[];for(y(t);e=b();)!1!==e&&(t.push(e),y(t));return t}()},cr}());return fr}();const gr=lr(pr),hr=gr.default||gr,mr=yr("end"),vr=yr("start");function yr(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 wr(e){return e&&"object"==typeof e?"position"in e||"type"in e?Er(e.position):"start"in e||"end"in e?Er(e):"line"in e||"column"in e?br(e):"":""}function br(e){return xr(e&&e.line)+":"+xr(e&&e.column)}function Er(e){return br(e&&e.start)+"-"+br(e&&e.end)}function xr(e){return e&&"number"==typeof e?e:1}class Pr 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=wr(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}}Pr.prototype.file="",Pr.prototype.name="",Pr.prototype.reason="",Pr.prototype.message="",Pr.prototype.stack="",Pr.prototype.column=void 0,Pr.prototype.line=void 0,Pr.prototype.ancestors=void 0,Pr.prototype.cause=void 0,Pr.prototype.fatal=void 0,Pr.prototype.place=void 0,Pr.prototype.ruleId=void 0,Pr.prototype.source=void 0;const Br={}.hasOwnProperty,Cr=new Map,Dr=/[A-Z]/g,kr=/-([a-z])/g,Sr=new Set(["table","tbody","thead","tfoot","tr"]),Tr=new Set(["td","th"]),Ir="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Qr(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),s=vr(n);return t(r,A,o,i,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.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?ar:sr,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},o=Mr(A,e,void 0);return o&&"string"!=typeof o?o:A.create(e,A.Fragment,{children:o||void 0},void 0)}function Mr(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=ar,e.schema=A),e.ancestors.push(t);const o=Nr(e,t.tagName,!1),i=function(e,t){const n={};let r,A;for(A in t.properties)if("children"!==A&&Br.call(t.properties,A)){const o=Rr(e,A,t.properties[A]);if(o){const[A,i]=o;e.tableCellAlignToStyle&&"align"===A&&"string"==typeof i&&Tr.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 s=jr(e,t);return Sr.has(t.tagName)&&(s=s.filter(function(e){return"string"!=typeof e||!function(e){return"object"==typeof e?"text"===e.type&&Dn(e.value):Dn(e)}(e)})),Or(e,i,o,t),Lr(i,s),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)}Hr(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=ar,e.schema=A),e.ancestors.push(t);const o=null===t.name?e.Fragment:Nr(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 Hr(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 Hr(e,t.position);else o=null===r.value||r.value;n[A]=o}return n}(e,t),s=jr(e,t);return Or(e,i,o,t),Lr(i,s),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);Hr(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const r={};return Lr(r,jr(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 Or(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Lr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function jr(e,t){const n=[];let r=-1;const A=e.passKeys?new Map:Cr;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 s=Mr(e,o,i);void 0!==s&&n.push(s)}return n}function Rr(e,t,n){const r=function(e,t){const n=Tn(t);let r=t,A=In;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&tr.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(nr,or);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!nr.test(e)){let n=e.replace(rr,Ar);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}A=_n}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{hr(t,r)}catch(t){if(!e.ignoreInvalidStyle){const n=t,r=new Pr("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=Ir+"#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(kr,Ur)),n[r]=t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)Br.call(e,n)&&(t[Fr(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?ir[r.property]||r.property:r.attribute,n]}}function Nr(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,A=-1;for(;++A<e.length;){const t=Bn(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=Bn(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 Br.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Hr(e)}function Hr(e,t){const n=new Pr("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=Ir+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Fr(e){let t=e.replace(Dr,zr);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function Ur(e,t){return t.toUpperCase()}function zr(e){return"-"+e.toLowerCase()}const _r={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"]},qr={};function Gr(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 Yr(e.children,t,n)}return Array.isArray(e)?Yr(e,t,n):""}function Yr(e,t,n){const r=[];let A=-1;for(;++A<e.length;)r[A]=Gr(e[A],t,n);return r.join("")}const Wr=document.createElement("i");function Vr(e){const t="&"+e+";";Wr.innerHTML=t;const n=Wr.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}function Xr(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 Kr(e,t){return e.length>0?(Xr(e,e.length,0,t),e):t}const Jr={}.hasOwnProperty;function Zr(e){const t={};let n=-1;for(;++n<e.length;)$r(t,e[n]);return t}function $r(e,t){let n;for(n in t){const r=(Jr.call(e,n)?e[n]:void 0)||(e[n]={}),A=t[n];let o;if(A)for(o in A){Jr.call(r,o)||(r[o]=[]);const e=A[o];eA(r[o],Array.isArray(e)?e:e?[e]:[])}}}function eA(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);Xr(e,0,0,r)}function tA(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 nA(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rA=gA(/[A-Za-z]/),AA=gA(/[\dA-Za-z]/),oA=gA(/[#-'*+\--9=?A-Z^-~]/);function iA(e){return null!==e&&(e<32||127===e)}const sA=gA(/\d/),aA=gA(/[\dA-Fa-f]/),lA=gA(/[!-/:-@[-`{-~]/);function cA(e){return null!==e&&e<-2}function uA(e){return null!==e&&(e<0||32===e)}function dA(e){return-2===e||-1===e||32===e}const fA=gA(new RegExp("\\p{P}|\\p{S}","u")),pA=gA(/\s/);function gA(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function hA(e){const t=[];let n=-1,r=0,A=0;for(;++n<e.length;){const o=e.charCodeAt(n);let i="";if(37===o&&AA(e.charCodeAt(n+1))&&AA(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 mA(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 vA={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"),mA(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)):cA(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),A)}}};const yA={tokenize:function(e){const t=this,n=[];let r,A,o,i=0;return s;function s(r){if(i<n.length){const A=n[i];return t.containerState=A[1],e.attempt(A[0].continuation,a,l)(r)}return l(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 s=n;for(;s<t.events.length;)t.events[s][1].end={...A},s++;return Xr(t.events,o+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(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(wA,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(wA,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)):cA(n)?(e.consume(n),h(e.exit("chunkFlow")),i=0,t.interrupt=void 0,s):(e.consume(n),g)}function h(e,n){const s=t.sliceStream(e);if(n&&s.push(null),e.previous=A,A&&(A.next=e),A=e,r.defineSkip(e.start),r.write(s),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,s,a=n;for(;a--;)if("exit"===t.events[a][0]&&"chunkFlow"===t.events[a][1].type){if(A){s=t.events[a][1].end;break}A=!0}for(m(i),e=n;e<t.events.length;)t.events[e][1].end={...s},e++;Xr(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}}},wA={tokenize:function(e,t,n){return mA(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function bA(e){return null===e||uA(e)||pA(e)?1:fA(e)?2:void 0}function EA(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 xA={name:"attention",resolveAll:function(e,t){let n,r,A,o,i,s,a,l,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;s=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};PA(u,-s),PA(d,s),o={type:s>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},i={type:s>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:d},A={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[c][1].start}},r={type:s>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=Kr(a,[["enter",e[n][1],t],["exit",e[n][1],t]])),a=Kr(a,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",A,t]]),a=Kr(a,EA(t.parser.constructs.insideSpan.null,e.slice(n+1,c),t)),a=Kr(a,[["exit",A,t],["enter",i,t],["exit",i,t],["exit",r,t]]),e[c][1].end.offset-e[c][1].start.offset?(l=2,a=Kr(a,[["enter",e[c][1],t],["exit",e[c][1],t]])):l=0,Xr(e,n-1,c-n+3,a),c=n+a.length-l-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=bA(r);let o;return function(t){return o=t,e.enter("attentionSequence"),i(t)};function i(s){if(s===o)return e.consume(s),i;const a=e.exit("attentionSequence"),l=bA(s),c=!l||2===l&&A||n.includes(s),u=!A||2===A&&l||n.includes(r);return a._open=!!(42===o?c:c&&(A||!u)),a._close=!!(42===o?u:u&&(l||!c)),t(s)}}};function PA(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const BA={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 rA(t)?(e.consume(t),o):64===t?n(t):a(t)}function o(e){return 43===e||45===e||46===e||AA(e)?(r=1,i(e)):a(e)}function i(t){return 58===t?(e.consume(t),r=0,s):(43===t||45===t||46===t||AA(t))&&r++<32?(e.consume(t),i):(r=0,a(t))}function s(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||iA(r)?n(r):(e.consume(r),s)}function a(t){return 64===t?(e.consume(t),l):oA(t)?(e.consume(t),a):n(t)}function l(e){return AA(e)?c(e):n(e)}function c(n){return 46===n?(e.consume(n),r=0,l):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||AA(t))&&r++<63){const n=45===t?u:c;return e.consume(t),n}return n(t)}}};const CA={partial:!0,tokenize:function(e,t,n){return function(t){return dA(t)?mA(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||cA(e)?t(e):n(e)}}};const DA={continuation:{tokenize:function(e,t,n){const r=this;return function(t){return dA(t)?mA(e,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):A(t)};function A(r){return e.attempt(DA,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 kA={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 lA(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const SA={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"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),a):(e.enter("characterReferenceValue"),A=31,o=AA,l(t))}function a(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),A=6,o=aA,l):(e.enter("characterReferenceValue"),A=7,o=sA,l(t))}function l(s){if(59===s&&i){const A=e.exit("characterReferenceValue");return o!==AA||Vr(r.sliceSerialize(A))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(s)}return o(s)&&i++<A?(e.consume(s),l):n(s)}}};const TA={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)}}},IA={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)?mA(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===o?(e.enter("codeFencedFenceSequence"),c(t)):n(t)}function c(t){return t===o?(A++,e.consume(t),c):A>=s?(e.exit("codeFencedFenceSequence"),dA(t)?mA(e,u,"whitespace")(t):u(t)):n(t)}function u(r){return null===r||cA(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let o,i=0,s=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?(s++,e.consume(t),a):s<3?n(t):(e.exit("codeFencedFenceSequence"),dA(t)?mA(e,l,"whitespace")(t):l(t))}function l(n){return null===n||cA(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(TA,f,v)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),c(n))}function c(t){return null===t||cA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(t)):dA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),mA(e,u,"whitespace")(t)):96===t&&t===o?n(t):(e.consume(t),c)}function u(t){return null===t||cA(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(t))}function d(t){return null===t||cA(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(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)?mA(e,h,"linePrefix",i+1)(t):h(t)}function h(t){return null===t||cA(t)?e.check(TA,f,v)(t):(e.enter("codeFlowValue"),m(t))}function m(t){return null===t||cA(t)?(e.exit("codeFlowValue"),h(t)):(e.consume(t),m)}function v(n){return e.exit("codeFenced"),t(n)}}};const QA={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),mA(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?s(t):cA(t)?e.attempt(MA,o,s)(t):(e.enter("codeFlowValue"),i(t))}function i(t){return null===t||cA(t)?(e.exit("codeFlowValue"),o(t)):(e.consume(t),i)}function s(n){return e.exit("codeIndented"),t(n)}}},MA={partial:!0,tokenize:function(e,t,n){const r=this;return A;function A(t){return r.parser.lazy[r.now().line]?n(t):cA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),A):mA(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):cA(e)?A(e):n(e)}}};const OA={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"),s(t))}function s(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),s):96===t?(A=e.enter("codeTextSequence"),r=0,l(t)):cA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s):(e.enter("codeTextData"),a(t))}function a(t){return null===t||32===t||96===t||cA(t)?(e.exit("codeTextData"),s(t)):(e.consume(t),a)}function l(n){return 96===n?(e.consume(n),r++,l):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(A.type="codeTextData",a(n))}}};class LA{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&&jA(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),jA(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),jA(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);jA(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);jA(this.left,t.reverse())}}}function jA(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 RA(e){const t={};let n,r,A,o,i,s,a,l=-1;const c=new LA(e);for(;++l<c.length;){for(;l in t;)l=t[l];if(n=c.get(l),l&&"chunkFlow"===n[1].type&&"listItemPrefix"===c.get(l-1)[1].type&&(s=n[1]._tokenizer.events,A=0,A<s.length&&"lineEndingBlank"===s[A][1].type&&(A+=2),A<s.length&&"content"===s[A][1].type))for(;++A<s.length&&"content"!==s[A][1].type;)"chunkText"===s[A][1].type&&(s[A][1]._isInFirstContentOfListItem=!0,A++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,NA(c,l)),l=t[l],a=!0);else if(n[1]._container){for(A=l,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,l),i.unshift(n),c.splice(r,l-r+1,i))}}return Xr(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!a}function NA(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),s=i.events,a=[],l={};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<s.length;)"exit"===s[d][0]&&"enter"===s[d-1][0]&&s[d][1].type===s[d-1][1].type&&s[d][1].start.line!==s[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=s.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;)l[p+a[d][0]]=p+a[d][1],p+=a[d][1]-a[d][0]-1;return l}const HA={resolve:function(e){return RA(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):cA(t)?e.check(FA,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}}},FA={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"),mA(e,A,"linePrefix")};function A(A){if(null===A||cA(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 UA(e,t,n,r,A,o,i,s,a){const l=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||iA(t)?n(t):(e.enter(r),e.enter(i),e.enter(s),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(s),e.enter("chunkString",{contentType:"string"}),d(n))}function d(t){return 62===t?(e.exit("chunkString"),e.exit(s),u(t)):null===t||60===t||cA(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&&!uA(A)?c<l&&40===A?(e.consume(A),c++,p):41===A?(e.consume(A),c--,p):null===A||32===A||40===A||iA(A)?n(A):(e.consume(A),92===A?g:p):(e.exit("chunkString"),e.exit(s),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 zA(e,t,n,r,A,o){const i=this;let s,a=0;return function(t){return e.enter(r),e.enter(A),e.consume(t),e.exit(A),e.enter(o),l};function l(u){return a>999||null===u||91===u||93===u&&!s||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):cA(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):(e.enter("chunkString",{contentType:"string"}),c(u))}function c(t){return null===t||91===t||93===t||cA(t)||a++>999?(e.exit("chunkString"),l(t)):(e.consume(t),s||(s=!dA(t)),92===t?u:c)}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}}function _A(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,s):n(t)};function s(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),s(i)):null===t?n(t):cA(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),mA(e,a,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),l(t))}function l(t){return t===i||null===t||cA(t)?(e.exit("chunkString"),a(t)):(e.consume(t),92===t?c:l)}function c(t){return t===i||92===t?(e.consume(t),l):l(t)}}function qA(e,t){let n;return function r(A){return cA(A)?(e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),n=!0,r):dA(A)?mA(e,r,n?"linePrefix":"lineSuffix")(A):t(A)}}const GA={name:"definition",tokenize:function(e,t,n){const r=this;let A;return function(t){return e.enter("definition"),function(t){return zA.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function o(t){return A=nA(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 uA(t)?qA(e,s)(t):s(t)}function s(t){return UA(e,a,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function a(t){return e.attempt(YA,l,l)(t)}function l(t){return dA(t)?mA(e,c,"whitespace")(t):c(t)}function c(o){return null===o||cA(o)?(e.exit("definition"),r.parser.defined.push(A),t(o)):n(o)}}},YA={partial:!0,tokenize:function(e,t,n){return function(t){return uA(t)?qA(e,r)(t):n(t)};function r(t){return _A(e,A,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function A(t){return dA(t)?mA(e,o,"whitespace")(t):o(t)}function o(e){return null===e||cA(e)?t(e):n(e)}}};const WA={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return cA(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};const VA={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"},Xr(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||uA(t)?(e.exit("atxHeadingSequence"),o(t)):n(t)}function o(n){return 35===n?(e.enter("atxHeadingSequence"),i(n)):null===n||cA(n)?(e.exit("atxHeading"),t(n)):dA(n)?mA(e,o,"whitespace")(n):(e.enter("atxHeadingText"),s(n))}function i(t){return 35===t?(e.consume(t),i):(e.exit("atxHeadingSequence"),o(t))}function s(t){return null===t||35===t||uA(t)?(e.exit("atxHeadingText"),o(t)):(e.consume(t),s)}}};const XA=["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"],KA=["pre","script","style","textarea"],JA={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,s,a;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),l}(t)};function l(s){return 33===s?(e.consume(s),c):47===s?(e.consume(s),o=!0,f):63===s?(e.consume(s),A=3,r.interrupt?t:O):rA(s)?(e.consume(s),i=String.fromCharCode(s),p):n(s)}function c(o){return 45===o?(e.consume(o),A=2,u):91===o?(e.consume(o),A=5,s=0,d):rA(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(s++)?(e.consume(A),6===s?r.interrupt?t:C:d):n(A)}function f(t){return rA(t)?(e.consume(t),i=String.fromCharCode(t),p):n(t)}function p(s){if(null===s||47===s||62===s||uA(s)){const a=47===s,l=i.toLowerCase();return a||o||!KA.includes(l)?XA.includes(i.toLowerCase())?(A=6,a?(e.consume(s),g):r.interrupt?t(s):C(s)):(A=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):o?h(s):m(s)):(A=1,r.interrupt?t(s):C(s))}return 45===s||AA(s)?(e.consume(s),i+=String.fromCharCode(s),p):n(s)}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):P(t)}function m(t){return 47===t?(e.consume(t),P):58===t||95===t||rA(t)?(e.consume(t),v):dA(t)?(e.consume(t),m):P(t)}function v(t){return 45===t||46===t||58===t||95===t||AA(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,x):null===t||cA(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||uA(t)?y(t):(e.consume(t),E)}function x(e){return 47===e||62===e||dA(e)?m(e):n(e)}function P(t){return 62===t?(e.consume(t),B):n(t)}function B(t){return null===t||cA(t)?C(t):dA(t)?(e.consume(t),B):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):!cA(t)||6!==A&&7!==A?null===t||cA(t)?(e.exit("htmlFlowData"),D(t)):(e.consume(t),C):(e.exit("htmlFlowData"),e.check(ZA,j,D)(t))}function D(t){return e.check($A,k,j)(t)}function k(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||cA(t)?D(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 KA.includes(n)?(e.consume(t),L):C(t)}return rA(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||cA(t)?(e.exit("htmlFlowData"),j(t)):(e.consume(t),L)}function j(n){return e.exit("htmlFlow"),t(n)}}},ZA={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(CA,t,n)}}},$A={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return cA(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 eo={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),s};function s(t){return 33===t?(e.consume(t),a):47===t?(e.consume(t),w):63===t?(e.consume(t),v):rA(t)?(e.consume(t),x):n(t)}function a(t){return 45===t?(e.consume(t),l):91===t?(e.consume(t),o=0,f):rA(t)?(e.consume(t),m):n(t)}function l(t){return 45===t?(e.consume(t),d):n(t)}function c(t){return null===t?n(t):45===t?(e.consume(t),u):cA(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):cA(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):cA(t)?(i=m,Q(t)):(e.consume(t),m)}function v(t){return null===t?n(t):63===t?(e.consume(t),y):cA(t)?(i=v,Q(t)):(e.consume(t),v)}function y(e){return 62===e?I(e):v(e)}function w(t){return rA(t)?(e.consume(t),b):n(t)}function b(t){return 45===t||AA(t)?(e.consume(t),b):E(t)}function E(t){return cA(t)?(i=E,Q(t)):dA(t)?(e.consume(t),E):I(t)}function x(t){return 45===t||AA(t)?(e.consume(t),x):47===t||62===t||uA(t)?P(t):n(t)}function P(t){return 47===t?(e.consume(t),I):58===t||95===t||rA(t)?(e.consume(t),B):cA(t)?(i=P,Q(t)):dA(t)?(e.consume(t),P):I(t)}function B(t){return 45===t||46===t||58===t||95===t||AA(t)?(e.consume(t),B):C(t)}function C(t){return 61===t?(e.consume(t),D):cA(t)?(i=C,Q(t)):dA(t)?(e.consume(t),C):P(t)}function D(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),A=t,k):cA(t)?(i=D,Q(t)):dA(t)?(e.consume(t),D):(e.consume(t),S)}function k(t){return t===A?(e.consume(t),A=void 0,T):null===t?n(t):cA(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||uA(t)?P(t):(e.consume(t),S)}function T(e){return 47===e||62===e||uA(e)?P(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)?mA(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 to={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&&Xr(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,A,o,i=e.length,s=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)){s=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}},l={type:"label",start:{...e[r][1].start},end:{...e[A][1].end}},c={type:"labelText",start:{...e[r+s+2][1].end},end:{...e[A-2][1].start}};return o=[["enter",a,t],["enter",l,t]],o=Kr(o,e.slice(r+1,r+s+3)),o=Kr(o,[["enter",c,t]]),o=Kr(o,EA(t.parser.constructs.insideSpan.null,e.slice(r+s+4,A-3),t)),o=Kr(o,[["exit",c,t],e[A-2],e[A-1],["exit",l,t]]),o=Kr(o,e.slice(A+1)),o=Kr(o,[["exit",a,t]]),Xr(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(nA(r.sliceSerialize({start:A.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):n(t)};function s(t){return 40===t?e.attempt(no,l,o?l:c)(t):91===t?e.attempt(ro,l,o?a:c)(t):o?l(t):c(t)}function a(t){return e.attempt(Ao,l,c)(t)}function l(e){return t(e)}function c(e){return A._balanced=!0,n(e)}}},no={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 uA(t)?qA(e,A)(t):A(t)}function A(t){return 41===t?l(t):UA(e,o,i,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return uA(t)?qA(e,s)(t):l(t)}function i(e){return n(e)}function s(t){return 34===t||39===t||40===t?_A(e,a,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):l(t)}function a(t){return uA(t)?qA(e,l)(t):l(t)}function l(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},ro={tokenize:function(e,t,n){const r=this;return function(t){return zA.call(r,e,A,o,"reference","referenceMarker","referenceString")(t)};function A(e){return r.parser.defined.includes(nA(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},Ao={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 oo={name:"labelStartImage",resolveAll:to.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 io={name:"labelStartLink",resolveAll:to.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 so={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),mA(e,t,"linePrefix")}}};const ao={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||cA(o))?(e.exit("thematicBreak"),t(o)):n(o)}function i(t){return t===r?(e.consume(t),A++,i):(e.exit("thematicBreakSequence"),dA(t)?mA(e,o,"whitespace")(t):o(t))}}};const lo={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(CA,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,mA(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(uo,t,A)(n))});function A(A){return r.containerState._closeFlow=!0,r.interrupt=void 0,mA(e,e.attempt(lo,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:sA(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(ao,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(t)}return n(t)};function s(t){return sA(t)&&++i<10?(e.consume(t),s):(!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(CA,r.interrupt?n:l,e.attempt(co,u,c))}function l(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)}}},co={partial:!0,tokenize:function(e,t,n){const r=this;return mA(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)}},uo={partial:!0,tokenize:function(e,t,n){const r=this;return mA(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 fo={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,s=r.events.length;for(;s--;)if("lineEnding"!==r.events[s][1].type&&"linePrefix"!==r.events[s][1].type&&"content"!==r.events[s][1].type){i="paragraph"===r.events[s][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)?mA(e,i,"lineSuffix")(t):i(t))}function i(r){return null===r||cA(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};const po={tokenize:function(e){const t=this,n=e.attempt(CA,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,mA(e,e.attempt(this.parser.constructs.flow,r,e.attempt(HA,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 go={resolveAll:yo()},ho=vo("string"),mo=vo("text");function vo(e){return{resolveAll:yo("text"===e?wo: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),s;t.consume(e)}function s(e){return a(e)?(t.exit("data"),A(e)):(t.consume(e),s)}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 yo(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 wo(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,s=-1,a=0;for(;i--;){const e=A[i];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)a++,s--;if(s)break;s=-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?s:r.start._bufferIndex+s,_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 bo={42:lo,43:lo,45:lo,48:lo,49:lo,50:lo,51:lo,52:lo,53:lo,54:lo,55:lo,56:lo,57:lo,62:DA},Eo={91:GA},xo={[-2]:QA,[-1]:QA,32:QA},Po={35:VA,42:ao,45:[fo,ao],60:JA,61:fo,95:ao,96:IA,126:IA},Bo={38:SA,92:kA},Co={[-5]:so,[-4]:so,[-3]:so,33:oo,38:SA,42:xA,60:[BA,eo],91:io,92:[WA,kA],93:to,95:xA,96:OA},Do={null:[xA,go]},ko=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:Eo,disable:{null:[]},document:bo,flow:Po,flowInitial:xo,insideSpan:Do,string:Bo,text:Co},Symbol.toStringTag,{value:"Module"}));function So(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=[],s=[];const a={attempt:g(function(e,t){h(e,t.from)}),check:g(p),consume:function(e){cA(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++)),l.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=d(),l.events.push(["enter",n,l]),s.push(n),n},exit:function(e){const t=s.pop();return t.end=d(),l.events.push(["exit",t,l]),t},interrupt:g(p,{interrupt:!0})},l={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=Kr(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),l.events=EA(o,l.events,l),l.events)}};let c=t.tokenize.call(l,a);return t.resolveAll&&o.push(t),l;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=l.previous,n=l.currentConstruct,A=l.events.length,o=Array.from(s);return{from:A,restore:i};function i(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=A,s=o,m()}}(),u=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?v():e.tokenize.call(t?Object.assign(Object.create(l),t):l,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&&Xr(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function m(){r.line in A&&r.column<2&&(r.column=A[r.line],r.offset+=A[r.line]-1)}}const To=/[\0\t\n\r]/g;const Io=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qo(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return tA(n.slice(t?2:1),t?16:10)}return Vr(n)||e}const Mo={}.hasOwnProperty;function Oo(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:B,autolinkEmail:B,atxHeading:o(J),blockQuote:o(Y),characterEscape:B,characterReference:B,codeFenced:o(W),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:o(W,i),codeText:o(V,i),codeTextData:B,data:B,codeFlowValue:B,definition:o(X),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:o(K),hardBreakEscape:o(Z),hardBreakTrailing:o(Z),htmlFlow:o($,i),htmlFlowData:B,htmlText:o($,i),htmlTextData:B,image:o(ee),label:i,link:o(te),listItem:o(re),listItemValue:d,listOrdered:o(ne,u),listUnordered:o(ne),paragraph:o(Ae),reference:H,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:o(J),strong:o(oe),thematicBreak:o(se)},exit:{atxHeading:a(),atxHeadingSequence:b,autolink:a(),autolinkEmail:G,autolinkProtocol:q,blockQuote:a(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,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:D,link:a(Q),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:F,resourceDestinationString:j,resourceTitleString:R,resource:N,setextHeading:a(P),setextHeadingLineSequence:x,setextHeadingText:E,strong:a(),thematicBreak:a()}};jo(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const o={stack:[r],tokenStack:[],config:t,enter:s,exit:l,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]];Mo.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]||No).call(o,void 0,e[0])}for(r.position={start:Lo(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Lo(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,s=t-1,a=-1,l=!1;for(;++s<=n;){const t=e[s];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=s),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=s;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",l=!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||s,0,["exit",r,t[2]]),s++,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(s,0,["enter",A,t[2]]),s++,n++,o=void 0,i=!0}}}return e[t][1]._spread=l,n}function o(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function s(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:Lo(t.start),end:void 0}}function a(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+wr({start:e.start,end:e.end})+"): it’s not open");r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||No).call(this,e,r[0])),n.position.end=Lo(e.end)}function c(){return function(e){return Gr(e,"boolean"!=typeof qr.includeImageAlt||qr.includeImageAlt,"boolean"!=typeof qr.includeHtml||qr.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=nA(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 x(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function B(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:Lo(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=Lo(e.end)}function D(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=Lo(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(B.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(Io,Qo)}(t),n.identifier=nA(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 j(){const e=this.resume();this.stack[this.stack.length-1].url=e}function R(){const e=this.resume();this.stack[this.stack.length-1].title=e}function N(){this.data.inReference=void 0}function H(){this.data.referenceType="collapsed"}function F(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=nA(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function U(e){this.data.characterReferenceType=e.type}function z(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;n?(r=tA(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):r=Vr(t);this.stack[this.stack.length-1].value+=r}function _(e){this.stack.pop().position.end=Lo(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 se(){return{type:"thematicBreak"}}}(n)(function(e){for(;!RA(e););return e}(function(e){const t={constructs:Zr([ko,...(e||{}).extensions||[]]),content:n(vA),defined:[],document:n(yA),flow:n(po),lazy:{},string:n(ho),text:n(mo)};return t;function n(e){return function(n){return So(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(A,o,i){const s=[];let a,l,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(To.lastIndex=c,a=To.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)s.push(-3),e=void 0;else switch(e&&(s.push(-5),e=void 0),c<u&&(s.push(A.slice(c,u)),t+=u-c),d){case 0:s.push(65533),t++;break;case 9:for(l=4*Math.ceil(t/4),s.push(-2);t++<l;)s.push(-1);break;case 10:s.push(-4),t=1;break;default:e=!0,t=1}c=u+1}return i&&(e&&s.push(-5),n&&s.push(n),s.push(null)),s}}()(e,t,!0))))}function Lo(e){return{line:e.line,column:e.column,offset:e.offset}}function jo(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?jo(e,r):Ro(e,r)}}function Ro(e,t){let n;for(n in t)if(Mo.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 No(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+wr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+wr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+wr({start:t.start,end:t.end})+") is still open")}function Ho(e){const t=this;t.parser=function(n){return Oo(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Fo(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 Uo(e){return e.spread??e.children.length>1}function zo(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),A=0;const o=[];for(;r;)o.push(_o(t.slice(A,r.index),A>0,!0),r[0]),A=r.index+r[0].length,r=n.exec(t);return o.push(_o(t.slice(A),A>0,!1)),o.join("")}function _o(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 qo={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=hA(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let i,s=e.footnoteCounts.get(r);void 0===s?(s=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=o+1,s+=1,e.footnoteCounts.set(r,s);const a={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+A,id:n+"fnref-"+A+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,a);const l={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,l),e.applyData(t,l)},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 Fo(e,t);const A={src:hA(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:hA(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 Fo(e,t);const A={href:hA(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:hA(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=Uo(n[r])}return t}(n):Uo(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 s=-1;for(;++s<r.length;){const e=r[s];(A||0!==s||"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 l={type:"element",tagName:"li",properties:o,children:i};return e.patch(t,l),e.applyData(t,l)},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=vr(t.children[1]),i=mr(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 s=-1;const a=[];for(;++s<i;){const n=t.children[s],r={},i=o?o[s]:void 0;i&&(r.align=i);let l={type:"element",tagName:A,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),a.push(l)}const l={type:"element",tagName:"tr",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)},text:function(e,t){const n={type:"text",value:zo(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:Go,yaml:Go,definition:Go,footnoteDefinition:Go};function Go(){}const Yo="object"==typeof self?self:globalThis,Wo=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 Yo[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 Yo[o](i),A)};return r})(new Map,e)(0),Vo="",{toString:Xo}={},{keys:Ko}=Object,Jo=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=Xo.call(e).slice(8,-1);switch(n){case"Array":return[1,Vo];case"Object":return[2,Vo];case"Date":return[3,Vo];case"RegExp":return[4,Vo];case"Map":return[5,Vo];case"Set":return[6,Vo];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Zo=([e,t])=>0===e&&("function"===t||"symbol"===t),$o=(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,s]=Jo(r);switch(i){case 0:{let t=r;switch(s){case"bigint":i=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+s);t=null;break;case"undefined":return A([-1],r)}return A([i,t],r)}case 1:{if(s){let e=r;return"DataView"===s?e=new Uint8Array(r.buffer):"ArrayBuffer"===s&&(e=new Uint8Array(r)),A([s,[...e]],r)}const e=[],t=A([i,e],r);for(const t of r)e.push(o(t));return t}case 2:{if(s)switch(s){case"BigInt":return A([s,r.toString()],r);case"Boolean":case"Number":case"String":return A([s,r.valueOf()],r)}if(t&&"toJSON"in r)return o(r.toJSON());const n=[],a=A([i,n],r);for(const t of Ko(r))(e||!Zo(Jo(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||!Zo(Jo(n))&&!Zo(Jo(A)))&&t.push([o(n),o(A)]);return n}case 6:{const t=[],n=A([i,t],r);for(const n of r)(e||!Zo(Jo(n)))&&t.push(o(n));return n}}const{message:a}=r;return A([i,{name:s,message:a}],r)};return o})(!(t||n),!!t,new Map,r)(e),r},ei="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?Wo($o(e,t)):structuredClone(e):(e,t)=>Wo($o(e,t));function ti(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 ni(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const ri=function(e){if(null==e)return oi;if("function"==typeof e)return Ai(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ri(e[n]);return Ai(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 Ai(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 Ai(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function Ai(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 oi(){return!0}const ii=[],si=!0,ai=!1;function li(e,t,n,r){let A;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):A=t;const o=ri(A),i=r?-1:1;!function e(A,s,a){const l=A&&"object"==typeof A?A:{};if("string"==typeof l.type){const e="string"==typeof l.tagName?l.tagName:"string"==typeof l.name?l.name:void 0;Object.defineProperty(c,"name",{value:"node ("+A.type+(e?"<"+e+">":"")+")"})}return c;function c(){let l,c,u,d=ii;if((!t||o(A,s,a[a.length-1]||void 0))&&(d=function(e){return Array.isArray(e)?e:"number"==typeof e?[si,e]:null==e?ii:[e]}(n(A,a)),d[0]===ai))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(l=e(n,c,u)(),l[0]===ai)return l;c="number"==typeof l[1]?l[1]:c+i}}return d}}(e,void 0,[])()}function ci(e,t,n,r){let A,o,i;"function"==typeof t?(o=void 0,i=t,A=n):(o=t,i=n,A=r),li(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 ui={}.hasOwnProperty,di={};function fi(e,t){const n=t||di,r=new Map,A=new Map,o=new Map,i={...qo,...n.handlers},s={all:function(e){const t=[];if("children"in e){const n=e.children;let r=-1;for(;++r<n.length;){const A=s.one(n[r],e);if(A){if(r&&"break"===n[r-1].type&&(!Array.isArray(A)&&"text"===A.type&&(A.value=vi(A.value)),!Array.isArray(A)&&"element"===A.type)){const e=A.children[0];e&&"text"===e.type&&(e.value=vi(e.value))}Array.isArray(A)?t.push(...A):t.push(A)}}}return t},applyData:gi,definitionById:r,footnoteById:A,footnoteCounts:o,footnoteOrder:[],handlers:i,one:function(e,t){const n=e.type,r=s.handlers[n];if(ui.call(s.handlers,n)&&r)return r(s,e,t);if(s.options.passThrough&&s.options.passThrough.includes(n)){if("children"in e){const{children:t,...n}=e,r=ei(n);return r.children=s.all(e),r}return ei(e)}return(s.options.unknownHandler||hi)(s,e,t)},options:n,patch:pi,wrap:mi};return ci(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)}}),s}function pi(e,t){e.position&&(t.position=function(e){const t=vr(e),n=mr(e);if(t&&n)return{start:t,end:n}}(e))}function gi(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,ei(A)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function hi(e,t){const n=t.data||{},r=!("value"in t)||ui.call(n,"hProperties")||ui.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 mi(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 vi(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function yi(e,t){const n=fi(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||ti,r=e.options.footnoteBackLabel||ni,A=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[];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(),l=hA(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-"+l+(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-"+l},children:e.wrap(o,!0)};e.patch(A,p),s.push(p)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ei(i),id:"footnote-label"},children:[{type:"text",value:A}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!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 wi(e,t){return e&&"run"in e?async function(n,r){const A=yi(n,{file:r,...t});await e.run(A,r)}:function(n,r){return yi(n,{file:r,...e||t})}}function bi(e){if(e)throw e}var Ei,xi;var Pi=function(){if(xi)return Ei;xi=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},s=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return Ei=function e(){var t,n,r,a,l,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=s(u,n),u!==(a=s(t,n))&&(p&&a&&(o(a)||(l=A(a)))?(l?(l=!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},Ei}();const Bi=lr(Pi);function Ci(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 Di(){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 s=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,s?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)}}(s,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 ki={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');Si(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,s=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else i<0&&(n=!0,i=o+1),s>-1&&(e.codePointAt(o)===t.codePointAt(s--)?s<0&&(A=o):(s=-1,A=i));return r===A?A=i:A<0&&(A=e.length),e.slice(r,A)},dirname:function(e){if(Si(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){Si(e);let t,n=e.length,r=-1,A=0,o=-1,i=0;for(;n--;){const s=e.codePointAt(n);if(47!==s)r<0&&(t=!0,r=n+1),46===s?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;)Si(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){Si(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,A="",o=0,i=-1,s=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!==s)if(i!==a-1&&2===s){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,s=0;continue}}else if(A.length>0){A="",o=0,i=a,s=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,s=0}else 46===n&&s>-1?s++:s=-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 Si(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Ti={cwd:function(){return"/"}};function Ii(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function Qi(e){if("string"==typeof e)e=new URL(e);else if(!Ii(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 Mi=["history","path","basename","stem","extname","dirname"];class Oi{constructor(e){let t;var n;t=e?Ii(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?"":Ti.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r,A=-1;for(;++A<Mi.length;){const e=Mi[A];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(r in t)Mi.includes(r)||(this[r]=t[r])}get basename(){return"string"==typeof this.path?ki.basename(this.path):void 0}set basename(e){ji(e,"basename"),Li(e,"basename"),this.path=ki.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?ki.dirname(this.path):void 0}set dirname(e){Ri(this.basename,"dirname"),this.path=ki.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?ki.extname(this.path):void 0}set extname(e){if(Li(e,"extname"),Ri(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=ki.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Ii(e)&&(e=Qi(e)),ji(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?ki.basename(this.path,this.extname):void 0}set stem(e){ji(e,"stem"),Li(e,"stem"),this.path=ki.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 Pr(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 Li(e,t){if(e&&e.includes(ki.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ki.sep+"`")}function ji(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ri(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const Ni=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},Hi={}.hasOwnProperty;class Fi extends Ni{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=Di()}copy(){const e=new Fi;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(Bi(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(qi("data",this.frozen),this.namespace[e]=t,this):Hi.call(this.namespace,e)&&this.namespace[e]||void 0:e?(qi("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=Wi(e),n=this.parser||this.Parser;return zi("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),zi("process",this.parser||this.Parser),_i("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,A){const o=Wi(e),i=n.parse(o);function s(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 s(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,s(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),zi("processSync",this.parser||this.Parser),_i("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,bi(e),t=r}),Yi("processSync","process",n),t}run(e,t,n){Gi(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=Wi(t);r.run(e,i,function(t,r,i){const s=r||e;t?o(t):A?A(s):n(void 0,s,i)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){bi(e),n=t,r=!0}),Yi("runSync","run",r),n}stringify(e,t){this.freeze();const n=Wi(t),r=this.compiler||this.Compiler;return _i("stringify",r),Gi(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(qi("use",this.frozen),null!=e)if("function"==typeof e)s(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)s(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;s(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=Bi(!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 s(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];Ci(i)&&Ci(r)&&(r=Bi(!0,i,r)),n[A]=[e,r,...o]}}}}const Ui=(new Fi).freeze();function zi(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function _i(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function qi(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 Gi(e){if(!Ci(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function Yi(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Wi(e){return function(e){return!!(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new Oi(e)}const Vi=[],Xi={allowDangerousHtml:!0},Ki=/^(https?|ircs?|mailto|xmpp)$/i,Ji=[{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 Zi(e){const t=e.allowedElements,r=e.allowElement,A=e.children||"",o=e.className,i=e.components,s=e.disallowedElements,a=e.rehypePlugins||Vi,l=e.remarkPlugins||Vi,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Xi}:Xi,u=e.skipHtml,d=e.unwrapDisallowed,f=e.urlTransform||$i,p=Ui().use(Ho).use(l).use(wi,c).use(a),g=new Oi;"string"==typeof A&&(g.value=A);for(const t of Ji)Object.hasOwn(e,t.from)&&(t.from,t.to&&t.to,t.id);const h=p.parse(g);let m=p.runSync(h,g);return o&&(m={type:"element",tagName:"div",properties:{className:o},children:"root"===m.type?m.children:[m]}),ci(m,function(e,n,A){if("raw"===e.type&&A&&"number"==typeof n)return u?A.children.splice(n,1):A.children[n]={type:"text",value:e.value},n;if("element"===e.type){let t;for(t in _r)if(Object.hasOwn(_r,t)&&Object.hasOwn(e.properties,t)){const n=e.properties[t],r=_r[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=f(String(n||""),t,e))}}if("element"===e.type){let o=t?!t.includes(e.tagName):!!s&&s.includes(e.tagName);if(!o&&r&&"number"==typeof n&&(o=!r(e,n,A)),o&&A&&"number"==typeof n)return d&&e.children?A.children.splice(n,1,...e.children):A.children.splice(n,1),n}}),Qr(m,{Fragment:n.Fragment,components:i,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0})}function $i(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||Ki.test(e.slice(0,t))?e:""}const es=({children:e})=>n.jsx("div",{style:{whiteSpace:"normal"},children:n.jsx(Zi,{components:{p:({...e})=>n.jsx("p",{style:{margin:0,marginBottom:"0.5em",lineHeight:1.4,textAlign:"left"},children:e.children}),ul:({...e})=>n.jsx("ul",{style:{paddingLeft:"clamp(8px, 3.5vw, 16px)",margin:0,listStylePosition:"inside"},children:e.children}),ol:({...e})=>n.jsx("ol",{style:{paddingLeft:"clamp(8px, 3.5vw, 16px)",margin:0,listStylePosition:"inside"},children:e.children}),li:({...e})=>n.jsx("li",{style:{marginBottom:"1px",lineHeight:1.4},children:e.children}),code:({inline:e,children:t})=>e?n.jsx("code",{style:{backgroundColor:"rgba(0, 0, 0, 0.3)",padding:"2px 4px",borderRadius:"4px",fontFamily:"inherit",fontSize:"0.95em"},children:t}):n.jsx("pre",{style:{backgroundColor:"rgba(0, 0, 0, 0.3)",padding:"8px",borderRadius:"4px",overflowX:"auto",margin:"0.5em 0",whiteSpace:"pre-wrap"},children:n.jsx("code",{children:t})}),blockquote:({...e})=>n.jsx("blockquote",{style:{margin:0,paddingLeft:"10px",borderLeft:"2px solid #ccc",color:"#666",fontStyle:"italic"},children:e.children})},children:"string"==typeof e?e:""})}),ts={autoConfig:!0},ns=t=>()=>(t=>{const{getFlow:n}=Ft(),{messages:r,replaceMessages:A}=Ut(),{settings:o}=_t(),{hasChatHistoryLoaded:i}=Gt(),s={...t,...ts},a=s.markdownComponent?s.markdownComponent:es;e.useEffect(()=>{var e,t;if(i){const n=[...r];for(let r=0;r<n.length&&r<((null==(e=o.chatHistory)?void 0:e.maxEntries)??30);r++){const e=n[r];null!=(t=e.tags)&&t.includes("rcb-markdown-renderer-plugin:parsed")&&(e.contentWrapper=a)}A(n)}},[i]);const l=async e=>{var t;const r=null==(t=e.data.message)?void 0:t.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,n(),r)&&(e.data.message.contentWrapper=a,e.data.message.tags||(e.data.message.tags=[]),e.data.message.tags.push("rcb-markdown-renderer-plugin:parsed"))};zt(N.PRE_INJECT_MESSAGE,l),zt(N.CHUNK_STREAM_MESSAGE,l),zt(N.START_STREAM_MESSAGE,l),zt(N.START_SIMULATE_STREAM_MESSAGE,l);const c={name:"@rcb-plugins/markdown-renderer"};return null!=s&&s.autoConfig&&(c.settings={event:{rcbPreInjectMessage:!0,rcbChunkStreamMessage:!0,rcbStartSimulateStreamMessage:!0,rcbStartStreamMessage:!0}}),c})(t),rs={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"}},As=(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},os=t=>{const{showToast:n}=(()=>{const{showToast:e,dismissToast:t,toasts:n,replaceToasts:r}=Je();return{showToast:e,dismissToast:t,toasts:n,replaceToasts:r}})(),{getFlow:r}=Ft(),{styles:A,updateStyles:o,replaceStyles:i}=(()=>{const{styles:e,replaceStyles:t,updateStyles:n}=Tt();return{styles:e,replaceStyles:t,updateStyles:n}})(),s=(e=>({...rs,...e,promptBaseColors:{...rs.promptBaseColors},promptHoveredColors:{...rs.promptHoveredColors},textAreaHighlightColors:{...rs.textAreaHighlightColors}}))(t),[a,l]=e.useState(0),c=e.useRef({});zt(N.USER_SUBMIT_TEXT,e=>{const t=e,i=As(t,r(),"validateTextInput");if(!i)return;const u=i(t.data.inputText);if(null!=u&&u.success||e.preventDefault(),!u.promptContent)return;0===a&&(c.current=structuredClone(A));const d=((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})(u,s);o(d),n(u.promptContent,u.promptDuration??3e3),l(e=>e+1)}),zt(N.USER_UPLOAD_FILE,e=>{var t,A;const o=e,i=null==(A=null==(t=o.data)?void 0:t.files)?void 0:A[0];if(!i)return console.error("No file uploaded."),void e.preventDefault();const s=As(o,r(),"validateFileInput");if(!s)return void console.error("Validator not found for file input.");const a=s(i);if(!a.success)return console.error("Validation failed:",a),a.promptContent&&n(a.promptContent,a.promptDuration??3e3),void e.preventDefault();console.log("Validation successful:",a)}),zt(N.DISMISS_TOAST,()=>{l(e=>e-1)}),e.useEffect(()=>{0===a&&setTimeout(()=>{i(c.current)})},[a,i]);const u={name:"@rcb-plugins/input-validator"};return s.autoConfig&&(u.settings={event:{rcbUserSubmitText:!0,rcbUserUploadFile:!0,rcbDismissToast:!0}}),u},is=e.forwardRef((t,n)=>{let{embedded:r,currentOpen:A,enabled:o,onSetEnabled:i}=t;const s=Ut(),a=(()=>{const{isChatWindowOpen:e,toggleChatWindow:t,toggleIsBotTyping:n,scrollToBottom:r,getIsChatBotVisible:A}=G();return{isChatWindowOpen:e,toggleChatWindow:t,toggleIsBotTyping:n,scrollToBottom:r,getIsChatBotVisible:A}})(),l=e.useRef(!1),c=e.useRef(!1);return e.useEffect(()=>{!r&&a&&a.toggleChatWindow&&(l.current===A||c.current||(setTimeout(()=>{a&&a.toggleChatWindow&&a.toggleChatWindow(A)},0),l.current=null!=A&&A),c.current=!1)},[A,r,a]),e.useEffect(()=>{const e=()=>{c.current=!0};return window.addEventListener("rcb-toggle-chat-window",e),()=>window.removeEventListener("rcb-toggle-chat-window",e)}),e.useImperativeHandle(n,()=>({addMessage:e=>{s&&s.injectMessage&&s.injectMessage(e)},openChat:()=>{!r&&a&&a.toggleChatWindow&&a.toggleChatWindow(!0)},closeChat:()=>{!r&&a&&a.toggleChatWindow&&a.toggleChatWindow(!1)},toggleChat:()=>{!r&&a&&a.toggleChatWindow&&a.toggleChatWindow()},setBotEnabled:e=>{i&&i(e)}}),[s,a,r,i]),null});is.displayName="BotController";const ss=e.createContext(null),as=t=>{let{trackEvent:n,children:r}=t;const A=e.useRef(n);return A.current=n,e.createElement(ss.Provider,{value:{trackEvent:e=>A.current(e)}},r)},ls=()=>{const t=e.useContext(ss);return t||{trackEvent:()=>{}}},cs=t=>{let{loginUrl:n,className:r="",style:A,isHeaderButton:o=!1}=t;const{trackEvent:i}=ls(),s=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 e.createElement(e.Fragment,null,o&&e.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 "),e.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({},s),A),onClick:()=>{i({type:"chatbot_login_clicked",loginUrl:n})}},"Log In"))},us=()=>e.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"},e.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"},e.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),e.createElement("circle",{cx:"12",cy:"7",r:"4"}))),ds=[];for(let e=0;e<256;++e)ds.push((e+256).toString(16).slice(1));let fs;const ps=new Uint8Array(16);var gs={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hs(e,t,n){if(gs.randomUUID&&!e)return gs.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!fs){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");fs=crypto.getRandomValues.bind(crypto)}return fs(ps)}();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(ds[e[t+0]]+ds[e[t+1]]+ds[e[t+2]]+ds[e[t+3]]+"-"+ds[e[t+4]]+ds[e[t+5]]+"-"+ds[e[t+6]]+ds[e[t+7]]+"-"+ds[e[t+8]]+ds[e[t+9]]+"-"+ds[e[t+10]]+ds[e[t+11]]+ds[e[t+12]]+ds[e[t+13]]+ds[e[t+14]]+ds[e[t+15]]).toLowerCase()}(r)}function ms(){return"undefined"!=typeof localStorage&&"true"===localStorage.getItem("QA_BOT_DEBUG")}const vs="background: #1a5b6e; color: white; padding: 2px 6px; border-radius: 3px;",ys="background: #7c3aed; color: white; padding: 2px 6px; border-radius: 3px;",ws="background: #059669; color: white; padding: 2px 6px; border-radius: 3px;",bs="background: #f97316; color: white; padding: 2px 6px; border-radius: 3px;",Es="background: #f59e0b; color: #000; padding: 2px 6px; border-radius: 3px 0 0 3px; font-weight: bold;",xs="background: #fbbf24; color: #000; padding: 2px 6px; border-radius: 0 3px 3px 0;",Ps=()=>{ms()&&console.log("%c QA Bot Core %c v0.2.35 ",Es,xs)},Bs=function(e){if(ms()){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}`,vs,"",...n)}},Cs=function(e){if(ms()){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}`,ys,"",...n)}},Ds=(e,t)=>{ms()&&console.log(`%c[Message]%c ${e}`,ws,"",t)},ks=function(e){if(ms()){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}`,bs,"",...n)}},Ss=function(){console.warn(...arguments)},Ts=function(){console.error(...arguments)},Is="qa_bot_session_messages",Qs=()=>`qa_bot_session_${hs()}`,Ms=()=>{try{const e=localStorage.getItem(Is);return e?JSON.parse(e):{}}catch(e){return{}}},Os=(e,t,n,r,A)=>{const o=Ms();!o[e]&&(o[e]={messages:[],startedAt:(new Date).toISOString(),preview:""},Cs("NEW session created",{sessionId:e.slice(-12)}));if(o[e].messages.some(e=>e.id===t))return void Cs("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),Cs("MESSAGE added",{sessionId:e.slice(-12),messageId:t.slice(-8),sender:r,totalInSession:o[e].messages.length});const s=o[e].messages,a=s.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=s.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(Is,JSON.stringify(e))})(o),Cs("STORAGE state",{ourSessions:Object.keys(o).length,ourTotalMessages:Object.values(o).reduce((e,t)=>e+t.messages.length,0)})},Ls=e=>{var t,n;return null!==(n=null===(t=Ms()[e])||void 0===t?void 0:t.messages.length)&&void 0!==n?n:0},js=e=>{const t=Ms()[e];return(null==t?void 0:t.startedAt)?Date.now()-new Date(t.startedAt).getTime():0},Rs=e.createContext(void 0),Ns=t=>{let{children:n,getSessionId:r,setSessionId:A,resetSession:o,clearResettingFlag:i}=t;return e.createElement(Rs.Provider,{value:{getSessionId:r,setSessionId:A,resetSession:o,clearResettingFlag:i}},n)},Hs=()=>{const t=e.useContext(Rs);if(!t)throw new Error("useSession must be used within a SessionProvider");return t},Fs=()=>{const[t,n]=e.useState(!1),[r,A]=e.useState([]),[o,i]=e.useState(null),[s,a]=e.useState(0),l=e.useRef(null),c=e.useRef(null),{replaceMessages:u}=Ut(),{toggleTextAreaDisabled:d}=qt(),{setSessionId:f,getSessionId:p}=Hs();e.useEffect(()=>{var e,r;const A=e=>{l.current&&!l.current.contains(e.target)&&c.current&&!c.current.contains(e.target)&&n(!1)},o=null!==(r=null===(e=l.current)||void 0===e?void 0:e.getRootNode())&&void 0!==r?r:document;return t&&o.addEventListener("mousedown",A),()=>{o.removeEventListener("mousedown",A)}},[t]);const g=e=>{var t;const r=p();if(Cs("RESTORE requested",{targetSession:e.slice(-12),currentSession:null==r?void 0:r.slice(-12)}),e===r)return Cs("RESTORE skipped - already on this session"),void n(!1);const A=(e=>{var t;return(null===(t=Ms()[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()});Cs("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;f(e),Cs("Session ID updated",{newSession:e.slice(-12)}),u(o),Cs("replaceMessages called",{count:o.length}),i=null===(t=c.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("<a href=")&&(n=n.replace(/<a\s+href=["']([^"']+)["'][^&]*>([^&]+)<\/a>/gi,'<a href="$1" target="_blank" rel="noopener noreferrer">$2</a>'),r=!0),(n.includes("<a ")||(null===(t=e.textContent)||void 0===t?void 0:t.includes("<a href=")))&&(e.textContent||"").includes("<a href=")&&(n=n.replace(/<a\s+href="([^"]+)"[^&]*>([^&]+)<\/a>/gi,'<a href="$1" target="_blank" rel="noopener noreferrer">$2</a>'),r=!0),r&&(e.innerHTML=n)})},50),d(!1),Cs("Chat input enabled after restore"),n(!1)};return e.createElement("div",{style:{position:"relative"}},e.createElement("button",{ref:c,className:"history-button",onClick:()=>{if(!t&&(A((()=>{const e=Ms();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())})()),c.current)){const e=c.current.closest(".rcb-chat-window");if(e){const t=e.getBoundingClientRect(),n=c.current.getBoundingClientRect();i(t.width+3),a(t.right-n.right-18+4)}}n(!t)},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":t,"aria-haspopup":"menu"},e.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"},e.createElement("circle",{cx:"12",cy:"12",r:"10"}),e.createElement("polyline",{points:"12 6 12 12 16 14"}))),t&&e.createElement("div",{ref:l,role:"menu",style:{position:"absolute",right:s?`-${s}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?e.createElement("div",{style:{padding:"12px 16px",color:"#666",fontSize:"14px",textAlign:"center"}},"No chat history"):r.map(t=>e.createElement("button",{key:t.sessionId,role:"menuitem",onClick:()=>g(t.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"}},e.createElement("span",{style:{fontSize:"14px",color:"#333",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.preview||"New conversation"),e.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"})})(t.startedAt))))))},Us=t=>{var{width:n=24,height:r=24,color:A="currentColor",children:o}=t,i=a(t,["width","height","color","children"]);return e.createElement("svg",s({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)},zs=t=>e.createElement(Us,t,e.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"})),_s=()=>{const{restartFlow:t}=Ft(),{setTextAreaValue:n}=qt(),{messages:r}=Ut(),{getSessionId:A,resetSession:o,clearResettingFlag:i}=Hs(),{trackEvent:s}=ls();return e.createElement("button",{onClick:async()=>{const e=A(),r=e?Ls(e):0;s({type:"chatbot_new_chat",previousMessageCount:r}),o(),await n(""),await t(),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)"}},e.createElement(zs,{width:16,height:16}),"New Chat")};function qs(e){if("string"==typeof e)return e;if("number"==typeof e)return String(e);if(!e)return"";if(Array.isArray(e))return e.map(qs).join("");if("object"==typeof e&&null!==e&&"props"in e){const t=e.props;if(t&&"children"in t)return qs(t.children)}return""}const Gs=()=>{const{getSessionId:t}=Hs(),n=e.useCallback(e=>{var n;const r=null===(n=e.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:qs(r.content),Ds("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 s=t();Os(s,r.id,i,A,o)},[t]);return e.useEffect(()=>(window.addEventListener("rcb-pre-inject-message",n),()=>{window.removeEventListener("rcb-pre-inject-message",n)}),[n]),null},Ys=()=>(e.useEffect(()=>{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 s=[];if(i.length>0){const e=i[i.length-1];s=Array.from(e.querySelectorAll(".rcb-options"))}if(0===s.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(s.length>0){if(s.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",s.length),0===t?e.classList.add("keyboard-focused"):e.classList.remove("keyboard-focused")}),s.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(()=>{s[0]&&null!==s[0].offsetParent&&!r&&(s[0].focus(),s.length>1&&t(`${s.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 Ws=!1,Vs=null;function Xs(){return Ws?Promise.resolve():Vs||(Vs=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=()=>{Ws=!0,ks("Script loaded"),e()},n.onerror=()=>{Vs=null,t(new Error("Failed to load Turnstile script"))},document.head.appendChild(n)}),Vs)}const Ks=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},Js=t=>{let{siteKey:n,onVerify:r,onError:o,loginUrl:i}=t;const s=e.useRef(null),a=e.useRef(null),l=e.useRef(!1),c=e.useRef(null),u=e.useRef(null),[d,f]=e.useState(!1),[p,g]=e.useState(0),h=e.useRef("widget_error"),m=e.useRef(null),v=i&&"/login"!==i,y=e.useCallback(()=>{const e=window.turnstile;if(c.current&&(null==e?void 0:e.remove)){try{e.remove(c.current)}catch(e){}c.current=null}},[]),w=e.useCallback(()=>{var e;y(),d?null==o||o(h.current,null!==(e=m.current)&&void 0!==e?e:void 0):null==o||o("user_cancelled")},[o,y,d]);e.useEffect(()=>()=>{y()},[y]),e.useEffect(()=>{var e;return u.current=document.activeElement,null===(e=a.current)||void 0===e||e.focus(),()=>{u.current&&"function"==typeof u.current.focus&&u.current.focus()}},[]),e.useEffect(()=>{const e=e=>{if("Escape"===e.key)return e.preventDefault(),void w();if("Tab"===e.key&&a.current){const t=a.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)},[w]),e.useEffect(()=>{l.current||!s.current||d||(l.current=!0,Xs().then(()=>{const e=window.turnstile;if(!e||!s.current)return Ts("Turnstile API not available after script load"),h.current="api_unavailable",void f(!0);c.current=e.render(s.current,{sitekey:n,callback:e=>{ks("Visible challenge completed"),r(e)},"error-callback":e=>(Ts("Turnstile challenge failed:",e),m.current=e,h.current="widget_error",y(),f(!0),!0),"expired-callback":()=>{Ts("Turnstile token expired"),h.current="token_expired",y(),f(!0)}})}).catch(e=>{Ts("Failed to load Turnstile script:",e),h.current="script_load_failed",f(!0)}))},[n,r,d]);const b=e.createElement(e.Fragment,null,e.createElement("div",{"aria-hidden":"true",style:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.5)",zIndex:999998}}),e.createElement("div",{ref:a,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'}},e.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"),d?e.createElement("div",{style:{fontSize:"14px",lineHeight:"1.5",color:"#333"}},0===p?e.createElement("p",{style:{margin:"0 0 16px 0"}},"Verification failed. You can try again",v&&e.createElement(e.Fragment,null,", or"," ",e.createElement("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--primaryColor, #107180)",fontWeight:"bold"}},"log in")," ","to skip verification"),"."):e.createElement(e.Fragment,null,e.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."),e.createElement("p",{style:{margin:"0 0 16px 0"}},"Try disabling extensions, using a private/incognito window,",v&&e.createElement(e.Fragment,null," ",e.createElement("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--primaryColor, #107180)",fontWeight:"bold"}},"logging in"),",")," ","or using a different browser.")),e.createElement("div",{style:{display:"flex",gap:"8px"}},e.createElement("button",{type:"button",onClick:()=>{y(),l.current=!1,g(e=>e+1),f(!1)},style:{padding:"8px 16px",background:"var(--primaryColor, #107180)",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Try again"),e.createElement("button",{type:"button",onClick:w,style:{padding:"8px 16px",background:"#f0f0f0",color:"#333",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Close"))):e.createElement(e.Fragment,null,e.createElement("div",{ref:s,style:{borderRadius:"8px",overflow:"hidden"}}),e.createElement("button",{type:"button",onClick:w,style:{marginTop:"16px",padding:"8px 16px",background:"#f0f0f0",color:"#333",border:"1px solid #ccc",borderRadius:"4px",cursor:"pointer",fontSize:"14px"}},"Cancel"))));return A.createPortal(b,document.body)};function Zs(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 $s(t){let{getState:n,onResubmit:r,trackEvent:A,loginUrl:o}=t;var i;const[s,a]=e.useState(null),[l,c]=e.useState(0),u=n(),d={},f="true"===d.VITE_FORCE_TURNSTILE_WIDGET,p=null!==(i=u.siteKey)&&void 0!==i?i:f?d.VITE_TURNSTILE_SITE_KEY:null;return p&&(f||s!==p)?e.createElement(Js,{key:l,siteKey:p,loginUrl:o,onVerify:async e=>{const t=p;u.token=e,null==A||A({type:"chatbot_turnstile_completed"});"needs_another_challenge"===await r(e)?c(e=>e+1):a(t)},onError:(e,t)=>{var n;const r=null===(n=u.pendingQuery)||void 0===n?void 0:n.queryId,o=p;u.token=null,u.pendingQuery=null,u.needsChallenge=!1,u.siteKey=null,a(o),null==A||A({type:"chatbot_turnstile_error",queryId:r,failureReason:e,cloudflareErrorCode:t})}}):null}const ea="#1a5b6e",ta="#107180",na="Arial, sans-serif",ra="Q&A Bot",Aa="/chat-icon.svg",oa="Type your question here...",ia="Select an option to continue",sa=!1,aa="Ask me a question!",la="/login",ca={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}},ua=e.forwardRef((t,n)=>{var r,A,o;const{apiKey:i,qaEndpoint:s,ratingEndpoint:a,capabilitiesEndpoint:c,agentRatingEndpoint:u,welcomeMessage:d,open:f,onOpenChange:p,isLoggedIn:g,allowAnonAccess:h=!1,actingUser:m,primaryColor:v,secondaryColor:y,botName:w,logo:b,placeholder:E,errorMessage:x,embedded:P,footerText:B,footerLink:C,tooltipText:D,loginUrl:k,turnstileSiteKey:S,backendId:T,resourceContext:I,customFlow:Q,onAnalyticsEvent:M}=t,O=e.useRef(`bot_${Math.random().toString(36).substr(2,9)}`);e.useEffect(()=>{Ps()},[]);const L=e.useRef(null);null===L.current&&(L.current=Qs(),Bs("CREATED",L.current));const j=e.useRef(!1),R=e.useRef({getSessionId:()=>L.current,isResetting:()=>j.current}),N=e.useRef(null),H=function(t,n){const[r,A]=e.useState(null),[o,i]=e.useState("idle"),s=e.useRef(null),a=e.useRef(null),l=e.useRef(!0),c=e.useCallback(()=>{const e=window.turnstile;if(a.current&&(null==e?void 0:e.remove)){try{e.remove(a.current)}catch(e){}a.current=null}s.current&&(s.current.remove(),s.current=null)},[]);return e.useEffect(()=>{if(l.current=!0,!t)return i("idle"),void A(null);i("loading");const e=document.createElement("div");return e.style.position="fixed",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0",e.style.height="0",e.style.overflow="hidden",e.setAttribute("aria-hidden","true"),document.body.appendChild(e),s.current=e,Xs().then(()=>{if(!l.current)return;const e=window.turnstile;if(!e||!s.current)return Ts("Turnstile API not available for silent verification"),i("failed"),void(null==n||n({type:"chatbot_turnstile_silent_failed",failureReason:"api_unavailable"}));const r=e.render(s.current,{sitekey:t,execution:"render","refresh-expired":"auto",callback:e=>{l.current&&(ks("Silent verification succeeded"),A(e),i("verified"))},"error-callback":e=>!l.current||(Ts("Turnstile silent verification failed:",e),A(null),i("failed"),null==n||n({type:"chatbot_turnstile_silent_failed",failureReason:"widget_error",cloudflareErrorCode:e}),!0),"expired-callback":()=>{l.current&&(ks("Token expired, awaiting refresh"),A(null),i("loading"))}});a.current=r}).catch(e=>{l.current&&(Ts("Failed to load Turnstile script for silent verification:",e),i("failed"),null==n||n({type:"chatbot_turnstile_silent_failed",failureReason:"script_load_failed"}))}),()=>{l.current=!1,c()}},[t,c]),{token:r,status:o,reset:e.useCallback(()=>{const e=window.turnstile;a.current&&(null==e?void 0:e.reset)&&(A(null),i("loading"),e.reset(a.current),ks("Token consumed, resetting widget for fresh token"))},[])}}(S,e=>{var t;null===(t=N.current)||void 0===t||t.call(N,e)}),F=e.useRef(null);F.current=H.token;const[U,z]=e.useState(g);e.useEffect(()=>{z(g)},[g]);const _=void 0!==P?P:sa,q=e.useCallback(e=>{var t;M&&M(Object.assign(Object.assign({},e),{timestamp:Date.now(),sessionId:null!==(t=L.current)&&void 0!==t?t:void 0,pageUrl:"undefined"!=typeof window?window.location.href:void 0,isEmbedded:_}))},[M,_]);e.useEffect(()=>{N.current=e=>q(e)},[q]);const G=e.useMemo(()=>{const t=Object.assign({},ca);t.general=Object.assign(Object.assign({},t.general),{primaryColor:v||ea,secondaryColor:y||ta,fontFamily:na,embedded:_});const n=!1===U?[e.createElement(cs,{key:"login-button",loginUrl:k||la,isHeaderButton:!0})]:[e.createElement(Fs,{key:"history-button"}),e.createElement(us,{key:"user-icon"})];t.header={title:e.createElement("span",{style:{fontSize:14,fontWeight:500}},w||ra),showAvatar:!0,avatar:b||Aa,buttons:[...n,l.CLOSE_CHAT_BUTTON]},t.chatInput=Object.assign(Object.assign({},t.chatInput),{disabled:!1,enabledPlaceholderText:E||oa,disabledPlaceholderText:x||ia}),t.tooltip=Object.assign(Object.assign({},t.tooltip),{text:D||aa});const r=B?C?e.createElement("a",{href:C,target:"_blank",rel:"noopener noreferrer",key:"footer-link"},B):e.createElement("span",{key:"footer-text"},B):null;return t.footer={text:null!=r?r:void 0,buttons:[e.createElement(_s,{key:"new-chat-button"})]},t.chatWindow=Object.assign(Object.assign({},t.chatWindow),{defaultOpen:!!_}),t.event={rcbPreInjectMessage:!0,rcbPostInjectMessage:!0,rcbUserSubmitText:!0,rcbChangePath:!0,rcbToggleChatWindow:!0},t},[v,y,w,b,E,x,_,D,U,k,B,C]),Y=e.useRef(null),W=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.useMemo(()=>{const e=(e,n)=>{if(t.current){const n=getComputedStyle(t.current).getPropertyValue(e);if(n&&""!==n.trim())return n.trim();if(t.current.parentElement){const n=getComputedStyle(t.current.parentElement).getPropertyValue(e);if(n&&""!==n.trim())return n.trim()}}return n};return{primaryColor:e("--primaryColor",n.primaryColor),secondaryColor:e("--secondaryColor",n.secondaryColor),fontFamily:e("--fontFamily",n.fontFamily)}},[t,n])}(Y,G.general);((t,n)=>{e.useEffect(()=>{n.current&&(t?n.current.classList.add("bot-logged-in"):n.current.classList.remove("bot-logged-in"))},[t,n])})(!1!==U,Y),(t=>{let{settings:n,themeColors:r}=t;e.useEffect(()=>{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]),e.useEffect(()=>{var t,r;(null===(t=n.header)||void 0===t?void 0:t.title)&&"string"==typeof n.header.title&&(n.header.title=e.createElement("div",{key:"header-title"},e.createElement("h1",{className:"sr-only"},n.header.title),e.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:G,themeColors:W});const V=e.useMemo(()=>{const t=(t=>{let{endpoint:n,ratingEndpoint:r,agentRatingEndpoint:A,apiKey:o,sessionId:i,isResetting:s=()=>!1,isLoggedIn:a,allowAnonAccess:l=!1,loginUrl:c="/login",trackEvent:u,getTurnstileToken:d,resetTurnstileToken:f,backendId:p,resourceContext:g}=t;if(!1===a&&!l)return null==u||u({type:"chatbot_login_prompt_shown"}),{qa_loop:{message:"To ask questions, please log in first.",component:e.createElement(cs,{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((!s||!s())&&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){Ts("Error sending feedback:",e)}}return"Thanks for the feedback!"}try{const r=hs();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 s=i();s&&(A["X-Session-ID"]=s,A["X-Query-ID"]=r),A["X-Origin"]=g||"access";const l={query:a,question_id:r};s&&(l.session_id=s),p&&(l._backend=p),g&&(l.rp_name=g,l.resource_context=g);const c=null==d?void 0:d();c&&(l.turnstile_token=c),Bs("SENT to API",{session_id:s,question_id:r});const w=Date.now(),b=await fetch(n,{method:"POST",headers:A,credentials:"include",body:JSON.stringify(l)});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="",s=!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){Ss("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"),s=!0}else if("token"===r){i+=n.content||"";const t=Ks(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=Ks(t);await e.streamMessage(n,"BOT"),s=!0}s&&await e.endStreamMessage("BOT")}}else if("error"===r){const t=n.message||"An error occurred";Ts("SSE error event:",t),s?(await e.streamMessage(t,"BOT"),await e.endStreamMessage("BOT")):await e.injectMessage(t)}a=o.indexOf("\n\n")}else a=o.indexOf("\n\n")}}s&&await e.endStreamMessage("BOT")}catch(t){if(Ts("Error reading SSE stream:",t),!s)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,x=await b.json();if(x.requires_turnstile)return null==u||u({type:"chatbot_turnstile_shown",queryId:r}),y.siteKey=x.site_key,y.pendingQuery={query:a,sessionId:s,queryId:r},y.needsChallenge=!0,"One moment — verifying your session…";null==f||f();const P=x.response||x.answer||x.text||x.message;if(!P)throw new Error("Invalid response format from API");const B=x.metadata||{};m=B.rating_target||null,v=!0===B.is_final_response;const C=Ks(P),D=ms()?Zs(x):"",k=D?`${C}\n\n${D}`:C;return await e.injectMessage(k),void(null==u||u({type:"chatbot_answer_received",queryId:r,responseTimeMs:E,success:!0,responseLength:P.length,hasMetadata:!!D}))}catch(e){return Ts("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=>s&&s()||"👍 Helpful"===e.userInput||"👎 Not helpful"===e.userInput||y.needsChallenge?[]:v&&m&&("agent"===m?A:r)?["👍 Helpful","👎 Not helpful"]:[],renderMarkdown:["BOT"],chatDisabled:!1,component:e.createElement($s,{getState:()=>y,onResubmit:async e=>{var t;if(!y.pendingQuery||!w)return Ts("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)}),s=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 s=r.indexOf("\n\n");for(;-1!==s;){const e=r.slice(0,s);r=r.slice(s+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){}s=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=s;const a=Ks(A);return await w(a),null==u||u({type:"chatbot_answer_received",queryId:s,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 l=a.response||a.answer||a.text||a.message;if(!l)throw new Error("Invalid response format from API");const c=a.metadata||{};m=c.rating_target||null,v=!0===c.is_final_response,h=s;const d=Ks(l),f=ms()?Zs(a):"",b=f?`${d}\n\n${f}`:d;return await w(b),null==u||u({type:"chatbot_answer_received",queryId:s,success:!0,responseLength:l.length}),"success"}catch(e){return Ts("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:s,ratingEndpoint:a,agentRatingEndpoint:u,apiKey:i,sessionId:R.current.getSessionId,isResetting:R.current.isResetting,isLoggedIn:U,allowAnonAccess:h,loginUrl:k||la,trackEvent:q,getTurnstileToken:()=>F.current,resetTurnstileToken:()=>H.reset(),backendId:T,resourceContext:I}),n={message:d,renderMarkdown:["BOT"],transition:{duration:0},path:"qa_loop"};return Object.assign(Object.assign({start:n},t),Q||{})},[i,s,a,u,d,U,h,k,Q,m,q,I,T]),X=e.useMemo(()=>{return[()=>bn(t),ns(),()=>os(e)];var e,t},[]);return e.useEffect(()=>{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)},[]),Ys(),e.useEffect(()=>{const e=Y.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")||q({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)},[q]),e.useEffect(()=>{if(!_){const e=e=>{const t=e.data.newState;null==p||p(t);const n=L.current;q(t?{type:"chatbot_open"}:{type:"chatbot_close",messageCount:n?Ls(n):0,durationMs:n?js(n):0})};return window.addEventListener("rcb-toggle-chat-window",e),()=>{window.removeEventListener("rcb-toggle-chat-window",e)}}},[_,p,q]),e.createElement("div",{className:"qa-bot "+((null===(r=G.general)||void 0===r?void 0:r.embedded)?"embedded-qa-bot":""),ref:Y,role:"region","aria-label":`${w||ra}${(null===(A=G.general)||void 0===A?void 0:A.embedded)?" - Embedded":""}`},e.createElement(Ns,{getSessionId:()=>L.current,setSessionId:e=>{const t=L.current;L.current=e,Bs("RESTORED",`${null==t?void 0:t.slice(-12)} -> ${e.slice(-12)}`)},resetSession:()=>{const e=L.current;j.current=!0,L.current=Qs(),Bs("RESET",`${null==e?void 0:e.slice(-12)} -> ${L.current.slice(-12)}`)},clearResettingFlag:()=>{j.current=!1}},e.createElement(as,{trackEvent:q},e.createElement(Ot,null,e.createElement("div",null,e.createElement(Gs,null),e.createElement(is,{ref:n,embedded:(null===(o=G.general)||void 0===o?void 0:o.embedded)||!1,currentOpen:f||!1,enabled:!1!==U,onSetEnabled:e=>z(!!e&&void 0)}),e.createElement(Nt,{key:`chatbot-${O.current}-${U}`,settings:G,flow:V,plugins:X}),e.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}}),e.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."))))))});ua.displayName="QABot";const da=()=>{const[t,n]=e.useState(!1),r=()=>"undefined"!=typeof navigator&&void 0!==navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getDisplayMedia;return{captureScreenshot:async()=>{if(!r())throw new Error("Screen capture is not available in this environment");try{n(!0);const e=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",cursor:"always",width:{ideal:1920},height:{ideal:1080}},audio:!1}),t=document.createElement("video");t.srcObject=e,await new Promise(e=>{t.onloadedmetadata=()=>{t.play(),e()}});const r=document.createElement("canvas");r.width=t.videoWidth,r.height=t.videoHeight;const A=r.getContext("2d");if(!A)throw new Error("Could not get canvas context");A.drawImage(t,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,"-"),s=new File([o],`screenshot-${i}.png`,{type:"image/png"});return e.getTracks().forEach(e=>e.stop()),n(!1),s}catch(e){throw Ts("Error capturing screenshot:",e),n(!1),e}},isCapturing:t,isScreenCaptureAvailable:r()}},fa=t=>e.createElement(Us,t,e.createElement("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.createElement("polyline",{points:"17 8 12 3 7 8"}),e.createElement("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),pa=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)}),ga=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`;const ha=e.forwardRef((t,n)=>{var{defaultOpen:r}=t,A=a(t,["defaultOpen"]);const[o,i]=e.useState(r||!1),l=e.useRef(null);return e.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()}}),[]),e.createElement(ua,s({ref:l},A,{open:o,onOpenChange:i}))});function ma(n){if(!(n.target&&n.target instanceof HTMLElement))return void Ts("QA Bot: A valid target DOM element is required");const{target:r}=n,A=a(n,["target"]),o=t.createRoot(r),i={current:null};return o.render(e.createElement(e.StrictMode,null,e.createElement(ha,s({ref:e=>{i.current=e}},A)))),{addMessage:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.addMessage(e)},setBotEnabled:e=>{var t;return null===(t=i.current)||void 0===t?void 0:t.setBotEnabled(e)},openChat:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.openChat()},closeChat:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.closeChat()},toggleChat:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.toggleChat()},destroy:()=>{i.current=null,o.unmount()}}}ha.displayName="ProgrammaticQABot",exports.FileUploadComponent=t=>{let{onFileUpload:n,maxSizeMB:r=10,acceptedTypes:A="image/*,application/pdf,text/*,.doc,.docx",enableScreenshot:o=!1,className:i}=t;const[s,a]=e.useState(!1),[l,c]=e.useState([]),[u,d]=e.useState(null),f=e.useRef(null),{captureScreenshot:p,isCapturing:g,isScreenCaptureAvailable:h}=da(),m=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)},v=e=>{if(!e||0===e.length)return void Ss("FileUploadComponent: No valid files provided to handleFiles");let t;try{t=Array.from(e)}catch(e){return Ts("FileUploadComponent: Error converting files to array:",e),void m("Error processing selected files. Please try again.")}const r=[...l,...t];c(r);const A=t.length,o=t.map(e=>e.name).join(", ");m(`${A} file${A>1?"s":""} selected: ${o}`),setTimeout(()=>{const e=document.querySelector(".rcb-chat-content");e&&(e.scrollTop=e.scrollHeight)},100),n&&n(r)},y=e=>{e.preventDefault(),e.stopPropagation(),"dragenter"===e.type||"dragover"===e.type?a(!0):"dragleave"===e.type&&a(!1)},w=()=>{try{f.current&&f.current.click()}catch(e){Ts("FileUploadComponent: Error in handleButtonClick:",e),m("Error opening file selection dialog. Please try again.")}},b=()=>{d(null)},E=o&&h;return e.createElement("div",{className:`file-upload-container ${i||""}`,style:{padding:"16px",margin:"8px 0"}},E&&e.createElement("div",{style:{display:"flex",justifyContent:"center",marginBottom:"10px"}},e.createElement("button",{onClick:e=>{e.preventDefault(),(async()=>{try{const e=await p();v([e]),m("Screenshot captured successfully")}catch(e){m("Error capturing screenshot. Please try again.")}})()},disabled:g,"aria-describedby":"screenshot-help","aria-label":g?"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:g?"not-allowed":"pointer",fontSize:"14px",fontWeight:"500",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}},e.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"},e.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"}),e.createElement("circle",{cx:"12",cy:"13",r:"4"})),g?"Taking screenshot...":"Take screenshot..."),e.createElement("span",{id:"screenshot-help",className:"sr-only"},"Captures the current screen and adds it as an attachment")),e.createElement("div",{className:"file-upload-dropzone "+(s?"active":""),onDragEnter:y,onDragLeave:y,onDragOver:y,onDrop:e=>{var t;e.preventDefault(),e.stopPropagation(),a(!1);try{(null===(t=e.dataTransfer)||void 0===t?void 0:t.files)&&e.dataTransfer.files.length>0&&v(e.dataTransfer.files)}catch(e){Ts("FileUploadComponent: Error in handleDrop:",e),m("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(),w())},style:{padding:"20px",border:"2px dashed #ccc",borderRadius:"8px",backgroundColor:s?"#f0f8ff":"#fafafa",transition:"all 0.3s ease"}},e.createElement("input",{ref:f,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&&v(e.target.files)}catch(e){Ts("FileUploadComponent: Error in handleFileSelect:",e),m("Error processing selected files. Please try again.")}},multiple:!0,style:{display:"none"},"aria-label":"Select files to upload",accept:A}),e.createElement("div",{className:"upload-content",onClick:w,style:{cursor:"pointer",flexDirection:"column",alignItems:"center",display:"flex",textAlign:"center",padding:"12px"}},e.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"10px"}},e.createElement(fa,null),e.createElement("p",{style:{margin:0,fontWeight:"bold"}},"Upload Files")),e.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)")),l.length>0&&e.createElement("div",{className:"selected-files",style:{display:"flex",flexWrap:"wrap",gap:"8px",marginTop:"12px",alignItems:"center"}},e.createElement("span",{style:{fontWeight:400,color:"#888",fontSize:"13px",marginRight:"8px",alignSelf:"center"}},"Selected files:"),l.map((t,r)=>e.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:e=>{e.stopPropagation(),(e=>{d(e)})(t)}},e.createElement("span",{onClick:e=>{e.stopPropagation(),(e=>{const t=l.filter((t,n)=>n!==e);c(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 ${t.name}`},"×"),t.name," (",ga(t.size),")"))))),(()=>{if(!u)return null;const t=u.type.startsWith("image/"),n=u.type.startsWith("text/"),r="application/pdf"===u.type;return e.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:b},e.createElement("div",{style:{backgroundColor:"white",padding:"20px",borderRadius:"8px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",position:"relative"},onClick:e=>e.stopPropagation()},e.createElement("button",{onClick:b,style:{position:"absolute",top:"10px",right:"10px",background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#666"}},"×"),e.createElement("h3",{style:{marginTop:0,marginBottom:"16px"}},u.name),t&&e.createElement("img",{src:URL.createObjectURL(u),alt:u.name,style:{maxWidth:"100%",maxHeight:"70vh"}}),n&&e.createElement("pre",{style:{whiteSpace:"pre-wrap",wordWrap:"break-word",maxHeight:"70vh",overflow:"auto",padding:"16px",backgroundColor:"#f5f5f5",borderRadius:"4px"}},URL.createObjectURL(u)),r&&e.createElement("iframe",{src:URL.createObjectURL(u),style:{width:"100%",height:"70vh",border:"none"},title:u.name}),!t&&!n&&!r&&e.createElement("div",{style:{padding:"20px",textAlign:"center"}},"Preview not available for this file type")))})())},exports.QABot=ua,exports.applyFlowSettings=function(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},exports.default=ma,exports.fileToBase64=pa,exports.filesToBase64=e=>Promise.all(e.map(pa)),exports.formatFileSize=ga,exports.qaBot=ma,exports.useScreenshotCapture=da,exports.validateFileSize=function(e){const t=1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:10)*1024;return e.size<=t},exports.withHistory=function(e){return async t=>{await t.injectMessage(e)}},exports.withHistoryFn=function(e){return async t=>{const n=await e(t);await t.injectMessage(n)}};
|
|
9
9
|
//# sourceMappingURL=qa-bot-core.umd.cjs.map
|