@eka-care/medassist-widget 0.0.18 → 0.0.21
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/medassist-widget.js
CHANGED
|
@@ -40,7 +40,7 @@ Error generating stack: `+a.message+`
|
|
|
40
40
|
max-height: 100svh;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
`}),z.jsxs(da,{className:b,children:[z.jsx("div",{className:"flex-shrink-0 sticky top-0 z-50",children:z.jsx(r1,{onClose:l,title:s,iconUrl:i,startNewConversation:o})}),z.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:u}),c&&z.jsx("div",{className:"flex-shrink-0 sticky bottom-0 z-50",children:z.jsx(q.Suspense,{fallback:null,children:z.jsx(i1,{value:c.value,onChange:c.onChange,onSend:c.onSend,onFileChange:c.onFileChange,onRecording:c.onRecording,isRecording:c.isRecording,hasAttachment:c.hasAttachment,attachmentFiles:c.attachmentFiles,isDisabled:c.isDisabled,isMobile:f,placeholder:c.placeholder,recordingStatus:c.recordingStatus})})})]})]})}function Wh(){const[n,l]=q.useState(typeof navigator<"u"?navigator.onLine:!0);return q.useEffect(()=>{const i=()=>l(!0),o=()=>l(!1);return window.addEventListener("online",i),window.addEventListener("offline",o),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",o)}},[]),{isOnline:n}}const l1=({environment:n,userId:l,onInlineText:i})=>{const[o,u]=q.useState([]),[s,c]=q.useState(!1),[f,h]=q.useState(0),[p,g]=q.useState(!1),[b,v]=q.useState([]),y=q.useRef(null),C=q.useRef(null),{isOnline:E}=Wh(),{agentId:T,setSessionId:_,setSessionToken:A,sessionId:k,sessionToken:P,setError:H,setConnectionStatus:D,setShowRetryButton:B,setStartNewConnection:Y,setIsStreaming:F,setIsWaitingForResponse:$,isStreaming:ie,initialMessage:M,isWaitingForResponse:re,setProgressMessage:w,setRecordingStatus:V,clearSession:Z,addMessageToSession:Q,getMessagesForSession:se,updateMessageInSession:de,setInitialMessage:I}=Yr();q.useEffect(()=>{E?p?U()&&(D(Ge.ConnectionStatus.CONNECTED),ne()):D(Ge.ConnectionStatus.CONNECTING):D(Ge.ConnectionStatus.NOT_CONNECTED)},[E,p]),q.useEffect(()=>{if(k){const S=se(k)||[];u(S),v([])}},[k]),q.useEffect(()=>{if(g(!1),!T)return;const S=new Ge.SynapseSDK({agentId:T,environment:n,userId:l,callbacks:{onError:K=>{if(K instanceof Ge.SynapseError)switch(K.code){case Ge.SynapseErrorCode.SESSION:D(Ge.ConnectionStatus.NOT_CONNECTED),B(!0);break;case Ge.SynapseErrorCode.RECORDING:H({title:"Recording failed",description:K?.displayMessage||"Please try again later"});break;default:H({title:"Something went wrong",description:"Please try again later"}),B(!0);break}},onSessionRefreshed:K=>{K?.session_id&&K?.session_token&&(_(K.session_id),A(K.session_token))}}});return y.current=S,g(!0),()=>{g(!1),y.current?.endSession(),y.current=null,C.current&&(clearTimeout(C.current),C.current=null)}},[T,n,l]),q.useEffect(()=>{const S=o[o.length-1];!S?.role||!k||(S?.role===On.USER?Q(k,S):!ie&&!S.isStored&&(u(K=>{const W=[...K];return W[W.length-1]={...S,isStored:!0},W}),Q(k,{...S,isStored:!0})))},[o,ie]),q.useEffect(()=>{const S=o[o.length-1];return()=>{S&&!S?.isStored&&k&&Q(k,{...S,isStored:!0})}},[]),q.useEffect(()=>(C.current&&(clearTimeout(C.current),C.current=null),re&&!ie?C.current=setTimeout(()=>{$(!1),C.current=null},3e4):ie&&C.current&&(clearTimeout(C.current),C.current=null),()=>{C.current&&(clearTimeout(C.current),C.current=null)}),[re,ie,$]);const N=async(S=!1)=>{try{if(!y.current){H({title:"SDK not initialized",description:"Please ensure agentId is configured"}),c(!1);return}c(!0);let K;S?(await Z(),ne(),K=await y.current.startSession()):K=await y.current.startSession({session_id:k||"",session_token:P||""}),K?.session_id&&K?.session_token&&(_(K.session_id),A(K.session_token),K?.initial_message?.text&&K?.initial_message?.suggestions?.length&&I(K.initial_message)),ce()}catch{H({title:"Something Went wrong!",description:"Please try again later."}),c(!1);return}finally{c(!1)}},U=()=>y.current?.isConnected()??!1,O=()=>{y.current?.endSession()},ne=()=>{h(0),B(!1),Y(!1),H(null)},ce=()=>{y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.MESSAGE_CHUNK,S=>{const K=S;if(K.data?.text&&K.messageId){ie||($(!1),F(!0));const W=K.data.text,j=K.messageId,L=K.timestamp;u(X=>{const he=X[X.length-1];if(he&&he.id===j&&he.role===On.ASSISTANT){const ge=[...X];return ge[ge.length-1]={...he,content:he.content+W},ge}else return[...X,{id:j,content:W,role:On.ASSISTANT,timestamp:fa(L??Date.now()),isStored:!1}]})}}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.END_OF_STREAM,()=>{F(!1),w(null)}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.CONNECTED,()=>{ne(),D(Ge.ConnectionStatus.CONNECTED)}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.TOOL_CALL,S=>{const K=S;if(!K?.messageId||!K?.data||!K?.data?.details?.component)return;const W=K.messageId,j=K.timestamp??Date.now();u(L=>{const X=L[L.length-1];if(X.id===W&&X.role===On.ASSISTANT){const he=[...L],ge={...X,toolEscalationData:{...K.data,isResponded:!1},isResponseFromTool:!0};return he[L.length-1]=ge,de(k,W,ge),he}else{const he={id:W,content:K.data?.text||"",role:On.ASSISTANT,toolEscalationData:{...K.data,isResponded:!1},isResponseFromTool:!0,timestamp:fa(j),isStored:!1};return[...L,he]}})}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.DISCONNECTED,S=>{D(Ge.ConnectionStatus.NOT_CONNECTED),f<2?(h(K=>K+1),B(!0)):Y(!0)}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.ERROR,S=>{B(!0)}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.INLINE_TEXT,S=>{const K=S;K?.data?.text&&i&&(V(Ft.IDLE),i?.(K.data.text)),F(!1),$(!1),w(null)}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.PROGRESS_MESSAGE,S=>{const K=S;K.data?.text&&($(!1),w(K.data.text))})},we=async({message:S,messageId:K,files:W,audio:j,toolCalled:L})=>{if(!U()||W&&W.length<0&&S?.trim()===""&&!j?.audio)return;H(null);const X=o.length==2&&b.length==2?b:null;if(S||W&&W.length>0||j?.audio){const he=o.length-1,ge=he>=0?o[he]:null,le=ge?ge?.isResponseFromTool||ge.role===On.ASSISTANT&&ge.toolEscalationData:null;await y.current?.sendMessage({message:S,files:W,audio:j,...X&&{initial_prompts:X},...le&&!L?{tool_declined:!0,tool_id:ge?.toolEscalationData?.tool_id||""}:{}}),u(Ee=>{const _e=[...Ee],Se=_e.length-1;return le&&Se>=0&&_e[Se].toolEscalationData&&(_e[Se]={..._e[Se],toolEscalationData:{..._e[Se].toolEscalationData,tool_id:null,isResponded:!0}},de(k,_e[he].id||Date.now().toString(),_e[he])),[..._e,{id:K||Date.now().toString(),content:S||"",files:W||[],role:On.USER,timestamp:fa(Date.now()),isStored:!0}]}),$(!0)}};return{sendMessage:we,startSession:N,incomingMessages:o,loading:s,endSession:O,isReady:p,startRecording:async()=>{if(!U())throw new Error("Not connected to the server");try{await y.current?.startRecording({onChunks:async S=>{V(Ft.PROCESSING),await we({audio:S}),V(Ft.TRANSCRIBING)},onError(S){V(Ft.IDLE)}}),V(Ft.LISTENING)}catch(S){throw V(Ft.IDLE),S}},stopRecording:()=>{U()&&y.current?.endRecording()},handleRetry:async()=>{if(!U())ne(),await N(!1);else{const S=o[o.length-1];S&&S.role===On.USER&&y.current?.sendMessage({message:S.content,files:S.files||[],messageId:S.id})}},isValidFile:S=>{const K=S.type.toLowerCase(),j=S.name.toLowerCase().split(".").pop()||"";return K&&["application/pdf","image/jpeg","image/jpg","image/png","image/heic","image/heif","application/vnd.openxmlformats-officedocument.wordprocessingml.document","image/tiff","text/plain","text/markdown"].some(X=>K.includes(X))?!0:!K||K===""?["pdf","jpg","jpeg","png","heic","docx","tiff","txt","md"].includes(j):!1},handleStartNewConnection:async()=>{ne(),await Z(),await N(!0)},callTool:async(S,K)=>{try{if(!U())throw new Error("Not connected to the server");const W=await y.current?.callTool(S,K);if(!W)throw new Error("Failed to call tool");return W}catch(W){throw W}},handleInitialTaskClick:async S=>{if(!M?.suggestions.length||!S)return;const K=M.suggestions.find(W=>W.value===S);if(!K||!K.response){await we({message:S});return}u(W=>[...W,{id:Date.now().toString(),content:S,role:On.USER,timestamp:fa(Date.now()),isStored:!0}]),$(!0),await Jv(1e3),$(!1),u(W=>[...W,{id:Date.now().toString(),content:K.response||"Please try again",role:On.ASSISTANT,timestamp:fa(Date.now()),isStored:!1}]),v([{role:"user",text:S},{role:"assistant",text:K.response}])}}},o1=q.lazy(()=>Promise.resolve().then(()=>Gw)),s1=q.lazy(()=>Promise.resolve().then(()=>Kw)),u1=q.lazy(()=>Promise.resolve().then(()=>Jw).then(n=>({default:n.ConnectionStatus})));function c1({isOpen:n,agentId:l,config:i}){const[o,u]=q.useState(""),[s,c]=q.useState(!1),[f,h]=q.useState(!1),[p,g]=q.useState([]),b=q.useRef(!1),v=q.useRef(null),y=q.useRef(null),[C,E]=q.useState(!1),T=q.useRef(0),{setAgentId:_,startNewConnection:A,showRetryButton:k,clearError:P,error:H,connectionStatus:D,recordingStatus:B,isWaitingForResponse:Y,isStreaming:F,setError:$,initialMessage:ie}=Yr(),{incomingMessages:M,loading:re,sendMessage:w,startSession:V,isReady:Z,startRecording:Q,stopRecording:se,handleRetry:de,handleStartNewConnection:I,isValidFile:N,callTool:U,handleInitialTaskClick:O}=l1({environment:"production",onInlineText:j=>{u(L=>L+j)}});q.useEffect(()=>{l&&(_(l),n&&Z&&!b.current&&(b.current=!0,V(!1)))},[n,Z,l]);const ne=()=>v.current?.querySelector("[data-radix-scroll-area-viewport]")||null,ce=()=>{const j=ne();j&&(j.scrollTo({top:j.scrollHeight,behavior:"smooth"}),E(!1))},we=()=>{const j=ne();return j?j.scrollHeight-j.scrollTop-j.clientHeight<50:!0};q.useEffect(()=>{M.length>T.current&&(setTimeout(()=>{ce()},100),T.current=M.length)},[M.length]),q.useEffect(()=>{const j=ne();if(!j)return;const L=()=>{E(!we())},X=()=>{L()},he=new MutationObserver(()=>{L()});return he.observe(j,{childList:!0,subtree:!0}),j.addEventListener("scroll",X),L(),()=>{he.disconnect(),j.removeEventListener("scroll",X)}},[M.length]);const Te=M.length>0,ke=D===Ge.ConnectionStatus.CONNECTED,Ae=re||!ke||Y||F,Pe=re||!ke,ve=q.useMemo(()=>B===Ft.IDLE?null:B===Ft.LISTENING?"Listening...":B===Ft.PROCESSING?"Processing...":B===Ft.TRANSCRIBING?"Transcribing...":null,[B]),ze=Pe?"Connecting...":ve||(Y||F?"Please wait for the response...":"Ask me anything…"),je=async()=>{if(!Ae&&(o.trim()||s||f)){const j=Date.now().toString();p.length>0?(await w({files:p,message:o.trim(),messageId:j}),g([]),h(!1)):o.trim()&&await w({message:o,messageId:j}),u(""),c(!1),h(!1),setTimeout(()=>{ce()},100)}},S=async j=>{j&&await O(j)},K=j=>{if(j&&j.length>0){const L=j.filter(X=>N(X)?!0:($({title:`File type not supported: ${X.name}`,description:"Only PDF, images (JPG, JPEG, PNG, HEIC), documents (DOCX, TIFF), and text files (TXT, MD) are allowed."}),!1));if(L?.length>0)j=L;else return}g(L=>(h((L?.length??0)+(j?.length??0)>0),[...L,...j]))},W=async()=>{if(s)await se(),c(!1);else{if(Ae)return;try{await Q(),c(!0)}catch{}}};return z.jsx(a1,{isOpen:n,onClose:i.onClose,title:i.title,iconUrl:i.iconUrl,onStartNewSession:()=>V(!0),chatComposer:{value:o,onChange:u,onSend:je,onFileChange:K,onRecording:W,isRecording:s,hasAttachment:f,attachmentFiles:p,isDisabled:Ae,placeholder:ze,recordingStatus:B},children:!re&&z.jsx(q.Suspense,{fallback:z.jsx(f1,{}),children:z.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-white backdrop-blur-2xl relative",children:[z.jsx(Ud,{ref:v,className:"flex-1 min-h-0",children:z.jsxs("div",{className:Ye("transition-all duration-300",Te?"p-4 space-y-3":"p-6 space-y-6"),children:[!Te&&ie?.text?z.jsx(s1,{tasks:ie.suggestions,initialPrompt:ie.text,onTaskClick:S,disabled:Ae}):z.jsx(o1,{messages:M,onSendMessage:w,iconUrl:i.iconUrl,callTool:U}),z.jsx("div",{ref:y})]})}),C&&z.jsx("div",{className:"absolute bottom-20 left-1/2 transform -translate-x-1/2 z-10",children:z.jsx(kt,{onClick:ce,size:"icon",className:"h-10 w-10 rounded-full bg-white/90 backdrop-blur-sm shadow-lg border border-lavender-200/60 hover:bg-white hover:shadow-xl transition-all duration-200",children:z.jsx(Rs,{className:"w-5 h-5 text-slate-700"})})}),z.jsx(u1,{className:"mt-2",onRetry:de,onStartNewSession:I,showRetryButton:k,startNewConnection:A,clearError:P,error:H,isConnected:ke})]})})})}function f1(){return z.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-white backdrop-blur-2xl animate-pulse",children:[z.jsxs("div",{className:"flex-1 p-6 space-y-4",children:[z.jsx("div",{className:"h-16 bg-gray-100 rounded-2xl"}),z.jsx("div",{className:"h-16 bg-gray-100 rounded-2xl"}),z.jsx("div",{className:"h-16 bg-gray-100 rounded-2xl"})]}),z.jsx("div",{className:"h-24 border-t border-gray-100 bg-gray-50"})]})}function d1({agentId:n,config:l}){const[i,o]=q.useState(!1);q.useEffect(()=>{o(!0)},[]);const u=()=>{o(!1),l?.onClose?.()};return z.jsx(c1,{isOpen:i,agentId:n,config:{...l,environment:l.environment??"production",onClose:u,title:l.title??"Medi Clinic"}})}const $h=(n,l,i)=>{Lb.createRoot(n).render(z.jsx(q.StrictMode,{children:z.jsx(d1,{agentId:l,config:i||{}})}))};typeof window<"u"&&(window.renderMedAssist=$h);const em=q.forwardRef(({className:n,...l},i)=>z.jsx("textarea",{className:Ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:i,...l}));em.displayName="Textarea";function h1({value:n,onChange:l,onSend:i,onFileChange:o,onRecording:u,isRecording:s,hasAttachment:c,attachmentFiles:f,isDisabled:h,placeholder:p,isMobile:g,recordingStatus:b}){const v=q.useRef(null),y=q.useRef(null),C=n.trim().length>0||c,E=(h||b!==Ft.IDLE)&&!s,T=Ye("rounded-full transition-all duration-200 ",s?"bg-gradient-to-r from-rose-400 via-lavender-500 to-indigo-500 text-white ring-2 ring-white/60 animate-pulse shadow-[0_0_20px_rgba(139,92,246,0.45)]":E?"text-lavender-300 cursor-not-allowed shadow-none":"text-lavender-600 hover:bg-gray-100"),_=D=>{const B=Array.from(D.target.files||[]);B.length>0&&o(B)},A=()=>{h||v.current?.click()},k=D=>{D.key==="Enter"&&!D.shiftKey&&C&&!h&&(D.preventDefault(),i())},P=D=>{D.style.height="auto",D.style.overflow="hidden";const B=D.scrollHeight,Y=40,F=120,$=Math.max(Y,Math.min(B,F));D.style.height=$+"px",B>F?D.style.overflow="auto":D.style.overflow="hidden"},H=D=>{P(D.currentTarget)};return q.useEffect(()=>{y.current&&P(y.current)},[n]),q.useEffect(()=>{!h&&!g&&y.current?.focus()},[h]),z.jsxs("div",{className:"border-t border-white/20 bg-white/70 backdrop-blur-xl p-4",children:[z.jsx("input",{ref:v,type:"file",multiple:!0,accept:"image/jpeg, image/png, image/jpg, image/tiff, application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document, text/plain, text/markdown, image/heif, image/heic",className:"hidden",onChange:_,disabled:h,title:"Attach file","aria-label":"Attach file"}),z.jsxs("div",{className:Ye("flex items-center gap-2 bg-white/70 backdrop-blur rounded-xl px-4 py-2 shadow-md focus-within:border-lavender-100/50 focus-within:ring-2 focus-within:ring-lavender-400/50 transition-all",s||c?"ring-2 ring-lavender-200/40":"ring-2 ring-lavender-300/40 backdrop-blur-xl",h&&"opacity-60"),children:[c&&f.length>0&&z.jsxs("span",{className:"text-xs text-lavender-600 mr-2",children:[f.length," file(s)"]}),z.jsx(em,{ref:y,onInput:H,placeholder:p,value:n,onChange:D=>l(D.target.value),rows:1,maxLength:1e3,autoFocus:!h,style:{wordBreak:"break-word",overflowWrap:"anywhere",minHeight:"40px",maxHeight:"120px",fontSize:window.innerWidth<=768?"16px":"14px"},onKeyPress:k,disabled:h,title:"Enter your message",className:"flex-1 border-0 outline-none focus-visible:ring-0 focus-visible:ring-offset-0 text-sm !placeholder:text-gray-400 bg-transparent disabled:cursor-not-allowed rounded-none break-words overflow-wrap-anywhere whitespace-pre-wrap"}),z.jsx(kt,{type:"button",variant:"ghost",size:"icon",onClick:A,disabled:h,className:`rounded-full transition-all ${c?"bg-lavender-200/30 text-lavender-600 hover:bg-lavender-200/40":"hover:bg-gray-100 text-lavender-600 hover:text-gray-700"}`,title:"Attach file",children:z.jsx(ES,{className:"w-5 h-5"})}),s?z.jsx(kt,{type:"button",variant:"ghost",size:"icon",onClick:u,className:"rounded-full bg-gradient-to-r from-red-400 to-rose-500 text-white hover:from-red-500 hover:to-rose-600 shadow-lg transition-all duration-200 hover:scale-105 active:scale-95",title:"Stop recording",children:z.jsx(_S,{className:"w-4 h-4"})}):z.jsx(kt,{type:"button",variant:"ghost",size:"icon",onClick:u,disabled:E,className:T,title:"Start recording",children:z.jsx(SS,{className:"w-5 h-5"})}),C&&!h&&z.jsx(kt,{type:"button",size:"icon",onClick:i,className:"h-10 w-10 bg-gradient-to-r from-lavender-400 to-lavender-500 hover:from-lavender-500 hover:to-lavender-600 rounded-full text-white transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95",children:z.jsx(xS,{className:"w-4 h-4"})})]})]})}const m1=Object.freeze(Object.defineProperty({__proto__:null,default:h1},Symbol.toStringTag,{value:"Module"}));function zT(){}function MT(){}function p1(n,l){const i={};return(n[n.length-1]===""?[...n,""]:n).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const g1=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,y1=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,b1={};function tm(n,l){return(b1.jsx?y1:g1).test(n)}const v1=/[ \t\n\f\r]/g;function S1(n){return typeof n=="object"?n.type==="text"?nm(n.value):!1:nm(n)}function nm(n){return n.replace(v1,"")===""}class Na{constructor(l,i,o){this.normal=i,this.property=l,o&&(this.space=o)}}Na.prototype.normal={},Na.prototype.property={},Na.prototype.space=void 0;function rm(n,l){const i={},o={};for(const u of n)Object.assign(i,u.property),Object.assign(o,u.normal);return new Na(i,o,l)}function Gs(n){return n.toLowerCase()}class Yt{constructor(l,i){this.attribute=i,this.property=l}}Yt.prototype.attribute="",Yt.prototype.booleanish=!1,Yt.prototype.boolean=!1,Yt.prototype.commaOrSpaceSeparated=!1,Yt.prototype.commaSeparated=!1,Yt.prototype.defined=!1,Yt.prototype.mustUseProperty=!1,Yt.prototype.number=!1,Yt.prototype.overloadedBoolean=!1,Yt.prototype.property="",Yt.prototype.spaceSeparated=!1,Yt.prototype.space=void 0;let E1=0;const qe=Vr(),xt=Vr(),Xs=Vr(),xe=Vr(),ft=Vr(),gi=Vr(),en=Vr();function Vr(){return 2**++E1}const Zs=Object.freeze(Object.defineProperty({__proto__:null,boolean:qe,booleanish:xt,commaOrSpaceSeparated:en,commaSeparated:gi,number:xe,overloadedBoolean:Xs,spaceSeparated:ft},Symbol.toStringTag,{value:"Module"})),Ks=Object.keys(Zs);class Qs extends Yt{constructor(l,i,o,u){let s=-1;if(super(l,i),im(this,"space",u),typeof o=="number")for(;++s<Ks.length;){const c=Ks[s];im(this,Ks[s],(o&Zs[c])===Zs[c])}}}Qs.prototype.defined=!0;function im(n,l,i){i&&(n[l]=i)}function yi(n){const l={},i={};for(const[o,u]of Object.entries(n.properties)){const s=new Qs(o,n.transform(n.attributes||{},o),u,n.space);n.mustUseProperty&&n.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),l[o]=s,i[Gs(o)]=o,i[Gs(s.attribute)]=o}return new Na(l,i,n.space)}const am=yi({properties:{ariaActiveDescendant:null,ariaAtomic:xt,ariaAutoComplete:null,ariaBusy:xt,ariaChecked:xt,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:ft,ariaCurrent:null,ariaDescribedBy:ft,ariaDetails:null,ariaDisabled:xt,ariaDropEffect:ft,ariaErrorMessage:null,ariaExpanded:xt,ariaFlowTo:ft,ariaGrabbed:xt,ariaHasPopup:null,ariaHidden:xt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ft,ariaLevel:xe,ariaLive:null,ariaModal:xt,ariaMultiLine:xt,ariaMultiSelectable:xt,ariaOrientation:null,ariaOwns:ft,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:xt,ariaReadOnly:xt,ariaRelevant:null,ariaRequired:xt,ariaRoleDescription:ft,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:xt,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null},transform(n,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function lm(n,l){return l in n?n[l]:l}function om(n,l){return lm(n,l.toLowerCase())}const x1=yi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:gi,acceptCharset:ft,accessKey:ft,action:null,allow:null,allowFullScreen:qe,allowPaymentRequest:qe,allowUserMedia:qe,alt:null,as:null,async:qe,autoCapitalize:null,autoComplete:ft,autoFocus:qe,autoPlay:qe,blocking:ft,capture:null,charSet:null,checked:qe,cite:null,className:ft,cols:xe,colSpan:null,content:null,contentEditable:xt,controls:qe,controlsList:ft,coords:xe|gi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:qe,defer:qe,dir:null,dirName:null,disabled:qe,download:Xs,draggable:xt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:qe,formTarget:null,headers:ft,height:xe,hidden:Xs,high:xe,href:null,hrefLang:null,htmlFor:ft,httpEquiv:ft,id:null,imageSizes:null,imageSrcSet:null,inert:qe,inputMode:null,integrity:null,is:null,isMap:qe,itemId:null,itemProp:ft,itemRef:ft,itemScope:qe,itemType:ft,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:qe,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:qe,muted:qe,name:null,nonce:null,noModule:qe,noValidate:qe,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:qe,optimum:xe,pattern:null,ping:ft,placeholder:null,playsInline:qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:qe,referrerPolicy:null,rel:ft,required:qe,reversed:qe,rows:xe,rowSpan:xe,sandbox:ft,scope:null,scoped:qe,seamless:qe,selected:qe,shadowRootClonable:qe,shadowRootDelegatesFocus:qe,shadowRootMode:null,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:xt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:qe,useMap:null,value:xt,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ft,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:qe,declare:qe,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:qe,noHref:qe,noShade:qe,noWrap:qe,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:xt,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:qe,disableRemotePlayback:qe,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:om}),_1=yi({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:en,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:ft,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:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:qe,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,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:gi,g2:gi,glyphName:gi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:en,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,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:xe,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:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ft,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:en,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:en,rev:en,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:en,requiredFeatures:en,requiredFonts:en,requiredFormats:en,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:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:en,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:en,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:en,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:lm}),sm=yi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,l){return"xlink:"+l.slice(5).toLowerCase()}}),um=yi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:om}),cm=yi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,l){return"xml:"+l.slice(3).toLowerCase()}}),w1={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"},C1=/[A-Z]/g,fm=/-[a-z]/g,T1=/^data[-\w.:]+$/i;function A1(n,l){const i=Gs(l);let o=l,u=Yt;if(i in n.normal)return n.property[n.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&T1.test(l)){if(l.charAt(4)==="-"){const s=l.slice(5).replace(fm,N1);o="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=l.slice(4);if(!fm.test(s)){let c=s.replace(C1,k1);c.charAt(0)!=="-"&&(c="-"+c),l="data"+c}}u=Qs}return new u(o,l)}function k1(n){return"-"+n.toLowerCase()}function N1(n){return n.charAt(1).toUpperCase()}const R1=rm([am,x1,sm,um,cm],"html"),Js=rm([am,_1,sm,um,cm],"svg");function O1(n){return n.join(" ").trim()}var bi={},Ws,dm;function z1(){if(dm)return Ws;dm=1;var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,i=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,u=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
43
|
+
`}),z.jsxs(da,{className:b,children:[z.jsx("div",{className:"flex-shrink-0 sticky top-0 z-50",children:z.jsx(r1,{onClose:l,title:s,iconUrl:i,startNewConversation:o})}),z.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:u}),c&&z.jsx("div",{className:"flex-shrink-0 sticky bottom-0 z-50",children:z.jsx(q.Suspense,{fallback:null,children:z.jsx(i1,{value:c.value,onChange:c.onChange,onSend:c.onSend,onFileChange:c.onFileChange,onRecording:c.onRecording,isRecording:c.isRecording,hasAttachment:c.hasAttachment,attachmentFiles:c.attachmentFiles,isDisabled:c.isDisabled,isMobile:f,placeholder:c.placeholder,recordingStatus:c.recordingStatus})})})]})]})}function Wh(){const[n,l]=q.useState(typeof navigator<"u"?navigator.onLine:!0);return q.useEffect(()=>{const i=()=>l(!0),o=()=>l(!1);return window.addEventListener("online",i),window.addEventListener("offline",o),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",o)}},[]),{isOnline:n}}const l1=({environment:n,userId:l,onInlineText:i})=>{const[o,u]=q.useState([]),[s,c]=q.useState(!1),[f,h]=q.useState(0),[p,g]=q.useState(!1),[b,v]=q.useState([]),y=q.useRef(null),C=q.useRef(null),{isOnline:E}=Wh(),{agentId:T,setSessionId:_,setSessionToken:A,sessionId:k,sessionToken:P,setError:H,setConnectionStatus:D,setShowRetryButton:B,setStartNewConnection:Y,setIsStreaming:F,setIsWaitingForResponse:$,isStreaming:ie,initialMessage:M,isWaitingForResponse:re,setProgressMessage:w,setRecordingStatus:V,clearSession:Z,addMessageToSession:Q,getMessagesForSession:se,updateMessageInSession:de,setInitialMessage:I}=Yr();q.useEffect(()=>{E?p?U()&&(D(Ge.ConnectionStatus.CONNECTED),ne()):D(Ge.ConnectionStatus.CONNECTING):D(Ge.ConnectionStatus.NOT_CONNECTED)},[E,p]),q.useEffect(()=>{if(k){const S=se(k)||[];u(S),v([])}},[k]),q.useEffect(()=>{if(g(!1),!T)return;const S=new Ge.SynapseSDK({agentId:T,environment:n,userId:l,callbacks:{onError:K=>{if(K instanceof Ge.SynapseError)switch(K.code){case Ge.SynapseErrorCode.SESSION:D(Ge.ConnectionStatus.NOT_CONNECTED),B(!0);break;case Ge.SynapseErrorCode.RECORDING:H({title:"Recording failed",description:K?.displayMessage||"Please try again later"});break;default:H({title:"Something went wrong",description:"Please try again later"}),B(!0);break}},onSessionRefreshed:K=>{K?.session_id&&K?.session_token&&(_(K.session_id),A(K.session_token))}}});return y.current=S,g(!0),()=>{g(!1),y.current?.endSession(),y.current=null,C.current&&(clearTimeout(C.current),C.current=null)}},[T,n,l]),q.useEffect(()=>{const S=o[o.length-1];!S?.role||!k||(S?.role===On.USER?Q(k,S):!ie&&!S.isStored&&(u(K=>{const W=[...K];return W[W.length-1]={...S,isStored:!0},W}),Q(k,{...S,isStored:!0})))},[o,ie]),q.useEffect(()=>{const S=o[o.length-1];return()=>{S&&!S?.isStored&&k&&Q(k,{...S,isStored:!0})}},[]),q.useEffect(()=>(C.current&&(clearTimeout(C.current),C.current=null),re&&!ie?C.current=setTimeout(()=>{$(!1),C.current=null},3e4):ie&&C.current&&(clearTimeout(C.current),C.current=null),()=>{C.current&&(clearTimeout(C.current),C.current=null)}),[re,ie,$]);const N=async(S=!1)=>{try{if(!y.current){H({title:"SDK not initialized",description:"Please ensure agentId is configured"}),c(!1);return}c(!0);let K;S?(await Z(),ne(),K=await y.current.startSession()):K=await y.current.startSession({session_id:k||"",session_token:P||""}),K?.session_id&&K?.session_token&&(_(K.session_id),A(K.session_token),K?.initial_message?.text&&K?.initial_message?.suggestions?.length&&I(K.initial_message)),ce()}catch{H({title:"Something Went wrong!",description:"Please try again later."}),c(!1);return}finally{c(!1)}},U=()=>y.current?.isConnected()??!1,O=()=>{y.current?.endSession()},ne=()=>{h(0),B(!1),Y(!1),H(null)},ce=()=>{y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.MESSAGE_CHUNK,S=>{const K=S;if(K.data?.text&&K.messageId){ie||($(!1),F(!0));const W=K.data.text,j=K.messageId,L=K.timestamp;u(X=>{const he=X[X.length-1];if(he&&he.id===j&&he.role===On.ASSISTANT){const ge=[...X];return ge[ge.length-1]={...he,content:he.content+W},ge}else return[...X,{id:j,content:W,role:On.ASSISTANT,timestamp:fa(L??Date.now()),isStored:!1}]})}}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.END_OF_STREAM,()=>{F(!1),w(null)}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.CONNECTED,()=>{ne(),D(Ge.ConnectionStatus.CONNECTED)}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.TOOL_CALL,S=>{const K=S;if(!K?.messageId||!K?.data||!K?.data?.details?.component)return;const W=K.messageId,j=K.timestamp??Date.now();u(L=>{const X=L[L.length-1];if(X.id===W&&X.role===On.ASSISTANT){const he=[...L],ge={...X,toolEscalationData:{...K.data,isResponded:!1},isResponseFromTool:!0};return he[L.length-1]=ge,de(k,W,ge),he}else{const he={id:W,content:K.data?.text||"",role:On.ASSISTANT,toolEscalationData:{...K.data,isResponded:!1},isResponseFromTool:!0,timestamp:fa(j),isStored:!1};return[...L,he]}})}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.DISCONNECTED,S=>{D(Ge.ConnectionStatus.NOT_CONNECTED),f<2?(h(K=>K+1),B(!0)):Y(!0)}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.ERROR,S=>{B(!0)}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.INLINE_TEXT,S=>{const K=S;K?.data?.text&&i&&(V(Ft.IDLE),i?.(K.data.text)),F(!1),$(!1),w(null)}),y.current?.on(Ge.SYNAPSE_REALTIME_EVENTS.PROGRESS_MESSAGE,S=>{const K=S;K.data?.text&&($(!1),w(K.data.text))})},we=async({message:S,messageId:K,files:W,audio:j,toolCalled:L})=>{if(!U()||W&&W.length<0&&S?.trim()===""&&!j?.audio)return;H(null);const X=o.length==2&&b.length==2?b:null;if(S||W&&W.length>0||j?.audio){const he=o.length-1,ge=he>=0?o[he]:null,le=ge?ge?.isResponseFromTool||ge.role===On.ASSISTANT&&ge.toolEscalationData:null;await y.current?.sendMessage({message:S,files:W,audio:j,...X&&{initial_prompts:X},...le&&!L?{tool_declined:!0,tool_id:ge?.toolEscalationData?.tool_id||""}:{}}),u(Ee=>{const _e=[...Ee],Se=_e.length-1;return le&&Se>=0&&_e[Se].toolEscalationData&&(_e[Se]={..._e[Se],toolEscalationData:{..._e[Se].toolEscalationData,tool_id:null,isResponded:!0}},de(k,_e[he].id||Date.now().toString(),_e[he])),[..._e,{id:K||Date.now().toString(),content:S||"",files:W||[],role:On.USER,timestamp:fa(Date.now()),isStored:!0}]}),$(!0)}};return{sendMessage:we,startSession:N,incomingMessages:o,loading:s,endSession:O,isReady:p,startRecording:async()=>{if(!U())throw new Error("Not connected to the server");try{await y.current?.startRecording({onChunks:async S=>{V(Ft.PROCESSING),await we({audio:S}),V(Ft.TRANSCRIBING)},onError(S){V(Ft.IDLE)}}),V(Ft.LISTENING)}catch(S){throw V(Ft.IDLE),S}},stopRecording:()=>{U()&&y.current?.endRecording()},handleRetry:async()=>{if(!U())ne(),await N(!1);else{const S=o[o.length-1];S&&S.role===On.USER&&y.current?.sendMessage({message:S.content,files:S.files||[],messageId:S.id})}},isValidFile:S=>{const K=S.type.toLowerCase(),j=S.name.toLowerCase().split(".").pop()||"";return K&&["application/pdf","image/jpeg","image/jpg","image/png","image/heic","image/heif","application/vnd.openxmlformats-officedocument.wordprocessingml.document","image/tiff","text/plain","text/markdown"].some(X=>K.includes(X))?!0:!K||K===""?["pdf","jpg","jpeg","png","heic","docx","tiff","txt","md"].includes(j):!1},handleStartNewConnection:async()=>{ne(),await Z(),await N(!0)},callTool:async(S,K)=>{try{if(!U())throw new Error("Not connected to the server");const W=await y.current?.callTool(S,K);if(!W)throw new Error("Failed to call tool");return W}catch(W){throw W}},handleInitialTaskClick:async S=>{if(!M?.suggestions.length||!S)return;const K=M.suggestions.find(W=>W.value===S);if(!K||!K.response){await we({message:S});return}u(W=>[...W,{id:Date.now().toString(),content:S,role:On.USER,timestamp:fa(Date.now()),isStored:!0}]),$(!0),await Jv(1e3),$(!1),u(W=>[...W,{id:Date.now().toString(),content:K.response||"Please try again",role:On.ASSISTANT,timestamp:fa(Date.now()),isStored:!1}]),v([{role:"user",text:S},{role:"assistant",text:K.response}])}}},o1=q.lazy(()=>Promise.resolve().then(()=>Gw)),s1=q.lazy(()=>Promise.resolve().then(()=>Kw)),u1=q.lazy(()=>Promise.resolve().then(()=>Jw).then(n=>({default:n.ConnectionStatus})));function c1({isOpen:n,agentId:l,config:i}){const[o,u]=q.useState(""),[s,c]=q.useState(!1),[f,h]=q.useState(!1),[p,g]=q.useState([]),b=q.useRef(!1),v=q.useRef(null),y=q.useRef(null),[C,E]=q.useState(!1),T=q.useRef(0),{setAgentId:_,startNewConnection:A,showRetryButton:k,clearError:P,error:H,connectionStatus:D,recordingStatus:B,isWaitingForResponse:Y,isStreaming:F,setError:$,initialMessage:ie}=Yr(),{incomingMessages:M,loading:re,sendMessage:w,startSession:V,isReady:Z,startRecording:Q,stopRecording:se,handleRetry:de,handleStartNewConnection:I,isValidFile:N,callTool:U,handleInitialTaskClick:O}=l1({environment:"production",onInlineText:j=>{u(L=>L+j)}});q.useEffect(()=>{l&&(_(l),n&&Z&&!b.current&&(b.current=!0,V(!1)))},[n,Z,l]);const ne=()=>v.current?.querySelector("[data-radix-scroll-area-viewport]")||null,ce=()=>{const j=ne();j&&(j.scrollTo({top:j.scrollHeight,behavior:"smooth"}),E(!1))},we=()=>{const j=ne();return j?j.scrollHeight-j.scrollTop-j.clientHeight<50:!0};q.useEffect(()=>{M.length>T.current&&(setTimeout(()=>{ce()},100),T.current=M.length)},[M.length]),q.useEffect(()=>{const j=ne();if(!j)return;const L=()=>{E(!we())},X=()=>{L()},he=new MutationObserver(()=>{L()});return he.observe(j,{childList:!0,subtree:!0}),j.addEventListener("scroll",X),L(),()=>{he.disconnect(),j.removeEventListener("scroll",X)}},[M.length]);const Te=M.length>0,ke=D===Ge.ConnectionStatus.CONNECTED,Ae=re||!ke||Y||F,Pe=re||!ke,ve=q.useMemo(()=>B===Ft.IDLE?null:B===Ft.LISTENING?"Listening...":B===Ft.PROCESSING?"Processing...":B===Ft.TRANSCRIBING?"Transcribing...":null,[B]),ze=Pe?"Connecting...":ve||(Y||F?"Please wait for the response...":"Ask me anything…"),je=async()=>{if(!Ae&&(o.trim()||s||f)){const j=Date.now().toString();p.length>0?(await w({files:p,message:o.trim(),messageId:j}),g([]),h(!1)):o.trim()&&await w({message:o,messageId:j}),u(""),c(!1),h(!1),setTimeout(()=>{ce()},100)}},S=async j=>{j&&await O(j)},K=j=>{if(j&&j.length>0){const L=j.filter(X=>N(X)?!0:($({title:`File type not supported: ${X.name}`,description:"Only PDF, images (JPG, JPEG, PNG, HEIC), documents (DOCX, TIFF), and text files (TXT, MD) are allowed."}),!1));if(L?.length>0)j=L;else return}g(L=>(h((L?.length??0)+(j?.length??0)>0),[...L,...j]))},W=async()=>{if(s)await se(),c(!1);else{if(Ae)return;try{await Q(),c(!0)}catch{}}};return z.jsx(a1,{isOpen:n,onClose:i.onClose,title:i.title,iconUrl:i.iconUrl,onStartNewSession:()=>V(!0),chatComposer:{value:o,onChange:u,onSend:je,onFileChange:K,onRecording:W,isRecording:s,hasAttachment:f,attachmentFiles:p,isDisabled:Ae,placeholder:ze,recordingStatus:B},children:!re&&z.jsx(q.Suspense,{fallback:z.jsx(f1,{}),children:z.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-white backdrop-blur-2xl relative",children:[z.jsx(Ud,{ref:v,className:"flex-1 min-h-0",children:z.jsxs("div",{className:Ye("transition-all duration-300",Te?"p-4 space-y-3":"p-6 space-y-6"),children:[!Te&&ie?.text?z.jsx(s1,{tasks:ie.suggestions,initialPrompt:ie.text,onTaskClick:S,disabled:Ae}):z.jsx(o1,{messages:M,onSendMessage:w,iconUrl:i.iconUrl,callTool:U}),z.jsx("div",{ref:y})]})}),C&&z.jsx("div",{className:"absolute bottom-[10px] left-1/2 transform -translate-x-1/2 z-10",children:z.jsx(kt,{onClick:ce,size:"icon",className:"h-10 w-10 rounded-full bg-white/90 backdrop-blur-sm shadow-lg border border-lavender-200/60 hover:bg-white hover:shadow-xl transition-all duration-200",children:z.jsx(Rs,{className:"w-5 h-5 text-slate-700"})})}),z.jsx(u1,{className:"mt-2",onRetry:de,onStartNewSession:I,showRetryButton:k,startNewConnection:A,clearError:P,error:H,isConnected:ke})]})})})}function f1(){return z.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden bg-white backdrop-blur-2xl animate-pulse",children:[z.jsxs("div",{className:"flex-1 p-6 space-y-4",children:[z.jsx("div",{className:"h-16 bg-gray-100 rounded-2xl"}),z.jsx("div",{className:"h-16 bg-gray-100 rounded-2xl"}),z.jsx("div",{className:"h-16 bg-gray-100 rounded-2xl"})]}),z.jsx("div",{className:"h-24 border-t border-gray-100 bg-gray-50"})]})}function d1({agentId:n,config:l}){const[i,o]=q.useState(!1);q.useEffect(()=>{o(!0)},[]);const u=()=>{o(!1),l?.onClose?.()};return z.jsx(c1,{isOpen:i,agentId:n,config:{...l,environment:l.environment??"production",onClose:u,title:l.title??"Medi Clinic"}})}const $h=(n,l,i)=>{Lb.createRoot(n).render(z.jsx(q.StrictMode,{children:z.jsx(d1,{agentId:l,config:i||{}})}))};typeof window<"u"&&(window.renderMedAssist=$h);const em=q.forwardRef(({className:n,...l},i)=>z.jsx("textarea",{className:Ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:i,...l}));em.displayName="Textarea";function h1({value:n,onChange:l,onSend:i,onFileChange:o,onRecording:u,isRecording:s,hasAttachment:c,attachmentFiles:f,isDisabled:h,placeholder:p,isMobile:g,recordingStatus:b}){const v=q.useRef(null),y=q.useRef(null),C=n.trim().length>0||c,E=(h||b!==Ft.IDLE)&&!s,T=Ye("rounded-full transition-all duration-200 ",s?"bg-gradient-to-r from-rose-400 via-lavender-500 to-indigo-500 text-white ring-2 ring-white/60 animate-pulse shadow-[0_0_20px_rgba(139,92,246,0.45)]":E?"text-lavender-300 cursor-not-allowed shadow-none":"text-lavender-600 hover:bg-gray-100"),_=D=>{const B=Array.from(D.target.files||[]);B.length>0&&o(B)},A=()=>{h||v.current?.click()},k=D=>{D.key==="Enter"&&!D.shiftKey&&C&&!h&&(D.preventDefault(),i())},P=D=>{D.style.height="auto",D.style.overflow="hidden";const B=D.scrollHeight,Y=40,F=120,$=Math.max(Y,Math.min(B,F));D.style.height=$+"px",B>F?D.style.overflow="auto":D.style.overflow="hidden"},H=D=>{P(D.currentTarget)};return q.useEffect(()=>{y.current&&P(y.current)},[n]),q.useEffect(()=>{!h&&!g&&y.current?.focus()},[h]),z.jsxs("div",{className:"border-t border-white/20 bg-white/70 backdrop-blur-xl p-4",children:[z.jsx("input",{ref:v,type:"file",multiple:!0,accept:"image/jpeg, image/png, image/jpg, image/tiff, application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document, text/plain, text/markdown, image/heif, image/heic",className:"hidden",onChange:_,disabled:h,title:"Attach file","aria-label":"Attach file"}),z.jsxs("div",{className:Ye("flex items-center gap-2 bg-white/70 backdrop-blur rounded-xl px-4 py-2 shadow-md focus-within:border-lavender-100/50 focus-within:ring-2 focus-within:ring-lavender-400/50 transition-all",s||c?"ring-2 ring-lavender-200/40":"ring-2 ring-lavender-300/40 backdrop-blur-xl",h&&"opacity-60"),children:[c&&f.length>0&&z.jsxs("span",{className:"text-xs text-lavender-600 mr-2",children:[f.length," file(s)"]}),z.jsx(em,{ref:y,onInput:H,placeholder:p,value:n,onChange:D=>l(D.target.value),rows:1,maxLength:1e3,autoFocus:!h,style:{wordBreak:"break-word",overflowWrap:"anywhere",minHeight:"40px",maxHeight:"120px",fontSize:window.innerWidth<=768?"16px":"14px"},onKeyPress:k,disabled:h,title:"Enter your message",className:"flex-1 border-0 outline-none focus-visible:ring-0 focus-visible:ring-offset-0 text-sm !placeholder:text-gray-400 bg-transparent disabled:cursor-not-allowed rounded-none break-words overflow-wrap-anywhere whitespace-pre-wrap"}),z.jsx(kt,{type:"button",variant:"ghost",size:"icon",onClick:A,disabled:h,className:`rounded-full transition-all ${c?"bg-lavender-200/30 text-lavender-600 hover:bg-lavender-200/40":"hover:bg-gray-100 text-lavender-600 hover:text-gray-700"}`,title:"Attach file",children:z.jsx(ES,{className:"w-5 h-5"})}),s?z.jsx(kt,{type:"button",variant:"ghost",size:"icon",onClick:u,className:"rounded-full bg-gradient-to-r from-red-400 to-rose-500 text-white hover:from-red-500 hover:to-rose-600 shadow-lg transition-all duration-200 hover:scale-105 active:scale-95",title:"Stop recording",children:z.jsx(_S,{className:"w-4 h-4"})}):z.jsx(kt,{type:"button",variant:"ghost",size:"icon",onClick:u,disabled:E,className:T,title:"Start recording",children:z.jsx(SS,{className:"w-5 h-5"})}),C&&!h&&z.jsx(kt,{type:"button",size:"icon",onClick:i,className:"h-10 w-10 bg-gradient-to-r from-lavender-400 to-lavender-500 hover:from-lavender-500 hover:to-lavender-600 rounded-full text-white transition-all duration-200 shadow-lg hover:shadow-xl hover:scale-105 active:scale-95",children:z.jsx(xS,{className:"w-4 h-4"})})]})]})}const m1=Object.freeze(Object.defineProperty({__proto__:null,default:h1},Symbol.toStringTag,{value:"Module"}));function zT(){}function MT(){}function p1(n,l){const i={};return(n[n.length-1]===""?[...n,""]:n).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const g1=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,y1=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,b1={};function tm(n,l){return(b1.jsx?y1:g1).test(n)}const v1=/[ \t\n\f\r]/g;function S1(n){return typeof n=="object"?n.type==="text"?nm(n.value):!1:nm(n)}function nm(n){return n.replace(v1,"")===""}class Na{constructor(l,i,o){this.normal=i,this.property=l,o&&(this.space=o)}}Na.prototype.normal={},Na.prototype.property={},Na.prototype.space=void 0;function rm(n,l){const i={},o={};for(const u of n)Object.assign(i,u.property),Object.assign(o,u.normal);return new Na(i,o,l)}function Gs(n){return n.toLowerCase()}class Yt{constructor(l,i){this.attribute=i,this.property=l}}Yt.prototype.attribute="",Yt.prototype.booleanish=!1,Yt.prototype.boolean=!1,Yt.prototype.commaOrSpaceSeparated=!1,Yt.prototype.commaSeparated=!1,Yt.prototype.defined=!1,Yt.prototype.mustUseProperty=!1,Yt.prototype.number=!1,Yt.prototype.overloadedBoolean=!1,Yt.prototype.property="",Yt.prototype.spaceSeparated=!1,Yt.prototype.space=void 0;let E1=0;const qe=Vr(),xt=Vr(),Xs=Vr(),xe=Vr(),ft=Vr(),gi=Vr(),en=Vr();function Vr(){return 2**++E1}const Zs=Object.freeze(Object.defineProperty({__proto__:null,boolean:qe,booleanish:xt,commaOrSpaceSeparated:en,commaSeparated:gi,number:xe,overloadedBoolean:Xs,spaceSeparated:ft},Symbol.toStringTag,{value:"Module"})),Ks=Object.keys(Zs);class Qs extends Yt{constructor(l,i,o,u){let s=-1;if(super(l,i),im(this,"space",u),typeof o=="number")for(;++s<Ks.length;){const c=Ks[s];im(this,Ks[s],(o&Zs[c])===Zs[c])}}}Qs.prototype.defined=!0;function im(n,l,i){i&&(n[l]=i)}function yi(n){const l={},i={};for(const[o,u]of Object.entries(n.properties)){const s=new Qs(o,n.transform(n.attributes||{},o),u,n.space);n.mustUseProperty&&n.mustUseProperty.includes(o)&&(s.mustUseProperty=!0),l[o]=s,i[Gs(o)]=o,i[Gs(s.attribute)]=o}return new Na(l,i,n.space)}const am=yi({properties:{ariaActiveDescendant:null,ariaAtomic:xt,ariaAutoComplete:null,ariaBusy:xt,ariaChecked:xt,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:ft,ariaCurrent:null,ariaDescribedBy:ft,ariaDetails:null,ariaDisabled:xt,ariaDropEffect:ft,ariaErrorMessage:null,ariaExpanded:xt,ariaFlowTo:ft,ariaGrabbed:xt,ariaHasPopup:null,ariaHidden:xt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ft,ariaLevel:xe,ariaLive:null,ariaModal:xt,ariaMultiLine:xt,ariaMultiSelectable:xt,ariaOrientation:null,ariaOwns:ft,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:xt,ariaReadOnly:xt,ariaRelevant:null,ariaRequired:xt,ariaRoleDescription:ft,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:xt,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null},transform(n,l){return l==="role"?l:"aria-"+l.slice(4).toLowerCase()}});function lm(n,l){return l in n?n[l]:l}function om(n,l){return lm(n,l.toLowerCase())}const x1=yi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:gi,acceptCharset:ft,accessKey:ft,action:null,allow:null,allowFullScreen:qe,allowPaymentRequest:qe,allowUserMedia:qe,alt:null,as:null,async:qe,autoCapitalize:null,autoComplete:ft,autoFocus:qe,autoPlay:qe,blocking:ft,capture:null,charSet:null,checked:qe,cite:null,className:ft,cols:xe,colSpan:null,content:null,contentEditable:xt,controls:qe,controlsList:ft,coords:xe|gi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:qe,defer:qe,dir:null,dirName:null,disabled:qe,download:Xs,draggable:xt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:qe,formTarget:null,headers:ft,height:xe,hidden:Xs,high:xe,href:null,hrefLang:null,htmlFor:ft,httpEquiv:ft,id:null,imageSizes:null,imageSrcSet:null,inert:qe,inputMode:null,integrity:null,is:null,isMap:qe,itemId:null,itemProp:ft,itemRef:ft,itemScope:qe,itemType:ft,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:qe,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:qe,muted:qe,name:null,nonce:null,noModule:qe,noValidate:qe,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:qe,optimum:xe,pattern:null,ping:ft,placeholder:null,playsInline:qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:qe,referrerPolicy:null,rel:ft,required:qe,reversed:qe,rows:xe,rowSpan:xe,sandbox:ft,scope:null,scoped:qe,seamless:qe,selected:qe,shadowRootClonable:qe,shadowRootDelegatesFocus:qe,shadowRootMode:null,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:xt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:qe,useMap:null,value:xt,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ft,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:qe,declare:qe,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:qe,noHref:qe,noShade:qe,noWrap:qe,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:xt,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:qe,disableRemotePlayback:qe,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:om}),_1=yi({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:en,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:ft,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:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:qe,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,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:gi,g2:gi,glyphName:gi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:en,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,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:xe,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:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ft,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:en,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:en,rev:en,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:en,requiredFeatures:en,requiredFonts:en,requiredFormats:en,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:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:en,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:en,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:en,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:lm}),sm=yi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,l){return"xlink:"+l.slice(5).toLowerCase()}}),um=yi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:om}),cm=yi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,l){return"xml:"+l.slice(3).toLowerCase()}}),w1={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"},C1=/[A-Z]/g,fm=/-[a-z]/g,T1=/^data[-\w.:]+$/i;function A1(n,l){const i=Gs(l);let o=l,u=Yt;if(i in n.normal)return n.property[n.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&T1.test(l)){if(l.charAt(4)==="-"){const s=l.slice(5).replace(fm,N1);o="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=l.slice(4);if(!fm.test(s)){let c=s.replace(C1,k1);c.charAt(0)!=="-"&&(c="-"+c),l="data"+c}}u=Qs}return new u(o,l)}function k1(n){return"-"+n.toLowerCase()}function N1(n){return n.charAt(1).toUpperCase()}const R1=rm([am,x1,sm,um,cm],"html"),Js=rm([am,_1,sm,um,cm],"svg");function O1(n){return n.join(" ").trim()}var bi={},Ws,dm;function z1(){if(dm)return Ws;dm=1;var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,l=/\n/g,i=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,u=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
44
44
|
`,p="/",g="*",b="",v="comment",y="declaration";function C(T,_){if(typeof T!="string")throw new TypeError("First argument must be a string");if(!T)return[];_=_||{};var A=1,k=1;function P(w){var V=w.match(l);V&&(A+=V.length);var Z=w.lastIndexOf(h);k=~Z?w.length-Z:k+w.length}function H(){var w={line:A,column:k};return function(V){return V.position=new D(w),F(),V}}function D(w){this.start=w,this.end={line:A,column:k},this.source=_.source}D.prototype.content=T;function B(w){var V=new Error(_.source+":"+A+":"+k+": "+w);if(V.reason=w,V.filename=_.source,V.line=A,V.column=k,V.source=T,!_.silent)throw V}function Y(w){var V=w.exec(T);if(V){var Z=V[0];return P(Z),T=T.slice(Z.length),V}}function F(){Y(i)}function $(w){var V;for(w=w||[];V=ie();)V!==!1&&w.push(V);return w}function ie(){var w=H();if(!(p!=T.charAt(0)||g!=T.charAt(1))){for(var V=2;b!=T.charAt(V)&&(g!=T.charAt(V)||p!=T.charAt(V+1));)++V;if(V+=2,b===T.charAt(V-1))return B("End of comment missing");var Z=T.slice(2,V-2);return k+=2,P(Z),T=T.slice(V),k+=2,w({type:v,comment:Z})}}function M(){var w=H(),V=Y(o);if(V){if(ie(),!Y(u))return B("property missing ':'");var Z=Y(s),Q=w({type:y,property:E(V[0].replace(n,b)),value:Z?E(Z[0].replace(n,b)):b});return Y(c),Q}}function re(){var w=[];$(w);for(var V;V=M();)V!==!1&&(w.push(V),$(w));return w}return F(),re()}function E(T){return T?T.replace(f,b):b}return Ws=C,Ws}var hm;function M1(){if(hm)return bi;hm=1;var n=bi&&bi.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(bi,"__esModule",{value:!0}),bi.default=i;const l=n(z1());function i(o,u){let s=null;if(!o||typeof o!="string")return s;const c=(0,l.default)(o),f=typeof u=="function";return c.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:g}=h;f?u(p,g,h):g&&(s=s||{},s[p]=g)}),s}return bi}var Ra={},mm;function D1(){if(mm)return Ra;mm=1,Object.defineProperty(Ra,"__esModule",{value:!0}),Ra.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,l=/-([a-z])/g,i=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,u=/^-(ms)-/,s=function(p){return!p||i.test(p)||n.test(p)},c=function(p,g){return g.toUpperCase()},f=function(p,g){return"".concat(g,"-")},h=function(p,g){return g===void 0&&(g={}),s(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(u,f):p=p.replace(o,f),p.replace(l,c))};return Ra.camelCase=h,Ra}var Oa,pm;function j1(){if(pm)return Oa;pm=1;var n=Oa&&Oa.__importDefault||function(u){return u&&u.__esModule?u:{default:u}},l=n(M1()),i=D1();function o(u,s){var c={};return!u||typeof u!="string"||(0,l.default)(u,function(f,h){f&&h&&(c[(0,i.camelCase)(f,s)]=h)}),c}return o.default=o,Oa=o,Oa}var L1=j1();const I1=ms(L1),gm=ym("end"),$s=ym("start");function ym(n){return l;function l(i){const o=i&&i.position&&i.position[n]||{};if(typeof o.line=="number"&&o.line>0&&typeof o.column=="number"&&o.column>0)return{line:o.line,column:o.column,offset:typeof o.offset=="number"&&o.offset>-1?o.offset:void 0}}}function B1(n){const l=$s(n),i=gm(n);if(l&&i)return{start:l,end:i}}function za(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?bm(n.position):"start"in n||"end"in n?bm(n):"line"in n||"column"in n?eu(n):""}function eu(n){return vm(n&&n.line)+":"+vm(n&&n.column)}function bm(n){return eu(n&&n.start)+"-"+eu(n&&n.end)}function vm(n){return n&&typeof n=="number"?n:1}class Ht extends Error{constructor(l,i,o){super(),typeof i=="string"&&(o=i,i=void 0);let u="",s={},c=!1;if(i&&("line"in i&&"column"in i?s={place:i}:"start"in i&&"end"in i?s={place:i}:"type"in i?s={ancestors:[i],place:i.position}:s={...i}),typeof l=="string"?u=l:!s.cause&&l&&(c=!0,u=l.message,s.cause=l),!s.ruleId&&!s.source&&typeof o=="string"){const h=o.indexOf(":");h===-1?s.ruleId=o:(s.source=o.slice(0,h),s.ruleId=o.slice(h+1))}if(!s.place&&s.ancestors&&s.ancestors){const h=s.ancestors[s.ancestors.length-1];h&&(s.place=h.position)}const f=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=u,this.line=f?f.line:void 0,this.name=za(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=c&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ht.prototype.file="",Ht.prototype.name="",Ht.prototype.reason="",Ht.prototype.message="",Ht.prototype.stack="",Ht.prototype.column=void 0,Ht.prototype.line=void 0,Ht.prototype.ancestors=void 0,Ht.prototype.cause=void 0,Ht.prototype.fatal=void 0,Ht.prototype.place=void 0,Ht.prototype.ruleId=void 0,Ht.prototype.source=void 0;const tu={}.hasOwnProperty,U1=new Map,H1=/[A-Z]/g,q1=new Set(["table","tbody","thead","tfoot","tr"]),P1=new Set(["td","th"]),Sm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function F1(n,l){if(!l||l.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=l.filePath||void 0;let o;if(l.development){if(typeof l.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=J1(i,l.jsxDEV)}else{if(typeof l.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof l.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=Q1(i,l.jsx,l.jsxs)}const u={Fragment:l.Fragment,ancestors:[],components:l.components||{},create:o,elementAttributeNameCase:l.elementAttributeNameCase||"react",evaluater:l.createEvaluater?l.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:l.ignoreInvalidStyle||!1,passKeys:l.passKeys!==!1,passNode:l.passNode||!1,schema:l.space==="svg"?Js:R1,stylePropertyNameCase:l.stylePropertyNameCase||"dom",tableCellAlignToStyle:l.tableCellAlignToStyle!==!1},s=Em(u,n,void 0);return s&&typeof s!="string"?s:u.create(n,u.Fragment,{children:s||void 0},void 0)}function Em(n,l,i){if(l.type==="element")return Y1(n,l,i);if(l.type==="mdxFlowExpression"||l.type==="mdxTextExpression")return V1(n,l);if(l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement")return X1(n,l,i);if(l.type==="mdxjsEsm")return G1(n,l);if(l.type==="root")return Z1(n,l,i);if(l.type==="text")return K1(n,l)}function Y1(n,l,i){const o=n.schema;let u=o;l.tagName.toLowerCase()==="svg"&&o.space==="html"&&(u=Js,n.schema=u),n.ancestors.push(l);const s=_m(n,l.tagName,!1),c=W1(n,l);let f=ru(n,l);return q1.has(l.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!S1(h):!0})),xm(n,c,s,l),nu(c,f),n.ancestors.pop(),n.schema=o,n.create(l,s,c,i)}function V1(n,l){if(l.data&&l.data.estree&&n.evaluater){const o=l.data.estree.body[0];return o.type,n.evaluater.evaluateExpression(o.expression)}Ma(n,l.position)}function G1(n,l){if(l.data&&l.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(l.data.estree);Ma(n,l.position)}function X1(n,l,i){const o=n.schema;let u=o;l.name==="svg"&&o.space==="html"&&(u=Js,n.schema=u),n.ancestors.push(l);const s=l.name===null?n.Fragment:_m(n,l.name,!0),c=$1(n,l),f=ru(n,l);return xm(n,c,s,l),nu(c,f),n.ancestors.pop(),n.schema=o,n.create(l,s,c,i)}function Z1(n,l,i){const o={};return nu(o,ru(n,l)),n.create(l,n.Fragment,o,i)}function K1(n,l){return l.value}function xm(n,l,i,o){typeof i!="string"&&i!==n.Fragment&&n.passNode&&(l.node=o)}function nu(n,l){if(l.length>0){const i=l.length>1?l:l[0];i&&(n.children=i)}}function Q1(n,l,i){return o;function o(u,s,c,f){const p=Array.isArray(c.children)?i:l;return f?p(s,c,f):p(s,c)}}function J1(n,l){return i;function i(o,u,s,c){const f=Array.isArray(s.children),h=$s(o);return l(u,s,c,f,{columnNumber:h?h.column-1:void 0,fileName:n,lineNumber:h?h.line:void 0},void 0)}}function W1(n,l){const i={};let o,u;for(u in l.properties)if(u!=="children"&&tu.call(l.properties,u)){const s=eE(n,u,l.properties[u]);if(s){const[c,f]=s;n.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&P1.has(l.tagName)?o=f:i[c]=f}}if(o){const s=i.style||(i.style={});s[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=o}return i}function $1(n,l){const i={};for(const o of l.attributes)if(o.type==="mdxJsxExpressionAttribute")if(o.data&&o.data.estree&&n.evaluater){const s=o.data.estree.body[0];s.type;const c=s.expression;c.type;const f=c.properties[0];f.type,Object.assign(i,n.evaluater.evaluateExpression(f.argument))}else Ma(n,l.position);else{const u=o.name;let s;if(o.value&&typeof o.value=="object")if(o.value.data&&o.value.data.estree&&n.evaluater){const f=o.value.data.estree.body[0];f.type,s=n.evaluater.evaluateExpression(f.expression)}else Ma(n,l.position);else s=o.value===null?!0:o.value;i[u]=s}return i}function ru(n,l){const i=[];let o=-1;const u=n.passKeys?new Map:U1;for(;++o<l.children.length;){const s=l.children[o];let c;if(n.passKeys){const h=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(h){const p=u.get(h)||0;c=h+"-"+p,u.set(h,p+1)}}const f=Em(n,s,c);f!==void 0&&i.push(f)}return i}function eE(n,l,i){const o=A1(n.schema,l);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=o.commaSeparated?p1(i):O1(i)),o.property==="style"){let u=typeof i=="object"?i:tE(n,String(i));return n.stylePropertyNameCase==="css"&&(u=nE(u)),["style",u]}return[n.elementAttributeNameCase==="react"&&o.space?w1[o.property]||o.property:o.attribute,i]}}function tE(n,l){try{return I1(l,{reactCompat:!0})}catch(i){if(n.ignoreInvalidStyle)return{};const o=i,u=new Ht("Cannot parse `style` attribute",{ancestors:n.ancestors,cause:o,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw u.file=n.filePath||void 0,u.url=Sm+"#cannot-parse-style-attribute",u}}function _m(n,l,i){let o;if(!i)o={type:"Literal",value:l};else if(l.includes(".")){const u=l.split(".");let s=-1,c;for(;++s<u.length;){const f=tm(u[s])?{type:"Identifier",name:u[s]}:{type:"Literal",value:u[s]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(s&&f.type==="Literal"),optional:!1}:f}o=c}else o=tm(l)&&!/^[a-z]/.test(l)?{type:"Identifier",name:l}:{type:"Literal",value:l};if(o.type==="Literal"){const u=o.value;return tu.call(n.components,u)?n.components[u]:u}if(n.evaluater)return n.evaluater.evaluateExpression(o);Ma(n)}function Ma(n,l){const i=new Ht("Cannot handle MDX estrees without `createEvaluater`",{ancestors:n.ancestors,place:l,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=n.filePath||void 0,i.url=Sm+"#cannot-handle-mdx-estrees-without-createevaluater",i}function nE(n){const l={};let i;for(i in n)tu.call(n,i)&&(l[rE(i)]=n[i]);return l}function rE(n){let l=n.replace(H1,iE);return l.slice(0,3)==="ms-"&&(l="-"+l),l}function iE(n){return"-"+n.toLowerCase()}const iu={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"]},aE={};function lE(n,l){const i=aE,o=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,u=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return wm(n,o,u)}function wm(n,l,i){if(oE(n)){if("value"in n)return n.type==="html"&&!i?"":n.value;if(l&&"alt"in n&&n.alt)return n.alt;if("children"in n)return Cm(n.children,l,i)}return Array.isArray(n)?Cm(n,l,i):""}function Cm(n,l,i){const o=[];let u=-1;for(;++u<n.length;)o[u]=wm(n[u],l,i);return o.join("")}function oE(n){return!!(n&&typeof n=="object")}const Tm=document.createElement("i");function au(n){const l="&"+n+";";Tm.innerHTML=l;const i=Tm.textContent;return i.charCodeAt(i.length-1)===59&&n!=="semi"||i===l?!1:i}function zn(n,l,i,o){const u=n.length;let s=0,c;if(l<0?l=-l>u?0:u+l:l=l>u?u:l,i=i>0?i:0,o.length<1e4)c=Array.from(o),c.unshift(l,i),n.splice(...c);else for(i&&n.splice(l,i);s<o.length;)c=o.slice(s,s+1e4),c.unshift(l,0),n.splice(...c),s+=1e4,l+=1e4}function dn(n,l){return n.length>0?(zn(n,n.length,0,l),n):l}const Am={}.hasOwnProperty;function sE(n){const l={};let i=-1;for(;++i<n.length;)uE(l,n[i]);return l}function uE(n,l){let i;for(i in l){const u=(Am.call(n,i)?n[i]:void 0)||(n[i]={}),s=l[i];let c;if(s)for(c in s){Am.call(u,c)||(u[c]=[]);const f=s[c];cE(u[c],Array.isArray(f)?f:f?[f]:[])}}}function cE(n,l){let i=-1;const o=[];for(;++i<l.length;)(l[i].add==="after"?n:o).push(l[i]);zn(n,0,0,o)}function km(n,l){const i=Number.parseInt(n,l);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function vi(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Mn=dr(/[A-Za-z]/),tn=dr(/[\dA-Za-z]/),fE=dr(/[#-'*+\--9=?A-Z^-~]/);function lu(n){return n!==null&&(n<32||n===127)}const ou=dr(/\d/),dE=dr(/[\dA-Fa-f]/),hE=dr(/[!-/:-@[-`{-~]/);function Be(n){return n!==null&&n<-2}function Vt(n){return n!==null&&(n<0||n===32)}function rt(n){return n===-2||n===-1||n===32}const mE=dr(new RegExp("\\p{P}|\\p{S}","u")),pE=dr(/\s/);function dr(n){return l;function l(i){return i!==null&&i>-1&&n.test(String.fromCharCode(i))}}function Si(n){const l=[];let i=-1,o=0,u=0;for(;++i<n.length;){const s=n.charCodeAt(i);let c="";if(s===37&&tn(n.charCodeAt(i+1))&&tn(n.charCodeAt(i+2)))u=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(c=String.fromCharCode(s));else if(s>55295&&s<57344){const f=n.charCodeAt(i+1);s<56320&&f>56319&&f<57344?(c=String.fromCharCode(s,f),u=1):c="�"}else c=String.fromCharCode(s);c&&(l.push(n.slice(o,i),encodeURIComponent(c)),o=i+u+1,c=""),u&&(i+=u,u=0)}return l.join("")+n.slice(o)}function dt(n,l,i,o){const u=o?o-1:Number.POSITIVE_INFINITY;let s=0;return c;function c(h){return rt(h)?(n.enter(i),f(h)):l(h)}function f(h){return rt(h)&&s++<u?(n.consume(h),f):(n.exit(i),l(h))}}const gE={tokenize:yE};function yE(n){const l=n.attempt(this.parser.constructs.contentInitial,o,u);let i;return l;function o(f){if(f===null){n.consume(f);return}return n.enter("lineEnding"),n.consume(f),n.exit("lineEnding"),dt(n,l,"linePrefix")}function u(f){return n.enter("paragraph"),s(f)}function s(f){const h=n.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=h),i=h,c(f)}function c(f){if(f===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(f);return}return Be(f)?(n.consume(f),n.exit("chunkText"),s):(n.consume(f),c)}}const bE={tokenize:vE},Nm={tokenize:SE};function vE(n){const l=this,i=[];let o=0,u,s,c;return f;function f(k){if(o<i.length){const P=i[o];return l.containerState=P[1],n.attempt(P[0].continuation,h,p)(k)}return p(k)}function h(k){if(o++,l.containerState._closeFlow){l.containerState._closeFlow=void 0,u&&A();const P=l.events.length;let H=P,D;for(;H--;)if(l.events[H][0]==="exit"&&l.events[H][1].type==="chunkFlow"){D=l.events[H][1].end;break}_(o);let B=P;for(;B<l.events.length;)l.events[B][1].end={...D},B++;return zn(l.events,H+1,0,l.events.slice(P)),l.events.length=B,p(k)}return f(k)}function p(k){if(o===i.length){if(!u)return v(k);if(u.currentConstruct&&u.currentConstruct.concrete)return C(k);l.interrupt=!!(u.currentConstruct&&!u._gfmTableDynamicInterruptHack)}return l.containerState={},n.check(Nm,g,b)(k)}function g(k){return u&&A(),_(o),v(k)}function b(k){return l.parser.lazy[l.now().line]=o!==i.length,c=l.now().offset,C(k)}function v(k){return l.containerState={},n.attempt(Nm,y,C)(k)}function y(k){return o++,i.push([l.currentConstruct,l.containerState]),v(k)}function C(k){if(k===null){u&&A(),_(0),n.consume(k);return}return u=u||l.parser.flow(l.now()),n.enter("chunkFlow",{_tokenizer:u,contentType:"flow",previous:s}),E(k)}function E(k){if(k===null){T(n.exit("chunkFlow"),!0),_(0),n.consume(k);return}return Be(k)?(n.consume(k),T(n.exit("chunkFlow")),o=0,l.interrupt=void 0,f):(n.consume(k),E)}function T(k,P){const H=l.sliceStream(k);if(P&&H.push(null),k.previous=s,s&&(s.next=k),s=k,u.defineSkip(k.start),u.write(H),l.parser.lazy[k.start.line]){let D=u.events.length;for(;D--;)if(u.events[D][1].start.offset<c&&(!u.events[D][1].end||u.events[D][1].end.offset>c))return;const B=l.events.length;let Y=B,F,$;for(;Y--;)if(l.events[Y][0]==="exit"&&l.events[Y][1].type==="chunkFlow"){if(F){$=l.events[Y][1].end;break}F=!0}for(_(o),D=B;D<l.events.length;)l.events[D][1].end={...$},D++;zn(l.events,Y+1,0,l.events.slice(B)),l.events.length=D}}function _(k){let P=i.length;for(;P-- >k;){const H=i[P];l.containerState=H[1],H[0].exit.call(l,n)}i.length=k}function A(){u.write([null]),s=void 0,u=void 0,l.containerState._closeFlow=void 0}}function SE(n,l,i){return dt(n,n.attempt(this.parser.constructs.document,l,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Rm(n){if(n===null||Vt(n)||pE(n))return 1;if(mE(n))return 2}function su(n,l,i){const o=[];let u=-1;for(;++u<n.length;){const s=n[u].resolveAll;s&&!o.includes(s)&&(l=s(l,i),o.push(s))}return l}const uu={name:"attention",resolveAll:EE,tokenize:xE};function EE(n,l){let i=-1,o,u,s,c,f,h,p,g;for(;++i<n.length;)if(n[i][0]==="enter"&&n[i][1].type==="attentionSequence"&&n[i][1]._close){for(o=i;o--;)if(n[o][0]==="exit"&&n[o][1].type==="attentionSequence"&&n[o][1]._open&&l.sliceSerialize(n[o][1]).charCodeAt(0)===l.sliceSerialize(n[i][1]).charCodeAt(0)){if((n[o][1]._close||n[i][1]._open)&&(n[i][1].end.offset-n[i][1].start.offset)%3&&!((n[o][1].end.offset-n[o][1].start.offset+n[i][1].end.offset-n[i][1].start.offset)%3))continue;h=n[o][1].end.offset-n[o][1].start.offset>1&&n[i][1].end.offset-n[i][1].start.offset>1?2:1;const b={...n[o][1].end},v={...n[i][1].start};Om(b,-h),Om(v,h),c={type:h>1?"strongSequence":"emphasisSequence",start:b,end:{...n[o][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...n[i][1].start},end:v},s={type:h>1?"strongText":"emphasisText",start:{...n[o][1].end},end:{...n[i][1].start}},u={type:h>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},n[o][1].end={...c.start},n[i][1].start={...f.end},p=[],n[o][1].end.offset-n[o][1].start.offset&&(p=dn(p,[["enter",n[o][1],l],["exit",n[o][1],l]])),p=dn(p,[["enter",u,l],["enter",c,l],["exit",c,l],["enter",s,l]]),p=dn(p,su(l.parser.constructs.insideSpan.null,n.slice(o+1,i),l)),p=dn(p,[["exit",s,l],["enter",f,l],["exit",f,l],["exit",u,l]]),n[i][1].end.offset-n[i][1].start.offset?(g=2,p=dn(p,[["enter",n[i][1],l],["exit",n[i][1],l]])):g=0,zn(n,o-1,i-o+3,p),i=o+p.length-g-2;break}}for(i=-1;++i<n.length;)n[i][1].type==="attentionSequence"&&(n[i][1].type="data");return n}function xE(n,l){const i=this.parser.constructs.attentionMarkers.null,o=this.previous,u=Rm(o);let s;return c;function c(h){return s=h,n.enter("attentionSequence"),f(h)}function f(h){if(h===s)return n.consume(h),f;const p=n.exit("attentionSequence"),g=Rm(h),b=!g||g===2&&u||i.includes(h),v=!u||u===2&&g||i.includes(o);return p._open=!!(s===42?b:b&&(u||!v)),p._close=!!(s===42?v:v&&(g||!b)),l(h)}}function Om(n,l){n.column+=l,n.offset+=l,n._bufferIndex+=l}const _E={name:"autolink",tokenize:wE};function wE(n,l,i){let o=0;return u;function u(y){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(y),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),s}function s(y){return Mn(y)?(n.consume(y),c):y===64?i(y):p(y)}function c(y){return y===43||y===45||y===46||tn(y)?(o=1,f(y)):p(y)}function f(y){return y===58?(n.consume(y),o=0,h):(y===43||y===45||y===46||tn(y))&&o++<32?(n.consume(y),f):(o=0,p(y))}function h(y){return y===62?(n.exit("autolinkProtocol"),n.enter("autolinkMarker"),n.consume(y),n.exit("autolinkMarker"),n.exit("autolink"),l):y===null||y===32||y===60||lu(y)?i(y):(n.consume(y),h)}function p(y){return y===64?(n.consume(y),g):fE(y)?(n.consume(y),p):i(y)}function g(y){return tn(y)?b(y):i(y)}function b(y){return y===46?(n.consume(y),o=0,g):y===62?(n.exit("autolinkProtocol").type="autolinkEmail",n.enter("autolinkMarker"),n.consume(y),n.exit("autolinkMarker"),n.exit("autolink"),l):v(y)}function v(y){if((y===45||tn(y))&&o++<63){const C=y===45?v:b;return n.consume(y),C}return i(y)}}const Fl={partial:!0,tokenize:CE};function CE(n,l,i){return o;function o(s){return rt(s)?dt(n,u,"linePrefix")(s):u(s)}function u(s){return s===null||Be(s)?l(s):i(s)}}const zm={continuation:{tokenize:AE},exit:kE,name:"blockQuote",tokenize:TE};function TE(n,l,i){const o=this;return u;function u(c){if(c===62){const f=o.containerState;return f.open||(n.enter("blockQuote",{_container:!0}),f.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(c),n.exit("blockQuoteMarker"),s}return i(c)}function s(c){return rt(c)?(n.enter("blockQuotePrefixWhitespace"),n.consume(c),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),l):(n.exit("blockQuotePrefix"),l(c))}}function AE(n,l,i){const o=this;return u;function u(c){return rt(c)?dt(n,s,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):s(c)}function s(c){return n.attempt(zm,l,i)(c)}}function kE(n){n.exit("blockQuote")}const Mm={name:"characterEscape",tokenize:NE};function NE(n,l,i){return o;function o(s){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(s),n.exit("escapeMarker"),u}function u(s){return hE(s)?(n.enter("characterEscapeValue"),n.consume(s),n.exit("characterEscapeValue"),n.exit("characterEscape"),l):i(s)}}const Dm={name:"characterReference",tokenize:RE};function RE(n,l,i){const o=this;let u=0,s,c;return f;function f(b){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(b),n.exit("characterReferenceMarker"),h}function h(b){return b===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(b),n.exit("characterReferenceMarkerNumeric"),p):(n.enter("characterReferenceValue"),s=31,c=tn,g(b))}function p(b){return b===88||b===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(b),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),s=6,c=dE,g):(n.enter("characterReferenceValue"),s=7,c=ou,g(b))}function g(b){if(b===59&&u){const v=n.exit("characterReferenceValue");return c===tn&&!au(o.sliceSerialize(v))?i(b):(n.enter("characterReferenceMarker"),n.consume(b),n.exit("characterReferenceMarker"),n.exit("characterReference"),l)}return c(b)&&u++<s?(n.consume(b),g):i(b)}}const jm={partial:!0,tokenize:zE},Lm={concrete:!0,name:"codeFenced",tokenize:OE};function OE(n,l,i){const o=this,u={partial:!0,tokenize:H};let s=0,c=0,f;return h;function h(D){return p(D)}function p(D){const B=o.events[o.events.length-1];return s=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,f=D,n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),g(D)}function g(D){return D===f?(c++,n.consume(D),g):c<3?i(D):(n.exit("codeFencedFenceSequence"),rt(D)?dt(n,b,"whitespace")(D):b(D))}function b(D){return D===null||Be(D)?(n.exit("codeFencedFence"),o.interrupt?l(D):n.check(jm,E,P)(D)):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),v(D))}function v(D){return D===null||Be(D)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),b(D)):rt(D)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),dt(n,y,"whitespace")(D)):D===96&&D===f?i(D):(n.consume(D),v)}function y(D){return D===null||Be(D)?b(D):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),C(D))}function C(D){return D===null||Be(D)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),b(D)):D===96&&D===f?i(D):(n.consume(D),C)}function E(D){return n.attempt(u,P,T)(D)}function T(D){return n.enter("lineEnding"),n.consume(D),n.exit("lineEnding"),_}function _(D){return s>0&&rt(D)?dt(n,A,"linePrefix",s+1)(D):A(D)}function A(D){return D===null||Be(D)?n.check(jm,E,P)(D):(n.enter("codeFlowValue"),k(D))}function k(D){return D===null||Be(D)?(n.exit("codeFlowValue"),A(D)):(n.consume(D),k)}function P(D){return n.exit("codeFenced"),l(D)}function H(D,B,Y){let F=0;return $;function $(V){return D.enter("lineEnding"),D.consume(V),D.exit("lineEnding"),ie}function ie(V){return D.enter("codeFencedFence"),rt(V)?dt(D,M,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):M(V)}function M(V){return V===f?(D.enter("codeFencedFenceSequence"),re(V)):Y(V)}function re(V){return V===f?(F++,D.consume(V),re):F>=c?(D.exit("codeFencedFenceSequence"),rt(V)?dt(D,w,"whitespace")(V):w(V)):Y(V)}function w(V){return V===null||Be(V)?(D.exit("codeFencedFence"),B(V)):Y(V)}}}function zE(n,l,i){const o=this;return u;function u(c){return c===null?i(c):(n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),s)}function s(c){return o.parser.lazy[o.now().line]?i(c):l(c)}}const cu={name:"codeIndented",tokenize:DE},ME={partial:!0,tokenize:jE};function DE(n,l,i){const o=this;return u;function u(p){return n.enter("codeIndented"),dt(n,s,"linePrefix",5)(p)}function s(p){const g=o.events[o.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(p):i(p)}function c(p){return p===null?h(p):Be(p)?n.attempt(ME,c,h)(p):(n.enter("codeFlowValue"),f(p))}function f(p){return p===null||Be(p)?(n.exit("codeFlowValue"),c(p)):(n.consume(p),f)}function h(p){return n.exit("codeIndented"),l(p)}}function jE(n,l,i){const o=this;return u;function u(c){return o.parser.lazy[o.now().line]?i(c):Be(c)?(n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),u):dt(n,s,"linePrefix",5)(c)}function s(c){const f=o.events[o.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?l(c):Be(c)?u(c):i(c)}}const LE={name:"codeText",previous:BE,resolve:IE,tokenize:UE};function IE(n){let l=n.length-4,i=3,o,u;if((n[i][1].type==="lineEnding"||n[i][1].type==="space")&&(n[l][1].type==="lineEnding"||n[l][1].type==="space")){for(o=i;++o<l;)if(n[o][1].type==="codeTextData"){n[i][1].type="codeTextPadding",n[l][1].type="codeTextPadding",i+=2,l-=2;break}}for(o=i-1,l++;++o<=l;)u===void 0?o!==l&&n[o][1].type!=="lineEnding"&&(u=o):(o===l||n[o][1].type==="lineEnding")&&(n[u][1].type="codeTextData",o!==u+2&&(n[u][1].end=n[o-1][1].end,n.splice(u+2,o-u-2),l-=o-u-2,o=u+2),u=void 0);return n}function BE(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function UE(n,l,i){let o=0,u,s;return c;function c(b){return n.enter("codeText"),n.enter("codeTextSequence"),f(b)}function f(b){return b===96?(n.consume(b),o++,f):(n.exit("codeTextSequence"),h(b))}function h(b){return b===null?i(b):b===32?(n.enter("space"),n.consume(b),n.exit("space"),h):b===96?(s=n.enter("codeTextSequence"),u=0,g(b)):Be(b)?(n.enter("lineEnding"),n.consume(b),n.exit("lineEnding"),h):(n.enter("codeTextData"),p(b))}function p(b){return b===null||b===32||b===96||Be(b)?(n.exit("codeTextData"),h(b)):(n.consume(b),p)}function g(b){return b===96?(n.consume(b),u++,g):u===o?(n.exit("codeTextSequence"),n.exit("codeText"),l(b)):(s.type="codeTextData",p(b))}}class HE{constructor(l){this.left=l?[...l]:[],this.right=[]}get(l){if(l<0||l>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+l+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return l<this.left.length?this.left[l]:this.right[this.right.length-l+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(l,i){const o=i??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(l,o):l>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-l+this.left.length).reverse():this.left.slice(l).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(l,i,o){const u=i||0;this.setCursor(Math.trunc(l));const s=this.right.splice(this.right.length-u,Number.POSITIVE_INFINITY);return o&&Da(this.left,o),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(l){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(l)}pushMany(l){this.setCursor(Number.POSITIVE_INFINITY),Da(this.left,l)}unshift(l){this.setCursor(0),this.right.push(l)}unshiftMany(l){this.setCursor(0),Da(this.right,l.reverse())}setCursor(l){if(!(l===this.left.length||l>this.left.length&&this.right.length===0||l<0&&this.left.length===0))if(l<this.left.length){const i=this.left.splice(l,Number.POSITIVE_INFINITY);Da(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-l,Number.POSITIVE_INFINITY);Da(this.left,i.reverse())}}}function Da(n,l){let i=0;if(l.length<1e4)n.push(...l);else for(;i<l.length;)n.push(...l.slice(i,i+1e4)),i+=1e4}function Im(n){const l={};let i=-1,o,u,s,c,f,h,p;const g=new HE(n);for(;++i<g.length;){for(;i in l;)i=l[i];if(o=g.get(i),i&&o[1].type==="chunkFlow"&&g.get(i-1)[1].type==="listItemPrefix"&&(h=o[1]._tokenizer.events,s=0,s<h.length&&h[s][1].type==="lineEndingBlank"&&(s+=2),s<h.length&&h[s][1].type==="content"))for(;++s<h.length&&h[s][1].type!=="content";)h[s][1].type==="chunkText"&&(h[s][1]._isInFirstContentOfListItem=!0,s++);if(o[0]==="enter")o[1].contentType&&(Object.assign(l,qE(g,i)),i=l[i],p=!0);else if(o[1]._container){for(s=i,u=void 0;s--;)if(c=g.get(s),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(u&&(g.get(u)[1].type="lineEndingBlank"),c[1].type="lineEnding",u=s);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;u&&(o[1].end={...g.get(u)[1].start},f=g.slice(u,i),f.unshift(o),g.splice(u,i-u+1,f))}}return zn(n,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function qE(n,l){const i=n.get(l)[1],o=n.get(l)[2];let u=l-1;const s=[];let c=i._tokenizer;c||(c=o.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,h=[],p={};let g,b,v=-1,y=i,C=0,E=0;const T=[E];for(;y;){for(;n.get(++u)[1]!==y;);s.push(u),y._tokenizer||(g=o.sliceStream(y),y.next||g.push(null),b&&c.defineSkip(y.start),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),b=y,y=y.next}for(y=i;++v<f.length;)f[v][0]==="exit"&&f[v-1][0]==="enter"&&f[v][1].type===f[v-1][1].type&&f[v][1].start.line!==f[v][1].end.line&&(E=v+1,T.push(E),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(c.events=[],y?(y._tokenizer=void 0,y.previous=void 0):T.pop(),v=T.length;v--;){const _=f.slice(T[v],T[v+1]),A=s.pop();h.push([A,A+_.length-1]),n.splice(A,2,_)}for(h.reverse(),v=-1;++v<h.length;)p[C+h[v][0]]=C+h[v][1],C+=h[v][1]-h[v][0]-1;return p}const PE={resolve:YE,tokenize:VE},FE={partial:!0,tokenize:GE};function YE(n){return Im(n),n}function VE(n,l){let i;return o;function o(f){return n.enter("content"),i=n.enter("chunkContent",{contentType:"content"}),u(f)}function u(f){return f===null?s(f):Be(f)?n.check(FE,c,s)(f):(n.consume(f),u)}function s(f){return n.exit("chunkContent"),n.exit("content"),l(f)}function c(f){return n.consume(f),n.exit("chunkContent"),i.next=n.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,u}}function GE(n,l,i){const o=this;return u;function u(c){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),dt(n,s,"linePrefix")}function s(c){if(c===null||Be(c))return i(c);const f=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?l(c):n.interrupt(o.parser.constructs.flow,i,l)(c)}}function Bm(n,l,i,o,u,s,c,f,h){const p=h||Number.POSITIVE_INFINITY;let g=0;return b;function b(_){return _===60?(n.enter(o),n.enter(u),n.enter(s),n.consume(_),n.exit(s),v):_===null||_===32||_===41||lu(_)?i(_):(n.enter(o),n.enter(c),n.enter(f),n.enter("chunkString",{contentType:"string"}),E(_))}function v(_){return _===62?(n.enter(s),n.consume(_),n.exit(s),n.exit(u),n.exit(o),l):(n.enter(f),n.enter("chunkString",{contentType:"string"}),y(_))}function y(_){return _===62?(n.exit("chunkString"),n.exit(f),v(_)):_===null||_===60||Be(_)?i(_):(n.consume(_),_===92?C:y)}function C(_){return _===60||_===62||_===92?(n.consume(_),y):y(_)}function E(_){return!g&&(_===null||_===41||Vt(_))?(n.exit("chunkString"),n.exit(f),n.exit(c),n.exit(o),l(_)):g<p&&_===40?(n.consume(_),g++,E):_===41?(n.consume(_),g--,E):_===null||_===32||_===40||lu(_)?i(_):(n.consume(_),_===92?T:E)}function T(_){return _===40||_===41||_===92?(n.consume(_),E):E(_)}}function Um(n,l,i,o,u,s){const c=this;let f=0,h;return p;function p(y){return n.enter(o),n.enter(u),n.consume(y),n.exit(u),n.enter(s),g}function g(y){return f>999||y===null||y===91||y===93&&!h||y===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?i(y):y===93?(n.exit(s),n.enter(u),n.consume(y),n.exit(u),n.exit(o),l):Be(y)?(n.enter("lineEnding"),n.consume(y),n.exit("lineEnding"),g):(n.enter("chunkString",{contentType:"string"}),b(y))}function b(y){return y===null||y===91||y===93||Be(y)||f++>999?(n.exit("chunkString"),g(y)):(n.consume(y),h||(h=!rt(y)),y===92?v:b)}function v(y){return y===91||y===92||y===93?(n.consume(y),f++,b):b(y)}}function Hm(n,l,i,o,u,s){let c;return f;function f(v){return v===34||v===39||v===40?(n.enter(o),n.enter(u),n.consume(v),n.exit(u),c=v===40?41:v,h):i(v)}function h(v){return v===c?(n.enter(u),n.consume(v),n.exit(u),n.exit(o),l):(n.enter(s),p(v))}function p(v){return v===c?(n.exit(s),h(c)):v===null?i(v):Be(v)?(n.enter("lineEnding"),n.consume(v),n.exit("lineEnding"),dt(n,p,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===c||v===null||Be(v)?(n.exit("chunkString"),p(v)):(n.consume(v),v===92?b:g)}function b(v){return v===c||v===92?(n.consume(v),g):g(v)}}function ja(n,l){let i;return o;function o(u){return Be(u)?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),i=!0,o):rt(u)?dt(n,o,i?"linePrefix":"lineSuffix")(u):l(u)}}const XE={name:"definition",tokenize:KE},ZE={partial:!0,tokenize:QE};function KE(n,l,i){const o=this;let u;return s;function s(y){return n.enter("definition"),c(y)}function c(y){return Um.call(o,n,f,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return u=vi(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),y===58?(n.enter("definitionMarker"),n.consume(y),n.exit("definitionMarker"),h):i(y)}function h(y){return Vt(y)?ja(n,p)(y):p(y)}function p(y){return Bm(n,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return n.attempt(ZE,b,b)(y)}function b(y){return rt(y)?dt(n,v,"whitespace")(y):v(y)}function v(y){return y===null||Be(y)?(n.exit("definition"),o.parser.defined.push(u),l(y)):i(y)}}function QE(n,l,i){return o;function o(f){return Vt(f)?ja(n,u)(f):i(f)}function u(f){return Hm(n,s,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function s(f){return rt(f)?dt(n,c,"whitespace")(f):c(f)}function c(f){return f===null||Be(f)?l(f):i(f)}}const JE={name:"hardBreakEscape",tokenize:WE};function WE(n,l,i){return o;function o(s){return n.enter("hardBreakEscape"),n.consume(s),u}function u(s){return Be(s)?(n.exit("hardBreakEscape"),l(s)):i(s)}}const $E={name:"headingAtx",resolve:ex,tokenize:tx};function ex(n,l){let i=n.length-2,o=3,u,s;return n[o][1].type==="whitespace"&&(o+=2),i-2>o&&n[i][1].type==="whitespace"&&(i-=2),n[i][1].type==="atxHeadingSequence"&&(o===i-1||i-4>o&&n[i-2][1].type==="whitespace")&&(i-=o+1===i?2:4),i>o&&(u={type:"atxHeadingText",start:n[o][1].start,end:n[i][1].end},s={type:"chunkText",start:n[o][1].start,end:n[i][1].end,contentType:"text"},zn(n,o,i-o+1,[["enter",u,l],["enter",s,l],["exit",s,l],["exit",u,l]])),n}function tx(n,l,i){let o=0;return u;function u(g){return n.enter("atxHeading"),s(g)}function s(g){return n.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&o++<6?(n.consume(g),c):g===null||Vt(g)?(n.exit("atxHeadingSequence"),f(g)):i(g)}function f(g){return g===35?(n.enter("atxHeadingSequence"),h(g)):g===null||Be(g)?(n.exit("atxHeading"),l(g)):rt(g)?dt(n,f,"whitespace")(g):(n.enter("atxHeadingText"),p(g))}function h(g){return g===35?(n.consume(g),h):(n.exit("atxHeadingSequence"),f(g))}function p(g){return g===null||g===35||Vt(g)?(n.exit("atxHeadingText"),f(g)):(n.consume(g),p)}}const nx=["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"],qm=["pre","script","style","textarea"],rx={concrete:!0,name:"htmlFlow",resolveTo:lx,tokenize:ox},ix={partial:!0,tokenize:ux},ax={partial:!0,tokenize:sx};function lx(n){let l=n.length;for(;l--&&!(n[l][0]==="enter"&&n[l][1].type==="htmlFlow"););return l>1&&n[l-2][1].type==="linePrefix"&&(n[l][1].start=n[l-2][1].start,n[l+1][1].start=n[l-2][1].start,n.splice(l-2,2)),n}function ox(n,l,i){const o=this;let u,s,c,f,h;return p;function p(O){return g(O)}function g(O){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(O),b}function b(O){return O===33?(n.consume(O),v):O===47?(n.consume(O),s=!0,E):O===63?(n.consume(O),u=3,o.interrupt?l:I):Mn(O)?(n.consume(O),c=String.fromCharCode(O),T):i(O)}function v(O){return O===45?(n.consume(O),u=2,y):O===91?(n.consume(O),u=5,f=0,C):Mn(O)?(n.consume(O),u=4,o.interrupt?l:I):i(O)}function y(O){return O===45?(n.consume(O),o.interrupt?l:I):i(O)}function C(O){const ne="CDATA[";return O===ne.charCodeAt(f++)?(n.consume(O),f===ne.length?o.interrupt?l:M:C):i(O)}function E(O){return Mn(O)?(n.consume(O),c=String.fromCharCode(O),T):i(O)}function T(O){if(O===null||O===47||O===62||Vt(O)){const ne=O===47,ce=c.toLowerCase();return!ne&&!s&&qm.includes(ce)?(u=1,o.interrupt?l(O):M(O)):nx.includes(c.toLowerCase())?(u=6,ne?(n.consume(O),_):o.interrupt?l(O):M(O)):(u=7,o.interrupt&&!o.parser.lazy[o.now().line]?i(O):s?A(O):k(O))}return O===45||tn(O)?(n.consume(O),c+=String.fromCharCode(O),T):i(O)}function _(O){return O===62?(n.consume(O),o.interrupt?l:M):i(O)}function A(O){return rt(O)?(n.consume(O),A):$(O)}function k(O){return O===47?(n.consume(O),$):O===58||O===95||Mn(O)?(n.consume(O),P):rt(O)?(n.consume(O),k):$(O)}function P(O){return O===45||O===46||O===58||O===95||tn(O)?(n.consume(O),P):H(O)}function H(O){return O===61?(n.consume(O),D):rt(O)?(n.consume(O),H):k(O)}function D(O){return O===null||O===60||O===61||O===62||O===96?i(O):O===34||O===39?(n.consume(O),h=O,B):rt(O)?(n.consume(O),D):Y(O)}function B(O){return O===h?(n.consume(O),h=null,F):O===null||Be(O)?i(O):(n.consume(O),B)}function Y(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||Vt(O)?H(O):(n.consume(O),Y)}function F(O){return O===47||O===62||rt(O)?k(O):i(O)}function $(O){return O===62?(n.consume(O),ie):i(O)}function ie(O){return O===null||Be(O)?M(O):rt(O)?(n.consume(O),ie):i(O)}function M(O){return O===45&&u===2?(n.consume(O),Z):O===60&&u===1?(n.consume(O),Q):O===62&&u===4?(n.consume(O),N):O===63&&u===3?(n.consume(O),I):O===93&&u===5?(n.consume(O),de):Be(O)&&(u===6||u===7)?(n.exit("htmlFlowData"),n.check(ix,U,re)(O)):O===null||Be(O)?(n.exit("htmlFlowData"),re(O)):(n.consume(O),M)}function re(O){return n.check(ax,w,U)(O)}function w(O){return n.enter("lineEnding"),n.consume(O),n.exit("lineEnding"),V}function V(O){return O===null||Be(O)?re(O):(n.enter("htmlFlowData"),M(O))}function Z(O){return O===45?(n.consume(O),I):M(O)}function Q(O){return O===47?(n.consume(O),c="",se):M(O)}function se(O){if(O===62){const ne=c.toLowerCase();return qm.includes(ne)?(n.consume(O),N):M(O)}return Mn(O)&&c.length<8?(n.consume(O),c+=String.fromCharCode(O),se):M(O)}function de(O){return O===93?(n.consume(O),I):M(O)}function I(O){return O===62?(n.consume(O),N):O===45&&u===2?(n.consume(O),I):M(O)}function N(O){return O===null||Be(O)?(n.exit("htmlFlowData"),U(O)):(n.consume(O),N)}function U(O){return n.exit("htmlFlow"),l(O)}}function sx(n,l,i){const o=this;return u;function u(c){return Be(c)?(n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),s):i(c)}function s(c){return o.parser.lazy[o.now().line]?i(c):l(c)}}function ux(n,l,i){return o;function o(u){return n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),n.attempt(Fl,l,i)}}const cx={name:"htmlText",tokenize:fx};function fx(n,l,i){const o=this;let u,s,c;return f;function f(I){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(I),h}function h(I){return I===33?(n.consume(I),p):I===47?(n.consume(I),H):I===63?(n.consume(I),k):Mn(I)?(n.consume(I),Y):i(I)}function p(I){return I===45?(n.consume(I),g):I===91?(n.consume(I),s=0,C):Mn(I)?(n.consume(I),A):i(I)}function g(I){return I===45?(n.consume(I),y):i(I)}function b(I){return I===null?i(I):I===45?(n.consume(I),v):Be(I)?(c=b,Q(I)):(n.consume(I),b)}function v(I){return I===45?(n.consume(I),y):b(I)}function y(I){return I===62?Z(I):I===45?v(I):b(I)}function C(I){const N="CDATA[";return I===N.charCodeAt(s++)?(n.consume(I),s===N.length?E:C):i(I)}function E(I){return I===null?i(I):I===93?(n.consume(I),T):Be(I)?(c=E,Q(I)):(n.consume(I),E)}function T(I){return I===93?(n.consume(I),_):E(I)}function _(I){return I===62?Z(I):I===93?(n.consume(I),_):E(I)}function A(I){return I===null||I===62?Z(I):Be(I)?(c=A,Q(I)):(n.consume(I),A)}function k(I){return I===null?i(I):I===63?(n.consume(I),P):Be(I)?(c=k,Q(I)):(n.consume(I),k)}function P(I){return I===62?Z(I):k(I)}function H(I){return Mn(I)?(n.consume(I),D):i(I)}function D(I){return I===45||tn(I)?(n.consume(I),D):B(I)}function B(I){return Be(I)?(c=B,Q(I)):rt(I)?(n.consume(I),B):Z(I)}function Y(I){return I===45||tn(I)?(n.consume(I),Y):I===47||I===62||Vt(I)?F(I):i(I)}function F(I){return I===47?(n.consume(I),Z):I===58||I===95||Mn(I)?(n.consume(I),$):Be(I)?(c=F,Q(I)):rt(I)?(n.consume(I),F):Z(I)}function $(I){return I===45||I===46||I===58||I===95||tn(I)?(n.consume(I),$):ie(I)}function ie(I){return I===61?(n.consume(I),M):Be(I)?(c=ie,Q(I)):rt(I)?(n.consume(I),ie):F(I)}function M(I){return I===null||I===60||I===61||I===62||I===96?i(I):I===34||I===39?(n.consume(I),u=I,re):Be(I)?(c=M,Q(I)):rt(I)?(n.consume(I),M):(n.consume(I),w)}function re(I){return I===u?(n.consume(I),u=void 0,V):I===null?i(I):Be(I)?(c=re,Q(I)):(n.consume(I),re)}function w(I){return I===null||I===34||I===39||I===60||I===61||I===96?i(I):I===47||I===62||Vt(I)?F(I):(n.consume(I),w)}function V(I){return I===47||I===62||Vt(I)?F(I):i(I)}function Z(I){return I===62?(n.consume(I),n.exit("htmlTextData"),n.exit("htmlText"),l):i(I)}function Q(I){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(I),n.exit("lineEnding"),se}function se(I){return rt(I)?dt(n,de,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):de(I)}function de(I){return n.enter("htmlTextData"),c(I)}}const fu={name:"labelEnd",resolveAll:px,resolveTo:gx,tokenize:yx},dx={tokenize:bx},hx={tokenize:vx},mx={tokenize:Sx};function px(n){let l=-1;const i=[];for(;++l<n.length;){const o=n[l][1];if(i.push(n[l]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const u=o.type==="labelImage"?4:2;o.type="data",l+=u}}return n.length!==i.length&&zn(n,0,n.length,i),n}function gx(n,l){let i=n.length,o=0,u,s,c,f;for(;i--;)if(u=n[i][1],s){if(u.type==="link"||u.type==="labelLink"&&u._inactive)break;n[i][0]==="enter"&&u.type==="labelLink"&&(u._inactive=!0)}else if(c){if(n[i][0]==="enter"&&(u.type==="labelImage"||u.type==="labelLink")&&!u._balanced&&(s=i,u.type!=="labelLink")){o=2;break}}else u.type==="labelEnd"&&(c=i);const h={type:n[s][1].type==="labelLink"?"link":"image",start:{...n[s][1].start},end:{...n[n.length-1][1].end}},p={type:"label",start:{...n[s][1].start},end:{...n[c][1].end}},g={type:"labelText",start:{...n[s+o+2][1].end},end:{...n[c-2][1].start}};return f=[["enter",h,l],["enter",p,l]],f=dn(f,n.slice(s+1,s+o+3)),f=dn(f,[["enter",g,l]]),f=dn(f,su(l.parser.constructs.insideSpan.null,n.slice(s+o+4,c-3),l)),f=dn(f,[["exit",g,l],n[c-2],n[c-1],["exit",p,l]]),f=dn(f,n.slice(c+1)),f=dn(f,[["exit",h,l]]),zn(n,s,n.length,f),n}function yx(n,l,i){const o=this;let u=o.events.length,s,c;for(;u--;)if((o.events[u][1].type==="labelImage"||o.events[u][1].type==="labelLink")&&!o.events[u][1]._balanced){s=o.events[u][1];break}return f;function f(v){return s?s._inactive?b(v):(c=o.parser.defined.includes(vi(o.sliceSerialize({start:s.end,end:o.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(v),n.exit("labelMarker"),n.exit("labelEnd"),h):i(v)}function h(v){return v===40?n.attempt(dx,g,c?g:b)(v):v===91?n.attempt(hx,g,c?p:b)(v):c?g(v):b(v)}function p(v){return n.attempt(mx,g,b)(v)}function g(v){return l(v)}function b(v){return s._balanced=!0,i(v)}}function bx(n,l,i){return o;function o(b){return n.enter("resource"),n.enter("resourceMarker"),n.consume(b),n.exit("resourceMarker"),u}function u(b){return Vt(b)?ja(n,s)(b):s(b)}function s(b){return b===41?g(b):Bm(n,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function c(b){return Vt(b)?ja(n,h)(b):g(b)}function f(b){return i(b)}function h(b){return b===34||b===39||b===40?Hm(n,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):g(b)}function p(b){return Vt(b)?ja(n,g)(b):g(b)}function g(b){return b===41?(n.enter("resourceMarker"),n.consume(b),n.exit("resourceMarker"),n.exit("resource"),l):i(b)}}function vx(n,l,i){const o=this;return u;function u(f){return Um.call(o,n,s,c,"reference","referenceMarker","referenceString")(f)}function s(f){return o.parser.defined.includes(vi(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?l(f):i(f)}function c(f){return i(f)}}function Sx(n,l,i){return o;function o(s){return n.enter("reference"),n.enter("referenceMarker"),n.consume(s),n.exit("referenceMarker"),u}function u(s){return s===93?(n.enter("referenceMarker"),n.consume(s),n.exit("referenceMarker"),n.exit("reference"),l):i(s)}}const Ex={name:"labelStartImage",resolveAll:fu.resolveAll,tokenize:xx};function xx(n,l,i){const o=this;return u;function u(f){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(f),n.exit("labelImageMarker"),s}function s(f){return f===91?(n.enter("labelMarker"),n.consume(f),n.exit("labelMarker"),n.exit("labelImage"),c):i(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in o.parser.constructs?i(f):l(f)}}const _x={name:"labelStartLink",resolveAll:fu.resolveAll,tokenize:wx};function wx(n,l,i){const o=this;return u;function u(c){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(c),n.exit("labelMarker"),n.exit("labelLink"),s}function s(c){return c===94&&"_hiddenFootnoteSupport"in o.parser.constructs?i(c):l(c)}}const du={name:"lineEnding",tokenize:Cx};function Cx(n,l){return i;function i(o){return n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),dt(n,l,"linePrefix")}}const Yl={name:"thematicBreak",tokenize:Tx};function Tx(n,l,i){let o=0,u;return s;function s(p){return n.enter("thematicBreak"),c(p)}function c(p){return u=p,f(p)}function f(p){return p===u?(n.enter("thematicBreakSequence"),h(p)):o>=3&&(p===null||Be(p))?(n.exit("thematicBreak"),l(p)):i(p)}function h(p){return p===u?(n.consume(p),o++,h):(n.exit("thematicBreakSequence"),rt(p)?dt(n,f,"whitespace")(p):f(p))}}const Gt={continuation:{tokenize:Rx},exit:zx,name:"list",tokenize:Nx},Ax={partial:!0,tokenize:Mx},kx={partial:!0,tokenize:Ox};function Nx(n,l,i){const o=this,u=o.events[o.events.length-1];let s=u&&u[1].type==="linePrefix"?u[2].sliceSerialize(u[1],!0).length:0,c=0;return f;function f(y){const C=o.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!o.containerState.marker||y===o.containerState.marker:ou(y)){if(o.containerState.type||(o.containerState.type=C,n.enter(C,{_container:!0})),C==="listUnordered")return n.enter("listItemPrefix"),y===42||y===45?n.check(Yl,i,p)(y):p(y);if(!o.interrupt||y===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),h(y)}return i(y)}function h(y){return ou(y)&&++c<10?(n.consume(y),h):(!o.interrupt||c<2)&&(o.containerState.marker?y===o.containerState.marker:y===41||y===46)?(n.exit("listItemValue"),p(y)):i(y)}function p(y){return n.enter("listItemMarker"),n.consume(y),n.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||y,n.check(Fl,o.interrupt?i:g,n.attempt(Ax,v,b))}function g(y){return o.containerState.initialBlankLine=!0,s++,v(y)}function b(y){return rt(y)?(n.enter("listItemPrefixWhitespace"),n.consume(y),n.exit("listItemPrefixWhitespace"),v):i(y)}function v(y){return o.containerState.size=s+o.sliceSerialize(n.exit("listItemPrefix"),!0).length,l(y)}}function Rx(n,l,i){const o=this;return o.containerState._closeFlow=void 0,n.check(Fl,u,s);function u(f){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,dt(n,l,"listItemIndent",o.containerState.size+1)(f)}function s(f){return o.containerState.furtherBlankLines||!rt(f)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,c(f)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,n.attempt(kx,l,c)(f))}function c(f){return o.containerState._closeFlow=!0,o.interrupt=void 0,dt(n,n.attempt(Gt,l,i),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function Ox(n,l,i){const o=this;return dt(n,u,"listItemIndent",o.containerState.size+1);function u(s){const c=o.events[o.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===o.containerState.size?l(s):i(s)}}function zx(n){n.exit(this.containerState.type)}function Mx(n,l,i){const o=this;return dt(n,u,"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function u(s){const c=o.events[o.events.length-1];return!rt(s)&&c&&c[1].type==="listItemPrefixWhitespace"?l(s):i(s)}}const Pm={name:"setextUnderline",resolveTo:Dx,tokenize:jx};function Dx(n,l){let i=n.length,o,u,s;for(;i--;)if(n[i][0]==="enter"){if(n[i][1].type==="content"){o=i;break}n[i][1].type==="paragraph"&&(u=i)}else n[i][1].type==="content"&&n.splice(i,1),!s&&n[i][1].type==="definition"&&(s=i);const c={type:"setextHeading",start:{...n[o][1].start},end:{...n[n.length-1][1].end}};return n[u][1].type="setextHeadingText",s?(n.splice(u,0,["enter",c,l]),n.splice(s+1,0,["exit",n[o][1],l]),n[o][1].end={...n[s][1].end}):n[o][1]=c,n.push(["exit",c,l]),n}function jx(n,l,i){const o=this;let u;return s;function s(p){let g=o.events.length,b;for(;g--;)if(o.events[g][1].type!=="lineEnding"&&o.events[g][1].type!=="linePrefix"&&o.events[g][1].type!=="content"){b=o.events[g][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||b)?(n.enter("setextHeadingLine"),u=p,c(p)):i(p)}function c(p){return n.enter("setextHeadingLineSequence"),f(p)}function f(p){return p===u?(n.consume(p),f):(n.exit("setextHeadingLineSequence"),rt(p)?dt(n,h,"lineSuffix")(p):h(p))}function h(p){return p===null||Be(p)?(n.exit("setextHeadingLine"),l(p)):i(p)}}const Lx={tokenize:Ix};function Ix(n){const l=this,i=n.attempt(Fl,o,n.attempt(this.parser.constructs.flowInitial,u,dt(n,n.attempt(this.parser.constructs.flow,u,n.attempt(PE,u)),"linePrefix")));return i;function o(s){if(s===null){n.consume(s);return}return n.enter("lineEndingBlank"),n.consume(s),n.exit("lineEndingBlank"),l.currentConstruct=void 0,i}function u(s){if(s===null){n.consume(s);return}return n.enter("lineEnding"),n.consume(s),n.exit("lineEnding"),l.currentConstruct=void 0,i}}const Bx={resolveAll:Ym()},Ux=Fm("string"),Hx=Fm("text");function Fm(n){return{resolveAll:Ym(n==="text"?qx:void 0),tokenize:l};function l(i){const o=this,u=this.parser.constructs[n],s=i.attempt(u,c,f);return c;function c(g){return p(g)?s(g):f(g)}function f(g){if(g===null){i.consume(g);return}return i.enter("data"),i.consume(g),h}function h(g){return p(g)?(i.exit("data"),s(g)):(i.consume(g),h)}function p(g){if(g===null)return!0;const b=u[g];let v=-1;if(b)for(;++v<b.length;){const y=b[v];if(!y.previous||y.previous.call(o,o.previous))return!0}return!1}}}function Ym(n){return l;function l(i,o){let u=-1,s;for(;++u<=i.length;)s===void 0?i[u]&&i[u][1].type==="data"&&(s=u,u++):(!i[u]||i[u][1].type!=="data")&&(u!==s+2&&(i[s][1].end=i[u-1][1].end,i.splice(s+2,u-s-2),u=s+2),s=void 0);return n?n(i,o):i}}function qx(n,l){let i=0;for(;++i<=n.length;)if((i===n.length||n[i][1].type==="lineEnding")&&n[i-1][1].type==="data"){const o=n[i-1][1],u=l.sliceStream(o);let s=u.length,c=-1,f=0,h;for(;s--;){const p=u[s];if(typeof p=="string"){for(c=p.length;p.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(p===-2)h=!0,f++;else if(p!==-1){s++;break}}if(l._contentTypeTextTrailing&&i===n.length&&(f=0),f){const p={type:i===n.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?c:o.start._bufferIndex+c,_index:o.start._index+s,line:o.end.line,column:o.end.column-f,offset:o.end.offset-f},end:{...o.end}};o.end={...p.start},o.start.offset===o.end.offset?Object.assign(o,p):(n.splice(i,0,["enter",p,l],["exit",p,l]),i+=2)}i++}return n}const Px=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:{91:XE},disable:{null:[]},document:{42:Gt,43:Gt,45:Gt,48:Gt,49:Gt,50:Gt,51:Gt,52:Gt,53:Gt,54:Gt,55:Gt,56:Gt,57:Gt,62:zm},flow:{35:$E,42:Yl,45:[Pm,Yl],60:rx,61:Pm,95:Yl,96:Lm,126:Lm},flowInitial:{[-2]:cu,[-1]:cu,32:cu},insideSpan:{null:[uu,Bx]},string:{38:Dm,92:Mm},text:{[-5]:du,[-4]:du,[-3]:du,33:Ex,38:Dm,42:uu,60:[_E,cx],91:_x,92:[JE,Mm],93:fu,95:uu,96:LE}},Symbol.toStringTag,{value:"Module"}));function Fx(n,l,i){let o={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const u={},s=[];let c=[],f=[];const h={attempt:B(H),check:B(D),consume:A,enter:k,exit:P,interrupt:B(D,{interrupt:!0})},p={code:null,containerState:{},defineSkip:E,events:[],now:C,parser:n,previous:null,sliceSerialize:v,sliceStream:y,write:b};let g=l.tokenize.call(p,h);return l.resolveAll&&s.push(l),p;function b(ie){return c=dn(c,ie),T(),c[c.length-1]!==null?[]:(Y(l,0),p.events=su(s,p.events,p),p.events)}function v(ie,M){return Vx(y(ie),M)}function y(ie){return Yx(c,ie)}function C(){const{_bufferIndex:ie,_index:M,line:re,column:w,offset:V}=o;return{_bufferIndex:ie,_index:M,line:re,column:w,offset:V}}function E(ie){u[ie.line]=ie.column,$()}function T(){let ie;for(;o._index<c.length;){const M=c[o._index];if(typeof M=="string")for(ie=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===ie&&o._bufferIndex<M.length;)_(M.charCodeAt(o._bufferIndex));else _(M)}}function _(ie){g=g(ie)}function A(ie){Be(ie)?(o.line++,o.column=1,o.offset+=ie===-3?2:1,$()):ie!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===c[o._index].length&&(o._bufferIndex=-1,o._index++)),p.previous=ie}function k(ie,M){const re=M||{};return re.type=ie,re.start=C(),p.events.push(["enter",re,p]),f.push(re),re}function P(ie){const M=f.pop();return M.end=C(),p.events.push(["exit",M,p]),M}function H(ie,M){Y(ie,M.from)}function D(ie,M){M.restore()}function B(ie,M){return re;function re(w,V,Z){let Q,se,de,I;return Array.isArray(w)?U(w):"tokenize"in w?U([w]):N(w);function N(we){return Te;function Te(ke){const Ae=ke!==null&&we[ke],Pe=ke!==null&&we.null,ve=[...Array.isArray(Ae)?Ae:Ae?[Ae]:[],...Array.isArray(Pe)?Pe:Pe?[Pe]:[]];return U(ve)(ke)}}function U(we){return Q=we,se=0,we.length===0?Z:O(we[se])}function O(we){return Te;function Te(ke){return I=F(),de=we,we.partial||(p.currentConstruct=we),we.name&&p.parser.constructs.disable.null.includes(we.name)?ce():we.tokenize.call(M?Object.assign(Object.create(p),M):p,h,ne,ce)(ke)}}function ne(we){return ie(de,I),V}function ce(we){return I.restore(),++se<Q.length?O(Q[se]):Z}}}function Y(ie,M){ie.resolveAll&&!s.includes(ie)&&s.push(ie),ie.resolve&&zn(p.events,M,p.events.length-M,ie.resolve(p.events.slice(M),p)),ie.resolveTo&&(p.events=ie.resolveTo(p.events,p))}function F(){const ie=C(),M=p.previous,re=p.currentConstruct,w=p.events.length,V=Array.from(f);return{from:w,restore:Z};function Z(){o=ie,p.previous=M,p.currentConstruct=re,p.events.length=w,f=V,$()}}function $(){o.line in u&&o.column<2&&(o.column=u[o.line],o.offset+=u[o.line]-1)}}function Yx(n,l){const i=l.start._index,o=l.start._bufferIndex,u=l.end._index,s=l.end._bufferIndex;let c;if(i===u)c=[n[i].slice(o,s)];else{if(c=n.slice(i,u),o>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(o):c.shift()}s>0&&c.push(n[u].slice(0,s))}return c}function Vx(n,l){let i=-1;const o=[];let u;for(;++i<n.length;){const s=n[i];let c;if(typeof s=="string")c=s;else switch(s){case-5:{c="\r";break}case-4:{c=`
|
|
45
45
|
`;break}case-3:{c=`\r
|
|
46
46
|
`;break}case-2:{c=l?" ":" ";break}case-1:{if(!l&&u)continue;c=" ";break}default:c=String.fromCharCode(s)}u=s===-2,o.push(c)}return o.join("")}function Gx(n){const o={constructs:sE([Px,...(n||{}).extensions||[]]),content:u(gE),defined:[],document:u(bE),flow:u(Lx),lazy:{},string:u(Ux),text:u(Hx)};return o;function u(s){return c;function c(f){return Fx(o,s,f)}}}function Xx(n){for(;!Im(n););return n}const Vm=/[\0\t\n\r]/g;function Zx(){let n=1,l="",i=!0,o;return u;function u(s,c,f){const h=[];let p,g,b,v,y;for(s=l+(typeof s=="string"?s.toString():new TextDecoder(c||void 0).decode(s)),b=0,l="",i&&(s.charCodeAt(0)===65279&&b++,i=void 0);b<s.length;){if(Vm.lastIndex=b,p=Vm.exec(s),v=p&&p.index!==void 0?p.index:s.length,y=s.charCodeAt(v),!p){l=s.slice(b);break}if(y===10&&b===v&&o)h.push(-3),o=void 0;else switch(o&&(h.push(-5),o=void 0),b<v&&(h.push(s.slice(b,v)),n+=v-b),y){case 0:{h.push(65533),n++;break}case 9:{for(g=Math.ceil(n/4)*4,h.push(-2);n++<g;)h.push(-1);break}case 10:{h.push(-4),n=1;break}default:o=!0,n=1}b=v+1}return f&&(o&&h.push(-5),l&&h.push(l),h.push(null)),h}}const Kx=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qx(n){return n.replace(Kx,Jx)}function Jx(n,l,i){if(l)return l;if(i.charCodeAt(0)===35){const u=i.charCodeAt(1),s=u===120||u===88;return km(i.slice(s?2:1),s?16:10)}return au(i)||n}const Gm={}.hasOwnProperty;function Wx(n,l,i){return typeof l!="string"&&(i=l,l=void 0),$x(i)(Xx(Gx(i).document().write(Zx()(n,l,!0))))}function $x(n){const l={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(X),autolinkProtocol:F,autolinkEmail:F,atxHeading:s(K),blockQuote:s(Pe),characterEscape:F,characterReference:F,codeFenced:s(ve),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:s(ve,c),codeText:s(ze,c),codeTextData:F,data:F,codeFlowValue:F,definition:s(je),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:s(S),hardBreakEscape:s(W),hardBreakTrailing:s(W),htmlFlow:s(j,c),htmlFlowData:F,htmlText:s(j,c),htmlTextData:F,image:s(L),label:c,link:s(X),listItem:s(ge),listItemValue:v,listOrdered:s(he,b),listUnordered:s(he),paragraph:s(le),reference:O,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:s(K),strong:s(Ee),thematicBreak:s(Se)},exit:{atxHeading:h(),atxHeadingSequence:H,autolink:h(),autolinkEmail:Ae,autolinkProtocol:ke,blockQuote:h(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:we,characterReference:Te,codeFenced:h(T),codeFencedFence:E,codeFencedFenceInfo:y,codeFencedFenceMeta:C,codeFlowValue:$,codeIndented:h(_),codeText:h(V),codeTextData:$,data:$,definition:h(),definitionDestinationString:P,definitionLabelString:A,definitionTitleString:k,emphasis:h(),hardBreakEscape:h(M),hardBreakTrailing:h(M),htmlFlow:h(re),htmlFlowData:$,htmlText:h(w),htmlTextData:$,image:h(Q),label:de,labelText:se,lineEnding:ie,link:h(Z),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:ne,resourceDestinationString:I,resourceTitleString:N,resource:U,setextHeading:h(Y),setextHeadingLineSequence:B,setextHeadingText:D,strong:h(),thematicBreak:h()}};Xm(l,(n||{}).mdastExtensions||[]);const i={};return o;function o(te){let be={type:"root",children:[]};const Ce={stack:[be],tokenStack:[],config:l,enter:f,exit:p,buffer:c,resume:g,data:i},Ie=[];let Je=-1;for(;++Je<te.length;)if(te[Je][1].type==="listOrdered"||te[Je][1].type==="listUnordered")if(te[Je][0]==="enter")Ie.push(Je);else{const pt=Ie.pop();Je=u(te,pt,Je)}for(Je=-1;++Je<te.length;){const pt=l[te[Je][0]];Gm.call(pt,te[Je][1].type)&&pt[te[Je][1].type].call(Object.assign({sliceSerialize:te[Je][2].sliceSerialize},Ce),te[Je][1])}if(Ce.tokenStack.length>0){const pt=Ce.tokenStack[Ce.tokenStack.length-1];(pt[1]||Zm).call(Ce,void 0,pt[0])}for(be.position={start:hr(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:hr(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},Je=-1;++Je<l.transforms.length;)be=l.transforms[Je](be)||be;return be}function u(te,be,Ce){let Ie=be-1,Je=-1,pt=!1,qt,Xe,gt,Ot;for(;++Ie<=Ce;){const Ze=te[Ie];switch(Ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ze[0]==="enter"?Je++:Je--,Ot=void 0;break}case"lineEndingBlank":{Ze[0]==="enter"&&(qt&&!Ot&&!Je&&!gt&&(gt=Ie),Ot=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ot=void 0}if(!Je&&Ze[0]==="enter"&&Ze[1].type==="listItemPrefix"||Je===-1&&Ze[0]==="exit"&&(Ze[1].type==="listUnordered"||Ze[1].type==="listOrdered")){if(qt){let Cn=Ie;for(Xe=void 0;Cn--;){const nn=te[Cn];if(nn[1].type==="lineEnding"||nn[1].type==="lineEndingBlank"){if(nn[0]==="exit")continue;Xe&&(te[Xe][1].type="lineEndingBlank",pt=!0),nn[1].type="lineEnding",Xe=Cn}else if(!(nn[1].type==="linePrefix"||nn[1].type==="blockQuotePrefix"||nn[1].type==="blockQuotePrefixWhitespace"||nn[1].type==="blockQuoteMarker"||nn[1].type==="listItemIndent"))break}gt&&(!Xe||gt<Xe)&&(qt._spread=!0),qt.end=Object.assign({},Xe?te[Xe][1].start:Ze[1].end),te.splice(Xe||Ie,0,["exit",qt,Ze[2]]),Ie++,Ce++}if(Ze[1].type==="listItemPrefix"){const Cn={type:"listItem",_spread:!1,start:Object.assign({},Ze[1].start),end:void 0};qt=Cn,te.splice(Ie,0,["enter",Cn,Ze[2]]),Ie++,Ce++,gt=void 0,Ot=!0}}}return te[be][1]._spread=pt,Ce}function s(te,be){return Ce;function Ce(Ie){f.call(this,te(Ie),Ie),be&&be.call(this,Ie)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(te,be,Ce){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([be,Ce||void 0]),te.position={start:hr(be.start),end:void 0}}function h(te){return be;function be(Ce){te&&te.call(this,Ce),p.call(this,Ce)}}function p(te,be){const Ce=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==te.type&&(be?be.call(this,te,Ie[0]):(Ie[1]||Zm).call(this,te,Ie[0]));else throw new Error("Cannot close `"+te.type+"` ("+za({start:te.start,end:te.end})+"): it’s not open");Ce.position.end=hr(te.end)}function g(){return lE(this.stack.pop())}function b(){this.data.expectingFirstListItemValue=!0}function v(te){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(te),10),this.data.expectingFirstListItemValue=void 0}}function y(){const te=this.resume(),be=this.stack[this.stack.length-1];be.lang=te}function C(){const te=this.resume(),be=this.stack[this.stack.length-1];be.meta=te}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){const te=this.resume(),be=this.stack[this.stack.length-1];be.value=te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const te=this.resume(),be=this.stack[this.stack.length-1];be.value=te.replace(/(\r?\n|\r)$/g,"")}function A(te){const be=this.resume(),Ce=this.stack[this.stack.length-1];Ce.label=be,Ce.identifier=vi(this.sliceSerialize(te)).toLowerCase()}function k(){const te=this.resume(),be=this.stack[this.stack.length-1];be.title=te}function P(){const te=this.resume(),be=this.stack[this.stack.length-1];be.url=te}function H(te){const be=this.stack[this.stack.length-1];if(!be.depth){const Ce=this.sliceSerialize(te).length;be.depth=Ce}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function B(te){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function Y(){this.data.setextHeadingSlurpLineEnding=void 0}function F(te){const Ce=this.stack[this.stack.length-1].children;let Ie=Ce[Ce.length-1];(!Ie||Ie.type!=="text")&&(Ie=_e(),Ie.position={start:hr(te.start),end:void 0},Ce.push(Ie)),this.stack.push(Ie)}function $(te){const be=this.stack.pop();be.value+=this.sliceSerialize(te),be.position.end=hr(te.end)}function ie(te){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ce=be.children[be.children.length-1];Ce.position.end=hr(te.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&l.canContainEols.includes(be.type)&&(F.call(this,te),$.call(this,te))}function M(){this.data.atHardBreak=!0}function re(){const te=this.resume(),be=this.stack[this.stack.length-1];be.value=te}function w(){const te=this.resume(),be=this.stack[this.stack.length-1];be.value=te}function V(){const te=this.resume(),be=this.stack[this.stack.length-1];be.value=te}function Z(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=be,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function Q(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=be,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function se(te){const be=this.sliceSerialize(te),Ce=this.stack[this.stack.length-2];Ce.label=Qx(be),Ce.identifier=vi(be).toLowerCase()}function de(){const te=this.stack[this.stack.length-1],be=this.resume(),Ce=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ce.type==="link"){const Ie=te.children;Ce.children=Ie}else Ce.alt=be}function I(){const te=this.resume(),be=this.stack[this.stack.length-1];be.url=te}function N(){const te=this.resume(),be=this.stack[this.stack.length-1];be.title=te}function U(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function ne(te){const be=this.resume(),Ce=this.stack[this.stack.length-1];Ce.label=be,Ce.identifier=vi(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function ce(te){this.data.characterReferenceType=te.type}function we(te){const be=this.sliceSerialize(te),Ce=this.data.characterReferenceType;let Ie;Ce?(Ie=km(be,Ce==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=au(be);const Je=this.stack[this.stack.length-1];Je.value+=Ie}function Te(te){const be=this.stack.pop();be.position.end=hr(te.end)}function ke(te){$.call(this,te);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(te)}function Ae(te){$.call(this,te);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(te)}function Pe(){return{type:"blockquote",children:[]}}function ve(){return{type:"code",lang:null,meta:null,value:""}}function ze(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function S(){return{type:"emphasis",children:[]}}function K(){return{type:"heading",depth:0,children:[]}}function W(){return{type:"break"}}function j(){return{type:"html",value:""}}function L(){return{type:"image",title:null,url:"",alt:null}}function X(){return{type:"link",title:null,url:"",children:[]}}function he(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function ge(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function le(){return{type:"paragraph",children:[]}}function Ee(){return{type:"strong",children:[]}}function _e(){return{type:"text",value:""}}function Se(){return{type:"thematicBreak"}}}function hr(n){return{line:n.line,column:n.column,offset:n.offset}}function Xm(n,l){let i=-1;for(;++i<l.length;){const o=l[i];Array.isArray(o)?Xm(n,o):e_(n,o)}}function e_(n,l){let i;for(i in l)if(Gm.call(l,i))switch(i){case"canContainEols":{const o=l[i];o&&n[i].push(...o);break}case"transforms":{const o=l[i];o&&n[i].push(...o);break}case"enter":case"exit":{const o=l[i];o&&Object.assign(n[i],o);break}}}function Zm(n,l){throw n?new Error("Cannot close `"+n.type+"` ("+za({start:n.start,end:n.end})+"): a different token (`"+l.type+"`, "+za({start:l.start,end:l.end})+") is open"):new Error("Cannot close document, a token (`"+l.type+"`, "+za({start:l.start,end:l.end})+") is still open")}function t_(n){const l=this;l.parser=i;function i(o){return Wx(o,{...l.data("settings"),...n,extensions:l.data("micromarkExtensions")||[],mdastExtensions:l.data("fromMarkdownExtensions")||[]})}}function n_(n,l){const i={type:"element",tagName:"blockquote",properties:{},children:n.wrap(n.all(l),!0)};return n.patch(l,i),n.applyData(l,i)}function r_(n,l){const i={type:"element",tagName:"br",properties:{},children:[]};return n.patch(l,i),[n.applyData(l,i),{type:"text",value:`
|
|
@@ -53,5 +53,5 @@ Error generating stack: `+a.message+`
|
|
|
53
53
|
`});++o<n.length;)o&&i.push({type:"text",value:`
|
|
54
54
|
`}),i.push(n[o]);return l&&n.length>0&&i.push({type:"text",value:`
|
|
55
55
|
`}),i}function cp(n){let l=0,i=n.charCodeAt(l);for(;i===9||i===32;)l++,i=n.charCodeAt(l);return n.slice(l)}function fp(n,l){const i=V_(n,l),o=i.one(n,void 0),u=D_(i),s=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return u&&s.children.push({type:"text",value:`
|
|
56
|
-
`},u),s}function Q_(n,l){return n&&"run"in n?async function(i,o){const u=fp(i,{file:o,...l});await n.run(u,o)}:function(i,o){return fp(i,{file:o,...n||l})}}function dp(n){if(n)throw n}var bu,hp;function J_(){if(hp)return bu;hp=1;var n=Object.prototype.hasOwnProperty,l=Object.prototype.toString,i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,u=function(p){return typeof Array.isArray=="function"?Array.isArray(p):l.call(p)==="[object Array]"},s=function(p){if(!p||l.call(p)!=="[object Object]")return!1;var g=n.call(p,"constructor"),b=p.constructor&&p.constructor.prototype&&n.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!b)return!1;var v;for(v in p);return typeof v>"u"||n.call(p,v)},c=function(p,g){i&&g.name==="__proto__"?i(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},f=function(p,g){if(g==="__proto__")if(n.call(p,g)){if(o)return o(p,g).value}else return;return p[g]};return bu=function h(){var p,g,b,v,y,C,E=arguments[0],T=1,_=arguments.length,A=!1;for(typeof E=="boolean"&&(A=E,E=arguments[1]||{},T=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});T<_;++T)if(p=arguments[T],p!=null)for(g in p)b=f(E,g),v=f(p,g),E!==v&&(A&&v&&(s(v)||(y=u(v)))?(y?(y=!1,C=b&&u(b)?b:[]):C=b&&s(b)?b:{},c(E,{name:g,newValue:h(A,C,v)})):typeof v<"u"&&c(E,{name:g,newValue:v}));return E},bu}var W_=J_();const vu=ms(W_);function Su(n){if(typeof n!="object"||n===null)return!1;const l=Object.getPrototypeOf(n);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function $_(){const n=[],l={run:i,use:o};return l;function i(...u){let s=-1;const c=u.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...u);function f(h,...p){const g=n[++s];let b=-1;if(h){c(h);return}for(;++b<u.length;)(p[b]===null||p[b]===void 0)&&(p[b]=u[b]);u=p,g?ew(g,f)(...p):c(null,...p)}}function o(u){if(typeof u!="function")throw new TypeError("Expected `middelware` to be a function, not "+u);return n.push(u),l}}function ew(n,l){let i;return o;function o(...c){const f=n.length>c.length;let h;f&&c.push(u);try{h=n.apply(this,c)}catch(p){const g=p;if(f&&i)throw g;return u(g)}f||(h&&h.then&&typeof h.then=="function"?h.then(s,u):h instanceof Error?u(h):s(h))}function u(c,...f){i||(i=!0,l(c,...f))}function s(c){u(null,c)}}const Dn={basename:tw,dirname:nw,extname:rw,join:iw,sep:"/"};function tw(n,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');Ba(n);let i=0,o=-1,u=n.length,s;if(l===void 0||l.length===0||l.length>n.length){for(;u--;)if(n.codePointAt(u)===47){if(s){i=u+1;break}}else o<0&&(s=!0,o=u+1);return o<0?"":n.slice(i,o)}if(l===n)return"";let c=-1,f=l.length-1;for(;u--;)if(n.codePointAt(u)===47){if(s){i=u+1;break}}else c<0&&(s=!0,c=u+1),f>-1&&(n.codePointAt(u)===l.codePointAt(f--)?f<0&&(o=u):(f=-1,o=c));return i===o?o=c:o<0&&(o=n.length),n.slice(i,o)}function nw(n){if(Ba(n),n.length===0)return".";let l=-1,i=n.length,o;for(;--i;)if(n.codePointAt(i)===47){if(o){l=i;break}}else o||(o=!0);return l<0?n.codePointAt(0)===47?"/":".":l===1&&n.codePointAt(0)===47?"//":n.slice(0,l)}function rw(n){Ba(n);let l=n.length,i=-1,o=0,u=-1,s=0,c;for(;l--;){const f=n.codePointAt(l);if(f===47){if(c){o=l+1;break}continue}i<0&&(c=!0,i=l+1),f===46?u<0?u=l:s!==1&&(s=1):u>-1&&(s=-1)}return u<0||i<0||s===0||s===1&&u===i-1&&u===o+1?"":n.slice(u,i)}function iw(...n){let l=-1,i;for(;++l<n.length;)Ba(n[l]),n[l]&&(i=i===void 0?n[l]:i+"/"+n[l]);return i===void 0?".":aw(i)}function aw(n){Ba(n);const l=n.codePointAt(0)===47;let i=lw(n,!l);return i.length===0&&!l&&(i="."),i.length>0&&n.codePointAt(n.length-1)===47&&(i+="/"),l?"/"+i:i}function lw(n,l){let i="",o=0,u=-1,s=0,c=-1,f,h;for(;++c<=n.length;){if(c<n.length)f=n.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(u===c-1||s===1))if(u!==c-1&&s===2){if(i.length<2||o!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(h=i.lastIndexOf("/"),h!==i.length-1){h<0?(i="",o=0):(i=i.slice(0,h),o=i.length-1-i.lastIndexOf("/")),u=c,s=0;continue}}else if(i.length>0){i="",o=0,u=c,s=0;continue}}l&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+n.slice(u+1,c):i=n.slice(u+1,c),o=c-u-1;u=c,s=0}else f===46&&s>-1?s++:s=-1}return i}function Ba(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const ow={cwd:sw};function sw(){return"/"}function Eu(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function uw(n){if(typeof n=="string")n=new URL(n);else if(!Eu(n)){const l=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw l.code="ERR_INVALID_ARG_TYPE",l}if(n.protocol!=="file:"){const l=new TypeError("The URL must be of scheme file");throw l.code="ERR_INVALID_URL_SCHEME",l}return cw(n)}function cw(n){if(n.hostname!==""){const o=new TypeError('File URL host must be "localhost" or empty on darwin');throw o.code="ERR_INVALID_FILE_URL_HOST",o}const l=n.pathname;let i=-1;for(;++i<l.length;)if(l.codePointAt(i)===37&&l.codePointAt(i+1)===50){const o=l.codePointAt(i+2);if(o===70||o===102){const u=new TypeError("File URL path must not include encoded / characters");throw u.code="ERR_INVALID_FILE_URL_PATH",u}}return decodeURIComponent(l)}const xu=["history","path","basename","stem","extname","dirname"];class mp{constructor(l){let i;l?Eu(l)?i={path:l}:typeof l=="string"||fw(l)?i={value:l}:i=l:i={},this.cwd="cwd"in i?"":ow.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o=-1;for(;++o<xu.length;){const s=xu[o];s in i&&i[s]!==void 0&&i[s]!==null&&(this[s]=s==="history"?[...i[s]]:i[s])}let u;for(u in i)xu.includes(u)||(this[u]=i[u])}get basename(){return typeof this.path=="string"?Dn.basename(this.path):void 0}set basename(l){wu(l,"basename"),_u(l,"basename"),this.path=Dn.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?Dn.dirname(this.path):void 0}set dirname(l){pp(this.basename,"dirname"),this.path=Dn.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?Dn.extname(this.path):void 0}set extname(l){if(_u(l,"extname"),pp(this.dirname,"extname"),l){if(l.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(l.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Dn.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Eu(l)&&(l=uw(l)),wu(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?Dn.basename(this.path,this.extname):void 0}set stem(l){wu(l,"stem"),_u(l,"stem"),this.path=Dn.join(this.dirname||"",l+(this.extname||""))}fail(l,i,o){const u=this.message(l,i,o);throw u.fatal=!0,u}info(l,i,o){const u=this.message(l,i,o);return u.fatal=void 0,u}message(l,i,o){const u=new Ht(l,i,o);return this.path&&(u.name=this.path+":"+u.name,u.file=this.path),u.fatal=!1,this.messages.push(u),u}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function _u(n,l){if(n&&n.includes(Dn.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+Dn.sep+"`")}function wu(n,l){if(!n)throw new Error("`"+l+"` cannot be empty")}function pp(n,l){if(!n)throw new Error("Setting `"+l+"` requires `path` to be set too")}function fw(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const dw=(function(n){const o=this.constructor.prototype,u=o[n],s=function(){return u.apply(s,arguments)};return Object.setPrototypeOf(s,o),s}),hw={}.hasOwnProperty;class Cu extends dw{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=$_()}copy(){const l=new Cu;let i=-1;for(;++i<this.attachers.length;){const o=this.attachers[i];l.use(...o)}return l.data(vu(!0,{},this.namespace)),l}data(l,i){return typeof l=="string"?arguments.length===2?(ku("data",this.frozen),this.namespace[l]=i,this):hw.call(this.namespace,l)&&this.namespace[l]||void 0:l?(ku("data",this.frozen),this.namespace=l,this):this.namespace}freeze(){if(this.frozen)return this;const l=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...o]=this.attachers[this.freezeIndex];if(o[0]===!1)continue;o[0]===!0&&(o[0]=void 0);const u=i.call(l,...o);typeof u=="function"&&this.transformers.use(u)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const i=Jl(l),o=this.parser||this.Parser;return Tu("parse",o),o(String(i),i)}process(l,i){const o=this;return this.freeze(),Tu("process",this.parser||this.Parser),Au("process",this.compiler||this.Compiler),i?u(void 0,i):new Promise(u);function u(s,c){const f=Jl(l),h=o.parse(f);o.run(h,f,function(g,b,v){if(g||!b||!v)return p(g);const y=b,C=o.stringify(y,v);gw(C)?v.value=C:v.result=C,p(g,v)});function p(g,b){g||!b?c(g):s?s(b):i(void 0,b)}}}processSync(l){let i=!1,o;return this.freeze(),Tu("processSync",this.parser||this.Parser),Au("processSync",this.compiler||this.Compiler),this.process(l,u),yp("processSync","process",i),o;function u(s,c){i=!0,dp(s),o=c}}run(l,i,o){gp(l),this.freeze();const u=this.transformers;return!o&&typeof i=="function"&&(o=i,i=void 0),o?s(void 0,o):new Promise(s);function s(c,f){const h=Jl(i);u.run(l,h,p);function p(g,b,v){const y=b||l;g?f(g):c?c(y):o(void 0,y,v)}}}runSync(l,i){let o=!1,u;return this.run(l,i,s),yp("runSync","run",o),u;function s(c,f){dp(c),u=f,o=!0}}stringify(l,i){this.freeze();const o=Jl(i),u=this.compiler||this.Compiler;return Au("stringify",u),gp(l),u(l,o)}use(l,...i){const o=this.attachers,u=this.namespace;if(ku("use",this.frozen),l!=null)if(typeof l=="function")h(l,i);else if(typeof l=="object")Array.isArray(l)?f(l):c(l);else throw new TypeError("Expected usable value, not `"+l+"`");return this;function s(p){if(typeof p=="function")h(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...b]=p;h(g,b)}else c(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function c(p){if(!("plugins"in p)&&!("settings"in p))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");f(p.plugins),p.settings&&(u.settings=vu(!0,u.settings,p.settings))}function f(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const b=p[g];s(b)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function h(p,g){let b=-1,v=-1;for(;++b<o.length;)if(o[b][0]===p){v=b;break}if(v===-1)o.push([p,...g]);else if(g.length>0){let[y,...C]=g;const E=o[v][1];Su(E)&&Su(y)&&(y=vu(!0,E,y)),o[v]=[p,y,...C]}}}}const mw=new Cu().freeze();function Tu(n,l){if(typeof l!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function Au(n,l){if(typeof l!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function ku(n,l){if(l)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function gp(n){if(!Su(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function yp(n,l,i){if(!i)throw new Error("`"+n+"` finished async. Use `"+l+"` instead")}function Jl(n){return pw(n)?n:new mp(n)}function pw(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function gw(n){return typeof n=="string"||yw(n)}function yw(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const bw="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bp=[],vp={allowDangerousHtml:!0},vw=/^(https?|ircs?|mailto|xmpp)$/i,Sw=[{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 Ew(n){const l=xw(n),i=_w(n);return ww(l.runSync(l.parse(i),i),n)}function xw(n){const l=n.rehypePlugins||bp,i=n.remarkPlugins||bp,o=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...vp}:vp;return mw().use(t_).use(i).use(Q_,o).use(l)}function _w(n){const l=n.children||"",i=new mp;return typeof l=="string"&&(i.value=l),i}function ww(n,l){const i=l.allowedElements,o=l.allowElement,u=l.components,s=l.disallowedElements,c=l.skipHtml,f=l.unwrapDisallowed,h=l.urlTransform||Cw;for(const g of Sw)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+bw+g.id,void 0);return up(n,p),F1(n,{Fragment:z.Fragment,components:u,ignoreInvalidStyle:!0,jsx:z.jsx,jsxs:z.jsxs,passKeys:!0,passNode:!0});function p(g,b,v){if(g.type==="raw"&&v&&typeof b=="number")return c?v.children.splice(b,1):v.children[b]={type:"text",value:g.value},b;if(g.type==="element"){let y;for(y in iu)if(Object.hasOwn(iu,y)&&Object.hasOwn(g.properties,y)){const C=g.properties[y],E=iu[y];(E===null||E.includes(g.tagName))&&(g.properties[y]=h(String(C||""),y,g))}}if(g.type==="element"){let y=i?!i.includes(g.tagName):s?s.includes(g.tagName):!1;if(!y&&o&&typeof b=="number"&&(y=!o(g,b,v)),y&&v&&typeof b=="number")return f&&g.children?v.children.splice(b,1,...g.children):v.children.splice(b,1),b}}}function Cw(n){const l=n.indexOf(":"),i=n.indexOf("?"),o=n.indexOf("#"),u=n.indexOf("/");return l===-1||u!==-1&&l>u||i!==-1&&l>i||o!==-1&&l>o||vw.test(n.slice(0,l))?n:""}function Tw({text:n,maxWidth:l="200px",className:i="",icon:o,onClick:u,disabled:s=!1}){const[c,f]=q.useState(!1),h=q.useRef(null),p=q.useRef(null);return q.useEffect(()=>{const g=()=>{if(h.current&&p.current){const b=h.current.offsetWidth,v=p.current.scrollWidth;f(v>b)}};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[n,l]),n?z.jsxs("div",{ref:h,onClick:s?void 0:u,className:Ye("inline-flex items-center gap-2 rounded-full border border-lavender-200/60 bg-white/80 px-3 py-1 shadow-sm text-xs text-slate-700 hover: cursor-pointer",i,s?"opacity-50 cursor-not-allowed":""),style:{maxWidth:l},title:n,children:[o&&z.jsx("span",{className:"text-lavender-500",children:o}),z.jsx("div",{className:"pill-marquee-wrapper",children:z.jsx("span",{ref:p,className:Ye("block whitespace-normal",c?"pill-marquee":""),children:n})})]}):null}var Aw=Qf[" useInsertionEffect ".trim().toString()]||ur;function kw({prop:n,defaultProp:l,onChange:i=()=>{},caller:o}){const[u,s,c]=Nw({defaultProp:l,onChange:i}),f=n!==void 0,h=f?n:u;{const g=q.useRef(n!==void 0);q.useEffect(()=>{const b=g.current;if(b!==f){const v=b?"controlled":"uncontrolled",y=f?"controlled":"uncontrolled"}g.current=f},[f,o])}const p=q.useCallback(g=>{if(f){const b=Rw(g)?g(n):g;b!==n&&c.current?.(b)}else s(g)},[f,n,s,c]);return[h,p]}function Nw({defaultProp:n,onChange:l}){const[i,o]=q.useState(n),u=q.useRef(i),s=q.useRef(l);return Aw(()=>{s.current=l},[l]),q.useEffect(()=>{u.current!==i&&(s.current?.(i),u.current=i)},[i,u]),[i,o,s]}function Rw(n){return typeof n=="function"}function Ow(n){const l=q.useRef({value:n,previous:n});return q.useMemo(()=>(l.current.value!==n&&(l.current.previous=l.current.value,l.current.value=n),l.current.previous),[n])}function zw(n){const[l,i]=q.useState(void 0);return ur(()=>{if(n){i({width:n.offsetWidth,height:n.offsetHeight});const o=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const s=u[0];let c,f;if("borderBoxSize"in s){const h=s.borderBoxSize,p=Array.isArray(h)?h[0]:h;c=p.inlineSize,f=p.blockSize}else c=n.offsetWidth,f=n.offsetHeight;i({width:c,height:f})});return o.observe(n,{box:"border-box"}),()=>o.unobserve(n)}else i(void 0)},[n]),l}var Wl="Checkbox",[Mw]=ad(Wl),[Dw,Nu]=Mw(Wl);function jw(n){const{__scopeCheckbox:l,checked:i,children:o,defaultChecked:u,disabled:s,form:c,name:f,onCheckedChange:h,required:p,value:g="on",internal_do_not_use_render:b}=n,[v,y]=kw({prop:i,defaultProp:u??!1,onChange:h,caller:Wl}),[C,E]=q.useState(null),[T,_]=q.useState(null),A=q.useRef(!1),k=C?!!c||!!C.closest("form"):!0,P={checked:v,disabled:s,setChecked:y,control:C,setControl:E,name:f,form:c,value:g,hasConsumerStoppedPropagationRef:A,required:p,defaultChecked:mr(u)?!1:u,isFormControl:k,bubbleInput:T,setBubbleInput:_};return z.jsx(Dw,{scope:l,...P,children:Lw(b)?b(P):o})}var Sp="CheckboxTrigger",Ep=q.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:i,...o},u)=>{const{control:s,value:c,disabled:f,checked:h,required:p,setControl:g,setChecked:b,hasConsumerStoppedPropagationRef:v,isFormControl:y,bubbleInput:C}=Nu(Sp,n),E=Hn(u,g),T=q.useRef(h);return q.useEffect(()=>{const _=s?.form;if(_){const A=()=>b(T.current);return _.addEventListener("reset",A),()=>_.removeEventListener("reset",A)}},[s,b]),z.jsx(sr.button,{type:"button",role:"checkbox","aria-checked":mr(h)?"mixed":h,"aria-required":p,"data-state":Tp(h),"data-disabled":f?"":void 0,disabled:f,value:c,...o,ref:E,onKeyDown:qn(l,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:qn(i,_=>{b(A=>mr(A)?!0:!A),C&&y&&(v.current=_.isPropagationStopped(),v.current||_.stopPropagation())})})});Ep.displayName=Sp;var Ru=q.forwardRef((n,l)=>{const{__scopeCheckbox:i,name:o,checked:u,defaultChecked:s,required:c,disabled:f,value:h,onCheckedChange:p,form:g,...b}=n;return z.jsx(jw,{__scopeCheckbox:i,checked:u,defaultChecked:s,disabled:f,required:c,onCheckedChange:p,name:o,form:g,value:h,internal_do_not_use_render:({isFormControl:v})=>z.jsxs(z.Fragment,{children:[z.jsx(Ep,{...b,ref:l,__scopeCheckbox:i}),v&&z.jsx(Cp,{__scopeCheckbox:i})]})})});Ru.displayName=Wl;var xp="CheckboxIndicator",_p=q.forwardRef((n,l)=>{const{__scopeCheckbox:i,forceMount:o,...u}=n,s=Nu(xp,i);return z.jsx(fi,{present:o||mr(s.checked)||s.checked===!0,children:z.jsx(sr.span,{"data-state":Tp(s.checked),"data-disabled":s.disabled?"":void 0,...u,ref:l,style:{pointerEvents:"none",...n.style}})})});_p.displayName=xp;var wp="CheckboxBubbleInput",Cp=q.forwardRef(({__scopeCheckbox:n,...l},i)=>{const{control:o,hasConsumerStoppedPropagationRef:u,checked:s,defaultChecked:c,required:f,disabled:h,name:p,value:g,form:b,bubbleInput:v,setBubbleInput:y}=Nu(wp,n),C=Hn(i,y),E=Ow(s),T=zw(o);q.useEffect(()=>{const A=v;if(!A)return;const k=window.HTMLInputElement.prototype,H=Object.getOwnPropertyDescriptor(k,"checked").set,D=!u.current;if(E!==s&&H){const B=new Event("click",{bubbles:D});A.indeterminate=mr(s),H.call(A,mr(s)?!1:s),A.dispatchEvent(B)}},[v,E,s,u]);const _=q.useRef(mr(s)?!1:s);return z.jsx(sr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??_.current,required:f,disabled:h,name:p,value:g,form:b,...l,tabIndex:-1,ref:C,style:{...l.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Cp.displayName=wp;function Lw(n){return typeof n=="function"}function mr(n){return n==="indeterminate"}function Tp(n){return mr(n)?"indeterminate":n?"checked":"unchecked"}const Ou=q.forwardRef(({className:n,...l},i)=>z.jsx(Ru,{ref:i,className:Ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:z.jsx(_p,{className:Ye("grid place-content-center text-current"),children:z.jsx(Kd,{className:"h-4 w-4"})})}));Ou.displayName=Ru.displayName;var Gr=(n=>(n.NOTA="none_of_the_above",n.AOTA="all_of_the_above",n))(Gr||{});function Iw({options:n,selectedValues:l,onSelectionChange:i,additionalOption:o,className:u,required:s=!0,maxSelections:c,error:f,disabled:h}){const p=o?{id:`extra-${o}`,label:o==="all_of_the_above"?"All of the above":"None of the above",value:o==="all_of_the_above"?"All of the above":"None of the above"}:{id:"extra-None of the above",label:"None of the above",value:"None of the above"},g=_=>p?_.filter(A=>A!==p.value):_,b=_=>p?o==="none_of_the_above"?_?[p.value]:[]:o==="all_of_the_above"?_?[...n.map(A=>A.value),p.value]:g(l):_?[...l,p.value]:g(l):l,v=(_,A)=>{const k=p?g(l):l;return A?c&&k.length>=c?null:[...k,_]:k.filter(P=>P!==_)},y=_=>!(s&&_.length===0&&l.length===1),C=(_,A)=>{const P=p&&_===p.value?b(A):v(_,A);P!==null&&y(P)&&i(P)},E=!s||l.length>0,T=p?l.filter(_=>_!==p.value).length:l.length;return n.length?z.jsxs("div",{className:Ye("bg-gray-50","rounded-lg","p-4","border border-gray-200",u),children:[z.jsxs("div",{className:"space-y-3",children:[n.map(_=>{const A=h||c&&T>=c&&!l.includes(_.value);return z.jsxs("div",{className:"flex items-center space-x-3",children:[z.jsx(Ou,{id:_.id,checked:!!l.includes(_.value),disabled:!!A,onCheckedChange:k=>C(_.value,!!k),className:"mt-0.5 border border-muted-foreground"}),z.jsx("label",{htmlFor:_.id,className:Ye("text-sm font-medium leading-none cursor-pointer",A?"text-muted-foreground cursor-not-allowed":"text-secondary-foreground"),children:_.label})]},_.id)}),p&&z.jsxs(z.Fragment,{children:[z.jsx("div",{className:"border-t border-gray-300 my-3"}),z.jsxs("div",{className:"flex items-center space-x-3",children:[z.jsx(Ou,{id:p.id,checked:l.includes(p.value),onCheckedChange:_=>C(p.value,_),className:"mt-0.5 border border-muted-foreground"}),z.jsx("label",{htmlFor:p.id,className:"text-sm font-medium leading-none cursor-pointer text-secondary-foreground",children:p.label})]})]})]}),f&&z.jsx("p",{className:"text-sm text-red-500 mt-3",children:f}),s&&!E&&z.jsx("p",{className:"text-sm text-red-500 mt-3",children:"Please select at least one option"}),c&&T>=c&&z.jsx("p",{className:"text-sm text-blue-600 mt-3",children:c===1?"You can select only 1 option":`Maximum ${c} selections allowed`})]}):null}function Ap({file:n,onRemove:l,isPreview:i=!0,className:o=""}){const[u,s]=q.useState(!1),[c,f]=q.useState(""),h=n?.type?.startsWith("image/")??!1,p=n?.type==="application/pdf";q.useEffect(()=>{if(h){const v=URL.createObjectURL(n);return f(v),()=>URL.revokeObjectURL(v)}},[n,h]),q.useEffect(()=>{s(!1)},[n]);const g=()=>h?"text-green-600":"text-gray-600",b=v=>{if(v===0)return"0 B";const y=1024,C=["B","KB","MB","GB"],E=Math.floor(Math.log(v)/Math.log(y));return`${(v/Math.pow(y,E)).toFixed(1)} ${C[E]}`.toLowerCase()};return!h||u?z.jsxs("div",{className:`relative group inline-flex flex-shrink-0 bg-white border border-neutral-300 rounded-lg flex items-center gap-3 px-3 py-2.5 max-w-full ${i?"hover:bg-neutral-50":""} ${o}`,children:[z.jsx("div",{className:`flex-shrink-0 ${g()}`,children:z.jsx(yS,{className:"h-5 w-5"})}),z.jsxs("div",{className:"flex-1 min-w-0 max-w-[200px]",children:[n?.name&&z.jsx("div",{className:"text-sm font-medium text-[var(--color-foreground)] truncate",children:n.name}),n?.size&&z.jsx("div",{className:"text-xs text-[var(--color-muted-foreground)]",children:b(n.size)})]}),i&&l&&z.jsx("button",{onClick:l,"aria-label":`Remove ${n.name}`,className:"flex-shrink-0 flex items-center justify-center w-5 h-5 text-[var(--color-muted-foreground)] hover:text-[var(--color-foreground)] transition-colors",children:z.jsx(Os,{className:"h-4 w-4"})})]}):z.jsxs("div",{className:`relative group flex-shrink-0 ${o}`,children:[z.jsx("div",{className:`w-20 h-20 bg-white border border-neutral-300 rounded-lg flex items-center justify-center overflow-hidden ${i?"hover:bg-neutral-100 cursor-pointer":""}`,children:c&&z.jsx("img",{src:c,alt:n.name,className:"w-full h-full object-cover",onError:()=>s(!0)})}),i&&l&&z.jsx("button",{onClick:l,"aria-label":`Remove ${n.name}`,className:"absolute top-0 right-0 bg-[var(--color-muted)] text-black rounded-full w-5 h-5 flex items-center justify-center hover:bg-[var(--color-muted-foreground)] transition-colors z-10 transform translate-x-1 -translate-y-1",children:z.jsx(Os,{className:"h-3 w-3 text-black"})})]})}function Bw({files:n,onRemoveFile:l,isPreview:i=!0,className:o=""}){if(n.length===0)return null;const u=n.filter(c=>c.type?.startsWith("image/")),s=n.filter(c=>!c.type?.startsWith("image/"));return z.jsxs("div",{className:`flex flex-wrap justify-end gap-2 max-w-full ${o}`,children:[s.map(c=>{const f=n.indexOf(c);return z.jsx(Ap,{file:c,onRemove:l?()=>l(f):void 0,isPreview:i},`${c.name}-${c.size}-${f}`)}),u.length>0&&z.jsx("div",{className:"flex gap-2 overflow-x-auto max-w-full p-1 scrollbar-hide",children:u.map(c=>{const f=n.indexOf(c);return z.jsx(Ap,{file:c,onRemove:l?()=>l(f):void 0,isPreview:i},`${c.name}-${c.size}-${f}`)})})]})}function Uw({value:n,onValueChange:l,placeholder:i="Select an option",className:o,triggerClassName:u,contentClassName:s,disabled:c=!1,options:f=[],size:h="default"}){const[p,g]=q.useState(!1),b=q.useRef(null),v=q.useRef(null),y=f.find(T=>T.value===n);q.useEffect(()=>{const T=_=>{p&&_.key==="Escape"&&(g(!1),v.current?.focus())};return document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T)}},[p]);const C=T=>{l?.(T),g(!1),v.current?.focus()},E=()=>{c||g(!p)};return z.jsxs("div",{className:Ye("relative w-full",o),children:[z.jsxs("button",{ref:v,type:"button",onClick:E,disabled:c,className:Ye('border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*="text-"])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 overflow-hidden',h==="default"?"min-h-9":"min-h-8",u),"aria-expanded":p,"aria-haspopup":"listbox",children:[z.jsx("span",{className:Ye("flex-1 text-left min-w-0 overflow-hidden break-words line-clamp-2",!y&&"text-muted-foreground"),children:y?y.label:i}),z.jsx(Rs,{className:Ye("size-4 opacity-50 pointer-events-none shrink-0 transition-transform duration-200",p&&"rotate-180")})]}),p&&z.jsx("div",{ref:b,className:Ye("bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 relative z-50 max-h-[300px] min-w-[8rem] w-full overflow-x-hidden overflow-y-auto rounded-md shadow-md mt-1",s),role:"listbox",children:z.jsx("div",{className:"p-1",children:f.length===0?z.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground text-center",children:"No options available"}):f.map(T=>{const _=T.value===n;return z.jsxs("div",{onClick:()=>C(T.value),className:Ye("relative flex w-full cursor-pointer items-center gap-1 rounded-sm py-2.5 px-3 text-sm outline-none select-none transition-colors duration-150","hover:bg-accent hover:text-accent-foreground","focus-visible:bg-accent focus-visible:text-accent-foreground","active:bg-accent/80",_&&"bg-accent/50 text-foreground",c&&"pointer-events-none opacity-50 cursor-not-allowed"),role:"option","aria-selected":_,tabIndex:c?-1:0,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),c||C(T.value))},children:[z.jsx("span",{className:"flex-1 text-left min-w-0 break-words line-clamp-2",children:T.label}),_&&z.jsx("span",{className:"absolute right-3 flex size-4 items-center justify-center shrink-0 pointer-events-none",children:z.jsx(Kd,{className:"size-4 text-foreground"})})]},T.value)})})})]})}const Hw=n=>n?n.split(" ").map(l=>l[0]).slice(0,2).join("").toUpperCase():"DR",kp=n=>{const l=n.toLocaleDateString(void 0,{weekday:"short"}).toUpperCase(),i=n.toLocaleDateString(void 0,{day:"2-digit"});return{weekday:l,dayNum:i}},Np=n=>[...n].sort((l,i)=>new Date(l.date).getTime()-new Date(i.date).getTime()),Rp=(n,l)=>(n?.[l]?.slots_details?.length??0)>0;function qw({doctor:n,availability:l,callbacks:i,onBook:o,disabled:u=!1,getAvailabilityDatesForAppointment:s,getAvailableSlotsForAppointment:c}){const[f,h]=q.useState(!1),[p,g]=q.useState(0),[b,v]=q.useState(null),[y,C]=q.useState(0),[E,T]=q.useState(()=>n.hospitals[0]||null),[_,A]=q.useState(!0),[k,P]=q.useState(!1),[H,D]=q.useState(null),[B,Y]=q.useState(!1),[F,$]=q.useState(null),ie=Yr(ve=>ve.sessionId),M=E?.hospital_id,re=!!i?.[Ge.SYNAPSE_TOOL_CALLBACK_NAME.AVAILABILITY_DATES],w=!!i?.[Ge.SYNAPSE_TOOL_CALLBACK_NAME.AVAILABILITY_SLOTS],V=q.useMemo(()=>{if(!M)return l||null;const ve=H?.[M],ze=l?.[M];return ve?{...l||{},[M]:ve}:ze?l:l||null},[H,l,M]),Z=q.useCallback(async()=>{if(!(!n.doctor_id||!ie||!M)){A(!0),$(null);try{const ve=await s({doctor_id:n.doctor_id,hospital_id:M,region_id:E?.region_id||""}),ze=ve?.available_dates?.length&&ve?.available_dates?.map(X=>({date:X,slots:[]}))||[],je=l?.[M]?.slots_details||[],S=H?.[M]?.slots_details||[],K=new Map;je.forEach(X=>{K.set(X.date,X)}),S.forEach(X=>{K.set(X.date,X)});const j=[...Array.from(K.values())];ze.forEach(X=>{K.has(X.date)||j.push(X)});const L=Np(j);D(X=>({...X||{},[M]:{slots_details:L}}))}catch{$("Failed to load availability dates")}finally{A(!1)}}},[n.doctor_id,ie,M,E?.region_id,s,l,H]);q.useEffect(()=>{if(!M)return;const ve=Rp(H,M),ze=Rp(l??null,M);Y(!1),g(0),C(0),v(null),$(null),!ve&&!ze&&re&&ie?Z():A(!1)},[M]);const Q=q.useMemo(()=>{if(!M)return new Date;const ve=V?.[M]?.slots_details;if(!ve?.length)return new Date;const ze=ve[0];return ze?new Date(ze.date):new Date},[V,M]),se=q.useCallback(async ve=>{if(!(!n.doctor_id||!M||!E?.region_id||!ie)){P(!0);try{const ze=await c(ve,{doctor_id:n.doctor_id,hospital_id:M,region_id:E.region_id});if(!ze?.slots?.length)return;D(je=>{if(!je||!je?.[M]?.slots_details?.length)return{...je||{},[M]:{slots_details:[{date:ve,slots:ze.slots}]}};const S=je[M].slots_details.map(j=>j.date===ve?{...j,slots:ze.slots}:j),W=je[M].slots_details.some(j=>j.date===ve)?S:[...S,{date:ve,slots:ze.slots}];return{...je,[M]:{slots_details:Np(W)}}})}catch{$("Failed to load slots")}finally{P(!1)}}},[n.doctor_id,M,E?.region_id,ie,c]);q.useEffect(()=>{if(!M||B||_)return;const ve=V?.[M],ze=ve?.slots_details||[];if(M&&ze.length>0&&!B){let je=0;const S=ve?.selected_date||l?.[M]?.selected_date;if(S){const W=ze.findIndex(j=>j.date===S);W>=0&&(je=W)}else{const W=l?.[M]?.slots_details||[],j=ze.findIndex(L=>{const X=W.find(he=>he.date===L.date);return X?.slots&&X.slots.length>0});j>=0&&(je=j)}g(je),C(Math.floor(je/3)*3);const K=ze[je];K&&(!K?.slots||K.slots.length===0)&&w&&ie&&se(K.date)}},[V,M,l,B,_]);const de=q.useMemo(()=>{const ve=M?V?.[M]?.slots_details:null;if(ve?.length){const je=Math.max(0,Math.floor(y/3)*3),S=Math.min(ve.length,je+3);return ve.slice(je,S).map(K=>{const W=new Date(K.date),{weekday:j,dayNum:L}=kp(W);return{weekday:j,dayNum:L,date:K.date,hasAvailability:!0,fullDate:W,hasSlots:!!(K.slots&&K.slots.length>0)}})}const ze=new Date(Q);return ze.setDate(ze.getDate()+y),Array.from({length:3},(je,S)=>{const K=new Date(ze);K.setDate(ze.getDate()+S);const{weekday:W,dayNum:j}=kp(K),L=K.toISOString().split("T")[0];return{weekday:W,dayNum:j,date:L,hasAvailability:!1,fullDate:K,hasSlots:!1}})},[Q,y,V,M]),I=q.useMemo(()=>(M?V?.[M]?.slots_details:null)?.[p]||null,[V,M,p]),N=q.useMemo(()=>Hw(n.name),[n.name]),U=q.useCallback(()=>{Y(!0),C(ve=>Math.max(0,ve-3)),v(null)},[]),O=q.useCallback(()=>{Y(!0);const ve=M?V?.[M]?.slots_details:null,ze=ve?.length?Math.max(0,ve.length-3):0;C(je=>Math.min(ze,je+3)),v(null)},[M,V]),ne=q.useCallback(ve=>{Y(!0);const ze=M?V?.[M]?.slots_details:null,je=ze?.findIndex(K=>K.date===ve)??-1;je>=0&&g(je),v(null);const S=ze?.find(K=>K.date===ve);w&&(!S?.slots||S.slots.length===0)&&n.doctor_id&&M&&E?.region_id&&ie&&se(ve)},[M,V,w,n.doctor_id,E?.region_id]),ce=q.useMemo(()=>y>0,[y]),we=q.useMemo(()=>{const ve=M?V?.[M]?.slots_details:null;if(!ve||ve.length===0)return!1;const ze=Math.max(0,ve.length-3);return y<ze},[y,V,M]),Te=q.useCallback(()=>{o&&I&&b&&o({date:I.date,time:b,doctorData:{doctor:n,hospital_id:M||"",region_id:E?.region_id||""}})},[o,I,b,n,M,E?.region_id]),ke=q.useMemo(()=>n.hospitals.map(ve=>({value:ve.hospital_id,label:ve.name})),[n.hospitals]),Ae=q.useCallback(ve=>{v(ve)},[]),Pe=q.useCallback(ve=>{const ze=n.hospitals.find(je=>je.hospital_id===ve);ze&&T(ze)},[n.hospitals]);return z.jsxs(da,{className:"max-w-md rounded-xl border-lavender-200 shadow-md p-0 bg-white overflow-hidden","aria-label":"Appointment card",children:[z.jsx(Jd,{className:"flex flex-row items-center justify-between gap-3 bg-lavender-50 rounded-t-xl p-4 border-b border-lavender-100 overflow-hidden",children:z.jsxs("div",{className:"flex items-center gap-3",children:[n.profile_pic&&z.jsxs(ha,{className:"h-12 w-12 ring-2 ring-lavender-200",children:[z.jsx(fh,{src:n.profile_pic,alt:`${n.name} profile photo`,crossOrigin:"anonymous"}),z.jsx(ma,{className:"bg-lavender-100 text-lavender-700",children:N})]}),z.jsxs("div",{className:"min-w-0",children:[z.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[z.jsx("h3",{className:" text-base font-bold text-slate-900",children:n.name}),n.profile_link?z.jsx("a",{href:n.profile_link,target:"_blank",rel:"noreferrer",className:"text-xs font-semibold text-lavender-600 hover:text-lavender-700 hover:underline",children:"View profile"}):null]}),z.jsxs("p",{className:"mt-0.5 text-sm text-slate-600",children:[n.specialty,n.experience&&z.jsxs(z.Fragment,{children:[" • ",n.experience]})]})]})]})}),z.jsxs(Wd,{className:"px-4 py-2",children:[z.jsxs("div",{className:"grid gap-2 border-b border-lavender-100 pb-3",children:[n?.timings&&z.jsxs("div",{className:"flex items-start gap-2 text-sm text-slate-900",children:[z.jsx(gS,{className:"h-4 w-4 text-lavender-600 mt-0.5 flex-shrink-0","aria-hidden":!0}),z.jsx("span",{className:"text-slate-600 text-xs",children:n?.timings})]}),n.languages?z.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[z.jsx(bS,{className:"h-4 w-4 text-lavender-600","aria-hidden":!0}),z.jsx("span",{className:"text-slate-600",children:n.languages})]}):null,n?.hospitals&&n.hospitals?.length>1?E&&E.name&&z.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[z.jsx(Zd,{className:"h-4 w-4 text-lavender-600","aria-hidden":!0}),z.jsx(Uw,{options:ke,placeholder:"Select Hospital",disabled:u,onValueChange:Pe,value:E?.hospital_id||""})]}):E&&E.name&&z.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[z.jsx(Zd,{className:"h-4 w-4 text-lavender-600","aria-hidden":!0}),z.jsx("span",{className:"text-slate-600",children:E.name})]})]}),E?.hospital_id&&V?.[E?.hospital_id]?.slots_details?.length||i?.[Ge.SYNAPSE_TOOL_CALLBACK_NAME.AVAILABILITY_DATES]||_?z.jsx(kt,{type:"button",variant:"outline","aria-expanded":f,"aria-controls":"ap-slots",onClick:()=>h(ve=>!ve),disabled:_,className:"mt-3 w-full border-lavender-500 text-lavender-600 hover:bg-lavender-50 hover:border-lavender-600 disabled:opacity-50",children:_?z.jsxs(z.Fragment,{children:[z.jsx(Qd,{className:"h-4 w-4 mr-2 animate-spin"}),"Loading availability..."]}):z.jsxs(z.Fragment,{children:[z.jsx("span",{className:"mr-1",children:f?"Hide slots":"Show available slots"}),z.jsx(Rs,{className:`h-4 w-4 transition-transform ${f?"rotate-180":""}`,"aria-hidden":!0})]})}):z.jsx("div",{className:"mt-3 w-full flex items-center justify-center py-3 px-4 bg-lavender-50 border border-lavender-200 rounded-lg",children:z.jsx("span",{className:"text-sm text-slate-600 font-medium",children:"No details available"})}),f&&E?.hospital_id&&V?.[E?.hospital_id]?.slots_details?.length&&z.jsx("div",{id:"ap-slots",role:"region","aria-label":"Available slots",className:"pt-3",children:V?.[E?.hospital_id??""]?.slots_details?.length?z.jsxs(z.Fragment,{children:[z.jsxs("div",{className:"flex items-center gap-2 px-0.5",children:[z.jsx(kt,{type:"button",variant:"outline",size:"icon",onClick:U,"aria-label":"Previous 3 days",disabled:u||!ce,className:"h-8 w-8 flex-shrink-0 rounded-md border-lavender-200 bg-white text-lavender-700 hover:bg-lavender-50 hover:border-lavender-300 disabled:opacity-50",children:z.jsx(mS,{className:"h-4 w-4"})}),z.jsx("div",{className:"flex-1 grid grid-cols-3 gap-1 min-w-0",children:de.map((ve,ze)=>{const je=I?.date===ve.date,S=!ve.hasAvailability;return z.jsxs(kt,{type:"button",variant:"outline",onClick:()=>!S&&ne(ve.date),disabled:S||u,"aria-current":je?"date":void 0,className:["flex flex-col items-center justify-center h-12 rounded-lg border-2 p-2 gap-0.5 min-w-0 transition-all",je?"border-lavender-500 ring-2 ring-lavender-200 bg-lavender-50 shadow-sm":S?"border-slate-200 bg-slate-50 text-slate-300 cursor-not-allowed":"border-slate-200 bg-white hover:bg-lavender-50 hover:border-lavender-300"].join(" "),children:[z.jsx("span",{className:["text-[10px] tracking-wide w-full text-center font-medium",je?"text-lavender-700":S?"text-slate-300":"text-slate-600"].join(" "),children:ve.weekday}),z.jsx("span",{className:["text-xs font-bold w-full text-center",je?"text-lavender-700":S?"text-slate-300":"text-slate-900"].join(" "),children:ve.dayNum})]},`${ve.date}-${ze}`)})}),z.jsx(kt,{type:"button",variant:"outline",size:"icon",onClick:O,"aria-label":"Next 3 days",disabled:u||!we,className:"h-8 w-8 flex-shrink-0 rounded-md border-lavender-200 bg-white text-lavender-700 hover:bg-lavender-50 hover:border-lavender-300 disabled:opacity-50",children:z.jsx(pS,{className:"h-4 w-4"})})]}),z.jsx("div",{className:"px-0.5 py-3",children:k?z.jsxs("div",{className:"flex items-center justify-center py-4",children:[z.jsx(Qd,{className:"h-4 w-4 animate-spin text-lavender-600 mr-2"}),z.jsx("span",{className:"text-sm text-slate-600",children:"Loading slots..."})]}):I?.slots?.length?z.jsx("div",{className:"grid grid-cols-2 gap-2 max-h-48 overflow-y-auto",children:I.slots.map((ve,ze)=>{const je=b===ve;return z.jsxs(kt,{type:"button",variant:"outline",onClick:()=>Ae(ve),"aria-pressed":je,disabled:u,className:["inline-flex h-9 items-center justify-center gap-2 rounded-lg px-3 text-xs font-semibold transition-all",je?"border-lavender-600 bg-lavender-600 text-white shadow-sm hover:bg-lavender-700 hover:border-lavender-700":"border-lavender-200 bg-white text-slate-900 hover:bg-lavender-50 hover:border-lavender-300"].join(" "),children:[z.jsx(hS,{className:`h-3.5 w-3.5 flex-shrink-0${je?"text-white":"text-lavender-600"}`}),z.jsx("span",{className:"truncate",children:ve})]},ve||`slot-${ze}`)})}):z.jsx("p",{className:"px-1 text-sm text-slate-600",children:"No slots available for this day."})}),z.jsx("div",{className:"px-0.5 pb-1.5",children:z.jsxs(kt,{type:"button",onClick:Te,disabled:!b||u,"aria-disabled":!b,className:"w-full h-10 gap-2 bg-lavender-600 text-white hover:bg-lavender-700 disabled:opacity-60 shadow-sm font-semibold",children:["Book appointment",z.jsx(dS,{className:"h-4 w-4"})]})})]}):z.jsx("div",{className:"px-1 pb-2 pt-1",children:z.jsx("p",{className:"text-sm text-slate-600",children:F||"No availability provided."})})}),f&&!V?.[E?.hospital_id??""]?.slots_details?.length&&z.jsx("div",{className:"px-1 pb-2 pt-1",children:z.jsx("p",{className:"text-sm text-slate-600",children:F||"No availability provided."})})]})]})}function Pw({callTool:n,doctorDetails:l,callbacks:i,onBook:o,disabled:u=!1}){const[s,c]=q.useState([]),[f,h]=q.useState(!1),[p,g]=q.useState(0),[b,v]=q.useState(null),y=Yr(D=>D.sessionId),C=l.doctor_ids||[],E=C.length,T=Math.min(3,E),_=E-T;q.useEffect(()=>{if(C.length===0||!y)return;(async()=>{h(!0),v(null);try{const Y=C.slice(0,T).map(ie=>n(Ge.SYNAPSE_TOOL_NAME.DOCTOR_DETAILS,{doctor_id:ie})),F=await Promise.allSettled(Y),$=[];F.forEach((ie,M)=>{ie.status==="fulfilled"&&$.push(ie.value)}),c($),g($.length)}catch{v("Failed to load doctor details. Please try again.")}finally{h(!1)}})()},[C,y,T]);const A=async()=>{if(!(p>=E||!y)){h(!0),v(null);try{const B=C.slice(p).map($=>n(Ge.SYNAPSE_TOOL_NAME.DOCTOR_DETAILS,{doctor_id:$})),Y=await Promise.allSettled(B),F=[];Y.forEach(($,ie)=>{$.status==="fulfilled"&&F.push($.value)}),c($=>[...$,...F]),g($=>$+F.length)}catch{v("Failed to load more doctor details. Please try again.")}finally{h(!1)}}},k=D=>{o&&o(D)},P=async D=>{const B=i?.[Ge.SYNAPSE_TOOL_CALLBACK_NAME.AVAILABILITY_DATES].tool_name||Ge.SYNAPSE_TOOL_NAME.AVAILABILITY_DATES;return await n(B,{doctor_id:D.doctor_id,hospital_id:D.hospital_id,region_id:D.region_id})},H=async(D,B)=>{const Y=i?.[Ge.SYNAPSE_TOOL_CALLBACK_NAME.AVAILABILITY_SLOTS].tool_name||Ge.SYNAPSE_TOOL_NAME.AVAILABILITY_SLOTS;return await n(Y,{appointment_date:D,doctor_id:B.doctor_id,hospital_id:B.hospital_id,region_id:B.region_id})};return f&&s.length===0?z.jsx("div",{className:"flex items-center justify-center py-8",children:z.jsxs("div",{className:"text-center",children:[z.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[var(--color-primary)] mx-auto mb-3"}),z.jsx("p",{className:"text-sm text-gray-500",children:"Loading doctor details..."})]})}):b&&s.length===0?z.jsx("div",{className:"flex items-center justify-center py-8",children:z.jsxs("div",{className:"text-center",children:[z.jsx("p",{className:"text-sm text-red-500 mb-2",children:b}),z.jsx(kt,{variant:"outline",size:"sm",onClick:()=>{v(null),C.length>0&&y&&(async()=>{h(!0);try{const Y=C.slice(0,T).map(ie=>n(Ge.SYNAPSE_TOOL_NAME.DOCTOR_DETAILS,{doctor_id:ie})),F=await Promise.allSettled(Y),$=[];F.forEach((ie,M)=>{ie.status==="fulfilled"&&$.push(ie.value)}),c($),g($.length)}catch{v("Failed to load doctor details. Please try again.")}finally{h(!1)}})()},children:"Retry"})]})}):s.length===0?z.jsx("div",{className:"flex items-center justify-center py-2",children:z.jsx("p",{className:"text-sm text-gray-500",children:"No doctor details available."})}):z.jsxs("div",{className:"space-y-4",children:[z.jsx("div",{className:"space-y-4",children:s.map((D,B)=>D?.doctor_id&&z.jsx(qw,{doctor:D,availability:l.availability,callbacks:i,onBook:k,disabled:u,getAvailabilityDatesForAppointment:P,getAvailableSlotsForAppointment:H},`${B}`))}),p<E&&z.jsx("div",{className:"flex justify-center",children:z.jsx(kt,{variant:"outline",onClick:A,disabled:f,className:"px-6 py-2",children:f?z.jsxs(z.Fragment,{children:[z.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--color-primary)] mr-2"}),"Loading more doctors..."]}):`Show more (${_} more)`})}),b&&s.length>0&&z.jsxs("div",{className:"text-center",children:[z.jsx("p",{className:"text-sm text-red-500 mb-2",children:b}),z.jsx(kt,{variant:"outline",size:"sm",onClick:A,disabled:f,children:"Retry loading more"})]})]})}function Fw({role:n,content:l,timestamp:i,iconUrl:o,files:u,isLastMessage:s,progressMessage:c,toolEscalationData:f,callTool:h,onSendMessage:p}){const g=n==="user",[b,v]=q.useState([]),y=async k=>{const P=Date.now().toString();await p({message:k,messageId:P,toolCalled:!0})},C=async k=>{await p({message:`I want to book an appointment for ${k.doctorData?.doctor?.name||"the doctor"} on ${k.date} for ${k.time}`,toolCalled:!0})},E=k=>{v(k)},T=()=>{if(!f?.details?.input?.additional_option)return;const k=f.details?.input?.additional_option;if(typeof k=="string"&&(k===Gr.NOTA||k===Gr.AOTA))return k;if(typeof k=="object"&&k!==null){if(k.NOTA===Gr.NOTA)return Gr.NOTA;if(k.AOTA===Gr.AOTA)return Gr.AOTA}},_=()=>{const k=f?.details?.input?.options;return k?Array.isArray(k)?k.map((P,H)=>({id:`option-${H}`,label:P.label,value:P.value})):Object.keys(k).map((P,H)=>({id:`option-${H}`,label:P,value:P})):[]},A=async()=>{if(b.length>0){const k=b.join(", "),P=Date.now().toString();await p({message:k,messageId:P,toolCalled:!0})}};return z.jsx("div",{className:Ye("flex",g?"justify-end":"justify-start"),children:z.jsxs("div",{className:Ye("flex gap-3",g?"flex-row-reverse":"flex-row",f?.details?.component===Ge.SYNAPSE_COMPONENTS.MULTI?"max-w-md":g?"max-w-[60%]":"max-w-xs"),children:[!g&&z.jsx(ha,{className:"w-8 h-8 bg-gradient-to-br from-lavender-400 to-lavender-500 text-white text-xs font-bold flex-shrink-0",children:z.jsx(ma,{className:"bg-transparent text-white text-xs font-bold",children:o?z.jsx("img",{src:o,alt:"Bot Icon",className:"w-full h-full"}):z.jsx(Xd,{className:"w-full h-full"})})}),z.jsxs(da,{className:Ye("px-4 py-2 rounded-2xl shadow-none break-words overflow-wrap-anywhere whitespace-pre-wrap",g?"bg-lavender-100/95 backdrop-blur-md text-slate-900 rounded-br-none border border-lavender-200/60":"bg-white/80 backdrop-blur-md text-slate-800 shadow-sm rounded-bl-none border border-lavender-200/40",f&&"w-full"),children:[c&&!g&&s&&z.jsx("p",{className:"text-sm font-medium text-slate-500 pb-2",children:c}),l&&z.jsx("div",{className:"text-sm markdown-content mb-3",children:z.jsx(Ew,{children:l})}),u&&u.length>0&&z.jsx("div",{className:"mt-2",children:z.jsx(Bw,{files:u,isPreview:!1,className:""})}),f?.details?.component===Ge.SYNAPSE_COMPONENTS.PILL&&f?.details?.input?.options&&z.jsx("div",{className:"flex flex-wrap gap-2 mt-3",children:f.details?.input?.options.map((k,P)=>z.jsx(Tw,{disabled:f?.isResponded,text:k?.label||"",onClick:()=>y(k?.value||""),className:"cursor-pointer hover:bg-lavender-100/80 transition-colors"},P))}),f?.details?.component===Ge.SYNAPSE_COMPONENTS.MULTI&&f?.details?.input?.options&&z.jsxs("div",{className:"mt-3 space-y-3 break-words overflow-wrap-anywhere whitespace-pre-wrap",children:[z.jsx("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"Select multiple options:"}),z.jsx(Iw,{options:_(),selectedValues:b,onSelectionChange:E,additionalOption:T(),disabled:f?.isResponded}),z.jsx(kt,{onClick:A,disabled:b.length===0||f?.isResponded,className:Ye("w-full rounded-lg px-4 py-2 text-sm font-medium transition-all","bg-blue-100 hover:bg-blue-200 text-blue-600 border border-blue-200","disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 disabled:border-gray-200","shadow-sm hover:shadow-md active:scale-[0.98] "),children:"Confirm"})]}),f?.details?.component===Ge.SYNAPSE_COMPONENTS.DOCTOR_CARD&&f?.details?.input?.doctor_details&&h?z.jsx("div",{className:"mt-3",children:z.jsx(Pw,{doctorDetails:f?.details?.input?.doctor_details,callTool:h,callbacks:f?.details?._meta?.callbacks,onBook:C,disabled:f?.isResponded})}):null,c&&!g&&s&&z.jsx("p",{className:"text-sm font-medium text-teal-600",children:c}),i&&z.jsx("p",{className:Ye("text-xs mt-2 text-right","text-slate-500"),children:i})]})]})})}function Yw({messages:n,onSendMessage:l,iconUrl:i,callTool:o}){const u=Yr(c=>c.isWaitingForResponse),s=Yr(c=>c.progressMessage);return z.jsxs(z.Fragment,{children:[(n&&n.length>0||s)&&z.jsx(z.Fragment,{children:n.map((c,f)=>z.jsx("div",{className:"animate-slideUp scroll-mt-[80px]",id:f===n.length-1?"last-message":void 0,children:z.jsx(Fw,{role:c.role,content:c.content,files:c.files||[],iconUrl:i,toolEscalationData:c.toolEscalationData,timestamp:c.timestamp,onSendMessage:l,isLastMessage:f===n.length-1,progressMessage:s,callTool:o})},c.id))}),u&&z.jsx(Vw,{iconUrl:i})]})}function Vw({iconUrl:n}){return z.jsx("div",{className:"animate-slideUp",children:z.jsx("div",{className:"flex justify-start",children:z.jsxs("div",{className:"flex gap-3",children:[z.jsx(ha,{className:"w-8 h-8 bg-gradient-to-br from-lavender-400 to-lavender-500 text-white text-xs font-bold flex-shrink-0",children:z.jsx(ma,{className:"bg-transparent text-white text-xs font-bold",children:n?z.jsx("img",{src:n,alt:"Bot Icon",className:"w-4 h-4",loading:"lazy"}):z.jsx(Xd,{className:"w-4 h-4"})})}),z.jsx(da,{className:"px-4 py-2 rounded-2xl shadow-none bg-white/80 backdrop-blur-md text-slate-800 shadow-sm rounded-bl-none border border-lavender-200/40",children:z.jsxs("div",{className:"flex items-center gap-1.5","aria-label":"Bot is typing",children:[z.jsx("span",{className:"text-sm text-slate-400",children:"Thinking"}),[0,1,2].map(l=>z.jsx("span",{className:"w-2 h-2 rounded-full bg-slate-400 animate-pulse",style:{animationDelay:`${l*150}ms`}},l))]})})]})})})}const Gw=Object.freeze(Object.defineProperty({__proto__:null,default:Yw},Symbol.toStringTag,{value:"Module"}));function Xw({onTaskClick:n,disabled:l,tasks:i}){return i?.length?z.jsx("div",{className:"grid grid-cols-2 gap-3",children:i.map(o=>z.jsx(kt,{type:"button",variant:"ghost",disabled:l,onClick:()=>n(o.value||""),className:"h-auto w-full flex flex-col items-start bg-white shadow-lg ring-1 ring-lavender-100 backdrop-blur-sm rounded-2xl p-4 hover:bg-white/95 hover:border-lavender-300 hover:shadow-lg transition-all text-left group",children:z.jsx("div",{className:"flex items-start justify-between gap-3",children:z.jsx("h3",{className:"font-semibold text-sm text-slate-900 text-wrap group-hover:text-lavender-600 transition-colors",children:o.label||""})})},o.value))}):null}function Zw({initialPrompt:n,tasks:l,onTaskClick:i,disabled:o}){return z.jsxs(z.Fragment,{children:[z.jsx("div",{className:"text-center space-y-2 animate-fadeIn",children:z.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:n||"How can I assist you today?"})}),z.jsx(Xw,{onTaskClick:i,disabled:o,tasks:l})]})}const Kw=Object.freeze(Object.defineProperty({__proto__:null,default:Zw},Symbol.toStringTag,{value:"Module"}));function Qw({className:n="",onRetry:l,onStartNewSession:i,showRetryButton:o,startNewConnection:u,clearError:s,error:c,isConnected:f}){const{isOnline:h}=Wh(),[p,g]=q.useState(!0);return q.useEffect(()=>{if(!u&&!o&&!!c){g(!0);const y=setTimeout(()=>g(!1),5e3);return()=>clearTimeout(y)}g(!0)},[c,u,o]),u?z.jsx("div",{className:Ye("mx-4 mb-3 px-2 py-1 bg-[#FFFBEB] border border-[#FEE39B] rounded-lg",n),children:z.jsxs("div",{className:"flex items-center gap-3",children:[z.jsx("div",{className:"w-4 h-4 bg-[#F7B500] rounded-full flex items-center justify-center flex-shrink-0",children:z.jsx("span",{className:"text-white text-sm font-bold",children:"!"})}),z.jsxs("div",{className:"flex-1",children:[z.jsx("div",{className:"text-slate-700 font-semibold text-sm",children:c?.title??"Something went wrong"}),z.jsx("div",{className:"text-[#666666] text-xs mt-1",children:"Start a new session."})]}),z.jsxs("button",{onClick:()=>{s(),i?.()},className:"p-2 bg-[#3B71F7] text-white text-xs font-semibold rounded-lg hover:bg-[#2E5CD9] transition-colors flex items-center gap-2 flex-shrink-0",children:[z.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:z.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),z.jsx("span",{className:"text-xs font-semibold",children:"Start new chat"})]})]})}):o?z.jsx("div",{className:Ye("mx-4 mb-3 p-2 bg-[#FFFBEB] border border-[#FEE39B] rounded-lg",n),children:z.jsxs("div",{className:"flex items-center gap-3",children:[z.jsx("div",{className:"w-5 h-5 bg-[#F7B500] rounded-full flex items-center justify-center flex-shrink-0",children:z.jsx("span",{className:"text-white text-sm font-bold",children:"!"})}),z.jsxs("div",{className:"flex-1",children:[z.jsx("div",{className:"text-slate-700 font-semibold text-sm",children:c?.title??"Failed to connect"}),z.jsx("div",{className:"text-slate-500 text-xs mt-1",children:c?.description??"Please check your connection and try again"})]}),z.jsxs("button",{onClick:()=>{s(),l?.()},className:"px-4 py-2 bg-lavender-600 text-white text-sm font-semibold rounded-lg hover:bg-lavender-700 transition-colors flex items-center gap-2 flex-shrink-0",children:[z.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:z.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):f&&h&&!c?.title||!u&&!o&&!p?null:z.jsx("div",{className:Ye("mx-4 mb-3 p-2 bg-[#FFFBEB] border border-[#FDD835] rounded-lg transition-opacity duration-500",n),children:z.jsxs("div",{className:"flex items-center gap-3",children:[z.jsx("div",{className:"w-5 h-5 bg-[#FDD835] rounded-full flex items-center justify-center flex-shrink-0",children:z.jsx("span",{className:"text-white text-sm font-bold",children:"!"})}),z.jsxs("div",{className:"flex-1",children:[z.jsx("div",{className:"text-slate-700 font-semibold text-sm",children:h?c?.title||"Connecting...":"No internet connection"}),z.jsx("div",{className:"text-slate-500 text-xs mt-1",children:h?c?.description??"Please wait while we try to connect":"Please check your internet connection"})]}),!f&&z.jsx("div",{className:"flex-shrink-0",children:z.jsx("div",{className:"w-6 h-6 border-2 border-[#FDD835] border-t-transparent rounded-full animate-spin"})})]})})}const Jw=Object.freeze(Object.defineProperty({__proto__:null,ConnectionStatus:Qw},Symbol.toStringTag,{value:"Module"}));return hs.renderMedAssist=$h,Object.defineProperty(hs,Symbol.toStringTag,{value:"Module"}),hs})({});
|
|
56
|
+
`},u),s}function Q_(n,l){return n&&"run"in n?async function(i,o){const u=fp(i,{file:o,...l});await n.run(u,o)}:function(i,o){return fp(i,{file:o,...n||l})}}function dp(n){if(n)throw n}var bu,hp;function J_(){if(hp)return bu;hp=1;var n=Object.prototype.hasOwnProperty,l=Object.prototype.toString,i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,u=function(p){return typeof Array.isArray=="function"?Array.isArray(p):l.call(p)==="[object Array]"},s=function(p){if(!p||l.call(p)!=="[object Object]")return!1;var g=n.call(p,"constructor"),b=p.constructor&&p.constructor.prototype&&n.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!b)return!1;var v;for(v in p);return typeof v>"u"||n.call(p,v)},c=function(p,g){i&&g.name==="__proto__"?i(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},f=function(p,g){if(g==="__proto__")if(n.call(p,g)){if(o)return o(p,g).value}else return;return p[g]};return bu=function h(){var p,g,b,v,y,C,E=arguments[0],T=1,_=arguments.length,A=!1;for(typeof E=="boolean"&&(A=E,E=arguments[1]||{},T=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});T<_;++T)if(p=arguments[T],p!=null)for(g in p)b=f(E,g),v=f(p,g),E!==v&&(A&&v&&(s(v)||(y=u(v)))?(y?(y=!1,C=b&&u(b)?b:[]):C=b&&s(b)?b:{},c(E,{name:g,newValue:h(A,C,v)})):typeof v<"u"&&c(E,{name:g,newValue:v}));return E},bu}var W_=J_();const vu=ms(W_);function Su(n){if(typeof n!="object"||n===null)return!1;const l=Object.getPrototypeOf(n);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function $_(){const n=[],l={run:i,use:o};return l;function i(...u){let s=-1;const c=u.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...u);function f(h,...p){const g=n[++s];let b=-1;if(h){c(h);return}for(;++b<u.length;)(p[b]===null||p[b]===void 0)&&(p[b]=u[b]);u=p,g?ew(g,f)(...p):c(null,...p)}}function o(u){if(typeof u!="function")throw new TypeError("Expected `middelware` to be a function, not "+u);return n.push(u),l}}function ew(n,l){let i;return o;function o(...c){const f=n.length>c.length;let h;f&&c.push(u);try{h=n.apply(this,c)}catch(p){const g=p;if(f&&i)throw g;return u(g)}f||(h&&h.then&&typeof h.then=="function"?h.then(s,u):h instanceof Error?u(h):s(h))}function u(c,...f){i||(i=!0,l(c,...f))}function s(c){u(null,c)}}const Dn={basename:tw,dirname:nw,extname:rw,join:iw,sep:"/"};function tw(n,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');Ba(n);let i=0,o=-1,u=n.length,s;if(l===void 0||l.length===0||l.length>n.length){for(;u--;)if(n.codePointAt(u)===47){if(s){i=u+1;break}}else o<0&&(s=!0,o=u+1);return o<0?"":n.slice(i,o)}if(l===n)return"";let c=-1,f=l.length-1;for(;u--;)if(n.codePointAt(u)===47){if(s){i=u+1;break}}else c<0&&(s=!0,c=u+1),f>-1&&(n.codePointAt(u)===l.codePointAt(f--)?f<0&&(o=u):(f=-1,o=c));return i===o?o=c:o<0&&(o=n.length),n.slice(i,o)}function nw(n){if(Ba(n),n.length===0)return".";let l=-1,i=n.length,o;for(;--i;)if(n.codePointAt(i)===47){if(o){l=i;break}}else o||(o=!0);return l<0?n.codePointAt(0)===47?"/":".":l===1&&n.codePointAt(0)===47?"//":n.slice(0,l)}function rw(n){Ba(n);let l=n.length,i=-1,o=0,u=-1,s=0,c;for(;l--;){const f=n.codePointAt(l);if(f===47){if(c){o=l+1;break}continue}i<0&&(c=!0,i=l+1),f===46?u<0?u=l:s!==1&&(s=1):u>-1&&(s=-1)}return u<0||i<0||s===0||s===1&&u===i-1&&u===o+1?"":n.slice(u,i)}function iw(...n){let l=-1,i;for(;++l<n.length;)Ba(n[l]),n[l]&&(i=i===void 0?n[l]:i+"/"+n[l]);return i===void 0?".":aw(i)}function aw(n){Ba(n);const l=n.codePointAt(0)===47;let i=lw(n,!l);return i.length===0&&!l&&(i="."),i.length>0&&n.codePointAt(n.length-1)===47&&(i+="/"),l?"/"+i:i}function lw(n,l){let i="",o=0,u=-1,s=0,c=-1,f,h;for(;++c<=n.length;){if(c<n.length)f=n.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(u===c-1||s===1))if(u!==c-1&&s===2){if(i.length<2||o!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(h=i.lastIndexOf("/"),h!==i.length-1){h<0?(i="",o=0):(i=i.slice(0,h),o=i.length-1-i.lastIndexOf("/")),u=c,s=0;continue}}else if(i.length>0){i="",o=0,u=c,s=0;continue}}l&&(i=i.length>0?i+"/..":"..",o=2)}else i.length>0?i+="/"+n.slice(u+1,c):i=n.slice(u+1,c),o=c-u-1;u=c,s=0}else f===46&&s>-1?s++:s=-1}return i}function Ba(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const ow={cwd:sw};function sw(){return"/"}function Eu(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function uw(n){if(typeof n=="string")n=new URL(n);else if(!Eu(n)){const l=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw l.code="ERR_INVALID_ARG_TYPE",l}if(n.protocol!=="file:"){const l=new TypeError("The URL must be of scheme file");throw l.code="ERR_INVALID_URL_SCHEME",l}return cw(n)}function cw(n){if(n.hostname!==""){const o=new TypeError('File URL host must be "localhost" or empty on darwin');throw o.code="ERR_INVALID_FILE_URL_HOST",o}const l=n.pathname;let i=-1;for(;++i<l.length;)if(l.codePointAt(i)===37&&l.codePointAt(i+1)===50){const o=l.codePointAt(i+2);if(o===70||o===102){const u=new TypeError("File URL path must not include encoded / characters");throw u.code="ERR_INVALID_FILE_URL_PATH",u}}return decodeURIComponent(l)}const xu=["history","path","basename","stem","extname","dirname"];class mp{constructor(l){let i;l?Eu(l)?i={path:l}:typeof l=="string"||fw(l)?i={value:l}:i=l:i={},this.cwd="cwd"in i?"":ow.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o=-1;for(;++o<xu.length;){const s=xu[o];s in i&&i[s]!==void 0&&i[s]!==null&&(this[s]=s==="history"?[...i[s]]:i[s])}let u;for(u in i)xu.includes(u)||(this[u]=i[u])}get basename(){return typeof this.path=="string"?Dn.basename(this.path):void 0}set basename(l){wu(l,"basename"),_u(l,"basename"),this.path=Dn.join(this.dirname||"",l)}get dirname(){return typeof this.path=="string"?Dn.dirname(this.path):void 0}set dirname(l){pp(this.basename,"dirname"),this.path=Dn.join(l||"",this.basename)}get extname(){return typeof this.path=="string"?Dn.extname(this.path):void 0}set extname(l){if(_u(l,"extname"),pp(this.dirname,"extname"),l){if(l.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(l.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Dn.join(this.dirname,this.stem+(l||""))}get path(){return this.history[this.history.length-1]}set path(l){Eu(l)&&(l=uw(l)),wu(l,"path"),this.path!==l&&this.history.push(l)}get stem(){return typeof this.path=="string"?Dn.basename(this.path,this.extname):void 0}set stem(l){wu(l,"stem"),_u(l,"stem"),this.path=Dn.join(this.dirname||"",l+(this.extname||""))}fail(l,i,o){const u=this.message(l,i,o);throw u.fatal=!0,u}info(l,i,o){const u=this.message(l,i,o);return u.fatal=void 0,u}message(l,i,o){const u=new Ht(l,i,o);return this.path&&(u.name=this.path+":"+u.name,u.file=this.path),u.fatal=!1,this.messages.push(u),u}toString(l){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(l||void 0).decode(this.value)}}function _u(n,l){if(n&&n.includes(Dn.sep))throw new Error("`"+l+"` cannot be a path: did not expect `"+Dn.sep+"`")}function wu(n,l){if(!n)throw new Error("`"+l+"` cannot be empty")}function pp(n,l){if(!n)throw new Error("Setting `"+l+"` requires `path` to be set too")}function fw(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const dw=(function(n){const o=this.constructor.prototype,u=o[n],s=function(){return u.apply(s,arguments)};return Object.setPrototypeOf(s,o),s}),hw={}.hasOwnProperty;class Cu extends dw{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=$_()}copy(){const l=new Cu;let i=-1;for(;++i<this.attachers.length;){const o=this.attachers[i];l.use(...o)}return l.data(vu(!0,{},this.namespace)),l}data(l,i){return typeof l=="string"?arguments.length===2?(ku("data",this.frozen),this.namespace[l]=i,this):hw.call(this.namespace,l)&&this.namespace[l]||void 0:l?(ku("data",this.frozen),this.namespace=l,this):this.namespace}freeze(){if(this.frozen)return this;const l=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...o]=this.attachers[this.freezeIndex];if(o[0]===!1)continue;o[0]===!0&&(o[0]=void 0);const u=i.call(l,...o);typeof u=="function"&&this.transformers.use(u)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(l){this.freeze();const i=Jl(l),o=this.parser||this.Parser;return Tu("parse",o),o(String(i),i)}process(l,i){const o=this;return this.freeze(),Tu("process",this.parser||this.Parser),Au("process",this.compiler||this.Compiler),i?u(void 0,i):new Promise(u);function u(s,c){const f=Jl(l),h=o.parse(f);o.run(h,f,function(g,b,v){if(g||!b||!v)return p(g);const y=b,C=o.stringify(y,v);gw(C)?v.value=C:v.result=C,p(g,v)});function p(g,b){g||!b?c(g):s?s(b):i(void 0,b)}}}processSync(l){let i=!1,o;return this.freeze(),Tu("processSync",this.parser||this.Parser),Au("processSync",this.compiler||this.Compiler),this.process(l,u),yp("processSync","process",i),o;function u(s,c){i=!0,dp(s),o=c}}run(l,i,o){gp(l),this.freeze();const u=this.transformers;return!o&&typeof i=="function"&&(o=i,i=void 0),o?s(void 0,o):new Promise(s);function s(c,f){const h=Jl(i);u.run(l,h,p);function p(g,b,v){const y=b||l;g?f(g):c?c(y):o(void 0,y,v)}}}runSync(l,i){let o=!1,u;return this.run(l,i,s),yp("runSync","run",o),u;function s(c,f){dp(c),u=f,o=!0}}stringify(l,i){this.freeze();const o=Jl(i),u=this.compiler||this.Compiler;return Au("stringify",u),gp(l),u(l,o)}use(l,...i){const o=this.attachers,u=this.namespace;if(ku("use",this.frozen),l!=null)if(typeof l=="function")h(l,i);else if(typeof l=="object")Array.isArray(l)?f(l):c(l);else throw new TypeError("Expected usable value, not `"+l+"`");return this;function s(p){if(typeof p=="function")h(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...b]=p;h(g,b)}else c(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function c(p){if(!("plugins"in p)&&!("settings"in p))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");f(p.plugins),p.settings&&(u.settings=vu(!0,u.settings,p.settings))}function f(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const b=p[g];s(b)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function h(p,g){let b=-1,v=-1;for(;++b<o.length;)if(o[b][0]===p){v=b;break}if(v===-1)o.push([p,...g]);else if(g.length>0){let[y,...C]=g;const E=o[v][1];Su(E)&&Su(y)&&(y=vu(!0,E,y)),o[v]=[p,y,...C]}}}}const mw=new Cu().freeze();function Tu(n,l){if(typeof l!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function Au(n,l){if(typeof l!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function ku(n,l){if(l)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function gp(n){if(!Su(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function yp(n,l,i){if(!i)throw new Error("`"+n+"` finished async. Use `"+l+"` instead")}function Jl(n){return pw(n)?n:new mp(n)}function pw(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function gw(n){return typeof n=="string"||yw(n)}function yw(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const bw="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bp=[],vp={allowDangerousHtml:!0},vw=/^(https?|ircs?|mailto|xmpp)$/i,Sw=[{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 Ew(n){const l=xw(n),i=_w(n);return ww(l.runSync(l.parse(i),i),n)}function xw(n){const l=n.rehypePlugins||bp,i=n.remarkPlugins||bp,o=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...vp}:vp;return mw().use(t_).use(i).use(Q_,o).use(l)}function _w(n){const l=n.children||"",i=new mp;return typeof l=="string"&&(i.value=l),i}function ww(n,l){const i=l.allowedElements,o=l.allowElement,u=l.components,s=l.disallowedElements,c=l.skipHtml,f=l.unwrapDisallowed,h=l.urlTransform||Cw;for(const g of Sw)Object.hasOwn(l,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+bw+g.id,void 0);return up(n,p),F1(n,{Fragment:z.Fragment,components:u,ignoreInvalidStyle:!0,jsx:z.jsx,jsxs:z.jsxs,passKeys:!0,passNode:!0});function p(g,b,v){if(g.type==="raw"&&v&&typeof b=="number")return c?v.children.splice(b,1):v.children[b]={type:"text",value:g.value},b;if(g.type==="element"){let y;for(y in iu)if(Object.hasOwn(iu,y)&&Object.hasOwn(g.properties,y)){const C=g.properties[y],E=iu[y];(E===null||E.includes(g.tagName))&&(g.properties[y]=h(String(C||""),y,g))}}if(g.type==="element"){let y=i?!i.includes(g.tagName):s?s.includes(g.tagName):!1;if(!y&&o&&typeof b=="number"&&(y=!o(g,b,v)),y&&v&&typeof b=="number")return f&&g.children?v.children.splice(b,1,...g.children):v.children.splice(b,1),b}}}function Cw(n){const l=n.indexOf(":"),i=n.indexOf("?"),o=n.indexOf("#"),u=n.indexOf("/");return l===-1||u!==-1&&l>u||i!==-1&&l>i||o!==-1&&l>o||vw.test(n.slice(0,l))?n:""}function Tw({text:n,maxWidth:l="200px",className:i="",icon:o,onClick:u,disabled:s=!1}){const[c,f]=q.useState(!1),h=q.useRef(null),p=q.useRef(null);return q.useEffect(()=>{const g=()=>{if(h.current&&p.current){const b=h.current.offsetWidth,v=p.current.scrollWidth;f(v>b)}};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[n,l]),n?z.jsxs("div",{ref:h,onClick:s?void 0:u,className:Ye("inline-flex items-center gap-2 rounded-full border border-lavender-200/60 bg-white/80 px-3 py-1 shadow-sm text-xs text-slate-700 hover: cursor-pointer",i,s?"opacity-50 cursor-not-allowed":""),style:{maxWidth:l},title:n,children:[o&&z.jsx("span",{className:"text-lavender-500",children:o}),z.jsx("div",{className:"pill-marquee-wrapper",children:z.jsx("span",{ref:p,className:Ye("block whitespace-normal",c?"pill-marquee":""),children:n})})]}):null}var Aw=Qf[" useInsertionEffect ".trim().toString()]||ur;function kw({prop:n,defaultProp:l,onChange:i=()=>{},caller:o}){const[u,s,c]=Nw({defaultProp:l,onChange:i}),f=n!==void 0,h=f?n:u;{const g=q.useRef(n!==void 0);q.useEffect(()=>{const b=g.current;if(b!==f){const v=b?"controlled":"uncontrolled",y=f?"controlled":"uncontrolled"}g.current=f},[f,o])}const p=q.useCallback(g=>{if(f){const b=Rw(g)?g(n):g;b!==n&&c.current?.(b)}else s(g)},[f,n,s,c]);return[h,p]}function Nw({defaultProp:n,onChange:l}){const[i,o]=q.useState(n),u=q.useRef(i),s=q.useRef(l);return Aw(()=>{s.current=l},[l]),q.useEffect(()=>{u.current!==i&&(s.current?.(i),u.current=i)},[i,u]),[i,o,s]}function Rw(n){return typeof n=="function"}function Ow(n){const l=q.useRef({value:n,previous:n});return q.useMemo(()=>(l.current.value!==n&&(l.current.previous=l.current.value,l.current.value=n),l.current.previous),[n])}function zw(n){const[l,i]=q.useState(void 0);return ur(()=>{if(n){i({width:n.offsetWidth,height:n.offsetHeight});const o=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const s=u[0];let c,f;if("borderBoxSize"in s){const h=s.borderBoxSize,p=Array.isArray(h)?h[0]:h;c=p.inlineSize,f=p.blockSize}else c=n.offsetWidth,f=n.offsetHeight;i({width:c,height:f})});return o.observe(n,{box:"border-box"}),()=>o.unobserve(n)}else i(void 0)},[n]),l}var Wl="Checkbox",[Mw]=ad(Wl),[Dw,Nu]=Mw(Wl);function jw(n){const{__scopeCheckbox:l,checked:i,children:o,defaultChecked:u,disabled:s,form:c,name:f,onCheckedChange:h,required:p,value:g="on",internal_do_not_use_render:b}=n,[v,y]=kw({prop:i,defaultProp:u??!1,onChange:h,caller:Wl}),[C,E]=q.useState(null),[T,_]=q.useState(null),A=q.useRef(!1),k=C?!!c||!!C.closest("form"):!0,P={checked:v,disabled:s,setChecked:y,control:C,setControl:E,name:f,form:c,value:g,hasConsumerStoppedPropagationRef:A,required:p,defaultChecked:mr(u)?!1:u,isFormControl:k,bubbleInput:T,setBubbleInput:_};return z.jsx(Dw,{scope:l,...P,children:Lw(b)?b(P):o})}var Sp="CheckboxTrigger",Ep=q.forwardRef(({__scopeCheckbox:n,onKeyDown:l,onClick:i,...o},u)=>{const{control:s,value:c,disabled:f,checked:h,required:p,setControl:g,setChecked:b,hasConsumerStoppedPropagationRef:v,isFormControl:y,bubbleInput:C}=Nu(Sp,n),E=Hn(u,g),T=q.useRef(h);return q.useEffect(()=>{const _=s?.form;if(_){const A=()=>b(T.current);return _.addEventListener("reset",A),()=>_.removeEventListener("reset",A)}},[s,b]),z.jsx(sr.button,{type:"button",role:"checkbox","aria-checked":mr(h)?"mixed":h,"aria-required":p,"data-state":Tp(h),"data-disabled":f?"":void 0,disabled:f,value:c,...o,ref:E,onKeyDown:qn(l,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:qn(i,_=>{b(A=>mr(A)?!0:!A),C&&y&&(v.current=_.isPropagationStopped(),v.current||_.stopPropagation())})})});Ep.displayName=Sp;var Ru=q.forwardRef((n,l)=>{const{__scopeCheckbox:i,name:o,checked:u,defaultChecked:s,required:c,disabled:f,value:h,onCheckedChange:p,form:g,...b}=n;return z.jsx(jw,{__scopeCheckbox:i,checked:u,defaultChecked:s,disabled:f,required:c,onCheckedChange:p,name:o,form:g,value:h,internal_do_not_use_render:({isFormControl:v})=>z.jsxs(z.Fragment,{children:[z.jsx(Ep,{...b,ref:l,__scopeCheckbox:i}),v&&z.jsx(Cp,{__scopeCheckbox:i})]})})});Ru.displayName=Wl;var xp="CheckboxIndicator",_p=q.forwardRef((n,l)=>{const{__scopeCheckbox:i,forceMount:o,...u}=n,s=Nu(xp,i);return z.jsx(fi,{present:o||mr(s.checked)||s.checked===!0,children:z.jsx(sr.span,{"data-state":Tp(s.checked),"data-disabled":s.disabled?"":void 0,...u,ref:l,style:{pointerEvents:"none",...n.style}})})});_p.displayName=xp;var wp="CheckboxBubbleInput",Cp=q.forwardRef(({__scopeCheckbox:n,...l},i)=>{const{control:o,hasConsumerStoppedPropagationRef:u,checked:s,defaultChecked:c,required:f,disabled:h,name:p,value:g,form:b,bubbleInput:v,setBubbleInput:y}=Nu(wp,n),C=Hn(i,y),E=Ow(s),T=zw(o);q.useEffect(()=>{const A=v;if(!A)return;const k=window.HTMLInputElement.prototype,H=Object.getOwnPropertyDescriptor(k,"checked").set,D=!u.current;if(E!==s&&H){const B=new Event("click",{bubbles:D});A.indeterminate=mr(s),H.call(A,mr(s)?!1:s),A.dispatchEvent(B)}},[v,E,s,u]);const _=q.useRef(mr(s)?!1:s);return z.jsx(sr.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??_.current,required:f,disabled:h,name:p,value:g,form:b,...l,tabIndex:-1,ref:C,style:{...l.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Cp.displayName=wp;function Lw(n){return typeof n=="function"}function mr(n){return n==="indeterminate"}function Tp(n){return mr(n)?"indeterminate":n?"checked":"unchecked"}const Ou=q.forwardRef(({className:n,...l},i)=>z.jsx(Ru,{ref:i,className:Ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...l,children:z.jsx(_p,{className:Ye("grid place-content-center text-current"),children:z.jsx(Kd,{className:"h-4 w-4"})})}));Ou.displayName=Ru.displayName;var Gr=(n=>(n.NOTA="none_of_the_above",n.AOTA="all_of_the_above",n))(Gr||{});function Iw({options:n,selectedValues:l,onSelectionChange:i,additionalOption:o,className:u,required:s=!0,maxSelections:c,error:f,disabled:h}){const p=o?{id:`extra-${o}`,label:o==="all_of_the_above"?"All of the above":"None of the above",value:o==="all_of_the_above"?"All of the above":"None of the above"}:{id:"extra-None of the above",label:"None of the above",value:"None of the above"},g=_=>p?_.filter(A=>A!==p.value):_,b=_=>p?o==="none_of_the_above"?_?[p.value]:[]:o==="all_of_the_above"?_?[...n.map(A=>A.value),p.value]:g(l):_?[...l,p.value]:g(l):l,v=(_,A)=>{const k=p?g(l):l;return A?c&&k.length>=c?null:[...k,_]:k.filter(P=>P!==_)},y=_=>!(s&&_.length===0&&l.length===1),C=(_,A)=>{const P=p&&_===p.value?b(A):v(_,A);P!==null&&y(P)&&i(P)},E=!s||l.length>0,T=p?l.filter(_=>_!==p.value).length:l.length;return n.length?z.jsxs("div",{className:Ye("bg-gray-50","rounded-lg","p-4","border border-gray-200",u),children:[z.jsxs("div",{className:"space-y-3",children:[n.map(_=>{const A=h||c&&T>=c&&!l.includes(_.value);return z.jsxs("div",{className:"flex items-center space-x-3",children:[z.jsx(Ou,{id:_.id,checked:!!l.includes(_.value),disabled:!!A,onCheckedChange:k=>C(_.value,!!k),className:"mt-0.5 border border-muted-foreground"}),z.jsx("label",{htmlFor:_.id,className:Ye("text-sm font-medium leading-none cursor-pointer",A?"text-muted-foreground cursor-not-allowed":"text-secondary-foreground"),children:_.label})]},_.id)}),p&&z.jsxs(z.Fragment,{children:[z.jsx("div",{className:"border-t border-gray-300 my-3"}),z.jsxs("div",{className:"flex items-center space-x-3",children:[z.jsx(Ou,{id:p.id,checked:l.includes(p.value),onCheckedChange:_=>C(p.value,_),className:"mt-0.5 border border-muted-foreground"}),z.jsx("label",{htmlFor:p.id,className:"text-sm font-medium leading-none cursor-pointer text-secondary-foreground",children:p.label})]})]})]}),f&&z.jsx("p",{className:"text-sm text-red-500 mt-3",children:f}),s&&!E&&z.jsx("p",{className:"text-sm text-red-500 mt-3",children:"Please select at least one option"}),c&&T>=c&&z.jsx("p",{className:"text-sm text-blue-600 mt-3",children:c===1?"You can select only 1 option":`Maximum ${c} selections allowed`})]}):null}function Ap({file:n,onRemove:l,isPreview:i=!0,className:o=""}){const[u,s]=q.useState(!1),[c,f]=q.useState(""),h=n?.type?.startsWith("image/")??!1,p=n?.type==="application/pdf";q.useEffect(()=>{if(h){const v=URL.createObjectURL(n);return f(v),()=>URL.revokeObjectURL(v)}},[n,h]),q.useEffect(()=>{s(!1)},[n]);const g=()=>h?"text-green-600":"text-gray-600",b=v=>{if(v===0)return"0 B";const y=1024,C=["B","KB","MB","GB"],E=Math.floor(Math.log(v)/Math.log(y));return`${(v/Math.pow(y,E)).toFixed(1)} ${C[E]}`.toLowerCase()};return!h||u?z.jsxs("div",{className:`relative group inline-flex flex-shrink-0 bg-white border border-neutral-300 rounded-lg flex items-center gap-3 px-3 py-2.5 max-w-full ${i?"hover:bg-neutral-50":""} ${o}`,children:[z.jsx("div",{className:`flex-shrink-0 ${g()}`,children:z.jsx(yS,{className:"h-5 w-5"})}),z.jsxs("div",{className:"flex-1 min-w-0 max-w-[200px]",children:[n?.name&&z.jsx("div",{className:"text-sm font-medium text-[var(--color-foreground)] truncate",children:n.name}),n?.size&&z.jsx("div",{className:"text-xs text-[var(--color-muted-foreground)]",children:b(n.size)})]}),i&&l&&z.jsx("button",{onClick:l,"aria-label":`Remove ${n.name}`,className:"flex-shrink-0 flex items-center justify-center w-5 h-5 text-[var(--color-muted-foreground)] hover:text-[var(--color-foreground)] transition-colors",children:z.jsx(Os,{className:"h-4 w-4"})})]}):z.jsxs("div",{className:`relative group flex-shrink-0 ${o}`,children:[z.jsx("div",{className:`w-20 h-20 bg-white border border-neutral-300 rounded-lg flex items-center justify-center overflow-hidden ${i?"hover:bg-neutral-100 cursor-pointer":""}`,children:c&&z.jsx("img",{src:c,alt:n.name,className:"w-full h-full object-cover",onError:()=>s(!0)})}),i&&l&&z.jsx("button",{onClick:l,"aria-label":`Remove ${n.name}`,className:"absolute top-0 right-0 bg-[var(--color-muted)] text-black rounded-full w-5 h-5 flex items-center justify-center hover:bg-[var(--color-muted-foreground)] transition-colors z-10 transform translate-x-1 -translate-y-1",children:z.jsx(Os,{className:"h-3 w-3 text-black"})})]})}function Bw({files:n,onRemoveFile:l,isPreview:i=!0,className:o=""}){if(n.length===0)return null;const u=n.filter(c=>c.type?.startsWith("image/")),s=n.filter(c=>!c.type?.startsWith("image/"));return z.jsxs("div",{className:`flex flex-wrap justify-end gap-2 max-w-full ${o}`,children:[s.map(c=>{const f=n.indexOf(c);return z.jsx(Ap,{file:c,onRemove:l?()=>l(f):void 0,isPreview:i},`${c.name}-${c.size}-${f}`)}),u.length>0&&z.jsx("div",{className:"flex gap-2 overflow-x-auto max-w-full p-1 scrollbar-hide",children:u.map(c=>{const f=n.indexOf(c);return z.jsx(Ap,{file:c,onRemove:l?()=>l(f):void 0,isPreview:i},`${c.name}-${c.size}-${f}`)})})]})}function Uw({value:n,onValueChange:l,placeholder:i="Select an option",className:o,triggerClassName:u,contentClassName:s,disabled:c=!1,options:f=[],size:h="default"}){const[p,g]=q.useState(!1),b=q.useRef(null),v=q.useRef(null),y=f.find(T=>T.value===n);q.useEffect(()=>{const T=_=>{p&&_.key==="Escape"&&(g(!1),v.current?.focus())};return document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T)}},[p]);const C=T=>{l?.(T),g(!1),v.current?.focus()},E=()=>{c||g(!p)};return z.jsxs("div",{className:Ye("relative w-full",o),children:[z.jsxs("button",{ref:v,type:"button",onClick:E,disabled:c,className:Ye('border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*="text-"])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 overflow-hidden',h==="default"?"min-h-9":"min-h-8",u),"aria-expanded":p,"aria-haspopup":"listbox",children:[z.jsx("span",{className:Ye("flex-1 text-left min-w-0 overflow-hidden break-words line-clamp-2",!y&&"text-muted-foreground"),children:y?y.label:i}),z.jsx(Rs,{className:Ye("size-4 opacity-50 pointer-events-none shrink-0 transition-transform duration-200",p&&"rotate-180")})]}),p&&z.jsx("div",{ref:b,className:Ye("bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 relative z-50 max-h-[300px] min-w-[8rem] w-full overflow-x-hidden overflow-y-auto rounded-md shadow-md mt-1",s),role:"listbox",children:z.jsx("div",{className:"p-1",children:f.length===0?z.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground text-center",children:"No options available"}):f.map(T=>{const _=T.value===n;return z.jsxs("div",{onClick:()=>C(T.value),className:Ye("relative flex w-full cursor-pointer items-center gap-1 rounded-sm py-2.5 px-3 text-sm outline-none select-none transition-colors duration-150","hover:bg-accent hover:text-accent-foreground","focus-visible:bg-accent focus-visible:text-accent-foreground","active:bg-accent/80",_&&"bg-accent/50 text-foreground",c&&"pointer-events-none opacity-50 cursor-not-allowed"),role:"option","aria-selected":_,tabIndex:c?-1:0,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),c||C(T.value))},children:[z.jsx("span",{className:"flex-1 text-left min-w-0 break-words line-clamp-2",children:T.label}),_&&z.jsx("span",{className:"absolute right-3 flex size-4 items-center justify-center shrink-0 pointer-events-none",children:z.jsx(Kd,{className:"size-4 text-foreground"})})]},T.value)})})})]})}const Hw=n=>n?n.split(" ").map(l=>l[0]).slice(0,2).join("").toUpperCase():"DR",kp=n=>{const l=n.toLocaleDateString(void 0,{weekday:"short"}).toUpperCase(),i=n.toLocaleDateString(void 0,{day:"2-digit"});return{weekday:l,dayNum:i}},Np=n=>[...n].sort((l,i)=>new Date(l.date).getTime()-new Date(i.date).getTime()),Rp=(n,l)=>(n?.[l]?.slots_details?.length??0)>0;function qw({doctor:n,availability:l,callbacks:i,onBook:o,disabled:u=!1,getAvailabilityDatesForAppointment:s,getAvailableSlotsForAppointment:c}){const[f,h]=q.useState(!1),[p,g]=q.useState(0),[b,v]=q.useState(null),[y,C]=q.useState(0),[E,T]=q.useState(()=>n.hospitals[0]||null),[_,A]=q.useState(!0),[k,P]=q.useState(!1),[H,D]=q.useState(null),[B,Y]=q.useState(!1),[F,$]=q.useState(null),ie=Yr(ve=>ve.sessionId),M=E?.hospital_id,re=!!i?.[Ge.SYNAPSE_TOOL_CALLBACK_NAME.AVAILABILITY_DATES],w=!!i?.[Ge.SYNAPSE_TOOL_CALLBACK_NAME.AVAILABILITY_SLOTS],V=q.useMemo(()=>{if(!M)return l||null;const ve=H?.[M],ze=l?.[M];return ve?{...l||{},[M]:ve}:ze?l:l||null},[H,l,M]),Z=q.useCallback(async()=>{if(!(!n.doctor_id||!ie||!M)){A(!0),$(null);try{const ve=await s({doctor_id:n.doctor_id,hospital_id:M,region_id:E?.region_id||""}),ze=ve?.available_dates?.length&&ve?.available_dates?.map(X=>({date:X,slots:[]}))||[],je=l?.[M]?.slots_details||[],S=H?.[M]?.slots_details||[],K=new Map;je.forEach(X=>{K.set(X.date,X)}),S.forEach(X=>{K.set(X.date,X)});const j=[...Array.from(K.values())];ze.forEach(X=>{K.has(X.date)||j.push(X)});const L=Np(j);D(X=>({...X||{},[M]:{slots_details:L}}))}catch{$("Failed to load availability dates")}finally{A(!1)}}},[n.doctor_id,ie,M,E?.region_id,s,l,H]);q.useEffect(()=>{if(!M)return;const ve=Rp(H,M),ze=Rp(l??null,M);Y(!1),g(0),C(0),v(null),$(null),!ve&&!ze&&re&&ie?Z():A(!1)},[M]);const Q=q.useMemo(()=>{if(!M)return new Date;const ve=V?.[M]?.slots_details;if(!ve?.length)return new Date;const ze=ve[0];return ze?new Date(ze.date):new Date},[V,M]),se=q.useCallback(async ve=>{if(!(!n.doctor_id||!M||!E?.region_id||!ie)){P(!0);try{const ze=await c(ve,{doctor_id:n.doctor_id,hospital_id:M,region_id:E.region_id});if(!ze?.slots?.length)return;D(je=>{if(!je||!je?.[M]?.slots_details?.length)return{...je||{},[M]:{slots_details:[{date:ve,slots:ze.slots}]}};const S=je[M].slots_details.map(j=>j.date===ve?{...j,slots:ze.slots}:j),W=je[M].slots_details.some(j=>j.date===ve)?S:[...S,{date:ve,slots:ze.slots}];return{...je,[M]:{slots_details:Np(W)}}})}catch{$("Failed to load slots")}finally{P(!1)}}},[n.doctor_id,M,E?.region_id,ie,c]);q.useEffect(()=>{if(!M||B||_)return;const ve=V?.[M],ze=ve?.slots_details||[];if(M&&ze.length>0&&!B){let je=0;const S=ve?.selected_date||l?.[M]?.selected_date;if(S){const W=ze.findIndex(j=>j.date===S);W>=0&&(je=W)}else{const W=l?.[M]?.slots_details||[],j=ze.findIndex(L=>{const X=W.find(he=>he.date===L.date);return X?.slots&&X.slots.length>0});j>=0&&(je=j)}g(je),C(Math.floor(je/3)*3);const K=ze[je];K&&(!K?.slots||K.slots.length===0)&&w&&ie&&se(K.date)}},[V,M,l,B,_]);const de=q.useMemo(()=>{const ve=M?V?.[M]?.slots_details:null;if(ve?.length){const je=Math.max(0,Math.floor(y/3)*3),S=Math.min(ve.length,je+3);return ve.slice(je,S).map(K=>{const W=new Date(K.date),{weekday:j,dayNum:L}=kp(W);return{weekday:j,dayNum:L,date:K.date,hasAvailability:!0,fullDate:W,hasSlots:!!(K.slots&&K.slots.length>0)}})}const ze=new Date(Q);return ze.setDate(ze.getDate()+y),Array.from({length:3},(je,S)=>{const K=new Date(ze);K.setDate(ze.getDate()+S);const{weekday:W,dayNum:j}=kp(K),L=K.toISOString().split("T")[0];return{weekday:W,dayNum:j,date:L,hasAvailability:!1,fullDate:K,hasSlots:!1}})},[Q,y,V,M]),I=q.useMemo(()=>(M?V?.[M]?.slots_details:null)?.[p]||null,[V,M,p]),N=q.useMemo(()=>Hw(n.name),[n.name]),U=q.useCallback(()=>{Y(!0),C(ve=>Math.max(0,ve-3)),v(null)},[]),O=q.useCallback(()=>{Y(!0);const ve=M?V?.[M]?.slots_details:null,ze=ve?.length?Math.max(0,ve.length-3):0;C(je=>Math.min(ze,je+3)),v(null)},[M,V]),ne=q.useCallback(ve=>{Y(!0);const ze=M?V?.[M]?.slots_details:null,je=ze?.findIndex(K=>K.date===ve)??-1;je>=0&&g(je),v(null);const S=ze?.find(K=>K.date===ve);w&&(!S?.slots||S.slots.length===0)&&n.doctor_id&&M&&E?.region_id&&ie&&se(ve)},[M,V,w,n.doctor_id,E?.region_id]),ce=q.useMemo(()=>y>0,[y]),we=q.useMemo(()=>{const ve=M?V?.[M]?.slots_details:null;if(!ve||ve.length===0)return!1;const ze=Math.max(0,ve.length-3);return y<ze},[y,V,M]),Te=q.useCallback(()=>{o&&I&&b&&o({date:I.date,time:b,doctorData:{doctor:n,hospital_id:M||"",region_id:E?.region_id||""}})},[o,I,b,n,M,E?.region_id]),ke=q.useMemo(()=>n.hospitals.map(ve=>({value:ve.hospital_id,label:ve.name})),[n.hospitals]),Ae=q.useCallback(ve=>{v(ve)},[]),Pe=q.useCallback(ve=>{const ze=n.hospitals.find(je=>je.hospital_id===ve);ze&&T(ze)},[n.hospitals]);return z.jsxs(da,{className:"max-w-md rounded-xl border-lavender-200 shadow-md p-0 bg-white overflow-hidden","aria-label":"Appointment card",children:[z.jsx(Jd,{className:"flex flex-row items-center justify-between gap-3 bg-lavender-50 rounded-t-xl p-4 border-b border-lavender-100 overflow-hidden",children:z.jsxs("div",{className:"flex items-center gap-3",children:[n.profile_pic&&z.jsxs(ha,{className:"h-12 w-12 ring-2 ring-lavender-200",children:[z.jsx(fh,{src:n.profile_pic,alt:`${n.name} profile photo`,crossOrigin:"anonymous"}),z.jsx(ma,{className:"bg-lavender-100 text-lavender-700",children:N})]}),z.jsxs("div",{className:"min-w-0",children:[z.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[z.jsx("h3",{className:" text-base font-bold text-slate-900",children:n.name}),n.profile_link?z.jsx("a",{href:n.profile_link,target:"_blank",rel:"noreferrer",className:"text-xs font-semibold text-lavender-600 hover:text-lavender-700 hover:underline",children:"View profile"}):null]}),z.jsxs("p",{className:"mt-0.5 text-sm text-slate-600",children:[n.specialty,n.experience&&z.jsxs(z.Fragment,{children:[" • ",n.experience]})]})]})]})}),z.jsxs(Wd,{className:"px-4 py-2",children:[z.jsxs("div",{className:"grid gap-2 border-b border-lavender-100 pb-3",children:[n?.timings&&z.jsxs("div",{className:"flex items-start gap-2 text-sm text-slate-900",children:[z.jsx(gS,{className:"h-4 w-4 text-lavender-600 mt-0.5 flex-shrink-0","aria-hidden":!0}),z.jsx("span",{className:"text-slate-600 text-xs",children:n?.timings})]}),n.languages?z.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[z.jsx(bS,{className:"h-4 w-4 text-lavender-600","aria-hidden":!0}),z.jsx("span",{className:"text-slate-600",children:n.languages})]}):null,n?.hospitals&&n.hospitals?.length>1?E&&E.name&&z.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[z.jsx(Zd,{className:"h-4 w-4 text-lavender-600","aria-hidden":!0}),z.jsx(Uw,{options:ke,placeholder:"Select Hospital",disabled:u,onValueChange:Pe,value:E?.hospital_id||""})]}):E&&E.name&&z.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[z.jsx(Zd,{className:"h-4 w-4 text-lavender-600","aria-hidden":!0}),z.jsx("span",{className:"text-slate-600",children:E.name})]})]}),E?.hospital_id&&V?.[E?.hospital_id]?.slots_details?.length||i?.[Ge.SYNAPSE_TOOL_CALLBACK_NAME.AVAILABILITY_DATES]||_?z.jsx(kt,{type:"button",variant:"outline","aria-expanded":f,"aria-controls":"ap-slots",onClick:()=>h(ve=>!ve),disabled:_,className:"mt-3 w-full border-lavender-500 text-lavender-600 hover:bg-lavender-50 hover:border-lavender-600 disabled:opacity-50",children:_?z.jsxs(z.Fragment,{children:[z.jsx(Qd,{className:"h-4 w-4 mr-2 animate-spin"}),"Loading availability..."]}):z.jsxs(z.Fragment,{children:[z.jsx("span",{className:"mr-1",children:f?"Hide slots":"Show available slots"}),z.jsx(Rs,{className:`h-4 w-4 transition-transform ${f?"rotate-180":""}`,"aria-hidden":!0})]})}):z.jsx("div",{className:"mt-3 w-full flex items-center justify-center py-3 px-4 bg-lavender-50 border border-lavender-200 rounded-lg",children:z.jsx("span",{className:"text-sm text-slate-600 font-medium",children:"No details available"})}),f&&E?.hospital_id&&V?.[E?.hospital_id]?.slots_details?.length&&z.jsx("div",{id:"ap-slots",role:"region","aria-label":"Available slots",className:"pt-3",children:V?.[E?.hospital_id??""]?.slots_details?.length?z.jsxs(z.Fragment,{children:[z.jsxs("div",{className:"flex items-center gap-2 px-0.5",children:[z.jsx(kt,{type:"button",variant:"outline",size:"icon",onClick:U,"aria-label":"Previous 3 days",disabled:u||!ce,className:"h-8 w-8 flex-shrink-0 rounded-md border-lavender-200 bg-white text-lavender-700 hover:bg-lavender-50 hover:border-lavender-300 disabled:opacity-50",children:z.jsx(mS,{className:"h-4 w-4"})}),z.jsx("div",{className:"flex-1 grid grid-cols-3 gap-1 min-w-0",children:de.map((ve,ze)=>{const je=I?.date===ve.date,S=!ve.hasAvailability;return z.jsxs(kt,{type:"button",variant:"outline",onClick:()=>!S&&ne(ve.date),disabled:S||u,"aria-current":je?"date":void 0,className:["flex flex-col items-center justify-center h-12 rounded-lg border-2 p-2 gap-0.5 min-w-0 transition-all",je?"border-lavender-500 ring-2 ring-lavender-200 bg-lavender-50 shadow-sm":S?"border-slate-200 bg-slate-50 text-slate-300 cursor-not-allowed":"border-slate-200 bg-white hover:bg-lavender-50 hover:border-lavender-300"].join(" "),children:[z.jsx("span",{className:["text-[10px] tracking-wide w-full text-center font-medium",je?"text-lavender-700":S?"text-slate-300":"text-slate-600"].join(" "),children:ve.weekday}),z.jsx("span",{className:["text-xs font-bold w-full text-center",je?"text-lavender-700":S?"text-slate-300":"text-slate-900"].join(" "),children:ve.dayNum})]},`${ve.date}-${ze}`)})}),z.jsx(kt,{type:"button",variant:"outline",size:"icon",onClick:O,"aria-label":"Next 3 days",disabled:u||!we,className:"h-8 w-8 flex-shrink-0 rounded-md border-lavender-200 bg-white text-lavender-700 hover:bg-lavender-50 hover:border-lavender-300 disabled:opacity-50",children:z.jsx(pS,{className:"h-4 w-4"})})]}),z.jsx("div",{className:"px-0.5 py-3",children:k?z.jsxs("div",{className:"flex items-center justify-center py-4",children:[z.jsx(Qd,{className:"h-4 w-4 animate-spin text-lavender-600 mr-2"}),z.jsx("span",{className:"text-sm text-slate-600",children:"Loading slots..."})]}):I?.slots?.length?z.jsx("div",{className:"grid grid-cols-2 gap-2 max-h-48 overflow-y-auto",children:I.slots.map((ve,ze)=>{const je=b===ve;return z.jsxs(kt,{type:"button",variant:"outline",onClick:()=>Ae(ve),"aria-pressed":je,disabled:u,className:["inline-flex h-9 items-center justify-center gap-2 rounded-lg px-3 text-xs font-semibold transition-all",je?"border-lavender-600 bg-lavender-600 text-white shadow-sm hover:bg-lavender-700 hover:border-lavender-700":"border-lavender-200 bg-white text-slate-900 hover:bg-lavender-50 hover:border-lavender-300"].join(" "),children:[z.jsx(hS,{className:`h-3.5 w-3.5 flex-shrink-0${je?"text-white":"text-lavender-600"}`}),z.jsx("span",{className:"truncate",children:ve})]},ve||`slot-${ze}`)})}):z.jsx("p",{className:"px-1 text-sm text-slate-600",children:"No slots available for this day."})}),z.jsx("div",{className:"px-0.5 pb-1.5",children:z.jsxs(kt,{type:"button",onClick:Te,disabled:!b||u,"aria-disabled":!b,className:"w-full h-10 gap-2 bg-lavender-600 text-white hover:bg-lavender-700 disabled:opacity-60 shadow-sm font-semibold",children:["Book appointment",z.jsx(dS,{className:"h-4 w-4"})]})})]}):z.jsx("div",{className:"px-1 pb-2 pt-1",children:z.jsx("p",{className:"text-sm text-slate-600",children:F||"No availability provided."})})}),f&&!V?.[E?.hospital_id??""]?.slots_details?.length&&z.jsx("div",{className:"px-1 pb-2 pt-1",children:z.jsx("p",{className:"text-sm text-slate-600",children:F||"No availability provided."})})]})]})}function Pw({callTool:n,doctorDetails:l,callbacks:i,onBook:o,disabled:u=!1}){const[s,c]=q.useState([]),[f,h]=q.useState(!1),[p,g]=q.useState(0),[b,v]=q.useState(null),y=Yr(D=>D.sessionId),C=l.doctor_ids||[],E=C.length,T=Math.min(3,E),_=E-T;q.useEffect(()=>{if(C.length===0||!y)return;(async()=>{h(!0),v(null);try{const Y=C.slice(0,T).map(ie=>n(Ge.SYNAPSE_TOOL_NAME.DOCTOR_DETAILS,{doctor_id:ie})),F=await Promise.allSettled(Y),$=[];F.forEach((ie,M)=>{ie.status==="fulfilled"&&$.push(ie.value)}),c($),g($.length)}catch{v("Failed to load doctor details. Please try again.")}finally{h(!1)}})()},[C,y,T]);const A=async()=>{if(!(p>=E||!y)){h(!0),v(null);try{const B=C.slice(p).map($=>n(Ge.SYNAPSE_TOOL_NAME.DOCTOR_DETAILS,{doctor_id:$})),Y=await Promise.allSettled(B),F=[];Y.forEach(($,ie)=>{$.status==="fulfilled"&&F.push($.value)}),c($=>[...$,...F]),g($=>$+F.length)}catch{v("Failed to load more doctor details. Please try again.")}finally{h(!1)}}},k=D=>{o&&o(D)},P=async D=>{const B=i?.[Ge.SYNAPSE_TOOL_CALLBACK_NAME.AVAILABILITY_DATES].tool_name||Ge.SYNAPSE_TOOL_NAME.AVAILABILITY_DATES;return await n(B,{doctor_id:D.doctor_id,hospital_id:D.hospital_id,region_id:D.region_id})},H=async(D,B)=>{const Y=i?.[Ge.SYNAPSE_TOOL_CALLBACK_NAME.AVAILABILITY_SLOTS].tool_name||Ge.SYNAPSE_TOOL_NAME.AVAILABILITY_SLOTS;return await n(Y,{appointment_date:D,doctor_id:B.doctor_id,hospital_id:B.hospital_id,region_id:B.region_id})};return f&&s.length===0?z.jsx("div",{className:"flex items-center justify-center py-8",children:z.jsxs("div",{className:"text-center",children:[z.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[var(--color-primary)] mx-auto mb-3"}),z.jsx("p",{className:"text-sm text-gray-500",children:"Loading doctor details..."})]})}):b&&s.length===0?z.jsx("div",{className:"flex items-center justify-center py-8",children:z.jsxs("div",{className:"text-center",children:[z.jsx("p",{className:"text-sm text-red-500 mb-2",children:b}),z.jsx(kt,{variant:"outline",size:"sm",onClick:()=>{v(null),C.length>0&&y&&(async()=>{h(!0);try{const Y=C.slice(0,T).map(ie=>n(Ge.SYNAPSE_TOOL_NAME.DOCTOR_DETAILS,{doctor_id:ie})),F=await Promise.allSettled(Y),$=[];F.forEach((ie,M)=>{ie.status==="fulfilled"&&$.push(ie.value)}),c($),g($.length)}catch{v("Failed to load doctor details. Please try again.")}finally{h(!1)}})()},children:"Retry"})]})}):s.length===0?z.jsx("div",{className:"flex items-center justify-center py-2",children:z.jsx("p",{className:"text-sm text-gray-500",children:"No doctor details available."})}):z.jsxs("div",{className:"space-y-4",children:[z.jsx("div",{className:"space-y-4",children:s.map((D,B)=>D?.doctor_id&&z.jsx(qw,{doctor:D,availability:l.availability,callbacks:i,onBook:k,disabled:u,getAvailabilityDatesForAppointment:P,getAvailableSlotsForAppointment:H},`${B}`))}),p<E&&z.jsx("div",{className:"flex justify-center",children:z.jsx(kt,{variant:"outline",onClick:A,disabled:f,className:"px-6 py-2",children:f?z.jsxs(z.Fragment,{children:[z.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--color-primary)] mr-2"}),"Loading more doctors..."]}):`Show more (${_} more)`})}),b&&s.length>0&&z.jsxs("div",{className:"text-center",children:[z.jsx("p",{className:"text-sm text-red-500 mb-2",children:b}),z.jsx(kt,{variant:"outline",size:"sm",onClick:A,disabled:f,children:"Retry loading more"})]})]})}function Fw({role:n,content:l,timestamp:i,iconUrl:o,files:u,isLastMessage:s,progressMessage:c,toolEscalationData:f,callTool:h,onSendMessage:p}){const g=n==="user",[b,v]=q.useState([]),y=async k=>{const P=Date.now().toString();await p({message:k,messageId:P,toolCalled:!0})},C=async k=>{await p({message:`I want to book an appointment for ${k.doctorData?.doctor?.name||"the doctor"} on ${k.date} for ${k.time}`,toolCalled:!0})},E=k=>{v(k)},T=()=>{if(!f?.details?.input?.additional_option)return;const k=f.details?.input?.additional_option;if(typeof k=="string"&&(k===Gr.NOTA||k===Gr.AOTA))return k;if(typeof k=="object"&&k!==null){if(k.NOTA===Gr.NOTA)return Gr.NOTA;if(k.AOTA===Gr.AOTA)return Gr.AOTA}},_=()=>{const k=f?.details?.input?.options;return k?Array.isArray(k)?k.map((P,H)=>({id:`option-${H}`,label:P.label,value:P.value})):Object.keys(k).map((P,H)=>({id:`option-${H}`,label:P,value:P})):[]},A=async()=>{if(b.length>0){const k=b.join(", "),P=Date.now().toString();await p({message:k,messageId:P,toolCalled:!0})}};return z.jsx("div",{className:Ye("flex",g?"justify-end":"justify-start"),children:z.jsxs("div",{className:Ye("flex gap-3",g?"flex-row-reverse":"flex-row",f?.details?.component===Ge.SYNAPSE_COMPONENTS.MULTI?"max-w-md":g?"max-w-[60%]":"max-w-xs"),children:[!g&&z.jsx(ha,{className:"w-8 h-8 bg-gradient-to-br from-lavender-400 to-lavender-500 text-white text-xs font-bold flex-shrink-0",children:z.jsx(ma,{className:"bg-transparent text-white text-xs font-bold",children:o?z.jsx("img",{src:o,alt:"Bot Icon",className:"w-full h-full"}):z.jsx(Xd,{className:"w-full h-full"})})}),z.jsxs(da,{className:Ye("px-4 py-2 rounded-2xl shadow-none break-words overflow-wrap-anywhere whitespace-pre-wrap",g?"bg-lavender-100/95 backdrop-blur-md text-slate-900 rounded-br-none border border-lavender-200/60":"bg-white/80 backdrop-blur-md text-slate-800 shadow-sm rounded-bl-none border border-lavender-200/40",f&&"w-full"),children:[c&&!g&&s&&z.jsx("p",{className:"text-sm font-medium text-slate-500 pb-2",children:c}),l&&z.jsx("div",{className:"text-sm markdown-content mb-3",children:z.jsx(Ew,{children:l})}),u&&u.length>0&&z.jsx("div",{className:"mt-2",children:z.jsx(Bw,{files:u,isPreview:!1,className:""})}),f?.details?.component===Ge.SYNAPSE_COMPONENTS.PILL&&f?.details?.input?.options&&z.jsx("div",{className:"flex flex-wrap gap-2 mt-3",children:f.details?.input?.options.map((k,P)=>z.jsx(Tw,{disabled:f?.isResponded,text:k?.label||"",onClick:()=>y(k?.value||""),className:"cursor-pointer hover:bg-lavender-100/80 transition-colors"},P))}),f?.details?.component===Ge.SYNAPSE_COMPONENTS.MULTI&&f?.details?.input?.options&&z.jsxs("div",{className:"mt-3 space-y-3 break-words overflow-wrap-anywhere whitespace-pre-wrap",children:[z.jsx("h3",{className:"text-sm font-medium text-gray-700 mb-2",children:"Select multiple options:"}),z.jsx(Iw,{options:_(),selectedValues:b,onSelectionChange:E,additionalOption:T(),disabled:f?.isResponded}),z.jsx(kt,{onClick:A,disabled:b.length===0||f?.isResponded,className:Ye("w-full rounded-lg px-4 py-2 text-sm font-medium transition-all","bg-blue-100 hover:bg-blue-200 text-blue-600 border border-blue-200","disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 disabled:border-gray-200","shadow-sm hover:shadow-md active:scale-[0.98] "),children:"Confirm"})]}),f?.details?.component===Ge.SYNAPSE_COMPONENTS.DOCTOR_CARD&&f?.details?.input?.doctor_details&&h?z.jsx("div",{className:"mt-3",children:z.jsx(Pw,{doctorDetails:f?.details?.input?.doctor_details,callTool:h,callbacks:f?.details?._meta?.callbacks,onBook:C,disabled:f?.isResponded})}):null,c&&!g&&s&&z.jsx("p",{className:"text-sm font-medium text-teal-600",children:c}),i&&z.jsx("p",{className:Ye("text-xs mt-2 text-right","text-slate-500"),children:i})]})]})})}function Yw({messages:n,onSendMessage:l,iconUrl:i,callTool:o}){const u=Yr(c=>c.isWaitingForResponse),s=Yr(c=>c.progressMessage);return z.jsxs(z.Fragment,{children:[(n&&n.length>0||s)&&z.jsx(z.Fragment,{children:n.map((c,f)=>z.jsx("div",{className:"animate-slideUp scroll-mt-[80px]",id:f===n.length-1?"last-message":void 0,children:z.jsx(Fw,{role:c.role,content:c.content,files:c.files||[],iconUrl:i,toolEscalationData:c.toolEscalationData,timestamp:c.timestamp,onSendMessage:l,isLastMessage:f===n.length-1,progressMessage:s,callTool:o})},c.id))}),u&&z.jsx(Vw,{iconUrl:i})]})}function Vw({iconUrl:n}){return z.jsx("div",{className:"animate-slideUp",children:z.jsx("div",{className:"flex justify-start",children:z.jsxs("div",{className:"flex gap-3",children:[z.jsx(ha,{className:"w-8 h-8 bg-gradient-to-br from-lavender-400 to-lavender-500 text-white text-xs font-bold flex-shrink-0",children:z.jsx(ma,{className:"bg-transparent text-white text-xs font-bold",children:n?z.jsx("img",{src:n,alt:"Bot Icon",className:"w-4 h-4",loading:"lazy"}):z.jsx(Xd,{className:"w-4 h-4"})})}),z.jsx(da,{className:"px-4 py-2 rounded-2xl shadow-none bg-white/80 backdrop-blur-md text-slate-800 shadow-sm rounded-bl-none border border-lavender-200/40",children:z.jsxs("div",{className:"flex items-center gap-1.5","aria-label":"Bot is typing",children:[z.jsx("span",{className:"text-sm text-slate-400",children:"Thinking"}),[0,1,2].map(l=>z.jsx("span",{className:"w-2 h-2 rounded-full bg-slate-400 animate-pulse",style:{animationDelay:`${l*150}ms`}},l))]})})]})})})}const Gw=Object.freeze(Object.defineProperty({__proto__:null,default:Yw},Symbol.toStringTag,{value:"Module"}));function Xw({onTaskClick:n,disabled:l,tasks:i}){return i?.length?z.jsx("div",{className:"grid grid-cols-2 gap-3",children:i.map(o=>z.jsx(kt,{type:"button",variant:"ghost",disabled:l,onClick:()=>n(o.value||""),className:"h-auto w-full flex flex-col items-start bg-white shadow-lg ring-1 ring-lavender-100 backdrop-blur-sm rounded-2xl p-4 hover:bg-white/95 hover:border-lavender-300 hover:shadow-lg transition-all text-left group",children:z.jsx("div",{className:"flex items-start justify-between gap-3",children:z.jsx("h3",{className:"font-semibold text-sm text-slate-900 text-wrap group-hover:text-lavender-600 transition-colors",children:o.label||""})})},o.value))}):null}function Zw({initialPrompt:n,tasks:l,onTaskClick:i,disabled:o}){return z.jsxs(z.Fragment,{children:[z.jsx("div",{className:"text-center space-y-2 animate-fadeIn",children:z.jsx("h1",{className:"text-xl-minus font-semibold text-slate-900",children:n||"How can I assist you today?"})}),z.jsx(Xw,{onTaskClick:i,disabled:o,tasks:l})]})}const Kw=Object.freeze(Object.defineProperty({__proto__:null,default:Zw},Symbol.toStringTag,{value:"Module"}));function Qw({className:n="",onRetry:l,onStartNewSession:i,showRetryButton:o,startNewConnection:u,clearError:s,error:c,isConnected:f}){const{isOnline:h}=Wh(),[p,g]=q.useState(!0);return q.useEffect(()=>{if(!u&&!o&&!!c){g(!0);const y=setTimeout(()=>g(!1),5e3);return()=>clearTimeout(y)}g(!0)},[c,u,o]),u?z.jsx("div",{className:Ye("mx-4 mb-3 px-2 py-1 bg-[#FFFBEB] border border-[#FEE39B] rounded-lg",n),children:z.jsxs("div",{className:"flex items-center gap-3",children:[z.jsx("div",{className:"w-4 h-4 bg-[#F7B500] rounded-full flex items-center justify-center flex-shrink-0",children:z.jsx("span",{className:"text-white text-sm font-bold",children:"!"})}),z.jsxs("div",{className:"flex-1",children:[z.jsx("div",{className:"text-slate-700 font-semibold text-sm",children:c?.title??"Something went wrong"}),z.jsx("div",{className:"text-[#666666] text-xs mt-1",children:"Start a new session."})]}),z.jsxs("button",{onClick:()=>{s(),i?.()},className:"p-2 bg-[#3B71F7] text-white text-xs font-semibold rounded-lg hover:bg-[#2E5CD9] transition-colors flex items-center gap-2 flex-shrink-0",children:[z.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:z.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),z.jsx("span",{className:"text-xs font-semibold",children:"Start new chat"})]})]})}):o?z.jsx("div",{className:Ye("mx-4 mb-3 p-2 bg-[#FFFBEB] border border-[#FEE39B] rounded-lg",n),children:z.jsxs("div",{className:"flex items-center gap-3",children:[z.jsx("div",{className:"w-5 h-5 bg-[#F7B500] rounded-full flex items-center justify-center flex-shrink-0",children:z.jsx("span",{className:"text-white text-sm font-bold",children:"!"})}),z.jsxs("div",{className:"flex-1",children:[z.jsx("div",{className:"text-slate-700 font-semibold text-sm",children:c?.title??"Failed to connect"}),z.jsx("div",{className:"text-slate-500 text-xs mt-1",children:c?.description??"Please check your connection and try again"})]}),z.jsxs("button",{onClick:()=>{s(),l?.()},className:"px-4 py-2 bg-lavender-600 text-white text-sm font-semibold rounded-lg hover:bg-lavender-700 transition-colors flex items-center gap-2 flex-shrink-0",children:[z.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:z.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Retry"]})]})}):f&&h&&!c?.title||!u&&!o&&!p?null:z.jsx("div",{className:Ye("mx-4 mb-3 p-2 bg-[#FFFBEB] border border-[#FDD835] rounded-lg transition-opacity duration-500",n),children:z.jsxs("div",{className:"flex items-center gap-3",children:[z.jsx("div",{className:"w-5 h-5 bg-[#FDD835] rounded-full flex items-center justify-center flex-shrink-0",children:z.jsx("span",{className:"text-white text-sm font-bold",children:"!"})}),z.jsxs("div",{className:"flex-1",children:[z.jsx("div",{className:"text-slate-700 font-semibold text-sm",children:h?c?.title||"Connecting...":"No internet connection"}),z.jsx("div",{className:"text-slate-500 text-xs mt-1",children:h?c?.description??"Please wait while we try to connect":"Please check your internet connection"})]}),!f&&z.jsx("div",{className:"flex-shrink-0",children:z.jsx("div",{className:"w-6 h-6 border-2 border-[#FDD835] border-t-transparent rounded-full animate-spin"})})]})})}const Jw=Object.freeze(Object.defineProperty({__proto__:null,ConnectionStatus:Qw},Symbol.toStringTag,{value:"Module"}));return hs.renderMedAssist=$h,Object.defineProperty(hs,Symbol.toStringTag,{value:"Module"}),hs})({});
|
|
57
57
|
//# sourceMappingURL=medassist-widget.js.map
|