@walker-di/fortalece-ai-sdk 0.3.13 → 0.3.16

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.
@@ -1,6 +1,6 @@
1
- (function(V,It){typeof exports=="object"&&typeof module<"u"?It(exports):typeof define=="function"&&define.amd?define(["exports"],It):(V=typeof globalThis<"u"?globalThis:V||self,It(V.FortaleceAI={}))})(this,(function(V){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const ms=1,_s=2,bs=16,ws=1,ys=2,Xr="[",Lt="[!",ur="]",lt={},U=Symbol(),xs="http://www.w3.org/1999/xhtml",dr=!1;var Qr=Array.isArray,$s=Array.prototype.indexOf,ct=Array.prototype.includes,Dt=Array.from,Ot=Object.keys,Nt=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,Ss=Object.getOwnPropertyDescriptors,ks=Object.prototype,Es=Array.prototype,en=Object.getPrototypeOf,tn=Object.isExtensible;function Cs(e){for(var t=0;t<e.length;t++)e[t]()}function rn(){var e,t,r=new Promise((n,s)=>{e=n,t=s});return{promise:r,resolve:e,reject:t}}const j=2,Pt=4,Ft=8,nn=1<<24,Re=16,me=32,je=64,hr=128,fe=512,P=1024,B=2048,_e=4096,ne=8192,Me=16384,Ut=32768,ut=65536,sn=1<<17,an=1<<18,Xe=1<<19,As=1<<20,Be=1<<25,Qe=32768,pr=1<<21,vr=1<<22,He=1<<23,jt=Symbol("$state"),zs=Symbol("legacy props"),Ts=Symbol(""),dt=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Bt=3,ht=8;function Rs(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ms(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Is(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ls(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Ds(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Os(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Ns(){throw new Error("https://svelte.dev/e/hydration_failed")}function Ps(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Fs(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Us(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function js(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function Ht(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function Bs(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let k=!1;function Ie(e){k=e}let S;function se(e){if(e===null)throw Ht(),lt;return S=e}function qt(){return se(ke(S))}function z(e){if(k){if(ke(S)!==null)throw Ht(),lt;S=e}}function gr(e=1){if(k){for(var t=e,r=S;t--;)r=ke(r);S=r}}function Vt(e=!0){for(var t=0,r=S;;){if(r.nodeType===ht){var n=r.data;if(n===ur){if(t===0)return r;t-=1}else(n===Xr||n===Lt)&&(t+=1)}var s=ke(r);e&&r.remove(),r=s}}function on(e){if(!e||e.nodeType!==ht)throw Ht(),lt;return e.data}function ln(e){return e===this.v}function Hs(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function cn(e){return!Hs(e,this.v)}let qs=!1,ie=null;function pt(e){ie=e}function mr(e,t=!1,r){ie={p:ie,i:!1,c:null,e:null,s:e,x:null,l:null}}function _r(e){var t=ie,r=t.e;if(r!==null){t.e=null;for(var n of r)In(n)}return e!==void 0&&(t.x=e),t.i=!0,ie=t.p,e??{}}function fn(){return!0}let et=[];function un(){var e=et;et=[],Cs(e)}function tt(e){if(et.length===0&&!yt){var t=et;queueMicrotask(()=>{t===et&&un()})}et.push(e)}function Vs(){for(;et.length>0;)un()}function dn(e){var t=E;if(t===null)return $.f|=He,e;if((t.f&Ut)===0){if((t.f&hr)===0)throw e;t.b.error(e)}else vt(e,t)}function vt(e,t){for(;t!==null;){if((t.f&hr)!==0)try{t.b.error(e);return}catch(r){e=r}t=t.parent}throw e}const Ws=-7169;function N(e,t){e.f=e.f&Ws|t}function br(e){(e.f&fe)!==0||e.deps===null?N(e,P):N(e,_e)}function hn(e){if(e!==null)for(const t of e)(t.f&j)===0||(t.f&Qe)===0||(t.f^=Qe,hn(t.deps))}function pn(e,t,r){(e.f&B)!==0?t.add(e):(e.f&_e)!==0&&r.add(e),hn(e.deps),N(e,P)}const Wt=new Set;let I=null,be=null,ae=[],Kt=null,wr=!1,yt=!1;class Le{committed=!1;current=new Map;previous=new Map;#e=new Set;#t=new Set;#r=0;#a=0;#o=null;#s=new Set;#n=new Set;#i=new Map;is_fork=!1;#l=!1;is_deferred(){return this.is_fork||this.#a>0}skip_effect(t){this.#i.has(t)||this.#i.set(t,{d:[],m:[]})}unskip_effect(t){var r=this.#i.get(t);if(r){this.#i.delete(t);for(var n of r.d)N(n,B),we(n);for(n of r.m)N(n,_e),we(n)}}process(t){ae=[],this.apply();var r=[],n=[];for(const s of t)this.#c(s,r,n);if(this.is_deferred()){this.#u(n),this.#u(r);for(const[s,i]of this.#i)bn(s,i)}else{for(const s of this.#e)s();this.#e.clear(),this.#r===0&&this.#f(),I=null,gn(n),gn(r),this.#o?.resolve()}be=null}#c(t,r,n){t.f^=P;for(var s=t.first,i=null;s!==null;){var a=s.f,o=(a&(me|je))!==0,l=o&&(a&P)!==0,f=l||(a&ne)!==0||this.#i.has(s);if(!f&&s.fn!==null){o?s.f^=P:i!==null&&(a&(Pt|Ft|nn))!==0?i.b.defer_effect(s):(a&Pt)!==0?r.push(s):$t(s)&&((a&Re)!==0&&this.#n.add(s),St(s));var u=s.first;if(u!==null){s=u;continue}}var d=s.parent;for(s=s.next;s===null&&d!==null;)d===i&&(i=null),s=d.next,d=d.parent}}#u(t){for(var r=0;r<t.length;r+=1)pn(t[r],this.#s,this.#n)}capture(t,r){r!==U&&!this.previous.has(t)&&this.previous.set(t,r),(t.f&He)===0&&(this.current.set(t,t.v),be?.set(t,t.v))}activate(){I=this,this.apply()}deactivate(){I===this&&(I=null,be=null)}flush(){if(this.activate(),ae.length>0){if(vn(),I!==null&&I!==this)return}else this.#r===0&&this.process([]);this.deactivate()}discard(){for(const t of this.#t)t(this);this.#t.clear()}#f(){if(Wt.size>1){this.previous.clear();var t=be,r=!0;for(const s of Wt){if(s===this){r=!1;continue}const i=[];for(const[o,l]of this.current){if(s.current.has(o))if(r&&l!==s.current.get(o))s.current.set(o,l);else continue;i.push(o)}if(i.length===0)continue;const a=[...s.current.keys()].filter(o=>!this.current.has(o));if(a.length>0){var n=ae;ae=[];const o=new Set,l=new Map;for(const f of i)mn(f,a,o,l);if(ae.length>0){I=s,s.apply();for(const f of ae)s.#c(f,[],[]);s.deactivate()}ae=n}}I=null,be=t}this.committed=!0,Wt.delete(this)}increment(t){this.#r+=1,t&&(this.#a+=1)}decrement(t){this.#r-=1,t&&(this.#a-=1),!this.#l&&(this.#l=!0,tt(()=>{this.#l=!1,this.is_deferred()?ae.length>0&&this.flush():this.revive()}))}revive(){for(const t of this.#s)this.#n.delete(t),N(t,B),we(t);for(const t of this.#n)N(t,_e),we(t);this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#t.add(t)}settled(){return(this.#o??=rn()).promise}static ensure(){if(I===null){const t=I=new Le;Wt.add(I),yt||tt(()=>{I===t&&t.flush()})}return I}apply(){}}function W(e){var t=yt;yt=!0;try{for(var r;;){if(Vs(),ae.length===0&&(I?.flush(),ae.length===0))return Kt=null,r;vn()}}finally{yt=t}}function vn(){wr=!0;var e=null;try{for(var t=0;ae.length>0;){var r=Le.ensure();if(t++>1e3){var n,s;Ks()}r.process(ae),qe.clear()}}finally{wr=!1,Kt=null}}function Ks(){try{Os()}catch(e){vt(e,Kt)}}let De=null;function gn(e){var t=e.length;if(t!==0){for(var r=0;r<t;){var n=e[r++];if((n.f&(Me|ne))===0&&$t(n)&&(De=new Set,St(n),n.deps===null&&n.first===null&&n.nodes===null&&(n.teardown===null&&n.ac===null?Nn(n):n.fn=null),De?.size>0)){qe.clear();for(const s of De){if((s.f&(Me|ne))!==0)continue;const i=[s];let a=s.parent;for(;a!==null;)De.has(a)&&(De.delete(a),i.push(a)),a=a.parent;for(let o=i.length-1;o>=0;o--){const l=i[o];(l.f&(Me|ne))===0&&St(l)}}De.clear()}}De=null}}function mn(e,t,r,n){if(!r.has(e)&&(r.add(e),e.reactions!==null))for(const s of e.reactions){const i=s.f;(i&j)!==0?mn(s,t,r,n):(i&(vr|Re))!==0&&(i&B)===0&&_n(s,t,n)&&(N(s,B),we(s))}}function _n(e,t,r){const n=r.get(e);if(n!==void 0)return n;if(e.deps!==null)for(const s of e.deps){if(ct.call(t,s))return!0;if((s.f&j)!==0&&_n(s,t,r))return r.set(s,!0),!0}return r.set(e,!1),!1}function we(e){for(var t=Kt=e;t.parent!==null;){t=t.parent;var r=t.f;if(wr&&t===E&&(r&Re)!==0&&(r&an)===0)return;if((r&(je|me))!==0){if((r&P)===0)return;t.f^=P}}ae.push(t)}function bn(e,t){if(!((e.f&me)!==0&&(e.f&P)!==0)){(e.f&B)!==0?t.d.push(e):(e.f&_e)!==0&&t.m.push(e),N(e,P);for(var r=e.first;r!==null;)bn(r,t),r=r.next}}function Ys(e){let t=0,r=rt(0),n;return()=>{Er()&&(c(r),Cr(()=>(t===0&&(n=Tr(()=>e(()=>xt(r)))),t+=1,()=>{tt(()=>{t-=1,t===0&&(n?.(),n=void 0,xt(r))})})))}}var Zs=ut|Xe|hr;function Gs(e,t,r){new Js(e,t,r)}class Js{parent;is_pending=!1;#e;#t=k?S:null;#r;#a;#o;#s=null;#n=null;#i=null;#l=null;#c=null;#u=0;#f=0;#p=!1;#h=!1;#v=new Set;#g=new Set;#d=null;#y=Ys(()=>(this.#d=rt(this.#u),()=>{this.#d=null}));constructor(t,r,n){this.#e=t,this.#r=r,this.#a=n,this.parent=E.b,this.is_pending=!!this.#r.pending,this.#o=Ar(()=>{if(E.b=this,k){const i=this.#t;qt(),i.nodeType===ht&&i.data===Lt?this.#$():(this.#x(),this.#f===0&&(this.is_pending=!1))}else{var s=this.#b();try{this.#s=ue(()=>n(s))}catch(i){this.error(i)}this.#f>0?this.#_():this.is_pending=!1}return()=>{this.#c?.remove()}},Zs),k&&(this.#e=S)}#x(){try{this.#s=ue(()=>this.#a(this.#e))}catch(t){this.error(t)}}#$(){const t=this.#r.pending;t&&(this.#n=ue(()=>t(this.#e)),tt(()=>{var r=this.#b();this.#s=this.#m(()=>(Le.ensure(),ue(()=>this.#a(r)))),this.#f>0?this.#_():(nt(this.#n,()=>{this.#n=null}),this.is_pending=!1)}))}#b(){var t=this.#e;return this.is_pending&&(this.#c=xe(),this.#e.before(this.#c),t=this.#c),t}defer_effect(t){pn(t,this.#v,this.#g)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#r.pending}#m(t){var r=E,n=$,s=ie;Ce(this.#o),de(this.#o),pt(this.#o.ctx);try{return t()}catch(i){return dn(i),null}finally{Ce(r),de(n),pt(s)}}#_(){const t=this.#r.pending;this.#s!==null&&(this.#l=document.createDocumentFragment(),this.#l.append(this.#c),Un(this.#s,this.#l)),this.#n===null&&(this.#n=ue(()=>t(this.#e)))}#w(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#w(t);return}if(this.#f+=t,this.#f===0){this.is_pending=!1;for(const r of this.#v)N(r,B),we(r);for(const r of this.#g)N(r,_e),we(r);this.#v.clear(),this.#g.clear(),this.#n&&nt(this.#n,()=>{this.#n=null}),this.#l&&(this.#e.before(this.#l),this.#l=null)}}update_pending_count(t){this.#w(t),this.#u+=t,!(!this.#d||this.#p)&&(this.#p=!0,tt(()=>{this.#p=!1,this.#d&&gt(this.#d,this.#u)}))}get_effect_pending(){return this.#y(),c(this.#d)}error(t){var r=this.#r.onerror;let n=this.#r.failed;if(this.#h||!r&&!n)throw t;this.#s&&(Z(this.#s),this.#s=null),this.#n&&(Z(this.#n),this.#n=null),this.#i&&(Z(this.#i),this.#i=null),k&&(se(this.#t),gr(),se(Vt()));var s=!1,i=!1;const a=()=>{if(s){Bs();return}s=!0,i&&js(),Le.ensure(),this.#u=0,this.#i!==null&&nt(this.#i,()=>{this.#i=null}),this.is_pending=this.has_pending_snippet(),this.#s=this.#m(()=>(this.#h=!1,ue(()=>this.#a(this.#e)))),this.#f>0?this.#_():this.is_pending=!1};tt(()=>{try{i=!0,r?.(t,a),i=!1}catch(o){vt(o,this.#o&&this.#o.parent)}n&&(this.#i=this.#m(()=>{Le.ensure(),this.#h=!0;try{return ue(()=>{n(this.#e,()=>t,()=>a)})}catch(o){return vt(o,this.#o.parent),null}finally{this.#h=!1}}))})}}function Xs(e,t,r,n){const s=Yt;var i=e.filter(h=>!h.settled);if(r.length===0&&i.length===0){n(t.map(s));return}var a=I,o=E,l=Qs(),f=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(h=>h.promise)):null;function u(h){l();try{n(h)}catch(g){(o.f&Me)===0&&vt(g,o)}a?.deactivate(),yr()}if(r.length===0){f.then(()=>u(t.map(s)));return}function d(){l(),Promise.all(r.map(h=>ei(h))).then(h=>u([...t.map(s),...h])).catch(h=>vt(h,o))}f?f.then(d):d()}function Qs(){var e=E,t=$,r=ie,n=I;return function(i=!0){Ce(e),de(t),pt(r),i&&n?.activate()}}function yr(){Ce(null),de(null),pt(null)}function Yt(e){var t=j|B,r=$!==null&&($.f&j)!==0?$:null;return E!==null&&(E.f|=Xe),{ctx:ie,deps:null,effects:null,equals:ln,f:t,fn:e,reactions:null,rv:0,v:U,wv:0,parent:r??E,ac:null}}function ei(e,t,r){let n=E;n===null&&Ms();var s=n.b,i=void 0,a=rt(U),o=!$,l=new Map;return ci(()=>{var f=rn();i=f.promise;try{Promise.resolve(e()).then(f.resolve,f.reject).then(()=>{u===I&&u.committed&&u.deactivate(),yr()})}catch(g){f.reject(g),yr()}var u=I;if(o){var d=s.is_rendered();s.update_pending_count(1),u.increment(d),l.get(u)?.reject(dt),l.delete(u),l.set(u,f)}const h=(g,p=void 0)=>{if(u.activate(),p)p!==dt&&(a.f|=He,gt(a,p));else{(a.f&He)!==0&&(a.f^=He),gt(a,g);for(const[_,R]of l){if(l.delete(_),_===u)break;R.reject(dt)}}o&&(s.update_pending_count(-1),u.decrement(d))};f.promise.then(h,g=>h(null,g||"unknown"))}),ai(()=>{for(const f of l.values())f.reject(dt)}),new Promise(f=>{function u(d){function h(){d===i?f(a):u(i)}d.then(h,h)}u(i)})}function ye(e){const t=Yt(e);return Bn(t),t}function ti(e){const t=Yt(e);return t.equals=cn,t}function wn(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)Z(t[r])}}function ri(e){for(var t=e.parent;t!==null;){if((t.f&j)===0)return(t.f&Me)===0?t:null;t=t.parent}return null}function xr(e){var t,r=E;Ce(ri(e));try{e.f&=~Qe,wn(e),t=Kn(e)}finally{Ce(r)}return t}function yn(e){var t=xr(e);if(!e.equals(t)&&(e.wv=Vn(),(!I?.is_fork||e.deps===null)&&(e.v=t,e.deps===null))){N(e,P);return}We||(be!==null?(Er()||I?.is_fork)&&be.set(e,t):br(e))}let $r=new Set;const qe=new Map;let xn=!1;function rt(e,t){var r={f:0,v:e,reactions:null,equals:ln,rv:0,wv:0};return r}function A(e,t){const r=rt(e);return Bn(r),r}function $n(e,t=!1,r=!0){const n=rt(e);return t||(n.equals=cn),n}function m(e,t,r=!1){$!==null&&(!$e||($.f&sn)!==0)&&fn()&&($.f&(j|Re|vr|sn))!==0&&(he===null||!ct.call(he,e))&&Us();let n=r?Oe(t):t;return gt(e,n)}function gt(e,t){if(!e.equals(t)){var r=e.v;We?qe.set(e,t):qe.set(e,r),e.v=t;var n=Le.ensure();if(n.capture(e,r),(e.f&j)!==0){const s=e;(e.f&B)!==0&&xr(s),br(s)}e.wv=Vn(),Sn(e,B),E!==null&&(E.f&P)!==0&&(E.f&(me|je))===0&&(pe===null?di([e]):pe.push(e)),!n.is_fork&&$r.size>0&&!xn&&ni()}return t}function ni(){xn=!1;for(const e of $r)(e.f&P)!==0&&N(e,_e),$t(e)&&St(e);$r.clear()}function xt(e){m(e,e.v+1)}function Sn(e,t){var r=e.reactions;if(r!==null)for(var n=r.length,s=0;s<n;s++){var i=r[s],a=i.f,o=(a&B)===0;if(o&&N(i,t),(a&j)!==0){var l=i;be?.delete(l),(a&Qe)===0&&(a&fe&&(i.f|=Qe),Sn(l,_e))}else o&&((a&Re)!==0&&De!==null&&De.add(i),we(i))}}function Oe(e){if(typeof e!="object"||e===null||jt in e)return e;const t=en(e);if(t!==ks&&t!==Es)return e;var r=new Map,n=Qr(e),s=A(0),i=it,a=o=>{if(it===i)return o();var l=$,f=it;de(null),qn(i);var u=o();return de(l),qn(f),u};return n&&r.set("length",A(e.length)),new Proxy(e,{defineProperty(o,l,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&Ps();var u=r.get(l);return u===void 0?u=a(()=>{var d=A(f.value);return r.set(l,d),d}):m(u,f.value,!0),!0},deleteProperty(o,l){var f=r.get(l);if(f===void 0){if(l in o){const u=a(()=>A(U));r.set(l,u),xt(s)}}else m(f,U),xt(s);return!0},get(o,l,f){if(l===jt)return e;var u=r.get(l),d=l in o;if(u===void 0&&(!d||ft(o,l)?.writable)&&(u=a(()=>{var g=Oe(d?o[l]:U),p=A(g);return p}),r.set(l,u)),u!==void 0){var h=c(u);return h===U?void 0:h}return Reflect.get(o,l,f)},getOwnPropertyDescriptor(o,l){var f=Reflect.getOwnPropertyDescriptor(o,l);if(f&&"value"in f){var u=r.get(l);u&&(f.value=c(u))}else if(f===void 0){var d=r.get(l),h=d?.v;if(d!==void 0&&h!==U)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return f},has(o,l){if(l===jt)return!0;var f=r.get(l),u=f!==void 0&&f.v!==U||Reflect.has(o,l);if(f!==void 0||E!==null&&(!u||ft(o,l)?.writable)){f===void 0&&(f=a(()=>{var h=u?Oe(o[l]):U,g=A(h);return g}),r.set(l,f));var d=c(f);if(d===U)return!1}return u},set(o,l,f,u){var d=r.get(l),h=l in o;if(n&&l==="length")for(var g=f;g<d.v;g+=1){var p=r.get(g+"");p!==void 0?m(p,U):g in o&&(p=a(()=>A(U)),r.set(g+"",p))}if(d===void 0)(!h||ft(o,l)?.writable)&&(d=a(()=>A(void 0)),m(d,Oe(f)),r.set(l,d));else{h=d.v!==U;var _=a(()=>Oe(f));m(d,_)}var R=Reflect.getOwnPropertyDescriptor(o,l);if(R?.set&&R.set.call(u,f),!h){if(n&&typeof l=="string"){var w=r.get("length"),x=Number(l);Number.isInteger(x)&&x>=w.v&&m(w,x+1)}xt(s)}return!0},ownKeys(o){c(s);var l=Reflect.ownKeys(o).filter(d=>{var h=r.get(d);return h===void 0||h.v!==U});for(var[f,u]of r)u.v!==U&&!(f in o)&&l.push(f);return l},setPrototypeOf(){Fs()}})}var kn,En,Cn,An;function Sr(){if(kn===void 0){kn=window,En=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;Cn=ft(t,"firstChild").get,An=ft(t,"nextSibling").get,tn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),tn(r)&&(r.__t=void 0)}}function xe(e=""){return document.createTextNode(e)}function Ve(e){return Cn.call(e)}function ke(e){return An.call(e)}function T(e,t){if(!k)return Ve(e);var r=Ve(S);if(r===null)r=S.appendChild(xe());else if(t&&r.nodeType!==Bt){var n=xe();return r?.before(n),se(n),n}return t&&kr(r),se(r),r}function zn(e,t=!1){if(!k){var r=Ve(e);return r instanceof Comment&&r.data===""?ke(r):r}if(t){if(S?.nodeType!==Bt){var n=xe();return S?.before(n),se(n),n}kr(S)}return S}function O(e,t=1,r=!1){let n=k?S:e;for(var s;t--;)s=n,n=ke(n);if(!k)return n;if(r){if(n?.nodeType!==Bt){var i=xe();return n===null?s?.after(i):n.before(i),se(i),i}kr(n)}return se(n),n}function Tn(e){e.textContent=""}function Rn(){return!1}function kr(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===Bt;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Mn(e){var t=$,r=E;de(null),Ce(null);try{return e()}finally{de(t),Ce(r)}}function si(e){E===null&&($===null&&Ds(),Ls()),We&&Is()}function ii(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function Ee(e,t,r){var n=E;n!==null&&(n.f&ne)!==0&&(e|=ne);var s={ctx:ie,deps:null,nodes:null,f:e|B|fe,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};if(r)try{St(s),s.f|=Ut}catch(o){throw Z(s),o}else t!==null&&we(s);var i=s;if(r&&i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&Xe)===0&&(i=i.first,(e&Re)!==0&&(e&ut)!==0&&i!==null&&(i.f|=ut)),i!==null&&(i.parent=n,n!==null&&ii(i,n),$!==null&&($.f&j)!==0&&(e&je)===0)){var a=$;(a.effects??=[]).push(i)}return s}function Er(){return $!==null&&!$e}function ai(e){const t=Ee(Ft,null,!1);return N(t,P),t.teardown=e,t}function Zt(e){si();var t=E.f,r=!$&&(t&me)!==0&&(t&Ut)===0;if(r){var n=ie;(n.e??=[]).push(e)}else return In(e)}function In(e){return Ee(Pt|As,e,!1)}function oi(e){Le.ensure();const t=Ee(je|Xe,e,!0);return()=>{Z(t)}}function li(e){Le.ensure();const t=Ee(je|Xe,e,!0);return(r={})=>new Promise(n=>{r.outro?nt(t,()=>{Z(t),n(void 0)}):(Z(t),n(void 0))})}function Ln(e){return Ee(Pt,e,!1)}function ci(e){return Ee(vr|Xe,e,!0)}function Cr(e,t=0){return Ee(Ft|t,e,!0)}function X(e,t=[],r=[],n=[]){Xs(n,t,r,s=>{Ee(Ft,()=>e(...s.map(c)),!0)})}function Ar(e,t=0){var r=Ee(Re|t,e,!0);return r}function ue(e){return Ee(me|Xe,e,!0)}function Dn(e){var t=e.teardown;if(t!==null){const r=We,n=$;jn(!0),de(null);try{t.call(null)}finally{jn(r),de(n)}}}function On(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){const s=r.ac;s!==null&&Mn(()=>{s.abort(dt)});var n=r.next;(r.f&je)!==0?r.parent=null:Z(r,t),r=n}}function fi(e){for(var t=e.first;t!==null;){var r=t.next;(t.f&me)===0&&Z(t),t=r}}function Z(e,t=!0){var r=!1;(t||(e.f&an)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(ui(e.nodes.start,e.nodes.end),r=!0),On(e,t&&!r),Jt(e,0),N(e,Me);var n=e.nodes&&e.nodes.t;if(n!==null)for(const i of n)i.stop();Dn(e);var s=e.parent;s!==null&&s.first!==null&&Nn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function ui(e,t){for(;e!==null;){var r=e===t?null:ke(e);e.remove(),e=r}}function Nn(e){var t=e.parent,r=e.prev,n=e.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),t!==null&&(t.first===e&&(t.first=n),t.last===e&&(t.last=r))}function nt(e,t,r=!0){var n=[];Pn(e,n,!0);var s=()=>{r&&Z(e),t&&t()},i=n.length;if(i>0){var a=()=>--i||s();for(var o of n)o.out(a)}else s()}function Pn(e,t,r){if((e.f&ne)===0){e.f^=ne;var n=e.nodes&&e.nodes.t;if(n!==null)for(const o of n)(o.is_global||r)&&t.push(o);for(var s=e.first;s!==null;){var i=s.next,a=(s.f&ut)!==0||(s.f&me)!==0&&(e.f&Re)!==0;Pn(s,t,a?r:!1),s=i}}}function zr(e){Fn(e,!0)}function Fn(e,t){if((e.f&ne)!==0){e.f^=ne,(e.f&P)===0&&(N(e,B),we(e));for(var r=e.first;r!==null;){var n=r.next,s=(r.f&ut)!==0||(r.f&me)!==0;Fn(r,s?t:!1),r=n}var i=e.nodes&&e.nodes.t;if(i!==null)for(const a of i)(a.is_global||t)&&a.in()}}function Un(e,t){if(e.nodes)for(var r=e.nodes.start,n=e.nodes.end;r!==null;){var s=r===n?null:ke(r);t.append(r),r=s}}let Gt=!1,We=!1;function jn(e){We=e}let $=null,$e=!1;function de(e){$=e}let E=null;function Ce(e){E=e}let he=null;function Bn(e){$!==null&&(he===null?he=[e]:he.push(e))}let Q=null,oe=0,pe=null;function di(e){pe=e}let Hn=1,st=0,it=st;function qn(e){it=e}function Vn(){return++Hn}function $t(e){var t=e.f;if((t&B)!==0)return!0;if(t&j&&(e.f&=~Qe),(t&_e)!==0){for(var r=e.deps,n=r.length,s=0;s<n;s++){var i=r[s];if($t(i)&&yn(i),i.wv>e.wv)return!0}(t&fe)!==0&&be===null&&N(e,P)}return!1}function Wn(e,t,r=!0){var n=e.reactions;if(n!==null&&!(he!==null&&ct.call(he,e)))for(var s=0;s<n.length;s++){var i=n[s];(i.f&j)!==0?Wn(i,t,!1):t===i&&(r?N(i,B):(i.f&P)!==0&&N(i,_e),we(i))}}function Kn(e){var t=Q,r=oe,n=pe,s=$,i=he,a=ie,o=$e,l=it,f=e.f;Q=null,oe=0,pe=null,$=(f&(me|je))===0?e:null,he=null,pt(e.ctx),$e=!1,it=++st,e.ac!==null&&(Mn(()=>{e.ac.abort(dt)}),e.ac=null);try{e.f|=pr;var u=e.fn,d=u(),h=e.deps,g=I?.is_fork;if(Q!==null){var p;if(g||Jt(e,oe),h!==null&&oe>0)for(h.length=oe+Q.length,p=0;p<Q.length;p++)h[oe+p]=Q[p];else e.deps=h=Q;if(Er()&&(e.f&fe)!==0)for(p=oe;p<h.length;p++)(h[p].reactions??=[]).push(e)}else!g&&h!==null&&oe<h.length&&(Jt(e,oe),h.length=oe);if(fn()&&pe!==null&&!$e&&h!==null&&(e.f&(j|_e|B))===0)for(p=0;p<pe.length;p++)Wn(pe[p],e);if(s!==null&&s!==e){if(st++,s.deps!==null)for(let _=0;_<r;_+=1)s.deps[_].rv=st;if(t!==null)for(const _ of t)_.rv=st;pe!==null&&(n===null?n=pe:n.push(...pe))}return(e.f&He)!==0&&(e.f^=He),d}catch(_){return dn(_)}finally{e.f^=pr,Q=t,oe=r,pe=n,$=s,he=i,pt(a),$e=o,it=l}}function hi(e,t){let r=t.reactions;if(r!==null){var n=$s.call(r,e);if(n!==-1){var s=r.length-1;s===0?r=t.reactions=null:(r[n]=r[s],r.pop())}}if(r===null&&(t.f&j)!==0&&(Q===null||!ct.call(Q,t))){var i=t;(i.f&fe)!==0&&(i.f^=fe,i.f&=~Qe),br(i),wn(i),Jt(i,0)}}function Jt(e,t){var r=e.deps;if(r!==null)for(var n=t;n<r.length;n++)hi(e,r[n])}function St(e){var t=e.f;if((t&Me)===0){N(e,P);var r=E,n=Gt;E=e,Gt=!0;try{(t&(Re|nn))!==0?fi(e):On(e),Dn(e);var s=Kn(e);e.teardown=typeof s=="function"?s:null,e.wv=Hn;var i;dr&&qs&&(e.f&B)!==0&&e.deps}finally{Gt=n,E=r}}}function c(e){var t=e.f,r=(t&j)!==0;if($!==null&&!$e){var n=E!==null&&(E.f&Me)!==0;if(!n&&(he===null||!ct.call(he,e))){var s=$.deps;if(($.f&pr)!==0)e.rv<st&&(e.rv=st,Q===null&&s!==null&&s[oe]===e?oe++:Q===null?Q=[e]:Q.push(e));else{($.deps??=[]).push(e);var i=e.reactions;i===null?e.reactions=[$]:ct.call(i,$)||i.push($)}}}if(We&&qe.has(e))return qe.get(e);if(r){var a=e;if(We){var o=a.v;return((a.f&P)===0&&a.reactions!==null||Zn(a))&&(o=xr(a)),qe.set(a,o),o}var l=(a.f&fe)===0&&!$e&&$!==null&&(Gt||($.f&fe)!==0),f=a.deps===null;$t(a)&&(l&&(a.f|=fe),yn(a)),l&&!f&&Yn(a)}if(be?.has(e))return be.get(e);if((e.f&He)!==0)throw e.v;return e.v}function Yn(e){if(e.deps!==null){e.f|=fe;for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&j)!==0&&(t.f&fe)===0&&Yn(t)}}function Zn(e){if(e.v===U)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(qe.has(t)||(t.f&j)!==0&&Zn(t))return!0;return!1}function Tr(e){var t=$e;try{return $e=!0,e()}finally{$e=t}}const Gn=new Set,Rr=new Set;function Jn(e){for(var t=0;t<e.length;t++)Gn.add(e[t]);for(var r of Rr)r(e)}let Xn=null;function Xt(e){var t=this,r=t.ownerDocument,n=e.type,s=e.composedPath?.()||[],i=s[0]||e.target;Xn=e;var a=0,o=Xn===e&&e.__root;if(o){var l=s.indexOf(o);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var f=s.indexOf(t);if(f===-1)return;l<=f&&(a=l)}if(i=s[a]||e.target,i!==t){Nt(e,"currentTarget",{configurable:!0,get(){return i||r}});var u=$,d=E;de(null),Ce(null);try{for(var h,g=[];i!==null;){var p=i.assignedSlot||i.parentNode||i.host||null;try{var _=i["__"+n];_!=null&&(!i.disabled||e.target===i)&&_.call(i,e)}catch(R){h?g.push(R):h=R}if(e.cancelBubble||p===t||p===null)break;i=p}if(h){for(let R of g)queueMicrotask(()=>{throw R});throw h}}finally{e.__root=t,delete e.currentTarget,de(u),Ce(d)}}}function Qn(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function Ke(e,t){var r=E;r.nodes===null&&(r.nodes={start:e,end:t,a:null,t:null})}function F(e,t){var r=(t&ws)!==0,n=(t&ys)!==0,s,i=!e.startsWith("<!>");return()=>{if(k)return Ke(S,null),S;s===void 0&&(s=Qn(i?e:"<!>"+e),r||(s=Ve(s)));var a=n||En?document.importNode(s,!0):s.cloneNode(!0);if(r){var o=Ve(a),l=a.lastChild;Ke(o,l)}else Ke(a,a);return a}}function pi(e,t,r="svg"){var n=!e.startsWith("<!>"),s=`<${r}>${n?e:"<!>"+e}</${r}>`,i;return()=>{if(k)return Ke(S,null),S;if(!i){var a=Qn(s),o=Ve(a);i=Ve(o)}var l=i.cloneNode(!0);return Ke(l,l),l}}function Qt(e,t){return pi(e,t,"svg")}function vi(){if(k)return Ke(S,null),S;var e=document.createDocumentFragment(),t=document.createComment(""),r=xe();return e.append(t,r),Ke(t,r),e}function L(e,t){if(k){var r=E;((r.f&Ut)===0||r.nodes.end===null)&&(r.nodes.end=S),qt();return}e!==null&&e.before(t)}const gi=["touchstart","touchmove"];function mi(e){return gi.includes(e)}function Ye(e,t){var r=t==null?"":typeof t=="object"?t+"":t;r!==(e.__t??=e.nodeValue)&&(e.__t=r,e.nodeValue=r+"")}function es(e,t){return ts(e,t)}function _i(e,t){Sr(),t.intro=t.intro??!1;const r=t.target,n=k,s=S;try{for(var i=Ve(r);i&&(i.nodeType!==ht||i.data!==Xr);)i=ke(i);if(!i)throw lt;Ie(!0),se(i);const a=ts(e,{...t,anchor:i});return Ie(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
2
- `).some(o=>o.startsWith("https://svelte.dev/e/")))throw a;return a!==lt&&console.warn("Failed to hydrate: ",a),t.recover===!1&&Ns(),Sr(),Tn(r),Ie(!1),es(e,t)}finally{Ie(n),se(s)}}const mt=new Map;function ts(e,{target:t,anchor:r,props:n={},events:s,context:i,intro:a=!0}){Sr();var o=new Set,l=d=>{for(var h=0;h<d.length;h++){var g=d[h];if(!o.has(g)){o.add(g);var p=mi(g);t.addEventListener(g,Xt,{passive:p});var _=mt.get(g);_===void 0?(document.addEventListener(g,Xt,{passive:p}),mt.set(g,1)):mt.set(g,_+1)}}};l(Dt(Gn)),Rr.add(l);var f=void 0,u=li(()=>{var d=r??t.appendChild(xe());return Gs(d,{pending:()=>{}},h=>{if(i){mr({});var g=ie;g.c=i}if(s&&(n.$$events=s),k&&Ke(h,null),f=e(h,n)||{},k&&(E.nodes.end=S,S===null||S.nodeType!==ht||S.data!==ur))throw Ht(),lt;i&&_r()}),()=>{for(var h of o){t.removeEventListener(h,Xt);var g=mt.get(h);--g===0?(document.removeEventListener(h,Xt),mt.delete(h)):mt.set(h,g)}Rr.delete(l),d!==r&&d.parentNode?.removeChild(d)}});return Mr.set(f,u),f}let Mr=new WeakMap;function bi(e,t){const r=Mr.get(e);return r?(Mr.delete(e),r(t)):Promise.resolve()}class wi{anchor;#e=new Map;#t=new Map;#r=new Map;#a=new Set;#o=!0;constructor(t,r=!0){this.anchor=t,this.#o=r}#s=()=>{var t=I;if(this.#e.has(t)){var r=this.#e.get(t),n=this.#t.get(r);if(n)zr(n),this.#a.delete(r);else{var s=this.#r.get(r);s&&(this.#t.set(r,s.effect),this.#r.delete(r),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),n=s.effect)}for(const[i,a]of this.#e){if(this.#e.delete(i),i===t)break;const o=this.#r.get(a);o&&(Z(o.effect),this.#r.delete(a))}for(const[i,a]of this.#t){if(i===r||this.#a.has(i))continue;const o=()=>{if(Array.from(this.#e.values()).includes(i)){var f=document.createDocumentFragment();Un(a,f),f.append(xe()),this.#r.set(i,{effect:a,fragment:f})}else Z(a);this.#a.delete(i),this.#t.delete(i)};this.#o||!n?(this.#a.add(i),nt(a,o,!1)):o()}}};#n=t=>{this.#e.delete(t);const r=Array.from(this.#e.values());for(const[n,s]of this.#r)r.includes(n)||(Z(s.effect),this.#r.delete(n))};ensure(t,r){var n=I,s=Rn();if(r&&!this.#t.has(t)&&!this.#r.has(t))if(s){var i=document.createDocumentFragment(),a=xe();i.append(a),this.#r.set(t,{effect:ue(()=>r(a)),fragment:i})}else this.#t.set(t,ue(()=>r(this.anchor)));if(this.#e.set(n,t),s){for(const[o,l]of this.#t)o===t?n.unskip_effect(l):n.skip_effect(l);for(const[o,l]of this.#r)o===t?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(this.#s),n.ondiscard(this.#n)}else k&&(this.anchor=S),this.#s()}}function rs(e){ie===null&&Rs(),Zt(()=>{const t=Tr(e);if(typeof t=="function")return t})}function H(e,t,r=!1){k&&qt();var n=new wi(e),s=r?ut:0;function i(a,o){if(k){const f=on(e)===Lt;if(a===f){var l=Vt();se(l),n.anchor=l,Ie(!1),n.ensure(a,o),Ie(!0);return}}n.ensure(a,o)}Ar(()=>{var a=!1;t((o,l=!0)=>{a=!0,i(l,o)}),a||i(!1,null)},s)}function yi(e,t,r){for(var n=[],s=t.length,i,a=t.length,o=0;o<s;o++){let d=t[o];nt(d,()=>{if(i){if(i.pending.delete(d),i.done.add(d),i.pending.size===0){var h=e.outrogroups;Ir(Dt(i.done)),h.delete(i),h.size===0&&(e.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=n.length===0&&r!==null;if(l){var f=r,u=f.parentNode;Tn(u),u.append(f),e.items.clear()}Ir(t,!l)}else i={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(i)}function Ir(e,t=!0){for(var r=0;r<e.length;r++)Z(e[r],t)}var ns;function xi(e,t,r,n,s,i=null){var a=e,o=new Map;k&&qt();var l=null,f=ti(()=>{var _=r();return Qr(_)?_:_==null?[]:Dt(_)}),u,d=!0;function h(){p.fallback=l,$i(p,u,a,t,n),l!==null&&(u.length===0?(l.f&Be)===0?zr(l):(l.f^=Be,Et(l,null,a)):nt(l,()=>{l=null}))}var g=Ar(()=>{u=c(f);var _=u.length;let R=!1;if(k){var w=on(a)===Lt;w!==(_===0)&&(a=Vt(),se(a),Ie(!1),R=!0)}for(var x=new Set,ee=I,K=Rn(),Y=0;Y<_;Y+=1){k&&S.nodeType===ht&&S.data===ur&&(a=S,R=!0,Ie(!1));var Ne=u[Y],Ae=n(Ne,Y),M=d?null:o.get(Ae);M?(M.v&&gt(M.v,Ne),M.i&&gt(M.i,Y),K&&ee.unskip_effect(M.e)):(M=Si(o,d?a:ns??=xe(),Ne,Ae,Y,s,t,r),d||(M.e.f|=Be),o.set(Ae,M)),x.add(Ae)}if(_===0&&i&&!l&&(d?l=ue(()=>i(a)):(l=ue(()=>i(ns??=xe())),l.f|=Be)),k&&_>0&&se(Vt()),!d)if(K){for(const[bt,Se]of o)x.has(bt)||ee.skip_effect(Se.e);ee.oncommit(h),ee.ondiscard(()=>{})}else h();R&&Ie(!0),c(f)}),p={effect:g,items:o,outrogroups:null,fallback:l};d=!1,k&&(a=S)}function kt(e){for(;e!==null&&(e.f&me)===0;)e=e.next;return e}function $i(e,t,r,n,s){var i=t.length,a=e.items,o=kt(e.effect.first),l,f=null,u=[],d=[],h,g,p,_;for(_=0;_<i;_+=1){if(h=t[_],g=s(h,_),p=a.get(g).e,e.outrogroups!==null)for(const M of e.outrogroups)M.pending.delete(p),M.done.delete(p);if((p.f&Be)!==0)if(p.f^=Be,p===o)Et(p,null,r);else{var R=f?f.next:o;p===e.effect.last&&(e.effect.last=p.prev),p.prev&&(p.prev.next=p.next),p.next&&(p.next.prev=p.prev),Ze(e,f,p),Ze(e,p,R),Et(p,R,r),f=p,u=[],d=[],o=kt(f.next);continue}if((p.f&ne)!==0&&zr(p),p!==o){if(l!==void 0&&l.has(p)){if(u.length<d.length){var w=d[0],x;f=w.prev;var ee=u[0],K=u[u.length-1];for(x=0;x<u.length;x+=1)Et(u[x],w,r);for(x=0;x<d.length;x+=1)l.delete(d[x]);Ze(e,ee.prev,K.next),Ze(e,f,ee),Ze(e,K,w),o=w,f=K,_-=1,u=[],d=[]}else l.delete(p),Et(p,o,r),Ze(e,p.prev,p.next),Ze(e,p,f===null?e.effect.first:f.next),Ze(e,f,p),f=p;continue}for(u=[],d=[];o!==null&&o!==p;)(l??=new Set).add(o),d.push(o),o=kt(o.next);if(o===null)continue}(p.f&Be)===0&&u.push(p),f=p,o=kt(p.next)}if(e.outrogroups!==null){for(const M of e.outrogroups)M.pending.size===0&&(Ir(Dt(M.done)),e.outrogroups?.delete(M));e.outrogroups.size===0&&(e.outrogroups=null)}if(o!==null||l!==void 0){var Y=[];if(l!==void 0)for(p of l)(p.f&ne)===0&&Y.push(p);for(;o!==null;)(o.f&ne)===0&&o!==e.fallback&&Y.push(o),o=kt(o.next);var Ne=Y.length;if(Ne>0){var Ae=null;yi(e,Y,Ae)}}}function Si(e,t,r,n,s,i,a,o){var l=(a&ms)!==0?(a&bs)===0?$n(r,!1,!1):rt(r):null,f=(a&_s)!==0?rt(s):null;return{v:l,i:f,e:ue(()=>(i(t,l??r,f??s,o),()=>{e.delete(n)}))}}function Et(e,t,r){if(e.nodes)for(var n=e.nodes.start,s=e.nodes.end,i=t&&(t.f&Be)===0?t.nodes.start:r;n!==null;){var a=ke(n);if(i.before(n),n===s)return;n=a}}function Ze(e,t,r){t===null?e.effect.first=r:t.next=r,r===null?e.effect.last=t:r.prev=t}function ss(e,t){Ln(()=>{var r=e.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+t.hash)){const s=document.createElement("style");s.id=t.hash,s.textContent=t.code,n.appendChild(s)}})}const is=[...`
3
- \r\f \v\uFEFF`];function ki(e,t,r){var n=e==null?"":""+e;if(r){for(var s in r)if(r[s])n=n?n+" "+s:s;else if(n.length)for(var i=s.length,a=0;(a=n.indexOf(s,a))>=0;){var o=a+i;(a===0||is.includes(n[a-1]))&&(o===n.length||is.includes(n[o]))?n=(a===0?"":n.substring(0,a))+n.substring(o+1):a=o}}return n===""?null:n}function as(e,t=!1){var r=t?" !important;":";",n="";for(var s in e){var i=e[s];i!=null&&i!==""&&(n+=" "+s+": "+i+r)}return n}function Lr(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function Ei(e,t){if(t){var r="",n,s;if(Array.isArray(t)?(n=t[0],s=t[1]):n=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var i=!1,a=0,o=!1,l=[];n&&l.push(...Object.keys(n).map(Lr)),s&&l.push(...Object.keys(s).map(Lr));var f=0,u=-1;const _=e.length;for(var d=0;d<_;d++){var h=e[d];if(o?h==="/"&&e[d-1]==="*"&&(o=!1):i?i===h&&(i=!1):h==="/"&&e[d+1]==="*"?o=!0:h==='"'||h==="'"?i=h:h==="("?a++:h===")"&&a--,!o&&i===!1&&a===0){if(h===":"&&u===-1)u=d;else if(h===";"||d===_-1){if(u!==-1){var g=Lr(e.substring(f,u).trim());if(!l.includes(g)){h!==";"&&d++;var p=e.substring(f,d).trim();r+=" "+p+";"}}f=d+1,u=-1}}}}return n&&(r+=as(n)),s&&(r+=as(s,!0)),r=r.trim(),r===""?null:r}return e==null?null:String(e)}function _t(e,t,r,n,s,i){var a=e.__className;if(k||a!==r||a===void 0){var o=ki(r,n,i);(!k||o!==e.getAttribute("class"))&&(o==null?e.removeAttribute("class"):e.className=o),e.__className=r}else if(i&&s!==i)for(var l in i){var f=!!i[l];(s==null||f!==!!s[l])&&e.classList.toggle(l,f)}return i}function Dr(e,t={},r,n){for(var s in r){var i=r[s];t[s]!==i&&(r[s]==null?e.style.removeProperty(s):e.style.setProperty(s,i,n))}}function Or(e,t,r,n){var s=e.__style;if(k||s!==t){var i=Ei(t,n);(!k||i!==e.getAttribute("style"))&&(i==null?e.removeAttribute("style"):e.style.cssText=i),e.__style=t}else n&&(Array.isArray(n)?(Dr(e,r?.[0],n[0]),Dr(e,r?.[1],n[1],"important")):Dr(e,r,n));return n}const Ci=Symbol("is custom element"),Ai=Symbol("is html");function er(e,t,r,n){var s=zi(e);k&&(s[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||s[t]!==(s[t]=r)&&(t==="loading"&&(e[Ts]=r),r==null?e.removeAttribute(t):typeof r!="string"&&Ti(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function zi(e){return e.__attributes??={[Ci]:e.nodeName.includes("-"),[Ai]:e.namespaceURI===xs}}var os=new Map;function Ti(e){var t=e.getAttribute("is")||e.nodeName,r=os.get(t);if(r)return r;os.set(t,r=[]);for(var n,s=e,i=Element.prototype;i!==s;){n=Ss(s);for(var a in n)n[a].set&&r.push(a);s=en(s)}return r}function ls(e,t){return e===t||e?.[jt]===t}function Nr(e={},t,r,n){return Ln(()=>{var s,i;return Cr(()=>{s=i,i=[],Tr(()=>{e!==r(...i)&&(t(e,...i),s&&ls(r(...s),e)&&t(null,...s))})}),()=>{tt(()=>{i&&ls(r(...i),e)&&t(null,...i)})}}),e}function G(e,t,r,n){var s=n,i=!0,a=()=>(i&&(i=!1,s=n),s),o;o=e[t],o===void 0&&n!==void 0&&(o=a());var l;l=()=>{var h=e[t];return h===void 0?a():(i=!0,h)};var f=!1,u=Yt(()=>(f=!1,l())),d=E;return(function(h,g){if(arguments.length>0){const p=g?c(u):h;return m(u,p),f=!0,s!==void 0&&(s=p),h}return We&&f||(d.f&Me)!==0?u.v:c(u)})}function Ri(e){return new Mi(e)}class Mi{#e;#t;constructor(t){var r=new Map,n=(i,a)=>{var o=$n(a,!1,!1);return r.set(i,o),o};const s=new Proxy({...t.props||{},$$events:{}},{get(i,a){return c(r.get(a)??n(a,Reflect.get(i,a)))},has(i,a){return a===zs?!0:(c(r.get(a)??n(a,Reflect.get(i,a))),Reflect.has(i,a))},set(i,a,o){return m(r.get(a)??n(a,o),o),Reflect.set(i,a,o)}});this.#t=(t.hydrate?_i:es)(t.component,{target:t.target,anchor:t.anchor,props:s,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&W(),this.#e=s.$$events;for(const i of Object.keys(this.#t))i==="$set"||i==="$destroy"||i==="$on"||Nt(this,i,{get(){return this.#t[i]},set(a){this.#t[i]=a},enumerable:!0});this.#t.$set=i=>{Object.assign(s,i)},this.#t.$destroy=()=>{bi(this.#t)}}$set(t){this.#t.$set(t)}$on(t,r){this.#e[t]=this.#e[t]||[];const n=(...s)=>r.call(this,...s);return this.#e[t].push(n),()=>{this.#e[t]=this.#e[t].filter(s=>s!==n)}}$destroy(){this.#t.$destroy()}}let cs;typeof HTMLElement=="function"&&(cs=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(e,t,r){super(),this.$$ctor=e,this.$$s=t,r&&(this.$$shadowRoot=this.attachShadow(r))}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const n=this.$$l_u.get(t);n&&(n(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return s=>{const i=document.createElement("slot");n!=="default"&&(i.name=n),L(s,i)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},r=Ii(this);for(const n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=e(n),t.default=!0):t[n]=e(n));for(const n of this.attributes){const s=this.$$g_p(n.name);s in this.$$d||(this.$$d[s]=tr(s,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=Ri({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=oi(()=>{Cr(()=>{this.$$r=!0;for(const n of Ot(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];const s=tr(n,this.$$d[n],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,s)}this.$$r=!1})});for(const n in this.$$l)for(const s of this.$$l[n]){const i=this.$$c.$on(n,s);this.$$l_u.set(s,i)}this.$$l={}}}attributeChangedCallback(e,t,r){this.$$r||(e=this.$$g_p(e),this.$$d[e]=tr(e,r,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return Ot(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function tr(e,t,r,n){const s=r[e]?.type;if(t=s==="Boolean"&&typeof t!="boolean"?t!=null:t,!n||!r[e])return t;if(n==="toAttribute")switch(s){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(s){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function Ii(e){const t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}function fs(e,t,r,n,s,i){let a=class extends cs{constructor(){super(e,r,s),this.$$p_d=t}static get observedAttributes(){return Ot(t).map(o=>(t[o].attribute||o).toLowerCase())}};return Ot(t).forEach(o=>{Nt(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(l){l=tr(o,l,t),this.$$d[o]=l;var f=this.$$c;if(f){var u=ft(f,o)?.get;u?f[o]=l:f.$set({[o]:l})}}})}),n.forEach(o=>{Nt(a.prototype,o,{get(){return this.$$c?.[o]}})}),e.element=a,a}const Li=50,Ct=5;class us{consoleErrors=[];attachments=[];mediaRecorder=null;recordingChunks=[];mediaStream=null;originalConsoleError;originalConsoleWarn;isCapturingConsole=!1;constructor(){this.originalConsoleError=console.error,this.originalConsoleWarn=console.warn}startConsoleCapture(){this.isCapturingConsole||(this.isCapturingConsole=!0,console.error=(...t)=>{this.captureLog("error",t),this.originalConsoleError.apply(console,t)},console.warn=(...t)=>{this.captureLog("warn",t),this.originalConsoleWarn.apply(console,t)})}stopConsoleCapture(){this.isCapturingConsole&&(this.isCapturingConsole=!1,console.error=this.originalConsoleError,console.warn=this.originalConsoleWarn)}captureLog(t,r){const n={level:t,message:r.map(s=>this.stringifyArg(s)).join(" "),timestamp:Date.now(),stack:new Error().stack};this.consoleErrors.push(n),this.consoleErrors.length>Li&&this.consoleErrors.shift()}stringifyArg(t){if(t===null)return"null";if(t===void 0)return"undefined";if(typeof t=="string")return t;if(t instanceof Error)return`${t.name}: ${t.message}`;try{return JSON.stringify(t)}catch{return String(t)}}getConsoleErrors(){return[...this.consoleErrors]}clearConsoleErrors(){this.consoleErrors=[]}getPageContext(){return{pageUrl:window.location.href,userAgent:navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight}}}isScreenRecordingSupported(){return!!navigator.mediaDevices?.getDisplayMedia}async startScreenRecording(){if(!this.isScreenRecordingSupported())throw new Error("Screen recording is not supported in this browser");try{const t=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!0,preferCurrentTab:!0});let r=null;try{r=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch{console.warn("[SDK] Microphone access denied or unavailable")}const n=new AudioContext,s=n.createMediaStreamDestination(),i=t.getAudioTracks()[0];if(i&&n.createMediaStreamSource(new MediaStream([i])).connect(s),r){const d=r.getAudioTracks()[0];d&&n.createMediaStreamSource(new MediaStream([d])).connect(s)}const a=new MediaStream,o=t.getVideoTracks()[0];o&&a.addTrack(o);const l=s.stream.getAudioTracks()[0];l&&a.addTrack(l),this.mediaStream=a,this.mediaStream._originalDisplayStream=t,this.mediaStream._originalMicStream=r,this.mediaStream._audioContext=n;const f=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm"];let u="video/webm";for(const d of f)if(MediaRecorder.isTypeSupported(d)){u=d;break}this.mediaRecorder=new MediaRecorder(a,{mimeType:u}),this.recordingChunks=[],this.mediaRecorder.ondataavailable=d=>{d.data.size>0&&this.recordingChunks.push(d.data)},this.mediaRecorder.start()}catch(t){throw console.error("[SDK] Screen recording failed:",t),new Error("Failed to start screen recording")}}async stopScreenRecording(){return new Promise(t=>{if(!this.mediaRecorder){t(null);return}this.mediaRecorder.onstop=()=>{if(this.mediaStream){for(const o of this.mediaStream.getTracks())o.stop();const n=this.mediaStream,s=n._originalDisplayStream;if(s)for(const o of s.getTracks())o.stop();const i=n._originalMicStream;if(i)for(const o of i.getTracks())o.stop();const a=n._audioContext;a&&a.close(),this.mediaStream=null}const r=new Blob(this.recordingChunks,{type:"video/webm"});this.recordingChunks=[],this.mediaRecorder=null,t(r)},this.mediaRecorder.stop()})}isRecording(){return this.mediaRecorder!==null&&this.mediaRecorder.state==="recording"}async captureScreenshot(){if(!this.isScreenRecordingSupported())return null;try{const t=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",width:{ideal:1920},height:{ideal:1080}},audio:!1}),r=document.createElement("video");r.srcObject=t,r.autoplay=!0,await new Promise(i=>{r.onloadedmetadata=i});const n=document.createElement("canvas");n.width=r.videoWidth,n.height=r.videoHeight;const s=n.getContext("2d");if(!s){for(const i of t.getTracks())i.stop();return null}s.drawImage(r,0,0);for(const i of t.getTracks())i.stop();return new Promise(i=>{n.toBlob(a=>i(a),"image/png")})}catch{return null}}async addAttachment(t){if(this.attachments.length>=Ct)return console.warn(`[SDK] Maximum ${Ct} attachments allowed`),null;const r=this.getAttachmentType(t.type);if(!r)return console.warn(`[SDK] Unsupported file type: ${t.type}`),null;const n=await this.fileToDataUrl(t),s={id:this.generateId(),name:t.name,type:r,size:t.size,dataUrl:n};return this.attachments.push(s),s}async addBlobAttachment(t,r){if(this.attachments.length>=Ct)return console.warn(`[SDK] Maximum ${Ct} attachments allowed`),null;const n=this.getAttachmentType(t.type);if(!n)return console.warn(`[SDK] Unsupported blob type: ${t.type}`),null;const s=await this.blobToDataUrl(t),i={id:this.generateId(),name:r,type:n,size:t.size,dataUrl:s};return this.attachments.push(i),i}removeAttachment(t){const r=this.attachments.findIndex(n=>n.id===t);return r!==-1?(this.attachments.splice(r,1),!0):!1}getAttachments(){return[...this.attachments]}clearAttachments(){this.attachments=[]}canAddAttachment(){return this.attachments.length<Ct}getAttachmentType(t){return t.startsWith("image/")?"image":t.startsWith("audio/")?"audio":t.startsWith("video/")?"video":null}generateId(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}fileToDataUrl(t){return new Promise((r,n)=>{const s=new FileReader;s.onload=()=>r(s.result),s.onerror=n,s.readAsDataURL(t)})}blobToDataUrl(t){return new Promise((r,n)=>{const s=new FileReader;s.onload=()=>r(s.result),s.onerror=n,s.readAsDataURL(t)})}destroy(){this.stopConsoleCapture(),this.isRecording()&&this.stopScreenRecording(),this.clearConsoleErrors(),this.clearAttachments()}}let Pr=null;function Fr(){return Pr||(Pr=new us),Pr}var Di=F('<button class="recording-btn svelte-1105cax" aria-label="Stop recording"><span class="recording-dot svelte-1105cax"></span> <span class="recording-time svelte-1105cax"> </span> <span class="stop-label svelte-1105cax">Stop</span></button>'),Oi=F('<span class="unread-badge svelte-1105cax"> </span>'),Ni=Qt('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-1105cax"><path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" class="svelte-1105cax"></path></svg>'),Pi=Qt('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-1105cax"><path fill-rule="evenodd" d="M4.804 21.644A6.707 6.707 0 0 0 6 21.75a6.721 6.721 0 0 0 3.583-1.029c.774.182 1.584.279 2.417.279 5.322 0 9.75-3.97 9.75-9 0-5.03-4.428-9-9.75-9s-9.75 3.97-9.75 9c0 2.409 1.025 4.587 2.674 6.192.232.226.277.428.254.543a3.73 3.73 0 0 1-.814 1.686.75.75 0 0 0 .44 1.223ZM8.25 10.875a1.125 1.125 0 1 0 0 2.25 1.125 1.125 0 0 0 0-2.25ZM10.875 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Zm4.875-1.125a1.125 1.125 0 1 0 0 2.25 1.125 1.125 0 0 0 0-2.25Z" clip-rule="evenodd" class="svelte-1105cax"></path></svg>'),Fi=F('<button class="toggle-btn svelte-1105cax"><!> <!></button>'),Ui=F('<div class="loading-state svelte-1105cax"><div class="loading-spinner svelte-1105cax"></div> <p class="svelte-1105cax">Loading...</p></div>'),ji=F('<div class="support-chat svelte-1105cax"><!> <div><!> <iframe title="Support Chat" sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox" allow="clipboard-write; display-capture; microphone"></iframe></div></div>');const Bi={hash:"svelte-1105cax",code:`.svelte-1105cax {box-sizing:border-box;margin:0;padding:0;}.support-chat.svelte-1105cax {--primary-color: #6366f1;--shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1),
1
+ (function(b,Dt){typeof exports=="object"&&typeof module<"u"?Dt(exports):typeof define=="function"&&define.amd?define(["exports"],Dt):(b=typeof globalThis<"u"?globalThis:b||self,Dt(b.FortaleceAI={}))})(this,(function(b){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const _i=1,bi=2,wi=16,yi=1,$i=2,tr="[",Lt="[!",hn="]",ct={},B=Symbol(),Si="http://www.w3.org/1999/xhtml",pn=!1;var nr=Array.isArray,ki=Array.prototype.indexOf,ut=Array.prototype.includes,Pt=Array.from,Ft=Object.keys,Nt=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,Ei=Object.getOwnPropertyDescriptors,xi=Object.prototype,Ci=Array.prototype,rr=Object.getPrototypeOf,ir=Object.isExtensible;function Ai(e){for(var t=0;t<e.length;t++)e[t]()}function sr(){var e,t,n=new Promise((r,i)=>{e=r,t=i});return{promise:n,resolve:e,reject:t}}const H=2,Ut=4,jt=8,ar=1<<24,Me=16,_e=32,Be=64,vn=128,fe=512,U=1024,W=2048,be=4096,ie=8192,Ie=16384,Bt=32768,dt=65536,or=1<<17,lr=1<<18,Qe=1<<19,Ti=1<<20,He=1<<25,et=32768,gn=1<<21,mn=1<<22,We=1<<23,Ht=Symbol("$state"),zi=Symbol("legacy props"),Ri=Symbol(""),ht=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Wt=3,pt=8;function Mi(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ii(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Oi(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Di(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Li(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Pi(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Fi(){throw new Error("https://svelte.dev/e/hydration_failed")}function Ni(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Ui(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ji(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Bi(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function qt(e){console.warn("https://svelte.dev/e/hydration_mismatch")}function Hi(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let x=!1;function Oe(e){x=e}let E;function se(e){if(e===null)throw qt(),ct;return E=e}function Vt(){return se(xe(E))}function R(e){if(x){if(xe(E)!==null)throw qt(),ct;E=e}}function _n(e=1){if(x){for(var t=e,n=E;t--;)n=xe(n);E=n}}function Gt(e=!0){for(var t=0,n=E;;){if(n.nodeType===pt){var r=n.data;if(r===hn){if(t===0)return n;t-=1}else(r===tr||r===Lt)&&(t+=1)}var i=xe(n);e&&n.remove(),n=i}}function cr(e){if(!e||e.nodeType!==pt)throw qt(),ct;return e.data}function ur(e){return e===this.v}function Wi(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function fr(e){return!Wi(e,this.v)}let qi=!1,ae=null;function vt(e){ae=e}function bn(e,t=!1,n){ae={p:ae,i:!1,c:null,e:null,s:e,x:null,l:null}}function wn(e){var t=ae,n=t.e;if(n!==null){t.e=null;for(var r of n)Dr(r)}return e!==void 0&&(t.x=e),t.i=!0,ae=t.p,e??{}}function dr(){return!0}let tt=[];function hr(){var e=tt;tt=[],Ai(e)}function nt(e){if(tt.length===0&&!$t){var t=tt;queueMicrotask(()=>{t===tt&&hr()})}tt.push(e)}function Vi(){for(;tt.length>0;)hr()}function pr(e){var t=C;if(t===null)return k.f|=We,e;if((t.f&Bt)===0){if((t.f&vn)===0)throw e;t.b.error(e)}else gt(e,t)}function gt(e,t){for(;t!==null;){if((t.f&vn)!==0)try{t.b.error(e);return}catch(n){e=n}t=t.parent}throw e}const Gi=-7169;function N(e,t){e.f=e.f&Gi|t}function yn(e){(e.f&fe)!==0||e.deps===null?N(e,U):N(e,be)}function vr(e){if(e!==null)for(const t of e)(t.f&H)===0||(t.f&et)===0||(t.f^=et,vr(t.deps))}function gr(e,t,n){(e.f&W)!==0?t.add(e):(e.f&be)!==0&&n.add(e),vr(e.deps),N(e,U)}const Kt=new Set;let D=null,we=null,oe=[],Jt=null,$n=!1,$t=!1;class De{committed=!1;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=0;#a=0;#o=null;#i=new Set;#r=new Set;#s=new Map;is_fork=!1;#l=!1;is_deferred(){return this.is_fork||this.#a>0}skip_effect(t){this.#s.has(t)||this.#s.set(t,{d:[],m:[]})}unskip_effect(t){var n=this.#s.get(t);if(n){this.#s.delete(t);for(var r of n.d)N(r,W),ye(r);for(r of n.m)N(r,be),ye(r)}}process(t){oe=[],this.apply();var n=[],r=[];for(const i of t)this.#c(i,n,r);if(this.is_deferred()){this.#f(r),this.#f(n);for(const[i,s]of this.#s)yr(i,s)}else{for(const i of this.#e)i();this.#e.clear(),this.#n===0&&this.#u(),D=null,_r(r),_r(n),this.#o?.resolve()}we=null}#c(t,n,r){t.f^=U;for(var i=t.first,s=null;i!==null;){var a=i.f,o=(a&(_e|Be))!==0,l=o&&(a&U)!==0,u=l||(a&ie)!==0||this.#s.has(i);if(!u&&i.fn!==null){o?i.f^=U:s!==null&&(a&(Ut|jt|ar))!==0?s.b.defer_effect(i):(a&Ut)!==0?n.push(i):kt(i)&&((a&Me)!==0&&this.#r.add(i),Et(i));var f=i.first;if(f!==null){i=f;continue}}var d=i.parent;for(i=i.next;i===null&&d!==null;)d===s&&(s=null),i=d.next,d=d.parent}}#f(t){for(var n=0;n<t.length;n+=1)gr(t[n],this.#i,this.#r)}capture(t,n){n!==B&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&We)===0&&(this.current.set(t,t.v),we?.set(t,t.v))}activate(){D=this,this.apply()}deactivate(){D===this&&(D=null,we=null)}flush(){if(this.activate(),oe.length>0){if(mr(),D!==null&&D!==this)return}else this.#n===0&&this.process([]);this.deactivate()}discard(){for(const t of this.#t)t(this);this.#t.clear()}#u(){if(Kt.size>1){this.previous.clear();var t=we,n=!0;for(const i of Kt){if(i===this){n=!1;continue}const s=[];for(const[o,l]of this.current){if(i.current.has(o))if(n&&l!==i.current.get(o))i.current.set(o,l);else continue;s.push(o)}if(s.length===0)continue;const a=[...i.current.keys()].filter(o=>!this.current.has(o));if(a.length>0){var r=oe;oe=[];const o=new Set,l=new Map;for(const u of s)br(u,a,o,l);if(oe.length>0){D=i,i.apply();for(const u of oe)i.#c(u,[],[]);i.deactivate()}oe=r}}D=null,we=t}this.committed=!0,Kt.delete(this)}increment(t){this.#n+=1,t&&(this.#a+=1)}decrement(t){this.#n-=1,t&&(this.#a-=1),!this.#l&&(this.#l=!0,nt(()=>{this.#l=!1,this.is_deferred()?oe.length>0&&this.flush():this.revive()}))}revive(){for(const t of this.#i)this.#r.delete(t),N(t,W),ye(t);for(const t of this.#r)N(t,be),ye(t);this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#t.add(t)}settled(){return(this.#o??=sr()).promise}static ensure(){if(D===null){const t=D=new De;Kt.add(D),$t||nt(()=>{D===t&&t.flush()})}return D}apply(){}}function G(e){var t=$t;$t=!0;try{for(var n;;){if(Vi(),oe.length===0&&(D?.flush(),oe.length===0))return Jt=null,n;mr()}}finally{$t=t}}function mr(){$n=!0;var e=null;try{for(var t=0;oe.length>0;){var n=De.ensure();if(t++>1e3){var r,i;Ki()}n.process(oe),qe.clear()}}finally{$n=!1,Jt=null}}function Ki(){try{Pi()}catch(e){gt(e,Jt)}}let Le=null;function _r(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(Ie|ie))===0&&kt(r)&&(Le=new Set,Et(r),r.deps===null&&r.first===null&&r.nodes===null&&(r.teardown===null&&r.ac===null?Nr(r):r.fn=null),Le?.size>0)){qe.clear();for(const i of Le){if((i.f&(Ie|ie))!==0)continue;const s=[i];let a=i.parent;for(;a!==null;)Le.has(a)&&(Le.delete(a),s.push(a)),a=a.parent;for(let o=s.length-1;o>=0;o--){const l=s[o];(l.f&(Ie|ie))===0&&Et(l)}}Le.clear()}}Le=null}}function br(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const i of e.reactions){const s=i.f;(s&H)!==0?br(i,t,n,r):(s&(mn|Me))!==0&&(s&W)===0&&wr(i,t,r)&&(N(i,W),ye(i))}}function wr(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const i of e.deps){if(ut.call(t,i))return!0;if((i.f&H)!==0&&wr(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function ye(e){for(var t=Jt=e;t.parent!==null;){t=t.parent;var n=t.f;if($n&&t===C&&(n&Me)!==0&&(n&lr)===0)return;if((n&(Be|_e))!==0){if((n&U)===0)return;t.f^=U}}oe.push(t)}function yr(e,t){if(!((e.f&_e)!==0&&(e.f&U)!==0)){(e.f&W)!==0?t.d.push(e):(e.f&be)!==0&&t.m.push(e),N(e,U);for(var n=e.first;n!==null;)yr(n,t),n=n.next}}function Ji(e){let t=0,n=rt(0),r;return()=>{An()&&(c(n),Tn(()=>(t===0&&(r=Mn(()=>e(()=>St(n)))),t+=1,()=>{nt(()=>{t-=1,t===0&&(r?.(),r=void 0,St(n))})})))}}var Yi=dt|Qe|vn;function Zi(e,t,n){new Xi(e,t,n)}class Xi{parent;is_pending=!1;#e;#t=x?E:null;#n;#a;#o;#i=null;#r=null;#s=null;#l=null;#c=null;#f=0;#u=0;#p=!1;#h=!1;#v=new Set;#g=new Set;#d=null;#y=Ji(()=>(this.#d=rt(this.#f),()=>{this.#d=null}));constructor(t,n,r){this.#e=t,this.#n=n,this.#a=r,this.parent=C.b,this.is_pending=!!this.#n.pending,this.#o=zn(()=>{if(C.b=this,x){const s=this.#t;Vt(),s.nodeType===pt&&s.data===Lt?this.#S():(this.#$(),this.#u===0&&(this.is_pending=!1))}else{var i=this.#b();try{this.#i=de(()=>r(i))}catch(s){this.error(s)}this.#u>0?this.#_():this.is_pending=!1}return()=>{this.#c?.remove()}},Yi),x&&(this.#e=E)}#$(){try{this.#i=de(()=>this.#a(this.#e))}catch(t){this.error(t)}}#S(){const t=this.#n.pending;t&&(this.#r=de(()=>t(this.#e)),nt(()=>{var n=this.#b();this.#i=this.#m(()=>(De.ensure(),de(()=>this.#a(n)))),this.#u>0?this.#_():(it(this.#r,()=>{this.#r=null}),this.is_pending=!1)}))}#b(){var t=this.#e;return this.is_pending&&(this.#c=Se(),this.#e.before(this.#c),t=this.#c),t}defer_effect(t){gr(t,this.#v,this.#g)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#m(t){var n=C,r=k,i=ae;Ae(this.#o),he(this.#o),vt(this.#o.ctx);try{return t()}catch(s){return pr(s),null}finally{Ae(n),he(r),vt(i)}}#_(){const t=this.#n.pending;this.#i!==null&&(this.#l=document.createDocumentFragment(),this.#l.append(this.#c),Br(this.#i,this.#l)),this.#r===null&&(this.#r=de(()=>t(this.#e)))}#w(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#w(t);return}if(this.#u+=t,this.#u===0){this.is_pending=!1;for(const n of this.#v)N(n,W),ye(n);for(const n of this.#g)N(n,be),ye(n);this.#v.clear(),this.#g.clear(),this.#r&&it(this.#r,()=>{this.#r=null}),this.#l&&(this.#e.before(this.#l),this.#l=null)}}update_pending_count(t){this.#w(t),this.#f+=t,!(!this.#d||this.#p)&&(this.#p=!0,nt(()=>{this.#p=!1,this.#d&&mt(this.#d,this.#f)}))}get_effect_pending(){return this.#y(),c(this.#d)}error(t){var n=this.#n.onerror;let r=this.#n.failed;if(this.#h||!n&&!r)throw t;this.#i&&(Y(this.#i),this.#i=null),this.#r&&(Y(this.#r),this.#r=null),this.#s&&(Y(this.#s),this.#s=null),x&&(se(this.#t),_n(),se(Gt()));var i=!1,s=!1;const a=()=>{if(i){Hi();return}i=!0,s&&Bi(),De.ensure(),this.#f=0,this.#s!==null&&it(this.#s,()=>{this.#s=null}),this.is_pending=this.has_pending_snippet(),this.#i=this.#m(()=>(this.#h=!1,de(()=>this.#a(this.#e)))),this.#u>0?this.#_():this.is_pending=!1};nt(()=>{try{s=!0,n?.(t,a),s=!1}catch(o){gt(o,this.#o&&this.#o.parent)}r&&(this.#s=this.#m(()=>{De.ensure(),this.#h=!0;try{return de(()=>{r(this.#e,()=>t,()=>a)})}catch(o){return gt(o,this.#o.parent),null}finally{this.#h=!1}}))})}}function Qi(e,t,n,r){const i=Yt;var s=e.filter(h=>!h.settled);if(n.length===0&&s.length===0){r(t.map(i));return}var a=D,o=C,l=es(),u=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(h=>h.promise)):null;function f(h){l();try{r(h)}catch(g){(o.f&Ie)===0&&gt(g,o)}a?.deactivate(),Sn()}if(n.length===0){u.then(()=>f(t.map(i)));return}function d(){l(),Promise.all(n.map(h=>ts(h))).then(h=>f([...t.map(i),...h])).catch(h=>gt(h,o))}u?u.then(d):d()}function es(){var e=C,t=k,n=ae,r=D;return function(s=!0){Ae(e),he(t),vt(n),s&&r?.activate()}}function Sn(){Ae(null),he(null),vt(null)}function Yt(e){var t=H|W,n=k!==null&&(k.f&H)!==0?k:null;return C!==null&&(C.f|=Qe),{ctx:ae,deps:null,effects:null,equals:ur,f:t,fn:e,reactions:null,rv:0,v:B,wv:0,parent:n??C,ac:null}}function ts(e,t,n){let r=C;r===null&&Ii();var i=r.b,s=void 0,a=rt(B),o=!k,l=new Map;return us(()=>{var u=sr();s=u.promise;try{Promise.resolve(e()).then(u.resolve,u.reject).then(()=>{f===D&&f.committed&&f.deactivate(),Sn()})}catch(g){u.reject(g),Sn()}var f=D;if(o){var d=i.is_rendered();i.update_pending_count(1),f.increment(d),l.get(f)?.reject(ht),l.delete(f),l.set(f,u)}const h=(g,p=void 0)=>{if(f.activate(),p)p!==ht&&(a.f|=We,mt(a,p));else{(a.f&We)!==0&&(a.f^=We),mt(a,g);for(const[_,I]of l){if(l.delete(_),_===f)break;I.reject(ht)}}o&&(i.update_pending_count(-1),f.decrement(d))};u.promise.then(h,g=>h(null,g||"unknown"))}),os(()=>{for(const u of l.values())u.reject(ht)}),new Promise(u=>{function f(d){function h(){d===s?u(a):f(s)}d.then(h,h)}f(s)})}function $e(e){const t=Yt(e);return Wr(t),t}function ns(e){const t=Yt(e);return t.equals=fr,t}function $r(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Y(t[n])}}function rs(e){for(var t=e.parent;t!==null;){if((t.f&H)===0)return(t.f&Ie)===0?t:null;t=t.parent}return null}function kn(e){var t,n=C;Ae(rs(e));try{e.f&=~et,$r(e),t=Jr(e)}finally{Ae(n)}return t}function Sr(e){var t=kn(e);if(!e.equals(t)&&(e.wv=Gr(),(!D?.is_fork||e.deps===null)&&(e.v=t,e.deps===null))){N(e,U);return}Ge||(we!==null?(An()||D?.is_fork)&&we.set(e,t):yn(e))}let En=new Set;const qe=new Map;let kr=!1;function rt(e,t){var n={f:0,v:e,reactions:null,equals:ur,rv:0,wv:0};return n}function T(e,t){const n=rt(e);return Wr(n),n}function Er(e,t=!1,n=!0){const r=rt(e);return t||(r.equals=fr),r}function m(e,t,n=!1){k!==null&&(!ke||(k.f&or)!==0)&&dr()&&(k.f&(H|Me|mn|or))!==0&&(pe===null||!ut.call(pe,e))&&ji();let r=n?Pe(t):t;return mt(e,r)}function mt(e,t){if(!e.equals(t)){var n=e.v;Ge?qe.set(e,t):qe.set(e,n),e.v=t;var r=De.ensure();if(r.capture(e,n),(e.f&H)!==0){const i=e;(e.f&W)!==0&&kn(i),yn(i)}e.wv=Gr(),xr(e,W),C!==null&&(C.f&U)!==0&&(C.f&(_e|Be))===0&&(ve===null?hs([e]):ve.push(e)),!r.is_fork&&En.size>0&&!kr&&is()}return t}function is(){kr=!1;for(const e of En)(e.f&U)!==0&&N(e,be),kt(e)&&Et(e);En.clear()}function St(e){m(e,e.v+1)}function xr(e,t){var n=e.reactions;if(n!==null)for(var r=n.length,i=0;i<r;i++){var s=n[i],a=s.f,o=(a&W)===0;if(o&&N(s,t),(a&H)!==0){var l=s;we?.delete(l),(a&et)===0&&(a&fe&&(s.f|=et),xr(l,be))}else o&&((a&Me)!==0&&Le!==null&&Le.add(s),ye(s))}}function Pe(e){if(typeof e!="object"||e===null||Ht in e)return e;const t=rr(e);if(t!==xi&&t!==Ci)return e;var n=new Map,r=nr(e),i=T(0),s=at,a=o=>{if(at===s)return o();var l=k,u=at;he(null),Vr(s);var f=o();return he(l),Vr(u),f};return r&&n.set("length",T(e.length)),new Proxy(e,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&Ni();var f=n.get(l);return f===void 0?f=a(()=>{var d=T(u.value);return n.set(l,d),d}):m(f,u.value,!0),!0},deleteProperty(o,l){var u=n.get(l);if(u===void 0){if(l in o){const f=a(()=>T(B));n.set(l,f),St(i)}}else m(u,B),St(i);return!0},get(o,l,u){if(l===Ht)return e;var f=n.get(l),d=l in o;if(f===void 0&&(!d||ft(o,l)?.writable)&&(f=a(()=>{var g=Pe(d?o[l]:B),p=T(g);return p}),n.set(l,f)),f!==void 0){var h=c(f);return h===B?void 0:h}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var f=n.get(l);f&&(u.value=c(f))}else if(u===void 0){var d=n.get(l),h=d?.v;if(d!==void 0&&h!==B)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return u},has(o,l){if(l===Ht)return!0;var u=n.get(l),f=u!==void 0&&u.v!==B||Reflect.has(o,l);if(u!==void 0||C!==null&&(!f||ft(o,l)?.writable)){u===void 0&&(u=a(()=>{var h=f?Pe(o[l]):B,g=T(h);return g}),n.set(l,u));var d=c(u);if(d===B)return!1}return f},set(o,l,u,f){var d=n.get(l),h=l in o;if(r&&l==="length")for(var g=u;g<d.v;g+=1){var p=n.get(g+"");p!==void 0?m(p,B):g in o&&(p=a(()=>T(B)),n.set(g+"",p))}if(d===void 0)(!h||ft(o,l)?.writable)&&(d=a(()=>T(void 0)),m(d,Pe(u)),n.set(l,d));else{h=d.v!==B;var _=a(()=>Pe(u));m(d,_)}var I=Reflect.getOwnPropertyDescriptor(o,l);if(I?.set&&I.set.call(f,u),!h){if(r&&typeof l=="string"){var y=n.get("length"),S=Number(l);Number.isInteger(S)&&S>=y.v&&m(y,S+1)}St(i)}return!0},ownKeys(o){c(i);var l=Reflect.ownKeys(o).filter(d=>{var h=n.get(d);return h===void 0||h.v!==B});for(var[u,f]of n)f.v!==B&&!(u in o)&&l.push(u);return l},setPrototypeOf(){Ui()}})}var Cr,Ar,Tr,zr;function xn(){if(Cr===void 0){Cr=window,Ar=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Tr=ft(t,"firstChild").get,zr=ft(t,"nextSibling").get,ir(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),ir(n)&&(n.__t=void 0)}}function Se(e=""){return document.createTextNode(e)}function Ve(e){return Tr.call(e)}function xe(e){return zr.call(e)}function M(e,t){if(!x)return Ve(e);var n=Ve(E);if(n===null)n=E.appendChild(Se());else if(t&&n.nodeType!==Wt){var r=Se();return n?.before(r),se(r),r}return t&&Cn(n),se(n),n}function Rr(e,t=!1){if(!x){var n=Ve(e);return n instanceof Comment&&n.data===""?xe(n):n}if(t){if(E?.nodeType!==Wt){var r=Se();return E?.before(r),se(r),r}Cn(E)}return E}function F(e,t=1,n=!1){let r=x?E:e;for(var i;t--;)i=r,r=xe(r);if(!x)return r;if(n){if(r?.nodeType!==Wt){var s=Se();return r===null?i?.after(s):r.before(s),se(s),s}Cn(r)}return se(r),r}function Mr(e){e.textContent=""}function Ir(){return!1}function Cn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===Wt;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Or(e){var t=k,n=C;he(null),Ae(null);try{return e()}finally{he(t),Ae(n)}}function ss(e){C===null&&(k===null&&Li(),Di()),Ge&&Oi()}function as(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Ce(e,t,n){var r=C;r!==null&&(r.f&ie)!==0&&(e|=ie);var i={ctx:ae,deps:null,nodes:null,f:e|W|fe,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{Et(i),i.f|=Bt}catch(o){throw Y(i),o}else t!==null&&ye(i);var s=i;if(n&&s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&(s.f&Qe)===0&&(s=s.first,(e&Me)!==0&&(e&dt)!==0&&s!==null&&(s.f|=dt)),s!==null&&(s.parent=r,r!==null&&as(s,r),k!==null&&(k.f&H)!==0&&(e&Be)===0)){var a=k;(a.effects??=[]).push(s)}return i}function An(){return k!==null&&!ke}function os(e){const t=Ce(jt,null,!1);return N(t,U),t.teardown=e,t}function Zt(e){ss();var t=C.f,n=!k&&(t&_e)!==0&&(t&Bt)===0;if(n){var r=ae;(r.e??=[]).push(e)}else return Dr(e)}function Dr(e){return Ce(Ut|Ti,e,!1)}function ls(e){De.ensure();const t=Ce(Be|Qe,e,!0);return()=>{Y(t)}}function cs(e){De.ensure();const t=Ce(Be|Qe,e,!0);return(n={})=>new Promise(r=>{n.outro?it(t,()=>{Y(t),r(void 0)}):(Y(t),r(void 0))})}function Lr(e){return Ce(Ut,e,!1)}function us(e){return Ce(mn|Qe,e,!0)}function Tn(e,t=0){return Ce(jt|t,e,!0)}function Q(e,t=[],n=[],r=[]){Qi(r,t,n,i=>{Ce(jt,()=>e(...i.map(c)),!0)})}function zn(e,t=0){var n=Ce(Me|t,e,!0);return n}function de(e){return Ce(_e|Qe,e,!0)}function Pr(e){var t=e.teardown;if(t!==null){const n=Ge,r=k;Hr(!0),he(null);try{t.call(null)}finally{Hr(n),he(r)}}}function Fr(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const i=n.ac;i!==null&&Or(()=>{i.abort(ht)});var r=n.next;(n.f&Be)!==0?n.parent=null:Y(n,t),n=r}}function fs(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&_e)===0&&Y(t),t=n}}function Y(e,t=!0){var n=!1;(t||(e.f&lr)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(ds(e.nodes.start,e.nodes.end),n=!0),Fr(e,t&&!n),Qt(e,0),N(e,Ie);var r=e.nodes&&e.nodes.t;if(r!==null)for(const s of r)s.stop();Pr(e);var i=e.parent;i!==null&&i.first!==null&&Nr(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function ds(e,t){for(;e!==null;){var n=e===t?null:xe(e);e.remove(),e=n}}function Nr(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function it(e,t,n=!0){var r=[];Ur(e,r,!0);var i=()=>{n&&Y(e),t&&t()},s=r.length;if(s>0){var a=()=>--s||i();for(var o of r)o.out(a)}else i()}function Ur(e,t,n){if((e.f&ie)===0){e.f^=ie;var r=e.nodes&&e.nodes.t;if(r!==null)for(const o of r)(o.is_global||n)&&t.push(o);for(var i=e.first;i!==null;){var s=i.next,a=(i.f&dt)!==0||(i.f&_e)!==0&&(e.f&Me)!==0;Ur(i,t,a?n:!1),i=s}}}function Rn(e){jr(e,!0)}function jr(e,t){if((e.f&ie)!==0){e.f^=ie,(e.f&U)===0&&(N(e,W),ye(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&dt)!==0||(n.f&_e)!==0;jr(n,i?t:!1),n=r}var s=e.nodes&&e.nodes.t;if(s!==null)for(const a of s)(a.is_global||t)&&a.in()}}function Br(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:xe(n);t.append(n),n=i}}let Xt=!1,Ge=!1;function Hr(e){Ge=e}let k=null,ke=!1;function he(e){k=e}let C=null;function Ae(e){C=e}let pe=null;function Wr(e){k!==null&&(pe===null?pe=[e]:pe.push(e))}let ee=null,le=0,ve=null;function hs(e){ve=e}let qr=1,st=0,at=st;function Vr(e){at=e}function Gr(){return++qr}function kt(e){var t=e.f;if((t&W)!==0)return!0;if(t&H&&(e.f&=~et),(t&be)!==0){for(var n=e.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(kt(s)&&Sr(s),s.wv>e.wv)return!0}(t&fe)!==0&&we===null&&N(e,U)}return!1}function Kr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(pe!==null&&ut.call(pe,e)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&H)!==0?Kr(s,t,!1):t===s&&(n?N(s,W):(s.f&U)!==0&&N(s,be),ye(s))}}function Jr(e){var t=ee,n=le,r=ve,i=k,s=pe,a=ae,o=ke,l=at,u=e.f;ee=null,le=0,ve=null,k=(u&(_e|Be))===0?e:null,pe=null,vt(e.ctx),ke=!1,at=++st,e.ac!==null&&(Or(()=>{e.ac.abort(ht)}),e.ac=null);try{e.f|=gn;var f=e.fn,d=f(),h=e.deps,g=D?.is_fork;if(ee!==null){var p;if(g||Qt(e,le),h!==null&&le>0)for(h.length=le+ee.length,p=0;p<ee.length;p++)h[le+p]=ee[p];else e.deps=h=ee;if(An()&&(e.f&fe)!==0)for(p=le;p<h.length;p++)(h[p].reactions??=[]).push(e)}else!g&&h!==null&&le<h.length&&(Qt(e,le),h.length=le);if(dr()&&ve!==null&&!ke&&h!==null&&(e.f&(H|be|W))===0)for(p=0;p<ve.length;p++)Kr(ve[p],e);if(i!==null&&i!==e){if(st++,i.deps!==null)for(let _=0;_<n;_+=1)i.deps[_].rv=st;if(t!==null)for(const _ of t)_.rv=st;ve!==null&&(r===null?r=ve:r.push(...ve))}return(e.f&We)!==0&&(e.f^=We),d}catch(_){return pr(_)}finally{e.f^=gn,ee=t,le=n,ve=r,k=i,pe=s,vt(a),ke=o,at=l}}function ps(e,t){let n=t.reactions;if(n!==null){var r=ki.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&(t.f&H)!==0&&(ee===null||!ut.call(ee,t))){var s=t;(s.f&fe)!==0&&(s.f^=fe,s.f&=~et),yn(s),$r(s),Qt(s,0)}}function Qt(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)ps(e,n[r])}function Et(e){var t=e.f;if((t&Ie)===0){N(e,U);var n=C,r=Xt;C=e,Xt=!0;try{(t&(Me|ar))!==0?fs(e):Fr(e),Pr(e);var i=Jr(e);e.teardown=typeof i=="function"?i:null,e.wv=qr;var s;pn&&qi&&(e.f&W)!==0&&e.deps}finally{Xt=r,C=n}}}function c(e){var t=e.f,n=(t&H)!==0;if(k!==null&&!ke){var r=C!==null&&(C.f&Ie)!==0;if(!r&&(pe===null||!ut.call(pe,e))){var i=k.deps;if((k.f&gn)!==0)e.rv<st&&(e.rv=st,ee===null&&i!==null&&i[le]===e?le++:ee===null?ee=[e]:ee.push(e));else{(k.deps??=[]).push(e);var s=e.reactions;s===null?e.reactions=[k]:ut.call(s,k)||s.push(k)}}}if(Ge&&qe.has(e))return qe.get(e);if(n){var a=e;if(Ge){var o=a.v;return((a.f&U)===0&&a.reactions!==null||Zr(a))&&(o=kn(a)),qe.set(a,o),o}var l=(a.f&fe)===0&&!ke&&k!==null&&(Xt||(k.f&fe)!==0),u=a.deps===null;kt(a)&&(l&&(a.f|=fe),Sr(a)),l&&!u&&Yr(a)}if(we?.has(e))return we.get(e);if((e.f&We)!==0)throw e.v;return e.v}function Yr(e){if(e.deps!==null){e.f|=fe;for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&H)!==0&&(t.f&fe)===0&&Yr(t)}}function Zr(e){if(e.v===B)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(qe.has(t)||(t.f&H)!==0&&Zr(t))return!0;return!1}function Mn(e){var t=ke;try{return ke=!0,e()}finally{ke=t}}const Xr=new Set,In=new Set;function Qr(e){for(var t=0;t<e.length;t++)Xr.add(e[t]);for(var n of In)n(e)}let ei=null;function en(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],s=i[0]||e.target;ei=e;var a=0,o=ei===e&&e.__root;if(o){var l=i.indexOf(o);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var u=i.indexOf(t);if(u===-1)return;l<=u&&(a=l)}if(s=i[a]||e.target,s!==t){Nt(e,"currentTarget",{configurable:!0,get(){return s||n}});var f=k,d=C;he(null),Ae(null);try{for(var h,g=[];s!==null;){var p=s.assignedSlot||s.parentNode||s.host||null;try{var _=s["__"+r];_!=null&&(!s.disabled||e.target===s)&&_.call(s,e)}catch(I){h?g.push(I):h=I}if(e.cancelBubble||p===t||p===null)break;s=p}if(h){for(let I of g)queueMicrotask(()=>{throw I});throw h}}finally{e.__root=t,delete e.currentTarget,he(f),Ae(d)}}}function ti(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function Ke(e,t){var n=C;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function j(e,t){var n=(t&yi)!==0,r=(t&$i)!==0,i,s=!e.startsWith("<!>");return()=>{if(x)return Ke(E,null),E;i===void 0&&(i=ti(s?e:"<!>"+e),n||(i=Ve(i)));var a=r||Ar?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=Ve(a),l=a.lastChild;Ke(o,l)}else Ke(a,a);return a}}function vs(e,t,n="svg"){var r=!e.startsWith("<!>"),i=`<${n}>${r?e:"<!>"+e}</${n}>`,s;return()=>{if(x)return Ke(E,null),E;if(!s){var a=ti(i),o=Ve(a);s=Ve(o)}var l=s.cloneNode(!0);return Ke(l,l),l}}function tn(e,t){return vs(e,t,"svg")}function gs(){if(x)return Ke(E,null),E;var e=document.createDocumentFragment(),t=document.createComment(""),n=Se();return e.append(t,n),Ke(t,n),e}function L(e,t){if(x){var n=C;((n.f&Bt)===0||n.nodes.end===null)&&(n.nodes.end=E),Vt();return}e!==null&&e.before(t)}const ms=["touchstart","touchmove"];function _s(e){return ms.includes(e)}function Je(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function ni(e,t){return ri(e,t)}function bs(e,t){xn(),t.intro=t.intro??!1;const n=t.target,r=x,i=E;try{for(var s=Ve(n);s&&(s.nodeType!==pt||s.data!==tr);)s=xe(s);if(!s)throw ct;Oe(!0),se(s);const a=ri(e,{...t,anchor:s});return Oe(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
2
+ `).some(o=>o.startsWith("https://svelte.dev/e/")))throw a;return a!==ct&&console.warn("Failed to hydrate: ",a),t.recover===!1&&Fi(),xn(),Mr(n),Oe(!1),ni(e,t)}finally{Oe(r),se(i)}}const _t=new Map;function ri(e,{target:t,anchor:n,props:r={},events:i,context:s,intro:a=!0}){xn();var o=new Set,l=d=>{for(var h=0;h<d.length;h++){var g=d[h];if(!o.has(g)){o.add(g);var p=_s(g);t.addEventListener(g,en,{passive:p});var _=_t.get(g);_===void 0?(document.addEventListener(g,en,{passive:p}),_t.set(g,1)):_t.set(g,_+1)}}};l(Pt(Xr)),In.add(l);var u=void 0,f=cs(()=>{var d=n??t.appendChild(Se());return Zi(d,{pending:()=>{}},h=>{if(s){bn({});var g=ae;g.c=s}if(i&&(r.$$events=i),x&&Ke(h,null),u=e(h,r)||{},x&&(C.nodes.end=E,E===null||E.nodeType!==pt||E.data!==hn))throw qt(),ct;s&&wn()}),()=>{for(var h of o){t.removeEventListener(h,en);var g=_t.get(h);--g===0?(document.removeEventListener(h,en),_t.delete(h)):_t.set(h,g)}In.delete(l),d!==n&&d.parentNode?.removeChild(d)}});return On.set(u,f),u}let On=new WeakMap;function ws(e,t){const n=On.get(e);return n?(On.delete(e),n(t)):Promise.resolve()}class ys{anchor;#e=new Map;#t=new Map;#n=new Map;#a=new Set;#o=!0;constructor(t,n=!0){this.anchor=t,this.#o=n}#i=()=>{var t=D;if(this.#e.has(t)){var n=this.#e.get(t),r=this.#t.get(n);if(r)Rn(r),this.#a.delete(n);else{var i=this.#n.get(n);i&&(this.#t.set(n,i.effect),this.#n.delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,a]of this.#e){if(this.#e.delete(s),s===t)break;const o=this.#n.get(a);o&&(Y(o.effect),this.#n.delete(a))}for(const[s,a]of this.#t){if(s===n||this.#a.has(s))continue;const o=()=>{if(Array.from(this.#e.values()).includes(s)){var u=document.createDocumentFragment();Br(a,u),u.append(Se()),this.#n.set(s,{effect:a,fragment:u})}else Y(a);this.#a.delete(s),this.#t.delete(s)};this.#o||!r?(this.#a.add(s),it(a,o,!1)):o()}}};#r=t=>{this.#e.delete(t);const n=Array.from(this.#e.values());for(const[r,i]of this.#n)n.includes(r)||(Y(i.effect),this.#n.delete(r))};ensure(t,n){var r=D,i=Ir();if(n&&!this.#t.has(t)&&!this.#n.has(t))if(i){var s=document.createDocumentFragment(),a=Se();s.append(a),this.#n.set(t,{effect:de(()=>n(a)),fragment:s})}else this.#t.set(t,de(()=>n(this.anchor)));if(this.#e.set(r,t),i){for(const[o,l]of this.#t)o===t?r.unskip_effect(l):r.skip_effect(l);for(const[o,l]of this.#n)o===t?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(this.#i),r.ondiscard(this.#r)}else x&&(this.anchor=E),this.#i()}}function ii(e){ae===null&&Mi(),Zt(()=>{const t=Mn(e);if(typeof t=="function")return t})}function q(e,t,n=!1){x&&Vt();var r=new ys(e),i=n?dt:0;function s(a,o){if(x){const u=cr(e)===Lt;if(a===u){var l=Gt();se(l),r.anchor=l,Oe(!1),r.ensure(a,o),Oe(!0);return}}r.ensure(a,o)}zn(()=>{var a=!1;t((o,l=!0)=>{a=!0,s(l,o)}),a||s(!1,null)},i)}function $s(e,t,n){for(var r=[],i=t.length,s,a=t.length,o=0;o<i;o++){let d=t[o];it(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=e.outrogroups;Dn(Pt(s.done)),h.delete(s),h.size===0&&(e.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=r.length===0&&n!==null;if(l){var u=n,f=u.parentNode;Mr(f),f.append(u),e.items.clear()}Dn(t,!l)}else s={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(s)}function Dn(e,t=!0){for(var n=0;n<e.length;n++)Y(e[n],t)}var si;function Ss(e,t,n,r,i,s=null){var a=e,o=new Map;x&&Vt();var l=null,u=ns(()=>{var _=n();return nr(_)?_:_==null?[]:Pt(_)}),f,d=!0;function h(){p.fallback=l,ks(p,f,a,t,r),l!==null&&(f.length===0?(l.f&He)===0?Rn(l):(l.f^=He,Ct(l,null,a)):it(l,()=>{l=null}))}var g=zn(()=>{f=c(u);var _=f.length;let I=!1;if(x){var y=cr(a)===Lt;y!==(_===0)&&(a=Gt(),se(a),Oe(!1),I=!0)}for(var S=new Set,te=D,K=Ir(),J=0;J<_;J+=1){x&&E.nodeType===pt&&E.data===hn&&(a=E,I=!0,Oe(!1));var Fe=f[J],Te=r(Fe,J),O=d?null:o.get(Te);O?(O.v&&mt(O.v,Fe),O.i&&mt(O.i,J),K&&te.unskip_effect(O.e)):(O=Es(o,d?a:si??=Se(),Fe,Te,J,i,t,n),d||(O.e.f|=He),o.set(Te,O)),S.add(Te)}if(_===0&&s&&!l&&(d?l=de(()=>s(a)):(l=de(()=>s(si??=Se())),l.f|=He)),x&&_>0&&se(Gt()),!d)if(K){for(const[wt,Ee]of o)S.has(wt)||te.skip_effect(Ee.e);te.oncommit(h),te.ondiscard(()=>{})}else h();I&&Oe(!0),c(u)}),p={effect:g,items:o,outrogroups:null,fallback:l};d=!1,x&&(a=E)}function xt(e){for(;e!==null&&(e.f&_e)===0;)e=e.next;return e}function ks(e,t,n,r,i){var s=t.length,a=e.items,o=xt(e.effect.first),l,u=null,f=[],d=[],h,g,p,_;for(_=0;_<s;_+=1){if(h=t[_],g=i(h,_),p=a.get(g).e,e.outrogroups!==null)for(const O of e.outrogroups)O.pending.delete(p),O.done.delete(p);if((p.f&He)!==0)if(p.f^=He,p===o)Ct(p,null,n);else{var I=u?u.next:o;p===e.effect.last&&(e.effect.last=p.prev),p.prev&&(p.prev.next=p.next),p.next&&(p.next.prev=p.prev),Ye(e,u,p),Ye(e,p,I),Ct(p,I,n),u=p,f=[],d=[],o=xt(u.next);continue}if((p.f&ie)!==0&&Rn(p),p!==o){if(l!==void 0&&l.has(p)){if(f.length<d.length){var y=d[0],S;u=y.prev;var te=f[0],K=f[f.length-1];for(S=0;S<f.length;S+=1)Ct(f[S],y,n);for(S=0;S<d.length;S+=1)l.delete(d[S]);Ye(e,te.prev,K.next),Ye(e,u,te),Ye(e,K,y),o=y,u=K,_-=1,f=[],d=[]}else l.delete(p),Ct(p,o,n),Ye(e,p.prev,p.next),Ye(e,p,u===null?e.effect.first:u.next),Ye(e,u,p),u=p;continue}for(f=[],d=[];o!==null&&o!==p;)(l??=new Set).add(o),d.push(o),o=xt(o.next);if(o===null)continue}(p.f&He)===0&&f.push(p),u=p,o=xt(p.next)}if(e.outrogroups!==null){for(const O of e.outrogroups)O.pending.size===0&&(Dn(Pt(O.done)),e.outrogroups?.delete(O));e.outrogroups.size===0&&(e.outrogroups=null)}if(o!==null||l!==void 0){var J=[];if(l!==void 0)for(p of l)(p.f&ie)===0&&J.push(p);for(;o!==null;)(o.f&ie)===0&&o!==e.fallback&&J.push(o),o=xt(o.next);var Fe=J.length;if(Fe>0){var Te=null;$s(e,J,Te)}}}function Es(e,t,n,r,i,s,a,o){var l=(a&_i)!==0?(a&wi)===0?Er(n,!1,!1):rt(n):null,u=(a&bi)!==0?rt(i):null;return{v:l,i:u,e:de(()=>(s(t,l??n,u??i,o),()=>{e.delete(r)}))}}function Ct(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,s=t&&(t.f&He)===0?t.nodes.start:n;r!==null;){var a=xe(r);if(s.before(r),r===i)return;r=a}}function Ye(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function ai(e,t){Lr(()=>{var n=e.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector("#"+t.hash)){const i=document.createElement("style");i.id=t.hash,i.textContent=t.code,r.appendChild(i)}})}const oi=[...`
3
+ \r\f \v\uFEFF`];function xs(e,t,n){var r=e==null?"":""+e;if(n){for(var i in n)if(n[i])r=r?r+" "+i:i;else if(r.length)for(var s=i.length,a=0;(a=r.indexOf(i,a))>=0;){var o=a+s;(a===0||oi.includes(r[a-1]))&&(o===r.length||oi.includes(r[o]))?r=(a===0?"":r.substring(0,a))+r.substring(o+1):a=o}}return r===""?null:r}function li(e,t=!1){var n=t?" !important;":";",r="";for(var i in e){var s=e[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function Ln(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function Cs(e,t){if(t){var n="",r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,a=0,o=!1,l=[];r&&l.push(...Object.keys(r).map(Ln)),i&&l.push(...Object.keys(i).map(Ln));var u=0,f=-1;const _=e.length;for(var d=0;d<_;d++){var h=e[d];if(o?h==="/"&&e[d-1]==="*"&&(o=!1):s?s===h&&(s=!1):h==="/"&&e[d+1]==="*"?o=!0:h==='"'||h==="'"?s=h:h==="("?a++:h===")"&&a--,!o&&s===!1&&a===0){if(h===":"&&f===-1)f=d;else if(h===";"||d===_-1){if(f!==-1){var g=Ln(e.substring(u,f).trim());if(!l.includes(g)){h!==";"&&d++;var p=e.substring(u,d).trim();n+=" "+p+";"}}u=d+1,f=-1}}}}return r&&(n+=li(r)),i&&(n+=li(i,!0)),n=n.trim(),n===""?null:n}return e==null?null:String(e)}function bt(e,t,n,r,i,s){var a=e.__className;if(x||a!==n||a===void 0){var o=xs(n,r,s);(!x||o!==e.getAttribute("class"))&&(o==null?e.removeAttribute("class"):e.className=o),e.__className=n}else if(s&&i!==s)for(var l in s){var u=!!s[l];(i==null||u!==!!i[l])&&e.classList.toggle(l,u)}return s}function Pn(e,t={},n,r){for(var i in n){var s=n[i];t[i]!==s&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,s,r))}}function Fn(e,t,n,r){var i=e.__style;if(x||i!==t){var s=Cs(t,r);(!x||s!==e.getAttribute("style"))&&(s==null?e.removeAttribute("style"):e.style.cssText=s),e.__style=t}else r&&(Array.isArray(r)?(Pn(e,n?.[0],r[0]),Pn(e,n?.[1],r[1],"important")):Pn(e,n,r));return r}const As=Symbol("is custom element"),Ts=Symbol("is html");function nn(e,t,n,r){var i=zs(e);x&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||i[t]!==(i[t]=n)&&(t==="loading"&&(e[Ri]=n),n==null?e.removeAttribute(t):typeof n!="string"&&Rs(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function zs(e){return e.__attributes??={[As]:e.nodeName.includes("-"),[Ts]:e.namespaceURI===Si}}var ci=new Map;function Rs(e){var t=e.getAttribute("is")||e.nodeName,n=ci.get(t);if(n)return n;ci.set(t,n=[]);for(var r,i=e,s=Element.prototype;s!==i;){r=Ei(i);for(var a in r)r[a].set&&n.push(a);i=rr(i)}return n}function ui(e,t){return e===t||e?.[Ht]===t}function Nn(e={},t,n,r){return Lr(()=>{var i,s;return Tn(()=>{i=s,s=[],Mn(()=>{e!==n(...s)&&(t(e,...s),i&&ui(n(...i),e)&&t(null,...i))})}),()=>{nt(()=>{s&&ui(n(...s),e)&&t(null,...s)})}}),e}function Z(e,t,n,r){var i=r,s=!0,a=()=>(s&&(s=!1,i=r),i),o;o=e[t],o===void 0&&r!==void 0&&(o=a());var l;l=()=>{var h=e[t];return h===void 0?a():(s=!0,h)};var u=!1,f=Yt(()=>(u=!1,l())),d=C;return(function(h,g){if(arguments.length>0){const p=g?c(f):h;return m(f,p),u=!0,i!==void 0&&(i=p),h}return Ge&&u||(d.f&Ie)!==0?f.v:c(f)})}function Ms(e){return new Is(e)}class Is{#e;#t;constructor(t){var n=new Map,r=(s,a)=>{var o=Er(a,!1,!1);return n.set(s,o),o};const i=new Proxy({...t.props||{},$$events:{}},{get(s,a){return c(n.get(a)??r(a,Reflect.get(s,a)))},has(s,a){return a===zi?!0:(c(n.get(a)??r(a,Reflect.get(s,a))),Reflect.has(s,a))},set(s,a,o){return m(n.get(a)??r(a,o),o),Reflect.set(s,a,o)}});this.#t=(t.hydrate?bs:ni)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&G(),this.#e=i.$$events;for(const s of Object.keys(this.#t))s==="$set"||s==="$destroy"||s==="$on"||Nt(this,s,{get(){return this.#t[s]},set(a){this.#t[s]=a},enumerable:!0});this.#t.$set=s=>{Object.assign(i,s)},this.#t.$destroy=()=>{ws(this.#t)}}$set(t){this.#t.$set(t)}$on(t,n){this.#e[t]=this.#e[t]||[];const r=(...i)=>n.call(this,...i);return this.#e[t].push(r),()=>{this.#e[t]=this.#e[t].filter(i=>i!==r)}}$destroy(){this.#t.$destroy()}}let fi;typeof HTMLElement=="function"&&(fi=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(e,t,n){super(),this.$$ctor=e,this.$$s=t,n&&(this.$$shadowRoot=this.attachShadow(n))}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const r=this.$$c.$on(e,t);this.$$l_u.set(t,r)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){const r=this.$$l_u.get(t);r&&(r(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(r){return i=>{const s=document.createElement("slot");r!=="default"&&(s.name=r),L(i,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},n=Os(this);for(const r of this.$$s)r in n&&(r==="default"&&!this.$$d.children?(this.$$d.children=e(r),t.default=!0):t[r]=e(r));for(const r of this.attributes){const i=this.$$g_p(r.name);i in this.$$d||(this.$$d[i]=rn(i,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);this.$$c=Ms({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=ls(()=>{Tn(()=>{this.$$r=!0;for(const r of Ft(this.$$c)){if(!this.$$p_d[r]?.reflect)continue;this.$$d[r]=this.$$c[r];const i=rn(r,this.$$d[r],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,i)}this.$$r=!1})});for(const r in this.$$l)for(const i of this.$$l[r]){const s=this.$$c.$on(r,i);this.$$l_u.set(i,s)}this.$$l={}}}attributeChangedCallback(e,t,n){this.$$r||(e=this.$$g_p(e),this.$$d[e]=rn(e,n,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return Ft(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function rn(e,t,n,r){const i=n[e]?.type;if(t=i==="Boolean"&&typeof t!="boolean"?t!=null:t,!r||!n[e])return t;if(r==="toAttribute")switch(i){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(i){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function Os(e){const t={};return e.childNodes.forEach(n=>{t[n.slot||"default"]=!0}),t}function di(e,t,n,r,i,s){let a=class extends fi{constructor(){super(e,n,i),this.$$p_d=t}static get observedAttributes(){return Ft(t).map(o=>(t[o].attribute||o).toLowerCase())}};return Ft(t).forEach(o=>{Nt(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(l){l=rn(o,l,t),this.$$d[o]=l;var u=this.$$c;if(u){var f=ft(u,o)?.get;f?u[o]=l:u.$set({[o]:l})}}})}),r.forEach(o=>{Nt(a.prototype,o,{get(){return this.$$c?.[o]}})}),e.element=a,a}const Ds=50,At=5;class hi{consoleErrors=[];attachments=[];mediaRecorder=null;recordingChunks=[];mediaStream=null;originalConsoleError;originalConsoleWarn;isCapturingConsole=!1;constructor(){this.originalConsoleError=console.error,this.originalConsoleWarn=console.warn}startConsoleCapture(){this.isCapturingConsole||(this.isCapturingConsole=!0,console.error=(...t)=>{this.captureLog("error",t),this.originalConsoleError.apply(console,t)},console.warn=(...t)=>{this.captureLog("warn",t),this.originalConsoleWarn.apply(console,t)})}stopConsoleCapture(){this.isCapturingConsole&&(this.isCapturingConsole=!1,console.error=this.originalConsoleError,console.warn=this.originalConsoleWarn)}captureLog(t,n){const r={level:t,message:n.map(i=>this.stringifyArg(i)).join(" "),timestamp:Date.now(),stack:new Error().stack};this.consoleErrors.push(r),this.consoleErrors.length>Ds&&this.consoleErrors.shift()}stringifyArg(t){if(t===null)return"null";if(t===void 0)return"undefined";if(typeof t=="string")return t;if(t instanceof Error)return`${t.name}: ${t.message}`;try{return JSON.stringify(t)}catch{return String(t)}}getConsoleErrors(){return[...this.consoleErrors]}clearConsoleErrors(){this.consoleErrors=[]}getPageContext(){return{pageUrl:window.location.href,userAgent:navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight}}}isScreenRecordingSupported(){return!!navigator.mediaDevices?.getDisplayMedia}async startScreenRecording(){if(!this.isScreenRecordingSupported())throw new Error("Screen recording is not supported in this browser");try{const t=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!0,preferCurrentTab:!0});let n=null;try{n=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch{console.warn("[SDK] Microphone access denied or unavailable")}const r=new AudioContext,i=r.createMediaStreamDestination(),s=t.getAudioTracks()[0];if(s&&r.createMediaStreamSource(new MediaStream([s])).connect(i),n){const d=n.getAudioTracks()[0];d&&r.createMediaStreamSource(new MediaStream([d])).connect(i)}const a=new MediaStream,o=t.getVideoTracks()[0];o&&a.addTrack(o);const l=i.stream.getAudioTracks()[0];l&&a.addTrack(l),this.mediaStream=a,this.mediaStream._originalDisplayStream=t,this.mediaStream._originalMicStream=n,this.mediaStream._audioContext=r;const u=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm"];let f="video/webm";for(const d of u)if(MediaRecorder.isTypeSupported(d)){f=d;break}this.mediaRecorder=new MediaRecorder(a,{mimeType:f}),this.recordingChunks=[],this.mediaRecorder.ondataavailable=d=>{d.data.size>0&&this.recordingChunks.push(d.data)},this.mediaRecorder.start()}catch(t){throw console.error("[SDK] Screen recording failed:",t),new Error("Failed to start screen recording")}}async stopScreenRecording(){return new Promise(t=>{if(!this.mediaRecorder){t(null);return}this.mediaRecorder.onstop=()=>{if(this.mediaStream){for(const o of this.mediaStream.getTracks())o.stop();const r=this.mediaStream,i=r._originalDisplayStream;if(i)for(const o of i.getTracks())o.stop();const s=r._originalMicStream;if(s)for(const o of s.getTracks())o.stop();const a=r._audioContext;a&&a.close(),this.mediaStream=null}const n=new Blob(this.recordingChunks,{type:"video/webm"});this.recordingChunks=[],this.mediaRecorder=null,t(n)},this.mediaRecorder.stop()})}isRecording(){return this.mediaRecorder!==null&&this.mediaRecorder.state==="recording"}async captureScreenshot(){if(!this.isScreenRecordingSupported())return null;try{const t=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",width:{ideal:1920},height:{ideal:1080}},audio:!1}),n=document.createElement("video");n.srcObject=t,n.autoplay=!0,await new Promise(s=>{n.onloadedmetadata=s});const r=document.createElement("canvas");r.width=n.videoWidth,r.height=n.videoHeight;const i=r.getContext("2d");if(!i){for(const s of t.getTracks())s.stop();return null}i.drawImage(n,0,0);for(const s of t.getTracks())s.stop();return new Promise(s=>{r.toBlob(a=>s(a),"image/png")})}catch{return null}}async addAttachment(t){if(this.attachments.length>=At)return console.warn(`[SDK] Maximum ${At} attachments allowed`),null;const n=this.getAttachmentType(t.type);if(!n)return console.warn(`[SDK] Unsupported file type: ${t.type}`),null;const r=await this.fileToDataUrl(t),i={id:this.generateId(),name:t.name,type:n,size:t.size,dataUrl:r};return this.attachments.push(i),i}async addBlobAttachment(t,n){if(this.attachments.length>=At)return console.warn(`[SDK] Maximum ${At} attachments allowed`),null;const r=this.getAttachmentType(t.type);if(!r)return console.warn(`[SDK] Unsupported blob type: ${t.type}`),null;const i=await this.blobToDataUrl(t),s={id:this.generateId(),name:n,type:r,size:t.size,dataUrl:i};return this.attachments.push(s),s}removeAttachment(t){const n=this.attachments.findIndex(r=>r.id===t);return n!==-1?(this.attachments.splice(n,1),!0):!1}getAttachments(){return[...this.attachments]}clearAttachments(){this.attachments=[]}canAddAttachment(){return this.attachments.length<At}getAttachmentType(t){return t.startsWith("image/")?"image":t.startsWith("audio/")?"audio":t.startsWith("video/")?"video":null}generateId(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}fileToDataUrl(t){return new Promise((n,r)=>{const i=new FileReader;i.onload=()=>n(i.result),i.onerror=r,i.readAsDataURL(t)})}blobToDataUrl(t){return new Promise((n,r)=>{const i=new FileReader;i.onload=()=>n(i.result),i.onerror=r,i.readAsDataURL(t)})}destroy(){this.stopConsoleCapture(),this.isRecording()&&this.stopScreenRecording(),this.clearConsoleErrors(),this.clearAttachments()}}let Un=null;function jn(){return Un||(Un=new hi),Un}var Ls=j('<button class="recording-btn svelte-1105cax" aria-label="Stop recording"><span class="recording-dot svelte-1105cax"></span> <span class="recording-time svelte-1105cax"> </span> <span class="stop-label svelte-1105cax">Stop</span></button>'),Ps=j('<span class="unread-badge svelte-1105cax"> </span>'),Fs=tn('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-1105cax"><path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" class="svelte-1105cax"></path></svg>'),Ns=tn('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-1105cax"><path fill-rule="evenodd" d="M4.804 21.644A6.707 6.707 0 0 0 6 21.75a6.721 6.721 0 0 0 3.583-1.029c.774.182 1.584.279 2.417.279 5.322 0 9.75-3.97 9.75-9 0-5.03-4.428-9-9.75-9s-9.75 3.97-9.75 9c0 2.409 1.025 4.587 2.674 6.192.232.226.277.428.254.543a3.73 3.73 0 0 1-.814 1.686.75.75 0 0 0 .44 1.223ZM8.25 10.875a1.125 1.125 0 1 0 0 2.25 1.125 1.125 0 0 0 0-2.25ZM10.875 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Zm4.875-1.125a1.125 1.125 0 1 0 0 2.25 1.125 1.125 0 0 0 0-2.25Z" clip-rule="evenodd" class="svelte-1105cax"></path></svg>'),Us=j('<button class="toggle-btn svelte-1105cax"><!> <!></button>'),js=j('<div class="loading-state svelte-1105cax"><div class="loading-spinner svelte-1105cax"></div> <p class="svelte-1105cax">Loading...</p></div>'),Bs=j('<div class="support-chat svelte-1105cax"><!> <div><!> <iframe title="Support Chat" sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox" allow="clipboard-write; display-capture; microphone"></iframe></div></div>');const Hs={hash:"svelte-1105cax",code:`.svelte-1105cax {box-sizing:border-box;margin:0;padding:0;}.support-chat.svelte-1105cax {--primary-color: #6366f1;--shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1),
4
4
  0 8px 10px -6px rgba(0, 0, 0, 0.1);position:fixed;bottom:1rem;z-index:9999;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
5
5
  "Helvetica Neue", Arial, sans-serif;}.toggle-btn.svelte-1105cax {position:absolute;bottom:0;right:0;width:3.5rem;height:3.5rem;border-radius:50%;border:none;background:var(--primary-color);color:white;cursor:pointer;box-shadow:var(--shadow);display:flex;align-items:center;justify-content:center;transition:transform 0.2s,
6
6
  opacity 0.2s;}.toggle-btn.svelte-1105cax:hover {transform:scale(1.05);}.toggle-btn.svelte-1105cax .icon:where(.svelte-1105cax) {width:1.5rem;height:1.5rem;}.unread-badge.svelte-1105cax {position:absolute;top:-4px;right:-4px;min-width:1.25rem;height:1.25rem;padding:0 0.25rem;background:#ef4444;color:white;font-size:0.625rem;font-weight:bold;border-radius:9999px;display:flex;align-items:center;justify-content:center;}.chat-window.svelte-1105cax {position:absolute;bottom:4.5rem;right:0;width:380px;max-width:calc(100vw - 2rem);height:500px;max-height:calc(100vh - 8rem);background:#ffffff;border-radius:1rem;box-shadow:var(--shadow);overflow:hidden;border:1px solid #e5e7eb;}.chat-window.svelte-1105cax iframe:where(.svelte-1105cax) {width:100%;height:100%;border:none;display:block;}.chat-window.svelte-1105cax iframe.hidden:where(.svelte-1105cax) {visibility:hidden;position:absolute;}.chat-window.chat-window-hidden.svelte-1105cax {display:none;}.chat-window.chat-window-fullscreen.svelte-1105cax {position:fixed;inset:1vh 1vw;width:auto;height:auto;max-width:none;max-height:none;border-radius:0.5rem;transition:all 0.3s ease;}.loading-state.svelte-1105cax {position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;background:#f9fafb;color:#6b7280;font-size:0.875rem;}.loading-spinner.svelte-1105cax {width:2rem;height:2rem;border:3px solid #e5e7eb;border-top-color:var(--primary-color);border-radius:50%;
@@ -42,7 +42,7 @@
42
42
  var(--shadow),
43
43
  0 0 30px rgba(239, 68, 68, 0.6);
44
44
  }
45
- }`};function ds(e,t){mr(t,!0),ss(e,Bi);let r=G(t,"embedId"),n=G(t,"embedUrl",7,"https://app.fortalece.ai"),s=G(t,"position",7,"bottom-right"),i=G(t,"showHeader",7,"true"),a=G(t,"allowAttachments",7,!0),o=G(t,"allowScreenRecording",7,!0),l=G(t,"captureConsoleLogs",7,!0),f=A(!1),u=A(!1),d=A(!1),h=A(0),g=A(!1),p=A(null),_=A("00:00"),R=A(void 0),w=A(null),x=A(Oe([])),ee=A(Oe([]));Zt(()=>{if(c(g)&&c(p)!==null){const y=setInterval(()=>{const D=Math.floor((Date.now()-c(p))/1e3),ce=Math.floor(D/60).toString().padStart(2,"0"),ze=(D%60).toString().padStart(2,"0");m(_,`${ce}:${ze}`)},1e3);return()=>clearInterval(y)}});const K=ye(()=>i()==="false"||i()===!1),Y=ye(()=>!c(f)||c(K)||!c(u)),Ne=ye(()=>`${n()}/embed/${r()}${c(K)?"?showHeader=false":""}`),Ae=ye(()=>s()==="bottom-left"?"left: 1rem; right: auto;":"right: 1rem; left: auto;");rs(()=>{m(w,Fr(),!0),l()&&c(w).startConsoleCapture();function y(D){try{const Je=new URL(n()).origin;if(D.origin!==Je)return}catch{return}const{type:ce,payload:ze}=D.data||{};switch(ce){case"fortalece:ready":m(u,!0);break;case"fortalece:close-request":m(f,!1);break;case"fortalece:request-context":At();break;case"fortalece:request-attachments":le();break;case"fortalece:clear-attachments":zt();break;case"fortalece:resize":m(d,ze?.fullscreen??!1,!0);break;case"fortalece:unread":m(h,ze?.count||0,!0);break;case"fortalece:recording-started":m(g,!0),m(p,Date.now(),!0),m(_,"00:00"),m(f,!1);break;case"fortalece:recording-stopped":m(g,!1),m(p,null),m(_,"00:00"),m(f,!0);break}}return window.addEventListener("message",y),()=>{window.removeEventListener("message",y),l()&&c(w)&&c(w).stopConsoleCapture()}});function M(){m(f,!c(f)),c(f)&&m(h,0)}function bt(){Se("fortalece:stop-recording"),m(g,!1),m(p,null),m(_,"00:00")}function Se(y,D={}){if(c(R)?.contentWindow)try{const ce=new URL(n()).origin;c(R).contentWindow.postMessage({type:y,payload:D},ce)}catch{}}function At(){if(!c(w))return;const y=c(w).getPageContext();if(Se("fortalece:page-context",y),l()){const D=c(w).getConsoleErrors();m(ee,D,!0),Se("fortalece:console-logs",{logs:D})}Se("fortalece:capture-state",{allowAttachments:a(),allowScreenRecording:o(),captureConsoleLogs:l(),attachmentCount:c(x).length,maxAttachments:5})}function le(){c(x).forEach(y=>{Se("fortalece:attachment-added",y)})}function zt(){c(w)&&(c(w).clearAttachments(),c(w).clearConsoleErrors(),m(x,[],!0),m(ee,[],!0),Se("fortalece:capture-state",{allowAttachments:a(),allowScreenRecording:o(),captureConsoleLogs:l(),attachmentCount:0,maxAttachments:5}))}Zt(()=>{c(f)&&c(u)&&(Se("fortalece:opened"),At(),le())});var nr={get embedId(){return r()},set embedId(y){r(y),W()},get embedUrl(){return n()},set embedUrl(y="https://app.fortalece.ai"){n(y),W()},get position(){return s()},set position(y="bottom-right"){s(y),W()},get showHeader(){return i()},set showHeader(y="true"){i(y),W()},get allowAttachments(){return a()},set allowAttachments(y=!0){a(y),W()},get allowScreenRecording(){return o()},set allowScreenRecording(y=!0){o(y),W()},get captureConsoleLogs(){return l()},set captureConsoleLogs(y=!0){l(y),W()}},Ge=ji(),sr=T(Ge);{var jr=y=>{var D=Di();D.__click=bt;var ce=O(T(D),2),ze=T(ce,!0);z(ce),gr(2),z(D),X(()=>Ye(ze,c(_))),L(y,D)},Br=y=>{var D=vi(),ce=zn(D);{var ze=Je=>{var at=Fi();at.__click=M;var Rt=T(at);{var qr=ve=>{var Pe=Oi(),v=T(Pe,!0);z(Pe),X(()=>Ye(v,c(h)>9?"9+":c(h))),L(ve,Pe)};H(Rt,ve=>{c(h)>0&&!c(f)&&ve(qr)})}var cr=O(Rt,2);{var Vr=ve=>{var Pe=Ni();L(ve,Pe)},Mt=ve=>{var Pe=Pi();L(ve,Pe)};H(cr,ve=>{c(f)?ve(Vr):ve(Mt,!1)})}z(at),X(()=>er(at,"aria-label",c(f)?"Close chat":"Open chat")),L(Je,at)};H(ce,Je=>{c(Y)&&Je(ze)},!0)}L(y,D)};H(sr,y=>{c(g)?y(jr):y(Br,!1)})}var wt=O(sr,2);let ir,ar;var or=T(wt);{var Hr=y=>{var D=Ui();L(y,D)};H(or,y=>{c(u)||y(Hr)})}var Tt=O(or,2);let lr;return Nr(Tt,y=>m(R,y),()=>c(R)),z(wt),z(Ge),X(()=>{Or(Ge,c(Ae)),ir=_t(wt,1,"chat-window svelte-1105cax",null,ir,{"chat-window-hidden":!c(f),"chat-window-fullscreen":c(d)}),ar=Or(wt,"",ar,{bottom:c(d)?void 0:c(Y)?"4.5rem":"0"}),er(Tt,"src",c(Ne)),lr=_t(Tt,1,"svelte-1105cax",null,lr,{hidden:!c(u)})}),L(e,Ge),_r(nr)}Jn(["click"]),customElements.define("support-chat",fs(ds,{embedId:{attribute:"embed-id",reflect:!0},embedUrl:{attribute:"embed-url",reflect:!0},position:{attribute:"position",reflect:!0},showHeader:{attribute:"show-header",reflect:!0},allowAttachments:{attribute:"allow-attachments",reflect:!0,type:"Boolean"},allowScreenRecording:{attribute:"allow-screen-recording",reflect:!0,type:"Boolean"},captureConsoleLogs:{attribute:"capture-console-logs",reflect:!0,type:"Boolean"}},[],[],{mode:"open"}));var Hi=F('<div class="recording-indicator svelte-p7nz7"><div class="recording-dot svelte-p7nz7"></div> <span class="svelte-p7nz7">Recording...</span> <button class="stop-recording-btn svelte-p7nz7">Stop</button></div>'),qi=F('<button class="capture-btn svelte-p7nz7"><span class="capture-icon svelte-p7nz7">📎</span> <span class="svelte-p7nz7">Add File</span></button>'),Vi=F('<button class="capture-btn svelte-p7nz7"><span class="capture-icon svelte-p7nz7">📸</span> <span class="svelte-p7nz7">Screenshot</span></button> <button class="capture-btn record-btn svelte-p7nz7"><span class="capture-icon svelte-p7nz7">🔴</span> <span class="svelte-p7nz7">Record Screen</span></button>',1),Wi=F('<div class="attachment-item svelte-p7nz7"><span class="attachment-icon svelte-p7nz7"> </span> <div class="attachment-info svelte-p7nz7"><span class="attachment-name svelte-p7nz7"> </span> <span class="attachment-size svelte-p7nz7"> </span></div> <button class="remove-attachment-btn svelte-p7nz7">✕</button></div>'),Ki=F('<div class="attachment-list svelte-p7nz7"><div class="attachment-header svelte-p7nz7"><span class="svelte-p7nz7"> </span></div> <!></div>'),Yi=F('<div class="console-info svelte-p7nz7"><span class="console-icon svelte-p7nz7">🔧</span> <span class="svelte-p7nz7"> </span></div>'),Zi=F('<div class="capture-panel svelte-p7nz7"><div class="capture-panel-header svelte-p7nz7"><span class="svelte-p7nz7">Capture</span> <button class="close-capture-btn svelte-p7nz7">✕</button></div> <div class="capture-actions svelte-p7nz7"><!> <!></div> <!> <!></div>'),Gi=Qt('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-p7nz7"><path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg>'),Ji=Qt('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-p7nz7"><path fill-rule="evenodd" d="M4.848 2.771A49.144 49.144 0 0 1 12 2.25c2.43 0 4.817.178 7.152.52 1.978.292 3.348 2.024 3.348 3.97v6.02c0 1.946-1.37 3.678-3.348 3.97a48.901 48.901 0 0 1-3.476.383.39.39 0 0 0-.297.17l-2.755 4.133a.75.75 0 0 1-1.248 0l-2.755-4.133a.39.39 0 0 0-.297-.17 48.9 48.9 0 0 1-3.476-.384c-1.978-.29-3.348-2.024-3.348-3.97V6.741c0-1.946 1.37-3.68 3.348-3.97Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg>'),Xi=F('<button class="toggle-btn svelte-p7nz7"><!></button>'),Qi=F('<span class="badge svelte-p7nz7"> </span>'),ea=F('<button aria-label="Toggle capture panel"><!> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-p7nz7"><path d="M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z" class="svelte-p7nz7"></path><path fill-rule="evenodd" d="M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3H4.5a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg></button>'),ta=F('<div class="loading-state svelte-p7nz7"><div class="loading-spinner svelte-p7nz7"></div> <p class="svelte-p7nz7">Loading...</p></div>'),ra=F('<div><!> <iframe title="Feedback Panel" sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox" allow="clipboard-write; display-capture; microphone"></iframe></div>'),na=F('<div><!> <!> <!> <!> <input type="file" accept="image/*,audio/*,video/*" multiple style="display: none;" class="svelte-p7nz7"/> <!></div>');const sa={hash:"svelte-p7nz7",code:`
45
+ }`};function pi(e,t){bn(t,!0),ai(e,Hs);let n=Z(t,"embedId"),r=Z(t,"embedUrl",7,"https://app.fortalece.ai"),i=Z(t,"position",7,"bottom-right"),s=Z(t,"showHeader",7,"true"),a=Z(t,"allowAttachments",7,!0),o=Z(t,"allowScreenRecording",7,!0),l=Z(t,"captureConsoleLogs",7,!0),u=T(!1),f=T(!1),d=T(!1),h=T(0),g=T(!1),p=T(null),_=T("00:00"),I=T(void 0),y=T(null),S=T(Pe([])),te=T(Pe([]));Zt(()=>{if(c(g)&&c(p)!==null){const $=setInterval(()=>{const P=Math.floor((Date.now()-c(p))/1e3),ue=Math.floor(P/60).toString().padStart(2,"0"),ze=(P%60).toString().padStart(2,"0");m(_,`${ue}:${ze}`)},1e3);return()=>clearInterval($)}});const K=$e(()=>s()==="false"||s()===!1),J=$e(()=>!c(u)||c(K)||!c(f)),Fe=$e(()=>`${r()}/embed/${n()}${c(K)?"?showHeader=false":""}`),Te=$e(()=>i()==="bottom-left"?"left: 1rem; right: auto;":"right: 1rem; left: auto;");ii(()=>{m(y,jn(),!0),l()&&c(y).startConsoleCapture();function $(P){try{const Xe=new URL(r()).origin;if(P.origin!==Xe)return}catch{return}const{type:ue,payload:ze}=P.data||{};switch(ue){case"fortalece:ready":m(f,!0);break;case"fortalece:close-request":m(u,!1);break;case"fortalece:request-context":zt();break;case"fortalece:request-attachments":ce();break;case"fortalece:clear-attachments":Rt();break;case"fortalece:resize":m(d,ze?.fullscreen??!1,!0);break;case"fortalece:unread":m(h,ze?.count||0,!0);break;case"fortalece:recording-started":m(g,!0),m(p,Date.now(),!0),m(_,"00:00"),m(u,!1);break;case"fortalece:recording-stopped":m(g,!1),m(p,null),m(_,"00:00"),m(u,!0);break}}return window.addEventListener("message",$),()=>{window.removeEventListener("message",$),l()&&c(y)&&c(y).stopConsoleCapture()}});function O(){m(u,!c(u)),c(u)&&m(h,0)}function wt(){Ee("fortalece:stop-recording"),m(g,!1),m(p,null),m(_,"00:00")}function Ee($,P={}){if(c(I)?.contentWindow)try{const ue=new URL(r()).origin;c(I).contentWindow.postMessage({type:$,payload:P},ue)}catch{}}function zt(){if(!c(y))return;const $=c(y).getPageContext();if(Ee("fortalece:page-context",$),l()){const P=c(y).getConsoleErrors();m(te,P,!0),Ee("fortalece:console-logs",{logs:P})}Ee("fortalece:capture-state",{allowAttachments:a(),allowScreenRecording:o(),captureConsoleLogs:l(),attachmentCount:c(S).length,maxAttachments:5})}function ce(){c(S).forEach($=>{Ee("fortalece:attachment-added",$)})}function Rt(){c(y)&&(c(y).clearAttachments(),c(y).clearConsoleErrors(),m(S,[],!0),m(te,[],!0),Ee("fortalece:capture-state",{allowAttachments:a(),allowScreenRecording:o(),captureConsoleLogs:l(),attachmentCount:0,maxAttachments:5}))}Zt(()=>{c(u)&&c(f)&&(Ee("fortalece:opened"),zt(),ce())});var sn={get embedId(){return n()},set embedId($){n($),G()},get embedUrl(){return r()},set embedUrl($="https://app.fortalece.ai"){r($),G()},get position(){return i()},set position($="bottom-right"){i($),G()},get showHeader(){return s()},set showHeader($="true"){s($),G()},get allowAttachments(){return a()},set allowAttachments($=!0){a($),G()},get allowScreenRecording(){return o()},set allowScreenRecording($=!0){o($),G()},get captureConsoleLogs(){return l()},set captureConsoleLogs($=!0){l($),G()}},Ze=Bs(),an=M(Ze);{var Wn=$=>{var P=Ls();P.__click=wt;var ue=F(M(P),2),ze=M(ue,!0);R(ue),_n(2),R(P),Q(()=>Je(ze,c(_))),L($,P)},qn=$=>{var P=gs(),ue=Rr(P);{var ze=Xe=>{var ot=Us();ot.__click=O;var It=M(ot);{var Gn=ge=>{var Ne=Ps(),v=M(Ne,!0);R(Ne),Q(()=>Je(v,c(h)>9?"9+":c(h))),L(ge,Ne)};q(It,ge=>{c(h)>0&&!c(u)&&ge(Gn)})}var fn=F(It,2);{var Kn=ge=>{var Ne=Fs();L(ge,Ne)},Ot=ge=>{var Ne=Ns();L(ge,Ne)};q(fn,ge=>{c(u)?ge(Kn):ge(Ot,!1)})}R(ot),Q(()=>nn(ot,"aria-label",c(u)?"Close chat":"Open chat")),L(Xe,ot)};q(ue,Xe=>{c(J)&&Xe(ze)},!0)}L($,P)};q(an,$=>{c(g)?$(Wn):$(qn,!1)})}var yt=F(an,2);let on,ln;var cn=M(yt);{var Vn=$=>{var P=js();L($,P)};q(cn,$=>{c(f)||$(Vn)})}var Mt=F(cn,2);let un;return Nn(Mt,$=>m(I,$),()=>c(I)),R(yt),R(Ze),Q(()=>{Fn(Ze,c(Te)),on=bt(yt,1,"chat-window svelte-1105cax",null,on,{"chat-window-hidden":!c(u),"chat-window-fullscreen":c(d)}),ln=Fn(yt,"",ln,{bottom:c(d)?void 0:c(J)?"4.5rem":"0"}),nn(Mt,"src",c(Fe)),un=bt(Mt,1,"svelte-1105cax",null,un,{hidden:!c(f)})}),L(e,Ze),wn(sn)}Qr(["click"]),customElements.define("support-chat",di(pi,{embedId:{attribute:"embed-id",reflect:!0},embedUrl:{attribute:"embed-url",reflect:!0},position:{attribute:"position",reflect:!0},showHeader:{attribute:"show-header",reflect:!0},allowAttachments:{attribute:"allow-attachments",reflect:!0,type:"Boolean"},allowScreenRecording:{attribute:"allow-screen-recording",reflect:!0,type:"Boolean"},captureConsoleLogs:{attribute:"capture-console-logs",reflect:!0,type:"Boolean"}},[],[],{mode:"open"}));var Ws=j('<div class="recording-indicator svelte-p7nz7"><div class="recording-dot svelte-p7nz7"></div> <span class="svelte-p7nz7">Recording...</span> <button class="stop-recording-btn svelte-p7nz7">Stop</button></div>'),qs=j('<button class="capture-btn svelte-p7nz7"><span class="capture-icon svelte-p7nz7">📎</span> <span class="svelte-p7nz7">Add File</span></button>'),Vs=j('<button class="capture-btn svelte-p7nz7"><span class="capture-icon svelte-p7nz7">📸</span> <span class="svelte-p7nz7">Screenshot</span></button> <button class="capture-btn record-btn svelte-p7nz7"><span class="capture-icon svelte-p7nz7">🔴</span> <span class="svelte-p7nz7">Record Screen</span></button>',1),Gs=j('<div class="attachment-item svelte-p7nz7"><span class="attachment-icon svelte-p7nz7"> </span> <div class="attachment-info svelte-p7nz7"><span class="attachment-name svelte-p7nz7"> </span> <span class="attachment-size svelte-p7nz7"> </span></div> <button class="remove-attachment-btn svelte-p7nz7">✕</button></div>'),Ks=j('<div class="attachment-list svelte-p7nz7"><div class="attachment-header svelte-p7nz7"><span class="svelte-p7nz7"> </span></div> <!></div>'),Js=j('<div class="console-info svelte-p7nz7"><span class="console-icon svelte-p7nz7">🔧</span> <span class="svelte-p7nz7"> </span></div>'),Ys=j('<div class="capture-panel svelte-p7nz7"><div class="capture-panel-header svelte-p7nz7"><span class="svelte-p7nz7">Capture</span> <button class="close-capture-btn svelte-p7nz7">✕</button></div> <div class="capture-actions svelte-p7nz7"><!> <!></div> <!> <!></div>'),Zs=tn('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-p7nz7"><path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg>'),Xs=tn('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-p7nz7"><path fill-rule="evenodd" d="M4.848 2.771A49.144 49.144 0 0 1 12 2.25c2.43 0 4.817.178 7.152.52 1.978.292 3.348 2.024 3.348 3.97v6.02c0 1.946-1.37 3.678-3.348 3.97a48.901 48.901 0 0 1-3.476.383.39.39 0 0 0-.297.17l-2.755 4.133a.75.75 0 0 1-1.248 0l-2.755-4.133a.39.39 0 0 0-.297-.17 48.9 48.9 0 0 1-3.476-.384c-1.978-.29-3.348-2.024-3.348-3.97V6.741c0-1.946 1.37-3.68 3.348-3.97Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg>'),Qs=j('<button class="toggle-btn svelte-p7nz7"><!></button>'),ea=j('<span class="badge svelte-p7nz7"> </span>'),ta=j('<button aria-label="Toggle capture panel"><!> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-p7nz7"><path d="M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z" class="svelte-p7nz7"></path><path fill-rule="evenodd" d="M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3H4.5a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg></button>'),na=j('<div class="loading-state svelte-p7nz7"><div class="loading-spinner svelte-p7nz7"></div> <p class="svelte-p7nz7">Loading...</p></div>'),ra=j('<div><!> <iframe title="Feedback Panel" sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox" allow="clipboard-write; display-capture; microphone"></iframe></div>'),ia=j('<div><!> <!> <!> <!> <input type="file" accept="image/*,audio/*,video/*" multiple style="display: none;" class="svelte-p7nz7"/> <!></div>');const sa={hash:"svelte-p7nz7",code:`
46
46
  /* Host element styling for inline mode */:host {display:block;}:host([display="inline"]) {display:block;width:100%;height:100%;}.svelte-p7nz7 {box-sizing:border-box;margin:0;padding:0;}.feedback-panel.svelte-p7nz7 {--primary-color: #6366f1;--danger-color: #ef4444;--shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1),
47
47
  0 8px 10px -6px rgba(0, 0, 0, 0.1);position:fixed;bottom:1rem;z-index:9999;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
48
48
  "Helvetica Neue", Arial, sans-serif;}
@@ -95,4 +95,4 @@
95
95
  to {
96
96
  transform: rotate(360deg);
97
97
  }
98
- }`};function hs(e,t){mr(t,!0),ss(e,sa);let r=G(t,"embedId"),n=G(t,"embedUrl",7,"https://app.fortalece.ai"),s=G(t,"position",7,"bottom-right"),i=G(t,"display",7,"floating"),a=G(t,"allowAttachments",7,!0),o=G(t,"allowScreenRecording",7,!0),l=G(t,"captureConsoleLogs",7,!0),f=G(t,"showHeader",7,"true");const u=ye(()=>i()==="inline");let d=A(!1),h=A(!1);const g=ye(()=>c(u)?!0:c(d));let p=A(!1),_=A(void 0),R=A(void 0),w=A(null),x=A(Oe([])),ee=A(Oe([])),K=A(!1);const Y=ye(()=>f()==="false"||f()===!1),Ne=ye(()=>`${n()}/embed/${r()}?type=feedback-panel${c(Y)?"&showHeader=false":""}`),Ae=ye(()=>s()==="bottom-left"?"left: 1rem; right: auto;":"right: 1rem; left: auto;"),M=ye(()=>c(x).length<5),bt=ye(()=>a()||o());rs(()=>{m(w,Fr(),!0),l()&&c(w).startConsoleCapture();function v(b){try{const te=new URL(n()).origin;if(b.origin!==te)return}catch{return}const{type:C}=b.data||{};switch(C){case"fortalece:ready":m(h,!0),zt();break;case"fortalece:close-request":m(d,!1);break;case"fortalece:request-context":zt();break;case"fortalece:request-attachments":nr();break;case"fortalece:submit-start":break;case"fortalece:submit-complete":b.data.payload?.success&&(or(),c(u)||m(d,!1));break}}return window.addEventListener("message",v),()=>{window.removeEventListener("message",v),l()&&c(w)&&c(w).stopConsoleCapture()}});function Se(){m(d,!c(d)),c(d)&&m(K,!1)}function At(){m(K,!c(K))}function le(v,b={}){if(c(_)?.contentWindow)try{const C=new URL(n()).origin;c(_).contentWindow.postMessage({type:v,payload:b},C)}catch{}}function zt(){if(!c(w))return;const v=c(w).getPageContext();if(le("fortalece:page-context",v),l()){const b=c(w).getConsoleErrors();le("fortalece:console-logs",{logs:b})}le("fortalece:capture-state",{allowAttachments:a(),allowScreenRecording:o(),captureConsoleLogs:l(),attachmentCount:c(x).length,maxAttachments:5})}function nr(){c(x).forEach(v=>{le("fortalece:attachment-added",v)})}let Ge=!1;Zt(()=>{const v=c(g)&&c(h);v&&!Ge?(Ge=!0,le("fortalece:opened"),zt(),nr()):v||(Ge=!1)});function sr(){c(R)?.click()}async function jr(v){const b=v.target;if(!(!b.files||!c(w))){for(const C of Array.from(b.files)){if(!c(M))break;const te=await c(w).addAttachment(C);te&&(m(x,[...c(x),te],!0),le("fortalece:attachment-added",te))}b.value=""}}function Br(v){c(w)&&(c(w).removeAttachment(v),m(x,c(x).filter(b=>b.id!==v),!0),le("fortalece:attachment-removed",{id:v}))}async function wt(){if(!(!c(w)||c(p)))try{await c(w).startScreenRecording(),m(p,!0),m(K,!1)}catch(v){console.error("[SDK] Failed to start recording:",v)}}async function ir(){if(!c(w)||!c(p))return;m(p,!1);const v=await c(w).stopScreenRecording();if(v&&c(M)){const b=`recording-${Date.now()}.webm`,C=await c(w).addBlobAttachment(v,b);C&&(m(x,[...c(x),C],!0),le("fortalece:attachment-added",C),le("fortalece:recording-complete",{dataUrl:C.dataUrl,size:C.size}))}}async function ar(){if(!c(w)||!c(M))return;m(K,!1),await new Promise(b=>setTimeout(b,100));const v=await c(w).captureScreenshot();if(v){const b=`screenshot-${Date.now()}.png`,C=await c(w).addBlobAttachment(v,b);C&&(m(x,[...c(x),C],!0),le("fortalece:attachment-added",C))}}function or(){c(w)&&(c(w).clearAttachments(),c(w).clearConsoleErrors(),m(x,[],!0),m(ee,[],!0))}function Hr(v){return v<1024?`${v} B`:v<1024*1024?`${(v/1024).toFixed(1)} KB`:`${(v/(1024*1024)).toFixed(1)} MB`}function Tt(v){switch(v){case"video":return"🎬";case"audio":return"🎵";default:return"🖼️"}}var lr={get embedId(){return r()},set embedId(v){r(v),W()},get embedUrl(){return n()},set embedUrl(v="https://app.fortalece.ai"){n(v),W()},get position(){return s()},set position(v="bottom-right"){s(v),W()},get display(){return i()},set display(v="floating"){i(v),W()},get allowAttachments(){return a()},set allowAttachments(v=!0){a(v),W()},get allowScreenRecording(){return o()},set allowScreenRecording(v=!0){o(v),W()},get captureConsoleLogs(){return l()},set captureConsoleLogs(v=!0){l(v),W()},get showHeader(){return f()},set showHeader(v="true"){f(v),W()}},y=na();let D;var ce=T(y);{var ze=v=>{var b=Hi(),C=O(T(b),4);C.__click=ir,z(b),L(v,b)};H(ce,v=>{c(p)&&!c(u)&&v(ze)})}var Je=O(ce,2);{var at=v=>{var b=Zi(),C=T(b),te=O(T(C),2);te.__click=At,z(C);var Fe=O(C,2),q=T(Fe);{var ge=J=>{var re=qi();re.__click=sr,X(()=>re.disabled=!c(M)),L(J,re)};H(q,J=>{a()&&J(ge)})}var Ue=O(q,2);{var Wr=J=>{var re=Vi(),Te=zn(re);Te.__click=ar;var ot=O(Te,2);ot.__click=wt,X(()=>{Te.disabled=!c(M),ot.disabled=!c(M)}),L(J,re)};H(Ue,J=>{o()&&J(Wr)})}z(Fe);var vs=O(Fe,2);{var ua=J=>{var re=Ki(),Te=T(re),ot=T(Te),pa=T(ot);z(ot),z(Te);var va=O(Te,2);xi(va,17,()=>c(x),Kr=>Kr.id,(Kr,fr)=>{var Yr=Wi(),Zr=T(Yr),ga=T(Zr,!0);z(Zr);var Gr=O(Zr,2),Jr=T(Gr),ma=T(Jr,!0);z(Jr);var gs=O(Jr,2),_a=T(gs,!0);z(gs),z(Gr);var ba=O(Gr,2);ba.__click=()=>Br(c(fr).id),z(Yr),X((wa,ya)=>{Ye(ga,wa),Ye(ma,c(fr).name),Ye(_a,ya)},[()=>Tt(c(fr).type),()=>Hr(c(fr).size)]),L(Kr,Yr)}),z(re),X(()=>Ye(pa,`Attachments (${c(x).length??""}/5)`)),L(J,re)};H(vs,J=>{c(x).length>0&&J(ua)})}var da=O(vs,2);{var ha=J=>{var re=Yi(),Te=O(T(re),2),ot=T(Te);z(Te),z(re),X(()=>Ye(ot,`${c(ee).length??""} console error(s) captured`)),L(J,re)};H(da,J=>{l()&&c(ee).length>0&&J(ha)})}z(b),L(v,b)};H(Je,v=>{c(K)&&!c(p)&&c(bt)&&!c(u)&&v(at)})}var Rt=O(Je,2);{var qr=v=>{var b=Xi();b.__click=Se;var C=T(b);{var te=q=>{var ge=Gi();L(q,ge)},Fe=q=>{var ge=Ji();L(q,ge)};H(C,q=>{c(g)?q(te):q(Fe,!1)})}z(b),X(()=>er(b,"aria-label",c(g)?"Close feedback":"Send feedback")),L(v,b)};H(Rt,v=>{c(u)||v(qr)})}var cr=O(Rt,2);{var Vr=v=>{var b=ea();let C;b.__click=At;var te=T(b);{var Fe=q=>{var ge=Qi(),Ue=T(ge,!0);z(ge),X(()=>Ye(Ue,c(x).length)),L(q,ge)};H(te,q=>{c(x).length>0&&q(Fe)})}gr(2),z(b),X(()=>C=_t(b,1,"capture-toggle-btn svelte-p7nz7",null,C,{"has-items":c(x).length>0})),L(v,b)};H(cr,v=>{!c(u)&&c(g)&&c(bt)&&!c(p)&&v(Vr)})}var Mt=O(cr,2);Mt.__change=jr,Nr(Mt,v=>m(R,v),()=>c(R));var ve=O(Mt,2);{var Pe=v=>{var b=ra();let C;var te=T(b);{var Fe=Ue=>{var Wr=ta();L(Ue,Wr)};H(te,Ue=>{c(h)||Ue(Fe)})}var q=O(te,2);let ge;Nr(q,Ue=>m(_,Ue),()=>c(_)),z(b),X(()=>{C=_t(b,1,"panel-window svelte-p7nz7",null,C,{inline:c(u)}),er(q,"src",c(Ne)),ge=_t(q,1,"svelte-p7nz7",null,ge,{hidden:!c(h)})}),L(v,b)};H(ve,v=>{c(g)&&v(Pe)})}return z(y),X(()=>{D=_t(y,1,"feedback-panel svelte-p7nz7",null,D,{inline:c(u)}),Or(y,c(u)?"":c(Ae))}),L(e,y),_r(lr)}Jn(["click","change"]),customElements.define("feedback-panel",fs(hs,{embedId:{attribute:"embed-id",reflect:!0},embedUrl:{attribute:"embed-url",reflect:!0},position:{attribute:"position",reflect:!0},display:{attribute:"display",reflect:!0},allowAttachments:{attribute:"allow-attachments",reflect:!0,type:"Boolean"},allowScreenRecording:{attribute:"allow-screen-recording",reflect:!0,type:"Boolean"},captureConsoleLogs:{attribute:"capture-console-logs",reflect:!0,type:"Boolean"},showHeader:{attribute:"show-header",reflect:!0}},[],[],{mode:"open"}));const rr="https://api.fortalece.ai";function Ur(){return`msg_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function ps(e){const t={"Content-Type":"application/json"};return e.apiKey&&(t.Authorization=`Bearer ${e.apiKey}`),e.projectId&&(t["X-Project-ID"]=e.projectId),t}async function ia(e,t,r){const n=e.apiUrl||rr,s={projectId:e.projectId,message:t,conversationId:r};try{const i=await fetch(`${n}/api/chat/message`,{method:"POST",headers:ps(e),body:JSON.stringify(s)});if(!i.ok)return{success:!1,error:(await i.json().catch(()=>({}))).error||`Request failed with status ${i.status}`};const a=await i.json();return{success:!0,message:{id:a.id||Ur(),role:"assistant",content:a.message||a.content||"",timestamp:new Date(a.timestamp||Date.now()),metadata:a.metadata},conversationId:a.conversationId}}catch(i){return{success:!1,error:i instanceof Error?i.message:"Unknown error occurred"}}}function aa(e){return{id:Ur(),role:"user",content:e,timestamp:new Date}}function oa(e){return{id:Ur(),role:"system",content:e,timestamp:new Date}}async function la(e,t){const r=e.apiUrl||rr,n={...t,projectId:e.projectId};try{const s=await fetch(`${r}/api/feedback`,{method:"POST",headers:ps(e),body:JSON.stringify(n)});if(!s.ok)return{success:!1,error:(await s.json().catch(()=>({}))).error||`Request failed with status ${s.status}`};const i=await s.json();return{success:!0,feedbackId:i.feedbackId||i.id}}catch(s){return{success:!1,error:s instanceof Error?s.message:"Unknown error occurred"}}}function ca(e,t){return{projectId:e,apiUrl:t?.apiUrl||rr,apiKey:t?.apiKey}}const fa="0.2.0";V.ContextCaptureService=us,V.DEFAULT_API_URL=rr,V.FeedbackPanel=hs,V.SupportChat=ds,V.VERSION=fa,V.createApiConfig=ca,V.createSystemMessage=oa,V.createUserMessage=aa,V.getContextCaptureService=Fr,V.sendMessage=ia,V.submitFeedback=la,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})}));
98
+ }`};function vi(e,t){bn(t,!0),ai(e,sa);let n=Z(t,"embedId"),r=Z(t,"embedUrl",7,"https://app.fortalece.ai"),i=Z(t,"position",7,"bottom-right"),s=Z(t,"display",7,"floating"),a=Z(t,"allowAttachments",7,!0),o=Z(t,"allowScreenRecording",7,!0),l=Z(t,"captureConsoleLogs",7,!0),u=Z(t,"showHeader",7,"true");const f=$e(()=>s()==="inline");let d=T(!1),h=T(!1);const g=$e(()=>c(f)?!0:c(d));let p=T(!1),_=T(void 0),I=T(void 0),y=T(null),S=T(Pe([])),te=T(Pe([])),K=T(!1);const J=$e(()=>u()==="false"||u()===!1),Fe=$e(()=>`${r()}/embed/${n()}?type=feedback-panel${c(J)?"&showHeader=false":""}`),Te=$e(()=>i()==="bottom-left"?"left: 1rem; right: auto;":"right: 1rem; left: auto;"),O=$e(()=>c(S).length<5),wt=$e(()=>a()||o());ii(()=>{m(y,jn(),!0),l()&&c(y).startConsoleCapture();function v(w){try{const ne=new URL(r()).origin;if(w.origin!==ne)return}catch{return}const{type:A}=w.data||{};switch(A){case"fortalece:ready":m(h,!0),Rt();break;case"fortalece:close-request":m(d,!1);break;case"fortalece:request-context":Rt();break;case"fortalece:request-attachments":sn();break;case"fortalece:submit-start":break;case"fortalece:submit-complete":w.data.payload?.success&&(cn(),c(f)||m(d,!1));break}}return window.addEventListener("message",v),()=>{window.removeEventListener("message",v),l()&&c(y)&&c(y).stopConsoleCapture()}});function Ee(){m(d,!c(d)),c(d)&&m(K,!1)}function zt(){m(K,!c(K))}function ce(v,w={}){if(c(_)?.contentWindow)try{const A=new URL(r()).origin;c(_).contentWindow.postMessage({type:v,payload:w},A)}catch{}}function Rt(){if(!c(y))return;const v=c(y).getPageContext();if(ce("fortalece:page-context",v),l()){const w=c(y).getConsoleErrors();ce("fortalece:console-logs",{logs:w})}ce("fortalece:capture-state",{allowAttachments:a(),allowScreenRecording:o(),captureConsoleLogs:l(),attachmentCount:c(S).length,maxAttachments:5})}function sn(){c(S).forEach(v=>{ce("fortalece:attachment-added",v)})}let Ze=!1;Zt(()=>{const v=c(g)&&c(h);v&&!Ze?(Ze=!0,ce("fortalece:opened"),Rt(),sn()):v||(Ze=!1)});function an(){c(I)?.click()}async function Wn(v){const w=v.target;if(!(!w.files||!c(y))){for(const A of Array.from(w.files)){if(!c(O))break;const ne=await c(y).addAttachment(A);ne&&(m(S,[...c(S),ne],!0),ce("fortalece:attachment-added",ne))}w.value=""}}function qn(v){c(y)&&(c(y).removeAttachment(v),m(S,c(S).filter(w=>w.id!==v),!0),ce("fortalece:attachment-removed",{id:v}))}async function yt(){if(!(!c(y)||c(p)))try{await c(y).startScreenRecording(),m(p,!0),m(K,!1)}catch(v){console.error("[SDK] Failed to start recording:",v)}}async function on(){if(!c(y)||!c(p))return;m(p,!1);const v=await c(y).stopScreenRecording();if(v&&c(O)){const w=`recording-${Date.now()}.webm`,A=await c(y).addBlobAttachment(v,w);A&&(m(S,[...c(S),A],!0),ce("fortalece:attachment-added",A),ce("fortalece:recording-complete",{dataUrl:A.dataUrl,size:A.size}))}}async function ln(){if(!c(y)||!c(O))return;m(K,!1),await new Promise(w=>setTimeout(w,100));const v=await c(y).captureScreenshot();if(v){const w=`screenshot-${Date.now()}.png`,A=await c(y).addBlobAttachment(v,w);A&&(m(S,[...c(S),A],!0),ce("fortalece:attachment-added",A))}}function cn(){c(y)&&(c(y).clearAttachments(),c(y).clearConsoleErrors(),m(S,[],!0),m(te,[],!0))}function Vn(v){return v<1024?`${v} B`:v<1024*1024?`${(v/1024).toFixed(1)} KB`:`${(v/(1024*1024)).toFixed(1)} MB`}function Mt(v){switch(v){case"video":return"🎬";case"audio":return"🎵";default:return"🖼️"}}var un={get embedId(){return n()},set embedId(v){n(v),G()},get embedUrl(){return r()},set embedUrl(v="https://app.fortalece.ai"){r(v),G()},get position(){return i()},set position(v="bottom-right"){i(v),G()},get display(){return s()},set display(v="floating"){s(v),G()},get allowAttachments(){return a()},set allowAttachments(v=!0){a(v),G()},get allowScreenRecording(){return o()},set allowScreenRecording(v=!0){o(v),G()},get captureConsoleLogs(){return l()},set captureConsoleLogs(v=!0){l(v),G()},get showHeader(){return u()},set showHeader(v="true"){u(v),G()}},$=ia();let P;var ue=M($);{var ze=v=>{var w=Ws(),A=F(M(w),4);A.__click=on,R(w),L(v,w)};q(ue,v=>{c(p)&&!c(f)&&v(ze)})}var Xe=F(ue,2);{var ot=v=>{var w=Ys(),A=M(w),ne=F(M(A),2);ne.__click=zt,R(A);var Ue=F(A,2),V=M(Ue);{var me=X=>{var re=qs();re.__click=an,Q(()=>re.disabled=!c(O)),L(X,re)};q(V,X=>{a()&&X(me)})}var je=F(V,2);{var Jn=X=>{var re=Vs(),Re=Rr(re);Re.__click=ln;var lt=F(Re,2);lt.__click=yt,Q(()=>{Re.disabled=!c(O),lt.disabled=!c(O)}),L(X,re)};q(je,X=>{o()&&X(Jn)})}R(Ue);var gi=F(Ue,2);{var Ua=X=>{var re=Ks(),Re=M(re),lt=M(Re),Ha=M(lt);R(lt),R(Re);var Wa=F(Re,2);Ss(Wa,17,()=>c(S),Yn=>Yn.id,(Yn,dn)=>{var Zn=Gs(),Xn=M(Zn),qa=M(Xn,!0);R(Xn);var Qn=F(Xn,2),er=M(Qn),Va=M(er,!0);R(er);var mi=F(er,2),Ga=M(mi,!0);R(mi),R(Qn);var Ka=F(Qn,2);Ka.__click=()=>qn(c(dn).id),R(Zn),Q((Ja,Ya)=>{Je(qa,Ja),Je(Va,c(dn).name),Je(Ga,Ya)},[()=>Mt(c(dn).type),()=>Vn(c(dn).size)]),L(Yn,Zn)}),R(re),Q(()=>Je(Ha,`Attachments (${c(S).length??""}/5)`)),L(X,re)};q(gi,X=>{c(S).length>0&&X(Ua)})}var ja=F(gi,2);{var Ba=X=>{var re=Js(),Re=F(M(re),2),lt=M(Re);R(Re),R(re),Q(()=>Je(lt,`${c(te).length??""} console error(s) captured`)),L(X,re)};q(ja,X=>{l()&&c(te).length>0&&X(Ba)})}R(w),L(v,w)};q(Xe,v=>{c(K)&&!c(p)&&c(wt)&&!c(f)&&v(ot)})}var It=F(Xe,2);{var Gn=v=>{var w=Qs();w.__click=Ee;var A=M(w);{var ne=V=>{var me=Zs();L(V,me)},Ue=V=>{var me=Xs();L(V,me)};q(A,V=>{c(g)?V(ne):V(Ue,!1)})}R(w),Q(()=>nn(w,"aria-label",c(g)?"Close feedback":"Send feedback")),L(v,w)};q(It,v=>{c(f)||v(Gn)})}var fn=F(It,2);{var Kn=v=>{var w=ta();let A;w.__click=zt;var ne=M(w);{var Ue=V=>{var me=ea(),je=M(me,!0);R(me),Q(()=>Je(je,c(S).length)),L(V,me)};q(ne,V=>{c(S).length>0&&V(Ue)})}_n(2),R(w),Q(()=>A=bt(w,1,"capture-toggle-btn svelte-p7nz7",null,A,{"has-items":c(S).length>0})),L(v,w)};q(fn,v=>{!c(f)&&c(g)&&c(wt)&&!c(p)&&v(Kn)})}var Ot=F(fn,2);Ot.__change=Wn,Nn(Ot,v=>m(I,v),()=>c(I));var ge=F(Ot,2);{var Ne=v=>{var w=ra();let A;var ne=M(w);{var Ue=je=>{var Jn=na();L(je,Jn)};q(ne,je=>{c(h)||je(Ue)})}var V=F(ne,2);let me;Nn(V,je=>m(_,je),()=>c(_)),R(w),Q(()=>{A=bt(w,1,"panel-window svelte-p7nz7",null,A,{inline:c(f)}),nn(V,"src",c(Fe)),me=bt(V,1,"svelte-p7nz7",null,me,{hidden:!c(h)})}),L(v,w)};q(ge,v=>{c(g)&&v(Ne)})}return R($),Q(()=>{P=bt($,1,"feedback-panel svelte-p7nz7",null,P,{inline:c(f)}),Fn($,c(f)?"":c(Te))}),L(e,$),wn(un)}Qr(["click","change"]),customElements.define("feedback-panel",di(vi,{embedId:{attribute:"embed-id",reflect:!0},embedUrl:{attribute:"embed-url",reflect:!0},position:{attribute:"position",reflect:!0},display:{attribute:"display",reflect:!0},allowAttachments:{attribute:"allow-attachments",reflect:!0,type:"Boolean"},allowScreenRecording:{attribute:"allow-screen-recording",reflect:!0,type:"Boolean"},captureConsoleLogs:{attribute:"capture-console-logs",reflect:!0,type:"Boolean"},showHeader:{attribute:"show-header",reflect:!0}},[],[],{mode:"open"}));const Tt="https://api.fortalece.ai";function Bn(){return`msg_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function Hn(e){const t={"Content-Type":"application/json"};return e.apiKey&&(t.Authorization=`Bearer ${e.apiKey}`),e.projectId&&(t["X-Project-ID"]=e.projectId),t}async function z(e,t,n){const r=e.apiUrl||Tt;try{const i=await fetch(`${r}${t}`,{...n,headers:{...Hn(e),...n?.headers||{}}}),s=await i.json().catch(()=>({}));return i.ok?{success:!0,data:s}:{success:!1,error:typeof s.error=="string"?s.error:`Request failed with status ${i.status}`}}catch(i){return{success:!1,error:i instanceof Error?i.message:"Unknown error occurred"}}}async function aa(e,t,n){const r=e.apiUrl||Tt,i={projectId:e.projectId,message:t,conversationId:n};try{const s=await fetch(`${r}/api/chat/message`,{method:"POST",headers:Hn(e),body:JSON.stringify(i)});if(!s.ok)return{success:!1,error:(await s.json().catch(()=>({}))).error||`Request failed with status ${s.status}`};const a=await s.json();return{success:!0,message:{id:a.id||Bn(),role:"assistant",content:a.message||a.content||"",timestamp:new Date(a.timestamp||Date.now()),metadata:a.metadata},conversationId:a.conversationId}}catch(s){return{success:!1,error:s instanceof Error?s.message:"Unknown error occurred"}}}function oa(e){return{id:Bn(),role:"user",content:e,timestamp:new Date}}function la(e){return{id:Bn(),role:"system",content:e,timestamp:new Date}}async function ca(e,t){const n=e.apiUrl||Tt,r={...t,projectId:e.projectId};try{const i=await fetch(`${n}/api/feedback`,{method:"POST",headers:Hn(e),body:JSON.stringify(r)});if(!i.ok)return{success:!1,error:(await i.json().catch(()=>({}))).error||`Request failed with status ${i.status}`};const s=await i.json();return{success:!0,feedbackId:s.feedbackId||s.id}}catch(i){return{success:!1,error:i instanceof Error?i.message:"Unknown error occurred"}}}async function ua(e){return z(e,"/api/admin/feedback",{method:"GET"})}async function fa(e,t){return z(e,`/api/admin/feedback/${t}`,{method:"GET"})}async function da(e,t,n){return z(e,`/api/admin/feedback/${t}`,{method:"PUT",body:JSON.stringify(n)})}async function ha(e,t){return z(e,`/api/admin/feedback/${t}/archive`,{method:"POST"})}async function pa(e,t){return z(e,`/api/admin/feedback/${t}/reanalyze`,{method:"POST"})}async function va(e,t){return z(e,`/api/admin/feedback/${t}/work-item`,{method:"POST"})}async function ga(e,t){return z(e,`/api/admin/feedback/${t}/create-and-assign`,{method:"POST"})}async function ma(e){return z(e,"/api/admin/work-items",{method:"GET"})}async function _a(e,t){return z(e,"/api/admin/work-items",{method:"POST",body:JSON.stringify(t)})}async function ba(e,t){return z(e,`/api/admin/work-items/${t}`,{method:"GET"})}async function wa(e,t,n){return z(e,`/api/admin/work-items/${t}`,{method:"PUT",body:JSON.stringify(n)})}async function ya(e,t){return z(e,`/api/admin/work-items/${t}`,{method:"DELETE"})}async function $a(e,t){return z(e,`/api/admin/work-items/${t}/reanalyze`,{method:"POST"})}async function Sa(e,t){return z(e,`/api/admin/work-items/${t}/deployment`,{method:"GET"})}async function ka(e,t){return z(e,`/api/admin/work-items/${t}/environments`,{method:"GET"})}async function Ea(e,t){return z(e,`/api/admin/work-items/${t}/deployment/merge`,{method:"POST"})}async function xa(e,t,n){return z(e,`/api/issues/${t}/assign-agent`,{method:"POST",body:JSON.stringify(n)})}async function Ca(e,t){return z(e,`/api/issues/${t}/agent`,{method:"GET"})}async function Aa(e,t,n){return z(e,`/api/agents/${t}/followup`,{method:"POST",body:JSON.stringify(n)})}async function Ta(e){return z(e,"/api/admin/story-map",{method:"GET"})}async function za(e,t){return z(e,`/api/admin/story-map/${t}`,{method:"GET"})}async function Ra(e,t,n){return z(e,`/api/admin/story-map/${t}`,{method:"POST",body:JSON.stringify(n)})}async function Ma(e,t,n,r){return z(e,`/api/admin/story-map/${t}/${n}`,{method:"PUT",body:JSON.stringify(r)})}async function Ia(e,t,n){return z(e,`/api/admin/story-map/${t}/${n}`,{method:"DELETE"})}async function Oa(e){return z(e,"/api/projects",{method:"GET"})}async function Da(e,t){return z(e,`/api/projects/${t}`,{method:"GET"})}async function La(e){return z(e,"/api/admin/queue",{method:"GET"})}async function Pa(e,t){return z(e,`/api/admin/queue/${t}/cancel`,{method:"POST"})}function Fa(e,t){return{projectId:e,apiUrl:t?.apiUrl||Tt,apiKey:t?.apiKey}}const Na="0.2.0";b.ContextCaptureService=hi,b.DEFAULT_API_URL=Tt,b.FeedbackPanel=vi,b.SupportChat=pi,b.VERSION=Na,b.archiveFeedback=ha,b.assignToAI=xa,b.cancelQueueItem=Pa,b.createAndAssignFromFeedback=ga,b.createApiConfig=Fa,b.createStoryMapEntity=Ra,b.createSystemMessage=la,b.createUserMessage=oa,b.createWorkItem=_a,b.createWorkItemFromFeedback=va,b.deleteStoryMapEntity=Ia,b.deleteWorkItem=ya,b.getAgentInfo=Ca,b.getContextCaptureService=jn,b.getDeployment=Sa,b.getEnvironments=ka,b.getFeedback=fa,b.getProject=Da,b.getStoryMap=Ta,b.getWorkItem=ba,b.listFeedback=ua,b.listProjects=Oa,b.listQueue=La,b.listStoryMapEntities=za,b.listWorkItems=ma,b.mergePR=Ea,b.reanalyzeFeedback=pa,b.reanalyzeWorkItem=$a,b.sendFollowUp=Aa,b.sendMessage=aa,b.submitFeedback=ca,b.updateFeedback=da,b.updateStoryMapEntity=Ma,b.updateWorkItem=wa,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walker-di/fortalece-ai-sdk",
3
- "version": "0.3.13",
3
+ "version": "0.3.16",
4
4
  "type": "module",
5
5
  "description": "Fortalece AI Web Components SDK - Support Chat and Feedback widgets",
6
6
  "author": "Fortalece AI",