@botfabrik/engine-webclient 4.109.10 → 4.109.12-alpha.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.
- package/dist/client/assets/{index-C02CnGO5.js → index-DfW2mfd6.js} +40 -40
- package/dist/client/assets/{index-C02CnGO5.js.map → index-DfW2mfd6.js.map} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/embed/bundle.js +5 -5
- package/dist/index.js +101 -9
- package/dist/types.d.ts +29 -0
- package/package.json +9 -6
package/dist/client/index.html
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<meta name="theme-color" content="#000000" />
|
|
14
14
|
<meta name="google" content="notranslate" />
|
|
15
15
|
<title>Bubble Chat Client</title>
|
|
16
|
-
<script type="module" crossorigin src="./assets/index-
|
|
16
|
+
<script type="module" crossorigin src="./assets/index-DfW2mfd6.js"></script>
|
|
17
17
|
<link rel="stylesheet" crossorigin href="./assets/index-BKtBdibb.css">
|
|
18
18
|
</head>
|
|
19
19
|
|
package/dist/embed/bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(){"use strict";const Ye=!1;var Tn=Array.isArray,Sn=Array.prototype.indexOf,ce=Array.prototype.includes,On=Array.from,Cn=Object.defineProperty,de=Object.getOwnPropertyDescriptor,An=Object.getOwnPropertyDescriptors,Rn=Object.prototype,Nn=Array.prototype,mt=Object.getPrototypeOf,bt=Object.isExtensible;const Dn=()=>{};function In(e){for(var t=0;t<e.length;t++)e[t]()}function yt(){var e,t,n=new Promise((i,r)=>{e=i,t=r});return{promise:n,resolve:e,reject:t}}const x=2,he=4,xe=8,Et=1<<24,J=16,B=32,re=64,Ve=128,I=512,E=1024,T=2048,U=4096,G=8192,V=16384,ve=32768,_e=65536,kt=1<<17,xt=1<<18,ie=1<<19,Ln=1<<20,se=65536,Ke=1<<21,Xe=1<<22,Q=1<<23,Ne=Symbol("$state"),Mn=Symbol("legacy props"),Pn=Symbol(""),oe=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function Fn(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Un(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function zn(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function jn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Wn(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Hn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function qn(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Bn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Gn(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Yn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Vn(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Kn=1,Xn=4,Zn=8,Jn=16,Qn=1,$n=2,S=Symbol(),Tt="http://www.w3.org/1999/xhtml";function er(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function St(e){return e===this.v}function tr(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function nr(e){return!tr(e,this.v)}let rr=!1,A=null;function pe(e){A=e}function De(e,t=!1,n){A={p:A,i:!1,c:null,e:null,s:e,x:null,l:null}}function Ie(e){var t=A,n=t.e;if(n!==null){t.e=null;for(var i of n)Gt(i)}return t.i=!0,A=t.p,{}}function Ot(){return!0}let ge=[];function ir(){var e=ge;ge=[],In(e)}function we(e){if(ge.length===0){var t=ge;queueMicrotask(()=>{t===ge&&ir()})}ge.push(e)}function Ct(e){var t=w;if(t===null)return _.f|=Q,e;if((t.f&ve)===0&&(t.f&he)===0)throw e;$(e,t)}function $(e,t){for(;t!==null;){if((t.f&Ve)!==0){if((t.f&ve)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const sr=-7169;function b(e,t){e.f=e.f&sr|t}function Ze(e){(e.f&I)!==0||e.deps===null?b(e,E):b(e,U)}function At(e){if(e!==null)for(const t of e)(t.f&x)===0||(t.f&se)===0||(t.f^=se,At(t.deps))}function Rt(e,t,n){(e.f&T)!==0?t.add(e):(e.f&U)!==0&&n.add(e),At(e.deps),b(e,E)}const Le=new Set;let y=null,z=null,L=[],Je=null,me=null;class ee{current=new Map;previous=new Map;#e=new Set;#a=new Set;#t=0;#o=0;#n=null;#s=new Set;#r=new Set;#i=new Map;is_fork=!1;#l=!1;#u(){return this.is_fork||this.#o>0}skip_effect(t){this.#i.has(t)||this.#i.set(t,{d:[],m:[]})}unskip_effect(t){var n=this.#i.get(t);if(n){this.#i.delete(t);for(var i of n.d)b(i,T),j(i);for(i of n.m)b(i,U),j(i)}}process(t){L=[],this.apply();var n=me=[],i=[];for(const r of t)this.#f(r,n,i);if(me=null,this.#u()){this.#c(i),this.#c(n);for(const[r,s]of this.#i)Lt(r,s)}else{y=null;for(const r of this.#e)r(this);this.#e.clear(),this.#t===0&&this.#d(),Nt(i),Nt(n),this.#s.clear(),this.#r.clear(),this.#n?.resolve()}z=null}#f(t,n,i){t.f^=E;for(var r=t.first;r!==null;){var s=r.f,o=(s&(B|re))!==0,l=o&&(s&E)!==0,a=l||(s&G)!==0||this.#i.has(r);if(!a&&r.fn!==null){o?r.f^=E:(s&he)!==0?n.push(r):Oe(r)&&((s&J)!==0&&this.#r.add(r),ye(r));var f=r.first;if(f!==null){r=f;continue}}for(;r!==null;){var u=r.next;if(u!==null){r=u;break}r=r.parent}}}#c(t){for(var n=0;n<t.length;n+=1)Rt(t[n],this.#s,this.#r)}capture(t,n){n!==S&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&Q)===0&&(this.current.set(t,t.v),z?.set(t,t.v))}activate(){y=this,this.apply()}deactivate(){y===this&&(y=null,z=null)}flush(){if(L.length>0)y=this,or();else if(this.#t===0&&!this.is_fork){for(const t of this.#e)t(this);this.#e.clear(),this.#d(),this.#n?.resolve()}this.deactivate()}discard(){for(const t of this.#a)t(this);this.#a.clear()}#d(){if(Le.size>1){this.previous.clear();var t=y,n=z,i=!0;for(const s of Le){if(s===this){i=!1;continue}const o=[];for(const[a,f]of this.current){if(s.current.has(a))if(i&&f!==s.current.get(a))s.current.set(a,f);else continue;o.push(a)}if(o.length===0)continue;const l=[...s.current.keys()].filter(a=>!this.current.has(a));if(l.length>0){var r=L;L=[];const a=new Set,f=new Map;for(const u of o)Dt(u,l,a,f);if(L.length>0){y=s,s.apply();for(const u of L)s.#f(u,[],[]);s.deactivate()}L=r}}y=t,z=n}this.#i.clear(),Le.delete(this)}increment(t){this.#t+=1,t&&(this.#o+=1)}decrement(t){this.#t-=1,t&&(this.#o-=1),!this.#l&&(this.#l=!0,we(()=>{this.#l=!1,this.#u()?L.length>0&&this.flush():this.revive()}))}revive(){for(const t of this.#s)this.#r.delete(t),b(t,T),j(t);for(const t of this.#r)b(t,U),j(t);this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#a.add(t)}settled(){return(this.#n??=yt()).promise}static ensure(){if(y===null){const t=y=new ee;Le.add(y),we(()=>{y===t&&t.flush()})}return y}apply(){}}function or(){var e=null;try{for(var t=0;L.length>0;){var n=ee.ensure();if(t++>1e3){var i,r;ar()}n.process(L),te.clear()}}finally{L=[],Je=null,me=null}}function ar(){try{Hn()}catch(e){$(e,Je)}}let K=null;function Nt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var i=e[n++];if((i.f&(V|G))===0&&Oe(i)&&(K=new Set,ye(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&Vt(i),K?.size>0)){te.clear();for(const r of K){if((r.f&(V|G))!==0)continue;const s=[r];let o=r.parent;for(;o!==null;)K.has(o)&&(K.delete(o),s.push(o)),o=o.parent;for(let l=s.length-1;l>=0;l--){const a=s[l];(a.f&(V|G))===0&&ye(a)}}K.clear()}}K=null}}function Dt(e,t,n,i){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const r of e.reactions){const s=r.f;(s&x)!==0?Dt(r,t,n,i):(s&(Xe|J))!==0&&(s&T)===0&&It(r,t,i)&&(b(r,T),j(r))}}function It(e,t,n){const i=n.get(e);if(i!==void 0)return i;if(e.deps!==null)for(const r of e.deps){if(ce.call(t,r))return!0;if((r.f&x)!==0&&It(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function j(e){var t=Je=e,n=t.b;if(n?.is_pending&&(e.f&(he|xe|Et))!==0&&(e.f&ve)===0){n.defer_effect(e);return}for(;t.parent!==null;){t=t.parent;var i=t.f;if(me!==null&&t===w&&(e.f&xe)===0)return;if((i&(re|B))!==0){if((i&E)===0)return;t.f^=E}}L.push(t)}function Lt(e,t){if(!((e.f&B)!==0&&(e.f&E)!==0)){(e.f&T)!==0?t.d.push(e):(e.f&U)!==0&&t.m.push(e),b(e,E);for(var n=e.first;n!==null;)Lt(n,t),n=n.next}}function lr(e){let t=0,n=Me(0),i;return()=>{rt()&&(O(n),Dr(()=>(t===0&&(i=ot(()=>e(()=>Te(n)))),t+=1,()=>{we(()=>{t-=1,t===0&&(i?.(),i=void 0,Te(n))})})))}}var fr=_e|ie;function ur(e,t,n,i){new cr(e,t,n,i)}class cr{parent;is_pending=!1;transform_error;#e;#a=null;#t;#o;#n;#s=null;#r=null;#i=null;#l=null;#u=0;#f=0;#c=!1;#d=new Set;#v=new Set;#h=null;#m=lr(()=>(this.#h=Me(this.#u),()=>{this.#h=null}));constructor(t,n,i,r){this.#e=t,this.#t=n,this.#o=s=>{var o=w;o.b=this,o.f|=Ve,i(s)},this.parent=w.b,this.transform_error=r??this.parent?.transform_error??(s=>s),this.#n=it(()=>{this.#g()},fr)}#b(){try{this.#s=Z(()=>this.#o(this.#e))}catch(t){this.error(t)}}#y(t){const n=this.#t.failed;n&&(this.#i=Z(()=>{n(this.#e,()=>t,()=>()=>{})}))}#E(){const t=this.#t.pending;t&&(this.is_pending=!0,this.#r=Z(()=>t(this.#e)),we(()=>{var n=this.#l=document.createDocumentFragment(),i=be();n.append(i),this.#s=this.#p(()=>(ee.ensure(),Z(()=>this.#o(i)))),this.#f===0&&(this.#e.before(n),this.#l=null,Se(this.#r,()=>{this.#r=null}),this.#_())}))}#g(){try{if(this.is_pending=this.has_pending_snippet(),this.#f=0,this.#u=0,this.#s=Z(()=>{this.#o(this.#e)}),this.#f>0){var t=this.#l=document.createDocumentFragment();Zt(this.#s,t);const n=this.#t.pending;this.#r=Z(()=>n(this.#e))}else this.#_()}catch(n){this.error(n)}}#_(){this.is_pending=!1;for(const t of this.#d)b(t,T),j(t);for(const t of this.#v)b(t,U),j(t);this.#d.clear(),this.#v.clear()}defer_effect(t){Rt(t,this.#d,this.#v)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#p(t){var n=w,i=_,r=A;Y(this.#n),M(this.#n),pe(this.#n.ctx);try{return t()}catch(s){return Ct(s),null}finally{Y(n),M(i),pe(r)}}#w(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#w(t);return}this.#f+=t,this.#f===0&&(this.#_(),this.#r&&Se(this.#r,()=>{this.#r=null}),this.#l&&(this.#e.before(this.#l),this.#l=null))}update_pending_count(t){this.#w(t),this.#u+=t,!(!this.#h||this.#c)&&(this.#c=!0,we(()=>{this.#c=!1,this.#h&&Pe(this.#h,this.#u)}))}get_effect_pending(){return this.#m(),O(this.#h)}error(t){var n=this.#t.onerror;let i=this.#t.failed;if(!n&&!i)throw t;this.#s&&(R(this.#s),this.#s=null),this.#r&&(R(this.#r),this.#r=null),this.#i&&(R(this.#i),this.#i=null);var r=!1,s=!1;const o=()=>{if(r){er();return}r=!0,s&&Vn(),this.#i!==null&&Se(this.#i,()=>{this.#i=null}),this.#p(()=>{ee.ensure(),this.#g()})},l=a=>{try{s=!0,n?.(a,o),s=!1}catch(f){$(f,this.#n&&this.#n.parent)}i&&(this.#i=this.#p(()=>{ee.ensure();try{return Z(()=>{var f=w;f.b=this,f.f|=Ve,i(this.#e,()=>a,()=>o)})}catch(f){return $(f,this.#n.parent),null}}))};we(()=>{var a;try{a=this.transform_error(t)}catch(f){$(f,this.#n&&this.#n.parent);return}a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(l,f=>$(f,this.#n&&this.#n.parent)):l(a)})}}function dr(e,t,n,i){const r=$e;var s=e.filter(c=>!c.settled);if(n.length===0&&s.length===0){i(t.map(r));return}var o=w,l=hr(),a=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(c=>c.promise)):null;function f(c){l();try{i(c)}catch(d){(o.f&V)===0&&$(d,o)}Qe()}if(n.length===0){a.then(()=>f(t.map(r)));return}function u(){l(),Promise.all(n.map(c=>_r(c))).then(c=>f([...t.map(r),...c])).catch(c=>$(c,o))}a?a.then(u):u()}function hr(){var e=w,t=_,n=A,i=y;return function(s=!0){Y(e),M(t),pe(n),s&&i?.activate()}}function Qe(e=!0){Y(null),M(null),pe(null),e&&y?.deactivate()}function vr(){var e=w.b,t=y,n=e.is_rendered();return e.update_pending_count(1),t.increment(n),()=>{e.update_pending_count(-1),t.decrement(n)}}function $e(e){var t=x|T,n=_!==null&&(_.f&x)!==0?_:null;return w!==null&&(w.f|=ie),{ctx:A,deps:null,effects:null,equals:St,f:t,fn:e,reactions:null,rv:0,v:S,wv:0,parent:n??w,ac:null}}function _r(e,t,n){w===null&&Un();var r=void 0,s=Me(S),o=!_,l=new Map;return Nr(()=>{var a=yt();r=a.promise;try{Promise.resolve(e()).then(a.resolve,a.reject).finally(Qe)}catch(d){a.reject(d),Qe()}var f=y;if(o){var u=vr();l.get(f)?.reject(oe),l.delete(f),l.set(f,a)}const c=(d,v=void 0)=>{if(f.activate(),v)v!==oe&&(s.f|=Q,Pe(s,v));else{(s.f&Q)!==0&&(s.f^=Q),Pe(s,d);for(const[h,p]of l){if(l.delete(h),h===f)break;p.reject(oe)}}u&&u()};a.promise.then(c,d=>c(null,d||"unknown"))}),Or(()=>{for(const a of l.values())a.reject(oe)}),new Promise(a=>{function f(u){function c(){u===r?a(s):f(r)}u.then(c,c)}f(r)})}function pr(e){const t=$e(e);return t.equals=nr,t}function gr(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)R(t[n])}}function wr(e){for(var t=e.parent;t!==null;){if((t.f&x)===0)return(t.f&V)===0?t:null;t=t.parent}return null}function et(e){var t,n=w;Y(wr(e));try{e.f&=~se,gr(e),t=nn(e)}finally{Y(n)}return t}function Mt(e){var t=et(e);if(!e.equals(t)&&(e.wv=en(),(!y?.is_fork||e.deps===null)&&(e.v=t,e.deps===null))){b(e,E);return}ne||(z!==null?(rt()||y?.is_fork)&&z.set(e,t):Ze(e))}function mr(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(oe),t.teardown=Dn,t.ac=null,Ce(t,0),st(t))}function Pt(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&ye(t)}let tt=new Set;const te=new Map;let Ft=!1;function Me(e,t){var n={f:0,v:e,reactions:null,equals:St,rv:0,wv:0};return n}function W(e,t){const n=Me(e);return Pr(n),n}function H(e,t,n=!1){_!==null&&(!q||(_.f&kt)!==0)&&Ot()&&(_.f&(x|J|Xe|kt))!==0&&(P===null||!ce.call(P,e))&&Yn();let i=n?ae(t):t;return Pe(e,i)}function Pe(e,t){if(!e.equals(t)){var n=e.v;ne?te.set(e,t):te.set(e,n),e.v=t;var i=ee.ensure();if(i.capture(e,n),(e.f&x)!==0){const r=e;(e.f&T)!==0&&et(r),Ze(r)}e.wv=en(),Ut(e,T),w!==null&&(w.f&E)!==0&&(w.f&(B|re))===0&&(F===null?Fr([e]):F.push(e)),!i.is_fork&&tt.size>0&&!Ft&&br()}return t}function br(){Ft=!1;for(const e of tt)(e.f&E)!==0&&b(e,U),Oe(e)&&ye(e);tt.clear()}function Te(e){H(e,e.v+1)}function Ut(e,t){var n=e.reactions;if(n!==null)for(var i=n.length,r=0;r<i;r++){var s=n[r],o=s.f,l=(o&T)===0;if(l&&b(s,t),(o&x)!==0){var a=s;z?.delete(a),(o&se)===0&&(o&I&&(s.f|=se),Ut(a,U))}else l&&((o&J)!==0&&K!==null&&K.add(s),j(s))}}function ae(e){if(typeof e!="object"||e===null||Ne in e)return e;const t=mt(e);if(t!==Rn&&t!==Nn)return e;var n=new Map,i=Tn(e),r=W(0),s=fe,o=l=>{if(fe===s)return l();var a=_,f=fe;M(null),$t(s);var u=l();return M(a),$t(f),u};return i&&n.set("length",W(e.length)),new Proxy(e,{defineProperty(l,a,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&Bn();var u=n.get(a);return u===void 0?o(()=>{var c=W(f.value);return n.set(a,c),c}):H(u,f.value,!0),!0},deleteProperty(l,a){var f=n.get(a);if(f===void 0){if(a in l){const u=o(()=>W(S));n.set(a,u),Te(r)}}else H(f,S),Te(r);return!0},get(l,a,f){if(a===Ne)return e;var u=n.get(a),c=a in l;if(u===void 0&&(!c||de(l,a)?.writable)&&(u=o(()=>{var v=ae(c?l[a]:S),h=W(v);return h}),n.set(a,u)),u!==void 0){var d=O(u);return d===S?void 0:d}return Reflect.get(l,a,f)},getOwnPropertyDescriptor(l,a){var f=Reflect.getOwnPropertyDescriptor(l,a);if(f&&"value"in f){var u=n.get(a);u&&(f.value=O(u))}else if(f===void 0){var c=n.get(a),d=c?.v;if(c!==void 0&&d!==S)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return f},has(l,a){if(a===Ne)return!0;var f=n.get(a),u=f!==void 0&&f.v!==S||Reflect.has(l,a);if(f!==void 0||w!==null&&(!u||de(l,a)?.writable)){f===void 0&&(f=o(()=>{var d=u?ae(l[a]):S,v=W(d);return v}),n.set(a,f));var c=O(f);if(c===S)return!1}return u},set(l,a,f,u){var c=n.get(a),d=a in l;if(i&&a==="length")for(var v=f;v<c.v;v+=1){var h=n.get(v+"");h!==void 0?H(h,S):v in l&&(h=o(()=>W(S)),n.set(v+"",h))}if(c===void 0)(!d||de(l,a)?.writable)&&(c=o(()=>W(void 0)),H(c,ae(f)),n.set(a,c));else{d=c.v!==S;var p=o(()=>ae(f));H(c,p)}var m=Reflect.getOwnPropertyDescriptor(l,a);if(m?.set&&m.set.call(u,f),!d){if(i&&typeof a=="string"){var D=n.get("length"),g=Number(a);Number.isInteger(g)&&g>=D.v&&H(D,g+1)}Te(r)}return!0},ownKeys(l){O(r);var a=Reflect.ownKeys(l).filter(c=>{var d=n.get(c);return d===void 0||d.v!==S});for(var[f,u]of n)u.v!==S&&!(f in l)&&a.push(f);return a},setPrototypeOf(){Gn()}})}var zt,jt,Wt,Ht;function yr(){if(zt===void 0){zt=window,jt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Wt=de(t,"firstChild").get,Ht=de(t,"nextSibling").get,bt(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),bt(n)&&(n.__t=void 0)}}function be(e=""){return document.createTextNode(e)}function Fe(e){return Wt.call(e)}function Ue(e){return Ht.call(e)}function nt(e,t){return Fe(e)}function Er(e,t=!1){{var n=Fe(e);return n instanceof Comment&&n.data===""?Ue(n):n}}function kr(e,t=1,n=!1){let i=e;for(;t--;)i=Ue(i);return i}function xr(){return!1}function qt(e,t,n){return document.createElementNS(Tt,e,void 0)}function Bt(e){var t=_,n=w;M(null),Y(null);try{return e()}finally{M(t),Y(n)}}function Tr(e){w===null&&(_===null&&Wn(),jn()),ne&&zn()}function Sr(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function X(e,t){var n=w;n!==null&&(n.f&G)!==0&&(e|=G);var i={ctx:A,deps:null,nodes:null,f:e|T|I,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null},r=i;if((e&he)!==0)me!==null?me.push(i):j(i);else if(t!==null){try{ye(i)}catch(o){throw R(i),o}r.deps===null&&r.teardown===null&&r.nodes===null&&r.first===r.last&&(r.f&ie)===0&&(r=r.first,(e&J)!==0&&(e&_e)!==0&&r!==null&&(r.f|=_e))}if(r!==null&&(r.parent=n,n!==null&&Sr(r,n),_!==null&&(_.f&x)!==0&&(e&re)===0)){var s=_;(s.effects??=[]).push(r)}return i}function rt(){return _!==null&&!q}function Or(e){const t=X(xe,null);return b(t,E),t.teardown=e,t}function Cr(e){Tr();var t=w.f,n=!_&&(t&B)!==0&&(t&ve)===0;if(n){var i=A;(i.e??=[]).push(e)}else return Gt(e)}function Gt(e){return X(he|Ln,e)}function Ar(e){ee.ensure();const t=X(re|ie,e);return(n={})=>new Promise(i=>{n.outro?Se(t,()=>{R(t),i(void 0)}):(R(t),i(void 0))})}function Rr(e){return X(he,e)}function Nr(e){return X(Xe|ie,e)}function Dr(e,t=0){return X(xe|t,e)}function ze(e,t=[],n=[],i=[]){dr(i,t,n,r=>{X(xe,()=>e(...r.map(O)))})}function it(e,t=0){var n=X(J|t,e);return n}function Z(e){return X(B|ie,e)}function Yt(e){var t=e.teardown;if(t!==null){const n=ne,i=_;Jt(!0),M(null);try{t.call(null)}finally{Jt(n),M(i)}}}function st(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const r=n.ac;r!==null&&Bt(()=>{r.abort(oe)});var i=n.next;(n.f&re)!==0?n.parent=null:R(n,t),n=i}}function Ir(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&B)===0&&R(t),t=n}}function R(e,t=!0){var n=!1;(t||(e.f&xt)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Lr(e.nodes.start,e.nodes.end),n=!0),st(e,t&&!n),Ce(e,0),b(e,V);var i=e.nodes&&e.nodes.t;if(i!==null)for(const s of i)s.stop();Yt(e);var r=e.parent;r!==null&&r.first!==null&&Vt(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function Lr(e,t){for(;e!==null;){var n=e===t?null:Ue(e);e.remove(),e=n}}function Vt(e){var t=e.parent,n=e.prev,i=e.next;n!==null&&(n.next=i),i!==null&&(i.prev=n),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function Se(e,t,n=!0){var i=[];Kt(e,i,!0);var r=()=>{n&&R(e),t&&t()},s=i.length;if(s>0){var o=()=>--s||r();for(var l of i)l.out(o)}else r()}function Kt(e,t,n){if((e.f&G)===0){e.f^=G;var i=e.nodes&&e.nodes.t;if(i!==null)for(const l of i)(l.is_global||n)&&t.push(l);for(var r=e.first;r!==null;){var s=r.next,o=(r.f&_e)!==0||(r.f&B)!==0&&(e.f&J)!==0;Kt(r,t,o?n:!1),r=s}}}function Mr(e){Xt(e,!0)}function Xt(e,t){if((e.f&G)!==0){e.f^=G,(e.f&E)===0&&(b(e,T),j(e));for(var n=e.first;n!==null;){var i=n.next,r=(n.f&_e)!==0||(n.f&B)!==0;Xt(n,r?t:!1),n=i}var s=e.nodes&&e.nodes.t;if(s!==null)for(const o of s)(o.is_global||t)&&o.in()}}function Zt(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;n!==null;){var r=n===i?null:Ue(n);t.append(n),n=r}}let je=!1,ne=!1;function Jt(e){ne=e}let _=null,q=!1;function M(e){_=e}let w=null;function Y(e){w=e}let P=null;function Pr(e){_!==null&&(P===null?P=[e]:P.push(e))}let C=null,N=0,F=null;function Fr(e){F=e}let Qt=1,le=0,fe=le;function $t(e){fe=e}function en(){return++Qt}function Oe(e){var t=e.f;if((t&T)!==0)return!0;if(t&x&&(e.f&=~se),(t&U)!==0){for(var n=e.deps,i=n.length,r=0;r<i;r++){var s=n[r];if(Oe(s)&&Mt(s),s.wv>e.wv)return!0}(t&I)!==0&&z===null&&b(e,E)}return!1}function tn(e,t,n=!0){var i=e.reactions;if(i!==null&&!(P!==null&&ce.call(P,e)))for(var r=0;r<i.length;r++){var s=i[r];(s.f&x)!==0?tn(s,t,!1):t===s&&(n?b(s,T):(s.f&E)!==0&&b(s,U),j(s))}}function nn(e){var t=C,n=N,i=F,r=_,s=P,o=A,l=q,a=fe,f=e.f;C=null,N=0,F=null,_=(f&(B|re))===0?e:null,P=null,pe(e.ctx),q=!1,fe=++le,e.ac!==null&&(Bt(()=>{e.ac.abort(oe)}),e.ac=null);try{e.f|=Ke;var u=e.fn,c=u();e.f|=ve;var d=e.deps,v=y?.is_fork;if(C!==null){var h;if(v||Ce(e,N),d!==null&&N>0)for(d.length=N+C.length,h=0;h<C.length;h++)d[N+h]=C[h];else e.deps=d=C;if(rt()&&(e.f&I)!==0)for(h=N;h<d.length;h++)(d[h].reactions??=[]).push(e)}else!v&&d!==null&&N<d.length&&(Ce(e,N),d.length=N);if(Ot()&&F!==null&&!q&&d!==null&&(e.f&(x|U|T))===0)for(h=0;h<F.length;h++)tn(F[h],e);if(r!==null&&r!==e){if(le++,r.deps!==null)for(let p=0;p<n;p+=1)r.deps[p].rv=le;if(t!==null)for(const p of t)p.rv=le;F!==null&&(i===null?i=F:i.push(...F))}return(e.f&Q)!==0&&(e.f^=Q),c}catch(p){return Ct(p)}finally{e.f^=Ke,C=t,N=n,F=i,_=r,P=s,pe(o),q=l,fe=a}}function Ur(e,t){let n=t.reactions;if(n!==null){var i=Sn.call(n,e);if(i!==-1){var r=n.length-1;r===0?n=t.reactions=null:(n[i]=n[r],n.pop())}}if(n===null&&(t.f&x)!==0&&(C===null||!ce.call(C,t))){var s=t;(s.f&I)!==0&&(s.f^=I,s.f&=~se),Ze(s),mr(s),Ce(s,0)}}function Ce(e,t){var n=e.deps;if(n!==null)for(var i=t;i<n.length;i++)Ur(e,n[i])}function ye(e){var t=e.f;if((t&V)===0){b(e,E);var n=w,i=je;w=e,je=!0;try{(t&(J|Et))!==0?Ir(e):st(e),Yt(e);var r=nn(e);e.teardown=typeof r=="function"?r:null,e.wv=Qt;var s;Ye&&rr&&(e.f&T)!==0&&e.deps}finally{je=i,w=n}}}function O(e){var t=e.f,n=(t&x)!==0;if(_!==null&&!q){var i=w!==null&&(w.f&V)!==0;if(!i&&(P===null||!ce.call(P,e))){var r=_.deps;if((_.f&Ke)!==0)e.rv<le&&(e.rv=le,C===null&&r!==null&&r[N]===e?N++:C===null?C=[e]:C.push(e));else{(_.deps??=[]).push(e);var s=e.reactions;s===null?e.reactions=[_]:ce.call(s,_)||s.push(_)}}}if(ne&&te.has(e))return te.get(e);if(n){var o=e;if(ne){var l=o.v;return((o.f&E)===0&&o.reactions!==null||sn(o))&&(l=et(o)),te.set(o,l),l}var a=(o.f&I)===0&&!q&&_!==null&&(je||(_.f&I)!==0),f=(o.f&ve)===0;Oe(o)&&(a&&(o.f|=I),Mt(o)),a&&!f&&(Pt(o),rn(o))}if(z?.has(e))return z.get(e);if((e.f&Q)!==0)throw e.v;return e.v}function rn(e){if(e.f|=I,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&x)!==0&&(t.f&I)===0&&(Pt(t),rn(t))}function sn(e){if(e.v===S)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(te.has(t)||(t.f&x)!==0&&sn(t))return!0;return!1}function ot(e){var t=q;try{return q=!0,e()}finally{q=t}}const zr=["touchstart","touchmove"];function jr(e){return zr.includes(e)}const Ae=Symbol("events"),on=new Set,at=new Set;function an(e,t,n){(t[Ae]??={})[e]=n}function Wr(e){for(var t=0;t<e.length;t++)on.add(e[t]);for(var n of at)n(e)}let ln=null;function fn(e){var t=this,n=t.ownerDocument,i=e.type,r=e.composedPath?.()||[],s=r[0]||e.target;ln=e;var o=0,l=ln===e&&e[Ae];if(l){var a=r.indexOf(l);if(a!==-1&&(t===document||t===window)){e[Ae]=t;return}var f=r.indexOf(t);if(f===-1)return;a<=f&&(o=a)}if(s=r[o]||e.target,s!==t){Cn(e,"currentTarget",{configurable:!0,get(){return s||n}});var u=_,c=w;M(null),Y(null);try{for(var d,v=[];s!==null;){var h=s.assignedSlot||s.parentNode||s.host||null;try{var p=s[Ae]?.[i];p!=null&&(!s.disabled||e.target===s)&&p.call(s,e)}catch(m){d?v.push(m):d=m}if(e.cancelBubble||h===t||h===null)break;s=h}if(d){for(let m of v)queueMicrotask(()=>{throw m});throw d}}finally{e[Ae]=t,delete e.currentTarget,M(u),Y(c)}}}const Hr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function qr(e){return Hr?.createHTML(e)??e}function Br(e){var t=qt("template");return t.innerHTML=qr(e.replaceAll("<!>","<!---->")),t.content}function lt(e,t){var n=w;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function Re(e,t){var n=(t&Qn)!==0,i=(t&$n)!==0,r,s=!e.startsWith("<!>");return()=>{r===void 0&&(r=Br(s?e:"<!>"+e),n||(r=Fe(r)));var o=i||jt?document.importNode(r,!0):r.cloneNode(!0);if(n){var l=Fe(o),a=o.lastChild;lt(l,a)}else lt(o,o);return o}}function Gr(){var e=document.createDocumentFragment(),t=document.createComment(""),n=be();return e.append(t,n),lt(t,n),e}function Ee(e,t){e!==null&&e.before(t)}function Yr(e,t){return Vr(e,t)}const We=new Map;function Vr(e,{target:t,anchor:n,props:i={},events:r,context:s,intro:o=!0,transformError:l}){yr();var a=void 0,f=Ar(()=>{var u=n??t.appendChild(be());ur(u,{pending:()=>{}},v=>{De({});var h=A;s&&(h.c=s),r&&(i.$$events=r),a=e(v,i)||{},Ie()},l);var c=new Set,d=v=>{for(var h=0;h<v.length;h++){var p=v[h];if(!c.has(p)){c.add(p);var m=jr(p);for(const k of[t,document]){var D=We.get(k);D===void 0&&(D=new Map,We.set(k,D));var g=D.get(p);g===void 0?(k.addEventListener(p,fn,{passive:m}),D.set(p,1)):D.set(p,g+1)}}}};return d(On(on)),at.add(d),()=>{for(var v of c)for(const m of[t,document]){var h=We.get(m),p=h.get(v);--p==0?(m.removeEventListener(v,fn),h.delete(v),h.size===0&&We.delete(m)):h.set(v,p)}at.delete(d),u!==n&&u.parentNode?.removeChild(u)}});return Kr.set(a,f),a}let Kr=new WeakMap;class Xr{anchor;#e=new Map;#a=new Map;#t=new Map;#o=new Set;#n=!0;constructor(t,n=!0){this.anchor=t,this.#n=n}#s=t=>{if(this.#e.has(t)){var n=this.#e.get(t),i=this.#a.get(n);if(i)Mr(i),this.#o.delete(n);else{var r=this.#t.get(n);r&&(this.#a.set(n,r.effect),this.#t.delete(n),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),i=r.effect)}for(const[s,o]of this.#e){if(this.#e.delete(s),s===t)break;const l=this.#t.get(o);l&&(R(l.effect),this.#t.delete(o))}for(const[s,o]of this.#a){if(s===n||this.#o.has(s))continue;const l=()=>{if(Array.from(this.#e.values()).includes(s)){var f=document.createDocumentFragment();Zt(o,f),f.append(be()),this.#t.set(s,{effect:o,fragment:f})}else R(o);this.#o.delete(s),this.#a.delete(s)};this.#n||!i?(this.#o.add(s),Se(o,l,!1)):l()}}};#r=t=>{this.#e.delete(t);const n=Array.from(this.#e.values());for(const[i,r]of this.#t)n.includes(i)||(R(r.effect),this.#t.delete(i))};ensure(t,n){var i=y,r=xr();if(n&&!this.#a.has(t)&&!this.#t.has(t))if(r){var s=document.createDocumentFragment(),o=be();s.append(o),this.#t.set(t,{effect:Z(()=>n(o)),fragment:s})}else this.#a.set(t,Z(()=>n(this.anchor)));if(this.#e.set(i,t),r){for(const[l,a]of this.#a)l===t?i.unskip_effect(a):i.skip_effect(a);for(const[l,a]of this.#t)l===t?i.unskip_effect(a.effect):i.skip_effect(a.effect);i.oncommit(this.#s),i.ondiscard(this.#r)}else this.#s(i)}}function Zr(e,t,n=!1){var i=new Xr(e),r=n?_e:0;function s(o,l){i.ensure(o,l)}it(()=>{var o=!1;t((l,a=0)=>{o=!0,s(a,l)}),o||s(!1,null)},r)}function Jr(e,t){var n;n=document.head.appendChild(be()),it(()=>t(n),xt|ie)}function ft(e,t){Rr(()=>{var n=e.getRootNode(),i=n.host?n:n.head??n.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const r=qt("style");r.id=t.hash,r.textContent=t.code,i.appendChild(r)}})}const un=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function
|
|
1
|
+
(function(){"use strict";const Ye=!1;var Tn=Array.isArray,Sn=Array.prototype.indexOf,ce=Array.prototype.includes,On=Array.from,Cn=Object.defineProperty,de=Object.getOwnPropertyDescriptor,An=Object.getOwnPropertyDescriptors,Rn=Object.prototype,Nn=Array.prototype,bt=Object.getPrototypeOf,yt=Object.isExtensible;const Dn=()=>{};function In(e){for(var t=0;t<e.length;t++)e[t]()}function Et(){var e,t,n=new Promise((i,r)=>{e=i,t=r});return{promise:n,resolve:e,reject:t}}const k=2,he=4,ve=8,Ve=1<<24,J=16,B=32,re=64,Ke=128,I=512,x=1024,T=2048,z=4096,L=8192,V=16384,_e=32768,pe=65536,kt=1<<17,xt=1<<18,ie=1<<19,Ln=1<<20,se=65536,Xe=1<<21,Ze=1<<22,Q=1<<23,Ne=Symbol("$state"),Mn=Symbol("legacy props"),Pn=Symbol(""),oe=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function Fn(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Un(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function zn(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function jn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Wn(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Hn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function qn(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Bn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Gn(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Yn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Vn(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Kn=1,Xn=4,Zn=8,Jn=16,Qn=1,$n=2,S=Symbol(),Tt="http://www.w3.org/1999/xhtml";function er(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function St(e){return e===this.v}function tr(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function nr(e){return!tr(e,this.v)}let rr=!1,A=null;function ge(e){A=e}function De(e,t=!1,n){A={p:A,i:!1,c:null,e:null,s:e,x:null,l:null}}function Ie(e){var t=A,n=t.e;if(n!==null){t.e=null;for(var i of n)Gt(i)}return t.i=!0,A=t.p,{}}function Ot(){return!0}let we=[];function ir(){var e=we;we=[],In(e)}function me(e){if(we.length===0){var t=we;queueMicrotask(()=>{t===we&&ir()})}we.push(e)}function Ct(e){var t=w;if(t===null)return _.f|=Q,e;if((t.f&_e)===0&&(t.f&he)===0)throw e;$(e,t)}function $(e,t){for(;t!==null;){if((t.f&Ke)!==0){if((t.f&_e)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}const sr=-7169;function b(e,t){e.f=e.f&sr|t}function Je(e){(e.f&I)!==0||e.deps===null?b(e,x):b(e,z)}function At(e){if(e!==null)for(const t of e)(t.f&k)===0||(t.f&se)===0||(t.f^=se,At(t.deps))}function Rt(e,t,n){(e.f&T)!==0?t.add(e):(e.f&z)!==0&&n.add(e),At(e.deps),b(e,x)}const Le=new Set;let y=null,j=null,M=[],Qe=null,be=null,or=1;class ee{id=or++;current=new Map;previous=new Map;#e=new Set;#a=new Set;#t=0;#o=0;#n=null;#s=new Set;#r=new Set;#i=new Map;is_fork=!1;#l=!1;#u(){return this.is_fork||this.#o>0}skip_effect(t){this.#i.has(t)||this.#i.set(t,{d:[],m:[]})}unskip_effect(t){var n=this.#i.get(t);if(n){this.#i.delete(t);for(var i of n.d)b(i,T),G(i);for(i of n.m)b(i,z),G(i)}}process(t){M=[],this.apply();var n=be=[],i=[];for(const r of t)this.#f(r,n,i);if(be=null,this.#u()){this.#c(i),this.#c(n);for(const[r,s]of this.#i)Lt(r,s)}else{y=null;for(const r of this.#e)r(this);this.#e.clear(),this.#t===0&&this.#d(),Nt(i),Nt(n),this.#s.clear(),this.#r.clear(),this.#n?.resolve()}j=null}#f(t,n,i){t.f^=x;for(var r=t.first;r!==null;){var s=r.f,o=(s&(B|re))!==0,l=o&&(s&x)!==0,a=(s&L)!==0,f=l||this.#i.has(r);if(!f&&r.fn!==null){o?a||(r.f^=x):(s&he)!==0?n.push(r):(s&(ve|Ve))!==0&&a?i.push(r):Oe(r)&&(Ee(r),(s&J)!==0&&(this.#r.add(r),a&&b(r,T)));var c=r.first;if(c!==null){r=c;continue}}for(;r!==null;){var u=r.next;if(u!==null){r=u;break}r=r.parent}}}#c(t){for(var n=0;n<t.length;n+=1)Rt(t[n],this.#s,this.#r)}capture(t,n){n!==S&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&Q)===0&&(this.current.set(t,t.v),j?.set(t,t.v))}activate(){y=this,this.apply()}deactivate(){y===this&&(y=null,j=null)}flush(){if(M.length>0)y=this,ar();else if(this.#t===0&&!this.is_fork){for(const t of this.#e)t(this);this.#e.clear(),this.#d(),this.#n?.resolve()}this.deactivate()}discard(){for(const t of this.#a)t(this);this.#a.clear()}#d(){if(Le.size>1){this.previous.clear();var t=y,n=j,i=!0;for(const s of Le){if(s===this){i=!1;continue}const o=[];for(const[a,f]of this.current){if(s.current.has(a))if(i&&f!==s.current.get(a))s.current.set(a,f);else continue;o.push(a)}if(o.length===0)continue;const l=[...s.current.keys()].filter(a=>!this.current.has(a));if(l.length>0){var r=M;M=[];const a=new Set,f=new Map;for(const c of o)Dt(c,l,a,f);if(M.length>0){y=s,s.apply();for(const c of M)s.#f(c,[],[]);s.deactivate()}M=r}}y=t,j=n}this.#i.clear(),Le.delete(this)}increment(t){this.#t+=1,t&&(this.#o+=1)}decrement(t){this.#t-=1,t&&(this.#o-=1),!this.#l&&(this.#l=!0,me(()=>{this.#l=!1,this.#u()?M.length>0&&this.flush():this.revive()}))}revive(){for(const t of this.#s)this.#r.delete(t),b(t,T),G(t);for(const t of this.#r)b(t,z),G(t);this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#a.add(t)}settled(){return(this.#n??=Et()).promise}static ensure(){if(y===null){const t=y=new ee;Le.add(y),me(()=>{y===t&&t.flush()})}return y}apply(){}}function ar(){var e=null;try{for(var t=0;M.length>0;){var n=ee.ensure();if(t++>1e3){var i,r;lr()}n.process(M),te.clear()}}finally{M=[],Qe=null,be=null}}function lr(){try{Hn()}catch(e){$(e,Qe)}}let K=null;function Nt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var i=e[n++];if((i.f&(V|L))===0&&Oe(i)&&(K=new Set,Ee(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&Vt(i),K?.size>0)){te.clear();for(const r of K){if((r.f&(V|L))!==0)continue;const s=[r];let o=r.parent;for(;o!==null;)K.has(o)&&(K.delete(o),s.push(o)),o=o.parent;for(let l=s.length-1;l>=0;l--){const a=s[l];(a.f&(V|L))===0&&Ee(a)}}K.clear()}}K=null}}function Dt(e,t,n,i){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const r of e.reactions){const s=r.f;(s&k)!==0?Dt(r,t,n,i):(s&(Ze|J))!==0&&(s&T)===0&&It(r,t,i)&&(b(r,T),G(r))}}function It(e,t,n){const i=n.get(e);if(i!==void 0)return i;if(e.deps!==null)for(const r of e.deps){if(ce.call(t,r))return!0;if((r.f&k)!==0&&It(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function G(e){var t=Qe=e,n=t.b;if(n?.is_pending&&(e.f&(he|ve|Ve))!==0&&(e.f&_e)===0){n.defer_effect(e);return}for(;t.parent!==null;){t=t.parent;var i=t.f;if(be!==null&&t===w&&(e.f&ve)===0)return;if((i&(re|B))!==0){if((i&x)===0)return;t.f^=x}}M.push(t)}function Lt(e,t){if(!((e.f&B)!==0&&(e.f&x)!==0)){(e.f&T)!==0?t.d.push(e):(e.f&z)!==0&&t.m.push(e),b(e,x);for(var n=e.first;n!==null;)Lt(n,t),n=n.next}}function fr(e){let t=0,n=Me(0),i;return()=>{it()&&(O(n),Ir(()=>(t===0&&(i=at(()=>e(()=>Te(n)))),t+=1,()=>{me(()=>{t-=1,t===0&&(i?.(),i=void 0,Te(n))})})))}}var ur=pe|ie;function cr(e,t,n,i){new dr(e,t,n,i)}class dr{parent;is_pending=!1;transform_error;#e;#a=null;#t;#o;#n;#s=null;#r=null;#i=null;#l=null;#u=0;#f=0;#c=!1;#d=new Set;#v=new Set;#h=null;#m=fr(()=>(this.#h=Me(this.#u),()=>{this.#h=null}));constructor(t,n,i,r){this.#e=t,this.#t=n,this.#o=s=>{var o=w;o.b=this,o.f|=Ke,i(s)},this.parent=w.b,this.transform_error=r??this.parent?.transform_error??(s=>s),this.#n=st(()=>{this.#g()},ur)}#b(){try{this.#s=Z(()=>this.#o(this.#e))}catch(t){this.error(t)}}#y(t){const n=this.#t.failed;n&&(this.#i=Z(()=>{n(this.#e,()=>t,()=>()=>{})}))}#E(){const t=this.#t.pending;t&&(this.is_pending=!0,this.#r=Z(()=>t(this.#e)),me(()=>{var n=this.#l=document.createDocumentFragment(),i=ye();n.append(i),this.#s=this.#p(()=>(ee.ensure(),Z(()=>this.#o(i)))),this.#f===0&&(this.#e.before(n),this.#l=null,Se(this.#r,()=>{this.#r=null}),this.#_())}))}#g(){try{if(this.is_pending=this.has_pending_snippet(),this.#f=0,this.#u=0,this.#s=Z(()=>{this.#o(this.#e)}),this.#f>0){var t=this.#l=document.createDocumentFragment();Zt(this.#s,t);const n=this.#t.pending;this.#r=Z(()=>n(this.#e))}else this.#_()}catch(n){this.error(n)}}#_(){this.is_pending=!1;for(const t of this.#d)b(t,T),G(t);for(const t of this.#v)b(t,z),G(t);this.#d.clear(),this.#v.clear()}defer_effect(t){Rt(t,this.#d,this.#v)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#p(t){var n=w,i=_,r=A;Y(this.#n),P(this.#n),ge(this.#n.ctx);try{return t()}catch(s){return Ct(s),null}finally{Y(n),P(i),ge(r)}}#w(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#w(t);return}this.#f+=t,this.#f===0&&(this.#_(),this.#r&&Se(this.#r,()=>{this.#r=null}),this.#l&&(this.#e.before(this.#l),this.#l=null))}update_pending_count(t){this.#w(t),this.#u+=t,!(!this.#h||this.#c)&&(this.#c=!0,me(()=>{this.#c=!1,this.#h&&Pe(this.#h,this.#u)}))}get_effect_pending(){return this.#m(),O(this.#h)}error(t){var n=this.#t.onerror;let i=this.#t.failed;if(!n&&!i)throw t;this.#s&&(R(this.#s),this.#s=null),this.#r&&(R(this.#r),this.#r=null),this.#i&&(R(this.#i),this.#i=null);var r=!1,s=!1;const o=()=>{if(r){er();return}r=!0,s&&Vn(),this.#i!==null&&Se(this.#i,()=>{this.#i=null}),this.#p(()=>{ee.ensure(),this.#g()})},l=a=>{try{s=!0,n?.(a,o),s=!1}catch(f){$(f,this.#n&&this.#n.parent)}i&&(this.#i=this.#p(()=>{ee.ensure();try{return Z(()=>{var f=w;f.b=this,f.f|=Ke,i(this.#e,()=>a,()=>o)})}catch(f){return $(f,this.#n.parent),null}}))};me(()=>{var a;try{a=this.transform_error(t)}catch(f){$(f,this.#n&&this.#n.parent);return}a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(l,f=>$(f,this.#n&&this.#n.parent)):l(a)})}}function hr(e,t,n,i){const r=et;var s=e.filter(u=>!u.settled);if(n.length===0&&s.length===0){i(t.map(r));return}var o=w,l=vr(),a=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(u=>u.promise)):null;function f(u){l();try{i(u)}catch(d){(o.f&V)===0&&$(d,o)}$e()}if(n.length===0){a.then(()=>f(t.map(r)));return}function c(){l(),Promise.all(n.map(u=>pr(u))).then(u=>f([...t.map(r),...u])).catch(u=>$(u,o))}a?a.then(c):c()}function vr(){var e=w,t=_,n=A,i=y;return function(s=!0){Y(e),P(t),ge(n),s&&i?.activate()}}function $e(e=!0){Y(null),P(null),ge(null),e&&y?.deactivate()}function _r(){var e=w.b,t=y,n=e.is_rendered();return e.update_pending_count(1),t.increment(n),()=>{e.update_pending_count(-1),t.decrement(n)}}function et(e){var t=k|T,n=_!==null&&(_.f&k)!==0?_:null;return w!==null&&(w.f|=ie),{ctx:A,deps:null,effects:null,equals:St,f:t,fn:e,reactions:null,rv:0,v:S,wv:0,parent:n??w,ac:null}}function pr(e,t,n){w===null&&Un();var r=void 0,s=Me(S),o=!_,l=new Map;return Dr(()=>{var a=Et();r=a.promise;try{Promise.resolve(e()).then(a.resolve,a.reject).finally($e)}catch(d){a.reject(d),$e()}var f=y;if(o){var c=_r();l.get(f)?.reject(oe),l.delete(f),l.set(f,a)}const u=(d,v=void 0)=>{if(f.activate(),v)v!==oe&&(s.f|=Q,Pe(s,v));else{(s.f&Q)!==0&&(s.f^=Q),Pe(s,d);for(const[h,p]of l){if(l.delete(h),h===f)break;p.reject(oe)}}c&&c()};a.promise.then(u,d=>u(null,d||"unknown"))}),Cr(()=>{for(const a of l.values())a.reject(oe)}),new Promise(a=>{function f(c){function u(){c===r?a(s):f(r)}c.then(u,u)}f(r)})}function gr(e){const t=et(e);return t.equals=nr,t}function wr(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)R(t[n])}}function mr(e){for(var t=e.parent;t!==null;){if((t.f&k)===0)return(t.f&V)===0?t:null;t=t.parent}return null}function tt(e){var t,n=w;Y(mr(e));try{e.f&=~se,wr(e),t=nn(e)}finally{Y(n)}return t}function Mt(e){var t=tt(e);if(!e.equals(t)&&(e.wv=en(),(!y?.is_fork||e.deps===null)&&(e.v=t,e.deps===null))){b(e,x);return}ne||(j!==null?(it()||y?.is_fork)&&j.set(e,t):Je(e))}function br(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(oe),t.teardown=Dn,t.ac=null,Ce(t,0),ot(t))}function Pt(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&Ee(t)}let nt=new Set;const te=new Map;let Ft=!1;function Me(e,t){var n={f:0,v:e,reactions:null,equals:St,rv:0,wv:0};return n}function W(e,t){const n=Me(e);return Fr(n),n}function H(e,t,n=!1){_!==null&&(!q||(_.f&kt)!==0)&&Ot()&&(_.f&(k|J|Ze|kt))!==0&&(F===null||!ce.call(F,e))&&Yn();let i=n?ae(t):t;return Pe(e,i)}function Pe(e,t){if(!e.equals(t)){var n=e.v;ne?te.set(e,t):te.set(e,n),e.v=t;var i=ee.ensure();if(i.capture(e,n),(e.f&k)!==0){const r=e;(e.f&T)!==0&&tt(r),Je(r)}e.wv=en(),Ut(e,T),w!==null&&(w.f&x)!==0&&(w.f&(B|re))===0&&(U===null?Ur([e]):U.push(e)),!i.is_fork&&nt.size>0&&!Ft&&yr()}return t}function yr(){Ft=!1;for(const e of nt)(e.f&x)!==0&&b(e,z),Oe(e)&&Ee(e);nt.clear()}function Te(e){H(e,e.v+1)}function Ut(e,t){var n=e.reactions;if(n!==null)for(var i=n.length,r=0;r<i;r++){var s=n[r],o=s.f,l=(o&T)===0;if(l&&b(s,t),(o&k)!==0){var a=s;j?.delete(a),(o&se)===0&&(o&I&&(s.f|=se),Ut(a,z))}else l&&((o&J)!==0&&K!==null&&K.add(s),G(s))}}function ae(e){if(typeof e!="object"||e===null||Ne in e)return e;const t=bt(e);if(t!==Rn&&t!==Nn)return e;var n=new Map,i=Tn(e),r=W(0),s=fe,o=l=>{if(fe===s)return l();var a=_,f=fe;P(null),$t(s);var c=l();return P(a),$t(f),c};return i&&n.set("length",W(e.length)),new Proxy(e,{defineProperty(l,a,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&Bn();var c=n.get(a);return c===void 0?o(()=>{var u=W(f.value);return n.set(a,u),u}):H(c,f.value,!0),!0},deleteProperty(l,a){var f=n.get(a);if(f===void 0){if(a in l){const c=o(()=>W(S));n.set(a,c),Te(r)}}else H(f,S),Te(r);return!0},get(l,a,f){if(a===Ne)return e;var c=n.get(a),u=a in l;if(c===void 0&&(!u||de(l,a)?.writable)&&(c=o(()=>{var v=ae(u?l[a]:S),h=W(v);return h}),n.set(a,c)),c!==void 0){var d=O(c);return d===S?void 0:d}return Reflect.get(l,a,f)},getOwnPropertyDescriptor(l,a){var f=Reflect.getOwnPropertyDescriptor(l,a);if(f&&"value"in f){var c=n.get(a);c&&(f.value=O(c))}else if(f===void 0){var u=n.get(a),d=u?.v;if(u!==void 0&&d!==S)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return f},has(l,a){if(a===Ne)return!0;var f=n.get(a),c=f!==void 0&&f.v!==S||Reflect.has(l,a);if(f!==void 0||w!==null&&(!c||de(l,a)?.writable)){f===void 0&&(f=o(()=>{var d=c?ae(l[a]):S,v=W(d);return v}),n.set(a,f));var u=O(f);if(u===S)return!1}return c},set(l,a,f,c){var u=n.get(a),d=a in l;if(i&&a==="length")for(var v=f;v<u.v;v+=1){var h=n.get(v+"");h!==void 0?H(h,S):v in l&&(h=o(()=>W(S)),n.set(v+"",h))}if(u===void 0)(!d||de(l,a)?.writable)&&(u=o(()=>W(void 0)),H(u,ae(f)),n.set(a,u));else{d=u.v!==S;var p=o(()=>ae(f));H(u,p)}var m=Reflect.getOwnPropertyDescriptor(l,a);if(m?.set&&m.set.call(c,f),!d){if(i&&typeof a=="string"){var D=n.get("length"),g=Number(a);Number.isInteger(g)&&g>=D.v&&H(D,g+1)}Te(r)}return!0},ownKeys(l){O(r);var a=Reflect.ownKeys(l).filter(u=>{var d=n.get(u);return d===void 0||d.v!==S});for(var[f,c]of n)c.v!==S&&!(f in l)&&a.push(f);return a},setPrototypeOf(){Gn()}})}var zt,jt,Wt,Ht;function Er(){if(zt===void 0){zt=window,jt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Wt=de(t,"firstChild").get,Ht=de(t,"nextSibling").get,yt(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),yt(n)&&(n.__t=void 0)}}function ye(e=""){return document.createTextNode(e)}function Fe(e){return Wt.call(e)}function Ue(e){return Ht.call(e)}function rt(e,t){return Fe(e)}function kr(e,t=!1){{var n=Fe(e);return n instanceof Comment&&n.data===""?Ue(n):n}}function xr(e,t=1,n=!1){let i=e;for(;t--;)i=Ue(i);return i}function Tr(){return!1}function qt(e,t,n){return document.createElementNS(Tt,e,void 0)}function Bt(e){var t=_,n=w;P(null),Y(null);try{return e()}finally{P(t),Y(n)}}function Sr(e){w===null&&(_===null&&Wn(),jn()),ne&&zn()}function Or(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function X(e,t){var n=w;n!==null&&(n.f&L)!==0&&(e|=L);var i={ctx:A,deps:null,nodes:null,f:e|T|I,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null},r=i;if((e&he)!==0)be!==null?be.push(i):G(i);else if(t!==null){try{Ee(i)}catch(o){throw R(i),o}r.deps===null&&r.teardown===null&&r.nodes===null&&r.first===r.last&&(r.f&ie)===0&&(r=r.first,(e&J)!==0&&(e&pe)!==0&&r!==null&&(r.f|=pe))}if(r!==null&&(r.parent=n,n!==null&&Or(r,n),_!==null&&(_.f&k)!==0&&(e&re)===0)){var s=_;(s.effects??=[]).push(r)}return i}function it(){return _!==null&&!q}function Cr(e){const t=X(ve,null);return b(t,x),t.teardown=e,t}function Ar(e){Sr();var t=w.f,n=!_&&(t&B)!==0&&(t&_e)===0;if(n){var i=A;(i.e??=[]).push(e)}else return Gt(e)}function Gt(e){return X(he|Ln,e)}function Rr(e){ee.ensure();const t=X(re|ie,e);return(n={})=>new Promise(i=>{n.outro?Se(t,()=>{R(t),i(void 0)}):(R(t),i(void 0))})}function Nr(e){return X(he,e)}function Dr(e){return X(Ze|ie,e)}function Ir(e,t=0){return X(ve|t,e)}function ze(e,t=[],n=[],i=[]){hr(i,t,n,r=>{X(ve,()=>e(...r.map(O)))})}function st(e,t=0){var n=X(J|t,e);return n}function Z(e){return X(B|ie,e)}function Yt(e){var t=e.teardown;if(t!==null){const n=ne,i=_;Jt(!0),P(null);try{t.call(null)}finally{Jt(n),P(i)}}}function ot(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const r=n.ac;r!==null&&Bt(()=>{r.abort(oe)});var i=n.next;(n.f&re)!==0?n.parent=null:R(n,t),n=i}}function Lr(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&B)===0&&R(t),t=n}}function R(e,t=!0){var n=!1;(t||(e.f&xt)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Mr(e.nodes.start,e.nodes.end),n=!0),ot(e,t&&!n),Ce(e,0),b(e,V);var i=e.nodes&&e.nodes.t;if(i!==null)for(const s of i)s.stop();Yt(e);var r=e.parent;r!==null&&r.first!==null&&Vt(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function Mr(e,t){for(;e!==null;){var n=e===t?null:Ue(e);e.remove(),e=n}}function Vt(e){var t=e.parent,n=e.prev,i=e.next;n!==null&&(n.next=i),i!==null&&(i.prev=n),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=n))}function Se(e,t,n=!0){var i=[];Kt(e,i,!0);var r=()=>{n&&R(e),t&&t()},s=i.length;if(s>0){var o=()=>--s||r();for(var l of i)l.out(o)}else r()}function Kt(e,t,n){if((e.f&L)===0){e.f^=L;var i=e.nodes&&e.nodes.t;if(i!==null)for(const l of i)(l.is_global||n)&&t.push(l);for(var r=e.first;r!==null;){var s=r.next,o=(r.f&pe)!==0||(r.f&B)!==0&&(e.f&J)!==0;Kt(r,t,o?n:!1),r=s}}}function Pr(e){Xt(e,!0)}function Xt(e,t){if((e.f&L)!==0){e.f^=L;for(var n=e.first;n!==null;){var i=n.next,r=(n.f&pe)!==0||(n.f&B)!==0;Xt(n,r?t:!1),n=i}var s=e.nodes&&e.nodes.t;if(s!==null)for(const o of s)(o.is_global||t)&&o.in()}}function Zt(e,t){if(e.nodes)for(var n=e.nodes.start,i=e.nodes.end;n!==null;){var r=n===i?null:Ue(n);t.append(n),n=r}}let je=!1,ne=!1;function Jt(e){ne=e}let _=null,q=!1;function P(e){_=e}let w=null;function Y(e){w=e}let F=null;function Fr(e){_!==null&&(F===null?F=[e]:F.push(e))}let C=null,N=0,U=null;function Ur(e){U=e}let Qt=1,le=0,fe=le;function $t(e){fe=e}function en(){return++Qt}function Oe(e){var t=e.f;if((t&T)!==0)return!0;if(t&k&&(e.f&=~se),(t&z)!==0){for(var n=e.deps,i=n.length,r=0;r<i;r++){var s=n[r];if(Oe(s)&&Mt(s),s.wv>e.wv)return!0}(t&I)!==0&&j===null&&b(e,x)}return!1}function tn(e,t,n=!0){var i=e.reactions;if(i!==null&&!(F!==null&&ce.call(F,e)))for(var r=0;r<i.length;r++){var s=i[r];(s.f&k)!==0?tn(s,t,!1):t===s&&(n?b(s,T):(s.f&x)!==0&&b(s,z),G(s))}}function nn(e){var t=C,n=N,i=U,r=_,s=F,o=A,l=q,a=fe,f=e.f;C=null,N=0,U=null,_=(f&(B|re))===0?e:null,F=null,ge(e.ctx),q=!1,fe=++le,e.ac!==null&&(Bt(()=>{e.ac.abort(oe)}),e.ac=null);try{e.f|=Xe;var c=e.fn,u=c();e.f|=_e;var d=e.deps,v=y?.is_fork;if(C!==null){var h;if(v||Ce(e,N),d!==null&&N>0)for(d.length=N+C.length,h=0;h<C.length;h++)d[N+h]=C[h];else e.deps=d=C;if(it()&&(e.f&I)!==0)for(h=N;h<d.length;h++)(d[h].reactions??=[]).push(e)}else!v&&d!==null&&N<d.length&&(Ce(e,N),d.length=N);if(Ot()&&U!==null&&!q&&d!==null&&(e.f&(k|z|T))===0)for(h=0;h<U.length;h++)tn(U[h],e);if(r!==null&&r!==e){if(le++,r.deps!==null)for(let p=0;p<n;p+=1)r.deps[p].rv=le;if(t!==null)for(const p of t)p.rv=le;U!==null&&(i===null?i=U:i.push(...U))}return(e.f&Q)!==0&&(e.f^=Q),u}catch(p){return Ct(p)}finally{e.f^=Xe,C=t,N=n,U=i,_=r,F=s,ge(o),q=l,fe=a}}function zr(e,t){let n=t.reactions;if(n!==null){var i=Sn.call(n,e);if(i!==-1){var r=n.length-1;r===0?n=t.reactions=null:(n[i]=n[r],n.pop())}}if(n===null&&(t.f&k)!==0&&(C===null||!ce.call(C,t))){var s=t;(s.f&I)!==0&&(s.f^=I,s.f&=~se),Je(s),br(s),Ce(s,0)}}function Ce(e,t){var n=e.deps;if(n!==null)for(var i=t;i<n.length;i++)zr(e,n[i])}function Ee(e){var t=e.f;if((t&V)===0){b(e,x);var n=w,i=je;w=e,je=!0;try{(t&(J|Ve))!==0?Lr(e):ot(e),Yt(e);var r=nn(e);e.teardown=typeof r=="function"?r:null,e.wv=Qt;var s;Ye&&rr&&(e.f&T)!==0&&e.deps}finally{je=i,w=n}}}function O(e){var t=e.f,n=(t&k)!==0;if(_!==null&&!q){var i=w!==null&&(w.f&V)!==0;if(!i&&(F===null||!ce.call(F,e))){var r=_.deps;if((_.f&Xe)!==0)e.rv<le&&(e.rv=le,C===null&&r!==null&&r[N]===e?N++:C===null?C=[e]:C.push(e));else{(_.deps??=[]).push(e);var s=e.reactions;s===null?e.reactions=[_]:ce.call(s,_)||s.push(_)}}}if(ne&&te.has(e))return te.get(e);if(n){var o=e;if(ne){var l=o.v;return((o.f&x)===0&&o.reactions!==null||sn(o))&&(l=tt(o)),te.set(o,l),l}var a=(o.f&I)===0&&!q&&_!==null&&(je||(_.f&I)!==0),f=(o.f&_e)===0;Oe(o)&&(a&&(o.f|=I),Mt(o)),a&&!f&&(Pt(o),rn(o))}if(j?.has(e))return j.get(e);if((e.f&Q)!==0)throw e.v;return e.v}function rn(e){if(e.f|=I,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&k)!==0&&(t.f&I)===0&&(Pt(t),rn(t))}function sn(e){if(e.v===S)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(te.has(t)||(t.f&k)!==0&&sn(t))return!0;return!1}function at(e){var t=q;try{return q=!0,e()}finally{q=t}}const jr=["touchstart","touchmove"];function Wr(e){return jr.includes(e)}const Ae=Symbol("events"),on=new Set,lt=new Set;function an(e,t,n){(t[Ae]??={})[e]=n}function Hr(e){for(var t=0;t<e.length;t++)on.add(e[t]);for(var n of lt)n(e)}let ln=null;function fn(e){var t=this,n=t.ownerDocument,i=e.type,r=e.composedPath?.()||[],s=r[0]||e.target;ln=e;var o=0,l=ln===e&&e[Ae];if(l){var a=r.indexOf(l);if(a!==-1&&(t===document||t===window)){e[Ae]=t;return}var f=r.indexOf(t);if(f===-1)return;a<=f&&(o=a)}if(s=r[o]||e.target,s!==t){Cn(e,"currentTarget",{configurable:!0,get(){return s||n}});var c=_,u=w;P(null),Y(null);try{for(var d,v=[];s!==null;){var h=s.assignedSlot||s.parentNode||s.host||null;try{var p=s[Ae]?.[i];p!=null&&(!s.disabled||e.target===s)&&p.call(s,e)}catch(m){d?v.push(m):d=m}if(e.cancelBubble||h===t||h===null)break;s=h}if(d){for(let m of v)queueMicrotask(()=>{throw m});throw d}}finally{e[Ae]=t,delete e.currentTarget,P(c),Y(u)}}}const qr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Br(e){return qr?.createHTML(e)??e}function Gr(e){var t=qt("template");return t.innerHTML=Br(e.replaceAll("<!>","<!---->")),t.content}function ft(e,t){var n=w;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function Re(e,t){var n=(t&Qn)!==0,i=(t&$n)!==0,r,s=!e.startsWith("<!>");return()=>{r===void 0&&(r=Gr(s?e:"<!>"+e),n||(r=Fe(r)));var o=i||jt?document.importNode(r,!0):r.cloneNode(!0);if(n){var l=Fe(o),a=o.lastChild;ft(l,a)}else ft(o,o);return o}}function Yr(){var e=document.createDocumentFragment(),t=document.createComment(""),n=ye();return e.append(t,n),ft(t,n),e}function ke(e,t){e!==null&&e.before(t)}function Vr(e,t){return Kr(e,t)}const We=new Map;function Kr(e,{target:t,anchor:n,props:i={},events:r,context:s,intro:o=!0,transformError:l}){Er();var a=void 0,f=Rr(()=>{var c=n??t.appendChild(ye());cr(c,{pending:()=>{}},v=>{De({});var h=A;s&&(h.c=s),r&&(i.$$events=r),a=e(v,i)||{},Ie()},l);var u=new Set,d=v=>{for(var h=0;h<v.length;h++){var p=v[h];if(!u.has(p)){u.add(p);var m=Wr(p);for(const E of[t,document]){var D=We.get(E);D===void 0&&(D=new Map,We.set(E,D));var g=D.get(p);g===void 0?(E.addEventListener(p,fn,{passive:m}),D.set(p,1)):D.set(p,g+1)}}}};return d(On(on)),lt.add(d),()=>{for(var v of u)for(const m of[t,document]){var h=We.get(m),p=h.get(v);--p==0?(m.removeEventListener(v,fn),h.delete(v),h.size===0&&We.delete(m)):h.set(v,p)}lt.delete(d),c!==n&&c.parentNode?.removeChild(c)}});return Xr.set(a,f),a}let Xr=new WeakMap;class Zr{anchor;#e=new Map;#a=new Map;#t=new Map;#o=new Set;#n=!0;constructor(t,n=!0){this.anchor=t,this.#n=n}#s=t=>{if(this.#e.has(t)){var n=this.#e.get(t),i=this.#a.get(n);if(i)Pr(i),this.#o.delete(n);else{var r=this.#t.get(n);r&&(r.effect.f&L)===0&&(this.#a.set(n,r.effect),this.#t.delete(n),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),i=r.effect)}for(const[s,o]of this.#e){if(this.#e.delete(s),s===t)break;const l=this.#t.get(o);l&&(R(l.effect),this.#t.delete(o))}for(const[s,o]of this.#a){if(s===n||this.#o.has(s)||(o.f&L)!==0)continue;const l=()=>{if(Array.from(this.#e.values()).includes(s)){var f=document.createDocumentFragment();Zt(o,f),f.append(ye()),this.#t.set(s,{effect:o,fragment:f})}else R(o);this.#o.delete(s),this.#a.delete(s)};this.#n||!i?(this.#o.add(s),Se(o,l,!1)):l()}}};#r=t=>{this.#e.delete(t);const n=Array.from(this.#e.values());for(const[i,r]of this.#t)n.includes(i)||(R(r.effect),this.#t.delete(i))};ensure(t,n){var i=y,r=Tr();if(n&&!this.#a.has(t)&&!this.#t.has(t))if(r){var s=document.createDocumentFragment(),o=ye();s.append(o),this.#t.set(t,{effect:Z(()=>n(o)),fragment:s})}else this.#a.set(t,Z(()=>n(this.anchor)));if(this.#e.set(i,t),r){for(const[l,a]of this.#a)l===t?i.unskip_effect(a):i.skip_effect(a);for(const[l,a]of this.#t)l===t?i.unskip_effect(a.effect):i.skip_effect(a.effect);i.oncommit(this.#s),i.ondiscard(this.#r)}else this.#s(i)}}function Jr(e,t,n=!1){var i=new Zr(e),r=n?pe:0;function s(o,l){i.ensure(o,l)}st(()=>{var o=!1;t((l,a=0)=>{o=!0,s(a,l)}),o||s(-1,null)},r)}function Qr(e,t){var n;n=document.head.appendChild(ye()),st(()=>t(n),xt|ie)}function ut(e,t){Nr(()=>{var n=e.getRootNode(),i=n.host?n:n.head??n.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const r=qt("style");r.id=t.hash,r.textContent=t.code,i.appendChild(r)}})}const un=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function $r(e,t,n){var i=e==null?"":""+e;if(t&&(i=i?i+" "+t:t),n){for(var r of Object.keys(n))if(n[r])i=i?i+" "+r:r;else if(i.length)for(var s=r.length,o=0;(o=i.indexOf(r,o))>=0;){var l=o+s;(o===0||un.includes(i[o-1]))&&(l===i.length||un.includes(i[l]))?i=(o===0?"":i.substring(0,o))+i.substring(l+1):o=l}}return i===""?null:i}function cn(e,t,n,i,r,s){var o=e.__className;if(o!==n||o===void 0){var l=$r(n,i,s);l==null?e.removeAttribute("class"):e.className=l,e.__className=n}else if(s&&r!==s)for(var a in s){var f=!!s[a];(r==null||f!==!!r[a])&&e.classList.toggle(a,f)}return s}const ei=Symbol("is custom element"),ti=Symbol("is html");function xe(e,t,n,i){var r=ni(e);r[t]!==(r[t]=n)&&(t==="loading"&&(e[Pn]=n),n==null?e.removeAttribute(t):typeof n!="string"&&ri(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function ni(e){return e.__attributes??={[ei]:e.nodeName.includes("-"),[ti]:e.namespaceURI===Tt}}var dn=new Map;function ri(e){var t=e.getAttribute("is")||e.nodeName,n=dn.get(t);if(n)return n;dn.set(t,n=[]);for(var i,r=e,s=Element.prototype;s!==r;){i=An(r);for(var o in i)i[o].set&&n.push(o);r=bt(r)}return n}let He=!1;function ii(e){var t=He;try{return He=!1,[e(),He]}finally{He=t}}function ct(e,t,n,i){var r=(n&Zn)!==0,s=(n&Jn)!==0,o=i,l=!0,a=()=>(l&&(l=!1,o=s?at(i):i),o),f;if(r){var c=Ne in e||Mn in e;f=de(e,t)?.set??(c&&t in e?g=>e[t]=g:void 0)}var u,d=!1;r?[u,d]=ii(()=>e[t]):u=e[t],u===void 0&&i!==void 0&&(u=a(),f&&(qn(),f(u)));var v;if(v=()=>{var g=e[t];return g===void 0?a():(l=!0,g)},(n&Xn)===0)return v;if(f){var h=e.$$legacy;return(function(g,E){return arguments.length>0?((!E||h||d)&&f(E?v():g),g):v()})}var p=!1,m=((n&Kn)!==0?et:gr)(()=>(p=!1,v()));r&&O(m);var D=w;return(function(g,E){if(arguments.length>0){const ue=E?O(m):r?ae(g):g;return H(m,ue),p=!0,o!==void 0&&(o=ue),g}return ne&&p||(D.f&V)!==0?m.v:O(m)})}function hn(e){A===null&&Fn(),Ar(()=>{const t=at(e);if(typeof t=="function")return t})}const si="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(si);var oi=Re('<div><iframe id="chat-frame" title="Chat" class="bot svelte-yhk8rr" frameborder="0" allow="microphone; clipboard-write" allowfullscreen=""></iframe></div>'),ai=Re(`<p class="svelte-yhk8rr">Please make sure that the script tag has 'id="chatbot"' and the attribute
|
|
3
3
|
'data-server' with the full qualified URL to the chatbot-server.</p> <pre class="svelte-yhk8rr">
|
|
4
4
|
<code class="svelte-yhk8rr">
|
|
5
5
|
<script
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<br class="svelte-yhk8rr"/>
|
|
13
13
|
src="https://server.com/webclient/embed/bundle.js"> </script>
|
|
14
14
|
</code>
|
|
15
|
-
</pre>`,1);const
|
|
15
|
+
</pre>`,1);const li={hash:"svelte-yhk8rr",code:`.svelte-yhk8rr,
|
|
16
16
|
.svelte-yhk8rr:before,
|
|
17
17
|
.svelte-yhk8rr:after {box-sizing:border-box;}.bot-border.svelte-yhk8rr {position:fixed;display:flex;flex-direction:column;top:0;bottom:env(safe-area-inset-bottom);height:100%;max-height:100vh;width:100%;border-width:0;border-radius:var(--window-border-radius, 8px);box-shadow:rgba(0, 0, 0, 0.24) 0px 16px 40px;background:transparent;opacity:1;transition:transform 200ms,
|
|
18
18
|
opacity 100ms 100ms,
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
@media screen and (min-width: 768px) {#chat-frame.svelte-yhk8rr {border-radius:var(--window-border-radius, 8px);}.bot-border.svelte-yhk8rr {height:var(--window-height, 46em);max-height:var(--window-max-height, calc(100vh - 2em));width:var(--window-width, 26em);top:var(--window-top, auto);right:var(--window-right, 1em);bottom:var(--window-bottom, 1em);left:var(--window-left, auto);border-radius:var(--window-border-radius, 8px);}.bot-border.closed.svelte-yhk8rr {transform:translateY(var(--window-height, 46em));opacity:0;}
|
|
22
22
|
}p.svelte-yhk8rr,
|
|
23
|
-
pre.svelte-yhk8rr {max-width:300px;}pre.svelte-yhk8rr {font-size:0.6em;line-height:0.5;}`};function
|
|
23
|
+
pre.svelte-yhk8rr {max-width:300px;}pre.svelte-yhk8rr {font-size:0.6em;line-height:0.5;}`};function fi(e,t){De(t,!0),ut(e,li),hn(()=>{document.getElementById("chat-frame")?.addEventListener("load",t.onLoad)});var n=Yr(),i=kr(n);{var r=o=>{var l=oi();let a;var f=rt(l);ze(c=>{a=cn(l,1,"bot-border svelte-yhk8rr",null,a,{closed:!t.open}),xe(l,"aria-hidden",t.open?"false":"true"),xe(f,"src",c)},[()=>`${t.server}${t.server.indexOf("?")===-1?"?":"&"}referrer=${encodeURIComponent(t.referrer??"")}`]),ke(o,l)},s=o=>{var l=ai();ke(o,l)};Jr(i,o=>{t.server?o(r):o(s,-1)})}ke(e,n),Ie()}var ui=Re('<div class="chat-button-wrapper svelte-1xi58vz" tabindex="0" role="button" aria-label="Open chat window"><img class="chat-button svelte-1xi58vz" alt="Open chat window"/></div>');const ci={hash:"svelte-1xi58vz",code:`.svelte-1xi58vz,
|
|
24
24
|
.svelte-1xi58vz:before,
|
|
25
25
|
.svelte-1xi58vz:after {box-sizing:border-box;}.chat-button-wrapper.svelte-1xi58vz {position:fixed;top:var(--fab-top-mobile, var(--fab-top, auto));right:var(--fab-right-mobile, var(--fab-right, 1.5em));bottom:var(--fab-bottom-mobile, var(--fab-bottom, 1.5em));left:var(--fab-left-mobile, var(--fab-left, auto));width:var(--fab-size-mobile, var(--fab-size, 5em));height:var(--fab-size-mobile, var(--fab-size, 5em));z-index:999;}
|
|
26
26
|
|
|
27
27
|
@media screen and (min-width: 768px) {.chat-button-wrapper.svelte-1xi58vz {top:var(--fab-top, auto);right:var(--fab-right, 1.5em);bottom:var(--fab-bottom, 1.5em);left:var(--fab-left, auto);width:var(--fab-size, 6em);height:var(--fab-size, 6em);}
|
|
28
28
|
}.chat-button.svelte-1xi58vz {display:block;height:100%;cursor:pointer;border-radius:50%;box-shadow:9px 9px 16px rgba(0, 0, 0, 0.25);transition:transform 100ms,
|
|
29
|
-
box-shadow 100ms;}.chat-button.svelte-1xi58vz:hover {box-shadow:16px 16px 16px rgba(0, 0, 0, 0.2);transform:translateY(-2px);}`};function
|
|
29
|
+
box-shadow 100ms;}.chat-button.svelte-1xi58vz:hover {box-shadow:16px 16px 16px rgba(0, 0, 0, 0.2);transform:translateY(-2px);}`};function di(e,t){De(t,!0),ut(e,ci);function n(s){const o=s.key;(o==="ArrowDown"||o==="ArrowRight"||o==="Enter"||o===" "||o==="Space")&&(s.stopPropagation(),t.onToggle())}var i=ui(),r=rt(i);ze(()=>{xe(i,"aria-expanded",t.open?"true":"false"),xe(r,"src",`${t.assetsUrl}/fab.svg`)}),an("click",i,function(...s){t.onToggle?.apply(this,s)}),an("keydown",i,n),ke(e,i),Ie()}Hr(["click","keydown"]);let vn=!1;function hi(e){vn=e}function vi(){return vn}function qe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}var _i={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function dt(e,t){function n(r,s,o){if(!(typeof document>"u")){o=qe({},t,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var a in o)o[a]&&(l+="; "+a,o[a]!==!0&&(l+="="+o[a].split(";")[0]));return document.cookie=r+"="+e.write(s,r)+l}}function i(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var s=document.cookie?document.cookie.split("; "):[],o={},l=0;l<s.length;l++){var a=s[l].split("="),f=a.slice(1).join("=");try{var c=decodeURIComponent(a[0]);if(o[c]=e.read(f,c),r===c)break}catch{}}return r?o[r]:o}}return Object.create({set:n,get:i,remove:function(r,s){n(r,"",qe({},s,{expires:-1}))},withAttributes:function(r){return dt(this.converter,qe({},this.attributes,r))},withConverter:function(r){return dt(qe({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var _n=dt(_i,{path:"/"});const pn="bubble-chat-window-state",gn=()=>{switch(_n.get(pn)){case"open":return!0;case"closed":return!1;default:return}},wn=e=>{const t=new Date(new Date().getTime()+288e5);_n.set(pn,e,{expires:t})},ht=[];let vt=gn();function _t(){vt=!0,wn("open"),ht.forEach(function(e){e.call(window,!0)})}function Be(){vt=!1,wn("closed"),ht.forEach(function(e){e.call(window,!1)})}function mn(){vt?Be():_t()}function pi(){pt({type:"RESTART_CHAT"})}function gi(e){pt({type:"CHAT_MESSAGE_FROM_GUEST",text:e})}function wi(e){pt({type:"TRIGGER_STORY",story:e})}function bn(){return document.getElementById("chat-frame")}function mi(){const e=bn();if(e?.src)try{return new URL(e.src).origin}catch{return null}return null}function pt(e){const t=bn(),n=mi();if(!n){console.warn("Cannot send message: chat iframe origin could not be determined");return}t?.contentWindow?.postMessage(e,n)}function yn(e,t){if(e==="ON_CHAT_WINDOW_STATE_CHANGE")ht.push(t);else throw new Error("Unsupported event "+e)}const bi=Object.freeze(Object.defineProperty({__proto__:null,closeChatWindow:Be,enterGuestMessage:gi,isChatbotLoaded:vi,openChatWindow:_t,restartChat:pi,subscribe:yn,toggleChatWindow:mn,triggerStory:wi},Symbol.toStringTag,{value:"Module"})),yi=e=>{if(!e||typeof e!="object"||Array.isArray(e)){console.warn("Invalid tracking payload received:",e);return}"gtag"in window&&typeof window.gtag=="function"?window.gtag("event","",e):"dataLayer"in window&&Array.isArray(window.dataLayer)&&window.dataLayer.push(e)},Ei=(e,t,n,i,r)=>{const s=()=>{const f=document.getElementById("chat-frame");if(f?.src)try{return new URL(f.src).origin}catch{return null}return null},o={CHAT_STARTED:"webclient.chat.started",CHAT_ENDED:"webclient.chat.ended",WINDOW_EXPAND:"webclient.window.expand",WINDOW_CLOSE:"webclient.window.close",CHANGE_URL:"webclient.change.url",GOOGLE_TAG_EVENT:"google.tag.event"},l=Object.values(o),a=f=>{if(!f.data?.type||!l.includes(f.data.type))return;const c=s();if(c&&f.origin!==c){console.warn("Rejected postMessage from untrusted origin:",f.origin);return}const u=f.data;switch(u.type){case o.CHAT_STARTED:e();break;case o.CHAT_ENDED:t();break;case o.WINDOW_EXPAND:n(u.devices,u.initial);break;case o.WINDOW_CLOSE:i();break;case o.CHANGE_URL:r(u.url);break;case o.GOOGLE_TAG_EVENT:yi(u.payload);break}};window.addEventListener("message",a,!1)},ki=e=>new Promise(t=>{const n=document.getElementById(e);n?(n.onload=()=>{t(!0)},n.onerror=()=>{console.error("Failed to load CSS file: custom.css"),t(!1)}):(console.error("No custom.css file found"),t(!1))});var xi=Re('<link rel="stylesheet"/>'),Ti=Re("<div><!> <!></div>");const Si={hash:"svelte-1n46o8q",code:".bubble-chat.svelte-1n46o8q {font-size:16px;visibility:hidden;opacity:0;}.bubble-chat.chatbot-ready.svelte-1n46o8q {visibility:visible;opacity:1;}"};function Oi(e,t){De(t,!0),ut(e,Si);let n=ct(t,"assetsUrl",19,()=>t.server?t.server.split("?")[0]:void 0),i=ct(t,"linkHandling",3,"default"),r=ct(t,"chatStarted",7,!1);const s="chatbot-style";let o=W(!1),l=W(!1),a=W(ae(gn()));yn("ON_CHAT_WINDOW_STATE_CHANGE",function(E){H(a,E,!0)});function f(){r(!0)}function c(){r(!1)}function u(g,E){const ue=window.innerWidth,wt=g==null||g==="all",mt=g==="desktop"&&ue>=768,Di=g==="mobile"&&ue<768,Ii=wt||mt||Di;(!E||O(a)!==!1)&&Ii&&_t()}function d(){Be()}function v(g){const E=window.innerWidth,ue=window.location.hostname,wt=new URL(g).hostname,mt=ue===wt;E<768&&Be(),i()==="new-tab"?window.open(g,"_blank"):i()==="existing-tab"||mt?document.location.href=g:window.open(g,"_blank")}function h(){H(l,!0)}Ei(f,c,u,d,v),hn(async()=>{H(o,await ki(s),!0)});var p=Ti();Qr("1n46o8q",g=>{var E=xi();xe(E,"id",s),ze(()=>xe(E,"href",`${n()}/custom.css`)),ke(g,E)});var m=rt(p);di(m,{get assetsUrl(){return n()},get open(){return O(a)},get onToggle(){return mn}});var D=xr(m,2);fi(D,{get server(){return t.server},get referrer(){return t.referrer},get open(){return O(a)},onLoad:h}),ze(()=>cn(p,1,`bubble-chat ${O(o)&&O(l)?"chatbot-ready":""}`,"svelte-1n46o8q")),ke(e,p),Ie()}const Ci=e=>e.replace(/\/embed\/bundle\.js/,""),Ai=e=>e.dataset?.server,Ri=e=>{if(e&&"src"in e&&typeof e.src=="string")return Ai(e)||Ci(e.src)},gt=document.querySelector("script#chatbot"),En=Ri(gt),Ni=gt?.getAttribute("link-handling")?gt.getAttribute("link-handling"):"default";window.chatbot=bi;const kn=()=>{console.log("Chatbot is loading from",En),Vr(Oi,{target:document.body,props:{server:En,referrer:window.location.href,linkHandling:Ni}}),hi(!0)},xn=(e=0)=>{e>=3||document.readyState==="complete"?setTimeout(kn,500):setTimeout(()=>{xn(e+1)},500)};xn();const Ge=document.getElementById("chatbot");Ge&&"src"in Ge&&typeof Ge.src=="string"&&Ge.src.indexOf("caller=bookmarklet")>0&&setTimeout(kn,500)})();
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Actions, ActionTypes, BotUser, TextMessage, } from '@botfabrik/engine-domain';
|
|
2
2
|
import { getPdf } from '@botfabrik/engine-transcript-export';
|
|
3
|
-
import
|
|
3
|
+
import cors from 'cors';
|
|
4
|
+
import { Router, static as serveStatic, } from 'express';
|
|
5
|
+
import helmet from 'helmet';
|
|
4
6
|
import { dirname } from 'node:path';
|
|
5
7
|
import { fileURLToPath } from 'node:url';
|
|
6
8
|
import { setUpSamlAuth, storeLoginRequestToken, verifyLoginToken, } from './auth/index.js';
|
|
@@ -21,8 +23,95 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
21
23
|
const __dirname = dirname(__filename);
|
|
22
24
|
export default (clientName, environment, props) => async (bot) => {
|
|
23
25
|
const logger = bot.logger.child({ clientType: CLIENT_TYPE, clientName });
|
|
26
|
+
const router = Router();
|
|
27
|
+
// Security: CORS
|
|
28
|
+
// When allowedOrigins is undefined, all origins are permitted (backward-compatible default).
|
|
29
|
+
// When it is set (even to an empty array), only the listed origins are allowed.
|
|
30
|
+
const allowedOrigins = props.allowedOrigins;
|
|
31
|
+
// When trustedResourceOrigins is undefined, the webclient may load resources from all origins.
|
|
32
|
+
// When it is set, only those origins are trusted as resource sources (font-src, img-src, …).
|
|
33
|
+
const trustedResourceOrigins = props.trustedResourceOrigins;
|
|
34
|
+
router.use(cors({
|
|
35
|
+
// Access-Control-Allow-Origin
|
|
36
|
+
origin: allowedOrigins === undefined
|
|
37
|
+
? true // all origins allowed
|
|
38
|
+
: (origin, callback) => {
|
|
39
|
+
if (!origin || allowedOrigins.includes(origin)) {
|
|
40
|
+
callback(null, true);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
callback(new Error(`CORS: Origin '${origin}' is not allowed`));
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
// Access-Control-Allow-Methods
|
|
47
|
+
methods: ['GET', 'POST', 'OPTIONS'],
|
|
48
|
+
// Access-Control-Allow-Headers
|
|
49
|
+
allowedHeaders: ['Content-Type', 'Authorization'],
|
|
50
|
+
credentials: true,
|
|
51
|
+
}));
|
|
52
|
+
// Security: Helmet (CSP + security headers)
|
|
53
|
+
router.use(helmet({
|
|
54
|
+
contentSecurityPolicy: {
|
|
55
|
+
directives: {
|
|
56
|
+
defaultSrc: ["'self'"],
|
|
57
|
+
scriptSrc: ["'self'"],
|
|
58
|
+
styleSrc: ["'self'", "'unsafe-inline'"],
|
|
59
|
+
// images: restrict to trusted resource origins when defined, otherwise allow all HTTPS
|
|
60
|
+
imgSrc: trustedResourceOrigins === undefined
|
|
61
|
+
? ["'self'", 'data:', 'https:']
|
|
62
|
+
: ["'self'", 'data:', ...trustedResourceOrigins],
|
|
63
|
+
connectSrc: [
|
|
64
|
+
"'self'",
|
|
65
|
+
// allow websocket connections back to the same server
|
|
66
|
+
bot.webserver.baseUrl.replace(/^http/, 'ws'),
|
|
67
|
+
bot.webserver.baseUrl.replace(/^http/, 'wss'),
|
|
68
|
+
],
|
|
69
|
+
// fonts may be loaded from trusted resource origins (e.g. Google Fonts);
|
|
70
|
+
// when no trustedResourceOrigins are configured, allow fonts from all origins
|
|
71
|
+
fontSrc: trustedResourceOrigins === undefined
|
|
72
|
+
? ['*']
|
|
73
|
+
: ["'self'", ...trustedResourceOrigins],
|
|
74
|
+
// when no allowedOrigins are configured, allow framing from all origins
|
|
75
|
+
frameAncestors: allowedOrigins === undefined
|
|
76
|
+
? ['*']
|
|
77
|
+
: ["'self'", ...allowedOrigins],
|
|
78
|
+
objectSrc: ["'none'"], // disable Flash/plugins
|
|
79
|
+
baseUri: ["'self'"], // prevent <base>-tag injection
|
|
80
|
+
// When SAML auth is configured, the browser POSTs a form to the external IdP.
|
|
81
|
+
// The IdP URL must therefore be explicitly allowed alongside 'self'.
|
|
82
|
+
formAction: props.auth?.saml.entryPoint
|
|
83
|
+
? ["'self'", props.auth.saml.entryPoint]
|
|
84
|
+
: ["'self'"],
|
|
85
|
+
// upgrade-insecure-requests is intentionally omitted:
|
|
86
|
+
// the webclient is embedded via iframe on external pages which may themselves be HTTP,
|
|
87
|
+
// and the directive would also affect those sub-resource loads in some browsers.
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
// Disable X-Frame-Options: we control framing exclusively via CSP frame-ancestors above.
|
|
91
|
+
// X-Frame-Options: SAMEORIGIN (helmet default) would block cross-origin iframe embedding.
|
|
92
|
+
frameguard: false,
|
|
93
|
+
// Send origin only, without path – sufficient for analytics while avoiding leaking URLs
|
|
94
|
+
referrerPolicy: { policy: 'strict-origin-when-cross-origin' },
|
|
95
|
+
// resources served by the webclient must be loadable cross-origin (e.g. embed script)
|
|
96
|
+
crossOriginResourcePolicy: { policy: 'cross-origin' },
|
|
97
|
+
}));
|
|
98
|
+
// Permissions-Policy: restrict browser feature access to the minimum required.
|
|
99
|
+
// Microphone is only permitted when speech-to-text is configured.
|
|
100
|
+
router.use((_req, res, next) => {
|
|
101
|
+
const microphonePolicy = props.speech
|
|
102
|
+
? 'microphone=(self)'
|
|
103
|
+
: 'microphone=()';
|
|
104
|
+
res.setHeader('Permissions-Policy', [
|
|
105
|
+
microphonePolicy,
|
|
106
|
+
'camera=()',
|
|
107
|
+
'geolocation=()',
|
|
108
|
+
'payment=()',
|
|
109
|
+
'usb=()',
|
|
110
|
+
].join(', '));
|
|
111
|
+
next();
|
|
112
|
+
});
|
|
24
113
|
// serve transcript pdf
|
|
25
|
-
|
|
114
|
+
router.use('/transcript-pdf/:sessionId', async (req, res) => {
|
|
26
115
|
const sessionId = req.params['sessionId'];
|
|
27
116
|
if (sessionId?.length) {
|
|
28
117
|
const session = await bot.createSession(sessionId);
|
|
@@ -36,7 +125,7 @@ export default (clientName, environment, props) => async (bot) => {
|
|
|
36
125
|
}
|
|
37
126
|
});
|
|
38
127
|
// serve embed resources
|
|
39
|
-
|
|
128
|
+
router.get('/embed', (req, res) => {
|
|
40
129
|
const server = `${bot.webserver.baseUrl}/${clientName}`;
|
|
41
130
|
const serverUrl = new URL(server);
|
|
42
131
|
// Pass all query parameters to the chatbot URL
|
|
@@ -53,7 +142,7 @@ export default (clientName, environment, props) => async (bot) => {
|
|
|
53
142
|
res.end();
|
|
54
143
|
});
|
|
55
144
|
if (fabVisibilityIsConditional(props)) {
|
|
56
|
-
|
|
145
|
+
router.get('/embed/bundle.js', (req, res) => {
|
|
57
146
|
const caller = req.query['caller'];
|
|
58
147
|
const referer = req.get('referer')?.toLowerCase();
|
|
59
148
|
const visibleUrls = Array.isArray(props.fabVisible)
|
|
@@ -72,18 +161,20 @@ export default (clientName, environment, props) => async (bot) => {
|
|
|
72
161
|
}
|
|
73
162
|
});
|
|
74
163
|
}
|
|
75
|
-
|
|
76
|
-
|
|
164
|
+
router.use('/embed', serveStatic(__dirname + '/embed', serveStaticOptions));
|
|
165
|
+
router.get('/logo.svg', (_req, res) => {
|
|
77
166
|
res.redirect(`/cms/chatbot/design/logo.svg?client=${clientName}`);
|
|
78
167
|
});
|
|
79
|
-
|
|
168
|
+
router.get('/bot.svg', (_req, res) => {
|
|
80
169
|
res.redirect(`/cms/chatbot/design/bot.svg?client=${clientName}`);
|
|
81
170
|
});
|
|
82
|
-
|
|
171
|
+
router.get('/fab.svg', (_req, res) => {
|
|
83
172
|
res.redirect(`/cms/chatbot/design/fab.svg?client=${clientName}`);
|
|
84
173
|
});
|
|
85
174
|
// serve chat client resources
|
|
86
|
-
|
|
175
|
+
router.use(serveStatic(__dirname + '/client', serveStaticOptions));
|
|
176
|
+
// mount router on the main app
|
|
177
|
+
bot.webserver.express.use(`/${clientName}`, router);
|
|
87
178
|
logger.info(`Webclient will be available on route: /${clientName}`);
|
|
88
179
|
const nsp = bot.webserver.socket.of(`/${clientName}/chat`);
|
|
89
180
|
nsp.on('connection', async (socket) => {
|
|
@@ -222,6 +313,7 @@ const sendConfigurationToClient = (socket, props, bot, clientName) => {
|
|
|
222
313
|
enableSpeechSupport: !!props.speech,
|
|
223
314
|
commands: props.commands || [],
|
|
224
315
|
menuItems: props.menuItems || [],
|
|
316
|
+
allowedOrigins: props.allowedOrigins,
|
|
225
317
|
};
|
|
226
318
|
socket.emit('set-settings', settings);
|
|
227
319
|
if (props.expandChatWindowAtStart &&
|
package/dist/types.d.ts
CHANGED
|
@@ -183,6 +183,35 @@ export interface WebClientProps {
|
|
|
183
183
|
* @default []
|
|
184
184
|
*/
|
|
185
185
|
menuItems?: MenuItem[];
|
|
186
|
+
/**
|
|
187
|
+
* List of allowed origins for CORS and CSP `frame-ancestors`.
|
|
188
|
+
*
|
|
189
|
+
* Controls **who may use the webclient**:
|
|
190
|
+
* - embed the chatbot in an iframe (`frame-ancestors` directive of the Content Security Policy)
|
|
191
|
+
* - make cross-origin requests to webclient endpoints (CORS `Access-Control-Allow-Origin`)
|
|
192
|
+
*
|
|
193
|
+
* - **Not set (default):** all origins are allowed – backward-compatible behaviour.
|
|
194
|
+
* - **Set to an array:** only the listed origins are permitted; all others are blocked.
|
|
195
|
+
* An empty array `[]` blocks all cross-origin access.
|
|
196
|
+
*
|
|
197
|
+
* @default undefined (all origins allowed)
|
|
198
|
+
*/
|
|
199
|
+
allowedOrigins?: string[];
|
|
200
|
+
/**
|
|
201
|
+
* List of trusted origins the webclient itself may load resources from.
|
|
202
|
+
*
|
|
203
|
+
* Controls **what external sources the webclient (iframe) may use**, e.g.:
|
|
204
|
+
* - fonts (`font-src`), e.g. `https://fonts.gstatic.com` for Google Fonts
|
|
205
|
+
* - images (`img-src`)
|
|
206
|
+
*
|
|
207
|
+
* Typical entries: `https://fonts.googleapis.com`, `https://fonts.gstatic.com`
|
|
208
|
+
*
|
|
209
|
+
* - **Not set (default):** all origins are trusted – backward-compatible behaviour.
|
|
210
|
+
* - **Set to an array:** only the listed origins are permitted as resource sources.
|
|
211
|
+
*
|
|
212
|
+
* @default undefined (all origins trusted)
|
|
213
|
+
*/
|
|
214
|
+
trustedResourceOrigins?: string[];
|
|
186
215
|
}
|
|
187
216
|
export declare enum Devices {
|
|
188
217
|
All = "all",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botfabrik/engine-webclient",
|
|
3
|
-
"version": "4.109.
|
|
3
|
+
"version": "4.109.12-alpha.0",
|
|
4
4
|
"description": "Webclient for Botfabriks Bot Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,13 +31,16 @@
|
|
|
31
31
|
"dev:embed": "tsx --watch ./run-embed-local.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@botfabrik/engine-domain": "^4.109.
|
|
35
|
-
"@botfabrik/engine-transcript-export": "^4.109.
|
|
36
|
-
"@botfabrik/engine-utils": "^4.109.
|
|
37
|
-
"@google-cloud/speech": "^7.
|
|
34
|
+
"@botfabrik/engine-domain": "^4.109.11",
|
|
35
|
+
"@botfabrik/engine-transcript-export": "^4.109.11",
|
|
36
|
+
"@botfabrik/engine-utils": "^4.109.11",
|
|
37
|
+
"@google-cloud/speech": "^7.3.0",
|
|
38
38
|
"@node-saml/passport-saml": "^5.1.0",
|
|
39
|
+
"@types/cors": "^2.8.19",
|
|
40
|
+
"cors": "^2.8.6",
|
|
39
41
|
"express": "^5.2.1",
|
|
40
42
|
"flat": "^6.0.1",
|
|
43
|
+
"helmet": "^8.1.0",
|
|
41
44
|
"jose": "^6.1.3",
|
|
42
45
|
"passport": "^0.7.0"
|
|
43
46
|
},
|
|
@@ -50,5 +53,5 @@
|
|
|
50
53
|
"tsx": "^4.21.0",
|
|
51
54
|
"typescript": "5.9.3"
|
|
52
55
|
},
|
|
53
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "49afbc154f2bdd31c5cb2a8c9c6d605959f538bf"
|
|
54
57
|
}
|