@brainbase-labs/chat-widget 0.1.15 → 0.1.17

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/index.cjs CHANGED
@@ -1,17 +1,17 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react"),g=require("react/jsx-runtime"),Fn="bb-chat-";function Ut(e){try{const n=sessionStorage.getItem(`${Fn}${e}`);return n?JSON.parse(n):null}catch{return null}}function vn(e,n){try{sessionStorage.setItem(`${Fn}${e}`,JSON.stringify(n))}catch{}}function Tn(e){try{sessionStorage.removeItem(`${Fn}${e}`)}catch{}}function qt(e){const{config:n,apiClient:t,mockMode:r,onSessionStart:i,onSessionEnd:l,onMessage:o,onError:a}=e,[c,s]=F.useState([]),[u,p]=F.useState([]),[m,h]=F.useState(!1),[C,E]=F.useState(null),[I,x]=F.useState(null),A=F.useRef(0),v=F.useRef(!1),R=F.useRef({});F.useEffect(()=>{if(v.current)return;v.current=!0;const S=Ut(n.embedId);S&&S.status==="active"&&(x(S.sessionId),s(S.messages),p(S.toolCalls),A.current=S.startTime)},[n.embedId]),F.useEffect(()=>{I&&c.length>0&&vn(n.embedId,{sessionId:I,deploymentId:n.deploymentId,workerId:n.workerId,flowId:n.flowId,startTime:A.current,messages:c,toolCalls:u,status:"active"})},[I,c,u,n]);const q=F.useCallback(async()=>(A.current=Date.now(),x(null),s([]),p([]),Tn(n.embedId),""),[n.embedId]),k=F.useCallback((S,j)=>{s(L=>{let b=!1;const N=L.map(T=>T.id===S?(b=!0,{...T,content:j,status:"streaming"}):T);return b||N.push({id:S,role:"assistant",content:j,timestamp:Date.now(),status:"streaming"}),N})},[]),B=F.useCallback((S,j,L)=>{switch(S.type){case"session":{const b=S.data;b.session_id&&(L(b.session_id),b.is_new&&(A.current=Date.now(),i==null||i(b.session_id)));break}case"message":{const b=S.data;b.content&&(R.current[j]=b.content,k(j,b.content));break}case"chunk":{const b=S.data;if(b.content){const T=(R.current[j]??"")+b.content;R.current[j]=T,k(j,T)}break}case"tool_call":{const b=S.data;if(p(N=>{const T=N.findIndex(O=>O.name===b.function&&O.status==="pending");return T!==-1&&b.result!==void 0?N.map((O,Q)=>Q===T?{...O,result:b.result,status:"completed"}:O):T===-1?[...N,{id:`tc-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:b.function,arguments:b.args??{},status:"pending",timestamp:Date.now()}]:N}),b.content){const N=b.content;R.current[j]=N,k(j,N)}break}case"waiting":break;case"done":{s(b=>b.map(N=>N.id===j?{...N,status:"sent"}:N)),delete R.current[j];break}case"completed":{s(b=>{const N=b.map(T=>T.id===j?{...T,status:"sent"}:T);return I&&vn(n.embedId,{sessionId:I,deploymentId:n.deploymentId,workerId:n.workerId,flowId:n.flowId,startTime:A.current,messages:N,toolCalls:[],status:"completed"}),N}),delete R.current[j];break}case"error":{const b=S.data;s(N=>N.map(T=>T.id===j?{...T,status:"error",content:b.error??"An error occurred"}:T));break}}},[n,I,i,k]),U=F.useCallback(async(S,j,L)=>{const b=S.getReader(),N=new TextDecoder;let T="";try{for(;;){const{done:O,value:Q}=await b.read();if(O)break;T+=N.decode(Q,{stream:!0});let f;for(;(f=T.indexOf(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),g=require("react/jsx-runtime"),Fn="bb-chat-";function Ut(e){try{const n=sessionStorage.getItem(`${Fn}${e}`);return n?JSON.parse(n):null}catch{return null}}function vn(e,n){try{sessionStorage.setItem(`${Fn}${e}`,JSON.stringify(n))}catch{}}function Tn(e){try{sessionStorage.removeItem(`${Fn}${e}`)}catch{}}function qt(e){const{config:n,apiClient:t,mockMode:r,onSessionStart:i,onSessionEnd:l,onMessage:o,onError:a}=e,[c,s]=O.useState([]),[u,p]=O.useState([]),[m,h]=O.useState(!1),[S,I]=O.useState(null),[E,b]=O.useState(null),P=O.useRef(0),v=O.useRef(!1),R=O.useRef({});O.useEffect(()=>{if(v.current)return;v.current=!0;const C=Ut(n.embedId);C&&C.status==="active"&&(b(C.sessionId),s(C.messages),p(C.toolCalls),P.current=C.startTime)},[n.embedId]),O.useEffect(()=>{E&&c.length>0&&vn(n.embedId,{sessionId:E,deploymentId:n.deploymentId,workerId:n.workerId,flowId:n.flowId,startTime:P.current,messages:c,toolCalls:u,status:"active"})},[E,c,u,n]);const V=O.useCallback(async()=>(P.current=Date.now(),b(null),s([]),p([]),Tn(n.embedId),""),[n.embedId]),k=O.useCallback((C,j)=>{s(T=>{let x=!1;const A=T.map(L=>L.id===C?(x=!0,{...L,content:j,status:"streaming"}):L);return x||A.push({id:C,role:"assistant",content:j,timestamp:Date.now(),status:"streaming"}),A})},[]),D=O.useCallback((C,j,T)=>{switch(C.type){case"session":{const x=C.data;x.session_id&&(T(x.session_id),x.is_new&&(P.current=Date.now(),i==null||i(x.session_id)));break}case"message":{const x=C.data;x.content&&(R.current[j]=x.content,k(j,x.content));break}case"chunk":{const x=C.data;if(x.content){const L=(R.current[j]??"")+x.content;R.current[j]=L,k(j,L)}break}case"tool_call":{const x=C.data;if(p(A=>{const L=A.findIndex(q=>q.name===x.function&&q.status==="pending");return L!==-1&&x.result!==void 0?A.map((q,Q)=>Q===L?{...q,result:x.result,status:"completed"}:q):L===-1?[...A,{id:`tc-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:x.function,arguments:x.args??{},status:"pending",timestamp:Date.now()}]:A}),x.content){const A=x.content;R.current[j]=A,k(j,A)}break}case"waiting":break;case"done":{s(x=>x.map(A=>A.id===j?{...A,status:"sent"}:A)),delete R.current[j];break}case"completed":{s(x=>{const A=x.map(L=>L.id===j?{...L,status:"sent"}:L);return E&&vn(n.embedId,{sessionId:E,deploymentId:n.deploymentId,workerId:n.workerId,flowId:n.flowId,startTime:P.current,messages:A,toolCalls:[],status:"completed"}),A}),delete R.current[j];break}case"error":{const x=C.data;s(A=>A.map(L=>L.id===j?{...L,status:"error",content:x.error??"An error occurred"}:L));break}}},[n,E,i,k]),U=O.useCallback(async(C,j,T)=>{const x=C.getReader(),A=new TextDecoder;let L="";try{for(;;){const{done:q,value:Q}=await x.read();if(q)break;L+=A.decode(Q,{stream:!0});let f;for(;(f=L.indexOf(`
2
2
 
