import{d as I,r as w,c as M,a as T,w as O,o as B,b as L,e as y,f as S,g as C,t as N,h as A,i as x,j as K,T as j}from"./tailwind-D5NWkpcg.js";import{$ as H,y as P,w as V,D as W,a as U,z,T as X,j as q}from"./sidepanel-VcS0zCOq.js";import"./TooltipContent.vue_vue_type_script_setup_true_lang-BuJLrO89.js";import"./ext-utils-BLHv4ziY.js";var $=(h,e,r)=>new Promise((f,d)=>{var c=a=>{try{l(r.next(a))}catch(v){d(v)}},n=a=>{try{l(r.throw(a))}catch(v){d(v)}},l=a=>a.done?f(a.value):Promise.resolve(a.value).then(c,n);l((r=r.apply(h,e)).next())});const F=["data-markstream-mode"],G=["innerHTML"],J={key:1,class:"math-inline math-inline--fallback"},Q={class:"math-inline__loading",role:"status","aria-live":"polite"},b=H(I({__name:"MathInlineNode",props:{node:{}},setup(h){const e=h,r=w(null),f=M(()=>e.node.markup==="$$"),d=M(()=>P(e.node.content)),c=function(){if(!e.node.content)return{html:"",text:e.node.raw,loading:!1};const t=V();if(!t)return{html:"",text:e.node.raw,loading:!1};try{return{html:t.renderToString(d.value,{throwOnError:e.node.loading,displayMode:f.value}),text:"",loading:!1}}catch{return{html:"",text:e.node.raw,loading:!1}}}(),n=w(c.html),l=w(c.text);let a=!1,v=0,p=!1,m=null;const i=w(c.loading),D=W();let u=null;function E(){return $(this,null,function*(){if(p)return;if(!e.node.content)return i.value=!1,n.value="",l.value=e.node.raw,void(a=!0);m&&(m.abort(),m=null);const t=++v,s=new AbortController;if(m=s,!a)try{!u&&r.value&&(u=D(r.value)),yield u==null?void 0:u.whenVisible}catch{}U(d.value,f.value,{timeout:1500,waitTimeout:0,maxRetries:0,signal:s.signal}).then(o=>{p||t!==v||(n.value=o,l.value="",i.value=!1,a=!0)}).catch(o=>$(null,null,function*(){if(p||t!==v)return;const g=(o==null?void 0:o.code)||(o==null?void 0:o.name),_=g==="KATEX_DISABLED";if(g==="WORKER_INIT_ERROR"||o!=null&&o.fallbackToRenderer||g===z||g==="WORKER_TIMEOUT"){const R=yield X();if(R){try{const k=R.renderToString(d.value,{throwOnError:e.node.loading,displayMode:f.value});n.value=k,l.value="",i.value=!1,a=!0,q(d.value,f.value,k)}catch{}return}}if(_)return i.value=!1,n.value="",void(l.value=e.node.raw);a||(i.value=!_),e.node.loading?_&&(n.value="",l.value=e.node.raw):(i.value=!1,n.value="",l.value=e.node.raw)}))})}return(c.html||c.text)&&(a=!0),O(()=>e.node.content,()=>{E()}),B(()=>{n.value||E()}),L(()=>{var t;p=!0,m&&(m.abort(),m=null),(t=u==null?void 0:u.destroy)==null||t.call(u),u=null}),(t,s)=>(y(),T("span",{ref_key:"containerEl",ref:r,class:"math-inline-wrapper","data-markstream-math":"inline","data-markstream-mode":n.value?"katex":l.value?"fallback":"loading"},[n.value?(y(),T("span",{key:0,class:"math-inline",innerHTML:n.value},null,8,G)):l.value?(y(),T("span",J,N(l.value),1)):i.value?(y(),S(j,{key:2,name:"table-node-fade"},{default:A(()=>[x("span",Q,[K(t.$slots,"loading",{isLoading:i.value},()=>[s[0]||(s[0]=x("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),s[1]||(s[1]=x("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):C("",!0)],8,F))}}),[["__scopeId","data-v-cbc053d8"]]);b.install=h=>{h.component(b.__name,b)};export{b as default};
