@liip/liipgpt 3.2.5 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/button/liipgpt-button.iife.js +32 -32
  2. package/chat/liipgpt-chat.iife.js +56 -47
  3. package/config/index.cjs +160 -2
  4. package/config/index.d.ts +16724 -104
  5. package/config/index.js +160 -2
  6. package/configurator/_app/env.js +1 -1
  7. package/configurator/_app/immutable/chunks/03vg6Qp7.js +286 -0
  8. package/configurator/_app/immutable/chunks/BE9gm6hD.js +3 -0
  9. package/configurator/_app/immutable/chunks/{Cpbg6gqo.js → Br-58faA.js} +1 -1
  10. package/configurator/_app/immutable/chunks/{P3S4YAQG.js → C6XdV3Lv.js} +1 -1
  11. package/configurator/_app/immutable/chunks/{BFyTjJX5.js → CROVZbk3.js} +1 -1
  12. package/configurator/_app/immutable/chunks/DKF3ACGN.js +117 -0
  13. package/configurator/_app/immutable/chunks/DNlyCRHN.js +1 -0
  14. package/configurator/_app/immutable/chunks/DSyPh3A4.js +1 -0
  15. package/configurator/_app/immutable/chunks/DZwn2NPr.js +143 -0
  16. package/configurator/_app/immutable/entry/{app.Cu0QvATM.js → app.DCKqR20T.js} +2 -2
  17. package/configurator/_app/immutable/entry/start.BVpSXwgq.js +1 -0
  18. package/configurator/_app/immutable/nodes/{0.CrU899yL.js → 0.bJp16ZWw.js} +31 -2
  19. package/configurator/_app/immutable/nodes/{1.BD_SDJXL.js → 1.MUQxcZbH.js} +1 -1
  20. package/configurator/_app/immutable/nodes/{2.ugxPosyc.js → 2.BtbFsQ_S.js} +7 -7
  21. package/configurator/_app/immutable/nodes/{3.CNAbn5jO.js → 3.FvTTpqZ0.js} +1 -1
  22. package/configurator/_app/version.json +1 -1
  23. package/configurator/index.html +6 -6
  24. package/configurator/sidebar.html +6 -6
  25. package/index.cjs +168 -19
  26. package/index.d.ts +59259 -2846
  27. package/index.js +168 -19
  28. package/package.json +1 -1
  29. package/configurator/_app/immutable/chunks/-SuUzcLl.js +0 -3
  30. package/configurator/_app/immutable/chunks/4Bj_aAxI.js +0 -286
  31. package/configurator/_app/immutable/chunks/BZFduDCC.js +0 -1
  32. package/configurator/_app/immutable/chunks/CQ_QazGM.js +0 -143
  33. package/configurator/_app/immutable/chunks/D88z-8NL.js +0 -1
  34. package/configurator/_app/immutable/chunks/l4sPpI_i.js +0 -108
  35. package/configurator/_app/immutable/entry/start.fNYeeeTK.js +0 -1
@@ -1,5 +1,5 @@
1
- var LiipGPTButton=function(rn){"use strict";const Mc="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Mc);const Pc=1,Nc=2,Dc=16,$c=1,zc=4,Fc=8,Bc=16,jc=1,Uc=2,Ra="[",Nn="[!",Ia="]",fr={},de=Symbol(),qc="http://www.w3.org/1999/xhtml",Vc="http://www.w3.org/2000/svg",Hc="@attach",lo=!1;var nn=Array.isArray,Zc=Array.prototype.indexOf,La=Array.from,Dn=Object.keys,Or=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,Gc=Object.getOwnPropertyDescriptors,co=Object.prototype,Wc=Array.prototype,Oa=Object.getPrototypeOf,uo=Object.isExtensible;function an(t){return typeof t=="function"}const pr=()=>{};function ho(t){return typeof t?.then=="function"}function fo(t){for(var e=0;e<t.length;e++)t[e]()}function Qc(){var t,e,r=new Promise((n,a)=>{t=n,e=a});return{promise:r,resolve:t,reject:e}}const Ze=2,Ma=4,Pa=8,on=16,Dt=32,gr=64,Na=128,Ge=256,$n=512,ge=1024,We=2048,mr=4096,ht=8192,vr=16384,Da=32768,Mr=65536,po=1<<17,go=1<<18,zn=1<<19,mo=1<<20,$a=1<<21,za=1<<22,br=1<<23,Jt=Symbol("$state"),Fa=Symbol("legacy props"),Yc=Symbol(""),Ba=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Kc=1,vo=3,kr=8;function Xc(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function bo(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Jc(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function eu(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function tu(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function ru(t){throw new Error("https://svelte.dev/e/effect_orphan")}function nu(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function au(){throw new Error("https://svelte.dev/e/hydration_failed")}function iu(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function ou(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function su(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function lu(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function sn(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function cu(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}let M=!1;function xe(t){M=t}let q;function me(t){if(t===null)throw sn(),fr;return q=t}function wt(){return me(Qe(q))}function $t(t){if(M){if(Qe(q)!==null)throw sn(),fr;q=t}}function ko(t=1){if(M){for(var e=t,r=q;e--;)r=Qe(r);q=r}}function ln(){for(var t=0,e=q;;){if(e.nodeType===kr){var r=e.data;if(r===Ia){if(t===0)return e;t-=1}else(r===Ra||r===Nn)&&(t+=1)}var n=Qe(e);e.remove(),e=n}}function yo(t){if(!t||t.nodeType!==kr)throw sn(),fr;return t.data}function wo(t){return t===this.v}function _o(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function xo(t){return!_o(t,this.v)}let uu=!1;const du=[];function hu(t,e=!1){return Fn(t,new Map,"",du)}function Fn(t,e,r,n,a=null){if(typeof t=="object"&&t!==null){var i=e.get(t);if(i!==void 0)return i;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(nn(t)){var o=Array(t.length);e.set(t,o),a!==null&&e.set(a,o);for(var s=0;s<t.length;s+=1){var c=t[s];s in t&&(o[s]=Fn(c,e,r,n))}return o}if(Oa(t)===co){o={},e.set(t,o),a!==null&&e.set(a,o);for(var l in t)o[l]=Fn(t[l],e,r,n);return o}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function")return Fn(t.toJSON(),e,r,n,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}let Ie=null;function er(t){Ie=t}function Pr(t,e=!1,r){Ie={p:Ie,c:null,e:null,s:t,x:null,l:null}}function Nr(t){var e=Ie,r=e.e;if(r!==null){e.e=null;for(var n of r)qo(n)}return t!==void 0&&(e.x=t),Ie=e.p,t??{}}function So(){return!0}const fu=new WeakMap;function pu(t){var e=B;if(e===null)return H.f|=br,t;if((e.f&Da)===0){if((e.f&Na)===0)throw!e.parent&&t instanceof Error&&To(t),t;e.b.error(t)}else Bn(t,e)}function Bn(t,e){for(;e!==null;){if((e.f&Na)!==0)try{e.b.error(t);return}catch{}e=e.parent}throw t instanceof Error&&To(t),t}function To(t){const e=fu.get(t);e&&(Or(t,"message",{value:e.message}),Or(t,"stack",{value:e.stack}))}let cn=[],ja=[];function Eo(){var t=cn;cn=[],fo(t)}function gu(){var t=ja;ja=[],fo(t)}function yr(t){cn.length===0&&queueMicrotask(Eo),cn.push(t)}function mu(){cn.length>0&&Eo(),ja.length>0&&gu()}function vu(t){let e=0,r=zt(0),n;return()=>{Iu()&&(_(r),Ga(()=>(e===0&&(n=pt(()=>t(()=>Vn(r)))),e+=1,()=>{yr(()=>{e-=1,e===0&&(n?.(),n=void 0)})})))}}var bu=Mr|zn|Na;function ku(t,e,r){new yu(t,e,r)}class yu{pending=!1;parent;#e;#t;#a;#l;#u;#i=null;#r=null;#o=null;#s=null;#n=0;#c=!1;#d=null;#f=()=>{this.#d&&rr(this.#d,this.#n)};#h=vu(()=>(this.#d=zt(this.#n),()=>{this.#d=null}));constructor(e,r,n){this.#e=e,this.#a=r,this.#l=n,this.#t=q,this.parent=B.b,this.pending=!!this.#a.pending,this.#u=jt(()=>{B.b=this,M&&wt();const a=this.#a.pending;if(M&&a)this.#r=he(()=>a(this.#e)),queueMicrotask(()=>{this.#i=this.#p(()=>(wr.ensure(),he(()=>this.#l(this.#e)))),this.#n>0?this.#g():(St(this.#r,()=>{this.#r=null}),this.pending=!1)});else{try{this.#i=he(()=>n(this.#e))}catch(i){this.error(i)}this.#n>0?this.#g():this.pending=!1}},bu),M&&(this.#e=q)}has_pending_snippet(){return!!this.#a.pending}#p(e){var r=B,n=H,a=Ie;nt(this.#u),Ee(this.#u),er(this.#u.ctx);try{return e()}finally{nt(r),Ee(n),er(a)}}#g(){const e=this.#a.pending;this.#i!==null&&(this.#s=document.createDocumentFragment(),wu(this.#i,this.#s)),this.#r===null&&(this.#r=he(()=>e(this.#e)))}#m(e){this.#n+=e,this.#n===0&&(this.pending=!1,this.#r&&St(this.#r,()=>{this.#r=null}),this.#s&&(this.#e.before(this.#s),this.#s=null))}update_pending_count(e){this.has_pending_snippet()?this.#m(e):this.parent&&this.parent.#m(e),qa.add(this.#f)}get_effect_pending(){return this.#h(),_(this.#d)}error(e){var r=this.#a.onerror;let n=this.#a.failed;const a=()=>{this.#n=0,this.#o!==null&&St(this.#o,()=>{this.#o=null}),this.pending=!0,this.#i=this.#p(()=>(this.#c=!1,he(()=>this.#l(this.#e)))),this.#n>0?this.#g():this.pending=!1};if(this.#c||!r&&!n)throw e;var i=H;try{Ee(null),r?.(e,a)}finally{Ee(i)}this.#i&&(ve(this.#i),this.#i=null),this.#r&&(ve(this.#r),this.#r=null),this.#o&&(ve(this.#o),this.#o=null),M&&(me(this.#t),ko(),me(ln())),n&&yr(()=>{this.#o=this.#p(()=>{this.#c=!0;try{return he(()=>{n(this.#e,()=>e,()=>a)})}catch(o){return Bn(o,this.#u.parent),null}finally{this.#c=!1}})})}}function wu(t,e){for(var r=t.nodes_start,n=t.nodes_end;r!==null;){var a=r===n?null:Qe(r);e.append(r),r=a}}function _u(){for(var t=B.b;t!==null&&!t.has_pending_snippet();)t=t.parent;return t===null&&Xc(),t}function jn(t){var e=Ze|We,r=H!==null&&(H.f&Ze)!==0?H:null;return B===null||r!==null&&(r.f&Ge)!==0?e|=Ge:B.f|=zn,{ctx:Ie,deps:null,effects:null,equals:wo,f:e,fn:t,reactions:null,rv:0,v:de,wv:0,parent:r??B,ac:null}}function xu(t,e){let r=B;r===null&&Jc();var n=r.b,a=void 0,i=zt(de),o=null,s=!H;return Mu(()=>{try{var c=t()}catch(v){c=Promise.reject(v)}var l=()=>c;a=o?.then(l,l)??Promise.resolve(c),o=a;var u=qe,p=n.pending;s&&(n.update_pending_count(1),p||u.increment());const h=(v,m=void 0)=>{o=null,p||u.activate(),m?m!==Ba&&(i.f|=br,rr(i,m)):((i.f&br)!==0&&(i.f^=br),rr(i,v)),s&&(n.update_pending_count(-1),p||u.decrement()),Lo()};if(a.then(h,v=>h(null,v||"unknown")),u)return()=>{queueMicrotask(()=>u.neuter())}}),new Promise(c=>{function l(u){function p(){u===a?c(i):l(a)}u.then(p,p)}l(a)})}function X(t){const e=jn(t);return Xo(e),e}function Co(t){const e=jn(t);return e.equals=xo,e}function Ao(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)ve(e[r])}}function Su(t){for(var e=t.parent;e!==null;){if((e.f&Ze)===0)return e;e=e.parent}return null}function Ua(t){var e,r=B;nt(Su(t));try{Ao(t),e=rs(t)}finally{nt(r)}return e}function Ro(t){var e=Ua(t);if(t.equals(e)||(t.v=e,t.wv=es()),!xr)if(Dr!==null)Dr.set(t,t.v);else{var r=(ar||(t.f&Ge)!==0)&&t.deps!==null?mr:ge;Se(t,r)}}function Io(t,e,r){const n=jn;if(e.length===0){r(t.map(n));return}var a=qe,i=B,o=Tu(),s=_u();Promise.all(e.map(c=>xu(c))).then(c=>{a?.activate(),o();try{r([...t.map(n),...c])}catch(l){(i.f&vr)===0&&Bn(l,i)}a?.deactivate(),Lo()}).catch(c=>{s.error(c)})}function Tu(){var t=B,e=H,r=Ie;return function(){nt(t),Ee(e),er(r)}}function Lo(){nt(null),Ee(null),er(null)}const Un=new Set;let qe=null,Dr=null,qa=new Set,$r=[],qn=null,Va=!1;class wr{#e=new Map;#t=new Map;#a=new Set;#l=0;#u=null;#i=!1;#r=[];#o=[];#s=[];#n=[];#c=[];skipped_effects=new Set;#d(e){$r=[];var r=null;if(Un.size>1){r=new Map,Dr=new Map;for(const[i,o]of this.#e)r.set(i,{v:i.v,wv:i.wv}),i.v=o;for(const i of Un)if(i!==this)for(const[o,s]of i.#t)r.has(o)||(r.set(o,{v:o.v,wv:o.wv}),o.v=s)}for(const i of e)this.#f(i);if(this.#r.length===0&&this.#l===0){var n=this.#s,a=this.#n;this.#s=[],this.#n=[],this.#c=[],this.#h(),Oo(n),Oo(a),this.#u?.resolve()}else{for(const i of this.#s)Se(i,ge);for(const i of this.#n)Se(i,ge);for(const i of this.#c)Se(i,ge)}if(r){for(const[i,{v:o,wv:s}]of r)i.wv<=s&&(i.v=o);Dr=null}for(const i of this.#r)dn(i);for(const i of this.#o)dn(i);this.#r=[],this.#o=[]}#f(e){e.f^=ge;for(var r=e.first;r!==null;){var n=r.f,a=(n&(Dt|gr))!==0,i=a&&(n&ge)!==0,o=i||(n&ht)!==0||this.skipped_effects.has(r);if(!o&&r.fn!==null){if(a)r.f^=ge;else if((n&Ma)!==0)this.#n.push(r);else if(Wn(r))if((n&za)!==0){var s=r.b?.pending?this.#o:this.#r;s.push(r)}else(r.f&on)!==0&&this.#c.push(r),dn(r);var c=r.first;if(c!==null){r=c;continue}}var l=r.parent;for(r=r.next;r===null&&l!==null;)r=l.next,l=l.parent}}capture(e,r){this.#t.has(e)||this.#t.set(e,r),this.#e.set(e,e.v)}activate(){qe=this}deactivate(){qe=null;for(const e of qa)if(qa.delete(e),e(),qe!==null)break}neuter(){this.#i=!0}flush(){$r.length>0?this.flush_effects():this.#h(),qe===this&&(this.#l===0&&Un.delete(this),this.deactivate())}flush_effects(){var e=Fr;Va=!0;try{var r=0;for(Yo(!0);$r.length>0;){if(r++>1e3){var n,a;Eu()}this.#d($r),_r.clear()}}finally{Va=!1,Yo(e),qn=null}}#h(){if(!this.#i)for(const e of this.#a)e();this.#a.clear()}increment(){this.#l+=1}decrement(){if(this.#l-=1,this.#l===0){for(const e of this.#s)Se(e,We),tr(e);for(const e of this.#n)Se(e,We),tr(e);for(const e of this.#c)Se(e,We),tr(e);this.#s=[],this.#n=[],this.flush()}else this.deactivate()}add_callback(e){this.#a.add(e)}settled(){return(this.#u??=Qc()).promise}static ensure(e=!0){if(qe===null){const r=qe=new wr;Un.add(qe),e&&queueMicrotask(()=>{qe===r&&r.flush()})}return qe}}function ee(t){var e;const r=wr.ensure(!1);for(;;){if(mu(),$r.length===0)return r===qe&&r.flush(),qn=null,e;r.flush_effects()}}function Eu(){try{nu()}catch(t){Bn(t,qn)}}function Oo(t){var e=t.length;if(e!==0){for(var r=0;r<e;r++){var n=t[r];if((n.f&(vr|ht))===0&&Wn(n)){var a=Gn;if(dn(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Go(n):n.fn=null),Gn>a&&(n.f&mo)!==0)break}}for(;r<e;r+=1)tr(t[r])}}function tr(t){for(var e=qn=t;e.parent!==null;){e=e.parent;var r=e.f;if(Va&&e===B&&(r&on)!==0)return;if((r&(gr|Dt))!==0){if((r&ge)===0)return;e.f^=ge}}$r.push(e)}const _r=new Map;function zt(t,e){var r={f:0,v:t,reactions:null,equals:wo,rv:0,wv:0};return r}function J(t,e){const r=zt(t);return Xo(r),r}function Mo(t,e=!1,r=!0){const n=zt(t);return e||(n.equals=xo),n}function P(t,e,r=!1){H!==null&&(!ft||(H.f&po)!==0)&&So()&&(H.f&(Ze|on|za|po))!==0&&!Ut?.includes(t)&&lu();let n=r?_t(e):e;return rr(t,n)}function rr(t,e){if(!t.equals(e)){var r=t.v;xr?_r.set(t,e):_r.set(t,r),t.v=e,wr.ensure().capture(t,r),(t.f&Ze)!==0&&((t.f&We)!==0&&Ua(t),Se(t,(t.f&Ge)===0?ge:mr)),t.wv=es(),Po(t,We),B!==null&&(B.f&ge)!==0&&(B.f&(Dt|gr))===0&&(at===null?Nu([t]):at.push(t))}return e}function Vn(t){P(t,t.v+1)}function Po(t,e){var r=t.reactions;if(r!==null)for(var n=r.length,a=0;a<n;a++){var i=r[a],o=i.f;(o&We)===0&&(Se(i,e),(o&(ge|Ge))!==0&&((o&Ze)!==0?Po(i,mr):tr(i)))}}function _t(t){if(typeof t!="object"||t===null||Jt in t)return t;const e=Oa(t);if(e!==co&&e!==Wc)return t;var r=new Map,n=nn(t),a=J(0),i=Sr,o=s=>{if(Sr===i)return s();var c=H,l=Sr;Ee(null),Jo(i);var u=s();return Ee(c),Jo(l),u};return n&&r.set("length",J(t.length)),new Proxy(t,{defineProperty(s,c,l){(!("value"in l)||l.configurable===!1||l.enumerable===!1||l.writable===!1)&&ou();var u=r.get(c);return u===void 0?u=o(()=>{var p=J(l.value);return r.set(c,p),p}):P(u,l.value,!0),!0},deleteProperty(s,c){var l=r.get(c);if(l===void 0){if(c in s){const u=o(()=>J(de));r.set(c,u),Vn(a)}}else P(l,de),Vn(a);return!0},get(s,c,l){if(c===Jt)return t;var u=r.get(c),p=c in s;if(u===void 0&&(!p||Nt(s,c)?.writable)&&(u=o(()=>{var v=_t(p?s[c]:de),m=J(v);return m}),r.set(c,u)),u!==void 0){var h=_(u);return h===de?void 0:h}return Reflect.get(s,c,l)},getOwnPropertyDescriptor(s,c){var l=Reflect.getOwnPropertyDescriptor(s,c);if(l&&"value"in l){var u=r.get(c);u&&(l.value=_(u))}else if(l===void 0){var p=r.get(c),h=p?.v;if(p!==void 0&&h!==de)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return l},has(s,c){if(c===Jt)return!0;var l=r.get(c),u=l!==void 0&&l.v!==de||Reflect.has(s,c);if(l!==void 0||B!==null&&(!u||Nt(s,c)?.writable)){l===void 0&&(l=o(()=>{var h=u?_t(s[c]):de,v=J(h);return v}),r.set(c,l));var p=_(l);if(p===de)return!1}return u},set(s,c,l,u){var p=r.get(c),h=c in s;if(n&&c==="length")for(var v=l;v<p.v;v+=1){var m=r.get(v+"");m!==void 0?P(m,de):v in s&&(m=o(()=>J(de)),r.set(v+"",m))}if(p===void 0)(!h||Nt(s,c)?.writable)&&(p=o(()=>J(void 0)),P(p,_t(l)),r.set(c,p));else{h=p.v!==de;var b=o(()=>_t(l));P(p,b)}var C=Reflect.getOwnPropertyDescriptor(s,c);if(C?.set&&C.set.call(u,l),!h){if(n&&typeof c=="string"){var y=r.get("length"),k=Number(c);Number.isInteger(k)&&k>=y.v&&P(y,k+1)}Vn(a)}return!0},ownKeys(s){_(a);var c=Reflect.ownKeys(s).filter(p=>{var h=r.get(p);return h===void 0||h.v!==de});for(var[l,u]of r)u.v!==de&&!(l in s)&&c.push(l);return c},setPrototypeOf(){su()}})}function No(t){try{if(t!==null&&typeof t=="object"&&Jt in t)return t[Jt]}catch{}return t}function Cu(t,e){return Object.is(No(t),No(e))}var Ha,Do,$o,zo;function Za(){if(Ha===void 0){Ha=window,Do=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;$o=Nt(e,"firstChild").get,zo=Nt(e,"nextSibling").get,uo(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),uo(r)&&(r.__t=void 0)}}function Ft(t=""){return document.createTextNode(t)}function rt(t){return $o.call(t)}function Qe(t){return zo.call(t)}function Bt(t,e){if(!M)return rt(t);var r=rt(q);if(r===null)r=q.appendChild(Ft());else if(e&&r.nodeType!==vo){var n=Ft();return r?.before(n),me(n),n}return me(r),r}function Le(t,e){if(!M){var r=rt(t);return r instanceof Comment&&r.data===""?Qe(r):r}return q}function nr(t,e=1,r=!1){let n=M?q:t;for(var a;e--;)a=n,n=Qe(n);if(!M)return n;if(r&&n?.nodeType!==vo){var i=Ft();return n===null?a?.after(i):n.before(i),me(i),i}return me(n),n}function Fo(t){t.textContent=""}function Bo(){return!1}function Au(t){B===null&&H===null&&ru(),H!==null&&(H.f&Ge)!==0&&B===null&&tu(),xr&&eu()}function Ru(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function xt(t,e,r,n=!0){var a=B;a!==null&&(a.f&ht)!==0&&(t|=ht);var i={ctx:Ie,deps:null,nodes_start:null,nodes_end:null,f:t|We,first:null,fn:e,last:null,next:null,parent:a,b:a&&a.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{dn(i),i.f|=Da}catch(c){throw ve(i),c}else e!==null&&tr(i);var o=r&&i.deps===null&&i.first===null&&i.nodes_start===null&&i.teardown===null&&(i.f&zn)===0;if(!o&&n&&(a!==null&&Ru(i,a),H!==null&&(H.f&Ze)!==0)){var s=H;(s.effects??=[]).push(i)}return i}function Iu(){return H!==null&&!ft}function jo(t){const e=xt(Pa,null,!1);return Se(e,ge),e.teardown=t,e}function Uo(t){Au();var e=B.f,r=!H&&(e&Dt)!==0&&(e&Da)===0;if(r){var n=Ie;(n.e??=[]).push(t)}else return qo(t)}function qo(t){return xt(Ma|mo,t,!1)}function Lu(t){wr.ensure();const e=xt(gr,t,!0);return()=>{ve(e)}}function Ou(t){wr.ensure();const e=xt(gr,t,!0);return(r={})=>new Promise(n=>{r.outro?St(e,()=>{ve(e),n(void 0)}):(ve(e),n(void 0))})}function Hn(t){return xt(Ma,t,!1)}function Mu(t){return xt(za|zn,t,!0)}function Ga(t,e=0){return xt(Pa|e,t,!0)}function Zn(t,e=[],r=[]){Io(e,r,n=>{xt(Pa,()=>t(...n.map(_)),!0)})}function jt(t,e=0){var r=xt(on|e,t,!0);return r}function he(t,e=!0){return xt(Dt,t,!0,e)}function Vo(t){var e=t.teardown;if(e!==null){const r=xr,n=H;Ko(!0),Ee(null);try{e.call(null)}finally{Ko(r),Ee(n)}}}function Ho(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){r.ac?.abort(Ba);var n=r.next;(r.f&gr)!==0?r.parent=null:ve(r,e),r=n}}function Pu(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&Dt)===0&&ve(e),e=r}}function ve(t,e=!0){var r=!1;(e||(t.f&go)!==0)&&t.nodes_start!==null&&t.nodes_end!==null&&(Zo(t.nodes_start,t.nodes_end),r=!0),Ho(t,e&&!r),Qn(t,0),Se(t,vr);var n=t.transitions;if(n!==null)for(const i of n)i.stop();Vo(t);var a=t.parent;a!==null&&a.first!==null&&Go(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function Zo(t,e){for(;t!==null;){var r=t===e?null:Qe(t);t.remove(),t=r}}function Go(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function St(t,e){var r=[];Wa(t,r,!0),Wo(r,()=>{ve(t),e&&e()})}function Wo(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var a of t)a.out(n)}else e()}function Wa(t,e,r){if((t.f&ht)===0){if(t.f^=ht,t.transitions!==null)for(const o of t.transitions)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var a=n.next,i=(n.f&Mr)!==0||(n.f&Dt)!==0;Wa(n,e,i?r:!1),n=a}}}function zr(t){Qo(t,!0)}function Qo(t,e){if((t.f&ht)!==0){t.f^=ht,(t.f&ge)===0&&(Se(t,We),tr(t));for(var r=t.first;r!==null;){var n=r.next,a=(r.f&Mr)!==0||(r.f&Dt)!==0;Qo(r,a?e:!1),r=n}if(t.transitions!==null)for(const i of t.transitions)(i.is_global||e)&&i.in()}}let Fr=!1;function Yo(t){Fr=t}let xr=!1;function Ko(t){xr=t}let H=null,ft=!1;function Ee(t){H=t}let B=null;function nt(t){B=t}let Ut=null;function Xo(t){H!==null&&(Ut===null?Ut=[t]:Ut.push(t))}let Oe=null,Ye=0,at=null;function Nu(t){at=t}let Gn=1,un=0,Sr=un;function Jo(t){Sr=t}let ar=!1;function es(){return++Gn}function Wn(t){var e=t.f;if((e&We)!==0)return!0;if((e&mr)!==0){var r=t.deps,n=(e&Ge)!==0;if(r!==null){var a,i,o=(e&$n)!==0,s=n&&B!==null&&!ar,c=r.length;if((o||s)&&(B===null||(B.f&vr)===0)){var l=t,u=l.parent;for(a=0;a<c;a++)i=r[a],(o||!i?.reactions?.includes(l))&&(i.reactions??=[]).push(l);o&&(l.f^=$n),s&&u!==null&&(u.f&Ge)===0&&(l.f^=Ge)}for(a=0;a<c;a++)if(i=r[a],Wn(i)&&Ro(i),i.wv>t.wv)return!0}(!n||B!==null&&!ar)&&Se(t,ge)}return!1}function ts(t,e,r=!0){var n=t.reactions;if(n!==null&&!Ut?.includes(t))for(var a=0;a<n.length;a++){var i=n[a];(i.f&Ze)!==0?ts(i,e,!1):e===i&&(r?Se(i,We):(i.f&ge)!==0&&Se(i,mr),tr(i))}}function rs(t){var e=Oe,r=Ye,n=at,a=H,i=ar,o=Ut,s=Ie,c=ft,l=Sr,u=t.f;Oe=null,Ye=0,at=null,ar=(u&Ge)!==0&&(ft||!Fr||H===null),H=(u&(Dt|gr))===0?t:null,Ut=null,er(t.ctx),ft=!1,Sr=++un,t.ac!==null&&(t.ac.abort(Ba),t.ac=null);try{t.f|=$a;var p=(0,t.fn)(),h=t.deps;if(Oe!==null){var v;if(Qn(t,Ye),h!==null&&Ye>0)for(h.length=Ye+Oe.length,v=0;v<Oe.length;v++)h[Ye+v]=Oe[v];else t.deps=h=Oe;if(!ar||(u&Ze)!==0&&t.reactions!==null)for(v=Ye;v<h.length;v++)(h[v].reactions??=[]).push(t)}else h!==null&&Ye<h.length&&(Qn(t,Ye),h.length=Ye);if(So()&&at!==null&&!ft&&h!==null&&(t.f&(Ze|mr|We))===0)for(v=0;v<at.length;v++)ts(at[v],t);return a!==null&&a!==t&&(un++,at!==null&&(n===null?n=at:n.push(...at))),(t.f&br)!==0&&(t.f^=br),p}catch(m){return pu(m)}finally{t.f^=$a,Oe=e,Ye=r,at=n,H=a,ar=i,Ut=o,er(s),ft=c,Sr=l}}function Du(t,e){let r=e.reactions;if(r!==null){var n=Zc.call(r,t);if(n!==-1){var a=r.length-1;a===0?r=e.reactions=null:(r[n]=r[a],r.pop())}}r===null&&(e.f&Ze)!==0&&(Oe===null||!Oe.includes(e))&&(Se(e,mr),(e.f&(Ge|$n))===0&&(e.f^=$n),Ao(e),Qn(e,0))}function Qn(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)Du(t,r[n])}function dn(t){var e=t.f;if((e&vr)===0){Se(t,ge);var r=B,n=Fr;B=t,Fr=!0;try{(e&on)!==0?Pu(t):Ho(t),Vo(t);var a=rs(t);t.teardown=typeof a=="function"?a:null,t.wv=Gn;var i;lo&&uu&&(t.f&We)!==0&&t.deps}finally{Fr=n,B=r}}}async function ns(){await Promise.resolve(),ee()}function _(t){var e=t.f,r=(e&Ze)!==0;if(H!==null&&!ft){var n=B!==null&&(B.f&vr)!==0;if(!n&&!Ut?.includes(t)){var a=H.deps;if((H.f&$a)!==0)t.rv<un&&(t.rv=un,Oe===null&&a!==null&&a[Ye]===t?Ye++:Oe===null?Oe=[t]:(!ar||!Oe.includes(t))&&Oe.push(t));else{(H.deps??=[]).push(t);var i=t.reactions;i===null?t.reactions=[H]:i.includes(H)||i.push(H)}}}else if(r&&t.deps===null&&t.effects===null){var o=t,s=o.parent;s!==null&&(s.f&Ge)===0&&(o.f^=Ge)}if(xr){if(_r.has(t))return _r.get(t);if(r){o=t;var c=o.v;return((o.f&ge)!==0||as(o))&&(c=Ua(o)),_r.set(o,c),c}}else if(r){if(o=t,Dr?.has(o))return Dr.get(o);Wn(o)&&Ro(o)}if((t.f&br)!==0)throw t.v;return t.v}function as(t){if(t.v===de)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(_r.has(e)||(e.f&Ze)!==0&&as(e))return!0;return!1}function pt(t){var e=ft;try{return ft=!0,t()}finally{ft=e}}const $u=-7169;function Se(t,e){t.f=t.f&$u|e}function zu(t,e){if(e){const r=document.body;t.autofocus=!0,yr(()=>{document.activeElement===r&&t.focus()})}}function Fu(t){var e=H,r=B;Ee(null),nt(null);try{return t()}finally{Ee(e),nt(r)}}const is=new Set,Qa=new Set;function os(t,e,r,n={}){function a(i){if(n.capture||hn.call(e,i),!i.cancelBubble)return Fu(()=>r?.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?yr(()=>{e.addEventListener(t,a,n)}):e.addEventListener(t,a,n),a}function Bu(t,e,r,n,a){var i={capture:n,passive:a},o=os(t,e,r,i);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&jo(()=>{e.removeEventListener(t,o,i)})}function ss(t){for(var e=0;e<t.length;e++)is.add(t[e]);for(var r of Qa)r(t)}function hn(t){var e=this,r=e.ownerDocument,n=t.type,a=t.composedPath?.()||[],i=a[0]||t.target,o=0,s=t.__root;if(s){var c=a.indexOf(s);if(c!==-1&&(e===document||e===window)){t.__root=e;return}var l=a.indexOf(e);if(l===-1)return;c<=l&&(o=c)}if(i=a[o]||t.target,i!==e){Or(t,"currentTarget",{configurable:!0,get(){return i||r}});var u=H,p=B;Ee(null),nt(null);try{for(var h,v=[];i!==null;){var m=i.assignedSlot||i.parentNode||i.host||null;try{var b=i["__"+n];if(b!=null&&(!i.disabled||t.target===i))if(nn(b)){var[C,...y]=b;C.apply(i,[t,...y])}else b.call(i,t)}catch(k){h?v.push(k):h=k}if(t.cancelBubble||m===e||m===null)break;i=m}if(h){for(let k of v)queueMicrotask(()=>{throw k});throw h}}finally{t.__root=e,delete t.currentTarget,Ee(u),nt(p)}}}let it;function ju(){it=void 0}function Uu(t){let e=null,r=M;var n;if(M){for(e=q,it===void 0&&(it=rt(document.head));it!==null&&(it.nodeType!==kr||it.data!==Ra);)it=Qe(it);it===null?xe(!1):it=me(Qe(it))}M||(n=document.head.appendChild(Ft()));try{jt(()=>t(n),go)}finally{r&&(xe(!0),it=q,me(e))}}function ls(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function qt(t,e){var r=B;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function Tt(t,e){var r=(e&jc)!==0,n=(e&Uc)!==0,a,i=!t.startsWith("<!>");return()=>{if(M)return qt(q,null),q;a===void 0&&(a=ls(i?t:"<!>"+t),r||(a=rt(a)));var o=n||Do?document.importNode(a,!0):a.cloneNode(!0);if(r){var s=rt(o),c=o.lastChild;qt(s,c)}else qt(o,o);return o}}function gt(){if(M)return qt(q,null),q;var t=document.createDocumentFragment(),e=document.createComment(""),r=Ft();return t.append(e,r),qt(e,r),t}function ie(t,e){if(M){B.nodes_end=q,wt();return}t!==null&&t.before(e)}function qu(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const Vu=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Hu(t){return Vu.includes(t)}const Zu={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Gu(t){return t=t.toLowerCase(),Zu[t]??t}const Wu=["touchstart","touchmove"];function Qu(t){return Wu.includes(t)}const Yu=["textarea","script","style","title"];function Ku(t){return Yu.includes(t)}function cs(t,e){var r=e==null?"":typeof e=="object"?e+"":e;r!==(t.__t??=t.nodeValue)&&(t.__t=r,t.nodeValue=r+"")}function us(t,e){return ds(t,e)}function Xu(t,e){Za(),e.intro=e.intro??!1;const r=e.target,n=M,a=q;try{for(var i=rt(r);i&&(i.nodeType!==kr||i.data!==Ra);)i=Qe(i);if(!i)throw fr;xe(!0),me(i),wt();const o=ds(t,{...e,anchor:i});if(q===null||q.nodeType!==kr||q.data!==Ia)throw sn(),fr;return xe(!1),o}catch(o){if(o===fr)return e.recover===!1&&au(),Za(),Fo(r),xe(!1),us(t,e);throw o}finally{xe(n),me(a),ju()}}const Br=new Map;function ds(t,{target:e,anchor:r,props:n={},events:a,context:i,intro:o=!0}){Za();var s=new Set,c=p=>{for(var h=0;h<p.length;h++){var v=p[h];if(!s.has(v)){s.add(v);var m=Qu(v);e.addEventListener(v,hn,{passive:m});var b=Br.get(v);b===void 0?(document.addEventListener(v,hn,{passive:m}),Br.set(v,1)):Br.set(v,b+1)}}};c(La(is)),Qa.add(c);var l=void 0,u=Ou(()=>{var p=r??e.appendChild(Ft());return he(()=>{if(i){Pr({});var h=Ie;h.c=i}a&&(n.$$events=a),M&&qt(p,null),l=t(p,n)||{},M&&(B.nodes_end=q),i&&Nr()}),()=>{for(var h of s){e.removeEventListener(h,hn);var v=Br.get(h);--v===0?(document.removeEventListener(h,hn),Br.delete(h)):Br.set(h,v)}Qa.delete(c),p!==r&&p.parentNode?.removeChild(p)}});return Ya.set(l,u),l}let Ya=new WeakMap;function Ju(t,e){const r=Ya.get(t);return r?(Ya.delete(t),r(e)):Promise.resolve()}function hs(t,e,...r){var n=t,a=pr,i;jt(()=>{a!==(a=e())&&(i&&(ve(i),i=null),i=he(()=>a(n,...r)))},Mr),M&&(n=q)}function ed(t){Ie===null&&bo(),Uo(()=>{const e=pt(t);if(typeof e=="function")return e})}function td(t){Ie===null&&bo(),ed(()=>()=>pt(t))}const Ka=0,Yn=1,Xa=2;function fs(t,e,r,n,a){M&&wt();var i=t,o=Ie,s=de,c,l,u,p=zt(void 0),h=zt(void 0),v=!1;function m(C,y){v=!0,y&&(nt(b),Ee(b),er(o));try{C===Ka&&r&&(c?zr(c):c=he(()=>r(i))),C===Yn&&n&&(l?zr(l):l=he(()=>n(i,p))),C!==Ka&&c&&St(c,()=>c=null),C!==Yn&&l&&St(l,()=>l=null),C!==Xa&&u&&St(u,()=>u=null)}finally{y&&(er(null),Ee(null),nt(null),ee())}}var b=jt(()=>{if(s===(s=e()))return;let C=M&&ho(s)===(i.data===Nn);if(C&&(i=ln(),me(i),xe(!1),C=!0),ho(s)){var y=s;v=!1,y.then(k=>{y===s&&(rr(p,k),m(Yn,!0))},k=>{if(y===s)throw rr(h,k),m(Xa,!0),h.v}),M?r&&(c=he(()=>r(i))):yr(()=>{v||m(Ka,!0)})}else rr(p,s),m(Yn,!1);return C&&xe(!0),()=>s=de});M&&(i=q)}function ir(t,e,r=!1){M&&wt();var n=t,a=null,i=null,o=de,s=r?Mr:0,c=!1;const l=(v,m=!0)=>{c=!0,h(m,v)};var u=null;function p(){u!==null&&(u.lastChild.remove(),n.before(u),u=null);var v=o?a:i,m=o?i:a;v&&zr(v),m&&St(m,()=>{o?i=null:a=null})}const h=(v,m)=>{if(o===(o=v))return;let b=!1;if(M){const R=yo(n)===Nn;!!o===R&&(n=ln(),me(n),xe(!1),b=!0)}var C=Bo(),y=n;if(C&&(u=document.createDocumentFragment(),u.append(y=Ft())),o?a??=m&&he(()=>m(y)):i??=m&&he(()=>m(y)),C){var k=qe,w=o?a:i,T=o?i:a;w&&k.skipped_effects.delete(w),T&&k.skipped_effects.add(T),k.add_callback(p)}else p();b&&xe(!0)};jt(()=>{c=!1,e(l),c||h(null,null)},s),M&&(n=q)}function rd(t,e){return e}function nd(t,e,r){for(var n=t.items,a=[],i=e.length,o=0;o<i;o++)Wa(e[o].e,a,!0);var s=i>0&&a.length===0&&r!==null;if(s){var c=r.parentNode;Fo(c),c.append(r),n.clear(),Et(t,e[0].prev,e[i-1].next)}Wo(a,()=>{for(var l=0;l<i;l++){var u=e[l];s||(n.delete(u.k),Et(t,u.prev,u.next)),ve(u.e,!s)}})}function ad(t,e,r,n,a,i=null){var o=t,s={flags:e,items:new Map,first:null};M&&wt();var c=null,l=!1,u=new Map,p=Co(()=>{var b=r();return nn(b)?b:b==null?[]:La(b)}),h,v;function m(){id(v,h,s,u,o,a,e,n,r),i!==null&&(h.length===0?c?zr(c):c=he(()=>i(o)):c!==null&&St(c,()=>{c=null}))}jt(()=>{v??=B,h=_(p);var b=h.length;if(l&&b===0)return;l=b===0;let C=!1;if(M){var y=yo(o)===Nn;y!==(b===0)&&(o=ln(),me(o),xe(!1),C=!0)}if(M){for(var k=null,w,T=0;T<b;T++){if(q.nodeType===kr&&q.data===Ia){o=q,C=!0,xe(!1);break}var R=h[T],U=n(R,T);w=Ja(q,s,k,null,R,U,T,a,e,r),s.items.set(U,w),k=w}b>0&&me(ln())}if(M)b===0&&i&&(c=he(()=>i(o)));else if(Bo()){var Q=new Set,Fe=qe;for(T=0;T<b;T+=1){R=h[T],U=n(R,T);var le=s.items.get(U)??u.get(U);le?ps(le,R,T):(w=Ja(null,s,null,null,R,U,T,a,e,r,!0),u.set(U,w)),Q.add(U)}for(const[ur,ne]of s.items)Q.has(ur)||Fe.skipped_effects.add(ne.e);Fe.add_callback(m)}else m();C&&xe(!0),_(p)}),M&&(o=q)}function id(t,e,r,n,a,i,o,s,c){var l=e.length,u=r.items,p=r.first,h=p,v,m=null,b=[],C=[],y,k,w,T;for(T=0;T<l;T+=1){if(y=e[T],k=s(y,T),w=u.get(k),w===void 0){var R=n.get(k);if(R!==void 0){n.delete(k),u.set(k,R);var U=m?m.next:h;Et(r,m,R),Et(r,R,U),ei(R,U,a),m=R}else{var Q=h?h.e.nodes_start:a;m=Ja(Q,r,m,m===null?r.first:m.next,y,k,T,i,o,c)}u.set(k,m),b=[],C=[],h=m.next;continue}if(ps(w,y,T),(w.e.f&ht)!==0&&zr(w.e),w!==h){if(v!==void 0&&v.has(w)){if(b.length<C.length){var Fe=C[0],le;m=Fe.prev;var ur=b[0],ne=b[b.length-1];for(le=0;le<b.length;le+=1)ei(b[le],Fe,a);for(le=0;le<C.length;le+=1)v.delete(C[le]);Et(r,ur.prev,ne.next),Et(r,m,ur),Et(r,ne,Fe),h=Fe,m=ne,T-=1,b=[],C=[]}else v.delete(w),ei(w,h,a),Et(r,w.prev,w.next),Et(r,w,m===null?r.first:m.next),Et(r,m,w),m=w;continue}for(b=[],C=[];h!==null&&h.k!==k;)(h.e.f&ht)===0&&(v??=new Set).add(h),C.push(h),h=h.next;if(h===null)continue;w=h}b.push(w),m=w,h=w.next}if(h!==null||v!==void 0){for(var Qt=v===void 0?[]:La(v);h!==null;)(h.e.f&ht)===0&&Qt.push(h),h=h.next;var dr=Qt.length;if(dr>0){var hr=null;nd(r,Qt,hr)}}t.first=r.first&&r.first.e,t.last=m&&m.e;for(var Xr of n.values())ve(Xr.e);n.clear()}function ps(t,e,r,n){rr(t.v,e),t.i=r}function Ja(t,e,r,n,a,i,o,s,c,l,u){var p=(c&Pc)!==0,h=(c&Dc)===0,v=p?h?Mo(a,!1,!1):zt(a):a,m=(c&Nc)===0?o:zt(o),b={i:m,v,k:i,a:null,e:null,prev:r,next:n};try{if(t===null){var C=document.createDocumentFragment();C.append(t=Ft())}return b.e=he(()=>s(t,v,m,l),M),b.e.prev=r&&r.e,b.e.next=n&&n.e,r===null?u||(e.first=b):(r.next=b,r.e.next=b.e),n!==null&&(n.prev=b,n.e.prev=b.e),b}finally{}}function ei(t,e,r){for(var n=t.next?t.next.e.nodes_start:r,a=e?e.e.nodes_start:r,i=t.e.nodes_start;i!==null&&i!==n;){var o=Qe(i);a.before(i),i=o}}function Et(t,e,r){e===null?t.first=r:(e.next=r,e.e.next=r&&r.e),r!==null&&(r.prev=e,r.e.prev=e&&e.e)}function ti(t,e,r=!1,n=!1,a=!1){var i=t,o="";Zn(()=>{var s=B;if(o===(o=e()??"")){M&&wt();return}if(s.nodes_start!==null&&(Zo(s.nodes_start,s.nodes_end),s.nodes_start=s.nodes_end=null),o!==""){if(M){q.data;for(var c=wt(),l=c;c!==null&&(c.nodeType!==kr||c.data!=="");)l=c,c=Qe(c);if(c===null)throw sn(),fr;qt(q,l),i=me(c);return}var u=o+"";r?u=`<svg>${u}</svg>`:n&&(u=`<math>${u}</math>`);var p=ls(u);if((r||n)&&(p=rt(p)),qt(rt(p),p.lastChild),r||n)for(;rt(p);)i.before(rt(p));else i.before(p)}})}function gs(t,e,r,n,a,i){let o=M;M&&wt();var s,c,l=null;M&&q.nodeType===Kc&&(l=q,wt());var u=M?q:t,p;jt(()=>{const h=e()||null;var v=h==="svg"?Vc:null;h!==s&&(p&&(h===null?St(p,()=>{p=null,c=null}):h===c?zr(p):ve(p)),h&&h!==c&&(p=he(()=>{if(l=M?l:v?document.createElementNS(v,h):document.createElement(h),qt(l,l),n){M&&Ku(h)&&l.append(document.createComment(""));var m=M?rt(l):l.appendChild(Ft());M&&(m===null?xe(!1):me(m)),n(l,m)}B.nodes_end=l,u.before(l)})),s=h,s&&(c=s))},Mr),o&&(xe(!0),me(u))}function od(t,e){yr(()=>{var r=t.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+e.hash)){const a=document.createElement("style");a.id=e.hash,a.textContent=e.code,n.appendChild(a)}})}function ms(t,e,r){Hn(()=>{var n=pt(()=>e(t,r?.())||{});if(n?.destroy)return()=>n.destroy()})}function sd(t,e){var r=void 0,n;jt(()=>{r!==(r=e())&&(n&&(ve(n),n=null),r&&(n=he(()=>{Hn(()=>r(t))})))})}function vs(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(r=vs(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function ld(){for(var t,e,r=0,n="",a=arguments.length;r<a;r++)(t=arguments[r])&&(e=vs(t))&&(n&&(n+=" "),n+=e);return n}function cd(t){return typeof t=="object"?ld(t):t??""}const bs=[...`
2
- \r\f \v\uFEFF`];function ud(t,e,r){var n=t==null?"":""+t;if(r){for(var a in r)if(r[a])n=n?n+" "+a:a;else if(n.length)for(var i=a.length,o=0;(o=n.indexOf(a,o))>=0;){var s=o+i;(o===0||bs.includes(n[o-1]))&&(s===n.length||bs.includes(n[s]))?n=(o===0?"":n.substring(0,o))+n.substring(s+1):o=s}}return n===""?null:n}function ks(t,e=!1){var r=e?" !important;":";",n="";for(var a in t){var i=t[a];i!=null&&i!==""&&(n+=" "+a+": "+i+r)}return n}function ri(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function dd(t,e){if(e){var r="",n,a;if(Array.isArray(e)?(n=e[0],a=e[1]):n=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var i=!1,o=0,s=!1,c=[];n&&c.push(...Object.keys(n).map(ri)),a&&c.push(...Object.keys(a).map(ri));var l=0,u=-1;const b=t.length;for(var p=0;p<b;p++){var h=t[p];if(s?h==="/"&&t[p-1]==="*"&&(s=!1):i?i===h&&(i=!1):h==="/"&&t[p+1]==="*"?s=!0:h==='"'||h==="'"?i=h:h==="("?o++:h===")"&&o--,!s&&i===!1&&o===0){if(h===":"&&u===-1)u=p;else if(h===";"||p===b-1){if(u!==-1){var v=ri(t.substring(l,u).trim());if(!c.includes(v)){h!==";"&&p++;var m=t.substring(l,p).trim();r+=" "+m+";"}}l=p+1,u=-1}}}}return n&&(r+=ks(n)),a&&(r+=ks(a,!0)),r=r.trim(),r===""?null:r}return t==null?null:String(t)}function hd(t,e,r,n,a,i){var o=t.__className;if(M||o!==r||o===void 0){var s=ud(r,n,i);(!M||s!==t.getAttribute("class"))&&(s==null?t.removeAttribute("class"):e?t.className=s:t.setAttribute("class",s)),t.__className=r}else if(i&&a!==i)for(var c in i){var l=!!i[c];(a==null||l!==!!a[c])&&t.classList.toggle(c,l)}return i}function ni(t,e={},r,n){for(var a in r){var i=r[a];e[a]!==i&&(r[a]==null?t.style.removeProperty(a):t.style.setProperty(a,i,n))}}function fd(t,e,r,n){var a=t.__style;if(M||a!==e){var i=dd(e,n);(!M||i!==t.getAttribute("style"))&&(i==null?t.removeAttribute("style"):t.style.cssText=i),t.__style=e}else n&&(Array.isArray(n)?(ni(t,r?.[0],n[0]),ni(t,r?.[1],n[1],"important")):ni(t,r,n));return n}function ai(t,e,r=!1){if(t.multiple){if(e==null)return;if(!nn(e))return cu();for(var n of t.options)n.selected=e.includes(ys(n));return}for(n of t.options){var a=ys(n);if(Cu(a,e)){n.selected=!0;return}}(!r||e!==void 0)&&(t.selectedIndex=-1)}function pd(t){var e=new MutationObserver(()=>{ai(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),jo(()=>{e.disconnect()})}function ys(t){return"__value"in t?t.__value:t.value}const jr=Symbol("class"),fn=Symbol("style"),ws=Symbol("is custom element"),_s=Symbol("is html");function gd(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function ii(t,e,r,n){var a=Ss(t);M&&(a[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")||a[e]!==(a[e]=r)&&(e==="loading"&&(t[Yc]=r),r==null?t.removeAttribute(e):typeof r!="string"&&Es(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function md(t,e,r,n,a=!1){var i=Ss(t),o=i[ws],s=!i[_s];let c=M&&o;c&&xe(!1);var l=e||{},u=t.tagName==="OPTION";for(var p in e)p in r||(r[p]=null);r.class?r.class=cd(r.class):r[jr]&&(r.class=null),r[fn]&&(r.style??=null);var h=Es(t);for(const w in r){let T=r[w];if(u&&w==="value"&&T==null){t.value=t.__value="",l[w]=T;continue}if(w==="class"){var v=t.namespaceURI==="http://www.w3.org/1999/xhtml";hd(t,v,T,n,e?.[jr],r[jr]),l[w]=T,l[jr]=r[jr];continue}if(w==="style"){fd(t,T,e?.[fn],r[fn]),l[w]=T,l[fn]=r[fn];continue}var m=l[w];if(!(T===m&&!(T===void 0&&t.hasAttribute(w)))){l[w]=T;var b=w[0]+w[1];if(b!=="$$")if(b==="on"){const R={},U="$$"+w;let Q=w.slice(2);var C=Hu(Q);if(qu(Q)&&(Q=Q.slice(0,-7),R.capture=!0),!C&&m){if(T!=null)continue;t.removeEventListener(Q,l[U],R),l[U]=null}if(T!=null)if(C)t[`__${Q}`]=T,ss([Q]);else{let Fe=function(le){l[w].call(this,le)};l[U]=os(Q,t,Fe,R)}else C&&(t[`__${Q}`]=void 0)}else if(w==="style")ii(t,w,T);else if(w==="autofocus")zu(t,!!T);else if(!o&&(w==="__value"||w==="value"&&T!=null))t.value=t.__value=T;else if(w==="selected"&&u)gd(t,T);else{var y=w;s||(y=Gu(y));var k=y==="defaultValue"||y==="defaultChecked";if(T==null&&!o&&!k)if(i[w]=null,y==="value"||y==="checked"){let R=t;const U=e===void 0;if(y==="value"){let Q=R.defaultValue;R.removeAttribute(y),R.defaultValue=Q,R.value=R.__value=U?Q:null}else{let Q=R.defaultChecked;R.removeAttribute(y),R.defaultChecked=Q,R.checked=U?Q:!1}}else t.removeAttribute(w);else k||h.includes(y)&&(o||typeof T!="string")?t[y]=T:typeof T!="function"&&ii(t,y,T)}}}return c&&xe(!0),l}function xs(t,e,r=[],n=[],a,i=!1){Io(r,n,o=>{var s=void 0,c={},l=t.nodeName==="SELECT",u=!1;if(jt(()=>{var h=e(...o.map(_)),v=md(t,s,h,a,i);u&&l&&"value"in h&&ai(t,h.value);for(let b of Object.getOwnPropertySymbols(c))h[b]||ve(c[b]);for(let b of Object.getOwnPropertySymbols(h)){var m=h[b];b.description===Hc&&(!s||m!==s[b])&&(c[b]&&ve(c[b]),c[b]=he(()=>sd(t,()=>m))),v[b]=m}s=v}),l){var p=t;Hn(()=>{ai(p,s.value,!0),pd(p)})}u=!0})}function Ss(t){return t.__attributes??={[ws]:t.nodeName.includes("-"),[_s]:t.namespaceURI===qc}}var Ts=new Map;function Es(t){var e=Ts.get(t.nodeName);if(e)return e;Ts.set(t.nodeName,e=[]);for(var r,n=t,a=Element.prototype;a!==n;){r=Gc(n);for(var i in r)r[i].set&&e.push(i);n=Oa(n)}return e}function Cs(t,e){return t===e||t?.[Jt]===e}function As(t={},e,r,n){return Hn(()=>{var a,i;return Ga(()=>{a=i,i=[],pt(()=>{t!==r(...i)&&(e(t,...i),a&&Cs(r(...a),t)&&e(null,...a))})}),()=>{yr(()=>{i&&Cs(r(...i),t)&&e(null,...i)})}}),t}const Ur=[];function vd(t,e=pr){let r=null;const n=new Set;function a(s){if(_o(t,s)&&(t=s,r)){const c=!Ur.length;for(const l of n)l[1](),Ur.push(l,t);if(c){for(let l=0;l<Ur.length;l+=2)Ur[l][0](Ur[l+1]);Ur.length=0}}}function i(s){a(s(t))}function o(s,c=pr){const l=[s,c];return n.add(l),n.size===1&&(r=e(a,i)||pr),s(t),()=>{n.delete(l),n.size===0&&r&&(r(),r=null)}}return{set:a,update:i,subscribe:o}}let Kn=!1;function bd(t){var e=Kn;try{return Kn=!1,[t(),Kn]}finally{Kn=e}}const kd={get(t,e){if(!t.exclude.includes(e))return t.props[e]},set(t,e){return!1},getOwnPropertyDescriptor(t,e){if(!t.exclude.includes(e)&&e in t.props)return{enumerable:!0,configurable:!0,value:t.props[e]}},has(t,e){return t.exclude.includes(e)?!1:e in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(e=>!t.exclude.includes(e))}};function oi(t,e,r){return new Proxy({props:t,exclude:e},kd)}const yd={get(t,e){let r=t.props.length;for(;r--;){let n=t.props[r];if(an(n)&&(n=n()),typeof n=="object"&&n!==null&&e in n)return n[e]}},set(t,e,r){let n=t.props.length;for(;n--;){let a=t.props[n];an(a)&&(a=a());const i=Nt(a,e);if(i&&i.set)return i.set(r),!0}return!1},getOwnPropertyDescriptor(t,e){let r=t.props.length;for(;r--;){let n=t.props[r];if(an(n)&&(n=n()),typeof n=="object"&&n!==null&&e in n){const a=Nt(n,e);return a&&!a.configurable&&(a.configurable=!0),a}}},has(t,e){if(e===Jt||e===Fa)return!1;for(let r of t.props)if(an(r)&&(r=r()),r!=null&&e in r)return!0;return!1},ownKeys(t){const e=[];for(let r of t.props)if(an(r)&&(r=r()),!!r){for(const n in r)e.includes(n)||e.push(n);for(const n of Object.getOwnPropertySymbols(r))e.includes(n)||e.push(n)}return e}};function wd(...t){return new Proxy({props:t},yd)}function oe(t,e,r,n){var a=(r&Fc)!==0,i=(r&Bc)!==0,o=n,s=!0,c=()=>(s&&(s=!1,o=i?pt(n):n),o),l;if(a){var u=Jt in t||Fa in t;l=Nt(t,e)?.set??(u&&e in t?k=>t[e]=k:void 0)}var p,h=!1;a?[p,h]=bd(()=>t[e]):p=t[e],p===void 0&&n!==void 0&&(p=c(),l&&(iu(),l(p)));var v;if(v=()=>{var k=t[e];return k===void 0?c():(s=!0,k)},(r&zc)===0)return v;if(l){var m=t.$$legacy;return function(k,w){return arguments.length>0?((!w||m||h)&&l(w?v():k),k):v()}}var b=!1,C=((r&$c)!==0?jn:Co)(()=>(b=!1,v()));a&&_(C);var y=B;return function(k,w){if(arguments.length>0){const T=w?_(C):a?_t(k):k;return P(C,T),b=!0,o!==void 0&&(o=T),k}return xr&&b||(y.f&vr)!==0?C.v:_(C)}}function _d(t){return new xd(t)}class xd{#e;#t;constructor(e){var r=new Map,n=(i,o)=>{var s=Mo(o,!1,!1);return r.set(i,s),s};const a=new Proxy({...e.props||{},$$events:{}},{get(i,o){return _(r.get(o)??n(o,Reflect.get(i,o)))},has(i,o){return o===Fa?!0:(_(r.get(o)??n(o,Reflect.get(i,o))),Reflect.has(i,o))},set(i,o,s){return P(r.get(o)??n(o,s),s),Reflect.set(i,o,s)}});this.#t=(e.hydrate?Xu:us)(e.component,{target:e.target,anchor:e.anchor,props:a,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&ee(),this.#e=a.$$events;for(const i of Object.keys(this.#t))i==="$set"||i==="$destroy"||i==="$on"||Or(this,i,{get(){return this.#t[i]},set(o){this.#t[i]=o},enumerable:!0});this.#t.$set=i=>{Object.assign(a,i)},this.#t.$destroy=()=>{Ju(this.#t)}}$set(e){this.#t.$set(e)}$on(e,r){this.#e[e]=this.#e[e]||[];const n=(...a)=>r.call(this,...a);return this.#e[e].push(n),()=>{this.#e[e]=this.#e[e].filter(a=>a!==n)}}$destroy(){this.#t.$destroy()}}let Rs;typeof HTMLElement=="function"&&(Rs=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(t,e,r){super(),this.$$ctor=t,this.$$s=e,r&&this.attachShadow({mode:"open"})}addEventListener(t,e,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,r)}removeEventListener(t,e,r){if(super.removeEventListener(t,e,r),this.$$c){const n=this.$$l_u.get(e);n&&(n(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(n){return a=>{const i=document.createElement("slot");n!=="default"&&(i.name=n),ie(a,i)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},r=Sd(this);for(const n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=t(n),e.default=!0):e[n]=t(n));for(const n of this.attributes){const a=this.$$g_p(n.name);a in this.$$d||(this.$$d[a]=Xn(a,n.value,this.$$p_d,"toProp"))}for(const n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=_d({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=Lu(()=>{Ga(()=>{this.$$r=!0;for(const n of Dn(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];const a=Xn(n,this.$$d[n],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,a)}this.$$r=!1})});for(const n in this.$$l)for(const a of this.$$l[n]){const i=this.$$c.$on(n,a);this.$$l_u.set(a,i)}this.$$l={}}}attributeChangedCallback(t,e,r){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Xn(t,r,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return Dn(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function Xn(t,e,r,n){const a=r[t]?.type;if(e=a==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="toAttribute")switch(a){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(a){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function Sd(t){const e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}function pn(t,e,r,n,a,i){let o=class extends Rs{constructor(){super(t,r,a),this.$$p_d=e}static get observedAttributes(){return Dn(e).map(s=>(e[s].attribute||s).toLowerCase())}};return Dn(e).forEach(s=>{Or(o.prototype,s,{get(){return this.$$c&&s in this.$$c?this.$$c[s]:this.$$d[s]},set(c){c=Xn(s,c,e),this.$$d[s]=c;var l=this.$$c;if(l){var u=Nt(l,s)?.get;u?l[s]=c:l.$set({[s]:c})}}})}),n.forEach(s=>{Or(o.prototype,s,{get(){return this.$$c?.[s]}})}),t.element=o,o}var Td=(t,e)=>e()(),Ed=Tt('<div class="chat-app__container"><div class="error-message svelte-4thrqu">Server is unreachable, please try later... <button class="error-message__retry-button svelte-4thrqu">Retry</button></div></div>'),Cd=Tt(" <!>",1);const Ad={hash:"svelte-4thrqu",code:`
1
+ var LiipGPTButton=function(sn){"use strict";const Vc="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(Vc);const Hc=1,Zc=2,Gc=16,Wc=1,Qc=4,Yc=8,Kc=16,Xc=1,Jc=2,Da="[",zn="[!",$a="]",vr={},he=Symbol(),eu="http://www.w3.org/1999/xhtml",tu="http://www.w3.org/2000/svg",ru="@attach",wo=!1;var ln=Array.isArray,nu=Array.prototype.indexOf,za=Array.from,Fn=Object.keys,Fr=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,au=Object.getOwnPropertyDescriptors,_o=Object.prototype,iu=Array.prototype,Fa=Object.getPrototypeOf,xo=Object.isExtensible;function cn(t){return typeof t=="function"}const br=()=>{};function So(t){return typeof t?.then=="function"}function To(t){for(var e=0;e<t.length;e++)t[e]()}function ou(){var t,e,r=new Promise((n,a)=>{t=n,e=a});return{promise:r,resolve:t,reject:e}}const We=2,Ba=4,ja=8,un=16,zt=32,kr=64,Ua=128,Qe=256,Bn=512,ve=1024,Ye=2048,yr=4096,pt=8192,wr=16384,qa=32768,Br=65536,Eo=1<<17,Co=1<<18,jn=1<<19,Ao=1<<20,Va=1<<21,Ha=1<<22,_r=1<<23,ar=Symbol("$state"),Za=Symbol("legacy props"),su=Symbol(""),Ga=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},lu=1,Ro=3,xr=8;function cu(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function Io(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function uu(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function du(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function hu(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function fu(t){throw new Error("https://svelte.dev/e/effect_orphan")}function pu(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function gu(){throw new Error("https://svelte.dev/e/hydration_failed")}function mu(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function vu(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function bu(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ku(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function dn(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function yu(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}let P=!1;function Te(t){P=t}let q;function be(t){if(t===null)throw dn(),vr;return q=t}function xt(){return be(Ke(q))}function Ft(t){if(P){if(Ke(q)!==null)throw dn(),vr;q=t}}function Lo(t=1){if(P){for(var e=t,r=q;e--;)r=Ke(r);q=r}}function hn(){for(var t=0,e=q;;){if(e.nodeType===xr){var r=e.data;if(r===$a){if(t===0)return e;t-=1}else(r===Da||r===zn)&&(t+=1)}var n=Ke(e);e.remove(),e=n}}function Oo(t){if(!t||t.nodeType!==xr)throw dn(),vr;return t.data}function Mo(t){return t===this.v}function Po(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function No(t){return!Po(t,this.v)}let wu=!1;const _u=[];function xu(t,e=!1){return Un(t,new Map,"",_u)}function Un(t,e,r,n,a=null){if(typeof t=="object"&&t!==null){var i=e.get(t);if(i!==void 0)return i;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(ln(t)){var o=Array(t.length);e.set(t,o),a!==null&&e.set(a,o);for(var s=0;s<t.length;s+=1){var c=t[s];s in t&&(o[s]=Un(c,e,r,n))}return o}if(Fa(t)===_o){o={},e.set(t,o),a!==null&&e.set(a,o);for(var l in t)o[l]=Un(t[l],e,r,n);return o}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function")return Un(t.toJSON(),e,r,n,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}let Le=null;function ir(t){Le=t}function jr(t,e=!1,r){Le={p:Le,c:null,e:null,s:t,x:null,l:null}}function Ur(t){var e=Le,r=e.e;if(r!==null){e.e=null;for(var n of r)ts(n)}return t!==void 0&&(e.x=t),Le=e.p,t??{}}function Do(){return!0}const Su=new WeakMap;function Tu(t){var e=j;if(e===null)return H.f|=_r,t;if((e.f&qa)===0){if((e.f&Ua)===0)throw!e.parent&&t instanceof Error&&$o(t),t;e.b.error(t)}else qn(t,e)}function qn(t,e){for(;e!==null;){if((e.f&Ua)!==0)try{e.b.error(t);return}catch{}e=e.parent}throw t instanceof Error&&$o(t),t}function $o(t){const e=Su.get(t);e&&(Fr(t,"message",{value:e.message}),Fr(t,"stack",{value:e.stack}))}let fn=[],Wa=[];function zo(){var t=fn;fn=[],To(t)}function Eu(){var t=Wa;Wa=[],To(t)}function Sr(t){fn.length===0&&queueMicrotask(zo),fn.push(t)}function Cu(){fn.length>0&&zo(),Wa.length>0&&Eu()}function Au(t){let e=0,r=Bt(0),n;return()=>{ju()&&(_(r),ei(()=>(e===0&&(n=mt(()=>t(()=>Gn(r)))),e+=1,()=>{Sr(()=>{e-=1,e===0&&(n?.(),n=void 0)})})))}}var Ru=Br|jn|Ua;function Iu(t,e,r){new Lu(t,e,r)}class Lu{pending=!1;parent;#e;#t;#a;#l;#u;#i=null;#r=null;#o=null;#s=null;#n=0;#c=!1;#d=null;#f=()=>{this.#d&&sr(this.#d,this.#n)};#h=Au(()=>(this.#d=Bt(this.#n),()=>{this.#d=null}));constructor(e,r,n){this.#e=e,this.#a=r,this.#l=n,this.#t=q,this.parent=j.b,this.pending=!!this.#a.pending,this.#u=qt(()=>{j.b=this,P&&xt();const a=this.#a.pending;if(P&&a)this.#r=fe(()=>a(this.#e)),queueMicrotask(()=>{this.#i=this.#p(()=>(Tr.ensure(),fe(()=>this.#l(this.#e)))),this.#n>0?this.#g():(Et(this.#r,()=>{this.#r=null}),this.pending=!1)});else{try{this.#i=fe(()=>n(this.#e))}catch(i){this.error(i)}this.#n>0?this.#g():this.pending=!1}},Ru),P&&(this.#e=q)}has_pending_snippet(){return!!this.#a.pending}#p(e){var r=j,n=H,a=Le;it(this.#u),Ae(this.#u),ir(this.#u.ctx);try{return e()}finally{it(r),Ae(n),ir(a)}}#g(){const e=this.#a.pending;this.#i!==null&&(this.#s=document.createDocumentFragment(),Ou(this.#i,this.#s)),this.#r===null&&(this.#r=fe(()=>e(this.#e)))}#m(e){this.#n+=e,this.#n===0&&(this.pending=!1,this.#r&&Et(this.#r,()=>{this.#r=null}),this.#s&&(this.#e.before(this.#s),this.#s=null))}update_pending_count(e){this.has_pending_snippet()?this.#m(e):this.parent&&this.parent.#m(e),Ya.add(this.#f)}get_effect_pending(){return this.#h(),_(this.#d)}error(e){var r=this.#a.onerror;let n=this.#a.failed;const a=()=>{this.#n=0,this.#o!==null&&Et(this.#o,()=>{this.#o=null}),this.pending=!0,this.#i=this.#p(()=>(this.#c=!1,fe(()=>this.#l(this.#e)))),this.#n>0?this.#g():this.pending=!1};if(this.#c||!r&&!n)throw e;var i=H;try{Ae(null),r?.(e,a)}finally{Ae(i)}this.#i&&(ke(this.#i),this.#i=null),this.#r&&(ke(this.#r),this.#r=null),this.#o&&(ke(this.#o),this.#o=null),P&&(be(this.#t),Lo(),be(hn())),n&&Sr(()=>{this.#o=this.#p(()=>{this.#c=!0;try{return fe(()=>{n(this.#e,()=>e,()=>a)})}catch(o){return qn(o,this.#u.parent),null}finally{this.#c=!1}})})}}function Ou(t,e){for(var r=t.nodes_start,n=t.nodes_end;r!==null;){var a=r===n?null:Ke(r);e.append(r),r=a}}function Mu(){for(var t=j.b;t!==null&&!t.has_pending_snippet();)t=t.parent;return t===null&&cu(),t}function Vn(t){var e=We|Ye,r=H!==null&&(H.f&We)!==0?H:null;return j===null||r!==null&&(r.f&Qe)!==0?e|=Qe:j.f|=jn,{ctx:Le,deps:null,effects:null,equals:Mo,f:e,fn:t,reactions:null,rv:0,v:he,wv:0,parent:r??j,ac:null}}function Pu(t,e){let r=j;r===null&&uu();var n=r.b,a=void 0,i=Bt(he),o=null,s=!H;return Vu(()=>{try{var c=t()}catch(v){c=Promise.reject(v)}var l=()=>c;a=o?.then(l,l)??Promise.resolve(c),o=a;var d=He,p=n.pending;s&&(n.update_pending_count(1),p||d.increment());const h=(v,m=void 0)=>{o=null,p||d.activate(),m?m!==Ga&&(i.f|=_r,sr(i,m)):((i.f&_r)!==0&&(i.f^=_r),sr(i,v)),s&&(n.update_pending_count(-1),p||d.decrement()),qo()};if(a.then(h,v=>h(null,v||"unknown")),d)return()=>{queueMicrotask(()=>d.neuter())}}),new Promise(c=>{function l(d){function p(){d===a?c(i):l(a)}d.then(p,p)}l(a)})}function ee(t){const e=Vn(t);return us(e),e}function Fo(t){const e=Vn(t);return e.equals=No,e}function Bo(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)ke(e[r])}}function Nu(t){for(var e=t.parent;e!==null;){if((e.f&We)===0)return e;e=e.parent}return null}function Qa(t){var e,r=j;it(Nu(t));try{Bo(t),e=ps(t)}finally{it(r)}return e}function jo(t){var e=Qa(t);if(t.equals(e)||(t.v=e,t.wv=hs()),!Cr)if(qr!==null)qr.set(t,t.v);else{var r=(cr||(t.f&Qe)!==0)&&t.deps!==null?yr:ve;Ee(t,r)}}function Uo(t,e,r){const n=Vn;if(e.length===0){r(t.map(n));return}var a=He,i=j,o=Du(),s=Mu();Promise.all(e.map(c=>Pu(c))).then(c=>{a?.activate(),o();try{r([...t.map(n),...c])}catch(l){(i.f&wr)===0&&qn(l,i)}a?.deactivate(),qo()}).catch(c=>{s.error(c)})}function Du(){var t=j,e=H,r=Le;return function(){it(t),Ae(e),ir(r)}}function qo(){it(null),Ae(null),ir(null)}const Hn=new Set;let He=null,qr=null,Ya=new Set,Vr=[],Zn=null,Ka=!1;class Tr{#e=new Map;#t=new Map;#a=new Set;#l=0;#u=null;#i=!1;#r=[];#o=[];#s=[];#n=[];#c=[];skipped_effects=new Set;#d(e){Vr=[];var r=null;if(Hn.size>1){r=new Map,qr=new Map;for(const[i,o]of this.#e)r.set(i,{v:i.v,wv:i.wv}),i.v=o;for(const i of Hn)if(i!==this)for(const[o,s]of i.#t)r.has(o)||(r.set(o,{v:o.v,wv:o.wv}),o.v=s)}for(const i of e)this.#f(i);if(this.#r.length===0&&this.#l===0){var n=this.#s,a=this.#n;this.#s=[],this.#n=[],this.#c=[],this.#h(),Vo(n),Vo(a),this.#u?.resolve()}else{for(const i of this.#s)Ee(i,ve);for(const i of this.#n)Ee(i,ve);for(const i of this.#c)Ee(i,ve)}if(r){for(const[i,{v:o,wv:s}]of r)i.wv<=s&&(i.v=o);qr=null}for(const i of this.#r)gn(i);for(const i of this.#o)gn(i);this.#r=[],this.#o=[]}#f(e){e.f^=ve;for(var r=e.first;r!==null;){var n=r.f,a=(n&(zt|kr))!==0,i=a&&(n&ve)!==0,o=i||(n&pt)!==0||this.skipped_effects.has(r);if(!o&&r.fn!==null){if(a)r.f^=ve;else if((n&Ba)!==0)this.#n.push(r);else if(Kn(r))if((n&Ha)!==0){var s=r.b?.pending?this.#o:this.#r;s.push(r)}else(r.f&un)!==0&&this.#c.push(r),gn(r);var c=r.first;if(c!==null){r=c;continue}}var l=r.parent;for(r=r.next;r===null&&l!==null;)r=l.next,l=l.parent}}capture(e,r){this.#t.has(e)||this.#t.set(e,r),this.#e.set(e,e.v)}activate(){He=this}deactivate(){He=null;for(const e of Ya)if(Ya.delete(e),e(),He!==null)break}neuter(){this.#i=!0}flush(){Vr.length>0?this.flush_effects():this.#h(),He===this&&(this.#l===0&&Hn.delete(this),this.deactivate())}flush_effects(){var e=Zr;Ka=!0;try{var r=0;for(ls(!0);Vr.length>0;){if(r++>1e3){var n,a;$u()}this.#d(Vr),Er.clear()}}finally{Ka=!1,ls(e),Zn=null}}#h(){if(!this.#i)for(const e of this.#a)e();this.#a.clear()}increment(){this.#l+=1}decrement(){if(this.#l-=1,this.#l===0){for(const e of this.#s)Ee(e,Ye),or(e);for(const e of this.#n)Ee(e,Ye),or(e);for(const e of this.#c)Ee(e,Ye),or(e);this.#s=[],this.#n=[],this.flush()}else this.deactivate()}add_callback(e){this.#a.add(e)}settled(){return(this.#u??=ou()).promise}static ensure(e=!0){if(He===null){const r=He=new Tr;Hn.add(He),e&&queueMicrotask(()=>{He===r&&r.flush()})}return He}}function re(t){var e;const r=Tr.ensure(!1);for(;;){if(Cu(),Vr.length===0)return r===He&&r.flush(),Zn=null,e;r.flush_effects()}}function $u(){try{pu()}catch(t){qn(t,Zn)}}function Vo(t){var e=t.length;if(e!==0){for(var r=0;r<e;r++){var n=t[r];if((n.f&(wr|pt))===0&&Kn(n)){var a=Yn;if(gn(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?is(n):n.fn=null),Yn>a&&(n.f&Ao)!==0)break}}for(;r<e;r+=1)or(t[r])}}function or(t){for(var e=Zn=t;e.parent!==null;){e=e.parent;var r=e.f;if(Ka&&e===j&&(r&un)!==0)return;if((r&(kr|zt))!==0){if((r&ve)===0)return;e.f^=ve}}Vr.push(e)}const Er=new Map;function Bt(t,e){var r={f:0,v:t,reactions:null,equals:Mo,rv:0,wv:0};return r}function te(t,e){const r=Bt(t);return us(r),r}function Ho(t,e=!1,r=!0){const n=Bt(t);return e||(n.equals=No),n}function $(t,e,r=!1){H!==null&&(!gt||(H.f&Eo)!==0)&&Do()&&(H.f&(We|un|Ha|Eo))!==0&&!Vt?.includes(t)&&ku();let n=r?St(e):e;return sr(t,n)}function sr(t,e){if(!t.equals(e)){var r=t.v;Cr?Er.set(t,e):Er.set(t,r),t.v=e,Tr.ensure().capture(t,r),(t.f&We)!==0&&((t.f&Ye)!==0&&Qa(t),Ee(t,(t.f&Qe)===0?ve:yr)),t.wv=hs(),Zo(t,Ye),j!==null&&(j.f&ve)!==0&&(j.f&(zt|kr))===0&&(ot===null?Zu([t]):ot.push(t))}return e}function Gn(t){$(t,t.v+1)}function Zo(t,e){var r=t.reactions;if(r!==null)for(var n=r.length,a=0;a<n;a++){var i=r[a],o=i.f;(o&Ye)===0&&(Ee(i,e),(o&(ve|Qe))!==0&&((o&We)!==0?Zo(i,yr):or(i)))}}function St(t){if(typeof t!="object"||t===null||ar in t)return t;const e=Fa(t);if(e!==_o&&e!==iu)return t;var r=new Map,n=ln(t),a=te(0),i=Ar,o=s=>{if(Ar===i)return s();var c=H,l=Ar;Ae(null),ds(i);var d=s();return Ae(c),ds(l),d};return n&&r.set("length",te(t.length)),new Proxy(t,{defineProperty(s,c,l){(!("value"in l)||l.configurable===!1||l.enumerable===!1||l.writable===!1)&&vu();var d=r.get(c);return d===void 0?d=o(()=>{var p=te(l.value);return r.set(c,p),p}):$(d,l.value,!0),!0},deleteProperty(s,c){var l=r.get(c);if(l===void 0){if(c in s){const d=o(()=>te(he));r.set(c,d),Gn(a)}}else $(l,he),Gn(a);return!0},get(s,c,l){if(c===ar)return t;var d=r.get(c),p=c in s;if(d===void 0&&(!p||$t(s,c)?.writable)&&(d=o(()=>{var v=St(p?s[c]:he),m=te(v);return m}),r.set(c,d)),d!==void 0){var h=_(d);return h===he?void 0:h}return Reflect.get(s,c,l)},getOwnPropertyDescriptor(s,c){var l=Reflect.getOwnPropertyDescriptor(s,c);if(l&&"value"in l){var d=r.get(c);d&&(l.value=_(d))}else if(l===void 0){var p=r.get(c),h=p?.v;if(p!==void 0&&h!==he)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return l},has(s,c){if(c===ar)return!0;var l=r.get(c),d=l!==void 0&&l.v!==he||Reflect.has(s,c);if(l!==void 0||j!==null&&(!d||$t(s,c)?.writable)){l===void 0&&(l=o(()=>{var h=d?St(s[c]):he,v=te(h);return v}),r.set(c,l));var p=_(l);if(p===he)return!1}return d},set(s,c,l,d){var p=r.get(c),h=c in s;if(n&&c==="length")for(var v=l;v<p.v;v+=1){var m=r.get(v+"");m!==void 0?$(m,he):v in s&&(m=o(()=>te(he)),r.set(v+"",m))}if(p===void 0)(!h||$t(s,c)?.writable)&&(p=o(()=>te(void 0)),$(p,St(l)),r.set(c,p));else{h=p.v!==he;var b=o(()=>St(l));$(p,b)}var A=Reflect.getOwnPropertyDescriptor(s,c);if(A?.set&&A.set.call(d,l),!h){if(n&&typeof c=="string"){var y=r.get("length"),k=Number(c);Number.isInteger(k)&&k>=y.v&&$(y,k+1)}Gn(a)}return!0},ownKeys(s){_(a);var c=Reflect.ownKeys(s).filter(p=>{var h=r.get(p);return h===void 0||h.v!==he});for(var[l,d]of r)d.v!==he&&!(l in s)&&c.push(l);return c},setPrototypeOf(){bu()}})}function Go(t){try{if(t!==null&&typeof t=="object"&&ar in t)return t[ar]}catch{}return t}function zu(t,e){return Object.is(Go(t),Go(e))}var Xa,Wo,Qo,Yo;function Ja(){if(Xa===void 0){Xa=window,Wo=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;Qo=$t(e,"firstChild").get,Yo=$t(e,"nextSibling").get,xo(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),xo(r)&&(r.__t=void 0)}}function jt(t=""){return document.createTextNode(t)}function at(t){return Qo.call(t)}function Ke(t){return Yo.call(t)}function Ut(t,e){if(!P)return at(t);var r=at(q);if(r===null)r=q.appendChild(jt());else if(e&&r.nodeType!==Ro){var n=jt();return r?.before(n),be(n),n}return be(r),r}function Oe(t,e){if(!P){var r=at(t);return r instanceof Comment&&r.data===""?Ke(r):r}return q}function lr(t,e=1,r=!1){let n=P?q:t;for(var a;e--;)a=n,n=Ke(n);if(!P)return n;if(r&&n?.nodeType!==Ro){var i=jt();return n===null?a?.after(i):n.before(i),be(i),i}return be(n),n}function Ko(t){t.textContent=""}function Xo(){return!1}function Fu(t){j===null&&H===null&&fu(),H!==null&&(H.f&Qe)!==0&&j===null&&hu(),Cr&&du()}function Bu(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Tt(t,e,r,n=!0){var a=j;a!==null&&(a.f&pt)!==0&&(t|=pt);var i={ctx:Le,deps:null,nodes_start:null,nodes_end:null,f:t|Ye,first:null,fn:e,last:null,next:null,parent:a,b:a&&a.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{gn(i),i.f|=qa}catch(c){throw ke(i),c}else e!==null&&or(i);var o=r&&i.deps===null&&i.first===null&&i.nodes_start===null&&i.teardown===null&&(i.f&jn)===0;if(!o&&n&&(a!==null&&Bu(i,a),H!==null&&(H.f&We)!==0)){var s=H;(s.effects??=[]).push(i)}return i}function ju(){return H!==null&&!gt}function Jo(t){const e=Tt(ja,null,!1);return Ee(e,ve),e.teardown=t,e}function es(t){Fu();var e=j.f,r=!H&&(e&zt)!==0&&(e&qa)===0;if(r){var n=Le;(n.e??=[]).push(t)}else return ts(t)}function ts(t){return Tt(Ba|Ao,t,!1)}function Uu(t){Tr.ensure();const e=Tt(kr,t,!0);return()=>{ke(e)}}function qu(t){Tr.ensure();const e=Tt(kr,t,!0);return(r={})=>new Promise(n=>{r.outro?Et(e,()=>{ke(e),n(void 0)}):(ke(e),n(void 0))})}function Wn(t){return Tt(Ba,t,!1)}function Vu(t){return Tt(Ha|jn,t,!0)}function ei(t,e=0){return Tt(ja|e,t,!0)}function Qn(t,e=[],r=[]){Uo(e,r,n=>{Tt(ja,()=>t(...n.map(_)),!0)})}function qt(t,e=0){var r=Tt(un|e,t,!0);return r}function fe(t,e=!0){return Tt(zt,t,!0,e)}function rs(t){var e=t.teardown;if(e!==null){const r=Cr,n=H;cs(!0),Ae(null);try{e.call(null)}finally{cs(r),Ae(n)}}}function ns(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){r.ac?.abort(Ga);var n=r.next;(r.f&kr)!==0?r.parent=null:ke(r,e),r=n}}function Hu(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&zt)===0&&ke(e),e=r}}function ke(t,e=!0){var r=!1;(e||(t.f&Co)!==0)&&t.nodes_start!==null&&t.nodes_end!==null&&(as(t.nodes_start,t.nodes_end),r=!0),ns(t,e&&!r),Xn(t,0),Ee(t,wr);var n=t.transitions;if(n!==null)for(const i of n)i.stop();rs(t);var a=t.parent;a!==null&&a.first!==null&&is(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function as(t,e){for(;t!==null;){var r=t===e?null:Ke(t);t.remove(),t=r}}function is(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function Et(t,e){var r=[];ti(t,r,!0),os(r,()=>{ke(t),e&&e()})}function os(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var a of t)a.out(n)}else e()}function ti(t,e,r){if((t.f&pt)===0){if(t.f^=pt,t.transitions!==null)for(const o of t.transitions)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var a=n.next,i=(n.f&Br)!==0||(n.f&zt)!==0;ti(n,e,i?r:!1),n=a}}}function Hr(t){ss(t,!0)}function ss(t,e){if((t.f&pt)!==0){t.f^=pt,(t.f&ve)===0&&(Ee(t,Ye),or(t));for(var r=t.first;r!==null;){var n=r.next,a=(r.f&Br)!==0||(r.f&zt)!==0;ss(r,a?e:!1),r=n}if(t.transitions!==null)for(const i of t.transitions)(i.is_global||e)&&i.in()}}let Zr=!1;function ls(t){Zr=t}let Cr=!1;function cs(t){Cr=t}let H=null,gt=!1;function Ae(t){H=t}let j=null;function it(t){j=t}let Vt=null;function us(t){H!==null&&(Vt===null?Vt=[t]:Vt.push(t))}let Me=null,Xe=0,ot=null;function Zu(t){ot=t}let Yn=1,pn=0,Ar=pn;function ds(t){Ar=t}let cr=!1;function hs(){return++Yn}function Kn(t){var e=t.f;if((e&Ye)!==0)return!0;if((e&yr)!==0){var r=t.deps,n=(e&Qe)!==0;if(r!==null){var a,i,o=(e&Bn)!==0,s=n&&j!==null&&!cr,c=r.length;if((o||s)&&(j===null||(j.f&wr)===0)){var l=t,d=l.parent;for(a=0;a<c;a++)i=r[a],(o||!i?.reactions?.includes(l))&&(i.reactions??=[]).push(l);o&&(l.f^=Bn),s&&d!==null&&(d.f&Qe)===0&&(l.f^=Qe)}for(a=0;a<c;a++)if(i=r[a],Kn(i)&&jo(i),i.wv>t.wv)return!0}(!n||j!==null&&!cr)&&Ee(t,ve)}return!1}function fs(t,e,r=!0){var n=t.reactions;if(n!==null&&!Vt?.includes(t))for(var a=0;a<n.length;a++){var i=n[a];(i.f&We)!==0?fs(i,e,!1):e===i&&(r?Ee(i,Ye):(i.f&ve)!==0&&Ee(i,yr),or(i))}}function ps(t){var e=Me,r=Xe,n=ot,a=H,i=cr,o=Vt,s=Le,c=gt,l=Ar,d=t.f;Me=null,Xe=0,ot=null,cr=(d&Qe)!==0&&(gt||!Zr||H===null),H=(d&(zt|kr))===0?t:null,Vt=null,ir(t.ctx),gt=!1,Ar=++pn,t.ac!==null&&(t.ac.abort(Ga),t.ac=null);try{t.f|=Va;var p=(0,t.fn)(),h=t.deps;if(Me!==null){var v;if(Xn(t,Xe),h!==null&&Xe>0)for(h.length=Xe+Me.length,v=0;v<Me.length;v++)h[Xe+v]=Me[v];else t.deps=h=Me;if(!cr||(d&We)!==0&&t.reactions!==null)for(v=Xe;v<h.length;v++)(h[v].reactions??=[]).push(t)}else h!==null&&Xe<h.length&&(Xn(t,Xe),h.length=Xe);if(Do()&&ot!==null&&!gt&&h!==null&&(t.f&(We|yr|Ye))===0)for(v=0;v<ot.length;v++)fs(ot[v],t);return a!==null&&a!==t&&(pn++,ot!==null&&(n===null?n=ot:n.push(...ot))),(t.f&_r)!==0&&(t.f^=_r),p}catch(m){return Tu(m)}finally{t.f^=Va,Me=e,Xe=r,ot=n,H=a,cr=i,Vt=o,ir(s),gt=c,Ar=l}}function Gu(t,e){let r=e.reactions;if(r!==null){var n=nu.call(r,t);if(n!==-1){var a=r.length-1;a===0?r=e.reactions=null:(r[n]=r[a],r.pop())}}r===null&&(e.f&We)!==0&&(Me===null||!Me.includes(e))&&(Ee(e,yr),(e.f&(Qe|Bn))===0&&(e.f^=Bn),Bo(e),Xn(e,0))}function Xn(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)Gu(t,r[n])}function gn(t){var e=t.f;if((e&wr)===0){Ee(t,ve);var r=j,n=Zr;j=t,Zr=!0;try{(e&un)!==0?Hu(t):ns(t),rs(t);var a=ps(t);t.teardown=typeof a=="function"?a:null,t.wv=Yn;var i;wo&&wu&&(t.f&Ye)!==0&&t.deps}finally{Zr=n,j=r}}}async function gs(){await Promise.resolve(),re()}function _(t){var e=t.f,r=(e&We)!==0;if(H!==null&&!gt){var n=j!==null&&(j.f&wr)!==0;if(!n&&!Vt?.includes(t)){var a=H.deps;if((H.f&Va)!==0)t.rv<pn&&(t.rv=pn,Me===null&&a!==null&&a[Xe]===t?Xe++:Me===null?Me=[t]:(!cr||!Me.includes(t))&&Me.push(t));else{(H.deps??=[]).push(t);var i=t.reactions;i===null?t.reactions=[H]:i.includes(H)||i.push(H)}}}else if(r&&t.deps===null&&t.effects===null){var o=t,s=o.parent;s!==null&&(s.f&Qe)===0&&(o.f^=Qe)}if(Cr){if(Er.has(t))return Er.get(t);if(r){o=t;var c=o.v;return((o.f&ve)!==0||ms(o))&&(c=Qa(o)),Er.set(o,c),c}}else if(r){if(o=t,qr?.has(o))return qr.get(o);Kn(o)&&jo(o)}if((t.f&_r)!==0)throw t.v;return t.v}function ms(t){if(t.v===he)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(Er.has(e)||(e.f&We)!==0&&ms(e))return!0;return!1}function mt(t){var e=gt;try{return gt=!0,t()}finally{gt=e}}const Wu=-7169;function Ee(t,e){t.f=t.f&Wu|e}function Qu(t,e){if(e){const r=document.body;t.autofocus=!0,Sr(()=>{document.activeElement===r&&t.focus()})}}function Yu(t){var e=H,r=j;Ae(null),it(null);try{return t()}finally{Ae(e),it(r)}}const vs=new Set,ri=new Set;function bs(t,e,r,n={}){function a(i){if(n.capture||mn.call(e,i),!i.cancelBubble)return Yu(()=>r?.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Sr(()=>{e.addEventListener(t,a,n)}):e.addEventListener(t,a,n),a}function Ku(t,e,r,n,a){var i={capture:n,passive:a},o=bs(t,e,r,i);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Jo(()=>{e.removeEventListener(t,o,i)})}function ks(t){for(var e=0;e<t.length;e++)vs.add(t[e]);for(var r of ri)r(t)}function mn(t){var e=this,r=e.ownerDocument,n=t.type,a=t.composedPath?.()||[],i=a[0]||t.target,o=0,s=t.__root;if(s){var c=a.indexOf(s);if(c!==-1&&(e===document||e===window)){t.__root=e;return}var l=a.indexOf(e);if(l===-1)return;c<=l&&(o=c)}if(i=a[o]||t.target,i!==e){Fr(t,"currentTarget",{configurable:!0,get(){return i||r}});var d=H,p=j;Ae(null),it(null);try{for(var h,v=[];i!==null;){var m=i.assignedSlot||i.parentNode||i.host||null;try{var b=i["__"+n];if(b!=null&&(!i.disabled||t.target===i))if(ln(b)){var[A,...y]=b;A.apply(i,[t,...y])}else b.call(i,t)}catch(k){h?v.push(k):h=k}if(t.cancelBubble||m===e||m===null)break;i=m}if(h){for(let k of v)queueMicrotask(()=>{throw k});throw h}}finally{t.__root=e,delete t.currentTarget,Ae(d),it(p)}}}let st;function Xu(){st=void 0}function Ju(t){let e=null,r=P;var n;if(P){for(e=q,st===void 0&&(st=at(document.head));st!==null&&(st.nodeType!==xr||st.data!==Da);)st=Ke(st);st===null?Te(!1):st=be(Ke(st))}P||(n=document.head.appendChild(jt()));try{qt(()=>t(n),Co)}finally{r&&(Te(!0),st=q,be(e))}}function ys(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function Ht(t,e){var r=j;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function Ct(t,e){var r=(e&Xc)!==0,n=(e&Jc)!==0,a,i=!t.startsWith("<!>");return()=>{if(P)return Ht(q,null),q;a===void 0&&(a=ys(i?t:"<!>"+t),r||(a=at(a)));var o=n||Wo?document.importNode(a,!0):a.cloneNode(!0);if(r){var s=at(o),c=o.lastChild;Ht(s,c)}else Ht(o,o);return o}}function vt(){if(P)return Ht(q,null),q;var t=document.createDocumentFragment(),e=document.createComment(""),r=jt();return t.append(e,r),Ht(e,r),t}function oe(t,e){if(P){j.nodes_end=q,xt();return}t!==null&&t.before(e)}function ed(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const td=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function rd(t){return td.includes(t)}const nd={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function ad(t){return t=t.toLowerCase(),nd[t]??t}const id=["touchstart","touchmove"];function od(t){return id.includes(t)}const sd=["textarea","script","style","title"];function ld(t){return sd.includes(t)}function ws(t,e){var r=e==null?"":typeof e=="object"?e+"":e;r!==(t.__t??=t.nodeValue)&&(t.__t=r,t.nodeValue=r+"")}function _s(t,e){return xs(t,e)}function cd(t,e){Ja(),e.intro=e.intro??!1;const r=e.target,n=P,a=q;try{for(var i=at(r);i&&(i.nodeType!==xr||i.data!==Da);)i=Ke(i);if(!i)throw vr;Te(!0),be(i),xt();const o=xs(t,{...e,anchor:i});if(q===null||q.nodeType!==xr||q.data!==$a)throw dn(),vr;return Te(!1),o}catch(o){if(o===vr)return e.recover===!1&&gu(),Ja(),Ko(r),Te(!1),_s(t,e);throw o}finally{Te(n),be(a),Xu()}}const Gr=new Map;function xs(t,{target:e,anchor:r,props:n={},events:a,context:i,intro:o=!0}){Ja();var s=new Set,c=p=>{for(var h=0;h<p.length;h++){var v=p[h];if(!s.has(v)){s.add(v);var m=od(v);e.addEventListener(v,mn,{passive:m});var b=Gr.get(v);b===void 0?(document.addEventListener(v,mn,{passive:m}),Gr.set(v,1)):Gr.set(v,b+1)}}};c(za(vs)),ri.add(c);var l=void 0,d=qu(()=>{var p=r??e.appendChild(jt());return fe(()=>{if(i){jr({});var h=Le;h.c=i}a&&(n.$$events=a),P&&Ht(p,null),l=t(p,n)||{},P&&(j.nodes_end=q),i&&Ur()}),()=>{for(var h of s){e.removeEventListener(h,mn);var v=Gr.get(h);--v===0?(document.removeEventListener(h,mn),Gr.delete(h)):Gr.set(h,v)}ri.delete(c),p!==r&&p.parentNode?.removeChild(p)}});return ni.set(l,d),l}let ni=new WeakMap;function ud(t,e){const r=ni.get(t);return r?(ni.delete(t),r(e)):Promise.resolve()}function Ss(t,e,...r){var n=t,a=br,i;qt(()=>{a!==(a=e())&&(i&&(ke(i),i=null),i=fe(()=>a(n,...r)))},Br),P&&(n=q)}function dd(t){Le===null&&Io(),es(()=>{const e=mt(t);if(typeof e=="function")return e})}function hd(t){Le===null&&Io(),dd(()=>()=>mt(t))}const ai=0,Jn=1,ii=2;function Ts(t,e,r,n,a){P&&xt();var i=t,o=Le,s=he,c,l,d,p=Bt(void 0),h=Bt(void 0),v=!1;function m(A,y){v=!0,y&&(it(b),Ae(b),ir(o));try{A===ai&&r&&(c?Hr(c):c=fe(()=>r(i))),A===Jn&&n&&(l?Hr(l):l=fe(()=>n(i,p))),A!==ai&&c&&Et(c,()=>c=null),A!==Jn&&l&&Et(l,()=>l=null),A!==ii&&d&&Et(d,()=>d=null)}finally{y&&(ir(null),Ae(null),it(null),re())}}var b=qt(()=>{if(s===(s=e()))return;let A=P&&So(s)===(i.data===zn);if(A&&(i=hn(),be(i),Te(!1),A=!0),So(s)){var y=s;v=!1,y.then(k=>{y===s&&(sr(p,k),m(Jn,!0))},k=>{if(y===s)throw sr(h,k),m(ii,!0),h.v}),P?r&&(c=fe(()=>r(i))):Sr(()=>{v||m(ai,!0)})}else sr(p,s),m(Jn,!1);return A&&Te(!0),()=>s=he});P&&(i=q)}function ur(t,e,r=!1){P&&xt();var n=t,a=null,i=null,o=he,s=r?Br:0,c=!1;const l=(v,m=!0)=>{c=!0,h(m,v)};var d=null;function p(){d!==null&&(d.lastChild.remove(),n.before(d),d=null);var v=o?a:i,m=o?i:a;v&&Hr(v),m&&Et(m,()=>{o?i=null:a=null})}const h=(v,m)=>{if(o===(o=v))return;let b=!1;if(P){const I=Oo(n)===zn;!!o===I&&(n=hn(),be(n),Te(!1),b=!0)}var A=Xo(),y=n;if(A&&(d=document.createDocumentFragment(),d.append(y=jt())),o?a??=m&&fe(()=>m(y)):i??=m&&fe(()=>m(y)),A){var k=He,w=o?a:i,T=o?i:a;w&&k.skipped_effects.delete(w),T&&k.skipped_effects.add(T),k.add_callback(p)}else p();b&&Te(!0)};qt(()=>{c=!1,e(l),c||h(null,null)},s),P&&(n=q)}function fd(t,e){return e}function pd(t,e,r){for(var n=t.items,a=[],i=e.length,o=0;o<i;o++)ti(e[o].e,a,!0);var s=i>0&&a.length===0&&r!==null;if(s){var c=r.parentNode;Ko(c),c.append(r),n.clear(),At(t,e[0].prev,e[i-1].next)}os(a,()=>{for(var l=0;l<i;l++){var d=e[l];s||(n.delete(d.k),At(t,d.prev,d.next)),ke(d.e,!s)}})}function gd(t,e,r,n,a,i=null){var o=t,s={flags:e,items:new Map,first:null};P&&xt();var c=null,l=!1,d=new Map,p=Fo(()=>{var b=r();return ln(b)?b:b==null?[]:za(b)}),h,v;function m(){md(v,h,s,d,o,a,e,n,r),i!==null&&(h.length===0?c?Hr(c):c=fe(()=>i(o)):c!==null&&Et(c,()=>{c=null}))}qt(()=>{v??=j,h=_(p);var b=h.length;if(l&&b===0)return;l=b===0;let A=!1;if(P){var y=Oo(o)===zn;y!==(b===0)&&(o=hn(),be(o),Te(!1),A=!0)}if(P){for(var k=null,w,T=0;T<b;T++){if(q.nodeType===xr&&q.data===$a){o=q,A=!0,Te(!1);break}var I=h[T],U=n(I,T);w=oi(q,s,k,null,I,U,T,a,e,r),s.items.set(U,w),k=w}b>0&&be(hn())}if(P)b===0&&i&&(c=fe(()=>i(o)));else if(Xo()){var Q=new Set,je=He;for(T=0;T<b;T+=1){I=h[T],U=n(I,T);var ce=s.items.get(U)??d.get(U);ce?Es(ce,I,T):(w=oi(null,s,null,null,I,U,T,a,e,r,!0),d.set(U,w)),Q.add(U)}for(const[pr,ae]of s.items)Q.has(pr)||je.skipped_effects.add(ae.e);je.add_callback(m)}else m();A&&Te(!0),_(p)}),P&&(o=q)}function md(t,e,r,n,a,i,o,s,c){var l=e.length,d=r.items,p=r.first,h=p,v,m=null,b=[],A=[],y,k,w,T;for(T=0;T<l;T+=1){if(y=e[T],k=s(y,T),w=d.get(k),w===void 0){var I=n.get(k);if(I!==void 0){n.delete(k),d.set(k,I);var U=m?m.next:h;At(r,m,I),At(r,I,U),si(I,U,a),m=I}else{var Q=h?h.e.nodes_start:a;m=oi(Q,r,m,m===null?r.first:m.next,y,k,T,i,o,c)}d.set(k,m),b=[],A=[],h=m.next;continue}if(Es(w,y,T),(w.e.f&pt)!==0&&Hr(w.e),w!==h){if(v!==void 0&&v.has(w)){if(b.length<A.length){var je=A[0],ce;m=je.prev;var pr=b[0],ae=b[b.length-1];for(ce=0;ce<b.length;ce+=1)si(b[ce],je,a);for(ce=0;ce<A.length;ce+=1)v.delete(A[ce]);At(r,pr.prev,ae.next),At(r,m,pr),At(r,ae,je),h=je,m=ae,T-=1,b=[],A=[]}else v.delete(w),si(w,h,a),At(r,w.prev,w.next),At(r,w,m===null?r.first:m.next),At(r,m,w),m=w;continue}for(b=[],A=[];h!==null&&h.k!==k;)(h.e.f&pt)===0&&(v??=new Set).add(h),A.push(h),h=h.next;if(h===null)continue;w=h}b.push(w),m=w,h=w.next}if(h!==null||v!==void 0){for(var er=v===void 0?[]:za(v);h!==null;)(h.e.f&pt)===0&&er.push(h),h=h.next;var gr=er.length;if(gr>0){var mr=null;pd(r,er,mr)}}t.first=r.first&&r.first.e,t.last=m&&m.e;for(var rn of n.values())ke(rn.e);n.clear()}function Es(t,e,r,n){sr(t.v,e),t.i=r}function oi(t,e,r,n,a,i,o,s,c,l,d){var p=(c&Hc)!==0,h=(c&Gc)===0,v=p?h?Ho(a,!1,!1):Bt(a):a,m=(c&Zc)===0?o:Bt(o),b={i:m,v,k:i,a:null,e:null,prev:r,next:n};try{if(t===null){var A=document.createDocumentFragment();A.append(t=jt())}return b.e=fe(()=>s(t,v,m,l),P),b.e.prev=r&&r.e,b.e.next=n&&n.e,r===null?d||(e.first=b):(r.next=b,r.e.next=b.e),n!==null&&(n.prev=b,n.e.prev=b.e),b}finally{}}function si(t,e,r){for(var n=t.next?t.next.e.nodes_start:r,a=e?e.e.nodes_start:r,i=t.e.nodes_start;i!==null&&i!==n;){var o=Ke(i);a.before(i),i=o}}function At(t,e,r){e===null?t.first=r:(e.next=r,e.e.next=r&&r.e),r!==null&&(r.prev=e,r.e.prev=e&&e.e)}function li(t,e,r=!1,n=!1,a=!1){var i=t,o="";Qn(()=>{var s=j;if(o===(o=e()??"")){P&&xt();return}if(s.nodes_start!==null&&(as(s.nodes_start,s.nodes_end),s.nodes_start=s.nodes_end=null),o!==""){if(P){q.data;for(var c=xt(),l=c;c!==null&&(c.nodeType!==xr||c.data!=="");)l=c,c=Ke(c);if(c===null)throw dn(),vr;Ht(q,l),i=be(c);return}var d=o+"";r?d=`<svg>${d}</svg>`:n&&(d=`<math>${d}</math>`);var p=ys(d);if((r||n)&&(p=at(p)),Ht(at(p),p.lastChild),r||n)for(;at(p);)i.before(at(p));else i.before(p)}})}function Cs(t,e,r,n,a,i){let o=P;P&&xt();var s,c,l=null;P&&q.nodeType===lu&&(l=q,xt());var d=P?q:t,p;qt(()=>{const h=e()||null;var v=h==="svg"?tu:null;h!==s&&(p&&(h===null?Et(p,()=>{p=null,c=null}):h===c?Hr(p):ke(p)),h&&h!==c&&(p=fe(()=>{if(l=P?l:v?document.createElementNS(v,h):document.createElement(h),Ht(l,l),n){P&&ld(h)&&l.append(document.createComment(""));var m=P?at(l):l.appendChild(jt());P&&(m===null?Te(!1):be(m)),n(l,m)}j.nodes_end=l,d.before(l)})),s=h,s&&(c=s))},Br),o&&(Te(!0),be(d))}function vd(t,e){Sr(()=>{var r=t.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+e.hash)){const a=document.createElement("style");a.id=e.hash,a.textContent=e.code,n.appendChild(a)}})}function As(t,e,r){Wn(()=>{var n=mt(()=>e(t,r?.())||{});if(n?.destroy)return()=>n.destroy()})}function bd(t,e){var r=void 0,n;qt(()=>{r!==(r=e())&&(n&&(ke(n),n=null),r&&(n=fe(()=>{Wn(()=>r(t))})))})}function Rs(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(r=Rs(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function kd(){for(var t,e,r=0,n="",a=arguments.length;r<a;r++)(t=arguments[r])&&(e=Rs(t))&&(n&&(n+=" "),n+=e);return n}function yd(t){return typeof t=="object"?kd(t):t??""}const Is=[...`
2
+ \r\f \v\uFEFF`];function wd(t,e,r){var n=t==null?"":""+t;if(r){for(var a in r)if(r[a])n=n?n+" "+a:a;else if(n.length)for(var i=a.length,o=0;(o=n.indexOf(a,o))>=0;){var s=o+i;(o===0||Is.includes(n[o-1]))&&(s===n.length||Is.includes(n[s]))?n=(o===0?"":n.substring(0,o))+n.substring(s+1):o=s}}return n===""?null:n}function Ls(t,e=!1){var r=e?" !important;":";",n="";for(var a in t){var i=t[a];i!=null&&i!==""&&(n+=" "+a+": "+i+r)}return n}function ci(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function _d(t,e){if(e){var r="",n,a;if(Array.isArray(e)?(n=e[0],a=e[1]):n=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var i=!1,o=0,s=!1,c=[];n&&c.push(...Object.keys(n).map(ci)),a&&c.push(...Object.keys(a).map(ci));var l=0,d=-1;const b=t.length;for(var p=0;p<b;p++){var h=t[p];if(s?h==="/"&&t[p-1]==="*"&&(s=!1):i?i===h&&(i=!1):h==="/"&&t[p+1]==="*"?s=!0:h==='"'||h==="'"?i=h:h==="("?o++:h===")"&&o--,!s&&i===!1&&o===0){if(h===":"&&d===-1)d=p;else if(h===";"||p===b-1){if(d!==-1){var v=ci(t.substring(l,d).trim());if(!c.includes(v)){h!==";"&&p++;var m=t.substring(l,p).trim();r+=" "+m+";"}}l=p+1,d=-1}}}}return n&&(r+=Ls(n)),a&&(r+=Ls(a,!0)),r=r.trim(),r===""?null:r}return t==null?null:String(t)}function xd(t,e,r,n,a,i){var o=t.__className;if(P||o!==r||o===void 0){var s=wd(r,n,i);(!P||s!==t.getAttribute("class"))&&(s==null?t.removeAttribute("class"):e?t.className=s:t.setAttribute("class",s)),t.__className=r}else if(i&&a!==i)for(var c in i){var l=!!i[c];(a==null||l!==!!a[c])&&t.classList.toggle(c,l)}return i}function ui(t,e={},r,n){for(var a in r){var i=r[a];e[a]!==i&&(r[a]==null?t.style.removeProperty(a):t.style.setProperty(a,i,n))}}function Sd(t,e,r,n){var a=t.__style;if(P||a!==e){var i=_d(e,n);(!P||i!==t.getAttribute("style"))&&(i==null?t.removeAttribute("style"):t.style.cssText=i),t.__style=e}else n&&(Array.isArray(n)?(ui(t,r?.[0],n[0]),ui(t,r?.[1],n[1],"important")):ui(t,r,n));return n}function di(t,e,r=!1){if(t.multiple){if(e==null)return;if(!ln(e))return yu();for(var n of t.options)n.selected=e.includes(Os(n));return}for(n of t.options){var a=Os(n);if(zu(a,e)){n.selected=!0;return}}(!r||e!==void 0)&&(t.selectedIndex=-1)}function Td(t){var e=new MutationObserver(()=>{di(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Jo(()=>{e.disconnect()})}function Os(t){return"__value"in t?t.__value:t.value}const Wr=Symbol("class"),vn=Symbol("style"),Ms=Symbol("is custom element"),Ps=Symbol("is html");function Ed(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function hi(t,e,r,n){var a=Ds(t);P&&(a[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")||a[e]!==(a[e]=r)&&(e==="loading"&&(t[su]=r),r==null?t.removeAttribute(e):typeof r!="string"&&zs(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function Cd(t,e,r,n,a=!1){var i=Ds(t),o=i[Ms],s=!i[Ps];let c=P&&o;c&&Te(!1);var l=e||{},d=t.tagName==="OPTION";for(var p in e)p in r||(r[p]=null);r.class?r.class=yd(r.class):r[Wr]&&(r.class=null),r[vn]&&(r.style??=null);var h=zs(t);for(const w in r){let T=r[w];if(d&&w==="value"&&T==null){t.value=t.__value="",l[w]=T;continue}if(w==="class"){var v=t.namespaceURI==="http://www.w3.org/1999/xhtml";xd(t,v,T,n,e?.[Wr],r[Wr]),l[w]=T,l[Wr]=r[Wr];continue}if(w==="style"){Sd(t,T,e?.[vn],r[vn]),l[w]=T,l[vn]=r[vn];continue}var m=l[w];if(!(T===m&&!(T===void 0&&t.hasAttribute(w)))){l[w]=T;var b=w[0]+w[1];if(b!=="$$")if(b==="on"){const I={},U="$$"+w;let Q=w.slice(2);var A=rd(Q);if(ed(Q)&&(Q=Q.slice(0,-7),I.capture=!0),!A&&m){if(T!=null)continue;t.removeEventListener(Q,l[U],I),l[U]=null}if(T!=null)if(A)t[`__${Q}`]=T,ks([Q]);else{let je=function(ce){l[w].call(this,ce)};l[U]=bs(Q,t,je,I)}else A&&(t[`__${Q}`]=void 0)}else if(w==="style")hi(t,w,T);else if(w==="autofocus")Qu(t,!!T);else if(!o&&(w==="__value"||w==="value"&&T!=null))t.value=t.__value=T;else if(w==="selected"&&d)Ed(t,T);else{var y=w;s||(y=ad(y));var k=y==="defaultValue"||y==="defaultChecked";if(T==null&&!o&&!k)if(i[w]=null,y==="value"||y==="checked"){let I=t;const U=e===void 0;if(y==="value"){let Q=I.defaultValue;I.removeAttribute(y),I.defaultValue=Q,I.value=I.__value=U?Q:null}else{let Q=I.defaultChecked;I.removeAttribute(y),I.defaultChecked=Q,I.checked=U?Q:!1}}else t.removeAttribute(w);else k||h.includes(y)&&(o||typeof T!="string")?t[y]=T:typeof T!="function"&&hi(t,y,T)}}}return c&&Te(!0),l}function Ns(t,e,r=[],n=[],a,i=!1){Uo(r,n,o=>{var s=void 0,c={},l=t.nodeName==="SELECT",d=!1;if(qt(()=>{var h=e(...o.map(_)),v=Cd(t,s,h,a,i);d&&l&&"value"in h&&di(t,h.value);for(let b of Object.getOwnPropertySymbols(c))h[b]||ke(c[b]);for(let b of Object.getOwnPropertySymbols(h)){var m=h[b];b.description===ru&&(!s||m!==s[b])&&(c[b]&&ke(c[b]),c[b]=fe(()=>bd(t,()=>m))),v[b]=m}s=v}),l){var p=t;Wn(()=>{di(p,s.value,!0),Td(p)})}d=!0})}function Ds(t){return t.__attributes??={[Ms]:t.nodeName.includes("-"),[Ps]:t.namespaceURI===eu}}var $s=new Map;function zs(t){var e=$s.get(t.nodeName);if(e)return e;$s.set(t.nodeName,e=[]);for(var r,n=t,a=Element.prototype;a!==n;){r=au(n);for(var i in r)r[i].set&&e.push(i);n=Fa(n)}return e}function Fs(t,e){return t===e||t?.[ar]===e}function Bs(t={},e,r,n){return Wn(()=>{var a,i;return ei(()=>{a=i,i=[],mt(()=>{t!==r(...i)&&(e(t,...i),a&&Fs(r(...a),t)&&e(null,...a))})}),()=>{Sr(()=>{i&&Fs(r(...i),t)&&e(null,...i)})}}),t}const Qr=[];function Ad(t,e=br){let r=null;const n=new Set;function a(s){if(Po(t,s)&&(t=s,r)){const c=!Qr.length;for(const l of n)l[1](),Qr.push(l,t);if(c){for(let l=0;l<Qr.length;l+=2)Qr[l][0](Qr[l+1]);Qr.length=0}}}function i(s){a(s(t))}function o(s,c=br){const l=[s,c];return n.add(l),n.size===1&&(r=e(a,i)||br),s(t),()=>{n.delete(l),n.size===0&&r&&(r(),r=null)}}return{set:a,update:i,subscribe:o}}let ea=!1;function Rd(t){var e=ea;try{return ea=!1,[t(),ea]}finally{ea=e}}const Id={get(t,e){if(!t.exclude.includes(e))return t.props[e]},set(t,e){return!1},getOwnPropertyDescriptor(t,e){if(!t.exclude.includes(e)&&e in t.props)return{enumerable:!0,configurable:!0,value:t.props[e]}},has(t,e){return t.exclude.includes(e)?!1:e in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(e=>!t.exclude.includes(e))}};function fi(t,e,r){return new Proxy({props:t,exclude:e},Id)}const Ld={get(t,e){let r=t.props.length;for(;r--;){let n=t.props[r];if(cn(n)&&(n=n()),typeof n=="object"&&n!==null&&e in n)return n[e]}},set(t,e,r){let n=t.props.length;for(;n--;){let a=t.props[n];cn(a)&&(a=a());const i=$t(a,e);if(i&&i.set)return i.set(r),!0}return!1},getOwnPropertyDescriptor(t,e){let r=t.props.length;for(;r--;){let n=t.props[r];if(cn(n)&&(n=n()),typeof n=="object"&&n!==null&&e in n){const a=$t(n,e);return a&&!a.configurable&&(a.configurable=!0),a}}},has(t,e){if(e===ar||e===Za)return!1;for(let r of t.props)if(cn(r)&&(r=r()),r!=null&&e in r)return!0;return!1},ownKeys(t){const e=[];for(let r of t.props)if(cn(r)&&(r=r()),!!r){for(const n in r)e.includes(n)||e.push(n);for(const n of Object.getOwnPropertySymbols(r))e.includes(n)||e.push(n)}return e}};function Od(...t){return new Proxy({props:t},Ld)}function se(t,e,r,n){var a=(r&Yc)!==0,i=(r&Kc)!==0,o=n,s=!0,c=()=>(s&&(s=!1,o=i?mt(n):n),o),l;if(a){var d=ar in t||Za in t;l=$t(t,e)?.set??(d&&e in t?k=>t[e]=k:void 0)}var p,h=!1;a?[p,h]=Rd(()=>t[e]):p=t[e],p===void 0&&n!==void 0&&(p=c(),l&&(mu(),l(p)));var v;if(v=()=>{var k=t[e];return k===void 0?c():(s=!0,k)},(r&Qc)===0)return v;if(l){var m=t.$$legacy;return function(k,w){return arguments.length>0?((!w||m||h)&&l(w?v():k),k):v()}}var b=!1,A=((r&Wc)!==0?Vn:Fo)(()=>(b=!1,v()));a&&_(A);var y=j;return function(k,w){if(arguments.length>0){const T=w?_(A):a?St(k):k;return $(A,T),b=!0,o!==void 0&&(o=T),k}return Cr&&b||(y.f&wr)!==0?A.v:_(A)}}function Md(t){return new Pd(t)}class Pd{#e;#t;constructor(e){var r=new Map,n=(i,o)=>{var s=Ho(o,!1,!1);return r.set(i,s),s};const a=new Proxy({...e.props||{},$$events:{}},{get(i,o){return _(r.get(o)??n(o,Reflect.get(i,o)))},has(i,o){return o===Za?!0:(_(r.get(o)??n(o,Reflect.get(i,o))),Reflect.has(i,o))},set(i,o,s){return $(r.get(o)??n(o,s),s),Reflect.set(i,o,s)}});this.#t=(e.hydrate?cd:_s)(e.component,{target:e.target,anchor:e.anchor,props:a,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&re(),this.#e=a.$$events;for(const i of Object.keys(this.#t))i==="$set"||i==="$destroy"||i==="$on"||Fr(this,i,{get(){return this.#t[i]},set(o){this.#t[i]=o},enumerable:!0});this.#t.$set=i=>{Object.assign(a,i)},this.#t.$destroy=()=>{ud(this.#t)}}$set(e){this.#t.$set(e)}$on(e,r){this.#e[e]=this.#e[e]||[];const n=(...a)=>r.call(this,...a);return this.#e[e].push(n),()=>{this.#e[e]=this.#e[e].filter(a=>a!==n)}}$destroy(){this.#t.$destroy()}}let js;typeof HTMLElement=="function"&&(js=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(t,e,r){super(),this.$$ctor=t,this.$$s=e,r&&this.attachShadow({mode:"open"})}addEventListener(t,e,r){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,r)}removeEventListener(t,e,r){if(super.removeEventListener(t,e,r),this.$$c){const n=this.$$l_u.get(e);n&&(n(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(n){return a=>{const i=document.createElement("slot");n!=="default"&&(i.name=n),oe(a,i)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},r=Nd(this);for(const n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=t(n),e.default=!0):e[n]=t(n));for(const n of this.attributes){const a=this.$$g_p(n.name);a in this.$$d||(this.$$d[a]=ta(a,n.value,this.$$p_d,"toProp"))}for(const n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=Md({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=Uu(()=>{ei(()=>{this.$$r=!0;for(const n of Fn(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];const a=ta(n,this.$$d[n],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,a)}this.$$r=!1})});for(const n in this.$$l)for(const a of this.$$l[n]){const i=this.$$c.$on(n,a);this.$$l_u.set(a,i)}this.$$l={}}}attributeChangedCallback(t,e,r){this.$$r||(t=this.$$g_p(t),this.$$d[t]=ta(t,r,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return Fn(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function ta(t,e,r,n){const a=r[t]?.type;if(e=a==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="toAttribute")switch(a){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(a){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function Nd(t){const e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}function bn(t,e,r,n,a,i){let o=class extends js{constructor(){super(t,r,a),this.$$p_d=e}static get observedAttributes(){return Fn(e).map(s=>(e[s].attribute||s).toLowerCase())}};return Fn(e).forEach(s=>{Fr(o.prototype,s,{get(){return this.$$c&&s in this.$$c?this.$$c[s]:this.$$d[s]},set(c){c=ta(s,c,e),this.$$d[s]=c;var l=this.$$c;if(l){var d=$t(l,s)?.get;d?l[s]=c:l.$set({[s]:c})}}})}),n.forEach(s=>{Fr(o.prototype,s,{get(){return this.$$c?.[s]}})}),t.element=o,o}var Dd=(t,e)=>e()(),$d=Ct('<div class="chat-app__container"><div class="error-message svelte-4thrqu">Server is unreachable, please try later... <button class="error-message__retry-button svelte-4thrqu">Retry</button></div></div>'),zd=Ct(" <!>",1);const Fd={hash:"svelte-4thrqu",code:`
3
3
  /* These styles are inline, because at this point theme loading has failed. */.error-message.svelte-4thrqu {display:table;z-index:1000;width:auto;margin:2rem auto;padding:2rem;border-radius:2px;background:white;color:oklch(27.8% 0.033 256.848);font-family:-apple-system,
4
4
  BlinkMacSystemFont,
5
5
  avenir next,
@@ -12,35 +12,35 @@ var LiipGPTButton=function(rn){"use strict";const Mc="5";typeof window<"u"&&((wi
12
12
  roboto,
13
13
  noto,
14
14
  arial,
15
- sans-serif;}.error-message__retry-button.svelte-4thrqu {border:none;outline:none;background:none;font-size:1rem;text-decoration:underline;&:active {outline:none;}}`};function Is(t,e){Pr(e,!0),od(t,Ad);const r=(l,u=pr,p=pr)=>{ko();var h=Cd(),v=Le(h),m=nr(v);{var b=y=>{},C=y=>{var k=Ed(),w=Bt(k),T=nr(Bt(w));T.__click=[Td,p],$t(w),$t(k),ie(y,k)};ir(m,y=>{a()?y(b):y(C,!1)})}Zn(y=>cs(v,`${y??""} `),[()=>console.error(`Panic, uncaught error:
16
- `,u())??""]),ie(l,h)};let n=oe(e,"body",7),a=oe(e,"silent",7),i=J(void 0);const o=l=>{P(i,{error:l},!0)};var s=gt(),c=Le(s);return ku(c,{get failed(){return r}},l=>{var u=gt(),p=Le(u);{var h=m=>{r(m,()=>_(i).error,()=>()=>{P(i,void 0)})},v=m=>{var b=gt(),C=Le(b);hs(C,n,()=>o),ie(m,b)};ir(p,m=>{_(i)?m(h):m(v,!1)})}ie(l,u)}),ie(t,s),Nr({get body(){return n()},set body(l){n(l),ee()},get silent(){return a()},set silent(l){a(l),ee()}})}ss(["click"]),pn(Is,{body:{},silent:{}},[],[],!0);/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:Ls,setPrototypeOf:Os,isFrozen:Rd,getPrototypeOf:Id,getOwnPropertyDescriptor:Ld}=Object;let{freeze:Me,seal:ot,create:Ms}=Object,{apply:si,construct:li}=typeof Reflect<"u"&&Reflect;Me||(Me=function(e){return e}),ot||(ot=function(e){return e}),si||(si=function(e,r,n){return e.apply(r,n)}),li||(li=function(e,r){return new e(...r)});const Jn=Ne(Array.prototype.forEach),Od=Ne(Array.prototype.lastIndexOf),Ps=Ne(Array.prototype.pop),gn=Ne(Array.prototype.push),Md=Ne(Array.prototype.splice),ea=Ne(String.prototype.toLowerCase),ci=Ne(String.prototype.toString),Ns=Ne(String.prototype.match),mn=Ne(String.prototype.replace),Pd=Ne(String.prototype.indexOf),Nd=Ne(String.prototype.trim),mt=Ne(Object.prototype.hasOwnProperty),Pe=Ne(RegExp.prototype.test),vn=Dd(TypeError);function Ne(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return si(t,e,n)}}function Dd(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return li(t,r)}}function V(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ea;Os&&Os(t,null);let n=e.length;for(;n--;){let a=e[n];if(typeof a=="string"){const i=r(a);i!==a&&(Rd(e)||(e[n]=i),a=i)}t[a]=!0}return t}function $d(t){for(let e=0;e<t.length;e++)mt(t,e)||(t[e]=null);return t}function Vt(t){const e=Ms(null);for(const[r,n]of Ls(t))mt(t,r)&&(Array.isArray(n)?e[r]=$d(n):n&&typeof n=="object"&&n.constructor===Object?e[r]=Vt(n):e[r]=n);return e}function bn(t,e){for(;t!==null;){const n=Ld(t,e);if(n){if(n.get)return Ne(n.get);if(typeof n.value=="function")return Ne(n.value)}t=Id(t)}function r(){return null}return r}const Ds=Me(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ui=Me(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),di=Me(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),zd=Me(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),hi=Me(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Fd=Me(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),$s=Me(["#text"]),zs=Me(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),fi=Me(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Fs=Me(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ta=Me(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Bd=ot(/\{\{[\w\W]*|[\w\W]*\}\}/gm),jd=ot(/<%[\w\W]*|[\w\W]*%>/gm),Ud=ot(/\$\{[\w\W]*/gm),qd=ot(/^data-[\-\w.\u00B7-\uFFFF]+$/),Vd=ot(/^aria-[\-\w]+$/),Bs=ot(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Hd=ot(/^(?:\w+script|data):/i),Zd=ot(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),js=ot(/^html$/i),Gd=ot(/^[a-z][.\w]*(-[.\w]+)+$/i);var Us=Object.freeze({__proto__:null,ARIA_ATTR:Vd,ATTR_WHITESPACE:Zd,CUSTOM_ELEMENT:Gd,DATA_ATTR:qd,DOCTYPE_NAME:js,ERB_EXPR:jd,IS_ALLOWED_URI:Bs,IS_SCRIPT_OR_DATA:Hd,MUSTACHE_EXPR:Bd,TMPLIT_EXPR:Ud});const kn={element:1,text:3,progressingInstruction:7,comment:8,document:9},Wd=function(){return typeof window>"u"?null:window},Qd=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const a="data-tt-policy-suffix";r&&r.hasAttribute(a)&&(n=r.getAttribute(a));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},qs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Vs(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Wd();const e=O=>Vs(O);if(e.version="3.2.6",e.removed=[],!t||!t.document||t.document.nodeType!==kn.document||!t.Element)return e.isSupported=!1,e;let{document:r}=t;const n=r,a=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:v}=t,m=c.prototype,b=bn(m,"cloneNode"),C=bn(m,"remove"),y=bn(m,"nextSibling"),k=bn(m,"childNodes"),w=bn(m,"parentNode");if(typeof o=="function"){const O=r.createElement("template");O.content&&O.content.ownerDocument&&(r=O.content.ownerDocument)}let T,R="";const{implementation:U,createNodeIterator:Q,createDocumentFragment:Fe,getElementsByTagName:le}=r,{importNode:ur}=n;let ne=qs();e.isSupported=typeof Ls=="function"&&typeof w=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Qt,ERB_EXPR:dr,TMPLIT_EXPR:hr,DATA_ATTR:Xr,ARIA_ATTR:Ki,IS_SCRIPT_OR_DATA:Xi,ATTR_WHITESPACE:_a,CUSTOM_ELEMENT:Ji}=Us;let{IS_ALLOWED_URI:xa}=Us,ce=null;const In=V({},[...Ds,...ui,...di,...hi,...$s]);let fe=null;const F=V({},[...zs,...fi,...Fs,...ta]);let $=Object.seal(Ms(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}})),G=null,Be=null,be=!0,se=!0,je=!1,ke=!0,ye=!1,we=!0,ae=!1,Je=!1,Ue=!1,dt=!1,Yt=!1,It=!1,Ln=!0,Sa=!1;const eo="user-content-";let Jr=!0,Ir=!1,et={},Ve=null;const Lr=V({},["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 Ta=null;const Ea=V({},["audio","video","img","source","image","track"]);let On=null;const Lt=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",Ot="http://www.w3.org/2000/svg",yt="http://www.w3.org/1999/xhtml";let Mt=yt,to=!1,ro=null;const s0=V({},[tt,Ot,yt],ci);let Ca=V({},["mi","mo","mn","ms","mtext"]),Aa=V({},["annotation-xml"]);const l0=V({},["title","style","font","a","script"]);let Mn=null;const c0=["application/xhtml+xml","text/html"],u0="text/html";let _e=null,en=null;const d0=r.createElement("form"),wc=function(f){return f instanceof RegExp||f instanceof Function},no=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(en&&en===f)){if((!f||typeof f!="object")&&(f={}),f=Vt(f),Mn=c0.indexOf(f.PARSER_MEDIA_TYPE)===-1?u0:f.PARSER_MEDIA_TYPE,_e=Mn==="application/xhtml+xml"?ci:ea,ce=mt(f,"ALLOWED_TAGS")?V({},f.ALLOWED_TAGS,_e):In,fe=mt(f,"ALLOWED_ATTR")?V({},f.ALLOWED_ATTR,_e):F,ro=mt(f,"ALLOWED_NAMESPACES")?V({},f.ALLOWED_NAMESPACES,ci):s0,On=mt(f,"ADD_URI_SAFE_ATTR")?V(Vt(Lt),f.ADD_URI_SAFE_ATTR,_e):Lt,Ta=mt(f,"ADD_DATA_URI_TAGS")?V(Vt(Ea),f.ADD_DATA_URI_TAGS,_e):Ea,Ve=mt(f,"FORBID_CONTENTS")?V({},f.FORBID_CONTENTS,_e):Lr,G=mt(f,"FORBID_TAGS")?V({},f.FORBID_TAGS,_e):Vt({}),Be=mt(f,"FORBID_ATTR")?V({},f.FORBID_ATTR,_e):Vt({}),et=mt(f,"USE_PROFILES")?f.USE_PROFILES:!1,be=f.ALLOW_ARIA_ATTR!==!1,se=f.ALLOW_DATA_ATTR!==!1,je=f.ALLOW_UNKNOWN_PROTOCOLS||!1,ke=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ye=f.SAFE_FOR_TEMPLATES||!1,we=f.SAFE_FOR_XML!==!1,ae=f.WHOLE_DOCUMENT||!1,dt=f.RETURN_DOM||!1,Yt=f.RETURN_DOM_FRAGMENT||!1,It=f.RETURN_TRUSTED_TYPE||!1,Ue=f.FORCE_BODY||!1,Ln=f.SANITIZE_DOM!==!1,Sa=f.SANITIZE_NAMED_PROPS||!1,Jr=f.KEEP_CONTENT!==!1,Ir=f.IN_PLACE||!1,xa=f.ALLOWED_URI_REGEXP||Bs,Mt=f.NAMESPACE||yt,Ca=f.MATHML_TEXT_INTEGRATION_POINTS||Ca,Aa=f.HTML_INTEGRATION_POINTS||Aa,$=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&wc(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&($.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&wc(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&($.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&($.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ye&&(se=!1),Yt&&(dt=!0),et&&(ce=V({},$s),fe=[],et.html===!0&&(V(ce,Ds),V(fe,zs)),et.svg===!0&&(V(ce,ui),V(fe,fi),V(fe,ta)),et.svgFilters===!0&&(V(ce,di),V(fe,fi),V(fe,ta)),et.mathMl===!0&&(V(ce,hi),V(fe,Fs),V(fe,ta))),f.ADD_TAGS&&(ce===In&&(ce=Vt(ce)),V(ce,f.ADD_TAGS,_e)),f.ADD_ATTR&&(fe===F&&(fe=Vt(fe)),V(fe,f.ADD_ATTR,_e)),f.ADD_URI_SAFE_ATTR&&V(On,f.ADD_URI_SAFE_ATTR,_e),f.FORBID_CONTENTS&&(Ve===Lr&&(Ve=Vt(Ve)),V(Ve,f.FORBID_CONTENTS,_e)),Jr&&(ce["#text"]=!0),ae&&V(ce,["html","head","body"]),ce.table&&(V(ce,["tbody"]),delete G.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw vn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw vn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=f.TRUSTED_TYPES_POLICY,R=T.createHTML("")}else T===void 0&&(T=Qd(v,a)),T!==null&&typeof R=="string"&&(R=T.createHTML(""));Me&&Me(f),en=f}},_c=V({},[...ui,...di,...zd]),xc=V({},[...hi,...Fd]),h0=function(f){let S=w(f);(!S||!S.tagName)&&(S={namespaceURI:Mt,tagName:"template"});const L=ea(f.tagName),re=ea(S.tagName);return ro[f.namespaceURI]?f.namespaceURI===Ot?S.namespaceURI===yt?L==="svg":S.namespaceURI===tt?L==="svg"&&(re==="annotation-xml"||Ca[re]):!!_c[L]:f.namespaceURI===tt?S.namespaceURI===yt?L==="math":S.namespaceURI===Ot?L==="math"&&Aa[re]:!!xc[L]:f.namespaceURI===yt?S.namespaceURI===Ot&&!Aa[re]||S.namespaceURI===tt&&!Ca[re]?!1:!xc[L]&&(l0[L]||!_c[L]):!!(Mn==="application/xhtml+xml"&&ro[f.namespaceURI]):!1},Pt=function(f){gn(e.removed,{element:f});try{w(f).removeChild(f)}catch{C(f)}},tn=function(f,S){try{gn(e.removed,{attribute:S.getAttributeNode(f),from:S})}catch{gn(e.removed,{attribute:null,from:S})}if(S.removeAttribute(f),f==="is")if(dt||Yt)try{Pt(S)}catch{}else try{S.setAttribute(f,"")}catch{}},Sc=function(f){let S=null,L=null;if(Ue)f="<remove></remove>"+f;else{const pe=Ns(f,/^[\r\n\t ]+/);L=pe&&pe[0]}Mn==="application/xhtml+xml"&&Mt===yt&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const re=T?T.createHTML(f):f;if(Mt===yt)try{S=new h().parseFromString(re,Mn)}catch{}if(!S||!S.documentElement){S=U.createDocument(Mt,"template",null);try{S.documentElement.innerHTML=to?R:re}catch{}}const Ae=S.body||S.documentElement;return f&&L&&Ae.insertBefore(r.createTextNode(L),Ae.childNodes[0]||null),Mt===yt?le.call(S,ae?"html":"body")[0]:ae?S.documentElement:Ae},Tc=function(f){return Q.call(f.ownerDocument||f,f,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},ao=function(f){return f instanceof p&&(typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||!(f.attributes instanceof u)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function")},Ec=function(f){return typeof s=="function"&&f instanceof s};function Kt(O,f,S){Jn(O,L=>{L.call(e,f,S,en)})}const Cc=function(f){let S=null;if(Kt(ne.beforeSanitizeElements,f,null),ao(f))return Pt(f),!0;const L=_e(f.nodeName);if(Kt(ne.uponSanitizeElement,f,{tagName:L,allowedTags:ce}),we&&f.hasChildNodes()&&!Ec(f.firstElementChild)&&Pe(/<[/\w!]/g,f.innerHTML)&&Pe(/<[/\w!]/g,f.textContent)||f.nodeType===kn.progressingInstruction||we&&f.nodeType===kn.comment&&Pe(/<[/\w]/g,f.data))return Pt(f),!0;if(!ce[L]||G[L]){if(!G[L]&&Rc(L)&&($.tagNameCheck instanceof RegExp&&Pe($.tagNameCheck,L)||$.tagNameCheck instanceof Function&&$.tagNameCheck(L)))return!1;if(Jr&&!Ve[L]){const re=w(f)||f.parentNode,Ae=k(f)||f.childNodes;if(Ae&&re){const pe=Ae.length;for(let He=pe-1;He>=0;--He){const Xt=b(Ae[He],!0);Xt.__removalCount=(f.__removalCount||0)+1,re.insertBefore(Xt,y(f))}}}return Pt(f),!0}return f instanceof c&&!h0(f)||(L==="noscript"||L==="noembed"||L==="noframes")&&Pe(/<\/no(script|embed|frames)/i,f.innerHTML)?(Pt(f),!0):(ye&&f.nodeType===kn.text&&(S=f.textContent,Jn([Qt,dr,hr],re=>{S=mn(S,re," ")}),f.textContent!==S&&(gn(e.removed,{element:f.cloneNode()}),f.textContent=S)),Kt(ne.afterSanitizeElements,f,null),!1)},Ac=function(f,S,L){if(Ln&&(S==="id"||S==="name")&&(L in r||L in d0))return!1;if(!(se&&!Be[S]&&Pe(Xr,S))){if(!(be&&Pe(Ki,S))){if(!fe[S]||Be[S]){if(!(Rc(f)&&($.tagNameCheck instanceof RegExp&&Pe($.tagNameCheck,f)||$.tagNameCheck instanceof Function&&$.tagNameCheck(f))&&($.attributeNameCheck instanceof RegExp&&Pe($.attributeNameCheck,S)||$.attributeNameCheck instanceof Function&&$.attributeNameCheck(S))||S==="is"&&$.allowCustomizedBuiltInElements&&($.tagNameCheck instanceof RegExp&&Pe($.tagNameCheck,L)||$.tagNameCheck instanceof Function&&$.tagNameCheck(L))))return!1}else if(!On[S]){if(!Pe(xa,mn(L,_a,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&f!=="script"&&Pd(L,"data:")===0&&Ta[f])){if(!(je&&!Pe(Xi,mn(L,_a,"")))){if(L)return!1}}}}}}return!0},Rc=function(f){return f!=="annotation-xml"&&Ns(f,Ji)},Ic=function(f){Kt(ne.beforeSanitizeAttributes,f,null);const{attributes:S}=f;if(!S||ao(f))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:fe,forceKeepAttr:void 0};let re=S.length;for(;re--;){const Ae=S[re],{name:pe,namespaceURI:He,value:Xt}=Ae,Pn=_e(pe),io=Xt;let Re=pe==="value"?io:Nd(io);if(L.attrName=Pn,L.attrValue=Re,L.keepAttr=!0,L.forceKeepAttr=void 0,Kt(ne.uponSanitizeAttribute,f,L),Re=L.attrValue,Sa&&(Pn==="id"||Pn==="name")&&(tn(pe,f),Re=eo+Re),we&&Pe(/((--!?|])>)|<\/(style|title)/i,Re)){tn(pe,f);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){tn(pe,f);continue}if(!ke&&Pe(/\/>/i,Re)){tn(pe,f);continue}ye&&Jn([Qt,dr,hr],Oc=>{Re=mn(Re,Oc," ")});const Lc=_e(f.nodeName);if(!Ac(Lc,Pn,Re)){tn(pe,f);continue}if(T&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!He)switch(v.getAttributeType(Lc,Pn)){case"TrustedHTML":{Re=T.createHTML(Re);break}case"TrustedScriptURL":{Re=T.createScriptURL(Re);break}}if(Re!==io)try{He?f.setAttributeNS(He,pe,Re):f.setAttribute(pe,Re),ao(f)?Pt(f):Ps(e.removed)}catch{tn(pe,f)}}Kt(ne.afterSanitizeAttributes,f,null)},f0=function O(f){let S=null;const L=Tc(f);for(Kt(ne.beforeSanitizeShadowDOM,f,null);S=L.nextNode();)Kt(ne.uponSanitizeShadowNode,S,null),Cc(S),Ic(S),S.content instanceof i&&O(S.content);Kt(ne.afterSanitizeShadowDOM,f,null)};return e.sanitize=function(O){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,L=null,re=null,Ae=null;if(to=!O,to&&(O="<!-->"),typeof O!="string"&&!Ec(O))if(typeof O.toString=="function"){if(O=O.toString(),typeof O!="string")throw vn("dirty is not a string, aborting")}else throw vn("toString is not a function");if(!e.isSupported)return O;if(Je||no(f),e.removed=[],typeof O=="string"&&(Ir=!1),Ir){if(O.nodeName){const Xt=_e(O.nodeName);if(!ce[Xt]||G[Xt])throw vn("root node is forbidden and cannot be sanitized in-place")}}else if(O instanceof s)S=Sc("<!---->"),L=S.ownerDocument.importNode(O,!0),L.nodeType===kn.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?S=L:S.appendChild(L);else{if(!dt&&!ye&&!ae&&O.indexOf("<")===-1)return T&&It?T.createHTML(O):O;if(S=Sc(O),!S)return dt?null:It?R:""}S&&Ue&&Pt(S.firstChild);const pe=Tc(Ir?O:S);for(;re=pe.nextNode();)Cc(re),Ic(re),re.content instanceof i&&f0(re.content);if(Ir)return O;if(dt){if(Yt)for(Ae=Fe.call(S.ownerDocument);S.firstChild;)Ae.appendChild(S.firstChild);else Ae=S;return(fe.shadowroot||fe.shadowrootmode)&&(Ae=ur.call(n,Ae,!0)),Ae}let He=ae?S.outerHTML:S.innerHTML;return ae&&ce["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&Pe(js,S.ownerDocument.doctype.name)&&(He="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
17
- `+He),ye&&Jn([Qt,dr,hr],Xt=>{He=mn(He,Xt," ")}),T&&It?T.createHTML(He):He},e.setConfig=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};no(O),Je=!0},e.clearConfig=function(){en=null,Je=!1},e.isValidAttribute=function(O,f,S){en||no({});const L=_e(O),re=_e(f);return Ac(L,re,S)},e.addHook=function(O,f){typeof f=="function"&&gn(ne[O],f)},e.removeHook=function(O,f){if(f!==void 0){const S=Od(ne[O],f);return S===-1?void 0:Md(ne[O],S,1)[0]}return Ps(ne[O])},e.removeHooks=function(O){ne[O]=[]},e.removeAllHooks=function(){ne=qs()},e}var Yd=Vs();function pi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Tr=pi();function Hs(t){Tr=t}var yn={exec:()=>null};function Y(t,e=""){let r=typeof t=="string"?t:t.source;const n={replace:(a,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(De.caret,"$1"),r=r.replace(a,o),n},getRegex:()=>new RegExp(r,e)};return n}var De={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Kd=/^(?:[ \t]*(?:\n|$))+/,Xd=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Jd=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,eh=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,gi=/(?:[*+-]|\d{1,9}[.)])/,Zs=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Gs=Y(Zs).replace(/bull/g,gi).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(),th=Y(Zs).replace(/bull/g,gi).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(),mi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rh=/^[^\n]+/,vi=/(?!\s*\])(?:\\.|[^\[\]\\])+/,nh=Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",vi).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ah=Y(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,gi).getRegex(),ra="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",bi=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ih=Y("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\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",bi).replace("tag",ra).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ws=Y(mi).replace("hr",wn).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ra).getRegex(),oh=Y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ws).getRegex(),ki={blockquote:oh,code:Xd,def:nh,fences:Jd,heading:eh,hr:wn,html:ih,lheading:Gs,list:ah,newline:Kd,paragraph:Ws,table:yn,text:rh},Qs=Y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",wn).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ra).getRegex(),sh={...ki,lheading:th,table:Qs,paragraph:Y(mi).replace("hr",wn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qs).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ra).getRegex()},lh={...ki,html:Y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",bi).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:yn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(mi).replace("hr",wn).replace("heading",` *#{1,6} *[^
18
- ]`).replace("lheading",Gs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ch=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,uh=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ys=/^( {2,}|\\)\n(?!\s*$)/,dh=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,na=/[\p{P}\p{S}]/u,yi=/[\s\p{P}\p{S}]/u,Ks=/[^\s\p{P}\p{S}]/u,hh=Y(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,yi).getRegex(),Xs=/(?!~)[\p{P}\p{S}]/u,fh=/(?!~)[\s\p{P}\p{S}]/u,ph=/(?:[^\s\p{P}\p{S}]|~)/u,gh=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Js=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,mh=Y(Js,"u").replace(/punct/g,na).getRegex(),vh=Y(Js,"u").replace(/punct/g,Xs).getRegex(),el="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",bh=Y(el,"gu").replace(/notPunctSpace/g,Ks).replace(/punctSpace/g,yi).replace(/punct/g,na).getRegex(),kh=Y(el,"gu").replace(/notPunctSpace/g,ph).replace(/punctSpace/g,fh).replace(/punct/g,Xs).getRegex(),yh=Y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ks).replace(/punctSpace/g,yi).replace(/punct/g,na).getRegex(),wh=Y(/\\(punct)/,"gu").replace(/punct/g,na).getRegex(),_h=Y(/^<(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(),xh=Y(bi).replace("(?:-->|$)","-->").getRegex(),Sh=Y("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",xh).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),aa=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Th=Y(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",aa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),tl=Y(/^!?\[(label)\]\[(ref)\]/).replace("label",aa).replace("ref",vi).getRegex(),rl=Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",vi).getRegex(),Eh=Y("reflink|nolink(?!\\()","g").replace("reflink",tl).replace("nolink",rl).getRegex(),wi={_backpedal:yn,anyPunctuation:wh,autolink:_h,blockSkip:gh,br:Ys,code:uh,del:yn,emStrongLDelim:mh,emStrongRDelimAst:bh,emStrongRDelimUnd:yh,escape:ch,link:Th,nolink:rl,punctuation:hh,reflink:tl,reflinkSearch:Eh,tag:Sh,text:dh,url:yn},Ch={...wi,link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",aa).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",aa).getRegex()},_i={...wi,emStrongRDelimAst:kh,emStrongLDelim:vh,url:Y(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ah={..._i,br:Y(Ys).replace("{2,}","*").getRegex(),text:Y(_i.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ia={normal:ki,gfm:sh,pedantic:lh},_n={normal:wi,gfm:_i,breaks:Ah,pedantic:Ch},Rh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},nl=t=>Rh[t];function Ct(t,e){if(e){if(De.escapeTest.test(t))return t.replace(De.escapeReplace,nl)}else if(De.escapeTestNoEncode.test(t))return t.replace(De.escapeReplaceNoEncode,nl);return t}function al(t){try{t=encodeURI(t).replace(De.percentDecode,"%")}catch{return null}return t}function il(t,e){const r=t.replace(De.findPipe,(i,o,s)=>{let c=!1,l=o;for(;--l>=0&&s[l]==="\\";)c=!c;return c?"|":" |"}),n=r.split(De.splitPipe);let a=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;a<n.length;a++)n[a]=n[a].trim().replace(De.slashPipe,"|");return n}function xn(t,e,r){const n=t.length;if(n===0)return"";let a=0;for(;a<n&&t.charAt(n-a-1)===e;)a++;return t.slice(0,n-a)}function Ih(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function ol(t,e,r,n,a){const i=e.href,o=e.title||null,s=t[1].replace(a.other.outputLinkReplace,"$1");n.state.inLink=!0;const c={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:o,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,c}function Lh(t,e,r){const n=t.match(r.other.indentCodeCompensation);if(n===null)return e;const a=n[1];return e.split(`
15
+ sans-serif;}.error-message__retry-button.svelte-4thrqu {border:none;outline:none;background:none;font-size:1rem;text-decoration:underline;&:active {outline:none;}}`};function Us(t,e){jr(e,!0),vd(t,Fd);const r=(l,d=br,p=br)=>{Lo();var h=zd(),v=Oe(h),m=lr(v);{var b=y=>{},A=y=>{var k=$d(),w=Ut(k),T=lr(Ut(w));T.__click=[Dd,p],Ft(w),Ft(k),oe(y,k)};ur(m,y=>{a()?y(b):y(A,!1)})}Qn(y=>ws(v,`${y??""} `),[()=>console.error(`Panic, uncaught error:
16
+ `,d())??""]),oe(l,h)};let n=se(e,"body",7),a=se(e,"silent",7),i=te(void 0);const o=l=>{$(i,{error:l},!0)};var s=vt(),c=Oe(s);return Iu(c,{get failed(){return r}},l=>{var d=vt(),p=Oe(d);{var h=m=>{r(m,()=>_(i).error,()=>()=>{$(i,void 0)})},v=m=>{var b=vt(),A=Oe(b);Ss(A,n,()=>o),oe(m,b)};ur(p,m=>{_(i)?m(h):m(v,!1)})}oe(l,d)}),oe(t,s),Ur({get body(){return n()},set body(l){n(l),re()},get silent(){return a()},set silent(l){a(l),re()}})}ks(["click"]),bn(Us,{body:{},silent:{}},[],[],!0);/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:qs,setPrototypeOf:Vs,isFrozen:Bd,getPrototypeOf:jd,getOwnPropertyDescriptor:Ud}=Object;let{freeze:Pe,seal:lt,create:Hs}=Object,{apply:pi,construct:gi}=typeof Reflect<"u"&&Reflect;Pe||(Pe=function(e){return e}),lt||(lt=function(e){return e}),pi||(pi=function(e,r,n){return e.apply(r,n)}),gi||(gi=function(e,r){return new e(...r)});const ra=De(Array.prototype.forEach),qd=De(Array.prototype.lastIndexOf),Zs=De(Array.prototype.pop),kn=De(Array.prototype.push),Vd=De(Array.prototype.splice),na=De(String.prototype.toLowerCase),mi=De(String.prototype.toString),Gs=De(String.prototype.match),yn=De(String.prototype.replace),Hd=De(String.prototype.indexOf),Zd=De(String.prototype.trim),bt=De(Object.prototype.hasOwnProperty),Ne=De(RegExp.prototype.test),wn=Gd(TypeError);function De(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return pi(t,e,n)}}function Gd(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return gi(t,r)}}function V(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:na;Vs&&Vs(t,null);let n=e.length;for(;n--;){let a=e[n];if(typeof a=="string"){const i=r(a);i!==a&&(Bd(e)||(e[n]=i),a=i)}t[a]=!0}return t}function Wd(t){for(let e=0;e<t.length;e++)bt(t,e)||(t[e]=null);return t}function Zt(t){const e=Hs(null);for(const[r,n]of qs(t))bt(t,r)&&(Array.isArray(n)?e[r]=Wd(n):n&&typeof n=="object"&&n.constructor===Object?e[r]=Zt(n):e[r]=n);return e}function _n(t,e){for(;t!==null;){const n=Ud(t,e);if(n){if(n.get)return De(n.get);if(typeof n.value=="function")return De(n.value)}t=jd(t)}function r(){return null}return r}const Ws=Pe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),vi=Pe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bi=Pe(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Qd=Pe(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ki=Pe(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Yd=Pe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Qs=Pe(["#text"]),Ys=Pe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),yi=Pe(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ks=Pe(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),aa=Pe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Kd=lt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Xd=lt(/<%[\w\W]*|[\w\W]*%>/gm),Jd=lt(/\$\{[\w\W]*/gm),eh=lt(/^data-[\-\w.\u00B7-\uFFFF]+$/),th=lt(/^aria-[\-\w]+$/),Xs=lt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rh=lt(/^(?:\w+script|data):/i),nh=lt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Js=lt(/^html$/i),ah=lt(/^[a-z][.\w]*(-[.\w]+)+$/i);var el=Object.freeze({__proto__:null,ARIA_ATTR:th,ATTR_WHITESPACE:nh,CUSTOM_ELEMENT:ah,DATA_ATTR:eh,DOCTYPE_NAME:Js,ERB_EXPR:Xd,IS_ALLOWED_URI:Xs,IS_SCRIPT_OR_DATA:rh,MUSTACHE_EXPR:Kd,TMPLIT_EXPR:Jd});const xn={element:1,text:3,progressingInstruction:7,comment:8,document:9},ih=function(){return typeof window>"u"?null:window},oh=function(e,r){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const a="data-tt-policy-suffix";r&&r.hasAttribute(a)&&(n=r.getAttribute(a));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},tl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function rl(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ih();const e=M=>rl(M);if(e.version="3.2.6",e.removed=[],!t||!t.document||t.document.nodeType!==xn.document||!t.Element)return e.isSupported=!1,e;let{document:r}=t;const n=r,a=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:v}=t,m=c.prototype,b=_n(m,"cloneNode"),A=_n(m,"remove"),y=_n(m,"nextSibling"),k=_n(m,"childNodes"),w=_n(m,"parentNode");if(typeof o=="function"){const M=r.createElement("template");M.content&&M.content.ownerDocument&&(r=M.content.ownerDocument)}let T,I="";const{implementation:U,createNodeIterator:Q,createDocumentFragment:je,getElementsByTagName:ce}=r,{importNode:pr}=n;let ae=tl();e.isSupported=typeof qs=="function"&&typeof w=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:er,ERB_EXPR:gr,TMPLIT_EXPR:mr,DATA_ATTR:rn,ARIA_ATTR:co,IS_SCRIPT_OR_DATA:uo,ATTR_WHITESPACE:Ra,CUSTOM_ELEMENT:ho}=el;let{IS_ALLOWED_URI:Ia}=el,ue=null;const Mn=V({},[...Ws,...vi,...bi,...ki,...Qs]);let ge=null;const B=V({},[...Ys,...yi,...Ks,...aa]);let z=Object.seal(Hs(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}})),G=null,Ue=null,ye=!0,le=!0,qe=!1,we=!0,_e=!1,xe=!0,ie=!1,tt=!1,Ve=!1,ft=!1,tr=!1,Ot=!1,Pn=!0,La=!1;const fo="user-content-";let nn=!0,$r=!1,rt={},Ze=null;const zr=V({},["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 Oa=null;const Ma=V({},["audio","video","img","source","image","track"]);let Nn=null;const Mt=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),nt="http://www.w3.org/1998/Math/MathML",Pt="http://www.w3.org/2000/svg",_t="http://www.w3.org/1999/xhtml";let Nt=_t,po=!1,go=null;const Mg=V({},[nt,Pt,_t],mi);let Pa=V({},["mi","mo","mn","ms","mtext"]),Na=V({},["annotation-xml"]);const Pg=V({},["title","style","font","a","script"]);let Dn=null;const Ng=["application/xhtml+xml","text/html"],Dg="text/html";let Se=null,an=null;const $g=r.createElement("form"),Oc=function(f){return f instanceof RegExp||f instanceof Function},mo=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(an&&an===f)){if((!f||typeof f!="object")&&(f={}),f=Zt(f),Dn=Ng.indexOf(f.PARSER_MEDIA_TYPE)===-1?Dg:f.PARSER_MEDIA_TYPE,Se=Dn==="application/xhtml+xml"?mi:na,ue=bt(f,"ALLOWED_TAGS")?V({},f.ALLOWED_TAGS,Se):Mn,ge=bt(f,"ALLOWED_ATTR")?V({},f.ALLOWED_ATTR,Se):B,go=bt(f,"ALLOWED_NAMESPACES")?V({},f.ALLOWED_NAMESPACES,mi):Mg,Nn=bt(f,"ADD_URI_SAFE_ATTR")?V(Zt(Mt),f.ADD_URI_SAFE_ATTR,Se):Mt,Oa=bt(f,"ADD_DATA_URI_TAGS")?V(Zt(Ma),f.ADD_DATA_URI_TAGS,Se):Ma,Ze=bt(f,"FORBID_CONTENTS")?V({},f.FORBID_CONTENTS,Se):zr,G=bt(f,"FORBID_TAGS")?V({},f.FORBID_TAGS,Se):Zt({}),Ue=bt(f,"FORBID_ATTR")?V({},f.FORBID_ATTR,Se):Zt({}),rt=bt(f,"USE_PROFILES")?f.USE_PROFILES:!1,ye=f.ALLOW_ARIA_ATTR!==!1,le=f.ALLOW_DATA_ATTR!==!1,qe=f.ALLOW_UNKNOWN_PROTOCOLS||!1,we=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,_e=f.SAFE_FOR_TEMPLATES||!1,xe=f.SAFE_FOR_XML!==!1,ie=f.WHOLE_DOCUMENT||!1,ft=f.RETURN_DOM||!1,tr=f.RETURN_DOM_FRAGMENT||!1,Ot=f.RETURN_TRUSTED_TYPE||!1,Ve=f.FORCE_BODY||!1,Pn=f.SANITIZE_DOM!==!1,La=f.SANITIZE_NAMED_PROPS||!1,nn=f.KEEP_CONTENT!==!1,$r=f.IN_PLACE||!1,Ia=f.ALLOWED_URI_REGEXP||Xs,Nt=f.NAMESPACE||_t,Pa=f.MATHML_TEXT_INTEGRATION_POINTS||Pa,Na=f.HTML_INTEGRATION_POINTS||Na,z=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&Oc(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&Oc(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(z.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),_e&&(le=!1),tr&&(ft=!0),rt&&(ue=V({},Qs),ge=[],rt.html===!0&&(V(ue,Ws),V(ge,Ys)),rt.svg===!0&&(V(ue,vi),V(ge,yi),V(ge,aa)),rt.svgFilters===!0&&(V(ue,bi),V(ge,yi),V(ge,aa)),rt.mathMl===!0&&(V(ue,ki),V(ge,Ks),V(ge,aa))),f.ADD_TAGS&&(ue===Mn&&(ue=Zt(ue)),V(ue,f.ADD_TAGS,Se)),f.ADD_ATTR&&(ge===B&&(ge=Zt(ge)),V(ge,f.ADD_ATTR,Se)),f.ADD_URI_SAFE_ATTR&&V(Nn,f.ADD_URI_SAFE_ATTR,Se),f.FORBID_CONTENTS&&(Ze===zr&&(Ze=Zt(Ze)),V(Ze,f.FORBID_CONTENTS,Se)),nn&&(ue["#text"]=!0),ie&&V(ue,["html","head","body"]),ue.table&&(V(ue,["tbody"]),delete G.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw wn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw wn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=f.TRUSTED_TYPES_POLICY,I=T.createHTML("")}else T===void 0&&(T=oh(v,a)),T!==null&&typeof I=="string"&&(I=T.createHTML(""));Pe&&Pe(f),an=f}},Mc=V({},[...vi,...bi,...Qd]),Pc=V({},[...ki,...Yd]),zg=function(f){let S=w(f);(!S||!S.tagName)&&(S={namespaceURI:Nt,tagName:"template"});const O=na(f.tagName),ne=na(S.tagName);return go[f.namespaceURI]?f.namespaceURI===Pt?S.namespaceURI===_t?O==="svg":S.namespaceURI===nt?O==="svg"&&(ne==="annotation-xml"||Pa[ne]):!!Mc[O]:f.namespaceURI===nt?S.namespaceURI===_t?O==="math":S.namespaceURI===Pt?O==="math"&&Na[ne]:!!Pc[O]:f.namespaceURI===_t?S.namespaceURI===Pt&&!Na[ne]||S.namespaceURI===nt&&!Pa[ne]?!1:!Pc[O]&&(Pg[O]||!Mc[O]):!!(Dn==="application/xhtml+xml"&&go[f.namespaceURI]):!1},Dt=function(f){kn(e.removed,{element:f});try{w(f).removeChild(f)}catch{A(f)}},on=function(f,S){try{kn(e.removed,{attribute:S.getAttributeNode(f),from:S})}catch{kn(e.removed,{attribute:null,from:S})}if(S.removeAttribute(f),f==="is")if(ft||tr)try{Dt(S)}catch{}else try{S.setAttribute(f,"")}catch{}},Nc=function(f){let S=null,O=null;if(Ve)f="<remove></remove>"+f;else{const me=Gs(f,/^[\r\n\t ]+/);O=me&&me[0]}Dn==="application/xhtml+xml"&&Nt===_t&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const ne=T?T.createHTML(f):f;if(Nt===_t)try{S=new h().parseFromString(ne,Dn)}catch{}if(!S||!S.documentElement){S=U.createDocument(Nt,"template",null);try{S.documentElement.innerHTML=po?I:ne}catch{}}const Re=S.body||S.documentElement;return f&&O&&Re.insertBefore(r.createTextNode(O),Re.childNodes[0]||null),Nt===_t?ce.call(S,ie?"html":"body")[0]:ie?S.documentElement:Re},Dc=function(f){return Q.call(f.ownerDocument||f,f,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},vo=function(f){return f instanceof p&&(typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||!(f.attributes instanceof d)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function")},$c=function(f){return typeof s=="function"&&f instanceof s};function rr(M,f,S){ra(M,O=>{O.call(e,f,S,an)})}const zc=function(f){let S=null;if(rr(ae.beforeSanitizeElements,f,null),vo(f))return Dt(f),!0;const O=Se(f.nodeName);if(rr(ae.uponSanitizeElement,f,{tagName:O,allowedTags:ue}),xe&&f.hasChildNodes()&&!$c(f.firstElementChild)&&Ne(/<[/\w!]/g,f.innerHTML)&&Ne(/<[/\w!]/g,f.textContent)||f.nodeType===xn.progressingInstruction||xe&&f.nodeType===xn.comment&&Ne(/<[/\w]/g,f.data))return Dt(f),!0;if(!ue[O]||G[O]){if(!G[O]&&Bc(O)&&(z.tagNameCheck instanceof RegExp&&Ne(z.tagNameCheck,O)||z.tagNameCheck instanceof Function&&z.tagNameCheck(O)))return!1;if(nn&&!Ze[O]){const ne=w(f)||f.parentNode,Re=k(f)||f.childNodes;if(Re&&ne){const me=Re.length;for(let Ge=me-1;Ge>=0;--Ge){const nr=b(Re[Ge],!0);nr.__removalCount=(f.__removalCount||0)+1,ne.insertBefore(nr,y(f))}}}return Dt(f),!0}return f instanceof c&&!zg(f)||(O==="noscript"||O==="noembed"||O==="noframes")&&Ne(/<\/no(script|embed|frames)/i,f.innerHTML)?(Dt(f),!0):(_e&&f.nodeType===xn.text&&(S=f.textContent,ra([er,gr,mr],ne=>{S=yn(S,ne," ")}),f.textContent!==S&&(kn(e.removed,{element:f.cloneNode()}),f.textContent=S)),rr(ae.afterSanitizeElements,f,null),!1)},Fc=function(f,S,O){if(Pn&&(S==="id"||S==="name")&&(O in r||O in $g))return!1;if(!(le&&!Ue[S]&&Ne(rn,S))){if(!(ye&&Ne(co,S))){if(!ge[S]||Ue[S]){if(!(Bc(f)&&(z.tagNameCheck instanceof RegExp&&Ne(z.tagNameCheck,f)||z.tagNameCheck instanceof Function&&z.tagNameCheck(f))&&(z.attributeNameCheck instanceof RegExp&&Ne(z.attributeNameCheck,S)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(S))||S==="is"&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&Ne(z.tagNameCheck,O)||z.tagNameCheck instanceof Function&&z.tagNameCheck(O))))return!1}else if(!Nn[S]){if(!Ne(Ia,yn(O,Ra,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&f!=="script"&&Hd(O,"data:")===0&&Oa[f])){if(!(qe&&!Ne(uo,yn(O,Ra,"")))){if(O)return!1}}}}}}return!0},Bc=function(f){return f!=="annotation-xml"&&Gs(f,ho)},jc=function(f){rr(ae.beforeSanitizeAttributes,f,null);const{attributes:S}=f;if(!S||vo(f))return;const O={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ge,forceKeepAttr:void 0};let ne=S.length;for(;ne--;){const Re=S[ne],{name:me,namespaceURI:Ge,value:nr}=Re,$n=Se(me),bo=nr;let Ie=me==="value"?bo:Zd(bo);if(O.attrName=$n,O.attrValue=Ie,O.keepAttr=!0,O.forceKeepAttr=void 0,rr(ae.uponSanitizeAttribute,f,O),Ie=O.attrValue,La&&($n==="id"||$n==="name")&&(on(me,f),Ie=fo+Ie),xe&&Ne(/((--!?|])>)|<\/(style|title)/i,Ie)){on(me,f);continue}if(O.forceKeepAttr)continue;if(!O.keepAttr){on(me,f);continue}if(!we&&Ne(/\/>/i,Ie)){on(me,f);continue}_e&&ra([er,gr,mr],qc=>{Ie=yn(Ie,qc," ")});const Uc=Se(f.nodeName);if(!Fc(Uc,$n,Ie)){on(me,f);continue}if(T&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!Ge)switch(v.getAttributeType(Uc,$n)){case"TrustedHTML":{Ie=T.createHTML(Ie);break}case"TrustedScriptURL":{Ie=T.createScriptURL(Ie);break}}if(Ie!==bo)try{Ge?f.setAttributeNS(Ge,me,Ie):f.setAttribute(me,Ie),vo(f)?Dt(f):Zs(e.removed)}catch{on(me,f)}}rr(ae.afterSanitizeAttributes,f,null)},Fg=function M(f){let S=null;const O=Dc(f);for(rr(ae.beforeSanitizeShadowDOM,f,null);S=O.nextNode();)rr(ae.uponSanitizeShadowNode,S,null),zc(S),jc(S),S.content instanceof i&&M(S.content);rr(ae.afterSanitizeShadowDOM,f,null)};return e.sanitize=function(M){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,O=null,ne=null,Re=null;if(po=!M,po&&(M="<!-->"),typeof M!="string"&&!$c(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw wn("dirty is not a string, aborting")}else throw wn("toString is not a function");if(!e.isSupported)return M;if(tt||mo(f),e.removed=[],typeof M=="string"&&($r=!1),$r){if(M.nodeName){const nr=Se(M.nodeName);if(!ue[nr]||G[nr])throw wn("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof s)S=Nc("<!---->"),O=S.ownerDocument.importNode(M,!0),O.nodeType===xn.element&&O.nodeName==="BODY"||O.nodeName==="HTML"?S=O:S.appendChild(O);else{if(!ft&&!_e&&!ie&&M.indexOf("<")===-1)return T&&Ot?T.createHTML(M):M;if(S=Nc(M),!S)return ft?null:Ot?I:""}S&&Ve&&Dt(S.firstChild);const me=Dc($r?M:S);for(;ne=me.nextNode();)zc(ne),jc(ne),ne.content instanceof i&&Fg(ne.content);if($r)return M;if(ft){if(tr)for(Re=je.call(S.ownerDocument);S.firstChild;)Re.appendChild(S.firstChild);else Re=S;return(ge.shadowroot||ge.shadowrootmode)&&(Re=pr.call(n,Re,!0)),Re}let Ge=ie?S.outerHTML:S.innerHTML;return ie&&ue["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&Ne(Js,S.ownerDocument.doctype.name)&&(Ge="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
17
+ `+Ge),_e&&ra([er,gr,mr],nr=>{Ge=yn(Ge,nr," ")}),T&&Ot?T.createHTML(Ge):Ge},e.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};mo(M),tt=!0},e.clearConfig=function(){an=null,tt=!1},e.isValidAttribute=function(M,f,S){an||mo({});const O=Se(M),ne=Se(f);return Fc(O,ne,S)},e.addHook=function(M,f){typeof f=="function"&&kn(ae[M],f)},e.removeHook=function(M,f){if(f!==void 0){const S=qd(ae[M],f);return S===-1?void 0:Vd(ae[M],S,1)[0]}return Zs(ae[M])},e.removeHooks=function(M){ae[M]=[]},e.removeAllHooks=function(){ae=tl()},e}var sh=rl();function wi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Rr=wi();function nl(t){Rr=t}var Sn={exec:()=>null};function Y(t,e=""){let r=typeof t=="string"?t:t.source;const n={replace:(a,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace($e.caret,"$1"),r=r.replace(a,o),n},getRegex:()=>new RegExp(r,e)};return n}var $e={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},lh=/^(?:[ \t]*(?:\n|$))+/,ch=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,uh=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Tn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,dh=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_i=/(?:[*+-]|\d{1,9}[.)])/,al=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,il=Y(al).replace(/bull/g,_i).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(),hh=Y(al).replace(/bull/g,_i).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(),xi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,fh=/^[^\n]+/,Si=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ph=Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Si).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),gh=Y(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,_i).getRegex(),ia="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",Ti=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,mh=Y("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\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",Ti).replace("tag",ia).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ol=Y(xi).replace("hr",Tn).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ia).getRegex(),vh=Y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ol).getRegex(),Ei={blockquote:vh,code:ch,def:ph,fences:uh,heading:dh,hr:Tn,html:mh,lheading:il,list:gh,newline:lh,paragraph:ol,table:Sn,text:fh},sl=Y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Tn).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ia).getRegex(),bh={...Ei,lheading:hh,table:sl,paragraph:Y(xi).replace("hr",Tn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",sl).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ia).getRegex()},kh={...Ei,html:Y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ti).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:Sn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(xi).replace("hr",Tn).replace("heading",` *#{1,6} *[^
18
+ ]`).replace("lheading",il).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},yh=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wh=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ll=/^( {2,}|\\)\n(?!\s*$)/,_h=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,oa=/[\p{P}\p{S}]/u,Ci=/[\s\p{P}\p{S}]/u,cl=/[^\s\p{P}\p{S}]/u,xh=Y(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ci).getRegex(),ul=/(?!~)[\p{P}\p{S}]/u,Sh=/(?!~)[\s\p{P}\p{S}]/u,Th=/(?:[^\s\p{P}\p{S}]|~)/u,Eh=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,dl=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ch=Y(dl,"u").replace(/punct/g,oa).getRegex(),Ah=Y(dl,"u").replace(/punct/g,ul).getRegex(),hl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Rh=Y(hl,"gu").replace(/notPunctSpace/g,cl).replace(/punctSpace/g,Ci).replace(/punct/g,oa).getRegex(),Ih=Y(hl,"gu").replace(/notPunctSpace/g,Th).replace(/punctSpace/g,Sh).replace(/punct/g,ul).getRegex(),Lh=Y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,cl).replace(/punctSpace/g,Ci).replace(/punct/g,oa).getRegex(),Oh=Y(/\\(punct)/,"gu").replace(/punct/g,oa).getRegex(),Mh=Y(/^<(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(),Ph=Y(Ti).replace("(?:-->|$)","-->").getRegex(),Nh=Y("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ph).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),sa=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Dh=Y(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",sa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fl=Y(/^!?\[(label)\]\[(ref)\]/).replace("label",sa).replace("ref",Si).getRegex(),pl=Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",Si).getRegex(),$h=Y("reflink|nolink(?!\\()","g").replace("reflink",fl).replace("nolink",pl).getRegex(),Ai={_backpedal:Sn,anyPunctuation:Oh,autolink:Mh,blockSkip:Eh,br:ll,code:wh,del:Sn,emStrongLDelim:Ch,emStrongRDelimAst:Rh,emStrongRDelimUnd:Lh,escape:yh,link:Dh,nolink:pl,punctuation:xh,reflink:fl,reflinkSearch:$h,tag:Nh,text:_h,url:Sn},zh={...Ai,link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",sa).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",sa).getRegex()},Ri={...Ai,emStrongRDelimAst:Ih,emStrongLDelim:Ah,url:Y(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Fh={...Ri,br:Y(ll).replace("{2,}","*").getRegex(),text:Y(Ri.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},la={normal:Ei,gfm:bh,pedantic:kh},En={normal:Ai,gfm:Ri,breaks:Fh,pedantic:zh},Bh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},gl=t=>Bh[t];function Rt(t,e){if(e){if($e.escapeTest.test(t))return t.replace($e.escapeReplace,gl)}else if($e.escapeTestNoEncode.test(t))return t.replace($e.escapeReplaceNoEncode,gl);return t}function ml(t){try{t=encodeURI(t).replace($e.percentDecode,"%")}catch{return null}return t}function vl(t,e){const r=t.replace($e.findPipe,(i,o,s)=>{let c=!1,l=o;for(;--l>=0&&s[l]==="\\";)c=!c;return c?"|":" |"}),n=r.split($e.splitPipe);let a=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;a<n.length;a++)n[a]=n[a].trim().replace($e.slashPipe,"|");return n}function Cn(t,e,r){const n=t.length;if(n===0)return"";let a=0;for(;a<n&&t.charAt(n-a-1)===e;)a++;return t.slice(0,n-a)}function jh(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function bl(t,e,r,n,a){const i=e.href,o=e.title||null,s=t[1].replace(a.other.outputLinkReplace,"$1");n.state.inLink=!0;const c={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:o,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,c}function Uh(t,e,r){const n=t.match(r.other.indentCodeCompensation);if(n===null)return e;const a=n[1];return e.split(`
19
19
  `).map(i=>{const o=i.match(r.other.beginningSpace);if(o===null)return i;const[s]=o;return s.length>=a.length?i.slice(a.length):i}).join(`
20
- `)}var oa=class{options;rules;lexer;constructor(t){this.options=t||Tr}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:xn(r,`
21
- `)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const r=e[0],n=Lh(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){const n=xn(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:xn(e[0],`
22
- `)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let r=xn(e[0],`
20
+ `)}var ca=class{options;rules;lexer;constructor(t){this.options=t||Rr}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Cn(r,`
21
+ `)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const r=e[0],n=Uh(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){const n=Cn(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Cn(e[0],`
22
+ `)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let r=Cn(e[0],`
23
23
  `).split(`
24
24
  `),n="",a="";const i=[];for(;r.length>0;){let o=!1;const s=[];let c;for(c=0;c<r.length;c++)if(this.rules.other.blockquoteStart.test(r[c]))s.push(r[c]),o=!0;else if(!o)s.push(r[c]);else break;r=r.slice(c);const l=s.join(`
25
- `),u=l.replace(this.rules.other.blockquoteSetextReplace,`
25
+ `),d=l.replace(this.rules.other.blockquoteSetextReplace,`
26
26
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
27
27
  ${l}`:l,a=a?`${a}
28
- ${u}`:u;const p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=p,r.length===0)break;const h=i.at(-1);if(h?.type==="code")break;if(h?.type==="blockquote"){const v=h,m=v.raw+`
28
+ ${d}`:d;const p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,i,!0),this.lexer.state.top=p,r.length===0)break;const h=i.at(-1);if(h?.type==="code")break;if(h?.type==="blockquote"){const v=h,m=v.raw+`
29
29
  `+r.join(`
30
30
  `),b=this.blockquote(m);i[i.length-1]=b,n=n.substring(0,n.length-v.raw.length)+b.raw,a=a.substring(0,a.length-v.text.length)+b.text;break}else if(h?.type==="list"){const v=h,m=v.raw+`
31
31
  `+r.join(`
32
32
  `),b=this.list(m);i[i.length-1]=b,n=n.substring(0,n.length-h.raw.length)+b.raw,a=a.substring(0,a.length-v.raw.length)+b.raw,r=m.substring(i.at(-1).raw.length).split(`
33
- `);continue}}return{type:"blockquote",raw:n,tokens:i,text:a}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim();const n=r.length>1,a={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");const i=this.rules.other.listItemRegex(r);let o=!1;for(;t;){let c=!1,l="",u="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;l=e[0],t=t.substring(l.length);let p=e[2].split(`
33
+ `);continue}}return{type:"blockquote",raw:n,tokens:i,text:a}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim();const n=r.length>1,a={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");const i=this.rules.other.listItemRegex(r);let o=!1;for(;t;){let c=!1,l="",d="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;l=e[0],t=t.substring(l.length);let p=e[2].split(`
34
34
  `,1)[0].replace(this.rules.other.listReplaceTabs,y=>" ".repeat(3*y.length)),h=t.split(`
35
- `,1)[0],v=!p.trim(),m=0;if(this.options.pedantic?(m=2,u=p.trimStart()):v?m=e[1].length+1:(m=e[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,u=p.slice(m),m+=e[1].length),v&&this.rules.other.blankLine.test(h)&&(l+=h+`
36
- `,t=t.substring(h.length+1),c=!0),!c){const y=this.rules.other.nextBulletRegex(m),k=this.rules.other.hrRegex(m),w=this.rules.other.fencesBeginRegex(m),T=this.rules.other.headingBeginRegex(m),R=this.rules.other.htmlBeginRegex(m);for(;t;){const U=t.split(`
37
- `,1)[0];let Q;if(h=U,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),Q=h):Q=h.replace(this.rules.other.tabCharGlobal," "),w.test(h)||T.test(h)||R.test(h)||y.test(h)||k.test(h))break;if(Q.search(this.rules.other.nonSpaceChar)>=m||!h.trim())u+=`
38
- `+Q.slice(m);else{if(v||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(p)||T.test(p)||k.test(p))break;u+=`
35
+ `,1)[0],v=!p.trim(),m=0;if(this.options.pedantic?(m=2,d=p.trimStart()):v?m=e[1].length+1:(m=e[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,d=p.slice(m),m+=e[1].length),v&&this.rules.other.blankLine.test(h)&&(l+=h+`
36
+ `,t=t.substring(h.length+1),c=!0),!c){const y=this.rules.other.nextBulletRegex(m),k=this.rules.other.hrRegex(m),w=this.rules.other.fencesBeginRegex(m),T=this.rules.other.headingBeginRegex(m),I=this.rules.other.htmlBeginRegex(m);for(;t;){const U=t.split(`
37
+ `,1)[0];let Q;if(h=U,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),Q=h):Q=h.replace(this.rules.other.tabCharGlobal," "),w.test(h)||T.test(h)||I.test(h)||y.test(h)||k.test(h))break;if(Q.search(this.rules.other.nonSpaceChar)>=m||!h.trim())d+=`
38
+ `+Q.slice(m);else{if(v||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(p)||T.test(p)||k.test(p))break;d+=`
39
39
  `+h}!v&&!h.trim()&&(v=!0),l+=U+`
40
- `,t=t.substring(U.length+1),p=Q.slice(m)}}a.loose||(o?a.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(o=!0));let b=null,C;this.options.gfm&&(b=this.rules.other.listIsTask.exec(u),b&&(C=b[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),a.items.push({type:"list_item",raw:l,task:!!b,checked:C,loose:!1,text:u,tokens:[]}),a.raw+=l}const s=a.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let c=0;c<a.items.length;c++)if(this.lexer.state.top=!1,a.items[c].tokens=this.lexer.blockTokens(a.items[c].text,[]),!a.loose){const l=a.items[c].tokens.filter(p=>p.type==="space"),u=l.length>0&&l.some(p=>this.rules.other.anyLine.test(p.raw));a.loose=u}if(a.loose)for(let c=0;c<a.items.length;c++)a.items[c].loose=!0;return a}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:n,title:a}}}table(t){const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const r=il(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
41
- `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===n.length){for(const o of n)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<r.length;o++)i.header.push({text:r[o],tokens:this.lexer.inline(r[o]),header:!0,align:i.align[o]});for(const o of a)i.rows.push(il(o,i.header.length).map((s,c)=>({text:s,tokens:this.lexer.inline(s),header:!1,align:i.align[c]})));return i}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const r=e[1].charAt(e[1].length-1)===`
42
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const i=xn(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{const i=Ih(e[2],"()");if(i===-2)return;if(i>-1){const s=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,s).trim(),e[3]=""}}let n=e[2],a="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(n);i&&(n=i[1],a=i[3])}else a=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),ol(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=e[n.toLowerCase()];if(!a){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return ol(r,a,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const i=[...n[0]].length-1;let o,s,c=i,l=0;const u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(n=u.exec(e))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(s=[...o].length,n[3]||n[4]){c+=s;continue}else if((n[5]||n[6])&&i%3&&!((i+s)%3)){l+=s;continue}if(c-=s,c>0)continue;s=Math.min(s,s+c+l);const p=[...n[0]][0].length,h=t.slice(0,i+n.index+p+s);if(Math.min(i,s)%2){const m=h.slice(1,-1);return{type:"em",raw:h,text:m,tokens:this.lexer.inlineTokens(m)}}const v=h.slice(2,-2);return{type:"strong",raw:h,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(r),a=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&a&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,n;if(e[2]==="@")r=e[0],n="mailto:"+r;else{let a;do a=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(a!==e[0]);r=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},Ht=class oo{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Tr,this.options.tokenizer=this.options.tokenizer||new oa,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:De,block:ia.normal,inline:_n.normal};this.options.pedantic?(r.block=ia.pedantic,r.inline=_n.pedantic):this.options.gfm&&(r.block=ia.gfm,this.options.breaks?r.inline=_n.breaks:r.inline=_n.gfm),this.tokenizer.rules=r}static get rules(){return{block:ia,inline:_n}}static lex(e,r){return new oo(r).lex(e)}static lexInline(e,r){return new oo(r).inlineTokens(e)}lex(e){e=e.replace(De.carriageReturn,`
43
- `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){for(this.options.pedantic&&(e=e.replace(De.tabCharGlobal," ").replace(De.spaceLine,""));e;){let a;if(this.options.extensions?.block?.some(o=>(a=o.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);const o=r.at(-1);a.raw.length===1&&o!==void 0?o.raw+=`
40
+ `,t=t.substring(U.length+1),p=Q.slice(m)}}a.loose||(o?a.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(o=!0));let b=null,A;this.options.gfm&&(b=this.rules.other.listIsTask.exec(d),b&&(A=b[0]!=="[ ] ",d=d.replace(this.rules.other.listReplaceTask,""))),a.items.push({type:"list_item",raw:l,task:!!b,checked:A,loose:!1,text:d,tokens:[]}),a.raw+=l}const s=a.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let c=0;c<a.items.length;c++)if(this.lexer.state.top=!1,a.items[c].tokens=this.lexer.blockTokens(a.items[c].text,[]),!a.loose){const l=a.items[c].tokens.filter(p=>p.type==="space"),d=l.length>0&&l.some(p=>this.rules.other.anyLine.test(p.raw));a.loose=d}if(a.loose)for(let c=0;c<a.items.length;c++)a.items[c].loose=!0;return a}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:n,title:a}}}table(t){const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const r=vl(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
41
+ `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===n.length){for(const o of n)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<r.length;o++)i.header.push({text:r[o],tokens:this.lexer.inline(r[o]),header:!0,align:i.align[o]});for(const o of a)i.rows.push(vl(o,i.header.length).map((s,c)=>({text:s,tokens:this.lexer.inline(s),header:!1,align:i.align[c]})));return i}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const r=e[1].charAt(e[1].length-1)===`
42
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const i=Cn(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{const i=jh(e[2],"()");if(i===-2)return;if(i>-1){const s=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,s).trim(),e[3]=""}}let n=e[2],a="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(n);i&&(n=i[1],a=i[3])}else a=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),bl(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=e[n.toLowerCase()];if(!a){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return bl(r,a,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const i=[...n[0]].length-1;let o,s,c=i,l=0;const d=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*t.length+i);(n=d.exec(e))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(s=[...o].length,n[3]||n[4]){c+=s;continue}else if((n[5]||n[6])&&i%3&&!((i+s)%3)){l+=s;continue}if(c-=s,c>0)continue;s=Math.min(s,s+c+l);const p=[...n[0]][0].length,h=t.slice(0,i+n.index+p+s);if(Math.min(i,s)%2){const m=h.slice(1,-1);return{type:"em",raw:h,text:m,tokens:this.lexer.inlineTokens(m)}}const v=h.slice(2,-2);return{type:"strong",raw:h,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(r),a=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&a&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,n;if(e[2]==="@")r=e[0],n="mailto:"+r;else{let a;do a=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(a!==e[0]);r=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},Gt=class ko{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Rr,this.options.tokenizer=this.options.tokenizer||new ca,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:$e,block:la.normal,inline:En.normal};this.options.pedantic?(r.block=la.pedantic,r.inline=En.pedantic):this.options.gfm&&(r.block=la.gfm,this.options.breaks?r.inline=En.breaks:r.inline=En.gfm),this.tokenizer.rules=r}static get rules(){return{block:la,inline:En}}static lex(e,r){return new ko(r).lex(e)}static lexInline(e,r){return new ko(r).inlineTokens(e)}lex(e){e=e.replace($e.carriageReturn,`
43
+ `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){for(this.options.pedantic&&(e=e.replace($e.tabCharGlobal," ").replace($e.spaceLine,""));e;){let a;if(this.options.extensions?.block?.some(o=>(a=o.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);const o=r.at(-1);a.raw.length===1&&o!==void 0?o.raw+=`
44
44
  `:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);const o=r.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
45
45
  `+a.raw,o.text+=`
46
46
  `+a.text,this.inlineQueue.at(-1).src=o.text):r.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);const o=r.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
@@ -49,16 +49,16 @@ ${u}`:u;const p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
49
49
  `+a.raw,o.text+=`
50
50
  `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(a),n=i.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);const o=r.at(-1);o?.type==="text"?(o.raw+=`
51
51
  `+a.raw,o.text+=`
52
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(a);continue}if(e){const o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){let n=e,a=null;if(this.tokens.links){const s=Object.keys(this.tokens.links);if(s.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)s.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,a.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(a=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,o="";for(;e;){i||(o=""),i=!1;let s;if(this.options.extensions?.inline?.some(l=>(s=l.call({lexer:this},e,r))?(e=e.substring(s.raw.length),r.push(s),!0):!1))continue;if(s=this.tokenizer.escape(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.tag(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.link(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(s.raw.length);const l=r.at(-1);s.type==="text"&&l?.type==="text"?(l.raw+=s.raw,l.text+=s.text):r.push(s);continue}if(s=this.tokenizer.emStrong(e,n,o)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.codespan(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.br(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.del(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.autolink(e)){e=e.substring(s.raw.length),r.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(e))){e=e.substring(s.raw.length),r.push(s);continue}let c=e;if(this.options.extensions?.startInline){let l=1/0;const u=e.slice(1);let p;this.options.extensions.startInline.forEach(h=>{p=h.call({lexer:this},u),typeof p=="number"&&p>=0&&(l=Math.min(l,p))}),l<1/0&&l>=0&&(c=e.substring(0,l+1))}if(s=this.tokenizer.inlineText(c)){e=e.substring(s.raw.length),s.raw.slice(-1)!=="_"&&(o=s.raw.slice(-1)),i=!0;const l=r.at(-1);l?.type==="text"?(l.raw+=s.raw,l.text+=s.text):r.push(s);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return r}},sa=class{options;parser;constructor(t){this.options=t||Tr}space(t){return""}code({text:t,lang:e,escaped:r}){const n=(e||"").match(De.notSpaceStart)?.[0],a=t.replace(De.endingNewline,"")+`
53
- `;return n?'<pre><code class="language-'+Ct(n)+'">'+(r?a:Ct(a,!0))+`</code></pre>
54
- `:"<pre><code>"+(r?a:Ct(a,!0))+`</code></pre>
52
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(a);continue}if(e){const o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){let n=e,a=null;if(this.tokens.links){const s=Object.keys(this.tokens.links);if(s.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)s.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,a.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(a=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,o="";for(;e;){i||(o=""),i=!1;let s;if(this.options.extensions?.inline?.some(l=>(s=l.call({lexer:this},e,r))?(e=e.substring(s.raw.length),r.push(s),!0):!1))continue;if(s=this.tokenizer.escape(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.tag(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.link(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(s.raw.length);const l=r.at(-1);s.type==="text"&&l?.type==="text"?(l.raw+=s.raw,l.text+=s.text):r.push(s);continue}if(s=this.tokenizer.emStrong(e,n,o)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.codespan(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.br(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.del(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.autolink(e)){e=e.substring(s.raw.length),r.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(e))){e=e.substring(s.raw.length),r.push(s);continue}let c=e;if(this.options.extensions?.startInline){let l=1/0;const d=e.slice(1);let p;this.options.extensions.startInline.forEach(h=>{p=h.call({lexer:this},d),typeof p=="number"&&p>=0&&(l=Math.min(l,p))}),l<1/0&&l>=0&&(c=e.substring(0,l+1))}if(s=this.tokenizer.inlineText(c)){e=e.substring(s.raw.length),s.raw.slice(-1)!=="_"&&(o=s.raw.slice(-1)),i=!0;const l=r.at(-1);l?.type==="text"?(l.raw+=s.raw,l.text+=s.text):r.push(s);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return r}},ua=class{options;parser;constructor(t){this.options=t||Rr}space(t){return""}code({text:t,lang:e,escaped:r}){const n=(e||"").match($e.notSpaceStart)?.[0],a=t.replace($e.endingNewline,"")+`
53
+ `;return n?'<pre><code class="language-'+Rt(n)+'">'+(r?a:Rt(a,!0))+`</code></pre>
54
+ `:"<pre><code>"+(r?a:Rt(a,!0))+`</code></pre>
55
55
  `}blockquote({tokens:t}){return`<blockquote>
56
56
  ${this.parser.parse(t)}</blockquote>
57
57
  `}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
58
58
  `}hr(t){return`<hr>
59
59
  `}list(t){const e=t.ordered,r=t.start;let n="";for(let o=0;o<t.items.length;o++){const s=t.items[o];n+=this.listitem(s)}const a=e?"ol":"ul",i=e&&r!==1?' start="'+r+'"':"";return"<"+a+i+`>
60
60
  `+n+"</"+a+`>
61
- `}listitem(t){let e="";if(t.task){const r=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=r+" "+Ct(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
61
+ `}listitem(t){let e="";if(t.task){const r=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=r+" "+Rt(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
62
62
  `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
63
63
  `}table(t){let e="",r="";for(let a=0;a<t.header.length;a++)r+=this.tablecell(t.header[a]);e+=this.tablerow({text:r});let n="";for(let a=0;a<t.rows.length;a++){const i=t.rows[a];r="";for(let o=0;o<i.length;o++)r+=this.tablecell(i[o]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
64
64
  <thead>
@@ -67,13 +67,13 @@ ${this.parser.parse(t)}</blockquote>
67
67
  `}tablerow({text:t}){return`<tr>
68
68
  ${t}</tr>
69
69
  `}tablecell(t){const e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
70
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Ct(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){const n=this.parser.parseInline(r),a=al(t);if(a===null)return n;t=a;let i='<a href="'+t+'"';return e&&(i+=' title="'+Ct(e)+'"'),i+=">"+n+"</a>",i}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));const a=al(t);if(a===null)return Ct(r);t=a;let i=`<img src="${t}" alt="${r}"`;return e&&(i+=` title="${Ct(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Ct(t.text)}},xi=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Zt=class so{options;renderer;textRenderer;constructor(e){this.options=e||Tr,this.options.renderer=this.options.renderer||new sa,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new xi}static parse(e,r){return new so(r).parse(e)}static parseInline(e,r){return new so(r).parseInline(e)}parse(e,r=!0){let n="";for(let a=0;a<e.length;a++){const i=e[a];if(this.options.extensions?.renderers?.[i.type]){const s=i,c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){n+=c||"";continue}}const o=i;switch(o.type){case"space":{n+=this.renderer.space(o);continue}case"hr":{n+=this.renderer.hr(o);continue}case"heading":{n+=this.renderer.heading(o);continue}case"code":{n+=this.renderer.code(o);continue}case"table":{n+=this.renderer.table(o);continue}case"blockquote":{n+=this.renderer.blockquote(o);continue}case"list":{n+=this.renderer.list(o);continue}case"html":{n+=this.renderer.html(o);continue}case"paragraph":{n+=this.renderer.paragraph(o);continue}case"text":{let s=o,c=this.renderer.text(s);for(;a+1<e.length&&e[a+1].type==="text";)s=e[++a],c+=`
71
- `+this.renderer.text(s);r?n+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):n+=c;continue}default:{const s='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}parseInline(e,r=this.renderer){let n="";for(let a=0;a<e.length;a++){const i=e[a];if(this.options.extensions?.renderers?.[i.type]){const s=this.options.extensions.renderers[i.type].call({parser:this},i);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=s||"";continue}}const o=i;switch(o.type){case"escape":{n+=r.text(o);break}case"html":{n+=r.html(o);break}case"link":{n+=r.link(o);break}case"image":{n+=r.image(o);break}case"strong":{n+=r.strong(o);break}case"em":{n+=r.em(o);break}case"codespan":{n+=r.codespan(o);break}case"br":{n+=r.br(o);break}case"del":{n+=r.del(o);break}case"text":{n+=r.text(o);break}default:{const s='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}},la=class{options;block;constructor(t){this.options=t||Tr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Ht.lex:Ht.lexInline}provideParser(){return this.block?Zt.parse:Zt.parseInline}},sl=class{defaults=pi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Zt;Renderer=sa;TextRenderer=xi;Lexer=Ht;Tokenizer=oa;Hooks=la;constructor(...t){this.use(...t)}walkTokens(t,e){let r=[];for(const n of t)switch(r=r.concat(e.call(this,n)),n.type){case"table":{const a=n;for(const i of a.header)r=r.concat(this.walkTokens(i.tokens,e));for(const i of a.rows)for(const o of i)r=r.concat(this.walkTokens(o.tokens,e));break}case"list":{const a=n;r=r.concat(this.walkTokens(a.items,e));break}default:{const a=n;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(i=>{const o=a[i].flat(1/0);r=r.concat(this.walkTokens(o,e))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,e)))}}return r}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){const i=e.renderers[a.name];i?e.renderers[a.name]=function(...o){let s=a.renderer.apply(this,o);return s===!1&&(s=i.apply(this,o)),s}:e.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[a.level];i?i.unshift(a.tokenizer):e[a.level]=[a.tokenizer],a.start&&(a.level==="block"?e.startBlock?e.startBlock.push(a.start):e.startBlock=[a.start]:a.level==="inline"&&(e.startInline?e.startInline.push(a.start):e.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(e.childTokens[a.name]=a.childTokens)}),n.extensions=e),r.renderer){const a=this.defaults.renderer||new sa(this.defaults);for(const i in r.renderer){if(!(i in a))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const o=i,s=r.renderer[o],c=a[o];a[o]=(...l)=>{let u=s.apply(a,l);return u===!1&&(u=c.apply(a,l)),u||""}}n.renderer=a}if(r.tokenizer){const a=this.defaults.tokenizer||new oa(this.defaults);for(const i in r.tokenizer){if(!(i in a))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const o=i,s=r.tokenizer[o],c=a[o];a[o]=(...l)=>{let u=s.apply(a,l);return u===!1&&(u=c.apply(a,l)),u}}n.tokenizer=a}if(r.hooks){const a=this.defaults.hooks||new la;for(const i in r.hooks){if(!(i in a))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const o=i,s=r.hooks[o],c=a[o];la.passThroughHooks.has(i)?a[o]=l=>{if(this.defaults.async)return Promise.resolve(s.call(a,l)).then(p=>c.call(a,p));const u=s.call(a,l);return c.call(a,u)}:a[o]=(...l)=>{let u=s.apply(a,l);return u===!1&&(u=c.apply(a,l)),u}}n.hooks=a}if(r.walkTokens){const a=this.defaults.walkTokens,i=r.walkTokens;n.walkTokens=function(o){let s=[];return s.push(i.call(this,o)),a&&(s=s.concat(a.call(this,o))),s}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Ht.lex(t,e??this.defaults)}parser(t,e){return Zt.parse(t,e??this.defaults)}parseMarkdown(t){return(r,n)=>{const a={...n},i={...this.defaults,...a},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&a.async===!1)return o(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 r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=t);const s=i.hooks?i.hooks.provideLexer():t?Ht.lex:Ht.lexInline,c=i.hooks?i.hooks.provideParser():t?Zt.parse:Zt.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(r):r).then(l=>s(l,i)).then(l=>i.hooks?i.hooks.processAllTokens(l):l).then(l=>i.walkTokens?Promise.all(this.walkTokens(l,i.walkTokens)).then(()=>l):l).then(l=>c(l,i)).then(l=>i.hooks?i.hooks.postprocess(l):l).catch(o);try{i.hooks&&(r=i.hooks.preprocess(r));let l=s(r,i);i.hooks&&(l=i.hooks.processAllTokens(l)),i.walkTokens&&this.walkTokens(l,i.walkTokens);let u=c(l,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(l){return o(l)}}}onError(t,e){return r=>{if(r.message+=`
72
- Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+Ct(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Er=new sl;function K(t,e){return Er.parse(t,e)}K.options=K.setOptions=function(t){return Er.setOptions(t),K.defaults=Er.defaults,Hs(K.defaults),K},K.getDefaults=pi,K.defaults=Tr,K.use=function(...t){return Er.use(...t),K.defaults=Er.defaults,Hs(K.defaults),K},K.walkTokens=function(t,e){return Er.walkTokens(t,e)},K.parseInline=Er.parseInline,K.Parser=Zt,K.parser=Zt.parse,K.Renderer=sa,K.TextRenderer=xi,K.Lexer=Ht,K.lexer=Ht.lex,K.Tokenizer=oa,K.Hooks=la,K.parse=K,K.options,K.setOptions,K.use,K.walkTokens,K.parseInline,Zt.parse,Ht.lex;const ll=t=>(Object.getOwnPropertyNames(t).forEach(e=>{const r=t[e];r&&typeof r=="object"&&ll(r)}),Object.freeze(t)),cl=ll({all:[],used:[],unused:[]}),Oh=t=>{const e=Yd(t);return e.addHook("uponSanitizeElement",function(r,n){const a=n.tagName||r.nodeName.toLowerCase();a.startsWith("liipgpt-")&&(n.allowedTags[a]=!0)}),e};class ul{marked;currentReferences=cl;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new sl({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=Oh(e.window)}createFootnoteExtension=()=>{const e=this;return{extensions:[{name:"footnote",level:"inline",start(r){return r.match(/\[\^(\d+)\]/)?.index},tokenizer(r){const a=/^\[\^(\d+)\]/.exec(r);if(a){const[i,o]=a;return{type:"footnote",raw:i,refNumber:o}}},renderer(r){if(r.type==="footnote"){const n=parseInt(r.refNumber)-1,a=e.currentReferences.all[n];if(!a)return console.error("Could not find ref with index:",n),"";let i;return a?.referenceIndex.used?i=a.referenceIndex.used:(e.currentReferences.used.push(a),e.lastUsedIndex++,i=e.lastUsedIndex,a.referenceIndex.used=i),` <liipgpt-reference-number data-all-index="${n}" data-used-index="${i}" data-source="${JSON.stringify(a).replace(/"/g,"&quot;")}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:["hr"]})}toHTML(e,r){this.currentReferences=r;const n=this.parse(e);return this.currentReferences=cl,n}}function Mh(){let t,e;return{promise:new Promise((n,a)=>{e=n,t=a}),reject:t,resolve:e}}class dl{promise;resolve;reject;constructor(){const{promise:e,resolve:r,reject:n}=Mh();this.promise=e,this.resolve=r,this.reject=n}then(e,r){return this.promise.then(e,r)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]="Flag"}class Si{hasValue=new dl;currentValue;setValue(e){this.currentValue=e,this.hasValue.resolve()}cleanup(e){this.hasValue.reject(e)}getCurrentValue(){return this.currentValue}async toPromise(){return await this.hasValue,this.currentValue}then(e,r){return this.toPromise().then(e,r)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]="FutureValue"}const Ph=t=>{try{return new URL(t).hostname}catch{return t}};function Nh(t){return t.replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"')}const Dh=({url:t,considered:e,title:r,description:n,summary:a})=>{const i=Ph(t);return{url:t,considered:e,referenceIndex:{},score:0,metadata:{},display:{card:{title:r,description:n||a,badge:t},listItem:{title:r,badge:i}}}};class $h{constructor(e){this.options=e,this.store=vd({id:e.id,state:"loading",errors:[],type:"bot",time:new Date().toISOString(),message:{markdown:"",html:"",text:""},references:{all:[],used:[],unused:[]},retrievalQuestion:e.userQuestion})}store;content=new Si;backendSendsMappedRefs=!1;pushError(e){this.options.onError?.(e),this.store.update(r=>({...r,errors:[...r.errors,e]}))}updateRequestId(e){this.store.update(r=>({...r,id:e}))}updateText(e){this.store.update(r=>{const n=r.message.markdown+e,a=this.options.markdownRenderer.toHTML(n,r.references);return{...r,state:"streaming",message:{markdown:n,html:a,text:""}}})}finishMessage(){this.store.update(e=>{const r={...e,state:"done"};return r.references.unused=r.references.all.filter(n=>n.referenceIndex.used===void 0),r.message.text=Nh(r.message.html),this.options?.onFinish?.(r),this.content.setValue(r),r})}addReference(e){this.store.update(r=>{const n=r.references.all,a=n.length,i=[...n,{...e,referenceIndex:{all:a}}];return{...r,references:{used:r.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(Dh(e))}updateRetrievalQuestion(e){this.store.update(r=>({...r,retrievalQuestion:e}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}}var W;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const i={};for(const o of a)i[o]=o;return i},t.getValidEnumValues=a=>{const i=t.objectKeys(a).filter(s=>typeof a[a[s]]!="number"),o={};for(const s of i)o[s]=a[s];return t.objectValues(o)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},t.find=(a,i)=>{for(const o of a)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,i=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(W||(W={}));var hl;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(hl||(hl={}));const A=W.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),or=t=>{switch(typeof t){case"undefined":return A.undefined;case"string":return A.string;case"number":return Number.isNaN(t)?A.nan:A.number;case"boolean":return A.boolean;case"function":return A.function;case"bigint":return A.bigint;case"symbol":return A.symbol;case"object":return Array.isArray(t)?A.array:t===null?A.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?A.promise:typeof Map<"u"&&t instanceof Map?A.map:typeof Set<"u"&&t instanceof Set?A.set:typeof Date<"u"&&t instanceof Date?A.date:A.object;default:return A.unknown}},x=W.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Gt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(i){return i.message},n={_errors:[]},a=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,c=0;for(;c<o.path.length;){const l=o.path[c];c===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return a(this),n}static assert(e){if(!(e instanceof Gt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,W.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];r[i]=r[i]||[],r[i].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Gt.create=t=>new Gt(t);const Ti=(t,e)=>{let r;switch(t.code){case x.invalid_type:t.received===A.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,W.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${W.joinValues(t.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${W.joinValues(t.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${W.joinValues(t.options)}, received '${t.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:W.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case x.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case x.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=e.defaultError,W.assertNever(t)}return{message:r}};let zh=Ti;function Fh(){return zh}const Bh=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,i=[...r,...a.path||[]],o={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let s="";const c=n.filter(l=>!!l).slice().reverse();for(const l of c)s=l(o,{data:e,defaultError:s}).message;return{...a,path:i,message:s}};function E(t,e){const r=Fh(),n=Bh({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ti?void 0:Ti].filter(a=>!!a)});t.common.issues.push(n)}class $e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return D;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const i=await a.key,o=await a.value;n.push({key:i,value:o})}return $e.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:i,value:o}=a;if(i.status==="aborted"||o.status==="aborted")return D;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}}const D=Object.freeze({status:"aborted"}),Sn=t=>({status:"dirty",value:t}),st=t=>({status:"valid",value:t}),fl=t=>t.status==="aborted",pl=t=>t.status==="dirty",qr=t=>t.status==="valid",ca=t=>typeof Promise<"u"&&t instanceof Promise;var I;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(I||(I={}));class At{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gl=(t,e)=>{if(qr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Gt(t.common.issues);return this._error=r,this._error}}};function j(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(o,s)=>{const{message:c}=t;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:a}}class Z{get description(){return this._def.description}_getType(e){return or(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:or(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $e,ctx:{common:e.parent.common,data:e.data,parsedType:or(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(ca(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:or(e)},a=this._parseSync({data:e,path:n.path,parent:n});return gl(n,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:or(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return qr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>qr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:or(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(ca(a)?a:Promise.resolve(a));return gl(n,i)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,i)=>{const o=e(a),s=()=>i.addIssue({code:x.custom,...n(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new Gr({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return lr.create(this,this._def)}nullable(){return Wr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rt.create(this)}promise(){return pa.create(this,this._def)}or(e){return da.create([this,e],this._def)}and(e){return ha.create(this,e,this._def)}transform(e){return new Gr({...j(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Ii({...j(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new uf({typeName:N.ZodBranded,type:this,...j(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Li({...j(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Oi.create(this,e)}readonly(){return Mi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const jh=/^c[^\s-]{8,}$/i,Uh=/^[0-9a-z]+$/,qh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Vh=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Hh=/^[a-z0-9_-]{21}$/i,Zh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gh=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Wh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ei;const Yh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Kh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Xh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Jh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ef=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tf=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ml="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",rf=new RegExp(`^${ml}$`);function vl(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function nf(t){return new RegExp(`^${vl(t)}$`)}function af(t){let e=`${ml}T${vl(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function of(t,e){return!!((e==="v4"||!e)&&Yh.test(t)||(e==="v6"||!e)&&Xh.test(t))}function sf(t,e){if(!Zh.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function lf(t,e){return!!((e==="v4"||!e)&&Kh.test(t)||(e==="v6"||!e)&&Jh.test(t))}class Wt extends Z{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==A.string){const i=this._getOrReturnCtx(e);return E(i,{code:x.invalid_type,expected:A.string,received:i.parsedType}),D}const n=new $e;let a;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(a=this._getOrReturnCtx(e,a),o?E(a,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&E(a,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Wh.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"email",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ei||(Ei=new RegExp(Qh,"u")),Ei.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"emoji",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Vh.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"uuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Hh.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"nanoid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")jh.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"cuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Uh.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"cuid2",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")qh.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"ulid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),E(a,{validation:"url",code:x.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"regex",code:x.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?af(i).test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?rf.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?nf(i).test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Gh.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"duration",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?of(e.data,i.version)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"ip",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?sf(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"jwt",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?lf(e.data,i.version)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"cidr",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?ef.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"base64",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?tf.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"base64url",code:x.invalid_string,message:i.message}),n.dirty()):W.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:x.invalid_string,...I.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...I.errToObj(e)})}url(e){return this._addCheck({kind:"url",...I.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...I.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...I.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...I.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...I.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...I.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...I.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...I.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...I.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...I.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...I.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...I.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...I.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...I.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...I.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...I.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...I.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...I.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...I.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...I.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...I.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...I.errToObj(r)})}nonempty(e){return this.min(1,I.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Wt.create=t=>new Wt({checks:[],typeName:N.ZodString,coerce:t?.coerce??!1,...j(t)});function cf(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,i=Number.parseInt(t.toFixed(a).replace(".","")),o=Number.parseInt(e.toFixed(a).replace(".",""));return i%o/10**a}class Vr extends Z{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==A.number){const i=this._getOrReturnCtx(e);return E(i,{code:x.invalid_type,expected:A.number,received:i.parsedType}),D}let n;const a=new $e;for(const i of this._def.checks)i.kind==="int"?W.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:x.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?cf(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:x.not_finite,message:i.message}),a.dirty()):W.assertNever(i);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,I.toString(r))}gt(e,r){return this.setLimit("min",e,!1,I.toString(r))}lte(e,r){return this.setLimit("max",e,!0,I.toString(r))}lt(e,r){return this.setLimit("max",e,!1,I.toString(r))}setLimit(e,r,n,a){return new Vr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:I.toString(a)}]})}_addCheck(e){return new Vr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:I.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:I.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&W.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Vr.create=t=>new Vr({checks:[],typeName:N.ZodNumber,coerce:t?.coerce||!1,...j(t)});class Tn extends Z{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==A.bigint)return this._getInvalidInput(e);let n;const a=new $e;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):W.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return E(r,{code:x.invalid_type,expected:A.bigint,received:r.parsedType}),D}gte(e,r){return this.setLimit("min",e,!0,I.toString(r))}gt(e,r){return this.setLimit("min",e,!1,I.toString(r))}lte(e,r){return this.setLimit("max",e,!0,I.toString(r))}lt(e,r){return this.setLimit("max",e,!1,I.toString(r))}setLimit(e,r,n,a){return new Tn({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:I.toString(a)}]})}_addCheck(e){return new Tn({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Tn.create=t=>new Tn({checks:[],typeName:N.ZodBigInt,coerce:t?.coerce??!1,...j(t)});class Ci extends Z{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==A.boolean){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:A.boolean,received:n.parsedType}),D}return st(e.data)}}Ci.create=t=>new Ci({typeName:N.ZodBoolean,coerce:t?.coerce||!1,...j(t)});class ua extends Z{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==A.date){const i=this._getOrReturnCtx(e);return E(i,{code:x.invalid_type,expected:A.date,received:i.parsedType}),D}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return E(i,{code:x.invalid_date}),D}const n=new $e;let a;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:x.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:x.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):W.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ua({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:I.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:I.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}ua.create=t=>new ua({checks:[],coerce:t?.coerce||!1,typeName:N.ZodDate,...j(t)});class bl extends Z{_parse(e){if(this._getType(e)!==A.symbol){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:A.symbol,received:n.parsedType}),D}return st(e.data)}}bl.create=t=>new bl({typeName:N.ZodSymbol,...j(t)});class kl extends Z{_parse(e){if(this._getType(e)!==A.undefined){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:A.undefined,received:n.parsedType}),D}return st(e.data)}}kl.create=t=>new kl({typeName:N.ZodUndefined,...j(t)});class yl extends Z{_parse(e){if(this._getType(e)!==A.null){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:A.null,received:n.parsedType}),D}return st(e.data)}}yl.create=t=>new yl({typeName:N.ZodNull,...j(t)});class wl extends Z{constructor(){super(...arguments),this._any=!0}_parse(e){return st(e.data)}}wl.create=t=>new wl({typeName:N.ZodAny,...j(t)});class _l extends Z{constructor(){super(...arguments),this._unknown=!0}_parse(e){return st(e.data)}}_l.create=t=>new _l({typeName:N.ZodUnknown,...j(t)});class sr extends Z{_parse(e){const r=this._getOrReturnCtx(e);return E(r,{code:x.invalid_type,expected:A.never,received:r.parsedType}),D}}sr.create=t=>new sr({typeName:N.ZodNever,...j(t)});class xl extends Z{_parse(e){if(this._getType(e)!==A.undefined){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:A.void,received:n.parsedType}),D}return st(e.data)}}xl.create=t=>new xl({typeName:N.ZodVoid,...j(t)});class Rt extends Z{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==A.array)return E(r,{code:x.invalid_type,expected:A.array,received:r.parsedType}),D;if(a.exactLength!==null){const o=r.data.length>a.exactLength.value,s=r.data.length<a.exactLength.value;(o||s)&&(E(r,{code:o?x.too_big:x.too_small,minimum:s?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(E(r,{code:x.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(E(r,{code:x.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>a.type._parseAsync(new At(r,o,r.path,s)))).then(o=>$e.mergeArray(n,o));const i=[...r.data].map((o,s)=>a.type._parseSync(new At(r,o,r.path,s)));return $e.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new Rt({...this._def,minLength:{value:e,message:I.toString(r)}})}max(e,r){return new Rt({...this._def,maxLength:{value:e,message:I.toString(r)}})}length(e,r){return new Rt({...this._def,exactLength:{value:e,message:I.toString(r)}})}nonempty(e){return this.min(1,e)}}Rt.create=(t,e)=>new Rt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...j(e)});function Hr(t){if(t instanceof ue){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=lr.create(Hr(n))}return new ue({...t._def,shape:()=>e})}else return t instanceof Rt?new Rt({...t._def,type:Hr(t.element)}):t instanceof lr?lr.create(Hr(t.unwrap())):t instanceof Wr?Wr.create(Hr(t.unwrap())):t instanceof Cr?Cr.create(t.items.map(e=>Hr(e))):t}class ue extends Z{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=W.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==A.object){const l=this._getOrReturnCtx(e);return E(l,{code:x.invalid_type,expected:A.object,received:l.parsedType}),D}const{status:n,ctx:a}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof sr&&this._def.unknownKeys==="strip"))for(const l in a.data)o.includes(l)||s.push(l);const c=[];for(const l of o){const u=i[l],p=a.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new At(a,p,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof sr){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of s)c.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(l==="strict")s.length>0&&(E(a,{code:x.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of s){const p=a.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new At(a,p,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const p=await u.key,h=await u.value;l.push({key:p,value:h,alwaysSet:u.alwaysSet})}return l}).then(l=>$e.mergeObjectSync(n,l)):$e.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return I.errToObj,new ue({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:I.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new ue({...this._def,unknownKeys:"strip"})}passthrough(){return new ue({...this._def,unknownKeys:"passthrough"})}extend(e){return new ue({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ue({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ue({...this._def,catchall:e})}pick(e){const r={};for(const n of W.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new ue({...this._def,shape:()=>r})}omit(e){const r={};for(const n of W.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new ue({...this._def,shape:()=>r})}deepPartial(){return Hr(this)}partial(e){const r={};for(const n of W.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new ue({...this._def,shape:()=>r})}required(e){const r={};for(const n of W.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof lr;)i=i._def.innerType;r[n]=i}return new ue({...this._def,shape:()=>r})}keyof(){return El(W.objectKeys(this.shape))}}ue.create=(t,e)=>new ue({shape:()=>t,unknownKeys:"strip",catchall:sr.create(),typeName:N.ZodObject,...j(e)}),ue.strictCreate=(t,e)=>new ue({shape:()=>t,unknownKeys:"strict",catchall:sr.create(),typeName:N.ZodObject,...j(e)}),ue.lazycreate=(t,e)=>new ue({shape:t,unknownKeys:"strip",catchall:sr.create(),typeName:N.ZodObject,...j(e)});class da extends Z{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(i){for(const s of i)if(s.result.status==="valid")return s.result;for(const s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(s=>new Gt(s.ctx.common.issues));return E(r,{code:x.invalid_union,unionErrors:o}),D}if(r.common.async)return Promise.all(n.map(async i=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(a);{let i;const o=[];for(const c of n){const l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const s=o.map(c=>new Gt(c));return E(r,{code:x.invalid_union,unionErrors:s}),D}}get options(){return this._def.options}}da.create=(t,e)=>new da({options:t,typeName:N.ZodUnion,...j(e)});function Ai(t,e){const r=or(t),n=or(e);if(t===e)return{valid:!0,data:t};if(r===A.object&&n===A.object){const a=W.objectKeys(e),i=W.objectKeys(t).filter(s=>a.indexOf(s)!==-1),o={...t,...e};for(const s of i){const c=Ai(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(r===A.array&&n===A.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let i=0;i<t.length;i++){const o=t[i],s=e[i],c=Ai(o,s);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===A.date&&n===A.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ha extends Z{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(i,o)=>{if(fl(i)||fl(o))return D;const s=Ai(i.value,o.value);return s.valid?((pl(i)||pl(o))&&r.dirty(),{status:r.value,value:s.data}):(E(n,{code:x.invalid_intersection_types}),D)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,o])=>a(i,o)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ha.create=(t,e,r)=>new ha({left:t,right:e,typeName:N.ZodIntersection,...j(r)});class Cr extends Z{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==A.array)return E(n,{code:x.invalid_type,expected:A.array,received:n.parsedType}),D;if(n.data.length<this._def.items.length)return E(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),D;!this._def.rest&&n.data.length>this._def.items.length&&(E(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((o,s)=>{const c=this._def.items[s]||this._def.rest;return c?c._parse(new At(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>$e.mergeArray(r,o)):$e.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new Cr({...this._def,rest:e})}}Cr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Cr({items:t,typeName:N.ZodTuple,rest:null,...j(e)})};class fa extends Z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==A.object)return E(n,{code:x.invalid_type,expected:A.object,received:n.parsedType}),D;const a=[],i=this._def.keyType,o=this._def.valueType;for(const s in n.data)a.push({key:i._parse(new At(n,s,n.path,s)),value:o._parse(new At(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?$e.mergeObjectAsync(r,a):$e.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Z?new fa({keyType:e,valueType:r,typeName:N.ZodRecord,...j(n)}):new fa({keyType:Wt.create(),valueType:e,typeName:N.ZodRecord,...j(r)})}}class Sl extends Z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==A.map)return E(n,{code:x.invalid_type,expected:A.map,received:n.parsedType}),D;const a=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([s,c],l)=>({key:a._parse(new At(n,s,n.path,[l,"key"])),value:i._parse(new At(n,c,n.path,[l,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return D;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}})}else{const s=new Map;for(const c of o){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return D;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}}}}Sl.create=(t,e,r)=>new Sl({valueType:e,keyType:t,typeName:N.ZodMap,...j(r)});class En extends Z{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==A.set)return E(n,{code:x.invalid_type,expected:A.set,received:n.parsedType}),D;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(E(n,{code:x.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(E(n,{code:x.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function o(c){const l=new Set;for(const u of c){if(u.status==="aborted")return D;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}const s=[...n.data.values()].map((c,l)=>i._parse(new At(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,r){return new En({...this._def,minSize:{value:e,message:I.toString(r)}})}max(e,r){return new En({...this._def,maxSize:{value:e,message:I.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}En.create=(t,e)=>new En({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...j(e)});class Tl extends Z{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Tl.create=(t,e)=>new Tl({getter:t,typeName:N.ZodLazy,...j(e)});class Ri extends Z{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return E(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),D}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ri.create=(t,e)=>new Ri({value:t,typeName:N.ZodLiteral,...j(e)});function El(t,e){return new Zr({values:t,typeName:N.ZodEnum,...j(e)})}class Zr extends Z{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return E(r,{expected:W.joinValues(n),received:r.parsedType,code:x.invalid_type}),D}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return E(r,{received:r.data,code:x.invalid_enum_value,options:n}),D}return st(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Zr.create(e,{...this._def,...r})}exclude(e,r=this._def){return Zr.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Zr.create=El;class Cl extends Z{_parse(e){const r=W.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==A.string&&n.parsedType!==A.number){const a=W.objectValues(r);return E(n,{expected:W.joinValues(a),received:n.parsedType,code:x.invalid_type}),D}if(this._cache||(this._cache=new Set(W.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=W.objectValues(r);return E(n,{received:n.data,code:x.invalid_enum_value,options:a}),D}return st(e.data)}get enum(){return this._def.values}}Cl.create=(t,e)=>new Cl({values:t,typeName:N.ZodNativeEnum,...j(e)});class pa extends Z{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==A.promise&&r.common.async===!1)return E(r,{code:x.invalid_type,expected:A.promise,received:r.parsedType}),D;const n=r.parsedType===A.promise?r.data:Promise.resolve(r.data);return st(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}pa.create=(t,e)=>new pa({type:t,typeName:N.ZodPromise,...j(e)});class Gr extends Z{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:o=>{E(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const o=a.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return D;const c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?D:c.status==="dirty"||r.value==="dirty"?Sn(c.value):c});{if(r.value==="aborted")return D;const s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?D:s.status==="dirty"||r.value==="dirty"?Sn(s.value):s}}if(a.type==="refinement"){const o=s=>{const c=a.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?D:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?D:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(a.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!qr(o))return D;const s=a.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>qr(o)?Promise.resolve(a.transform(o.value,i)).then(s=>({status:r.value,value:s})):D);W.assertNever(a)}}Gr.create=(t,e,r)=>new Gr({schema:t,typeName:N.ZodEffects,effect:e,...j(r)}),Gr.createWithPreprocess=(t,e,r)=>new Gr({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...j(r)});class lr extends Z{_parse(e){return this._getType(e)===A.undefined?st(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}lr.create=(t,e)=>new lr({innerType:t,typeName:N.ZodOptional,...j(e)});class Wr extends Z{_parse(e){return this._getType(e)===A.null?st(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Wr.create=(t,e)=>new Wr({innerType:t,typeName:N.ZodNullable,...j(e)});class Ii extends Z{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===A.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Ii.create=(t,e)=>new Ii({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...j(e)});class Li extends Z{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ca(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Gt(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Gt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Li.create=(t,e)=>new Li({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...j(e)});class Al extends Z{_parse(e){if(this._getType(e)!==A.nan){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:A.nan,received:n.parsedType}),D}return{status:"valid",value:e.data}}}Al.create=t=>new Al({typeName:N.ZodNaN,...j(t)});class uf extends Z{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Oi extends Z{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?D:i.status==="dirty"?(r.dirty(),Sn(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?D:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new Oi({in:e,out:r,typeName:N.ZodPipeline})}}class Mi extends Z{_parse(e){const r=this._def.innerType._parse(e),n=a=>(qr(a)&&(a.value=Object.freeze(a.value)),a);return ca(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}Mi.create=(t,e)=>new Mi({innerType:t,typeName:N.ZodReadonly,...j(e)});var N;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));const d=Wt.create,Ke=Vr.create,te=Ci.create;sr.create;const Ce=Rt.create,z=ue.create,Cn=da.create;ha.create,Cr.create;const lt=fa.create,df=Ri.create,Ar=Zr.create;pa.create,lr.create,Wr.create;var Pi={inherit:"inherit",current:"currentcolor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},yellow:{50:"oklch(98.7% 0.026 102.212)",100:"oklch(97.3% 0.071 103.193)",200:"oklch(94.5% 0.129 101.54)",300:"oklch(90.5% 0.182 98.111)",400:"oklch(85.2% 0.199 91.936)",500:"oklch(79.5% 0.184 86.047)",600:"oklch(68.1% 0.162 75.834)",700:"oklch(55.4% 0.135 66.442)",800:"oklch(47.6% 0.114 61.907)",900:"oklch(42.1% 0.095 57.708)",950:"oklch(28.6% 0.066 53.813)"},lime:{50:"oklch(98.6% 0.031 120.757)",100:"oklch(96.7% 0.067 122.328)",200:"oklch(93.8% 0.127 124.321)",300:"oklch(89.7% 0.196 126.665)",400:"oklch(84.1% 0.238 128.85)",500:"oklch(76.8% 0.233 130.85)",600:"oklch(64.8% 0.2 131.684)",700:"oklch(53.2% 0.157 131.589)",800:"oklch(45.3% 0.124 130.933)",900:"oklch(40.5% 0.101 131.063)",950:"oklch(27.4% 0.072 132.109)"},green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},emerald:{50:"oklch(97.9% 0.021 166.113)",100:"oklch(95% 0.052 163.051)",200:"oklch(90.5% 0.093 164.15)",300:"oklch(84.5% 0.143 164.978)",400:"oklch(76.5% 0.177 163.223)",500:"oklch(69.6% 0.17 162.48)",600:"oklch(59.6% 0.145 163.225)",700:"oklch(50.8% 0.118 165.612)",800:"oklch(43.2% 0.095 166.913)",900:"oklch(37.8% 0.077 168.94)",950:"oklch(26.2% 0.051 172.552)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},violet:{50:"oklch(96.9% 0.016 293.756)",100:"oklch(94.3% 0.029 294.588)",200:"oklch(89.4% 0.057 293.283)",300:"oklch(81.1% 0.111 293.571)",400:"oklch(70.2% 0.183 293.541)",500:"oklch(60.6% 0.25 292.717)",600:"oklch(54.1% 0.281 293.009)",700:"oklch(49.1% 0.27 292.581)",800:"oklch(43.2% 0.232 292.759)",900:"oklch(38% 0.189 293.745)",950:"oklch(28.3% 0.141 291.089)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},fuchsia:{50:"oklch(97.7% 0.017 320.058)",100:"oklch(95.2% 0.037 318.852)",200:"oklch(90.3% 0.076 319.62)",300:"oklch(83.3% 0.145 321.434)",400:"oklch(74% 0.238 322.16)",500:"oklch(66.7% 0.295 322.15)",600:"oklch(59.1% 0.293 322.896)",700:"oklch(51.8% 0.253 323.949)",800:"oklch(45.2% 0.211 324.591)",900:"oklch(40.1% 0.17 325.612)",950:"oklch(29.3% 0.136 325.661)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"}};const ze=z({minRem:Ke(),maxRem:Ke()}).or(d()),ga=z({0:d().optional(),50:d(),100:d(),200:d(),300:d(),400:d(),500:d(),600:d(),700:d(),800:d(),900:d(),950:d(),1e3:d().optional()}),Ni=z({color:d().optional(),background:d().optional(),borderWidth:d().optional(),borderColor:d().optional(),boxShadow:d().optional()}),hf=z({borderRadius:ze.optional(),custom:lt(d(),Cn([d(),Ke()])).optional(),hover:Ni.optional(),focus:Ni.optional()}).and(Ni),ff=z({family:d().optional()}),pf=lt(Ar(["predefinedQuestion","edit","newConversation","voteUp","voteDown","retry","message","messageLoading","thread","submit","abort","expand","help","attach","record","reward","share","audio","copy","dismiss","menu","info","menuClose","chevronDown","chevronUp","chevronTopDown","chevronDownSmall","internalLink","externalLink","liip","avatar","avatarLarge","openChat","speechInput","listUnordered","lightMode","darkMode","avatarLarge","settings","settingsClose","sources","model","checkbox","warning","headerLogo"]),d()),gf=z({font:ff.optional(),colors:z({brand:ga,accent:ga.optional(),highlight:ga,grey:ga}),base:z({fontSizeXs:ze.optional(),fontSizeSm:ze.optional(),fontSizeBody:ze.optional(),fontSizeH3:ze.optional(),fontSizeH2:ze.optional(),fontSizeH1:ze.optional(),fontWeightNormal:d().optional(),fontWeightBold:d().optional(),fontWeightTitle:d().optional(),lineHeightDefault:d().optional(),lineHeightSnug:d().optional(),lineHeightTight:d().optional(),borderRadius:ze.optional(),lineColor:d().optional(),boxShadow:d().optional()}),components:lt(d(),hf),svgs:pf}),ma=z({customCSS:d().optional(),fontCSS:d().optional(),fontURLs:d().array().optional(),tokens:gf});z({light:ma,dark:ma});const mf=z({light:ma,dark:ma}).deepPartial(),Rl=z({50:d(),100:d(),200:d(),300:d(),400:d(),500:d(),600:d(),700:d(),800:d(),900:d(),950:d()}),Il=Ar(["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]),Ll=Cn([Rl,Il]),vf=Cn([Rl.and(z({0:d(),1e3:d()})),Il]),Ol=z({avatarImageUrl:d().optional(),colors:z({brand:Ll.optional(),highlight:Ll.optional(),grey:vf.optional(),background:d().optional(),text:d().optional(),anchor:z({default:d().optional(),hover:d().optional()}).optional()}).optional(),font:z({family:d().optional(),urls:Ce(d()).optional(),sizeXs:ze.optional(),sizeSm:ze.optional(),sizeBody:ze.optional(),sizeH3:ze.optional(),sizeH2:ze.optional(),sizeH1:ze.optional(),weightNormal:d().optional(),weightBold:d().optional(),weightTitle:d().optional()}).optional(),borderRadius:ze.optional(),fineGrained:mf.optional()}),bf=z({blocked:d(),maintenance:d(),"rate-limit":d(),"server-error":d(),"too-short":d(),"too-long":d(),"quota-reached":d(),aborted:d(),"sse-error":d(),"client-error":d(),"unexpected-call":d(),"incomplete-error":d(),"feedback-failed":d(),"speech-not-supported":d(),"speech-transcription-failed":d(),"speech-no-text-detected":d(),"speech-microphone-access-denied":d(),"pii-detected":d()}),kf=z({email:d(),creditCard:d(),ahv:d(),phoneSwiss:d(),phoneInternational:d(),swissPassport:d(),longNumber:d()}),Ml=z({name:d(),namePlural:d().optional(),intro:d().optional(),placeholder:d(),values:lt(d(),d())}),yf=z({action:d(),label:d(),type:Ar(["primary","secondary"]).optional()}),wf=z({hash:d(),title:d(),content:d(),actions:Ce(yf).optional()}),Pl=z({introductionTitle:d(),introductionDisclaimer:d().optional(),termsInvitationToConsent:d().optional(),chatInputPlaceholder:d(),chatInputPlaceholderListening:d().optional(),chatInputSubmit:d(),chatInputAbort:d(),chatInputStartListening:d(),chatInputStopListening:d(),referenceLink:d(),referencesDisplay:d(),referencesHide:d(),referencesTitle:d(),referencesFurtherTitle:d(),newChat:d(),maintenanceModeError:d(),messageBotLoading:d(),messageBotError:d(),messageBotDefaultError:d(),noResultsFound:d(),chatFooterText:d().optional(),scrollToBottom:d(),openButtonTitle:d().optional(),openButtonDescription:d().optional(),openMenu:d(),openInfo:d(),aboutThisChat:d().optional(),closeMenu:d(),closeChat:d(),close:d(),send:d(),thankYouForFeedback:d(),giveFeedback:d(),sendFeedback:d(),feedbackFormTitle:d(),feedbackFormMessage:d(),feedbackFormMessagePlaceholder:d(),feedbackFormEmail:d(),feedbackFormEmailPlaceholder:d(),askQuestionAgain:d(),answerGood:d(),answerBad:d(),classificationSubmit:d(),classificationThankYou:d(),classificationTitle:d(),selectLanguage:d(),languageChanged:d(),selectColorTheme:d(),lightMode:d(),darkMode:d(),ariaMainNavigation:d(),ariaMainNavigationRegion:d(),ariaGotoMainNavigation:d(),ariaAskQuestion:d(),ariaAskQuestionRegion:d(),ariaNotifications:d(),ariaPredefinedQuestions:d(),ariaPredefinedQuestionsRegion:d(),ariaChatHistory:d(),ariaOpenChat:d(),ariaQuestionFromYou:d(),ariaAnswerFromBot:d(),ariaLastAnswerNavigation:d(),ariaQuestionSent:d(),ariaAnswerReady:d(),ariaAnswerFinished:d(),ariaAskQuestionAgain:d(),ariaAnswerGood:d(),ariaAnswerBad:d(),ariaReferenceSource:d(),ariaGiveFeedback:d(),ariaLanguageChanged:d(),ariaLightSelected:d(),ariaDarkSelected:d(),ariaSettings:d(),ariaSettingsRegion:d(),ariaReferencesRegion:d(),ariaFlyoutRegion:d(),ariaSelected:d(),ariaUnselected:d(),ariaAllSelected:d(),ariaAllUnselected:d(),ariaAllReseted:d(),popups:Ce(wf).optional(),termsAcceptButton:d().optional(),termsReadButton:d().optional(),selectors:lt(d(),Ml).optional(),hideSettings:d(),showSettings:d(),chooseAtLeastOneOption:d(),selectAll:d(),selectNone:d(),resetToDefaults:d(),messageTooLong:d()}),Qr=Ar(["en","de","fr","it"]),Nl=lt(Qr,Pl.partial().extend({selectors:lt(d(),Ml).optional()}));lt(Qr,bf),lt(Qr,kf);const Dl=z({label:d(),options:Ce(z({label:d(),value:Ke()}))}),_f=z({label:d(),icon:d(),url:d(),target:Ar(["_blank","_self"]).optional()}),xf=z({label:d().nullable(),question:d()}),$l=z({impact:Dl.optional(),quality:Dl.optional()});z({classification:$l.optional()});const Sf=z({predefinedQuestions:Ce(xf)}),zl=Cn([z({maintenance:df(!0)}),z({id:d(),cID:d()})]);lt(Qr,Pl);const Tf=z({settingName:d(),iconName:d(),settingIntro:d().optional(),type:Ar(["single-select","multi-select"]),allowEmpty:te(),values:Ce(d()),defaultValues:Ce(d()).optional()}),Fl=z({showPredefinedQuestions:te(),showOverallFeedbackButton:te(),showOverallFeedbackEmail:te(),showCloseChatButton:te(),showContextMenu:te(),showContextInfo:te(),showReferencesByDefault:te(),showExpandedSelectors:te(),showTextFeedback:te(),inlineLayout:te(),allowAudioInput:te(),blockPII:te(),questionPrefix:d(),menu:lt(Qr,Ce(_f)).optional(),supportedLanguages:Ce(Qr),classification:$l.optional(),theme:Ol,translations:Nl,buttonHref:d().optional(),addQueryToUrlParams:te().optional(),addRetrievalQuestionToUrlParams:te().optional(),renderKatex:te().optional(),reflectLanguageInPath:te().optional(),sendReferrer:Ar(["all","own","none","location"]).optional(),selectorsConfig:Ce(Tf).default([]),questionLengthLimit:Ke().optional(),forceConsent:te().optional(),askQuestionAgain:te(),enableBackdrop:te().optional()}).partial().and(z({theme:z({name:d().optional()}).optional()}));class Ef{constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}id;async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,r){return this.chatResponseData.readableStore.subscribe(e,r)}getContent(){return this.chatResponseData.content.toPromise()}abort(){return this.chatResponseData.abort()}async thumbsUp(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsUp(this.id,this.chatResponseData.question)}async thumbsDown(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsDown(this.id,this.chatResponseData.question)}async feedback(e){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.feedback(this.id,this.chatResponseData.question,e)}}const Te=[];for(let t=0;t<256;++t)Te.push((t+256).toString(16).slice(1));function Cf(t,e=0){return(Te[t[e+0]]+Te[t[e+1]]+Te[t[e+2]]+Te[t[e+3]]+"-"+Te[t[e+4]]+Te[t[e+5]]+"-"+Te[t[e+6]]+Te[t[e+7]]+"-"+Te[t[e+8]]+Te[t[e+9]]+"-"+Te[t[e+10]]+Te[t[e+11]]+Te[t[e+12]]+Te[t[e+13]]+Te[t[e+14]]+Te[t[e+15]]).toLowerCase()}let Di;const Af=new Uint8Array(16);function Rf(){if(!Di){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Di=crypto.getRandomValues.bind(crypto)}return Di(Af)}const Bl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function If(t,e,r){t=t||{};const n=t.random??t.rng?.()??Rf();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Cf(n)}function jl(t,e,r){return Bl.randomUUID&&!t?Bl.randomUUID():If(t)}const Yr=new Map;class Lf{get length(){return Yr.size}clear(){Yr.clear()}getItem(e){return Yr.get(e)||null}key(e){return Array.from(Yr.keys())[e]||null}removeItem(e){Yr.delete(e)}setItem(e,r){Yr.set(e,String(r))}}const vt=globalThis.localStorage??new Lf,Of=async t=>{try{const e=vt.getItem("liipgpt:uID")||vt.getItem("uID"),r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:e})},n=await t.fetchData("/login",zl,{},r).catch(a=>(console.log("Failed to /login use /log",a),t.fetchData("/log",zl,{},r)));if("maintenance"in n&&n.maintenance)return{mode:"maintenance"};if(!("id"in n))throw new Error("Invalid response format: missing user id");return vt.setItem("liipgpt:uID",n.id),{mode:"ready",userId:n.id}}catch(e){throw console.error("Failed to fetch user data:",e),e}};var Xe=function(t,e){if(!(this instanceof Xe))return new Xe(t,e);this.url=t,e=e||{},this.headers=e.headers||{},this.payload=e.payload!==void 0?e.payload:"",this.method=e.method||this.payload&&"POST"||"GET",this.withCredentials=!!e.withCredentials,this.debug=!!e.debug,this.autoReconnect=e.autoReconnect!==void 0?e.autoReconnect:!1,this.reconnectDelay=e.reconnectDelay!==void 0?e.reconnectDelay:3e3,this.maxRetries=e.maxRetries!==void 0?e.maxRetries:null,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=e.useLastEventId!==void 0?e.useLastEventId:!0,this.FIELD_SEPARATOR=":",this.listeners={},this.xhr=null,this.readyState=Xe.INITIALIZING,this.progress=0,this.chunk="",this.lastEventId="",this.addEventListener=function(r,n){this.listeners[r]===void 0&&(this.listeners[r]=[]),this.listeners[r].indexOf(n)===-1&&this.listeners[r].push(n)},this.removeEventListener=function(r,n){if(this.listeners[r]===void 0)return;const a=[];this.listeners[r].forEach(function(i){i!==n&&a.push(i)}),a.length===0?delete this.listeners[r]:this.listeners[r]=a},this.dispatchEvent=function(r){if(!r)return!0;this.debug&&console.debug(r),r.source=this;const n="on"+r.type;return this.hasOwnProperty(n)&&(this[n].call(this,r),r.defaultPrevented)?!1:this.listeners[r.type]?this.listeners[r.type].every(function(a){return a(r),!r.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk="",this._setReadyState(Xe.CLOSED),this.autoReconnect){if(this.maxRetries!==null&&this.retryCount>=this.maxRetries){this.debug&&console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`),this.autoReconnect=!1,this.close();return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.debug&&console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount+1}${this.maxRetries?"/"+this.maxRetries:""})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryCount++,this.stream()},this.reconnectDelay)}},this._setReadyState=function(r){const n=new CustomEvent("readystatechange");n.readyState=r,this.readyState=r,this.dispatchEvent(n)},this._onStreamFailure=function(r){const n=new CustomEvent("error");n.responseCode=r.currentTarget.status,n.data=r.currentTarget.response,this.dispatchEvent(n),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent("abort")),this._markClosed()},this._onStreamProgress=function(r){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(r);return}this.retryCount=0;const n=this.xhr.responseText.substring(this.progress);this.progress+=n.length;const a=(this.chunk+n).split(/(\r\n\r\n|\r\r|\n\n)/g),i=a.pop();a.forEach((function(o){o.trim().length>0&&this.dispatchEvent(this._parseEventChunk(o))}).bind(this)),this.chunk=i},this._onStreamLoaded=function(r){this._onStreamProgress(r),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk="",this._markClosed()},this._parseEventChunk=function(r){if(!r||r.length===0)return null;this.debug&&console.debug(r);const n={id:null,retry:null,data:null,event:null};if(r.split(/\n|\r\n|\r/).forEach((function(i){const o=i.indexOf(this.FIELD_SEPARATOR);let s,c;if(o>0){const l=i[o+1]===" "?2:1;s=i.substring(0,o),c=i.substring(o+l)}else if(o<0)s=i,c="";else return;s in n&&(s==="data"&&n[s]!==null?n.data+=`
70
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Rt(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){const n=this.parser.parseInline(r),a=ml(t);if(a===null)return n;t=a;let i='<a href="'+t+'"';return e&&(i+=' title="'+Rt(e)+'"'),i+=">"+n+"</a>",i}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));const a=ml(t);if(a===null)return Rt(r);t=a;let i=`<img src="${t}" alt="${r}"`;return e&&(i+=` title="${Rt(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Rt(t.text)}},Ii=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Wt=class yo{options;renderer;textRenderer;constructor(e){this.options=e||Rr,this.options.renderer=this.options.renderer||new ua,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ii}static parse(e,r){return new yo(r).parse(e)}static parseInline(e,r){return new yo(r).parseInline(e)}parse(e,r=!0){let n="";for(let a=0;a<e.length;a++){const i=e[a];if(this.options.extensions?.renderers?.[i.type]){const s=i,c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){n+=c||"";continue}}const o=i;switch(o.type){case"space":{n+=this.renderer.space(o);continue}case"hr":{n+=this.renderer.hr(o);continue}case"heading":{n+=this.renderer.heading(o);continue}case"code":{n+=this.renderer.code(o);continue}case"table":{n+=this.renderer.table(o);continue}case"blockquote":{n+=this.renderer.blockquote(o);continue}case"list":{n+=this.renderer.list(o);continue}case"html":{n+=this.renderer.html(o);continue}case"paragraph":{n+=this.renderer.paragraph(o);continue}case"text":{let s=o,c=this.renderer.text(s);for(;a+1<e.length&&e[a+1].type==="text";)s=e[++a],c+=`
71
+ `+this.renderer.text(s);r?n+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):n+=c;continue}default:{const s='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}parseInline(e,r=this.renderer){let n="";for(let a=0;a<e.length;a++){const i=e[a];if(this.options.extensions?.renderers?.[i.type]){const s=this.options.extensions.renderers[i.type].call({parser:this},i);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=s||"";continue}}const o=i;switch(o.type){case"escape":{n+=r.text(o);break}case"html":{n+=r.html(o);break}case"link":{n+=r.link(o);break}case"image":{n+=r.image(o);break}case"strong":{n+=r.strong(o);break}case"em":{n+=r.em(o);break}case"codespan":{n+=r.codespan(o);break}case"br":{n+=r.br(o);break}case"del":{n+=r.del(o);break}case"text":{n+=r.text(o);break}default:{const s='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}},da=class{options;block;constructor(t){this.options=t||Rr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Gt.lex:Gt.lexInline}provideParser(){return this.block?Wt.parse:Wt.parseInline}},kl=class{defaults=wi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Wt;Renderer=ua;TextRenderer=Ii;Lexer=Gt;Tokenizer=ca;Hooks=da;constructor(...t){this.use(...t)}walkTokens(t,e){let r=[];for(const n of t)switch(r=r.concat(e.call(this,n)),n.type){case"table":{const a=n;for(const i of a.header)r=r.concat(this.walkTokens(i.tokens,e));for(const i of a.rows)for(const o of i)r=r.concat(this.walkTokens(o.tokens,e));break}case"list":{const a=n;r=r.concat(this.walkTokens(a.items,e));break}default:{const a=n;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(i=>{const o=a[i].flat(1/0);r=r.concat(this.walkTokens(o,e))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,e)))}}return r}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){const i=e.renderers[a.name];i?e.renderers[a.name]=function(...o){let s=a.renderer.apply(this,o);return s===!1&&(s=i.apply(this,o)),s}:e.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[a.level];i?i.unshift(a.tokenizer):e[a.level]=[a.tokenizer],a.start&&(a.level==="block"?e.startBlock?e.startBlock.push(a.start):e.startBlock=[a.start]:a.level==="inline"&&(e.startInline?e.startInline.push(a.start):e.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(e.childTokens[a.name]=a.childTokens)}),n.extensions=e),r.renderer){const a=this.defaults.renderer||new ua(this.defaults);for(const i in r.renderer){if(!(i in a))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const o=i,s=r.renderer[o],c=a[o];a[o]=(...l)=>{let d=s.apply(a,l);return d===!1&&(d=c.apply(a,l)),d||""}}n.renderer=a}if(r.tokenizer){const a=this.defaults.tokenizer||new ca(this.defaults);for(const i in r.tokenizer){if(!(i in a))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const o=i,s=r.tokenizer[o],c=a[o];a[o]=(...l)=>{let d=s.apply(a,l);return d===!1&&(d=c.apply(a,l)),d}}n.tokenizer=a}if(r.hooks){const a=this.defaults.hooks||new da;for(const i in r.hooks){if(!(i in a))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const o=i,s=r.hooks[o],c=a[o];da.passThroughHooks.has(i)?a[o]=l=>{if(this.defaults.async)return Promise.resolve(s.call(a,l)).then(p=>c.call(a,p));const d=s.call(a,l);return c.call(a,d)}:a[o]=(...l)=>{let d=s.apply(a,l);return d===!1&&(d=c.apply(a,l)),d}}n.hooks=a}if(r.walkTokens){const a=this.defaults.walkTokens,i=r.walkTokens;n.walkTokens=function(o){let s=[];return s.push(i.call(this,o)),a&&(s=s.concat(a.call(this,o))),s}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Gt.lex(t,e??this.defaults)}parser(t,e){return Wt.parse(t,e??this.defaults)}parseMarkdown(t){return(r,n)=>{const a={...n},i={...this.defaults,...a},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&a.async===!1)return o(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 r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=t);const s=i.hooks?i.hooks.provideLexer():t?Gt.lex:Gt.lexInline,c=i.hooks?i.hooks.provideParser():t?Wt.parse:Wt.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(r):r).then(l=>s(l,i)).then(l=>i.hooks?i.hooks.processAllTokens(l):l).then(l=>i.walkTokens?Promise.all(this.walkTokens(l,i.walkTokens)).then(()=>l):l).then(l=>c(l,i)).then(l=>i.hooks?i.hooks.postprocess(l):l).catch(o);try{i.hooks&&(r=i.hooks.preprocess(r));let l=s(r,i);i.hooks&&(l=i.hooks.processAllTokens(l)),i.walkTokens&&this.walkTokens(l,i.walkTokens);let d=c(l,i);return i.hooks&&(d=i.hooks.postprocess(d)),d}catch(l){return o(l)}}}onError(t,e){return r=>{if(r.message+=`
72
+ Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+Rt(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Ir=new kl;function X(t,e){return Ir.parse(t,e)}X.options=X.setOptions=function(t){return Ir.setOptions(t),X.defaults=Ir.defaults,nl(X.defaults),X},X.getDefaults=wi,X.defaults=Rr,X.use=function(...t){return Ir.use(...t),X.defaults=Ir.defaults,nl(X.defaults),X},X.walkTokens=function(t,e){return Ir.walkTokens(t,e)},X.parseInline=Ir.parseInline,X.Parser=Wt,X.parser=Wt.parse,X.Renderer=ua,X.TextRenderer=Ii,X.Lexer=Gt,X.lexer=Gt.lex,X.Tokenizer=ca,X.Hooks=da,X.parse=X,X.options,X.setOptions,X.use,X.walkTokens,X.parseInline,Wt.parse,Gt.lex;const yl=t=>(Object.getOwnPropertyNames(t).forEach(e=>{const r=t[e];r&&typeof r=="object"&&yl(r)}),Object.freeze(t)),wl=yl({all:[],used:[],unused:[]}),qh=t=>{const e=sh(t);return e.addHook("uponSanitizeElement",function(r,n){const a=n.tagName||r.nodeName.toLowerCase();a.startsWith("liipgpt-")&&(n.allowedTags[a]=!0)}),e};class _l{marked;currentReferences=wl;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new kl({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=qh(e.window)}createFootnoteExtension=()=>{const e=this;return{extensions:[{name:"footnote",level:"inline",start(r){return r.match(/\[\^(\d+)\]/)?.index},tokenizer(r){const a=/^\[\^(\d+)\]/.exec(r);if(a){const[i,o]=a;return{type:"footnote",raw:i,refNumber:o}}},renderer(r){if(r.type==="footnote"){const n=parseInt(r.refNumber)-1,a=e.currentReferences.all[n];if(!a)return console.error("Could not find ref with index:",n),"";let i;return a?.referenceIndex.used?i=a.referenceIndex.used:(e.currentReferences.used.push(a),e.lastUsedIndex++,i=e.lastUsedIndex,a.referenceIndex.used=i),` <liipgpt-reference-number data-all-index="${n}" data-used-index="${i}" data-source="${JSON.stringify(a).replace(/"/g,"&quot;")}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:["hr"]})}toHTML(e,r){this.currentReferences=r;const n=this.parse(e);return this.currentReferences=wl,n}}function Vh(){let t,e;return{promise:new Promise((n,a)=>{e=n,t=a}),reject:t,resolve:e}}class xl{promise;resolve;reject;constructor(){const{promise:e,resolve:r,reject:n}=Vh();this.promise=e,this.resolve=r,this.reject=n}then(e,r){return this.promise.then(e,r)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]="Flag"}class Li{hasValue=new xl;currentValue;setValue(e){this.currentValue=e,this.hasValue.resolve()}cleanup(e){this.hasValue.reject(e)}getCurrentValue(){return this.currentValue}async toPromise(){return await this.hasValue,this.currentValue}then(e,r){return this.toPromise().then(e,r)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]="FutureValue"}const Hh=t=>{try{return new URL(t).hostname}catch{return t}};function Zh(t){return t.replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"')}const Gh=({url:t,considered:e,title:r,description:n,summary:a})=>{const i=Hh(t);return{url:t,considered:e,referenceIndex:{},score:0,metadata:{},display:{card:{title:r,description:n||a,badge:t},listItem:{title:r,badge:i}}}};class Wh{constructor(e){this.options=e,this.store=Ad({id:e.id,state:"loading",errors:[],type:"bot",time:new Date().toISOString(),message:{markdown:"",html:"",text:""},references:{all:[],used:[],unused:[]},retrievalQuestion:e.userQuestion})}store;content=new Li;backendSendsMappedRefs=!1;pushError(e){this.options.onError?.(e),this.store.update(r=>({...r,errors:[...r.errors,e]}))}updateRequestId(e){this.store.update(r=>({...r,id:e}))}updateText(e){this.store.update(r=>{const n=r.message.markdown+e,a=this.options.markdownRenderer.toHTML(n,r.references);return{...r,state:"streaming",message:{markdown:n,html:a,text:""}}})}finishMessage(){this.store.update(e=>{const r={...e,state:"done"};return r.references.unused=r.references.all.filter(n=>n.referenceIndex.used===void 0),r.message.text=Zh(r.message.html),this.options?.onFinish?.(r),this.content.setValue(r),r})}addReference(e){this.store.update(r=>{const n=r.references.all,a=n.length,i=[...n,{...e,referenceIndex:{all:a}}];return{...r,references:{used:r.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(Gh(e))}updateRetrievalQuestion(e){this.store.update(r=>({...r,retrievalQuestion:e}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}}var W;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const i={};for(const o of a)i[o]=o;return i},t.getValidEnumValues=a=>{const i=t.objectKeys(a).filter(s=>typeof a[a[s]]!="number"),o={};for(const s of i)o[s]=a[s];return t.objectValues(o)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},t.find=(a,i)=>{for(const o of a)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,i=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(W||(W={}));var Sl;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Sl||(Sl={}));const C=W.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dr=t=>{switch(typeof t){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(t)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(t)?C.array:t===null?C.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?C.promise:typeof Map<"u"&&t instanceof Map?C.map:typeof Set<"u"&&t instanceof Set?C.set:typeof Date<"u"&&t instanceof Date?C.date:C.object;default:return C.unknown}},x=W.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Qt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(i){return i.message},n={_errors:[]},a=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,c=0;for(;c<o.path.length;){const l=o.path[c];c===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return a(this),n}static assert(e){if(!(e instanceof Qt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,W.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];r[i]=r[i]||[],r[i].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Qt.create=t=>new Qt(t);const Oi=(t,e)=>{let r;switch(t.code){case x.invalid_type:t.received===C.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,W.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${W.joinValues(t.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${W.joinValues(t.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${W.joinValues(t.options)}, received '${t.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:W.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case x.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case x.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=e.defaultError,W.assertNever(t)}return{message:r}};let Qh=Oi;function Yh(){return Qh}const Kh=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,i=[...r,...a.path||[]],o={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let s="";const c=n.filter(l=>!!l).slice().reverse();for(const l of c)s=l(o,{data:e,defaultError:s}).message;return{...a,path:i,message:s}};function E(t,e){const r=Yh(),n=Kh({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Oi?void 0:Oi].filter(a=>!!a)});t.common.issues.push(n)}class ze{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return N;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const i=await a.key,o=await a.value;n.push({key:i,value:o})}return ze.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:i,value:o}=a;if(i.status==="aborted"||o.status==="aborted")return N;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}}const N=Object.freeze({status:"aborted"}),An=t=>({status:"dirty",value:t}),ct=t=>({status:"valid",value:t}),Tl=t=>t.status==="aborted",El=t=>t.status==="dirty",Yr=t=>t.status==="valid",ha=t=>typeof Promise<"u"&&t instanceof Promise;var L;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(L||(L={}));class It{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Cl=(t,e)=>{if(Yr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Qt(t.common.issues);return this._error=r,this._error}}};function F(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(o,s)=>{const{message:c}=t;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:a}}class Z{get description(){return this._def.description}_getType(e){return dr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:dr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ze,ctx:{common:e.parent.common,data:e.data,parsedType:dr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(ha(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Cl(n,a)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return Yr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Yr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(ha(a)?a:Promise.resolve(a));return Cl(n,i)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,i)=>{const o=e(a),s=()=>i.addIssue({code:x.custom,...n(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new Mr({schema:this,typeName:D.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Xt.create(this,this._def)}nullable(){return Pr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Lt.create(this)}promise(){return ba.create(this,this._def)}or(e){return pa.create([this,e],this._def)}and(e){return ga.create(this,e,this._def)}transform(e){return new Mr({...F(this._def),schema:this,typeName:D.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new ka({...F(this._def),innerType:this,defaultValue:r,typeName:D.ZodDefault})}brand(){return new $l({typeName:D.ZodBranded,type:this,...F(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new ya({...F(this._def),innerType:this,catchValue:r,typeName:D.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ji.create(this,e)}readonly(){return wa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Xh=/^c[^\s-]{8,}$/i,Jh=/^[0-9a-z]+$/,ef=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tf=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rf=/^[a-z0-9_-]{21}$/i,nf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,af=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,of=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Mi;const lf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,uf=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,df=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hf=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ff=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Al="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pf=new RegExp(`^${Al}$`);function Rl(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function gf(t){return new RegExp(`^${Rl(t)}$`)}function mf(t){let e=`${Al}T${Rl(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function vf(t,e){return!!((e==="v4"||!e)&&lf.test(t)||(e==="v6"||!e)&&uf.test(t))}function bf(t,e){if(!nf.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function kf(t,e){return!!((e==="v4"||!e)&&cf.test(t)||(e==="v6"||!e)&&df.test(t))}class Yt extends Z{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){const i=this._getOrReturnCtx(e);return E(i,{code:x.invalid_type,expected:C.string,received:i.parsedType}),N}const n=new ze;let a;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(a=this._getOrReturnCtx(e,a),o?E(a,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&E(a,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")of.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"email",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Mi||(Mi=new RegExp(sf,"u")),Mi.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"emoji",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")tf.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"uuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")rf.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"nanoid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Xh.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"cuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Jh.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"cuid2",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")ef.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"ulid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),E(a,{validation:"url",code:x.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"regex",code:x.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?mf(i).test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?pf.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?gf(i).test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{code:x.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?af.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"duration",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?vf(e.data,i.version)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"ip",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?bf(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"jwt",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?kf(e.data,i.version)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"cidr",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?hf.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"base64",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?ff.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"base64url",code:x.invalid_string,message:i.message}),n.dirty()):W.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:x.invalid_string,...L.errToObj(n)})}_addCheck(e){return new Yt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...L.errToObj(e)})}url(e){return this._addCheck({kind:"url",...L.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...L.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...L.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...L.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...L.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...L.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...L.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...L.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...L.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...L.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...L.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...L.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...L.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...L.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...L.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...L.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...L.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...L.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...L.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...L.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...L.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...L.errToObj(r)})}nonempty(e){return this.min(1,L.errToObj(e))}trim(){return new Yt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Yt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Yt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Yt.create=t=>new Yt({checks:[],typeName:D.ZodString,coerce:t?.coerce??!1,...F(t)});function yf(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,i=Number.parseInt(t.toFixed(a).replace(".","")),o=Number.parseInt(e.toFixed(a).replace(".",""));return i%o/10**a}class Kr extends Z{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){const i=this._getOrReturnCtx(e);return E(i,{code:x.invalid_type,expected:C.number,received:i.parsedType}),N}let n;const a=new ze;for(const i of this._def.checks)i.kind==="int"?W.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:x.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?yf(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:x.not_finite,message:i.message}),a.dirty()):W.assertNever(i);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,L.toString(r))}gt(e,r){return this.setLimit("min",e,!1,L.toString(r))}lte(e,r){return this.setLimit("max",e,!0,L.toString(r))}lt(e,r){return this.setLimit("max",e,!1,L.toString(r))}setLimit(e,r,n,a){return new Kr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:L.toString(a)}]})}_addCheck(e){return new Kr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:L.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:L.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:L.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:L.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:L.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:L.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:L.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:L.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:L.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&W.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Kr.create=t=>new Kr({checks:[],typeName:D.ZodNumber,coerce:t?.coerce||!1,...F(t)});class Rn extends Z{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let n;const a=new ze;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),E(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):W.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return E(r,{code:x.invalid_type,expected:C.bigint,received:r.parsedType}),N}gte(e,r){return this.setLimit("min",e,!0,L.toString(r))}gt(e,r){return this.setLimit("min",e,!1,L.toString(r))}lte(e,r){return this.setLimit("max",e,!0,L.toString(r))}lt(e,r){return this.setLimit("max",e,!1,L.toString(r))}setLimit(e,r,n,a){return new Rn({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:L.toString(a)}]})}_addCheck(e){return new Rn({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:L.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:L.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:L.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:L.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:L.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Rn.create=t=>new Rn({checks:[],typeName:D.ZodBigInt,coerce:t?.coerce??!1,...F(t)});class Pi extends Z{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:C.boolean,received:n.parsedType}),N}return ct(e.data)}}Pi.create=t=>new Pi({typeName:D.ZodBoolean,coerce:t?.coerce||!1,...F(t)});class fa extends Z{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){const i=this._getOrReturnCtx(e);return E(i,{code:x.invalid_type,expected:C.date,received:i.parsedType}),N}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return E(i,{code:x.invalid_date}),N}const n=new ze;let a;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:x.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:x.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):W.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new fa({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:L.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:L.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}fa.create=t=>new fa({checks:[],coerce:t?.coerce||!1,typeName:D.ZodDate,...F(t)});class Il extends Z{_parse(e){if(this._getType(e)!==C.symbol){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:C.symbol,received:n.parsedType}),N}return ct(e.data)}}Il.create=t=>new Il({typeName:D.ZodSymbol,...F(t)});class Ni extends Z{_parse(e){if(this._getType(e)!==C.undefined){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:C.undefined,received:n.parsedType}),N}return ct(e.data)}}Ni.create=t=>new Ni({typeName:D.ZodUndefined,...F(t)});class Di extends Z{_parse(e){if(this._getType(e)!==C.null){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:C.null,received:n.parsedType}),N}return ct(e.data)}}Di.create=t=>new Di({typeName:D.ZodNull,...F(t)});class Ll extends Z{constructor(){super(...arguments),this._any=!0}_parse(e){return ct(e.data)}}Ll.create=t=>new Ll({typeName:D.ZodAny,...F(t)});class Ol extends Z{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ct(e.data)}}Ol.create=t=>new Ol({typeName:D.ZodUnknown,...F(t)});class hr extends Z{_parse(e){const r=this._getOrReturnCtx(e);return E(r,{code:x.invalid_type,expected:C.never,received:r.parsedType}),N}}hr.create=t=>new hr({typeName:D.ZodNever,...F(t)});class Ml extends Z{_parse(e){if(this._getType(e)!==C.undefined){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:C.void,received:n.parsedType}),N}return ct(e.data)}}Ml.create=t=>new Ml({typeName:D.ZodVoid,...F(t)});class Lt extends Z{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==C.array)return E(r,{code:x.invalid_type,expected:C.array,received:r.parsedType}),N;if(a.exactLength!==null){const o=r.data.length>a.exactLength.value,s=r.data.length<a.exactLength.value;(o||s)&&(E(r,{code:o?x.too_big:x.too_small,minimum:s?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(E(r,{code:x.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(E(r,{code:x.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>a.type._parseAsync(new It(r,o,r.path,s)))).then(o=>ze.mergeArray(n,o));const i=[...r.data].map((o,s)=>a.type._parseSync(new It(r,o,r.path,s)));return ze.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new Lt({...this._def,minLength:{value:e,message:L.toString(r)}})}max(e,r){return new Lt({...this._def,maxLength:{value:e,message:L.toString(r)}})}length(e,r){return new Lt({...this._def,exactLength:{value:e,message:L.toString(r)}})}nonempty(e){return this.min(1,e)}}Lt.create=(t,e)=>new Lt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:D.ZodArray,...F(e)});function Xr(t){if(t instanceof de){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Xt.create(Xr(n))}return new de({...t._def,shape:()=>e})}else return t instanceof Lt?new Lt({...t._def,type:Xr(t.element)}):t instanceof Xt?Xt.create(Xr(t.unwrap())):t instanceof Pr?Pr.create(Xr(t.unwrap())):t instanceof Lr?Lr.create(t.items.map(e=>Xr(e))):t}class de extends Z{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=W.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==C.object){const l=this._getOrReturnCtx(e);return E(l,{code:x.invalid_type,expected:C.object,received:l.parsedType}),N}const{status:n,ctx:a}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof hr&&this._def.unknownKeys==="strip"))for(const l in a.data)o.includes(l)||s.push(l);const c=[];for(const l of o){const d=i[l],p=a.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new It(a,p,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof hr){const l=this._def.unknownKeys;if(l==="passthrough")for(const d of s)c.push({key:{status:"valid",value:d},value:{status:"valid",value:a.data[d]}});else if(l==="strict")s.length>0&&(E(a,{code:x.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const d of s){const p=a.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new It(a,p,a.path,d)),alwaysSet:d in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const l=[];for(const d of c){const p=await d.key,h=await d.value;l.push({key:p,value:h,alwaysSet:d.alwaysSet})}return l}).then(l=>ze.mergeObjectSync(n,l)):ze.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return L.errToObj,new de({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:L.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new de({...this._def,unknownKeys:"strip"})}passthrough(){return new de({...this._def,unknownKeys:"passthrough"})}extend(e){return new de({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new de({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:D.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new de({...this._def,catchall:e})}pick(e){const r={};for(const n of W.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new de({...this._def,shape:()=>r})}omit(e){const r={};for(const n of W.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new de({...this._def,shape:()=>r})}deepPartial(){return Xr(this)}partial(e){const r={};for(const n of W.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new de({...this._def,shape:()=>r})}required(e){const r={};for(const n of W.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Xt;)i=i._def.innerType;r[n]=i}return new de({...this._def,shape:()=>r})}keyof(){return Nl(W.objectKeys(this.shape))}}de.create=(t,e)=>new de({shape:()=>t,unknownKeys:"strip",catchall:hr.create(),typeName:D.ZodObject,...F(e)}),de.strictCreate=(t,e)=>new de({shape:()=>t,unknownKeys:"strict",catchall:hr.create(),typeName:D.ZodObject,...F(e)}),de.lazycreate=(t,e)=>new de({shape:t,unknownKeys:"strip",catchall:hr.create(),typeName:D.ZodObject,...F(e)});class pa extends Z{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(i){for(const s of i)if(s.result.status==="valid")return s.result;for(const s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(s=>new Qt(s.ctx.common.issues));return E(r,{code:x.invalid_union,unionErrors:o}),N}if(r.common.async)return Promise.all(n.map(async i=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(a);{let i;const o=[];for(const c of n){const l={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const s=o.map(c=>new Qt(c));return E(r,{code:x.invalid_union,unionErrors:s}),N}}get options(){return this._def.options}}pa.create=(t,e)=>new pa({options:t,typeName:D.ZodUnion,...F(e)});const Kt=t=>t instanceof Fi?Kt(t.schema):t instanceof Mr?Kt(t.innerType()):t instanceof va?[t.value]:t instanceof Or?t.options:t instanceof Bi?W.objectValues(t.enum):t instanceof ka?Kt(t._def.innerType):t instanceof Ni?[void 0]:t instanceof Di?[null]:t instanceof Xt?[void 0,...Kt(t.unwrap())]:t instanceof Pr?[null,...Kt(t.unwrap())]:t instanceof $l||t instanceof wa?Kt(t.unwrap()):t instanceof ya?Kt(t._def.innerType):[];class $i extends Z{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.object)return E(r,{code:x.invalid_type,expected:C.object,received:r.parsedType}),N;const n=this.discriminator,a=r.data[n],i=this.optionsMap.get(a);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(E(r,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),N)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const a=new Map;for(const i of r){const o=Kt(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of o){if(a.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,i)}}return new $i({typeName:D.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...F(n)})}}function zi(t,e){const r=dr(t),n=dr(e);if(t===e)return{valid:!0,data:t};if(r===C.object&&n===C.object){const a=W.objectKeys(e),i=W.objectKeys(t).filter(s=>a.indexOf(s)!==-1),o={...t,...e};for(const s of i){const c=zi(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(r===C.array&&n===C.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let i=0;i<t.length;i++){const o=t[i],s=e[i],c=zi(o,s);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===C.date&&n===C.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ga extends Z{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(i,o)=>{if(Tl(i)||Tl(o))return N;const s=zi(i.value,o.value);return s.valid?((El(i)||El(o))&&r.dirty(),{status:r.value,value:s.data}):(E(n,{code:x.invalid_intersection_types}),N)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,o])=>a(i,o)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ga.create=(t,e,r)=>new ga({left:t,right:e,typeName:D.ZodIntersection,...F(r)});class Lr extends Z{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.array)return E(n,{code:x.invalid_type,expected:C.array,received:n.parsedType}),N;if(n.data.length<this._def.items.length)return E(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),N;!this._def.rest&&n.data.length>this._def.items.length&&(E(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((o,s)=>{const c=this._def.items[s]||this._def.rest;return c?c._parse(new It(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>ze.mergeArray(r,o)):ze.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new Lr({...this._def,rest:e})}}Lr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Lr({items:t,typeName:D.ZodTuple,rest:null,...F(e)})};class ma extends Z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.object)return E(n,{code:x.invalid_type,expected:C.object,received:n.parsedType}),N;const a=[],i=this._def.keyType,o=this._def.valueType;for(const s in n.data)a.push({key:i._parse(new It(n,s,n.path,s)),value:o._parse(new It(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?ze.mergeObjectAsync(r,a):ze.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Z?new ma({keyType:e,valueType:r,typeName:D.ZodRecord,...F(n)}):new ma({keyType:Yt.create(),valueType:e,typeName:D.ZodRecord,...F(r)})}}class Pl extends Z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.map)return E(n,{code:x.invalid_type,expected:C.map,received:n.parsedType}),N;const a=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([s,c],l)=>({key:a._parse(new It(n,s,n.path,[l,"key"])),value:i._parse(new It(n,c,n.path,[l,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,d=await c.value;if(l.status==="aborted"||d.status==="aborted")return N;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),s.set(l.value,d.value)}return{status:r.value,value:s}})}else{const s=new Map;for(const c of o){const l=c.key,d=c.value;if(l.status==="aborted"||d.status==="aborted")return N;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),s.set(l.value,d.value)}return{status:r.value,value:s}}}}Pl.create=(t,e,r)=>new Pl({valueType:e,keyType:t,typeName:D.ZodMap,...F(r)});class In extends Z{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==C.set)return E(n,{code:x.invalid_type,expected:C.set,received:n.parsedType}),N;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(E(n,{code:x.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(E(n,{code:x.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function o(c){const l=new Set;for(const d of c){if(d.status==="aborted")return N;d.status==="dirty"&&r.dirty(),l.add(d.value)}return{status:r.value,value:l}}const s=[...n.data.values()].map((c,l)=>i._parse(new It(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,r){return new In({...this._def,minSize:{value:e,message:L.toString(r)}})}max(e,r){return new In({...this._def,maxSize:{value:e,message:L.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}In.create=(t,e)=>new In({valueType:t,minSize:null,maxSize:null,typeName:D.ZodSet,...F(e)});class Fi extends Z{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Fi.create=(t,e)=>new Fi({getter:t,typeName:D.ZodLazy,...F(e)});class va extends Z{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return E(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),N}return{status:"valid",value:e.data}}get value(){return this._def.value}}va.create=(t,e)=>new va({value:t,typeName:D.ZodLiteral,...F(e)});function Nl(t,e){return new Or({values:t,typeName:D.ZodEnum,...F(e)})}class Or extends Z{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return E(r,{expected:W.joinValues(n),received:r.parsedType,code:x.invalid_type}),N}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return E(r,{received:r.data,code:x.invalid_enum_value,options:n}),N}return ct(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Or.create(e,{...this._def,...r})}exclude(e,r=this._def){return Or.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Or.create=Nl;class Bi extends Z{_parse(e){const r=W.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==C.string&&n.parsedType!==C.number){const a=W.objectValues(r);return E(n,{expected:W.joinValues(a),received:n.parsedType,code:x.invalid_type}),N}if(this._cache||(this._cache=new Set(W.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=W.objectValues(r);return E(n,{received:n.data,code:x.invalid_enum_value,options:a}),N}return ct(e.data)}get enum(){return this._def.values}}Bi.create=(t,e)=>new Bi({values:t,typeName:D.ZodNativeEnum,...F(e)});class ba extends Z{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==C.promise&&r.common.async===!1)return E(r,{code:x.invalid_type,expected:C.promise,received:r.parsedType}),N;const n=r.parsedType===C.promise?r.data:Promise.resolve(r.data);return ct(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}ba.create=(t,e)=>new ba({type:t,typeName:D.ZodPromise,...F(e)});class Mr extends Z{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===D.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:o=>{E(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const o=a.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return N;const c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?N:c.status==="dirty"||r.value==="dirty"?An(c.value):c});{if(r.value==="aborted")return N;const s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?N:s.status==="dirty"||r.value==="dirty"?An(s.value):s}}if(a.type==="refinement"){const o=s=>{const c=a.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?N:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?N:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(a.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Yr(o))return N;const s=a.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Yr(o)?Promise.resolve(a.transform(o.value,i)).then(s=>({status:r.value,value:s})):N);W.assertNever(a)}}Mr.create=(t,e,r)=>new Mr({schema:t,typeName:D.ZodEffects,effect:e,...F(r)}),Mr.createWithPreprocess=(t,e,r)=>new Mr({schema:e,effect:{type:"preprocess",transform:t},typeName:D.ZodEffects,...F(r)});class Xt extends Z{_parse(e){return this._getType(e)===C.undefined?ct(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Xt.create=(t,e)=>new Xt({innerType:t,typeName:D.ZodOptional,...F(e)});class Pr extends Z{_parse(e){return this._getType(e)===C.null?ct(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pr.create=(t,e)=>new Pr({innerType:t,typeName:D.ZodNullable,...F(e)});class ka extends Z{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===C.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}ka.create=(t,e)=>new ka({innerType:t,typeName:D.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...F(e)});class ya extends Z{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ha(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Qt(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Qt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ya.create=(t,e)=>new ya({innerType:t,typeName:D.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...F(e)});class Dl extends Z{_parse(e){if(this._getType(e)!==C.nan){const n=this._getOrReturnCtx(e);return E(n,{code:x.invalid_type,expected:C.nan,received:n.parsedType}),N}return{status:"valid",value:e.data}}}Dl.create=t=>new Dl({typeName:D.ZodNaN,...F(t)});class $l extends Z{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class ji extends Z{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?N:i.status==="dirty"?(r.dirty(),An(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?N:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new ji({in:e,out:r,typeName:D.ZodPipeline})}}class wa extends Z{_parse(e){const r=this._def.innerType._parse(e),n=a=>(Yr(a)&&(a.value=Object.freeze(a.value)),a);return ha(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}wa.create=(t,e)=>new wa({innerType:t,typeName:D.ZodReadonly,...F(e)});var D;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(D||(D={}));const u=Yt.create,pe=Kr.create,K=Pi.create;hr.create;const J=Lt.create,R=de.create,Jt=pa.create,zl=$i.create;ga.create,Lr.create;const Je=ma.create,Fe=va.create,ut=Or.create;ba.create,Xt.create,Pr.create;const wf=Jt([u(),pe(),K(),J(u()),J(pe()),J(K())]),Ui=R({title:u(),description:u().optional(),badge:u().optional(),breadcrumbs:J(u()).optional(),previewImage:u().optional(),date:u().datetime().optional()}),_f=R({url:u().url(),score:pe(),metadata:Je(u(),wf),language:u().optional()}).merge(Ui),xf=R({componentName:Fe("buttons"),data:R({caption:u().optional(),buttons:J(R({label:u(),href:u().url().optional(),value:u(),variant:ut(["primary","secondary","tertiary"]).optional(),icon:u().optional(),target:u().optional()}))})}),Sf=R({componentName:Fe("combobox"),data:R({caption:u().optional(),placeholder:u(),values:J(R({label:u(),value:u()}))})}),Tf=R({componentName:Fe("alva-init"),data:R({enable:K()})}),Ef=R({componentName:Fe("alva-score-survey"),data:R({enable:K()})}),Cf=R({type:Fe("component"),time:u(),id:u().optional(),hideAvatar:K().optional()}),Af=zl("componentName",[xf,Sf,Tf,Ef]).and(Cf);ut(["start","chat"]),zl("name",[R({name:Fe("start-page"),prefill:u().optional()}),R({name:Fe("consent-page")}),R({name:Fe("chat-page"),query:u()})]);const Rf=R({type:Fe("user"),time:u(),message:u(),id:u().optional()});ut(["idle","searching","answering"]);const If=Jt([u(),pe(),K(),J(u()),J(pe()),J(K())]),qi=R({url:u(),score:pe(),metadata:Je(u(),If),considered:K(),display:R({card:Ui,listItem:Ui})}).extend({referenceIndex:R({all:pe(),used:pe().optional()})}),Lf=R({all:J(qi),used:J(qi),unused:J(qi)}),Of=ut(["pii-detected","blocked","maintenance","rate-limit","server-error","too-short","too-long","quota-reached","aborted"]),Mf=Jt([Of,Fe("sse-error"),Fe("client-error"),Fe("unexpected-call")]),Fl=R({type:Fe("bot"),time:u(),id:u(),message:R({markdown:u(),html:u(),text:u()}),references:Lf,errors:J(Mf),retrievalQuestion:u().optional()}),Pf=Fl.extend({state:ut(["streaming","done"])}),Nf=Fl.extend({state:Fe("loading")}),Df=Jt([Nf,Pf]),Vi=Jt([Df,Rf,Af]);var Hi={inherit:"inherit",current:"currentcolor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},yellow:{50:"oklch(98.7% 0.026 102.212)",100:"oklch(97.3% 0.071 103.193)",200:"oklch(94.5% 0.129 101.54)",300:"oklch(90.5% 0.182 98.111)",400:"oklch(85.2% 0.199 91.936)",500:"oklch(79.5% 0.184 86.047)",600:"oklch(68.1% 0.162 75.834)",700:"oklch(55.4% 0.135 66.442)",800:"oklch(47.6% 0.114 61.907)",900:"oklch(42.1% 0.095 57.708)",950:"oklch(28.6% 0.066 53.813)"},lime:{50:"oklch(98.6% 0.031 120.757)",100:"oklch(96.7% 0.067 122.328)",200:"oklch(93.8% 0.127 124.321)",300:"oklch(89.7% 0.196 126.665)",400:"oklch(84.1% 0.238 128.85)",500:"oklch(76.8% 0.233 130.85)",600:"oklch(64.8% 0.2 131.684)",700:"oklch(53.2% 0.157 131.589)",800:"oklch(45.3% 0.124 130.933)",900:"oklch(40.5% 0.101 131.063)",950:"oklch(27.4% 0.072 132.109)"},green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},emerald:{50:"oklch(97.9% 0.021 166.113)",100:"oklch(95% 0.052 163.051)",200:"oklch(90.5% 0.093 164.15)",300:"oklch(84.5% 0.143 164.978)",400:"oklch(76.5% 0.177 163.223)",500:"oklch(69.6% 0.17 162.48)",600:"oklch(59.6% 0.145 163.225)",700:"oklch(50.8% 0.118 165.612)",800:"oklch(43.2% 0.095 166.913)",900:"oklch(37.8% 0.077 168.94)",950:"oklch(26.2% 0.051 172.552)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},violet:{50:"oklch(96.9% 0.016 293.756)",100:"oklch(94.3% 0.029 294.588)",200:"oklch(89.4% 0.057 293.283)",300:"oklch(81.1% 0.111 293.571)",400:"oklch(70.2% 0.183 293.541)",500:"oklch(60.6% 0.25 292.717)",600:"oklch(54.1% 0.281 293.009)",700:"oklch(49.1% 0.27 292.581)",800:"oklch(43.2% 0.232 292.759)",900:"oklch(38% 0.189 293.745)",950:"oklch(28.3% 0.141 291.089)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},fuchsia:{50:"oklch(97.7% 0.017 320.058)",100:"oklch(95.2% 0.037 318.852)",200:"oklch(90.3% 0.076 319.62)",300:"oklch(83.3% 0.145 321.434)",400:"oklch(74% 0.238 322.16)",500:"oklch(66.7% 0.295 322.15)",600:"oklch(59.1% 0.293 322.896)",700:"oklch(51.8% 0.253 323.949)",800:"oklch(45.2% 0.211 324.591)",900:"oklch(40.1% 0.17 325.612)",950:"oklch(29.3% 0.136 325.661)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"}};const Be=R({minRem:pe(),maxRem:pe()}).or(u()),_a=R({0:u().optional(),50:u(),100:u(),200:u(),300:u(),400:u(),500:u(),600:u(),700:u(),800:u(),900:u(),950:u(),1e3:u().optional()}),Zi=R({color:u().optional(),background:u().optional(),borderWidth:u().optional(),borderColor:u().optional(),boxShadow:u().optional()}),$f=R({borderRadius:Be.optional(),custom:Je(u(),Jt([u(),pe()])).optional(),hover:Zi.optional(),focus:Zi.optional()}).and(Zi),zf=R({family:u().optional()}),Ff=Je(ut(["predefinedQuestion","edit","newConversation","voteUp","voteDown","retry","message","messageLoading","thread","submit","abort","expand","help","attach","record","reward","share","audio","copy","dismiss","menu","info","menuClose","chevronDown","chevronUp","chevronTopDown","chevronDownSmall","internalLink","externalLink","liip","avatar","avatarLarge","openChat","speechInput","listUnordered","lightMode","darkMode","avatarLarge","settings","settingsClose","sources","model","checkbox","warning","headerLogo","embedAvatar"]),u()),Bf=R({font:zf.optional(),colors:R({brand:_a,accent:_a.optional(),highlight:_a,grey:_a}),base:R({fontSizeXs:Be.optional(),fontSizeSm:Be.optional(),fontSizeBody:Be.optional(),fontSizeH3:Be.optional(),fontSizeH2:Be.optional(),fontSizeH1:Be.optional(),fontWeightNormal:u().optional(),fontWeightBold:u().optional(),fontWeightTitle:u().optional(),lineHeightDefault:u().optional(),lineHeightSnug:u().optional(),lineHeightTight:u().optional(),borderRadius:Be.optional(),lineColor:u().optional(),boxShadow:u().optional()}),components:Je(u(),$f),svgs:Ff}),xa=R({customCSS:u().optional(),fontCSS:u().optional(),fontURLs:u().array().optional(),tokens:Bf});R({light:xa,dark:xa});const jf=R({light:xa,dark:xa}).deepPartial(),Bl=R({50:u(),100:u(),200:u(),300:u(),400:u(),500:u(),600:u(),700:u(),800:u(),900:u(),950:u()}),jl=ut(["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]),Ul=Jt([Bl,jl]),Uf=Jt([Bl.and(R({0:u(),1e3:u()})),jl]),ql=R({avatarImageUrl:u().optional(),colors:R({brand:Ul.optional(),highlight:Ul.optional(),grey:Uf.optional(),background:u().optional(),text:u().optional(),anchor:R({default:u().optional(),hover:u().optional()}).optional()}).optional(),font:R({family:u().optional(),urls:J(u()).optional(),sizeXs:Be.optional(),sizeSm:Be.optional(),sizeBody:Be.optional(),sizeH3:Be.optional(),sizeH2:Be.optional(),sizeH1:Be.optional(),weightNormal:u().optional(),weightBold:u().optional(),weightTitle:u().optional()}).optional(),borderRadius:Be.optional(),fineGrained:jf.optional()}),qf=R({blocked:u(),maintenance:u(),"rate-limit":u(),"server-error":u(),"too-short":u(),"too-long":u(),"quota-reached":u(),aborted:u(),"sse-error":u(),"client-error":u(),"unexpected-call":u(),"incomplete-error":u(),"feedback-failed":u(),"speech-not-supported":u(),"speech-transcription-failed":u(),"speech-no-text-detected":u(),"speech-microphone-access-denied":u(),"pii-detected":u()}),Vf=R({email:u(),creditCard:u(),ahv:u(),phoneSwiss:u(),phoneInternational:u(),swissPassport:u(),longNumber:u()}),Vl=R({name:u(),namePlural:u().optional(),intro:u().optional(),placeholder:u(),values:Je(u(),u())}),Hf=R({action:u(),label:u(),type:ut(["primary","secondary"]).optional()}),Zf=R({hash:u(),title:u(),content:u(),actions:J(Hf).optional()}),Hl=R({introductionTitle:u(),introductionDisclaimer:u().optional(),termsInvitationToConsent:u().optional(),chatInputPlaceholder:u(),chatInputPlaceholderListening:u().optional(),chatInputSubmit:u(),chatInputAbort:u(),chatInputStartListening:u(),chatInputStopListening:u(),referenceLink:u(),referencesDisplay:u(),referencesHide:u(),referencesTitle:u(),referencesFurtherTitle:u(),newChat:u(),maintenanceModeError:u(),messageBotLoading:u(),messageBotError:u(),messageBotDefaultError:u(),noResultsFound:u(),chatFooterText:u().optional(),scrollToBottom:u(),openButtonTitle:u().optional(),openButtonDescription:u().optional(),openMenu:u(),openInfo:u(),aboutThisChat:u().optional(),closeMenu:u(),closeChat:u(),close:u(),send:u(),thankYouForFeedback:u(),giveFeedback:u(),sendFeedback:u(),feedbackFormTitle:u(),feedbackFormMessage:u(),feedbackFormMessagePlaceholder:u(),feedbackFormEmail:u(),feedbackFormEmailPlaceholder:u(),askQuestionAgain:u(),answerGood:u(),answerBad:u(),classificationSubmit:u(),classificationThankYou:u(),classificationTitle:u(),selectLanguage:u(),languageChanged:u(),selectColorTheme:u(),lightMode:u(),darkMode:u(),ariaMainNavigation:u(),ariaMainNavigationRegion:u(),ariaGotoMainNavigation:u(),ariaAskQuestion:u(),ariaAskQuestionRegion:u(),ariaNotifications:u(),ariaPredefinedQuestions:u(),ariaPredefinedQuestionsRegion:u(),ariaChatHistory:u(),ariaOpenChat:u(),ariaQuestionFromYou:u(),ariaAnswerFromBot:u(),ariaLastAnswerNavigation:u(),ariaQuestionSent:u(),ariaAnswerReady:u(),ariaAnswerFinished:u(),ariaAskQuestionAgain:u(),ariaAnswerGood:u(),ariaAnswerBad:u(),ariaReferenceSource:u(),ariaGiveFeedback:u(),ariaLanguageChanged:u(),ariaLightSelected:u(),ariaDarkSelected:u(),ariaSettings:u(),ariaSettingsRegion:u(),ariaReferencesRegion:u(),ariaFlyoutRegion:u(),ariaSelected:u(),ariaUnselected:u(),ariaAllSelected:u(),ariaAllUnselected:u(),ariaAllReseted:u(),popups:J(Zf).optional(),termsAcceptButton:u().optional(),termsReadButton:u().optional(),selectors:Je(u(),Vl).optional(),hideSettings:u(),showSettings:u(),chooseAtLeastOneOption:u(),selectAll:u(),selectNone:u(),resetToDefaults:u(),messageTooLong:u()}),Jr=ut(["en","de","fr","it"]),Zl=Je(Jr,Hl.partial().extend({selectors:Je(u(),Vl).optional()}));Je(Jr,qf),Je(Jr,Vf);const Gl=R({label:u(),options:J(R({label:u(),value:pe()}))}),Gf=R({label:u(),icon:u(),url:u(),target:ut(["_blank","_self"]).optional()}),Wf=R({label:u().nullable(),question:u()}),Wl=R({impact:Gl.optional(),quality:Gl.optional()});R({classification:Wl.optional()});const Qf=R({predefinedQuestions:J(Wf)}),Ql=Jt([R({maintenance:Fe(!0)}),R({id:u(),cID:u()})]);Je(Jr,Hl);const Yf=R({settingName:u(),iconName:u(),settingIntro:u().optional(),type:ut(["single-select","multi-select"]),allowEmpty:K(),values:J(u()),defaultValues:J(u()).optional()}),Yl=R({before:J(Vi).optional(),after:J(Vi).optional()}),Kf=R({init:J(Vi).optional(),bot:Yl.optional(),user:Yl.optional()}),Kl=R({showPredefinedQuestions:K(),showOverallFeedbackButton:K(),showOverallFeedbackEmail:K(),showCloseChatButton:K(),showContextMenu:K(),showContextInfo:K(),showReferencesByDefault:K(),showExpandedSelectors:K(),showTextFeedback:K(),inlineLayout:K(),allowAudioInput:K(),blockPII:K(),questionPrefix:u(),menu:Je(Jr,J(Gf)).optional(),supportedLanguages:J(Jr),classification:Wl.optional(),theme:ql,translations:Zl,buttonHref:u().optional(),addQueryToUrlParams:K().optional(),addRetrievalQuestionToUrlParams:K().optional(),renderKatex:K().optional(),reflectLanguageInPath:K().optional(),sendReferrer:ut(["all","own","none","location"]).optional(),selectorsConfig:J(Yf).default([]),questionLengthLimit:pe().optional(),forceConsent:K().optional(),askQuestionAgain:K(),enableBackdrop:K().optional(),messageAdditions:Kf.optional(),contextVersion:pe().optional()}).partial().and(R({theme:R({name:u().optional()}).optional()}));class Xf{constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}id;async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,r){return this.chatResponseData.readableStore.subscribe(e,r)}getContent(){return this.chatResponseData.content.toPromise()}abort(){return this.chatResponseData.abort()}async thumbsUp(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsUp(this.id,this.chatResponseData.question)}async thumbsDown(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsDown(this.id,this.chatResponseData.question)}async feedback(e){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.feedback(this.id,this.chatResponseData.question,e)}}const Ce=[];for(let t=0;t<256;++t)Ce.push((t+256).toString(16).slice(1));function Jf(t,e=0){return(Ce[t[e+0]]+Ce[t[e+1]]+Ce[t[e+2]]+Ce[t[e+3]]+"-"+Ce[t[e+4]]+Ce[t[e+5]]+"-"+Ce[t[e+6]]+Ce[t[e+7]]+"-"+Ce[t[e+8]]+Ce[t[e+9]]+"-"+Ce[t[e+10]]+Ce[t[e+11]]+Ce[t[e+12]]+Ce[t[e+13]]+Ce[t[e+14]]+Ce[t[e+15]]).toLowerCase()}let Gi;const ep=new Uint8Array(16);function tp(){if(!Gi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Gi=crypto.getRandomValues.bind(crypto)}return Gi(ep)}const Xl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function rp(t,e,r){t=t||{};const n=t.random??t.rng?.()??tp();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Jf(n)}function Wi(t,e,r){return Xl.randomUUID&&!t?Xl.randomUUID():rp(t)}const en=new Map;class np{get length(){return en.size}clear(){en.clear()}getItem(e){return en.get(e)||null}key(e){return Array.from(en.keys())[e]||null}removeItem(e){en.delete(e)}setItem(e,r){en.set(e,String(r))}}const kt=globalThis.localStorage??new np,ap=async t=>{try{const e=kt.getItem("liipgpt:uID")||kt.getItem("uID"),r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:e})},n=await t.fetchData("/login",Ql,{},r).catch(a=>(console.log("Failed to /login use /log",a),t.fetchData("/log",Ql,{},r)));if("maintenance"in n&&n.maintenance)return{mode:"maintenance"};if(!("id"in n))throw new Error("Invalid response format: missing user id");return kt.setItem("liipgpt:uID",n.id),{mode:"ready",userId:n.id}}catch(e){throw console.error("Failed to fetch user data:",e),e}};var et=function(t,e){if(!(this instanceof et))return new et(t,e);this.url=t,e=e||{},this.headers=e.headers||{},this.payload=e.payload!==void 0?e.payload:"",this.method=e.method||this.payload&&"POST"||"GET",this.withCredentials=!!e.withCredentials,this.debug=!!e.debug,this.autoReconnect=e.autoReconnect!==void 0?e.autoReconnect:!1,this.reconnectDelay=e.reconnectDelay!==void 0?e.reconnectDelay:3e3,this.maxRetries=e.maxRetries!==void 0?e.maxRetries:null,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=e.useLastEventId!==void 0?e.useLastEventId:!0,this.FIELD_SEPARATOR=":",this.listeners={},this.xhr=null,this.readyState=et.INITIALIZING,this.progress=0,this.chunk="",this.lastEventId="",this.addEventListener=function(r,n){this.listeners[r]===void 0&&(this.listeners[r]=[]),this.listeners[r].indexOf(n)===-1&&this.listeners[r].push(n)},this.removeEventListener=function(r,n){if(this.listeners[r]===void 0)return;const a=[];this.listeners[r].forEach(function(i){i!==n&&a.push(i)}),a.length===0?delete this.listeners[r]:this.listeners[r]=a},this.dispatchEvent=function(r){if(!r)return!0;this.debug&&console.debug(r),r.source=this;const n="on"+r.type;return this.hasOwnProperty(n)&&(this[n].call(this,r),r.defaultPrevented)?!1:this.listeners[r.type]?this.listeners[r.type].every(function(a){return a(r),!r.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk="",this._setReadyState(et.CLOSED),this.autoReconnect){if(this.maxRetries!==null&&this.retryCount>=this.maxRetries){this.debug&&console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`),this.autoReconnect=!1,this.close();return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.debug&&console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount+1}${this.maxRetries?"/"+this.maxRetries:""})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryCount++,this.stream()},this.reconnectDelay)}},this._setReadyState=function(r){const n=new CustomEvent("readystatechange");n.readyState=r,this.readyState=r,this.dispatchEvent(n)},this._onStreamFailure=function(r){const n=new CustomEvent("error");n.responseCode=r.currentTarget.status,n.data=r.currentTarget.response,this.dispatchEvent(n),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent("abort")),this._markClosed()},this._onStreamProgress=function(r){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(r);return}this.retryCount=0;const n=this.xhr.responseText.substring(this.progress);this.progress+=n.length;const a=(this.chunk+n).split(/(\r\n\r\n|\r\r|\n\n)/g),i=a.pop();a.forEach((function(o){o.trim().length>0&&this.dispatchEvent(this._parseEventChunk(o))}).bind(this)),this.chunk=i},this._onStreamLoaded=function(r){this._onStreamProgress(r),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk="",this._markClosed()},this._parseEventChunk=function(r){if(!r||r.length===0)return null;this.debug&&console.debug(r);const n={id:null,retry:null,data:null,event:null};if(r.split(/\n|\r\n|\r/).forEach((function(i){const o=i.indexOf(this.FIELD_SEPARATOR);let s,c;if(o>0){const l=i[o+1]===" "?2:1;s=i.substring(0,o),c=i.substring(o+l)}else if(o<0)s=i,c="";else return;s in n&&(s==="data"&&n[s]!==null?n.data+=`
73
73
  `+c:n[s]=c)}).bind(this)),n.data===null)return null;n.id!==null&&(this.lastEventId=n.id);const a=new CustomEvent(n.event||"message");return a.id=n.id,a.data=n.data||"",a.lastEventId=this.lastEventId,a},this._onReadyStateChange=function(){if(this.xhr&&this.xhr.readyState===XMLHttpRequest.HEADERS_RECEIVED){const r={},n=this.xhr.getAllResponseHeaders().trim().split(`\r
74
- `);for(const i of n){const[o,...s]=i.split(":"),c=s.join(":").trim();r[o.trim().toLowerCase()]=r[o.trim().toLowerCase()]||[],r[o.trim().toLowerCase()].push(c)}const a=new CustomEvent("open");a.responseCode=this.xhr.status,a.headers=r,this.dispatchEvent(a),this._setReadyState(Xe.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState(Xe.CONNECTING),this.xhr=new XMLHttpRequest,this.xhr.addEventListener("progress",this._onStreamProgress.bind(this)),this.xhr.addEventListener("load",this._onStreamLoaded.bind(this)),this.xhr.addEventListener("readystatechange",this._onReadyStateChange.bind(this)),this.xhr.addEventListener("error",this._onStreamFailure.bind(this)),this.xhr.addEventListener("abort",this._onStreamAbort.bind(this)),this.xhr.open(this.method,this.url);for(let r in this.headers)this.xhr.setRequestHeader(r,this.headers[r]);this.useLastEventId&&this.lastEventId.length>0&&this.xhr.setRequestHeader("Last-Event-ID",this.lastEventId),this.xhr.withCredentials=this.withCredentials,this.xhr.send(this.payload)}},this.close=function(){this.readyState!==Xe.CLOSED&&(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.autoReconnect=!1,this.xhr.abort())},(e.start===void 0||e.start)&&this.stream()};Xe.INITIALIZING=-1,Xe.CONNECTING=0,Xe.OPEN=1,Xe.CLOSED=2,typeof rn<"u"&&(rn.SSE=Xe);class Mf{constructor(e,r,n){this.options=r,this.payload=n;const a={headers:{"content-type":"application/json"}};n&&(a.payload=JSON.stringify(n)),r.apiKey&&(a.headers["api-key"]=r.apiKey),this.eventSource=new(r.EventSource??Xe)(e,a),this.eventSource.onmessage=i=>{try{const o=JSON.parse(i.data);r.onMessage(o)}catch(o){r.onError(new CustomEvent("parse-error",{detail:o}))}},this.eventSource.onerror=i=>{r.onError(i),this.isClosed()&&this.close()}}eventSource;triggeredOnClose=!1;isClosed(){return this.eventSource.readyState===EventSource.CLOSED}close(){this.isClosed()||this.eventSource.close(),this.triggeredOnClose||(this.triggeredOnClose=!0,this.options.onClose())}}const Ul=t=>Object.fromEntries(Object.entries(t).filter(([e,r])=>r!=null));class Pf{constructor(e){this.options=e}getDefaultHeaders(e={}){const r={"Content-Type":"application/json",...e};return this.options.apiKey&&(r["api-key"]=this.options.apiKey),r}get speechRecognitionApiKey(){return this.options.speechRecognitionApiKey}async subscribeSse(e,r={},n){const a=Ul(r);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new Mf(`${this.options.apiUrl}${e}`,n,a)}async fetchData(e,r,n={},a={}){const i=`${this.options.apiUrl}${e}?${new URLSearchParams(Ul(n)).toString()}`,o={...a,headers:this.getDefaultHeaders(a?.headers)},s=await fetch(i,o);if(!s.ok){const h=await s.text();throw new Error(`API request failed: ${s.status} - ${h}`)}const c=await s.json(),{success:l,data:u,error:p}=r.safeParse(c);if(this.options.strict){if(!l)throw console.error(`Server response has wrong type:
75
- `,{error:p,url:i,opts:o,data:c}),new Error(`Server response has wrong type: ${p.message}`);return u}else return l||console.warn(`Server response has wrong type:
76
- `,{error:p,url:i,opts:o,data:c}),c}async postData(e,r){const n=await fetch(`${this.options.apiUrl}${e}`,{method:"POST",headers:this.getDefaultHeaders(),body:JSON.stringify(r)});if(!n.ok){const a=await n.text();throw new Error(`${n.status} - ${a}`)}return n}async postFormData(e,r){const n=await fetch(`${this.options.apiUrl}${e}`,{method:"POST",body:r});if(!n.ok){const a=await n.text();throw new Error(`${n.status} - ${a}`)}return n}}const Nf=Cn([d(),Ke(),te(),Ce(d()),Ce(Ke()),Ce(te())]),Df=z({title:d(),description:d().optional(),badge:d().optional(),breadcrumbs:Ce(d()).optional(),previewImage:d().optional(),date:d().datetime().optional()}),$f=z({url:d().url(),score:Ke(),metadata:lt(d(),Nf),language:d().optional()}).merge(Df),zf=z({url:d().url(),title:d(),considered:te(),orgMetadata:z({authors:Ce(d())}),type:d(),date:d().datetime(),similarity:Ke(),content:d(),fromFullTextSearch:te(),rerank:z({index:Ke().int(),adjustment:Ke(),score:Ke(),similarityOld:Ke()})}).deepPartial().or($f),Ff=z({links:Ce(zf)}),Bf=t=>{if("metadata"in t)return t;console.warn("Please upgrade your backend you are currently using an old api feature.");const e=t.orgMetadata??{};t?.fromFullTextSearch&&(e.fromFullTextSearch=t?.fromFullTextSearch),t?.rerank&&(e.rerank=t?.rerank);let r=[],n=t.title??"";if(t.title&&t.title.includes(" > ")){const a=t.title.split(" > ");n=a.pop()??"",r=a}return{url:t.url??"",title:n,score:t.similarity||0,breadcrumbs:r,metadata:e,description:t.content,date:t.date}};class jf{constructor(e){this.results=e}}class Uf{internalData;renderers=new Map;markedExtensions=[];constructor(e){const r={apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:e.speechRecognitionApiKey,strict:e.strict??!1,EventSource:e.EventSource??EventSource},n=new Pf(r);this.internalData={restClient:n,metadata:Of(n),searchResponseMap:new Map,chatResponseMap:new Map,conversationMap:new Map}}setMarkedExtensions(...e){this.markedExtensions=e}getMetadata(){return this.internalData.metadata}createConversationId(){const e=jl();return this.renderers.set(e,new ul({extensions:this.markedExtensions})),e}chat(e,r,n={}){const a=new Si,i=jl(),o=new dl,s=this.renderers.get(e)??new ul({extensions:this.markedExtensions}),c=new $h({id:i,onError:h=>{n.onError?.(h)},onFinish:h=>{a.setValue(h)},markdownRenderer:s,userQuestion:r}),l=async()=>{await o,(await u).close()},u=new Si;(async()=>{const h=await this.internalData.metadata;if(h.mode==="maintenance")throw new Error("Can not chat in maintenance mode");const v=await this.internalData.restClient.subscribeSse("/assistant/sse",{query:r,uID:h.userId,cID:e,rID:i,lang:n.lang,feature:n.features?.join(","),referrer:n.referrer,...n.selectorValues??{},chat:"true",version:"2"},{onClose:()=>{c.finishMessage(),o.resolve(),a.cleanup()},onMessage:m=>{const b=m;switch(b.type){case"error":c.pushError(b.error);break;case"id":b.for==="request"&&i!==b.id&&console.warn(`Unexpected request id "${b.id}" expected "${i}"`),b.for==="conversation"&&e!==b.id&&console.warn(`Unexpected conversation id "${b.id}" expected "${e}"`);break;case"state":b.state==="history-entry-initialized"&&o.resolve();break;case"text":c.updateText(b.text);break;case"done":case"answer-done":c.finishMessage(),o.resolve(),u.then(C=>C.close());break;case"unexpected-call":console.error("unexpected-call:",b),c.pushError("unexpected-call");break;case"mapped-reference":c.addMappedReference(b.reference);break;case"reference":c.addOldReference(b.reference);break;case"retrieval-question":c.updateRetrievalQuestion(b.question);break}n.onMessage?.(b)},onError:m=>{console.error(" sse-error:",m),!("data"in m&&!m.data&&"responseCode"in m&&m.responseCode===0)&&c.pushError("sse-error")}});u.setValue(v)})();const p=new Ef({question:r,id:i,content:a,readableStore:c.getReadableStore(),readyForFeedback:o,abort:l,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(p.id,p),p}async thumbs(e,r,n){if((await this.internalData.metadata).mode!=="ready")throw new Error("Can not post feedback unless we are in ready mode");const i={feedback:n,rID:e,query:r};await this.internalData.restClient.postData("/quickfeedback",i)}thumbsUp(e,r){return this.thumbs(e,r,"positive")}thumbsDown(e,r){return this.thumbs(e,r,"negative")}async feedback(e,r,n){const a=await this.internalData.metadata;if(a.mode!=="ready")throw new Error("Can not post feedback unless we are in ready mode");if(n.message){const i={body:n.message,email:n.email,rID:e,uID:a.userId,query:r};await this.internalData.restClient.postData("/feedback",i)}n.classification&&await this.internalData.restClient.postData("/classification",{impact:n.classification.impact,quality:n.classification.quality,rID:e})}async search(e,r={}){const n=await this.internalData.metadata,a=n.mode==="ready"?n.userId:void 0,{links:i}=await this.internalData.restClient.fetchData("/assistant/search",Ff,{modelId:r.model,lang:r.language,query:e,mapResults:"true",uID:a}),o=i.map(Bf);return new jf(o)}async getChatConfig(){return this.internalData.restClient.fetchData("/chatconfig",Fl)}async getPredefinedQuestions(e){return(await this.internalData.restClient.fetchData("/topics/questions",Sf,e)).predefinedQuestions}async transcribeAudio(e,r={}){const n=await this.internalData.metadata,a=r.lang||"de-CH";if(n.mode==="maintenance")throw new Error("Can not transcribe audio in maintenance mode");try{const o=(u=>u.includes("mp4")?"mp4":u.includes("webm")?"webm":(u.includes("wav"),"wav"))(e.type),s=new FormData;return s.append("file",e,`audio.${o}`),s.append("lang",a),s.append("type",e.type),{transcript:await(await this.internalData.restClient.postFormData(`/speech?key=${this.internalData.restClient.speechRecognitionApiKey||""}&lang=${a}`,s)).text()||"",error:void 0}}catch(i){return console.error("Error transcribing audio:",i),{transcript:"",error:i instanceof Error?i.message:"Unknown error"}}}}const qf=600;function ql(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $i,Vl;function Vf(){if(Vl)return $i;Vl=1;var t=function(k){return e(k)&&!r(k)};function e(y){return!!y&&typeof y=="object"}function r(y){var k=Object.prototype.toString.call(y);return k==="[object RegExp]"||k==="[object Date]"||i(y)}var n=typeof Symbol=="function"&&Symbol.for,a=n?Symbol.for("react.element"):60103;function i(y){return y.$$typeof===a}function o(y){return Array.isArray(y)?[]:{}}function s(y,k){return k.clone!==!1&&k.isMergeableObject(y)?b(o(y),y,k):y}function c(y,k,w){return y.concat(k).map(function(T){return s(T,w)})}function l(y,k){if(!k.customMerge)return b;var w=k.customMerge(y);return typeof w=="function"?w:b}function u(y){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(y).filter(function(k){return Object.propertyIsEnumerable.call(y,k)}):[]}function p(y){return Object.keys(y).concat(u(y))}function h(y,k){try{return k in y}catch{return!1}}function v(y,k){return h(y,k)&&!(Object.hasOwnProperty.call(y,k)&&Object.propertyIsEnumerable.call(y,k))}function m(y,k,w){var T={};return w.isMergeableObject(y)&&p(y).forEach(function(R){T[R]=s(y[R],w)}),p(k).forEach(function(R){v(y,R)||(h(y,R)&&w.isMergeableObject(k[R])?T[R]=l(R,w)(y[R],k[R],w):T[R]=s(k[R],w))}),T}function b(y,k,w){w=w||{},w.arrayMerge=w.arrayMerge||c,w.isMergeableObject=w.isMergeableObject||t,w.cloneUnlessOtherwiseSpecified=s;var T=Array.isArray(k),R=Array.isArray(y),U=T===R;return U?T?w.arrayMerge(y,k,w):m(y,k,w):s(k,w)}b.all=function(k,w){if(!Array.isArray(k))throw new Error("first argument should be an array");return k.reduce(function(T,R){return b(T,R,w)},{})};var C=b;return $i=C,$i}var Hf=Vf();const An=ql(Hf),Zf=t=>t===null||typeof t!="object",zi=t=>{if(Zf(t))return t;if(Array.isArray(t))return t.map(zi);const e=Object.entries(t).filter(([r,n])=>n!==void 0).map(([r,n])=>[r,zi(n)]);return Object.fromEntries(e)},va=(t,e)=>{const r=zi(e);return An(t,r)},Hl={tokens:{font:{family:"-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif"},colors:{brand:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#2d3748",900:"#1a202c",950:"#171923"},highlight:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#2d3748",900:"#1a202c",950:"#171923"},grey:{0:"#ffffff",50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#2d3748",900:"#1a202c",950:"#171923",1e3:"#000000"}},base:{fontSizeXs:{minRem:.75,maxRem:.875},fontSizeSm:{minRem:1,maxRem:1},fontSizeBody:{minRem:1,maxRem:1.25},fontSizeH3:{minRem:1.125,maxRem:1.5},fontSizeH2:{minRem:1.25,maxRem:1.75},fontSizeH1:{minRem:1.5,maxRem:2},fontWeightNormal:"400",fontWeightBold:"700",fontWeightTitle:"700",lineHeightDefault:"1.5",lineHeightSnug:"1.375",lineHeightTight:"1.25",borderRadius:{minRem:.5,maxRem:.75},lineColor:"color-mix(in srgb, var(--color-brand-950) 20%, transparent)",boxShadow:"0px 0px 2px rgba(0, 0, 0, 0.15), 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)"},components:{body:{background:"var(--color-grey-0)",color:"var(--color-grey-900)",focus:{color:"var(--color-highlight-500)"},custom:{selectionColor:"var(--color-grey-0)",selectionBackground:"var(--color-brand-700)",focusWidth:"var(--spacer-3)",focusOffset:"var(--spacer-2)",focusStyle:"solid"}},container:{custom:{maxWidth:"1024px"}},avatar:{color:"var(--color-brand-400)",background:"var(--color-grey-100)"},anchor:{color:"var(--color-brand-700)",hover:{color:"var(--color-brand-950)"}},btnPrimary:{color:"var(--color-grey-0)",background:"var(--color-brand-700)",borderRadius:"var(--base-border-radius)",hover:{background:"var(--color-brand-900)"}},btnSecondary:{color:"var(--color-brand-700)",background:"var(--color-brand-100)",borderRadius:"var(--base-border-radius)",hover:{color:"var(--color-grey-1000)",background:"var(--color-brand-200)"}},btnTertiary:{color:"var(--anchor-color)",background:"transparent",borderRadius:"var(--base-border-radius)",hover:{color:"var(--anchor-hover-color)"}},card:{color:"var(--color-grey-900)",background:"var(--color-grey-100)",borderRadius:"var(--base-border-radius)",boxShadow:"none",hover:{color:"var(--color-grey-1000)",background:"var(--color-brand-100)"},custom:{iconColor:"var(--anchor-color)",iconHoverColor:"var(--anchor-hover-color)"}},input:{background:"var(--color-grey-0)",borderColor:"var(--color-grey-300)",borderWidth:"1px",borderRadius:"var(--base-border-radius)",custom:{padding:"var(--spacer-r-16) var(--spacer-r-20)",placeholderColor:"var(--color-grey-500)",placeholderOpacity:"1"}},label:{color:"var(--color-grey-600)"},hr:{color:"var(--base-line-color)"},checkbox:{color:"transparent",background:"var(--color-grey-0)",borderColor:"var(--color-grey-300)",borderWidth:"1px",borderRadius:"0.2em",custom:{checkedColor:"var(--btn-primary-color)",checkedBorderColor:"var(--color-brand-700)",checkedBackground:"var(--color-brand-700)"}},radio:{color:"transparent",background:"var(--color-grey-0)",borderColor:"var(--color-grey-300)",borderWidth:"1px",custom:{checkedColor:"var(--btn-primary-color)",checkedBorderColor:"var(--color-brand-700)",checkedBackground:"var(--color-brand-700)"}},contextBox:{color:"var(--card-color)",background:"var(--card-background)",borderColor:"var(--card-border-color)",borderWidth:"var(--card-border-width)",borderRadius:"var(--card-border-radius)",boxShadow:"var(--base-box-shadow)",custom:{transitionDuration:200,transitionDelay:200,transitionY:8,titleColor:"var(--color-grey-1000)",titleFontWeight:"var(--base-font-weight-bold)",separatorColor:"var(--base-line-color)",errorColor:"var(--message-error-color)"}},contextBoxMenuItem:{background:"transparent",color:"var(--body-color)",borderRadius:"calc(var(--base-border-radius) / 2)",hover:{color:"var(--btn-secondary-hover-color)",background:"var(--btn-secondary-hover-background)"},custom:{activeColor:"var(--btn-secondary-hover-color)",activeBackground:"var(--btn-secondary-hover-background)"}},chatFooter:{color:"var(--color-grey-400)",background:"var(--body-background)",borderRadius:"var(--base-border-radius)",boxShadow:"0px -10px 20px 5px color-mix(in srgb, var(--body-background) 90%, transparent)"},chatInput:{color:"var(--color-grey-700)",background:"var(--card-background)",borderRadius:"var(--base-border-radius)",borderColor:"transparent",borderWidth:"3px",hover:{background:"var(--card-hover-background)"},focus:{borderColor:"var(--body-focus-color)"}},chatInputSubmit:{color:"var(--btn-primary-color)",background:"var(--btn-primary-background)",borderRadius:"calc(var(--base-border-radius) / 1.25)",hover:{color:"var(--btn-primary-hover-color)",background:"var(--btn-primary-hover-background)"},custom:{strokeWidth:"2",deactivatedBackground:"var(--color-grey-500)",deactivatedOpacity:"0.25",deactivatedScale:"0.8",deactivatedBorderColor:"var(--color-grey-500)"}},chatInputNotification:{background:"#DD135A",color:"var(--color-grey-0)",borderColor:"#DD135A",borderWidth:"1px",borderRadius:"var(--chat-input-border-radius)"},dialog:{background:"var(--card-background)",color:"var(--body-color)",borderColor:"var(--card-border-color)",borderWidth:"var(--card-border-width)",borderRadius:"var(--card-border-radius)",boxShadow:"var(--base-box-shadow)",custom:{transitionDuration:200,transitionDelay:0,transitionY:30,backgroundOverlay:"rgba(0, 0, 0, 0.25)",headerBorderBottomColor:"var(--base-line-color)"}},aside:{background:"var(--card-background)",custom:{width:"400px",containerWidthForMobileLayout:1024,backgroundOverlay:"rgba(0, 0, 0, 0.4)",headerColor:"var(--card-color)",headerBorderColor:"var(--base-line-color)",headerBorderWidth:"1px"}},message:{color:"var(--body-color)",custom:{errorColor:"#C91658",transitionDuration:300,transitionDelay:0,transitionY:30,transitionBotLoadingDelay:300}},messageOptions:{borderColor:"var(--base-line-color)",borderWidth:"1px",custom:{transitionDuration:300,transitionDelay:0,transitionY:30}},messageUser:{color:"var(--body-color)",background:"var(--card-background)",boxShadow:"var(--card-box-shadow)",borderRadius:"var(--card-border-radius)"},openButton:{color:"var(--card-color)",background:"var(--card-background)",borderColor:"var(--card-background)",borderWidth:"0",borderRadius:"calc(var(--base-border-radius) / 2)",hover:{color:"var(--card-hover-color)",background:"var(--card-hover-background)"},custom:{hideTitleWhenCollapsed:0,autoExpandScrollThreshold:0,autoCollapseDelay:0,autoExpandOnce:0}},referencesToggle:{color:"var(--color-brand-700)",hover:{color:"var(--anchor-hover-color)"}},referenceNumberTrigger:{color:"var(--btn-secondary-color)",background:"var(--btn-secondary-background)",borderRadius:"calc(var(--base-border-radius) / 2)",hover:{color:"var(--btn-secondary-hover-color)",background:"var(--btn-secondary-hover-background)"},custom:{padding:"0.25em"}},referenceDomain:{color:"var(--color-brand-700)",hover:{color:"var(--color-brand-800)"},custom:{padding:"0px"}},referenceNumberContent:{color:"var(--card-color)",background:"var(--card-background)",borderColor:"var(--card-border-color)",borderWidth:"var(--card-border-width)",borderRadius:"var(--card-border-radius)",hover:{color:"var(--card-hover-color)",background:"var(--card-hover-background)",borderColor:"var(--card-hover-border-color)",borderWidth:"var(--card-hover-border-width)"},boxShadow:"var(--base-box-shadow)",custom:{width:"95cqi",maxWidth:"450px",transitionDuration:200,transitionDelay:200,transitionY:8}},reference:{color:"var(--card-color)",background:"var(--card-background)",borderColor:"var(--card-border-color)",borderWidth:"var(--card-border-width)",borderRadius:"var(--card-border-radius)",hover:{color:"var(--card-hover-color)",background:"var(--body-background)",borderColor:"var(--card-hover-border-color)",borderWidth:"var(--card-hover-border-width)"}},referenceDescription:{color:"var(--reference-color)",hover:{color:"var(--reference-hover-color)"}},referenceNumber:{color:"var(--reference-number-trigger-color)",background:"var(--body-background)",borderColor:"var(--reference-number-trigger-border-color)",borderWidth:"var(--reference-number-trigger-border-width)",borderRadius:"var(--reference-number-trigger-border-radius)",hover:{color:"var(--reference-number-trigger-color)",background:"var(--reference-number-trigger-background)",borderColor:"var(--reference-number-trigger-border-color)",borderWidth:"var(--reference-number-trigger-border-width)"},custom:{padding:"var(--reference-number-trigger-padding)"}},toast:{background:"var(--card-background)",color:"var(--body-color)",boxShadow:"var(--base-box-shadow)",borderRadius:"var(--card-border-radius)",custom:{iconSuccessColor:"#22c55e",iconErrorColor:"#ef4444",iconWarningColor:"#f97316",iconInfoColor:"#3b82f6"}},tooltip:{background:"var(--color-grey-200)",color:"var(--body-color)",borderRadius:"calc(var(--base-border-radius) / 2)"},flyout:{custom:{backdropColor:"var(--color-brand-800)",backdropOpacity:"0.4",backdropDelayIn:"0",backdropDurationIn:"200",backdropDelayOut:"0",backdropDurationOut:"150",backdropBaseScaleIn:"1",backdropBaseScaleOut:"1",backdropTransformOrigin:"center",backdropScaleDirection:"scale"}}},svgs:{predefinedQuestion:`
74
+ `);for(const i of n){const[o,...s]=i.split(":"),c=s.join(":").trim();r[o.trim().toLowerCase()]=r[o.trim().toLowerCase()]||[],r[o.trim().toLowerCase()].push(c)}const a=new CustomEvent("open");a.responseCode=this.xhr.status,a.headers=r,this.dispatchEvent(a),this._setReadyState(et.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState(et.CONNECTING),this.xhr=new XMLHttpRequest,this.xhr.addEventListener("progress",this._onStreamProgress.bind(this)),this.xhr.addEventListener("load",this._onStreamLoaded.bind(this)),this.xhr.addEventListener("readystatechange",this._onReadyStateChange.bind(this)),this.xhr.addEventListener("error",this._onStreamFailure.bind(this)),this.xhr.addEventListener("abort",this._onStreamAbort.bind(this)),this.xhr.open(this.method,this.url);for(let r in this.headers)this.xhr.setRequestHeader(r,this.headers[r]);this.useLastEventId&&this.lastEventId.length>0&&this.xhr.setRequestHeader("Last-Event-ID",this.lastEventId),this.xhr.withCredentials=this.withCredentials,this.xhr.send(this.payload)}},this.close=function(){this.readyState!==et.CLOSED&&(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.autoReconnect=!1,this.xhr.abort())},(e.start===void 0||e.start)&&this.stream()};et.INITIALIZING=-1,et.CONNECTING=0,et.OPEN=1,et.CLOSED=2,typeof sn<"u"&&(sn.SSE=et);class ip{constructor(e,r,n){this.options=r,this.payload=n;const a={headers:{"content-type":"application/json"}};n&&(a.payload=JSON.stringify(n)),r.apiKey&&(a.headers["api-key"]=r.apiKey),this.eventSource=new(r.EventSource??et)(e,a),this.eventSource.onmessage=i=>{try{const o=JSON.parse(i.data);r.onMessage(o)}catch(o){r.onError(new CustomEvent("parse-error",{detail:o}))}},this.eventSource.onerror=i=>{r.onError(i),this.isClosed()&&this.close()}}eventSource;triggeredOnClose=!1;isClosed(){return this.eventSource.readyState===EventSource.CLOSED}close(){this.isClosed()||this.eventSource.close(),this.triggeredOnClose||(this.triggeredOnClose=!0,this.options.onClose())}}const Jl=t=>Object.fromEntries(Object.entries(t).filter(([e,r])=>r!=null));class op{constructor(e){this.options=e}getDefaultHeaders(e={}){const r={"Content-Type":"application/json",...e};return this.options.apiKey&&(r["api-key"]=this.options.apiKey),r}get speechRecognitionApiKey(){return this.options.speechRecognitionApiKey}async subscribeSse(e,r={},n){const a=Jl(r);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new ip(`${this.options.apiUrl}${e}`,n,a)}async fetchData(e,r,n={},a={}){const i=`${this.options.apiUrl}${e}?${new URLSearchParams(Jl(n)).toString()}`,o={...a,headers:this.getDefaultHeaders(a?.headers)},s=await fetch(i,o);if(!s.ok){const h=await s.text();throw new Error(`API request failed: ${s.status} - ${h}`)}const c=await s.json(),{success:l,data:d,error:p}=r.safeParse(c);if(this.options.strict){if(!l)throw console.error(`Server response has wrong type:
75
+ `,{error:p,url:i,opts:o,data:c}),new Error(`Server response has wrong type: ${p.message}`);return d}else return l||console.warn(`Server response has wrong type:
76
+ `,{error:p,url:i,opts:o,data:c}),c}async postData(e,r){const n=await fetch(`${this.options.apiUrl}${e}`,{method:"POST",headers:this.getDefaultHeaders(),body:JSON.stringify(r)});if(!n.ok){const a=await n.text();throw new Error(`${n.status} - ${a}`)}return n}async postFormData(e,r){const n=await fetch(`${this.options.apiUrl}${e}`,{method:"POST",body:r});if(!n.ok){const a=await n.text();throw new Error(`${n.status} - ${a}`)}return n}}const sp=R({url:u().url(),title:u(),considered:K(),orgMetadata:R({authors:J(u())}),type:u(),date:u().datetime(),similarity:pe(),content:u(),fromFullTextSearch:K(),rerank:R({index:pe().int(),adjustment:pe(),score:pe(),similarityOld:pe()})}).deepPartial().or(_f),lp=R({links:J(sp)}),cp=t=>{if("metadata"in t)return t;console.warn("Please upgrade your backend you are currently using an old api feature.");const e=t.orgMetadata??{};t?.fromFullTextSearch&&(e.fromFullTextSearch=t?.fromFullTextSearch),t?.rerank&&(e.rerank=t?.rerank);let r=[],n=t.title??"";if(t.title&&t.title.includes(" > ")){const a=t.title.split(" > ");n=a.pop()??"",r=a}return{url:t.url??"",title:n,score:t.similarity||0,breadcrumbs:r,metadata:e,description:t.content,date:t.date}};class up{constructor(e){this.results=e}}class dp{internalData;renderers=new Map;markedExtensions=[];constructor(e){const r={apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:e.speechRecognitionApiKey,strict:e.strict??!1,EventSource:e.EventSource??EventSource},n=new op(r);this.internalData={restClient:n,metadata:ap(n),searchResponseMap:new Map,chatResponseMap:new Map,conversationMap:new Map}}setMarkedExtensions(...e){this.markedExtensions=e}getMetadata(){return this.internalData.metadata}createConversationId(){const e=Wi();return this.renderers.set(e,new _l({extensions:this.markedExtensions})),e}chat(e,r,n={}){const a=new Li,i=Wi(),o=new xl,s=this.renderers.get(e)??new _l({extensions:this.markedExtensions}),c=new Wh({id:i,onError:h=>{n.onError?.(h)},onFinish:h=>{a.setValue(h)},markdownRenderer:s,userQuestion:r}),l=async()=>{await o,(await d).close()},d=new Li;(async()=>{const h=await this.internalData.metadata;if(h.mode==="maintenance")throw new Error("Can not chat in maintenance mode");const v=await this.internalData.restClient.subscribeSse("/assistant/sse",{query:r,uID:h.userId,cID:e,rID:i,lang:n.lang,feature:n.features?.join(","),referrer:n.referrer,...n.selectorValues??{},chat:"true",version:"2"},{onClose:()=>{c.finishMessage(),o.resolve(),a.cleanup()},onMessage:m=>{const b=m;switch(b.type){case"error":c.pushError(b.error);break;case"id":b.for==="request"&&i!==b.id&&console.warn(`Unexpected request id "${b.id}" expected "${i}"`),b.for==="conversation"&&e!==b.id&&console.warn(`Unexpected conversation id "${b.id}" expected "${e}"`);break;case"state":b.state==="history-entry-initialized"&&o.resolve();break;case"text":c.updateText(b.text);break;case"done":case"answer-done":c.finishMessage(),o.resolve(),d.then(A=>A.close());break;case"unexpected-call":console.error("unexpected-call:",b),c.pushError("unexpected-call");break;case"mapped-reference":c.addMappedReference(b.reference);break;case"reference":c.addOldReference(b.reference);break;case"retrieval-question":c.updateRetrievalQuestion(b.question);break}n.onMessage?.(b)},onError:m=>{console.error(" sse-error:",m),!("data"in m&&!m.data&&"responseCode"in m&&m.responseCode===0)&&c.pushError("sse-error")}});d.setValue(v)})();const p=new Xf({question:r,id:i,content:a,readableStore:c.getReadableStore(),readyForFeedback:o,abort:l,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(p.id,p),p}async thumbs(e,r,n){if((await this.internalData.metadata).mode!=="ready")throw new Error("Can not post feedback unless we are in ready mode");const i={feedback:n,rID:e,query:r};await this.internalData.restClient.postData("/quickfeedback",i)}thumbsUp(e,r){return this.thumbs(e,r,"positive")}thumbsDown(e,r){return this.thumbs(e,r,"negative")}async feedback(e,r,n){const a=await this.internalData.metadata;if(a.mode!=="ready")throw new Error("Can not post feedback unless we are in ready mode");if(n.message){const i={body:n.message,email:n.email,rID:e,uID:a.userId,query:r};await this.internalData.restClient.postData("/feedback",i)}n.classification&&await this.internalData.restClient.postData("/classification",{impact:n.classification.impact,quality:n.classification.quality,rID:e})}async search(e,r={}){const n=await this.internalData.metadata,a=n.mode==="ready"?n.userId:void 0,{links:i}=await this.internalData.restClient.fetchData("/assistant/search",lp,{modelId:r.model,lang:r.language,query:e,mapResults:"true",uID:a}),o=i.map(cp);return new up(o)}async getChatConfig(){return this.internalData.restClient.fetchData("/chatconfig",Kl)}async getPredefinedQuestions(e){return(await this.internalData.restClient.fetchData("/topics/questions",Qf,e)).predefinedQuestions}async transcribeAudio(e,r={}){const n=await this.internalData.metadata,a=r.lang||"de-CH";if(n.mode==="maintenance")throw new Error("Can not transcribe audio in maintenance mode");try{const o=(d=>d.includes("mp4")?"mp4":d.includes("webm")?"webm":(d.includes("wav"),"wav"))(e.type),s=new FormData;return s.append("file",e,`audio.${o}`),s.append("lang",a),s.append("type",e.type),{transcript:await(await this.internalData.restClient.postFormData(`/speech?key=${this.internalData.restClient.speechRecognitionApiKey||""}&lang=${a}`,s)).text()||"",error:void 0}}catch(i){return console.error("Error transcribing audio:",i),{transcript:"",error:i instanceof Error?i.message:"Unknown error"}}}}const hp=600;function ec(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Qi,tc;function fp(){if(tc)return Qi;tc=1;var t=function(k){return e(k)&&!r(k)};function e(y){return!!y&&typeof y=="object"}function r(y){var k=Object.prototype.toString.call(y);return k==="[object RegExp]"||k==="[object Date]"||i(y)}var n=typeof Symbol=="function"&&Symbol.for,a=n?Symbol.for("react.element"):60103;function i(y){return y.$$typeof===a}function o(y){return Array.isArray(y)?[]:{}}function s(y,k){return k.clone!==!1&&k.isMergeableObject(y)?b(o(y),y,k):y}function c(y,k,w){return y.concat(k).map(function(T){return s(T,w)})}function l(y,k){if(!k.customMerge)return b;var w=k.customMerge(y);return typeof w=="function"?w:b}function d(y){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(y).filter(function(k){return Object.propertyIsEnumerable.call(y,k)}):[]}function p(y){return Object.keys(y).concat(d(y))}function h(y,k){try{return k in y}catch{return!1}}function v(y,k){return h(y,k)&&!(Object.hasOwnProperty.call(y,k)&&Object.propertyIsEnumerable.call(y,k))}function m(y,k,w){var T={};return w.isMergeableObject(y)&&p(y).forEach(function(I){T[I]=s(y[I],w)}),p(k).forEach(function(I){v(y,I)||(h(y,I)&&w.isMergeableObject(k[I])?T[I]=l(I,w)(y[I],k[I],w):T[I]=s(k[I],w))}),T}function b(y,k,w){w=w||{},w.arrayMerge=w.arrayMerge||c,w.isMergeableObject=w.isMergeableObject||t,w.cloneUnlessOtherwiseSpecified=s;var T=Array.isArray(k),I=Array.isArray(y),U=T===I;return U?T?w.arrayMerge(y,k,w):m(y,k,w):s(k,w)}b.all=function(k,w){if(!Array.isArray(k))throw new Error("first argument should be an array");return k.reduce(function(T,I){return b(T,I,w)},{})};var A=b;return Qi=A,Qi}var pp=fp();const Ln=ec(pp),gp=t=>t===null||typeof t!="object",Yi=t=>{if(gp(t))return t;if(Array.isArray(t))return t.map(Yi);const e=Object.entries(t).filter(([r,n])=>n!==void 0).map(([r,n])=>[r,Yi(n)]);return Object.fromEntries(e)},Sa=(t,e)=>{const r=Yi(e);return Ln(t,r)},rc={tokens:{font:{family:"-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif"},colors:{brand:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#2d3748",900:"#1a202c",950:"#171923"},highlight:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#2d3748",900:"#1a202c",950:"#171923"},grey:{0:"#ffffff",50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#2d3748",900:"#1a202c",950:"#171923",1e3:"#000000"}},base:{fontSizeXs:{minRem:.75,maxRem:.875},fontSizeSm:{minRem:1,maxRem:1},fontSizeBody:{minRem:1,maxRem:1.25},fontSizeH3:{minRem:1.125,maxRem:1.5},fontSizeH2:{minRem:1.25,maxRem:1.75},fontSizeH1:{minRem:1.5,maxRem:2},fontWeightNormal:"400",fontWeightBold:"700",fontWeightTitle:"700",lineHeightDefault:"1.5",lineHeightSnug:"1.375",lineHeightTight:"1.25",borderRadius:{minRem:.5,maxRem:.75},lineColor:"color-mix(in srgb, var(--color-brand-950) 20%, transparent)",boxShadow:"0px 0px 2px rgba(0, 0, 0, 0.15), 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)"},components:{body:{background:"var(--color-grey-0)",color:"var(--color-grey-900)",focus:{color:"var(--color-highlight-500)"},custom:{selectionColor:"var(--color-grey-0)",selectionBackground:"var(--color-brand-700)",focusWidth:"var(--spacer-3)",focusOffset:"var(--spacer-2)",focusStyle:"solid"}},container:{custom:{maxWidth:"1024px"}},avatar:{color:"var(--color-brand-400)",background:"var(--color-grey-100)"},anchor:{color:"var(--color-brand-700)",hover:{color:"var(--color-brand-950)"}},btnPrimary:{color:"var(--color-grey-0)",background:"var(--color-brand-700)",borderRadius:"var(--base-border-radius)",hover:{background:"var(--color-brand-900)"}},btnSecondary:{color:"var(--color-brand-700)",background:"var(--color-brand-100)",borderRadius:"var(--base-border-radius)",hover:{color:"var(--color-grey-1000)",background:"var(--color-brand-200)"}},btnTertiary:{color:"var(--anchor-color)",background:"transparent",borderRadius:"var(--base-border-radius)",hover:{color:"var(--anchor-hover-color)"}},card:{color:"var(--color-grey-900)",background:"var(--color-grey-100)",borderRadius:"var(--base-border-radius)",boxShadow:"none",hover:{color:"var(--color-grey-1000)",background:"var(--color-brand-100)"},custom:{iconColor:"var(--anchor-color)",iconHoverColor:"var(--anchor-hover-color)"}},input:{background:"var(--color-grey-0)",borderColor:"var(--color-grey-300)",borderWidth:"1px",borderRadius:"var(--base-border-radius)",custom:{padding:"var(--spacer-r-16) var(--spacer-r-20)",placeholderColor:"var(--color-grey-500)",placeholderOpacity:"1"}},label:{color:"var(--color-grey-600)"},hr:{color:"var(--base-line-color)"},checkbox:{color:"transparent",background:"var(--color-grey-0)",borderColor:"var(--color-grey-300)",borderWidth:"1px",borderRadius:"0.2em",custom:{checkedColor:"var(--btn-primary-color)",checkedBorderColor:"var(--color-brand-700)",checkedBackground:"var(--color-brand-700)"}},radio:{color:"transparent",background:"var(--color-grey-0)",borderColor:"var(--color-grey-300)",borderWidth:"1px",custom:{checkedColor:"var(--btn-primary-color)",checkedBorderColor:"var(--color-brand-700)",checkedBackground:"var(--color-brand-700)"}},contextBox:{color:"var(--card-color)",background:"var(--card-background)",borderColor:"var(--card-border-color)",borderWidth:"var(--card-border-width)",borderRadius:"var(--card-border-radius)",boxShadow:"var(--base-box-shadow)",custom:{transitionDuration:200,transitionDelay:200,transitionY:8,titleColor:"var(--color-grey-1000)",titleFontWeight:"var(--base-font-weight-bold)",separatorColor:"var(--base-line-color)",errorColor:"var(--message-error-color)"}},contextBoxMenuItem:{background:"transparent",color:"var(--body-color)",borderRadius:"calc(var(--base-border-radius) / 2)",hover:{color:"var(--btn-secondary-hover-color)",background:"var(--btn-secondary-hover-background)"},custom:{activeColor:"var(--btn-secondary-hover-color)",activeBackground:"var(--btn-secondary-hover-background)"}},chatFooter:{color:"var(--color-grey-400)",background:"var(--body-background)",borderRadius:"var(--base-border-radius)",boxShadow:"0px -10px 20px 5px color-mix(in srgb, var(--body-background) 90%, transparent)"},chatInput:{color:"var(--color-grey-700)",background:"var(--card-background)",borderRadius:"var(--base-border-radius)",borderColor:"transparent",borderWidth:"3px",hover:{background:"var(--card-hover-background)"},focus:{borderColor:"var(--body-focus-color)"}},chatInputSubmit:{color:"var(--btn-primary-color)",background:"var(--btn-primary-background)",borderRadius:"calc(var(--base-border-radius) / 1.25)",hover:{color:"var(--btn-primary-hover-color)",background:"var(--btn-primary-hover-background)"},custom:{strokeWidth:"2",deactivatedBackground:"var(--color-grey-500)",deactivatedOpacity:"0.25",deactivatedScale:"0.8",deactivatedBorderColor:"var(--color-grey-500)"}},chatInputNotification:{background:"#DD135A",color:"var(--color-grey-0)",borderColor:"#DD135A",borderWidth:"1px",borderRadius:"var(--chat-input-border-radius)"},dialog:{background:"var(--card-background)",color:"var(--body-color)",borderColor:"var(--card-border-color)",borderWidth:"var(--card-border-width)",borderRadius:"var(--card-border-radius)",boxShadow:"var(--base-box-shadow)",custom:{transitionDuration:200,transitionDelay:0,transitionY:30,backgroundOverlay:"rgba(0, 0, 0, 0.25)",headerBorderBottomColor:"var(--base-line-color)"}},aside:{background:"var(--card-background)",custom:{width:"400px",containerWidthForMobileLayout:1024,backgroundOverlay:"rgba(0, 0, 0, 0.4)",headerColor:"var(--card-color)",headerBorderColor:"var(--base-line-color)",headerBorderWidth:"1px"}},message:{color:"var(--body-color)",custom:{errorColor:"#C91658",transitionDuration:300,transitionDelay:0,transitionY:30,transitionBotLoadingDelay:300}},messageOptions:{borderColor:"var(--base-line-color)",borderWidth:"1px",custom:{transitionDuration:300,transitionDelay:0,transitionY:30}},messageUser:{color:"var(--body-color)",background:"var(--card-background)",boxShadow:"var(--card-box-shadow)",borderRadius:"var(--card-border-radius)"},openButton:{color:"var(--card-color)",background:"var(--card-background)",borderColor:"var(--card-background)",borderWidth:"0",borderRadius:"calc(var(--base-border-radius) / 2)",hover:{color:"var(--card-hover-color)",background:"var(--card-hover-background)"},custom:{hideTitleWhenCollapsed:0,autoExpandScrollThreshold:0,autoCollapseDelay:0,autoExpandOnce:0}},referencesToggle:{color:"var(--color-brand-700)",hover:{color:"var(--anchor-hover-color)"}},referenceNumberTrigger:{color:"var(--btn-secondary-color)",background:"var(--btn-secondary-background)",borderRadius:"calc(var(--base-border-radius) / 2)",hover:{color:"var(--btn-secondary-hover-color)",background:"var(--btn-secondary-hover-background)"},custom:{padding:"0.25em"}},referenceDomain:{color:"var(--color-brand-700)",hover:{color:"var(--color-brand-800)"},custom:{padding:"0px"}},referenceNumberContent:{color:"var(--card-color)",background:"var(--card-background)",borderColor:"var(--card-border-color)",borderWidth:"var(--card-border-width)",borderRadius:"var(--card-border-radius)",hover:{color:"var(--card-hover-color)",background:"var(--card-hover-background)",borderColor:"var(--card-hover-border-color)",borderWidth:"var(--card-hover-border-width)"},boxShadow:"var(--base-box-shadow)",custom:{width:"95cqi",maxWidth:"450px",transitionDuration:200,transitionDelay:200,transitionY:8}},reference:{color:"var(--card-color)",background:"var(--card-background)",borderColor:"var(--card-border-color)",borderWidth:"var(--card-border-width)",borderRadius:"var(--card-border-radius)",hover:{color:"var(--card-hover-color)",background:"var(--body-background)",borderColor:"var(--card-hover-border-color)",borderWidth:"var(--card-hover-border-width)"}},referenceDescription:{color:"var(--reference-color)",hover:{color:"var(--reference-hover-color)"}},referenceNumber:{color:"var(--reference-number-trigger-color)",background:"var(--body-background)",borderColor:"var(--reference-number-trigger-border-color)",borderWidth:"var(--reference-number-trigger-border-width)",borderRadius:"var(--reference-number-trigger-border-radius)",hover:{color:"var(--reference-number-trigger-color)",background:"var(--reference-number-trigger-background)",borderColor:"var(--reference-number-trigger-border-color)",borderWidth:"var(--reference-number-trigger-border-width)"},custom:{padding:"var(--reference-number-trigger-padding)"}},toast:{background:"var(--card-background)",color:"var(--body-color)",boxShadow:"var(--base-box-shadow)",borderRadius:"var(--card-border-radius)",custom:{iconSuccessColor:"#22c55e",iconErrorColor:"#ef4444",iconWarningColor:"#f97316",iconInfoColor:"#3b82f6"}},tooltip:{background:"var(--color-grey-200)",color:"var(--body-color)",borderRadius:"calc(var(--base-border-radius) / 2)"},flyout:{custom:{backdropColor:"var(--color-brand-800)",backdropOpacity:"0.4",backdropDelayIn:"0",backdropDurationIn:"200",backdropDelayOut:"0",backdropDurationOut:"150",backdropBaseScaleIn:"1",backdropBaseScaleOut:"1",backdropTransformOrigin:"center",backdropScaleDirection:"scale"}}},svgs:{predefinedQuestion:`
77
77
  <svg viewBox="0 0 24 24" >
78
78
  <path d="M11 3.5A10.5 10.5 0 0 0 0.5 14v1.5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
79
79
  <path d="M0.5 15.498a5 5 0 1 0 10 0 5 5 0 1 0 -10 0" fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
@@ -358,7 +358,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An err
358
358
  <path stroke="currentColor" d="M11.998 16.0161c-0.138 0 -0.25 -0.1119 -0.25 -0.25s0.112 -0.25 0.25 -0.25" stroke-width="2"></path>
359
359
  <path stroke="currentColor" d="M11.998 16.0161c0.1381 0 0.25 -0.1119 0.25 -0.25s-0.1119 -0.25 -0.25 -0.25" stroke-width="2"></path>
360
360
  </svg>
361
- `}}},Gf=va(Hl,{tokens:{base:{lineColor:"color-mix(in srgb, var(--color-brand-100) 20%, transparent)"},components:{body:{background:"var(--color-grey-900)",color:"var(--color-grey-100)",focus:{color:"var(--color-highlight-400)"},custom:{selectionColor:"var(--color-grey-1000)",selectionBackground:"var(--color-brand-400)"}},avatar:{color:"var(--color-brand-200)",background:"var(--color-grey-800)"},anchor:{color:"var(--color-brand-300)",hover:{color:"var(--color-brand-50)"}},btnPrimary:{color:"var(--color-grey-1000)",background:"var(--color-brand-300)",hover:{background:"var(--color-brand-100)"}},btnSecondary:{color:"var(--color-brand-100)",background:"var(--color-brand-900)",hover:{color:"var(--color-grey-0)",background:"var(--color-brand-800)"}},btnTertiary:{color:"var(--anchor-color)",background:"transparent",borderRadius:"var(--base-border-radius)",hover:{color:"var(--anchor-hover-color)"}},card:{color:"var(--body-color)",background:"var(--color-grey-800)",hover:{color:"var(--color-grey-0)",background:"var(--color-brand-900)"}},input:{background:"var(--color-grey-900)",borderColor:"var(--color-grey-700)",custom:{placeholderColor:"var(--color-grey-400)"}},label:{color:"var(--color-grey-50)"},checkbox:{background:"var(--color-grey-700)",borderColor:"var(--color-grey-500)",custom:{checkedColor:"var(--color-grey-900)",checkedBorderColor:"var(--color-brand-300)",checkedBackground:"var(--color-brand-300)"}},radio:{background:"var(--color-grey-700)",borderColor:"var(--color-grey-500)",custom:{checkedColor:"var(--color-grey-900)",checkedBorderColor:"var(--color-brand-300)",checkedBackground:"var(--color-brand-300)"}},contextBox:{custom:{titleColor:"var(--color-grey-50)"}},referenceDescription:{color:"var(--color-grey-300)",hover:{color:"var(--color-grey-300)"}},chatFooter:{color:"var(--color-grey-500)"},chatInput:{color:"var(--color-grey-100)"},chatInputSubmit:{custom:{deactivatedBackground:"var(--color-grey-400)",deactivatedBorderColor:"var(--color-grey-400)"}},dialog:{custom:{backgroundOverlay:"rgba(0, 0, 0, 0.5)"}},tooltip:{background:"var(--color-grey-1000)"}}}}),cr={fineGrained:{light:Hl,dark:Gf}},Wf=Object.freeze(Object.defineProperty({__proto__:null,theme:cr},Symbol.toStringTag,{value:"Module"})),Fi=t=>typeof t=="string"?Pi[t]:t,Qf=t=>{const e=Fi(t?.colors?.brand||Pi.gray),r=Fi(t?.colors?.highlight||e),n={0:"#ffffff",1e3:"#000000",...Fi(t?.colors?.grey||Pi.gray)};let a="";return t.avatarImageUrl?a=`<img src="${t.avatarImageUrl}" alt="Avatar" style="width: 100%; height: 100%; object-fit: cover; border-radius: 50%; aspect-ratio: 1 / 1; display: block; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.1));" />`:a=cr.fineGrained.light.tokens.svgs.avatar,{fontURLs:t.font?.urls,tokens:{font:{family:t.font?.family},colors:{brand:e,highlight:r,grey:n},base:{fontSizeXs:t.font?.sizeXs,fontSizeSm:t.font?.sizeSm,fontSizeBody:t.font?.sizeBody,fontSizeH3:t.font?.sizeH3,fontSizeH2:t.font?.sizeH2,fontSizeH1:t.font?.sizeH1,fontWeightNormal:t.font?.weightBold,fontWeightBold:t.font?.weightNormal,fontWeightTitle:t.font?.weightTitle,borderRadius:t.borderRadius},components:{body:{background:t.colors?.background,color:t.colors?.text},anchor:{color:t.colors?.anchor?.default,hover:{color:t.colors?.anchor?.hover}}},svgs:{avatar:a}}}},Yf=t=>{const e=Qf(t);return{light:va(cr.fineGrained.light,e)}},Kf=t=>{const e={};return t.dark&&(e.dark=va(cr.fineGrained.dark,t.dark)),t.light&&(e.light=va(cr.fineGrained.light,t.light)),!t.dark&&!t.light&&(e.light=t.light),e},Rr={de:{askQuestionAgain:"Frage erneut stellen",answerGood:"Gute Antwort",answerBad:"Schlechte Antwort",chatInputPlaceholder:"Fragen Sie mich etwas",chatInputPlaceholderListening:"Ich höre zu...",chatInputSubmit:"Aufforderung senden",chatInputAbort:"Antwort unterbrechen",chatInputStartListening:"Spracherkennung starten",chatInputStopListening:"Spracherkennung beenden",introductionTitle:'Ich bin <span class="liipgpt-gradient-text">LiipGPT</span>. Wie kann ich Ihnen heute helfen?',newChat:"Neuer Chat",maintenanceModeError:"Der Chat ist derzeit nicht verfügbar. Bitte versuchen Sie es später erneut.",messageBotLoading:"Lass mich nachdenken",messageBotError:"Es ist ein Fehler aufgetreten:",messageBotDefaultError:"Unbekannter Fehler",referenceLink:"Link zur Referenz",referencesDisplay:"Referenzen anzeigen",referencesHide:"Referenzen ausblenden",referencesTitle:"Referenzen",referencesFurtherTitle:"Weitere Referenzen",chatFooterText:"",scrollToBottom:"Nach unten scrollen",openMenu:"Menü öffnen",closeMenu:"Menü schließen",closeChat:"Chat schließen",close:"Schließen",openInfo:"Info öffnen",send:"Abschicken",thankYouForFeedback:"Danke für Dein Feedback!",giveFeedback:"Feedback geben",sendFeedback:"Feedback senden",feedbackFormTitle:"Feedback geben, um unseren Chatbot zu verbessern",feedbackFormMessage:"Ihre Nachricht",feedbackFormMessagePlaceholder:"Schreiben Sie hier Ihre Nachricht...",feedbackFormEmail:"E-Mail",feedbackFormEmailPlaceholder:"Ihre E-Mail eingeben...",classificationSubmit:"Abschicken",classificationThankYou:"Danke für Dein Feedback!",classificationTitle:"Bitte bewerten Sie den Einfluss und die Qualität der Antwort",selectLanguage:"Sprache auswählen",languageChanged:"Sprache auf Deutsch geändert.",selectColorTheme:"Farbmodus wählen",lightMode:"Hell",darkMode:"Dunkel",noResultsFound:"Keine Ergebnisse gefunden",aboutThisChat:`
361
+ `,embedAvatar:""}}},mp=Sa(rc,{tokens:{base:{lineColor:"color-mix(in srgb, var(--color-brand-100) 20%, transparent)"},components:{body:{background:"var(--color-grey-900)",color:"var(--color-grey-100)",focus:{color:"var(--color-highlight-400)"},custom:{selectionColor:"var(--color-grey-1000)",selectionBackground:"var(--color-brand-400)"}},avatar:{color:"var(--color-brand-200)",background:"var(--color-grey-800)"},anchor:{color:"var(--color-brand-300)",hover:{color:"var(--color-brand-50)"}},btnPrimary:{color:"var(--color-grey-1000)",background:"var(--color-brand-300)",hover:{background:"var(--color-brand-100)"}},btnSecondary:{color:"var(--color-brand-100)",background:"var(--color-brand-900)",hover:{color:"var(--color-grey-0)",background:"var(--color-brand-800)"}},btnTertiary:{color:"var(--anchor-color)",background:"transparent",borderRadius:"var(--base-border-radius)",hover:{color:"var(--anchor-hover-color)"}},card:{color:"var(--body-color)",background:"var(--color-grey-800)",hover:{color:"var(--color-grey-0)",background:"var(--color-brand-900)"}},input:{background:"var(--color-grey-900)",borderColor:"var(--color-grey-700)",custom:{placeholderColor:"var(--color-grey-400)"}},label:{color:"var(--color-grey-50)"},checkbox:{background:"var(--color-grey-700)",borderColor:"var(--color-grey-500)",custom:{checkedColor:"var(--color-grey-900)",checkedBorderColor:"var(--color-brand-300)",checkedBackground:"var(--color-brand-300)"}},radio:{background:"var(--color-grey-700)",borderColor:"var(--color-grey-500)",custom:{checkedColor:"var(--color-grey-900)",checkedBorderColor:"var(--color-brand-300)",checkedBackground:"var(--color-brand-300)"}},contextBox:{custom:{titleColor:"var(--color-grey-50)"}},referenceDescription:{color:"var(--color-grey-300)",hover:{color:"var(--color-grey-300)"}},chatFooter:{color:"var(--color-grey-500)"},chatInput:{color:"var(--color-grey-100)"},chatInputSubmit:{custom:{deactivatedBackground:"var(--color-grey-400)",deactivatedBorderColor:"var(--color-grey-400)"}},dialog:{custom:{backgroundOverlay:"rgba(0, 0, 0, 0.5)"}},tooltip:{background:"var(--color-grey-1000)"}}}}),fr={fineGrained:{light:rc,dark:mp}},vp=Object.freeze(Object.defineProperty({__proto__:null,theme:fr},Symbol.toStringTag,{value:"Module"})),Ki=t=>typeof t=="string"?Hi[t]:t,bp=t=>{const e=Ki(t?.colors?.brand||Hi.gray),r=Ki(t?.colors?.highlight||e),n={0:"#ffffff",1e3:"#000000",...Ki(t?.colors?.grey||Hi.gray)};let a="";return t.avatarImageUrl?a=`<img src="${t.avatarImageUrl}" alt="Avatar" style="width: 100%; height: 100%; object-fit: cover; border-radius: 50%; aspect-ratio: 1 / 1; display: block; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.1));" />`:a=fr.fineGrained.light.tokens.svgs.avatar,{fontURLs:t.font?.urls,tokens:{font:{family:t.font?.family},colors:{brand:e,highlight:r,grey:n},base:{fontSizeXs:t.font?.sizeXs,fontSizeSm:t.font?.sizeSm,fontSizeBody:t.font?.sizeBody,fontSizeH3:t.font?.sizeH3,fontSizeH2:t.font?.sizeH2,fontSizeH1:t.font?.sizeH1,fontWeightNormal:t.font?.weightBold,fontWeightBold:t.font?.weightNormal,fontWeightTitle:t.font?.weightTitle,borderRadius:t.borderRadius},components:{body:{background:t.colors?.background,color:t.colors?.text},anchor:{color:t.colors?.anchor?.default,hover:{color:t.colors?.anchor?.hover}}},svgs:{avatar:a}}}},kp=t=>{const e=bp(t);return{light:Sa(fr.fineGrained.light,e)}},yp=t=>{const e={};return t.dark&&(e.dark=Sa(fr.fineGrained.dark,t.dark)),t.light&&(e.light=Sa(fr.fineGrained.light,t.light)),!t.dark&&!t.light&&(e.light=t.light),e},Nr={de:{askQuestionAgain:"Frage erneut stellen",answerGood:"Gute Antwort",answerBad:"Schlechte Antwort",chatInputPlaceholder:"Fragen Sie mich etwas",chatInputPlaceholderListening:"Ich höre zu...",chatInputSubmit:"Aufforderung senden",chatInputAbort:"Antwort unterbrechen",chatInputStartListening:"Spracherkennung starten",chatInputStopListening:"Spracherkennung beenden",introductionTitle:'Ich bin <span class="liipgpt-gradient-text">LiipGPT</span>. Wie kann ich Ihnen heute helfen?',newChat:"Neuer Chat",maintenanceModeError:"Der Chat ist derzeit nicht verfügbar. Bitte versuchen Sie es später erneut.",messageBotLoading:"Lass mich nachdenken",messageBotError:"Es ist ein Fehler aufgetreten:",messageBotDefaultError:"Unbekannter Fehler",referenceLink:"Link zur Referenz",referencesDisplay:"Referenzen anzeigen",referencesHide:"Referenzen ausblenden",referencesTitle:"Referenzen",referencesFurtherTitle:"Weitere Referenzen",chatFooterText:"",scrollToBottom:"Nach unten scrollen",openMenu:"Menü öffnen",closeMenu:"Menü schließen",closeChat:"Chat schließen",close:"Schließen",openInfo:"Info öffnen",send:"Abschicken",thankYouForFeedback:"Danke für Dein Feedback!",giveFeedback:"Feedback geben",sendFeedback:"Feedback senden",feedbackFormTitle:"Feedback geben, um unseren Chatbot zu verbessern",feedbackFormMessage:"Ihre Nachricht",feedbackFormMessagePlaceholder:"Schreiben Sie hier Ihre Nachricht...",feedbackFormEmail:"E-Mail",feedbackFormEmailPlaceholder:"Ihre E-Mail eingeben...",classificationSubmit:"Abschicken",classificationThankYou:"Danke für Dein Feedback!",classificationTitle:"Bitte bewerten Sie den Einfluss und die Qualität der Antwort",selectLanguage:"Sprache auswählen",languageChanged:"Sprache auf Deutsch geändert.",selectColorTheme:"Farbmodus wählen",lightMode:"Hell",darkMode:"Dunkel",noResultsFound:"Keine Ergebnisse gefunden",aboutThisChat:`
362
362
  <p>
363
363
  <strong>Dies ist ein Platzhaltertext, um dem Chatbot Kontext zu geben</strong>
364
364
  </p>
@@ -386,4 +386,4 @@ Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An err
386
386
  <p>
387
387
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mauris diam, vestibulum vitae cursus et, hendrerit sed dolor. Sed quis nisl quis ipsum tempus hendrerit. <a href="https://www.liipgpt.ch/" target="_blank">Plus d'informations</a>
388
388
  </p>
389
- `,ariaMainNavigation:"Navigation principale",ariaMainNavigationRegion:"Navigation principale: liens, changement de langue, mode couleur",ariaGotoMainNavigation:"Aller à la navigation principale",ariaAskQuestion:"Saisie texte",ariaAskQuestionRegion:"Poser une question",ariaNotifications:"Notifications",ariaPredefinedQuestions:"Questions prédéfinies",ariaPredefinedQuestionsRegion:"Essayez nos questions d'exemple",ariaChatHistory:"Historique du chat",ariaOpenChat:"Ouvrir le chat",ariaQuestionFromYou:"Votre question:",ariaAnswerFromBot:"Réponse de l'Assistant:",ariaLastAnswerNavigation:"Navigation et options pour la dernière réponse",ariaQuestionSent:"Question envoyée. Génération de la réponse en cours...",ariaAnswerReady:"Réponse prête.",ariaAnswerFinished:"Réponse terminée. Posez une autre question ou naviguez en arrière pour consulter l'historique du chat, donner un avis ou voir les références liées à la réponse.",ariaAskQuestionAgain:"Copier la dernière question dans le champ de saisie pour la reposer",ariaAnswerGood:"Évaluer cette réponse comme bonne",ariaAnswerBad:"Évaluer cette réponse comme mauvaise",ariaReferenceSource:"Source:",ariaGiveFeedback:"Donner un feedback détaillé sur la réponse",ariaLanguageChanged:"Langue française sélectionnée.",ariaLightSelected:"Mode clair activé.",ariaDarkSelected:"Mode sombre activé.",ariaSettings:"Paramètres du chat",ariaSettingsRegion:"Ajustez vos préférences de chat",ariaReferencesRegion:"Références pour la question actuelle",ariaFlyoutRegion:"Chatbot",ariaSelected:"sélectionné",ariaUnselected:"non sélectionné",ariaAllSelected:"Tous les éléments sélectionnés",ariaAllUnselected:"Tous les éléments non sélectionnés",ariaAllReseted:"Éléments par défaut sélectionnés",hideSettings:"Masquer les paramètres",showSettings:"Paramètres",chooseAtLeastOneOption:"Veuillez choisir au moins une option",selectAll:"Tout sélectionner",selectNone:"Tout désélectionner",resetToDefaults:"Réinitialiser",messageTooLong:"Votre message doit être plus court que {questionLengthLimit} caractères. Actuellement, il fait {questionLength} caractères"}},Xf=Object.freeze(Object.defineProperty({__proto__:null,translations:Rr},Symbol.toStringTag,{value:"Module"})),Jf=t=>{t=t??Rr;const e={};return t.de&&(e.de=An(Rr.de,t.de)),t.en&&(e.en=An(Rr.en,t.en)),t.fr&&(e.fr=An(Rr.fr,t.fr)),t.it&&(e.it=An(Rr.it,t.it)),e},Zl=t=>{let e;t.theme?.fineGrained?e=Kf(t.theme?.fineGrained):e=Yf(t?.theme??{});const r=Jf(t?.translations),n={...t,showPredefinedQuestions:t.showPredefinedQuestions??!0,showOverallFeedbackButton:t.showOverallFeedbackButton??!1,showOverallFeedbackEmail:t.showOverallFeedbackEmail??!0,showCloseChatButton:t.showCloseChatButton??!1,showContextInfo:t.showContextInfo??!1,showContextMenu:t.showContextMenu??!1,showReferencesByDefault:t.showReferencesByDefault??!1,showTextFeedback:t.showTextFeedback??!0,showExpandedSelectors:t.showExpandedSelectors??!1,inlineLayout:t.inlineLayout??!1,questionPrefix:t.questionPrefix??"",blockPII:t.blockPII??!1,allowAudioInput:t.allowAudioInput??!1,supportedLanguages:t.supportedLanguages??Object.keys(r),fullTheme:e,translations:r,buttonHref:t.buttonHref,addQueryToUrlParams:t.addQueryToUrlParams??!0,addRetrievalQuestionToUrlParams:t.addRetrievalQuestionToUrlParams??!1,renderKatex:t.renderKatex??!1,sendReferrer:t.sendReferrer??"all",selectorsConfig:t.selectorsConfig??[],questionLengthLimit:t.questionLengthLimit??qf,forceConsent:t.forceConsent??!1,askQuestionAgain:t.askQuestionAgain??!1,enableBackdrop:t.enableBackdrop??!1};return t.classification&&(n.classification=t.classification),t.menu&&(n.menu=t.menu),n},Gl={de:{aborted:"Verbindung zum Server wurde unerwartet unterbrochen. Bitte versuchen Sie es erneut.","client-error":"Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.","server-error":"Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.","sse-error":"Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.",blocked:"Ihre Anfrage wurde blockiert.","pii-detected":"Es wurden persönliche Daten erkannt. Bitte entfernen Sie diese und versuchen Sie es erneut.","incomplete-error":"Ein unbekannter Fehler ist aufgetreten. Die Antwort könnte unvollständig sein.","unexpected-call":"Ein unbekannter Fehler ist aufgetreten. Die Antwort könnte unvollständig sein.","quota-reached":"Kontingent überschritten. Bitte versuchen Sie es später erneut.","rate-limit":"Kontingent überschritten. Bitte versuchen Sie es später erneut.",maintenance:"Der Chat ist derzeit nicht verfügbar. Bitte versuchen Sie es später erneut.","too-long":"Ihre Frage war zu lang, versuchen Sie es mit einer Kürzeren.","too-short":"Ihre Frage war zu kurz, versuchen Sie es mit einer Längeren.","feedback-failed":"Feedback senden fehlgeschlagen. Bitte versuchen Sie es erneut.","speech-not-supported":"Spracherkennung wird nicht unterstützt.","speech-transcription-failed":"Sprachtranskription fehlgeschlagen.","speech-no-text-detected":"Kein Text in der Spracheingabe erkannt.","speech-microphone-access-denied":"Mikrofonzugriff verweigert."},en:{aborted:"Connection to the server was unexpectedly interrupted. Please try again.","client-error":"An unknown error has occurred. Please try again.","server-error":"An unknown error has occurred. Please try again.","sse-error":"An unknown error has occurred. Please try again.",blocked:"Your request has been blocked.","pii-detected":"Personal data has been detected. Please remove it and try again.","incomplete-error":"An unknown error has occurred. The response might be incomplete.","unexpected-call":"An unknown error has occurred. The response might be incomplete.","quota-reached":"Quota exceeded. Please try again later.","rate-limit":"Quota exceeded. Please try again later.",maintenance:"The chat is currently unavailable. Please try again later.","too-long":"Your question was too long, try a shorter one.","too-short":"Your question was too short, try a longer one.","feedback-failed":"Failed to send feedback. Please try again.","speech-not-supported":"Speech recognition is not supported.","speech-transcription-failed":"Speech transcription failed.","speech-no-text-detected":"No text detected in speech input.","speech-microphone-access-denied":"Microphone access denied."},it:{aborted:"La connessione al server è stata interrotta inaspettatamente. Si prega di riprovare.","client-error":"Si è verificato un errore sconosciuto. Si prega di riprovare.","server-error":"Si è verificato un errore sconosciuto. Si prega di riprovare.","sse-error":"Si è verificato un errore sconosciuto. Si prega di riprovare.",blocked:"La tua richiesta è stata bloccata.","pii-detected":"Sono stati rilevati dati personali. Si prega di rimuoverli e riprovare.","incomplete-error":"Si è verificato un errore sconosciuto. La risposta potrebbe essere incompleta.","unexpected-call":"Si è verificato un errore sconosciuto. La risposta potrebbe essere incompleta.","quota-reached":"Quota superata. Si prega di riprovare più tardi.","rate-limit":"Quota superata. Si prega di riprovare più tardi.",maintenance:"La chat non è attualmente disponibile. Si prega di riprovare più tardi.","too-long":"La tua domanda era troppo lunga, prova con una più breve.","too-short":"La tua domanda era troppo breve, prova con una più lunga.","feedback-failed":"Invio del feedback non riuscito. Si prega di riprovare.","speech-not-supported":"Il riconoscimento vocale non è supportato.","speech-transcription-failed":"Trascrizione vocale fallita.","speech-no-text-detected":"Nessun testo rilevato nell'input vocale.","speech-microphone-access-denied":"Accesso al microfono negato."},fr:{aborted:"La connexion au serveur a été interrompue de façon inattendue. Veuillez réessayer.","client-error":"Une erreur inconnue s'est produite. Veuillez réessayer.","server-error":"Une erreur inconnue s'est produite. Veuillez réessayer.","sse-error":"Une erreur inconnue s'est produite. Veuillez réessayer.","pii-detected":"Des données personnelles ont été détectées. Veuillez les supprimer et réessayer.",blocked:"Votre demande a été bloquée.","incomplete-error":"Une erreur inconnue s'est produite. La réponse pourrait être incomplète.","unexpected-call":"Une erreur inconnue s'est produite. La réponse pourrait être incomplète.","quota-reached":"Quota dépassé. Veuillez réessayer plus tard.","rate-limit":"Quota dépassé. Veuillez réessayer plus tard.",maintenance:"Le chat est actuellement indisponible. Veuillez réessayer plus tard.","too-long":"Votre question était trop longue, essayez d'en poser une plus courte.","too-short":"Votre question était trop courte, essayez d'en poser une plus longue.","feedback-failed":"Échec de l'envoi du feedback. Veuillez réessayer.","speech-not-supported":"La reconnaissance vocale n'est pas prise en charge.","speech-transcription-failed":"Échec de la transcription vocale.","speech-no-text-detected":"Aucun texte détecté dans l'entrée vocale.","speech-microphone-access-denied":"Accès au microphone refusé."}},Wl={de:{email:"Bitte keine E-Mail Adressen eingeben",creditCard:"Bitte keine Kreditkarteninformationen eingeben",ahv:"Bitte keine AHV-Nummern eingeben",phoneSwiss:"Bitte keine Telefonnummern eingeben",phoneInternational:"Bitte keine Telefonnummern eingeben",swissPassport:"Bitte keine Passinformationen eingeben",longNumber:"Bitte keine langen Nummern eingeben"},en:{email:"Please do not enter email addresses",creditCard:"Please do not enter credit card information",ahv:"Please do not enter AHV numbers",phoneSwiss:"Please do not enter phone numbers",phoneInternational:"Please do not enter phone numbers",swissPassport:"Please do not enter passport information",longNumber:"Please do not enter long numbers"},it:{email:"Si prega di non inserire indirizzi email",creditCard:"Si prega di non inserire informazioni sulla carta di credito",ahv:"Si prega di non inserire numeri AVS",phoneSwiss:"Si prega di non inserire numeri di telefono",phoneInternational:"Si prega di non inserire numeri di telefono",swissPassport:"Si prega di non inserire informazioni sul passaporto",longNumber:"Si prega di non inserire numeri lunghi"},fr:{email:"Veuillez ne pas saisir d'adresses e-mail",creditCard:"Veuillez ne pas saisir d'informations de carte de crédit",ahv:"Veuillez ne pas saisir de numéros AVS",phoneSwiss:"Veuillez ne pas saisir de numéros de téléphone",phoneInternational:"Veuillez ne pas saisir de numéros de téléphone",swissPassport:"Veuillez ne pas saisir d'informations de passeport",longNumber:"Veuillez ne pas saisir de longs numéros"}},Bi=structuredClone(cr.fineGrained.light);Bi.tokens.colors={brand:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#037ABA",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},highlight:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},grey:{0:"#ffffff",50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#2d3748",900:"#1a202c",950:"#171923",1e3:"#000000"}};const Ql=structuredClone(cr.fineGrained.dark);Ql.tokens.colors=Bi.tokens.colors;const ep=Object.freeze(Object.defineProperty({__proto__:null,theme:{fineGrained:{light:Bi,dark:Ql}}},Symbol.toStringTag,{value:"Module"})),Yl=t=>t.split("/").pop().split(".")[0],tp=Object.assign({"./default/fallback-dev.theme.ts":ep,"./default/fallback.theme.ts":Wf}),ji=new Map;Object.entries(tp).forEach(([t,e])=>{const{error:r,data:n}=Ol.safeParse(e?.theme);if(r){console.error(`Invalid theme in ${t}:`,r);return}ji.set(Yl(t),n)});const w0=t=>{const e=ji.get(t);return e||(console.error(`Theme ${t} not found`),cr)};Array.from(ji.keys());const rp=Object.assign({"./default/fallback.translations.ts":Xf}),Ui=new Map;Object.entries(rp).forEach(([t,e])=>{const{error:r,data:n}=Nl.safeParse(e?.translations);if(r){console.error(`Invalid translations in ${t}:`,r);return}Ui.set(Yl(t),n)});const _0=t=>{const e=Ui.get(t);return e||(console.error(`Theme ${t} not found`),Rr)};Array.from(Ui.keys());const np="en",Kl=(t,e)=>e.includes(t),ba=(t,e)=>{if(Kl(t,e))return t;const r=ap();return Kl(r,e)?r:np},ap=()=>navigator.language.split("-")[0],Xl=(t,e)=>{localStorage.setItem("liipgpt:selectedLanguage",t),e&&(e.lang=t)},Jl=t=>ba(localStorage.getItem("liipgpt:selectedLanguage"),t);var qi,ec;function ip(){return ec||(ec=1,qi=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,a,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(a=n;a--!==0;)if(!t(e[a],r[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(a=n;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[a]))return!1;for(a=n;a--!==0;){var o=i[a];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}),qi}var op=ip();const sp=ql(op),lp=typeof document<"u";let tc=0;class cp{#e=J(_t([]));get toasts(){return _(this.#e)}set toasts(e){P(this.#e,e,!0)}#t=J(_t([]));get heights(){return _(this.#t)}set heights(e){P(this.#t,e,!0)}#a=e=>{const r=this.toasts.findIndex(n=>n.id===e);return r===-1?null:r};addToast=e=>{lp&&this.toasts.unshift(e)};updateToast=({id:e,data:r,type:n,message:a})=>{const i=this.toasts.findIndex(s=>s.id===e),o=this.toasts[i];this.toasts[i]={...o,...r,id:e,title:a,type:n,updated:!0}};create=e=>{const{message:r,...n}=e,a=typeof e?.id=="number"||e.id&&e.id?.length>0?e.id:tc++,i=e.dismissable===void 0?!0:e.dismissable,o=e.type===void 0?"default":e.type;return pt(()=>{this.toasts.find(c=>c.id===a)?this.updateToast({id:a,data:e,type:o,message:r,dismissable:i}):this.addToast({...n,id:a,title:r,dismissable:i,type:o})}),a};dismiss=e=>(pt(()=>{if(e===void 0){this.toasts=this.toasts.map(n=>({...n,dismiss:!0}));return}const r=this.toasts.findIndex(n=>n.id===e);this.toasts[r]&&(this.toasts[r]={...this.toasts[r],dismiss:!0})}),e);remove=e=>{if(e===void 0){this.toasts=[];return}const r=this.#a(e);if(r!==null)return this.toasts.splice(r,1),e};message=(e,r)=>this.create({...r,type:"default",message:e});error=(e,r)=>this.create({...r,type:"error",message:e});success=(e,r)=>this.create({...r,type:"success",message:e});info=(e,r)=>this.create({...r,type:"info",message:e});warning=(e,r)=>this.create({...r,type:"warning",message:e});loading=(e,r)=>this.create({...r,type:"loading",message:e});promise=(e,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:e,type:"loading",message:typeof r.loading=="string"?r.loading:r.loading()}));const a=e instanceof Promise?e:e();let i=n!==void 0;return a.then(o=>{if(typeof o=="object"&&o&&"ok"in o&&typeof o.ok=="boolean"&&!o.ok){i=!1;const s=up(o);this.create({id:n,type:"error",message:s})}else if(r.success!==void 0){i=!1;const s=typeof r.success=="function"?r.success(o):r.success;this.create({id:n,type:"success",message:s})}}).catch(o=>{if(r.error!==void 0){i=!1;const s=typeof r.error=="function"?r.error(o):r.error;this.create({id:n,type:"error",message:s})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),r.finally?.()}),n};custom=(e,r)=>{const n=r?.id||tc++;return this.create({component:e,id:n,...r}),n};removeHeight=e=>{this.heights=this.heights.filter(r=>r.toastId!==e)};setHeight=e=>{const r=this.#a(e.toastId);if(r===null){this.heights.push(e);return}this.heights[r]=e};reset=()=>{this.toasts=[],this.heights=[]}}function up(t){return t&&typeof t=="object"&&"status"in t?`HTTP error! Status: ${t.status}`:`Error! ${t}`}const bt=new cp;function dp(t,e){return bt.create({message:t,...e})}const Vi=Object.assign(dp,{success:bt.success,info:bt.info,warning:bt.warning,error:bt.error,custom:bt.custom,message:bt.message,promise:bt.promise,dismiss:bt.dismiss,loading:bt.loading,getActiveToasts:()=>bt.toasts.filter(t=>!t.dismiss)}),hp=t=>{const e=new Set;Object.getOwnPropertyNames(t).forEach(n=>e.add(n));let r=Object.getPrototypeOf(t);for(;r&&r!==Object.prototype;)Object.getOwnPropertyNames(r).forEach(n=>e.add(n)),r=Object.getPrototypeOf(r);return Array.from(e)},fp=(t,e)=>{const r={};return e.forEach(n=>{r[n]=t[n]}),r},pp=console.warn,gp=()=>{},rc=(t,e)=>pt(()=>{console.warn=gp;const r=e?fp(t,e):t,n=hu(r);return console.warn=pp,n}),mp=t=>t&&typeof t.then=="function";class vp{config;self;devtools;stateKeys;constructor(e,r){this.config=e,this.self=r,typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&(this.stateKeys=hp(this.config.state),this.devtools=window.__REDUX_DEVTOOLS_EXTENSION__.connect({name:this.config.name??"updatelogic"}),this.devtools.init(this.createStateSnapshot()),this.devtools.subscribe(n=>{n.type==="DISPATCH"&&n.state}))}createStateSnapshot(){return rc(this.config.state,this.stateKeys)}sendStart(e,r){this.devtools.send({type:`→ ${e}`,args:r},this.createStateSnapshot())}sendError(e,r,n){this.devtools.send({type:`❌ ${e}`,args:r,error:n},this.createStateSnapshot())}sendSuccess(e,r,n){this.devtools.send({type:`✓ ${e}`,args:r,return:n},this.createStateSnapshot())}isIncluded(e){return this.config.excludeInDevTools?!this.config.excludeInDevTools.includes(e):!0}createProxyFunction(e,r){const n=this.devtools&&this.isIncluded(e);return typeof r=="function"?(...a)=>{if(!n)return pt(()=>r.call(this.self,...a));const i=rc(a);this.sendStart(e,i);try{const o=pt(()=>r.call(this.self,...a));return mp(o)?o.then(s=>(this.sendSuccess(e,i,s),s),s=>{throw this.sendError(e,i,s),s}):(this.sendSuccess(e,i,o),o)}catch(o){throw this.sendError(e,i,o),o}}:r}}const bp=(t,e)=>{const r={},n=new vp(t,r);return Object.keys(e).forEach(a=>{if(a==="state"||a==="name")return;const i=e[a];r[a]=n.createProxyFunction(a,i)}),r};async function kp(){if(typeof navigator>"u"||!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return!1;try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind==="audioinput")}catch(t){return console.error("Error checking for microphone:",t),!1}}function Hi(){return typeof window>"u"||!window.MediaRecorder?null:MediaRecorder.isTypeSupported("audio/mp4")?"audio/mp4":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":MediaRecorder.isTypeSupported("audio/wav")?"audio/wav":null}function nc(){return typeof window>"u"?!1:!!(window.MediaRecorder&&Hi())}class ac{mediaRecorder=null;audioChunks=[];started=!1;starting=!1;stream=null;options;audioContext=null;analyser=null;dataArray=null;volumeUpdateInterval=null;constructor(e={}){this.options=e}async start(){if(this.started||this.starting){console.warn("AudioRecorder: Start already in progress or already started");return}if(!nc()||!navigator.mediaDevices){const e=new Error("MediaRecorder not supported or no microphone access");throw this.options.onError?.(e),e}try{if(this.starting=!0,this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},video:!1}),!this.starting){this.stopStream(this.stream);return}this.mediaRecorder&&this.mediaRecorder.state!=="inactive"&&(console.warn("AudioRecorder: MediaRecorder already active, stopping previous recording"),this.mediaRecorder.stop(),this.cleanup()),this.started=!0,this.starting=!1;const e=Hi();if(!e)throw new Error("No supported media type found");const r={mimeType:e};this.mediaRecorder=new MediaRecorder(this.stream,r),this.audioChunks=[],this.mediaRecorder.ondataavailable=n=>{n.data.size>0&&this.audioChunks.push(n.data)},this.mediaRecorder.onstop=async()=>{const n=this.audioChunks.length>0?new Blob(this.audioChunks,{type:e}):null;await this.options.onDataAvailable?.(n),this.options.onStop?.(),this.cleanup()},this.mediaRecorder.onerror=n=>{const a=new Error(`MediaRecorder error: ${n}`);this.options.onError?.(a),this.cleanup()},this.mediaRecorder.start(),this.setupVolumeAnalysis(this.stream),this.options.onStart?.()}catch(e){this.started=!1,this.starting=!1;const r=e instanceof Error?e:new Error(String(e));throw this.options.onError?.(r),r}}stop(){this.started=!1,this.starting=!1,this.volumeUpdateInterval&&(clearInterval(this.volumeUpdateInterval),this.volumeUpdateInterval=null),this.mediaRecorder&&this.mediaRecorder.state!=="inactive"?this.mediaRecorder.stop():(this.stream&&this.stopStream(this.stream),this.cleanup())}setupVolumeAnalysis(e){if(this.options.onVolumeChange)try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8;const r=this.analyser.frequencyBinCount;this.dataArray=new Uint8Array(r),this.audioContext.createMediaStreamSource(e).connect(this.analyser),this.startVolumeMonitoring()}catch(r){console.warn("Failed to set up volume analysis:",r)}}startVolumeMonitoring(){!this.analyser||!this.dataArray||!this.options.onVolumeChange||(this.volumeUpdateInterval=window.setInterval(()=>{if(!this.analyser||!this.dataArray||!this.started)return;this.analyser.getByteFrequencyData(this.dataArray);let e=0;for(let i=0;i<this.dataArray.length;i++)e+=this.dataArray[i]*this.dataArray[i];let n=Math.sqrt(e/this.dataArray.length)/255;n=Math.pow(n*3,.7);const a=Math.min(100,Math.max(0,Math.round(n*100)));this.options.onVolumeChange?.(a)},100))}get recording(){return this.started&&this.mediaRecorder?.state==="recording"}get isStarting(){return this.starting}stopStream(e){e.getTracks().forEach(r=>r.stop())}cleanup(){this.volumeUpdateInterval&&(clearInterval(this.volumeUpdateInterval),this.volumeUpdateInterval=null),this.audioContext&&(this.audioContext.close().catch(console.warn),this.audioContext=null),this.analyser=null,this.dataArray=null,this.stream&&(this.stopStream(this.stream),this.stream=null),this.mediaRecorder=null,this.audioChunks=[],this.started=!1,this.starting=!1}static isSupported(){return nc()}static getSupportedMediaType(){return Hi()}}const yp=t=>(localStorage.setItem("liipgpt-color-scheme",t),Zi(["light","dark"])),ic=()=>{const t=localStorage.getItem("liipgpt-color-scheme");return t==="light"||t==="dark"?t:"system"},Zi=t=>{let e=ic();return e==="system"&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),t.includes(e)?e:t[0]??"light"},wp=[{type:"email",check:t=>/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/.test(t)},{type:"creditCard",check:t=>/\b(?:\d[ -]*?){13,16}\b/.test(t)},{type:"ahv",check:t=>/\b756\.\d{4}\.\d{4}\.\d{2}\b/.test(t)},{type:"phoneSwiss",check:t=>/\b0(?:\s*\d){2}(?:\s*\/\s*)?(?:\s*\d){7,}\b/.test(t)},{type:"phoneInternational",check:t=>/(?:\+|00)(?:\s*\d){10,}\b/.test(t)},{type:"swissPassport",check:t=>/\b[A-HJ-NP-Z](?=.*\d)[A-HJ-NP-Z0-9]{7}\b/.test(t)},{type:"longNumber",check:t=>/\b\d{9,}\b/.test(t)}],oc=t=>{for(const e of wp)if(e.check(t))return e.type},Gi="liipgpt:selectorValues",Wi="liipgpt:selectorKnownDefaults",sc=()=>{try{const t=vt.getItem(Gi),e=vt.getItem(Wi);return t?{values:JSON.parse(t),knownDefaults:e?JSON.parse(e):{}}:null}catch{return null}},_p=t=>{const e={};for(const r of t)e[r.settingName]=r.defaultValues??(r.allowEmpty?[]:[r.values[0]]).filter(Boolean);return e},lc=(t,e)=>{try{const r=_p(e);vt.setItem(Gi,JSON.stringify(t)),vt.setItem(Wi,JSON.stringify(r))}catch(r){console.error("Failed to save selector values:",r)}},xp=t=>{try{const e=sc();if(!e)return;delete e.values[t],delete e.knownDefaults[t],vt.setItem(Gi,JSON.stringify(e.values)),vt.setItem(Wi,JSON.stringify(e.knownDefaults))}catch(e){console.error("Failed to clear selector saved state:",e)}},Sp=t=>{const e=sc(),r=t.map(n=>{const a=n.defaultValues??(n.allowEmpty?[]:[n.values[0]]).filter(Boolean);if(!e?.values[n.settingName])return[n.settingName,a];const i=e.values[n.settingName],o=e.knownDefaults[n.settingName]||[],s=i.filter(h=>n.values.includes(h)),c=o.filter(h=>!a.includes(h)),l=s.filter(h=>!c.includes(h)),u=a.filter(h=>!o.includes(h)&&!l.includes(h)),p=[...l,...u];return p.length===0&&!n.allowEmpty?[n.settingName,a]:[n.settingName,p]});return Object.fromEntries(r)};class Tp extends Error{constructor(e){super(e),this.name="UnreachableError"}}const cc=(t,e)=>{const n=new URLSearchParams(window.location.search).get("q");return n?{name:"chat-page",query:n}:t&&!e?{name:"consent-page"}:{name:"start-page"}};class Ep{#e=J(_t({}));get data(){return _(this.#e)}set data(e){P(this.#e,e,!0)}#t=J(_t({}));get targets(){return _(this.#t)}set targets(e){P(this.#t,e,!0)}#a=J(!1);get initialized(){return _(this.#a)}set initialized(e){P(this.#a,e,!0)}#l=J(0);get currentAudioVolume(){return _(this.#l)}set currentAudioVolume(e){P(this.#l,e,!0)}ariaLiveMessagesClearingTimeoutDuration=350;#u=J(null);get currentAudioRecorder(){return _(this.#u)}set currentAudioRecorder(e){P(this.#u,e,!0)}#i=J(!1);get isTranscribing(){return _(this.#i)}set isTranscribing(e){P(this.#i,e,!0)}#r=X(()=>{if(!this.initialized)return[];const e=this.data.chatConfig.menu;return e?e[this.data.language]??[]:[]});get menu(){return _(this.#r)}set menu(e){P(this.#r,e)}#o=X(()=>this.initialized?this.data.chatConfig.translations[this.data.language]??{}:{});get t(){return _(this.#o)}set t(e){P(this.#o,e)}#s=X(()=>this.initialized?Gl[this.data.language]??{}:Gl.en??{});get errorTranslations(){return _(this.#s)}set errorTranslations(e){P(this.#s,e)}#n=X(()=>this.initialized?Wl[this.data.language]??{}:Wl.en??{});get piiTranslations(){return _(this.#n)}set piiTranslations(e){P(this.#n,e)}#c=X(()=>this.initialized?this.data.currentColorScheme:"light");get colorScheme(){return _(this.#c)}set colorScheme(e){P(this.#c,e)}#d=X(()=>this.initialized?this.data.chatConfig.fullTheme[this.data.currentColorScheme]:{});get themeBase(){return _(this.#d)}set themeBase(e){P(this.#d,e)}#f=X(()=>this.themeBase.tokens);get theme(){return _(this.#f)}set theme(e){P(this.#f,e)}#h=X(()=>{if(!this.initialized)return[];const e=[];for(const r of this.data.chatConfig.selectorsConfig){if(r.allowEmpty)continue;(this.data.selectorValues[r.settingName]||[]).length===0&&e.push(r.settingName)}return e});get selectorsWithErrors(){return _(this.#h)}set selectorsWithErrors(e){P(this.#h,e)}}const g=new Ep;let ct,kt,uc;bp({name:"chat-logic",state:g,excludeInDevTools:["onInput"]},{async init(t){kt=t;const e=kt.speechRecognitionApiKey||void 0;ct=new Uf({apiUrl:kt.apiUrl,apiKey:kt.apiKey,speechRecognitionApiKey:e,strict:!0});try{const r=await ct.getChatConfig();window.CHAT_CONFIG_OVERRIDE&&Object.assign(r,window.CHAT_CONFIG_OVERRIDE);const a=(await ct.getMetadata()).mode==="maintenance";a&&this.showErrorToast("maintenance");const i=Zl(r);kt.inlineLayout!==void 0&&(i.inlineLayout=kt.inlineLayout);let o;kt.lang?o=ba(kt.lang,i.supportedLanguages):o=Jl(i.supportedLanguages),Xl(o,g.targets.mainElement);const s=await this.getPredefinedQuestions(o),c=[];if(i.renderKatex){const h=await import("https://esm.sh/marked-katex-extension@5.1.5").catch(v=>{console.error("Couldn't load marked-katex-extension:",v)});h&&(ct.setMarkedExtensions(h.default({nonStandard:!0,output:"mathml"})),c.push("https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css"))}const l=Object.keys(i.fullTheme);let u=!1;if(i.forceConsent)try{u=vt.getItem("liipgpt:termsAccepted")==="true"}catch(h){console.warn("Failed to load terms acceptance from storage:",h)}g.data={currentConversationState:"idle",chatConfig:i,language:o,predefinedQuestions:s,isInMaintenance:a,history:[],selectedColorScheme:ic(),has2ColorSchemes:l.length===2,currentColorScheme:Zi(l),conversationFeedbackId:void 0,conversationFeedbackIsOpen:!1,openedPopup:void 0,props:kt,flyoutIsOpen:!1,questionHasPii:void 0,chatInputValue:"",selectorValues:Sp(i.selectorsConfig),selectorsIsOpen:!1,currentReferencesAsideId:void 0,ariaLiveStatusMessage:void 0,ariaLiveStatusMessageClearingTimeout:void 0,wasReferencesAsideClosed:!1,isAsideMobile:!0,route:cc(i.forceConsent??!1,u),additionalStylesheets:c,hasOpenedOverlays:!1,isInlineLayoutContained:!1,termsAccepted:u},window.LIIPGPT_LISTENERS?.route?.(g.data.route),window.LIIPGPT_LISTENERS?.conversation?.(g.data.currentConversationState),g.data.selectorsIsOpen=g.data.chatConfig.showExpandedSelectors??!1,g.initialized=!0,this.checkForOpenedPopup(),window.addEventListener("hashchange",()=>{this.checkForOpenedPopup()}),this.goto(cc(i.forceConsent??!1,u),!0)}catch(r){throw Vi.error(r instanceof Error?r.message:"Failed to load the chatbot. Please reload the page.",{duration:1e4,unstyled:!0,classes:{toast:"toast"}}),r}},setTarget(t,e){g.targets[t]=e},goto(t,e=!1){if(!(!e&&sp(g.data.route,t)))switch(g.data.route=t,window.LIIPGPT_LISTENERS?.route?.(t),t.name){case"consent-page":break;case"start-page":t.prefill&&(g.data.chatInputValue=t.prefill);break;case"chat-page":if(g.data.chatInputValue=t.query,this.onSubmit(),g.data.chatConfig.addQueryToUrlParams){const r=new URLSearchParams(window.location.search);r.set("q",t.query),history.pushState(null,"",`?${r.toString()}`)}break}},getSelectorConfig(t){const e=g.data.chatConfig.selectorsConfig.find(r=>r.settingName===t);if(!e)throw new Error(`Setting ${t} not found`);return e},getPrettifiedSelectorValues(){const t=Object.entries(g.data.selectorValues).map(([e,r])=>{let n;try{n=this.getSelectorConfig(e)}catch(a){console.error(`Error getting selector config for ${e}: ${a}`);return}return n.type==="single-select"?[e,r[0]]:[e,r]}).filter(e=>!!e);return Object.fromEntries(t)},setSelectorValue(t,e){const r=this.getSelectorConfig(t);if(!r){console.warn(`Trying to set setting ${t} but it is not defined in the chat config`);return}if(r.type==="single-select"&&e.length>1){console.warn(`Trying to set multiple values for single-select setting ${t}`);return}g.data.selectorValues[t]=e,lc(g.data.selectorValues,g.data.chatConfig.selectorsConfig)},resetSelectorToDefaults(t){const e=this.getSelectorConfig(t);if(!e){console.warn(`Trying to reset setting ${t} but it is not defined in the chat config`);return}const r=e.defaultValues??(e.allowEmpty?[]:[e.values[0]]).filter(Boolean);return xp(t),g.data.selectorValues[t]=r,lc(g.data.selectorValues,g.data.chatConfig.selectorsConfig),r},async getPredefinedQuestions(t){try{return ct.getPredefinedQuestions({url:window.location.origin+window.location.pathname,language:t})}catch(e){return console.warn("Failed to load predefined questions:",e),[]}},setColorScheme(t){g.data.selectedColorScheme=t,g.data.currentColorScheme=yp(t),this.setAriaLiveStatusMessage(t==="dark"?g.t.ariaDarkSelected:g.t.ariaLightSelected)},async abort(){await uc?.abort()},changeConversationState(t){g.data.currentConversationState=t,window.LIIPGPT_LISTENERS?.conversation?.(t)},onInput(t){g.data.chatConfig.blockPII&&(g.data.questionHasPii=oc(t)),g.data.chatInputValue=t},onSubmit(t=!1){if(g.data.questionHasPii){console.warn("Question contains PII, not submitting:",g.data.questionHasPii);return}const e=g.data.chatConfig.questionPrefix?`${g.data.chatConfig.questionPrefix} ${g.data.chatInputValue}`:g.data.chatInputValue,r=g.data.history.push({type:"user",time:new Date().toISOString(),message:g.data.chatInputValue});g.data.history.push({id:"UNRESOLVED",state:"loading",errors:[],type:"bot",time:new Date().toISOString(),message:{markdown:"",html:"",text:""},references:{all:[],used:[],unused:[]}});const n={features:kt.features?kt.features.trim().split(","):["formatting"],onError:u=>{this.showErrorToast(u),window.LIIPGPT_LISTENERS?.error?.(u),(u==="pii-detected"||u==="blocked")&&this.editLatestQuestion()},lang:g.data.language,selectorValues:this.getPrettifiedSelectorValues()},a=(u,p)=>{try{const h=new URL(u),v=new URL(p);return h.origin===v.origin&&h.pathname===v.pathname}catch{return!1}},i=g.data.chatConfig.sendReferrer??"all";if(["all","own","location"].includes(i)){const u=i==="location"||g.data.props.flyout;let p;u?p=`${window.location.protocol}//${window.location.host}${window.location.pathname}`:p=a(document.referrer,window.location.href)?null:document.referrer;const h=i==="own"&&!g.data.props.flyout&&p&&!p.startsWith(window.location.origin);n.referrer=p&&!h?p:void 0}g.data.currentConversationId||(g.data.currentConversationId=ct.createConversationId());const o=ct.chat(g.data.currentConversationId,e,n);uc=o,g.data.lastChatResponseId=o.id,g.data.currentConversationState!=="searching"&&this.changeConversationState("searching"),this.setAriaLiveStatusMessage(g.t.ariaQuestionSent);let s=!1,c;const l=!!g.data.currentReferencesAsideId;(t&&l||!t&&g.data.chatConfig.showReferencesByDefault)&&(g.data.isAsideMobile||this.openReferencesAside(o.id)),o.subscribe(u=>{if(g.data.history[r]&&(g.data.history[r]={question:g.data.chatInputValue,...u}),g.data.chatConfig.addRetrievalQuestionToUrlParams&&u.retrievalQuestion){const p=new URLSearchParams(window.location.search);p.get("search")!==u.retrievalQuestion&&(p.set("search",u.retrievalQuestion),history.replaceState(null,"",`?${p.toString()}`))}g.data.chatConfig.showReferencesByDefault&&!g.data.wasReferencesAsideClosed&&g.data.currentReferencesAsideId!==u.id&&!g.data.isAsideMobile&&this.openReferencesAside(u.id),u.state==="streaming"&&g.data.currentConversationState!=="answering"&&this.changeConversationState("answering"),u.state==="done"&&(this.changeConversationState("idle"),s||(s=!0,this.setAriaLiveStatusMessage(`${g.t.ariaAnswerReady} ... ${u.message.text} ... ${g.t.ariaAnswerFinished}`)),g.data.currentReferencesAsideId&&g.data.history[r].references.used.length>0?(clearTimeout(c),c=setTimeout(()=>{this.openReferencesAside(u.id)},100)):this.closeReferencesAside())}),g.data.chatInputValue=""},async onStartSpeechRecognition(){try{if(!await kp()){this.showErrorToast("speech-not-supported");return}if(await navigator.mediaDevices.getUserMedia({audio:!0}),ac.isSupported())g.data.chatInputValue="",g.currentAudioRecorder=new ac({onDataAvailable:async e=>{g.isTranscribing=!0,await this.handleTranscription(e)},onError:()=>{this.showErrorToast("speech-microphone-access-denied"),g.currentAudioRecorder=null,g.isTranscribing=!1},onVolumeChange:e=>{g.currentAudioVolume=e}}),g.currentAudioRecorder.start();else{this.showErrorToast("speech-not-supported");return}}catch(t){throw this.showErrorToast("speech-microphone-access-denied"),g.currentAudioRecorder=null,g.isTranscribing=!1,t}},editLatestQuestion(){const t=g.data.history.findLastIndex(r=>r?.type==="user");if(t===-1){console.error("No last user question, available");return}const e=g.data.history.splice(t)[0];g.data.chatInputValue=e.message},onStopSpeechRecognition(){if(g.currentAudioRecorder){const t=g.currentAudioRecorder;g.currentAudioRecorder=null,t.stop()}g.currentAudioVolume=0},async handleTranscription(t){if(!t){console.warn("No audio data received");return}try{const e=await ct.transcribeAudio(t,{lang:g.data.language});if(e.error){this.showErrorToast("speech-transcription-failed");return}if(e.transcript.trim()){if(g.data.chatConfig.blockPII&&(g.data.questionHasPii=oc(e.transcript.trim()),g.data.questionHasPii))return;g.data.chatInputValue=e.transcript.trim()}else this.showErrorToast("speech-no-text-detected")}catch(e){console.error("Speech transcription error:",e),this.showErrorToast("speech-transcription-failed")}finally{g.currentAudioRecorder=null,g.isTranscribing=!1,g.currentAudioVolume=0}},async onStartConversation(t){await this.abort(),g.data.history=[],g.data.currentConversationId=ct.createConversationId(),this.goto({name:"chat-page",query:t})},async onNewConversation(){if(await this.abort(),g.data.currentConversationId=void 0,g.data.currentReferencesAsideId=void 0,g.data.history=[],g.data.chatConfig.addQueryToUrlParams){const t=new URLSearchParams(window.location.search);t.delete("q"),history.pushState(null,"",`?${t.toString()}`)}this.goto({name:"start-page"})},showSuccessToast(t){Vi.success(g.t[t],{unstyled:!0,duration:3e3,classes:{toast:"toast"}})},showErrorToast(t){Vi.error(g.errorTranslations[t],{unstyled:!0,duration:3e3,classes:{toast:"toast"}})},async submitFeedback(t){try{const e=g.data.conversationFeedbackId||g.data.lastChatResponseId;if(!e)throw new Tp("Tried to give feedback with no id.");const r=g.data.history.find(n=>n.type==="bot"&&n.id===e);await ct.feedback(e,r?.question??"",t),setTimeout(()=>{this.showSuccessToast("thankYouForFeedback")},500)}catch(e){console.error("Feedback failed:",e),this.showErrorToast("feedback-failed")}},toggleReferencesAside(t){g.data.currentReferencesAsideId===t?this.closeReferencesAside():this.openReferencesAside(t)},openReferencesAside(t){g.data.currentReferencesAsideId=t,this.setOpenOverlay(!0)},closeReferencesAside(){g.data.currentReferencesAsideId=void 0,g.data.wasReferencesAsideClosed=!0,this.setOpenOverlay(!1)},setAsideMobile(t){g.data.isAsideMobile=t},openFlyout(){g.data.flyoutIsOpen=!0},closeFlyout(){g.data.flyoutIsOpen=!1},openConversationFeedback(){g.data.conversationFeedbackIsOpen=!0,this.setOpenOverlay(!0)},openMessageFeedback(t){g.data.conversationFeedbackId=t},closeFeedback(){g.data.conversationFeedbackIsOpen=!1,g.data.conversationFeedbackId=void 0,this.setOpenOverlay(!1)},setOpenOverlay(t){g.data.hasOpenedOverlays=t},setAriaLiveStatusMessage(t){g.data.ariaLiveStatusMessage=t,clearTimeout(g.data.ariaLiveStatusMessageClearingTimeout),g.data.ariaLiveStatusMessageClearingTimeout=setTimeout(()=>{g.data.ariaLiveStatusMessage=""},g.ariaLiveMessagesClearingTimeoutDuration)},closePopup(){window.location.hash=""},checkForOpenedPopup(){const t=window.location.hash.slice(1),e=g.t.popups?.find(r=>r.hash===t);e?g.data.openedPopup=e:g.data.openedPopup=void 0},async thumbs(t,e){try{const r=g.data.history.find(n=>n.type==="bot"&&n.id===t);e==="up"?await ct.thumbsUp(t,r?.question??""):await ct.thumbsDown(t,r?.question??""),this.showSuccessToast("thankYouForFeedback")}catch(r){console.error("Feedback failed:",r),this.showErrorToast("feedback-failed")}},async onLanguageChange(t){if(g.data.language=ba(t,g.data.chatConfig.supportedLanguages),Xl(g.data.language,g.targets.mainElement),g.data.predefinedQuestions=await this.getPredefinedQuestions(g.data.language),this.setAriaLiveStatusMessage(g.t.ariaLanguageChanged),g.data.chatConfig.reflectLanguageInPath){const e=new URL(window.location.href);e.pathname=`/${g.data.language}`,window.history.replaceState({},"",e.toString())}},async acceptTerms(){g.data.termsAccepted=!0;try{vt.setItem("liipgpt:termsAccepted","true")}catch(t){console.warn("Failed to save terms acceptance to storage:",t)}this.closePopup(),await ns(),this.goto({name:"start-page"})},updateChatInput(t){g.data.chatInputValue=t}});const Cp='@layer base,utilities,components;/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::-moz-placeholder{color:currentcolor}@supports (color: color-mix(in lab,red,red)){{color:color-mix(in oklab,currentcolor 50%,transparent)}}::placeholder{color:currentcolor}@supports (color: color-mix(in lab,red,red)){{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer base{.chat-app{--spacer-1: .0625rem;--spacer-2: .125rem;--spacer-3: .1875rem;--spacer-4: .25rem;--spacer-5: .3125rem;--spacer-6: .375rem;--spacer-8: .5rem;--spacer-10: .625rem;--spacer-12: .75rem;--spacer-16: 1rem;--spacer-20: 1.25rem;--spacer-24: 1.5rem;--spacer-28: 1.75rem;--spacer-32: 2rem;--spacer-40: 2.5rem;--spacer-48: 3rem;--spacer-56: 3.5rem;--spacer-64: 4rem;--spacer-72: 4.5rem;--spacer-80: 5rem;--spacer-120: 7.5rem;--spacer-r-8: clamp(.375rem, .3182rem + .2841cqw, .5rem);--spacer-r-12: clamp(.625rem, .5682rem + .2841cqw, .75rem);--spacer-r-16: clamp(.75rem, .6364rem + .5682cqw, 1rem);--spacer-r-20: clamp(.875rem, .7045rem + .8523cqw, 1.25rem);--spacer-r-24: clamp(1rem, .7727rem + 1.1364cqw, 1.5rem);--spacer-r-28: clamp(1.125rem, .8409rem + 1.4205cqw, 1.75rem);--spacer-r-32: clamp(1.25rem, .9091rem + 1.7045cqw, 2rem);--spacer-r-40: clamp(1.5rem, 1.0455rem + 2.2727cqw, 2.5rem);--spacer-r-48: clamp(1.625rem, 1rem + 3.125cqw, 3rem);--spacer-r-56: clamp(1.75rem, .9545rem + 3.9773cqw, 3.5rem);--spacer-r-64: clamp(2rem, 1.0909rem + 4.5455cqw, 4rem);--spacer-r-80: clamp(3rem, 2.0909rem + 4.5455cqw, 5rem);--spacer-r-96: clamp(3.5rem, 2.3636rem + 5.6818cqw, 6rem);--spacer-r-120: clamp(4rem, 2.4091rem + 7.9545cqw, 7.5rem);--default-transition-duration: .2s;--default-transition-timing-function: ease-in-out;--z-index-flyout: 10000;--z-index-dialog: 600;--z-index-loader: 500;--z-index-reference-number: 400;--z-index-footer: 300;--z-index-header: 200;--z-index-tooltip: 100;--z-index-tooltip-hover: 101;--z-index-local-overlay: 10;--ease-out-quart: cubic-bezier(.165, .84, .44, 1);--ease-in-quart: cubic-bezier(.895, .03, .685, .22);--ease-in-out-quart: cubic-bezier(.77, 0, .175, 1);--fly-in-id: 0;--btn-padding-x: var(--spacer-r-20);--btn-padding-y: var(--spacer-r-8);--btn-icon-size: var(--spacer-24);--btn-submit-size: 2.5em;--last-bot-message-min-height: 0}}@value container-xs,container-sm,container-md,container-lg,container-inner-xs,container-inner-sm,container-inner-md,container-inner-lg from "./viewports.css";@layer base{.chat-app :where(h1,.h1,h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6){font-weight:var(--base-font-weight-title);line-height:var(--base-line-height-tight)}.chat-app :where(b,strong){font-weight:var(--base-font-weight-bold)}.chat-app :where(button){cursor:pointer}.chat-app :where(input[type=text],input[type=email],input[type=search],input[type=password],textarea){width:100%;padding:var(--input-padding);border-width:var(--input-border-width);border-radius:var(--input-border-radius);border-color:var(--input-border-color);background:var(--input-background);box-shadow:var(--input-box-shadow, none);color:var(--input-color)}.chat-app :where(input[type=text],input[type=email],input[type=search],input[type=password],textarea)::-moz-placeholder{color:var(--input-placeholder-color);opacity:var(--input-placeholder-opacity)}.chat-app :where(input[type=text],input[type=email],input[type=search],input[type=password],textarea)::placeholder{color:var(--input-placeholder-color);opacity:var(--input-placeholder-opacity)}.chat-app :where(input[type=radio],input[type=checkbox]){margin:0}.chat-app :where(*:focus-visible){border-radius:var(--btn-primary-border-radius);outline-color:var(--body-focus-color);outline-style:var(--body-focus-style);outline-width:var(--body-focus-width);outline-offset:var(--body-focus-offset)}.chat-app *::-moz-selection{background:var(--body-selection-background);color:var(--body-selection-color)}.chat-app *::selection{background:var(--body-selection-background);color:var(--body-selection-color)}.chat-app ::-webkit-scrollbar{width:8px;height:8px}.chat-app ::-webkit-scrollbar-track{background:transparent}.chat-app ::-webkit-scrollbar-thumb{border-radius:4px;background-color:#0000004d;-webkit-transition:background-color .2s;transition:background-color .2s}.chat-app ::-webkit-scrollbar-thumb:hover{background-color:#00000080}.chat-app *{scrollbar-color:rgba(0,0,0,.3) transparent;scrollbar-width:thin}.chat-app ::-webkit-scrollbar-thumb{visibility:hidden}.chat-app *:hover::-webkit-scrollbar-thumb,.chat-app *:active::-webkit-scrollbar-thumb,.chat-app *:focus::-webkit-scrollbar-thumb{visibility:visible}}@layer utilities{.chat-app :where(.expand-interaction){position:relative}.chat-app :where(.expand-interaction):after{position:absolute;inset:0;background-color:transparent;content:""}.chat-app :where(.sr-only){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.chat-app :where(.transition-colors){transition-duration:var(--default-transition-duration);transition-property:color,background-color,border-color,box-shadow;transition-timing-function:var(--default-transition-timing-function)}.chat-app :where(.transition){transition-duration:var(--default-transition-duration);transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--default-transition-timing-function)}.chat-app :where(.skip-link){position:absolute;width:0px;height:0px;overflow:hidden;color:var(--anchor-color);font-weight:700;font-size:var(--base-font-size-xs)}.chat-app :where(.skip-link):focus-visible{position:static;width:auto;height:auto}.chat-app :where(.fly-in){--fly-in-id: 0;--fly-in-duration: .4s;--fly-out-duration: .2s;--fly-in-delay: .3s;--fly-in-delay-additional: .1s;--fly-in-y: var(--spacer-r-64);transform:translateY(var(--fly-in-y));opacity:0;transition-delay:0s,1s;transition-duration:var(--fly-out-duration);transition-property:opacity,transform;transition-timing-function:ease,var(--ease-out-quart)}.chat-app :where(.mounted .fly-in){transform:translateY(0);opacity:1;transition-delay:calc(var(--fly-in-delay) + var(--fly-in-id) * var(--fly-in-delay-additional));transition-duration:var(--fly-in-duration)}.chat-app :where(.truncate){display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-app :where(.line-clamp){display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.chat-app :where(.line-clamp--2){-webkit-line-clamp:2}.chat-app :where(.line-clamp--6){-webkit-line-clamp:6}.chat-app :where(.container){width:100%;max-width:var(--container-max-width, 1024px);margin:0 auto;padding-right:var(--spacer-16);padding-left:var(--spacer-16)}@container chat-container (min-width: 640px){.chat-app :where(.container){padding-right:var(--spacer-32);padding-left:var(--spacer-32)}}@container chat-container (min-width: 768px){.chat-app :where(.container){padding-right:var(--spacer-48);padding-left:var(--spacer-48)}}.chat-app :where(h1){font-size:var(--base-font-size-h1)}.chat-app :where(h2){font-size:var(--base-font-size-h2)}.chat-app :where(h3){font-size:var(--base-font-size-h3)}.chat-app :where(h4,h5,h6){font-size:var(--body-font-size)}.chat-app :where(.h1){font-size:var(--base-font-size-h1)}.chat-app :where(.h2){font-size:var(--base-font-size-h2)}.chat-app :where(.h3){font-size:var(--base-font-size-h3)}.chat-app :where(.h4,.h5,.h6){font-size:var(--body-font-size)}.chat-app :where(.text-container)>:where(p,ul,ol,img,table){display:block;margin-bottom:var(--spacer-r-24)}.chat-app :where(.text-container)>:where(div){margin:var(--spacer-r-40) 0}.chat-app :where(.text-container)>:where(h1,.h1){margin-bottom:var(--spacer-r-28)}.chat-app :where(.text-container)>:where(h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6){margin-bottom:var(--spacer-r-20)}.chat-app :where(.text-container)>:where(h1,.h1,h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6){margin-top:var(--spacer-r-40)}.chat-app :where(.text-container)>:where(ul:not(.no-list-styling),ol:not(.no-list-styling))>:where(li){margin-bottom:var(--spacer-12)}.chat-app :where(.text-container)>:where(ul:not(.no-list-styling),ol:not(.no-list-styling))>:where(li):last-child{margin-bottom:0}.chat-app :where(.text-container)>:where(ol){padding-left:1.5em;list-style-position:outside;list-style-type:decimal}.chat-app :where(.text-container)>:where(ul:not(.no-list-styling))>:where(li){position:relative;padding-left:1em}.chat-app :where(.text-container)>:where(ul:not(.no-list-styling))>:where(li):before{position:absolute;top:0;left:0;content:"•";font-size:.9em}.chat-app :where(.text-container)>:where(hr){height:1px;margin:var(--spacer-r-40) 0;border:none;background-color:var(--color-grey-700);background-color:var(--hr-color)}.chat-app :where(.text-container) :where(a:not(.button,.no-link-styling,.reference)){color:var(--anchor-color);font-weight:var(--anchor-font-weight, var(--base-font-weight-normal));-webkit-text-decoration:var(--anchor-text-decoration, underline);text-decoration:var(--anchor-text-decoration, underline);text-underline-offset:var(--anchor-text-underline-offset, .15em);transition-duration:var(--default-transition-duration);transition-property:color,background-color,border-color;transition-timing-function:var(--default-transition-timing-function)}.chat-app :where(.text-container) :where(a:not(.button,.no-link-styling,.reference)):hover{color:var(--anchor-hover-color)}.chat-app :where(.text-container) :where(table){display:block;width:100%;overflow-x:auto;border-collapse:collapse;border-spacing:0;-webkit-overflow-scrolling:touch}.chat-app :where(.text-container) :where(th){width:1000px;padding:var(--spacer-12) var(--spacer-16) var(--spacer-12) 0;border-bottom:1px solid var(--color-grey-300);line-height:var(--base-line-height-tight);text-align:left;vertical-align:bottom}.chat-app :where(.text-container) :where(td){padding:var(--spacer-12) var(--spacer-16) var(--spacer-12) 0;border-bottom:1px solid var(--color-grey-300);vertical-align:top}.chat-app :where(.text-container) :where(tr:last-child td){border-bottom:none}.chat-app :where(.text-container) :where(*:first-child){margin-top:0}.chat-app :where(.text-container) :where(*:last-child){margin-bottom:0}.chat-app :where(.animated-height){transition:height .5s var(--ease-in-out-quart)}.chat-app :where(.display-contents){display:contents}.chat-app :where(.absolute){position:absolute!important}}@layer base{.svg{width:var(--spacer-r-24);height:auto}.svg svg{display:block;width:100%;height:auto;overflow:visible}}@layer components{.chat-app{display:contents}.chat-app__container{container-name:chat-container;container-type:inline-size;display:flex;height:100%;overflow:hidden;transform:translateZ(0)}.chat-app__container>:where(*){color:var(--body-color);font-style:normal;font-weight:var(--base-font-weight-normal);font-size:var(--base-font-size-body);line-height:var(--base-line-height-default);font-family:var(--font-family);font-optical-sizing:auto}.chat-app__container.chat-app__container--inline-layout-contained{height:90svh;scroll-margin-top:10svh}@media (min-width: 768px){.chat-app__container.chat-app__container--inline-layout-contained{height:100svh;scroll-margin-top:0}}.chat-app__main{container-name:chat-inner-container;container-type:inline-size;display:flex;flex-direction:column;width:100%;height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior-x:none;overscroll-behavior-y:contain;background:var(--body-background);scrollbar-gutter:stable;touch-action:pan-y}.chat-app__container--inline-layout .chat-app__main{overscroll-behavior-y:auto}.chat-app__loader-container{display:flex;z-index:var(--z-index-loader);position:relative;align-items:center;justify-content:center;width:100%;height:100%}.chat-app__portals{display:contents}.chat-app__header{z-index:var(--z-index-header);position:sticky;top:0;background:var(--body-background)}.chat-app__header--unsticked{position:relative}.chat-app__header-content{--btn-padding-x: var(--btn-padding-y);display:flex;position:relative;-moz-column-gap:var(--spacer-r-12);column-gap:var(--spacer-r-12);flex-wrap:wrap;align-items:center;justify-content:flex-end;margin-right:calc(var(--btn-padding-x) * -1);margin-left:calc(var(--btn-padding-x) * -1);padding-top:var(--spacer-10);padding-bottom:var(--spacer-10)}.chat-app__header-content>:where(*){z-index:0;position:relative;pointer-events:auto}.chat-app__header-content:after{position:absolute;right:var(--btn-padding-x);bottom:0;left:var(--btn-padding-x);border-bottom:1px solid transparent;content:"";transition:border-color .1s ease-in-out}.chat-app__header-content.has-border:after{border-color:var(--base-line-color)}.chat-app__header-new-conversation{position:relative;margin-right:auto}@container chat-container (min-width: 640px){.chat-app__header-new-conversation .tooltip{display:none}}.chat-app__header--with-logo :where(.chat-app__header-content){margin-left:0}.chat-app__header--with-logo :where(.chat-app__header-new-conversation){margin-right:unset;margin-left:auto}.chat-app__header-logo{margin-right:auto}.chat-app__header-logo :where(svg){width:auto;height:var(--spacer-28)}.chat-app__body{display:flex;position:relative;flex-grow:1;flex-direction:column;width:100%}.chat-app__page-transition{display:flex;flex-grow:1;flex-direction:column;width:100%;height:100%}.chat-app__aside{--duration-in: .65s;--duration-out: .5s;visibility:hidden;position:relative;top:0;bottom:0;flex-grow:1;width:0;transition-delay:0s,var(--duration-out);transition-duration:var(--duration-out),0s;transition-property:width,visibility;transition-timing-function:var(--ease-in-out-quart),linear}.chat-app__aside.open{visibility:visible;width:var(--aside-width);transition-delay:0s;transition-duration:var(--duration-in),0s;transition-timing-function:var(--ease-out-quart),linear}.chat-app__aside .tooltip{--background-color: var(--btn-secondary-hover-background)}.chat-app__aside-container{position:relative;width:var(--aside-width);height:100%;overflow-y:auto;overscroll-behavior:contain;border-left-width:var(--aside-border-width);border-color:var(--aside-border-color);background:var(--aside-background);scrollbar-gutter:stable}.chat-app__container--inline-layout .chat-app__aside-container{overscroll-behavior-y:auto}.chat-app__aside-header,.chat-app__sheet-header{display:flex;z-index:var(--z-index-header);position:sticky;top:0;flex-wrap:no-wrap;align-items:center;justify-content:space-between;padding:var(--spacer-12) var(--spacer-12) var(--spacer-12) var(--spacer-24);gap:var(--spacer-24);border-bottom-width:var(--aside-header-border-width);border-color:var(--aside-header-border-color);background:var(--aside-background);color:var(--aside-header-color)}.chat-app__sheet-close{position:relative}.chat-app__sheet-overlay{z-index:var(--z-index-dialog);position:fixed;inset:0;background:var(--aside-background-overlay)}.chat-app__sheet-content{z-index:var(--z-index-flyout);position:fixed;top:0;right:0;width:100%;max-width:var(--aside-width);height:100%;overflow-y:auto;overscroll-behavior:contain;border-left-width:var(--aside-border-width);border-color:var(--aside-border-color);background:var(--aside-background);scrollbar-gutter:stable}.chat-app__container--inline-layout .chat-app__sheet-content{overscroll-behavior-y:auto}:is(.chat-app__aside-close,.chat-app__sheet-close) :where(.btn){background-color:transparent}.chat-app__aside-title,.chat-app__sheet-title{font-size:var(--base-font-size-sm)}.chat-app__close-button{z-index:var(--z-index-flyout)}}@layer components{.open-button{--open-button-avatar-height: var(--spacer-r-80);--open-button-avatar-width: var(--spacer-r-80);--open-button-duration: .4s;--open-button-delay: .3s;--open-button-ease: ease-in-out;display:flex;flex-direction:row;align-items:flex-end;cursor:pointer;transition:opacity .15s ease-out}.open-button--expanded{opacity:0;pointer-events:none}.open-button__text{display:flex;position:absolute;right:100%;bottom:50%;flex-direction:column;align-items:flex-start;justify-content:center;margin-right:calc(var(--open-button-avatar-width) * -.5);padding-top:var(--spacer-r-12);padding-right:0;padding-bottom:var(--spacer-r-12);padding-left:0;overflow:hidden;transform:translateY(50%);border-width:var(--open-button-border-width);border-radius:var(--open-button-border-radius);border-color:var(--open-button-border-color);background:var(--open-button-background);box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;color:var(--open-button-color);text-align:left;transition:transform var(--open-button-duration) var(--open-button-ease),padding-right var(--open-button-duration) var(--open-button-delay) var(--open-button-ease)}.open-button:is(:hover,.open-button--programmatic-expand) .open-button__text{transform:translateY(0);background:var(--open-button-hover-background, var(--open-button-background));color:var(--open-button-hover-color, var(--open-button-color));opacity:1;transition:transform var(--open-button-duration) var(--open-button-delay) var(--open-button-ease)}.open-button__title{max-width:240px;padding:0 calc(var(--open-button-avatar-width) * .5 + var(--spacer-r-12)) 0 var(--spacer-r-12);font-weight:700;white-space:pre}.open-button__mask{width:0;height:0;overflow:hidden;transition:width var(--open-button-duration) var(--open-button-delay) var(--open-button-ease),height var(--open-button-duration) var(--open-button-ease)}.open-button:is(:hover,.open-button--programmatic-expand) .open-button__mask{transition:width var(--open-button-duration) var(--open-button-ease),height var(--open-button-duration) var(--open-button-delay) var(--open-button-ease)}.open-button__description{position:relative;width:50cqw;max-width:260px;padding:0 calc(var(--open-button-avatar-width) * .5 + var(--spacer-r-12)) 0 var(--spacer-r-12);text-wrap:balance}.open-button__avatar{z-index:var(--z-index-local-overlay);position:relative;width:var(--open-button-avatar-width);height:var(--open-button-avatar-height);overflow:clip;border-radius:var(--spacer-r-80);filter:drop-shadow(0 4px 6px rgba(0,0,0,.15));transition:transform .2s var(--open-button-ease)}.open-button:is(:hover,.open-button--programmatic-expand) .open-button__avatar{transform:scale(1.05)}.open-button__link-icon{display:none;position:absolute;right:0;width:var(--spacer-r-80);height:var(--spacer-r-80);padding:var(--spacer-r-20);color:var(--open-button-color)}:where(.open-button--standalone){position:fixed;right:var(--spacer-r-16);bottom:var(--spacer-r-16)}@media (prefers-reduced-motion: reduce){.open-button__text,.open-button__mask,.open-button:hover .open-button__text,.open-button:hover .open-button__mask{transition:none!important}.open-button__avatar,.open-button:hover .open-button__avatar{filter:none!important;transition:none!important}}.open-button--hide-title-when-collapsed .open-button__text{visibility:hidden;opacity:0;transition:transform var(--open-button-duration) var(--open-button-ease),padding-right var(--open-button-duration) var(--open-button-delay) var(--open-button-ease),opacity var(--open-button-duration) var(--open-button-delay) var(--open-button-ease),visibility 0s linear calc(var(--open-button-duration) + var(--open-button-delay))}.open-button--hide-title-when-collapsed:is(:hover,.open-button--programmatic-expand) .open-button__text{visibility:visible;transform:translateY(0);background:var(--open-button-hover-background, var(--open-button-background));color:var(--open-button-hover-color, var(--open-button-color));opacity:1;transition:transform var(--open-button-duration) var(--open-button-delay) var(--open-button-ease),opacity var(--open-button-duration) var(--open-button-ease),visibility 0s linear 0s}}',Ap=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),Rp=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),Ip=new RegExp("(\\d)(\\p{Ll})","gu"),Lp=new RegExp("(\\p{L})(\\d)","gu"),Op=/[^\p{L}\d]+/giu,ka="$1\0$2",Mp="";function Pp(t,e){let r=t.trim();r=r.replace(Ap,ka).replace(Rp,ka),e?.separateNumbers&&(r=r.replace(Ip,ka).replace(Lp,ka)),r=r.replace(Op,"\0");let n=0,a=r.length;for(;r.charAt(n)==="\0";)n++;if(n===a)return[];for(;r.charAt(a-1)==="\0";)a--;return r.slice(n,a).split(/\0/g)}function Np(t,e){return zp(t,e?.prefixCharacters)+Pp(t,e).map($p(e?.locale)).join(e?.delimiter??" ")}function Dp(t,e){return Np(t,{delimiter:"-",...e})}function $p(t){return t===!1?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t)}function zp(t,e=Mp){let r="";for(let n=0;n<t.length;n++){const a=t.charAt(n);if(e.includes(a))r+=a;else break}return r}const ya=Dp,Fp=640,Bp=1024;let wa=null;const jp=()=>{if(wa)return wa;if(!globalThis.document)return 16;const t=globalThis.document.querySelector(":root");return wa=Number(getComputedStyle(t).fontSize.slice(0,-2)),wa},Up=({minRem:t,maxRem:e})=>{const r=jp(),n=Fp/r,a=Bp/r,i=(e-t)/(a-n),o=-n*i+t;return`clamp( ${t}rem, ${o}rem + ${i*100}cqw, ${e}rem )`},dc=t=>typeof t=="string"?t:typeof t=="number"?String(t):typeof t=="object"?t.minRem===t.maxRem?`${t.minRem}rem`:Up(t):"",Qi=(t,e,r,n=!1)=>{let a="";return r.forEach(i=>{let o=e[i];n&&!o&&i==="borderWidth"&&(o="0px"),n&&!o&&i==="borderColor"&&(o="transparent"),o&&(a+=`--${ya(t)}-${ya(i)}:${dc(o)}; `)}),a},hc=(t,e)=>Object.entries(e).map(([r,n])=>`--${t}-${ya(r)}:${dc(n)}`).join("; ")+"; ",qp=(t,e)=>{let r="";return r+=Qi(t,e,["background","borderWidth","borderColor","boxShadow","borderRadius","color"],!0),e.hover&&(r+=Qi(`${t}-hover`,e.hover,["background","borderWidth","borderColor","boxShadow","color"])),e.focus&&(r+=Qi(`${t}-focus`,e.focus,["background","borderWidth","borderColor","boxShadow","color"])),e.custom&&(r+=hc(t,e.custom)),r},Vp=(t,e)=>Object.entries(e).map(([r,n])=>`--color-${t}-${r}:${n}`).join("; ")+"; ",Hp=t=>`--font-family: ${t?.family||"inherit"};`,Zp=t=>{const e=Hp(t.font),r=Object.entries(t.colors).map(([i,o])=>Vp(i,o)).join(""),n=hc("base",t.base),a=Object.entries(t.components).map(([i,o])=>qp(ya(i),o)).join("");return`.chat-app {${e} ${r} ${n} ${a}};`};var ut=typeof window<"u"?window:{screen:{},navigator:{}},Kr=(ut.matchMedia||function(){return{matches:!1}}).bind(ut),Gp={get passive(){return!0}},fc=function(){};ut.addEventListener&&ut.addEventListener("p",fc,Gp),ut.removeEventListener&&ut.removeEventListener("p",fc,!1);var Yi="ontouchstart"in ut,Wp="TouchEvent"in ut,Qp=Yi||Wp&&Kr("(any-pointer: coarse)").matches,pc=(ut.navigator.maxTouchPoints||0)>0||Qp,gc=ut.navigator.userAgent||"",Yp=Kr("(pointer: coarse)").matches&&/iPad|Macintosh/.test(gc)&&Math.min(ut.screen.width||0,ut.screen.height||0)>=768,mc=(Kr("(pointer: coarse)").matches||!Kr("(pointer: fine)").matches&&Yi)&&!/Windows.*Firefox/.test(gc),Kp=Kr("(any-pointer: fine)").matches||Kr("(any-hover: hover)").matches||Yp||!Yi,vc=pc&&(Kp||!mc)?"hybrid":pc?"touchOnly":"mouseOnly",Xp=vc==="mouseOnly"?"mouse":vc==="touchOnly"||mc?"touch":"mouse";function bc(t,e){Pr(e,!0);let r=oe(e,"href",7),n=oe(e,"target",7),a=oe(e,"onclick",7),i=oe(e,"className",23,()=>[]),o=oe(e,"isStandalone",7,!1),s=oe(e,"children",7),c=oe(e,"type",7,"button"),l=oe(e,"use",7),u=oe(e,"class",7),p=oi(e,["$$slots","$$events","$$legacy","$$host","href","target","onclick","className","isStandalone","children","type","use","class"]);const h=X(()=>r()?"a":"button"),v=X(()=>[...Array.isArray(i())?i():i()?[i()]:[],...u()?[u()]:[]]),m=()=>({}),b=X(()=>l()??m);var C=gt(),y=Le(C);return gs(y,()=>_(h),!1,(k,w)=>{ms(k,U=>_(b)?.(U)),xs(k,U=>({...p,onclick:r()?void 0:a(),type:r()?void 0:c(),href:r(),role:r()?"link":"button",target:r()?n():void 0,class:_(v),[jr]:U}),[()=>({"open-button--standalone":o()})]);var T=gt(),R=Le(T);hs(R,s),ie(w,T)}),ie(t,C),Nr({get href(){return r()},set href(k){r(k),ee()},get target(){return n()},set target(k){n(k),ee()},get onclick(){return a()},set onclick(k){a(k),ee()},get className(){return i()},set className(k=[]){i(k),ee()},get isStandalone(){return o()},set isStandalone(k=!1){o(k),ee()},get children(){return s()},set children(k){s(k),ee()},get type(){return c()},set type(k="button"){c(k),ee()},get use(){return l()},set use(k){l(k),ee()},get class(){return u()},set class(k){u(k),ee()}})}pn(bc,{href:{},target:{},onclick:{},className:{},isStandalone:{},children:{},type:{},use:{},class:{}},[],[],!0);function Rn(t,e){Pr(e,!0);let r=oe(e,"css",7),n=oi(e,["$$slots","$$events","$$legacy","$$host","css"]);const a=c=>{Uo(()=>{r()&&(c.innerHTML=r())})};var i=gt(),o=Le(i);{var s=c=>{var l=gt(),u=Le(l);gs(u,()=>"style",!1,(p,h)=>{ms(p,v=>a?.(v)),xs(p,()=>({...n}))}),ie(c,l)};ir(o,c=>{r()&&c(s)})}return ie(t,i),Nr({get css(){return r()},set css(c){r(c),ee()}})}pn(Rn,{css:{}},[],[],!0);var Jp=Tt('<div class="open-button__title"><!></div>'),e0=Tt('<div class="open-button__mask"><div class="open-button__description"><!></div></div>'),t0=Tt('<div class="open-button__text"><!> <!></div>'),r0=Tt('<div class="sr-only"> </div>'),n0=Tt('<!> <div class="svg svg--avatar open-button__avatar" aria-hidden="true"><!></div>',1),a0=Tt('<link rel="stylesheet"/>'),i0=Tt("<!> <!>",1),o0=Tt('<!> <!> <!> <main class="chat-app"><!></main>',1);function kc(t,e){Pr(e,!0);const r=(F,$)=>{let G=()=>$?.().chatConfig,Be=()=>$?.().language,be=()=>$?.().colorScheme;const se=X(()=>{const{openButtonTitle:we,openButtonDescription:ae}=G().translations[Be()];return{openButtonTitle:we,openButtonDescription:ae}}),je=X(()=>G().fullTheme[be()].tokens.svgs),ke=X(()=>G().fullTheme[be()]?.tokens.components.openButton?.custom),ye=X(()=>!!_(ke)?.hideTitleWhenCollapsed);{let we=X(()=>G().buttonHref?void 0:s()?"true":"false"),ae=X(()=>G().buttonHref?void 0:"true"),Je=X(()=>G().buttonHref?void 0:o()),Ue=X(()=>["open-button",e.buttonClass,g.data.flyoutIsOpen?"open-button--expanded":void 0,_(ye)?"open-button--hide-title-when-collapsed":void 0]);bc(F,{get href(){return G().buttonHref},onclick:xa,onmouseenter:_a,onmouseleave:Ji,use:Qt,get"aria-expanded"(){return _(we)},get"aria-haspopup"(){return _(ae)},get"aria-controls"(){return _(Je)},get style(){return e.buttonStyle},get className(){return _(Ue)},get isStandalone(){return _(h)},children:(dt,Yt)=>{var It=n0(),Ln=Le(It);{var Sa=et=>{var Ve=t0(),Lr=Bt(Ve);{var Ta=Lt=>{var tt=Jp(),Ot=Bt(tt);ti(Ot,()=>_(se).openButtonTitle),$t(tt),ie(Lt,tt)};ir(Lr,Lt=>{_(se).openButtonTitle&&Lt(Ta)})}var Ea=nr(Lr,2);{var On=Lt=>{var tt=e0(),Ot=Bt(tt),yt=Bt(Ot);ti(yt,()=>_(se).openButtonDescription),$t(Ot),As(Ot,Mt=>P(k,Mt),()=>_(k)),$t(tt),As(tt,Mt=>P(y,Mt),()=>_(y)),ie(Lt,tt)};ir(Ea,Lt=>{_(se).openButtonDescription&&Xp==="mouse"&&Lt(On)})}$t(Ve),ie(et,Ve)},eo=et=>{var Ve=r0(),Lr=Bt(Ve,!0);$t(Ve),Zn(()=>cs(Lr,g.t.ariaOpenChat)),ie(et,Ve)};ir(Ln,et=>{_(se).openButtonTitle||_(se).openButtonDescription?et(Sa):et(eo,!1)})}var Jr=nr(Ln,2),Ir=Bt(Jr);ti(Ir,()=>_(je).avatar),$t(Jr),ie(dt,It)},$$slots:{default:!0}})}};let n=J("light"),a=oe(e,"host",7),i=oe(e,"onError",7),o=oe(e,"flyoutId",7),s=oe(e,"flyoutIsOpen",7),c=oi(e,["$$slots","$$events","$$legacy","$$host","host","onError","flyoutId","flyoutIsOpen"]);const l=async F=>{const G=await(await fetch(`${F}/chatconfig`)).json();return Fl.parse(G)},u=async({forceTheme:F,lang:$,apiUrl:G})=>{const Be=window.CHAT_CONFIG_OVERRIDE?window.CHAT_CONFIG_OVERRIDE:await l(G),be=Zl(Be);let se;$?se=ba($,be.supportedLanguages):se=Jl(be.supportedLanguages);const je=Object.keys(be.fullTheme),ke=Zi(je);return{chatConfig:be,language:se,colorScheme:ke}},p=(F,$)=>{if(F==null)return $;if(typeof F=="string"){const G=F.trim().toLowerCase();return!(G===""||G==="0"||G==="false"||G==="no")}return typeof F=="number"?F!==0:typeof F=="boolean"?F:$};let h=X(()=>!!a()),v=J(!1),m=J(!1),b=J(!1),C=J(void 0),y=J(void 0),k=J(void 0),w=X(()=>_(k)?.offsetWidth??0),T=X(()=>_(k)?.offsetHeight??0),R=J(void 0),U=J(!1),Q,Fe=J(!0);function le(){return _(R)?(clearTimeout(_(R)),P(R,void 0),!0):!1}async function ur(F){P(n,F.colorScheme,!0),Q?.(),le(),P(U,!1);const $=F.chatConfig.fullTheme[_(n)]?.tokens.components.openButton?.custom??{},G=$.autoExpandScrollThreshold,Be=Number($.autoCollapseDelay??0),be=Number.isNaN(Be)?0:Math.max(0,Be),se=p($.autoExpandOnce,!1),je=(()=>{if(G==null)return 100;if(typeof G=="string"){if(G.trim().toLowerCase()==="none")return 0;const Ue=Number(G);return Number.isNaN(Ue)?100:Ue}const ae=Number(G);return Number.isNaN(ae)?100:ae})();if(Number.isNaN(je)||je<=0)return;const ke=`liipgpt-auto-expand-${e.apiUrl}`;let ye=!1;if(typeof window<"u")try{ye=window.localStorage.getItem(ke)==="true"}catch(ae){console.warn("LiipGPT: unable to read auto-expand flag",ae)}P(b,ye,!0);const we=()=>{if(!(window.scrollY/window.innerHeight*100>=je)){P(Fe,!0);return}if(!(_(m)||s())&&!(se&&(ye||_(b)))&&_(Fe)){if(P(Fe,!1),P(m,!0),P(b,!0),Ki(),se&&typeof window<"u")try{window.localStorage.setItem(ke,"true")}catch(Ue){console.warn("LiipGPT: unable to persist auto-expand flag",Ue)}P(R,setTimeout(()=>{_(U)||(Xi(),P(m,!1)),P(R,void 0)},be),!0)}};window.addEventListener("scroll",we,{passive:!0}),je===0&&(await ns(),we()),Q=()=>{window.removeEventListener("scroll",we)}}function ne(){le(),P(m,!1),P(U,!1)}function Qt(F){P(C,F,!0)}function dr(){Q?.(),le()}td(dr);function hr(){!_(k)||!_(y)||(_(y).style.width=`${_(w)}px`,_(y).style.height=`${_(T)}px`)}function Xr(){_(y)&&(_(y).style.width="0",_(y).style.height="0")}function Ki(){_(C)&&(_(C).classList.add("open-button--programmatic-expand"),hr())}function Xi(){_(C)&&(_(C).classList.remove("open-button--programmatic-expand"),Xr())}function _a(){le()&&P(U,!0),hr()}function Ji(){le(),_(U)&&(P(m,!1),P(U,!1),_(C)?.classList.remove("open-button--programmatic-expand")),_(v)||Xr()}function xa(F){ne(),e.onclick?.(F)}let ce=X(()=>u(c).then(async F=>(await ur(F),F)).catch(F=>i()(F)));var In=gt();Bu("beforeunload",Ha,dr),Uu(F=>{var $=gt(),G=Le($);{var Be=be=>{var se=gt(),je=Le(se);fs(je,()=>_(ce),null,(ke,ye)=>{var we=i0();const ae=X(()=>_(ye).chatConfig.fullTheme[_(ye).colorScheme]);var Je=Le(we);ad(Je,17,()=>_(ae).fontURLs??[],rd,(dt,Yt)=>{var It=a0();Zn(()=>ii(It,"href",_(Yt))),ie(dt,It)});var Ue=nr(Je,2);Rn(Ue,{id:"font-css",get css(){return _(ae).fontCSS}}),ie(ke,we)}),ie(be,se)};ir(G,be=>{_(h)&&be(Be)})}ie(F,$)});var fe=Le(In);return fs(fe,()=>_(ce),F=>{},(F,$)=>{var G=gt();const Be=X(()=>_($).chatConfig.fullTheme[_(n)]);var be=Le(G);{var se=ke=>{var ye=o0(),we=Le(ye);{let Yt=X(()=>Zp(_(Be).tokens));Rn(we,{id:"theme-css",get css(){return _(Yt)}})}var ae=nr(we,2);Rn(ae,{id:"app-css",get css(){return Cp}});var Je=nr(ae,2);Rn(Je,{id:"custom-css",get css(){return _(Be).customCSS}});var Ue=nr(Je,2),dt=Bt(Ue);r(dt,()=>_($)),$t(Ue),ie(ke,ye)},je=ke=>{r(ke,()=>_($))};ir(be,ke=>{_(h)?ke(se):ke(je,!1)})}ie(F,G)}),ie(t,In),Nr({get host(){return a()},set host(F){a(F),ee()},get onError(){return i()},set onError(F){i(F),ee()},get flyoutId(){return o()},set flyoutId(F){o(F),ee()},get flyoutIsOpen(){return s()},set flyoutIsOpen(F){s(F),ee()}})}pn(kc,{host:{},onError:{},flyoutId:{},flyoutIsOpen:{}},[],[],!0);function yc(t,e){Pr(e,!0);let r=oe(e,"onclick",7),n=oe(e,"buttonClass",7),a=oe(e,"buttonStyle",7),i=oe(e,"apiUrl",7),o=oe(e,"forceTheme",7),s=oe(e,"lang",7),c=X(()=>({onclick:r(),buttonClass:n(),buttonStyle:a(),apiUrl:i(),forceTheme:o(),lang:s()}));return Is(t,{silent:!0,body:(u,p=pr)=>{kc(u,wd({host:e.$$host,get onError(){return p()}},()=>_(c)))},$$slots:{body:!0}}),Nr({get onclick(){return r()},set onclick(l){r(l),ee()},get buttonClass(){return n()},set buttonClass(l){n(l),ee()},get buttonStyle(){return a()},set buttonStyle(l){a(l),ee()},get apiUrl(){return i()},set apiUrl(l){i(l),ee()},get forceTheme(){return o()},set forceTheme(l){o(l),ee()},get lang(){return s()},set lang(l){s(l),ee()}})}return customElements.define("liipgpt-button",pn(yc,{forceTheme:{attribute:"force-theme",type:"String"},buttonClass:{attribute:"button-class",type:"String"},buttonStyle:{attribute:"button-style",type:"String"},apiUrl:{attribute:"api-url",type:"String"},lang:{attribute:"lang",type:"String"},onclick:{}},[],[],!0)),rn.LiipGPTButton=yc,Object.defineProperty(rn,Symbol.toStringTag,{value:"Module"}),rn}({});
389
+ `,ariaMainNavigation:"Navigation principale",ariaMainNavigationRegion:"Navigation principale: liens, changement de langue, mode couleur",ariaGotoMainNavigation:"Aller à la navigation principale",ariaAskQuestion:"Saisie texte",ariaAskQuestionRegion:"Poser une question",ariaNotifications:"Notifications",ariaPredefinedQuestions:"Questions prédéfinies",ariaPredefinedQuestionsRegion:"Essayez nos questions d'exemple",ariaChatHistory:"Historique du chat",ariaOpenChat:"Ouvrir le chat",ariaQuestionFromYou:"Votre question:",ariaAnswerFromBot:"Réponse de l'Assistant:",ariaLastAnswerNavigation:"Navigation et options pour la dernière réponse",ariaQuestionSent:"Question envoyée. Génération de la réponse en cours...",ariaAnswerReady:"Réponse prête.",ariaAnswerFinished:"Réponse terminée. Posez une autre question ou naviguez en arrière pour consulter l'historique du chat, donner un avis ou voir les références liées à la réponse.",ariaAskQuestionAgain:"Copier la dernière question dans le champ de saisie pour la reposer",ariaAnswerGood:"Évaluer cette réponse comme bonne",ariaAnswerBad:"Évaluer cette réponse comme mauvaise",ariaReferenceSource:"Source:",ariaGiveFeedback:"Donner un feedback détaillé sur la réponse",ariaLanguageChanged:"Langue française sélectionnée.",ariaLightSelected:"Mode clair activé.",ariaDarkSelected:"Mode sombre activé.",ariaSettings:"Paramètres du chat",ariaSettingsRegion:"Ajustez vos préférences de chat",ariaReferencesRegion:"Références pour la question actuelle",ariaFlyoutRegion:"Chatbot",ariaSelected:"sélectionné",ariaUnselected:"non sélectionné",ariaAllSelected:"Tous les éléments sélectionnés",ariaAllUnselected:"Tous les éléments non sélectionnés",ariaAllReseted:"Éléments par défaut sélectionnés",hideSettings:"Masquer les paramètres",showSettings:"Paramètres",chooseAtLeastOneOption:"Veuillez choisir au moins une option",selectAll:"Tout sélectionner",selectNone:"Tout désélectionner",resetToDefaults:"Réinitialiser",messageTooLong:"Votre message doit être plus court que {questionLengthLimit} caractères. Actuellement, il fait {questionLength} caractères"}},wp=Object.freeze(Object.defineProperty({__proto__:null,translations:Nr},Symbol.toStringTag,{value:"Module"})),_p=t=>{t=t??Nr;const e={};return t.de&&(e.de=Ln(Nr.de,t.de)),t.en&&(e.en=Ln(Nr.en,t.en)),t.fr&&(e.fr=Ln(Nr.fr,t.fr)),t.it&&(e.it=Ln(Nr.it,t.it)),e},xp=t=>({init:t?.init??[],bot:{before:t?.bot?.before??[],after:t?.bot?.after??[]},user:{before:t?.user?.before??[],after:t?.user?.after??[]}}),nc=t=>{let e;t.theme?.fineGrained?e=yp(t.theme?.fineGrained):e=kp(t?.theme??{});const r=_p(t?.translations),n={...t,showPredefinedQuestions:t.showPredefinedQuestions??!0,showOverallFeedbackButton:t.showOverallFeedbackButton??!1,showOverallFeedbackEmail:t.showOverallFeedbackEmail??!0,showCloseChatButton:t.showCloseChatButton??!1,showContextInfo:t.showContextInfo??!1,showContextMenu:t.showContextMenu??!1,showReferencesByDefault:t.showReferencesByDefault??!1,showTextFeedback:t.showTextFeedback??!0,showExpandedSelectors:t.showExpandedSelectors??!1,inlineLayout:t.inlineLayout??!1,questionPrefix:t.questionPrefix??"",blockPII:t.blockPII??!1,allowAudioInput:t.allowAudioInput??!1,supportedLanguages:t.supportedLanguages??Object.keys(r),fullTheme:e,translations:r,buttonHref:t.buttonHref,addQueryToUrlParams:t.addQueryToUrlParams??!0,addRetrievalQuestionToUrlParams:t.addRetrievalQuestionToUrlParams??!1,renderKatex:t.renderKatex??!1,sendReferrer:t.sendReferrer??"all",selectorsConfig:t.selectorsConfig??[],questionLengthLimit:t.questionLengthLimit??hp,forceConsent:t.forceConsent??!1,askQuestionAgain:t.askQuestionAgain??!1,enableBackdrop:t.enableBackdrop??!1,messageAdditions:xp(t.messageAdditions??{}),contextVersion:t.contextVersion??0};return t.classification&&(n.classification=t.classification),t.menu&&(n.menu=t.menu),n},ac={de:{aborted:"Verbindung zum Server wurde unerwartet unterbrochen. Bitte versuchen Sie es erneut.","client-error":"Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.","server-error":"Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.","sse-error":"Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es erneut.",blocked:"Ihre Anfrage wurde blockiert.","pii-detected":"Es wurden persönliche Daten erkannt. Bitte entfernen Sie diese und versuchen Sie es erneut.","incomplete-error":"Ein unbekannter Fehler ist aufgetreten. Die Antwort könnte unvollständig sein.","unexpected-call":"Ein unbekannter Fehler ist aufgetreten. Die Antwort könnte unvollständig sein.","quota-reached":"Kontingent überschritten. Bitte versuchen Sie es später erneut.","rate-limit":"Kontingent überschritten. Bitte versuchen Sie es später erneut.",maintenance:"Der Chat ist derzeit nicht verfügbar. Bitte versuchen Sie es später erneut.","too-long":"Ihre Frage war zu lang, versuchen Sie es mit einer Kürzeren.","too-short":"Ihre Frage war zu kurz, versuchen Sie es mit einer Längeren.","feedback-failed":"Feedback senden fehlgeschlagen. Bitte versuchen Sie es erneut.","speech-not-supported":"Spracherkennung wird nicht unterstützt.","speech-transcription-failed":"Sprachtranskription fehlgeschlagen.","speech-no-text-detected":"Kein Text in der Spracheingabe erkannt.","speech-microphone-access-denied":"Mikrofonzugriff verweigert."},en:{aborted:"Connection to the server was unexpectedly interrupted. Please try again.","client-error":"An unknown error has occurred. Please try again.","server-error":"An unknown error has occurred. Please try again.","sse-error":"An unknown error has occurred. Please try again.",blocked:"Your request has been blocked.","pii-detected":"Personal data has been detected. Please remove it and try again.","incomplete-error":"An unknown error has occurred. The response might be incomplete.","unexpected-call":"An unknown error has occurred. The response might be incomplete.","quota-reached":"Quota exceeded. Please try again later.","rate-limit":"Quota exceeded. Please try again later.",maintenance:"The chat is currently unavailable. Please try again later.","too-long":"Your question was too long, try a shorter one.","too-short":"Your question was too short, try a longer one.","feedback-failed":"Failed to send feedback. Please try again.","speech-not-supported":"Speech recognition is not supported.","speech-transcription-failed":"Speech transcription failed.","speech-no-text-detected":"No text detected in speech input.","speech-microphone-access-denied":"Microphone access denied."},it:{aborted:"La connessione al server è stata interrotta inaspettatamente. Si prega di riprovare.","client-error":"Si è verificato un errore sconosciuto. Si prega di riprovare.","server-error":"Si è verificato un errore sconosciuto. Si prega di riprovare.","sse-error":"Si è verificato un errore sconosciuto. Si prega di riprovare.",blocked:"La tua richiesta è stata bloccata.","pii-detected":"Sono stati rilevati dati personali. Si prega di rimuoverli e riprovare.","incomplete-error":"Si è verificato un errore sconosciuto. La risposta potrebbe essere incompleta.","unexpected-call":"Si è verificato un errore sconosciuto. La risposta potrebbe essere incompleta.","quota-reached":"Quota superata. Si prega di riprovare più tardi.","rate-limit":"Quota superata. Si prega di riprovare più tardi.",maintenance:"La chat non è attualmente disponibile. Si prega di riprovare più tardi.","too-long":"La tua domanda era troppo lunga, prova con una più breve.","too-short":"La tua domanda era troppo breve, prova con una più lunga.","feedback-failed":"Invio del feedback non riuscito. Si prega di riprovare.","speech-not-supported":"Il riconoscimento vocale non è supportato.","speech-transcription-failed":"Trascrizione vocale fallita.","speech-no-text-detected":"Nessun testo rilevato nell'input vocale.","speech-microphone-access-denied":"Accesso al microfono negato."},fr:{aborted:"La connexion au serveur a été interrompue de façon inattendue. Veuillez réessayer.","client-error":"Une erreur inconnue s'est produite. Veuillez réessayer.","server-error":"Une erreur inconnue s'est produite. Veuillez réessayer.","sse-error":"Une erreur inconnue s'est produite. Veuillez réessayer.","pii-detected":"Des données personnelles ont été détectées. Veuillez les supprimer et réessayer.",blocked:"Votre demande a été bloquée.","incomplete-error":"Une erreur inconnue s'est produite. La réponse pourrait être incomplète.","unexpected-call":"Une erreur inconnue s'est produite. La réponse pourrait être incomplète.","quota-reached":"Quota dépassé. Veuillez réessayer plus tard.","rate-limit":"Quota dépassé. Veuillez réessayer plus tard.",maintenance:"Le chat est actuellement indisponible. Veuillez réessayer plus tard.","too-long":"Votre question était trop longue, essayez d'en poser une plus courte.","too-short":"Votre question était trop courte, essayez d'en poser une plus longue.","feedback-failed":"Échec de l'envoi du feedback. Veuillez réessayer.","speech-not-supported":"La reconnaissance vocale n'est pas prise en charge.","speech-transcription-failed":"Échec de la transcription vocale.","speech-no-text-detected":"Aucun texte détecté dans l'entrée vocale.","speech-microphone-access-denied":"Accès au microphone refusé."}},ic={de:{email:"Bitte keine E-Mail Adressen eingeben",creditCard:"Bitte keine Kreditkarteninformationen eingeben",ahv:"Bitte keine AHV-Nummern eingeben",phoneSwiss:"Bitte keine Telefonnummern eingeben",phoneInternational:"Bitte keine Telefonnummern eingeben",swissPassport:"Bitte keine Passinformationen eingeben",longNumber:"Bitte keine langen Nummern eingeben"},en:{email:"Please do not enter email addresses",creditCard:"Please do not enter credit card information",ahv:"Please do not enter AHV numbers",phoneSwiss:"Please do not enter phone numbers",phoneInternational:"Please do not enter phone numbers",swissPassport:"Please do not enter passport information",longNumber:"Please do not enter long numbers"},it:{email:"Si prega di non inserire indirizzi email",creditCard:"Si prega di non inserire informazioni sulla carta di credito",ahv:"Si prega di non inserire numeri AVS",phoneSwiss:"Si prega di non inserire numeri di telefono",phoneInternational:"Si prega di non inserire numeri di telefono",swissPassport:"Si prega di non inserire informazioni sul passaporto",longNumber:"Si prega di non inserire numeri lunghi"},fr:{email:"Veuillez ne pas saisir d'adresses e-mail",creditCard:"Veuillez ne pas saisir d'informations de carte de crédit",ahv:"Veuillez ne pas saisir de numéros AVS",phoneSwiss:"Veuillez ne pas saisir de numéros de téléphone",phoneInternational:"Veuillez ne pas saisir de numéros de téléphone",swissPassport:"Veuillez ne pas saisir d'informations de passeport",longNumber:"Veuillez ne pas saisir de longs numéros"}},Xi=structuredClone(fr.fineGrained.light);Xi.tokens.colors={brand:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#037ABA",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},highlight:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},grey:{0:"#ffffff",50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#2d3748",900:"#1a202c",950:"#171923",1e3:"#000000"}};const oc=structuredClone(fr.fineGrained.dark);oc.tokens.colors=Xi.tokens.colors;const Sp=Object.freeze(Object.defineProperty({__proto__:null,theme:{fineGrained:{light:Xi,dark:oc}}},Symbol.toStringTag,{value:"Module"})),sc=t=>t.split("/").pop().split(".")[0],Tp=Object.assign({"./default/fallback-dev.theme.ts":Sp,"./default/fallback.theme.ts":vp}),Ji=new Map;Object.entries(Tp).forEach(([t,e])=>{const{error:r,data:n}=ql.safeParse(e?.theme);if(r){console.error(`Invalid theme in ${t}:`,r);return}Ji.set(sc(t),n)});const Wg=t=>{const e=Ji.get(t);return e||(console.error(`Theme ${t} not found`),fr)};Array.from(Ji.keys());const Ep=Object.assign({"./default/fallback.translations.ts":wp}),eo=new Map;Object.entries(Ep).forEach(([t,e])=>{const{error:r,data:n}=Zl.safeParse(e?.translations);if(r){console.error(`Invalid translations in ${t}:`,r);return}eo.set(sc(t),n)});const Qg=t=>{const e=eo.get(t);return e||(console.error(`Theme ${t} not found`),Nr)};Array.from(eo.keys());const Cp="en",lc=(t,e)=>e.includes(t),Ta=(t,e)=>{if(lc(t,e))return t;const r=Ap();return lc(r,e)?r:Cp},Ap=()=>navigator.language.split("-")[0],cc=(t,e)=>{localStorage.setItem("liipgpt:selectedLanguage",t),e&&(e.lang=t)},uc=t=>Ta(localStorage.getItem("liipgpt:selectedLanguage"),t);var to,dc;function Rp(){return dc||(dc=1,to=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,a,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(a=n;a--!==0;)if(!t(e[a],r[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(a=n;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[a]))return!1;for(a=n;a--!==0;){var o=i[a];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}),to}var Ip=Rp();const Lp=ec(Ip),Op=typeof document<"u";let hc=0;class Mp{#e=te(St([]));get toasts(){return _(this.#e)}set toasts(e){$(this.#e,e,!0)}#t=te(St([]));get heights(){return _(this.#t)}set heights(e){$(this.#t,e,!0)}#a=e=>{const r=this.toasts.findIndex(n=>n.id===e);return r===-1?null:r};addToast=e=>{Op&&this.toasts.unshift(e)};updateToast=({id:e,data:r,type:n,message:a})=>{const i=this.toasts.findIndex(s=>s.id===e),o=this.toasts[i];this.toasts[i]={...o,...r,id:e,title:a,type:n,updated:!0}};create=e=>{const{message:r,...n}=e,a=typeof e?.id=="number"||e.id&&e.id?.length>0?e.id:hc++,i=e.dismissable===void 0?!0:e.dismissable,o=e.type===void 0?"default":e.type;return mt(()=>{this.toasts.find(c=>c.id===a)?this.updateToast({id:a,data:e,type:o,message:r,dismissable:i}):this.addToast({...n,id:a,title:r,dismissable:i,type:o})}),a};dismiss=e=>(mt(()=>{if(e===void 0){this.toasts=this.toasts.map(n=>({...n,dismiss:!0}));return}const r=this.toasts.findIndex(n=>n.id===e);this.toasts[r]&&(this.toasts[r]={...this.toasts[r],dismiss:!0})}),e);remove=e=>{if(e===void 0){this.toasts=[];return}const r=this.#a(e);if(r!==null)return this.toasts.splice(r,1),e};message=(e,r)=>this.create({...r,type:"default",message:e});error=(e,r)=>this.create({...r,type:"error",message:e});success=(e,r)=>this.create({...r,type:"success",message:e});info=(e,r)=>this.create({...r,type:"info",message:e});warning=(e,r)=>this.create({...r,type:"warning",message:e});loading=(e,r)=>this.create({...r,type:"loading",message:e});promise=(e,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:e,type:"loading",message:typeof r.loading=="string"?r.loading:r.loading()}));const a=e instanceof Promise?e:e();let i=n!==void 0;return a.then(o=>{if(typeof o=="object"&&o&&"ok"in o&&typeof o.ok=="boolean"&&!o.ok){i=!1;const s=Pp(o);this.create({id:n,type:"error",message:s})}else if(r.success!==void 0){i=!1;const s=typeof r.success=="function"?r.success(o):r.success;this.create({id:n,type:"success",message:s})}}).catch(o=>{if(r.error!==void 0){i=!1;const s=typeof r.error=="function"?r.error(o):r.error;this.create({id:n,type:"error",message:s})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),r.finally?.()}),n};custom=(e,r)=>{const n=r?.id||hc++;return this.create({component:e,id:n,...r}),n};removeHeight=e=>{this.heights=this.heights.filter(r=>r.toastId!==e)};setHeight=e=>{const r=this.#a(e.toastId);if(r===null){this.heights.push(e);return}this.heights[r]=e};reset=()=>{this.toasts=[],this.heights=[]}}function Pp(t){return t&&typeof t=="object"&&"status"in t?`HTTP error! Status: ${t.status}`:`Error! ${t}`}const yt=new Mp;function Np(t,e){return yt.create({message:t,...e})}const ro=Object.assign(Np,{success:yt.success,info:yt.info,warning:yt.warning,error:yt.error,custom:yt.custom,message:yt.message,promise:yt.promise,dismiss:yt.dismiss,loading:yt.loading,getActiveToasts:()=>yt.toasts.filter(t=>!t.dismiss)}),Dp=t=>{const e=new Set;Object.getOwnPropertyNames(t).forEach(n=>e.add(n));let r=Object.getPrototypeOf(t);for(;r&&r!==Object.prototype;)Object.getOwnPropertyNames(r).forEach(n=>e.add(n)),r=Object.getPrototypeOf(r);return Array.from(e)},$p=(t,e)=>{const r={};return e.forEach(n=>{r[n]=t[n]}),r},zp=console.warn,Fp=()=>{},fc=(t,e)=>mt(()=>{console.warn=Fp;const r=e?$p(t,e):t,n=xu(r);return console.warn=zp,n}),Bp=t=>t&&typeof t.then=="function";class jp{config;self;devtools;stateKeys;constructor(e,r){this.config=e,this.self=r,typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&(this.stateKeys=Dp(this.config.state),this.devtools=window.__REDUX_DEVTOOLS_EXTENSION__.connect({name:this.config.name??"updatelogic"}),this.devtools.init(this.createStateSnapshot()),this.devtools.subscribe(n=>{n.type==="DISPATCH"&&n.state}))}createStateSnapshot(){return fc(this.config.state,this.stateKeys)}sendStart(e,r){this.devtools.send({type:`→ ${e}`,args:r},this.createStateSnapshot())}sendError(e,r,n){this.devtools.send({type:`❌ ${e}`,args:r,error:n},this.createStateSnapshot())}sendSuccess(e,r,n){this.devtools.send({type:`✓ ${e}`,args:r,return:n},this.createStateSnapshot())}isIncluded(e){return this.config.excludeInDevTools?!this.config.excludeInDevTools.includes(e):!0}createProxyFunction(e,r){const n=this.devtools&&this.isIncluded(e);return typeof r=="function"?(...a)=>{if(!n)return mt(()=>r.call(this.self,...a));const i=fc(a);this.sendStart(e,i);try{const o=mt(()=>r.call(this.self,...a));return Bp(o)?o.then(s=>(this.sendSuccess(e,i,s),s),s=>{throw this.sendError(e,i,s),s}):(this.sendSuccess(e,i,o),o)}catch(o){throw this.sendError(e,i,o),o}}:r}}const Up=(t,e)=>{const r={},n=new jp(t,r);return Object.keys(e).forEach(a=>{if(a==="state"||a==="name")return;const i=e[a];r[a]=n.createProxyFunction(a,i)}),r};async function qp(){if(typeof navigator>"u"||!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return!1;try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind==="audioinput")}catch(t){return console.error("Error checking for microphone:",t),!1}}function no(){return typeof window>"u"||!window.MediaRecorder?null:MediaRecorder.isTypeSupported("audio/mp4")?"audio/mp4":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":MediaRecorder.isTypeSupported("audio/wav")?"audio/wav":null}function pc(){return typeof window>"u"?!1:!!(window.MediaRecorder&&no())}class gc{mediaRecorder=null;audioChunks=[];started=!1;starting=!1;stream=null;options;audioContext=null;analyser=null;dataArray=null;volumeUpdateInterval=null;constructor(e={}){this.options=e}async start(){if(this.started||this.starting){console.warn("AudioRecorder: Start already in progress or already started");return}if(!pc()||!navigator.mediaDevices){const e=new Error("MediaRecorder not supported or no microphone access");throw this.options.onError?.(e),e}try{if(this.starting=!0,this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},video:!1}),!this.starting){this.stopStream(this.stream);return}this.mediaRecorder&&this.mediaRecorder.state!=="inactive"&&(console.warn("AudioRecorder: MediaRecorder already active, stopping previous recording"),this.mediaRecorder.stop(),this.cleanup()),this.started=!0,this.starting=!1;const e=no();if(!e)throw new Error("No supported media type found");const r={mimeType:e};this.mediaRecorder=new MediaRecorder(this.stream,r),this.audioChunks=[],this.mediaRecorder.ondataavailable=n=>{n.data.size>0&&this.audioChunks.push(n.data)},this.mediaRecorder.onstop=async()=>{const n=this.audioChunks.length>0?new Blob(this.audioChunks,{type:e}):null;await this.options.onDataAvailable?.(n),this.options.onStop?.(),this.cleanup()},this.mediaRecorder.onerror=n=>{const a=new Error(`MediaRecorder error: ${n}`);this.options.onError?.(a),this.cleanup()},this.mediaRecorder.start(),this.setupVolumeAnalysis(this.stream),this.options.onStart?.()}catch(e){this.started=!1,this.starting=!1;const r=e instanceof Error?e:new Error(String(e));throw this.options.onError?.(r),r}}stop(){this.started=!1,this.starting=!1,this.volumeUpdateInterval&&(clearInterval(this.volumeUpdateInterval),this.volumeUpdateInterval=null),this.mediaRecorder&&this.mediaRecorder.state!=="inactive"?this.mediaRecorder.stop():(this.stream&&this.stopStream(this.stream),this.cleanup())}setupVolumeAnalysis(e){if(this.options.onVolumeChange)try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8;const r=this.analyser.frequencyBinCount;this.dataArray=new Uint8Array(r),this.audioContext.createMediaStreamSource(e).connect(this.analyser),this.startVolumeMonitoring()}catch(r){console.warn("Failed to set up volume analysis:",r)}}startVolumeMonitoring(){!this.analyser||!this.dataArray||!this.options.onVolumeChange||(this.volumeUpdateInterval=window.setInterval(()=>{if(!this.analyser||!this.dataArray||!this.started)return;this.analyser.getByteFrequencyData(this.dataArray);let e=0;for(let i=0;i<this.dataArray.length;i++)e+=this.dataArray[i]*this.dataArray[i];let n=Math.sqrt(e/this.dataArray.length)/255;n=Math.pow(n*3,.7);const a=Math.min(100,Math.max(0,Math.round(n*100)));this.options.onVolumeChange?.(a)},100))}get recording(){return this.started&&this.mediaRecorder?.state==="recording"}get isStarting(){return this.starting}stopStream(e){e.getTracks().forEach(r=>r.stop())}cleanup(){this.volumeUpdateInterval&&(clearInterval(this.volumeUpdateInterval),this.volumeUpdateInterval=null),this.audioContext&&(this.audioContext.close().catch(console.warn),this.audioContext=null),this.analyser=null,this.dataArray=null,this.stream&&(this.stopStream(this.stream),this.stream=null),this.mediaRecorder=null,this.audioChunks=[],this.started=!1,this.starting=!1}static isSupported(){return pc()}static getSupportedMediaType(){return no()}}const Vp=t=>(localStorage.setItem("liipgpt-color-scheme",t),ao(["light","dark"])),mc=()=>{const t=localStorage.getItem("liipgpt-color-scheme");return t==="light"||t==="dark"?t:"system"},ao=t=>{let e=mc();return e==="system"&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),t.includes(e)?e:t[0]??"light"},Hp="liipgpt:context",Zp=()=>localStorage.getItem(Hp),Gp=[{type:"email",check:t=>/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/.test(t)},{type:"creditCard",check:t=>/\b(?:\d[ -]*?){13,16}\b/.test(t)},{type:"ahv",check:t=>/\b756\.\d{4}\.\d{4}\.\d{2}\b/.test(t)},{type:"phoneSwiss",check:t=>/\b0(?:\s*\d){2}(?:\s*\/\s*)?(?:\s*\d){7,}\b/.test(t)},{type:"phoneInternational",check:t=>/(?:\+|00)(?:\s*\d){10,}\b/.test(t)},{type:"swissPassport",check:t=>/\b[A-HJ-NP-Z](?=.*\d)[A-HJ-NP-Z0-9]{7}\b/.test(t)},{type:"longNumber",check:t=>/\b\d{9,}\b/.test(t)}],vc=t=>{for(const e of Gp)if(e.check(t))return e.type},io="liipgpt:selectorValues",oo="liipgpt:selectorKnownDefaults",bc=()=>{try{const t=kt.getItem(io),e=kt.getItem(oo);return t?{values:JSON.parse(t),knownDefaults:e?JSON.parse(e):{}}:null}catch{return null}},Wp=t=>{const e={};for(const r of t)e[r.settingName]=r.defaultValues??(r.allowEmpty?[]:[r.values[0]]).filter(Boolean);return e},kc=(t,e)=>{try{const r=Wp(e);kt.setItem(io,JSON.stringify(t)),kt.setItem(oo,JSON.stringify(r))}catch(r){console.error("Failed to save selector values:",r)}},Qp=t=>{try{const e=bc();if(!e)return;delete e.values[t],delete e.knownDefaults[t],kt.setItem(io,JSON.stringify(e.values)),kt.setItem(oo,JSON.stringify(e.knownDefaults))}catch(e){console.error("Failed to clear selector saved state:",e)}},Yp=t=>{const e=bc(),r=t.map(n=>{const a=n.defaultValues??(n.allowEmpty?[]:[n.values[0]]).filter(Boolean);if(!e?.values[n.settingName])return[n.settingName,a];const i=e.values[n.settingName],o=e.knownDefaults[n.settingName]||[],s=i.filter(h=>n.values.includes(h)),c=o.filter(h=>!a.includes(h)),l=s.filter(h=>!c.includes(h)),d=a.filter(h=>!o.includes(h)&&!l.includes(h)),p=[...l,...d];return p.length===0&&!n.allowEmpty?[n.settingName,a]:[n.settingName,p]});return Object.fromEntries(r)};class Kp extends Error{constructor(e){super(e),this.name="UnreachableError"}}const yc=(t,e)=>{const n=new URLSearchParams(window.location.search).get("q");return n?{name:"chat-page",query:n}:t&&!e?{name:"consent-page"}:{name:"start-page"}},Dr=t=>t?t.map(e=>({id:Wi(),...e})):[];class Xp{#e=te(St({}));get data(){return _(this.#e)}set data(e){$(this.#e,e,!0)}#t=te(St({}));get targets(){return _(this.#t)}set targets(e){$(this.#t,e,!0)}#a=te(!1);get initialized(){return _(this.#a)}set initialized(e){$(this.#a,e,!0)}#l=te(0);get currentAudioVolume(){return _(this.#l)}set currentAudioVolume(e){$(this.#l,e,!0)}ariaLiveMessagesClearingTimeoutDuration=350;#u=te(null);get currentAudioRecorder(){return _(this.#u)}set currentAudioRecorder(e){$(this.#u,e,!0)}#i=te(!1);get isTranscribing(){return _(this.#i)}set isTranscribing(e){$(this.#i,e,!0)}#r=ee(()=>{if(!this.initialized)return[];const e=this.data.chatConfig.menu;return e?e[this.data.language]??[]:[]});get menu(){return _(this.#r)}set menu(e){$(this.#r,e)}#o=ee(()=>this.initialized?this.data.chatConfig.translations[this.data.language]??{}:{});get t(){return _(this.#o)}set t(e){$(this.#o,e)}#s=ee(()=>this.initialized?ac[this.data.language]??{}:ac.en??{});get errorTranslations(){return _(this.#s)}set errorTranslations(e){$(this.#s,e)}#n=ee(()=>this.initialized?ic[this.data.language]??{}:ic.en??{});get piiTranslations(){return _(this.#n)}set piiTranslations(e){$(this.#n,e)}#c=ee(()=>this.initialized?this.data.currentColorScheme:"light");get colorScheme(){return _(this.#c)}set colorScheme(e){$(this.#c,e)}#d=ee(()=>this.initialized?this.data.chatConfig.fullTheme[this.data.currentColorScheme]:{});get themeBase(){return _(this.#d)}set themeBase(e){$(this.#d,e)}#f=ee(()=>this.themeBase.tokens);get theme(){return _(this.#f)}set theme(e){$(this.#f,e)}#h=ee(()=>{if(!this.initialized)return[];const e=[];for(const r of this.data.chatConfig.selectorsConfig){if(r.allowEmpty)continue;(this.data.selectorValues[r.settingName]||[]).length===0&&e.push(r.settingName)}return e});get selectorsWithErrors(){return _(this.#h)}set selectorsWithErrors(e){$(this.#h,e)}}const g=new Xp;let dt,wt,wc;Up({name:"chat-logic",state:g,excludeInDevTools:["onInput"]},{async init(t){wt=t;const e=wt.speechRecognitionApiKey||void 0;dt=new dp({apiUrl:wt.apiUrl,apiKey:wt.apiKey,speechRecognitionApiKey:e,strict:!0});try{const r=await dt.getChatConfig();window.CHAT_CONFIG_OVERRIDE&&Object.assign(r,window.CHAT_CONFIG_OVERRIDE);const a=(await dt.getMetadata()).mode==="maintenance";a&&this.showErrorToast("maintenance");const i=nc(r);wt.inlineLayout!==void 0&&(i.inlineLayout=wt.inlineLayout);let o;wt.lang?o=Ta(wt.lang,i.supportedLanguages):o=uc(i.supportedLanguages),cc(o,g.targets.mainElement);const s=await this.getPredefinedQuestions(o),c=[];if(i.renderKatex){const h=await import("https://esm.sh/marked-katex-extension@5.1.5").catch(v=>{console.error("Couldn't load marked-katex-extension:",v)});h&&(dt.setMarkedExtensions(h.default({nonStandard:!0,output:"mathml"})),c.push("https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css"))}const l=Object.keys(i.fullTheme);let d=!1;if(i.forceConsent)try{d=kt.getItem("liipgpt:termsAccepted")==="true"}catch(h){console.warn("Failed to load terms acceptance from storage:",h)}g.data={currentConversationState:"idle",chatConfig:i,language:o,predefinedQuestions:s,isInMaintenance:a,history:Dr(i.messageAdditions.init),selectedColorScheme:mc(),has2ColorSchemes:l.length===2,currentColorScheme:ao(l),conversationFeedbackId:void 0,conversationFeedbackIsOpen:!1,openedPopup:void 0,props:wt,flyoutIsOpen:!1,questionHasPii:void 0,chatInputValue:"",selectorValues:Yp(i.selectorsConfig),selectorsIsOpen:!1,currentReferencesAsideId:void 0,ariaLiveStatusMessage:void 0,ariaLiveStatusMessageClearingTimeout:void 0,wasReferencesAsideClosed:!1,isAsideMobile:!0,route:yc(i.forceConsent??!1,d),additionalStylesheets:c,hasOpenedOverlays:!1,isInlineLayoutContained:!1,termsAccepted:d},window.LIIPGPT_LISTENERS?.route?.(g.data.route),window.LIIPGPT_LISTENERS?.conversation?.(g.data.currentConversationState),g.data.selectorsIsOpen=g.data.chatConfig.showExpandedSelectors??!1,g.initialized=!0,this.checkForOpenedPopup(),window.addEventListener("hashchange",()=>{this.checkForOpenedPopup()}),this.goto(yc(i.forceConsent??!1,d),!0)}catch(r){throw ro.error(r instanceof Error?r.message:"Failed to load the chatbot. Please reload the page.",{duration:1e4,unstyled:!0,classes:{toast:"toast"}}),r}},setTarget(t,e){g.targets[t]=e},goto(t,e=!1){if(!(!e&&Lp(g.data.route,t)))switch(g.data.route=t,window.LIIPGPT_LISTENERS?.route?.(t),t.name){case"consent-page":break;case"start-page":t.prefill&&(g.data.chatInputValue=t.prefill);break;case"chat-page":if(g.data.chatInputValue=t.query,this.onSubmit(),g.data.chatConfig.addQueryToUrlParams){const r=new URLSearchParams(window.location.search);r.set("q",t.query),history.pushState(null,"",`?${r.toString()}`)}break}},getSelectorConfig(t){const e=g.data.chatConfig.selectorsConfig.find(r=>r.settingName===t);if(!e)throw new Error(`Setting ${t} not found`);return e},getPrettifiedSelectorValues(){const t=Object.entries(g.data.selectorValues).map(([e,r])=>{let n;try{n=this.getSelectorConfig(e)}catch(a){console.error(`Error getting selector config for ${e}: ${a}`);return}return n.type==="single-select"?[e,r[0]]:[e,r]}).filter(e=>!!e);return Object.fromEntries(t)},setSelectorValue(t,e){const r=this.getSelectorConfig(t);if(!r){console.warn(`Trying to set setting ${t} but it is not defined in the chat config`);return}if(r.type==="single-select"&&e.length>1){console.warn(`Trying to set multiple values for single-select setting ${t}`);return}g.data.selectorValues[t]=e,kc(g.data.selectorValues,g.data.chatConfig.selectorsConfig)},resetSelectorToDefaults(t){const e=this.getSelectorConfig(t);if(!e){console.warn(`Trying to reset setting ${t} but it is not defined in the chat config`);return}const r=e.defaultValues??(e.allowEmpty?[]:[e.values[0]]).filter(Boolean);return Qp(t),g.data.selectorValues[t]=r,kc(g.data.selectorValues,g.data.chatConfig.selectorsConfig),r},async getPredefinedQuestions(t){try{return dt.getPredefinedQuestions({url:window.location.origin+window.location.pathname,language:t})}catch(e){return console.warn("Failed to load predefined questions:",e),[]}},setColorScheme(t){g.data.selectedColorScheme=t,g.data.currentColorScheme=Vp(t),this.setAriaLiveStatusMessage(t==="dark"?g.t.ariaDarkSelected:g.t.ariaLightSelected)},async abort(){await wc?.abort()},changeConversationState(t){g.data.currentConversationState=t,window.LIIPGPT_LISTENERS?.conversation?.(t)},onInput(t){g.data.chatConfig.blockPII&&(g.data.questionHasPii=vc(t)),g.data.chatInputValue=t},onSubmit(t=!1){if(g.data.questionHasPii){console.warn("Question contains PII, not submitting:",g.data.questionHasPii);return}const e=g.data.chatConfig.questionPrefix?`${g.data.chatConfig.questionPrefix} ${g.data.chatInputValue}`:g.data.chatInputValue;g.data.history.push(...Dr(g.data.chatConfig.messageAdditions.user.before)),g.data.history.push({type:"user",time:new Date().toISOString(),message:g.data.chatInputValue}),g.data.history.push(...Dr(g.data.chatConfig.messageAdditions.user.after));const r=g.data.history.push(...Dr(g.data.chatConfig.messageAdditions.bot.before));g.data.history.push({id:"UNRESOLVED",state:"loading",errors:[],type:"bot",time:new Date().toISOString(),message:{markdown:"",html:"",text:""},references:{all:[],used:[],unused:[]}});const n={features:wt.features?wt.features.trim().split(","):["formatting"],onError:d=>{this.showErrorToast(d),window.LIIPGPT_LISTENERS?.error?.(d),(d==="pii-detected"||d==="blocked")&&this.editLatestQuestion()},lang:g.data.language,selectorValues:{...this.getPrettifiedSelectorValues(),context:Zp()}},a=(d,p)=>{try{const h=new URL(d),v=new URL(p);return h.origin===v.origin&&h.pathname===v.pathname}catch{return!1}},i=g.data.chatConfig.sendReferrer??"all";if(["all","own","location"].includes(i)){const d=i==="location"||g.data.props.flyout;let p;d?p=`${window.location.protocol}//${window.location.host}${window.location.pathname}`:p=a(document.referrer,window.location.href)?null:document.referrer;const h=i==="own"&&!g.data.props.flyout&&p&&!p.startsWith(window.location.origin);n.referrer=p&&!h?p:void 0}g.data.currentConversationId||(g.data.currentConversationId=dt.createConversationId());const o=dt.chat(g.data.currentConversationId,e,n);wc=o,g.data.lastChatResponseId=o.id,g.data.currentConversationState!=="searching"&&this.changeConversationState("searching"),this.setAriaLiveStatusMessage(g.t.ariaQuestionSent);let s=!1,c;const l=!!g.data.currentReferencesAsideId;(t&&l||!t&&g.data.chatConfig.showReferencesByDefault)&&(g.data.isAsideMobile||this.openReferencesAside(o.id)),o.subscribe(d=>{if(g.data.history[r]&&(g.data.history[r]={question:g.data.chatInputValue,...d}),g.data.chatConfig.addRetrievalQuestionToUrlParams&&d.retrievalQuestion){const p=new URLSearchParams(window.location.search);p.get("search")!==d.retrievalQuestion&&(p.set("search",d.retrievalQuestion),history.replaceState(null,"",`?${p.toString()}`))}g.data.chatConfig.showReferencesByDefault&&!g.data.wasReferencesAsideClosed&&g.data.currentReferencesAsideId!==d.id&&!g.data.isAsideMobile&&this.openReferencesAside(d.id),d.state==="streaming"&&g.data.currentConversationState!=="answering"&&this.changeConversationState("answering"),d.state==="done"&&(this.changeConversationState("idle"),s||(s=!0,this.setAriaLiveStatusMessage(`${g.t.ariaAnswerReady} ... ${d.message.text} ... ${g.t.ariaAnswerFinished}`),g.data.history.push(...Dr(g.data.chatConfig.messageAdditions.bot.after))),g.data.currentReferencesAsideId&&g.data.history[r].references.used.length>0?(clearTimeout(c),c=setTimeout(()=>{this.openReferencesAside(d.id)},100)):this.closeReferencesAside())}),g.data.chatInputValue=""},async onStartSpeechRecognition(){try{if(!await qp()){this.showErrorToast("speech-not-supported");return}if(await navigator.mediaDevices.getUserMedia({audio:!0}),gc.isSupported())g.data.chatInputValue="",g.currentAudioRecorder=new gc({onDataAvailable:async e=>{g.isTranscribing=!0,await this.handleTranscription(e)},onError:()=>{this.showErrorToast("speech-microphone-access-denied"),g.currentAudioRecorder=null,g.isTranscribing=!1},onVolumeChange:e=>{g.currentAudioVolume=e}}),g.currentAudioRecorder.start();else{this.showErrorToast("speech-not-supported");return}}catch(t){throw this.showErrorToast("speech-microphone-access-denied"),g.currentAudioRecorder=null,g.isTranscribing=!1,t}},editLatestQuestion(){const t=g.data.history.findLastIndex(r=>r?.type==="user");if(t===-1){console.error("No last user question, available");return}const e=g.data.history.splice(t)[0];g.data.chatInputValue=e.message},onStopSpeechRecognition(){if(g.currentAudioRecorder){const t=g.currentAudioRecorder;g.currentAudioRecorder=null,t.stop()}g.currentAudioVolume=0},async handleTranscription(t){if(!t){console.warn("No audio data received");return}try{const e=await dt.transcribeAudio(t,{lang:g.data.language});if(e.error){this.showErrorToast("speech-transcription-failed");return}if(e.transcript.trim()){if(g.data.chatConfig.blockPII&&(g.data.questionHasPii=vc(e.transcript.trim()),g.data.questionHasPii))return;g.data.chatInputValue=e.transcript.trim()}else this.showErrorToast("speech-no-text-detected")}catch(e){console.error("Speech transcription error:",e),this.showErrorToast("speech-transcription-failed")}finally{g.currentAudioRecorder=null,g.isTranscribing=!1,g.currentAudioVolume=0}},async onStartConversation(t){await this.abort(),g.data.history=Dr(g.data.chatConfig.messageAdditions.init),g.data.currentConversationId=dt.createConversationId(),this.goto({name:"chat-page",query:t})},async onNewConversation(){if(await this.abort(),g.data.currentConversationId=void 0,g.data.currentReferencesAsideId=void 0,g.data.history=Dr(g.data.chatConfig.messageAdditions.init),g.data.chatConfig.addQueryToUrlParams){const t=new URLSearchParams(window.location.search);t.delete("q"),history.pushState(null,"",`?${t.toString()}`)}this.goto({name:"start-page"})},showSuccessToast(t){ro.success(g.t[t],{unstyled:!0,duration:3e3,classes:{toast:"toast"}})},showErrorToast(t){ro.error(g.errorTranslations[t],{unstyled:!0,duration:3e3,classes:{toast:"toast"}})},async submitFeedback(t){try{const e=g.data.conversationFeedbackId||g.data.lastChatResponseId;if(!e)throw new Kp("Tried to give feedback with no id.");const r=g.data.history.find(n=>n.type==="bot"&&n.id===e);await dt.feedback(e,r?.question??"",t),setTimeout(()=>{this.showSuccessToast("thankYouForFeedback")},500)}catch(e){console.error("Feedback failed:",e),this.showErrorToast("feedback-failed")}},toggleReferencesAside(t){g.data.currentReferencesAsideId===t?this.closeReferencesAside():this.openReferencesAside(t)},openReferencesAside(t){g.data.currentReferencesAsideId=t,this.setOpenOverlay(!0)},closeReferencesAside(){g.data.currentReferencesAsideId=void 0,g.data.wasReferencesAsideClosed=!0,this.setOpenOverlay(!1)},setAsideMobile(t){g.data.isAsideMobile=t},openFlyout(){g.data.flyoutIsOpen=!0},closeFlyout(){g.data.flyoutIsOpen=!1},openConversationFeedback(){g.data.conversationFeedbackIsOpen=!0,this.setOpenOverlay(!0)},openMessageFeedback(t){g.data.conversationFeedbackId=t},closeFeedback(){g.data.conversationFeedbackIsOpen=!1,g.data.conversationFeedbackId=void 0,this.setOpenOverlay(!1)},setOpenOverlay(t){g.data.hasOpenedOverlays=t},setAriaLiveStatusMessage(t){g.data.ariaLiveStatusMessage=t,clearTimeout(g.data.ariaLiveStatusMessageClearingTimeout),g.data.ariaLiveStatusMessageClearingTimeout=setTimeout(()=>{g.data.ariaLiveStatusMessage=""},g.ariaLiveMessagesClearingTimeoutDuration)},closePopup(){window.location.hash=""},checkForOpenedPopup(){const t=window.location.hash.slice(1),e=g.t.popups?.find(r=>r.hash===t);e?g.data.openedPopup=e:g.data.openedPopup=void 0},async thumbs(t,e){try{const r=g.data.history.find(n=>n.type==="bot"&&n.id===t);e==="up"?await dt.thumbsUp(t,r?.question??""):await dt.thumbsDown(t,r?.question??""),this.showSuccessToast("thankYouForFeedback")}catch(r){console.error("Feedback failed:",r),this.showErrorToast("feedback-failed")}},async onLanguageChange(t){if(g.data.language=Ta(t,g.data.chatConfig.supportedLanguages),cc(g.data.language,g.targets.mainElement),g.data.predefinedQuestions=await this.getPredefinedQuestions(g.data.language),this.setAriaLiveStatusMessage(g.t.ariaLanguageChanged),g.data.chatConfig.reflectLanguageInPath){const e=new URL(window.location.href);e.pathname=`/${g.data.language}`,window.history.replaceState({},"",e.toString())}},async acceptTerms(){g.data.termsAccepted=!0;try{kt.setItem("liipgpt:termsAccepted","true")}catch(t){console.warn("Failed to save terms acceptance to storage:",t)}this.closePopup(),await gs(),this.goto({name:"start-page"})},updateChatInput(t){g.data.chatInputValue=t}});const Jp='@layer base,utilities,components;/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::-moz-placeholder{color:currentcolor}@supports (color: color-mix(in lab,red,red)){{color:color-mix(in oklab,currentcolor 50%,transparent)}}::placeholder{color:currentcolor}@supports (color: color-mix(in lab,red,red)){{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer base{.chat-app{--spacer-1: .0625rem;--spacer-2: .125rem;--spacer-3: .1875rem;--spacer-4: .25rem;--spacer-5: .3125rem;--spacer-6: .375rem;--spacer-8: .5rem;--spacer-10: .625rem;--spacer-12: .75rem;--spacer-16: 1rem;--spacer-20: 1.25rem;--spacer-24: 1.5rem;--spacer-28: 1.75rem;--spacer-32: 2rem;--spacer-40: 2.5rem;--spacer-48: 3rem;--spacer-56: 3.5rem;--spacer-64: 4rem;--spacer-72: 4.5rem;--spacer-80: 5rem;--spacer-120: 7.5rem;--spacer-r-8: clamp(.375rem, .3182rem + .2841cqw, .5rem);--spacer-r-12: clamp(.625rem, .5682rem + .2841cqw, .75rem);--spacer-r-16: clamp(.75rem, .6364rem + .5682cqw, 1rem);--spacer-r-20: clamp(.875rem, .7045rem + .8523cqw, 1.25rem);--spacer-r-24: clamp(1rem, .7727rem + 1.1364cqw, 1.5rem);--spacer-r-28: clamp(1.125rem, .8409rem + 1.4205cqw, 1.75rem);--spacer-r-32: clamp(1.25rem, .9091rem + 1.7045cqw, 2rem);--spacer-r-40: clamp(1.5rem, 1.0455rem + 2.2727cqw, 2.5rem);--spacer-r-48: clamp(1.625rem, 1rem + 3.125cqw, 3rem);--spacer-r-56: clamp(1.75rem, .9545rem + 3.9773cqw, 3.5rem);--spacer-r-64: clamp(2rem, 1.0909rem + 4.5455cqw, 4rem);--spacer-r-80: clamp(3rem, 2.0909rem + 4.5455cqw, 5rem);--spacer-r-96: clamp(3.5rem, 2.3636rem + 5.6818cqw, 6rem);--spacer-r-120: clamp(4rem, 2.4091rem + 7.9545cqw, 7.5rem);--default-transition-duration: .2s;--default-transition-timing-function: ease-in-out;--z-index-flyout: 10000;--z-index-dialog: 600;--z-index-loader: 500;--z-index-reference-number: 400;--z-index-footer: 300;--z-index-header: 200;--z-index-tooltip: 100;--z-index-tooltip-hover: 101;--z-index-local-overlay: 10;--ease-out-quart: cubic-bezier(.165, .84, .44, 1);--ease-in-quart: cubic-bezier(.895, .03, .685, .22);--ease-in-out-quart: cubic-bezier(.77, 0, .175, 1);--fly-in-id: 0;--btn-padding-x: var(--spacer-r-20);--btn-padding-y: var(--spacer-r-8);--btn-icon-size: var(--spacer-24);--btn-submit-size: 2.5em;--last-bot-message-min-height: 0}}@value container-xs,container-sm,container-md,container-lg,container-inner-xs,container-inner-sm,container-inner-md,container-inner-lg from "./viewports.css";@layer base{.chat-app :where(h1,.h1,h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6){font-weight:var(--base-font-weight-title);line-height:var(--base-line-height-tight)}.chat-app :where(b,strong){font-weight:var(--base-font-weight-bold)}.chat-app :where(button){cursor:pointer}.chat-app :where(input[type=text],input[type=email],input[type=search],input[type=password],textarea){width:100%;padding:var(--input-padding);border-width:var(--input-border-width);border-radius:var(--input-border-radius);border-color:var(--input-border-color);background:var(--input-background);box-shadow:var(--input-box-shadow, none);color:var(--input-color)}.chat-app :where(input[type=text],input[type=email],input[type=search],input[type=password],textarea)::-moz-placeholder{color:var(--input-placeholder-color);opacity:var(--input-placeholder-opacity)}.chat-app :where(input[type=text],input[type=email],input[type=search],input[type=password],textarea)::placeholder{color:var(--input-placeholder-color);opacity:var(--input-placeholder-opacity)}.chat-app :where(input[type=radio],input[type=checkbox]){margin:0}.chat-app :where(*:focus-visible){border-radius:var(--btn-primary-border-radius);outline-color:var(--body-focus-color);outline-style:var(--body-focus-style);outline-width:var(--body-focus-width);outline-offset:var(--body-focus-offset)}.chat-app *::-moz-selection{background:var(--body-selection-background);color:var(--body-selection-color)}.chat-app *::selection{background:var(--body-selection-background);color:var(--body-selection-color)}.chat-app ::-webkit-scrollbar{width:8px;height:8px}.chat-app ::-webkit-scrollbar-track{background:transparent}.chat-app ::-webkit-scrollbar-thumb{border-radius:4px;background-color:#0000004d;-webkit-transition:background-color .2s;transition:background-color .2s}.chat-app ::-webkit-scrollbar-thumb:hover{background-color:#00000080}.chat-app *{scrollbar-color:rgba(0,0,0,.3) transparent;scrollbar-width:thin}.chat-app ::-webkit-scrollbar-thumb{visibility:hidden}.chat-app *:hover::-webkit-scrollbar-thumb,.chat-app *:active::-webkit-scrollbar-thumb,.chat-app *:focus::-webkit-scrollbar-thumb{visibility:visible}}@layer utilities{.chat-app :where(.expand-interaction){position:relative}.chat-app :where(.expand-interaction):after{position:absolute;inset:0;background-color:transparent;content:""}.chat-app :where(.sr-only){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.chat-app :where(.transition-colors){transition-duration:var(--default-transition-duration);transition-property:color,background-color,border-color,box-shadow;transition-timing-function:var(--default-transition-timing-function)}.chat-app :where(.transition){transition-duration:var(--default-transition-duration);transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,translate,scale,rotate,filter,backdrop-filter;transition-timing-function:var(--default-transition-timing-function)}.chat-app :where(.skip-link){position:absolute;width:0px;height:0px;overflow:hidden;color:var(--anchor-color);font-weight:700;font-size:var(--base-font-size-xs)}.chat-app :where(.skip-link):focus-visible{position:static;width:auto;height:auto}.chat-app :where(.fly-in){--fly-in-id: 0;--fly-in-duration: .4s;--fly-out-duration: .2s;--fly-in-delay: .3s;--fly-in-delay-additional: .1s;--fly-in-y: var(--spacer-r-64);transform:translateY(var(--fly-in-y));opacity:0;transition-delay:0s,1s;transition-duration:var(--fly-out-duration);transition-property:opacity,transform;transition-timing-function:ease,var(--ease-out-quart)}.chat-app :where(.mounted .fly-in){transform:translateY(0);opacity:1;transition-delay:calc(var(--fly-in-delay) + var(--fly-in-id) * var(--fly-in-delay-additional));transition-duration:var(--fly-in-duration)}.chat-app :where(.truncate){display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-app :where(.line-clamp){display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.chat-app :where(.line-clamp--2){-webkit-line-clamp:2}.chat-app :where(.line-clamp--6){-webkit-line-clamp:6}.chat-app :where(.container){width:100%;max-width:var(--container-max-width, 1024px);margin:0 auto;padding-right:var(--spacer-16);padding-left:var(--spacer-16)}@container chat-container (min-width: 640px){.chat-app :where(.container){padding-right:var(--spacer-32);padding-left:var(--spacer-32)}}@container chat-container (min-width: 768px){.chat-app :where(.container){padding-right:var(--spacer-48);padding-left:var(--spacer-48)}}.chat-app :where(h1){font-size:var(--base-font-size-h1)}.chat-app :where(h2){font-size:var(--base-font-size-h2)}.chat-app :where(h3){font-size:var(--base-font-size-h3)}.chat-app :where(h4,h5,h6){font-size:var(--body-font-size)}.chat-app :where(.h1){font-size:var(--base-font-size-h1)}.chat-app :where(.h2){font-size:var(--base-font-size-h2)}.chat-app :where(.h3){font-size:var(--base-font-size-h3)}.chat-app :where(.h4,.h5,.h6){font-size:var(--body-font-size)}.chat-app :where(.text-container)>:where(p,ul,ol,img,table){display:block;margin-bottom:var(--spacer-r-24)}.chat-app :where(.text-container)>:where(div){margin:var(--spacer-r-40) 0}.chat-app :where(.text-container)>:where(h1,.h1){margin-bottom:var(--spacer-r-28)}.chat-app :where(.text-container)>:where(h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6){margin-bottom:var(--spacer-r-20)}.chat-app :where(.text-container)>:where(h1,.h1,h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6){margin-top:var(--spacer-r-40)}.chat-app :where(.text-container)>:where(ul:not(.no-list-styling),ol:not(.no-list-styling))>:where(li){margin-bottom:var(--spacer-12)}.chat-app :where(.text-container)>:where(ul:not(.no-list-styling),ol:not(.no-list-styling))>:where(li):last-child{margin-bottom:0}.chat-app :where(.text-container)>:where(ol){padding-left:1.5em;list-style-position:outside;list-style-type:decimal}.chat-app :where(.text-container)>:where(ul:not(.no-list-styling))>:where(li){position:relative;padding-left:1em}.chat-app :where(.text-container)>:where(ul:not(.no-list-styling))>:where(li):before{position:absolute;top:0;left:0;content:"•";font-size:.9em}.chat-app :where(.text-container)>:where(hr){height:1px;margin:var(--spacer-r-40) 0;border:none;background-color:var(--color-grey-700);background-color:var(--hr-color)}.chat-app :where(.text-container) :where(a:not(.button,.no-link-styling,.reference)){color:var(--anchor-color);font-weight:var(--anchor-font-weight, var(--base-font-weight-normal));-webkit-text-decoration:var(--anchor-text-decoration, underline);text-decoration:var(--anchor-text-decoration, underline);text-underline-offset:var(--anchor-text-underline-offset, .15em);transition-duration:var(--default-transition-duration);transition-property:color,background-color,border-color;transition-timing-function:var(--default-transition-timing-function)}.chat-app :where(.text-container) :where(a:not(.button,.no-link-styling,.reference)):hover{color:var(--anchor-hover-color)}.chat-app :where(.text-container) :where(table){display:block;width:100%;overflow-x:auto;border-collapse:collapse;border-spacing:0;-webkit-overflow-scrolling:touch}.chat-app :where(.text-container) :where(th){width:1000px;padding:var(--spacer-12) var(--spacer-16) var(--spacer-12) 0;border-bottom:1px solid var(--color-grey-300);line-height:var(--base-line-height-tight);text-align:left;vertical-align:bottom}.chat-app :where(.text-container) :where(td){padding:var(--spacer-12) var(--spacer-16) var(--spacer-12) 0;border-bottom:1px solid var(--color-grey-300);vertical-align:top}.chat-app :where(.text-container) :where(tr:last-child td){border-bottom:none}.chat-app :where(.text-container) :where(*:first-child){margin-top:0}.chat-app :where(.text-container) :where(*:last-child){margin-bottom:0}.chat-app :where(.animated-height){transition:height .5s var(--ease-in-out-quart)}.chat-app :where(.display-contents){display:contents}.chat-app :where(.absolute){position:absolute!important}}@layer base{.svg{width:var(--spacer-r-24);height:auto}.svg svg{display:block;width:100%;height:auto;overflow:visible}}@layer components{.chat-app{display:contents}.chat-app__container{container-name:chat-container;container-type:inline-size;display:flex;height:100%;overflow:hidden;transform:translateZ(0)}.chat-app__container>:where(*){color:var(--body-color);font-style:normal;font-weight:var(--base-font-weight-normal);font-size:var(--base-font-size-body);line-height:var(--base-line-height-default);font-family:var(--font-family);font-optical-sizing:auto}.chat-app__container.chat-app__container--inline-layout-contained{height:90svh;scroll-margin-top:10svh}@media (min-width: 768px){.chat-app__container.chat-app__container--inline-layout-contained{height:100svh;scroll-margin-top:0}}.chat-app__main{container-name:chat-inner-container;container-type:inline-size;display:flex;flex-direction:column;width:100%;height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior-x:none;overscroll-behavior-y:contain;background:var(--body-background);scrollbar-gutter:stable;touch-action:pan-y}.chat-app__container--inline-layout .chat-app__main{overscroll-behavior-y:auto}.chat-app__loader-container{display:flex;z-index:var(--z-index-loader);position:relative;align-items:center;justify-content:center;width:100%;height:100%}.chat-app__portals{display:contents}.chat-app__header{z-index:var(--z-index-header);position:sticky;top:0;background:var(--body-background)}.chat-app__header--unsticked{position:relative}.chat-app__header-content{--btn-padding-x: var(--btn-padding-y);display:flex;position:relative;-moz-column-gap:var(--spacer-r-12);column-gap:var(--spacer-r-12);flex-wrap:wrap;align-items:center;justify-content:flex-end;margin-right:calc(var(--btn-padding-x) * -1);margin-left:calc(var(--btn-padding-x) * -1);padding-top:var(--spacer-10);padding-bottom:var(--spacer-10)}.chat-app__header-content>:where(*){z-index:0;position:relative;pointer-events:auto}.chat-app__header-content:after{position:absolute;right:var(--btn-padding-x);bottom:0;left:var(--btn-padding-x);border-bottom:1px solid transparent;content:"";transition:border-color .1s ease-in-out}.chat-app__header-content.has-border:after{border-color:var(--base-line-color)}.chat-app__header-new-conversation{position:relative;margin-right:auto}@container chat-container (min-width: 640px){.chat-app__header-new-conversation .tooltip{display:none}}.chat-app__header--with-logo :where(.chat-app__header-content){margin-left:0}.chat-app__header--with-logo :where(.chat-app__header-new-conversation){margin-right:unset;margin-left:auto}.chat-app__header-logo{margin-right:auto}.chat-app__header-logo :where(svg){width:auto;height:var(--spacer-28)}.chat-app__body{display:flex;position:relative;flex-grow:1;flex-direction:column;width:100%}.chat-app__page-transition{display:flex;flex-grow:1;flex-direction:column;width:100%;height:100%}.chat-app__aside{--duration-in: .65s;--duration-out: .5s;visibility:hidden;position:relative;top:0;bottom:0;flex-grow:1;width:0;transition-delay:0s,var(--duration-out);transition-duration:var(--duration-out),0s;transition-property:width,visibility;transition-timing-function:var(--ease-in-out-quart),linear}.chat-app__aside.open{visibility:visible;width:var(--aside-width);transition-delay:0s;transition-duration:var(--duration-in),0s;transition-timing-function:var(--ease-out-quart),linear}.chat-app__aside .tooltip{--background-color: var(--btn-secondary-hover-background)}.chat-app__aside-container{position:relative;width:var(--aside-width);height:100%;overflow-y:auto;overscroll-behavior:contain;border-left-width:var(--aside-border-width);border-color:var(--aside-border-color);background:var(--aside-background);scrollbar-gutter:stable}.chat-app__container--inline-layout .chat-app__aside-container{overscroll-behavior-y:auto}.chat-app__aside-header,.chat-app__sheet-header{display:flex;z-index:var(--z-index-header);position:sticky;top:0;flex-wrap:no-wrap;align-items:center;justify-content:space-between;padding:var(--spacer-12) var(--spacer-12) var(--spacer-12) var(--spacer-24);gap:var(--spacer-24);border-bottom-width:var(--aside-header-border-width);border-color:var(--aside-header-border-color);background:var(--aside-background);color:var(--aside-header-color)}.chat-app__sheet-close{position:relative}.chat-app__sheet-overlay{z-index:var(--z-index-dialog);position:fixed;inset:0;background:var(--aside-background-overlay)}.chat-app__sheet-content{z-index:var(--z-index-flyout);position:fixed;top:0;right:0;width:100%;max-width:var(--aside-width);height:100%;overflow-y:auto;overscroll-behavior:contain;border-left-width:var(--aside-border-width);border-color:var(--aside-border-color);background:var(--aside-background);scrollbar-gutter:stable}.chat-app__container--inline-layout .chat-app__sheet-content{overscroll-behavior-y:auto}:is(.chat-app__aside-close,.chat-app__sheet-close) :where(.btn){background-color:transparent}.chat-app__aside-title,.chat-app__sheet-title{font-size:var(--base-font-size-sm)}.chat-app__close-button{z-index:var(--z-index-flyout)}}@layer components{.open-button{--open-button-avatar-height: var(--spacer-r-80);--open-button-avatar-width: var(--spacer-r-80);--open-button-duration: .4s;--open-button-delay: .3s;--open-button-ease: ease-in-out;display:flex;flex-direction:row;align-items:flex-end;cursor:pointer;transition:opacity .15s ease-out}.open-button--expanded{opacity:0;pointer-events:none}.open-button__text{display:flex;position:absolute;right:100%;bottom:50%;flex-direction:column;align-items:flex-start;justify-content:center;margin-right:calc(var(--open-button-avatar-width) * -.5);padding-top:var(--spacer-r-12);padding-right:0;padding-bottom:var(--spacer-r-12);padding-left:0;overflow:hidden;transform:translateY(50%);border-width:var(--open-button-border-width);border-radius:var(--open-button-border-radius);border-color:var(--open-button-border-color);background:var(--open-button-background);box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;color:var(--open-button-color);text-align:left;transition:transform var(--open-button-duration) var(--open-button-ease),padding-right var(--open-button-duration) var(--open-button-delay) var(--open-button-ease)}.open-button:is(:hover,.open-button--programmatic-expand) .open-button__text{transform:translateY(0);background:var(--open-button-hover-background, var(--open-button-background));color:var(--open-button-hover-color, var(--open-button-color));opacity:1;transition:transform var(--open-button-duration) var(--open-button-delay) var(--open-button-ease)}.open-button__title{max-width:240px;padding:0 calc(var(--open-button-avatar-width) * .5 + var(--spacer-r-12)) 0 var(--spacer-r-12);font-weight:700;white-space:pre}.open-button__mask{width:0;height:0;overflow:hidden;transition:width var(--open-button-duration) var(--open-button-delay) var(--open-button-ease),height var(--open-button-duration) var(--open-button-ease)}.open-button:is(:hover,.open-button--programmatic-expand) .open-button__mask{transition:width var(--open-button-duration) var(--open-button-ease),height var(--open-button-duration) var(--open-button-delay) var(--open-button-ease)}.open-button__description{position:relative;width:50cqw;max-width:260px;padding:0 calc(var(--open-button-avatar-width) * .5 + var(--spacer-r-12)) 0 var(--spacer-r-12);text-wrap:balance}.open-button__avatar{z-index:var(--z-index-local-overlay);position:relative;width:var(--open-button-avatar-width);height:var(--open-button-avatar-height);overflow:clip;border-radius:var(--spacer-r-80);filter:drop-shadow(0 4px 6px rgba(0,0,0,.15));transition:transform .2s var(--open-button-ease)}.open-button:is(:hover,.open-button--programmatic-expand) .open-button__avatar{transform:scale(1.05)}.open-button__link-icon{display:none;position:absolute;right:0;width:var(--spacer-r-80);height:var(--spacer-r-80);padding:var(--spacer-r-20);color:var(--open-button-color)}:where(.open-button--standalone){position:fixed;right:var(--spacer-r-16);bottom:var(--spacer-r-16)}@media (prefers-reduced-motion: reduce){.open-button__text,.open-button__mask,.open-button:hover .open-button__text,.open-button:hover .open-button__mask{transition:none!important}.open-button__avatar,.open-button:hover .open-button__avatar{filter:none!important;transition:none!important}}.open-button--hide-title-when-collapsed .open-button__text{visibility:hidden;opacity:0;transition:transform var(--open-button-duration) var(--open-button-ease),padding-right var(--open-button-duration) var(--open-button-delay) var(--open-button-ease),opacity var(--open-button-duration) var(--open-button-delay) var(--open-button-ease),visibility 0s linear calc(var(--open-button-duration) + var(--open-button-delay))}.open-button--hide-title-when-collapsed:is(:hover,.open-button--programmatic-expand) .open-button__text{visibility:visible;transform:translateY(0);background:var(--open-button-hover-background, var(--open-button-background));color:var(--open-button-hover-color, var(--open-button-color));opacity:1;transition:transform var(--open-button-duration) var(--open-button-delay) var(--open-button-ease),opacity var(--open-button-duration) var(--open-button-ease),visibility 0s linear 0s}}',eg=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),tg=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),rg=new RegExp("(\\d)(\\p{Ll})","gu"),ng=new RegExp("(\\p{L})(\\d)","gu"),ag=/[^\p{L}\d]+/giu,Ea="$1\0$2",ig="";function og(t,e){let r=t.trim();r=r.replace(eg,Ea).replace(tg,Ea),e?.separateNumbers&&(r=r.replace(rg,Ea).replace(ng,Ea)),r=r.replace(ag,"\0");let n=0,a=r.length;for(;r.charAt(n)==="\0";)n++;if(n===a)return[];for(;r.charAt(a-1)==="\0";)a--;return r.slice(n,a).split(/\0/g)}function sg(t,e){return ug(t,e?.prefixCharacters)+og(t,e).map(cg(e?.locale)).join(e?.delimiter??" ")}function lg(t,e){return sg(t,{delimiter:"-",...e})}function cg(t){return t===!1?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t)}function ug(t,e=ig){let r="";for(let n=0;n<t.length;n++){const a=t.charAt(n);if(e.includes(a))r+=a;else break}return r}const Ca=lg,dg=640,hg=1024;let Aa=null;const fg=()=>{if(Aa)return Aa;if(!globalThis.document)return 16;const t=globalThis.document.querySelector(":root");return Aa=Number(getComputedStyle(t).fontSize.slice(0,-2)),Aa},pg=({minRem:t,maxRem:e})=>{const r=fg(),n=dg/r,a=hg/r,i=(e-t)/(a-n),o=-n*i+t;return`clamp( ${t}rem, ${o}rem + ${i*100}cqw, ${e}rem )`},_c=t=>typeof t=="string"?t:typeof t=="number"?String(t):typeof t=="object"?t.minRem===t.maxRem?`${t.minRem}rem`:pg(t):"",so=(t,e,r,n=!1)=>{let a="";return r.forEach(i=>{let o=e[i];n&&!o&&i==="borderWidth"&&(o="0px"),n&&!o&&i==="borderColor"&&(o="transparent"),o&&(a+=`--${Ca(t)}-${Ca(i)}:${_c(o)}; `)}),a},xc=(t,e)=>Object.entries(e).map(([r,n])=>`--${t}-${Ca(r)}:${_c(n)}`).join("; ")+"; ",gg=(t,e)=>{let r="";return r+=so(t,e,["background","borderWidth","borderColor","boxShadow","borderRadius","color"],!0),e.hover&&(r+=so(`${t}-hover`,e.hover,["background","borderWidth","borderColor","boxShadow","color"])),e.focus&&(r+=so(`${t}-focus`,e.focus,["background","borderWidth","borderColor","boxShadow","color"])),e.custom&&(r+=xc(t,e.custom)),r},mg=(t,e)=>Object.entries(e).map(([r,n])=>`--color-${t}-${r}:${n}`).join("; ")+"; ",vg=t=>`--font-family: ${t?.family||"inherit"};`,bg=t=>{const e=vg(t.font),r=Object.entries(t.colors).map(([i,o])=>mg(i,o)).join(""),n=xc("base",t.base),a=Object.entries(t.components).map(([i,o])=>gg(Ca(i),o)).join("");return`.chat-app {${e} ${r} ${n} ${a}};`};var ht=typeof window<"u"?window:{screen:{},navigator:{}},tn=(ht.matchMedia||function(){return{matches:!1}}).bind(ht),kg={get passive(){return!0}},Sc=function(){};ht.addEventListener&&ht.addEventListener("p",Sc,kg),ht.removeEventListener&&ht.removeEventListener("p",Sc,!1);var lo="ontouchstart"in ht,yg="TouchEvent"in ht,wg=lo||yg&&tn("(any-pointer: coarse)").matches,Tc=(ht.navigator.maxTouchPoints||0)>0||wg,Ec=ht.navigator.userAgent||"",_g=tn("(pointer: coarse)").matches&&/iPad|Macintosh/.test(Ec)&&Math.min(ht.screen.width||0,ht.screen.height||0)>=768,Cc=(tn("(pointer: coarse)").matches||!tn("(pointer: fine)").matches&&lo)&&!/Windows.*Firefox/.test(Ec),xg=tn("(any-pointer: fine)").matches||tn("(any-hover: hover)").matches||_g||!lo,Ac=Tc&&(xg||!Cc)?"hybrid":Tc?"touchOnly":"mouseOnly",Sg=Ac==="mouseOnly"?"mouse":Ac==="touchOnly"||Cc?"touch":"mouse";function Rc(t,e){jr(e,!0);let r=se(e,"href",7),n=se(e,"target",7),a=se(e,"onclick",7),i=se(e,"className",23,()=>[]),o=se(e,"isStandalone",7,!1),s=se(e,"children",7),c=se(e,"type",7,"button"),l=se(e,"use",7),d=se(e,"class",7),p=fi(e,["$$slots","$$events","$$legacy","$$host","href","target","onclick","className","isStandalone","children","type","use","class"]);const h=ee(()=>r()?"a":"button"),v=ee(()=>[...Array.isArray(i())?i():i()?[i()]:[],...d()?[d()]:[]]),m=()=>({}),b=ee(()=>l()??m);var A=vt(),y=Oe(A);return Cs(y,()=>_(h),!1,(k,w)=>{As(k,U=>_(b)?.(U)),Ns(k,U=>({...p,onclick:r()?void 0:a(),type:r()?void 0:c(),href:r(),role:r()?"link":"button",target:r()?n():void 0,class:_(v),[Wr]:U}),[()=>({"open-button--standalone":o()})]);var T=vt(),I=Oe(T);Ss(I,s),oe(w,T)}),oe(t,A),Ur({get href(){return r()},set href(k){r(k),re()},get target(){return n()},set target(k){n(k),re()},get onclick(){return a()},set onclick(k){a(k),re()},get className(){return i()},set className(k=[]){i(k),re()},get isStandalone(){return o()},set isStandalone(k=!1){o(k),re()},get children(){return s()},set children(k){s(k),re()},get type(){return c()},set type(k="button"){c(k),re()},get use(){return l()},set use(k){l(k),re()},get class(){return d()},set class(k){d(k),re()}})}bn(Rc,{href:{},target:{},onclick:{},className:{},isStandalone:{},children:{},type:{},use:{},class:{}},[],[],!0);function On(t,e){jr(e,!0);let r=se(e,"css",7),n=fi(e,["$$slots","$$events","$$legacy","$$host","css"]);const a=c=>{es(()=>{r()&&(c.innerHTML=r())})};var i=vt(),o=Oe(i);{var s=c=>{var l=vt(),d=Oe(l);Cs(d,()=>"style",!1,(p,h)=>{As(p,v=>a?.(v)),Ns(p,()=>({...n}))}),oe(c,l)};ur(o,c=>{r()&&c(s)})}return oe(t,i),Ur({get css(){return r()},set css(c){r(c),re()}})}bn(On,{css:{}},[],[],!0);var Tg=Ct('<div class="open-button__title"><!></div>'),Eg=Ct('<div class="open-button__mask"><div class="open-button__description"><!></div></div>'),Cg=Ct('<div class="open-button__text"><!> <!></div>'),Ag=Ct('<div class="sr-only"> </div>'),Rg=Ct('<!> <div class="svg svg--avatar open-button__avatar" aria-hidden="true"><!></div>',1),Ig=Ct('<link rel="stylesheet"/>'),Lg=Ct("<!> <!>",1),Og=Ct('<!> <!> <!> <main class="chat-app"><!></main>',1);function Ic(t,e){jr(e,!0);const r=(B,z)=>{let G=()=>z?.().chatConfig,Ue=()=>z?.().language,ye=()=>z?.().colorScheme;const le=ee(()=>{const{openButtonTitle:xe,openButtonDescription:ie}=G().translations[Ue()];return{openButtonTitle:xe,openButtonDescription:ie}}),qe=ee(()=>G().fullTheme[ye()].tokens.svgs),we=ee(()=>G().fullTheme[ye()]?.tokens.components.openButton?.custom),_e=ee(()=>!!_(we)?.hideTitleWhenCollapsed);{let xe=ee(()=>G().buttonHref?void 0:s()?"true":"false"),ie=ee(()=>G().buttonHref?void 0:"true"),tt=ee(()=>G().buttonHref?void 0:o()),Ve=ee(()=>["open-button",e.buttonClass,g.data.flyoutIsOpen?"open-button--expanded":void 0,_(_e)?"open-button--hide-title-when-collapsed":void 0]);Rc(B,{get href(){return G().buttonHref},onclick:Ia,onmouseenter:Ra,onmouseleave:ho,use:er,get"aria-expanded"(){return _(xe)},get"aria-haspopup"(){return _(ie)},get"aria-controls"(){return _(tt)},get style(){return e.buttonStyle},get className(){return _(Ve)},get isStandalone(){return _(h)},children:(ft,tr)=>{var Ot=Rg(),Pn=Oe(Ot);{var La=rt=>{var Ze=Cg(),zr=Ut(Ze);{var Oa=Mt=>{var nt=Tg(),Pt=Ut(nt);li(Pt,()=>_(le).openButtonTitle),Ft(nt),oe(Mt,nt)};ur(zr,Mt=>{_(le).openButtonTitle&&Mt(Oa)})}var Ma=lr(zr,2);{var Nn=Mt=>{var nt=Eg(),Pt=Ut(nt),_t=Ut(Pt);li(_t,()=>_(le).openButtonDescription),Ft(Pt),Bs(Pt,Nt=>$(k,Nt),()=>_(k)),Ft(nt),Bs(nt,Nt=>$(y,Nt),()=>_(y)),oe(Mt,nt)};ur(Ma,Mt=>{_(le).openButtonDescription&&Sg==="mouse"&&Mt(Nn)})}Ft(Ze),oe(rt,Ze)},fo=rt=>{var Ze=Ag(),zr=Ut(Ze,!0);Ft(Ze),Qn(()=>ws(zr,g.t.ariaOpenChat)),oe(rt,Ze)};ur(Pn,rt=>{_(le).openButtonTitle||_(le).openButtonDescription?rt(La):rt(fo,!1)})}var nn=lr(Pn,2),$r=Ut(nn);li($r,()=>_(qe).avatar),Ft(nn),oe(ft,Ot)},$$slots:{default:!0}})}};let n=te("light"),a=se(e,"host",7),i=se(e,"onError",7),o=se(e,"flyoutId",7),s=se(e,"flyoutIsOpen",7),c=fi(e,["$$slots","$$events","$$legacy","$$host","host","onError","flyoutId","flyoutIsOpen"]);const l=async B=>{const G=await(await fetch(`${B}/chatconfig`)).json();return Kl.parse(G)},d=async({forceTheme:B,lang:z,apiUrl:G})=>{const Ue=window.CHAT_CONFIG_OVERRIDE?window.CHAT_CONFIG_OVERRIDE:await l(G),ye=nc(Ue);let le;z?le=Ta(z,ye.supportedLanguages):le=uc(ye.supportedLanguages);const qe=Object.keys(ye.fullTheme),we=ao(qe);return{chatConfig:ye,language:le,colorScheme:we}},p=(B,z)=>{if(B==null)return z;if(typeof B=="string"){const G=B.trim().toLowerCase();return!(G===""||G==="0"||G==="false"||G==="no")}return typeof B=="number"?B!==0:typeof B=="boolean"?B:z};let h=ee(()=>!!a()),v=te(!1),m=te(!1),b=te(!1),A=te(void 0),y=te(void 0),k=te(void 0),w=ee(()=>_(k)?.offsetWidth??0),T=ee(()=>_(k)?.offsetHeight??0),I=te(void 0),U=te(!1),Q,je=te(!0);function ce(){return _(I)?(clearTimeout(_(I)),$(I,void 0),!0):!1}async function pr(B){$(n,B.colorScheme,!0),Q?.(),ce(),$(U,!1);const z=B.chatConfig.fullTheme[_(n)]?.tokens.components.openButton?.custom??{},G=z.autoExpandScrollThreshold,Ue=Number(z.autoCollapseDelay??0),ye=Number.isNaN(Ue)?0:Math.max(0,Ue),le=p(z.autoExpandOnce,!1),qe=(()=>{if(G==null)return 100;if(typeof G=="string"){if(G.trim().toLowerCase()==="none")return 0;const Ve=Number(G);return Number.isNaN(Ve)?100:Ve}const ie=Number(G);return Number.isNaN(ie)?100:ie})();if(Number.isNaN(qe)||qe<=0)return;const we=`liipgpt-auto-expand-${e.apiUrl}`;let _e=!1;if(typeof window<"u")try{_e=window.localStorage.getItem(we)==="true"}catch(ie){console.warn("LiipGPT: unable to read auto-expand flag",ie)}$(b,_e,!0);const xe=()=>{if(!(window.scrollY/window.innerHeight*100>=qe)){$(je,!0);return}if(!(_(m)||s())&&!(le&&(_e||_(b)))&&_(je)){if($(je,!1),$(m,!0),$(b,!0),co(),le&&typeof window<"u")try{window.localStorage.setItem(we,"true")}catch(Ve){console.warn("LiipGPT: unable to persist auto-expand flag",Ve)}$(I,setTimeout(()=>{_(U)||(uo(),$(m,!1)),$(I,void 0)},ye),!0)}};window.addEventListener("scroll",xe,{passive:!0}),qe===0&&(await gs(),xe()),Q=()=>{window.removeEventListener("scroll",xe)}}function ae(){ce(),$(m,!1),$(U,!1)}function er(B){$(A,B,!0)}function gr(){Q?.(),ce()}hd(gr);function mr(){!_(k)||!_(y)||(_(y).style.width=`${_(w)}px`,_(y).style.height=`${_(T)}px`)}function rn(){_(y)&&(_(y).style.width="0",_(y).style.height="0")}function co(){_(A)&&(_(A).classList.add("open-button--programmatic-expand"),mr())}function uo(){_(A)&&(_(A).classList.remove("open-button--programmatic-expand"),rn())}function Ra(){ce()&&$(U,!0),mr()}function ho(){ce(),_(U)&&($(m,!1),$(U,!1),_(A)?.classList.remove("open-button--programmatic-expand")),_(v)||rn()}function Ia(B){ae(),e.onclick?.(B)}let ue=ee(()=>d(c).then(async B=>(await pr(B),B)).catch(B=>i()(B)));var Mn=vt();Ku("beforeunload",Xa,gr),Ju(B=>{var z=vt(),G=Oe(z);{var Ue=ye=>{var le=vt(),qe=Oe(le);Ts(qe,()=>_(ue),null,(we,_e)=>{var xe=Lg();const ie=ee(()=>_(_e).chatConfig.fullTheme[_(_e).colorScheme]);var tt=Oe(xe);gd(tt,17,()=>_(ie).fontURLs??[],fd,(ft,tr)=>{var Ot=Ig();Qn(()=>hi(Ot,"href",_(tr))),oe(ft,Ot)});var Ve=lr(tt,2);On(Ve,{id:"font-css",get css(){return _(ie).fontCSS}}),oe(we,xe)}),oe(ye,le)};ur(G,ye=>{_(h)&&ye(Ue)})}oe(B,z)});var ge=Oe(Mn);return Ts(ge,()=>_(ue),B=>{},(B,z)=>{var G=vt();const Ue=ee(()=>_(z).chatConfig.fullTheme[_(n)]);var ye=Oe(G);{var le=we=>{var _e=Og(),xe=Oe(_e);{let tr=ee(()=>bg(_(Ue).tokens));On(xe,{id:"theme-css",get css(){return _(tr)}})}var ie=lr(xe,2);On(ie,{id:"app-css",get css(){return Jp}});var tt=lr(ie,2);On(tt,{id:"custom-css",get css(){return _(Ue).customCSS}});var Ve=lr(tt,2),ft=Ut(Ve);r(ft,()=>_(z)),Ft(Ve),oe(we,_e)},qe=we=>{r(we,()=>_(z))};ur(ye,we=>{_(h)?we(le):we(qe,!1)})}oe(B,G)}),oe(t,Mn),Ur({get host(){return a()},set host(B){a(B),re()},get onError(){return i()},set onError(B){i(B),re()},get flyoutId(){return o()},set flyoutId(B){o(B),re()},get flyoutIsOpen(){return s()},set flyoutIsOpen(B){s(B),re()}})}bn(Ic,{host:{},onError:{},flyoutId:{},flyoutIsOpen:{}},[],[],!0);function Lc(t,e){jr(e,!0);let r=se(e,"onclick",7),n=se(e,"buttonClass",7),a=se(e,"buttonStyle",7),i=se(e,"apiUrl",7),o=se(e,"forceTheme",7),s=se(e,"lang",7),c=ee(()=>({onclick:r(),buttonClass:n(),buttonStyle:a(),apiUrl:i(),forceTheme:o(),lang:s()}));return Us(t,{silent:!0,body:(d,p=br)=>{Ic(d,Od({host:e.$$host,get onError(){return p()}},()=>_(c)))},$$slots:{body:!0}}),Ur({get onclick(){return r()},set onclick(l){r(l),re()},get buttonClass(){return n()},set buttonClass(l){n(l),re()},get buttonStyle(){return a()},set buttonStyle(l){a(l),re()},get apiUrl(){return i()},set apiUrl(l){i(l),re()},get forceTheme(){return o()},set forceTheme(l){o(l),re()},get lang(){return s()},set lang(l){s(l),re()}})}return customElements.define("liipgpt-button",bn(Lc,{forceTheme:{attribute:"force-theme",type:"String"},buttonClass:{attribute:"button-class",type:"String"},buttonStyle:{attribute:"button-style",type:"String"},apiUrl:{attribute:"api-url",type:"String"},lang:{attribute:"lang",type:"String"},onclick:{}},[],[],!0)),sn.LiipGPTButton=Lc,Object.defineProperty(sn,Symbol.toStringTag,{value:"Module"}),sn}({});