1)for(let i=0;iFn(E,t&&(Q(t)?t[m]:t),n,s,r));return}if(Bn(s)&&!r){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&Fn(e,t,n,s.component.subTree);return}const i=s.shapeFlag&4?Es(s.component):s.el,o=r?null:i,{i:a,r:l}=e,c=t&&t.r,u=a.refs===se?a.refs={}:a.refs,p=a.setupState,g=oe(p),w=p===se?()=>!1:E=>ge(g,E);if(c!=null&&c!==l&&(Ce(c)?(u[c]=null,w(c)&&(p[c]=null)):je(c)&&(c.value=null)),be(l))mn(l,a,12,[o,u]);else{const E=Ce(l),m=je(l);if(E||m){const A=()=>{if(e.f){const T=E?w(l)?p[l]:u[l]:l.value;r?Q(T)&&ei(T,i):Q(T)?T.includes(i)||T.push(i):E?(u[l]=[i],w(l)&&(p[l]=u[l])):(l.value=[i],e.k&&(u[e.k]=l.value))}else E?(u[l]=o,w(l)&&(p[l]=o)):m&&(l.value=o,e.k&&(u[e.k]=o))};o?(A.id=-1,nt(A,n)):A()}}}rs().requestIdleCallback,rs().cancelIdleCallback;const Bn=e=>!!e.type.__asyncLoader,ar=e=>e.type.__isKeepAlive;function Da(e,t,n=Yt,s=!1){if(n){const r=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...o)=>{It();const a=xr(n),l=_t(t,n,e,o);return a(),Mt(),l});return s?r.unshift(i):r.push(i),i}}const qi=e=>(t,n=Yt)=>{(!Vn||e==="sp")&&Da(e,(...s)=>t(...s),n)},Hn=qi("m"),xs=qi("bum"),Na=Symbol.for("v-ndc");function ys(e,t,n,s){let r;const i=n,o=Q(e);if(o||Ce(e)){const a=o&&gn(e);let l=!1,c=!1;a&&(l=!lt(e),c=Vt(e),e=is(e)),r=new Array(e.length);for(let u=0,p=e.length;ut(a,l,void 0,i));else{const a=Object.keys(e);r=new Array(a.length);for(let l=0,c=a.length;le?po(e)?Es(e):ur(e.parent):null,zn=ht(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ur(e.parent),$root:e=>ur(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>e.type,$forceUpdate:e=>e.f||(e.f=()=>{ir(e.update)}),$nextTick:e=>e.n||(e.n=Tt.bind(e.proxy)),$watch:e=>Qt}),cr=(e,t)=>e!==se&&!e.__isScriptSetup&&ge(e,t),Fa={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:s,data:r,props:i,accessCache:o,type:a,appContext:l}=e;let c;if(t[0]!=="$"){const w=o[t];if(w!==void 0)switch(w){case 1:return s[t];case 2:return r[t];case 4:return n[t];case 3:return i[t]}else{if(cr(s,t))return o[t]=1,s[t];if(r!==se&&ge(r,t))return o[t]=2,r[t];if((c=e.propsOptions[0])&&ge(c,t))return o[t]=3,i[t];if(n!==se&&ge(n,t))return o[t]=4,n[t];o[t]=0}}const u=zn[t];let p,g;if(u)return t==="$attrs"&&Ue(e.attrs,"get",""),u(e);if((p=a.__cssModules)&&(p=p[t]))return p;if(n!==se&&ge(n,t))return o[t]=4,n[t];if(g=l.config.globalProperties,ge(g,t))return g[t]},set({_:e},t,n){const{data:s,setupState:r,ctx:i}=e;return cr(r,t)?(r[t]=n,!0):s!==se&&ge(s,t)?(s[t]=n,!0):ge(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:r,propsOptions:i}},o){let a;return!!n[o]||e!==se&&ge(e,o)||cr(t,o)||(a=i[0])&&ge(a,o)||ge(s,o)||ge(zn,o)||ge(r.config.globalProperties,o)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:ge(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Wi(){return{app:null,config:{isNativeTag:Dl,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Ba=0;function Ha(e,t){return function(s,r=null){be(s)||(s=ht({},s)),r!=null&&!Ae(r)&&(r=null);const i=Wi(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Ba++,_component:s,_props:r,_container:null,_context:i,_instance:null,version:Su,get config(){return i.config},set config(u){},use(u,...p){return o.has(u)||(u&&be(u.install)?(o.add(u),u.install(c,...p)):be(u)&&(o.add(u),u(c,...p))),c},mixin(u){return c},component(u,p){return p?(i.components[u]=p,c):i.components[u]},directive(u,p){return p?(i.directives[u]=p,c):i.directives[u]},mount(u,p,g){if(!l){const w=c._ceVNode||Me(s,r);return w.appContext=i,g===!0?g="svg":g===!1&&(g=void 0),e(w,u,g),l=!0,c._container=u,u.__vue_app__=c,Es(w.component)}},onUnmount(u){a.push(u)},unmount(){l&&(_t(a,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(u,p){return i.provides[u]=p,c},runWithContext(u){const p=yn;yn=c;try{return u()}finally{yn=p}}};return c}}let yn=null;function za(e,t,n=!1){const s=co();if(s||yn){let r=yn?yn._context.provides:s?s.parent==null||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return n&&be(t)?t.call(s&&s.proxy):t}}const Gi={},Ki=()=>Object.create(Gi),Yi=e=>Object.getPrototypeOf(e)===Gi;function Ua(e,t,n,s=!1){const r={},i=Ki();e.propsDefaults=Object.create(null),Zi(e,t,r,i);for(const o in e.propsOptions[0])o in r||(r[o]=void 0);n?e.props=s?r:pa(r):e.type.props?e.props=r:e.props=i,e.attrs=i}function ja(e,t,n,s){const{props:r,attrs:i,vnode:{patchFlag:o}}=e,a=oe(r),[l]=e.propsOptions;let c=!1;if((s||o>0)&&!(o&16)){if(o&8){const u=e.vnode.dynamicProps;for(let p=0;pe==="_"||e==="__"||e==="_ctx"||e==="$stable",pr=e=>Q(e)?e.map(Et):[Et(e)],qa=(e,t,n)=>{if(t._n)return t;const s=Ni((...r)=>pr(t(...r)),n);return s._c=!1,s},Qi=(e,t,n)=>{const s=e._ctx;for(const r in e){if(dr(r))continue;const i=e[r];if(be(i))t[r]=qa(r,i,s);else if(i!=null){const o=pr(i);t[r]=()=>o}}},Ji=(e,t)=>{const n=pr(t);e.slots.default=()=>n},eo=(e,t,n)=>{for(const s in t)(n||!dr(s))&&(e[s]=t[s])},Wa=(e,t,n)=>{const s=e.slots=Ki();if(e.vnode.shapeFlag&32){const r=t.__;r&&Us(s,"__",r,!0);const i=t._;i?(eo(s,t,n),n&&Us(s,"_",i,!0)):Qi(t,s)}else t&&Ji(e,t)},Ga=(e,t,n)=>{const{vnode:s,slots:r}=e;let i=!0,o=se;if(s.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:eo(r,t,n):(i=!t.$stable,Qi(t,r)),o=t}else t&&(Ji(e,t),o={default:1});if(i)for(const a in r)!dr(a)&&o[a]==null&&delete r[a]},nt=au;function Ka(e){return Ya(e)}function Ya(e,t){const n=rs();n.__VUE__=!0;const{insert:s,remove:r,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:p,nextSibling:g,setScopeId:w=Qt,insertStaticContent:E}=e,m=(f,h,b,k=null,v=null,_=null,M=void 0,C=null,R=!!h.dynamicChildren)=>{if(f===h)return;f&&!on(f,h)&&(k=le(f),pe(f,v,_,!0),f=null),h.patchFlag===-2&&(R=!1,h.dynamicChildren=null);const{type:S,ref:H,shapeFlag:L}=h;switch(S){case vs:A(f,h,b,k);break;case Ke:T(f,h,b,k);break;case gr:f==null&&W(h,b,k,M);break;case Be:$(f,h,b,k,v,_,M,C,R);break;default:L&1?z(f,h,b,k,v,_,M,C,R):L&6?Z(f,h,b,k,v,_,M,C,R):(L&64||L&128)&&S.process(f,h,b,k,v,_,M,C,R,ze)}H!=null&&v?Fn(H,f&&f.ref,_,h||f,!h):H==null&&f&&f.ref!=null&&Fn(f.ref,null,_,f,!0)},A=(f,h,b,k)=>{if(f==null)s(h.el=a(h.children),b,k);else{const v=h.el=f.el;h.children!==f.children&&c(v,h.children)}},T=(f,h,b,k)=>{f==null?s(h.el=l(h.children||""),b,k):h.el=f.el},W=(f,h,b,k)=>{[f.el,f.anchor]=E(f.children,h,b,k,f.el,f.anchor)},K=({el:f,anchor:h},b,k)=>{let v;for(;f&&f!==h;)v=g(f),s(f,b,k),f=v;s(h,b,k)},O=({el:f,anchor:h})=>{let b;for(;f&&f!==h;)b=g(f),r(f),f=b;r(h)},z=(f,h,b,k,v,_,M,C,R)=>{h.type==="svg"?M="svg":h.type==="math"&&(M="mathml"),f==null?P(h,b,k,v,_,M,C,R):j(f,h,v,_,M,C,R)},P=(f,h,b,k,v,_,M,C)=>{let R,S;const{props:H,shapeFlag:L,transition:U,dirs:G}=f;if(R=f.el=o(f.type,_,H&&H.is,H),L&8?u(R,f.children):L&16&&re(f.children,R,null,k,v,hr(f,_),M,C),G&&nn(f,null,k,"created"),I(R,f,f.scopeId,M,k),H){for(const de in H)de!=="value"&&!Cn(de)&&i(R,de,null,H[de],_,k);"value"in H&&i(R,"value",null,H.value,_),(S=H.onVnodeBeforeMount)&&At(S,k,f)}G&&nn(f,null,k,"beforeMount");const ee=Za(v,U);ee&&U.beforeEnter(R),s(R,h,b),((S=H&&H.onVnodeMounted)||ee||G)&&nt(()=>{S&&At(S,k,f),ee&&U.enter(R),G&&nn(f,null,k,"mounted")},v)},I=(f,h,b,k,v)=>{if(b&&w(f,b),k)for(let _=0;_{for(let S=R;S{const C=h.el=f.el;let{patchFlag:R,dynamicChildren:S,dirs:H}=h;R|=f.patchFlag&16;const L=f.props||se,U=h.props||se;let G;if(b&&sn(b,!1),(G=U.onVnodeBeforeUpdate)&&At(G,b,h,f),H&&nn(h,f,b,"beforeUpdate"),b&&sn(b,!0),(L.innerHTML&&U.innerHTML==null||L.textContent&&U.textContent==null)&&u(C,""),S?te(f.dynamicChildren,S,C,b,k,hr(h,v),_):M||We(f,h,C,null,b,k,hr(h,v),_,!1),R>0){if(R&16)ue(C,L,U,b,v);else if(R&2&&L.class!==U.class&&i(C,"class",null,U.class,v),R&4&&i(C,"style",L.style,U.style,v),R&8){const ee=h.dynamicProps;for(let de=0;de{G&&At(G,b,h,f),H&&nn(h,f,b,"updated")},k)},te=(f,h,b,k,v,_,M)=>{for(let C=0;C{if(h!==b){if(h!==se)for(const _ in h)!Cn(_)&&!(_ in b)&&i(f,_,h[_],null,v,k);for(const _ in b){if(Cn(_))continue;const M=b[_],C=h[_];M!==C&&_!=="value"&&i(f,_,C,M,v,k)}"value"in b&&i(f,"value",h.value,b.value,v)}},$=(f,h,b,k,v,_,M,C,R)=>{const S=h.el=f?f.el:a(""),H=h.anchor=f?f.anchor:a("");let{patchFlag:L,dynamicChildren:U,slotScopeIds:G}=h;G&&(C=C?C.concat(G):G),f==null?(s(S,b,k),s(H,b,k),re(h.children||[],b,H,v,_,M,C,R)):L>0&&L&64&&U&&f.dynamicChildren?(te(f.dynamicChildren,U,b,v,_,M,C),(h.key!=null||v&&h===v.subTree)&&to(f,h,!0)):We(f,h,b,H,v,_,M,C,R)},Z=(f,h,b,k,v,_,M,C,R)=>{h.slotScopeIds=C,f==null?h.shapeFlag&512?v.ctx.activate(h,b,k,M,R):Y(h,b,k,v,_,M,R):B(f,h,R)},Y=(f,h,b,k,v,_,M)=>{const C=f.component=gu(f,k,v);if(ar(f)&&(C.ctx.renderer=ze),mu(C,!1,M),C.asyncDep){if(v&&v.registerDep(C,ce,M),!f.el){const R=C.subTree=Me(Ke);T(null,R,h,b),f.placeholder=R.el}}else ce(C,f,h,b,v,_,M)},B=(f,h,b)=>{const k=h.component=f.component;if(ou(f,h,b))if(k.asyncDep&&!k.asyncResolved){Se(k,h,b);return}else k.next=h,k.update();else h.el=f.el,k.vnode=h},ce=(f,h,b,k,v,_,M)=>{const C=()=>{if(f.isMounted){let{next:L,bu:U,u:G,parent:ee,vnode:de}=f;{const it=no(f);if(it){L&&(L.el=de.el,Se(f,L,M)),it.asyncDep.then(()=>{f.isUnmounted||C()});return}}let ne=L,Te;sn(f,!1),L?(L.el=de.el,Se(f,L,M)):L=de,U&&ss(U),(Te=L.props&&L.props.onVnodeBeforeUpdate)&&At(Te,ee,L,de),sn(f,!0);const Oe=ro(f),rt=f.subTree;f.subTree=Oe,m(rt,Oe,p(rt.el),le(rt),f,v,_),L.el=Oe.el,ne===null&&lu(f,Oe.el),G&&nt(G,v),(Te=L.props&&L.props.onVnodeUpdated)&&nt(()=>At(Te,ee,L,de),v)}else{let L;const{el:U,props:G}=h,{bm:ee,m:de,parent:ne,root:Te,type:Oe}=f,rt=Bn(h);sn(f,!1),ee&&ss(ee),!rt&&(L=G&&G.onVnodeBeforeMount)&&At(L,ne,h),sn(f,!0);{Te.ce&&Te.ce._def.shadowRoot!==!1&&Te.ce._injectChildStyle(Oe);const it=f.subTree=ro(f);m(null,it,b,k,f,v,_),h.el=it.el}if(de&&nt(de,v),!rt&&(L=G&&G.onVnodeMounted)){const it=h;nt(()=>At(L,ne,it),v)}(h.shapeFlag&256||ne&&Bn(ne.vnode)&&ne.vnode.shapeFlag&256)&&f.a&&nt(f.a,v),f.isMounted=!0,h=b=k=null}};f.scope.on();const R=f.effect=new ci(C);f.scope.off();const S=f.update=R.run.bind(R),H=f.job=R.runIfDirty.bind(R);H.i=f,H.id=f.uid,R.scheduler=()=>ir(H),sn(f,!0),S()},Se=(f,h,b)=>{h.component=f;const k=f.vnode.props;f.vnode=h,f.next=null,ja(f,h.props,k,b),Ga(f,h.children,b),It(),Li(f),Mt()},We=(f,h,b,k,v,_,M,C,R=!1)=>{const S=f&&f.children,H=f?f.shapeFlag:0,L=h.children,{patchFlag:U,shapeFlag:G}=h;if(U>0){if(U&128){fe(S,L,b,k,v,_,M,C,R);return}else if(U&256){xt(S,L,b,k,v,_,M,C,R);return}}G&8?(H&16&&me(S,v,_),L!==S&&u(b,L)):H&16?G&16?fe(S,L,b,k,v,_,M,C,R):me(S,v,_,!0):(H&8&&u(b,""),G&16&&re(L,b,k,v,_,M,C,R))},xt=(f,h,b,k,v,_,M,C,R)=>{f=f||pt,h=h||pt;const S=f.length,H=h.length,L=Math.min(S,H);let U;for(U=0;UH?me(f,v,_,!0,!1,L):re(h,b,k,v,_,M,C,R,L)},fe=(f,h,b,k,v,_,M,C,R)=>{let S=0;const H=h.length;let L=f.length-1,U=H-1;for(;S<=L&&S<=U;){const G=f[S],ee=h[S]=R?Kt(h[S]):Et(h[S]);if(on(G,ee))m(G,ee,b,null,v,_,M,C,R);else break;S++}for(;S<=L&&S<=U;){const G=f[L],ee=h[U]=R?Kt(h[U]):Et(h[U]);if(on(G,ee))m(G,ee,b,null,v,_,M,C,R);else break;L--,U--}if(S>L){if(S<=U){const G=U+1,ee=GU)for(;S<=L;)pe(f[S],v,_,!0),S++;else{const G=S,ee=S,de=new Map;for(S=ee;S<=U;S++){const $e=h[S]=R?Kt(h[S]):Et(h[S]);$e.key!=null&&de.set($e.key,S)}let ne,Te=0;const Oe=U-ee+1;let rt=!1,it=0;const Ft=new Array(Oe);for(S=0;S=Oe){pe($e,v,_,!0);continue}let Xe;if($e.key!=null)Xe=de.get($e.key);else for(ne=ee;ne<=U;ne++)if(Ft[ne-ee]===0&&on($e,h[ne])){Xe=ne;break}Xe===void 0?pe($e,v,_,!0):(Ft[Xe-ee]=S+1,Xe>=it?it=Xe:rt=!0,m($e,h[Xe],b,null,v,_,M,C,R),Te++)}const Qn=rt?Xa(Ft):pt;for(ne=Qn.length-1,S=Oe-1;S>=0;S--){const $e=ee+S,Xe=h[$e],ot=h[$e+1],Bt=$e+1{const{el:_,type:M,transition:C,children:R,shapeFlag:S}=f;if(S&6){N(f.component.subTree,h,b,k);return}if(S&128){f.suspense.move(h,b,k);return}if(S&64){M.move(f,h,b,ze);return}if(M===Be){s(_,h,b);for(let L=0;LC.enter(_),v);else{const{leave:L,delayLeave:U,afterLeave:G}=C,ee=()=>{f.ctx.isUnmounted?r(_):s(_,h,b)},de=()=>{L(_,()=>{ee(),G&&G()})};U?U(_,ee,de):de()}else s(_,h,b)},pe=(f,h,b,k=!1,v=!1)=>{const{type:_,props:M,ref:C,children:R,dynamicChildren:S,shapeFlag:H,patchFlag:L,dirs:U,cacheIndex:G}=f;if(L===-2&&(v=!1),C!=null&&(It(),Fn(C,null,b,f,!0),Mt()),G!=null&&(h.renderCache[G]=void 0),H&256){h.ctx.deactivate(f);return}const ee=H&1&&U,de=!Bn(f);let ne;if(de&&(ne=M&&M.onVnodeBeforeUnmount)&&At(ne,h,f),H&6)ve(f.component,b,k);else{if(H&128){f.suspense.unmount(b,k);return}ee&&nn(f,null,h,"beforeUnmount"),H&64?f.type.remove(f,h,b,ze,k):S&&!S.hasOnce&&(_!==Be||L>0&&L&64)?me(S,h,b,!1,!0):(_===Be&&L&384||!v&&H&16)&&me(R,h,b),k&&he(f)}(de&&(ne=M&&M.onVnodeUnmounted)||ee)&&nt(()=>{ne&&At(ne,h,f),ee&&nn(f,null,h,"unmounted")},b)},he=f=>{const{type:h,el:b,anchor:k,transition:v}=f;if(h===Be){ke(b,k);return}if(h===gr){O(f);return}const _=()=>{r(b),v&&!v.persisted&&v.afterLeave&&v.afterLeave()};if(f.shapeFlag&1&&v&&!v.persisted){const{leave:M,delayLeave:C}=v,R=()=>M(b,_);C?C(f.el,_,R):R()}else _()},ke=(f,h)=>{let b;for(;f!==h;)b=g(f),r(f),f=b;r(h)},ve=(f,h,b)=>{const{bum:k,scope:v,job:_,subTree:M,um:C,m:R,a:S,parent:H,slots:{__:L}}=f;so(R),so(S),k&&ss(k),H&&Q(L)&&L.forEach(U=>{H.renderCache[U]=void 0}),v.stop(),_&&(_.flags|=8,pe(M,f,h,b)),C&&nt(C,h),nt(()=>{f.isUnmounted=!0},h),h&&h.pendingBranch&&!h.isUnmounted&&f.asyncDep&&!f.asyncResolved&&f.suspenseId===h.pendingId&&(h.deps--,h.deps===0&&h.resolve())},me=(f,h,b,k=!1,v=!1,_=0)=>{for(let M=_;M{if(f.shapeFlag&6)return le(f.component.subTree);if(f.shapeFlag&128)return f.suspense.next();const h=g(f.anchor||f.el),b=h&&h[Ia];return b?g(b):h};let yt=!1;const Ct=(f,h,b)=>{f==null?h._vnode&&pe(h._vnode,null,null,!0):m(h._vnode||null,f,h,null,null,null,b),h._vnode=f,yt||(yt=!0,Li(),Oi(),yt=!1)},ze={p:m,um:pe,m:N,r:he,mt:Y,mc:re,pc:We,pbc:te,n:le,o:e};return{render:Ct,hydrate:void 0,createApp:Ha(Ct)}}function hr({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function sn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Za(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function to(e,t,n=!1){const s=e.children,r=t.children;if(Q(s)&&Q(r))for(let i=0;i>1,e[n[a]]0&&(t[s]=n[i-1]),n[i]=s)}}for(i=n.length,o=n[i-1];i-- >0;)n[i]=o,o=t[o];return n}function no(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:no(t)}function so(e){if(e)for(let t=0;tza(Qa);function rn(e,t,n){return eu(e,t,n)}function eu(e,t,n=se){const{immediate:s,deep:r,flush:i,once:o}=n,a=ht({},n),l=t&&s||!t&&i!=="post";let c;if(Vn){if(i==="sync"){const w=Ja();c=w.__watcherHandles||(w.__watcherHandles=[])}else if(!l){const w=()=>{};return w.stop=Qt,w.resume=Qt,w.pause=Qt,w}}const u=Yt;a.call=(w,E,m)=>_t(w,u,E,m);let p=!1;i==="post"?a.scheduler=w=>{nt(w,u&&u.suspense)}:i!=="sync"&&(p=!0,a.scheduler=(w,E)=>{E?w():ir(w)}),a.augmentJob=w=>{t&&(w.flags|=4),p&&(w.flags|=2,u&&(w.id=u.uid,w.i=u))};const g=_a(e,t,a);return Vn&&(c?c.push(g):l&&g()),g}const tu=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Ut(t)}Modifiers`]||e[`${Jt(t)}Modifiers`];function nu(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||se;let r=n;const i=t.startsWith("update:"),o=i&&tu(s,t.slice(7));o&&(o.trim&&(r=n.map(u=>Ce(u)?u.trim():u)),o.number&&(r=n.map(js)));let a,l=s[a=zs(t)]||s[a=zs(Ut(t))];!l&&i&&(l=s[a=zs(Jt(t))]),l&&_t(l,e,6,r);const c=s[a+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,_t(c,e,6,r)}}function su(e,t,n=!1){const s=t.emitsCache,r=s.get(e);if(r!==void 0)return r;const i=e.emits;let o={};return i?(Q(i)?i.forEach(a=>o[a]=null):ht(o,i),Ae(e)&&s.set(e,o),o):(Ae(e)&&s.set(e,null),null)}function ws(e,t){return!e||!es(t)?!1:(t=t.slice(2).replace(/Once$/,""),ge(e,t[0].toLowerCase()+t.slice(1))||ge(e,Jt(t))||ge(e,t))}function Ep(){}function ro(e){const{type:t,vnode:n,proxy:s,withProxy:r,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:p,data:g,setupState:w,ctx:E,inheritAttrs:m}=e,A=ms(e);let T,W;try{if(n.shapeFlag&4){const O=r||s,z=O;T=Et(c.call(z,O,u,p,w,g,E)),W=a}else{const O=t;T=Et(O.length>1?O(p,{attrs:a,slots:o,emit:l}):O(p,null)),W=t.props?a:ru(a)}}catch(O){Un.length=0,hs(O,e,1),T=Me(Ke)}let K=T;if(W&&m!==!1){const O=Object.keys(W),{shapeFlag:z}=K;O.length&&z&7&&(i&&O.some(Bs)&&(W=iu(W,i)),K=Gt(K,W,!1,!0))}return n.dirs&&(K=Gt(K,null,!1,!0),K.dirs=K.dirs?K.dirs.concat(n.dirs):n.dirs),n.transition&&Nn(K,n.transition),T=K,ms(A),T}const ru=e=>{let t;for(const n in e)(n==="class"||n==="style"||es(n))&&((t||(t={}))[n]=e[n]);return t},iu=(e,t)=>{const n={};for(const s in e)(!Bs(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function ou(e,t,n){const{props:s,children:r,component:i}=e,{props:o,children:a,patchFlag:l}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return s?io(s,o,c):!!o;if(l&8){const u=t.dynamicProps;for(let p=0;pe.__isSuspense;function au(e,t){t&&t.pendingBranch?Q(e)?t.effects.push(...e):t.effects.push(e):Ca(e)}const Be=Symbol.for("v-fgt"),vs=Symbol.for("v-txt"),Ke=Symbol.for("v-cmt"),gr=Symbol.for("v-stc"),Un=[];let st=null;function F(e=!1){Un.push(st=e?null:[])}function uu(){Un.pop(),st=Un[Un.length-1]||null}let jn=1;function lo(e,t=!1){jn+=e,e<0&&st&&t&&(st.hasOnce=!0)}function ao(e){return e.dynamicChildren=jn>0?st||pt:null,uu(),jn>0&&st&&st.push(e),e}function q(e,t,n,s,r,i){return ao(x(e,t,n,s,r,i,!0))}function St(e,t,n,s,r){return ao(Me(e,t,n,s,r,!0))}function _s(e){return e?e.__v_isVNode===!0:!1}function on(e,t){return e.type===t.type&&e.key===t.key}const uo=({key:e})=>e!=null?e:null,ks=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Ce(e)||je(e)||be(e)?{i:at,r:e,k:t,f:!!n}:e:null);function x(e,t=null,n=null,s=0,r=null,i=e===Be?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&uo(t),ref:t&&ks(t),scopeId:Di,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:at};return a?(mr(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Ce(n)?8:16),jn>0&&!o&&st&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&st.push(l),l}const Me=cu;function cu(e,t=null,n=null,s=0,r=null,i=!1){if((!e||e===Na)&&(e=Ke),_s(e)){const a=Gt(e,t,!0);return n&&mr(a,n),jn>0&&!i&&st&&(a.shapeFlag&6?st[st.indexOf(e)]=a:st.push(a)),a.patchFlag=-2,a}if(ku(e)&&(e=e.__vccOpts),t){t=fu(t);let{class:a,style:l}=t;a&&!Ce(a)&&(t.class=ye(a)),Ae(l)&&(sr(l)&&!Q(l)&&(l=ht({},l)),t.style=Vs(l))}const o=Ce(e)?1:oo(e)?128:Fi(e)?64:Ae(e)?4:be(e)?2:0;return x(e,t,n,s,r,o,i,!0)}function fu(e){return e?sr(e)||Yi(e)?ht({},e):e:null}function Gt(e,t,n=!1,s=!1){const{props:r,ref:i,patchFlag:o,children:a,transition:l}=e,c=t?du(r||{},t):r,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&uo(c),ref:t&&t.ref?n&&i?Q(i)?i.concat(ks(t)):[i,ks(t)]:ks(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Be?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Gt(e.ssContent),ssFallback:e.ssFallback&&Gt(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&s&&Nn(u,l.clone(u)),u}function Ts(e=" ",t=0){return Me(vs,null,e,t)}function Ve(e="",t=!1){return t?(F(),St(Ke,null,e)):Me(Ke,null,e)}function Et(e){return e==null||typeof e=="boolean"?Me(Ke):Q(e)?Me(Be,null,e.slice()):_s(e)?Kt(e):Me(vs,null,String(e))}function Kt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Gt(e)}function mr(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(Q(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),mr(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!Yi(t)?t._ctx=at:r===3&&at&&(at.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else be(t)?(t={default:t,_ctx:at},n=32):(t=String(t),s&64?(n=16,t=[Ts(t)]):n=8);e.children=t,e.shapeFlag|=n}function du(...e){const t={};for(let n=0;nYt||at;let Ss,br;{const e=rs(),t=(n,s)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(s),i=>{r.length>1?r.forEach(o=>o(i)):r[0](i)}};Ss=t("__VUE_INSTANCE_SETTERS__",n=>Yt=n),br=t("__VUE_SSR_SETTERS__",n=>Vn=n)}const xr=e=>{const t=Yt;return Ss(e),e.scope.on(),()=>{e.scope.off(),Ss(t)}},fo=()=>{Yt&&Yt.scope.off(),Ss(null)};function po(e){return e.vnode.shapeFlag&4}let Vn=!1;function mu(e,t=!1,n=!1){t&&br(t);const{props:s,children:r}=e.vnode,i=po(e);Ua(e,s,i,t),Wa(e,r,n||t);const o=i?bu(e,t):void 0;return t&&br(!1),o}function bu(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Fa);const{setup:s}=n;if(s){It();const r=e.setupContext=s.length>1?yu(e):null,i=xr(e),o=mn(s,e,0,[e.props,r]),a=ni(o);if(Mt(),i(),(a||e.sp)&&!Bn(e)&&$a(e),a){if(o.then(fo,fo),t)return o.then(l=>{ho(e,l)}).catch(l=>{hs(l,e,0)});e.asyncDep=o}else ho(e,o)}else go(e)}function ho(e,t,n){be(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ae(t)&&(e.setupState=Ci(t)),go(e)}function go(e,t,n){const s=e.type;e.render||(e.render=s.render||Qt)}const xu={get(e,t){return Ue(e,"get",""),e[t]}};function yu(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,xu),slots:e.slots,emit:e.emit,expose:t}}function Es(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Ci(ha(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in zn)return zn[n](e)},has(t,n){return n in t||n in zn}})):e.proxy}const wu=/(?:^|[-_])(\w)/g,vu=e=>e.replace(wu,t=>t.toUpperCase()).replace(/[-_]/g,"");function _u(e,t=!0){return be(e)?e.displayName||e.name:e.name||t&&e.__name}function mo(e,t,n=!1){let s=_u(t);if(!s&&t.__file){const r=t.__file.match(/([^/\\]+)\.\w+$/);r&&(s=r[1])}if(!s&&e&&e.parent){const r=i=>{for(const o in i)if(i[o]===t)return o};s=r(e.components||e.parent.type.components)||r(e.appContext.components)}return s?vu(s):n?"App":"Anonymous"}function ku(e){return be(e)&&"__vccOpts"in e}const Re=(e,t)=>wa(e,t,Vn);function Tu(e,t,n){const s=arguments.length;return s===2?Ae(t)&&!Q(t)?_s(t)?Me(e,null,[t]):Me(e,t):Me(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&_s(n)&&(n=[n]),Me(e,t,n))}const Su="3.5.18";let yr;const bo=typeof window!="undefined"&&window.trustedTypes;if(bo)try{yr=bo.createPolicy("vue",{createHTML:e=>e})}catch{}const xo=yr?e=>yr.createHTML(e):e=>e,Eu="http://www.w3.org/2000/svg",Au="http://www.w3.org/1998/Math/MathML",Dt=typeof document!="undefined"?document:null,yo=Dt&&Dt.createElement("template"),Ru={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const r=t==="svg"?Dt.createElementNS(Eu,e):t==="mathml"?Dt.createElementNS(Au,e):n?Dt.createElement(e,{is:n}):Dt.createElement(e);return e==="select"&&s&&s.multiple!=null&&r.setAttribute("multiple",s.multiple),r},createText:e=>Dt.createTextNode(e),createComment:e=>Dt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Dt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,r,i){const o=n?n.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===i||!(r=r.nextSibling)););else{yo.innerHTML=xo(s==="svg"?``:s==="mathml"?``:e);const a=yo.content;if(s==="svg"||s==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Zt="transition",qn="animation",Wn=Symbol("_vtc"),wo={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Cu=ht({},Bi,wo),Pu=(e=>(e.displayName="Transition",e.props=Cu,e))((e,{slots:t})=>Tu(Oa,Iu(e),t)),ln=(e,t=[])=>{Q(e)?e.forEach(n=>n(...t)):e&&e(...t)},vo=e=>e?Q(e)?e.some(t=>t.length>1):e.length>1:!1;function Iu(e){const t={};for(const $ in e)$ in wo||(t[$]=e[$]);if(e.css===!1)return t;const{name:n="v",type:s,duration:r,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:p=`${n}-leave-from`,leaveActiveClass:g=`${n}-leave-active`,leaveToClass:w=`${n}-leave-to`}=e,E=Mu(r),m=E&&E[0],A=E&&E[1],{onBeforeEnter:T,onEnter:W,onEnterCancelled:K,onLeave:O,onLeaveCancelled:z,onBeforeAppear:P=T,onAppear:I=W,onAppearCancelled:re=K}=t,j=($,Z,Y,B)=>{$._enterCancelled=B,an($,Z?u:a),an($,Z?c:o),Y&&Y()},te=($,Z)=>{$._isLeaving=!1,an($,p),an($,w),an($,g),Z&&Z()},ue=$=>(Z,Y)=>{const B=$?I:W,ce=()=>j(Z,$,Y);ln(B,[Z,ce]),_o(()=>{an(Z,$?l:i),Nt(Z,$?u:a),vo(B)||ko(Z,s,m,ce)})};return ht(t,{onBeforeEnter($){ln(T,[$]),Nt($,i),Nt($,o)},onBeforeAppear($){ln(P,[$]),Nt($,l),Nt($,c)},onEnter:ue(!1),onAppear:ue(!0),onLeave($,Z){$._isLeaving=!0;const Y=()=>te($,Z);Nt($,p),$._enterCancelled?(Nt($,g),Eo()):(Eo(),Nt($,g)),_o(()=>{$._isLeaving&&(an($,p),Nt($,w),vo(O)||ko($,s,A,Y))}),ln(O,[$,Y])},onEnterCancelled($){j($,!1,void 0,!0),ln(K,[$])},onAppearCancelled($){j($,!0,void 0,!0),ln(re,[$])},onLeaveCancelled($){te($),ln(z,[$])}})}function Mu(e){if(e==null)return null;if(Ae(e))return[wr(e.enter),wr(e.leave)];{const t=wr(e);return[t,t]}}function wr(e){return zl(e)}function Nt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Wn]||(e[Wn]=new Set)).add(t)}function an(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[Wn];n&&(n.delete(t),n.size||(e[Wn]=void 0))}function _o(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Lu=0;function ko(e,t,n,s){const r=e._endId=++Lu,i=()=>{r===e._endId&&s()};if(n!=null)return setTimeout(i,n);const{type:o,timeout:a,propCount:l}=Ou(e,t);if(!o)return s();const c=o+"end";let u=0;const p=()=>{e.removeEventListener(c,g),i()},g=w=>{w.target===e&&++u>=l&&p()};setTimeout(()=>{u(n[E]||"").split(", "),r=s(`${Zt}Delay`),i=s(`${Zt}Duration`),o=To(r,i),a=s(`${qn}Delay`),l=s(`${qn}Duration`),c=To(a,l);let u=null,p=0,g=0;t===Zt?o>0&&(u=Zt,p=o,g=i.length):t===qn?c>0&&(u=qn,p=c,g=l.length):(p=Math.max(o,c),u=p>0?o>c?Zt:qn:null,g=u?u===Zt?i.length:l.length:0);const w=u===Zt&&/\b(transform|all)(,|$)/.test(s(`${Zt}Property`).toString());return{type:u,timeout:p,propCount:g,hasTransform:w}}function To(e,t){for(;e.lengthSo(n)+So(e[s])))}function So(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Eo(){return document.body.offsetHeight}function $u(e,t,n){const s=e[Wn];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Ao=Symbol("_vod"),Du=Symbol("_vsh"),Nu=Symbol(""),Fu=/(^|;)\s*display\s*:/;function Bu(e,t,n){const s=e.style,r=Ce(n);let i=!1;if(n&&!r){if(t)if(Ce(t))for(const o of t.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&As(s,a,"")}else for(const o in t)n[o]==null&&As(s,o,"");for(const o in n)o==="display"&&(i=!0),As(s,o,n[o])}else if(r){if(t!==n){const o=s[Nu];o&&(n+=";"+o),s.cssText=n,i=Fu.test(n)}}else t&&e.removeAttribute("style");Ao in e&&(e[Ao]=i?s.display:"",e[Du]&&(s.display="none"))}const Ro=/\s*!important$/;function As(e,t,n){if(Q(n))n.forEach(s=>As(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=Hu(e,t);Ro.test(n)?e.setProperty(Jt(s),n.replace(Ro,""),"important"):e[s]=n}}const Co=["Webkit","Moz","ms"],vr={};function Hu(e,t){const n=vr[t];if(n)return n;let s=Ut(t);if(s!=="filter"&&s in e)return vr[t]=s;s=ii(s);for(let r=0;r_r||(Vu.then(()=>_r=0),_r=Date.now());function Wu(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;_t(Gu(s,n.value),t,5,[s])};return n.value=e,n.attached=qu(),n}function Gu(e,t){if(Q(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(s=>r=>!r._stopped&&s&&s(r))}else return t}const $o=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Ku=(e,t,n,s,r,i)=>{const o=r==="svg";t==="class"?$u(e,s,o):t==="style"?Bu(e,n,s):es(t)?Bs(t)||Uu(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Yu(e,t,s,o))?(Mo(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Io(e,t,s,o,i,t!=="value")):e._isVueCE&&(/[A-Z]/.test(t)||!Ce(s))?Mo(e,Ut(t),s,i,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),Io(e,t,s,o))};function Yu(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&$o(t)&&be(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return $o(t)&&Ce(n)?!1:t in e}const Do=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Q(t)?n=>ss(t,n):t};function Zu(e){e.target.composing=!0}function No(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const kr=Symbol("_assign"),Xu={created(e,{modifiers:{lazy:t,trim:n,number:s}},r){e[kr]=Do(r);const i=s||r.props&&r.props.type==="number";wn(e,t?"change":"input",o=>{if(o.target.composing)return;let a=e.value;n&&(a=a.trim()),i&&(a=js(a)),e[kr](a)}),n&&wn(e,"change",()=>{e.value=e.value.trim()}),t||(wn(e,"compositionstart",Zu),wn(e,"compositionend",No),wn(e,"change",No))},mounted(e,{value:t}){e.value=t==null?"":t},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:r,number:i}},o){if(e[kr]=Do(o),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?js(e.value):e.value,l=t==null?"":t;a!==l&&(document.activeElement===e&&e.type!=="range"&&(s&&t===n||r&&e.value.trim()===l)||(e.value=l))}},Qu=["ctrl","shift","alt","meta"],Ju={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Qu.some(n=>e[`${n}Key`]&&!t.includes(n))},ct=(e,t)=>{const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=(r,...i)=>{for(let o=0;o{const t=tc().createApp(...e),{mount:n}=t;return t.mount=s=>{const r=rc(s);if(!r)return;const i=t._component;!be(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=n(r,!1,sc(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t};function sc(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function rc(e){return Ce(e)?document.querySelector(e):e}const ic=["aria-pressed"],oc={key:0,viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":"true"},lc={key:1,viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",fill:"none"},ac={__name:"ChatbotToggler",props:{isOpen:{type:Boolean,required:!0}},emits:["toggle"],setup(e){return(t,n)=>(F(),q("button",{class:"fixed bottom-5 right-5 z-9999 grid h-12 w-12 appearance-none place-items-center rounded-full border border-white/20 bg-gradient-to-br from-brand-500 to-brand-600 text-white shadow-[0_20px_36px_-20px_rgba(109,79,194,0.85)] transition-all duration-250 hover:-translate-y-0.5 hover:from-brand-600 hover:to-violet-700 hover:shadow-[0_22px_40px_-22px_rgba(109,79,194,1)] focus:outline-none max-[600px]:bottom-3 max-[600px]:right-3 max-[600px]:h-13 max-[600px]:w-13",style:{"border-radius":"9999px"},"aria-pressed":e.isOpen?"true":"false",onClick:n[0]||(n[0]=s=>t.$emit("toggle"))},[e.isOpen?(F(),q("svg",lc,n[2]||(n[2]=[x("path",{d:"M6 6l12 12M18 6L6 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)]))):(F(),q("svg",oc,n[1]||(n[1]=[x("path",{d:"M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H8l-4 4v-4H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z",fill:"currentColor",stroke:"currentColor","stroke-width":"2","stroke-linecap":"miter","stroke-linejoin":"miter"},null,-1)])))],8,ic))}},uc={class:"chat-header relative flex min-h-14 items-center justify-between px-4 pb-2.5 pt-3 text-white sm:px-5"},cc={class:"flex min-w-0 flex-1 items-center gap-2 sm:gap-2.5"},fc={xmlns:"http://www.w3.org/2000/svg",width:"35",height:"35",viewBox:"0 0 1024 1024",class:"h-8 w-8 shrink-0 rounded-full bg-white p-1.5 shadow-md motion-safe:animate-soft-float",style:{fill:"#6d4fc2"}},dc={class:"ml-2 flex items-center gap-1.5"},pc=["title"],hc=["title","aria-label"],gc={key:0,viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},mc={key:1,viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},bc=["title","aria-label"],xc={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},yc={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},wc={key:2,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},vc={__name:"ChatHeader",props:{windowMode:{type:String,required:!0},autoReadEnabled:{type:Boolean,required:!0},activeTtsProvider:{type:String,required:!0}},emits:["close","cycleResize","toggleAutoRead"],setup(e){const t=e,n={default:"Compact",half:"Half Screen",full:"Full Screen"},s=Re(()=>n[t.windowMode]||"Compact"),r=Re(()=>t.windowMode==="default"?"Half Screen":t.windowMode==="half"?"Full Screen":"Compact"),i=Re(()=>t.activeTtsProvider==="polly"?"TTS: Polly":t.activeTtsProvider==="browser"?"TTS: Browser":"TTS: Off"),o=Re(()=>t.activeTtsProvider==="polly"?"bg-emerald-500/45":t.activeTtsProvider==="browser"?"bg-amber-500/45":"bg-slate-500/35");return(a,l)=>(F(),q("div",uc,[x("div",cc,[(F(),q("svg",fc,l[3]||(l[3]=[x("path",{d:"M738.3 287.6H285.7c-59 0-106.8 47.8-106.8 106.8v303.1c0 59 47.8 106.8 106.8 106.8h81.5v111.1c0 .7.8 1.1 1.4.7l166.9-110.6 41.8-.8h117.4l43.6-.4c59 0 106.8-47.8 106.8-106.8V394.5c0-59-47.8-106.9-106.8-106.9zM351.7 448.2c0-29.5 23.9-53.5 53.5-53.5s53.5 23.9 53.5 53.5-23.9 53.5-53.5 53.5-53.5-23.9-53.5-53.5zm157.9 267.1c-67.8 0-123.8-47.5-132.3-109h264.6c-8.6 61.5-64.5 109-132.3 109zm110-213.7c-29.5 0-53.5-23.9-53.5-53.5s23.9-53.5 53.5-53.5 53.5 23.9 53.5 53.5-23.9 53.5-53.5 53.5zM867.2 644.5V453.1h26.5c19.4 0 35.1 15.7 35.1 35.1v121.1c0 19.4-15.7 35.1-35.1 35.1h-26.5zM95.2 609.4V488.2c0-19.4 15.7-35.1 35.1-35.1h26.5v191.3h-26.5c-19.4 0-35.1-15.7-35.1-35.1zM561.5 149.6c0 23.4-15.6 43.3-36.9 49.7v44.9h-30v-44.9c-21.4-6.5-36.9-26.3-36.9-49.7 0-28.6 23.3-51.9 51.9-51.9s51.9 23.3 51.9 51.9z"},null,-1)]))),l[4]||(l[4]=x("h2",{class:"truncate text-xs font-semibold tracking-[0.01em] sm:text-base text-white/95"},"ChangAI from ERPGulf",-1))]),x("div",dc,[x("span",{class:ye(["hidden rounded-full border border-white/25 px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-white/95 shadow-sm backdrop-blur-sm sm:inline",o.value]),title:`TTS provider: ${i.value}`},Qe(i.value),11,pc),x("button",{class:ye(["h-8 min-w-8 appearance-none items-center justify-center rounded-md border border-white/20 px-2 text-xs font-semibold text-white/90 transition-all duration-200 focus:outline-none sm:flex",e.autoReadEnabled?"bg-white/24 shadow-sm":"hover:bg-white/15"]),style:{"border-radius":"0.375rem"},title:e.autoReadEnabled?"Auto speech on":"Auto speech off","aria-label":e.autoReadEnabled?"Turn off auto speech":"Turn on auto speech",onClick:l[0]||(l[0]=c=>a.$emit("toggleAutoRead"))},[e.autoReadEnabled?(F(),q("svg",gc,l[5]||(l[5]=[x("path",{d:"M11 5L6 9H3v6h3l5 4V5z"},null,-1),x("path",{d:"M15 9a4 4 0 0 1 0 6"},null,-1),x("path",{d:"M18 7a7 7 0 0 1 0 10"},null,-1)]))):(F(),q("svg",mc,l[6]||(l[6]=[x("path",{d:"M11 5L6 9H3v6h3l5 4V5z"},null,-1),x("path",{d:"M22 9l-6 6"},null,-1),x("path",{d:"M16 9l6 6"},null,-1)])))],10,hc),x("button",{class:ye(["flex h-8 min-w-8 appearance-none items-center justify-center rounded-md border border-white/20 px-2 text-xs font-semibold text-white/90 transition-all duration-200 focus:outline-none","bg-white/20 shadow-sm hover:bg-white/25"]),style:{"border-radius":"0.375rem"},title:`Resize mode: ${s.value} (click to ${r.value})`,"aria-label":`Resize mode ${s.value}. Click to switch to ${r.value}`,onClick:l[1]||(l[1]=c=>a.$emit("cycleResize"))},[e.windowMode==="default"?(F(),q("svg",xc,l[7]||(l[7]=[x("rect",{x:"7",y:"8",width:"10",height:"8",rx:"2"},null,-1)]))):e.windowMode==="half"?(F(),q("svg",yc,l[8]||(l[8]=[x("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"},null,-1),x("path",{d:"M12 5v14"},null,-1)]))):(F(),q("svg",wc,l[9]||(l[9]=[x("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"},null,-1),x("path",{d:"M8 8H6v2M16 8h2v2M8 16H6v-2M16 16h2v-2"},null,-1)])))],8,bc),x("button",{class:"grid h-8 w-8 shrink-0 appearance-none place-items-center rounded-full border border-white/20 text-white transition-all duration-200 hover:scale-105 hover:bg-white/20 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/70",style:{"border-radius":"9999px"},"aria-label":"Close chatbot",onClick:l[2]||(l[2]=c=>a.$emit("close"))},l[10]||(l[10]=[x("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",width:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[x("path",{d:"M6 9l6 6 6-6"})],-1)]))])]))}},_c={class:"flex gap-1.5 border-b border-slate-200/80 px-2.5 pb-2.5 pt-1"},kc=["onClick"],Tc={class:"inline-flex items-center gap-1.5"},Sc={__name:"TabBar",props:{modelValue:{type:String,required:!0},debugEnabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e){const t=e,n=Re(()=>{const s=[{id:"chat",label:"Chats"},{id:"debug",label:"Debug"},{id:"support",label:"Support"},{id:"settings",label:"Settings"}];return t.debugEnabled?s:s.filter(r=>r.id!=="debug")});return(s,r)=>(F(),q("div",_c,[(F(!0),q(Be,null,ys(n.value,i=>(F(),q("button",{key:i.id,class:ye(["group min-w-0 flex-1 h-9 appearance-none rounded-lg border border-transparent bg-transparent px-2 text-xs font-semibold transition-all duration-200 focus:outline-none",e.modelValue===i.id?"border-white/30 bg-linear-to-r from-violet-300/36 via-indigo-300/30 to-sky-300/28 text-white shadow-[0_4px_10px_rgba(20,24,40,0.22)]":"text-white/80 hover:border-white/25 hover:bg-white/12 hover:text-white"]),onClick:o=>s.$emit("update:modelValue",i.id)},[x("span",Tc,[x("span",{class:ye(["h-1.5 w-1.5 rounded-full transition-colors duration-200",e.modelValue===i.id?"bg-white":"bg-white/40 group-hover:bg-white/70"])},null,2),Ts(" "+Qe(i.label),1)])],10,kc))),128))]))}},Ec=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},Ac={},Rc={xmlns:"http://www.w3.org/2000/svg",width:"50",height:"50",viewBox:"0 0 1024 1024",class:"h-7.5 w-7.5 shrink-0 self-end rounded-full bg-gradient-to-br from-brand-500 to-brand-600 p-1.5 fill-white shadow-[0_10px_18px_-12px_rgba(109,79,194,0.85)]"};function Cc(e,t){return F(),q("svg",Rc,t[0]||(t[0]=[x("path",{d:"M738.3 287.6H285.7c-59 0-106.8 47.8-106.8 106.8v303.1c0 59 47.8 106.8 106.8 106.8h81.5v111.1c0 .7.8 1.1 1.4.7l166.9-110.6 41.8-.8h117.4l43.6-.4c59 0 106.8-47.8 106.8-106.8V394.5c0-59-47.8-106.9-106.8-106.9zM351.7 448.2c0-29.5 23.9-53.5 53.5-53.5s53.5 23.9 53.5 53.5-23.9 53.5-53.5 53.5-53.5-23.9-53.5-53.5zm157.9 267.1c-67.8 0-123.8-47.5-132.3-109h264.6c-8.6 61.5-64.5 109-132.3 109zm110-213.7c-29.5 0-53.5-23.9-53.5-53.5s23.9-53.5 53.5-53.5 53.5 23.9 53.5 53.5-23.9 53.5-53.5 53.5zM867.2 644.5V453.1h26.5c19.4 0 35.1 15.7 35.1 35.1v121.1c0 19.4-15.7 35.1-35.1 35.1h-26.5zM95.2 609.4V488.2c0-19.4 15.7-35.1 35.1-35.1h26.5v191.3h-26.5c-19.4 0-35.1-15.7-35.1-35.1zM561.5 149.6c0 23.4-15.6 43.3-36.9 49.7v44.9h-30v-44.9c-21.4-6.5-36.9-26.3-36.9-49.7 0-28.6 23.3-51.9 51.9-51.9s51.9 23.3 51.9 51.9z"},null,-1)]))}const Bo=Ec(Ac,[["render",Cc]]),Rs={PIPELINE:"changai.changai.api.v2.text2sql_pipeline_v2.run_text2sql_pipeline",SUPPORT:"changai.changai.api.v2.text2sql_pipeline_v2.support_bot",SETTINGS:"changai.changai.api.v2.text2sql_pipeline_v2.get_frontend_settings",TTS:"changai.changai.api.v2.text2sql_pipeline_v2.synthesize_tts"};function Tr(e,t={},n="actual"){return n==="test"?Promise.resolve({Bot:`[TEST MODE] ${JSON.stringify(t)}`}):!window.frappe||!window.frappe.call?Promise.reject(new Error("Frappe API is unavailable in actual mode.")):new Promise((s,r)=>{window.frappe.call({method:e,args:t,callback(i){s(i.message)},error(i){r(i)}})})}function Pc(e,t,n="actual",s=null,r){if(n==="test")return{promise:Promise.resolve({Bot:`[TEST MODE] ${JSON.stringify({user_question:e,chat_id:t,request_id:s,sendNonErptoAI:r})}`}),cancel:()=>!1};if(!window.frappe||!window.frappe.call)return{promise:Promise.reject(new Error("Frappe API is unavailable in actual mode.")),cancel:()=>!1};let i=null,o=!1;return{promise:new Promise((c,u)=>{i=window.frappe.call({method:Rs.PIPELINE,args:{user_question:e,chat_id:t,request_id:s,sendNonErptoAI:r},callback(p){o=!0,c(p.message)},error(p){o=!0,u(p)}})}),cancel:()=>o||!i||typeof i.abort!="function"?!1:(i.abort(),o=!0,!0)}}function Ic(e,t="actual"){return Tr(Rs.SUPPORT,{message:e},t)}function Mc(e="actual"){return Tr(Rs.SETTINGS,{},e)}function Lc(e,t="Zayd",n="actual"){return Tr(Rs.TTS,{text:e,voice_id:t},n)}function Sr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var un=Sr();function Ho(e){un=e}var cn={exec:()=>null};function ie(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(r,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(qe.caret,"$1"),n=n.replace(r,o),s},getRegex:()=>new RegExp(n,t)};return s}var Oc=((e="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},$c=/^(?:[ \t]*(?:\n|$))+/,Dc=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Nc=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Gn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Fc=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Er=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,zo=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Uo=ie(zo).replace(/bull/g,Er).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Bc=ie(zo).replace(/bull/g,Er).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ar=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Hc=/^[^\n]+/,Rr=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,zc=ie(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Rr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Uc=ie(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Er).getRegex(),Cs="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Cr=/|$))/,jc=ie("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Cr).replace("tag",Cs).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),jo=ie(Ar).replace("hr",Gn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Cs).getRegex(),Vc=ie(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",jo).getRegex(),Pr={blockquote:Vc,code:Dc,def:zc,fences:Nc,heading:Fc,hr:Gn,html:jc,lheading:Uo,list:Uc,newline:$c,paragraph:jo,table:cn,text:Hc},Vo=ie("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Gn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Cs).getRegex(),qc={...Pr,lheading:Bc,table:Vo,paragraph:ie(Ar).replace("hr",Gn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Vo).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Cs).getRegex()},Wc={...Pr,html:ie(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Cr).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:cn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ie(Ar).replace("hr",Gn).replace("heading",` *#{1,6} *[^
-]`).replace("lheading",Uo).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Gc=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Kc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qo=/^( {2,}|\\)\n(?!\s*$)/,Yc=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Oc?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Go=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ef=ie(Go,"u").replace(/punct/g,vn).getRegex(),tf=ie(Go,"u").replace(/punct/g,Wo).getRegex(),Ko="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",nf=ie(Ko,"gu").replace(/notPunctSpace/g,Ir).replace(/punctSpace/g,Ps).replace(/punct/g,vn).getRegex(),sf=ie(Ko,"gu").replace(/notPunctSpace/g,Qc).replace(/punctSpace/g,Xc).replace(/punct/g,Wo).getRegex(),rf=ie("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ir).replace(/punctSpace/g,Ps).replace(/punct/g,vn).getRegex(),of=ie(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,vn).getRegex(),lf="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",af=ie(lf,"gu").replace(/notPunctSpace/g,Ir).replace(/punctSpace/g,Ps).replace(/punct/g,vn).getRegex(),uf=ie(/\\(punct)/,"gu").replace(/punct/g,vn).getRegex(),cf=ie(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ff=ie(Cr).replace("(?:-->|$)","-->").getRegex(),df=ie("^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",ff).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Is=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,pf=ie(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Is).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Yo=ie(/^!?\[(label)\]\[(ref)\]/).replace("label",Is).replace("ref",Rr).getRegex(),Zo=ie(/^!?\[(ref)\](?:\[\])?/).replace("ref",Rr).getRegex(),hf=ie("reflink|nolink(?!\\()","g").replace("reflink",Yo).replace("nolink",Zo).getRegex(),Xo=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Mr={_backpedal:cn,anyPunctuation:uf,autolink:cf,blockSkip:Jc,br:qo,code:Kc,del:cn,delLDelim:cn,delRDelim:cn,emStrongLDelim:ef,emStrongRDelimAst:nf,emStrongRDelimUnd:rf,escape:Gc,link:pf,nolink:Zo,punctuation:Zc,reflink:Yo,reflinkSearch:hf,tag:df,text:Yc,url:cn},gf={...Mr,link:ie(/^!?\[(label)\]\((.*?)\)/).replace("label",Is).getRegex(),reflink:ie(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Is).getRegex()},Lr={...Mr,emStrongRDelimAst:sf,emStrongLDelim:tf,delLDelim:of,delRDelim:af,url:ie(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Xo).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ie(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Qo=e=>bf[e];function Rt(e,t){if(t){if(qe.escapeTest.test(e))return e.replace(qe.escapeReplace,Qo)}else if(qe.escapeTestNoEncode.test(e))return e.replace(qe.escapeReplaceNoEncode,Qo);return e}function Jo(e){try{e=encodeURI(e).replace(qe.percentDecode,"%")}catch{return null}return e}function el(e,t){var i;let n=e.replace(qe.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),s=n.split(qe.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!((i=s.at(-1))!=null&&i.trim())&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length=0&&qe.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
+`,...ka(r))}Mt(),ir=!1}function Ta(){let e=Dn[Dn.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const s=e.component&&e.component.parent;e=s&&s.vnode}return t}function ka(e){const t=[];return e.forEach((n,s)=>{t.push(...s===0?[]:[`
+`],...Sa(n))}),t}function Sa({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",s=e.component?e.component.parent==null:!1,r=` at <${go(e.component,e.type,s)}`,i=">"+n;return e.props?[r,...Ea(e.props),i]:[r+i]}function Ea(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(s=>{t.push(...Ci(s,e[s]))}),n.length>3&&t.push(" ..."),t}function Ci(e,t,n){return Pe(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:Ve(t)?(t=Ci(e,ue(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):be(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=ue(t),n?t:[`${e}=`,t])}function bn(e,t,n,s){try{return s?e(...s):e()}catch(r){gs(r,t,n)}}function Tt(e,t,n,s){if(be(e)){const r=bn(e,t,n,s);return r&&ti(r)&&r.catch(i=>{gs(i,t,n)}),r}if(Q(e)){const r=[];for(let i=0;i>>1,r=Ke[s],i=Nn(r);i=Nn(n)?Ke.push(e):Ke.splice(Ra(t),0,e),e.flags|=1,Ii()}}function Ii(){ms||(ms=Pi.then(Li))}function Ca(e){Q(e)?xn.push(...e):Wt&&e.id===-1?Wt.splice(yn+1,0,e):e.flags&1||(xn.push(e),e.flags|=1),Ii()}function Mi(e,t,n=kt+1){for(;nNn(n)-Nn(s));if(xn.length=0,Wt){Wt.push(...t);return}for(Wt=t,yn=0;yne.id==null?e.flags&2?-1:1/0:e.id;function Li(e){try{for(kt=0;kt{s._d&&oo(-1);const i=bs(t);let o;try{o=e(...r)}finally{bs(i),s._d&&oo(1)}return o};return s._n=!0,s._c=!0,s._d=!0,s}function Pa(e,t){if(ct===null)return e;const n=As(ct),s=e.dirs||(e.dirs=[]);for(let r=0;re.__isTeleport,Gt=Symbol("_leaveCb"),xs=Symbol("_enterCb");function Ma(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return zn(()=>{e.isMounted=!0}),ys(()=>{e.isUnmounting=!0}),e}const ft=[Function,Array],Fi={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ft,onEnter:ft,onAfterEnter:ft,onEnterCancelled:ft,onBeforeLeave:ft,onLeave:ft,onAfterLeave:ft,onLeaveCancelled:ft,onBeforeAppear:ft,onAppear:ft,onAfterAppear:ft,onAppearCancelled:ft},Bi=e=>{const t=e.subTree;return t.component?Bi(t.component):t},Oa={name:"BaseTransition",props:Fi,setup(e,{slots:t}){const n=uo(),s=Ma();return()=>{const r=t.default&&ji(t.default(),!0);if(!r||!r.length)return;const i=Hi(r),o=ue(e),{mode:a}=o;if(s.isLeaving)return ar(i);const l=Ui(i);if(!l)return ar(i);let f=lr(l,o,s,n,d=>f=d);l.type!==Ye&&Fn(l,f);let u=n.subTree&&Ui(n.subTree);if(u&&u.type!==Ye&&!ln(l,u)&&Bi(n).type!==Ye){let d=lr(u,o,s,n);if(Fn(u,d),a==="out-in"&&l.type!==Ye)return s.isLeaving=!0,d.afterLeave=()=>{s.isLeaving=!1,n.job.flags&8||n.update(),delete d.afterLeave,u=void 0},ar(i);a==="in-out"&&l.type!==Ye?d.delayLeave=(g,y,E)=>{const x=zi(s,u);x[String(u.key)]=u,g[Gt]=()=>{y(),g[Gt]=void 0,delete f.delayedLeave,u=void 0},f.delayedLeave=()=>{E(),delete f.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function Hi(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Ye){t=n;break}}return t}const La=Oa;function zi(e,t){const{leavingVNodes:n}=e;let s=n.get(t.type);return s||(s=Object.create(null),n.set(t.type,s)),s}function lr(e,t,n,s,r){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:f,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:g,onLeave:y,onAfterLeave:E,onLeaveCancelled:x,onBeforeAppear:M,onAppear:m,onAfterAppear:H,onAppearCancelled:Y}=t,$=String(e.key),z=zi(n,e),O=(V,se)=>{V&&Tt(V,s,9,se)},P=(V,se)=>{const fe=se[1];O(V,se),Q(V)?V.every(D=>D.length<=1)&&fe():V.length<=1&&fe()},ee={mode:o,persisted:a,beforeEnter(V){let se=l;if(!n.isMounted)if(i)se=M||l;else return;V[Gt]&&V[Gt](!0);const fe=z[$];fe&&ln(e,fe)&&fe.el[Gt]&&fe.el[Gt](),O(se,[V])},enter(V){let se=f,fe=u,D=d;if(!n.isMounted)if(i)se=m||f,fe=H||u,D=Y||d;else return;let Z=!1;const Se=V[xs]=Ue=>{Z||(Z=!0,Ue?O(D,[V]):O(fe,[V]),ee.delayedLeave&&ee.delayedLeave(),V[xs]=void 0)};se?P(se,[V,Se]):Se()},leave(V,se){const fe=String(e.key);if(V[xs]&&V[xs](!0),n.isUnmounting)return se();O(g,[V]);let D=!1;const Z=V[Gt]=Se=>{D||(D=!0,se(),Se?O(x,[V]):O(E,[V]),V[Gt]=void 0,z[fe]===e&&delete z[fe])};z[fe]=e,y?P(y,[V,Z]):Z()},clone(V){const se=lr(V,t,n,s,r);return r&&r(se),se}};return ee}function ar(e){if(ur(e))return e=Kt(e),e.children=null,e}function Ui(e){if(!ur(e))return Ni(e.type)&&e.children?Hi(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&be(n.default))return n.default()}}function Fn(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Fn(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function ji(e,t=!1,n){let s=[],r=0;for(let i=0;i1)for(let i=0;iBn(E,t&&(Q(t)?t[x]:t),n,s,r));return}if(Hn(s)&&!r){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&Bn(e,t,n,s.component.subTree);return}const i=s.shapeFlag&4?As(s.component):s.el,o=r?null:i,{i:a,r:l}=e,f=t&&t.r,u=a.refs===oe?a.refs={}:a.refs,d=a.setupState,g=ue(d),y=d===oe?()=>!1:E=>me(g,E);if(f!=null&&f!==l&&(Pe(f)?(u[f]=null,y(f)&&(d[f]=null)):Ve(f)&&(f.value=null)),be(l))bn(l,a,12,[o,u]);else{const E=Pe(l),x=Ve(l);if(E||x){const M=()=>{if(e.f){const m=E?y(l)?d[l]:u[l]:l.value;r?Q(m)&&Jr(m,i):Q(m)?m.includes(i)||m.push(i):E?(u[l]=[i],y(l)&&(d[l]=u[l])):(l.value=[i],e.k&&(u[e.k]=l.value))}else E?(u[l]=o,y(l)&&(d[l]=o)):x&&(l.value=o,e.k&&(u[e.k]=o))};o?(M.id=-1,rt(M,n)):M()}}}is().requestIdleCallback,is().cancelIdleCallback;const Hn=e=>!!e.type.__asyncLoader,ur=e=>e.type.__isKeepAlive;function Da(e,t,n=Zt,s=!1){if(n){const r=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...o)=>{It();const a=yr(n),l=Tt(t,n,e,o);return a(),Mt(),l});return s?r.unshift(i):r.push(i),i}}const Vi=e=>(t,n=Zt)=>{(!qn||e==="sp")&&Da(e,(...s)=>t(...s),n)},zn=Vi("m"),ys=Vi("bum"),Na=Symbol.for("v-ndc");function ws(e,t,n,s){let r;const i=n,o=Q(e);if(o||Pe(e)){const a=o&&mn(e);let l=!1,f=!1;a&&(l=!ut(e),f=qt(e),e=os(e)),r=new Array(e.length);for(let u=0,d=e.length;ut(a,l,void 0,i));else{const a=Object.keys(e);r=new Array(a.length);for(let l=0,f=a.length;le?fo(e)?As(e):cr(e.parent):null,Un=bt(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>cr(e.parent),$root:e=>cr(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>e.type,$forceUpdate:e=>e.f||(e.f=()=>{or(e.update)}),$nextTick:e=>e.n||(e.n=St.bind(e.proxy)),$watch:e=>Jt}),fr=(e,t)=>e!==oe&&!e.__isScriptSetup&&me(e,t),Fa={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:s,data:r,props:i,accessCache:o,type:a,appContext:l}=e;let f;if(t[0]!=="$"){const y=o[t];if(y!==void 0)switch(y){case 1:return s[t];case 2:return r[t];case 4:return n[t];case 3:return i[t]}else{if(fr(s,t))return o[t]=1,s[t];if(r!==oe&&me(r,t))return o[t]=2,r[t];if((f=e.propsOptions[0])&&me(f,t))return o[t]=3,i[t];if(n!==oe&&me(n,t))return o[t]=4,n[t];o[t]=0}}const u=Un[t];let d,g;if(u)return t==="$attrs"&&je(e.attrs,"get",""),u(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==oe&&me(n,t))return o[t]=4,n[t];if(g=l.config.globalProperties,me(g,t))return g[t]},set({_:e},t,n){const{data:s,setupState:r,ctx:i}=e;return fr(r,t)?(r[t]=n,!0):s!==oe&&me(s,t)?(s[t]=n,!0):me(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:r,propsOptions:i}},o){let a;return!!n[o]||e!==oe&&me(e,o)||fr(t,o)||(a=i[0])&&me(a,o)||me(s,o)||me(Un,o)||me(r.config.globalProperties,o)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:me(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function qi(){return{app:null,config:{isNativeTag:Dl,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Ba=0;function Ha(e,t){return function(s,r=null){be(s)||(s=bt({},s)),r!=null&&!Re(r)&&(r=null);const i=qi(),o=new WeakSet,a=[];let l=!1;const f=i.app={_uid:Ba++,_component:s,_props:r,_container:null,_context:i,_instance:null,version:Su,get config(){return i.config},set config(u){},use(u,...d){return o.has(u)||(u&&be(u.install)?(o.add(u),u.install(f,...d)):be(u)&&(o.add(u),u(f,...d))),f},mixin(u){return f},component(u,d){return d?(i.components[u]=d,f):i.components[u]},directive(u,d){return d?(i.directives[u]=d,f):i.directives[u]},mount(u,d,g){if(!l){const y=f._ceVNode||Oe(s,r);return y.appContext=i,g===!0?g="svg":g===!1&&(g=void 0),e(y,u,g),l=!0,f._container=u,u.__vue_app__=f,As(y.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Tt(a,f._instance,16),e(null,f._container),delete f._container.__vue_app__)},provide(u,d){return i.provides[u]=d,f},runWithContext(u){const d=wn;wn=f;try{return u()}finally{wn=d}}};return f}}let wn=null;function za(e,t,n=!1){const s=uo();if(s||wn){let r=wn?wn._context.provides:s?s.parent==null||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return n&&be(t)?t.call(s&&s.proxy):t}}const Wi={},Gi=()=>Object.create(Wi),Ki=e=>Object.getPrototypeOf(e)===Wi;function Ua(e,t,n,s=!1){const r={},i=Gi();e.propsDefaults=Object.create(null),Yi(e,t,r,i);for(const o in e.propsOptions[0])o in r||(r[o]=void 0);n?e.props=s?r:da(r):e.type.props?e.props=r:e.props=i,e.attrs=i}function ja(e,t,n,s){const{props:r,attrs:i,vnode:{patchFlag:o}}=e,a=ue(r),[l]=e.propsOptions;let f=!1;if((s||o>0)&&!(o&16)){if(o&8){const u=e.vnode.dynamicProps;for(let d=0;de==="_"||e==="__"||e==="_ctx"||e==="$stable",hr=e=>Q(e)?e.map(At):[At(e)],qa=(e,t,n)=>{if(t._n)return t;const s=Di((...r)=>hr(t(...r)),n);return s._c=!1,s},Xi=(e,t,n)=>{const s=e._ctx;for(const r in e){if(dr(r))continue;const i=e[r];if(be(i))t[r]=qa(r,i,s);else if(i!=null){const o=hr(i);t[r]=()=>o}}},Qi=(e,t)=>{const n=hr(t);e.slots.default=()=>n},Ji=(e,t,n)=>{for(const s in t)(n||!dr(s))&&(e[s]=t[s])},Wa=(e,t,n)=>{const s=e.slots=Gi();if(e.vnode.shapeFlag&32){const r=t.__;r&&js(s,"__",r,!0);const i=t._;i?(Ji(s,t,n),n&&js(s,"_",i,!0)):Xi(t,s)}else t&&Qi(e,t)},Ga=(e,t,n)=>{const{vnode:s,slots:r}=e;let i=!0,o=oe;if(s.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Ji(r,t,n):(i=!t.$stable,Xi(t,r)),o=t}else t&&(Qi(e,t),o={default:1});if(i)for(const a in r)!dr(a)&&o[a]==null&&delete r[a]},rt=au;function Ka(e){return Ya(e)}function Ya(e,t){const n=is();n.__VUE__=!0;const{insert:s,remove:r,patchProp:i,createElement:o,createText:a,createComment:l,setText:f,setElementText:u,parentNode:d,nextSibling:g,setScopeId:y=Jt,insertStaticContent:E}=e,x=(c,h,b,k=null,v=null,_=null,I=void 0,R=null,A=!!h.dynamicChildren)=>{if(c===h)return;c&&!ln(c,h)&&(k=ye(c),de(c,v,_,!0),c=null),h.patchFlag===-2&&(A=!1,h.dynamicChildren=null);const{type:S,ref:U,shapeFlag:L}=h;switch(S){case _s:M(c,h,b,k);break;case Ye:m(c,h,b,k);break;case mr:c==null&&H(h,b,k,I);break;case He:D(c,h,b,k,v,_,I,R,A);break;default:L&1?z(c,h,b,k,v,_,I,R,A):L&6?Z(c,h,b,k,v,_,I,R,A):(L&64||L&128)&&S.process(c,h,b,k,v,_,I,R,A,Ce)}U!=null&&v?Bn(U,c&&c.ref,_,h||c,!h):U==null&&c&&c.ref!=null&&Bn(c.ref,null,_,c,!0)},M=(c,h,b,k)=>{if(c==null)s(h.el=a(h.children),b,k);else{const v=h.el=c.el;h.children!==c.children&&f(v,h.children)}},m=(c,h,b,k)=>{c==null?s(h.el=l(h.children||""),b,k):h.el=c.el},H=(c,h,b,k)=>{[c.el,c.anchor]=E(c.children,h,b,k,c.el,c.anchor)},Y=({el:c,anchor:h},b,k)=>{let v;for(;c&&c!==h;)v=g(c),s(c,b,k),c=v;s(h,b,k)},$=({el:c,anchor:h})=>{let b;for(;c&&c!==h;)b=g(c),r(c),c=b;r(h)},z=(c,h,b,k,v,_,I,R,A)=>{h.type==="svg"?I="svg":h.type==="math"&&(I="mathml"),c==null?O(h,b,k,v,_,I,R,A):V(c,h,v,_,I,R,A)},O=(c,h,b,k,v,_,I,R)=>{let A,S;const{props:U,shapeFlag:L,transition:j,dirs:K}=c;if(A=c.el=o(c.type,_,U&&U.is,U),L&8?u(A,c.children):L&16&&ee(c.children,A,null,k,v,gr(c,_),I,R),K&&sn(c,null,k,"created"),P(A,c,c.scopeId,I,k),U){for(const he in U)he!=="value"&&!Pn(he)&&i(A,he,null,U[he],_,k);"value"in U&&i(A,"value",null,U.value,_),(S=U.onVnodeBeforeMount)&&Rt(S,k,c)}K&&sn(c,null,k,"beforeMount");const ne=Za(v,j);ne&&j.beforeEnter(A),s(A,h,b),((S=U&&U.onVnodeMounted)||ne||K)&&rt(()=>{S&&Rt(S,k,c),ne&&j.enter(A),K&&sn(c,null,k,"mounted")},v)},P=(c,h,b,k,v)=>{if(b&&y(c,b),k)for(let _=0;_{for(let S=A;S{const R=h.el=c.el;let{patchFlag:A,dynamicChildren:S,dirs:U}=h;A|=c.patchFlag&16;const L=c.props||oe,j=h.props||oe;let K;if(b&&rn(b,!1),(K=j.onVnodeBeforeUpdate)&&Rt(K,b,h,c),U&&sn(h,c,b,"beforeUpdate"),b&&rn(b,!0),(L.innerHTML&&j.innerHTML==null||L.textContent&&j.textContent==null)&&u(R,""),S?se(c.dynamicChildren,S,R,b,k,gr(h,v),_):I||pe(c,h,R,null,b,k,gr(h,v),_,!1),A>0){if(A&16)fe(R,L,j,b,v);else if(A&2&&L.class!==j.class&&i(R,"class",null,j.class,v),A&4&&i(R,"style",L.style,j.style,v),A&8){const ne=h.dynamicProps;for(let he=0;he{K&&Rt(K,b,h,c),U&&sn(h,c,b,"updated")},k)},se=(c,h,b,k,v,_,I)=>{for(let R=0;R{if(h!==b){if(h!==oe)for(const _ in h)!Pn(_)&&!(_ in b)&&i(c,_,h[_],null,v,k);for(const _ in b){if(Pn(_))continue;const I=b[_],R=h[_];I!==R&&_!=="value"&&i(c,_,R,I,v,k)}"value"in b&&i(c,"value",h.value,b.value,v)}},D=(c,h,b,k,v,_,I,R,A)=>{const S=h.el=c?c.el:a(""),U=h.anchor=c?c.anchor:a("");let{patchFlag:L,dynamicChildren:j,slotScopeIds:K}=h;K&&(R=R?R.concat(K):K),c==null?(s(S,b,k),s(U,b,k),ee(h.children||[],b,U,v,_,I,R,A)):L>0&&L&64&&j&&c.dynamicChildren?(se(c.dynamicChildren,j,b,v,_,I,R),(h.key!=null||v&&h===v.subTree)&&eo(c,h,!0)):pe(c,h,b,U,v,_,I,R,A)},Z=(c,h,b,k,v,_,I,R,A)=>{h.slotScopeIds=R,c==null?h.shapeFlag&512?v.ctx.activate(h,b,k,I,A):Se(h,b,k,v,_,I,A):Ue(c,h,A)},Se=(c,h,b,k,v,_,I)=>{const R=c.component=gu(c,k,v);if(ur(c)&&(R.ctx.renderer=Ce),mu(R,!1,I),R.asyncDep){if(v&&v.registerDep(R,te,I),!c.el){const A=R.subTree=Oe(Ye);m(null,A,h,b),c.placeholder=A.el}}else te(R,c,h,b,v,_,I)},Ue=(c,h,b)=>{const k=h.component=c.component;if(ou(c,h,b))if(k.asyncDep&&!k.asyncResolved){C(k,h,b);return}else k.next=h,k.update();else h.el=c.el,k.vnode=h},te=(c,h,b,k,v,_,I)=>{const R=()=>{if(c.isMounted){let{next:L,bu:j,u:K,parent:ne,vnode:he}=c;{const lt=to(c);if(lt){L&&(L.el=he.el,C(c,L,I)),lt.asyncDep.then(()=>{c.isUnmounted||R()});return}}let ie=L,ke;rn(c,!1),L?(L.el=he.el,C(c,L,I)):L=he,j&&rs(j),(ke=L.props&&L.props.onVnodeBeforeUpdate)&&Rt(ke,ne,L,he),rn(c,!0);const $e=so(c),ot=c.subTree;c.subTree=$e,x(ot,$e,d(ot.el),ye(ot),c,v,_),L.el=$e.el,ie===null&&lu(c,$e.el),K&&rt(K,v),(ke=L.props&&L.props.onVnodeUpdated)&&rt(()=>Rt(ke,ne,L,he),v)}else{let L;const{el:j,props:K}=h,{bm:ne,m:he,parent:ie,root:ke,type:$e}=c,ot=Hn(h);rn(c,!1),ne&&rs(ne),!ot&&(L=K&&K.onVnodeBeforeMount)&&Rt(L,ie,h),rn(c,!0);{ke.ce&&ke.ce._def.shadowRoot!==!1&&ke.ce._injectChildStyle($e);const lt=c.subTree=so(c);x(null,lt,b,k,c,v,_),h.el=lt.el}if(he&&rt(he,v),!ot&&(L=K&&K.onVnodeMounted)){const lt=h;rt(()=>Rt(L,ie,lt),v)}(h.shapeFlag&256||ie&&Hn(ie.vnode)&&ie.vnode.shapeFlag&256)&&c.a&&rt(c.a,v),c.isMounted=!0,h=b=k=null}};c.scope.on();const A=c.effect=new ui(R);c.scope.off();const S=c.update=A.run.bind(A),U=c.job=A.runIfDirty.bind(A);U.i=c,U.id=c.uid,A.scheduler=()=>or(U),rn(c,!0),S()},C=(c,h,b)=>{h.component=c;const k=c.vnode.props;c.vnode=h,c.next=null,ja(c,h.props,k,b),Ga(c,h.children,b),It(),Mi(c),Mt()},pe=(c,h,b,k,v,_,I,R,A=!1)=>{const S=c&&c.children,U=c?c.shapeFlag:0,L=h.children,{patchFlag:j,shapeFlag:K}=h;if(j>0){if(j&128){re(S,L,b,k,v,_,I,R,A);return}else if(j&256){Ge(S,L,b,k,v,_,I,R,A);return}}K&8?(U&16&&nt(S,v,_),L!==S&&u(b,L)):U&16?K&16?re(S,L,b,k,v,_,I,R,A):nt(S,v,_,!0):(U&8&&u(b,""),K&16&&ee(L,b,k,v,_,I,R,A))},Ge=(c,h,b,k,v,_,I,R,A)=>{c=c||mt,h=h||mt;const S=c.length,U=h.length,L=Math.min(S,U);let j;for(j=0;jU?nt(c,v,_,!0,!1,L):ee(h,b,k,v,_,I,R,A,L)},re=(c,h,b,k,v,_,I,R,A)=>{let S=0;const U=h.length;let L=c.length-1,j=U-1;for(;S<=L&&S<=j;){const K=c[S],ne=h[S]=A?Yt(h[S]):At(h[S]);if(ln(K,ne))x(K,ne,b,null,v,_,I,R,A);else break;S++}for(;S<=L&&S<=j;){const K=c[L],ne=h[j]=A?Yt(h[j]):At(h[j]);if(ln(K,ne))x(K,ne,b,null,v,_,I,R,A);else break;L--,j--}if(S>L){if(S<=j){const K=j+1,ne=Kj)for(;S<=L;)de(c[S],v,_,!0),S++;else{const K=S,ne=S,he=new Map;for(S=ne;S<=j;S++){const De=h[S]=A?Yt(h[S]):At(h[S]);De.key!=null&&he.set(De.key,S)}let ie,ke=0;const $e=j-ne+1;let ot=!1,lt=0;const Bt=new Array($e);for(S=0;S<$e;S++)Bt[S]=0;for(S=K;S<=L;S++){const De=c[S];if(ke>=$e){de(De,v,_,!0);continue}let Qe;if(De.key!=null)Qe=he.get(De.key);else for(ie=ne;ie<=j;ie++)if(Bt[ie-ne]===0&&ln(De,h[ie])){Qe=ie;break}Qe===void 0?de(De,v,_,!0):(Bt[Qe-ne]=S+1,Qe>=lt?lt=Qe:ot=!0,x(De,h[Qe],b,null,v,_,I,R,A),ke++)}const Jn=ot?Xa(Bt):mt;for(ie=Jn.length-1,S=$e-1;S>=0;S--){const De=ne+S,Qe=h[De],at=h[De+1],Ht=De+1{const{el:_,type:I,transition:R,children:A,shapeFlag:S}=c;if(S&6){B(c.component.subTree,h,b,k);return}if(S&128){c.suspense.move(h,b,k);return}if(S&64){I.move(c,h,b,Ce);return}if(I===He){s(_,h,b);for(let L=0;LR.enter(_),v);else{const{leave:L,delayLeave:j,afterLeave:K}=R,ne=()=>{c.ctx.isUnmounted?r(_):s(_,h,b)},he=()=>{L(_,()=>{ne(),K&&K()})};j?j(_,ne,he):he()}else s(_,h,b)},de=(c,h,b,k=!1,v=!1)=>{const{type:_,props:I,ref:R,children:A,dynamicChildren:S,shapeFlag:U,patchFlag:L,dirs:j,cacheIndex:K}=c;if(L===-2&&(v=!1),R!=null&&(It(),Bn(R,null,b,c,!0),Mt()),K!=null&&(h.renderCache[K]=void 0),U&256){h.ctx.deactivate(c);return}const ne=U&1&&j,he=!Hn(c);let ie;if(he&&(ie=I&&I.onVnodeBeforeUnmount)&&Rt(ie,h,c),U&6)ge(c.component,b,k);else{if(U&128){c.suspense.unmount(b,k);return}ne&&sn(c,null,h,"beforeUnmount"),U&64?c.type.remove(c,h,b,Ce,k):S&&!S.hasOnce&&(_!==He||L>0&&L&64)?nt(S,h,b,!1,!0):(_===He&&L&384||!v&&U&16)&&nt(A,h,b),k&&ae(c)}(he&&(ie=I&&I.onVnodeUnmounted)||ne)&&rt(()=>{ie&&Rt(ie,h,c),ne&&sn(c,null,h,"unmounted")},b)},ae=c=>{const{type:h,el:b,anchor:k,transition:v}=c;if(h===He){ve(b,k);return}if(h===mr){$(c);return}const _=()=>{r(b),v&&!v.persisted&&v.afterLeave&&v.afterLeave()};if(c.shapeFlag&1&&v&&!v.persisted){const{leave:I,delayLeave:R}=v,A=()=>I(b,_);R?R(c.el,_,A):A()}else _()},ve=(c,h)=>{let b;for(;c!==h;)b=g(c),r(c),c=b;r(h)},ge=(c,h,b)=>{const{bum:k,scope:v,job:_,subTree:I,um:R,m:A,a:S,parent:U,slots:{__:L}}=c;no(A),no(S),k&&rs(k),U&&Q(L)&&L.forEach(j=>{U.renderCache[j]=void 0}),v.stop(),_&&(_.flags|=8,de(I,c,h,b)),R&&rt(R,h),rt(()=>{c.isUnmounted=!0},h),h&&h.pendingBranch&&!h.isUnmounted&&c.asyncDep&&!c.asyncResolved&&c.suspenseId===h.pendingId&&(h.deps--,h.deps===0&&h.resolve())},nt=(c,h,b,k=!1,v=!1,_=0)=>{for(let I=_;I{if(c.shapeFlag&6)return ye(c.component.subTree);if(c.shapeFlag&128)return c.suspense.next();const h=g(c.anchor||c.el),b=h&&h[Ia];return b?g(b):h};let ht=!1;const G=(c,h,b)=>{c==null?h._vnode&&de(h._vnode,null,null,!0):x(h._vnode||null,c,h,null,null,null,b),h._vnode=c,ht||(ht=!0,Mi(),Oi(),ht=!1)},Ce={p:x,um:de,m:B,r:ae,mt:Se,mc:ee,pc:pe,pbc:se,n:ye,o:e};return{render:G,hydrate:void 0,createApp:Ha(G)}}function gr({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function rn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Za(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function eo(e,t,n=!1){const s=e.children,r=t.children;if(Q(s)&&Q(r))for(let i=0;i>1,e[n[a]]0&&(t[s]=n[i-1]),n[i]=s)}}for(i=n.length,o=n[i-1];i-- >0;)n[i]=o,o=t[o];return n}function to(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:to(t)}function no(e){if(e)for(let t=0;tza(Qa);function on(e,t,n){return eu(e,t,n)}function eu(e,t,n=oe){const{immediate:s,deep:r,flush:i,once:o}=n,a=bt({},n),l=t&&s||!t&&i!=="post";let f;if(qn){if(i==="sync"){const y=Ja();f=y.__watcherHandles||(y.__watcherHandles=[])}else if(!l){const y=()=>{};return y.stop=Jt,y.resume=Jt,y.pause=Jt,y}}const u=Zt;a.call=(y,E,x)=>Tt(y,u,E,x);let d=!1;i==="post"?a.scheduler=y=>{rt(y,u&&u.suspense)}:i!=="sync"&&(d=!0,a.scheduler=(y,E)=>{E?y():or(y)}),a.augmentJob=y=>{t&&(y.flags|=4),d&&(y.flags|=2,u&&(y.id=u.uid,y.i=u))};const g=_a(e,t,a);return qn&&(f?f.push(g):l&&g()),g}const tu=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${jt(t)}Modifiers`]||e[`${en(t)}Modifiers`];function nu(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||oe;let r=n;const i=t.startsWith("update:"),o=i&&tu(s,t.slice(7));o&&(o.trim&&(r=n.map(u=>Pe(u)?u.trim():u)),o.number&&(r=n.map(Vs)));let a,l=s[a=Us(t)]||s[a=Us(jt(t))];!l&&i&&(l=s[a=Us(en(t))]),l&&Tt(l,e,6,r);const f=s[a+"Once"];if(f){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Tt(f,e,6,r)}}function su(e,t,n=!1){const s=t.emitsCache,r=s.get(e);if(r!==void 0)return r;const i=e.emits;let o={};return i?(Q(i)?i.forEach(a=>o[a]=null):bt(o,i),Re(e)&&s.set(e,o),o):(Re(e)&&s.set(e,null),null)}function vs(e,t){return!e||!ts(t)?!1:(t=t.slice(2).replace(/Once$/,""),me(e,t[0].toLowerCase()+t.slice(1))||me(e,en(t))||me(e,t))}function Ed(){}function so(e){const{type:t,vnode:n,proxy:s,withProxy:r,propsOptions:[i],slots:o,attrs:a,emit:l,render:f,renderCache:u,props:d,data:g,setupState:y,ctx:E,inheritAttrs:x}=e,M=bs(e);let m,H;try{if(n.shapeFlag&4){const $=r||s,z=$;m=At(f.call(z,$,u,d,y,g,E)),H=a}else{const $=t;m=At($.length>1?$(d,{attrs:a,slots:o,emit:l}):$(d,null)),H=t.props?a:ru(a)}}catch($){jn.length=0,gs($,e,1),m=Oe(Ye)}let Y=m;if(H&&x!==!1){const $=Object.keys(H),{shapeFlag:z}=Y;$.length&&z&7&&(i&&$.some(Hs)&&(H=iu(H,i)),Y=Kt(Y,H,!1,!0))}return n.dirs&&(Y=Kt(Y,null,!1,!0),Y.dirs=Y.dirs?Y.dirs.concat(n.dirs):n.dirs),n.transition&&Fn(Y,n.transition),m=Y,bs(M),m}const ru=e=>{let t;for(const n in e)(n==="class"||n==="style"||ts(n))&&((t||(t={}))[n]=e[n]);return t},iu=(e,t)=>{const n={};for(const s in e)(!Hs(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function ou(e,t,n){const{props:s,children:r,component:i}=e,{props:o,children:a,patchFlag:l}=t,f=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return s?ro(s,o,f):!!o;if(l&8){const u=t.dynamicProps;for(let d=0;de.__isSuspense;function au(e,t){t&&t.pendingBranch?Q(e)?t.effects.push(...e):t.effects.push(e):Ca(e)}const He=Symbol.for("v-fgt"),_s=Symbol.for("v-txt"),Ye=Symbol.for("v-cmt"),mr=Symbol.for("v-stc"),jn=[];let it=null;function F(e=!1){jn.push(it=e?null:[])}function uu(){jn.pop(),it=jn[jn.length-1]||null}let Vn=1;function oo(e,t=!1){Vn+=e,e<0&&it&&t&&(it.hasOnce=!0)}function lo(e){return e.dynamicChildren=Vn>0?it||mt:null,uu(),Vn>0&&it&&it.push(e),e}function W(e,t,n,s,r,i){return lo(w(e,t,n,s,r,i,!0))}function Et(e,t,n,s,r){return lo(Oe(e,t,n,s,r,!0))}function Ts(e){return e?e.__v_isVNode===!0:!1}function ln(e,t){return e.type===t.type&&e.key===t.key}const ao=({key:e})=>e!=null?e:null,ks=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Pe(e)||Ve(e)||be(e)?{i:ct,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,s=0,r=null,i=e===He?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ao(t),ref:t&&ks(t),scopeId:$i,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:ct};return a?(br(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Pe(n)?8:16),Vn>0&&!o&&it&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&it.push(l),l}const Oe=cu;function cu(e,t=null,n=null,s=0,r=null,i=!1){if((!e||e===Na)&&(e=Ye),Ts(e)){const a=Kt(e,t,!0);return n&&br(a,n),Vn>0&&!i&&it&&(a.shapeFlag&6?it[it.indexOf(e)]=a:it.push(a)),a.patchFlag=-2,a}if(Tu(e)&&(e=e.__vccOpts),t){t=fu(t);let{class:a,style:l}=t;a&&!Pe(a)&&(t.class=we(a)),Re(l)&&(rr(l)&&!Q(l)&&(l=bt({},l)),t.style=qs(l))}const o=Pe(e)?1:io(e)?128:Ni(e)?64:Re(e)?4:be(e)?2:0;return w(e,t,n,s,r,o,i,!0)}function fu(e){return e?rr(e)||Ki(e)?bt({},e):e:null}function Kt(e,t,n=!1,s=!1){const{props:r,ref:i,patchFlag:o,children:a,transition:l}=e,f=t?pu(r||{},t):r,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&ao(f),ref:t&&t.ref?n&&i?Q(i)?i.concat(ks(t)):[i,ks(t)]:ks(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==He?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Kt(e.ssContent),ssFallback:e.ssFallback&&Kt(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&s&&Fn(u,l.clone(u)),u}function Ss(e=" ",t=0){return Oe(_s,null,e,t)}function qe(e="",t=!1){return t?(F(),Et(Ye,null,e)):Oe(Ye,null,e)}function At(e){return e==null||typeof e=="boolean"?Oe(Ye):Q(e)?Oe(He,null,e.slice()):Ts(e)?Yt(e):Oe(_s,null,String(e))}function Yt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Kt(e)}function br(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(Q(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),br(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!Ki(t)?t._ctx=ct:r===3&&ct&&(ct.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else be(t)?(t={default:t,_ctx:ct},n=32):(t=String(t),s&64?(n=16,t=[Ss(t)]):n=8);e.children=t,e.shapeFlag|=n}function pu(...e){const t={};for(let n=0;nZt||ct;let Es,xr;{const e=is(),t=(n,s)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(s),i=>{r.length>1?r.forEach(o=>o(i)):r[0](i)}};Es=t("__VUE_INSTANCE_SETTERS__",n=>Zt=n),xr=t("__VUE_SSR_SETTERS__",n=>qn=n)}const yr=e=>{const t=Zt;return Es(e),e.scope.on(),()=>{e.scope.off(),Es(t)}},co=()=>{Zt&&Zt.scope.off(),Es(null)};function fo(e){return e.vnode.shapeFlag&4}let qn=!1;function mu(e,t=!1,n=!1){t&&xr(t);const{props:s,children:r}=e.vnode,i=fo(e);Ua(e,s,i,t),Wa(e,r,n||t);const o=i?bu(e,t):void 0;return t&&xr(!1),o}function bu(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Fa);const{setup:s}=n;if(s){It();const r=e.setupContext=s.length>1?yu(e):null,i=yr(e),o=bn(s,e,0,[e.props,r]),a=ti(o);if(Mt(),i(),(a||e.sp)&&!Hn(e)&&$a(e),a){if(o.then(co,co),t)return o.then(l=>{po(e,l)}).catch(l=>{gs(l,e,0)});e.asyncDep=o}else po(e,o)}else ho(e)}function po(e,t,n){be(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Re(t)&&(e.setupState=Ri(t)),ho(e)}function ho(e,t,n){const s=e.type;e.render||(e.render=s.render||Jt)}const xu={get(e,t){return je(e,"get",""),e[t]}};function yu(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,xu),slots:e.slots,emit:e.emit,expose:t}}function As(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Ri(ha(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Un)return Un[n](e)},has(t,n){return n in t||n in Un}})):e.proxy}const wu=/(?:^|[-_])(\w)/g,vu=e=>e.replace(wu,t=>t.toUpperCase()).replace(/[-_]/g,"");function _u(e,t=!0){return be(e)?e.displayName||e.name:e.name||t&&e.__name}function go(e,t,n=!1){let s=_u(t);if(!s&&t.__file){const r=t.__file.match(/([^/\\]+)\.\w+$/);r&&(s=r[1])}if(!s&&e&&e.parent){const r=i=>{for(const o in i)if(i[o]===t)return o};s=r(e.components||e.parent.type.components)||r(e.appContext.components)}return s?vu(s):n?"App":"Anonymous"}function Tu(e){return be(e)&&"__vccOpts"in e}const Ee=(e,t)=>wa(e,t,qn);function ku(e,t,n){const s=arguments.length;return s===2?Re(t)&&!Q(t)?Ts(t)?Oe(e,null,[t]):Oe(e,t):Oe(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&Ts(n)&&(n=[n]),Oe(e,t,n))}const Su="3.5.18";let wr;const mo=typeof window!="undefined"&&window.trustedTypes;if(mo)try{wr=mo.createPolicy("vue",{createHTML:e=>e})}catch{}const bo=wr?e=>wr.createHTML(e):e=>e,Eu="http://www.w3.org/2000/svg",Au="http://www.w3.org/1998/Math/MathML",Dt=typeof document!="undefined"?document:null,xo=Dt&&Dt.createElement("template"),Ru={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const r=t==="svg"?Dt.createElementNS(Eu,e):t==="mathml"?Dt.createElementNS(Au,e):n?Dt.createElement(e,{is:n}):Dt.createElement(e);return e==="select"&&s&&s.multiple!=null&&r.setAttribute("multiple",s.multiple),r},createText:e=>Dt.createTextNode(e),createComment:e=>Dt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Dt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,r,i){const o=n?n.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===i||!(r=r.nextSibling)););else{xo.innerHTML=bo(s==="svg"?``:s==="mathml"?``:e);const a=xo.content;if(s==="svg"||s==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Xt="transition",Wn="animation",Gn=Symbol("_vtc"),yo={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Cu=bt({},Fi,yo),Pu=(e=>(e.displayName="Transition",e.props=Cu,e))((e,{slots:t})=>ku(La,Iu(e),t)),an=(e,t=[])=>{Q(e)?e.forEach(n=>n(...t)):e&&e(...t)},wo=e=>e?Q(e)?e.some(t=>t.length>1):e.length>1:!1;function Iu(e){const t={};for(const D in e)D in yo||(t[D]=e[D]);if(e.css===!1)return t;const{name:n="v",type:s,duration:r,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:f=o,appearToClass:u=a,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:g=`${n}-leave-active`,leaveToClass:y=`${n}-leave-to`}=e,E=Mu(r),x=E&&E[0],M=E&&E[1],{onBeforeEnter:m,onEnter:H,onEnterCancelled:Y,onLeave:$,onLeaveCancelled:z,onBeforeAppear:O=m,onAppear:P=H,onAppearCancelled:ee=Y}=t,V=(D,Z,Se,Ue)=>{D._enterCancelled=Ue,un(D,Z?u:a),un(D,Z?f:o),Se&&Se()},se=(D,Z)=>{D._isLeaving=!1,un(D,d),un(D,y),un(D,g),Z&&Z()},fe=D=>(Z,Se)=>{const Ue=D?P:H,te=()=>V(Z,D,Se);an(Ue,[Z,te]),vo(()=>{un(Z,D?l:i),Nt(Z,D?u:a),wo(Ue)||_o(Z,s,x,te)})};return bt(t,{onBeforeEnter(D){an(m,[D]),Nt(D,i),Nt(D,o)},onBeforeAppear(D){an(O,[D]),Nt(D,l),Nt(D,f)},onEnter:fe(!1),onAppear:fe(!0),onLeave(D,Z){D._isLeaving=!0;const Se=()=>se(D,Z);Nt(D,d),D._enterCancelled?(Nt(D,g),So()):(So(),Nt(D,g)),vo(()=>{D._isLeaving&&(un(D,d),Nt(D,y),wo($)||_o(D,s,M,Se))}),an($,[D,Se])},onEnterCancelled(D){V(D,!1,void 0,!0),an(Y,[D])},onAppearCancelled(D){V(D,!0,void 0,!0),an(ee,[D])},onLeaveCancelled(D){se(D),an(z,[D])}})}function Mu(e){if(e==null)return null;if(Re(e))return[vr(e.enter),vr(e.leave)];{const t=vr(e);return[t,t]}}function vr(e){return zl(e)}function Nt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Gn]||(e[Gn]=new Set)).add(t)}function un(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[Gn];n&&(n.delete(t),n.size||(e[Gn]=void 0))}function vo(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Ou=0;function _o(e,t,n,s){const r=e._endId=++Ou,i=()=>{r===e._endId&&s()};if(n!=null)return setTimeout(i,n);const{type:o,timeout:a,propCount:l}=Lu(e,t);if(!o)return s();const f=o+"end";let u=0;const d=()=>{e.removeEventListener(f,g),i()},g=y=>{y.target===e&&++u>=l&&d()};setTimeout(()=>{u(n[E]||"").split(", "),r=s(`${Xt}Delay`),i=s(`${Xt}Duration`),o=To(r,i),a=s(`${Wn}Delay`),l=s(`${Wn}Duration`),f=To(a,l);let u=null,d=0,g=0;t===Xt?o>0&&(u=Xt,d=o,g=i.length):t===Wn?f>0&&(u=Wn,d=f,g=l.length):(d=Math.max(o,f),u=d>0?o>f?Xt:Wn:null,g=u?u===Xt?i.length:l.length:0);const y=u===Xt&&/\b(transform|all)(,|$)/.test(s(`${Xt}Property`).toString());return{type:u,timeout:d,propCount:g,hasTransform:y}}function To(e,t){for(;e.lengthko(n)+ko(e[s])))}function ko(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function So(){return document.body.offsetHeight}function $u(e,t,n){const s=e[Gn];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Eo=Symbol("_vod"),Du=Symbol("_vsh"),Nu=Symbol(""),Fu=/(^|;)\s*display\s*:/;function Bu(e,t,n){const s=e.style,r=Pe(n);let i=!1;if(n&&!r){if(t)if(Pe(t))for(const o of t.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&Rs(s,a,"")}else for(const o in t)n[o]==null&&Rs(s,o,"");for(const o in n)o==="display"&&(i=!0),Rs(s,o,n[o])}else if(r){if(t!==n){const o=s[Nu];o&&(n+=";"+o),s.cssText=n,i=Fu.test(n)}}else t&&e.removeAttribute("style");Eo in e&&(e[Eo]=i?s.display:"",e[Du]&&(s.display="none"))}const Ao=/\s*!important$/;function Rs(e,t,n){if(Q(n))n.forEach(s=>Rs(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=Hu(e,t);Ao.test(n)?e.setProperty(en(s),n.replace(Ao,""),"important"):e[s]=n}}const Ro=["Webkit","Moz","ms"],_r={};function Hu(e,t){const n=_r[t];if(n)return n;let s=jt(t);if(s!=="filter"&&s in e)return _r[t]=s;s=ri(s);for(let r=0;rTr||(Vu.then(()=>Tr=0),Tr=Date.now());function Wu(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;Tt(Gu(s,n.value),t,5,[s])};return n.value=e,n.attached=qu(),n}function Gu(e,t){if(Q(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(s=>r=>!r._stopped&&s&&s(r))}else return t}const Lo=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Ku=(e,t,n,s,r,i)=>{const o=r==="svg";t==="class"?$u(e,s,o):t==="style"?Bu(e,n,s):ts(t)?Hs(t)||Uu(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Yu(e,t,s,o))?(Io(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Po(e,t,s,o,i,t!=="value")):e._isVueCE&&(/[A-Z]/.test(t)||!Pe(s))?Io(e,jt(t),s,i,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),Po(e,t,s,o))};function Yu(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Lo(t)&&be(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Lo(t)&&Pe(n)?!1:t in e}const $o=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Q(t)?n=>rs(t,n):t};function Zu(e){e.target.composing=!0}function Do(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const kr=Symbol("_assign"),Xu={created(e,{modifiers:{lazy:t,trim:n,number:s}},r){e[kr]=$o(r);const i=s||r.props&&r.props.type==="number";vn(e,t?"change":"input",o=>{if(o.target.composing)return;let a=e.value;n&&(a=a.trim()),i&&(a=Vs(a)),e[kr](a)}),n&&vn(e,"change",()=>{e.value=e.value.trim()}),t||(vn(e,"compositionstart",Zu),vn(e,"compositionend",Do),vn(e,"change",Do))},mounted(e,{value:t}){e.value=t==null?"":t},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:r,number:i}},o){if(e[kr]=$o(o),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?Vs(e.value):e.value,l=t==null?"":t;a!==l&&(document.activeElement===e&&e.type!=="range"&&(s&&t===n||r&&e.value.trim()===l)||(e.value=l))}},Qu=["ctrl","shift","alt","meta"],Ju={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Qu.some(n=>e[`${n}Key`]&&!t.includes(n))},pt=(e,t)=>{const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=(r,...i)=>{for(let o=0;o{const t=tc().createApp(...e),{mount:n}=t;return t.mount=s=>{const r=rc(s);if(!r)return;const i=t._component;!be(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=n(r,!1,sc(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t};function sc(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function rc(e){return Pe(e)?document.querySelector(e):e}const ic=["aria-pressed"],oc={key:0,viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":"true"},lc={key:1,viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",fill:"none"},ac={__name:"ChatbotToggler",props:{isOpen:{type:Boolean,required:!0}},emits:["toggle"],setup(e){return(t,n)=>(F(),W("button",{class:"fixed bottom-5 right-5 z-9999 grid h-12 w-12 appearance-none place-items-center rounded-full border border-white/20 bg-gradient-to-br from-brand-500 to-brand-600 text-white shadow-[0_20px_36px_-20px_rgba(109,79,194,0.85)] transition-all duration-250 hover:-translate-y-0.5 hover:from-brand-600 hover:to-violet-700 hover:shadow-[0_22px_40px_-22px_rgba(109,79,194,1)] focus:outline-none max-[600px]:bottom-3 max-[600px]:right-3 max-[600px]:h-13 max-[600px]:w-13",style:{"border-radius":"9999px"},"aria-pressed":e.isOpen?"true":"false",onClick:n[0]||(n[0]=s=>t.$emit("toggle"))},[e.isOpen?(F(),W("svg",lc,n[2]||(n[2]=[w("path",{d:"M6 6l12 12M18 6L6 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)]))):(F(),W("svg",oc,n[1]||(n[1]=[w("path",{d:"M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H8l-4 4v-4H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z",fill:"currentColor",stroke:"currentColor","stroke-width":"2","stroke-linecap":"miter","stroke-linejoin":"miter"},null,-1)])))],8,ic))}},uc={class:"chat-header relative flex min-h-14 items-center justify-between px-4 pb-2.5 pt-3 text-white sm:px-5"},cc={class:"flex min-w-0 flex-1 items-center gap-2 sm:gap-2.5"},fc={xmlns:"http://www.w3.org/2000/svg",width:"35",height:"35",viewBox:"0 0 1024 1024",class:"h-8 w-8 shrink-0 rounded-full bg-white p-1.5 shadow-md motion-safe:animate-soft-float",style:{fill:"#6d4fc2"}},pc={class:"ml-2 flex items-center gap-1.5"},dc=["title"],hc=["title","aria-label"],gc={key:0,viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},mc={key:1,viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},bc=["title","aria-label"],xc={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},yc={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},wc={key:2,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},vc={__name:"ChatHeader",props:{windowMode:{type:String,required:!0},autoReadEnabled:{type:Boolean,required:!0},activeTtsProvider:{type:String,required:!0}},emits:["close","cycleResize","toggleAutoRead"],setup(e){const t=e,n={default:"Compact",half:"Half Screen",full:"Full Screen"},s=Ee(()=>n[t.windowMode]||"Compact"),r=Ee(()=>t.windowMode==="default"?"Half Screen":t.windowMode==="half"?"Full Screen":"Compact"),i=Ee(()=>t.activeTtsProvider==="polly"?"TTS: Polly":t.activeTtsProvider==="browser"?"TTS: Browser":"TTS: Off"),o=Ee(()=>t.activeTtsProvider==="polly"?"bg-emerald-500/45":t.activeTtsProvider==="browser"?"bg-amber-500/45":"bg-slate-500/35");return(a,l)=>(F(),W("div",uc,[w("div",cc,[(F(),W("svg",fc,l[3]||(l[3]=[w("path",{d:"M738.3 287.6H285.7c-59 0-106.8 47.8-106.8 106.8v303.1c0 59 47.8 106.8 106.8 106.8h81.5v111.1c0 .7.8 1.1 1.4.7l166.9-110.6 41.8-.8h117.4l43.6-.4c59 0 106.8-47.8 106.8-106.8V394.5c0-59-47.8-106.9-106.8-106.9zM351.7 448.2c0-29.5 23.9-53.5 53.5-53.5s53.5 23.9 53.5 53.5-23.9 53.5-53.5 53.5-53.5-23.9-53.5-53.5zm157.9 267.1c-67.8 0-123.8-47.5-132.3-109h264.6c-8.6 61.5-64.5 109-132.3 109zm110-213.7c-29.5 0-53.5-23.9-53.5-53.5s23.9-53.5 53.5-53.5 53.5 23.9 53.5 53.5-23.9 53.5-53.5 53.5zM867.2 644.5V453.1h26.5c19.4 0 35.1 15.7 35.1 35.1v121.1c0 19.4-15.7 35.1-35.1 35.1h-26.5zM95.2 609.4V488.2c0-19.4 15.7-35.1 35.1-35.1h26.5v191.3h-26.5c-19.4 0-35.1-15.7-35.1-35.1zM561.5 149.6c0 23.4-15.6 43.3-36.9 49.7v44.9h-30v-44.9c-21.4-6.5-36.9-26.3-36.9-49.7 0-28.6 23.3-51.9 51.9-51.9s51.9 23.3 51.9 51.9z"},null,-1)]))),l[4]||(l[4]=w("h2",{class:"truncate text-xs font-semibold tracking-[0.01em] sm:text-base text-white/95"},"ChangAI from ERPGulf",-1))]),w("div",pc,[w("span",{class:we(["hidden rounded-full border border-white/25 px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-white/95 shadow-sm backdrop-blur-sm sm:inline",o.value]),title:`TTS provider: ${i.value}`},Je(i.value),11,dc),w("button",{class:we(["h-8 min-w-8 appearance-none items-center justify-center rounded-md border border-white/20 px-2 text-xs font-semibold text-white/90 transition-all duration-200 focus:outline-none sm:flex",e.autoReadEnabled?"bg-white/24 shadow-sm":"hover:bg-white/15"]),style:{"border-radius":"0.375rem"},title:e.autoReadEnabled?"Auto speech on":"Auto speech off","aria-label":e.autoReadEnabled?"Turn off auto speech":"Turn on auto speech",onClick:l[0]||(l[0]=f=>a.$emit("toggleAutoRead"))},[e.autoReadEnabled?(F(),W("svg",gc,l[5]||(l[5]=[w("path",{d:"M11 5L6 9H3v6h3l5 4V5z"},null,-1),w("path",{d:"M15 9a4 4 0 0 1 0 6"},null,-1),w("path",{d:"M18 7a7 7 0 0 1 0 10"},null,-1)]))):(F(),W("svg",mc,l[6]||(l[6]=[w("path",{d:"M11 5L6 9H3v6h3l5 4V5z"},null,-1),w("path",{d:"M22 9l-6 6"},null,-1),w("path",{d:"M16 9l6 6"},null,-1)])))],10,hc),w("button",{class:we(["flex h-8 min-w-8 appearance-none items-center justify-center rounded-md border border-white/20 px-2 text-xs font-semibold text-white/90 transition-all duration-200 focus:outline-none","bg-white/20 shadow-sm hover:bg-white/25"]),style:{"border-radius":"0.375rem"},title:`Resize mode: ${s.value} (click to ${r.value})`,"aria-label":`Resize mode ${s.value}. Click to switch to ${r.value}`,onClick:l[1]||(l[1]=f=>a.$emit("cycleResize"))},[e.windowMode==="default"?(F(),W("svg",xc,l[7]||(l[7]=[w("rect",{x:"7",y:"8",width:"10",height:"8",rx:"2"},null,-1)]))):e.windowMode==="half"?(F(),W("svg",yc,l[8]||(l[8]=[w("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"},null,-1),w("path",{d:"M12 5v14"},null,-1)]))):(F(),W("svg",wc,l[9]||(l[9]=[w("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"},null,-1),w("path",{d:"M8 8H6v2M16 8h2v2M8 16H6v-2M16 16h2v-2"},null,-1)])))],8,bc),w("button",{class:"grid h-8 w-8 shrink-0 appearance-none place-items-center rounded-full border border-white/20 text-white transition-all duration-200 hover:scale-105 hover:bg-white/20 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/70",style:{"border-radius":"9999px"},"aria-label":"Close chatbot",onClick:l[2]||(l[2]=f=>a.$emit("close"))},l[10]||(l[10]=[w("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",width:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[w("path",{d:"M6 9l6 6 6-6"})],-1)]))])]))}},_c={class:"flex gap-1.5 border-b border-slate-200/80 px-2.5 pb-2.5 pt-1"},Tc=["onClick"],kc={class:"inline-flex items-center gap-1.5"},Sc={__name:"TabBar",props:{modelValue:{type:String,required:!0},debugEnabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e){const t=e,n=Ee(()=>{const s=[{id:"chat",label:"Chats"},{id:"debug",label:"Debug"},{id:"support",label:"Support"},{id:"settings",label:"Settings"}];return t.debugEnabled?s:s.filter(r=>r.id!=="debug")});return(s,r)=>(F(),W("div",_c,[(F(!0),W(He,null,ws(n.value,i=>(F(),W("button",{key:i.id,class:we(["group min-w-0 flex-1 h-9 appearance-none rounded-lg border border-transparent bg-transparent px-2 text-xs font-semibold transition-all duration-200 focus:outline-none",e.modelValue===i.id?"border-white/30 bg-linear-to-r from-violet-300/36 via-indigo-300/30 to-sky-300/28 text-white shadow-[0_4px_10px_rgba(20,24,40,0.22)]":"text-white/80 hover:border-white/25 hover:bg-white/12 hover:text-white"]),onClick:o=>s.$emit("update:modelValue",i.id)},[w("span",kc,[w("span",{class:we(["h-1.5 w-1.5 rounded-full transition-colors duration-200",e.modelValue===i.id?"bg-white":"bg-white/40 group-hover:bg-white/70"])},null,2),Ss(" "+Je(i.label),1)])],10,Tc))),128))]))}},Ec=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},Ac={},Rc={xmlns:"http://www.w3.org/2000/svg",width:"50",height:"50",viewBox:"0 0 1024 1024",class:"h-7.5 w-7.5 shrink-0 self-end rounded-full bg-gradient-to-br from-brand-500 to-brand-600 p-1.5 fill-white shadow-[0_10px_18px_-12px_rgba(109,79,194,0.85)]"};function Cc(e,t){return F(),W("svg",Rc,t[0]||(t[0]=[w("path",{d:"M738.3 287.6H285.7c-59 0-106.8 47.8-106.8 106.8v303.1c0 59 47.8 106.8 106.8 106.8h81.5v111.1c0 .7.8 1.1 1.4.7l166.9-110.6 41.8-.8h117.4l43.6-.4c59 0 106.8-47.8 106.8-106.8V394.5c0-59-47.8-106.9-106.8-106.9zM351.7 448.2c0-29.5 23.9-53.5 53.5-53.5s53.5 23.9 53.5 53.5-23.9 53.5-53.5 53.5-53.5-23.9-53.5-53.5zm157.9 267.1c-67.8 0-123.8-47.5-132.3-109h264.6c-8.6 61.5-64.5 109-132.3 109zm110-213.7c-29.5 0-53.5-23.9-53.5-53.5s23.9-53.5 53.5-53.5 53.5 23.9 53.5 53.5-23.9 53.5-53.5 53.5zM867.2 644.5V453.1h26.5c19.4 0 35.1 15.7 35.1 35.1v121.1c0 19.4-15.7 35.1-35.1 35.1h-26.5zM95.2 609.4V488.2c0-19.4 15.7-35.1 35.1-35.1h26.5v191.3h-26.5c-19.4 0-35.1-15.7-35.1-35.1zM561.5 149.6c0 23.4-15.6 43.3-36.9 49.7v44.9h-30v-44.9c-21.4-6.5-36.9-26.3-36.9-49.7 0-28.6 23.3-51.9 51.9-51.9s51.9 23.3 51.9 51.9z"},null,-1)]))}const Fo=Ec(Ac,[["render",Cc]]),Cs={PIPELINE:"changai.changai.api.v2.text2sql_pipeline_v2.run_text2sql_pipeline",SUPPORT:"changai.changai.api.v2.text2sql_pipeline_v2.support_bot",SETTINGS:"changai.changai.api.v2.text2sql_pipeline_v2.get_frontend_settings",TTS:"changai.changai.api.v2.text2sql_pipeline_v2.synthesize_tts"};function Bo(e,t={},n="actual"){return n==="test"?Promise.resolve({Bot:`[TEST MODE] ${JSON.stringify(t)}`}):!window.frappe||!window.frappe.call?Promise.reject(new Error("Frappe API is unavailable in actual mode.")):new Promise((s,r)=>{window.frappe.call({method:e,args:t,callback(i){s(i.message)},error(i){r(i)}})})}function Pc(e,t,n="actual",s=null,r){if(n==="test")return{promise:Promise.resolve({Bot:`[TEST MODE] ${JSON.stringify({user_question:e,chat_id:t,request_id:s,sendNonErptoAI:r})}`}),cancel:()=>!1};if(!window.frappe||!window.frappe.call)return{promise:Promise.reject(new Error("Frappe API is unavailable in actual mode.")),cancel:()=>!1};let i=null,o=!1;return{promise:new Promise((f,u)=>{i=window.frappe.call({method:Cs.PIPELINE,args:{user_question:e,chat_id:t,request_id:s,sendNonErptoAI:r},callback(d){o=!0,f(d.message)},error(d){o=!0,u(d)}})}),cancel:()=>o||!i||typeof i.abort!="function"?!1:(i.abort(),o=!0,!0)}}function Ic(e,t="actual"){if(t==="test")return{promise:Promise.resolve(`[TEST MODE] ${JSON.stringify({message:e})}`),cancel:()=>!1};if(!window.frappe||!window.frappe.call)return{promise:Promise.reject(new Error("Frappe API is unavailable in actual mode.")),cancel:()=>!1};let n=null,s=!1;return{promise:new Promise((o,a)=>{n=window.frappe.call({method:Cs.SUPPORT,args:{message:e},callback(l){s=!0,o(l.message)},error(l){s=!0,a(l)}})}),cancel:()=>s||!n||typeof n.abort!="function"?!1:(n.abort(),s=!0,!0)}}function Mc(e="actual"){return Bo(Cs.SETTINGS,{},e)}function Oc(e,t="Zayd",n="actual"){return Bo(Cs.TTS,{text:e,voice_id:t},n)}function Sr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var cn=Sr();function Ho(e){cn=e}var fn={exec:()=>null};function le(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(r,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(We.caret,"$1"),n=n.replace(r,o),s},getRegex:()=>new RegExp(n,t)};return s}var Lc=((e="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},$c=/^(?:[ \t]*(?:\n|$))+/,Dc=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Nc=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Kn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Fc=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Er=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,zo=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Uo=le(zo).replace(/bull/g,Er).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Bc=le(zo).replace(/bull/g,Er).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ar=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Hc=/^[^\n]+/,Rr=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,zc=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Rr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Uc=le(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Er).getRegex(),Ps="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Cr=/|$))/,jc=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Cr).replace("tag",Ps).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),jo=le(Ar).replace("hr",Kn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ps).getRegex(),Vc=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",jo).getRegex(),Pr={blockquote:Vc,code:Dc,def:zc,fences:Nc,heading:Fc,hr:Kn,html:jc,lheading:Uo,list:Uc,newline:$c,paragraph:jo,table:fn,text:Hc},Vo=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Kn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ps).getRegex(),qc={...Pr,lheading:Bc,table:Vo,paragraph:le(Ar).replace("hr",Kn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Vo).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ps).getRegex()},Wc={...Pr,html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Cr).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:fn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(Ar).replace("hr",Kn).replace("heading",` *#{1,6} *[^
+]`).replace("lheading",Uo).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Gc=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Kc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qo=/^( {2,}|\\)\n(?!\s*$)/,Yc=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Lc?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Go=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ef=le(Go,"u").replace(/punct/g,_n).getRegex(),tf=le(Go,"u").replace(/punct/g,Wo).getRegex(),Ko="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",nf=le(Ko,"gu").replace(/notPunctSpace/g,Ir).replace(/punctSpace/g,Is).replace(/punct/g,_n).getRegex(),sf=le(Ko,"gu").replace(/notPunctSpace/g,Qc).replace(/punctSpace/g,Xc).replace(/punct/g,Wo).getRegex(),rf=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ir).replace(/punctSpace/g,Is).replace(/punct/g,_n).getRegex(),of=le(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,_n).getRegex(),lf="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",af=le(lf,"gu").replace(/notPunctSpace/g,Ir).replace(/punctSpace/g,Is).replace(/punct/g,_n).getRegex(),uf=le(/\\(punct)/,"gu").replace(/punct/g,_n).getRegex(),cf=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ff=le(Cr).replace("(?:-->|$)","-->").getRegex(),pf=le("^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",ff).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ms=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,df=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Ms).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Yo=le(/^!?\[(label)\]\[(ref)\]/).replace("label",Ms).replace("ref",Rr).getRegex(),Zo=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Rr).getRegex(),hf=le("reflink|nolink(?!\\()","g").replace("reflink",Yo).replace("nolink",Zo).getRegex(),Xo=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Mr={_backpedal:fn,anyPunctuation:uf,autolink:cf,blockSkip:Jc,br:qo,code:Kc,del:fn,delLDelim:fn,delRDelim:fn,emStrongLDelim:ef,emStrongRDelimAst:nf,emStrongRDelimUnd:rf,escape:Gc,link:df,nolink:Zo,punctuation:Zc,reflink:Yo,reflinkSearch:hf,tag:pf,text:Yc,url:fn},gf={...Mr,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",Ms).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ms).getRegex()},Or={...Mr,emStrongRDelimAst:sf,emStrongLDelim:tf,delLDelim:of,delRDelim:af,url:le(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Xo).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:le(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Qo=e=>bf[e];function Ct(e,t){if(t){if(We.escapeTest.test(e))return e.replace(We.escapeReplace,Qo)}else if(We.escapeTestNoEncode.test(e))return e.replace(We.escapeReplaceNoEncode,Qo);return e}function Jo(e){try{e=encodeURI(e).replace(We.percentDecode,"%")}catch{return null}return e}function el(e,t){var i;let n=e.replace(We.findPipe,(o,a,l)=>{let f=!1,u=a;for(;--u>=0&&l[u]==="\\";)f=!f;return f?"|":" |"}),s=n.split(We.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!((i=s.at(-1))!=null&&i.trim())&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length=0&&We.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
`)}function xf(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s0?-2:-1}function yf(e,t=0){let n=t,s="";for(let r of e)if(r===" "){let i=4-n%4;s+=" ".repeat(i),n+=i}else s+=r,n++;return s}function nl(e,t,n,s,r){let i=t.href,o=t.title||null,a=e[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function wf(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let r=s[1];return t.split(`
`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[a]=o;return a.length>=r.length?i.slice(r.length):i}).join(`
-`)}var Ls=class{constructor(e){we(this,"options");we(this,"rules");we(this,"lexer");this.options=e||un}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:tl(t[0]),s=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:s}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=wf(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=Xt(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:Xt(t[0],`
-`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Xt(t[0],`
-`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Xt(t[0],`
+`)}var Ls=class{constructor(e){_e(this,"options");_e(this,"rules");_e(this,"lexer");this.options=e||cn}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:tl(t[0]),s=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:s}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],s=wf(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let s=Qt(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:Qt(t[0],`
+`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Qt(t[0],`
+`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Qt(t[0],`
`).split(`
-`),s="",r="",i=[];for(;n.length>0;){let o=!1,a=[],l;for(l=0;l0;){let o=!1,a=[],l;for(l=0;l1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let i=this.rules.other.listItemRegex(n),o=!1;for(;e;){let l=!1,c="",u="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let p=yf(t[2].split(`
+`),x=this.list(E);i[i.length-1]=x,s=s.substring(0,s.length-g.raw.length)+x.raw,r=r.substring(0,r.length-y.raw.length)+x.raw,n=E.substring(i.at(-1).raw.length).split(`
+`);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let i=this.rules.other.listItemRegex(n),o=!1;for(;e;){let l=!1,f="",u="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let d=yf(t[2].split(`
`,1)[0],t[1].length),g=e.split(`
-`,1)[0],w=!p.trim(),E=0;if(this.options.pedantic?(E=2,u=p.trimStart()):w?E=t[1].length+1:(E=p.search(this.rules.other.nonSpaceChar),E=E>4?1:E,u=p.slice(E),E+=t[1].length),w&&this.rules.other.blankLine.test(g)&&(c+=g+`
-`,e=e.substring(g.length+1),l=!0),!l){let m=this.rules.other.nextBulletRegex(E),A=this.rules.other.hrRegex(E),T=this.rules.other.fencesBeginRegex(E),W=this.rules.other.headingBeginRegex(E),K=this.rules.other.htmlBeginRegex(E),O=this.rules.other.blockquoteBeginRegex(E);for(;e;){let z=e.split(`
-`,1)[0],P;if(g=z,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),P=g):P=g.replace(this.rules.other.tabCharGlobal," "),T.test(g)||W.test(g)||K.test(g)||O.test(g)||m.test(g)||A.test(g))break;if(P.search(this.rules.other.nonSpaceChar)>=E||!g.trim())u+=`
-`+P.slice(E);else{if(w||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||T.test(p)||W.test(p)||A.test(p))break;u+=`
-`+g}w=!g.trim(),c+=z+`
-`,e=e.substring(z.length+1),p=P.slice(E)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),r.raw+=c}let a=r.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items){this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]);let c=l.tokens[0];if(l.task&&((c==null?void 0:c.type)==="text"||(c==null?void 0:c.type)==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let p=this.lexer.inlineQueue.length-1;p>=0;p--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)){this.lexer.inlineQueue[p].src=this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask,"");break}let u=this.rules.other.listTaskCheckbox.exec(l.raw);if(u){let p={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};l.checked=p.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=p.raw+l.tokens[0].raw,l.tokens[0].text=p.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(p)):l.tokens.unshift({type:"paragraph",raw:p.raw,text:p.raw,tokens:[p]}):l.tokens.unshift(p)}}else l.task&&(l.task=!1);if(!r.loose){let u=l.tokens.filter(g=>g.type==="space"),p=u.length>0&&u.some(g=>this.rules.other.anyLine.test(g.raw));r.loose=p}}if(r.loose)for(let l of r.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=tl(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:Xt(t[0],`
+`,1)[0],y=!d.trim(),E=0;if(this.options.pedantic?(E=2,u=d.trimStart()):y?E=t[1].length+1:(E=d.search(this.rules.other.nonSpaceChar),E=E>4?1:E,u=d.slice(E),E+=t[1].length),y&&this.rules.other.blankLine.test(g)&&(f+=g+`
+`,e=e.substring(g.length+1),l=!0),!l){let x=this.rules.other.nextBulletRegex(E),M=this.rules.other.hrRegex(E),m=this.rules.other.fencesBeginRegex(E),H=this.rules.other.headingBeginRegex(E),Y=this.rules.other.htmlBeginRegex(E),$=this.rules.other.blockquoteBeginRegex(E);for(;e;){let z=e.split(`
+`,1)[0],O;if(g=z,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),O=g):O=g.replace(this.rules.other.tabCharGlobal," "),m.test(g)||H.test(g)||Y.test(g)||$.test(g)||x.test(g)||M.test(g))break;if(O.search(this.rules.other.nonSpaceChar)>=E||!g.trim())u+=`
+`+O.slice(E);else{if(y||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||m.test(d)||H.test(d)||M.test(d))break;u+=`
+`+g}y=!g.trim(),f+=z+`
+`,e=e.substring(z.length+1),d=O.slice(E)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(o=!0)),r.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),r.raw+=f}let a=r.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items){this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]);let f=l.tokens[0];if(l.task&&((f==null?void 0:f.type)==="text"||(f==null?void 0:f.type)==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),f.raw=f.raw.replace(this.rules.other.listReplaceTask,""),f.text=f.text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let u=this.rules.other.listTaskCheckbox.exec(l.raw);if(u){let d={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};l.checked=d.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=d.raw+l.tokens[0].raw,l.tokens[0].text=d.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(d)):l.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):l.tokens.unshift(d)}}else l.task&&(l.task=!1);if(!r.loose){let u=l.tokens.filter(g=>g.type==="space"),d=u.length>0&&u.some(g=>this.rules.other.anyLine.test(g.raw));r.loose=d}}if(r.loose)for(let l of r.items){l.loose=!0;for(let f of l.tokens)f.type==="text"&&(f.type="paragraph")}return r}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=tl(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:Qt(t[0],`
`),href:s,title:r}}}table(e){var o;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=el(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
-`):[],i={type:"table",raw:Xt(t[0],`
-`),header:[],align:[],rows:[]};if(n.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:Xt(t[0],`
+`):[],i={type:"table",raw:Qt(t[0],`
+`),header:[],align:[],rows:[]};if(n.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[f]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:Qt(t[0],`
`),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
-`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Xt(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=xf(t[2],"()");if(i===-2)return;if(i>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let s=t[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],r=i[3])}else r=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),nl(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[s.toLowerCase()];if(!r){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return nl(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!n||this.rules.inline.punctuation.exec(n))){let r=[...s[0]].length-1,i,o,a=r,l=0,c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+r);(s=c.exec(t))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(o=[...i].length,s[3]||s[4]){a+=o;continue}else if((s[5]||s[6])&&r%3&&!((r+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...s[0]][0].length,p=e.slice(0,r+s.index+u+o);if(Math.min(r,o)%2){let w=p.slice(1,-1);return{type:"em",raw:p,text:w,tokens:this.lexer.inlineTokens(w)}}let g=p.slice(2,-2);return{type:"strong",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let s=this.rules.inline.delLDelim.exec(e);if(s&&(!s[1]||!n||this.rules.inline.punctuation.exec(n))){let r=[...s[0]].length-1,i,o,a=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+r);(s=l.exec(t))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(o=[...i].length,o!==r))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...s[0]][0].length,u=e.slice(0,r+s.index+c+o),p=u.slice(r,-r);return{type:"del",raw:u,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,s;let t;if(t=this.rules.inline.url.exec(e)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let o;do o=t[0],t[0]=(s=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?s:"";while(o!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},mt=class Qr{constructor(t){we(this,"tokens");we(this,"options");we(this,"state");we(this,"inlineQueue");we(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||un,this.options.tokenizer=this.options.tokenizer||new Ls,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:qe,block:Ms.normal,inline:Kn.normal};this.options.pedantic?(n.block=Ms.pedantic,n.inline=Kn.pedantic):this.options.gfm&&(n.block=Ms.gfm,this.options.breaks?n.inline=Kn.breaks:n.inline=Kn.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ms,inline:Kn}}static lex(t,n){return new Qr(n).lex(t)}static lexInline(t,n){return new Qr(n).inlineTokens(t)}lex(t){t=t.replace(qe.carriageReturn,`
-`),this.blockTokens(t,this.tokens);for(let n=0;n(l=u.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let u=n.at(-1);l.raw.length===1&&u!==void 0?u.raw+=`
+`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Qt(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=xf(t[2],"()");if(i===-2)return;if(i>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let s=t[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],r=i[3])}else r=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),nl(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[s.toLowerCase()];if(!r){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return nl(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!n||this.rules.inline.punctuation.exec(n))){let r=[...s[0]].length-1,i,o,a=r,l=0,f=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+r);(s=f.exec(t))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(o=[...i].length,s[3]||s[4]){a+=o;continue}else if((s[5]||s[6])&&r%3&&!((r+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...s[0]][0].length,d=e.slice(0,r+s.index+u+o);if(Math.min(r,o)%2){let y=d.slice(1,-1);return{type:"em",raw:d,text:y,tokens:this.lexer.inlineTokens(y)}}let g=d.slice(2,-2);return{type:"strong",raw:d,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let s=this.rules.inline.delLDelim.exec(e);if(s&&(!s[1]||!n||this.rules.inline.punctuation.exec(n))){let r=[...s[0]].length-1,i,o,a=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+r);(s=l.exec(t))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(o=[...i].length,o!==r))continue;if(s[3]||s[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let f=[...s[0]][0].length,u=e.slice(0,r+s.index+f+o),d=u.slice(r,-r);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,s;let t;if(t=this.rules.inline.url.exec(e)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let o;do o=t[0],t[0]=(s=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?s:"";while(o!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},yt=class Xr{constructor(t){_e(this,"tokens");_e(this,"options");_e(this,"state");_e(this,"inlineQueue");_e(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||cn,this.options.tokenizer=this.options.tokenizer||new Ls,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:We,block:Os.normal,inline:Yn.normal};this.options.pedantic?(n.block=Os.pedantic,n.inline=Yn.pedantic):this.options.gfm&&(n.block=Os.gfm,this.options.breaks?n.inline=Yn.breaks:n.inline=Yn.gfm),this.tokenizer.rules=n}static get rules(){return{block:Os,inline:Yn}}static lex(t,n){return new Xr(n).lex(t)}static lexInline(t,n){return new Xr(n).inlineTokens(t)}lex(t){t=t.replace(We.carriageReturn,`
+`),this.blockTokens(t,this.tokens);for(let n=0;n(l=u.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let u=n.at(-1);l.raw.length===1&&u!==void 0?u.raw+=`
`:n.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
`)?"":`
`)+l.raw,u.text+=`
`+l.text,this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
`)?"":`
`)+l.raw,u.text+=`
-`+l.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},n.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),n.push(l);continue}let c=t;if((a=this.options.extensions)!=null&&a.startBlock){let u=1/0,p=t.slice(1),g;this.options.extensions.startBlock.forEach(w=>{g=w.call({lexer:this},p),typeof g=="number"&&g>=0&&(u=Math.min(u,g))}),u<1/0&&u>=0&&(c=t.substring(0,u+1))}if(this.state.top&&(l=this.tokenizer.paragraph(c))){let u=n.at(-1);s&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
+`+l.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},n.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),n.push(l);continue}let f=t;if((a=this.options.extensions)!=null&&a.startBlock){let u=1/0,d=t.slice(1),g;this.options.extensions.startBlock.forEach(y=>{g=y.call({lexer:this},d),typeof g=="number"&&g>=0&&(u=Math.min(u,g))}),u<1/0&&u>=0&&(f=t.substring(0,u+1))}if(this.state.top&&(l=this.tokenizer.paragraph(f))){let u=n.at(-1);s&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
`)?"":`
`)+l.raw,u.text+=`
-`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l),s=c.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
+`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l),s=f.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
`)?"":`
`)+l.raw,u.text+=`
-`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var c,u,p,g,w,E;this.tokenizer.lexer=this;let s=t,r=null;if(this.tokens.links){let m=Object.keys(this.tokens.links);if(m.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)m.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,r.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)i=r[2]?r[2].length:0,s=s.slice(0,r.index+i)+"["+"a".repeat(r[0].length-i-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=(p=(u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},s))!=null?p:s;let o=!1,a="",l=1/0;for(;t;){if(t.length(m=T.call({lexer:this},t,n))?(t=t.substring(m.raw.length),n.push(m),!0):!1))continue;if(m=this.tokenizer.escape(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.tag(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.link(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(m.raw.length);let T=n.at(-1);m.type==="text"&&(T==null?void 0:T.type)==="text"?(T.raw+=m.raw,T.text+=m.text):n.push(m);continue}if(m=this.tokenizer.emStrong(t,s,a)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.codespan(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.br(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.del(t,s,a)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.autolink(t)){t=t.substring(m.raw.length),n.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(t))){t=t.substring(m.raw.length),n.push(m);continue}let A=t;if((E=this.options.extensions)!=null&&E.startInline){let T=1/0,W=t.slice(1),K;this.options.extensions.startInline.forEach(O=>{K=O.call({lexer:this},W),typeof K=="number"&&K>=0&&(T=Math.min(T,K))}),T<1/0&&T>=0&&(A=t.substring(0,T+1))}if(m=this.tokenizer.inlineText(A)){t=t.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(a=m.raw.slice(-1)),o=!0;let T=n.at(-1);(T==null?void 0:T.type)==="text"?(T.raw+=m.raw,T.text+=m.text):n.push(m);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(!this.options.silent)throw new Error(n)}},Os=class{constructor(e){we(this,"options");we(this,"parser");this.options=e||un}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let s=(i=(t||"").match(qe.notSpaceStart))==null?void 0:i[0],r=e.replace(qe.endingNewline,"")+`
-`;return s?''+(n?r:Rt(r,!0))+`
-`:""+(n?r:Rt(r,!0))+`
+`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var f,u,d,g,y,E;this.tokenizer.lexer=this;let s=t,r=null;if(this.tokens.links){let x=Object.keys(this.tokens.links);if(x.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)x.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,r.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)i=r[2]?r[2].length:0,s=s.slice(0,r.index+i)+"["+"a".repeat(r[0].length-i-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=(d=(u=(f=this.options.hooks)==null?void 0:f.emStrongMask)==null?void 0:u.call({lexer:this},s))!=null?d:s;let o=!1,a="",l=1/0;for(;t;){if(t.length(x=m.call({lexer:this},t,n))?(t=t.substring(x.raw.length),n.push(x),!0):!1))continue;if(x=this.tokenizer.escape(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.tag(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.link(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(x.raw.length);let m=n.at(-1);x.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=x.raw,m.text+=x.text):n.push(x);continue}if(x=this.tokenizer.emStrong(t,s,a)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.codespan(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.br(t)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.del(t,s,a)){t=t.substring(x.raw.length),n.push(x);continue}if(x=this.tokenizer.autolink(t)){t=t.substring(x.raw.length),n.push(x);continue}if(!this.state.inLink&&(x=this.tokenizer.url(t))){t=t.substring(x.raw.length),n.push(x);continue}let M=t;if((E=this.options.extensions)!=null&&E.startInline){let m=1/0,H=t.slice(1),Y;this.options.extensions.startInline.forEach($=>{Y=$.call({lexer:this},H),typeof Y=="number"&&Y>=0&&(m=Math.min(m,Y))}),m<1/0&&m>=0&&(M=t.substring(0,m+1))}if(x=this.tokenizer.inlineText(M)){t=t.substring(x.raw.length),x.raw.slice(-1)!=="_"&&(a=x.raw.slice(-1)),o=!0;let m=n.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=x.raw,m.text+=x.text):n.push(x);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(!this.options.silent)throw new Error(n)}},$s=class{constructor(e){_e(this,"options");_e(this,"parser");this.options=e||cn}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let s=(i=(t||"").match(We.notSpaceStart))==null?void 0:i[0],r=e.replace(We.endingNewline,"")+`
+`;return s?''+(n?r:Ct(r,!0))+`
+`:""+(n?r:Ct(r,!0))+`
`}blockquote({tokens:e}){return`
${this.parser.parse(e)}
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)}
@@ -63,7 +63,7 @@ ${this.parser.parse(e)}
`}tablerow({text:e}){return`
${e}
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`${n}>
-`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Rt(e,!0)}`}br(e){return"
"}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),r=Jo(e);if(r===null)return s;e=r;let i='"+s+"",i}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let r=Jo(e);if(r===null)return Rt(n);e=r;let i=`
",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Rt(e.text)}},Or=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},bt=class Jr{constructor(t){we(this,"options");we(this,"renderer");we(this,"textRenderer");this.options=t||un,this.options.renderer=this.options.renderer||new Os,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Or}static parse(t,n){return new Jr(n).parse(t)}static parseInline(t,n){return new Jr(n).parseInline(t)}parse(t){var s,r;this.renderer.parser=this;let n="";for(let i=0;i{let l=o[a].flat(1/0);n=n.concat(this.walkTokens(l,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=t.renderers[r.name];i?t.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[r.level];i?i.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),s.extensions=t),n.renderer){let r=this.defaults.renderer||new Os(this.defaults);for(let i in n.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,a=n.renderer[o],l=r[o];r[o]=(...c)=>{let u=a.apply(r,c);return u===!1&&(u=l.apply(r,c)),u||""}}s.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new Ls(this.defaults);for(let i in n.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,a=n.tokenizer[o],l=r[o];r[o]=(...c)=>{let u=a.apply(r,c);return u===!1&&(u=l.apply(r,c)),u}}s.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new Yn;for(let i in n.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,a=n.hooks[o],l=r[o];Yn.passThroughHooks.has(i)?r[o]=c=>{if(this.defaults.async&&Yn.passThroughHooksRespectAsync.has(i))return(async()=>{let p=await a.call(r,c);return l.call(r,p)})();let u=a.call(r,c);return l.call(r,u)}:r[o]=(...c)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(r,c);return p===!1&&(p=await l.apply(r,c)),p})();let u=a.apply(r,c);return u===!1&&(u=l.apply(r,c)),u}}s.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,i=n.walkTokens;s.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return mt.lex(e,t!=null?t:this.defaults)}parser(e,t){return bt.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let o=r.hooks?await r.hooks.preprocess(t):t,a=await(r.hooks?await r.hooks.provideLexer(e):e?mt.lex:mt.lexInline)(o,r),l=r.hooks?await r.hooks.processAllTokens(a):a;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(e):e?bt.parse:bt.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(i);try{r.hooks&&(t=r.hooks.preprocess(t));let o=(r.hooks?r.hooks.provideLexer(e):e?mt.lex:mt.lexInline)(t,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let a=(r.hooks?r.hooks.provideParser(e):e?bt.parse:bt.parseInline)(o,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(o){return i(o)}}}onError(e,t){return n=>{if(n.message+=`
-Please report this to https://github.com/markedjs/marked.`,e){let s="An error occurred:
"+Rt(n.message+"",!0)+"
";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},fn=new vf;function xe(e,t){return fn.parse(e,t)}xe.options=xe.setOptions=function(e){return fn.setOptions(e),xe.defaults=fn.defaults,Ho(xe.defaults),xe},xe.getDefaults=Sr,xe.defaults=un,xe.use=function(...e){return fn.use(...e),xe.defaults=fn.defaults,Ho(xe.defaults),xe},xe.walkTokens=function(e,t){return fn.walkTokens(e,t)},xe.parseInline=fn.parseInline,xe.Parser=bt,xe.parser=bt.parse,xe.Renderer=Os,xe.TextRenderer=Or,xe.Lexer=mt,xe.lexer=mt.lex,xe.Tokenizer=Ls,xe.Hooks=Yn,xe.parse=xe,xe.options,xe.setOptions,xe.use,xe.walkTokens,xe.parseInline,bt.parse,mt.lex;function sl(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n2?s-2:0),i=2;i1?n-1:0),r=1;r1?n-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:Zn;if(il&&il(e,null),!Ze(t))return e;let s=t.length;for(;s--;){let r=t[s];if(typeof r=="string"){const i=n(r);i!==r&&(Af(t)||(t[s]=i),r=i)}e[r]=!0}return e}function Df(e){for(let t=0;t/g),jf=ft(/\${[\w\W]*/g),Vf=ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),qf=ft(/^aria-[\-\w]+$/),ml=ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wf=ft(/^(?:\w+script|data):/i),Gf=ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Kf=ft(/^html$/i),Yf=ft(/^[a-z][.\w]*(-[.\w]+)+$/i),An={element:1,text:3,progressingInstruction:7,comment:8,document:9},Zf=function(){return typeof window=="undefined"?null:window},Xf=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(s=n.getAttribute(r));const i="dompurify"+(s?"#"+s:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return null}},bl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function xl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Zf();const t=V=>xl(V);if(t.version="3.4.3",t.removed=[],!e||!e.document||e.document.nodeType!==An.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const s=n,r=s.currentScript,i=e.DocumentFragment,o=e.HTMLTemplateElement,a=e.Node,l=e.Element,c=e.NodeFilter,u=e.NamedNodeMap,p=u===void 0?e.NamedNodeMap||e.MozNamedAttrMap:u,g=e.HTMLFormElement,w=e.DOMParser,E=e.trustedTypes,m=l.prototype,A=En(m,"cloneNode"),T=En(m,"remove"),W=En(m,"nextSibling"),K=En(m,"childNodes"),O=En(m,"parentNode");if(typeof o=="function"){const V=n.createElement("template");V.content&&V.content.ownerDocument&&(n=V.content.ownerDocument)}let z,P="";const I=n,re=I.implementation,j=I.createNodeIterator,te=I.createDocumentFragment,ue=I.getElementsByTagName,$=s.importNode;let Z=bl();t.isSupported=typeof rl=="function"&&typeof O=="function"&&re&&re.createHTMLDocument!==void 0;const Y=zf,B=Uf,ce=jf,Se=Vf,We=qf,xt=Wf,fe=Gf,N=Yf;let pe=ml,he=null;const ke=X({},[...dl,...Fr,...Br,...Hr,...pl]);let ve=null;const me=X({},[...hl,...zr,...gl,...Ds]);let le=Object.seal(_n(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),yt=null,Ct=null;const ze=Object.seal(_n(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ur=!0,f=!0,h=!1,b=!0,k=!1,v=!0,_=!1,M=!1,C=!1,R=!1,S=!1,H=!1,L=!0,U=!1;const G="user-content-";let ee=!0,de=!1,ne={},Te=null;const Oe=X({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let rt=null;const it=X({},["audio","video","img","source","image","track"]);let Ft=null;const Qn=X({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$e="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",ot="http://www.w3.org/1999/xhtml";let Bt=ot,jr=!1,Vr=null;const hp=X({},[$e,Xe,ot],Nr);let qr=X({},["mi","mo","mn","ms","mtext"]),Wr=X({},["annotation-xml"]);const gp=X({},["title","style","font","a","script"]);let Jn=null;const mp=["application/xhtml+xml","text/html"],bp="text/html";let Le=null,Rn=null;const xp=n.createElement("form"),Sl=function(d){return d instanceof RegExp||d instanceof Function},Gr=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Rn&&Rn===d)return;(!d||typeof d!="object")&&(d={}),d=et(d),Jn=mp.indexOf(d.PARSER_MEDIA_TYPE)===-1?bp:d.PARSER_MEDIA_TYPE,Le=Jn==="application/xhtml+xml"?Nr:Zn,he=Ee(d,"ALLOWED_TAGS")&&Ze(d.ALLOWED_TAGS)?X({},d.ALLOWED_TAGS,Le):ke,ve=Ee(d,"ALLOWED_ATTR")&&Ze(d.ALLOWED_ATTR)?X({},d.ALLOWED_ATTR,Le):me,Vr=Ee(d,"ALLOWED_NAMESPACES")&&Ze(d.ALLOWED_NAMESPACES)?X({},d.ALLOWED_NAMESPACES,Nr):hp,Ft=Ee(d,"ADD_URI_SAFE_ATTR")&&Ze(d.ADD_URI_SAFE_ATTR)?X(et(Qn),d.ADD_URI_SAFE_ATTR,Le):Qn,rt=Ee(d,"ADD_DATA_URI_TAGS")&&Ze(d.ADD_DATA_URI_TAGS)?X(et(it),d.ADD_DATA_URI_TAGS,Le):it,Te=Ee(d,"FORBID_CONTENTS")&&Ze(d.FORBID_CONTENTS)?X({},d.FORBID_CONTENTS,Le):Oe,yt=Ee(d,"FORBID_TAGS")&&Ze(d.FORBID_TAGS)?X({},d.FORBID_TAGS,Le):et({}),Ct=Ee(d,"FORBID_ATTR")&&Ze(d.FORBID_ATTR)?X({},d.FORBID_ATTR,Le):et({}),ne=Ee(d,"USE_PROFILES")?d.USE_PROFILES&&typeof d.USE_PROFILES=="object"?et(d.USE_PROFILES):d.USE_PROFILES:!1,Ur=d.ALLOW_ARIA_ATTR!==!1,f=d.ALLOW_DATA_ATTR!==!1,h=d.ALLOW_UNKNOWN_PROTOCOLS||!1,b=d.ALLOW_SELF_CLOSE_IN_ATTR!==!1,k=d.SAFE_FOR_TEMPLATES||!1,v=d.SAFE_FOR_XML!==!1,_=d.WHOLE_DOCUMENT||!1,R=d.RETURN_DOM||!1,S=d.RETURN_DOM_FRAGMENT||!1,H=d.RETURN_TRUSTED_TYPE||!1,C=d.FORCE_BODY||!1,L=d.SANITIZE_DOM!==!1,U=d.SANITIZE_NAMED_PROPS||!1,ee=d.KEEP_CONTENT!==!1,de=d.IN_PLACE||!1,pe=Ff(d.ALLOWED_URI_REGEXP)?d.ALLOWED_URI_REGEXP:ml,Bt=typeof d.NAMESPACE=="string"?d.NAMESPACE:ot,qr=Ee(d,"MATHML_TEXT_INTEGRATION_POINTS")&&d.MATHML_TEXT_INTEGRATION_POINTS&&typeof d.MATHML_TEXT_INTEGRATION_POINTS=="object"?et(d.MATHML_TEXT_INTEGRATION_POINTS):X({},["mi","mo","mn","ms","mtext"]),Wr=Ee(d,"HTML_INTEGRATION_POINTS")&&d.HTML_INTEGRATION_POINTS&&typeof d.HTML_INTEGRATION_POINTS=="object"?et(d.HTML_INTEGRATION_POINTS):X({},["annotation-xml"]);const y=Ee(d,"CUSTOM_ELEMENT_HANDLING")&&d.CUSTOM_ELEMENT_HANDLING&&typeof d.CUSTOM_ELEMENT_HANDLING=="object"?et(d.CUSTOM_ELEMENT_HANDLING):_n(null);if(le=_n(null),Ee(y,"tagNameCheck")&&Sl(y.tagNameCheck)&&(le.tagNameCheck=y.tagNameCheck),Ee(y,"attributeNameCheck")&&Sl(y.attributeNameCheck)&&(le.attributeNameCheck=y.attributeNameCheck),Ee(y,"allowCustomizedBuiltInElements")&&typeof y.allowCustomizedBuiltInElements=="boolean"&&(le.allowCustomizedBuiltInElements=y.allowCustomizedBuiltInElements),k&&(f=!1),S&&(R=!0),ne&&(he=X({},pl),ve=_n(null),ne.html===!0&&(X(he,dl),X(ve,hl)),ne.svg===!0&&(X(he,Fr),X(ve,zr),X(ve,Ds)),ne.svgFilters===!0&&(X(he,Br),X(ve,zr),X(ve,Ds)),ne.mathMl===!0&&(X(he,Hr),X(ve,gl),X(ve,Ds))),ze.tagCheck=null,ze.attributeCheck=null,Ee(d,"ADD_TAGS")&&(typeof d.ADD_TAGS=="function"?ze.tagCheck=d.ADD_TAGS:Ze(d.ADD_TAGS)&&(he===ke&&(he=et(he)),X(he,d.ADD_TAGS,Le))),Ee(d,"ADD_ATTR")&&(typeof d.ADD_ATTR=="function"?ze.attributeCheck=d.ADD_ATTR:Ze(d.ADD_ATTR)&&(ve===me&&(ve=et(ve)),X(ve,d.ADD_ATTR,Le))),Ee(d,"ADD_URI_SAFE_ATTR")&&Ze(d.ADD_URI_SAFE_ATTR)&&X(Ft,d.ADD_URI_SAFE_ATTR,Le),Ee(d,"FORBID_CONTENTS")&&Ze(d.FORBID_CONTENTS)&&(Te===Oe&&(Te=et(Te)),X(Te,d.FORBID_CONTENTS,Le)),Ee(d,"ADD_FORBID_CONTENTS")&&Ze(d.ADD_FORBID_CONTENTS)&&(Te===Oe&&(Te=et(Te)),X(Te,d.ADD_FORBID_CONTENTS,Le)),ee&&(he["#text"]=!0),_&&X(he,["html","head","body"]),he.table&&(X(he,["tbody"]),delete yt.tbody),d.TRUSTED_TYPES_POLICY){if(typeof d.TRUSTED_TYPES_POLICY.createHTML!="function")throw $s('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof d.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $s('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');z=d.TRUSTED_TYPES_POLICY,P=z.createHTML("")}else z===void 0&&(z=Xf(E,r)),z!==null&&typeof P=="string"&&(P=z.createHTML(""));Ye&&Ye(d),Rn=d},El=X({},[...Fr,...Br,...Bf]),Al=X({},[...Hr,...Hf]),yp=function(d){let y=O(d);(!y||!y.tagName)&&(y={namespaceURI:Bt,tagName:"template"});const D=Zn(d.tagName),ae=Zn(y.tagName);return Vr[d.namespaceURI]?d.namespaceURI===Xe?y.namespaceURI===ot?D==="svg":y.namespaceURI===$e?D==="svg"&&(ae==="annotation-xml"||qr[ae]):!!El[D]:d.namespaceURI===$e?y.namespaceURI===ot?D==="math":y.namespaceURI===Xe?D==="math"&&Wr[ae]:!!Al[D]:d.namespaceURI===ot?y.namespaceURI===Xe&&!Wr[ae]||y.namespaceURI===$e&&!qr[ae]?!1:!Al[D]&&(gp[D]||!El[D]):!!(Jn==="application/xhtml+xml"&&Vr[d.namespaceURI]):!1},wt=function(d){Tn(t.removed,{element:d});try{O(d).removeChild(d)}catch{T(d)}},dn=function(d,y){try{Tn(t.removed,{attribute:y.getAttributeNode(d),from:y})}catch{Tn(t.removed,{attribute:null,from:y})}if(y.removeAttribute(d),d==="is")if(R||S)try{wt(y)}catch{}else try{y.setAttribute(d,"")}catch{}},Rl=function(d){let y=null,D=null;if(C)d=""+d;else{const Ie=al(d,/^[\r\n\t ]+/);D=Ie&&Ie[0]}Jn==="application/xhtml+xml"&&Bt===ot&&(d=''+d+"");const ae=z?z.createHTML(d):d;if(Bt===ot)try{y=new w().parseFromString(ae,Jn)}catch{}if(!y||!y.documentElement){y=re.createDocument(Bt,"template",null);try{y.documentElement.innerHTML=jr?P:ae}catch{}}const De=y.body||y.documentElement;return d&&D&&De.insertBefore(n.createTextNode(D),De.childNodes[0]||null),Bt===ot?ue.call(y,_?"html":"body")[0]:_?y.documentElement:De},Cl=function(d){return j.call(d.ownerDocument||d,d,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Kr=function(d){return d instanceof g&&(typeof d.nodeName!="string"||typeof d.textContent!="string"||typeof d.removeChild!="function"||!(d.attributes instanceof p)||typeof d.removeAttribute!="function"||typeof d.setAttribute!="function"||typeof d.namespaceURI!="string"||typeof d.insertBefore!="function"||typeof d.hasChildNodes!="function")},Yr=function(d){return typeof a=="function"&&d instanceof a};function Ht(V,d,y){kn(V,D=>{D.call(t,d,y,Rn)})}const Pl=function(d){let y=null;if(Ht(Z.beforeSanitizeElements,d,null),Kr(d))return wt(d),!0;const D=Le(d.nodeName);if(Ht(Z.uponSanitizeElement,d,{tagName:D,allowedTags:he}),v&&d.hasChildNodes()&&!Yr(d.firstElementChild)&&He(/<[/\w!]/g,d.innerHTML)&&He(/<[/\w!]/g,d.textContent)||v&&d.namespaceURI===ot&&D==="style"&&Yr(d.firstElementChild)||d.nodeType===An.progressingInstruction||v&&d.nodeType===An.comment&&He(/<[/\w]/g,d.data))return wt(d),!0;if(yt[D]||!(ze.tagCheck instanceof Function&&ze.tagCheck(D))&&!he[D]){if(!yt[D]&&Ml(D)&&(le.tagNameCheck instanceof RegExp&&He(le.tagNameCheck,D)||le.tagNameCheck instanceof Function&&le.tagNameCheck(D)))return!1;if(ee&&!Te[D]){const ae=O(d)||d.parentNode,De=K(d)||d.childNodes;if(De&&ae){const Ie=De.length;for(let tt=Ie-1;tt>=0;--tt){const dt=A(De[tt],!0);ae.insertBefore(dt,W(d))}}}return wt(d),!0}return d instanceof l&&!yp(d)||(D==="noscript"||D==="noembed"||D==="noframes")&&He(/<\/no(script|embed|frames)/i,d.innerHTML)?(wt(d),!0):(k&&d.nodeType===An.text&&(y=d.textContent,kn([Y,B,ce],ae=>{y=Sn(y,ae," ")}),d.textContent!==y&&(Tn(t.removed,{element:d.cloneNode()}),d.textContent=y)),Ht(Z.afterSanitizeElements,d,null),!1)},Il=function(d,y,D){if(Ct[y]||L&&(y==="id"||y==="name")&&(D in n||D in xp))return!1;const ae=ve[y]||ze.attributeCheck instanceof Function&&ze.attributeCheck(y,d);if(!(f&&!Ct[y]&&He(Se,y))){if(!(Ur&&He(We,y))){if(!ae||Ct[y]){if(!(Ml(d)&&(le.tagNameCheck instanceof RegExp&&He(le.tagNameCheck,d)||le.tagNameCheck instanceof Function&&le.tagNameCheck(d))&&(le.attributeNameCheck instanceof RegExp&&He(le.attributeNameCheck,y)||le.attributeNameCheck instanceof Function&&le.attributeNameCheck(y,d))||y==="is"&&le.allowCustomizedBuiltInElements&&(le.tagNameCheck instanceof RegExp&&He(le.tagNameCheck,D)||le.tagNameCheck instanceof Function&&le.tagNameCheck(D))))return!1}else if(!Ft[y]){if(!He(pe,Sn(D,fe,""))){if(!((y==="src"||y==="xlink:href"||y==="href")&&d!=="script"&&ul(D,"data:")===0&&rt[d])){if(!(h&&!He(xt,Sn(D,fe,"")))){if(D)return!1}}}}}}return!0},wp=X({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ml=function(d){return!wp[Zn(d)]&&He(N,d)},Ll=function(d){Ht(Z.beforeSanitizeAttributes,d,null);const y=d.attributes;if(!y||Kr(d))return;const D={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ve,forceKeepAttr:void 0};let ae=y.length;for(;ae--;){const De=y[ae],Ie=De.name,tt=De.namespaceURI,dt=De.value,vt=Le(Ie),Xr=dt;let Ne=Ie==="value"?Xr:Mf(Xr);if(D.attrName=vt,D.attrValue=Ne,D.keepAttr=!0,D.forceKeepAttr=void 0,Ht(Z.uponSanitizeAttribute,d,D),Ne=D.attrValue,U&&(vt==="id"||vt==="name")&&ul(Ne,G)!==0&&(dn(Ie,d),Ne=G+Ne),v&&He(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ne)){dn(Ie,d);continue}if(vt==="attributename"&&al(Ne,"href")){dn(Ie,d);continue}if(D.forceKeepAttr)continue;if(!D.keepAttr){dn(Ie,d);continue}if(!b&&He(/\/>/i,Ne)){dn(Ie,d);continue}k&&kn([Y,B,ce],$l=>{Ne=Sn(Ne,$l," ")});const Ol=Le(d.nodeName);if(!Il(Ol,vt,Ne)){dn(Ie,d);continue}if(z&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!tt)switch(E.getAttributeType(Ol,vt)){case"TrustedHTML":{Ne=z.createHTML(Ne);break}case"TrustedScriptURL":{Ne=z.createScriptURL(Ne);break}}if(Ne!==Xr)try{tt?d.setAttributeNS(tt,Ie,Ne):d.setAttribute(Ie,Ne),Kr(d)?wt(d):ll(t.removed)}catch{dn(Ie,d)}}Ht(Z.afterSanitizeAttributes,d,null)},Zr=function(d){let y=null;const D=Cl(d);for(Ht(Z.beforeSanitizeShadowDOM,d,null);y=D.nextNode();)Ht(Z.uponSanitizeShadowNode,y,null),Pl(y),Ll(y),y.content instanceof i&&Zr(y.content);Ht(Z.afterSanitizeShadowDOM,d,null)},Fs=function(d){if(d.nodeType===An.element&&d.shadowRoot instanceof i){const ae=d.shadowRoot;Fs(ae),Zr(ae)}const y=d.childNodes;if(!y)return;const D=[];kn(y,ae=>{Tn(D,ae)});for(const ae of D)Fs(ae)};return t.sanitize=function(V){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=null,D=null,ae=null,De=null;if(jr=!V,jr&&(V=""),typeof V!="string"&&!Yr(V)&&(V=Nf(V),typeof V!="string"))throw $s("dirty is not a string, aborting");if(!t.isSupported)return V;if(M||Gr(d),t.removed=[],typeof V=="string"&&(de=!1),de){const dt=V.nodeName;if(typeof dt=="string"){const vt=Le(dt);if(!he[vt]||yt[vt])throw $s("root node is forbidden and cannot be sanitized in-place")}Fs(V)}else if(V instanceof a)y=Rl(""),D=y.ownerDocument.importNode(V,!0),D.nodeType===An.element&&D.nodeName==="BODY"||D.nodeName==="HTML"?y=D:y.appendChild(D),Fs(D);else{if(!R&&!k&&!_&&V.indexOf("<")===-1)return z&&H?z.createHTML(V):V;if(y=Rl(V),!y)return R?null:H?P:""}y&&C&&wt(y.firstChild);const Ie=Cl(de?V:y);for(;ae=Ie.nextNode();)Pl(ae),Ll(ae),ae.content instanceof i&&Zr(ae.content);if(de)return V;if(R){if(k){y.normalize();let dt=y.innerHTML;kn([Y,B,ce],vt=>{dt=Sn(dt,vt," ")}),y.innerHTML=dt}if(S)for(De=te.call(y.ownerDocument);y.firstChild;)De.appendChild(y.firstChild);else De=y;return(ve.shadowroot||ve.shadowrootmode)&&(De=$.call(s,De,!0)),De}let tt=_?y.outerHTML:y.innerHTML;return _&&he["!doctype"]&&y.ownerDocument&&y.ownerDocument.doctype&&y.ownerDocument.doctype.name&&He(Kf,y.ownerDocument.doctype.name)&&(tt="
-`+tt),k&&kn([Y,B,ce],dt=>{tt=Sn(tt,dt," ")}),z&&H?z.createHTML(tt):tt},t.setConfig=function(){let V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gr(V),M=!0},t.clearConfig=function(){Rn=null,M=!1},t.isValidAttribute=function(V,d,y){Rn||Gr({});const D=Le(V),ae=Le(d);return Il(D,ae,y)},t.addHook=function(V,d){typeof d=="function"&&Tn(Z[V],d)},t.removeHook=function(V,d){if(d!==void 0){const y=Pf(Z[V],d);return y===-1?void 0:If(Z[V],y,1)[0]}return ll(Z[V])},t.removeHooks=function(V){Z[V]=[]},t.removeAllHooks=function(){Z=bl()},t}var Qf=xl();const Jf={key:1,class:"flex min-w-0 max-w-[calc(100%-2.5rem)] flex-1 flex-col max-[600px]:max-w-[calc(100%-2.25rem)]"},ed={key:0,class:"flex w-fit flex-col items-start gap-1"},td=["aria-label"],nd={class:"inline-flex items-center gap-1.5"},sd={class:"text-[8px] font-semibold tracking-[0.12em] uppercase text-[#3a67c9]"},rd={key:1,class:"flex w-fit max-w-full flex-col items-start gap-2"},id={class:"chat-card relative w-fit max-w-full whitespace-pre-line rounded-[10px_10px_10px_3px] px-4 py-3 text-xs leading-relaxed wrap-anywhere text-slate-900"},od=["innerHTML"],ld={key:0,class:"pointer-events-none absolute inset-x-0 bottom-0 h-14 rounded-b-[10px] bg-linear-to-t from-white via-white/92 to-white/0","aria-hidden":"true"},ad={key:0,class:"flex flex-wrap items-center gap-2"},ud=["title","aria-label"],cd={key:1,class:"flex flex-wrap items-center"},fd=["title","aria-label"],dd={viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},pd=["innerHTML"],yl={__name:"ChatMessage",props:{message:{type:Object,required:!0},autoReadEnabled:{type:Boolean,default:!1},ttsConfig:{type:Object,default:()=>({enableVoiceChat:!1,pollyAvailable:!1,usePolly:!0,voiceId:"Zayd"})}},setup(e){const t=e,n=J(!1),s=J(null),r=J(!1),i=J(!1),o=Re(()=>typeof window!="undefined"&&"speechSynthesis"in window&&"SpeechSynthesisUtterance"in window);function a(P){typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("changai-tts-provider",{detail:{provider:P}}))}function l(P){if(typeof P!="string")return"";const I=P.replace(/[\u{1F000}-\u{1FFFF}]/gu,"").replace(/[\u{2600}-\u{26FF}]/gu,"").replace(/[\u{2700}-\u{27BF}]/gu,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/#{1,6}\s+/g,"").replace(/[-*+]\s+/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\s+/g," ");return I.includes("<")?(new DOMParser().parseFromString(P,"text/html").body.textContent||"").replace(/\s+/g," ").trim():I.trim()}function c(){o.value&&window.speechSynthesis.cancel(),s.value&&(s.value.pause(),s.value.src="",s.value=null),n.value=!1}function u(){var P,I,re;if(i.value=!i.value,i.value)c();else{const j=A.value;if(!t.autoReadEnabled||!((P=t.ttsConfig)!=null&&P.enableVoiceChat)||!j||E())return;if((I=t.ttsConfig)!=null&&I.pollyAvailable&&((re=t.ttsConfig)!=null&&re.usePolly)){g(j).catch(te=>{p(j)});return}p(j)}}function p(P){if(!o.value||!P)return;window.dispatchEvent(new CustomEvent("changai-tts-stop")),window.speechSynthesis.cancel();const I=new SpeechSynthesisUtterance(P);I.rate=1,I.pitch=1,I.onend=()=>{n.value=!1},I.onerror=()=>{n.value=!1},n.value=!0,a("browser"),window.speechSynthesis.speak(I)}async function g(P){var ue;const I=await Lc(P,((ue=t.ttsConfig)==null?void 0:ue.voiceId)||"Zayd");if(!(I!=null&&I.ok)||!(I!=null&&I.audio_base64))throw new Error((I==null?void 0:I.error)||"Polly synthesis failed");window.dispatchEvent(new CustomEvent("changai-tts-stop")),c();const re=(I==null?void 0:I.mime_type)||"audio/mpeg",j=new Audio(`data:${re};base64,${I.audio_base64}`);s.value=j,n.value=!0;let te=!1;j.onplay=()=>{te=!0,a("polly")},j.onended=()=>{s.value===j&&(s.value=null),n.value=!1},j.onerror=()=>{s.value===j&&(s.value=null),n.value=!1},await j.play(),te||a("polly")}function w(){c()}function E(){var P;return!!((P=t.message)!=null&&P.isStatus)}function m(P){const I=P.target.closest("a");!I||!I.href||(P.preventDefault(),P.stopPropagation(),window.open(I.href,"_blank","noopener,noreferrer"))}const A=Re(()=>{var P;return l(((P=t.message)==null?void 0:P.text)||"")}),T=Re(()=>{var P;return((P=t.message)==null?void 0:P.role)!=="user"&&E()}),W=Re(()=>{var P;return(P=t.message)!=null&&P.isStatus?t.message.statusType==="support"?"Sending to support":A.value||"Thinking":""}),K=Re(()=>{var re;if(((re=t.message)==null?void 0:re.role)==="user"||T.value)return!1;const P=A.value,I=P.split(/\n+/).filter(Boolean).length;return P.length>520||I>8}),O=Re(()=>{var P,I;return((P=t.message)==null?void 0:P.role)!=="user"&&!T.value&&((I=t.ttsConfig)==null?void 0:I.enableVoiceChat)}),z=Re(()=>{var I;const P=((I=t.message)==null?void 0:I.text)||"";return Qf.sanitize(xe.parse(P))});return rn(()=>t.message.text,async(P,I)=>{var te,ue,$;if(!t.autoReadEnabled||t.message.role==="user"||i.value)return;if(!((te=t.ttsConfig)!=null&&te.enableVoiceChat)){a("off");return}const re=l(P);if(!re||E())return;const j=l(I||"");if(re!==j){if((ue=t.ttsConfig)!=null&&ue.pollyAvailable&&(($=t.ttsConfig)!=null&&$.usePolly))try{await g(re);return}catch{}p(re)}}),rn(()=>t.message.text,()=>{r.value=!1,i.value=!1}),Hn(()=>{typeof window!="undefined"&&window.addEventListener("changai-tts-stop",w)}),xs(()=>{typeof window!="undefined"&&window.removeEventListener("changai-tts-stop",w),n.value&&c()}),(P,I)=>(F(),q("div",{class:ye(["motion-safe:animate-fade-rise flex w-full gap-1.5",e.message.role==="user"?"flex-col items-end":"items-start"])},[e.message.role!=="user"?(F(),St(Bo,{key:0})):Ve("",!0),e.message.role!=="user"?(F(),q("div",Jf,[T.value?(F(),q("div",ed,[x("div",{class:"chat-card inline-flex w-fit rounded-[10px_10px_10px_3px] px-3 py-2",role:"status","aria-live":"polite","aria-label":W.value},[x("div",nd,[I[1]||(I[1]=x("span",{class:"relative inline-flex h-4 w-4 shrink-0 items-center justify-center"},[x("span",{class:"absolute inset-0 rounded-full border border-transparent border-t-[#4b89ff] border-r-[#4b89ff]/70 animate-gemini-arc"}),x("svg",{viewBox:"0 0 24 24",class:"relative h-3 w-3 text-[#4b89ff] animate-gemini-spark","aria-hidden":"true"},[x("path",{fill:"currentColor",d:"M12 2.8c.52 3.22 1.6 5.66 3.22 7.28 1.62 1.62 4.06 2.7 7.28 3.22-3.22.52-5.66 1.6-7.28 3.22-1.62 1.62-2.7 4.06-3.22 7.28-.52-3.22-1.6-5.66-3.22-7.28-1.62-1.62-4.06-2.7-7.28-3.22 3.22-.52 5.66-1.6 7.28-3.22 1.62-1.62 2.7-4.06 3.22-7.28Z"})])],-1)),x("span",sd,Qe(W.value),1)])],8,td)])):(F(),q("div",rd,[x("div",id,[x("div",{class:ye(["overflow-x-auto",K.value&&!r.value?"max-h-48 overflow-y-hidden":""]),innerHTML:z.value,onClick:m},null,10,od),K.value&&!r.value?(F(),q("div",ld)):Ve("",!0)]),K.value?(F(),q("div",ad,[x("button",{type:"button",class:"inline-flex items-center rounded-full border border-slate-200 bg-white px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-600 transition-colors duration-200 hover:border-brand-200 hover:text-brand-600",title:r.value?"Collapse response":"Expand response","aria-label":r.value?"Collapse response":"Expand response",onClick:I[0]||(I[0]=re=>r.value=!r.value)},Qe(r.value?"Collapse":"Expand"),9,ud)])):Ve("",!0),O.value?(F(),q("div",cd,[x("button",{type:"button",class:ye(["inline-flex h-8 w-8 items-center justify-center rounded-full border transition-colors duration-200",i.value?"border-red-200 bg-red-50 text-red-600 hover:border-red-300 hover:bg-red-100":"border-green-200 bg-green-50 text-green-600 hover:border-green-300 hover:bg-green-100"]),title:i.value?"Unmute voice playback":"Mute voice playback","aria-label":i.value?"Unmute voice playback":"Mute voice playback",onClick:u},[(F(),q("svg",dd,[I[6]||(I[6]=x("path",{d:"M11 5L6 9H3v6h3l5 4V5Z"},null,-1)),i.value?(F(),q(Be,{key:0},[I[2]||(I[2]=x("path",{d:"M15 9l4 6"},null,-1)),I[3]||(I[3]=x("path",{d:"M19 9l-4 6"},null,-1))],64)):(F(),q(Be,{key:1},[I[4]||(I[4]=x("path",{d:"M15 10a3 3 0 0 1 0 4"},null,-1)),I[5]||(I[5]=x("path",{d:"M17.5 7.5a6 6 0 0 1 0 9"},null,-1))],64))]))],10,fd)])):Ve("",!0)]))])):(F(),q("div",{key:2,class:"w-fit max-w-[85%] whitespace-pre-line rounded-[13px_13px_3px_13px] bg-linear-to-br from-brand-500 to-brand-600 px-4 py-3 text-[11px] leading-relaxed wrap-anywhere text-white shadow-[0_14px_30px_-18px_rgba(109,79,194,0.85)] max-[600px]:max-w-[88%]",innerHTML:z.value},null,8,pd))],2))}},hd={class:"flex flex-col gap-4 sm:gap-5"},gd={class:"motion-safe:animate-fade-rise flex w-full items-start gap-1.5"},md={__name:"ChatTab",props:{messages:{type:Array,required:!0},autoReadEnabled:{type:Boolean,default:!1},ttsConfig:{type:Object,required:!0}},setup(e){return(t,n)=>(F(),q("div",hd,[x("div",gd,[Me(Bo),n[0]||(n[0]=x("p",{class:"w-fit max-w-[calc(100%-2.5rem)] whitespace-pre-line rounded-[10px_10px_10px_3px] bg-brand-50 px-4 py-3 text-xs leading-relaxed wrap-anywhere text-slate-900 max-[600px]:max-w-[calc(100%-2.25rem)]"},[Ts(" Hello there 👋 I am ChangAI from "),x("a",{target:"_blank",href:"https://erpgulf.com",rel:"noopener noreferrer",style:{color:"#1e90ff"}},"ERPGulf.com"),Ts(", your ERP assistant."),x("br"),x("a",{target:"_blank",href:"https://app.erpgulf.com/en/articles/chang-ai-quick-start-guide",rel:"noopener noreferrer",style:{color:"#1e90ff"}},"ChangAI Quick Start Guide - Click here.")],-1))]),(F(!0),q(Be,null,ys(e.messages,(s,r)=>(F(),St(yl,{key:r,message:s,autoReadEnabled:e.autoReadEnabled,ttsConfig:e.ttsConfig},null,8,["message","autoReadEnabled","ttsConfig"]))),128))]))}};function wl(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function vl(e){var t,n;return(e==null?void 0:e.message)||((t=e==null?void 0:e.responseJSON)==null?void 0:t.exception)||((n=e==null?void 0:e.responseJSON)==null?void 0:n.message)||(e==null?void 0:e.responseText)||String(e)}function bd(e){return typeof e=="string"?e:e&&typeof e=="object"?e.error?`⚠️ ${e.error}`:e.answer||e.text||"":""}const xd={key:0,class:"rounded-lg bg-brand-50 px-4 py-3 text-xs text-black"},yd={class:"whitespace-pre-wrap wrap-anywhere text-[11px] leading-relaxed text-black"},wd={key:1,class:"mb-3 min-w-0 overflow-x-auto rounded-lg bg-brand-50 p-2 text-[11px]"},vd={class:"whitespace-pre-wrap wrap-anywhere text-[11px] leading-relaxed text-black"},_d={__name:"DebugTab",props:{logs:{type:Array,required:!0},currentDebug:{type:Object,default:null}},setup(e){const t=new Set(["gemini_json_content","private_key","private_key_id","client_secret","client_id","aws_access_key","aws_secret_key","api_key","token","access_token","refresh_token","password","secret","authorization","embed_version_id","llm_version_id","entity_retriever","retriever","deploy_url","support_api_url","get_ticket_details_url"]);function n(r,i=0){if(i>10||r===null||r===void 0||typeof r=="string"||typeof r=="number"||typeof r=="boolean")return r;if(Array.isArray(r))return r.map(o=>n(o,i+1));if(typeof r=="object"){const o={};for(const[a,l]of Object.entries(r))t.has(a.toLowerCase())||(o[a]=n(l,i+1));return o}return r}function s(r){return wl(n(r))}return(r,i)=>(F(),q("div",null,[e.logs.length===0?(F(),q("p",xd,"No debug data yet.")):Ve("",!0),(F(!0),q(Be,null,ys(e.logs,(o,a)=>(F(),q("div",{key:a,class:"mb-3 min-w-0 overflow-x-auto rounded-lg bg-gray-100 p-2 text-[11px]"},[x("pre",yd,Qe(s(o)),1)]))),128)),e.currentDebug?(F(),q("div",wd,[x("pre",vd,Qe(s(e.currentDebug)),1)])):Ve("",!0)]))}},kd={class:"flex flex-col gap-4 sm:gap-5"},Td={key:0,class:"chat-card motion-safe:animate-fade-rise rounded-lg px-4 py-3 text-xs text-slate-900"},Sd={__name:"SupportTab",props:{messages:{type:Array,required:!0},autoReadEnabled:{type:Boolean,default:!1},ttsConfig:{type:Object,required:!0}},setup(e){return(t,n)=>(F(),q("div",kd,[e.messages.length===0?(F(),q("p",Td,"Send a message to Support.")):Ve("",!0),(F(!0),q(Be,null,ys(e.messages,(s,r)=>(F(),St(yl,{key:r,message:s,autoReadEnabled:e.autoReadEnabled,ttsConfig:e.ttsConfig},null,8,["message","autoReadEnabled","ttsConfig"]))),128))]))}},Ed={class:"flex flex-col gap-4"},Ad={class:"chat-card motion-safe:animate-fade-rise rounded-xl p-4"},Rd={class:"flex items-start justify-between gap-4"},Cd=["aria-pressed","title"],Pd={class:"chat-card motion-safe:animate-fade-rise rounded-xl p-4"},Id={class:"flex items-start justify-between gap-4"},Md={class:"mt-2 text-[11px] text-slate-500"},Ld={key:0,class:"mt-1 text-[11px] text-slate-500"},Od={key:1,class:"mt-1 text-[11px] text-slate-500"},$d=["aria-pressed","disabled"],Dd={key:0,class:"mt-3 rounded-md bg-amber-50 px-2.5 py-2 text-xs text-amber-700"},Nd={key:1,class:"mt-3 rounded-md bg-amber-50 px-2.5 py-2 text-xs text-amber-700"},Fd={class:"chat-card motion-safe:animate-fade-rise rounded-xl p-4"},Bd={class:"flex items-start justify-between gap-4"},Hd=["aria-pressed","title"],zd={class:"chat-card motion-safe:animate-fade-rise rounded-xl p-4"},Ud={class:"flex items-start justify-between gap-4"},jd=["aria-pressed","title"],Vd={__name:"SettingsTab",props:{autoReadEnabled:{type:Boolean,required:!0},ttsConfig:{type:Object,required:!0},settings:{type:Object,default:null},debugEnabled:{type:Boolean,default:!1},sendNonERPtoaiEnabled:{type:Boolean,default:!1}},emits:["toggleAutoRead","togglePollyPreference","toggleDebug","toggleSendNonERP"],setup(e){const t=e,n=Re(()=>{var s,r;return(s=t.ttsConfig)!=null&&s.enableVoiceChat?(r=t.ttsConfig)!=null&&r.pollyAvailable?"Available":"Unavailable":"Voice disabled on server"});return(s,r)=>{var i,o,a,l,c,u,p,g,w,E,m,A,T,W,K;return F(),q("div",Ed,[r[10]||(r[10]=x("div",{class:"chat-card motion-safe:animate-fade-rise rounded-xl p-4 text-slate-900"},[x("h3",{class:"text-sm font-semibold tracking-[0.01em]"},"Speech Settings"),x("p",{class:"mt-1 text-xs leading-relaxed text-slate-600"},"These controls apply only inside this chatbot box for the current browser session.")],-1)),x("div",Ad,[x("div",Rd,[r[4]||(r[4]=x("div",null,[x("p",{class:"text-sm font-semibold text-slate-900"},"Auto Read Replies"),x("p",{class:"mt-1 text-xs text-slate-600"},"Automatically read bot replies aloud.")],-1)),x("button",{class:ye(["group relative h-7 w-12 shrink-0 rounded-full border border-slate-200 transition-all duration-200",e.autoReadEnabled?"bg-emerald-500/95":"bg-slate-300"]),"aria-pressed":e.autoReadEnabled?"true":"false",title:e.autoReadEnabled?"Disable auto read":"Enable auto read",onClick:r[0]||(r[0]=O=>s.$emit("toggleAutoRead"))},[x("span",{class:ye(["absolute top-0.5 h-5.5 w-5.5 rounded-full bg-white shadow-sm transition-all duration-200",e.autoReadEnabled?"left-[1.45rem]":"left-0.5"])},null,2)],10,Cd)]),x("p",{class:ye(["mt-3 text-[11px] font-medium",e.autoReadEnabled?"text-emerald-700":"text-slate-500"])},Qe(e.autoReadEnabled?"Auto read is active.":"Auto read is currently off."),3)]),x("div",Pd,[x("div",Id,[x("div",null,[r[5]||(r[5]=x("p",{class:"text-sm font-semibold text-slate-900"},"Use Amazon Polly",-1)),r[6]||(r[6]=x("p",{class:"mt-1 text-xs text-slate-600"},"Use Polly when available; otherwise browser speech is used automatically.",-1)),x("p",Md,"Availability: "+Qe(n.value),1),(i=e.settings)!=null&&i.aws_region?(F(),q("p",Ld,"Region: "+Qe(e.settings.aws_region),1)):Ve("",!0),(o=e.ttsConfig)!=null&&o.voiceId?(F(),q("p",Od,"Voice: "+Qe(e.ttsConfig.voiceId),1)):Ve("",!0)]),x("button",{class:ye(["relative h-7 w-12 shrink-0 rounded-full border border-slate-200 transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-55",(a=e.ttsConfig)!=null&&a.usePolly&&((l=e.ttsConfig)!=null&&l.enableVoiceChat)&&((c=e.ttsConfig)!=null&&c.pollyAvailable)?"bg-emerald-500/95":"bg-slate-300"]),"aria-pressed":(u=e.ttsConfig)!=null&&u.usePolly&&((p=e.ttsConfig)!=null&&p.enableVoiceChat)&&((g=e.ttsConfig)!=null&&g.pollyAvailable)?"true":"false",disabled:!((w=e.ttsConfig)!=null&&w.pollyAvailable)||!((E=e.ttsConfig)!=null&&E.enableVoiceChat),onClick:r[1]||(r[1]=O=>s.$emit("togglePollyPreference"))},[x("span",{class:ye(["absolute top-0.5 h-5.5 w-5.5 rounded-full bg-white shadow-sm transition-all duration-200",(m=e.ttsConfig)!=null&&m.usePolly&&((A=e.ttsConfig)!=null&&A.enableVoiceChat)&&((T=e.ttsConfig)!=null&&T.pollyAvailable)?"left-[1.45rem]":"left-0.5"])},null,2)],10,$d)]),(W=e.ttsConfig)!=null&&W.enableVoiceChat?(K=e.ttsConfig)!=null&&K.pollyAvailable?Ve("",!0):(F(),q("p",Nd,"Polly is not available for this site. Browser speech will be used.")):(F(),q("p",Dd,"Voice chat is disabled in ChangAI Settings."))]),x("div",Fd,[x("div",Bd,[x("div",null,[r[7]||(r[7]=x("p",{class:"text-sm font-semibold text-slate-900"},"Enable Debug Tab",-1)),r[8]||(r[8]=x("p",{class:"mt-1 text-xs text-slate-600"}," Show or hide the Debug tab inside this chatbot. ",-1)),x("p",{class:ye(["mt-2 text-[11px] font-medium",e.debugEnabled?"text-emerald-700":"text-slate-500"])},Qe(e.debugEnabled?"Debug tab is active.":"Debug tab is currently off."),3)]),x("button",{type:"button",class:ye(["relative h-7 w-12 shrink-0 rounded-full border border-slate-200 transition-all duration-200",e.debugEnabled?"bg-emerald-500/95":"bg-slate-300"]),"aria-pressed":e.debugEnabled?"true":"false",title:e.debugEnabled?"Disable debug tab":"Enable debug tab",onClick:r[2]||(r[2]=O=>s.$emit("toggleDebug"))},[x("span",{class:ye(["absolute top-0.5 h-5.5 w-5.5 rounded-full bg-white shadow-sm transition-all duration-200",e.debugEnabled?"left-[1.45rem]":"left-0.5"])},null,2)],10,Hd)])]),x("div",zd,[x("div",Ud,[r[9]||(r[9]=x("div",null,[x("p",{class:"text-sm font-semibold text-slate-900"},"Send non-ERP questions directly to AI"),x("p",{class:"mt-1 text-xs text-slate-600"},"Questions unrelated to your ERP will skip the system and go straight to AI")],-1)),x("button",{class:ye(["group relative h-7 w-12 shrink-0 rounded-full border border-slate-200 transition-all duration-200",e.sendNonERPtoaiEnabled?"bg-emerald-500/95":"bg-slate-300"]),"aria-pressed":e.sendNonERPtoaiEnabled?"true":"false",title:e.sendNonERPtoaiEnabled?"Non-ERP questions are being sent directly to AI":"Enable direct AI reply for non-ERP questions",onClick:r[3]||(r[3]=O=>s.$emit("toggleSendNonERP"))},[x("span",{class:ye(["absolute top-0.5 h-5.5 w-5.5 rounded-full bg-white shadow-sm transition-all duration-200",e.sendNonERPtoaiEnabled?"left-[1.45rem]":"left-0.5"])},null,2)],10,jd)]),x("p",{class:ye(["mt-3 text-[11px] font-medium",e.sendNonERPtoaiEnabled?"text-emerald-700":"text-slate-500"])},Qe(e.sendNonERPtoaiEnabled?"Non-ERP questions are now routed directly to AI":"Direct AI routing is currently off"),3)])])}}},qd={key:0,class:"pointer-events-none absolute -top-14 left-0 right-0 z-20 flex justify-center px-2",role:"status","aria-live":"polite"},Wd={__name:"StatusToast",props:{visible:{type:Boolean,required:!0},message:{type:String,default:""},type:{type:String,default:"info"},dismissible:{type:Boolean,default:!0}},emits:["close"],setup(e){const t=e,n=Re(()=>t.type==="error"?"bg-red-50 text-red-700 ring-red-200":(t.type==="listening","bg-blue-50 text-blue-700 ring-blue-200")),s=Re(()=>t.type==="error"?"bg-red-500":t.type==="listening"?"bg-blue-500 animate-pulse":"bg-blue-500");return(r,i)=>(F(),St(Pu,{"enter-active-class":"transition duration-200 ease-out","enter-from-class":"translate-y-1 opacity-0","enter-to-class":"translate-y-0 opacity-100","leave-active-class":"transition duration-150 ease-in","leave-from-class":"translate-y-0 opacity-100","leave-to-class":"translate-y-1 opacity-0"},{default:Ni(()=>[e.visible?(F(),q("div",qd,[x("div",{class:ye(["pointer-events-auto flex max-w-[92%] items-start gap-2 rounded-lg px-3 py-2 text-xs shadow-lg ring-1",n.value])},[x("span",{class:ye(["mt-0.5 h-2 w-2 shrink-0 rounded-full",s.value])},null,2),x("span",null,Qe(e.message),1),e.dismissible?(F(),q("button",{key:0,type:"button",class:"ml-1 appearance-none border-0 text-current/80 transition hover:text-current focus:outline-none","aria-label":"Dismiss notification",onClick:i[0]||(i[0]=o=>r.$emit("close"))}," × ")):Ve("",!0)],2)])):Ve("",!0)]),_:1}))}},Gd={class:"relative w-full"},Kd=["placeholder","disabled"],Yd=["title","aria-label","disabled"],Zd={key:0,viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor","aria-hidden":"true"},Xd={key:1,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},Qd={key:2,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",class:"animate-spin"},Jd=["title","aria-label","disabled"],ep={key:0,viewBox:"0 0 24 24",width:"18",height:"18",fill:"none","aria-hidden":"true",class:"text-rose-600 motion-safe:animate-stop-button-pulse"},tp={key:1,viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor","aria-hidden":"true"},np={__name:"ChatForm",props:{placeholder:{type:String,default:"Message..."},disabled:{type:Boolean,default:!1},isAwaitingResponse:{type:Boolean,default:!1}},emits:["submit","cancel"],setup(e,{expose:t,emit:n}){const s=e,r=n,i=J(""),o=J(null),a=J(!1),l=J(!1),c=J(!1),u=J(!1),p=J(!1),g=J(!1),w=J(!1),E=J(""),m=J("info"),A=J("Voice input is unavailable in this browser/context.");let T=null,W=null,K=null;const O=J(""),z=J(!1),P=Re(()=>c.value?"Requesting microphone permission...":u.value?"Starting voice input...":p.value?"Stopping voice input...":l.value?a.value?"Stop voice input":"Start voice input":"Voice input is unavailable in this browser/context"),I=Re(()=>s.isAwaitingResponse?"Stop response":"Send"),re=Re(()=>s.isAwaitingResponse?!1:s.disabled||!i.value.trim()),j=Re(()=>s.isAwaitingResponse?"bg-white border border-rose-100 shadow-[0_8px_20px_-12px_rgba(159,18,57,0.35)] hover:bg-rose-50":"bg-linear-to-br from-brand-500 to-brand-600 text-white shadow-[0_10px_24px_-16px_rgba(109,79,194,0.85)] hover:from-brand-600 hover:to-violet-700");function te(){return typeof window=="undefined"?null:window.SpeechRecognition||window.webkitSpeechRecognition||null}function ue(){var he;const fe=te(),N=typeof window!="undefined"?window.isSecureContext:!1,pe=typeof navigator!="undefined"&&!!((he=navigator.mediaDevices)!=null&&he.getUserMedia);l.value=!!(fe&&N&&pe),N?(!pe||!fe)&&(A.value="Voice input is not supported in this browser."):A.value="Voice input requires HTTPS (or localhost).",fe&&l.value&&(T=new fe,T.continuous=!0,T.interimResults=!0,T.lang=typeof navigator!="undefined"&&navigator.language||"en-US",T.onstart=()=>{a.value=!0,u.value=!1,p.value=!1,$(),Se("Listening... Tap mic to stop","listening",{persistent:!0,key:"listening"})},T.onend=()=>{a.value=!1,u.value=!1,p.value=!1,$(),O.value==="listening"&&We(),z.value&&(z.value=!1,xt())},T.onerror=ke=>{if(a.value=!1,u.value=!1,p.value=!1,$(),z.value=!1,(ke==null?void 0:ke.error)==="not-allowed"||(ke==null?void 0:ke.error)==="service-not-allowed"){Se("Microphone permission denied. Please allow microphone access in browser settings.","error");return}if((ke==null?void 0:ke.error)==="audio-capture"){Se("No microphone detected. Please connect a microphone and try again.","error");return}if((ke==null?void 0:ke.error)==="no-speech"){Se("No speech detected. Try speaking a bit louder.","info");return}Se("Voice input failed. Please try again.","error")},T.onresult=ke=>{let ve="";for(let me=ke.resultIndex;me{if(T&&!(!a.value&&!p.value))try{T.abort()}catch{p.value=!1,z.value=!1}},1200)}}function Y(){if(!l.value||!T){Se(A.value,"error");return}if(a.value||u.value||p.value){Z({submitAfterStop:a.value});return}ce()}async function B(){var fe;if(g.value)return!0;if(!((fe=navigator.mediaDevices)!=null&&fe.getUserMedia))return Se("Microphone API is unavailable in this browser.","error"),!1;c.value=!0,Se("Requesting microphone permission...","info",{persistent:!0,key:"requesting"});try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(pe=>pe.stop()),g.value=!0,!0}catch(N){return(N==null?void 0:N.name)==="NotAllowedError"||(N==null?void 0:N.name)==="SecurityError"?Se("Microphone permission denied. Please allow it and try again.","error"):(N==null?void 0:N.name)==="NotFoundError"?Se("No microphone found on this device.","error"):Se("Unable to access microphone. Please check browser permissions.","error"),!1}finally{c.value=!1,O.value==="requesting"&&We()}}async function ce(){var N;if(!(!T||a.value||u.value||p.value||!await B()||!T)){z.value=!1,(N=o.value)==null||N.focus(),u.value=!0;try{T.start()}catch(pe){u.value=!1,p.value=!1,(pe==null?void 0:pe.name)!=="InvalidStateError"&&Se("Unable to start voice input. Please try again.","error")}}}function Se(fe,N="info",pe={}){const{duration:he=4200,persistent:ke=!1,key:ve=""}=pe;E.value=fe,m.value=N,O.value=ve,w.value=!0,W&&clearTimeout(W),ke||(W=setTimeout(()=>{w.value=!1,O.value=""},he))}function We(){w.value=!1,O.value="",W&&(clearTimeout(W),W=null)}function xt(){if(s.isAwaitingResponse){r("cancel");return}const fe=i.value.trim();fe&&((a.value||u.value||p.value)&&T&&Z({submitAfterStop:!1}),r("submit",fe),i.value="")}return t({focus:()=>{var fe;return(fe=o.value)==null?void 0:fe.focus()}}),Hn(()=>{ue()}),xs(()=>{if(T&&(a.value||u.value||p.value)){z.value=!1,$();try{T.abort()}catch{}}$(),We()}),(fe,N)=>(F(),q("div",Gd,[x("form",{class:"group flex min-h-11 items-center gap-2 rounded-full border border-slate-200/90 bg-white/95 px-3 shadow-[0_12px_26px_-20px_rgba(15,23,42,0.7)] transition-all duration-250 focus-within:-translate-y-0.5 focus-within:border-brand-200 focus-within:shadow-[0_18px_30px_-20px_rgba(13,110,253,0.5)] focus-within:ring-2 focus-within:ring-brand-500/25",style:{"border-radius":"9999px"},autocomplete:"off",onSubmit:ct(xt,["prevent"]),onClick:N[5]||(N[5]=ct(()=>{},["stop"])),onMousedown:N[6]||(N[6]=ct(()=>{},["stop"])),onKeydown:N[7]||(N[7]=ct(()=>{},["stop"])),onKeyup:N[8]||(N[8]=ct(()=>{},["stop"]))},[Pa(x("input",{ref_key:"inputRef",ref:o,type:"text","onUpdate:modelValue":N[0]||(N[0]=pe=>i.value=pe),class:"h-11 w-full border-none bg-transparent text-sm font-medium text-slate-800 placeholder:text-slate-400 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",placeholder:e.disabled?"Waiting for response...":e.placeholder,disabled:e.disabled,required:"",onKeydown:N[1]||(N[1]=ct(()=>{},["stop"])),onKeyup:N[2]||(N[2]=ct(()=>{},["stop"])),onKeypress:N[3]||(N[3]=ct(()=>{},["stop"])),onInput:N[4]||(N[4]=ct(()=>{},["stop"]))},null,40,Kd),[[Xu,i.value]]),x("button",{type:"button",class:ye(["grid h-8 w-8 shrink-0 appearance-none place-items-center rounded-full border border-transparent text-slate-600 transition-all duration-200 hover:-translate-y-0.5 hover:border-slate-200 hover:bg-slate-100 hover:text-slate-900 focus:outline-none disabled:cursor-not-allowed disabled:opacity-40",a.value?"border-red-200 bg-red-100 text-red-600 shadow-[0_10px_20px_-18px_rgba(220,38,38,0.9)] hover:bg-red-100 hover:text-red-600":""]),style:{"border-radius":"9999px"},title:P.value,"aria-label":P.value,disabled:e.disabled||!l.value||c.value||u.value||p.value,onClick:Y},[a.value&&!c.value?(F(),q("svg",Zd,N[9]||(N[9]=[x("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"},null,-1)]))):c.value?(F(),q("svg",Qd,N[11]||(N[11]=[x("circle",{cx:"12",cy:"12",r:"9",opacity:"0.3"},null,-1),x("path",{d:"M21 12a9 9 0 0 1-9 9"},null,-1)]))):(F(),q("svg",Xd,N[10]||(N[10]=[x("path",{d:"M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z"},null,-1),x("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"},null,-1),x("path",{d:"M12 19v3"},null,-1)])))],10,Yd),x("button",{type:"submit",title:I.value,"aria-label":I.value,class:ye(["grid h-8 w-8 shrink-0 appearance-none place-items-center rounded-full border-0 transition-all duration-200 hover:-translate-y-0.5 focus:outline-none disabled:cursor-not-allowed disabled:opacity-40",j.value]),style:{"border-radius":"9999px"},disabled:re.value},[e.isAwaitingResponse?(F(),q("svg",ep,N[12]||(N[12]=[x("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor","stroke-width":"2.1",class:"opacity-95"},null,-1),x("rect",{x:"9",y:"9",width:"6",height:"6",rx:"1.35",fill:"currentColor"},null,-1)]))):(F(),q("svg",tp,N[13]||(N[13]=[x("path",{d:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.59 5.58L20 12l-8-8-8 8z"},null,-1)])))],10,Jd)],32),Me(Wd,{visible:w.value,message:E.value,type:m.value,dismissible:m.value!=="listening",onClose:We},null,8,["visible","message","type","dismissible"])]))}},sp={class:"relative overflow-hidden bg-linear-to-br from-brand-600 via-brand-500 to-violet-400"},rp={class:"min-w-0"},ip={key:1,class:"border-t border-slate-200/80 bg-white/90 px-3 py-3 pb-[calc(12px+env(safe-area-inset-bottom))] backdrop-blur-sm sm:px-4 sm:py-4"},op=56,lp={__name:"ChatbotPopup",props:{isOpen:{type:Boolean,required:!0},activeTab:{type:String,required:!0},debugEnabled:{type:Boolean,default:!1},sendNonERPtoaiEnabled:{type:Boolean,default:!1},chatHistory:{type:Array,required:!0},debugLogs:{type:Array,required:!0},currentDebug:{type:Object,default:null},supportHistory:{type:Array,required:!0},autoReadEnabled:{type:Boolean,required:!0},ttsConfig:{type:Object,required:!0},activeTtsProvider:{type:String,required:!0},settings:{type:Object,default:null},isAwaitingResponse:{type:Boolean,default:!1}},emits:["close","submit","cancelResponse","update:activeTab","toggleAutoRead","togglePollyPreference","toggleDebug","toggleSendNonERP"],setup(e,{expose:t,emit:n}){const s=e,r=n,i=J(null),o=J(null),a=J(s.activeTab),l=J("default"),c=J(!1);function u(){const m=i.value;if(!s.isOpen||!m){c.value=!1;return}const A=m.scrollHeight-m.clientHeight;if(A<=4){c.value=!1;return}const T=A-m.scrollTop;c.value=T>op}function p(){const m=i.value;m&&(m.scrollTo({top:m.scrollHeight,behavior:"smooth"}),setTimeout(()=>{u()},220))}function g(){Tt(()=>{u()})}function w(){if(l.value==="default"){l.value="half";return}if(l.value==="half"){l.value="full";return}l.value="default"}const E=Re(()=>{const m="chat-shell fixed z-[9999] flex min-h-0 flex-col overflow-hidden border border-slate-200/80 shadow-[0_32px_80px_-44px_rgba(2,6,23,0.7),0_18px_40px_-24px_rgba(15,23,42,0.45)] transition-all duration-300 ease-out origin-bottom-right",A=s.isOpen?"pointer-events-auto opacity-100 translate-x-0 translate-y-0 scale-100 motion-safe:animate-surface-in":"pointer-events-none opacity-0 translate-x-1/5 translate-y-8 scale-95";return l.value==="full"?[m,A,"inset-0 h-screen w-screen max-h-screen max-w-screen rounded-none origin-center"]:l.value==="half"?[m,A,"bottom-[74px] right-5 h-[min(86vh,860px)] w-[min(50vw,860px)] rounded-2xl","max-[900px]:bottom-[78px] max-[900px]:right-3 max-[900px]:h-[min(86vh,760px)] max-[900px]:w-[min(70vw,760px)] max-[900px]:rounded-[14px]","max-[600px]:inset-0 max-[600px]:h-screen max-[600px]:w-screen max-[600px]:max-h-screen max-[600px]:max-w-screen max-[600px]:rounded-none max-[600px]:pb-[env(safe-area-inset-bottom)]"]:[m,A,"bottom-[74px] right-5 h-[min(560px,72vh)] w-[min(360px,calc(100vw-40px))] rounded-2xl","max-[900px]:bottom-[78px] max-[900px]:right-3 max-[900px]:h-[min(70vh,540px)] max-[900px]:w-[min(360px,calc(100vw-24px))] max-[900px]:rounded-[14px]","max-[600px]:inset-0 max-[600px]:h-screen max-[600px]:w-screen max-[600px]:max-h-screen max-[600px]:max-w-screen max-[600px]:rounded-none max-[600px]:pb-[env(safe-area-inset-bottom)]"]});return rn(()=>s.activeTab,m=>{a.value=m,g()}),rn(()=>s.isOpen,m=>{m&&a.value!=="settings"&&Tt(()=>{var A;return(A=o.value)==null?void 0:A.focus()}),g()}),rn(a,m=>{r("update:activeTab",m),g()}),rn(()=>[s.chatHistory.length,s.supportHistory.length,s.debugLogs.length,s.currentDebug],()=>{g()}),rn(()=>s.debugEnabled,m=>{!m&&a.value==="debug"&&(a.value="chat"),g()}),Hn(()=>{g()}),t({scrollToBottom(){Tt(()=>{p()})}}),(m,A)=>(F(),q("div",{class:ye(E.value),onKeydown:A[9]||(A[9]=ct(()=>{},["stop"])),onKeyup:A[10]||(A[10]=ct(()=>{},["stop"])),onKeypress:A[11]||(A[11]=ct(()=>{},["stop"]))},[A[14]||(A[14]=x("div",{class:"pointer-events-none absolute -right-14 -top-14 h-36 w-36 rounded-full bg-brand-500/15 blur-2xl"},null,-1)),A[15]||(A[15]=x("div",{class:"pointer-events-none absolute -bottom-14 -left-12 h-32 w-32 rounded-full bg-violet-400/15 blur-2xl"},null,-1)),x("div",sp,[A[12]||(A[12]=x("div",{class:"pointer-events-none absolute inset-0 opacity-45",style:{background:"linear-gradient(120deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.02) 52%, rgba(255,255,255,0.12) 100%)"}},null,-1)),Me(vc,{windowMode:l.value,autoReadEnabled:e.autoReadEnabled,activeTtsProvider:e.activeTtsProvider,onClose:A[0]||(A[0]=T=>m.$emit("close")),onCycleResize:w,onToggleAutoRead:A[1]||(A[1]=T=>m.$emit("toggleAutoRead"))},null,8,["windowMode","autoReadEnabled","activeTtsProvider"]),Me(Sc,{modelValue:a.value,"onUpdate:modelValue":A[2]||(A[2]=T=>a.value=T),debugEnabled:e.debugEnabled},null,8,["modelValue","debugEnabled"])]),x("div",{class:"chat-scrollbar min-h-0 flex-1 overflow-x-hidden overflow-y-scroll bg-slate-50/60 px-4 py-4 max-[900px]:px-3.5 max-[900px]:py-3.5 max-[600px]:px-3 max-[600px]:py-3",ref_key:"chatBodyRef",ref:i,onScrollPassive:u},[x("div",rp,[a.value==="chat"?(F(),St(md,{key:0,messages:e.chatHistory,autoReadEnabled:e.autoReadEnabled,ttsConfig:e.ttsConfig},null,8,["messages","autoReadEnabled","ttsConfig"])):a.value==="debug"&&e.debugEnabled?(F(),St(_d,{key:1,logs:e.debugLogs,currentDebug:e.currentDebug},null,8,["logs","currentDebug"])):a.value==="support"?(F(),St(Sd,{key:2,messages:e.supportHistory,autoReadEnabled:e.autoReadEnabled,ttsConfig:e.ttsConfig},null,8,["messages","autoReadEnabled","ttsConfig"])):a.value==="settings"?(F(),St(Vd,{key:3,autoReadEnabled:e.autoReadEnabled,ttsConfig:e.ttsConfig,settings:e.settings,debugEnabled:e.debugEnabled,sendNonERPtoaiEnabled:e.sendNonERPtoaiEnabled,onToggleAutoRead:A[3]||(A[3]=T=>m.$emit("toggleAutoRead")),onTogglePollyPreference:A[4]||(A[4]=T=>m.$emit("togglePollyPreference")),onToggleDebug:A[5]||(A[5]=T=>m.$emit("toggleDebug")),onToggleSendNonERP:A[6]||(A[6]=T=>m.$emit("toggleSendNonERP"))},null,8,["autoReadEnabled","ttsConfig","settings","debugEnabled","sendNonERPtoaiEnabled"])):Ve("",!0)])],544),c.value?(F(),q("button",{key:0,type:"button",class:ye(["absolute right-4 z-20 grid h-9 w-9 place-items-center rounded-full border border-brand-200/70 bg-white/95 text-brand-600 shadow-[0_14px_26px_-16px_rgba(15,23,42,0.65)] transition-all duration-200 hover:-translate-y-0.5 hover:border-brand-300 hover:text-brand-700 focus:outline-none",a.value!=="settings"?"bottom-[calc(90px+env(safe-area-inset-bottom))] sm:bottom-[96px]":"bottom-4 sm:bottom-5"]),title:"Scroll to bottom","aria-label":"Scroll to bottom",onClick:p},A[13]||(A[13]=[x("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},[x("path",{d:"M7 10l5 5 5-5"})],-1)]),2)):Ve("",!0),a.value!=="settings"?(F(),q("div",ip,[Me(np,{ref_key:"chatFormRef",ref:o,placeholder:a.value==="support"?"Message Support...":"Message...",disabled:a.value==="chat"&&e.isAwaitingResponse,isAwaitingResponse:a.value==="chat"&&e.isAwaitingResponse,onSubmit:A[7]||(A[7]=T=>m.$emit("submit",T)),onCancel:A[8]||(A[8]=T=>m.$emit("cancelResponse"))},null,8,["placeholder","disabled","isAwaitingResponse"])])):Ve("",!0)],34))}},_l="changai_chat_id",kl="changai_polly_enabled";function ap(){let e=sessionStorage.getItem(_l);return e||(e=`session_${Date.now()}_${crypto.randomUUID()}`,sessionStorage.setItem(_l,e)),e}function up(){const e=localStorage.getItem(kl);return e===null?!0:e==="true"}function cp(e){localStorage.setItem(kl,String(!!e))}const fp={__name:"App",setup(e){const t=J(!1),n=J("chat"),s=J([]),r=J([]),i=J(!1),o=J([]),a=J(null),l=J("actual"),c=J(!0),u=J(null),p=J(!1),g=J(null),w=J(!1),E=J({enableVoiceChat:!1,pollyAvailable:!1,usePolly:!0,voiceId:"Zayd",enable_changai:!1}),m=J("off"),A=J(null),T=Re(()=>A.value!==null);function W(){if(!E.value.enableVoiceChat){m.value="off";return}m.value=E.value.usePolly?"polly":"browser"}function K(Y){var ce;const B=(ce=Y==null?void 0:Y.detail)==null?void 0:ce.provider;(B==="polly"||B==="browser"||B==="off")&&(m.value=B)}async function O(){var ce,Se,We,xt,fe;if(!(p.value||u.value)){p.value=!0;try{u.value=await Mc(l.value),E.value={enableVoiceChat:!!((ce=u.value)!=null&&ce.enable_voice_chat),pollyAvailable:!!((Se=u.value)!=null&&Se.polly_enabled),usePolly:!!((We=u.value)!=null&&We.polly_enabled)&&up(),voiceId:((xt=u.value)==null?void 0:xt.polly_voice_id)||"Zayd",enable_changai:!!((fe=u.value)!=null&&fe.enable_changai)},W(),r.value.push({type:"settings",settings:u.value})}catch(N){const pe=vl(N);r.value.push({type:"settings",error:pe})}finally{p.value=!1}}}function z(){t.value=!t.value}function P(){var Y;(Y=a.value)==null||Y.scrollToBottom()}function I(){c.value=!c.value}function re(){const Y=!E.value.usePolly;E.value={...E.value,usePolly:Y&&E.value.pollyAvailable},cp(E.value.usePolly),W()}function j(){w.value=!w.value}async function te(Y){n.value==="support"?await Z(Y):await ue(Y)}async function ue(Y){var ve;g.value=null,l.value==="actual"&&await O(),s.value.push({role:"user",text:Y}),await Tt(),P();const B=us({role:"model",text:"Thinking...",cancelable:!0,isStatus:!0,statusType:"thinking"});s.value.push(B),await Tt(),P();let ce=!1;const Se=ap(),We=`${Se}_${Date.now()}`,xt=w.value,fe=Pc(Y,Se,l.value,We,w.value),N=`debug_${We}`;let pe=Date.now();const he=[],ke=me=>{var ze;const le=Date.now(),yt=((le-pe)/1e3).toFixed(2);pe=le;const Ct=`${me.message} (${yt}s)`;if(me.message&&(he.push(Ct),g.value=Ct),!me.done&&me.message&&(B.text=me.message,B.statusType="pipeline"),me.done){B.cancelable=!1,me.error?(B.text=`⚠️ ${me.message||"Something failed"}`,B.isStatus=!1,B.statusType=null):(ze=me.data)!=null&&ze.answer&&(B.text=me.data.answer,B.isStatus=!1,B.statusType=null),frappe.realtime.off(N),g.value=null;return}};frappe.realtime.on(N,ke),A.value=()=>{ce||(ce=!0,fe.cancel(),frappe.realtime.off(N),B.isStatus=!1,B.statusType=null,B.text="Cancelled by user.",r.value.push({type:"cancelled",user:Y,steps:[...he]}),g.value=null,B.cancelable=!1,A.value=null)};try{const me=await fe.promise;if(ce)return;B.cancelable=!1;const le=((ve=bd(me==null?void 0:me.Bot))==null?void 0:ve.trim())||"No response.";B.isStatus=!1,B.statusType=null,B.text=le,r.value.push({type:"success",user:Y,steps:[...he],final_response:me}),g.value=null}catch(me){if(ce)return;frappe.realtime.off(N),B.cancelable=!1,B.isStatus=!1,B.statusType=null;const le=vl(me);g.value=null,r.value.push({type:"failed",user:Y,steps:[...he],error:le}),error==="ERR_NETWORK_CHANGED"&&(B.isStatus=!1,B.statusType=null,B.text="⚠️ Network error. Please check your connection and try again."),B.isStatus=!1,B.statusType=null,B.text="⚠️ Something went wrong. Please try again."}finally{frappe.realtime.off(N),ce||(A.value=null)}await Tt(),P()}function $(){var Y;(Y=A.value)==null||Y.call(A)}async function Z(Y){o.value.push({role:"user",text:Y}),await Tt(),P();const B=us({role:"model",text:"Sending to support...",isStatus:!0,statusType:"support"});o.value.push(B),await Tt(),P();try{const ce=await Ic(Y,l.value);B.text=ce?wl(ce):"Support request sent successfully."}catch{B.text="⚠️ Failed to reach support. Please try again."}await Tt(),P()}return Hn(()=>{typeof window!="undefined"&&window.addEventListener("changai-tts-provider",K),l.value==="actual"&&O()}),xs(()=>{typeof window!="undefined"&&window.removeEventListener("changai-tts-provider",K)}),(Y,B)=>(F(),q(Be,null,[E.value.enable_changai?(F(),St(ac,{key:0,isOpen:t.value,onToggle:z},null,8,["isOpen"])):Ve("",!0),Me(lp,{ref_key:"popupRef",ref:a,isOpen:t.value,activeTab:n.value,"onUpdate:activeTab":B[0]||(B[0]=ce=>n.value=ce),chatHistory:s.value,debugLogs:r.value,currentDebug:g.value,supportHistory:o.value,autoReadEnabled:c.value,ttsConfig:E.value,activeTtsProvider:m.value,settings:u.value,isAwaitingResponse:T.value,debugEnabled:i.value,sendNonERPtoaiEnabled:w.value,onToggleDebug:B[1]||(B[1]=ce=>i.value=!i.value),onClose:B[2]||(B[2]=ce=>t.value=!1),onSubmit:te,onCancelResponse:$,onToggleAutoRead:I,onTogglePollyPreference:re,onToggleSendNonERP:j},null,8,["isOpen","activeTab","chatHistory","debugLogs","currentDebug","supportHistory","autoReadEnabled","ttsConfig","activeTtsProvider","settings","isAwaitingResponse","debugEnabled","sendNonERPtoaiEnabled"])],64))}};function dp(){const e=document.querySelector('link[href*="/assets/changai/dist/changai-chatbot.css"]');if(e!=null&&e.href)return e.href;const t=Array.from(document.scripts).find(n=>{var s;return(s=n.src)==null?void 0:s.includes("/assets/changai/dist/changai-chatbot.js")});return t!=null&&t.src?t.src.replace(/changai-chatbot\.js(\?.*)?$/,"changai-chatbot.css$1"):null}function pp(e){const t=dp();if(!t){const n=Array.from(document.querySelectorAll("style[data-vite-dev-id]"));return n.length&&n.forEach(s=>{const r=document.createElement("style");r.dataset.changaiShadowDevStyle="1",r.textContent=s.textContent||"",e.appendChild(r)}),Promise.resolve()}return e.querySelector('link[data-changai-shadow-style="1"]')?Promise.resolve():new Promise(n=>{const s=document.createElement("link");s.rel="stylesheet",s.href=t,s.dataset.changaiShadowStyle="1",s.onload=()=>n(),s.onerror=()=>n(),e.appendChild(s),setTimeout(n,1200)})}async function Tl(){if(document.getElementById("changai-chatbot-host"))return;const e=document.createElement("div");e.id="changai-chatbot-host",document.body.appendChild(e);const t=e.attachShadow({mode:"open"});await pp(t);const n=document.createElement("div");n.id="changai-chatbot-root",t.appendChild(n),nc(fp).mount(n);function s(r){r.stopPropagation()}n.addEventListener("keydown",s),n.addEventListener("keyup",s),n.addEventListener("keypress",s)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Tl):Tl()})();
+`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Ct(e,!0)}`}br(e){return"
"}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let s=this.parser.parseInline(n),r=Jo(e);if(r===null)return s;e=r;let i='"+s+"",i}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let r=Jo(e);if(r===null)return Ct(n);e=r;let i=`
",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ct(e.text)}},Lr=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},wt=class Qr{constructor(t){_e(this,"options");_e(this,"renderer");_e(this,"textRenderer");this.options=t||cn,this.options.renderer=this.options.renderer||new $s,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Lr}static parse(t,n){return new Qr(n).parse(t)}static parseInline(t,n){return new Qr(n).parseInline(t)}parse(t){var s,r;this.renderer.parser=this;let n="";for(let i=0;i{let l=o[a].flat(1/0);n=n.concat(this.walkTokens(l,t))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=t.renderers[r.name];i?t.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[r.level];i?i.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),s.extensions=t),n.renderer){let r=this.defaults.renderer||new $s(this.defaults);for(let i in n.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,a=n.renderer[o],l=r[o];r[o]=(...f)=>{let u=a.apply(r,f);return u===!1&&(u=l.apply(r,f)),u||""}}s.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new Ls(this.defaults);for(let i in n.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,a=n.tokenizer[o],l=r[o];r[o]=(...f)=>{let u=a.apply(r,f);return u===!1&&(u=l.apply(r,f)),u}}s.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new Zn;for(let i in n.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,a=n.hooks[o],l=r[o];Zn.passThroughHooks.has(i)?r[o]=f=>{if(this.defaults.async&&Zn.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await a.call(r,f);return l.call(r,d)})();let u=a.call(r,f);return l.call(r,u)}:r[o]=(...f)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(r,f);return d===!1&&(d=await l.apply(r,f)),d})();let u=a.apply(r,f);return u===!1&&(u=l.apply(r,f)),u}}s.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,i=n.walkTokens;s.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return yt.lex(e,t!=null?t:this.defaults)}parser(e,t){return wt.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let s={...n},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let o=r.hooks?await r.hooks.preprocess(t):t,a=await(r.hooks?await r.hooks.provideLexer(e):e?yt.lex:yt.lexInline)(o,r),l=r.hooks?await r.hooks.processAllTokens(a):a;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let f=await(r.hooks?await r.hooks.provideParser(e):e?wt.parse:wt.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(f):f})().catch(i);try{r.hooks&&(t=r.hooks.preprocess(t));let o=(r.hooks?r.hooks.provideLexer(e):e?yt.lex:yt.lexInline)(t,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let a=(r.hooks?r.hooks.provideParser(e):e?wt.parse:wt.parseInline)(o,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(o){return i(o)}}}onError(e,t){return n=>{if(n.message+=`
+Please report this to https://github.com/markedjs/marked.`,e){let s="An error occurred:
"+Ct(n.message+"",!0)+"
";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},pn=new vf;function xe(e,t){return pn.parse(e,t)}xe.options=xe.setOptions=function(e){return pn.setOptions(e),xe.defaults=pn.defaults,Ho(xe.defaults),xe},xe.getDefaults=Sr,xe.defaults=cn,xe.use=function(...e){return pn.use(...e),xe.defaults=pn.defaults,Ho(xe.defaults),xe},xe.walkTokens=function(e,t){return pn.walkTokens(e,t)},xe.parseInline=pn.parseInline,xe.Parser=wt,xe.parser=wt.parse,xe.Renderer=$s,xe.TextRenderer=Lr,xe.Lexer=yt,xe.lexer=yt.lex,xe.Tokenizer=Ls,xe.Hooks=Zn,xe.parse=xe,xe.options,xe.setOptions,xe.use,xe.walkTokens,xe.parseInline,wt.parse,yt.lex;function sl(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n2?s-2:0),i=2;i1?n-1:0),r=1;r1?n-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:Xn;if(il&&il(e,null),!Xe(t))return e;let s=t.length;for(;s--;){let r=t[s];if(typeof r=="string"){const i=n(r);i!==r&&(Af(t)||(t[s]=i),r=i)}e[r]=!0}return e}function Df(e){for(let t=0;t/g),jf=dt(/\${[\w\W]*/g),Vf=dt(/^data-[\-\w.\u00B7-\uFFFF]+$/),qf=dt(/^aria-[\-\w]+$/),ml=dt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wf=dt(/^(?:\w+script|data):/i),Gf=dt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Kf=dt(/^html$/i),Yf=dt(/^[a-z][.\w]*(-[.\w]+)+$/i),Rn={element:1,text:3,progressingInstruction:7,comment:8,document:9},Zf=function(){return typeof window=="undefined"?null:window},Xf=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(s=n.getAttribute(r));const i="dompurify"+(s?"#"+s:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return null}},bl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function xl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Zf();const t=q=>xl(q);if(t.version="3.4.3",t.removed=[],!e||!e.document||e.document.nodeType!==Rn.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const s=n,r=s.currentScript,i=e.DocumentFragment,o=e.HTMLTemplateElement,a=e.Node,l=e.Element,f=e.NodeFilter,u=e.NamedNodeMap,d=u===void 0?e.NamedNodeMap||e.MozNamedAttrMap:u,g=e.HTMLFormElement,y=e.DOMParser,E=e.trustedTypes,x=l.prototype,M=An(x,"cloneNode"),m=An(x,"remove"),H=An(x,"nextSibling"),Y=An(x,"childNodes"),$=An(x,"parentNode");if(typeof o=="function"){const q=n.createElement("template");q.content&&q.content.ownerDocument&&(n=q.content.ownerDocument)}let z,O="";const P=n,ee=P.implementation,V=P.createNodeIterator,se=P.createDocumentFragment,fe=P.getElementsByTagName,D=s.importNode;let Z=bl();t.isSupported=typeof rl=="function"&&typeof $=="function"&&ee&&ee.createHTMLDocument!==void 0;const Se=zf,Ue=Uf,te=jf,C=Vf,pe=qf,Ge=Wf,re=Gf,B=Yf;let de=ml,ae=null;const ve=X({},[...pl,...Fr,...Br,...Hr,...dl]);let ge=null;const nt=X({},[...hl,...zr,...gl,...Ns]);let ye=Object.seal(Tn(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ht=null,G=null;const Ce=Object.seal(Tn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ft=!0,c=!0,h=!1,b=!0,k=!1,v=!0,_=!1,I=!1,R=!1,A=!1,S=!1,U=!1,L=!0,j=!1;const K="user-content-";let ne=!0,he=!1,ie={},ke=null;const $e=X({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ot=null;const lt=X({},["audio","video","img","source","image","track"]);let Bt=null;const Jn=X({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),De="http://www.w3.org/1998/Math/MathML",Qe="http://www.w3.org/2000/svg",at="http://www.w3.org/1999/xhtml";let Ht=at,Ur=!1,jr=null;const hd=X({},[De,Qe,at],Nr);let Vr=X({},["mi","mo","mn","ms","mtext"]),qr=X({},["annotation-xml"]);const gd=X({},["title","style","font","a","script"]);let es=null;const md=["application/xhtml+xml","text/html"],bd="text/html";let Le=null,Cn=null;const xd=n.createElement("form"),Sl=function(p){return p instanceof RegExp||p instanceof Function},Wr=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Cn&&Cn===p)return;(!p||typeof p!="object")&&(p={}),p=tt(p),es=md.indexOf(p.PARSER_MEDIA_TYPE)===-1?bd:p.PARSER_MEDIA_TYPE,Le=es==="application/xhtml+xml"?Nr:Xn,ae=Ae(p,"ALLOWED_TAGS")&&Xe(p.ALLOWED_TAGS)?X({},p.ALLOWED_TAGS,Le):ve,ge=Ae(p,"ALLOWED_ATTR")&&Xe(p.ALLOWED_ATTR)?X({},p.ALLOWED_ATTR,Le):nt,jr=Ae(p,"ALLOWED_NAMESPACES")&&Xe(p.ALLOWED_NAMESPACES)?X({},p.ALLOWED_NAMESPACES,Nr):hd,Bt=Ae(p,"ADD_URI_SAFE_ATTR")&&Xe(p.ADD_URI_SAFE_ATTR)?X(tt(Jn),p.ADD_URI_SAFE_ATTR,Le):Jn,ot=Ae(p,"ADD_DATA_URI_TAGS")&&Xe(p.ADD_DATA_URI_TAGS)?X(tt(lt),p.ADD_DATA_URI_TAGS,Le):lt,ke=Ae(p,"FORBID_CONTENTS")&&Xe(p.FORBID_CONTENTS)?X({},p.FORBID_CONTENTS,Le):$e,ht=Ae(p,"FORBID_TAGS")&&Xe(p.FORBID_TAGS)?X({},p.FORBID_TAGS,Le):tt({}),G=Ae(p,"FORBID_ATTR")&&Xe(p.FORBID_ATTR)?X({},p.FORBID_ATTR,Le):tt({}),ie=Ae(p,"USE_PROFILES")?p.USE_PROFILES&&typeof p.USE_PROFILES=="object"?tt(p.USE_PROFILES):p.USE_PROFILES:!1,Ft=p.ALLOW_ARIA_ATTR!==!1,c=p.ALLOW_DATA_ATTR!==!1,h=p.ALLOW_UNKNOWN_PROTOCOLS||!1,b=p.ALLOW_SELF_CLOSE_IN_ATTR!==!1,k=p.SAFE_FOR_TEMPLATES||!1,v=p.SAFE_FOR_XML!==!1,_=p.WHOLE_DOCUMENT||!1,A=p.RETURN_DOM||!1,S=p.RETURN_DOM_FRAGMENT||!1,U=p.RETURN_TRUSTED_TYPE||!1,R=p.FORCE_BODY||!1,L=p.SANITIZE_DOM!==!1,j=p.SANITIZE_NAMED_PROPS||!1,ne=p.KEEP_CONTENT!==!1,he=p.IN_PLACE||!1,de=Ff(p.ALLOWED_URI_REGEXP)?p.ALLOWED_URI_REGEXP:ml,Ht=typeof p.NAMESPACE=="string"?p.NAMESPACE:at,Vr=Ae(p,"MATHML_TEXT_INTEGRATION_POINTS")&&p.MATHML_TEXT_INTEGRATION_POINTS&&typeof p.MATHML_TEXT_INTEGRATION_POINTS=="object"?tt(p.MATHML_TEXT_INTEGRATION_POINTS):X({},["mi","mo","mn","ms","mtext"]),qr=Ae(p,"HTML_INTEGRATION_POINTS")&&p.HTML_INTEGRATION_POINTS&&typeof p.HTML_INTEGRATION_POINTS=="object"?tt(p.HTML_INTEGRATION_POINTS):X({},["annotation-xml"]);const T=Ae(p,"CUSTOM_ELEMENT_HANDLING")&&p.CUSTOM_ELEMENT_HANDLING&&typeof p.CUSTOM_ELEMENT_HANDLING=="object"?tt(p.CUSTOM_ELEMENT_HANDLING):Tn(null);if(ye=Tn(null),Ae(T,"tagNameCheck")&&Sl(T.tagNameCheck)&&(ye.tagNameCheck=T.tagNameCheck),Ae(T,"attributeNameCheck")&&Sl(T.attributeNameCheck)&&(ye.attributeNameCheck=T.attributeNameCheck),Ae(T,"allowCustomizedBuiltInElements")&&typeof T.allowCustomizedBuiltInElements=="boolean"&&(ye.allowCustomizedBuiltInElements=T.allowCustomizedBuiltInElements),k&&(c=!1),S&&(A=!0),ie&&(ae=X({},dl),ge=Tn(null),ie.html===!0&&(X(ae,pl),X(ge,hl)),ie.svg===!0&&(X(ae,Fr),X(ge,zr),X(ge,Ns)),ie.svgFilters===!0&&(X(ae,Br),X(ge,zr),X(ge,Ns)),ie.mathMl===!0&&(X(ae,Hr),X(ge,gl),X(ge,Ns))),Ce.tagCheck=null,Ce.attributeCheck=null,Ae(p,"ADD_TAGS")&&(typeof p.ADD_TAGS=="function"?Ce.tagCheck=p.ADD_TAGS:Xe(p.ADD_TAGS)&&(ae===ve&&(ae=tt(ae)),X(ae,p.ADD_TAGS,Le))),Ae(p,"ADD_ATTR")&&(typeof p.ADD_ATTR=="function"?Ce.attributeCheck=p.ADD_ATTR:Xe(p.ADD_ATTR)&&(ge===nt&&(ge=tt(ge)),X(ge,p.ADD_ATTR,Le))),Ae(p,"ADD_URI_SAFE_ATTR")&&Xe(p.ADD_URI_SAFE_ATTR)&&X(Bt,p.ADD_URI_SAFE_ATTR,Le),Ae(p,"FORBID_CONTENTS")&&Xe(p.FORBID_CONTENTS)&&(ke===$e&&(ke=tt(ke)),X(ke,p.FORBID_CONTENTS,Le)),Ae(p,"ADD_FORBID_CONTENTS")&&Xe(p.ADD_FORBID_CONTENTS)&&(ke===$e&&(ke=tt(ke)),X(ke,p.ADD_FORBID_CONTENTS,Le)),ne&&(ae["#text"]=!0),_&&X(ae,["html","head","body"]),ae.table&&(X(ae,["tbody"]),delete ht.tbody),p.TRUSTED_TYPES_POLICY){if(typeof p.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ds('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof p.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ds('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');z=p.TRUSTED_TYPES_POLICY,O=z.createHTML("")}else z===void 0&&(z=Xf(E,r)),z!==null&&typeof O=="string"&&(O=z.createHTML(""));Ze&&Ze(p),Cn=p},El=X({},[...Fr,...Br,...Bf]),Al=X({},[...Hr,...Hf]),yd=function(p){let T=$(p);(!T||!T.tagName)&&(T={namespaceURI:Ht,tagName:"template"});const N=Xn(p.tagName),ce=Xn(T.tagName);return jr[p.namespaceURI]?p.namespaceURI===Qe?T.namespaceURI===at?N==="svg":T.namespaceURI===De?N==="svg"&&(ce==="annotation-xml"||Vr[ce]):!!El[N]:p.namespaceURI===De?T.namespaceURI===at?N==="math":T.namespaceURI===Qe?N==="math"&&qr[ce]:!!Al[N]:p.namespaceURI===at?T.namespaceURI===Qe&&!qr[ce]||T.namespaceURI===De&&!Vr[ce]?!1:!Al[N]&&(gd[N]||!El[N]):!!(es==="application/xhtml+xml"&&jr[p.namespaceURI]):!1},vt=function(p){Sn(t.removed,{element:p});try{$(p).removeChild(p)}catch{m(p)}},dn=function(p,T){try{Sn(t.removed,{attribute:T.getAttributeNode(p),from:T})}catch{Sn(t.removed,{attribute:null,from:T})}if(T.removeAttribute(p),p==="is")if(A||S)try{vt(T)}catch{}else try{T.setAttribute(p,"")}catch{}},Rl=function(p){let T=null,N=null;if(R)p=""+p;else{const Me=al(p,/^[\r\n\t ]+/);N=Me&&Me[0]}es==="application/xhtml+xml"&&Ht===at&&(p=''+p+"");const ce=z?z.createHTML(p):p;if(Ht===at)try{T=new y().parseFromString(ce,es)}catch{}if(!T||!T.documentElement){T=ee.createDocument(Ht,"template",null);try{T.documentElement.innerHTML=Ur?O:ce}catch{}}const Ne=T.body||T.documentElement;return p&&N&&Ne.insertBefore(n.createTextNode(N),Ne.childNodes[0]||null),Ht===at?fe.call(T,_?"html":"body")[0]:_?T.documentElement:Ne},Cl=function(p){return V.call(p.ownerDocument||p,p,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},Gr=function(p){return p instanceof g&&(typeof p.nodeName!="string"||typeof p.textContent!="string"||typeof p.removeChild!="function"||!(p.attributes instanceof d)||typeof p.removeAttribute!="function"||typeof p.setAttribute!="function"||typeof p.namespaceURI!="string"||typeof p.insertBefore!="function"||typeof p.hasChildNodes!="function")},Kr=function(p){return typeof a=="function"&&p instanceof a};function zt(q,p,T){kn(q,N=>{N.call(t,p,T,Cn)})}const Pl=function(p){let T=null;if(zt(Z.beforeSanitizeElements,p,null),Gr(p))return vt(p),!0;const N=Le(p.nodeName);if(zt(Z.uponSanitizeElement,p,{tagName:N,allowedTags:ae}),v&&p.hasChildNodes()&&!Kr(p.firstElementChild)&&ze(/<[/\w!]/g,p.innerHTML)&&ze(/<[/\w!]/g,p.textContent)||v&&p.namespaceURI===at&&N==="style"&&Kr(p.firstElementChild)||p.nodeType===Rn.progressingInstruction||v&&p.nodeType===Rn.comment&&ze(/<[/\w]/g,p.data))return vt(p),!0;if(ht[N]||!(Ce.tagCheck instanceof Function&&Ce.tagCheck(N))&&!ae[N]){if(!ht[N]&&Ml(N)&&(ye.tagNameCheck instanceof RegExp&&ze(ye.tagNameCheck,N)||ye.tagNameCheck instanceof Function&&ye.tagNameCheck(N)))return!1;if(ne&&!ke[N]){const ce=$(p)||p.parentNode,Ne=Y(p)||p.childNodes;if(Ne&&ce){const Me=Ne.length;for(let st=Me-1;st>=0;--st){const gt=M(Ne[st],!0);ce.insertBefore(gt,H(p))}}}return vt(p),!0}return p instanceof l&&!yd(p)||(N==="noscript"||N==="noembed"||N==="noframes")&&ze(/<\/no(script|embed|frames)/i,p.innerHTML)?(vt(p),!0):(k&&p.nodeType===Rn.text&&(T=p.textContent,kn([Se,Ue,te],ce=>{T=En(T,ce," ")}),p.textContent!==T&&(Sn(t.removed,{element:p.cloneNode()}),p.textContent=T)),zt(Z.afterSanitizeElements,p,null),!1)},Il=function(p,T,N){if(G[T]||L&&(T==="id"||T==="name")&&(N in n||N in xd))return!1;const ce=ge[T]||Ce.attributeCheck instanceof Function&&Ce.attributeCheck(T,p);if(!(c&&!G[T]&&ze(C,T))){if(!(Ft&&ze(pe,T))){if(!ce||G[T]){if(!(Ml(p)&&(ye.tagNameCheck instanceof RegExp&&ze(ye.tagNameCheck,p)||ye.tagNameCheck instanceof Function&&ye.tagNameCheck(p))&&(ye.attributeNameCheck instanceof RegExp&&ze(ye.attributeNameCheck,T)||ye.attributeNameCheck instanceof Function&&ye.attributeNameCheck(T,p))||T==="is"&&ye.allowCustomizedBuiltInElements&&(ye.tagNameCheck instanceof RegExp&&ze(ye.tagNameCheck,N)||ye.tagNameCheck instanceof Function&&ye.tagNameCheck(N))))return!1}else if(!Bt[T]){if(!ze(de,En(N,re,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&p!=="script"&&ul(N,"data:")===0&&ot[p])){if(!(h&&!ze(Ge,En(N,re,"")))){if(N)return!1}}}}}}return!0},wd=X({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ml=function(p){return!wd[Xn(p)]&&ze(B,p)},Ol=function(p){zt(Z.beforeSanitizeAttributes,p,null);const T=p.attributes;if(!T||Gr(p))return;const N={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ge,forceKeepAttr:void 0};let ce=T.length;for(;ce--;){const Ne=T[ce],Me=Ne.name,st=Ne.namespaceURI,gt=Ne.value,_t=Le(Me),Zr=gt;let Fe=Me==="value"?Zr:Mf(Zr);if(N.attrName=_t,N.attrValue=Fe,N.keepAttr=!0,N.forceKeepAttr=void 0,zt(Z.uponSanitizeAttribute,p,N),Fe=N.attrValue,j&&(_t==="id"||_t==="name")&&ul(Fe,K)!==0&&(dn(Me,p),Fe=K+Fe),v&&ze(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Fe)){dn(Me,p);continue}if(_t==="attributename"&&al(Fe,"href")){dn(Me,p);continue}if(N.forceKeepAttr)continue;if(!N.keepAttr){dn(Me,p);continue}if(!b&&ze(/\/>/i,Fe)){dn(Me,p);continue}k&&kn([Se,Ue,te],$l=>{Fe=En(Fe,$l," ")});const Ll=Le(p.nodeName);if(!Il(Ll,_t,Fe)){dn(Me,p);continue}if(z&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!st)switch(E.getAttributeType(Ll,_t)){case"TrustedHTML":{Fe=z.createHTML(Fe);break}case"TrustedScriptURL":{Fe=z.createScriptURL(Fe);break}}if(Fe!==Zr)try{st?p.setAttributeNS(st,Me,Fe):p.setAttribute(Me,Fe),Gr(p)?vt(p):ll(t.removed)}catch{dn(Me,p)}}zt(Z.afterSanitizeAttributes,p,null)},Yr=function(p){let T=null;const N=Cl(p);for(zt(Z.beforeSanitizeShadowDOM,p,null);T=N.nextNode();)zt(Z.uponSanitizeShadowNode,T,null),Pl(T),Ol(T),T.content instanceof i&&Yr(T.content);zt(Z.afterSanitizeShadowDOM,p,null)},Bs=function(p){if(p.nodeType===Rn.element&&p.shadowRoot instanceof i){const ce=p.shadowRoot;Bs(ce),Yr(ce)}const T=p.childNodes;if(!T)return;const N=[];kn(T,ce=>{Sn(N,ce)});for(const ce of N)Bs(ce)};return t.sanitize=function(q){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,N=null,ce=null,Ne=null;if(Ur=!q,Ur&&(q=""),typeof q!="string"&&!Kr(q)&&(q=Nf(q),typeof q!="string"))throw Ds("dirty is not a string, aborting");if(!t.isSupported)return q;if(I||Wr(p),t.removed=[],typeof q=="string"&&(he=!1),he){const gt=q.nodeName;if(typeof gt=="string"){const _t=Le(gt);if(!ae[_t]||ht[_t])throw Ds("root node is forbidden and cannot be sanitized in-place")}Bs(q)}else if(q instanceof a)T=Rl(""),N=T.ownerDocument.importNode(q,!0),N.nodeType===Rn.element&&N.nodeName==="BODY"||N.nodeName==="HTML"?T=N:T.appendChild(N),Bs(N);else{if(!A&&!k&&!_&&q.indexOf("<")===-1)return z&&U?z.createHTML(q):q;if(T=Rl(q),!T)return A?null:U?O:""}T&&R&&vt(T.firstChild);const Me=Cl(he?q:T);for(;ce=Me.nextNode();)Pl(ce),Ol(ce),ce.content instanceof i&&Yr(ce.content);if(he)return q;if(A){if(k){T.normalize();let gt=T.innerHTML;kn([Se,Ue,te],_t=>{gt=En(gt,_t," ")}),T.innerHTML=gt}if(S)for(Ne=se.call(T.ownerDocument);T.firstChild;)Ne.appendChild(T.firstChild);else Ne=T;return(ge.shadowroot||ge.shadowrootmode)&&(Ne=D.call(s,Ne,!0)),Ne}let st=_?T.outerHTML:T.innerHTML;return _&&ae["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&ze(Kf,T.ownerDocument.doctype.name)&&(st="
+`+st),k&&kn([Se,Ue,te],gt=>{st=En(st,gt," ")}),z&&U?z.createHTML(st):st},t.setConfig=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Wr(q),I=!0},t.clearConfig=function(){Cn=null,I=!1},t.isValidAttribute=function(q,p,T){Cn||Wr({});const N=Le(q),ce=Le(p);return Il(N,ce,T)},t.addHook=function(q,p){typeof p=="function"&&Sn(Z[q],p)},t.removeHook=function(q,p){if(p!==void 0){const T=Pf(Z[q],p);return T===-1?void 0:If(Z[q],T,1)[0]}return ll(Z[q])},t.removeHooks=function(q){Z[q]=[]},t.removeAllHooks=function(){Z=bl()},t}var Qf=xl();const Jf={key:1,class:"flex min-w-0 max-w-[calc(100%-2.5rem)] flex-1 flex-col max-[600px]:max-w-[calc(100%-2.25rem)]"},ep={key:0,class:"flex w-fit flex-col items-start gap-1"},tp=["aria-label"],np={class:"inline-flex items-center gap-1.5"},sp={class:"text-[8px] font-semibold tracking-[0.12em] uppercase text-[#3a67c9]"},rp={key:1,class:"flex w-fit max-w-full flex-col items-start gap-2"},ip={class:"chat-card relative w-fit max-w-full whitespace-pre-line rounded-[10px_10px_10px_3px] px-4 py-3 text-xs leading-relaxed wrap-anywhere text-slate-900"},op=["innerHTML"],lp={key:0,class:"pointer-events-none absolute inset-x-0 bottom-0 h-14 rounded-b-[10px] bg-linear-to-t from-white via-white/92 to-white/0","aria-hidden":"true"},ap={key:0,class:"flex flex-wrap items-center gap-2"},up=["title","aria-label"],cp={key:1,class:"flex flex-wrap items-center"},fp=["title","aria-label"],pp={viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},dp=["innerHTML"],yl={__name:"ChatMessage",props:{message:{type:Object,required:!0},autoReadEnabled:{type:Boolean,default:!1},ttsConfig:{type:Object,default:()=>({enableVoiceChat:!1,pollyAvailable:!1,usePolly:!0,voiceId:"Zayd"})}},setup(e){const t=e,n=J(!1),s=J(null),r=J(!1),i=J(!1),o=Ee(()=>typeof window!="undefined"&&"speechSynthesis"in window&&"SpeechSynthesisUtterance"in window);function a(O){typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("changai-tts-provider",{detail:{provider:O}}))}function l(O){if(typeof O!="string")return"";const P=O.replace(/[\u{1F000}-\u{1FFFF}]/gu,"").replace(/[\u{2600}-\u{26FF}]/gu,"").replace(/[\u{2700}-\u{27BF}]/gu,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/#{1,6}\s+/g,"").replace(/[-*+]\s+/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\s+/g," ");return P.includes("<")?(new DOMParser().parseFromString(O,"text/html").body.textContent||"").replace(/\s+/g," ").trim():P.trim()}function f(){o.value&&window.speechSynthesis.cancel(),s.value&&(s.value.pause(),s.value.src="",s.value=null),n.value=!1}function u(){var O,P,ee;if(i.value=!i.value,i.value)f();else{const V=M.value;if(!t.autoReadEnabled||!((O=t.ttsConfig)!=null&&O.enableVoiceChat)||!V||E())return;if((P=t.ttsConfig)!=null&&P.pollyAvailable&&((ee=t.ttsConfig)!=null&&ee.usePolly)){g(V).catch(se=>{d(V)});return}d(V)}}function d(O){if(!o.value||!O)return;window.dispatchEvent(new CustomEvent("changai-tts-stop")),window.speechSynthesis.cancel();const P=new SpeechSynthesisUtterance(O);P.rate=1,P.pitch=1,P.onend=()=>{n.value=!1},P.onerror=()=>{n.value=!1},n.value=!0,a("browser"),window.speechSynthesis.speak(P)}async function g(O){var fe;const P=await Oc(O,((fe=t.ttsConfig)==null?void 0:fe.voiceId)||"Zayd");if(!(P!=null&&P.ok)||!(P!=null&&P.audio_base64))throw new Error((P==null?void 0:P.error)||"Polly synthesis failed");window.dispatchEvent(new CustomEvent("changai-tts-stop")),f();const ee=(P==null?void 0:P.mime_type)||"audio/mpeg",V=new Audio(`data:${ee};base64,${P.audio_base64}`);s.value=V,n.value=!0;let se=!1;V.onplay=()=>{se=!0,a("polly")},V.onended=()=>{s.value===V&&(s.value=null),n.value=!1},V.onerror=()=>{s.value===V&&(s.value=null),n.value=!1},await V.play(),se||a("polly")}function y(){f()}function E(){var O;return!!((O=t.message)!=null&&O.isStatus)}function x(O){const P=O.target.closest("a");!P||!P.href||(O.preventDefault(),O.stopPropagation(),window.open(P.href,"_blank","noopener,noreferrer"))}const M=Ee(()=>{var O;return l(((O=t.message)==null?void 0:O.text)||"")}),m=Ee(()=>{var O;return((O=t.message)==null?void 0:O.role)!=="user"&&E()}),H=Ee(()=>{var O;return(O=t.message)!=null&&O.isStatus?t.message.statusType==="support"?"Sending to support":M.value||"Thinking":""}),Y=Ee(()=>{var ee;if(((ee=t.message)==null?void 0:ee.role)==="user"||m.value)return!1;const O=M.value,P=O.split(/\n+/).filter(Boolean).length;return O.length>520||P>8}),$=Ee(()=>{var O,P;return((O=t.message)==null?void 0:O.role)!=="user"&&!m.value&&((P=t.ttsConfig)==null?void 0:P.enableVoiceChat)}),z=Ee(()=>{var P;const O=((P=t.message)==null?void 0:P.text)||"";return Qf.sanitize(xe.parse(O))});return on(()=>t.message.text,async(O,P)=>{var se,fe,D;if(!t.autoReadEnabled||t.message.role==="user"||i.value)return;if(!((se=t.ttsConfig)!=null&&se.enableVoiceChat)){a("off");return}const ee=l(O);if(!ee||E())return;const V=l(P||"");if(ee!==V){if((fe=t.ttsConfig)!=null&&fe.pollyAvailable&&((D=t.ttsConfig)!=null&&D.usePolly))try{await g(ee);return}catch{}d(ee)}}),on(()=>t.message.text,()=>{r.value=!1,i.value=!1}),zn(()=>{typeof window!="undefined"&&window.addEventListener("changai-tts-stop",y)}),ys(()=>{typeof window!="undefined"&&window.removeEventListener("changai-tts-stop",y),n.value&&f()}),(O,P)=>(F(),W("div",{class:we(["motion-safe:animate-fade-rise flex w-full gap-1.5",e.message.role==="user"?"flex-col items-end":"items-start"])},[e.message.role!=="user"?(F(),Et(Fo,{key:0})):qe("",!0),e.message.role!=="user"?(F(),W("div",Jf,[m.value?(F(),W("div",ep,[w("div",{class:"chat-card inline-flex w-fit rounded-[10px_10px_10px_3px] px-3 py-2",role:"status","aria-live":"polite","aria-label":H.value},[w("div",np,[P[1]||(P[1]=w("span",{class:"relative inline-flex h-4 w-4 shrink-0 items-center justify-center"},[w("span",{class:"absolute inset-0 rounded-full border border-transparent border-t-[#4b89ff] border-r-[#4b89ff]/70 animate-gemini-arc"}),w("svg",{viewBox:"0 0 24 24",class:"relative h-3 w-3 text-[#4b89ff] animate-gemini-spark","aria-hidden":"true"},[w("path",{fill:"currentColor",d:"M12 2.8c.52 3.22 1.6 5.66 3.22 7.28 1.62 1.62 4.06 2.7 7.28 3.22-3.22.52-5.66 1.6-7.28 3.22-1.62 1.62-2.7 4.06-3.22 7.28-.52-3.22-1.6-5.66-3.22-7.28-1.62-1.62-4.06-2.7-7.28-3.22 3.22-.52 5.66-1.6 7.28-3.22 1.62-1.62 2.7-4.06 3.22-7.28Z"})])],-1)),w("span",sp,Je(H.value),1)])],8,tp)])):(F(),W("div",rp,[w("div",ip,[w("div",{class:we(["overflow-x-auto",Y.value&&!r.value?"max-h-48 overflow-y-hidden":""]),innerHTML:z.value,onClick:x},null,10,op),Y.value&&!r.value?(F(),W("div",lp)):qe("",!0)]),Y.value?(F(),W("div",ap,[w("button",{type:"button",class:"inline-flex items-center rounded-full border border-slate-200 bg-white px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-600 transition-colors duration-200 hover:border-brand-200 hover:text-brand-600",title:r.value?"Collapse response":"Expand response","aria-label":r.value?"Collapse response":"Expand response",onClick:P[0]||(P[0]=ee=>r.value=!r.value)},Je(r.value?"Collapse":"Expand"),9,up)])):qe("",!0),$.value?(F(),W("div",cp,[w("button",{type:"button",class:we(["inline-flex h-8 w-8 items-center justify-center rounded-full border transition-colors duration-200",i.value?"border-red-200 bg-red-50 text-red-600 hover:border-red-300 hover:bg-red-100":"border-green-200 bg-green-50 text-green-600 hover:border-green-300 hover:bg-green-100"]),title:i.value?"Unmute voice playback":"Mute voice playback","aria-label":i.value?"Unmute voice playback":"Mute voice playback",onClick:u},[(F(),W("svg",pp,[P[6]||(P[6]=w("path",{d:"M11 5L6 9H3v6h3l5 4V5Z"},null,-1)),i.value?(F(),W(He,{key:0},[P[2]||(P[2]=w("path",{d:"M15 9l4 6"},null,-1)),P[3]||(P[3]=w("path",{d:"M19 9l-4 6"},null,-1))],64)):(F(),W(He,{key:1},[P[4]||(P[4]=w("path",{d:"M15 10a3 3 0 0 1 0 4"},null,-1)),P[5]||(P[5]=w("path",{d:"M17.5 7.5a6 6 0 0 1 0 9"},null,-1))],64))]))],10,fp)])):qe("",!0)]))])):(F(),W("div",{key:2,class:"w-fit max-w-[85%] whitespace-pre-line rounded-[13px_13px_3px_13px] bg-linear-to-br from-brand-500 to-brand-600 px-4 py-3 text-[11px] leading-relaxed wrap-anywhere text-white shadow-[0_14px_30px_-18px_rgba(109,79,194,0.85)] max-[600px]:max-w-[88%]",innerHTML:z.value},null,8,dp))],2))}},hp={class:"flex flex-col gap-4 sm:gap-5"},gp={class:"motion-safe:animate-fade-rise flex w-full items-start gap-1.5"},mp={__name:"ChatTab",props:{messages:{type:Array,required:!0},autoReadEnabled:{type:Boolean,default:!1},ttsConfig:{type:Object,required:!0}},setup(e){return(t,n)=>(F(),W("div",hp,[w("div",gp,[Oe(Fo),n[0]||(n[0]=w("p",{class:"w-fit max-w-[calc(100%-2.5rem)] whitespace-pre-line rounded-[10px_10px_10px_3px] bg-brand-50 px-4 py-3 text-xs leading-relaxed wrap-anywhere text-slate-900 max-[600px]:max-w-[calc(100%-2.25rem)]"},[Ss(" Hello there 👋 I am ChangAI from "),w("a",{target:"_blank",href:"https://erpgulf.com",rel:"noopener noreferrer",style:{color:"#1e90ff"}},"ERPGulf.com"),Ss(", your ERP assistant."),w("br"),w("a",{target:"_blank",href:"https://app.erpgulf.com/en/articles/chang-ai-quick-start-guide",rel:"noopener noreferrer",style:{color:"#1e90ff"}},"ChangAI Quick Start Guide - Click here.")],-1))]),(F(!0),W(He,null,ws(e.messages,(s,r)=>(F(),Et(yl,{key:r,message:s,autoReadEnabled:e.autoReadEnabled,ttsConfig:e.ttsConfig},null,8,["message","autoReadEnabled","ttsConfig"]))),128))]))}};function wl(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function vl(e){var t,n;return(e==null?void 0:e.message)||((t=e==null?void 0:e.responseJSON)==null?void 0:t.exception)||((n=e==null?void 0:e.responseJSON)==null?void 0:n.message)||(e==null?void 0:e.responseText)||String(e)}function bp(e){return typeof e=="string"?e:e&&typeof e=="object"?e.error?`⚠️ ${e.error}`:e.answer||e.text||"":""}const xp={key:0,class:"rounded-lg bg-brand-50 px-4 py-3 text-xs text-black"},yp={class:"whitespace-pre-wrap wrap-anywhere text-[11px] leading-relaxed text-black"},wp={key:1,class:"mb-3 min-w-0 overflow-x-auto rounded-lg bg-brand-50 p-2 text-[11px]"},vp={class:"whitespace-pre-wrap wrap-anywhere text-[11px] leading-relaxed text-black"},_p={__name:"DebugTab",props:{logs:{type:Array,required:!0},currentDebug:{type:Object,default:null}},setup(e){const t=new Set(["gemini_json_content","private_key","private_key_id","client_secret","client_id","aws_access_key","aws_secret_key","api_key","token","access_token","refresh_token","password","secret","authorization","embed_version_id","llm_version_id","entity_retriever","retriever","deploy_url","support_api_url","get_ticket_details_url"]);function n(r,i=0){if(i>10||r===null||r===void 0||typeof r=="string"||typeof r=="number"||typeof r=="boolean")return r;if(Array.isArray(r))return r.map(o=>n(o,i+1));if(typeof r=="object"){const o={};for(const[a,l]of Object.entries(r))t.has(a.toLowerCase())||(o[a]=n(l,i+1));return o}return r}function s(r){return wl(n(r))}return(r,i)=>(F(),W("div",null,[e.logs.length===0?(F(),W("p",xp,"No debug data yet.")):qe("",!0),(F(!0),W(He,null,ws(e.logs,(o,a)=>(F(),W("div",{key:a,class:"mb-3 min-w-0 overflow-x-auto rounded-lg bg-gray-100 p-2 text-[11px]"},[w("pre",yp,Je(s(o)),1)]))),128)),e.currentDebug?(F(),W("div",wp,[w("pre",vp,Je(s(e.currentDebug)),1)])):qe("",!0)]))}},Tp={class:"flex flex-col gap-4 sm:gap-5"},kp={key:0,class:"chat-card motion-safe:animate-fade-rise rounded-lg px-4 py-3 text-xs text-slate-900"},Sp={__name:"SupportTab",props:{messages:{type:Array,required:!0},autoReadEnabled:{type:Boolean,default:!1},ttsConfig:{type:Object,required:!0}},setup(e){return(t,n)=>(F(),W("div",Tp,[e.messages.length===0?(F(),W("p",kp,"Send a message to Support.")):qe("",!0),(F(!0),W(He,null,ws(e.messages,(s,r)=>(F(),Et(yl,{key:r,message:s,autoReadEnabled:e.autoReadEnabled,ttsConfig:e.ttsConfig},null,8,["message","autoReadEnabled","ttsConfig"]))),128))]))}},Ep={class:"flex flex-col gap-4"},Ap={class:"chat-card motion-safe:animate-fade-rise rounded-xl p-4"},Rp={class:"flex items-start justify-between gap-4"},Cp=["aria-pressed","title"],Pp={class:"chat-card motion-safe:animate-fade-rise rounded-xl p-4"},Ip={class:"flex items-start justify-between gap-4"},Mp={class:"mt-2 text-[11px] text-slate-500"},Op={key:0,class:"mt-1 text-[11px] text-slate-500"},Lp={key:1,class:"mt-1 text-[11px] text-slate-500"},$p=["aria-pressed","disabled"],Dp={key:0,class:"mt-3 rounded-md bg-amber-50 px-2.5 py-2 text-xs text-amber-700"},Np={key:1,class:"mt-3 rounded-md bg-amber-50 px-2.5 py-2 text-xs text-amber-700"},Fp={class:"chat-card motion-safe:animate-fade-rise rounded-xl p-4"},Bp={class:"flex items-start justify-between gap-4"},Hp=["aria-pressed","title"],zp={class:"chat-card motion-safe:animate-fade-rise rounded-xl p-4"},Up={class:"flex items-start justify-between gap-4"},jp=["aria-pressed","title"],Vp={__name:"SettingsTab",props:{autoReadEnabled:{type:Boolean,required:!0},ttsConfig:{type:Object,required:!0},settings:{type:Object,default:null},debugEnabled:{type:Boolean,default:!1},sendNonERPtoaiEnabled:{type:Boolean,default:!1}},emits:["toggleAutoRead","togglePollyPreference","toggleDebug","toggleSendNonERP"],setup(e){const t=e,n=Ee(()=>{var s,r;return(s=t.ttsConfig)!=null&&s.enableVoiceChat?(r=t.ttsConfig)!=null&&r.pollyAvailable?"Available":"Unavailable":"Voice disabled on server"});return(s,r)=>{var i,o,a,l,f,u,d,g,y,E,x,M,m,H,Y;return F(),W("div",Ep,[r[10]||(r[10]=w("div",{class:"chat-card motion-safe:animate-fade-rise rounded-xl p-4 text-slate-900"},[w("h3",{class:"text-sm font-semibold tracking-[0.01em]"},"Speech Settings"),w("p",{class:"mt-1 text-xs leading-relaxed text-slate-600"},"These controls apply only inside this chatbot box for the current browser session.")],-1)),w("div",Ap,[w("div",Rp,[r[4]||(r[4]=w("div",null,[w("p",{class:"text-sm font-semibold text-slate-900"},"Auto Read Replies"),w("p",{class:"mt-1 text-xs text-slate-600"},"Automatically read bot replies aloud.")],-1)),w("button",{class:we(["group relative h-7 w-12 shrink-0 rounded-full border border-slate-200 transition-all duration-200",e.autoReadEnabled?"bg-emerald-500/95":"bg-slate-300"]),"aria-pressed":e.autoReadEnabled?"true":"false",title:e.autoReadEnabled?"Disable auto read":"Enable auto read",onClick:r[0]||(r[0]=$=>s.$emit("toggleAutoRead"))},[w("span",{class:we(["absolute top-0.5 h-5.5 w-5.5 rounded-full bg-white shadow-sm transition-all duration-200",e.autoReadEnabled?"left-[1.45rem]":"left-0.5"])},null,2)],10,Cp)]),w("p",{class:we(["mt-3 text-[11px] font-medium",e.autoReadEnabled?"text-emerald-700":"text-slate-500"])},Je(e.autoReadEnabled?"Auto read is active.":"Auto read is currently off."),3)]),w("div",Pp,[w("div",Ip,[w("div",null,[r[5]||(r[5]=w("p",{class:"text-sm font-semibold text-slate-900"},"Use Amazon Polly",-1)),r[6]||(r[6]=w("p",{class:"mt-1 text-xs text-slate-600"},"Use Polly when available; otherwise browser speech is used automatically.",-1)),w("p",Mp,"Availability: "+Je(n.value),1),(i=e.settings)!=null&&i.aws_region?(F(),W("p",Op,"Region: "+Je(e.settings.aws_region),1)):qe("",!0),(o=e.ttsConfig)!=null&&o.voiceId?(F(),W("p",Lp,"Voice: "+Je(e.ttsConfig.voiceId),1)):qe("",!0)]),w("button",{class:we(["relative h-7 w-12 shrink-0 rounded-full border border-slate-200 transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-55",(a=e.ttsConfig)!=null&&a.usePolly&&((l=e.ttsConfig)!=null&&l.enableVoiceChat)&&((f=e.ttsConfig)!=null&&f.pollyAvailable)?"bg-emerald-500/95":"bg-slate-300"]),"aria-pressed":(u=e.ttsConfig)!=null&&u.usePolly&&((d=e.ttsConfig)!=null&&d.enableVoiceChat)&&((g=e.ttsConfig)!=null&&g.pollyAvailable)?"true":"false",disabled:!((y=e.ttsConfig)!=null&&y.pollyAvailable)||!((E=e.ttsConfig)!=null&&E.enableVoiceChat),onClick:r[1]||(r[1]=$=>s.$emit("togglePollyPreference"))},[w("span",{class:we(["absolute top-0.5 h-5.5 w-5.5 rounded-full bg-white shadow-sm transition-all duration-200",(x=e.ttsConfig)!=null&&x.usePolly&&((M=e.ttsConfig)!=null&&M.enableVoiceChat)&&((m=e.ttsConfig)!=null&&m.pollyAvailable)?"left-[1.45rem]":"left-0.5"])},null,2)],10,$p)]),(H=e.ttsConfig)!=null&&H.enableVoiceChat?(Y=e.ttsConfig)!=null&&Y.pollyAvailable?qe("",!0):(F(),W("p",Np,"Polly is not available for this site. Browser speech will be used.")):(F(),W("p",Dp,"Voice chat is disabled in ChangAI Settings."))]),w("div",Fp,[w("div",Bp,[w("div",null,[r[7]||(r[7]=w("p",{class:"text-sm font-semibold text-slate-900"},"Enable Debug Tab",-1)),r[8]||(r[8]=w("p",{class:"mt-1 text-xs text-slate-600"}," Show or hide the Debug tab inside this chatbot. ",-1)),w("p",{class:we(["mt-2 text-[11px] font-medium",e.debugEnabled?"text-emerald-700":"text-slate-500"])},Je(e.debugEnabled?"Debug tab is active.":"Debug tab is currently off."),3)]),w("button",{type:"button",class:we(["relative h-7 w-12 shrink-0 rounded-full border border-slate-200 transition-all duration-200",e.debugEnabled?"bg-emerald-500/95":"bg-slate-300"]),"aria-pressed":e.debugEnabled?"true":"false",title:e.debugEnabled?"Disable debug tab":"Enable debug tab",onClick:r[2]||(r[2]=$=>s.$emit("toggleDebug"))},[w("span",{class:we(["absolute top-0.5 h-5.5 w-5.5 rounded-full bg-white shadow-sm transition-all duration-200",e.debugEnabled?"left-[1.45rem]":"left-0.5"])},null,2)],10,Hp)])]),w("div",zp,[w("div",Up,[r[9]||(r[9]=w("div",null,[w("p",{class:"text-sm font-semibold text-slate-900"},"Send non-ERP questions directly to AI"),w("p",{class:"mt-1 text-xs text-slate-600"},"Questions unrelated to your ERP will skip the system and go straight to AI")],-1)),w("button",{class:we(["group relative h-7 w-12 shrink-0 rounded-full border border-slate-200 transition-all duration-200",e.sendNonERPtoaiEnabled?"bg-emerald-500/95":"bg-slate-300"]),"aria-pressed":e.sendNonERPtoaiEnabled?"true":"false",title:e.sendNonERPtoaiEnabled?"Non-ERP questions are being sent directly to AI":"Enable direct AI reply for non-ERP questions",onClick:r[3]||(r[3]=$=>s.$emit("toggleSendNonERP"))},[w("span",{class:we(["absolute top-0.5 h-5.5 w-5.5 rounded-full bg-white shadow-sm transition-all duration-200",e.sendNonERPtoaiEnabled?"left-[1.45rem]":"left-0.5"])},null,2)],10,jp)]),w("p",{class:we(["mt-3 text-[11px] font-medium",e.sendNonERPtoaiEnabled?"text-emerald-700":"text-slate-500"])},Je(e.sendNonERPtoaiEnabled?"Non-ERP questions are now routed directly to AI":"Direct AI routing is currently off"),3)])])}}},qp={key:0,class:"pointer-events-none absolute -top-14 left-0 right-0 z-20 flex justify-center px-2",role:"status","aria-live":"polite"},Wp={__name:"StatusToast",props:{visible:{type:Boolean,required:!0},message:{type:String,default:""},type:{type:String,default:"info"},dismissible:{type:Boolean,default:!0}},emits:["close"],setup(e){const t=e,n=Ee(()=>t.type==="error"?"bg-red-50 text-red-700 ring-red-200":(t.type==="listening","bg-blue-50 text-blue-700 ring-blue-200")),s=Ee(()=>t.type==="error"?"bg-red-500":t.type==="listening"?"bg-blue-500 animate-pulse":"bg-blue-500");return(r,i)=>(F(),Et(Pu,{"enter-active-class":"transition duration-200 ease-out","enter-from-class":"translate-y-1 opacity-0","enter-to-class":"translate-y-0 opacity-100","leave-active-class":"transition duration-150 ease-in","leave-from-class":"translate-y-0 opacity-100","leave-to-class":"translate-y-1 opacity-0"},{default:Di(()=>[e.visible?(F(),W("div",qp,[w("div",{class:we(["pointer-events-auto flex max-w-[92%] items-start gap-2 rounded-lg px-3 py-2 text-xs shadow-lg ring-1",n.value])},[w("span",{class:we(["mt-0.5 h-2 w-2 shrink-0 rounded-full",s.value])},null,2),w("span",null,Je(e.message),1),e.dismissible?(F(),W("button",{key:0,type:"button",class:"ml-1 appearance-none border-0 text-current/80 transition hover:text-current focus:outline-none","aria-label":"Dismiss notification",onClick:i[0]||(i[0]=o=>r.$emit("close"))}," × ")):qe("",!0)],2)])):qe("",!0)]),_:1}))}},Gp={class:"relative w-full"},Kp=["placeholder","disabled"],Yp=["title","aria-label","disabled"],Zp={key:0,viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor","aria-hidden":"true"},Xp={key:1,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},Qp={key:2,viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",class:"animate-spin"},Jp=["title","aria-label","disabled"],ed={key:0,viewBox:"0 0 24 24",width:"18",height:"18",fill:"none","aria-hidden":"true",class:"text-rose-600 motion-safe:animate-stop-button-pulse"},td={key:1,viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor","aria-hidden":"true"},nd={__name:"ChatForm",props:{placeholder:{type:String,default:"Message..."},disabled:{type:Boolean,default:!1},isAwaitingResponse:{type:Boolean,default:!1}},emits:["submit","cancel"],setup(e,{expose:t,emit:n}){const s=e,r=n,i=J(""),o=J(null),a=J(!1),l=J(!1),f=J(!1),u=J(!1),d=J(!1),g=J(!1),y=J(!1),E=J(""),x=J("info"),M=J("Voice input is unavailable in this browser/context.");let m=null,H=null,Y=null;const $=J(""),z=J(!1),O=Ee(()=>f.value?"Requesting microphone permission...":u.value?"Starting voice input...":d.value?"Stopping voice input...":l.value?a.value?"Stop voice input":"Start voice input":"Voice input is unavailable in this browser/context"),P=Ee(()=>s.isAwaitingResponse?"Stop response":"Send"),ee=Ee(()=>s.isAwaitingResponse?!1:s.disabled||!i.value.trim()),V=Ee(()=>s.isAwaitingResponse?"bg-white border border-rose-100 shadow-[0_8px_20px_-12px_rgba(159,18,57,0.35)] hover:bg-rose-50":"bg-linear-to-br from-brand-500 to-brand-600 text-white shadow-[0_10px_24px_-16px_rgba(109,79,194,0.85)] hover:from-brand-600 hover:to-violet-700");function se(){return typeof window=="undefined"?null:window.SpeechRecognition||window.webkitSpeechRecognition||null}function fe(){var ae;const re=se(),B=typeof window!="undefined"?window.isSecureContext:!1,de=typeof navigator!="undefined"&&!!((ae=navigator.mediaDevices)!=null&&ae.getUserMedia);l.value=!!(re&&B&&de),B?(!de||!re)&&(M.value="Voice input is not supported in this browser."):M.value="Voice input requires HTTPS (or localhost).",re&&l.value&&(m=new re,m.continuous=!0,m.interimResults=!0,m.lang=typeof navigator!="undefined"&&navigator.language||"en-US",m.onstart=()=>{a.value=!0,u.value=!1,d.value=!1,D(),C("Listening... Tap mic to stop","listening",{persistent:!0,key:"listening"})},m.onend=()=>{a.value=!1,u.value=!1,d.value=!1,D(),$.value==="listening"&&pe(),z.value&&(z.value=!1,Ge())},m.onerror=ve=>{if(a.value=!1,u.value=!1,d.value=!1,D(),z.value=!1,(ve==null?void 0:ve.error)==="not-allowed"||(ve==null?void 0:ve.error)==="service-not-allowed"){C("Microphone permission denied. Please allow microphone access in browser settings.","error");return}if((ve==null?void 0:ve.error)==="audio-capture"){C("No microphone detected. Please connect a microphone and try again.","error");return}if((ve==null?void 0:ve.error)==="no-speech"){C("No speech detected. Try speaking a bit louder.","info");return}C("Voice input failed. Please try again.","error")},m.onresult=ve=>{let ge="";for(let nt=ve.resultIndex;nt{if(m&&!(!a.value&&!d.value))try{m.abort()}catch{d.value=!1,z.value=!1}},1200)}}function Se(){if(!l.value||!m){C(M.value,"error");return}if(a.value||u.value||d.value){Z({submitAfterStop:a.value});return}te()}async function Ue(){var re;if(g.value)return!0;if(!((re=navigator.mediaDevices)!=null&&re.getUserMedia))return C("Microphone API is unavailable in this browser.","error"),!1;f.value=!0,C("Requesting microphone permission...","info",{persistent:!0,key:"requesting"});try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(de=>de.stop()),g.value=!0,!0}catch(B){return(B==null?void 0:B.name)==="NotAllowedError"||(B==null?void 0:B.name)==="SecurityError"?C("Microphone permission denied. Please allow it and try again.","error"):(B==null?void 0:B.name)==="NotFoundError"?C("No microphone found on this device.","error"):C("Unable to access microphone. Please check browser permissions.","error"),!1}finally{f.value=!1,$.value==="requesting"&&pe()}}async function te(){var B;if(!(!m||a.value||u.value||d.value||!await Ue()||!m)){z.value=!1,(B=o.value)==null||B.focus(),u.value=!0;try{m.start()}catch(de){u.value=!1,d.value=!1,(de==null?void 0:de.name)!=="InvalidStateError"&&C("Unable to start voice input. Please try again.","error")}}}function C(re,B="info",de={}){const{duration:ae=4200,persistent:ve=!1,key:ge=""}=de;E.value=re,x.value=B,$.value=ge,y.value=!0,H&&clearTimeout(H),ve||(H=setTimeout(()=>{y.value=!1,$.value=""},ae))}function pe(){y.value=!1,$.value="",H&&(clearTimeout(H),H=null)}function Ge(){if(s.isAwaitingResponse){r("cancel");return}const re=i.value.trim();re&&((a.value||u.value||d.value)&&m&&Z({submitAfterStop:!1}),r("submit",re),i.value="")}return t({focus:()=>{var re;return(re=o.value)==null?void 0:re.focus()}}),zn(()=>{fe()}),ys(()=>{if(m&&(a.value||u.value||d.value)){z.value=!1,D();try{m.abort()}catch{}}D(),pe()}),(re,B)=>(F(),W("div",Gp,[w("form",{class:"group flex min-h-11 items-center gap-2 rounded-full border border-slate-200/90 bg-white/95 px-3 shadow-[0_12px_26px_-20px_rgba(15,23,42,0.7)] transition-all duration-250 focus-within:-translate-y-0.5 focus-within:border-brand-200 focus-within:shadow-[0_18px_30px_-20px_rgba(13,110,253,0.5)] focus-within:ring-2 focus-within:ring-brand-500/25",style:{"border-radius":"9999px"},autocomplete:"off",onSubmit:pt(Ge,["prevent"]),onClick:B[5]||(B[5]=pt(()=>{},["stop"])),onMousedown:B[6]||(B[6]=pt(()=>{},["stop"])),onKeydown:B[7]||(B[7]=pt(()=>{},["stop"])),onKeyup:B[8]||(B[8]=pt(()=>{},["stop"]))},[Pa(w("input",{ref_key:"inputRef",ref:o,type:"text","onUpdate:modelValue":B[0]||(B[0]=de=>i.value=de),class:"h-11 w-full border-none bg-transparent text-sm font-medium text-slate-800 placeholder:text-slate-400 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",placeholder:e.disabled?"Waiting for response...":e.placeholder,disabled:e.disabled,required:"",onKeydown:B[1]||(B[1]=pt(()=>{},["stop"])),onKeyup:B[2]||(B[2]=pt(()=>{},["stop"])),onKeypress:B[3]||(B[3]=pt(()=>{},["stop"])),onInput:B[4]||(B[4]=pt(()=>{},["stop"]))},null,40,Kp),[[Xu,i.value]]),w("button",{type:"button",class:we(["grid h-8 w-8 shrink-0 appearance-none place-items-center rounded-full border border-transparent text-slate-600 transition-all duration-200 hover:-translate-y-0.5 hover:border-slate-200 hover:bg-slate-100 hover:text-slate-900 focus:outline-none disabled:cursor-not-allowed disabled:opacity-40",a.value?"border-red-200 bg-red-100 text-red-600 shadow-[0_10px_20px_-18px_rgba(220,38,38,0.9)] hover:bg-red-100 hover:text-red-600":""]),style:{"border-radius":"9999px"},title:O.value,"aria-label":O.value,disabled:e.disabled||!l.value||f.value||u.value||d.value,onClick:Se},[a.value&&!f.value?(F(),W("svg",Zp,B[9]||(B[9]=[w("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"},null,-1)]))):f.value?(F(),W("svg",Qp,B[11]||(B[11]=[w("circle",{cx:"12",cy:"12",r:"9",opacity:"0.3"},null,-1),w("path",{d:"M21 12a9 9 0 0 1-9 9"},null,-1)]))):(F(),W("svg",Xp,B[10]||(B[10]=[w("path",{d:"M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z"},null,-1),w("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"},null,-1),w("path",{d:"M12 19v3"},null,-1)])))],10,Yp),w("button",{type:"submit",title:P.value,"aria-label":P.value,class:we(["grid h-8 w-8 shrink-0 appearance-none place-items-center rounded-full border-0 transition-all duration-200 hover:-translate-y-0.5 focus:outline-none disabled:cursor-not-allowed disabled:opacity-40",V.value]),style:{"border-radius":"9999px"},disabled:ee.value},[e.isAwaitingResponse?(F(),W("svg",ed,B[12]||(B[12]=[w("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor","stroke-width":"2.1",class:"opacity-95"},null,-1),w("rect",{x:"9",y:"9",width:"6",height:"6",rx:"1.35",fill:"currentColor"},null,-1)]))):(F(),W("svg",td,B[13]||(B[13]=[w("path",{d:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.59 5.58L20 12l-8-8-8 8z"},null,-1)])))],10,Jp)],32),Oe(Wp,{visible:y.value,message:E.value,type:x.value,dismissible:x.value!=="listening",onClose:pe},null,8,["visible","message","type","dismissible"])]))}},sd={class:"relative overflow-hidden bg-linear-to-br from-brand-600 via-brand-500 to-violet-400"},rd={class:"min-w-0"},id={key:1,class:"border-t border-slate-200/80 bg-white/90 px-3 py-3 pb-[calc(12px+env(safe-area-inset-bottom))] backdrop-blur-sm sm:px-4 sm:py-4"},od=56,ld={__name:"ChatbotPopup",props:{isOpen:{type:Boolean,required:!0},activeTab:{type:String,required:!0},debugEnabled:{type:Boolean,default:!1},sendNonERPtoaiEnabled:{type:Boolean,default:!1},chatHistory:{type:Array,required:!0},debugLogs:{type:Array,required:!0},currentDebug:{type:Object,default:null},supportHistory:{type:Array,required:!0},autoReadEnabled:{type:Boolean,required:!0},ttsConfig:{type:Object,required:!0},activeTtsProvider:{type:String,required:!0},settings:{type:Object,default:null},isAwaitingChatResponse:{type:Boolean,default:!1},isAwaitingSupportResponse:{type:Boolean,default:!1}},emits:["close","submit","cancelResponse","update:activeTab","toggleAutoRead","togglePollyPreference","toggleDebug","toggleSendNonERP"],setup(e,{expose:t,emit:n}){const s=e,r=n,i=J(null),o=J(null),a=J(s.activeTab),l=J("default"),f=J(!1),u=Ee(()=>a.value==="support"?s.isAwaitingSupportResponse:a.value==="chat"?s.isAwaitingChatResponse:!1);function d(){const M=i.value;if(!s.isOpen||!M){f.value=!1;return}const m=M.scrollHeight-M.clientHeight;if(m<=4){f.value=!1;return}const H=m-M.scrollTop;f.value=H>od}function g(){const M=i.value;M&&(M.scrollTo({top:M.scrollHeight,behavior:"smooth"}),setTimeout(()=>{d()},220))}function y(){St(()=>{d()})}function E(){if(l.value==="default"){l.value="half";return}if(l.value==="half"){l.value="full";return}l.value="default"}const x=Ee(()=>{const M="chat-shell fixed z-[9999] flex min-h-0 flex-col overflow-hidden border border-slate-200/80 shadow-[0_32px_80px_-44px_rgba(2,6,23,0.7),0_18px_40px_-24px_rgba(15,23,42,0.45)] transition-all duration-300 ease-out origin-bottom-right",m=s.isOpen?"pointer-events-auto opacity-100 translate-x-0 translate-y-0 scale-100 motion-safe:animate-surface-in":"pointer-events-none opacity-0 translate-x-1/5 translate-y-8 scale-95";return l.value==="full"?[M,m,"inset-0 h-screen w-screen max-h-screen max-w-screen rounded-none origin-center"]:l.value==="half"?[M,m,"bottom-[74px] right-5 h-[min(86vh,860px)] w-[min(50vw,860px)] rounded-2xl","max-[900px]:bottom-[78px] max-[900px]:right-3 max-[900px]:h-[min(86vh,760px)] max-[900px]:w-[min(70vw,760px)] max-[900px]:rounded-[14px]","max-[600px]:inset-0 max-[600px]:h-screen max-[600px]:w-screen max-[600px]:max-h-screen max-[600px]:max-w-screen max-[600px]:rounded-none max-[600px]:pb-[env(safe-area-inset-bottom)]"]:[M,m,"bottom-[74px] right-5 h-[min(560px,72vh)] w-[min(360px,calc(100vw-40px))] rounded-2xl","max-[900px]:bottom-[78px] max-[900px]:right-3 max-[900px]:h-[min(70vh,540px)] max-[900px]:w-[min(360px,calc(100vw-24px))] max-[900px]:rounded-[14px]","max-[600px]:inset-0 max-[600px]:h-screen max-[600px]:w-screen max-[600px]:max-h-screen max-[600px]:max-w-screen max-[600px]:rounded-none max-[600px]:pb-[env(safe-area-inset-bottom)]"]});return on(()=>s.activeTab,M=>{a.value=M,y()}),on(()=>s.isOpen,M=>{M&&a.value!=="settings"&&St(()=>{var m;return(m=o.value)==null?void 0:m.focus()}),y()}),on(a,M=>{r("update:activeTab",M),y()}),on(()=>[s.chatHistory.length,s.supportHistory.length,s.debugLogs.length,s.currentDebug],()=>{y()}),on(()=>s.debugEnabled,M=>{!M&&a.value==="debug"&&(a.value="chat"),y()}),zn(()=>{y()}),t({scrollToBottom(){St(()=>{g()})}}),(M,m)=>(F(),W("div",{class:we(x.value),onKeydown:m[9]||(m[9]=pt(()=>{},["stop"])),onKeyup:m[10]||(m[10]=pt(()=>{},["stop"])),onKeypress:m[11]||(m[11]=pt(()=>{},["stop"]))},[m[14]||(m[14]=w("div",{class:"pointer-events-none absolute -right-14 -top-14 h-36 w-36 rounded-full bg-brand-500/15 blur-2xl"},null,-1)),m[15]||(m[15]=w("div",{class:"pointer-events-none absolute -bottom-14 -left-12 h-32 w-32 rounded-full bg-violet-400/15 blur-2xl"},null,-1)),w("div",sd,[m[12]||(m[12]=w("div",{class:"pointer-events-none absolute inset-0 opacity-45",style:{background:"linear-gradient(120deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.02) 52%, rgba(255,255,255,0.12) 100%)"}},null,-1)),Oe(vc,{windowMode:l.value,autoReadEnabled:e.autoReadEnabled,activeTtsProvider:e.activeTtsProvider,onClose:m[0]||(m[0]=H=>M.$emit("close")),onCycleResize:E,onToggleAutoRead:m[1]||(m[1]=H=>M.$emit("toggleAutoRead"))},null,8,["windowMode","autoReadEnabled","activeTtsProvider"]),Oe(Sc,{modelValue:a.value,"onUpdate:modelValue":m[2]||(m[2]=H=>a.value=H),debugEnabled:e.debugEnabled},null,8,["modelValue","debugEnabled"])]),w("div",{class:"chat-scrollbar min-h-0 flex-1 overflow-x-hidden overflow-y-scroll bg-slate-50/60 px-4 py-4 max-[900px]:px-3.5 max-[900px]:py-3.5 max-[600px]:px-3 max-[600px]:py-3",ref_key:"chatBodyRef",ref:i,onScrollPassive:d},[w("div",rd,[a.value==="chat"?(F(),Et(mp,{key:0,messages:e.chatHistory,autoReadEnabled:e.autoReadEnabled,ttsConfig:e.ttsConfig},null,8,["messages","autoReadEnabled","ttsConfig"])):a.value==="debug"&&e.debugEnabled?(F(),Et(_p,{key:1,logs:e.debugLogs,currentDebug:e.currentDebug},null,8,["logs","currentDebug"])):a.value==="support"?(F(),Et(Sp,{key:2,messages:e.supportHistory,autoReadEnabled:e.autoReadEnabled,ttsConfig:e.ttsConfig},null,8,["messages","autoReadEnabled","ttsConfig"])):a.value==="settings"?(F(),Et(Vp,{key:3,autoReadEnabled:e.autoReadEnabled,ttsConfig:e.ttsConfig,settings:e.settings,debugEnabled:e.debugEnabled,sendNonERPtoaiEnabled:e.sendNonERPtoaiEnabled,onToggleAutoRead:m[3]||(m[3]=H=>M.$emit("toggleAutoRead")),onTogglePollyPreference:m[4]||(m[4]=H=>M.$emit("togglePollyPreference")),onToggleDebug:m[5]||(m[5]=H=>M.$emit("toggleDebug")),onToggleSendNonERP:m[6]||(m[6]=H=>M.$emit("toggleSendNonERP"))},null,8,["autoReadEnabled","ttsConfig","settings","debugEnabled","sendNonERPtoaiEnabled"])):qe("",!0)])],544),f.value?(F(),W("button",{key:0,type:"button",class:we(["absolute right-4 z-20 grid h-9 w-9 place-items-center rounded-full border border-brand-200/70 bg-white/95 text-brand-600 shadow-[0_14px_26px_-16px_rgba(15,23,42,0.65)] transition-all duration-200 hover:-translate-y-0.5 hover:border-brand-300 hover:text-brand-700 focus:outline-none",a.value!=="settings"?"bottom-[calc(90px+env(safe-area-inset-bottom))] sm:bottom-[96px]":"bottom-4 sm:bottom-5"]),title:"Scroll to bottom","aria-label":"Scroll to bottom",onClick:g},m[13]||(m[13]=[w("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},[w("path",{d:"M7 10l5 5 5-5"})],-1)]),2)):qe("",!0),a.value!=="settings"?(F(),W("div",id,[Oe(nd,{ref_key:"chatFormRef",ref:o,placeholder:a.value==="support"?"Message Support...":"Message...",disabled:u.value,isAwaitingResponse:u.value,onSubmit:m[7]||(m[7]=H=>M.$emit("submit",H)),onCancel:m[8]||(m[8]=H=>M.$emit("cancelResponse"))},null,8,["placeholder","disabled","isAwaitingResponse"])])):qe("",!0)],34))}},_l="changai_chat_id",Tl="changai_polly_enabled";function ad(){let e=sessionStorage.getItem(_l);return e||(e=`session_${Date.now()}_${crypto.randomUUID()}`,sessionStorage.setItem(_l,e)),e}function ud(){const e=localStorage.getItem(Tl);return e===null?!0:e==="true"}function cd(e){localStorage.setItem(Tl,String(!!e))}const fd={__name:"App",setup(e){const t=J(!1),n=J("chat"),s=J([]),r=J([]),i=J(!1),o=J([]),a=J(null),l=J("actual"),f=J(!0),u=J(null),d=J(!1),g=J(null),y=J(!1),E=J({enableVoiceChat:!1,pollyAvailable:!1,usePolly:!0,voiceId:"Zayd",enable_changai:!1}),x=J("off"),M=J(null),m=J(null),H=Ee(()=>M.value!==null),Y=Ee(()=>m.value!==null);function $(){if(!E.value.enableVoiceChat){x.value="off";return}x.value=E.value.usePolly?"polly":"browser"}function z(te){var pe;const C=(pe=te==null?void 0:te.detail)==null?void 0:pe.provider;(C==="polly"||C==="browser"||C==="off")&&(x.value=C)}async function O(){var pe,Ge,re,B,de;if(!(d.value||u.value)){d.value=!0;try{u.value=await Mc(l.value),E.value={enableVoiceChat:!!((pe=u.value)!=null&&pe.enable_voice_chat),pollyAvailable:!!((Ge=u.value)!=null&&Ge.polly_enabled),usePolly:!!((re=u.value)!=null&&re.polly_enabled)&&ud(),voiceId:((B=u.value)==null?void 0:B.polly_voice_id)||"Zayd",enable_changai:!!((de=u.value)!=null&&de.enable_changai)},$(),r.value.push({type:"settings",settings:u.value})}catch(ae){const ve=vl(ae);r.value.push({type:"settings",error:ve})}finally{d.value=!1}}}function P(){t.value=!t.value}function ee(){var te;(te=a.value)==null||te.scrollToBottom()}function V(){f.value=!f.value}function se(){const te=!E.value.usePolly;E.value={...E.value,usePolly:te&&E.value.pollyAvailable},cd(E.value.usePolly),$()}function fe(){y.value=!y.value}async function D(te){n.value==="support"?await Ue(te):await Z(te)}async function Z(te){var ye,ht;g.value=null,l.value==="actual"&&await O(),s.value.push({role:"user",text:te}),await St(),ee();const C=cs({role:"model",text:"Thinking...",cancelable:!0,isStatus:!0,statusType:"thinking"});s.value.push(C),await St(),ee();let pe=!1;const Ge=ad(),re=`${Ge}_${Date.now()}`,B=y.value,de=Pc(te,Ge,l.value,re,y.value),ae=`debug_${re}`;let ve=Date.now();const ge=[],nt=G=>{var h;const Ce=Date.now(),Ft=((Ce-ve)/1e3).toFixed(2);ve=Ce;const c=`${G.message} (${Ft}s)`;if(G.message&&(ge.push(c),g.value=c),!G.done&&G.message&&(C.text=G.message,C.statusType="pipeline"),G.done){C.cancelable=!1,G.error?(C.text=`⚠️ ${G.message||"Something failed"}`,C.isStatus=!1,C.statusType=null):(h=G.data)!=null&&h.answer&&(C.text=G.data.answer,C.isStatus=!1,C.statusType=null),frappe.realtime.off(ae),g.value=null;return}};frappe.realtime.on(ae,nt),M.value=()=>{pe||(pe=!0,de.cancel(),frappe.realtime.off(ae),C.isStatus=!1,C.statusType=null,C.text="Cancelled by user.",r.value.push({type:"cancelled",user:te,steps:[...ge]}),g.value=null,C.cancelable=!1,M.value=null)};try{const G=await de.promise;if(G!=null&&G.open_report){if(C.isStatus=!1,C.statusType=null,C.text=`Opening "${G.report_name}" report." `,r.value.push({type:"success",steps:[...ge],final_response:G,entity_raw:G.entity_raw}),g.value=null,!G.report_name){C.text="Report name extraction failed.Can you ask the same question again?";return}frappe.set_route("query-report",G.report_name,G.filters||{});return}else if(G!=null&&G.create_entity){C.isStatus=!1,C.statusType=null,C.cancelable=!1,C.text=`Opening "${G.doc}" doctype for creating Entity "${G.entity_name}" record.`,r.value.push({type:"success",user:te,steps:[...ge],final_response:G}),g.value=null;const Ft=G.doc,c=G.entity_name||"",b={Customer:{customer_name:c},Supplier:{supplier_name:c},Employee:{employee_name:c},Item:{item_code:c,item_name:c},Project:{project_name:c},Lead:{lead_name:c},Opportunity:{opportunity_name:c}}[Ft]||{};frappe.route_options=b,frappe.set_route("Form",Ft,"new");const k=setInterval(()=>{cur_frm&&cur_frm.doctype===Ft&&cur_frm.is_new()&&(clearInterval(k),Object.entries(b).forEach(([v,_])=>{_&&cur_frm.fields_dict[v]&&(cur_frm.set_value(v,_),cur_frm.refresh_field(v))}))},200);return}if(pe)return;C.cancelable=!1;const Ce=((ye=bp(G==null?void 0:G.Bot))==null?void 0:ye.trim())||"No response.";C.isStatus=!1,C.statusType=null,C.text=Ce,r.value.push({type:"success",user:te,steps:[...ge],final_response:G}),g.value=null}catch(G){if(pe)return;frappe.realtime.off(ae),C.cancelable=!1,C.isStatus=!1,C.statusType=null;const Ce=vl(G);g.value=null,r.value.push({type:"failed",user:te,steps:[...ge],error:Ce}),(G==null?void 0:G.code)==="ERR_NETWORK_CHANGED"||(ht=G==null?void 0:G.message)!=null&&ht.includes("ERR_NETWORK_CHANGED")?(C.isStatus=!1,C.statusType=null,C.text="⚠️ Network error. Please check your connection and try again."):(C.isStatus=!1,C.statusType=null,C.text="⚠️ Something went wrong. Please try again.")}finally{frappe.realtime.off(ae),pe||(M.value=null)}await St(),ee()}function Se(){var te,C;if(n.value==="support"){(te=m.value)==null||te.call(m);return}(C=M.value)==null||C.call(M)}async function Ue(te){o.value.push({role:"user",text:te}),await St(),ee();const C=cs({role:"model",text:"Sending to support...",isStatus:!0,statusType:"support"});o.value.push(C),await St(),ee();let pe=!1;const Ge=Ic(te,l.value);m.value=()=>{pe||(pe=!0,Ge.cancel(),C.isStatus=!1,C.statusType=null,C.text="Cancelled by user.",m.value=null)};try{const re=await Ge.promise;if(pe)return;C.isStatus=!1,C.statusType=null,C.text=re?wl(re):"Support request sent successfully."}catch{if(pe)return;C.isStatus=!1,C.statusType=null,C.text="⚠️ Failed to reach support. Please try again."}finally{pe||(m.value=null)}await St(),ee()}return zn(()=>{typeof window!="undefined"&&window.addEventListener("changai-tts-provider",z),l.value==="actual"&&O()}),ys(()=>{typeof window!="undefined"&&window.removeEventListener("changai-tts-provider",z)}),(te,C)=>(F(),W(He,null,[E.value.enable_changai?(F(),Et(ac,{key:0,isOpen:t.value,onToggle:P},null,8,["isOpen"])):qe("",!0),Oe(ld,{ref_key:"popupRef",ref:a,isOpen:t.value,activeTab:n.value,"onUpdate:activeTab":C[0]||(C[0]=pe=>n.value=pe),chatHistory:s.value,debugLogs:r.value,currentDebug:g.value,supportHistory:o.value,autoReadEnabled:f.value,ttsConfig:E.value,activeTtsProvider:x.value,settings:u.value,isAwaitingChatResponse:H.value,isAwaitingSupportResponse:Y.value,debugEnabled:i.value,sendNonERPtoaiEnabled:y.value,onToggleDebug:C[1]||(C[1]=pe=>i.value=!i.value),onClose:C[2]||(C[2]=pe=>t.value=!1),onSubmit:D,onCancelResponse:Se,onToggleAutoRead:V,onTogglePollyPreference:se,onToggleSendNonERP:fe},null,8,["isOpen","activeTab","chatHistory","debugLogs","currentDebug","supportHistory","autoReadEnabled","ttsConfig","activeTtsProvider","settings","isAwaitingChatResponse","isAwaitingSupportResponse","debugEnabled","sendNonERPtoaiEnabled"])],64))}};function pd(){const e=document.querySelector('link[href*="/assets/changai/dist/changai-chatbot.css"]');if(e!=null&&e.href)return e.href;const t=Array.from(document.scripts).find(n=>{var s;return(s=n.src)==null?void 0:s.includes("/assets/changai/dist/changai-chatbot.js")});return t!=null&&t.src?t.src.replace(/changai-chatbot\.js(\?.*)?$/,"changai-chatbot.css$1"):null}function dd(e){const t=pd();if(!t){const n=Array.from(document.querySelectorAll("style[data-vite-dev-id]"));return n.length&&n.forEach(s=>{const r=document.createElement("style");r.dataset.changaiShadowDevStyle="1",r.textContent=s.textContent||"",e.appendChild(r)}),Promise.resolve()}return e.querySelector('link[data-changai-shadow-style="1"]')?Promise.resolve():new Promise(n=>{const s=document.createElement("link");s.rel="stylesheet",s.href=t,s.dataset.changaiShadowStyle="1",s.onload=()=>n(),s.onerror=()=>n(),e.appendChild(s),setTimeout(n,1200)})}async function kl(){if(document.getElementById("changai-chatbot-host"))return;const e=document.createElement("div");e.id="changai-chatbot-host",document.body.appendChild(e);const t=e.attachShadow({mode:"open"});await dd(t);const n=document.createElement("div");n.id="changai-chatbot-root",t.appendChild(n),nc(fd).mount(n);function s(r){r.stopPropagation()}n.addEventListener("keydown",s),n.addEventListener("keyup",s),n.addEventListener("keypress",s)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",kl):kl()})();
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index 945d499..03162eb 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -2,7 +2,7 @@
import { ref, reactive, computed, nextTick, onMounted, onBeforeUnmount } from 'vue'
import ChatbotToggler from './components/ChatbotToggler.vue'
import ChatbotPopup from './components/ChatbotPopup.vue'
-import { starupCall, runPipelineCancelable, callSupportBot, getSettingsDetails } from './utils/frappe.js'
+import { runPipelineCancelable, callSupportBotCancelable, getSettingsDetails } from './utils/frappe.js'
import { getOrCreateChatId, getPollyPreference, setPollyPreference } from './utils/session.js'
import { normalizeBotText, getErrorText, safeStringify } from './utils/helpers.js'
const showChatbot = ref(false)
@@ -27,7 +27,9 @@ const ttsConfig = ref({
})
const activeTtsProvider = ref('off')
const cancelPendingChatRequest = ref(null)
+const cancelPendingSupportRequest = ref(null)
const isAwaitingChatResponse = computed(() => cancelPendingChatRequest.value !== null)
+const isAwaitingSupportResponse = computed(() => cancelPendingSupportRequest.value !== null)
function updateProviderFromSettings() {
if (!ttsConfig.value.enableVoiceChat) {
@@ -126,8 +128,9 @@ async function handleChatSubmit(message) {
const requestId = `${chatId}_${Date.now()}`
const sendNonErptoAI = sendNonERPtoaiEnabled.value
console.log('sendNonErptoAI value being sent:', sendNonErptoAI, typeof sendNonErptoAI)
- const request = runPipelineCancelable(message,chatId, responseMode.value,requestId,sendNonERPtoaiEnabled.value)
const eventName = `debug_${requestId}`
+ frappe.realtime.on(eventName, onPipelineUpdate)
+ const request = runPipelineCancelable(message,chatId, responseMode.value,requestId,sendNonERPtoaiEnabled.value)
let lastStepTime = Date.now()
const steps = []
const onPipelineUpdate = (msg) => {
@@ -135,10 +138,12 @@ async function handleChatSubmit(message) {
const seconds = ((now - lastStepTime) / 1000).toFixed(2)
lastStepTime = now
console.log('REALTIME STEP', msg)
- const step = `${msg.message} (${seconds}s)`
if (msg.message) {
+ const step = `${msg.message} (${seconds}s)`
steps.push(step)
currentDebug.value = step
+ thinkingMsg.text = msg.message
+ thinkingMsg.statusType = 'pipeline'
}
if (!msg.done && msg.message) {
@@ -158,18 +163,17 @@ if (msg.done) {
thinkingMsg.statusType = null
}
- frappe.realtime.off(eventName)
+ frappe.realtime.off(eventName, onPipelineUpdate)
currentDebug.value = null
return
}
}
- frappe.realtime.on(eventName, onPipelineUpdate)
cancelPendingChatRequest.value = () => {
if (cancelled) return
cancelled = true
request.cancel()
- frappe.realtime.off(eventName)
+ frappe.realtime.off(eventName, onPipelineUpdate)
thinkingMsg.isStatus = false
thinkingMsg.statusType = null
thinkingMsg.text = 'Cancelled by user.'
@@ -182,8 +186,108 @@ if (msg.done) {
thinkingMsg.cancelable = false
cancelPendingChatRequest.value = null
}
- try {
- const response = await request.promise
+try {
+ const response = await request.promise
+ if (response?.open_report)
+ {
+ thinkingMsg.isStatus = false
+ thinkingMsg.statusType = null
+ thinkingMsg.text = `Opening "${response.report_name}" report." `
+ debugLogs.value.push({
+ type: 'success',
+ steps: [...steps],
+ final_response: response,
+ entity_raw: response.entity_raw
+ })
+ currentDebug.value = null
+ if (!response.report_name) {
+ thinkingMsg.text = `Report name extraction failed.Can you ask the same question again?`
+ return
+ }
+ frappe.set_route('query-report', response.report_name, response.filters || {})
+ return
+ }
+else if (response?.create_entity) {
+ thinkingMsg.isStatus = false
+ thinkingMsg.statusType = null
+ thinkingMsg.cancelable = false
+ thinkingMsg.text = `Opening "${response.doc}" doctype for creating Entity "${response.entity_name}" record.`
+
+ debugLogs.value.push({
+ type: 'success',
+ user: message,
+ steps: [...steps],
+ final_response: response,
+ })
+
+ currentDebug.value = null
+
+ const doctype = response.doc
+ const entityName = response.entity_name || ""
+
+ const defaultMap = {
+ Customer: {
+ customer_name: entityName
+ },
+ Supplier: {
+ supplier_name: entityName
+ },
+ Employee: {
+ employee_name: entityName
+ },
+ Item: {
+ item_code: entityName,
+ item_name: entityName
+ },
+ Project: {
+ project_name: entityName
+ },
+ Lead: {
+ lead_name: entityName
+ },
+ Opportunity: {
+ opportunity_name: entityName
+ }
+ }
+
+ const defaults = defaultMap[doctype] || {}
+
+ frappe.route_options = defaults
+
+ frappe.set_route("Form", doctype, "new")
+
+ const timer = setInterval(() => {
+ if (cur_frm && cur_frm.doctype === doctype && cur_frm.is_new()) {
+ clearInterval(timer)
+
+ Object.entries(defaults).forEach(([field, value]) => {
+ if (value && cur_frm.fields_dict[field]) {
+ cur_frm.set_value(field, value)
+ cur_frm.refresh_field(field)
+ }
+ })
+ }
+ }, 200)
+
+ return
+}
+if (response?.stop_followup) {
+ thinkingMsg.isStatus = false
+ thinkingMsg.statusType = null
+ thinkingMsg.cancelable = false
+ thinkingMsg.text = response.message || 'You’re welcome!'
+
+ debugLogs.value.push({
+ type: 'stop_followup',
+ user: message,
+ steps: [...steps],
+ final_response: response,
+ })
+
+ currentDebug.value = null
+ return
+}
+
if (cancelled) return
thinkingMsg.cancelable = false
const finalBotText = normalizeBotText(response?.Bot)?.trim() || 'No response.'
@@ -199,7 +303,7 @@ if (msg.done) {
currentDebug.value = null
} catch (err) {
if (cancelled) return
- frappe.realtime.off(eventName)
+ frappe.realtime.off(eventName, onPipelineUpdate)
thinkingMsg.cancelable = false
thinkingMsg.isStatus = false
thinkingMsg.statusType = null
@@ -212,17 +316,19 @@ if (msg.done) {
error: errorText,
})
console.error('ChangAI API Error:', err)
- if (error === "ERR_NETWORK_CHANGED"){
+ if (err?.code === "ERR_NETWORK_CHANGED" || err?.message?.includes("ERR_NETWORK_CHANGED")){
thinkingMsg.isStatus = false
thinkingMsg.statusType = null
thinkingMsg.text = '⚠️ Network error. Please check your connection and try again.'
}
+ else{
thinkingMsg.isStatus = false
thinkingMsg.statusType = null
thinkingMsg.text = '⚠️ Something went wrong. Please try again.'
+ }
} finally {
- frappe.realtime.off(eventName)
+ frappe.realtime.off(eventName, onPipelineUpdate)
if (!cancelled) {
cancelPendingChatRequest.value = null
}
@@ -232,6 +338,11 @@ if (msg.done) {
}
function handleCancelResponse() {
+ if (activeTab.value === 'support') {
+ cancelPendingSupportRequest.value?.()
+ return
+ }
+
cancelPendingChatRequest.value?.()
}
@@ -245,12 +356,35 @@ async function handleSupportSubmit(message) {
await nextTick()
scrollToBottom()
+ let cancelled = false
+ const request = callSupportBotCancelable(message, responseMode.value)
+
+ cancelPendingSupportRequest.value = () => {
+ if (cancelled) return
+ cancelled = true
+ request.cancel()
+ thinkingMsg.isStatus = false
+ thinkingMsg.statusType = null
+ thinkingMsg.text = 'Cancelled by user.'
+ cancelPendingSupportRequest.value = null
+ }
+
try {
- const response = await callSupportBot(message, responseMode.value)
+ const response = await request.promise
+ if (cancelled) return
+ thinkingMsg.isStatus = false
+ thinkingMsg.statusType = null
thinkingMsg.text = response ? safeStringify(response) : 'Support request sent successfully.'
} catch (err) {
+ if (cancelled) return
console.error('Support API Error:', err)
+ thinkingMsg.isStatus = false
+ thinkingMsg.statusType = null
thinkingMsg.text = '⚠️ Failed to reach support. Please try again.'
+ } finally {
+ if (!cancelled) {
+ cancelPendingSupportRequest.value = null
+ }
}
await nextTick()
@@ -288,7 +422,8 @@ onBeforeUnmount(() => {
:ttsConfig="ttsConfig"
:activeTtsProvider="activeTtsProvider"
:settings="settings"
- :isAwaitingResponse="isAwaitingChatResponse"
+ :isAwaitingChatResponse="isAwaitingChatResponse"
+ :isAwaitingSupportResponse="isAwaitingSupportResponse"
:debugEnabled="debugEnabled"
:sendNonERPtoaiEnabled="sendNonERPtoaiEnabled"
@toggleDebug="debugEnabled = !debugEnabled"
diff --git a/frontend/src/components/ChatbotPopup.vue b/frontend/src/components/ChatbotPopup.vue
index fa7cbe3..bddb955 100644
--- a/frontend/src/components/ChatbotPopup.vue
+++ b/frontend/src/components/ChatbotPopup.vue
@@ -64,8 +64,8 @@
$emit('submit', text)"
@cancel="$emit('cancelResponse')"
/>
@@ -99,7 +99,8 @@ const props = defineProps({
ttsConfig: { type: Object, required: true },
activeTtsProvider: { type: String, required: true },
settings: { type: Object, default: null },
- isAwaitingResponse: { type: Boolean, default: false },
+ isAwaitingChatResponse: { type: Boolean, default: false },
+ isAwaitingSupportResponse: { type: Boolean, default: false },
})
const emit = defineEmits(['close', 'submit', 'cancelResponse', 'update:activeTab', 'toggleAutoRead', 'togglePollyPreference', 'toggleDebug','toggleSendNonERP'])
@@ -110,6 +111,12 @@ const localTab = ref(props.activeTab)
const windowMode = ref('default')
const showScrollButton = ref(false)
+const isAwaitingCurrentTabResponse = computed(() => {
+ if (localTab.value === 'support') return props.isAwaitingSupportResponse
+ if (localTab.value === 'chat') return props.isAwaitingChatResponse
+ return false
+})
+
const SCROLL_BUTTON_THRESHOLD = 56
function updateScrollButtonVisibility() {
diff --git a/frontend/src/utils/frappe.js b/frontend/src/utils/frappe.js
index 1fd57fd..8c39f10 100644
--- a/frontend/src/utils/frappe.js
+++ b/frontend/src/utils/frappe.js
@@ -97,6 +97,50 @@ export function runPipelineCancelable(userQuestion, chatId, mode = 'actual', req
return { promise, cancel }
}
+export function callSupportBotCancelable(message, mode = 'actual') {
+ if (mode === 'test') {
+ return {
+ promise: Promise.resolve(`[TEST MODE] ${JSON.stringify({ message })}`),
+ cancel: () => false,
+ }
+ }
+
+ if (!window.frappe || !window.frappe.call) {
+ return {
+ promise: Promise.reject(new Error('Frappe API is unavailable in actual mode.')),
+ cancel: () => false,
+ }
+ }
+
+ let requestHandle = null
+ let settled = false
+
+ const promise = new Promise((resolve, reject) => {
+ requestHandle = window.frappe.call({
+ method: API.SUPPORT,
+ args: { message },
+ callback(r) {
+ settled = true
+ resolve(r.message)
+ },
+ error(err) {
+ settled = true
+ reject(err)
+ },
+ })
+ })
+
+ const cancel = () => {
+ if (settled) return false
+ if (!requestHandle || typeof requestHandle.abort !== 'function') return false
+ requestHandle.abort()
+ settled = true
+ return true
+ }
+
+ return { promise, cancel }
+}
+
export function callSupportBot(message, mode = 'actual') {
return frappeCall(API.SUPPORT, { message }, mode)
}