3
- `))!==-1;){const le=T.slice(0,f);T=T.slice(f+2);for(const ue of le.split(`
4
- `))if(ue.startsWith("data: "))try{const d=JSON.parse(ue.slice(6));B(d,j,L)}catch{}}}}finally{b.releaseLock()}},[B]),$=F.useCallback(async S=>{if(!S.trim())return;const j={id:`user-${Date.now()}`,role:"user",content:S,timestamp:Date.now(),status:"sent"};s(T=>[...T,j]),o==null||o(j);const L=`assistant-${Date.now()}`,b={id:L,role:"assistant",content:"",timestamp:Date.now(),status:"streaming"};s(T=>[...T,b]),h(!0),E(null);const N=T=>{x(T)};try{if(r){const T=t.sendMessage(S);for await(const O of T)B(O,L,N)}else{const T=await t.sendMessage({embedId:n.embedId,message:S,sessionId:I??void 0});await U(T,L,N)}s(T=>T.map(O=>O.id===L&&O.status==="streaming"?{...O,status:"sent"}:O))}catch(T){const O=T instanceof Error?T:new Error("Failed to send message");E(O),a==null||a(O),s(Q=>Q.map(f=>f.id===L?{...f,status:"error",content:"Failed to get response"}:f))}finally{h(!1)}},[I,t,r,n.embedId,B,U,o,a]),V=F.useCallback(async()=>{if(!I)return;const S={sessionId:I,deploymentId:n.deploymentId,workerId:n.workerId,flowId:n.flowId,startTime:A.current,messages:c,toolCalls:u,status:"completed"};l==null||l(S),Tn(n.embedId),x(null),s([]),p([])},[I,n,c,u,l]),P=F.useCallback(()=>{s([]),p([])},[]);return{messages:c,toolCalls:u,isLoading:m,error:C,sessionId:I,sendMessage:$,endSession:V,clearMessages:P,startNewSession:q}}const Wt="http://localhost:8003";function Yt(e=Wt){return{async getDeploymentConfig(n){const t=await fetch(`${e}/chat/config/${n}`);if(!t.ok)throw new Error(`Failed to fetch deployment config: ${t.status}`);const r=await t.json();return{embedId:r.embedId,deploymentId:"",workerId:"",flowId:"",welcomeMessage:r.welcomeMessage,agentName:r.agentName,agentLogoUrl:r.agentLogoUrl,primaryColor:r.primaryColor,styling:r.styling}},async sendMessage(n){const t=await fetch(`${e}/chat/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embed_id:n.embedId,message:n.message,session_id:n.sessionId||void 0,metadata:n.metadata})});if(!t.ok){const r=await t.text();throw new Error(`Failed to send message: ${t.status} - ${r}`)}if(!t.body)throw new Error("No response stream available");return t.body}}}const Yr={embedId:"mock-embed-id",deploymentId:"mock-deployment-id",workerId:"mock-worker-id",flowId:"mock-flow-id",agentName:"AI Assistant",agentLogoUrl:void 0,primaryColor:"#1a1a2e",styling:{}},Xr=[{trigger:/hello|hi|hey/i,response:"Hello! I'm a demo AI assistant. How can I help you today?",delay:500},{trigger:/weather/i,response:"I'd check the weather for you, but I'm in mock mode! In production, I could use a weather API.",delay:800,toolCalls:[{name:"get_weather",arguments:{location:"San Francisco"},result:{temperature:72,condition:"sunny"}}]},{trigger:/help|support/i,response:"I'm here to help! You can ask me questions, and I'll do my best to assist you. In production, I'd be connected to your agent with full capabilities.",delay:600},{trigger:/pricing|cost|price/i,response:"For pricing information, I'd typically check our database or connect you with the sales team. This is a mock response demonstrating how I'd handle pricing questions.",delay:700,toolCalls:[{name:"lookup_pricing",arguments:{plan:"all"},result:{plans:[{name:"Starter",price:"$29/mo"},{name:"Pro",price:"$99/mo"}]}}]},{trigger:/.*/,response:"I'm running in mock mode. This is a simulated response to demonstrate the chat UI. In production, I'd be connected to your agent!",delay:1e3}];function $e(e){return new Promise(n=>setTimeout(n,e))}function Xt(e,n){const t={...Yr,...e},r=n??Xr,i=`mock-session-${Date.now()}`;return{async getDeploymentConfig(l){return await $e(300),t},async*sendMessage(l){yield{type:"session",data:{session_id:i,is_new:!0},timestamp:Date.now()};const o=r.find(s=>typeof s.trigger=="string"?l.toLowerCase().includes(s.trigger.toLowerCase()):s.trigger.test(l))??r[r.length-1];if(await $e(o.delay??500),o.toolCalls)for(const s of o.toolCalls)yield{type:"tool_call",data:{function:s.name,args:s.arguments},timestamp:Date.now()},await $e(300),yield{type:"tool_call",data:{function:s.name,result:s.result},timestamp:Date.now()},await $e(200);const a=o.response.split(" ");let c="";for(const s of a)c+=(c?" ":"")+s,yield{type:"message",data:{content:c,role:"assistant"},timestamp:Date.now()},await $e(30+Math.random()*40);yield{type:"done",data:{session_id:i},timestamp:Date.now()}}}}const Qe=({className:e,color:n="currentColor",cutoutColor:t="var(--bb-primary-color)"})=>g.jsxs("svg",{className:e,viewBox:"0 0 800 800",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H788C794.627 400 800 405.373 800 412V740C800 773.137 773.137 800 740 800H412C405.373 800 400 794.627 400 788V412Z",fill:n}),g.jsx("circle",{cx:"400",cy:"400",r:"400",fill:n}),g.jsx("path",{d:"M0 60C0 26.8629 26.8629 0 60 0H397.614C398.932 0 400 1.06811 400 2.38569V2.38569C400 221.982 221.982 400 2.38569 400V400C1.06811 400 0 398.932 0 397.614V60Z",fill:n}),g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H738C744.627 400 750 405.373 750 412V725C750 738.807 738.807 750 725 750H412C405.373 750 400 744.627 400 738V412Z",fill:n}),g.jsx("circle",{cx:"400",cy:"400",r:"350",fill:n}),g.jsx("path",{d:"M50 75C50 61.1929 61.1929 50 75 50H388C394.627 50 400 55.3726 400 62V388C400 394.627 394.627 400 388 400H62C55.3726 400 50 394.627 50 388V75Z",fill:n}),g.jsx("rect",{x:"399.919",y:"209",width:"270",height:"270",rx:"12",transform:"rotate(45 399.919 209)",fill:t})]}),Kr="_header_1p6z5_1",Qr="_compact_1p6z5_9",Zr="_headerBackground_1p6z5_20",Jr="_headerContent_1p6z5_59",Gr="_topRow_1p6z5_64",ei="_agentInfo_1p6z5_79",ni="_agentLogo_1p6z5_85",ti="_agentLogoPlaceholder_1p6z5_102",ri="_brainbaseLogo_1p6z5_123",ii="_agentName_1p6z5_137",li="_actions_1p6z5_144",oi="_actionButton_1p6z5_149",ai="_welcomeText_1p6z5_183",si="_title_1p6z5_202",ui="_subtitle_1p6z5_210",G={header:Kr,compact:Qr,headerBackground:Zr,headerContent:Jr,topRow:Gr,agentInfo:ei,agentLogo:ni,agentLogoPlaceholder:ti,brainbaseLogo:ri,agentName:ii,actions:li,actionButton:oi,welcomeText:ai,title:si,subtitle:ui},Kt=({agentName:e="AI Assistant",agentLogoUrl:n,welcomeTitle:t,welcomeSubtitle:r,onClose:i,onNewChatRequest:l,showNewChatButton:o=!1,compact:a=!1})=>{const c=t||"Hello there.",s=r!==void 0?r:t?void 0:"How can we help?";return g.jsxs("div",{className:`${G.header} ${a?G.compact:""}`,children:[g.jsx("div",{className:G.headerBackground}),g.jsxs("div",{className:G.headerContent,children:[g.jsxs("div",{className:G.topRow,children:[g.jsxs("div",{className:G.agentInfo,children:[n?g.jsx("img",{src:n,alt:e,className:G.agentLogo}):g.jsx("div",{className:G.agentLogoPlaceholder,children:g.jsx(Qe,{className:G.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})}),g.jsx("span",{className:G.agentName,children:e})]}),g.jsxs("div",{className:G.actions,children:[o&&l&&g.jsx("button",{className:G.actionButton,onClick:l,"aria-label":"Start new chat",type:"button",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M12 5V19M5 12H19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),i&&g.jsx("button",{className:G.actionButton,onClick:i,"aria-label":"Close chat",type:"button",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),!a&&g.jsxs("div",{className:G.welcomeText,children:[g.jsx("h1",{className:G.title,children:c}),s&&g.jsx("p",{className:G.subtitle,children:s})]})]})]})};function ci(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const pi=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hi=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fi={};function ot(e,n){return(fi.jsx?hi:pi).test(e)}const di=/[ \t\n\f\r]/g;function mi(e){return typeof e=="object"?e.type==="text"?at(e.value):!1:at(e)}function at(e){return e.replace(di,"")===""}class Je{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}Je.prototype.normal={};Je.prototype.property={};Je.prototype.space=void 0;function Qt(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Je(t,r,n)}function Ln(e){return e.toLowerCase()}class ie{constructor(n,t){this.attribute=t,this.property=n}}ie.prototype.attribute="";ie.prototype.booleanish=!1;ie.prototype.boolean=!1;ie.prototype.commaOrSpaceSeparated=!1;ie.prototype.commaSeparated=!1;ie.prototype.defined=!1;ie.prototype.mustUseProperty=!1;ie.prototype.number=!1;ie.prototype.overloadedBoolean=!1;ie.prototype.property="";ie.prototype.spaceSeparated=!1;ie.prototype.space=void 0;let gi=0;const D=ve(),Z=ve(),Pn=ve(),w=ve(),X=ve(),ze=ve(),ae=ve();function ve(){return 2**++gi}const Nn=Object.freeze(Object.defineProperty({__proto__:null,boolean:D,booleanish:Z,commaOrSpaceSeparated:ae,commaSeparated:ze,number:w,overloadedBoolean:Pn,spaceSeparated:X},Symbol.toStringTag,{value:"Module"})),dn=Object.keys(Nn);class $n extends ie{constructor(n,t,r,i){let l=-1;if(super(n,t),st(this,"space",i),typeof r=="number")for(;++l<dn.length;){const o=dn[l];st(this,dn[l],(r&Nn[o])===Nn[o])}}}$n.prototype.defined=!0;function st(e,n,t){t&&(e[n]=t)}function De(e){const n={},t={};for(const[r,i]of Object.entries(e.properties)){const l=new $n(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),n[r]=l,t[Ln(r)]=r,t[Ln(l.attribute)]=r}return new Je(n,t,e.space)}const Zt=De({properties:{ariaActiveDescendant:null,ariaAtomic:Z,ariaAutoComplete:null,ariaBusy:Z,ariaChecked:Z,ariaColCount:w,ariaColIndex:w,ariaColSpan:w,ariaControls:X,ariaCurrent:null,ariaDescribedBy:X,ariaDetails:null,ariaDisabled:Z,ariaDropEffect:X,ariaErrorMessage:null,ariaExpanded:Z,ariaFlowTo:X,ariaGrabbed:Z,ariaHasPopup:null,ariaHidden:Z,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:X,ariaLevel:w,ariaLive:null,ariaModal:Z,ariaMultiLine:Z,ariaMultiSelectable:Z,ariaOrientation:null,ariaOwns:X,ariaPlaceholder:null,ariaPosInSet:w,ariaPressed:Z,ariaReadOnly:Z,ariaRelevant:null,ariaRequired:Z,ariaRoleDescription:X,ariaRowCount:w,ariaRowIndex:w,ariaRowSpan:w,ariaSelected:Z,ariaSetSize:w,ariaSort:null,ariaValueMax:w,ariaValueMin:w,ariaValueNow:w,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Jt(e,n){return n in e?e[n]:n}function Gt(e,n){return Jt(e,n.toLowerCase())}const yi=De({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ze,acceptCharset:X,accessKey:X,action:null,allow:null,allowFullScreen:D,allowPaymentRequest:D,allowUserMedia:D,alt:null,as:null,async:D,autoCapitalize:null,autoComplete:X,autoFocus:D,autoPlay:D,blocking:X,capture:null,charSet:null,checked:D,cite:null,className:X,cols:w,colSpan:null,content:null,contentEditable:Z,controls:D,controlsList:X,coords:w|ze,crossOrigin:null,data:null,dateTime:null,decoding:null,default:D,defer:D,dir:null,dirName:null,disabled:D,download:Pn,draggable:Z,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:D,formTarget:null,headers:X,height:w,hidden:Pn,high:w,href:null,hrefLang:null,htmlFor:X,httpEquiv:X,id:null,imageSizes:null,imageSrcSet:null,inert:D,inputMode:null,integrity:null,is:null,isMap:D,itemId:null,itemProp:X,itemRef:X,itemScope:D,itemType:X,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:D,low:w,manifest:null,max:null,maxLength:w,media:null,method:null,min:null,minLength:w,multiple:D,muted:D,name:null,nonce:null,noModule:D,noValidate:D,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:D,optimum:w,pattern:null,ping:X,placeholder:null,playsInline:D,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:D,referrerPolicy:null,rel:X,required:D,reversed:D,rows:w,rowSpan:w,sandbox:X,scope:null,scoped:D,seamless:D,selected:D,shadowRootClonable:D,shadowRootDelegatesFocus:D,shadowRootMode:null,shape:null,size:w,sizes:null,slot:null,span:w,spellCheck:Z,src:null,srcDoc:null,srcLang:null,srcSet:null,start:w,step:null,style:null,tabIndex:w,target:null,title:null,translate:null,type:null,typeMustMatch:D,useMap:null,value:Z,width:w,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:X,axis:null,background:null,bgColor:null,border:w,borderColor:null,bottomMargin:w,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:D,declare:D,event:null,face:null,frame:null,frameBorder:null,hSpace:w,leftMargin:w,link:null,longDesc:null,lowSrc:null,marginHeight:w,marginWidth:w,noResize:D,noHref:D,noShade:D,noWrap:D,object:null,profile:null,prompt:null,rev:null,rightMargin:w,rules:null,scheme:null,scrolling:Z,standby:null,summary:null,text:null,topMargin:w,valueType:null,version:null,vAlign:null,vLink:null,vSpace:w,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:D,disableRemotePlayback:D,prefix:null,property:null,results:w,security:null,unselectable:null},space:"html",transform:Gt}),xi=De({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ae,accentHeight:w,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:w,amplitude:w,arabicForm:null,ascent:w,attributeName:null,attributeType:null,azimuth:w,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:w,by:null,calcMode:null,capHeight:w,className:X,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:w,diffuseConstant:w,direction:null,display:null,dur:null,divisor:w,dominantBaseline:null,download:D,dx:null,dy:null,edgeMode:null,editable:null,elevation:w,enableBackground:null,end:null,event:null,exponent:w,externalResourcesRequired:null,fill:null,fillOpacity:w,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:ze,g2:ze,glyphName:ze,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:w,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:w,horizOriginX:w,horizOriginY:w,id:null,ideographic:w,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:w,k:w,k1:w,k2:w,k3:w,k4:w,kernelMatrix:ae,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:w,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:w,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:w,overlineThickness:w,paintOrder:null,panose1:null,path:null,pathLength:w,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:X,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:w,pointsAtY:w,pointsAtZ:w,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ae,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ae,rev:ae,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ae,requiredFeatures:ae,requiredFonts:ae,requiredFormats:ae,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:w,specularExponent:w,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:w,strikethroughThickness:w,string:null,stroke:null,strokeDashArray:ae,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:w,strokeOpacity:w,strokeWidth:null,style:null,surfaceScale:w,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ae,tabIndex:w,tableValues:null,target:null,targetX:w,targetY:w,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ae,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:w,underlineThickness:w,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:w,values:null,vAlphabetic:w,vMathematical:w,vectorEffect:null,vHanging:w,vIdeographic:w,version:null,vertAdvY:w,vertOriginX:w,vertOriginY:w,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:w,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Jt}),er=De({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),nr=De({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Gt}),tr=De({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),ki={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"},bi=/[A-Z]/g,ut=/-[a-z]/g,wi=/^data[-\w.:]+$/i;function Ci(e,n){const t=Ln(n);let r=n,i=ie;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&wi.test(n)){if(n.charAt(4)==="-"){const l=n.slice(5).replace(ut,_i);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=n.slice(4);if(!ut.test(l)){let o=l.replace(bi,Si);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}i=$n}return new i(r,n)}function Si(e){return"-"+e.toLowerCase()}function _i(e){return e.charAt(1).toUpperCase()}const Ii=Qt([Zt,yi,er,nr,tr],"html"),Hn=Qt([Zt,xi,er,nr,tr],"svg");function Ei(e){return e.join(" ").trim()}function rr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ne={},mn,ct;function vi(){if(ct)return mn;ct=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,c=`
5
- `,s="/",u="*",p="",m="comment",h="declaration";function C(I,x){if(typeof I!="string")throw new TypeError("First argument must be a string");if(!I)return[];x=x||{};var A=1,v=1;function R(L){var b=L.match(n);b&&(A+=b.length);var N=L.lastIndexOf(c);v=~N?L.length-N:v+L.length}function q(){var L={line:A,column:v};return function(b){return b.position=new k(L),$(),b}}function k(L){this.start=L,this.end={line:A,column:v},this.source=x.source}k.prototype.content=I;function B(L){var b=new Error(x.source+":"+A+":"+v+": "+L);if(b.reason=L,b.filename=x.source,b.line=A,b.column=v,b.source=I,!x.silent)throw b}function U(L){var b=L.exec(I);if(b){var N=b[0];return R(N),I=I.slice(N.length),b}}function $(){U(t)}function V(L){var b;for(L=L||[];b=P();)b!==!1&&L.push(b);return L}function P(){var L=q();if(!(s!=I.charAt(0)||u!=I.charAt(1))){for(var b=2;p!=I.charAt(b)&&(u!=I.charAt(b)||s!=I.charAt(b+1));)++b;if(b+=2,p===I.charAt(b-1))return B("End of comment missing");var N=I.slice(2,b-2);return v+=2,R(N),I=I.slice(b),v+=2,L({type:m,comment:N})}}function S(){var L=q(),b=U(r);if(b){if(P(),!U(i))return B("property missing ':'");var N=U(l),T=L({type:h,property:E(b[0].replace(e,p)),value:N?E(N[0].replace(e,p)):p});return U(o),T}}function j(){var L=[];V(L);for(var b;b=S();)b!==!1&&(L.push(b),V(L));return L}return $(),j()}function E(I){return I?I.replace(a,p):p}return mn=C,mn}var pt;function Ti(){if(pt)return Ne;pt=1;var e=Ne&&Ne.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.default=t;const n=e(vi());function t(r,i){let l=null;if(!r||typeof r!="string")return l;const o=(0,n.default)(r),a=typeof i=="function";return o.forEach(c=>{if(c.type!=="declaration")return;const{property:s,value:u}=c;a?i(s,u,c):u&&(l=l||{},l[s]=u)}),l}return Ne}var He={},ht;function Li(){if(ht)return He;ht=1,Object.defineProperty(He,"__esModule",{value:!0}),He.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,t=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,l=function(s){return!s||t.test(s)||e.test(s)},o=function(s,u){return u.toUpperCase()},a=function(s,u){return"".concat(u,"-")},c=function(s,u){return u===void 0&&(u={}),l(s)?s:(s=s.toLowerCase(),u.reactCompat?s=s.replace(i,a):s=s.replace(r,a),s.replace(n,o))};return He.camelCase=c,He}var Ve,ft;function Pi(){if(ft)return Ve;ft=1;var e=Ve&&Ve.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},n=e(Ti()),t=Li();function r(i,l){var o={};return!i||typeof i!="string"||(0,n.default)(i,function(a,c){a&&c&&(o[(0,t.camelCase)(a,l)]=c)}),o}return r.default=r,Ve=r,Ve}var Ni=Pi();const Ai=rr(Ni),ir=lr("end"),Vn=lr("start");function lr(e){return n;function n(t){const r=t&&t.position&&t.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ji(e){const n=Vn(e),t=ir(e);if(n&&t)return{start:n,end:t}}function Ye(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?dt(e.position):"start"in e||"end"in e?dt(e):"line"in e||"column"in e?An(e):""}function An(e){return mt(e&&e.line)+":"+mt(e&&e.column)}function dt(e){return An(e&&e.start)+"-"+An(e&&e.end)}function mt(e){return e&&typeof e=="number"?e:1}class ne extends Error{constructor(n,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let i="",l={},o=!1;if(t&&("line"in t&&"column"in t?l={place:t}:"start"in t&&"end"in t?l={place:t}:"type"in t?l={ancestors:[t],place:t.position}:l={...t}),typeof n=="string"?i=n:!l.cause&&n&&(o=!0,i=n.message,l.cause=n),!l.ruleId&&!l.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?l.ruleId=r:(l.source=r.slice(0,c),l.ruleId=r.slice(c+1))}if(!l.place&&l.ancestors&&l.ancestors){const c=l.ancestors[l.ancestors.length-1];c&&(l.place=c.position)}const a=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Ye(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ne.prototype.file="";ne.prototype.name="";ne.prototype.reason="";ne.prototype.message="";ne.prototype.stack="";ne.prototype.column=void 0;ne.prototype.line=void 0;ne.prototype.ancestors=void 0;ne.prototype.cause=void 0;ne.prototype.fatal=void 0;ne.prototype.place=void 0;ne.prototype.ruleId=void 0;ne.prototype.source=void 0;const Un={}.hasOwnProperty,zi=new Map,Mi=/[A-Z]/g,Di=new Set(["table","tbody","thead","tfoot","tr"]),Bi=new Set(["td","th"]),or="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Oi(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Wi(t,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=qi(t,n.jsx,n.jsxs)}const i={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Hn:Ii,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},l=ar(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function ar(e,n,t){if(n.type==="element")return Ri(e,n,t);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Fi(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Hi(e,n,t);if(n.type==="mdxjsEsm")return $i(e,n);if(n.type==="root")return Vi(e,n,t);if(n.type==="text")return Ui(e,n)}function Ri(e,n,t){const r=e.schema;let i=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Hn,e.schema=i),e.ancestors.push(n);const l=ur(e,n.tagName,!1),o=Yi(e,n);let a=Wn(e,n);return Di.has(n.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!mi(c):!0})),sr(e,o,l,n),qn(o,a),e.ancestors.pop(),e.schema=r,e.create(n,l,o,t)}function Fi(e,n){if(n.data&&n.data.estree&&e.evaluater){const r=n.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ze(e,n.position)}function $i(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Ze(e,n.position)}function Hi(e,n,t){const r=e.schema;let i=r;n.name==="svg"&&r.space==="html"&&(i=Hn,e.schema=i),e.ancestors.push(n);const l=n.name===null?e.Fragment:ur(e,n.name,!0),o=Xi(e,n),a=Wn(e,n);return sr(e,o,l,n),qn(o,a),e.ancestors.pop(),e.schema=r,e.create(n,l,o,t)}function Vi(e,n,t){const r={};return qn(r,Wn(e,n)),e.create(n,e.Fragment,r,t)}function Ui(e,n){return n.value}function sr(e,n,t,r){typeof t!="string"&&t!==e.Fragment&&e.passNode&&(n.node=r)}function qn(e,n){if(n.length>0){const t=n.length>1?n:n[0];t&&(e.children=t)}}function qi(e,n,t){return r;function r(i,l,o,a){const s=Array.isArray(o.children)?t:n;return a?s(l,o,a):s(l,o)}}function Wi(e,n){return t;function t(r,i,l,o){const a=Array.isArray(l.children),c=Vn(r);return n(i,l,o,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Yi(e,n){const t={};let r,i;for(i in n.properties)if(i!=="children"&&Un.call(n.properties,i)){const l=Ki(e,i,n.properties[i]);if(l){const[o,a]=l;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Bi.has(n.tagName)?r=a:t[o]=a}}if(r){const l=t.style||(t.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return t}function Xi(e,n){const t={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const o=l.expression;o.type;const a=o.properties[0];a.type,Object.assign(t,e.evaluater.evaluateExpression(a.argument))}else Ze(e,n.position);else{const i=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,l=e.evaluater.evaluateExpression(a.expression)}else Ze(e,n.position);else l=r.value===null?!0:r.value;t[i]=l}return t}function Wn(e,n){const t=[];let r=-1;const i=e.passKeys?new Map:zi;for(;++r<n.children.length;){const l=n.children[r];let o;if(e.passKeys){const c=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(c){const s=i.get(c)||0;o=c+"-"+s,i.set(c,s+1)}}const a=ar(e,l,o);a!==void 0&&t.push(a)}return t}function Ki(e,n,t){const r=Ci(e.schema,n);if(!(t==null||typeof t=="number"&&Number.isNaN(t))){if(Array.isArray(t)&&(t=r.commaSeparated?ci(t):Ei(t)),r.property==="style"){let i=typeof t=="object"?t:Qi(e,String(t));return e.stylePropertyNameCase==="css"&&(i=Zi(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?ki[r.property]||r.property:r.attribute,t]}}function Qi(e,n){try{return Ai(n,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};const r=t,i=new ne("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=or+"#cannot-parse-style-attribute",i}}function ur(e,n,t){let r;if(!t)r={type:"Literal",value:n};else if(n.includes(".")){const i=n.split(".");let l=-1,o;for(;++l<i.length;){const a=ot(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(l&&a.type==="Literal"),optional:!1}:a}r=o}else r=ot(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(r.type==="Literal"){const i=r.value;return Un.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ze(e)}function Ze(e,n){const t=new ne("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=or+"#cannot-handle-mdx-estrees-without-createevaluater",t}function Zi(e){const n={};let t;for(t in e)Un.call(e,t)&&(n[Ji(t)]=e[t]);return n}function Ji(e){let n=e.replace(Mi,Gi);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Gi(e){return"-"+e.toLowerCase()}const gn={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"]},el={};function nl(e,n){const t=el,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return cr(e,r,i)}function cr(e,n,t){if(tl(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return gt(e.children,n,t)}return Array.isArray(e)?gt(e,n,t):""}function gt(e,n,t){const r=[];let i=-1;for(;++i<e.length;)r[i]=cr(e[i],n,t);return r.join("")}function tl(e){return!!(e&&typeof e=="object")}const yt=document.createElement("i");function Yn(e){const n="&"+e+";";yt.innerHTML=n;const t=yt.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function ye(e,n,t,r){const i=e.length;let l=0,o;if(n<0?n=-n>i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)o=Array.from(r),o.unshift(n,t),e.splice(...o);else for(t&&e.splice(n,t);l<r.length;)o=r.slice(l,l+1e4),o.unshift(n,0),e.splice(...o),l+=1e4,n+=1e4}function pe(e,n){return e.length>0?(ye(e,e.length,0,n),e):n}const xt={}.hasOwnProperty;function rl(e){const n={};let t=-1;for(;++t<e.length;)il(n,e[t]);return n}function il(e,n){let t;for(t in n){const i=(xt.call(e,t)?e[t]:void 0)||(e[t]={}),l=n[t];let o;if(l)for(o in l){xt.call(i,o)||(i[o]=[]);const a=l[o];ll(i[o],Array.isArray(a)?a:a?[a]:[])}}}function ll(e,n){let t=-1;const r=[];for(;++t<n.length;)(n[t].add==="after"?e:r).push(n[t]);ye(e,0,0,r)}function pr(e,n){const t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function Me(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ge=_e(/[A-Za-z]/),se=_e(/[\dA-Za-z]/),ol=_e(/[#-'*+\--9=?A-Z^-~]/);function jn(e){return e!==null&&(e<32||e===127)}const zn=_e(/\d/),al=_e(/[\dA-Fa-f]/),sl=_e(/[!-/:-@[-`{-~]/);function z(e){return e!==null&&e<-2}function re(e){return e!==null&&(e<0||e===32)}function W(e){return e===-2||e===-1||e===32}const ul=_e(new RegExp("\\p{P}|\\p{S}","u")),cl=_e(/\s/);function _e(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Be(e){const n=[];let t=-1,r=0,i=0;for(;++t<e.length;){const l=e.charCodeAt(t);let o="";if(l===37&&se(e.charCodeAt(t+1))&&se(e.charCodeAt(t+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const a=e.charCodeAt(t+1);l<56320&&a>56319&&a<57344?(o=String.fromCharCode(l,a),i=1):o="�"}else o=String.fromCharCode(l);o&&(n.push(e.slice(r,t),encodeURIComponent(o)),r=t+i+1,o=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function K(e,n,t,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(c){return W(c)?(e.enter(t),a(c)):n(c)}function a(c){return W(c)&&l++<i?(e.consume(c),a):(e.exit(t),n(c))}}const pl={tokenize:hl};function hl(e){const n=e.attempt(this.parser.constructs.contentInitial,r,i);let t;return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),K(e,n,"linePrefix")}function i(a){return e.enter("paragraph"),l(a)}function l(a){const c=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=c),t=c,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return z(a)?(e.consume(a),e.exit("chunkText"),l):(e.consume(a),o)}}const fl={tokenize:dl},kt={tokenize:ml};function dl(e){const n=this,t=[];let r=0,i,l,o;return a;function a(v){if(r<t.length){const R=t[r];return n.containerState=R[1],e.attempt(R[0].continuation,c,s)(v)}return s(v)}function c(v){if(r++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,i&&A();const R=n.events.length;let q=R,k;for(;q--;)if(n.events[q][0]==="exit"&&n.events[q][1].type==="chunkFlow"){k=n.events[q][1].end;break}x(r);let B=R;for(;B<n.events.length;)n.events[B][1].end={...k},B++;return ye(n.events,q+1,0,n.events.slice(R)),n.events.length=B,s(v)}return a(v)}function s(v){if(r===t.length){if(!i)return m(v);if(i.currentConstruct&&i.currentConstruct.concrete)return C(v);n.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(kt,u,p)(v)}function u(v){return i&&A(),x(r),m(v)}function p(v){return n.parser.lazy[n.now().line]=r!==t.length,o=n.now().offset,C(v)}function m(v){return n.containerState={},e.attempt(kt,h,C)(v)}function h(v){return r++,t.push([n.currentConstruct,n.containerState]),m(v)}function C(v){if(v===null){i&&A(),x(0),e.consume(v);return}return i=i||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),E(v)}function E(v){if(v===null){I(e.exit("chunkFlow"),!0),x(0),e.consume(v);return}return z(v)?(e.consume(v),I(e.exit("chunkFlow")),r=0,n.interrupt=void 0,a):(e.consume(v),E)}function I(v,R){const q=n.sliceStream(v);if(R&&q.push(null),v.previous=l,l&&(l.next=v),l=v,i.defineSkip(v.start),i.write(q),n.parser.lazy[v.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const B=n.events.length;let U=B,$,V;for(;U--;)if(n.events[U][0]==="exit"&&n.events[U][1].type==="chunkFlow"){if($){V=n.events[U][1].end;break}$=!0}for(x(r),k=B;k<n.events.length;)n.events[k][1].end={...V},k++;ye(n.events,U+1,0,n.events.slice(B)),n.events.length=k}}function x(v){let R=t.length;for(;R-- >v;){const q=t[R];n.containerState=q[1],q[0].exit.call(n,e)}t.length=v}function A(){i.write([null]),l=void 0,i=void 0,n.containerState._closeFlow=void 0}}function ml(e,n,t){return K(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bt(e){if(e===null||re(e)||cl(e))return 1;if(ul(e))return 2}function Xn(e,n,t){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(n=l(n,t),r.push(l))}return n}const Mn={name:"attention",resolveAll:gl,tokenize:yl};function gl(e,n){let t=-1,r,i,l,o,a,c,s,u;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(r=t;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&n.sliceSerialize(e[r][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[r][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const p={...e[r][1].end},m={...e[t][1].start};wt(p,-c),wt(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:m},l={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[t][1].start={...a.end},s=[],e[r][1].end.offset-e[r][1].start.offset&&(s=pe(s,[["enter",e[r][1],n],["exit",e[r][1],n]])),s=pe(s,[["enter",i,n],["enter",o,n],["exit",o,n],["enter",l,n]]),s=pe(s,Xn(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),s=pe(s,[["exit",l,n],["enter",a,n],["exit",a,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(u=2,s=pe(s,[["enter",e[t][1],n],["exit",e[t][1],n]])):u=0,ye(e,r-1,t-r+3,s),t=r+s.length-u-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function yl(e,n){const t=this.parser.constructs.attentionMarkers.null,r=this.previous,i=bt(r);let l;return o;function o(c){return l=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===l)return e.consume(c),a;const s=e.exit("attentionSequence"),u=bt(c),p=!u||u===2&&i||t.includes(c),m=!i||i===2&&u||t.includes(r);return s._open=!!(l===42?p:p&&(i||!m)),s._close=!!(l===42?m:m&&(u||!p)),n(c)}}function wt(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const xl={name:"autolink",tokenize:kl};function kl(e,n,t){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(h){return ge(h)?(e.consume(h),o):h===64?t(h):s(h)}function o(h){return h===43||h===45||h===46||se(h)?(r=1,a(h)):s(h)}function a(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||se(h))&&r++<32?(e.consume(h),a):(r=0,s(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),n):h===null||h===32||h===60||jn(h)?t(h):(e.consume(h),c)}function s(h){return h===64?(e.consume(h),u):ol(h)?(e.consume(h),s):t(h)}function u(h){return se(h)?p(h):t(h)}function p(h){return h===46?(e.consume(h),r=0,u):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),n):m(h)}function m(h){if((h===45||se(h))&&r++<63){const C=h===45?m:p;return e.consume(h),C}return t(h)}}const pn={partial:!0,tokenize:bl};function bl(e,n,t){return r;function r(l){return W(l)?K(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||z(l)?n(l):t(l)}}const hr={continuation:{tokenize:Cl},exit:Sl,name:"blockQuote",tokenize:wl};function wl(e,n,t){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return t(o)}function l(o){return W(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function Cl(e,n,t){const r=this;return i;function i(o){return W(o)?K(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(hr,n,t)(o)}}function Sl(e){e.exit("blockQuote")}const fr={name:"characterEscape",tokenize:_l};function _l(e,n,t){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return sl(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(l)}}const dr={name:"characterReference",tokenize:Il};function Il(e,n,t){const r=this;let i=0,l,o;return a;function a(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),c}function c(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),s):(e.enter("characterReferenceValue"),l=31,o=se,u(p))}function s(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=al,u):(e.enter("characterReferenceValue"),l=7,o=zn,u(p))}function u(p){if(p===59&&i){const m=e.exit("characterReferenceValue");return o===se&&!Yn(r.sliceSerialize(m))?t(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(p)&&i++<l?(e.consume(p),u):t(p)}}const Ct={partial:!0,tokenize:vl},St={concrete:!0,name:"codeFenced",tokenize:El};function El(e,n,t){const r=this,i={partial:!0,tokenize:q};let l=0,o=0,a;return c;function c(k){return s(k)}function s(k){const B=r.events[r.events.length-1];return l=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===a?(o++,e.consume(k),u):o<3?t(k):(e.exit("codeFencedFenceSequence"),W(k)?K(e,p,"whitespace")(k):p(k))}function p(k){return k===null||z(k)?(e.exit("codeFencedFence"),r.interrupt?n(k):e.check(Ct,E,R)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||z(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(k)):W(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),K(e,h,"whitespace")(k)):k===96&&k===a?t(k):(e.consume(k),m)}function h(k){return k===null||z(k)?p(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(k))}function C(k){return k===null||z(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(k)):k===96&&k===a?t(k):(e.consume(k),C)}function E(k){return e.attempt(i,R,I)(k)}function I(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),x}function x(k){return l>0&&W(k)?K(e,A,"linePrefix",l+1)(k):A(k)}function A(k){return k===null||z(k)?e.check(Ct,E,R)(k):(e.enter("codeFlowValue"),v(k))}function v(k){return k===null||z(k)?(e.exit("codeFlowValue"),A(k)):(e.consume(k),v)}function R(k){return e.exit("codeFenced"),n(k)}function q(k,B,U){let $=0;return V;function V(b){return k.enter("lineEnding"),k.consume(b),k.exit("lineEnding"),P}function P(b){return k.enter("codeFencedFence"),W(b)?K(k,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):S(b)}function S(b){return b===a?(k.enter("codeFencedFenceSequence"),j(b)):U(b)}function j(b){return b===a?($++,k.consume(b),j):$>=o?(k.exit("codeFencedFenceSequence"),W(b)?K(k,L,"whitespace")(b):L(b)):U(b)}function L(b){return b===null||z(b)?(k.exit("codeFencedFence"),B(b)):U(b)}}}function vl(e,n,t){const r=this;return i;function i(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}const yn={name:"codeIndented",tokenize:Ll},Tl={partial:!0,tokenize:Pl};function Ll(e,n,t){const r=this;return i;function i(s){return e.enter("codeIndented"),K(e,l,"linePrefix",5)(s)}function l(s){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(s):t(s)}function o(s){return s===null?c(s):z(s)?e.attempt(Tl,o,c)(s):(e.enter("codeFlowValue"),a(s))}function a(s){return s===null||z(s)?(e.exit("codeFlowValue"),o(s)):(e.consume(s),a)}function c(s){return e.exit("codeIndented"),n(s)}}function Pl(e,n,t){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?t(o):z(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):K(e,l,"linePrefix",5)(o)}function l(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):z(o)?i(o):t(o)}}const Nl={name:"codeText",previous:jl,resolve:Al,tokenize:zl};function Al(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r<n;)if(e[r][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(r=t-1,n++;++r<=n;)i===void 0?r!==n&&e[r][1].type!=="lineEnding"&&(i=r):(r===n||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),n-=r-i-2,r=i+2),i=void 0);return e}function jl(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function zl(e,n,t){let r=0,i,l;return o;function o(p){return e.enter("codeText"),e.enter("codeTextSequence"),a(p)}function a(p){return p===96?(e.consume(p),r++,a):(e.exit("codeTextSequence"),c(p))}function c(p){return p===null?t(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),c):p===96?(l=e.enter("codeTextSequence"),i=0,u(p)):z(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("codeTextData"),s(p))}function s(p){return p===null||p===32||p===96||z(p)?(e.exit("codeTextData"),c(p)):(e.consume(p),s)}function u(p){return p===96?(e.consume(p),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(p)):(l.type="codeTextData",s(p))}}class Ml{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,t){const r=t??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(n,r):n>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,t,r){const i=t||0;this.setCursor(Math.trunc(n));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ue(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),Ue(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),Ue(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const t=this.left.splice(n,Number.POSITIVE_INFINITY);Ue(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);Ue(this.left,t.reverse())}}}function Ue(e,n){let t=0;if(n.length<1e4)e.push(...n);else for(;t<n.length;)e.push(...n.slice(t,t+1e4)),t+=1e4}function mr(e){const n={};let t=-1,r,i,l,o,a,c,s;const u=new Ml(e);for(;++t<u.length;){for(;t in n;)t=n[t];if(r=u.get(t),t&&r[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,l=0,l<c.length&&c[l][1].type==="lineEndingBlank"&&(l+=2),l<c.length&&c[l][1].type==="content"))for(;++l<c.length&&c[l][1].type!=="content";)c[l][1].type==="chunkText"&&(c[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(n,Dl(u,t)),t=n[t],s=!0);else if(r[1]._container){for(l=t,i=void 0;l--;)if(o=u.get(l),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=l);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,t),a.unshift(r),u.splice(i,t-i+1,a))}}return ye(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!s}function Dl(e,n){const t=e.get(n)[1],r=e.get(n)[2];let i=n-1;const l=[];let o=t._tokenizer;o||(o=r.parser[t.contentType](t.start),t._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,c=[],s={};let u,p,m=-1,h=t,C=0,E=0;const I=[E];for(;h;){for(;e.get(++i)[1]!==h;);l.push(i),h._tokenizer||(u=r.sliceStream(h),h.next||u.push(null),p&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=h,h=h.next}for(h=t;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(E=m+1,I.push(E),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):I.pop(),m=I.length;m--;){const x=a.slice(I[m],I[m+1]),A=l.pop();c.push([A,A+x.length-1]),e.splice(A,2,x)}for(c.reverse(),m=-1;++m<c.length;)s[C+c[m][0]]=C+c[m][1],C+=c[m][1]-c[m][0]-1;return s}const Bl={resolve:Rl,tokenize:Fl},Ol={partial:!0,tokenize:$l};function Rl(e){return mr(e),e}function Fl(e,n){let t;return r;function r(a){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?l(a):z(a)?e.check(Ol,o,l)(a):(e.consume(a),i)}function l(a){return e.exit("chunkContent"),e.exit("content"),n(a)}function o(a){return e.consume(a),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,i}}function $l(e,n,t){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),K(e,l,"linePrefix")}function l(o){if(o===null||z(o))return t(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):e.interrupt(r.parser.constructs.flow,t,n)(o)}}function gr(e,n,t,r,i,l,o,a,c){const s=c||Number.POSITIVE_INFINITY;let u=0;return p;function p(x){return x===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(x),e.exit(l),m):x===null||x===32||x===41||jn(x)?t(x):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),E(x))}function m(x){return x===62?(e.enter(l),e.consume(x),e.exit(l),e.exit(i),e.exit(r),n):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===62?(e.exit("chunkString"),e.exit(a),m(x)):x===null||x===60||z(x)?t(x):(e.consume(x),x===92?C:h)}function C(x){return x===60||x===62||x===92?(e.consume(x),h):h(x)}function E(x){return!u&&(x===null||x===41||re(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),n(x)):u<s&&x===40?(e.consume(x),u++,E):x===41?(e.consume(x),u--,E):x===null||x===32||x===40||jn(x)?t(x):(e.consume(x),x===92?I:E)}function I(x){return x===40||x===41||x===92?(e.consume(x),E):E(x)}}function yr(e,n,t,r,i,l){const o=this;let a=0,c;return s;function s(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(l),u}function u(h){return a>999||h===null||h===91||h===93&&!c||h===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?t(h):h===93?(e.exit(l),e.enter(i),e.consume(h),e.exit(i),e.exit(r),n):z(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),p(h))}function p(h){return h===null||h===91||h===93||z(h)||a++>999?(e.exit("chunkString"),u(h)):(e.consume(h),c||(c=!W(h)),h===92?m:p)}function m(h){return h===91||h===92||h===93?(e.consume(h),a++,p):p(h)}}function xr(e,n,t,r,i,l){let o;return a;function a(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),o=m===40?41:m,c):t(m)}function c(m){return m===o?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),n):(e.enter(l),s(m))}function s(m){return m===o?(e.exit(l),c(o)):m===null?t(m):z(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),K(e,s,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||z(m)?(e.exit("chunkString"),s(m)):(e.consume(m),m===92?p:u)}function p(m){return m===o||m===92?(e.consume(m),u):u(m)}}function Xe(e,n){let t;return r;function r(i){return z(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):W(i)?K(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}const Hl={name:"definition",tokenize:Ul},Vl={partial:!0,tokenize:ql};function Ul(e,n,t){const r=this;let i;return l;function l(h){return e.enter("definition"),o(h)}function o(h){return yr.call(r,e,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=Me(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):t(h)}function c(h){return re(h)?Xe(e,s)(h):s(h)}function s(h){return gr(e,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return e.attempt(Vl,p,p)(h)}function p(h){return W(h)?K(e,m,"whitespace")(h):m(h)}function m(h){return h===null||z(h)?(e.exit("definition"),r.parser.defined.push(i),n(h)):t(h)}}function ql(e,n,t){return r;function r(a){return re(a)?Xe(e,i)(a):t(a)}function i(a){return xr(e,l,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function l(a){return W(a)?K(e,o,"whitespace")(a):o(a)}function o(a){return a===null||z(a)?n(a):t(a)}}const Wl={name:"hardBreakEscape",tokenize:Yl};function Yl(e,n,t){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return z(l)?(e.exit("hardBreakEscape"),n(l)):t(l)}}const Xl={name:"headingAtx",resolve:Kl,tokenize:Ql};function Kl(e,n){let t=e.length-2,r=3,i,l;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},l={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},ye(e,r,t-r+1,[["enter",i,n],["enter",l,n],["exit",l,n],["exit",i,n]])),e}function Ql(e,n,t){let r=0;return i;function i(u){return e.enter("atxHeading"),l(u)}function l(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||re(u)?(e.exit("atxHeadingSequence"),a(u)):t(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||z(u)?(e.exit("atxHeading"),n(u)):W(u)?K(e,a,"whitespace")(u):(e.enter("atxHeadingText"),s(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),a(u))}function s(u){return u===null||u===35||re(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),s)}}const Zl=["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"],_t=["pre","script","style","textarea"],Jl={concrete:!0,name:"htmlFlow",resolveTo:no,tokenize:to},Gl={partial:!0,tokenize:io},eo={partial:!0,tokenize:ro};function no(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function to(e,n,t){const r=this;let i,l,o,a,c;return s;function s(d){return u(d)}function u(d){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(d),p}function p(d){return d===33?(e.consume(d),m):d===47?(e.consume(d),l=!0,E):d===63?(e.consume(d),i=3,r.interrupt?n:f):ge(d)?(e.consume(d),o=String.fromCharCode(d),I):t(d)}function m(d){return d===45?(e.consume(d),i=2,h):d===91?(e.consume(d),i=5,a=0,C):ge(d)?(e.consume(d),i=4,r.interrupt?n:f):t(d)}function h(d){return d===45?(e.consume(d),r.interrupt?n:f):t(d)}function C(d){const he="CDATA[";return d===he.charCodeAt(a++)?(e.consume(d),a===he.length?r.interrupt?n:S:C):t(d)}function E(d){return ge(d)?(e.consume(d),o=String.fromCharCode(d),I):t(d)}function I(d){if(d===null||d===47||d===62||re(d)){const he=d===47,Ie=o.toLowerCase();return!he&&!l&&_t.includes(Ie)?(i=1,r.interrupt?n(d):S(d)):Zl.includes(o.toLowerCase())?(i=6,he?(e.consume(d),x):r.interrupt?n(d):S(d)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(d):l?A(d):v(d))}return d===45||se(d)?(e.consume(d),o+=String.fromCharCode(d),I):t(d)}function x(d){return d===62?(e.consume(d),r.interrupt?n:S):t(d)}function A(d){return W(d)?(e.consume(d),A):V(d)}function v(d){return d===47?(e.consume(d),V):d===58||d===95||ge(d)?(e.consume(d),R):W(d)?(e.consume(d),v):V(d)}function R(d){return d===45||d===46||d===58||d===95||se(d)?(e.consume(d),R):q(d)}function q(d){return d===61?(e.consume(d),k):W(d)?(e.consume(d),q):v(d)}function k(d){return d===null||d===60||d===61||d===62||d===96?t(d):d===34||d===39?(e.consume(d),c=d,B):W(d)?(e.consume(d),k):U(d)}function B(d){return d===c?(e.consume(d),c=null,$):d===null||z(d)?t(d):(e.consume(d),B)}function U(d){return d===null||d===34||d===39||d===47||d===60||d===61||d===62||d===96||re(d)?q(d):(e.consume(d),U)}function $(d){return d===47||d===62||W(d)?v(d):t(d)}function V(d){return d===62?(e.consume(d),P):t(d)}function P(d){return d===null||z(d)?S(d):W(d)?(e.consume(d),P):t(d)}function S(d){return d===45&&i===2?(e.consume(d),N):d===60&&i===1?(e.consume(d),T):d===62&&i===4?(e.consume(d),le):d===63&&i===3?(e.consume(d),f):d===93&&i===5?(e.consume(d),Q):z(d)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Gl,ue,j)(d)):d===null||z(d)?(e.exit("htmlFlowData"),j(d)):(e.consume(d),S)}function j(d){return e.check(eo,L,ue)(d)}function L(d){return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),b}function b(d){return d===null||z(d)?j(d):(e.enter("htmlFlowData"),S(d))}function N(d){return d===45?(e.consume(d),f):S(d)}function T(d){return d===47?(e.consume(d),o="",O):S(d)}function O(d){if(d===62){const he=o.toLowerCase();return _t.includes(he)?(e.consume(d),le):S(d)}return ge(d)&&o.length<8?(e.consume(d),o+=String.fromCharCode(d),O):S(d)}function Q(d){return d===93?(e.consume(d),f):S(d)}function f(d){return d===62?(e.consume(d),le):d===45&&i===2?(e.consume(d),f):S(d)}function le(d){return d===null||z(d)?(e.exit("htmlFlowData"),ue(d)):(e.consume(d),le)}function ue(d){return e.exit("htmlFlow"),n(d)}}function ro(e,n,t){const r=this;return i;function i(o){return z(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):t(o)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}function io(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(pn,n,t)}}const lo={name:"htmlText",tokenize:oo};function oo(e,n,t){const r=this;let i,l,o;return a;function a(f){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(f),c}function c(f){return f===33?(e.consume(f),s):f===47?(e.consume(f),q):f===63?(e.consume(f),v):ge(f)?(e.consume(f),U):t(f)}function s(f){return f===45?(e.consume(f),u):f===91?(e.consume(f),l=0,C):ge(f)?(e.consume(f),A):t(f)}function u(f){return f===45?(e.consume(f),h):t(f)}function p(f){return f===null?t(f):f===45?(e.consume(f),m):z(f)?(o=p,T(f)):(e.consume(f),p)}function m(f){return f===45?(e.consume(f),h):p(f)}function h(f){return f===62?N(f):f===45?m(f):p(f)}function C(f){const le="CDATA[";return f===le.charCodeAt(l++)?(e.consume(f),l===le.length?E:C):t(f)}function E(f){return f===null?t(f):f===93?(e.consume(f),I):z(f)?(o=E,T(f)):(e.consume(f),E)}function I(f){return f===93?(e.consume(f),x):E(f)}function x(f){return f===62?N(f):f===93?(e.consume(f),x):E(f)}function A(f){return f===null||f===62?N(f):z(f)?(o=A,T(f)):(e.consume(f),A)}function v(f){return f===null?t(f):f===63?(e.consume(f),R):z(f)?(o=v,T(f)):(e.consume(f),v)}function R(f){return f===62?N(f):v(f)}function q(f){return ge(f)?(e.consume(f),k):t(f)}function k(f){return f===45||se(f)?(e.consume(f),k):B(f)}function B(f){return z(f)?(o=B,T(f)):W(f)?(e.consume(f),B):N(f)}function U(f){return f===45||se(f)?(e.consume(f),U):f===47||f===62||re(f)?$(f):t(f)}function $(f){return f===47?(e.consume(f),N):f===58||f===95||ge(f)?(e.consume(f),V):z(f)?(o=$,T(f)):W(f)?(e.consume(f),$):N(f)}function V(f){return f===45||f===46||f===58||f===95||se(f)?(e.consume(f),V):P(f)}function P(f){return f===61?(e.consume(f),S):z(f)?(o=P,T(f)):W(f)?(e.consume(f),P):$(f)}function S(f){return f===null||f===60||f===61||f===62||f===96?t(f):f===34||f===39?(e.consume(f),i=f,j):z(f)?(o=S,T(f)):W(f)?(e.consume(f),S):(e.consume(f),L)}function j(f){return f===i?(e.consume(f),i=void 0,b):f===null?t(f):z(f)?(o=j,T(f)):(e.consume(f),j)}function L(f){return f===null||f===34||f===39||f===60||f===61||f===96?t(f):f===47||f===62||re(f)?$(f):(e.consume(f),L)}function b(f){return f===47||f===62||re(f)?$(f):t(f)}function N(f){return f===62?(e.consume(f),e.exit("htmlTextData"),e.exit("htmlText"),n):t(f)}function T(f){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),O}function O(f){return W(f)?K(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):Q(f)}function Q(f){return e.enter("htmlTextData"),o(f)}}const Kn={name:"labelEnd",resolveAll:co,resolveTo:po,tokenize:ho},ao={tokenize:fo},so={tokenize:mo},uo={tokenize:go};function co(e){let n=-1;const t=[];for(;++n<e.length;){const r=e[n][1];if(t.push(e[n]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",n+=i}}return e.length!==t.length&&ye(e,0,e.length,t),e}function po(e,n){let t=e.length,r=0,i,l,o,a;for(;t--;)if(i=e[t][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[t][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[t][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=t,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=t);const c={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},s={type:"label",start:{...e[l][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",c,n],["enter",s,n]],a=pe(a,e.slice(l+1,l+r+3)),a=pe(a,[["enter",u,n]]),a=pe(a,Xn(n.parser.constructs.insideSpan.null,e.slice(l+r+4,o-3),n)),a=pe(a,[["exit",u,n],e[o-2],e[o-1],["exit",s,n]]),a=pe(a,e.slice(o+1)),a=pe(a,[["exit",c,n]]),ye(e,l,e.length,a),e}function ho(e,n,t){const r=this;let i=r.events.length,l,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){l=r.events[i][1];break}return a;function a(m){return l?l._inactive?p(m):(o=r.parser.defined.includes(Me(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),c):t(m)}function c(m){return m===40?e.attempt(ao,u,o?u:p)(m):m===91?e.attempt(so,u,o?s:p)(m):o?u(m):p(m)}function s(m){return e.attempt(uo,u,p)(m)}function u(m){return n(m)}function p(m){return l._balanced=!0,t(m)}}function fo(e,n,t){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return re(p)?Xe(e,l)(p):l(p)}function l(p){return p===41?u(p):gr(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return re(p)?Xe(e,c)(p):u(p)}function a(p){return t(p)}function c(p){return p===34||p===39||p===40?xr(e,s,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function s(p){return re(p)?Xe(e,u)(p):u(p)}function u(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),n):t(p)}}function mo(e,n,t){const r=this;return i;function i(a){return yr.call(r,e,l,o,"reference","referenceMarker","referenceString")(a)}function l(a){return r.parser.defined.includes(Me(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?n(a):t(a)}function o(a){return t(a)}}function go(e,n,t){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),n):t(l)}}const yo={name:"labelStartImage",resolveAll:Kn.resolveAll,tokenize:xo};function xo(e,n,t){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),l}function l(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):t(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(a):n(a)}}const ko={name:"labelStartLink",resolveAll:Kn.resolveAll,tokenize:bo};function bo(e,n,t){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(o):n(o)}}const xn={name:"lineEnding",tokenize:wo};function wo(e,n){return t;function t(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),K(e,n,"linePrefix")}}const sn={name:"thematicBreak",tokenize:Co};function Co(e,n,t){let r=0,i;return l;function l(s){return e.enter("thematicBreak"),o(s)}function o(s){return i=s,a(s)}function a(s){return s===i?(e.enter("thematicBreakSequence"),c(s)):r>=3&&(s===null||z(s))?(e.exit("thematicBreak"),n(s)):t(s)}function c(s){return s===i?(e.consume(s),r++,c):(e.exit("thematicBreakSequence"),W(s)?K(e,a,"whitespace")(s):a(s))}}const te={continuation:{tokenize:Eo},exit:To,name:"list",tokenize:Io},So={partial:!0,tokenize:Lo},_o={partial:!0,tokenize:vo};function Io(e,n,t){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(h){const C=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:zn(h)){if(r.containerState.type||(r.containerState.type=C,e.enter(C,{_container:!0})),C==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(sn,t,s)(h):s(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return t(h)}function c(h){return zn(h)&&++o<10?(e.consume(h),c):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),s(h)):t(h)}function s(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(pn,r.interrupt?t:u,e.attempt(So,m,p))}function u(h){return r.containerState.initialBlankLine=!0,l++,m(h)}function p(h){return W(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),m):t(h)}function m(h){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(h)}}function Eo(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(pn,i,l);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,K(e,n,"listItemIndent",r.containerState.size+1)(a)}function l(a){return r.containerState.furtherBlankLines||!W(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(_o,n,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,K(e,e.attempt(te,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function vo(e,n,t){const r=this;return K(e,i,"listItemIndent",r.containerState.size+1);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?n(l):t(l)}}function To(e){e.exit(this.containerState.type)}function Lo(e,n,t){const r=this;return K(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const o=r.events[r.events.length-1];return!W(l)&&o&&o[1].type==="listItemPrefixWhitespace"?n(l):t(l)}}const It={name:"setextUnderline",resolveTo:Po,tokenize:No};function Po(e,n){let t=e.length,r,i,l;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!l&&e[t][1].type==="definition"&&(l=t);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",o,n]),e.splice(l+1,0,["exit",e[r][1],n]),e[r][1].end={...e[l][1].end}):e[r][1]=o,e.push(["exit",o,n]),e}function No(e,n,t){const r=this;let i;return l;function l(s){let u=r.events.length,p;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){p=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),i=s,o(s)):t(s)}function o(s){return e.enter("setextHeadingLineSequence"),a(s)}function a(s){return s===i?(e.consume(s),a):(e.exit("setextHeadingLineSequence"),W(s)?K(e,c,"lineSuffix")(s):c(s))}function c(s){return s===null||z(s)?(e.exit("setextHeadingLine"),n(s)):t(s)}}const Ao={tokenize:jo};function jo(e){const n=this,t=e.attempt(pn,r,e.attempt(this.parser.constructs.flowInitial,i,K(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Bl,i)),"linePrefix")));return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n.currentConstruct=void 0,t}}const zo={resolveAll:br()},Mo=kr("string"),Do=kr("text");function kr(e){return{resolveAll:br(e==="text"?Bo:void 0),tokenize:n};function n(t){const r=this,i=this.parser.constructs[e],l=t.attempt(i,o,a);return o;function o(u){return s(u)?l(u):a(u)}function a(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),c}function c(u){return s(u)?(t.exit("data"),l(u)):(t.consume(u),c)}function s(u){if(u===null)return!0;const p=i[u];let m=-1;if(p)for(;++m<p.length;){const h=p[m];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function br(e){return n;function n(t,r){let i=-1,l;for(;++i<=t.length;)l===void 0?t[i]&&t[i][1].type==="data"&&(l=i,i++):(!t[i]||t[i][1].type!=="data")&&(i!==l+2&&(t[l][1].end=t[i-1][1].end,t.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(t,r):t}}function Bo(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){const r=e[t-1][1],i=n.sliceStream(r);let l=i.length,o=-1,a=0,c;for(;l--;){const s=i[l];if(typeof s=="string"){for(o=s.length;s.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(s===-2)c=!0,a++;else if(s!==-1){l++;break}}if(n._contentTypeTextTrailing&&t===e.length&&(a=0),a){const s={type:t===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?o:r.start._bufferIndex+o,_index:r.start._index+l,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...s.start},r.start.offset===r.end.offset?Object.assign(r,s):(e.splice(t,0,["enter",s,n],["exit",s,n]),t+=2)}t++}return e}const Oo={42:te,43:te,45:te,48:te,49:te,50:te,51:te,52:te,53:te,54:te,55:te,56:te,57:te,62:hr},Ro={91:Hl},Fo={[-2]:yn,[-1]:yn,32:yn},$o={35:Xl,42:sn,45:[It,sn],60:Jl,61:It,95:sn,96:St,126:St},Ho={38:dr,92:fr},Vo={[-5]:xn,[-4]:xn,[-3]:xn,33:yo,38:dr,42:Mn,60:[xl,lo],91:ko,92:[Wl,fr],93:Kn,95:Mn,96:Nl},Uo={null:[Mn,zo]},qo={null:[42,95]},Wo={null:[]},Yo=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qo,contentInitial:Ro,disable:Wo,document:Oo,flow:$o,flowInitial:Fo,insideSpan:Uo,string:Ho,text:Vo},Symbol.toStringTag,{value:"Module"}));function Xo(e,n,t){let r={_bufferIndex:-1,_index:0,line:t&&t.line||1,column:t&&t.column||1,offset:t&&t.offset||0};const i={},l=[];let o=[],a=[];const c={attempt:B(q),check:B(k),consume:A,enter:v,exit:R,interrupt:B(k,{interrupt:!0})},s={code:null,containerState:{},defineSkip:E,events:[],now:C,parser:e,previous:null,sliceSerialize:m,sliceStream:h,write:p};let u=n.tokenize.call(s,c);return n.resolveAll&&l.push(n),s;function p(P){return o=pe(o,P),I(),o[o.length-1]!==null?[]:(U(n,0),s.events=Xn(l,s.events,s),s.events)}function m(P,S){return Qo(h(P),S)}function h(P){return Ko(o,P)}function C(){const{_bufferIndex:P,_index:S,line:j,column:L,offset:b}=r;return{_bufferIndex:P,_index:S,line:j,column:L,offset:b}}function E(P){i[P.line]=P.column,V()}function I(){let P;for(;r._index<o.length;){const S=o[r._index];if(typeof S=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<S.length;)x(S.charCodeAt(r._bufferIndex));else x(S)}}function x(P){u=u(P)}function A(P){z(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,V()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),s.previous=P}function v(P,S){const j=S||{};return j.type=P,j.start=C(),s.events.push(["enter",j,s]),a.push(j),j}function R(P){const S=a.pop();return S.end=C(),s.events.push(["exit",S,s]),S}function q(P,S){U(P,S.from)}function k(P,S){S.restore()}function B(P,S){return j;function j(L,b,N){let T,O,Q,f;return Array.isArray(L)?ue(L):"tokenize"in L?ue([L]):le(L);function le(J){return Oe;function Oe(be){const Te=be!==null&&J[be],Le=be!==null&&J.null,en=[...Array.isArray(Te)?Te:Te?[Te]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return ue(en)(be)}}function ue(J){return T=J,O=0,J.length===0?N:d(J[O])}function d(J){return Oe;function Oe(be){return f=$(),Q=J,J.partial||(s.currentConstruct=J),J.name&&s.parser.constructs.disable.null.includes(J.name)?Ie():J.tokenize.call(S?Object.assign(Object.create(s),S):s,c,he,Ie)(be)}}function he(J){return P(Q,f),b}function Ie(J){return f.restore(),++O<T.length?d(T[O]):N}}}function U(P,S){P.resolveAll&&!l.includes(P)&&l.push(P),P.resolve&&ye(s.events,S,s.events.length-S,P.resolve(s.events.slice(S),s)),P.resolveTo&&(s.events=P.resolveTo(s.events,s))}function $(){const P=C(),S=s.previous,j=s.currentConstruct,L=s.events.length,b=Array.from(a);return{from:L,restore:N};function N(){r=P,s.previous=S,s.currentConstruct=j,s.events.length=L,a=b,V()}}function V(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ko(e,n){const t=n.start._index,r=n.start._bufferIndex,i=n.end._index,l=n.end._bufferIndex;let o;if(t===i)o=[e[t].slice(r,l)];else{if(o=e.slice(t,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}l>0&&o.push(e[i].slice(0,l))}return o}function Qo(e,n){let t=-1;const r=[];let i;for(;++t<e.length;){const l=e[t];let o;if(typeof l=="string")o=l;else switch(l){case-5:{o="\r";break}case-4:{o=`
3
+ `))!==-1;){const J=L.slice(0,f);L=L.slice(f+2);for(const ue of J.split(`
4
+ `))if(ue.startsWith("data: "))try{const d=JSON.parse(ue.slice(6));D(d,j,T)}catch{}}}}finally{x.releaseLock()}},[D]),F=O.useCallback(async C=>{if(!C.trim())return;const j={id:`user-${Date.now()}`,role:"user",content:C,timestamp:Date.now(),status:"sent"};s(L=>[...L,j]),o==null||o(j);const T=`assistant-${Date.now()}`,x={id:T,role:"assistant",content:"",timestamp:Date.now(),status:"streaming"};s(L=>[...L,x]),h(!0),I(null);const A=L=>{b(L)};try{if(r){const L=t.sendMessage(C);for await(const q of L)D(q,T,A)}else{const L=await t.sendMessage({embedId:n.embedId,message:C,sessionId:E??void 0});await U(L,T,A)}s(L=>L.map(q=>q.id===T&&q.status==="streaming"?{...q,status:"sent"}:q))}catch(L){const q=L instanceof Error?L:new Error("Failed to send message");I(q),a==null||a(q),s(Q=>Q.map(f=>f.id===T?{...f,status:"error",content:"Failed to get response"}:f))}finally{h(!1)}},[E,t,r,n.embedId,D,U,o,a]),$=O.useCallback(async()=>{if(!E)return;const C={sessionId:E,deploymentId:n.deploymentId,workerId:n.workerId,flowId:n.flowId,startTime:P.current,messages:c,toolCalls:u,status:"completed"};l==null||l(C),Tn(n.embedId),b(null),s([]),p([])},[E,n,c,u,l]),N=O.useCallback(()=>{s([]),p([])},[]);return{messages:c,toolCalls:u,isLoading:m,error:S,sessionId:E,sendMessage:F,endSession:$,clearMessages:N,startNewSession:V}}const Wt="https://chat-embed-deployment.onrender.com";function Yt(e=Wt){return{async getDeploymentConfig(n){const t=await fetch(`${e}/chat/config/${n}`);if(!t.ok)throw new Error(`Failed to fetch deployment config: ${t.status}`);const r=await t.json();return{embedId:r.embedId,deploymentId:"",workerId:"",flowId:"",welcomeMessage:r.welcomeMessage,agentName:r.agentName,agentLogoUrl:r.agentLogoUrl,primaryColor:r.primaryColor,styling:r.styling}},async sendMessage(n){const t=await fetch(`${e}/chat/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embed_id:n.embedId,message:n.message,session_id:n.sessionId||void 0,metadata:n.metadata})});if(!t.ok){const r=await t.text();throw new Error(`Failed to send message: ${t.status} - ${r}`)}if(!t.body)throw new Error("No response stream available");return t.body}}}const Yr={embedId:"mock-embed-id",deploymentId:"mock-deployment-id",workerId:"mock-worker-id",flowId:"mock-flow-id",agentName:"AI Assistant",agentLogoUrl:void 0,primaryColor:"#1a1a2e",styling:{}},Xr=[{trigger:/hello|hi|hey/i,response:"Hello! I'm a demo AI assistant. How can I help you today?",delay:500},{trigger:/weather/i,response:"I'd check the weather for you, but I'm in mock mode! In production, I could use a weather API.",delay:800,toolCalls:[{name:"get_weather",arguments:{location:"San Francisco"},result:{temperature:72,condition:"sunny"}}]},{trigger:/help|support/i,response:"I'm here to help! You can ask me questions, and I'll do my best to assist you. In production, I'd be connected to your agent with full capabilities.",delay:600},{trigger:/pricing|cost|price/i,response:"For pricing information, I'd typically check our database or connect you with the sales team. This is a mock response demonstrating how I'd handle pricing questions.",delay:700,toolCalls:[{name:"lookup_pricing",arguments:{plan:"all"},result:{plans:[{name:"Starter",price:"$29/mo"},{name:"Pro",price:"$99/mo"}]}}]},{trigger:/.*/,response:"I'm running in mock mode. This is a simulated response to demonstrate the chat UI. In production, I'd be connected to your agent!",delay:1e3}];function $e(e){return new Promise(n=>setTimeout(n,e))}function Xt(e,n){const t={...Yr,...e},r=n??Xr,i=`mock-session-${Date.now()}`;return{async getDeploymentConfig(l){return await $e(300),t},async*sendMessage(l){yield{type:"session",data:{session_id:i,is_new:!0},timestamp:Date.now()};const o=r.find(s=>typeof s.trigger=="string"?l.toLowerCase().includes(s.trigger.toLowerCase()):s.trigger.test(l))??r[r.length-1];if(await $e(o.delay??500),o.toolCalls)for(const s of o.toolCalls)yield{type:"tool_call",data:{function:s.name,args:s.arguments},timestamp:Date.now()},await $e(300),yield{type:"tool_call",data:{function:s.name,result:s.result},timestamp:Date.now()},await $e(200);const a=o.response.split(" ");let c="";for(const s of a)c+=(c?" ":"")+s,yield{type:"message",data:{content:c,role:"assistant"},timestamp:Date.now()},await $e(30+Math.random()*40);yield{type:"done",data:{session_id:i},timestamp:Date.now()}}}}const Qe=({className:e,color:n="currentColor",cutoutColor:t="var(--bb-primary-color)"})=>g.jsxs("svg",{className:e,viewBox:"0 0 800 800",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H788C794.627 400 800 405.373 800 412V740C800 773.137 773.137 800 740 800H412C405.373 800 400 794.627 400 788V412Z",fill:n}),g.jsx("circle",{cx:"400",cy:"400",r:"400",fill:n}),g.jsx("path",{d:"M0 60C0 26.8629 26.8629 0 60 0H397.614C398.932 0 400 1.06811 400 2.38569V2.38569C400 221.982 221.982 400 2.38569 400V400C1.06811 400 0 398.932 0 397.614V60Z",fill:n}),g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H738C744.627 400 750 405.373 750 412V725C750 738.807 738.807 750 725 750H412C405.373 750 400 744.627 400 738V412Z",fill:n}),g.jsx("circle",{cx:"400",cy:"400",r:"350",fill:n}),g.jsx("path",{d:"M50 75C50 61.1929 61.1929 50 75 50H388C394.627 50 400 55.3726 400 62V388C400 394.627 394.627 400 388 400H62C55.3726 400 50 394.627 50 388V75Z",fill:n}),g.jsx("rect",{x:"399.919",y:"209",width:"270",height:"270",rx:"12",transform:"rotate(45 399.919 209)",fill:t})]}),Kr="_header_1p6z5_1",Qr="_compact_1p6z5_9",Zr="_headerBackground_1p6z5_20",Jr="_headerContent_1p6z5_59",Gr="_topRow_1p6z5_64",ei="_agentInfo_1p6z5_79",ni="_agentLogo_1p6z5_85",ti="_agentLogoPlaceholder_1p6z5_102",ri="_brainbaseLogo_1p6z5_123",ii="_agentName_1p6z5_137",li="_actions_1p6z5_144",oi="_actionButton_1p6z5_149",ai="_welcomeText_1p6z5_183",si="_title_1p6z5_202",ui="_subtitle_1p6z5_210",ee={header:Kr,compact:Qr,headerBackground:Zr,headerContent:Jr,topRow:Gr,agentInfo:ei,agentLogo:ni,agentLogoPlaceholder:ti,brainbaseLogo:ri,agentName:ii,actions:li,actionButton:oi,welcomeText:ai,title:si,subtitle:ui},Kt=({agentName:e="AI Assistant",agentLogoUrl:n,welcomeTitle:t,welcomeSubtitle:r,onClose:i,onNewChatRequest:l,showNewChatButton:o=!1,compact:a=!1})=>{const c=t||"Hello there.",s=r!==void 0?r:t?void 0:"How can we help?";return g.jsxs("div",{className:`${ee.header} ${a?ee.compact:""}`,children:[g.jsx("div",{className:ee.headerBackground}),g.jsxs("div",{className:ee.headerContent,children:[g.jsxs("div",{className:ee.topRow,children:[g.jsxs("div",{className:ee.agentInfo,children:[n?g.jsx("img",{src:n,alt:e,className:ee.agentLogo}):g.jsx("div",{className:ee.agentLogoPlaceholder,children:g.jsx(Qe,{className:ee.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})}),g.jsx("span",{className:ee.agentName,children:e})]}),g.jsxs("div",{className:ee.actions,children:[o&&l&&g.jsx("button",{className:ee.actionButton,onClick:l,"aria-label":"Start new chat",type:"button",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M12 5V19M5 12H19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),i&&g.jsx("button",{className:ee.actionButton,onClick:i,"aria-label":"Close chat",type:"button",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),!a&&g.jsxs("div",{className:ee.welcomeText,children:[g.jsx("h1",{className:ee.title,children:c}),s&&g.jsx("p",{className:ee.subtitle,children:s})]})]})]})};function ci(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const pi=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hi=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fi={};function ot(e,n){return(fi.jsx?hi:pi).test(e)}const di=/[ \t\n\f\r]/g;function mi(e){return typeof e=="object"?e.type==="text"?at(e.value):!1:at(e)}function at(e){return e.replace(di,"")===""}class Je{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}Je.prototype.normal={};Je.prototype.property={};Je.prototype.space=void 0;function Qt(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Je(t,r,n)}function Ln(e){return e.toLowerCase()}class le{constructor(n,t){this.attribute=t,this.property=n}}le.prototype.attribute="";le.prototype.booleanish=!1;le.prototype.boolean=!1;le.prototype.commaOrSpaceSeparated=!1;le.prototype.commaSeparated=!1;le.prototype.defined=!1;le.prototype.mustUseProperty=!1;le.prototype.number=!1;le.prototype.overloadedBoolean=!1;le.prototype.property="";le.prototype.spaceSeparated=!1;le.prototype.space=void 0;let gi=0;const B=ve(),Z=ve(),Nn=ve(),w=ve(),X=ve(),ze=ve(),ae=ve();function ve(){return 2**++gi}const Pn=Object.freeze(Object.defineProperty({__proto__:null,boolean:B,booleanish:Z,commaOrSpaceSeparated:ae,commaSeparated:ze,number:w,overloadedBoolean:Nn,spaceSeparated:X},Symbol.toStringTag,{value:"Module"})),dn=Object.keys(Pn);class $n extends le{constructor(n,t,r,i){let l=-1;if(super(n,t),st(this,"space",i),typeof r=="number")for(;++l<dn.length;){const o=dn[l];st(this,dn[l],(r&Pn[o])===Pn[o])}}}$n.prototype.defined=!0;function st(e,n,t){t&&(e[n]=t)}function De(e){const n={},t={};for(const[r,i]of Object.entries(e.properties)){const l=new $n(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),n[r]=l,t[Ln(r)]=r,t[Ln(l.attribute)]=r}return new Je(n,t,e.space)}const Zt=De({properties:{ariaActiveDescendant:null,ariaAtomic:Z,ariaAutoComplete:null,ariaBusy:Z,ariaChecked:Z,ariaColCount:w,ariaColIndex:w,ariaColSpan:w,ariaControls:X,ariaCurrent:null,ariaDescribedBy:X,ariaDetails:null,ariaDisabled:Z,ariaDropEffect:X,ariaErrorMessage:null,ariaExpanded:Z,ariaFlowTo:X,ariaGrabbed:Z,ariaHasPopup:null,ariaHidden:Z,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:X,ariaLevel:w,ariaLive:null,ariaModal:Z,ariaMultiLine:Z,ariaMultiSelectable:Z,ariaOrientation:null,ariaOwns:X,ariaPlaceholder:null,ariaPosInSet:w,ariaPressed:Z,ariaReadOnly:Z,ariaRelevant:null,ariaRequired:Z,ariaRoleDescription:X,ariaRowCount:w,ariaRowIndex:w,ariaRowSpan:w,ariaSelected:Z,ariaSetSize:w,ariaSort:null,ariaValueMax:w,ariaValueMin:w,ariaValueNow:w,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Jt(e,n){return n in e?e[n]:n}function Gt(e,n){return Jt(e,n.toLowerCase())}const yi=De({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ze,acceptCharset:X,accessKey:X,action:null,allow:null,allowFullScreen:B,allowPaymentRequest:B,allowUserMedia:B,alt:null,as:null,async:B,autoCapitalize:null,autoComplete:X,autoFocus:B,autoPlay:B,blocking:X,capture:null,charSet:null,checked:B,cite:null,className:X,cols:w,colSpan:null,content:null,contentEditable:Z,controls:B,controlsList:X,coords:w|ze,crossOrigin:null,data:null,dateTime:null,decoding:null,default:B,defer:B,dir:null,dirName:null,disabled:B,download:Nn,draggable:Z,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:B,formTarget:null,headers:X,height:w,hidden:Nn,high:w,href:null,hrefLang:null,htmlFor:X,httpEquiv:X,id:null,imageSizes:null,imageSrcSet:null,inert:B,inputMode:null,integrity:null,is:null,isMap:B,itemId:null,itemProp:X,itemRef:X,itemScope:B,itemType:X,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:B,low:w,manifest:null,max:null,maxLength:w,media:null,method:null,min:null,minLength:w,multiple:B,muted:B,name:null,nonce:null,noModule:B,noValidate:B,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:B,optimum:w,pattern:null,ping:X,placeholder:null,playsInline:B,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:B,referrerPolicy:null,rel:X,required:B,reversed:B,rows:w,rowSpan:w,sandbox:X,scope:null,scoped:B,seamless:B,selected:B,shadowRootClonable:B,shadowRootDelegatesFocus:B,shadowRootMode:null,shape:null,size:w,sizes:null,slot:null,span:w,spellCheck:Z,src:null,srcDoc:null,srcLang:null,srcSet:null,start:w,step:null,style:null,tabIndex:w,target:null,title:null,translate:null,type:null,typeMustMatch:B,useMap:null,value:Z,width:w,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:X,axis:null,background:null,bgColor:null,border:w,borderColor:null,bottomMargin:w,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:B,declare:B,event:null,face:null,frame:null,frameBorder:null,hSpace:w,leftMargin:w,link:null,longDesc:null,lowSrc:null,marginHeight:w,marginWidth:w,noResize:B,noHref:B,noShade:B,noWrap:B,object:null,profile:null,prompt:null,rev:null,rightMargin:w,rules:null,scheme:null,scrolling:Z,standby:null,summary:null,text:null,topMargin:w,valueType:null,version:null,vAlign:null,vLink:null,vSpace:w,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:B,disableRemotePlayback:B,prefix:null,property:null,results:w,security:null,unselectable:null},space:"html",transform:Gt}),xi=De({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ae,accentHeight:w,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:w,amplitude:w,arabicForm:null,ascent:w,attributeName:null,attributeType:null,azimuth:w,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:w,by:null,calcMode:null,capHeight:w,className:X,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:w,diffuseConstant:w,direction:null,display:null,dur:null,divisor:w,dominantBaseline:null,download:B,dx:null,dy:null,edgeMode:null,editable:null,elevation:w,enableBackground:null,end:null,event:null,exponent:w,externalResourcesRequired:null,fill:null,fillOpacity:w,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:ze,g2:ze,glyphName:ze,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:w,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:w,horizOriginX:w,horizOriginY:w,id:null,ideographic:w,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:w,k:w,k1:w,k2:w,k3:w,k4:w,kernelMatrix:ae,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:w,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:w,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:w,overlineThickness:w,paintOrder:null,panose1:null,path:null,pathLength:w,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:X,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:w,pointsAtY:w,pointsAtZ:w,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ae,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ae,rev:ae,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ae,requiredFeatures:ae,requiredFonts:ae,requiredFormats:ae,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:w,specularExponent:w,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:w,strikethroughThickness:w,string:null,stroke:null,strokeDashArray:ae,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:w,strokeOpacity:w,strokeWidth:null,style:null,surfaceScale:w,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ae,tabIndex:w,tableValues:null,target:null,targetX:w,targetY:w,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ae,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:w,underlineThickness:w,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:w,values:null,vAlphabetic:w,vMathematical:w,vectorEffect:null,vHanging:w,vIdeographic:w,version:null,vertAdvY:w,vertOriginX:w,vertOriginY:w,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:w,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Jt}),er=De({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),nr=De({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Gt}),tr=De({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),ki={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"},bi=/[A-Z]/g,ut=/-[a-z]/g,wi=/^data[-\w.:]+$/i;function Ci(e,n){const t=Ln(n);let r=n,i=le;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&wi.test(n)){if(n.charAt(4)==="-"){const l=n.slice(5).replace(ut,_i);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=n.slice(4);if(!ut.test(l)){let o=l.replace(bi,Si);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}i=$n}return new i(r,n)}function Si(e){return"-"+e.toLowerCase()}function _i(e){return e.charAt(1).toUpperCase()}const Ii=Qt([Zt,yi,er,nr,tr],"html"),Hn=Qt([Zt,xi,er,nr,tr],"svg");function Ei(e){return e.join(" ").trim()}function rr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pe={},mn,ct;function vi(){if(ct)return mn;ct=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,c=`
5
+ `,s="/",u="*",p="",m="comment",h="declaration";function S(E,b){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];b=b||{};var P=1,v=1;function R(T){var x=T.match(n);x&&(P+=x.length);var A=T.lastIndexOf(c);v=~A?T.length-A:v+T.length}function V(){var T={line:P,column:v};return function(x){return x.position=new k(T),F(),x}}function k(T){this.start=T,this.end={line:P,column:v},this.source=b.source}k.prototype.content=E;function D(T){var x=new Error(b.source+":"+P+":"+v+": "+T);if(x.reason=T,x.filename=b.source,x.line=P,x.column=v,x.source=E,!b.silent)throw x}function U(T){var x=T.exec(E);if(x){var A=x[0];return R(A),E=E.slice(A.length),x}}function F(){U(t)}function $(T){var x;for(T=T||[];x=N();)x!==!1&&T.push(x);return T}function N(){var T=V();if(!(s!=E.charAt(0)||u!=E.charAt(1))){for(var x=2;p!=E.charAt(x)&&(u!=E.charAt(x)||s!=E.charAt(x+1));)++x;if(x+=2,p===E.charAt(x-1))return D("End of comment missing");var A=E.slice(2,x-2);return v+=2,R(A),E=E.slice(x),v+=2,T({type:m,comment:A})}}function C(){var T=V(),x=U(r);if(x){if(N(),!U(i))return D("property missing ':'");var A=U(l),L=T({type:h,property:I(x[0].replace(e,p)),value:A?I(A[0].replace(e,p)):p});return U(o),L}}function j(){var T=[];$(T);for(var x;x=C();)x!==!1&&(T.push(x),$(T));return T}return F(),j()}function I(E){return E?E.replace(a,p):p}return mn=S,mn}var pt;function Ti(){if(pt)return Pe;pt=1;var e=Pe&&Pe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.default=t;const n=e(vi());function t(r,i){let l=null;if(!r||typeof r!="string")return l;const o=(0,n.default)(r),a=typeof i=="function";return o.forEach(c=>{if(c.type!=="declaration")return;const{property:s,value:u}=c;a?i(s,u,c):u&&(l=l||{},l[s]=u)}),l}return Pe}var He={},ht;function Li(){if(ht)return He;ht=1,Object.defineProperty(He,"__esModule",{value:!0}),He.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,t=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,l=function(s){return!s||t.test(s)||e.test(s)},o=function(s,u){return u.toUpperCase()},a=function(s,u){return"".concat(u,"-")},c=function(s,u){return u===void 0&&(u={}),l(s)?s:(s=s.toLowerCase(),u.reactCompat?s=s.replace(i,a):s=s.replace(r,a),s.replace(n,o))};return He.camelCase=c,He}var Ve,ft;function Ni(){if(ft)return Ve;ft=1;var e=Ve&&Ve.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},n=e(Ti()),t=Li();function r(i,l){var o={};return!i||typeof i!="string"||(0,n.default)(i,function(a,c){a&&c&&(o[(0,t.camelCase)(a,l)]=c)}),o}return r.default=r,Ve=r,Ve}var Pi=Ni();const Ai=rr(Pi),ir=lr("end"),Vn=lr("start");function lr(e){return n;function n(t){const r=t&&t.position&&t.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ji(e){const n=Vn(e),t=ir(e);if(n&&t)return{start:n,end:t}}function Ye(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?dt(e.position):"start"in e||"end"in e?dt(e):"line"in e||"column"in e?An(e):""}function An(e){return mt(e&&e.line)+":"+mt(e&&e.column)}function dt(e){return An(e&&e.start)+"-"+An(e&&e.end)}function mt(e){return e&&typeof e=="number"?e:1}class te extends Error{constructor(n,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let i="",l={},o=!1;if(t&&("line"in t&&"column"in t?l={place:t}:"start"in t&&"end"in t?l={place:t}:"type"in t?l={ancestors:[t],place:t.position}:l={...t}),typeof n=="string"?i=n:!l.cause&&n&&(o=!0,i=n.message,l.cause=n),!l.ruleId&&!l.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?l.ruleId=r:(l.source=r.slice(0,c),l.ruleId=r.slice(c+1))}if(!l.place&&l.ancestors&&l.ancestors){const c=l.ancestors[l.ancestors.length-1];c&&(l.place=c.position)}const a=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Ye(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}te.prototype.file="";te.prototype.name="";te.prototype.reason="";te.prototype.message="";te.prototype.stack="";te.prototype.column=void 0;te.prototype.line=void 0;te.prototype.ancestors=void 0;te.prototype.cause=void 0;te.prototype.fatal=void 0;te.prototype.place=void 0;te.prototype.ruleId=void 0;te.prototype.source=void 0;const Un={}.hasOwnProperty,zi=new Map,Mi=/[A-Z]/g,Di=new Set(["table","tbody","thead","tfoot","tr"]),Bi=new Set(["td","th"]),or="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Oi(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Wi(t,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=qi(t,n.jsx,n.jsxs)}const i={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Hn:Ii,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},l=ar(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function ar(e,n,t){if(n.type==="element")return Ri(e,n,t);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Fi(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Hi(e,n,t);if(n.type==="mdxjsEsm")return $i(e,n);if(n.type==="root")return Vi(e,n,t);if(n.type==="text")return Ui(e,n)}function Ri(e,n,t){const r=e.schema;let i=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Hn,e.schema=i),e.ancestors.push(n);const l=ur(e,n.tagName,!1),o=Yi(e,n);let a=Wn(e,n);return Di.has(n.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!mi(c):!0})),sr(e,o,l,n),qn(o,a),e.ancestors.pop(),e.schema=r,e.create(n,l,o,t)}function Fi(e,n){if(n.data&&n.data.estree&&e.evaluater){const r=n.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ze(e,n.position)}function $i(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Ze(e,n.position)}function Hi(e,n,t){const r=e.schema;let i=r;n.name==="svg"&&r.space==="html"&&(i=Hn,e.schema=i),e.ancestors.push(n);const l=n.name===null?e.Fragment:ur(e,n.name,!0),o=Xi(e,n),a=Wn(e,n);return sr(e,o,l,n),qn(o,a),e.ancestors.pop(),e.schema=r,e.create(n,l,o,t)}function Vi(e,n,t){const r={};return qn(r,Wn(e,n)),e.create(n,e.Fragment,r,t)}function Ui(e,n){return n.value}function sr(e,n,t,r){typeof t!="string"&&t!==e.Fragment&&e.passNode&&(n.node=r)}function qn(e,n){if(n.length>0){const t=n.length>1?n:n[0];t&&(e.children=t)}}function qi(e,n,t){return r;function r(i,l,o,a){const s=Array.isArray(o.children)?t:n;return a?s(l,o,a):s(l,o)}}function Wi(e,n){return t;function t(r,i,l,o){const a=Array.isArray(l.children),c=Vn(r);return n(i,l,o,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Yi(e,n){const t={};let r,i;for(i in n.properties)if(i!=="children"&&Un.call(n.properties,i)){const l=Ki(e,i,n.properties[i]);if(l){const[o,a]=l;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Bi.has(n.tagName)?r=a:t[o]=a}}if(r){const l=t.style||(t.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return t}function Xi(e,n){const t={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const o=l.expression;o.type;const a=o.properties[0];a.type,Object.assign(t,e.evaluater.evaluateExpression(a.argument))}else Ze(e,n.position);else{const i=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,l=e.evaluater.evaluateExpression(a.expression)}else Ze(e,n.position);else l=r.value===null?!0:r.value;t[i]=l}return t}function Wn(e,n){const t=[];let r=-1;const i=e.passKeys?new Map:zi;for(;++r<n.children.length;){const l=n.children[r];let o;if(e.passKeys){const c=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(c){const s=i.get(c)||0;o=c+"-"+s,i.set(c,s+1)}}const a=ar(e,l,o);a!==void 0&&t.push(a)}return t}function Ki(e,n,t){const r=Ci(e.schema,n);if(!(t==null||typeof t=="number"&&Number.isNaN(t))){if(Array.isArray(t)&&(t=r.commaSeparated?ci(t):Ei(t)),r.property==="style"){let i=typeof t=="object"?t:Qi(e,String(t));return e.stylePropertyNameCase==="css"&&(i=Zi(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?ki[r.property]||r.property:r.attribute,t]}}function Qi(e,n){try{return Ai(n,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};const r=t,i=new te("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=or+"#cannot-parse-style-attribute",i}}function ur(e,n,t){let r;if(!t)r={type:"Literal",value:n};else if(n.includes(".")){const i=n.split(".");let l=-1,o;for(;++l<i.length;){const a=ot(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(l&&a.type==="Literal"),optional:!1}:a}r=o}else r=ot(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(r.type==="Literal"){const i=r.value;return Un.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ze(e)}function Ze(e,n){const t=new te("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=or+"#cannot-handle-mdx-estrees-without-createevaluater",t}function Zi(e){const n={};let t;for(t in e)Un.call(e,t)&&(n[Ji(t)]=e[t]);return n}function Ji(e){let n=e.replace(Mi,Gi);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Gi(e){return"-"+e.toLowerCase()}const gn={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"]},el={};function nl(e,n){const t=el,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return cr(e,r,i)}function cr(e,n,t){if(tl(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return gt(e.children,n,t)}return Array.isArray(e)?gt(e,n,t):""}function gt(e,n,t){const r=[];let i=-1;for(;++i<e.length;)r[i]=cr(e[i],n,t);return r.join("")}function tl(e){return!!(e&&typeof e=="object")}const yt=document.createElement("i");function Yn(e){const n="&"+e+";";yt.innerHTML=n;const t=yt.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function ye(e,n,t,r){const i=e.length;let l=0,o;if(n<0?n=-n>i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)o=Array.from(r),o.unshift(n,t),e.splice(...o);else for(t&&e.splice(n,t);l<r.length;)o=r.slice(l,l+1e4),o.unshift(n,0),e.splice(...o),l+=1e4,n+=1e4}function pe(e,n){return e.length>0?(ye(e,e.length,0,n),e):n}const xt={}.hasOwnProperty;function rl(e){const n={};let t=-1;for(;++t<e.length;)il(n,e[t]);return n}function il(e,n){let t;for(t in n){const i=(xt.call(e,t)?e[t]:void 0)||(e[t]={}),l=n[t];let o;if(l)for(o in l){xt.call(i,o)||(i[o]=[]);const a=l[o];ll(i[o],Array.isArray(a)?a:a?[a]:[])}}}function ll(e,n){let t=-1;const r=[];for(;++t<n.length;)(n[t].add==="after"?e:r).push(n[t]);ye(e,0,0,r)}function pr(e,n){const t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function Me(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ge=_e(/[A-Za-z]/),se=_e(/[\dA-Za-z]/),ol=_e(/[#-'*+\--9=?A-Z^-~]/);function jn(e){return e!==null&&(e<32||e===127)}const zn=_e(/\d/),al=_e(/[\dA-Fa-f]/),sl=_e(/[!-/:-@[-`{-~]/);function z(e){return e!==null&&e<-2}function ie(e){return e!==null&&(e<0||e===32)}function W(e){return e===-2||e===-1||e===32}const ul=_e(new RegExp("\\p{P}|\\p{S}","u")),cl=_e(/\s/);function _e(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Be(e){const n=[];let t=-1,r=0,i=0;for(;++t<e.length;){const l=e.charCodeAt(t);let o="";if(l===37&&se(e.charCodeAt(t+1))&&se(e.charCodeAt(t+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const a=e.charCodeAt(t+1);l<56320&&a>56319&&a<57344?(o=String.fromCharCode(l,a),i=1):o="�"}else o=String.fromCharCode(l);o&&(n.push(e.slice(r,t),encodeURIComponent(o)),r=t+i+1,o=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function K(e,n,t,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(c){return W(c)?(e.enter(t),a(c)):n(c)}function a(c){return W(c)&&l++<i?(e.consume(c),a):(e.exit(t),n(c))}}const pl={tokenize:hl};function hl(e){const n=e.attempt(this.parser.constructs.contentInitial,r,i);let t;return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),K(e,n,"linePrefix")}function i(a){return e.enter("paragraph"),l(a)}function l(a){const c=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=c),t=c,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return z(a)?(e.consume(a),e.exit("chunkText"),l):(e.consume(a),o)}}const fl={tokenize:dl},kt={tokenize:ml};function dl(e){const n=this,t=[];let r=0,i,l,o;return a;function a(v){if(r<t.length){const R=t[r];return n.containerState=R[1],e.attempt(R[0].continuation,c,s)(v)}return s(v)}function c(v){if(r++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,i&&P();const R=n.events.length;let V=R,k;for(;V--;)if(n.events[V][0]==="exit"&&n.events[V][1].type==="chunkFlow"){k=n.events[V][1].end;break}b(r);let D=R;for(;D<n.events.length;)n.events[D][1].end={...k},D++;return ye(n.events,V+1,0,n.events.slice(R)),n.events.length=D,s(v)}return a(v)}function s(v){if(r===t.length){if(!i)return m(v);if(i.currentConstruct&&i.currentConstruct.concrete)return S(v);n.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(kt,u,p)(v)}function u(v){return i&&P(),b(r),m(v)}function p(v){return n.parser.lazy[n.now().line]=r!==t.length,o=n.now().offset,S(v)}function m(v){return n.containerState={},e.attempt(kt,h,S)(v)}function h(v){return r++,t.push([n.currentConstruct,n.containerState]),m(v)}function S(v){if(v===null){i&&P(),b(0),e.consume(v);return}return i=i||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),I(v)}function I(v){if(v===null){E(e.exit("chunkFlow"),!0),b(0),e.consume(v);return}return z(v)?(e.consume(v),E(e.exit("chunkFlow")),r=0,n.interrupt=void 0,a):(e.consume(v),I)}function E(v,R){const V=n.sliceStream(v);if(R&&V.push(null),v.previous=l,l&&(l.next=v),l=v,i.defineSkip(v.start),i.write(V),n.parser.lazy[v.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const D=n.events.length;let U=D,F,$;for(;U--;)if(n.events[U][0]==="exit"&&n.events[U][1].type==="chunkFlow"){if(F){$=n.events[U][1].end;break}F=!0}for(b(r),k=D;k<n.events.length;)n.events[k][1].end={...$},k++;ye(n.events,U+1,0,n.events.slice(D)),n.events.length=k}}function b(v){let R=t.length;for(;R-- >v;){const V=t[R];n.containerState=V[1],V[0].exit.call(n,e)}t.length=v}function P(){i.write([null]),l=void 0,i=void 0,n.containerState._closeFlow=void 0}}function ml(e,n,t){return K(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bt(e){if(e===null||ie(e)||cl(e))return 1;if(ul(e))return 2}function Xn(e,n,t){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(n=l(n,t),r.push(l))}return n}const Mn={name:"attention",resolveAll:gl,tokenize:yl};function gl(e,n){let t=-1,r,i,l,o,a,c,s,u;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(r=t;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&n.sliceSerialize(e[r][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[r][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const p={...e[r][1].end},m={...e[t][1].start};wt(p,-c),wt(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:m},l={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[t][1].start={...a.end},s=[],e[r][1].end.offset-e[r][1].start.offset&&(s=pe(s,[["enter",e[r][1],n],["exit",e[r][1],n]])),s=pe(s,[["enter",i,n],["enter",o,n],["exit",o,n],["enter",l,n]]),s=pe(s,Xn(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),s=pe(s,[["exit",l,n],["enter",a,n],["exit",a,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(u=2,s=pe(s,[["enter",e[t][1],n],["exit",e[t][1],n]])):u=0,ye(e,r-1,t-r+3,s),t=r+s.length-u-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function yl(e,n){const t=this.parser.constructs.attentionMarkers.null,r=this.previous,i=bt(r);let l;return o;function o(c){return l=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===l)return e.consume(c),a;const s=e.exit("attentionSequence"),u=bt(c),p=!u||u===2&&i||t.includes(c),m=!i||i===2&&u||t.includes(r);return s._open=!!(l===42?p:p&&(i||!m)),s._close=!!(l===42?m:m&&(u||!p)),n(c)}}function wt(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const xl={name:"autolink",tokenize:kl};function kl(e,n,t){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(h){return ge(h)?(e.consume(h),o):h===64?t(h):s(h)}function o(h){return h===43||h===45||h===46||se(h)?(r=1,a(h)):s(h)}function a(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||se(h))&&r++<32?(e.consume(h),a):(r=0,s(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),n):h===null||h===32||h===60||jn(h)?t(h):(e.consume(h),c)}function s(h){return h===64?(e.consume(h),u):ol(h)?(e.consume(h),s):t(h)}function u(h){return se(h)?p(h):t(h)}function p(h){return h===46?(e.consume(h),r=0,u):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),n):m(h)}function m(h){if((h===45||se(h))&&r++<63){const S=h===45?m:p;return e.consume(h),S}return t(h)}}const pn={partial:!0,tokenize:bl};function bl(e,n,t){return r;function r(l){return W(l)?K(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||z(l)?n(l):t(l)}}const hr={continuation:{tokenize:Cl},exit:Sl,name:"blockQuote",tokenize:wl};function wl(e,n,t){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return t(o)}function l(o){return W(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function Cl(e,n,t){const r=this;return i;function i(o){return W(o)?K(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(hr,n,t)(o)}}function Sl(e){e.exit("blockQuote")}const fr={name:"characterEscape",tokenize:_l};function _l(e,n,t){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return sl(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(l)}}const dr={name:"characterReference",tokenize:Il};function Il(e,n,t){const r=this;let i=0,l,o;return a;function a(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),c}function c(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),s):(e.enter("characterReferenceValue"),l=31,o=se,u(p))}function s(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=al,u):(e.enter("characterReferenceValue"),l=7,o=zn,u(p))}function u(p){if(p===59&&i){const m=e.exit("characterReferenceValue");return o===se&&!Yn(r.sliceSerialize(m))?t(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(p)&&i++<l?(e.consume(p),u):t(p)}}const Ct={partial:!0,tokenize:vl},St={concrete:!0,name:"codeFenced",tokenize:El};function El(e,n,t){const r=this,i={partial:!0,tokenize:V};let l=0,o=0,a;return c;function c(k){return s(k)}function s(k){const D=r.events[r.events.length-1];return l=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===a?(o++,e.consume(k),u):o<3?t(k):(e.exit("codeFencedFenceSequence"),W(k)?K(e,p,"whitespace")(k):p(k))}function p(k){return k===null||z(k)?(e.exit("codeFencedFence"),r.interrupt?n(k):e.check(Ct,I,R)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||z(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(k)):W(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),K(e,h,"whitespace")(k)):k===96&&k===a?t(k):(e.consume(k),m)}function h(k){return k===null||z(k)?p(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(k))}function S(k){return k===null||z(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(k)):k===96&&k===a?t(k):(e.consume(k),S)}function I(k){return e.attempt(i,R,E)(k)}function E(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),b}function b(k){return l>0&&W(k)?K(e,P,"linePrefix",l+1)(k):P(k)}function P(k){return k===null||z(k)?e.check(Ct,I,R)(k):(e.enter("codeFlowValue"),v(k))}function v(k){return k===null||z(k)?(e.exit("codeFlowValue"),P(k)):(e.consume(k),v)}function R(k){return e.exit("codeFenced"),n(k)}function V(k,D,U){let F=0;return $;function $(x){return k.enter("lineEnding"),k.consume(x),k.exit("lineEnding"),N}function N(x){return k.enter("codeFencedFence"),W(x)?K(k,C,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):C(x)}function C(x){return x===a?(k.enter("codeFencedFenceSequence"),j(x)):U(x)}function j(x){return x===a?(F++,k.consume(x),j):F>=o?(k.exit("codeFencedFenceSequence"),W(x)?K(k,T,"whitespace")(x):T(x)):U(x)}function T(x){return x===null||z(x)?(k.exit("codeFencedFence"),D(x)):U(x)}}}function vl(e,n,t){const r=this;return i;function i(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}const yn={name:"codeIndented",tokenize:Ll},Tl={partial:!0,tokenize:Nl};function Ll(e,n,t){const r=this;return i;function i(s){return e.enter("codeIndented"),K(e,l,"linePrefix",5)(s)}function l(s){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(s):t(s)}function o(s){return s===null?c(s):z(s)?e.attempt(Tl,o,c)(s):(e.enter("codeFlowValue"),a(s))}function a(s){return s===null||z(s)?(e.exit("codeFlowValue"),o(s)):(e.consume(s),a)}function c(s){return e.exit("codeIndented"),n(s)}}function Nl(e,n,t){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?t(o):z(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):K(e,l,"linePrefix",5)(o)}function l(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):z(o)?i(o):t(o)}}const Pl={name:"codeText",previous:jl,resolve:Al,tokenize:zl};function Al(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r<n;)if(e[r][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(r=t-1,n++;++r<=n;)i===void 0?r!==n&&e[r][1].type!=="lineEnding"&&(i=r):(r===n||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),n-=r-i-2,r=i+2),i=void 0);return e}function jl(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function zl(e,n,t){let r=0,i,l;return o;function o(p){return e.enter("codeText"),e.enter("codeTextSequence"),a(p)}function a(p){return p===96?(e.consume(p),r++,a):(e.exit("codeTextSequence"),c(p))}function c(p){return p===null?t(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),c):p===96?(l=e.enter("codeTextSequence"),i=0,u(p)):z(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("codeTextData"),s(p))}function s(p){return p===null||p===32||p===96||z(p)?(e.exit("codeTextData"),c(p)):(e.consume(p),s)}function u(p){return p===96?(e.consume(p),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(p)):(l.type="codeTextData",s(p))}}class Ml{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,t){const r=t??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(n,r):n>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,t,r){const i=t||0;this.setCursor(Math.trunc(n));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ue(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),Ue(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),Ue(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const t=this.left.splice(n,Number.POSITIVE_INFINITY);Ue(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);Ue(this.left,t.reverse())}}}function Ue(e,n){let t=0;if(n.length<1e4)e.push(...n);else for(;t<n.length;)e.push(...n.slice(t,t+1e4)),t+=1e4}function mr(e){const n={};let t=-1,r,i,l,o,a,c,s;const u=new Ml(e);for(;++t<u.length;){for(;t in n;)t=n[t];if(r=u.get(t),t&&r[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,l=0,l<c.length&&c[l][1].type==="lineEndingBlank"&&(l+=2),l<c.length&&c[l][1].type==="content"))for(;++l<c.length&&c[l][1].type!=="content";)c[l][1].type==="chunkText"&&(c[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(n,Dl(u,t)),t=n[t],s=!0);else if(r[1]._container){for(l=t,i=void 0;l--;)if(o=u.get(l),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=l);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,t),a.unshift(r),u.splice(i,t-i+1,a))}}return ye(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!s}function Dl(e,n){const t=e.get(n)[1],r=e.get(n)[2];let i=n-1;const l=[];let o=t._tokenizer;o||(o=r.parser[t.contentType](t.start),t._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,c=[],s={};let u,p,m=-1,h=t,S=0,I=0;const E=[I];for(;h;){for(;e.get(++i)[1]!==h;);l.push(i),h._tokenizer||(u=r.sliceStream(h),h.next||u.push(null),p&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=h,h=h.next}for(h=t;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(I=m+1,E.push(I),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):E.pop(),m=E.length;m--;){const b=a.slice(E[m],E[m+1]),P=l.pop();c.push([P,P+b.length-1]),e.splice(P,2,b)}for(c.reverse(),m=-1;++m<c.length;)s[S+c[m][0]]=S+c[m][1],S+=c[m][1]-c[m][0]-1;return s}const Bl={resolve:Rl,tokenize:Fl},Ol={partial:!0,tokenize:$l};function Rl(e){return mr(e),e}function Fl(e,n){let t;return r;function r(a){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?l(a):z(a)?e.check(Ol,o,l)(a):(e.consume(a),i)}function l(a){return e.exit("chunkContent"),e.exit("content"),n(a)}function o(a){return e.consume(a),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,i}}function $l(e,n,t){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),K(e,l,"linePrefix")}function l(o){if(o===null||z(o))return t(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):e.interrupt(r.parser.constructs.flow,t,n)(o)}}function gr(e,n,t,r,i,l,o,a,c){const s=c||Number.POSITIVE_INFINITY;let u=0;return p;function p(b){return b===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(b),e.exit(l),m):b===null||b===32||b===41||jn(b)?t(b):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),I(b))}function m(b){return b===62?(e.enter(l),e.consume(b),e.exit(l),e.exit(i),e.exit(r),n):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(b))}function h(b){return b===62?(e.exit("chunkString"),e.exit(a),m(b)):b===null||b===60||z(b)?t(b):(e.consume(b),b===92?S:h)}function S(b){return b===60||b===62||b===92?(e.consume(b),h):h(b)}function I(b){return!u&&(b===null||b===41||ie(b))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),n(b)):u<s&&b===40?(e.consume(b),u++,I):b===41?(e.consume(b),u--,I):b===null||b===32||b===40||jn(b)?t(b):(e.consume(b),b===92?E:I)}function E(b){return b===40||b===41||b===92?(e.consume(b),I):I(b)}}function yr(e,n,t,r,i,l){const o=this;let a=0,c;return s;function s(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(l),u}function u(h){return a>999||h===null||h===91||h===93&&!c||h===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?t(h):h===93?(e.exit(l),e.enter(i),e.consume(h),e.exit(i),e.exit(r),n):z(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),p(h))}function p(h){return h===null||h===91||h===93||z(h)||a++>999?(e.exit("chunkString"),u(h)):(e.consume(h),c||(c=!W(h)),h===92?m:p)}function m(h){return h===91||h===92||h===93?(e.consume(h),a++,p):p(h)}}function xr(e,n,t,r,i,l){let o;return a;function a(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),o=m===40?41:m,c):t(m)}function c(m){return m===o?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),n):(e.enter(l),s(m))}function s(m){return m===o?(e.exit(l),c(o)):m===null?t(m):z(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),K(e,s,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||z(m)?(e.exit("chunkString"),s(m)):(e.consume(m),m===92?p:u)}function p(m){return m===o||m===92?(e.consume(m),u):u(m)}}function Xe(e,n){let t;return r;function r(i){return z(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):W(i)?K(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}const Hl={name:"definition",tokenize:Ul},Vl={partial:!0,tokenize:ql};function Ul(e,n,t){const r=this;let i;return l;function l(h){return e.enter("definition"),o(h)}function o(h){return yr.call(r,e,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=Me(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):t(h)}function c(h){return ie(h)?Xe(e,s)(h):s(h)}function s(h){return gr(e,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return e.attempt(Vl,p,p)(h)}function p(h){return W(h)?K(e,m,"whitespace")(h):m(h)}function m(h){return h===null||z(h)?(e.exit("definition"),r.parser.defined.push(i),n(h)):t(h)}}function ql(e,n,t){return r;function r(a){return ie(a)?Xe(e,i)(a):t(a)}function i(a){return xr(e,l,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function l(a){return W(a)?K(e,o,"whitespace")(a):o(a)}function o(a){return a===null||z(a)?n(a):t(a)}}const Wl={name:"hardBreakEscape",tokenize:Yl};function Yl(e,n,t){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return z(l)?(e.exit("hardBreakEscape"),n(l)):t(l)}}const Xl={name:"headingAtx",resolve:Kl,tokenize:Ql};function Kl(e,n){let t=e.length-2,r=3,i,l;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},l={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},ye(e,r,t-r+1,[["enter",i,n],["enter",l,n],["exit",l,n],["exit",i,n]])),e}function Ql(e,n,t){let r=0;return i;function i(u){return e.enter("atxHeading"),l(u)}function l(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||ie(u)?(e.exit("atxHeadingSequence"),a(u)):t(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||z(u)?(e.exit("atxHeading"),n(u)):W(u)?K(e,a,"whitespace")(u):(e.enter("atxHeadingText"),s(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),a(u))}function s(u){return u===null||u===35||ie(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),s)}}const Zl=["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"],_t=["pre","script","style","textarea"],Jl={concrete:!0,name:"htmlFlow",resolveTo:no,tokenize:to},Gl={partial:!0,tokenize:io},eo={partial:!0,tokenize:ro};function no(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function to(e,n,t){const r=this;let i,l,o,a,c;return s;function s(d){return u(d)}function u(d){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(d),p}function p(d){return d===33?(e.consume(d),m):d===47?(e.consume(d),l=!0,I):d===63?(e.consume(d),i=3,r.interrupt?n:f):ge(d)?(e.consume(d),o=String.fromCharCode(d),E):t(d)}function m(d){return d===45?(e.consume(d),i=2,h):d===91?(e.consume(d),i=5,a=0,S):ge(d)?(e.consume(d),i=4,r.interrupt?n:f):t(d)}function h(d){return d===45?(e.consume(d),r.interrupt?n:f):t(d)}function S(d){const he="CDATA[";return d===he.charCodeAt(a++)?(e.consume(d),a===he.length?r.interrupt?n:C:S):t(d)}function I(d){return ge(d)?(e.consume(d),o=String.fromCharCode(d),E):t(d)}function E(d){if(d===null||d===47||d===62||ie(d)){const he=d===47,Ie=o.toLowerCase();return!he&&!l&&_t.includes(Ie)?(i=1,r.interrupt?n(d):C(d)):Zl.includes(o.toLowerCase())?(i=6,he?(e.consume(d),b):r.interrupt?n(d):C(d)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(d):l?P(d):v(d))}return d===45||se(d)?(e.consume(d),o+=String.fromCharCode(d),E):t(d)}function b(d){return d===62?(e.consume(d),r.interrupt?n:C):t(d)}function P(d){return W(d)?(e.consume(d),P):$(d)}function v(d){return d===47?(e.consume(d),$):d===58||d===95||ge(d)?(e.consume(d),R):W(d)?(e.consume(d),v):$(d)}function R(d){return d===45||d===46||d===58||d===95||se(d)?(e.consume(d),R):V(d)}function V(d){return d===61?(e.consume(d),k):W(d)?(e.consume(d),V):v(d)}function k(d){return d===null||d===60||d===61||d===62||d===96?t(d):d===34||d===39?(e.consume(d),c=d,D):W(d)?(e.consume(d),k):U(d)}function D(d){return d===c?(e.consume(d),c=null,F):d===null||z(d)?t(d):(e.consume(d),D)}function U(d){return d===null||d===34||d===39||d===47||d===60||d===61||d===62||d===96||ie(d)?V(d):(e.consume(d),U)}function F(d){return d===47||d===62||W(d)?v(d):t(d)}function $(d){return d===62?(e.consume(d),N):t(d)}function N(d){return d===null||z(d)?C(d):W(d)?(e.consume(d),N):t(d)}function C(d){return d===45&&i===2?(e.consume(d),A):d===60&&i===1?(e.consume(d),L):d===62&&i===4?(e.consume(d),J):d===63&&i===3?(e.consume(d),f):d===93&&i===5?(e.consume(d),Q):z(d)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Gl,ue,j)(d)):d===null||z(d)?(e.exit("htmlFlowData"),j(d)):(e.consume(d),C)}function j(d){return e.check(eo,T,ue)(d)}function T(d){return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),x}function x(d){return d===null||z(d)?j(d):(e.enter("htmlFlowData"),C(d))}function A(d){return d===45?(e.consume(d),f):C(d)}function L(d){return d===47?(e.consume(d),o="",q):C(d)}function q(d){if(d===62){const he=o.toLowerCase();return _t.includes(he)?(e.consume(d),J):C(d)}return ge(d)&&o.length<8?(e.consume(d),o+=String.fromCharCode(d),q):C(d)}function Q(d){return d===93?(e.consume(d),f):C(d)}function f(d){return d===62?(e.consume(d),J):d===45&&i===2?(e.consume(d),f):C(d)}function J(d){return d===null||z(d)?(e.exit("htmlFlowData"),ue(d)):(e.consume(d),J)}function ue(d){return e.exit("htmlFlow"),n(d)}}function ro(e,n,t){const r=this;return i;function i(o){return z(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):t(o)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}function io(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(pn,n,t)}}const lo={name:"htmlText",tokenize:oo};function oo(e,n,t){const r=this;let i,l,o;return a;function a(f){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(f),c}function c(f){return f===33?(e.consume(f),s):f===47?(e.consume(f),V):f===63?(e.consume(f),v):ge(f)?(e.consume(f),U):t(f)}function s(f){return f===45?(e.consume(f),u):f===91?(e.consume(f),l=0,S):ge(f)?(e.consume(f),P):t(f)}function u(f){return f===45?(e.consume(f),h):t(f)}function p(f){return f===null?t(f):f===45?(e.consume(f),m):z(f)?(o=p,L(f)):(e.consume(f),p)}function m(f){return f===45?(e.consume(f),h):p(f)}function h(f){return f===62?A(f):f===45?m(f):p(f)}function S(f){const J="CDATA[";return f===J.charCodeAt(l++)?(e.consume(f),l===J.length?I:S):t(f)}function I(f){return f===null?t(f):f===93?(e.consume(f),E):z(f)?(o=I,L(f)):(e.consume(f),I)}function E(f){return f===93?(e.consume(f),b):I(f)}function b(f){return f===62?A(f):f===93?(e.consume(f),b):I(f)}function P(f){return f===null||f===62?A(f):z(f)?(o=P,L(f)):(e.consume(f),P)}function v(f){return f===null?t(f):f===63?(e.consume(f),R):z(f)?(o=v,L(f)):(e.consume(f),v)}function R(f){return f===62?A(f):v(f)}function V(f){return ge(f)?(e.consume(f),k):t(f)}function k(f){return f===45||se(f)?(e.consume(f),k):D(f)}function D(f){return z(f)?(o=D,L(f)):W(f)?(e.consume(f),D):A(f)}function U(f){return f===45||se(f)?(e.consume(f),U):f===47||f===62||ie(f)?F(f):t(f)}function F(f){return f===47?(e.consume(f),A):f===58||f===95||ge(f)?(e.consume(f),$):z(f)?(o=F,L(f)):W(f)?(e.consume(f),F):A(f)}function $(f){return f===45||f===46||f===58||f===95||se(f)?(e.consume(f),$):N(f)}function N(f){return f===61?(e.consume(f),C):z(f)?(o=N,L(f)):W(f)?(e.consume(f),N):F(f)}function C(f){return f===null||f===60||f===61||f===62||f===96?t(f):f===34||f===39?(e.consume(f),i=f,j):z(f)?(o=C,L(f)):W(f)?(e.consume(f),C):(e.consume(f),T)}function j(f){return f===i?(e.consume(f),i=void 0,x):f===null?t(f):z(f)?(o=j,L(f)):(e.consume(f),j)}function T(f){return f===null||f===34||f===39||f===60||f===61||f===96?t(f):f===47||f===62||ie(f)?F(f):(e.consume(f),T)}function x(f){return f===47||f===62||ie(f)?F(f):t(f)}function A(f){return f===62?(e.consume(f),e.exit("htmlTextData"),e.exit("htmlText"),n):t(f)}function L(f){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),q}function q(f){return W(f)?K(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):Q(f)}function Q(f){return e.enter("htmlTextData"),o(f)}}const Kn={name:"labelEnd",resolveAll:co,resolveTo:po,tokenize:ho},ao={tokenize:fo},so={tokenize:mo},uo={tokenize:go};function co(e){let n=-1;const t=[];for(;++n<e.length;){const r=e[n][1];if(t.push(e[n]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",n+=i}}return e.length!==t.length&&ye(e,0,e.length,t),e}function po(e,n){let t=e.length,r=0,i,l,o,a;for(;t--;)if(i=e[t][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[t][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[t][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=t,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=t);const c={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},s={type:"label",start:{...e[l][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",c,n],["enter",s,n]],a=pe(a,e.slice(l+1,l+r+3)),a=pe(a,[["enter",u,n]]),a=pe(a,Xn(n.parser.constructs.insideSpan.null,e.slice(l+r+4,o-3),n)),a=pe(a,[["exit",u,n],e[o-2],e[o-1],["exit",s,n]]),a=pe(a,e.slice(o+1)),a=pe(a,[["exit",c,n]]),ye(e,l,e.length,a),e}function ho(e,n,t){const r=this;let i=r.events.length,l,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){l=r.events[i][1];break}return a;function a(m){return l?l._inactive?p(m):(o=r.parser.defined.includes(Me(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),c):t(m)}function c(m){return m===40?e.attempt(ao,u,o?u:p)(m):m===91?e.attempt(so,u,o?s:p)(m):o?u(m):p(m)}function s(m){return e.attempt(uo,u,p)(m)}function u(m){return n(m)}function p(m){return l._balanced=!0,t(m)}}function fo(e,n,t){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return ie(p)?Xe(e,l)(p):l(p)}function l(p){return p===41?u(p):gr(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return ie(p)?Xe(e,c)(p):u(p)}function a(p){return t(p)}function c(p){return p===34||p===39||p===40?xr(e,s,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function s(p){return ie(p)?Xe(e,u)(p):u(p)}function u(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),n):t(p)}}function mo(e,n,t){const r=this;return i;function i(a){return yr.call(r,e,l,o,"reference","referenceMarker","referenceString")(a)}function l(a){return r.parser.defined.includes(Me(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?n(a):t(a)}function o(a){return t(a)}}function go(e,n,t){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),n):t(l)}}const yo={name:"labelStartImage",resolveAll:Kn.resolveAll,tokenize:xo};function xo(e,n,t){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),l}function l(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):t(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(a):n(a)}}const ko={name:"labelStartLink",resolveAll:Kn.resolveAll,tokenize:bo};function bo(e,n,t){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(o):n(o)}}const xn={name:"lineEnding",tokenize:wo};function wo(e,n){return t;function t(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),K(e,n,"linePrefix")}}const sn={name:"thematicBreak",tokenize:Co};function Co(e,n,t){let r=0,i;return l;function l(s){return e.enter("thematicBreak"),o(s)}function o(s){return i=s,a(s)}function a(s){return s===i?(e.enter("thematicBreakSequence"),c(s)):r>=3&&(s===null||z(s))?(e.exit("thematicBreak"),n(s)):t(s)}function c(s){return s===i?(e.consume(s),r++,c):(e.exit("thematicBreakSequence"),W(s)?K(e,a,"whitespace")(s):a(s))}}const re={continuation:{tokenize:Eo},exit:To,name:"list",tokenize:Io},So={partial:!0,tokenize:Lo},_o={partial:!0,tokenize:vo};function Io(e,n,t){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(h){const S=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:zn(h)){if(r.containerState.type||(r.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(sn,t,s)(h):s(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return t(h)}function c(h){return zn(h)&&++o<10?(e.consume(h),c):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),s(h)):t(h)}function s(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(pn,r.interrupt?t:u,e.attempt(So,m,p))}function u(h){return r.containerState.initialBlankLine=!0,l++,m(h)}function p(h){return W(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),m):t(h)}function m(h){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(h)}}function Eo(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(pn,i,l);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,K(e,n,"listItemIndent",r.containerState.size+1)(a)}function l(a){return r.containerState.furtherBlankLines||!W(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(_o,n,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,K(e,e.attempt(re,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function vo(e,n,t){const r=this;return K(e,i,"listItemIndent",r.containerState.size+1);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?n(l):t(l)}}function To(e){e.exit(this.containerState.type)}function Lo(e,n,t){const r=this;return K(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const o=r.events[r.events.length-1];return!W(l)&&o&&o[1].type==="listItemPrefixWhitespace"?n(l):t(l)}}const It={name:"setextUnderline",resolveTo:No,tokenize:Po};function No(e,n){let t=e.length,r,i,l;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!l&&e[t][1].type==="definition"&&(l=t);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",o,n]),e.splice(l+1,0,["exit",e[r][1],n]),e[r][1].end={...e[l][1].end}):e[r][1]=o,e.push(["exit",o,n]),e}function Po(e,n,t){const r=this;let i;return l;function l(s){let u=r.events.length,p;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){p=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),i=s,o(s)):t(s)}function o(s){return e.enter("setextHeadingLineSequence"),a(s)}function a(s){return s===i?(e.consume(s),a):(e.exit("setextHeadingLineSequence"),W(s)?K(e,c,"lineSuffix")(s):c(s))}function c(s){return s===null||z(s)?(e.exit("setextHeadingLine"),n(s)):t(s)}}const Ao={tokenize:jo};function jo(e){const n=this,t=e.attempt(pn,r,e.attempt(this.parser.constructs.flowInitial,i,K(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Bl,i)),"linePrefix")));return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n.currentConstruct=void 0,t}}const zo={resolveAll:br()},Mo=kr("string"),Do=kr("text");function kr(e){return{resolveAll:br(e==="text"?Bo:void 0),tokenize:n};function n(t){const r=this,i=this.parser.constructs[e],l=t.attempt(i,o,a);return o;function o(u){return s(u)?l(u):a(u)}function a(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),c}function c(u){return s(u)?(t.exit("data"),l(u)):(t.consume(u),c)}function s(u){if(u===null)return!0;const p=i[u];let m=-1;if(p)for(;++m<p.length;){const h=p[m];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function br(e){return n;function n(t,r){let i=-1,l;for(;++i<=t.length;)l===void 0?t[i]&&t[i][1].type==="data"&&(l=i,i++):(!t[i]||t[i][1].type!=="data")&&(i!==l+2&&(t[l][1].end=t[i-1][1].end,t.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(t,r):t}}function Bo(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){const r=e[t-1][1],i=n.sliceStream(r);let l=i.length,o=-1,a=0,c;for(;l--;){const s=i[l];if(typeof s=="string"){for(o=s.length;s.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(s===-2)c=!0,a++;else if(s!==-1){l++;break}}if(n._contentTypeTextTrailing&&t===e.length&&(a=0),a){const s={type:t===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?o:r.start._bufferIndex+o,_index:r.start._index+l,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...s.start},r.start.offset===r.end.offset?Object.assign(r,s):(e.splice(t,0,["enter",s,n],["exit",s,n]),t+=2)}t++}return e}const Oo={42:re,43:re,45:re,48:re,49:re,50:re,51:re,52:re,53:re,54:re,55:re,56:re,57:re,62:hr},Ro={91:Hl},Fo={[-2]:yn,[-1]:yn,32:yn},$o={35:Xl,42:sn,45:[It,sn],60:Jl,61:It,95:sn,96:St,126:St},Ho={38:dr,92:fr},Vo={[-5]:xn,[-4]:xn,[-3]:xn,33:yo,38:dr,42:Mn,60:[xl,lo],91:ko,92:[Wl,fr],93:Kn,95:Mn,96:Pl},Uo={null:[Mn,zo]},qo={null:[42,95]},Wo={null:[]},Yo=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qo,contentInitial:Ro,disable:Wo,document:Oo,flow:$o,flowInitial:Fo,insideSpan:Uo,string:Ho,text:Vo},Symbol.toStringTag,{value:"Module"}));function Xo(e,n,t){let r={_bufferIndex:-1,_index:0,line:t&&t.line||1,column:t&&t.column||1,offset:t&&t.offset||0};const i={},l=[];let o=[],a=[];const c={attempt:D(V),check:D(k),consume:P,enter:v,exit:R,interrupt:D(k,{interrupt:!0})},s={code:null,containerState:{},defineSkip:I,events:[],now:S,parser:e,previous:null,sliceSerialize:m,sliceStream:h,write:p};let u=n.tokenize.call(s,c);return n.resolveAll&&l.push(n),s;function p(N){return o=pe(o,N),E(),o[o.length-1]!==null?[]:(U(n,0),s.events=Xn(l,s.events,s),s.events)}function m(N,C){return Qo(h(N),C)}function h(N){return Ko(o,N)}function S(){const{_bufferIndex:N,_index:C,line:j,column:T,offset:x}=r;return{_bufferIndex:N,_index:C,line:j,column:T,offset:x}}function I(N){i[N.line]=N.column,$()}function E(){let N;for(;r._index<o.length;){const C=o[r._index];if(typeof C=="string")for(N=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===N&&r._bufferIndex<C.length;)b(C.charCodeAt(r._bufferIndex));else b(C)}}function b(N){u=u(N)}function P(N){z(N)?(r.line++,r.column=1,r.offset+=N===-3?2:1,$()):N!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),s.previous=N}function v(N,C){const j=C||{};return j.type=N,j.start=S(),s.events.push(["enter",j,s]),a.push(j),j}function R(N){const C=a.pop();return C.end=S(),s.events.push(["exit",C,s]),C}function V(N,C){U(N,C.from)}function k(N,C){C.restore()}function D(N,C){return j;function j(T,x,A){let L,q,Q,f;return Array.isArray(T)?ue(T):"tokenize"in T?ue([T]):J(T);function J(G){return Oe;function Oe(be){const Te=be!==null&&G[be],Le=be!==null&&G.null,en=[...Array.isArray(Te)?Te:Te?[Te]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return ue(en)(be)}}function ue(G){return L=G,q=0,G.length===0?A:d(G[q])}function d(G){return Oe;function Oe(be){return f=F(),Q=G,G.partial||(s.currentConstruct=G),G.name&&s.parser.constructs.disable.null.includes(G.name)?Ie():G.tokenize.call(C?Object.assign(Object.create(s),C):s,c,he,Ie)(be)}}function he(G){return N(Q,f),x}function Ie(G){return f.restore(),++q<L.length?d(L[q]):A}}}function U(N,C){N.resolveAll&&!l.includes(N)&&l.push(N),N.resolve&&ye(s.events,C,s.events.length-C,N.resolve(s.events.slice(C),s)),N.resolveTo&&(s.events=N.resolveTo(s.events,s))}function F(){const N=S(),C=s.previous,j=s.currentConstruct,T=s.events.length,x=Array.from(a);return{from:T,restore:A};function A(){r=N,s.previous=C,s.currentConstruct=j,s.events.length=T,a=x,$()}}function $(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ko(e,n){const t=n.start._index,r=n.start._bufferIndex,i=n.end._index,l=n.end._bufferIndex;let o;if(t===i)o=[e[t].slice(r,l)];else{if(o=e.slice(t,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}l>0&&o.push(e[i].slice(0,l))}return o}function Qo(e,n){let t=-1;const r=[];let i;for(;++t<e.length;){const l=e[t];let o;if(typeof l=="string")o=l;else switch(l){case-5:{o="\r";break}case-4:{o=`
6
6
  `;break}case-3:{o=`\r
7
- `;break}case-2:{o=n?" ":" ";break}case-1:{if(!n&&i)continue;o=" ";break}default:o=String.fromCharCode(l)}i=l===-2,r.push(o)}return r.join("")}function Zo(e){const r={constructs:rl([Yo,...(e||{}).extensions||[]]),content:i(pl),defined:[],document:i(fl),flow:i(Ao),lazy:{},string:i(Mo),text:i(Do)};return r;function i(l){return o;function o(a){return Xo(r,l,a)}}}function Jo(e){for(;!mr(e););return e}const Et=/[\0\t\n\r]/g;function Go(){let e=1,n="",t=!0,r;return i;function i(l,o,a){const c=[];let s,u,p,m,h;for(l=n+(typeof l=="string"?l.toString():new TextDecoder(o||void 0).decode(l)),p=0,n="",t&&(l.charCodeAt(0)===65279&&p++,t=void 0);p<l.length;){if(Et.lastIndex=p,s=Et.exec(l),m=s&&s.index!==void 0?s.index:l.length,h=l.charCodeAt(m),!s){n=l.slice(p);break}if(h===10&&p===m&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),p<m&&(c.push(l.slice(p,m)),e+=m-p),h){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}p=m+1}return a&&(r&&c.push(-5),n&&c.push(n),c.push(null)),c}}const ea=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function na(e){return e.replace(ea,ta)}function ta(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){const i=t.charCodeAt(1),l=i===120||i===88;return pr(t.slice(l?2:1),l?16:10)}return Yn(t)||e}const wr={}.hasOwnProperty;function ra(e,n,t){return typeof n!="string"&&(t=n,n=void 0),ia(t)(Jo(Zo(t).document().write(Go()(e,n,!0))))}function ia(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(it),autolinkProtocol:$,autolinkEmail:$,atxHeading:l(nt),blockQuote:l(Le),characterEscape:$,characterReference:$,codeFenced:l(en),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:l(en,o),codeText:l(Or,o),codeTextData:$,data:$,codeFlowValue:$,definition:l(Rr),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:l(Fr),hardBreakEscape:l(tt),hardBreakTrailing:l(tt),htmlFlow:l(rt,o),htmlFlowData:$,htmlText:l(rt,o),htmlTextData:$,image:l($r),label:o,link:l(it),listItem:l(Hr),listItemValue:m,listOrdered:l(lt,p),listUnordered:l(lt),paragraph:l(Vr),reference:d,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:l(nt),strong:l(Ur),thematicBreak:l(Wr)},exit:{atxHeading:c(),atxHeadingSequence:q,autolink:c(),autolinkEmail:Te,autolinkProtocol:be,blockQuote:c(),characterEscapeValue:V,characterReferenceMarkerHexadecimal:Ie,characterReferenceMarkerNumeric:Ie,characterReferenceValue:J,characterReference:Oe,codeFenced:c(I),codeFencedFence:E,codeFencedFenceInfo:h,codeFencedFenceMeta:C,codeFlowValue:V,codeIndented:c(x),codeText:c(b),codeTextData:V,data:V,definition:c(),definitionDestinationString:R,definitionLabelString:A,definitionTitleString:v,emphasis:c(),hardBreakEscape:c(S),hardBreakTrailing:c(S),htmlFlow:c(j),htmlFlowData:V,htmlText:c(L),htmlTextData:V,image:c(T),label:Q,labelText:O,lineEnding:P,link:c(N),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:he,resourceDestinationString:f,resourceTitleString:le,resource:ue,setextHeading:c(U),setextHeadingLineSequence:B,setextHeadingText:k,strong:c(),thematicBreak:c()}};Cr(n,(e||{}).mdastExtensions||[]);const t={};return r;function r(y){let _={type:"root",children:[]};const M={stack:[_],tokenStack:[],config:n,enter:a,exit:s,buffer:o,resume:u,data:t},H=[];let Y=-1;for(;++Y<y.length;)if(y[Y][1].type==="listOrdered"||y[Y][1].type==="listUnordered")if(y[Y][0]==="enter")H.push(Y);else{const fe=H.pop();Y=i(y,fe,Y)}for(Y=-1;++Y<y.length;){const fe=n[y[Y][0]];wr.call(fe,y[Y][1].type)&&fe[y[Y][1].type].call(Object.assign({sliceSerialize:y[Y][2].sliceSerialize},M),y[Y][1])}if(M.tokenStack.length>0){const fe=M.tokenStack[M.tokenStack.length-1];(fe[1]||vt).call(M,void 0,fe[0])}for(_.position={start:we(y.length>0?y[0][1].start:{line:1,column:1,offset:0}),end:we(y.length>0?y[y.length-2][1].end:{line:1,column:1,offset:0})},Y=-1;++Y<n.transforms.length;)_=n.transforms[Y](_)||_;return _}function i(y,_,M){let H=_-1,Y=-1,fe=!1,Ee,xe,Re,Fe;for(;++H<=M;){const oe=y[H];switch(oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{oe[0]==="enter"?Y++:Y--,Fe=void 0;break}case"lineEndingBlank":{oe[0]==="enter"&&(Ee&&!Fe&&!Y&&!Re&&(Re=H),Fe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Fe=void 0}if(!Y&&oe[0]==="enter"&&oe[1].type==="listItemPrefix"||Y===-1&&oe[0]==="exit"&&(oe[1].type==="listUnordered"||oe[1].type==="listOrdered")){if(Ee){let Pe=H;for(xe=void 0;Pe--;){const ke=y[Pe];if(ke[1].type==="lineEnding"||ke[1].type==="lineEndingBlank"){if(ke[0]==="exit")continue;xe&&(y[xe][1].type="lineEndingBlank",fe=!0),ke[1].type="lineEnding",xe=Pe}else if(!(ke[1].type==="linePrefix"||ke[1].type==="blockQuotePrefix"||ke[1].type==="blockQuotePrefixWhitespace"||ke[1].type==="blockQuoteMarker"||ke[1].type==="listItemIndent"))break}Re&&(!xe||Re<xe)&&(Ee._spread=!0),Ee.end=Object.assign({},xe?y[xe][1].start:oe[1].end),y.splice(xe||H,0,["exit",Ee,oe[2]]),H++,M++}if(oe[1].type==="listItemPrefix"){const Pe={type:"listItem",_spread:!1,start:Object.assign({},oe[1].start),end:void 0};Ee=Pe,y.splice(H,0,["enter",Pe,oe[2]]),H++,M++,Re=void 0,Fe=!0}}}return y[_][1]._spread=fe,M}function l(y,_){return M;function M(H){a.call(this,y(H),H),_&&_.call(this,H)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(y,_,M){this.stack[this.stack.length-1].children.push(y),this.stack.push(y),this.tokenStack.push([_,M||void 0]),y.position={start:we(_.start),end:void 0}}function c(y){return _;function _(M){y&&y.call(this,M),s.call(this,M)}}function s(y,_){const M=this.stack.pop(),H=this.tokenStack.pop();if(H)H[0].type!==y.type&&(_?_.call(this,y,H[0]):(H[1]||vt).call(this,y,H[0]));else throw new Error("Cannot close `"+y.type+"` ("+Ye({start:y.start,end:y.end})+"): it’s not open");M.position.end=we(y.end)}function u(){return nl(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(y){if(this.data.expectingFirstListItemValue){const _=this.stack[this.stack.length-2];_.start=Number.parseInt(this.sliceSerialize(y),10),this.data.expectingFirstListItemValue=void 0}}function h(){const y=this.resume(),_=this.stack[this.stack.length-1];_.lang=y}function C(){const y=this.resume(),_=this.stack[this.stack.length-1];_.meta=y}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function I(){const y=this.resume(),_=this.stack[this.stack.length-1];_.value=y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const y=this.resume(),_=this.stack[this.stack.length-1];_.value=y.replace(/(\r?\n|\r)$/g,"")}function A(y){const _=this.resume(),M=this.stack[this.stack.length-1];M.label=_,M.identifier=Me(this.sliceSerialize(y)).toLowerCase()}function v(){const y=this.resume(),_=this.stack[this.stack.length-1];_.title=y}function R(){const y=this.resume(),_=this.stack[this.stack.length-1];_.url=y}function q(y){const _=this.stack[this.stack.length-1];if(!_.depth){const M=this.sliceSerialize(y).length;_.depth=M}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function B(y){const _=this.stack[this.stack.length-1];_.depth=this.sliceSerialize(y).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function $(y){const M=this.stack[this.stack.length-1].children;let H=M[M.length-1];(!H||H.type!=="text")&&(H=qr(),H.position={start:we(y.start),end:void 0},M.push(H)),this.stack.push(H)}function V(y){const _=this.stack.pop();_.value+=this.sliceSerialize(y),_.position.end=we(y.end)}function P(y){const _=this.stack[this.stack.length-1];if(this.data.atHardBreak){const M=_.children[_.children.length-1];M.position.end=we(y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(_.type)&&($.call(this,y),V.call(this,y))}function S(){this.data.atHardBreak=!0}function j(){const y=this.resume(),_=this.stack[this.stack.length-1];_.value=y}function L(){const y=this.resume(),_=this.stack[this.stack.length-1];_.value=y}function b(){const y=this.resume(),_=this.stack[this.stack.length-1];_.value=y}function N(){const y=this.stack[this.stack.length-1];if(this.data.inReference){const _=this.data.referenceType||"shortcut";y.type+="Reference",y.referenceType=_,delete y.url,delete y.title}else delete y.identifier,delete y.label;this.data.referenceType=void 0}function T(){const y=this.stack[this.stack.length-1];if(this.data.inReference){const _=this.data.referenceType||"shortcut";y.type+="Reference",y.referenceType=_,delete y.url,delete y.title}else delete y.identifier,delete y.label;this.data.referenceType=void 0}function O(y){const _=this.sliceSerialize(y),M=this.stack[this.stack.length-2];M.label=na(_),M.identifier=Me(_).toLowerCase()}function Q(){const y=this.stack[this.stack.length-1],_=this.resume(),M=this.stack[this.stack.length-1];if(this.data.inReference=!0,M.type==="link"){const H=y.children;M.children=H}else M.alt=_}function f(){const y=this.resume(),_=this.stack[this.stack.length-1];_.url=y}function le(){const y=this.resume(),_=this.stack[this.stack.length-1];_.title=y}function ue(){this.data.inReference=void 0}function d(){this.data.referenceType="collapsed"}function he(y){const _=this.resume(),M=this.stack[this.stack.length-1];M.label=_,M.identifier=Me(this.sliceSerialize(y)).toLowerCase(),this.data.referenceType="full"}function Ie(y){this.data.characterReferenceType=y.type}function J(y){const _=this.sliceSerialize(y),M=this.data.characterReferenceType;let H;M?(H=pr(_,M==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):H=Yn(_);const Y=this.stack[this.stack.length-1];Y.value+=H}function Oe(y){const _=this.stack.pop();_.position.end=we(y.end)}function be(y){V.call(this,y);const _=this.stack[this.stack.length-1];_.url=this.sliceSerialize(y)}function Te(y){V.call(this,y);const _=this.stack[this.stack.length-1];_.url="mailto:"+this.sliceSerialize(y)}function Le(){return{type:"blockquote",children:[]}}function en(){return{type:"code",lang:null,meta:null,value:""}}function Or(){return{type:"inlineCode",value:""}}function Rr(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Fr(){return{type:"emphasis",children:[]}}function nt(){return{type:"heading",depth:0,children:[]}}function tt(){return{type:"break"}}function rt(){return{type:"html",value:""}}function $r(){return{type:"image",title:null,url:"",alt:null}}function it(){return{type:"link",title:null,url:"",children:[]}}function lt(y){return{type:"list",ordered:y.type==="listOrdered",start:null,spread:y._spread,children:[]}}function Hr(y){return{type:"listItem",spread:y._spread,checked:null,children:[]}}function Vr(){return{type:"paragraph",children:[]}}function Ur(){return{type:"strong",children:[]}}function qr(){return{type:"text",value:""}}function Wr(){return{type:"thematicBreak"}}}function we(e){return{line:e.line,column:e.column,offset:e.offset}}function Cr(e,n){let t=-1;for(;++t<n.length;){const r=n[t];Array.isArray(r)?Cr(e,r):la(e,r)}}function la(e,n){let t;for(t in n)if(wr.call(n,t))switch(t){case"canContainEols":{const r=n[t];r&&e[t].push(...r);break}case"transforms":{const r=n[t];r&&e[t].push(...r);break}case"enter":case"exit":{const r=n[t];r&&Object.assign(e[t],r);break}}}function vt(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Ye({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Ye({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Ye({start:n.start,end:n.end})+") is still open")}function oa(e){const n=this;n.parser=t;function t(r){return ra(r,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function aa(e,n){const t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function sa(e,n){const t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:`
7
+ `;break}case-2:{o=n?" ":" ";break}case-1:{if(!n&&i)continue;o=" ";break}default:o=String.fromCharCode(l)}i=l===-2,r.push(o)}return r.join("")}function Zo(e){const r={constructs:rl([Yo,...(e||{}).extensions||[]]),content:i(pl),defined:[],document:i(fl),flow:i(Ao),lazy:{},string:i(Mo),text:i(Do)};return r;function i(l){return o;function o(a){return Xo(r,l,a)}}}function Jo(e){for(;!mr(e););return e}const Et=/[\0\t\n\r]/g;function Go(){let e=1,n="",t=!0,r;return i;function i(l,o,a){const c=[];let s,u,p,m,h;for(l=n+(typeof l=="string"?l.toString():new TextDecoder(o||void 0).decode(l)),p=0,n="",t&&(l.charCodeAt(0)===65279&&p++,t=void 0);p<l.length;){if(Et.lastIndex=p,s=Et.exec(l),m=s&&s.index!==void 0?s.index:l.length,h=l.charCodeAt(m),!s){n=l.slice(p);break}if(h===10&&p===m&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),p<m&&(c.push(l.slice(p,m)),e+=m-p),h){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}p=m+1}return a&&(r&&c.push(-5),n&&c.push(n),c.push(null)),c}}const ea=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function na(e){return e.replace(ea,ta)}function ta(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){const i=t.charCodeAt(1),l=i===120||i===88;return pr(t.slice(l?2:1),l?16:10)}return Yn(t)||e}const wr={}.hasOwnProperty;function ra(e,n,t){return typeof n!="string"&&(t=n,n=void 0),ia(t)(Jo(Zo(t).document().write(Go()(e,n,!0))))}function ia(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(it),autolinkProtocol:F,autolinkEmail:F,atxHeading:l(nt),blockQuote:l(Le),characterEscape:F,characterReference:F,codeFenced:l(en),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:l(en,o),codeText:l(Or,o),codeTextData:F,data:F,codeFlowValue:F,definition:l(Rr),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:l(Fr),hardBreakEscape:l(tt),hardBreakTrailing:l(tt),htmlFlow:l(rt,o),htmlFlowData:F,htmlText:l(rt,o),htmlTextData:F,image:l($r),label:o,link:l(it),listItem:l(Hr),listItemValue:m,listOrdered:l(lt,p),listUnordered:l(lt),paragraph:l(Vr),reference:d,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:l(nt),strong:l(Ur),thematicBreak:l(Wr)},exit:{atxHeading:c(),atxHeadingSequence:V,autolink:c(),autolinkEmail:Te,autolinkProtocol:be,blockQuote:c(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:Ie,characterReferenceMarkerNumeric:Ie,characterReferenceValue:G,characterReference:Oe,codeFenced:c(E),codeFencedFence:I,codeFencedFenceInfo:h,codeFencedFenceMeta:S,codeFlowValue:$,codeIndented:c(b),codeText:c(x),codeTextData:$,data:$,definition:c(),definitionDestinationString:R,definitionLabelString:P,definitionTitleString:v,emphasis:c(),hardBreakEscape:c(C),hardBreakTrailing:c(C),htmlFlow:c(j),htmlFlowData:$,htmlText:c(T),htmlTextData:$,image:c(L),label:Q,labelText:q,lineEnding:N,link:c(A),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:he,resourceDestinationString:f,resourceTitleString:J,resource:ue,setextHeading:c(U),setextHeadingLineSequence:D,setextHeadingText:k,strong:c(),thematicBreak:c()}};Cr(n,(e||{}).mdastExtensions||[]);const t={};return r;function r(y){let _={type:"root",children:[]};const M={stack:[_],tokenStack:[],config:n,enter:a,exit:s,buffer:o,resume:u,data:t},H=[];let Y=-1;for(;++Y<y.length;)if(y[Y][1].type==="listOrdered"||y[Y][1].type==="listUnordered")if(y[Y][0]==="enter")H.push(Y);else{const fe=H.pop();Y=i(y,fe,Y)}for(Y=-1;++Y<y.length;){const fe=n[y[Y][0]];wr.call(fe,y[Y][1].type)&&fe[y[Y][1].type].call(Object.assign({sliceSerialize:y[Y][2].sliceSerialize},M),y[Y][1])}if(M.tokenStack.length>0){const fe=M.tokenStack[M.tokenStack.length-1];(fe[1]||vt).call(M,void 0,fe[0])}for(_.position={start:we(y.length>0?y[0][1].start:{line:1,column:1,offset:0}),end:we(y.length>0?y[y.length-2][1].end:{line:1,column:1,offset:0})},Y=-1;++Y<n.transforms.length;)_=n.transforms[Y](_)||_;return _}function i(y,_,M){let H=_-1,Y=-1,fe=!1,Ee,xe,Re,Fe;for(;++H<=M;){const oe=y[H];switch(oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{oe[0]==="enter"?Y++:Y--,Fe=void 0;break}case"lineEndingBlank":{oe[0]==="enter"&&(Ee&&!Fe&&!Y&&!Re&&(Re=H),Fe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Fe=void 0}if(!Y&&oe[0]==="enter"&&oe[1].type==="listItemPrefix"||Y===-1&&oe[0]==="exit"&&(oe[1].type==="listUnordered"||oe[1].type==="listOrdered")){if(Ee){let Ne=H;for(xe=void 0;Ne--;){const ke=y[Ne];if(ke[1].type==="lineEnding"||ke[1].type==="lineEndingBlank"){if(ke[0]==="exit")continue;xe&&(y[xe][1].type="lineEndingBlank",fe=!0),ke[1].type="lineEnding",xe=Ne}else if(!(ke[1].type==="linePrefix"||ke[1].type==="blockQuotePrefix"||ke[1].type==="blockQuotePrefixWhitespace"||ke[1].type==="blockQuoteMarker"||ke[1].type==="listItemIndent"))break}Re&&(!xe||Re<xe)&&(Ee._spread=!0),Ee.end=Object.assign({},xe?y[xe][1].start:oe[1].end),y.splice(xe||H,0,["exit",Ee,oe[2]]),H++,M++}if(oe[1].type==="listItemPrefix"){const Ne={type:"listItem",_spread:!1,start:Object.assign({},oe[1].start),end:void 0};Ee=Ne,y.splice(H,0,["enter",Ne,oe[2]]),H++,M++,Re=void 0,Fe=!0}}}return y[_][1]._spread=fe,M}function l(y,_){return M;function M(H){a.call(this,y(H),H),_&&_.call(this,H)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(y,_,M){this.stack[this.stack.length-1].children.push(y),this.stack.push(y),this.tokenStack.push([_,M||void 0]),y.position={start:we(_.start),end:void 0}}function c(y){return _;function _(M){y&&y.call(this,M),s.call(this,M)}}function s(y,_){const M=this.stack.pop(),H=this.tokenStack.pop();if(H)H[0].type!==y.type&&(_?_.call(this,y,H[0]):(H[1]||vt).call(this,y,H[0]));else throw new Error("Cannot close `"+y.type+"` ("+Ye({start:y.start,end:y.end})+"): it’s not open");M.position.end=we(y.end)}function u(){return nl(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(y){if(this.data.expectingFirstListItemValue){const _=this.stack[this.stack.length-2];_.start=Number.parseInt(this.sliceSerialize(y),10),this.data.expectingFirstListItemValue=void 0}}function h(){const y=this.resume(),_=this.stack[this.stack.length-1];_.lang=y}function S(){const y=this.resume(),_=this.stack[this.stack.length-1];_.meta=y}function I(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const y=this.resume(),_=this.stack[this.stack.length-1];_.value=y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const y=this.resume(),_=this.stack[this.stack.length-1];_.value=y.replace(/(\r?\n|\r)$/g,"")}function P(y){const _=this.resume(),M=this.stack[this.stack.length-1];M.label=_,M.identifier=Me(this.sliceSerialize(y)).toLowerCase()}function v(){const y=this.resume(),_=this.stack[this.stack.length-1];_.title=y}function R(){const y=this.resume(),_=this.stack[this.stack.length-1];_.url=y}function V(y){const _=this.stack[this.stack.length-1];if(!_.depth){const M=this.sliceSerialize(y).length;_.depth=M}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function D(y){const _=this.stack[this.stack.length-1];_.depth=this.sliceSerialize(y).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function F(y){const M=this.stack[this.stack.length-1].children;let H=M[M.length-1];(!H||H.type!=="text")&&(H=qr(),H.position={start:we(y.start),end:void 0},M.push(H)),this.stack.push(H)}function $(y){const _=this.stack.pop();_.value+=this.sliceSerialize(y),_.position.end=we(y.end)}function N(y){const _=this.stack[this.stack.length-1];if(this.data.atHardBreak){const M=_.children[_.children.length-1];M.position.end=we(y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(_.type)&&(F.call(this,y),$.call(this,y))}function C(){this.data.atHardBreak=!0}function j(){const y=this.resume(),_=this.stack[this.stack.length-1];_.value=y}function T(){const y=this.resume(),_=this.stack[this.stack.length-1];_.value=y}function x(){const y=this.resume(),_=this.stack[this.stack.length-1];_.value=y}function A(){const y=this.stack[this.stack.length-1];if(this.data.inReference){const _=this.data.referenceType||"shortcut";y.type+="Reference",y.referenceType=_,delete y.url,delete y.title}else delete y.identifier,delete y.label;this.data.referenceType=void 0}function L(){const y=this.stack[this.stack.length-1];if(this.data.inReference){const _=this.data.referenceType||"shortcut";y.type+="Reference",y.referenceType=_,delete y.url,delete y.title}else delete y.identifier,delete y.label;this.data.referenceType=void 0}function q(y){const _=this.sliceSerialize(y),M=this.stack[this.stack.length-2];M.label=na(_),M.identifier=Me(_).toLowerCase()}function Q(){const y=this.stack[this.stack.length-1],_=this.resume(),M=this.stack[this.stack.length-1];if(this.data.inReference=!0,M.type==="link"){const H=y.children;M.children=H}else M.alt=_}function f(){const y=this.resume(),_=this.stack[this.stack.length-1];_.url=y}function J(){const y=this.resume(),_=this.stack[this.stack.length-1];_.title=y}function ue(){this.data.inReference=void 0}function d(){this.data.referenceType="collapsed"}function he(y){const _=this.resume(),M=this.stack[this.stack.length-1];M.label=_,M.identifier=Me(this.sliceSerialize(y)).toLowerCase(),this.data.referenceType="full"}function Ie(y){this.data.characterReferenceType=y.type}function G(y){const _=this.sliceSerialize(y),M=this.data.characterReferenceType;let H;M?(H=pr(_,M==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):H=Yn(_);const Y=this.stack[this.stack.length-1];Y.value+=H}function Oe(y){const _=this.stack.pop();_.position.end=we(y.end)}function be(y){$.call(this,y);const _=this.stack[this.stack.length-1];_.url=this.sliceSerialize(y)}function Te(y){$.call(this,y);const _=this.stack[this.stack.length-1];_.url="mailto:"+this.sliceSerialize(y)}function Le(){return{type:"blockquote",children:[]}}function en(){return{type:"code",lang:null,meta:null,value:""}}function Or(){return{type:"inlineCode",value:""}}function Rr(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Fr(){return{type:"emphasis",children:[]}}function nt(){return{type:"heading",depth:0,children:[]}}function tt(){return{type:"break"}}function rt(){return{type:"html",value:""}}function $r(){return{type:"image",title:null,url:"",alt:null}}function it(){return{type:"link",title:null,url:"",children:[]}}function lt(y){return{type:"list",ordered:y.type==="listOrdered",start:null,spread:y._spread,children:[]}}function Hr(y){return{type:"listItem",spread:y._spread,checked:null,children:[]}}function Vr(){return{type:"paragraph",children:[]}}function Ur(){return{type:"strong",children:[]}}function qr(){return{type:"text",value:""}}function Wr(){return{type:"thematicBreak"}}}function we(e){return{line:e.line,column:e.column,offset:e.offset}}function Cr(e,n){let t=-1;for(;++t<n.length;){const r=n[t];Array.isArray(r)?Cr(e,r):la(e,r)}}function la(e,n){let t;for(t in n)if(wr.call(n,t))switch(t){case"canContainEols":{const r=n[t];r&&e[t].push(...r);break}case"transforms":{const r=n[t];r&&e[t].push(...r);break}case"enter":case"exit":{const r=n[t];r&&Object.assign(e[t],r);break}}}function vt(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Ye({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Ye({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Ye({start:n.start,end:n.end})+") is still open")}function oa(e){const n=this;n.parser=t;function t(r){return ra(r,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function aa(e,n){const t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function sa(e,n){const t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:`
8
8
  `}]}function ua(e,n){const t=n.value?n.value+`
9
9
  `:"",r={},i=n.lang?n.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:t}]};return n.meta&&(l.data={meta:n.meta}),e.patch(n,l),l=e.applyData(n,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(n,l),l}function ca(e,n){const t={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function pa(e,n){const t={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function ha(e,n){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(n.identifier).toUpperCase(),i=Be(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=l+1,a+=1,e.footnoteCounts.set(r,a);const c={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+i,id:t+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(n,c);const s={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(n,s),e.applyData(n,s)}function fa(e,n){const t={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function da(e,n){if(e.options.allowDangerousHtml){const t={type:"raw",value:n.value};return e.patch(n,t),e.applyData(n,t)}}function Sr(e,n){const t=n.referenceType;let r="]";if(t==="collapsed"?r+="[]":t==="full"&&(r+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+r}];const i=e.all(n),l=i[0];l&&l.type==="text"?l.value="["+l.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function ma(e,n){const t=String(n.identifier).toUpperCase(),r=e.definitionById.get(t);if(!r)return Sr(e,n);const i={src:Be(r.url||""),alt:n.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(n,l),e.applyData(n,l)}function ga(e,n){const t={src:Be(n.url)};n.alt!==null&&n.alt!==void 0&&(t.alt=n.alt),n.title!==null&&n.title!==void 0&&(t.title=n.title);const r={type:"element",tagName:"img",properties:t,children:[]};return e.patch(n,r),e.applyData(n,r)}function ya(e,n){const t={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,t);const r={type:"element",tagName:"code",properties:{},children:[t]};return e.patch(n,r),e.applyData(n,r)}function xa(e,n){const t=String(n.identifier).toUpperCase(),r=e.definitionById.get(t);if(!r)return Sr(e,n);const i={href:Be(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const l={type:"element",tagName:"a",properties:i,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function ka(e,n){const t={href:Be(n.url)};n.title!==null&&n.title!==void 0&&(t.title=n.title);const r={type:"element",tagName:"a",properties:t,children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ba(e,n,t){const r=e.all(n),i=t?wa(t):_r(n),l={},o=[];if(typeof n.checked=="boolean"){const u=r[0];let p;u&&u.type==="element"&&u.tagName==="p"?p=u:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
10
10
  `}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
11
- `});const s={type:"element",tagName:"li",properties:l,children:o};return e.patch(n,s),e.applyData(n,s)}function wa(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const t=e.children;let r=-1;for(;!n&&++r<t.length;)n=_r(t[r])}return n}function _r(e){const n=e.spread;return n??e.children.length>1}function Ca(e,n){const t={},r=e.all(n);let i=-1;for(typeof n.start=="number"&&n.start!==1&&(t.start=n.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){t.className=["contains-task-list"];break}}const l={type:"element",tagName:n.ordered?"ol":"ul",properties:t,children:e.wrap(r,!0)};return e.patch(n,l),e.applyData(n,l)}function Sa(e,n){const t={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function _a(e,n){const t={type:"root",children:e.wrap(e.all(n))};return e.patch(n,t),e.applyData(n,t)}function Ia(e,n){const t={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Ea(e,n){const t=e.all(n),r=t.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(n.children[0],o),i.push(o)}if(t.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(t,!0)},a=Vn(n.children[1]),c=ir(n.children[n.children.length-1]);a&&c&&(o.position={start:a,end:c}),i.push(o)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(n,l),e.applyData(n,l)}function va(e,n,t){const r=t?t.children:void 0,l=(r?r.indexOf(n):1)===0?"th":"td",o=t&&t.type==="table"?t.align:void 0,a=o?o.length:n.children.length;let c=-1;const s=[];for(;++c<a;){const p=n.children[c],m={},h=o?o[c]:void 0;h&&(m.align=h);let C={type:"element",tagName:l,properties:m,children:[]};p&&(C.children=e.all(p),e.patch(p,C),C=e.applyData(p,C)),s.push(C)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(s,!0)};return e.patch(n,u),e.applyData(n,u)}function Ta(e,n){const t={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}const Tt=9,Lt=32;function La(e){const n=String(e),t=/\r?\n|\r/g;let r=t.exec(n),i=0;const l=[];for(;r;)l.push(Pt(n.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=t.exec(n);return l.push(Pt(n.slice(i),i>0,!1)),l.join("")}function Pt(e,n,t){let r=0,i=e.length;if(n){let l=e.codePointAt(r);for(;l===Tt||l===Lt;)r++,l=e.codePointAt(r)}if(t){let l=e.codePointAt(i-1);for(;l===Tt||l===Lt;)i--,l=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Pa(e,n){const t={type:"text",value:La(String(n.value))};return e.patch(n,t),e.applyData(n,t)}function Na(e,n){const t={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,t),e.applyData(n,t)}const Aa={blockquote:aa,break:sa,code:ua,delete:ca,emphasis:pa,footnoteReference:ha,heading:fa,html:da,imageReference:ma,image:ga,inlineCode:ya,linkReference:xa,link:ka,listItem:ba,list:Ca,paragraph:Sa,root:_a,strong:Ia,table:Ea,tableCell:Ta,tableRow:va,text:Pa,thematicBreak:Na,toml:nn,yaml:nn,definition:nn,footnoteDefinition:nn};function nn(){}const Ir=-1,hn=0,Ke=1,un=2,Qn=3,Zn=4,Jn=5,Gn=6,Er=7,vr=8,Nt=typeof self=="object"?self:globalThis,ja=(e,n)=>{const t=(i,l)=>(e.set(l,i),i),r=i=>{if(e.has(i))return e.get(i);const[l,o]=n[i];switch(l){case hn:case Ir:return t(o,i);case Ke:{const a=t([],i);for(const c of o)a.push(r(c));return a}case un:{const a=t({},i);for(const[c,s]of o)a[r(c)]=r(s);return a}case Qn:return t(new Date(o),i);case Zn:{const{source:a,flags:c}=o;return t(new RegExp(a,c),i)}case Jn:{const a=t(new Map,i);for(const[c,s]of o)a.set(r(c),r(s));return a}case Gn:{const a=t(new Set,i);for(const c of o)a.add(r(c));return a}case Er:{const{name:a,message:c}=o;return t(new Nt[a](c),i)}case vr:return t(BigInt(o),i);case"BigInt":return t(Object(BigInt(o)),i);case"ArrayBuffer":return t(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return t(new DataView(a),o)}}return t(new Nt[l](o),i)};return r},At=e=>ja(new Map,e)(0),Ae="",{toString:za}={},{keys:Ma}=Object,qe=e=>{const n=typeof e;if(n!=="object"||!e)return[hn,n];const t=za.call(e).slice(8,-1);switch(t){case"Array":return[Ke,Ae];case"Object":return[un,Ae];case"Date":return[Qn,Ae];case"RegExp":return[Zn,Ae];case"Map":return[Jn,Ae];case"Set":return[Gn,Ae];case"DataView":return[Ke,t]}return t.includes("Array")?[Ke,t]:t.includes("Error")?[Er,t]:[un,t]},tn=([e,n])=>e===hn&&(n==="function"||n==="symbol"),Da=(e,n,t,r)=>{const i=(o,a)=>{const c=r.push(o)-1;return t.set(a,c),c},l=o=>{if(t.has(o))return t.get(o);let[a,c]=qe(o);switch(a){case hn:{let u=o;switch(c){case"bigint":a=vr,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return i([Ir],o)}return i([a,u],o)}case Ke:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),i([c,[...m]],o)}const u=[],p=i([a,u],o);for(const m of o)u.push(l(m));return p}case un:{if(c)switch(c){case"BigInt":return i([c,o.toString()],o);case"Boolean":case"Number":case"String":return i([c,o.valueOf()],o)}if(n&&"toJSON"in o)return l(o.toJSON());const u=[],p=i([a,u],o);for(const m of Ma(o))(e||!tn(qe(o[m])))&&u.push([l(m),l(o[m])]);return p}case Qn:return i([a,o.toISOString()],o);case Zn:{const{source:u,flags:p}=o;return i([a,{source:u,flags:p}],o)}case Jn:{const u=[],p=i([a,u],o);for(const[m,h]of o)(e||!(tn(qe(m))||tn(qe(h))))&&u.push([l(m),l(h)]);return p}case Gn:{const u=[],p=i([a,u],o);for(const m of o)(e||!tn(qe(m)))&&u.push(l(m));return p}}const{message:s}=o;return i([a,{name:c,message:s}],o)};return l},jt=(e,{json:n,lossy:t}={})=>{const r=[];return Da(!(n||t),!!n,new Map,r)(e),r},cn=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?At(jt(e,n)):structuredClone(e):(e,n)=>At(jt(e,n));function Ba(e,n){const t=[{type:"text",value:"↩"}];return n>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),t}function Oa(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function Ra(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",t=e.options.footnoteBackContent||Ba,r=e.options.footnoteBackLabel||Oa,i=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const s=e.footnoteById.get(e.footnoteOrder[c]);if(!s)continue;const u=e.all(s),p=String(s.identifier).toUpperCase(),m=Be(p.toLowerCase());let h=0;const C=[],E=e.footnoteCounts.get(p);for(;E!==void 0&&++h<=E;){C.length>0&&C.push({type:"text",value:" "});let A=typeof t=="string"?t:t(c,h);typeof A=="string"&&(A={type:"text",value:A}),C.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+m+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const I=u[u.length-1];if(I&&I.type==="element"&&I.tagName==="p"){const A=I.children[I.children.length-1];A&&A.type==="text"?A.value+=" ":I.children.push({type:"text",value:" "}),I.children.push(...C)}else u.push(...C);const x={type:"element",tagName:"li",properties:{id:n+"fn-"+m},children:e.wrap(u,!0)};e.patch(s,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...cn(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
11
+ `});const s={type:"element",tagName:"li",properties:l,children:o};return e.patch(n,s),e.applyData(n,s)}function wa(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const t=e.children;let r=-1;for(;!n&&++r<t.length;)n=_r(t[r])}return n}function _r(e){const n=e.spread;return n??e.children.length>1}function Ca(e,n){const t={},r=e.all(n);let i=-1;for(typeof n.start=="number"&&n.start!==1&&(t.start=n.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){t.className=["contains-task-list"];break}}const l={type:"element",tagName:n.ordered?"ol":"ul",properties:t,children:e.wrap(r,!0)};return e.patch(n,l),e.applyData(n,l)}function Sa(e,n){const t={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function _a(e,n){const t={type:"root",children:e.wrap(e.all(n))};return e.patch(n,t),e.applyData(n,t)}function Ia(e,n){const t={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Ea(e,n){const t=e.all(n),r=t.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(n.children[0],o),i.push(o)}if(t.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(t,!0)},a=Vn(n.children[1]),c=ir(n.children[n.children.length-1]);a&&c&&(o.position={start:a,end:c}),i.push(o)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(n,l),e.applyData(n,l)}function va(e,n,t){const r=t?t.children:void 0,l=(r?r.indexOf(n):1)===0?"th":"td",o=t&&t.type==="table"?t.align:void 0,a=o?o.length:n.children.length;let c=-1;const s=[];for(;++c<a;){const p=n.children[c],m={},h=o?o[c]:void 0;h&&(m.align=h);let S={type:"element",tagName:l,properties:m,children:[]};p&&(S.children=e.all(p),e.patch(p,S),S=e.applyData(p,S)),s.push(S)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(s,!0)};return e.patch(n,u),e.applyData(n,u)}function Ta(e,n){const t={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}const Tt=9,Lt=32;function La(e){const n=String(e),t=/\r?\n|\r/g;let r=t.exec(n),i=0;const l=[];for(;r;)l.push(Nt(n.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=t.exec(n);return l.push(Nt(n.slice(i),i>0,!1)),l.join("")}function Nt(e,n,t){let r=0,i=e.length;if(n){let l=e.codePointAt(r);for(;l===Tt||l===Lt;)r++,l=e.codePointAt(r)}if(t){let l=e.codePointAt(i-1);for(;l===Tt||l===Lt;)i--,l=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Na(e,n){const t={type:"text",value:La(String(n.value))};return e.patch(n,t),e.applyData(n,t)}function Pa(e,n){const t={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,t),e.applyData(n,t)}const Aa={blockquote:aa,break:sa,code:ua,delete:ca,emphasis:pa,footnoteReference:ha,heading:fa,html:da,imageReference:ma,image:ga,inlineCode:ya,linkReference:xa,link:ka,listItem:ba,list:Ca,paragraph:Sa,root:_a,strong:Ia,table:Ea,tableCell:Ta,tableRow:va,text:Na,thematicBreak:Pa,toml:nn,yaml:nn,definition:nn,footnoteDefinition:nn};function nn(){}const Ir=-1,hn=0,Ke=1,un=2,Qn=3,Zn=4,Jn=5,Gn=6,Er=7,vr=8,Pt=typeof self=="object"?self:globalThis,ja=(e,n)=>{const t=(i,l)=>(e.set(l,i),i),r=i=>{if(e.has(i))return e.get(i);const[l,o]=n[i];switch(l){case hn:case Ir:return t(o,i);case Ke:{const a=t([],i);for(const c of o)a.push(r(c));return a}case un:{const a=t({},i);for(const[c,s]of o)a[r(c)]=r(s);return a}case Qn:return t(new Date(o),i);case Zn:{const{source:a,flags:c}=o;return t(new RegExp(a,c),i)}case Jn:{const a=t(new Map,i);for(const[c,s]of o)a.set(r(c),r(s));return a}case Gn:{const a=t(new Set,i);for(const c of o)a.add(r(c));return a}case Er:{const{name:a,message:c}=o;return t(new Pt[a](c),i)}case vr:return t(BigInt(o),i);case"BigInt":return t(Object(BigInt(o)),i);case"ArrayBuffer":return t(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return t(new DataView(a),o)}}return t(new Pt[l](o),i)};return r},At=e=>ja(new Map,e)(0),Ae="",{toString:za}={},{keys:Ma}=Object,qe=e=>{const n=typeof e;if(n!=="object"||!e)return[hn,n];const t=za.call(e).slice(8,-1);switch(t){case"Array":return[Ke,Ae];case"Object":return[un,Ae];case"Date":return[Qn,Ae];case"RegExp":return[Zn,Ae];case"Map":return[Jn,Ae];case"Set":return[Gn,Ae];case"DataView":return[Ke,t]}return t.includes("Array")?[Ke,t]:t.includes("Error")?[Er,t]:[un,t]},tn=([e,n])=>e===hn&&(n==="function"||n==="symbol"),Da=(e,n,t,r)=>{const i=(o,a)=>{const c=r.push(o)-1;return t.set(a,c),c},l=o=>{if(t.has(o))return t.get(o);let[a,c]=qe(o);switch(a){case hn:{let u=o;switch(c){case"bigint":a=vr,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return i([Ir],o)}return i([a,u],o)}case Ke:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),i([c,[...m]],o)}const u=[],p=i([a,u],o);for(const m of o)u.push(l(m));return p}case un:{if(c)switch(c){case"BigInt":return i([c,o.toString()],o);case"Boolean":case"Number":case"String":return i([c,o.valueOf()],o)}if(n&&"toJSON"in o)return l(o.toJSON());const u=[],p=i([a,u],o);for(const m of Ma(o))(e||!tn(qe(o[m])))&&u.push([l(m),l(o[m])]);return p}case Qn:return i([a,o.toISOString()],o);case Zn:{const{source:u,flags:p}=o;return i([a,{source:u,flags:p}],o)}case Jn:{const u=[],p=i([a,u],o);for(const[m,h]of o)(e||!(tn(qe(m))||tn(qe(h))))&&u.push([l(m),l(h)]);return p}case Gn:{const u=[],p=i([a,u],o);for(const m of o)(e||!tn(qe(m)))&&u.push(l(m));return p}}const{message:s}=o;return i([a,{name:c,message:s}],o)};return l},jt=(e,{json:n,lossy:t}={})=>{const r=[];return Da(!(n||t),!!n,new Map,r)(e),r},cn=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?At(jt(e,n)):structuredClone(e):(e,n)=>At(jt(e,n));function Ba(e,n){const t=[{type:"text",value:"↩"}];return n>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),t}function Oa(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function Ra(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",t=e.options.footnoteBackContent||Ba,r=e.options.footnoteBackLabel||Oa,i=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const s=e.footnoteById.get(e.footnoteOrder[c]);if(!s)continue;const u=e.all(s),p=String(s.identifier).toUpperCase(),m=Be(p.toLowerCase());let h=0;const S=[],I=e.footnoteCounts.get(p);for(;I!==void 0&&++h<=I;){S.length>0&&S.push({type:"text",value:" "});let P=typeof t=="string"?t:t(c,h);typeof P=="string"&&(P={type:"text",value:P}),S.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+m+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(P)?P:[P]})}const E=u[u.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const P=E.children[E.children.length-1];P&&P.type==="text"?P.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...S)}else u.push(...S);const b={type:"element",tagName:"li",properties:{id:n+"fn-"+m},children:e.wrap(u,!0)};e.patch(s,b),a.push(b)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...cn(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
12
12
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
13
- `}]}}const Tr=(function(e){if(e==null)return Va;if(typeof e=="function")return fn(e);if(typeof e=="object")return Array.isArray(e)?Fa(e):$a(e);if(typeof e=="string")return Ha(e);throw new Error("Expected function, string, or object as test")});function Fa(e){const n=[];let t=-1;for(;++t<e.length;)n[t]=Tr(e[t]);return fn(r);function r(...i){let l=-1;for(;++l<n.length;)if(n[l].apply(this,i))return!0;return!1}}function $a(e){const n=e;return fn(t);function t(r){const i=r;let l;for(l in e)if(i[l]!==n[l])return!1;return!0}}function Ha(e){return fn(n);function n(t){return t&&t.type===e}}function fn(e){return n;function n(t,r,i){return!!(Ua(t)&&e.call(this,t,typeof r=="number"?r:void 0,i||void 0))}}function Va(){return!0}function Ua(e){return e!==null&&typeof e=="object"&&"type"in e}const Lr=[],qa=!0,zt=!1,Wa="skip";function Ya(e,n,t,r){let i;typeof n=="function"&&typeof t!="function"?(r=t,t=n):i=n;const l=Tr(i),o=r?-1:1;a(e,void 0,[])();function a(c,s,u){const p=c&&typeof c=="object"?c:{};if(typeof p.type=="string"){const h=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return m;function m(){let h=Lr,C,E,I;if((!n||l(c,s,u[u.length-1]||void 0))&&(h=Xa(t(c,u)),h[0]===zt))return h;if("children"in c&&c.children){const x=c;if(x.children&&h[0]!==Wa)for(E=(r?x.children.length:-1)+o,I=u.concat(x);E>-1&&E<x.children.length;){const A=x.children[E];if(C=a(A,E,I)(),C[0]===zt)return C;E=typeof C[1]=="number"?C[1]:E+o}}return h}}}function Xa(e){return Array.isArray(e)?e:typeof e=="number"?[qa,e]:e==null?Lr:[e]}function Pr(e,n,t,r){let i,l,o;typeof n=="function"&&typeof t!="function"?(l=void 0,o=n,i=t):(l=n,o=t,i=r),Ya(e,l,a,i);function a(c,s){const u=s[s.length-1],p=u?u.children.indexOf(c):void 0;return o(c,p,u)}}const Dn={}.hasOwnProperty,Ka={};function Qa(e,n){const t=n||Ka,r=new Map,i=new Map,l=new Map,o={...Aa,...t.handlers},a={all:s,applyData:Ja,definitionById:r,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:o,one:c,options:t,patch:Za,wrap:es};return Pr(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const p=u.type==="definition"?r:i,m=String(u.identifier).toUpperCase();p.has(m)||p.set(m,u)}}),a;function c(u,p){const m=u.type,h=a.handlers[m];if(Dn.call(a.handlers,m)&&h)return h(a,u,p);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in u){const{children:E,...I}=u,x=cn(I);return x.children=a.all(u),x}return cn(u)}return(a.options.unknownHandler||Ga)(a,u,p)}function s(u){const p=[];if("children"in u){const m=u.children;let h=-1;for(;++h<m.length;){const C=a.one(m[h],u);if(C){if(h&&m[h-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=Mt(C.value)),!Array.isArray(C)&&C.type==="element")){const E=C.children[0];E&&E.type==="text"&&(E.value=Mt(E.value))}Array.isArray(C)?p.push(...C):p.push(C)}}}return p}}function Za(e,n){e.position&&(n.position=ji(e))}function Ja(e,n){let t=n;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,l=e.data.hProperties;if(typeof r=="string")if(t.type==="element")t.tagName=r;else{const o="children"in t?t.children:[t];t={type:"element",tagName:r,properties:{},children:o}}t.type==="element"&&l&&Object.assign(t.properties,cn(l)),"children"in t&&t.children&&i!==null&&i!==void 0&&(t.children=i)}return t}function Ga(e,n){const t=n.data||{},r="value"in n&&!(Dn.call(t,"hProperties")||Dn.call(t,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function es(e,n){const t=[];let r=-1;for(n&&t.push({type:"text",value:`
13
+ `}]}}const Tr=(function(e){if(e==null)return Va;if(typeof e=="function")return fn(e);if(typeof e=="object")return Array.isArray(e)?Fa(e):$a(e);if(typeof e=="string")return Ha(e);throw new Error("Expected function, string, or object as test")});function Fa(e){const n=[];let t=-1;for(;++t<e.length;)n[t]=Tr(e[t]);return fn(r);function r(...i){let l=-1;for(;++l<n.length;)if(n[l].apply(this,i))return!0;return!1}}function $a(e){const n=e;return fn(t);function t(r){const i=r;let l;for(l in e)if(i[l]!==n[l])return!1;return!0}}function Ha(e){return fn(n);function n(t){return t&&t.type===e}}function fn(e){return n;function n(t,r,i){return!!(Ua(t)&&e.call(this,t,typeof r=="number"?r:void 0,i||void 0))}}function Va(){return!0}function Ua(e){return e!==null&&typeof e=="object"&&"type"in e}const Lr=[],qa=!0,zt=!1,Wa="skip";function Ya(e,n,t,r){let i;typeof n=="function"&&typeof t!="function"?(r=t,t=n):i=n;const l=Tr(i),o=r?-1:1;a(e,void 0,[])();function a(c,s,u){const p=c&&typeof c=="object"?c:{};if(typeof p.type=="string"){const h=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return m;function m(){let h=Lr,S,I,E;if((!n||l(c,s,u[u.length-1]||void 0))&&(h=Xa(t(c,u)),h[0]===zt))return h;if("children"in c&&c.children){const b=c;if(b.children&&h[0]!==Wa)for(I=(r?b.children.length:-1)+o,E=u.concat(b);I>-1&&I<b.children.length;){const P=b.children[I];if(S=a(P,I,E)(),S[0]===zt)return S;I=typeof S[1]=="number"?S[1]:I+o}}return h}}}function Xa(e){return Array.isArray(e)?e:typeof e=="number"?[qa,e]:e==null?Lr:[e]}function Nr(e,n,t,r){let i,l,o;typeof n=="function"&&typeof t!="function"?(l=void 0,o=n,i=t):(l=n,o=t,i=r),Ya(e,l,a,i);function a(c,s){const u=s[s.length-1],p=u?u.children.indexOf(c):void 0;return o(c,p,u)}}const Dn={}.hasOwnProperty,Ka={};function Qa(e,n){const t=n||Ka,r=new Map,i=new Map,l=new Map,o={...Aa,...t.handlers},a={all:s,applyData:Ja,definitionById:r,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:o,one:c,options:t,patch:Za,wrap:es};return Nr(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const p=u.type==="definition"?r:i,m=String(u.identifier).toUpperCase();p.has(m)||p.set(m,u)}}),a;function c(u,p){const m=u.type,h=a.handlers[m];if(Dn.call(a.handlers,m)&&h)return h(a,u,p);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in u){const{children:I,...E}=u,b=cn(E);return b.children=a.all(u),b}return cn(u)}return(a.options.unknownHandler||Ga)(a,u,p)}function s(u){const p=[];if("children"in u){const m=u.children;let h=-1;for(;++h<m.length;){const S=a.one(m[h],u);if(S){if(h&&m[h-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=Mt(S.value)),!Array.isArray(S)&&S.type==="element")){const I=S.children[0];I&&I.type==="text"&&(I.value=Mt(I.value))}Array.isArray(S)?p.push(...S):p.push(S)}}}return p}}function Za(e,n){e.position&&(n.position=ji(e))}function Ja(e,n){let t=n;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,l=e.data.hProperties;if(typeof r=="string")if(t.type==="element")t.tagName=r;else{const o="children"in t?t.children:[t];t={type:"element",tagName:r,properties:{},children:o}}t.type==="element"&&l&&Object.assign(t.properties,cn(l)),"children"in t&&t.children&&i!==null&&i!==void 0&&(t.children=i)}return t}function Ga(e,n){const t=n.data||{},r="value"in n&&!(Dn.call(t,"hProperties")||Dn.call(t,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function es(e,n){const t=[];let r=-1;for(n&&t.push({type:"text",value:`
14
14
  `});++r<e.length;)r&&t.push({type:"text",value:`
15
15
  `}),t.push(e[r]);return n&&e.length>0&&t.push({type:"text",value:`
16
16
  `}),t}function Mt(e){let n=0,t=e.charCodeAt(n);for(;t===9||t===32;)n++,t=e.charCodeAt(n);return e.slice(n)}function Dt(e,n){const t=Qa(e,n),r=t.one(e,void 0),i=Ra(t),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
17
- `},i),l}function ns(e,n){return e&&"run"in e?async function(t,r){const i=Dt(t,{file:r,...n});await e.run(i,r)}:function(t,r){return Dt(t,{file:r,...e||n})}}function Bt(e){if(e)throw e}var kn,Ot;function ts(){if(Ot)return kn;Ot=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(s){return typeof Array.isArray=="function"?Array.isArray(s):n.call(s)==="[object Array]"},l=function(s){if(!s||n.call(s)!=="[object Object]")return!1;var u=e.call(s,"constructor"),p=s.constructor&&s.constructor.prototype&&e.call(s.constructor.prototype,"isPrototypeOf");if(s.constructor&&!u&&!p)return!1;var m;for(m in s);return typeof m>"u"||e.call(s,m)},o=function(s,u){t&&u.name==="__proto__"?t(s,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):s[u.name]=u.newValue},a=function(s,u){if(u==="__proto__")if(e.call(s,u)){if(r)return r(s,u).value}else return;return s[u]};return kn=function c(){var s,u,p,m,h,C,E=arguments[0],I=1,x=arguments.length,A=!1;for(typeof E=="boolean"&&(A=E,E=arguments[1]||{},I=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});I<x;++I)if(s=arguments[I],s!=null)for(u in s)p=a(E,u),m=a(s,u),E!==m&&(A&&m&&(l(m)||(h=i(m)))?(h?(h=!1,C=p&&i(p)?p:[]):C=p&&l(p)?p:{},o(E,{name:u,newValue:c(A,C,m)})):typeof m<"u"&&o(E,{name:u,newValue:m}));return E},kn}var rs=ts();const bn=rr(rs);function Bn(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function is(){const e=[],n={run:t,use:r};return n;function t(...i){let l=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(c,...s){const u=e[++l];let p=-1;if(c){o(c);return}for(;++p<i.length;)(s[p]===null||s[p]===void 0)&&(s[p]=i[p]);i=s,u?ls(u,a)(...s):o(null,...s)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),n}}function ls(e,n){let t;return r;function r(...o){const a=e.length>o.length;let c;a&&o.push(i);try{c=e.apply(this,o)}catch(s){const u=s;if(a&&t)throw u;return i(u)}a||(c&&c.then&&typeof c.then=="function"?c.then(l,i):c instanceof Error?i(c):l(c))}function i(o,...a){t||(t=!0,n(o,...a))}function l(o){i(null,o)}}const me={basename:os,dirname:as,extname:ss,join:us,sep:"/"};function os(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Ge(e);let t=0,r=-1,i=e.length,l;if(n===void 0||n.length===0||n.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){t=i+1;break}}else r<0&&(l=!0,r=i+1);return r<0?"":e.slice(t,r)}if(n===e)return"";let o=-1,a=n.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){t=i+1;break}}else o<0&&(l=!0,o=i+1),a>-1&&(e.codePointAt(i)===n.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return t===r?r=o:r<0&&(r=e.length),e.slice(t,r)}function as(e){if(Ge(e),e.length===0)return".";let n=-1,t=e.length,r;for(;--t;)if(e.codePointAt(t)===47){if(r){n=t;break}}else r||(r=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function ss(e){Ge(e);let n=e.length,t=-1,r=0,i=-1,l=0,o;for(;n--;){const a=e.codePointAt(n);if(a===47){if(o){r=n+1;break}continue}t<0&&(o=!0,t=n+1),a===46?i<0?i=n:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||t<0||l===0||l===1&&i===t-1&&i===r+1?"":e.slice(i,t)}function us(...e){let n=-1,t;for(;++n<e.length;)Ge(e[n]),e[n]&&(t=t===void 0?e[n]:t+"/"+e[n]);return t===void 0?".":cs(t)}function cs(e){Ge(e);const n=e.codePointAt(0)===47;let t=ps(e,!n);return t.length===0&&!n&&(t="."),t.length>0&&e.codePointAt(e.length-1)===47&&(t+="/"),n?"/"+t:t}function ps(e,n){let t="",r=0,i=-1,l=0,o=-1,a,c;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||l===1))if(i!==o-1&&l===2){if(t.length<2||r!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(c=t.lastIndexOf("/"),c!==t.length-1){c<0?(t="",r=0):(t=t.slice(0,c),r=t.length-1-t.lastIndexOf("/")),i=o,l=0;continue}}else if(t.length>0){t="",r=0,i=o,l=0;continue}}n&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+e.slice(i+1,o):t=e.slice(i+1,o),r=o-i-1;i=o,l=0}else a===46&&l>-1?l++:l=-1}return t}function Ge(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const hs={cwd:fs};function fs(){return"/"}function On(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ds(e){if(typeof e=="string")e=new URL(e);else if(!On(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return ms(e)}function ms(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let t=-1;for(;++t<n.length;)if(n.codePointAt(t)===37&&n.codePointAt(t+1)===50){const r=n.codePointAt(t+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(n)}const wn=["history","path","basename","stem","extname","dirname"];class Nr{constructor(n){let t;n?On(n)?t={path:n}:typeof n=="string"||gs(n)?t={value:n}:t=n:t={},this.cwd="cwd"in t?"":hs.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<wn.length;){const l=wn[r];l in t&&t[l]!==void 0&&t[l]!==null&&(this[l]=l==="history"?[...t[l]]:t[l])}let i;for(i in t)wn.includes(i)||(this[i]=t[i])}get basename(){return typeof this.path=="string"?me.basename(this.path):void 0}set basename(n){Sn(n,"basename"),Cn(n,"basename"),this.path=me.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?me.dirname(this.path):void 0}set dirname(n){Rt(this.basename,"dirname"),this.path=me.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?me.extname(this.path):void 0}set extname(n){if(Cn(n,"extname"),Rt(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=me.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){On(n)&&(n=ds(n)),Sn(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?me.basename(this.path,this.extname):void 0}set stem(n){Sn(n,"stem"),Cn(n,"stem"),this.path=me.join(this.dirname||"",n+(this.extname||""))}fail(n,t,r){const i=this.message(n,t,r);throw i.fatal=!0,i}info(n,t,r){const i=this.message(n,t,r);return i.fatal=void 0,i}message(n,t,r){const i=new ne(n,t,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function Cn(e,n){if(e&&e.includes(me.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+me.sep+"`")}function Sn(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function Rt(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function gs(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ys=(function(e){const r=this.constructor.prototype,i=r[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,r),l}),xs={}.hasOwnProperty;class et extends ys{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=is()}copy(){const n=new et;let t=-1;for(;++t<this.attachers.length;){const r=this.attachers[t];n.use(...r)}return n.data(bn(!0,{},this.namespace)),n}data(n,t){return typeof n=="string"?arguments.length===2?(En("data",this.frozen),this.namespace[n]=t,this):xs.call(this.namespace,n)&&this.namespace[n]||void 0:n?(En("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=t.call(n,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const t=rn(n),r=this.parser||this.Parser;return _n("parse",r),r(String(t),t)}process(n,t){const r=this;return this.freeze(),_n("process",this.parser||this.Parser),In("process",this.compiler||this.Compiler),t?i(void 0,t):new Promise(i);function i(l,o){const a=rn(n),c=r.parse(a);r.run(c,a,function(u,p,m){if(u||!p||!m)return s(u);const h=p,C=r.stringify(h,m);ws(C)?m.value=C:m.result=C,s(u,m)});function s(u,p){u||!p?o(u):l?l(p):t(void 0,p)}}}processSync(n){let t=!1,r;return this.freeze(),_n("processSync",this.parser||this.Parser),In("processSync",this.compiler||this.Compiler),this.process(n,i),$t("processSync","process",t),r;function i(l,o){t=!0,Bt(l),r=o}}run(n,t,r){Ft(n),this.freeze();const i=this.transformers;return!r&&typeof t=="function"&&(r=t,t=void 0),r?l(void 0,r):new Promise(l);function l(o,a){const c=rn(t);i.run(n,c,s);function s(u,p,m){const h=p||n;u?a(u):o?o(h):r(void 0,h,m)}}}runSync(n,t){let r=!1,i;return this.run(n,t,l),$t("runSync","run",r),i;function l(o,a){Bt(o),i=a,r=!0}}stringify(n,t){this.freeze();const r=rn(t),i=this.compiler||this.Compiler;return In("stringify",i),Ft(n),i(n,r)}use(n,...t){const r=this.attachers,i=this.namespace;if(En("use",this.frozen),n!=null)if(typeof n=="function")c(n,t);else if(typeof n=="object")Array.isArray(n)?a(n):o(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function l(s){if(typeof s=="function")c(s,[]);else if(typeof s=="object")if(Array.isArray(s)){const[u,...p]=s;c(u,p)}else o(s);else throw new TypeError("Expected usable value, not `"+s+"`")}function o(s){if(!("plugins"in s)&&!("settings"in s))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");a(s.plugins),s.settings&&(i.settings=bn(!0,i.settings,s.settings))}function a(s){let u=-1;if(s!=null)if(Array.isArray(s))for(;++u<s.length;){const p=s[u];l(p)}else throw new TypeError("Expected a list of plugins, not `"+s+"`")}function c(s,u){let p=-1,m=-1;for(;++p<r.length;)if(r[p][0]===s){m=p;break}if(m===-1)r.push([s,...u]);else if(u.length>0){let[h,...C]=u;const E=r[m][1];Bn(E)&&Bn(h)&&(h=bn(!0,E,h)),r[m]=[s,h,...C]}}}}const ks=new et().freeze();function _n(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function In(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function En(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ft(e){if(!Bn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $t(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function rn(e){return bs(e)?e:new Nr(e)}function bs(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ws(e){return typeof e=="string"||Cs(e)}function Cs(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ss="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ht=[],Vt={allowDangerousHtml:!0},_s=/^(https?|ircs?|mailto|xmpp)$/i,Is=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Es(e){const n=vs(e),t=Ts(e);return Ls(n.runSync(n.parse(t),t),e)}function vs(e){const n=e.rehypePlugins||Ht,t=e.remarkPlugins||Ht,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Vt}:Vt;return ks().use(oa).use(t).use(ns,r).use(n)}function Ts(e){const n=e.children||"",t=new Nr;return typeof n=="string"&&(t.value=n),t}function Ls(e,n){const t=n.allowedElements,r=n.allowElement,i=n.components,l=n.disallowedElements,o=n.skipHtml,a=n.unwrapDisallowed,c=n.urlTransform||Ps;for(const u of Is)Object.hasOwn(n,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+Ss+u.id,void 0);return Pr(e,s),Oi(e,{Fragment:g.Fragment,components:i,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function s(u,p,m){if(u.type==="raw"&&m&&typeof p=="number")return o?m.children.splice(p,1):m.children[p]={type:"text",value:u.value},p;if(u.type==="element"){let h;for(h in gn)if(Object.hasOwn(gn,h)&&Object.hasOwn(u.properties,h)){const C=u.properties[h],E=gn[h];(E===null||E.includes(u.tagName))&&(u.properties[h]=c(String(C||""),h,u))}}if(u.type==="element"){let h=t?!t.includes(u.tagName):l?l.includes(u.tagName):!1;if(!h&&r&&typeof p=="number"&&(h=!r(u,p,m)),h&&m&&typeof p=="number")return a&&u.children?m.children.splice(p,1,...u.children):m.children.splice(p,1),p}}}function Ps(e){const n=e.indexOf(":"),t=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return n===-1||i!==-1&&n>i||t!==-1&&n>t||r!==-1&&n>r||_s.test(e.slice(0,n))?e:""}const Ns="_messageWrapper_1thak_1",As="_user_1thak_19",js="_assistant_1thak_24",zs="_avatar_1thak_28",Ms="_avatarPlaceholder_1thak_43",Ds="_brainbaseLogo_1thak_53",Bs="_messageBubble_1thak_58",Os="_error_1thak_76",Rs="_content_1thak_81",Fs="_markdown_1thak_92",$s="_cursor_1thak_183",Hs="_errorIndicator_1thak_202",ce={messageWrapper:Ns,user:As,assistant:js,avatar:zs,avatarPlaceholder:Ms,brainbaseLogo:Ds,messageBubble:Bs,error:Os,content:Rs,markdown:Fs,cursor:$s,errorIndicator:Hs},Ar=({message:e,agentName:n,agentLogoUrl:t})=>{const r=e.role==="user",i=e.status==="streaming",l=e.status==="error";return g.jsxs("div",{className:`${ce.messageWrapper} ${r?ce.user:ce.assistant}`,children:[!r&&g.jsx("div",{className:ce.avatar,children:t?g.jsx("img",{src:t,alt:n||"AI"}):g.jsx("div",{className:ce.avatarPlaceholder,children:g.jsx(Qe,{className:ce.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})})}),g.jsxs("div",{className:`${ce.messageBubble} ${l?ce.error:""}`,role:"article","aria-label":`${r?"Your message":`${n||"AI"} says`}`,children:[g.jsxs("div",{className:`${ce.content} ${r?"":ce.markdown}`,children:[r?e.content:g.jsx(Es,{components:{a:({href:o,children:a})=>o?g.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:a}):g.jsx(g.Fragment,{children:a})},children:e.content}),i&&g.jsx("span",{className:ce.cursor})]}),l&&g.jsxs("div",{className:ce.errorIndicator,children:[g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",children:[g.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),g.jsx("path",{d:"M12 8V12M12 16H12.01",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),g.jsx("span",{children:"Failed to send"})]})]})]})},Vs="_toolCall_1wby1_1",Us="_iconWrapper_1wby1_24",qs="_spinner_1wby1_33",Ws="_checkIcon_1wby1_48",Ys="_errorIcon_1wby1_54",Xs="_content_1wby1_60",Ks="_label_1wby1_66",Qs="_name_1wby1_73",Zs="_pending_1wby1_78",Js="_completed_1wby1_82",Gs="_error_1wby1_54",de={toolCall:Vs,iconWrapper:Us,spinner:qs,checkIcon:Ws,errorIcon:Ys,content:Xs,label:Ks,name:Qs,pending:Zs,completed:Js,error:Gs},jr=({toolCall:e})=>{const n=e.status==="pending"||e.status==="executing",t=e.status==="completed",r=e.status==="error",i=l=>l.replace(/_/g," ").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,o=>o.toUpperCase());return g.jsxs("div",{className:`${de.toolCall} ${n?de.pending:""} ${t?de.completed:""} ${r?de.error:""}`,children:[g.jsx("div",{className:de.iconWrapper,children:n?g.jsx("div",{className:de.spinner}):t?g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:de.checkIcon,children:g.jsx("path",{d:"M20 6L9 17L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:de.errorIcon,children:g.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),g.jsxs("div",{className:de.content,children:[g.jsx("span",{className:de.label,children:n?"Running":t?"Completed":"Failed"}),g.jsx("span",{className:de.name,children:i(e.name)})]})]})},eu="_wrapper_10rss_2",nu="_avatar_10rss_22",tu="_avatarPlaceholder_10rss_37",ru="_brainbaseLogo_10rss_47",iu="_bubble_10rss_52",lu="_dot_10rss_63",Ce={wrapper:eu,avatar:nu,avatarPlaceholder:tu,brainbaseLogo:ru,bubble:iu,dot:lu},zr=({agentName:e="AI",agentLogoUrl:n})=>g.jsxs("div",{className:Ce.wrapper,role:"status","aria-label":`${e} is typing`,children:[g.jsx("div",{className:Ce.avatar,children:n?g.jsx("img",{src:n,alt:e}):g.jsx("div",{className:Ce.avatarPlaceholder,children:g.jsx(Qe,{className:Ce.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})})}),g.jsxs("div",{className:Ce.bubble,children:[g.jsx("span",{className:Ce.dot}),g.jsx("span",{className:Ce.dot}),g.jsx("span",{className:Ce.dot})]})]}),ou="_messageList_241kk_1",au="_emptyState_241kk_29",su="_emptyIcon_241kk_40",uu="_emptyText_241kk_52",ln={messageList:ou,emptyState:au,emptyIcon:su,emptyText:uu},Mr=({messages:e,toolCalls:n=[],isLoading:t,agentName:r,agentLogoUrl:i})=>{var c;const l=F.useRef(null),o=F.useRef(null);F.useEffect(()=>{var s;(s=o.current)==null||s.scrollIntoView({behavior:"smooth"})},[e,n,t]);const a=n.filter(s=>s.status==="pending"||s.status==="executing");return g.jsxs("div",{className:ln.messageList,ref:l,role:"log","aria-live":"polite",children:[e.length===0&&!t&&g.jsxs("div",{className:ln.emptyState,children:[g.jsx("div",{className:ln.emptyIcon,children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M8 12H8.01M12 12H12.01M16 12H16.01M21 12C21 16.4183 16.9706 20 12 20C10.4607 20 9.01172 19.6565 7.74467 19.0511L3 20L4.39499 16.28C3.51156 15.0423 3 13.5743 3 12C3 7.58172 7.02944 4 12 4C16.9706 4 21 7.58172 21 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),g.jsx("p",{className:ln.emptyText,children:"Start a conversation"})]}),e.map(s=>g.jsx(Ar,{message:s,agentName:r,agentLogoUrl:i},s.id)),a.map(s=>g.jsx(jr,{toolCall:s},s.id)),t&&((c=e[e.length-1])==null?void 0:c.role)==="user"&&g.jsx(zr,{agentName:r,agentLogoUrl:i}),g.jsx("div",{ref:o})]})},cu="_inputWrapper_5lgg7_1",pu="_inputContainer_5lgg7_7",hu="_textarea_5lgg7_23",fu="_sendButton_5lgg7_50",du="_hint_5lgg7_89",We={inputWrapper:cu,inputContainer:pu,textarea:hu,sendButton:fu,hint:du},Dr=({onSend:e,disabled:n=!1,placeholder:t="Send a message..."})=>{const[r,i]=F.useState(""),l=F.useRef(null),o=F.useCallback(()=>{const s=l.current;s&&(s.style.height="auto",s.style.height=`${Math.min(s.scrollHeight,150)}px`)},[]);F.useEffect(()=>{o()},[r,o]);const a=F.useCallback(s=>{s==null||s.preventDefault();const u=r.trim();u&&!n&&(e(u),i(""),l.current&&(l.current.style.height="auto"))},[r,n,e]),c=F.useCallback(s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),a())},[a]);return g.jsxs("form",{className:We.inputWrapper,onSubmit:a,children:[g.jsxs("div",{className:We.inputContainer,children:[g.jsx("textarea",{ref:l,className:We.textarea,value:r,onChange:s=>i(s.target.value),onKeyDown:c,placeholder:t,disabled:n,rows:1,"aria-label":"Message input"}),g.jsx("button",{type:"submit",className:We.sendButton,disabled:n||!r.trim(),"aria-label":"Send message",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),g.jsxs("div",{className:We.hint,children:["Press ",g.jsx("kbd",{children:"Enter"})," to send, ",g.jsx("kbd",{children:"Shift + Enter"})," for new line"]})]})},mu="_poweredBy_9jh5q_1",gu="_logo_9jh5q_20",yu="_poweredText_9jh5q_24",xu="_text_9jh5q_36",on={poweredBy:mu,logo:gu,poweredText:yu,text:xu},ku=({className:e})=>g.jsxs("svg",{className:e,viewBox:"0 0 800 800",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H788C794.627 400 800 405.373 800 412V740C800 773.137 773.137 800 740 800H412C405.373 800 400 794.627 400 788V412Z",fill:"currentColor"}),g.jsx("circle",{cx:"400",cy:"400",r:"400",fill:"currentColor"}),g.jsx("path",{d:"M0 60C0 26.8629 26.8629 0 60 0H397.614C398.932 0 400 1.06811 400 2.38569V2.38569C400 221.982 221.982 400 2.38569 400V400C1.06811 400 0 398.932 0 397.614V60Z",fill:"currentColor"}),g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H738C744.627 400 750 405.373 750 412V725C750 738.807 738.807 750 725 750H412C405.373 750 400 744.627 400 738V412Z",fill:"currentColor"}),g.jsx("circle",{cx:"400",cy:"400",r:"350",fill:"currentColor"}),g.jsx("path",{d:"M50 75C50 61.1929 61.1929 50 75 50H388C394.627 50 400 55.3726 400 62V388C400 394.627 394.627 400 388 400H62C55.3726 400 50 394.627 50 388V75Z",fill:"currentColor"}),g.jsx("rect",{x:"399.919",y:"209",width:"270",height:"270",rx:"12",transform:"rotate(45 399.919 209)",fill:"var(--bb-surface-bg, #ffffff)"})]}),bu=({showBranding:e=!0})=>e?g.jsxs("a",{href:"https://brainbaselabs.com/",target:"_blank",rel:"noopener noreferrer",className:on.poweredBy,"aria-label":"Powered by Brainbase Labs",children:[g.jsx("span",{className:on.poweredText,children:"Powered by"}),g.jsx(ku,{className:on.logo}),g.jsx("span",{className:on.text,children:"Brainbase Labs"})]}):null,wu="_container_m2o9l_1",Cu="_body_m2o9l_26",Su="_confirmationOverlay_m2o9l_35",_u="_confirmationDialog_m2o9l_56",Iu="_confirmationText_m2o9l_78",Eu="_confirmationButtons_m2o9l_86",vu="_cancelButton_m2o9l_91",Tu="_confirmButton_m2o9l_92",Se={container:wu,body:Cu,confirmationOverlay:Su,confirmationDialog:_u,confirmationText:Iu,confirmationButtons:Eu,cancelButton:vu,confirmButton:Tu},Br=({config:e,messages:n,toolCalls:t=[],isLoading:r,onSendMessage:i,onClose:l,onNewChat:o})=>{var h;const[a,c]=F.useState(!1),s=n.length>0,u=()=>{c(!0)},p=()=>{c(!1),o==null||o()},m=()=>{c(!1)};return g.jsxs("div",{className:Se.container,role:"dialog","aria-label":"Chat window",children:[g.jsx(Kt,{agentName:e.agentName,agentLogoUrl:e.agentLogoUrl,welcomeTitle:e.welcomeMessage||"Hello there.",welcomeSubtitle:e.welcomeMessage?void 0:"How can we help?",onClose:l,onNewChatRequest:u,showNewChatButton:s,compact:s}),g.jsxs("div",{className:Se.body,children:[g.jsx(Mr,{messages:n,toolCalls:t,isLoading:r,agentName:e.agentName,agentLogoUrl:e.agentLogoUrl}),g.jsx(Dr,{onSend:i,disabled:r,placeholder:"Ask a question..."})]}),g.jsx(bu,{showBranding:((h=e.styling)==null?void 0:h.showBranding)??!0}),a&&g.jsx("div",{className:Se.confirmationOverlay,children:g.jsxs("div",{className:Se.confirmationDialog,children:[g.jsx("p",{className:Se.confirmationText,children:"End current chat and start a new conversation?"}),g.jsxs("div",{className:Se.confirmationButtons,children:[g.jsx("button",{className:Se.cancelButton,onClick:m,type:"button",children:"Cancel"}),g.jsx("button",{className:Se.confirmButton,onClick:p,type:"button",children:"End Chat"})]})]})})]})},Lu="_toggleButton_11dqz_1",Pu="_icon_11dqz_31",Nu="_agentLogo_11dqz_36",Au="_unreadBadge_11dqz_43",an={toggleButton:Lu,icon:Pu,agentLogo:Nu,unreadBadge:Au},Rn=({onClick:e,agentLogoUrl:n,unreadCount:t=0})=>g.jsxs("button",{className:an.toggleButton,onClick:e,"aria-label":"Open chat",type:"button",children:[n?g.jsx("img",{src:n,alt:"",className:an.agentLogo}):g.jsx("svg",{className:an.icon,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M8 12H8.01M12 12H12.01M16 12H16.01M21 12C21 16.4183 16.9706 20 12 20C10.4607 20 9.01172 19.6565 7.74467 19.0511L3 20L4.39499 16.28C3.51156 15.0423 3 13.5743 3 12C3 7.58172 7.02944 4 12 4C16.9706 4 21 7.58172 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),t>0&&g.jsx("span",{className:an.unreadBadge,children:t>9?"9+":t})]}),ju="_container_kgfgt_1",zu="_header_kgfgt_25",Mu="_logoWrapper_kgfgt_38",Du="_logo_kgfgt_38",Bu="_closeButton_kgfgt_51",Ou="_content_kgfgt_74",Ru="_iconWrapper_kgfgt_84",Fu="_errorIcon_kgfgt_95",$u="_title_kgfgt_101",Hu="_description_kgfgt_109",Vu="_retryButton_kgfgt_117",Uu="_footer_kgfgt_139",qu="_poweredBy_kgfgt_146",Wu="_footerLogo_kgfgt_160",ee={container:ju,header:zu,logoWrapper:Mu,logo:Du,closeButton:Bu,content:Ou,iconWrapper:Ru,errorIcon:Fu,title:$u,description:Hu,retryButton:Vu,footer:Uu,poweredBy:qu,footerLogo:Wu},Yu=({errorType:e,message:n,onRetry:t,onClose:r})=>{const i=()=>{switch(e){case"not_found":return{title:"Chat Not Found",description:n||"This chat widget is not configured correctly. Please check the embed ID.",icon:g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:ee.errorIcon,children:[g.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("path",{d:"M12 7V13M12 16V16.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})};case"network":return{title:"Connection Error",description:n||"Unable to connect to the chat service. Please check your internet connection.",icon:g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:ee.errorIcon,children:[g.jsx("path",{d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("path",{d:"M8 15L16 9M8 9L16 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})};default:return{title:"Something Went Wrong",description:n||"An unexpected error occurred. Please try again later.",icon:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:ee.errorIcon,children:g.jsx("path",{d:"M12 9V13M12 17H12.01M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}}},{title:l,description:o,icon:a}=i();return g.jsxs("div",{className:ee.container,children:[g.jsxs("div",{className:ee.header,children:[g.jsx("div",{className:ee.logoWrapper,children:g.jsx(Qe,{className:ee.logo,color:"white",cutoutColor:"var(--bb-primary-color)"})}),r&&g.jsx("button",{className:ee.closeButton,onClick:r,"aria-label":"Close",type:"button",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),g.jsxs("div",{className:ee.content,children:[g.jsx("div",{className:ee.iconWrapper,children:a}),g.jsx("h2",{className:ee.title,children:l}),g.jsx("p",{className:ee.description,children:o}),t&&g.jsx("button",{className:ee.retryButton,onClick:t,type:"button",children:"Try Again"})]}),g.jsx("div",{className:ee.footer,children:g.jsxs("a",{href:"https://brainbaselabs.com",target:"_blank",rel:"noopener noreferrer",className:ee.poweredBy,children:["Powered by"," ",g.jsx(Qe,{className:ee.footerLogo,color:"var(--bb-text-tertiary)",cutoutColor:"var(--bb-surface-bg)"}),g.jsx("span",{children:"Brainbase Labs"})]})})]})},Xu="_widget_1ehud_1",Ku="_inline_1ehud_25",je={widget:Xu,"bottom-right":"_bottom-right_1ehud_10","bottom-left":"_bottom-left_1ehud_17",inline:Ku},Qu=({embedId:e,apiBaseUrl:n=Wt,mockMode:t=!1,mockResponses:r,position:i="bottom-right",defaultOpen:l=!1,primaryColor:o,agentName:a,welcomeMessage:c,showBranding:s,className:u,onSessionStart:p,onSessionEnd:m,onMessage:h,onError:C})=>{const[E,I]=F.useState(l),[x,A]=F.useState(null),[v,R]=F.useState(!0),[q,k]=F.useState(null),[B,U]=F.useState(),$=F.useMemo(()=>t?Xt({primaryColor:o,agentName:a,welcomeMessage:c},r):Yt(n),[t,o,a,c,r,n]),V=F.useCallback(async()=>{R(!0),k(null),U(void 0);try{const O=await $.getDeploymentConfig(e);A({...O,primaryColor:o??O.primaryColor,agentName:a??O.agentName,welcomeMessage:c??O.welcomeMessage,styling:{...O.styling??{},...s!==void 0?{showBranding:s}:{}}})}catch(O){const Q=O instanceof Error?O:new Error("Failed to load config");Q.message.includes("404")?(k("not_found"),U("The chat widget with this embed ID was not found.")):Q.message.includes("Failed to fetch")||Q.message.includes("network")?k("network"):k("unknown"),t&&(A({embedId:e,deploymentId:"mock-deployment",workerId:"mock-worker",flowId:"mock-flow",primaryColor:o??"#1a1a2e",agentName:a??"AI Assistant",styling:s!==void 0?{showBranding:s}:void 0}),k(null)),C==null||C(Q)}finally{R(!1)}},[e,t,$,o,a,c,C]);F.useEffect(()=>{V()},[V]);const P=F.useMemo(()=>x||{embedId:e,deploymentId:"",workerId:"",flowId:"",primaryColor:o,agentName:a,welcomeMessage:c,styling:s!==void 0?{showBranding:s}:void 0},[x,e,o,a,c,s]),S=qt({config:P,apiClient:$,mockMode:t,onSessionStart:p,onSessionEnd:m,onMessage:h,onError:C}),j=F.useMemo(()=>({"--bb-primary-color":(x==null?void 0:x.primaryColor)??o??"#1a1a2e"}),[x==null?void 0:x.primaryColor,o]),L=()=>{S.endSession(),S.startNewSession()},b=()=>{I(!1)},N=()=>{V()},T=i==="inline";return v?null:q&&!t?!T&&!E?g.jsx("div",{className:`${je.widget} ${je[i]} ${u??""}`,style:j,children:g.jsx(Rn,{onClick:()=>I(!0),agentName:a})}):g.jsx("div",{className:`${je.widget} ${je[i]} ${u??""}`,style:j,children:g.jsx(Yu,{errorType:q,message:B,onRetry:N,onClose:T?void 0:b})}):g.jsx("div",{className:`${je.widget} ${je[i]} ${u??""}`,style:j,children:E||T?g.jsx(Br,{config:P,messages:S.messages,isLoading:S.isLoading,onSendMessage:S.sendMessage,onClose:T?void 0:b,onNewChat:L}):g.jsx(Rn,{onClick:()=>I(!0),agentName:x==null?void 0:x.agentName,agentLogoUrl:x==null?void 0:x.agentLogoUrl})})};function Zu(){if(typeof crypto<"u"&&crypto.randomUUID)return`bb-${crypto.randomUUID()}`;const e=Date.now().toString(36),n=Math.random().toString(36).substring(2,15),t=Math.random().toString(36).substring(2,15);return`bb-${e}-${n}${t}`}exports.ChatContainer=Br;exports.ChatHeader=Kt;exports.ChatToggleButton=Rn;exports.ChatWidget=Qu;exports.Message=Ar;exports.MessageInput=Dr;exports.MessageList=Mr;exports.ToolCallDisplay=jr;exports.TypingIndicator=zr;exports.clearSession=Tn;exports.createAPIClient=Yt;exports.createMockAPIClient=Xt;exports.generateSessionId=Zu;exports.getStoredSession=Ut;exports.storeSession=vn;exports.useChat=qt;
17
+ `},i),l}function ns(e,n){return e&&"run"in e?async function(t,r){const i=Dt(t,{file:r,...n});await e.run(i,r)}:function(t,r){return Dt(t,{file:r,...e||n})}}function Bt(e){if(e)throw e}var kn,Ot;function ts(){if(Ot)return kn;Ot=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(s){return typeof Array.isArray=="function"?Array.isArray(s):n.call(s)==="[object Array]"},l=function(s){if(!s||n.call(s)!=="[object Object]")return!1;var u=e.call(s,"constructor"),p=s.constructor&&s.constructor.prototype&&e.call(s.constructor.prototype,"isPrototypeOf");if(s.constructor&&!u&&!p)return!1;var m;for(m in s);return typeof m>"u"||e.call(s,m)},o=function(s,u){t&&u.name==="__proto__"?t(s,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):s[u.name]=u.newValue},a=function(s,u){if(u==="__proto__")if(e.call(s,u)){if(r)return r(s,u).value}else return;return s[u]};return kn=function c(){var s,u,p,m,h,S,I=arguments[0],E=1,b=arguments.length,P=!1;for(typeof I=="boolean"&&(P=I,I=arguments[1]||{},E=2),(I==null||typeof I!="object"&&typeof I!="function")&&(I={});E<b;++E)if(s=arguments[E],s!=null)for(u in s)p=a(I,u),m=a(s,u),I!==m&&(P&&m&&(l(m)||(h=i(m)))?(h?(h=!1,S=p&&i(p)?p:[]):S=p&&l(p)?p:{},o(I,{name:u,newValue:c(P,S,m)})):typeof m<"u"&&o(I,{name:u,newValue:m}));return I},kn}var rs=ts();const bn=rr(rs);function Bn(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function is(){const e=[],n={run:t,use:r};return n;function t(...i){let l=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(c,...s){const u=e[++l];let p=-1;if(c){o(c);return}for(;++p<i.length;)(s[p]===null||s[p]===void 0)&&(s[p]=i[p]);i=s,u?ls(u,a)(...s):o(null,...s)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),n}}function ls(e,n){let t;return r;function r(...o){const a=e.length>o.length;let c;a&&o.push(i);try{c=e.apply(this,o)}catch(s){const u=s;if(a&&t)throw u;return i(u)}a||(c&&c.then&&typeof c.then=="function"?c.then(l,i):c instanceof Error?i(c):l(c))}function i(o,...a){t||(t=!0,n(o,...a))}function l(o){i(null,o)}}const me={basename:os,dirname:as,extname:ss,join:us,sep:"/"};function os(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Ge(e);let t=0,r=-1,i=e.length,l;if(n===void 0||n.length===0||n.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){t=i+1;break}}else r<0&&(l=!0,r=i+1);return r<0?"":e.slice(t,r)}if(n===e)return"";let o=-1,a=n.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){t=i+1;break}}else o<0&&(l=!0,o=i+1),a>-1&&(e.codePointAt(i)===n.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return t===r?r=o:r<0&&(r=e.length),e.slice(t,r)}function as(e){if(Ge(e),e.length===0)return".";let n=-1,t=e.length,r;for(;--t;)if(e.codePointAt(t)===47){if(r){n=t;break}}else r||(r=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function ss(e){Ge(e);let n=e.length,t=-1,r=0,i=-1,l=0,o;for(;n--;){const a=e.codePointAt(n);if(a===47){if(o){r=n+1;break}continue}t<0&&(o=!0,t=n+1),a===46?i<0?i=n:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||t<0||l===0||l===1&&i===t-1&&i===r+1?"":e.slice(i,t)}function us(...e){let n=-1,t;for(;++n<e.length;)Ge(e[n]),e[n]&&(t=t===void 0?e[n]:t+"/"+e[n]);return t===void 0?".":cs(t)}function cs(e){Ge(e);const n=e.codePointAt(0)===47;let t=ps(e,!n);return t.length===0&&!n&&(t="."),t.length>0&&e.codePointAt(e.length-1)===47&&(t+="/"),n?"/"+t:t}function ps(e,n){let t="",r=0,i=-1,l=0,o=-1,a,c;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||l===1))if(i!==o-1&&l===2){if(t.length<2||r!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(c=t.lastIndexOf("/"),c!==t.length-1){c<0?(t="",r=0):(t=t.slice(0,c),r=t.length-1-t.lastIndexOf("/")),i=o,l=0;continue}}else if(t.length>0){t="",r=0,i=o,l=0;continue}}n&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+e.slice(i+1,o):t=e.slice(i+1,o),r=o-i-1;i=o,l=0}else a===46&&l>-1?l++:l=-1}return t}function Ge(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const hs={cwd:fs};function fs(){return"/"}function On(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ds(e){if(typeof e=="string")e=new URL(e);else if(!On(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return ms(e)}function ms(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let t=-1;for(;++t<n.length;)if(n.codePointAt(t)===37&&n.codePointAt(t+1)===50){const r=n.codePointAt(t+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(n)}const wn=["history","path","basename","stem","extname","dirname"];class Pr{constructor(n){let t;n?On(n)?t={path:n}:typeof n=="string"||gs(n)?t={value:n}:t=n:t={},this.cwd="cwd"in t?"":hs.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<wn.length;){const l=wn[r];l in t&&t[l]!==void 0&&t[l]!==null&&(this[l]=l==="history"?[...t[l]]:t[l])}let i;for(i in t)wn.includes(i)||(this[i]=t[i])}get basename(){return typeof this.path=="string"?me.basename(this.path):void 0}set basename(n){Sn(n,"basename"),Cn(n,"basename"),this.path=me.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?me.dirname(this.path):void 0}set dirname(n){Rt(this.basename,"dirname"),this.path=me.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?me.extname(this.path):void 0}set extname(n){if(Cn(n,"extname"),Rt(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=me.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){On(n)&&(n=ds(n)),Sn(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?me.basename(this.path,this.extname):void 0}set stem(n){Sn(n,"stem"),Cn(n,"stem"),this.path=me.join(this.dirname||"",n+(this.extname||""))}fail(n,t,r){const i=this.message(n,t,r);throw i.fatal=!0,i}info(n,t,r){const i=this.message(n,t,r);return i.fatal=void 0,i}message(n,t,r){const i=new te(n,t,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function Cn(e,n){if(e&&e.includes(me.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+me.sep+"`")}function Sn(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function Rt(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function gs(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ys=(function(e){const r=this.constructor.prototype,i=r[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,r),l}),xs={}.hasOwnProperty;class et extends ys{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=is()}copy(){const n=new et;let t=-1;for(;++t<this.attachers.length;){const r=this.attachers[t];n.use(...r)}return n.data(bn(!0,{},this.namespace)),n}data(n,t){return typeof n=="string"?arguments.length===2?(En("data",this.frozen),this.namespace[n]=t,this):xs.call(this.namespace,n)&&this.namespace[n]||void 0:n?(En("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=t.call(n,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const t=rn(n),r=this.parser||this.Parser;return _n("parse",r),r(String(t),t)}process(n,t){const r=this;return this.freeze(),_n("process",this.parser||this.Parser),In("process",this.compiler||this.Compiler),t?i(void 0,t):new Promise(i);function i(l,o){const a=rn(n),c=r.parse(a);r.run(c,a,function(u,p,m){if(u||!p||!m)return s(u);const h=p,S=r.stringify(h,m);ws(S)?m.value=S:m.result=S,s(u,m)});function s(u,p){u||!p?o(u):l?l(p):t(void 0,p)}}}processSync(n){let t=!1,r;return this.freeze(),_n("processSync",this.parser||this.Parser),In("processSync",this.compiler||this.Compiler),this.process(n,i),$t("processSync","process",t),r;function i(l,o){t=!0,Bt(l),r=o}}run(n,t,r){Ft(n),this.freeze();const i=this.transformers;return!r&&typeof t=="function"&&(r=t,t=void 0),r?l(void 0,r):new Promise(l);function l(o,a){const c=rn(t);i.run(n,c,s);function s(u,p,m){const h=p||n;u?a(u):o?o(h):r(void 0,h,m)}}}runSync(n,t){let r=!1,i;return this.run(n,t,l),$t("runSync","run",r),i;function l(o,a){Bt(o),i=a,r=!0}}stringify(n,t){this.freeze();const r=rn(t),i=this.compiler||this.Compiler;return In("stringify",i),Ft(n),i(n,r)}use(n,...t){const r=this.attachers,i=this.namespace;if(En("use",this.frozen),n!=null)if(typeof n=="function")c(n,t);else if(typeof n=="object")Array.isArray(n)?a(n):o(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function l(s){if(typeof s=="function")c(s,[]);else if(typeof s=="object")if(Array.isArray(s)){const[u,...p]=s;c(u,p)}else o(s);else throw new TypeError("Expected usable value, not `"+s+"`")}function o(s){if(!("plugins"in s)&&!("settings"in s))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");a(s.plugins),s.settings&&(i.settings=bn(!0,i.settings,s.settings))}function a(s){let u=-1;if(s!=null)if(Array.isArray(s))for(;++u<s.length;){const p=s[u];l(p)}else throw new TypeError("Expected a list of plugins, not `"+s+"`")}function c(s,u){let p=-1,m=-1;for(;++p<r.length;)if(r[p][0]===s){m=p;break}if(m===-1)r.push([s,...u]);else if(u.length>0){let[h,...S]=u;const I=r[m][1];Bn(I)&&Bn(h)&&(h=bn(!0,I,h)),r[m]=[s,h,...S]}}}}const ks=new et().freeze();function _n(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function In(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function En(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ft(e){if(!Bn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $t(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function rn(e){return bs(e)?e:new Pr(e)}function bs(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ws(e){return typeof e=="string"||Cs(e)}function Cs(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ss="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ht=[],Vt={allowDangerousHtml:!0},_s=/^(https?|ircs?|mailto|xmpp)$/i,Is=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Es(e){const n=vs(e),t=Ts(e);return Ls(n.runSync(n.parse(t),t),e)}function vs(e){const n=e.rehypePlugins||Ht,t=e.remarkPlugins||Ht,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Vt}:Vt;return ks().use(oa).use(t).use(ns,r).use(n)}function Ts(e){const n=e.children||"",t=new Pr;return typeof n=="string"&&(t.value=n),t}function Ls(e,n){const t=n.allowedElements,r=n.allowElement,i=n.components,l=n.disallowedElements,o=n.skipHtml,a=n.unwrapDisallowed,c=n.urlTransform||Ns;for(const u of Is)Object.hasOwn(n,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+Ss+u.id,void 0);return Nr(e,s),Oi(e,{Fragment:g.Fragment,components:i,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function s(u,p,m){if(u.type==="raw"&&m&&typeof p=="number")return o?m.children.splice(p,1):m.children[p]={type:"text",value:u.value},p;if(u.type==="element"){let h;for(h in gn)if(Object.hasOwn(gn,h)&&Object.hasOwn(u.properties,h)){const S=u.properties[h],I=gn[h];(I===null||I.includes(u.tagName))&&(u.properties[h]=c(String(S||""),h,u))}}if(u.type==="element"){let h=t?!t.includes(u.tagName):l?l.includes(u.tagName):!1;if(!h&&r&&typeof p=="number"&&(h=!r(u,p,m)),h&&m&&typeof p=="number")return a&&u.children?m.children.splice(p,1,...u.children):m.children.splice(p,1),p}}}function Ns(e){const n=e.indexOf(":"),t=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return n===-1||i!==-1&&n>i||t!==-1&&n>t||r!==-1&&n>r||_s.test(e.slice(0,n))?e:""}const Ps="_messageWrapper_1thak_1",As="_user_1thak_19",js="_assistant_1thak_24",zs="_avatar_1thak_28",Ms="_avatarPlaceholder_1thak_43",Ds="_brainbaseLogo_1thak_53",Bs="_messageBubble_1thak_58",Os="_error_1thak_76",Rs="_content_1thak_81",Fs="_markdown_1thak_92",$s="_cursor_1thak_183",Hs="_errorIndicator_1thak_202",ce={messageWrapper:Ps,user:As,assistant:js,avatar:zs,avatarPlaceholder:Ms,brainbaseLogo:Ds,messageBubble:Bs,error:Os,content:Rs,markdown:Fs,cursor:$s,errorIndicator:Hs},Ar=({message:e,agentName:n,agentLogoUrl:t})=>{const r=e.role==="user",i=e.status==="streaming",l=e.status==="error";return g.jsxs("div",{className:`${ce.messageWrapper} ${r?ce.user:ce.assistant}`,children:[!r&&g.jsx("div",{className:ce.avatar,children:t?g.jsx("img",{src:t,alt:n||"AI"}):g.jsx("div",{className:ce.avatarPlaceholder,children:g.jsx(Qe,{className:ce.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})})}),g.jsxs("div",{className:`${ce.messageBubble} ${l?ce.error:""}`,role:"article","aria-label":`${r?"Your message":`${n||"AI"} says`}`,children:[g.jsxs("div",{className:`${ce.content} ${r?"":ce.markdown}`,children:[r?e.content:g.jsx(Es,{components:{a:({href:o,children:a})=>o?g.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:a}):g.jsx(g.Fragment,{children:a})},children:e.content}),i&&g.jsx("span",{className:ce.cursor})]}),l&&g.jsxs("div",{className:ce.errorIndicator,children:[g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",children:[g.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),g.jsx("path",{d:"M12 8V12M12 16H12.01",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),g.jsx("span",{children:"Failed to send"})]})]})]})},Vs="_toolCall_1wby1_1",Us="_iconWrapper_1wby1_24",qs="_spinner_1wby1_33",Ws="_checkIcon_1wby1_48",Ys="_errorIcon_1wby1_54",Xs="_content_1wby1_60",Ks="_label_1wby1_66",Qs="_name_1wby1_73",Zs="_pending_1wby1_78",Js="_completed_1wby1_82",Gs="_error_1wby1_54",de={toolCall:Vs,iconWrapper:Us,spinner:qs,checkIcon:Ws,errorIcon:Ys,content:Xs,label:Ks,name:Qs,pending:Zs,completed:Js,error:Gs},jr=({toolCall:e})=>{const n=e.status==="pending"||e.status==="executing",t=e.status==="completed",r=e.status==="error",i=l=>l.replace(/_/g," ").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,o=>o.toUpperCase());return g.jsxs("div",{className:`${de.toolCall} ${n?de.pending:""} ${t?de.completed:""} ${r?de.error:""}`,children:[g.jsx("div",{className:de.iconWrapper,children:n?g.jsx("div",{className:de.spinner}):t?g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:de.checkIcon,children:g.jsx("path",{d:"M20 6L9 17L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:de.errorIcon,children:g.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),g.jsxs("div",{className:de.content,children:[g.jsx("span",{className:de.label,children:n?"Running":t?"Completed":"Failed"}),g.jsx("span",{className:de.name,children:i(e.name)})]})]})},eu="_wrapper_10rss_2",nu="_avatar_10rss_22",tu="_avatarPlaceholder_10rss_37",ru="_brainbaseLogo_10rss_47",iu="_bubble_10rss_52",lu="_dot_10rss_63",Ce={wrapper:eu,avatar:nu,avatarPlaceholder:tu,brainbaseLogo:ru,bubble:iu,dot:lu},zr=({agentName:e="AI",agentLogoUrl:n})=>g.jsxs("div",{className:Ce.wrapper,role:"status","aria-label":`${e} is typing`,children:[g.jsx("div",{className:Ce.avatar,children:n?g.jsx("img",{src:n,alt:e}):g.jsx("div",{className:Ce.avatarPlaceholder,children:g.jsx(Qe,{className:Ce.brainbaseLogo,color:"white",cutoutColor:"var(--bb-primary-color)"})})}),g.jsxs("div",{className:Ce.bubble,children:[g.jsx("span",{className:Ce.dot}),g.jsx("span",{className:Ce.dot}),g.jsx("span",{className:Ce.dot})]})]}),ou="_messageList_241kk_1",au="_emptyState_241kk_29",su="_emptyIcon_241kk_40",uu="_emptyText_241kk_52",ln={messageList:ou,emptyState:au,emptyIcon:su,emptyText:uu},Mr=({messages:e,toolCalls:n=[],isLoading:t,agentName:r,agentLogoUrl:i})=>{var c;const l=O.useRef(null),o=O.useRef(null);O.useEffect(()=>{var s;(s=o.current)==null||s.scrollIntoView({behavior:"smooth"})},[e,n,t]);const a=n.filter(s=>s.status==="pending"||s.status==="executing");return g.jsxs("div",{className:ln.messageList,ref:l,role:"log","aria-live":"polite",children:[e.length===0&&!t&&g.jsxs("div",{className:ln.emptyState,children:[g.jsx("div",{className:ln.emptyIcon,children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M8 12H8.01M12 12H12.01M16 12H16.01M21 12C21 16.4183 16.9706 20 12 20C10.4607 20 9.01172 19.6565 7.74467 19.0511L3 20L4.39499 16.28C3.51156 15.0423 3 13.5743 3 12C3 7.58172 7.02944 4 12 4C16.9706 4 21 7.58172 21 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),g.jsx("p",{className:ln.emptyText,children:"Start a conversation"})]}),e.map(s=>g.jsx(Ar,{message:s,agentName:r,agentLogoUrl:i},s.id)),a.map(s=>g.jsx(jr,{toolCall:s},s.id)),t&&((c=e[e.length-1])==null?void 0:c.role)==="user"&&g.jsx(zr,{agentName:r,agentLogoUrl:i}),g.jsx("div",{ref:o})]})},cu="_inputWrapper_5lgg7_1",pu="_inputContainer_5lgg7_7",hu="_textarea_5lgg7_23",fu="_sendButton_5lgg7_50",du="_hint_5lgg7_89",We={inputWrapper:cu,inputContainer:pu,textarea:hu,sendButton:fu,hint:du},Dr=({onSend:e,disabled:n=!1,placeholder:t="Send a message..."})=>{const[r,i]=O.useState(""),l=O.useRef(null),o=O.useCallback(()=>{const s=l.current;s&&(s.style.height="auto",s.style.height=`${Math.min(s.scrollHeight,150)}px`)},[]);O.useEffect(()=>{o()},[r,o]);const a=O.useCallback(s=>{s==null||s.preventDefault();const u=r.trim();u&&!n&&(e(u),i(""),l.current&&(l.current.style.height="auto"))},[r,n,e]),c=O.useCallback(s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),a())},[a]);return g.jsxs("form",{className:We.inputWrapper,onSubmit:a,children:[g.jsxs("div",{className:We.inputContainer,children:[g.jsx("textarea",{ref:l,className:We.textarea,value:r,onChange:s=>i(s.target.value),onKeyDown:c,placeholder:t,disabled:n,rows:1,"aria-label":"Message input"}),g.jsx("button",{type:"submit",className:We.sendButton,disabled:n||!r.trim(),"aria-label":"Send message",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),g.jsxs("div",{className:We.hint,children:["Press ",g.jsx("kbd",{children:"Enter"})," to send, ",g.jsx("kbd",{children:"Shift + Enter"})," for new line"]})]})},mu="_poweredBy_9jh5q_1",gu="_logo_9jh5q_20",yu="_poweredText_9jh5q_24",xu="_text_9jh5q_36",on={poweredBy:mu,logo:gu,poweredText:yu,text:xu},ku=({className:e})=>g.jsxs("svg",{className:e,viewBox:"0 0 800 800",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H788C794.627 400 800 405.373 800 412V740C800 773.137 773.137 800 740 800H412C405.373 800 400 794.627 400 788V412Z",fill:"currentColor"}),g.jsx("circle",{cx:"400",cy:"400",r:"400",fill:"currentColor"}),g.jsx("path",{d:"M0 60C0 26.8629 26.8629 0 60 0H397.614C398.932 0 400 1.06811 400 2.38569V2.38569C400 221.982 221.982 400 2.38569 400V400C1.06811 400 0 398.932 0 397.614V60Z",fill:"currentColor"}),g.jsx("path",{d:"M400 412C400 405.373 405.373 400 412 400H738C744.627 400 750 405.373 750 412V725C750 738.807 738.807 750 725 750H412C405.373 750 400 744.627 400 738V412Z",fill:"currentColor"}),g.jsx("circle",{cx:"400",cy:"400",r:"350",fill:"currentColor"}),g.jsx("path",{d:"M50 75C50 61.1929 61.1929 50 75 50H388C394.627 50 400 55.3726 400 62V388C400 394.627 394.627 400 388 400H62C55.3726 400 50 394.627 50 388V75Z",fill:"currentColor"}),g.jsx("rect",{x:"399.919",y:"209",width:"270",height:"270",rx:"12",transform:"rotate(45 399.919 209)",fill:"var(--bb-surface-bg, #ffffff)"})]}),bu=({showBranding:e=!0})=>e?g.jsxs("a",{href:"https://brainbaselabs.com/",target:"_blank",rel:"noopener noreferrer",className:on.poweredBy,"aria-label":"Powered by Brainbase Labs",children:[g.jsx("span",{className:on.poweredText,children:"Powered by"}),g.jsx(ku,{className:on.logo}),g.jsx("span",{className:on.text,children:"Brainbase Labs"})]}):null,wu="_container_m2o9l_1",Cu="_body_m2o9l_26",Su="_confirmationOverlay_m2o9l_35",_u="_confirmationDialog_m2o9l_56",Iu="_confirmationText_m2o9l_78",Eu="_confirmationButtons_m2o9l_86",vu="_cancelButton_m2o9l_91",Tu="_confirmButton_m2o9l_92",Se={container:wu,body:Cu,confirmationOverlay:Su,confirmationDialog:_u,confirmationText:Iu,confirmationButtons:Eu,cancelButton:vu,confirmButton:Tu},Br=({config:e,messages:n,toolCalls:t=[],isLoading:r,onSendMessage:i,onClose:l,onNewChat:o})=>{var h;const[a,c]=O.useState(!1),s=n.length>0,u=()=>{c(!0)},p=()=>{c(!1),o==null||o()},m=()=>{c(!1)};return g.jsxs("div",{className:Se.container,role:"dialog","aria-label":"Chat window",children:[g.jsx(Kt,{agentName:e.agentName,agentLogoUrl:e.agentLogoUrl,welcomeTitle:e.welcomeMessage||"Hello there.",welcomeSubtitle:e.welcomeMessage?void 0:"How can we help?",onClose:l,onNewChatRequest:u,showNewChatButton:s,compact:s}),g.jsxs("div",{className:Se.body,children:[g.jsx(Mr,{messages:n,toolCalls:t,isLoading:r,agentName:e.agentName,agentLogoUrl:e.agentLogoUrl}),g.jsx(Dr,{onSend:i,disabled:r,placeholder:"Ask a question..."})]}),g.jsx(bu,{showBranding:((h=e.styling)==null?void 0:h.showBranding)??!0}),a&&g.jsx("div",{className:Se.confirmationOverlay,children:g.jsxs("div",{className:Se.confirmationDialog,children:[g.jsx("p",{className:Se.confirmationText,children:"End current chat and start a new conversation?"}),g.jsxs("div",{className:Se.confirmationButtons,children:[g.jsx("button",{className:Se.cancelButton,onClick:m,type:"button",children:"Cancel"}),g.jsx("button",{className:Se.confirmButton,onClick:p,type:"button",children:"End Chat"})]})]})})]})},Lu="_toggleButton_11dqz_1",Nu="_icon_11dqz_31",Pu="_agentLogo_11dqz_36",Au="_unreadBadge_11dqz_43",an={toggleButton:Lu,icon:Nu,agentLogo:Pu,unreadBadge:Au},Rn=({onClick:e,agentLogoUrl:n,unreadCount:t=0})=>g.jsxs("button",{className:an.toggleButton,onClick:e,"aria-label":"Open chat",type:"button",children:[n?g.jsx("img",{src:n,alt:"",className:an.agentLogo}):g.jsx("svg",{className:an.icon,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M8 12H8.01M12 12H12.01M16 12H16.01M21 12C21 16.4183 16.9706 20 12 20C10.4607 20 9.01172 19.6565 7.74467 19.0511L3 20L4.39499 16.28C3.51156 15.0423 3 13.5743 3 12C3 7.58172 7.02944 4 12 4C16.9706 4 21 7.58172 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),t>0&&g.jsx("span",{className:an.unreadBadge,children:t>9?"9+":t})]}),ju="_container_kgfgt_1",zu="_header_kgfgt_25",Mu="_logoWrapper_kgfgt_38",Du="_logo_kgfgt_38",Bu="_closeButton_kgfgt_51",Ou="_content_kgfgt_74",Ru="_iconWrapper_kgfgt_84",Fu="_errorIcon_kgfgt_95",$u="_title_kgfgt_101",Hu="_description_kgfgt_109",Vu="_retryButton_kgfgt_117",Uu="_footer_kgfgt_139",qu="_poweredBy_kgfgt_146",Wu="_footerLogo_kgfgt_160",ne={container:ju,header:zu,logoWrapper:Mu,logo:Du,closeButton:Bu,content:Ou,iconWrapper:Ru,errorIcon:Fu,title:$u,description:Hu,retryButton:Vu,footer:Uu,poweredBy:qu,footerLogo:Wu},Yu=({errorType:e,message:n,onRetry:t,onClose:r})=>{const i=()=>{switch(e){case"not_found":return{title:"Chat Not Found",description:n||"This chat widget is not configured correctly. Please check the embed ID.",icon:g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:ne.errorIcon,children:[g.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("path",{d:"M12 7V13M12 16V16.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})};case"network":return{title:"Connection Error",description:n||"Unable to connect to the chat service. Please check your internet connection.",icon:g.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",className:ne.errorIcon,children:[g.jsx("path",{d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("path",{d:"M8 15L16 9M8 9L16 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})};default:return{title:"Something Went Wrong",description:n||"An unexpected error occurred. Please try again later.",icon:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",className:ne.errorIcon,children:g.jsx("path",{d:"M12 9V13M12 17H12.01M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}}},{title:l,description:o,icon:a}=i();return g.jsxs("div",{className:ne.container,children:[g.jsxs("div",{className:ne.header,children:[g.jsx("div",{className:ne.logoWrapper,children:g.jsx(Qe,{className:ne.logo,color:"white",cutoutColor:"var(--bb-primary-color)"})}),r&&g.jsx("button",{className:ne.closeButton,onClick:r,"aria-label":"Close",type:"button",children:g.jsx("svg",{viewBox:"0 0 24 24",fill:"none",children:g.jsx("path",{d:"M6 18L18 6M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),g.jsxs("div",{className:ne.content,children:[g.jsx("div",{className:ne.iconWrapper,children:a}),g.jsx("h2",{className:ne.title,children:l}),g.jsx("p",{className:ne.description,children:o}),t&&g.jsx("button",{className:ne.retryButton,onClick:t,type:"button",children:"Try Again"})]}),g.jsx("div",{className:ne.footer,children:g.jsxs("a",{href:"https://brainbaselabs.com",target:"_blank",rel:"noopener noreferrer",className:ne.poweredBy,children:["Powered by"," ",g.jsx(Qe,{className:ne.footerLogo,color:"var(--bb-text-tertiary)",cutoutColor:"var(--bb-surface-bg)"}),g.jsx("span",{children:"Brainbase Labs"})]})})]})},Xu="_widget_1ehud_1",Ku="_inline_1ehud_25",je={widget:Xu,"bottom-right":"_bottom-right_1ehud_10","bottom-left":"_bottom-left_1ehud_17",inline:Ku},Qu=({embedId:e,apiBaseUrl:n=Wt,mockMode:t=!1,mockResponses:r,position:i="bottom-right",defaultOpen:l=!1,primaryColor:o,agentName:a,agentLogoUrl:c,welcomeMessage:s,showBranding:u,className:p,onSessionStart:m,onSessionEnd:h,onMessage:S,onError:I})=>{const[E,b]=O.useState(l),[P,v]=O.useState(null),[R,V]=O.useState(!0),[k,D]=O.useState(null),[U,F]=O.useState(),$=O.useRef(!1),N=O.useMemo(()=>t?Xt({},r):Yt(n),[t,r,n]),C=O.useCallback(async()=>{if(!($.current&&P)){V(!0),D(null),F(void 0);try{const f=await N.getDeploymentConfig(e);v(f),$.current=!0}catch(f){const J=f instanceof Error?f:new Error("Failed to load config");J.message.includes("404")?(D("not_found"),F("The chat widget with this embed ID was not found.")):J.message.includes("Failed to fetch")||J.message.includes("network")?D("network"):D("unknown"),t&&(v({embedId:e,deploymentId:"mock-deployment",workerId:"mock-worker",flowId:"mock-flow",primaryColor:"#1a1a2e",agentName:"AI Assistant",styling:{}}),D(null),$.current=!0),I==null||I(J)}finally{V(!1)}}},[e,t,N,I,P]);O.useEffect(()=>{$.current=!1,C()},[e,t,N]);const j=O.useMemo(()=>{const f=P??{embedId:e,deploymentId:"",workerId:"",flowId:""};return{...f,primaryColor:o??f.primaryColor??"#1a1a2e",agentName:a??f.agentName,agentLogoUrl:c??f.agentLogoUrl,welcomeMessage:s??f.welcomeMessage,styling:{...f.styling??{},...u!==void 0?{showBranding:u}:{}}}},[P,e,o,a,c,s,u]),T=qt({config:j,apiClient:N,mockMode:t,onSessionStart:m,onSessionEnd:h,onMessage:S,onError:I}),x=O.useMemo(()=>({"--bb-primary-color":j.primaryColor??"#1a1a2e"}),[j.primaryColor]),A=()=>{T.endSession(),T.startNewSession()},L=()=>{b(!1)},q=()=>{C()},Q=i==="inline";return R?null:k&&!t?!Q&&!E?g.jsx("div",{className:`${je.widget} ${je[i]} ${p??""}`,style:x,children:g.jsx(Rn,{onClick:()=>b(!0),agentName:a})}):g.jsx("div",{className:`${je.widget} ${je[i]} ${p??""}`,style:x,children:g.jsx(Yu,{errorType:k,message:U,onRetry:q,onClose:Q?void 0:L})}):g.jsx("div",{className:`${je.widget} ${je[i]} ${p??""}`,style:x,children:E||Q?g.jsx(Br,{config:j,messages:T.messages,isLoading:T.isLoading,onSendMessage:T.sendMessage,onClose:Q?void 0:L,onNewChat:A}):g.jsx(Rn,{onClick:()=>b(!0),agentName:j.agentName,agentLogoUrl:j.agentLogoUrl})})};function Zu(){if(typeof crypto<"u"&&crypto.randomUUID)return`bb-${crypto.randomUUID()}`;const e=Date.now().toString(36),n=Math.random().toString(36).substring(2,15),t=Math.random().toString(36).substring(2,15);return`bb-${e}-${n}${t}`}exports.ChatContainer=Br;exports.ChatHeader=Kt;exports.ChatToggleButton=Rn;exports.ChatWidget=Qu;exports.Message=Ar;exports.MessageInput=Dr;exports.MessageList=Mr;exports.ToolCallDisplay=jr;exports.TypingIndicator=zr;exports.clearSession=Tn;exports.createAPIClient=Yt;exports.createMockAPIClient=Xt;exports.generateSessionId=Zu;exports.getStoredSession=Ut;exports.storeSession=vn;exports.useChat=qt;