@useknest/widget-web 0.1.0-beta.10 → 0.1.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/widget.js +1065 -1029
- package/dist/widget.umd.js +32 -32
- package/package.json +2 -2
package/dist/widget.umd.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(_t,Sr){typeof exports=="object"&&typeof module<"u"?Sr(exports):typeof define=="function"&&define.amd?define(["exports"],Sr):(_t=typeof globalThis<"u"?globalThis:_t||self,Sr(_t.KnestWidget={}))})(this,(function(_t){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const Lu=1,Du=2,ju=16,Fu=1,Uu=2,Ro="[",Tr="[!",$s="]",It={},ae=Symbol(),Mu="http://www.w3.org/1999/xhtml",Io=!1;var Cs=Array.isArray,Bu=Array.prototype.indexOf,Ps=Array.from,xr=Object.keys,hn=Object.defineProperty,fn=Object.getOwnPropertyDescriptor,qu=Object.getOwnPropertyDescriptors,Hu=Object.prototype,zu=Array.prototype,$o=Object.getPrototypeOf,Co=Object.isExtensible;const Wu=()=>{};function Gu(t){for(var e=0;e<t.length;e++)t[e]()}function Po(){var t,e,n=new Promise((r,s)=>{t=r,e=s});return{promise:n,resolve:t,reject:e}}const we=2,Ns=4,Ls=8,$t=16,lt=32,mt=64,Ds=128,De=256,Ar=512,le=1024,xe=2048,vt=4096,Be=8192,Ct=16384,js=32768,Or=65536,No=1<<17,Ku=1<<18,Pt=1<<19,Vu=1<<20,Fs=1<<21,Rr=1<<22,Nt=1<<23,Ir=Symbol("$state"),Ju=Symbol("legacy props"),Yu=Symbol(""),zn=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Us=3,Lt=8;function Xu(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Zu(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Qu(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function ed(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function td(t){throw new Error("https://svelte.dev/e/effect_orphan")}function nd(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function rd(){throw new Error("https://svelte.dev/e/hydration_failed")}function sd(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function id(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function od(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ad(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function Wn(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function ld(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let N=!1;function qe(t){N=t}let L;function ce(t){if(t===null)throw Wn(),It;return L=t}function pn(){return ce(He(L))}function V(t){if(N){if(He(L)!==null)throw Wn(),It;L=t}}function cd(t=1){if(N){for(var e=t,n=L;e--;)n=He(n);L=n}}function $r(t=!0){for(var e=0,n=L;;){if(n.nodeType===Lt){var r=n.data;if(r===$s){if(e===0)return n;e-=1}else(r===Ro||r===Tr)&&(e+=1)}var s=He(n);t&&n.remove(),n=s}}function Lo(t){if(!t||t.nodeType!==Lt)throw Wn(),It;return t.data}function Do(t){return t===this.v}function ud(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function jo(t){return!ud(t,this.v)}let dd=!1,Ae=null;function gn(t){Ae=t}function Cr(t,e=!1,n){Ae={p:Ae,c:null,e:null,s:t,x:null,l:null}}function Pr(t){var e=Ae,n=e.e;if(n!==null){e.e=null;for(var r of n)ia(r)}return t!==void 0&&(e.x=t),Ae=e.p,t??{}}function Fo(){return!0}let Dt=[];function Uo(){var t=Dt;Dt=[],Gu(t)}function jt(t){if(Dt.length===0&&!Gn){var e=Dt;queueMicrotask(()=>{e===Dt&&Uo()})}Dt.push(t)}function hd(){for(;Dt.length>0;)Uo()}const fd=new WeakMap;function Mo(t){var e=C;if(e===null)return D.f|=Nt,t;if((e.f&js)===0){if((e.f&Ds)===0)throw!e.parent&&t instanceof Error&&Bo(t),t;e.b.error(t)}else _n(t,e)}function _n(t,e){for(;e!==null;){if((e.f&Ds)!==0)try{e.b.error(t);return}catch(n){t=n}e=e.parent}throw t instanceof Error&&Bo(t),t}function Bo(t){const e=fd.get(t);e&&(hn(t,"message",{value:e.message}),hn(t,"stack",{value:e.stack}))}const Nr=new Set;let W=null,Lr=null,Ms=new Set,Qe=[],Dr=null,Bs=!1,Gn=!1;class Oe{current=new Map;#t=new Map;#e=new Set;#u=0;#i=null;#l=[];#s=[];#r=[];#n=[];#o=[];#c=[];skipped_effects=new Set;process(e){Qe=[],Lr=null;var n=Oe.apply(this);for(const i of e)this.#d(i);if(this.#u===0){this.#h();var r=this.#s,s=this.#r;this.#s=[],this.#r=[],this.#n=[],Lr=this,W=null,Ho(r),Ho(s),Lr=null,this.#i?.resolve()}else this.#a(this.#s),this.#a(this.#r),this.#a(this.#n);n();for(const i of this.#l)Xn(i);this.#l=[]}#d(e){e.f^=le;for(var n=e.first;n!==null;){var r=n.f,s=(r&(lt|mt))!==0,i=s&&(r&le)!==0,o=i||(r&Be)!==0||this.skipped_effects.has(n);if(!o&&n.fn!==null){s?n.f^=le:(r&Ns)!==0?this.#r.push(n):(r&le)===0&&((r&Rr)!==0&&n.b?.is_pending()?this.#l.push(n):Mr(n)&&((n.f&$t)!==0&&this.#n.push(n),Xn(n)));var a=n.first;if(a!==null){n=a;continue}}var l=n.parent;for(n=n.next;n===null&&l!==null;)n=l.next,l=l.parent}}#a(e){for(const n of e)((n.f&xe)!==0?this.#o:this.#c).push(n),he(n,le);e.length=0}capture(e,n){this.#t.has(e)||this.#t.set(e,n),this.current.set(e,e.v)}activate(){W=this}deactivate(){W=null}flush(){if(Qe.length>0){if(this.activate(),qo(),W!==null&&W!==this)return}else this.#u===0&&this.#h();this.deactivate();for(const e of Ms)if(Ms.delete(e),e(),W!==null)break}#h(){for(const e of this.#e)e();if(this.#e.clear(),Nr.size>1){this.#t.clear();let e=!0;for(const n of Nr){if(n===this){e=!1;continue}for(const[r,s]of this.current){if(n.current.has(r))if(e)n.current.set(r,s);else continue;zo(r)}if(Qe.length>0){W=n;const r=Oe.apply(n);for(const s of Qe)n.#d(s);Qe=[],r()}}W=null}Nr.delete(this)}increment(){this.#u+=1}decrement(){this.#u-=1;for(const e of this.#o)he(e,xe),Ut(e);for(const e of this.#c)he(e,vt),Ut(e);this.flush()}add_callback(e){this.#e.add(e)}settled(){return(this.#i??=Po()).promise}static ensure(){if(W===null){const e=W=new Oe;Nr.add(W),Gn||Oe.enqueue(()=>{W===e&&e.flush()})}return W}static enqueue(e){jt(e)}static apply(e){return Wu}}function ue(t){var e=Gn;Gn=!0;try{for(var n;;){if(hd(),Qe.length===0&&(W?.flush(),Qe.length===0))return Dr=null,n;qo()}}finally{Gn=e}}function qo(){var t=vn;Bs=!0;try{var e=0;for(fa(!0);Qe.length>0;){var n=Oe.ensure();if(e++>1e3){var r,s;pd()}n.process(Qe),bt.clear()}}finally{Bs=!1,fa(t),Dr=null}}function pd(){try{nd()}catch(t){_n(t,Dr)}}let Ft=null;function Ho(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&(Ct|Be))===0&&Mr(r)&&(Ft=[],Xn(r),r.deps===null&&r.first===null&&r.nodes_start===null&&(r.teardown===null&&r.ac===null?ua(r):r.fn=null),Ft?.length>0)){bt.clear();for(const s of Ft)Xn(s);Ft=[]}}Ft=null}}function zo(t){if(t.reactions!==null)for(const e of t.reactions){const n=e.f;(n&we)!==0?zo(e):(n&(Rr|$t))!==0&&(he(e,xe),Ut(e))}}function Ut(t){for(var e=Dr=t;e.parent!==null;){e=e.parent;var n=e.f;if(Bs&&e===C&&(n&$t)!==0)return;if((n&(mt|lt))!==0){if((n&le)===0)return;e.f^=le}}Qe.push(e)}function gd(t){let e=0,n=Mt(0),r;return()=>{Od()&&(T(n),Ur(()=>(e===0&&(r=qr(()=>t(()=>Jn(n)))),e+=1,()=>{jt(()=>{e-=1,e===0&&(r?.(),r=void 0,Jn(n))})})))}}var _d=Or|Pt|Ds;function md(t,e,n){new vd(t,e,n)}class vd{parent;#t=!1;#e;#u=N?L:null;#i;#l;#s;#r=null;#n=null;#o=null;#c=null;#d=0;#a=0;#h=!1;#f=null;#m=()=>{this.#f&&Vn(this.#f,this.#d)};#v=gd(()=>(this.#f=Mt(this.#d),()=>{this.#f=null}));constructor(e,n,r){this.#e=e,this.#i=n,this.#l=r,this.parent=C.b,this.#t=!!this.#i.pending,this.#s=Ws(()=>{if(C.b=this,N){const s=this.#u;pn(),s.nodeType===Lt&&s.data===Tr?this.#y():this.#b()}else{try{this.#r=Fe(()=>r(this.#e))}catch(s){this.error(s)}this.#a>0?this.#g():this.#t=!1}},_d),N&&(this.#e=L)}#b(){try{this.#r=Fe(()=>this.#l(this.#e))}catch(e){this.error(e)}this.#t=!1}#y(){const e=this.#i.pending;e&&(this.#n=Fe(()=>e(this.#e)),Oe.enqueue(()=>{this.#r=this.#p(()=>(Oe.ensure(),Fe(()=>this.#l(this.#e)))),this.#a>0?this.#g():(mn(this.#n,()=>{this.#n=null}),this.#t=!1)}))}is_pending(){return this.#t||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#i.pending}#p(e){var n=C,r=D,s=Ae;nt(this.#s),Ee(this.#s),gn(this.#s.ctx);try{return e()}catch(i){return Mo(i),null}finally{nt(n),Ee(r),gn(s)}}#g(){const e=this.#i.pending;this.#r!==null&&(this.#c=document.createDocumentFragment(),bd(this.#r,this.#c)),this.#n===null&&(this.#n=Fe(()=>e(this.#e)))}#_(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#_(e);return}this.#a+=e,this.#a===0&&(this.#t=!1,this.#n&&mn(this.#n,()=>{this.#n=null}),this.#c&&(this.#e.before(this.#c),this.#c=null),jt(()=>{Oe.ensure().flush()}))}update_pending_count(e){this.#_(e),this.#d+=e,Ms.add(this.#m)}get_effect_pending(){return this.#v(),T(this.#f)}error(e){var n=this.#i.onerror;let r=this.#i.failed;if(this.#h||!n&&!r)throw e;this.#r&&(Ie(this.#r),this.#r=null),this.#n&&(Ie(this.#n),this.#n=null),this.#o&&(Ie(this.#o),this.#o=null),N&&(ce(this.#u),cd(),ce($r()));var s=!1,i=!1;const o=()=>{if(s){ld();return}s=!0,i&&ad(),Oe.ensure(),this.#d=0,this.#o!==null&&mn(this.#o,()=>{this.#o=null}),this.#t=this.has_pending_snippet(),this.#r=this.#p(()=>(this.#h=!1,Fe(()=>this.#l(this.#e)))),this.#a>0?this.#g():this.#t=!1};var a=D;try{Ee(null),i=!0,n?.(e,o),i=!1}catch(l){_n(l,this.#s&&this.#s.parent)}finally{Ee(a)}r&&jt(()=>{this.#o=this.#p(()=>{this.#h=!0;try{return Fe(()=>{r(this.#e,()=>e,()=>o)})}catch(l){return _n(l,this.#s.parent),null}finally{this.#h=!1}})})}}function bd(t,e){for(var n=t.nodes_start,r=t.nodes_end;n!==null;){var s=n===r?null:He(n);e.append(n),n=s}}function yd(t,e,n){const r=jr;if(e.length===0){n(t.map(r));return}var s=W,i=C,o=wd(),a=N;Promise.all(e.map(l=>Ed(l))).then(l=>{o();try{n([...t.map(r),...l])}catch(c){(i.f&Ct)===0&&_n(c,i)}a&&qe(!1),s?.deactivate(),Wo()}).catch(l=>{_n(l,i)})}function wd(){var t=C,e=D,n=Ae,r=W,s=N;if(s)var i=L;return function(){nt(t),Ee(e),gn(n),r?.activate(),s&&(qe(!0),ce(i))}}function Wo(){nt(null),Ee(null),gn(null)}function jr(t){var e=we|xe,n=D!==null&&(D.f&we)!==0?D:null;return C===null||n!==null&&(n.f&De)!==0?e|=De:C.f|=Pt,{ctx:Ae,deps:null,effects:null,equals:Do,f:e,fn:t,reactions:null,rv:0,v:ae,wv:0,parent:n??C,ac:null}}function Ed(t,e){let n=C;n===null&&Zu();var r=n.b,s=void 0,i=Mt(ae),o=!D,a=new Map;return $d(()=>{var l=Po();s=l.promise;try{Promise.resolve(t()).then(l.resolve,l.reject)}catch(h){l.reject(h)}var c=W,u=r.is_pending();o&&(r.update_pending_count(1),u||(c.increment(),a.get(c)?.reject(zn),a.set(c,l)));const d=(h,f=void 0)=>{u||c.activate(),f?f!==zn&&(i.f|=Nt,Vn(i,f)):((i.f&Nt)!==0&&(i.f^=Nt),Vn(i,h)),o&&(r.update_pending_count(-1),u||c.decrement()),Wo()};l.promise.then(d,h=>d(null,h||"unknown"))}),sa(()=>{for(const l of a.values())l.reject(zn)}),new Promise(l=>{function c(u){function d(){u===s?l(i):c(s)}u.then(d,d)}c(s)})}function Kn(t){const e=jr(t);return ga(e),e}function kd(t){const e=jr(t);return e.equals=jo,e}function Go(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)Ie(e[n])}}function Sd(t){for(var e=t.parent;e!==null;){if((e.f&we)===0)return e;e=e.parent}return null}function qs(t){var e,n=C;nt(Sd(t));try{Go(t),e=ya(t)}finally{nt(n)}return e}function Ko(t){var e=qs(t);if(t.equals(e)||(t.v=e,t.wv=va()),!Ht){var n=(wt||(t.f&De)!==0)&&t.deps!==null?vt:le;he(t,n)}}const bt=new Map;function Mt(t,e){var n={f:0,v:t,reactions:null,equals:Do,rv:0,wv:0};return n}function Q(t,e){const n=Mt(t);return ga(n),n}function Vo(t,e=!1,n=!0){const r=Mt(t);return e||(r.equals=jo),r}function U(t,e,n=!1){D!==null&&(!ze||(D.f&No)!==0)&&Fo()&&(D.f&(we|$t|Rr|No))!==0&&!ct?.includes(t)&&od();let r=n?Bt(e):e;return Vn(t,r)}function Vn(t,e){if(!t.equals(e)){var n=t.v;Ht?bt.set(t,e):bt.set(t,n),t.v=e;var r=Oe.ensure();r.capture(t,n),(t.f&we)!==0&&((t.f&xe)!==0&&qs(t),he(t,(t.f&De)===0?le:vt)),t.wv=va(),Jo(t,xe),C!==null&&(C.f&le)!==0&&(C.f&(lt|mt))===0&&(Ue===null?Pd([t]):Ue.push(t))}return e}function Jn(t){U(t,t.v+1)}function Jo(t,e){var n=t.reactions;if(n!==null)for(var r=n.length,s=0;s<r;s++){var i=n[s],o=i.f,a=(o&xe)===0;a&&he(i,e),(o&we)!==0?Jo(i,vt):a&&((o&$t)!==0&&Ft!==null&&Ft.push(i),Ut(i))}}function Bt(t){if(typeof t!="object"||t===null||Ir in t)return t;const e=$o(t);if(e!==Hu&&e!==zu)return t;var n=new Map,r=Cs(t),s=Q(0),i=zt,o=a=>{if(zt===i)return a();var l=D,c=zt;Ee(null),ma(i);var u=a();return Ee(l),ma(c),u};return r&&n.set("length",Q(t.length)),new Proxy(t,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&sd();var u=n.get(l);return u===void 0?u=o(()=>{var d=Q(c.value);return n.set(l,d),d}):U(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>Q(ae));n.set(l,u),Jn(s)}}else U(c,ae),Jn(s);return!0},get(a,l,c){if(l===Ir)return t;var u=n.get(l),d=l in a;if(u===void 0&&(!d||fn(a,l)?.writable)&&(u=o(()=>{var f=Bt(d?a[l]:ae),p=Q(f);return p}),n.set(l,u)),u!==void 0){var h=T(u);return h===ae?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=T(u))}else if(c===void 0){var d=n.get(l),h=d?.v;if(d!==void 0&&h!==ae)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){if(l===Ir)return!0;var c=n.get(l),u=c!==void 0&&c.v!==ae||Reflect.has(a,l);if(c!==void 0||C!==null&&(!u||fn(a,l)?.writable)){c===void 0&&(c=o(()=>{var h=u?Bt(a[l]):ae,f=Q(h);return f}),n.set(l,c));var d=T(c);if(d===ae)return!1}return u},set(a,l,c,u){var d=n.get(l),h=l in a;if(r&&l==="length")for(var f=c;f<d.v;f+=1){var p=n.get(f+"");p!==void 0?U(p,ae):f in a&&(p=o(()=>Q(ae)),n.set(f+"",p))}if(d===void 0)(!h||fn(a,l)?.writable)&&(d=o(()=>Q(void 0)),U(d,Bt(c)),n.set(l,d));else{h=d.v!==ae;var v=o(()=>Bt(c));U(d,v)}var b=Reflect.getOwnPropertyDescriptor(a,l);if(b?.set&&b.set.call(u,c),!h){if(r&&typeof l=="string"){var E=n.get("length"),_=Number(l);Number.isInteger(_)&&_>=E.v&&U(E,_+1)}Jn(s)}return!0},ownKeys(a){T(s);var l=Reflect.ownKeys(a).filter(d=>{var h=n.get(d);return h===void 0||h.v!==ae});for(var[c,u]of n)u.v!==ae&&!(c in a)&&l.push(c);return l},setPrototypeOf(){id()}})}var Yo,Xo,Zo,Qo;function Hs(){if(Yo===void 0){Yo=window,Xo=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Zo=fn(e,"firstChild").get,Qo=fn(e,"nextSibling").get,Co(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Co(n)&&(n.__t=void 0)}}function yt(t=""){return document.createTextNode(t)}function je(t){return Zo.call(t)}function He(t){return Qo.call(t)}function J(t,e){if(!N)return je(t);var n=je(L);if(n===null)n=L.appendChild(yt());else if(e&&n.nodeType!==Us){var r=yt();return n?.before(r),ce(r),r}return ce(n),n}function qt(t,e=!1){if(!N){var n=je(t);return n instanceof Comment&&n.data===""?He(n):n}if(e&&L?.nodeType!==Us){var r=yt();return L?.before(r),ce(r),r}return L}function Re(t,e=1,n=!1){let r=N?L:t;for(var s;e--;)s=r,r=He(r);if(!N)return r;if(n&&r?.nodeType!==Us){var i=yt();return r===null?s?.after(i):r.before(i),ce(i),i}return ce(r),r}function ea(t){t.textContent=""}function ta(){return!1}let na=!1;function ra(){na||(na=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{if(!t.defaultPrevented)for(const e of t.target.elements)e.__on_r?.()})},{capture:!0}))}function Fr(t){var e=D,n=C;Ee(null),nt(null);try{return t()}finally{Ee(e),nt(n)}}function Td(t,e,n,r=n){t.addEventListener(e,()=>Fr(n));const s=t.__on_r;s?t.__on_r=()=>{s(),r(!0)}:t.__on_r=()=>r(!0),ra()}function xd(t){C===null&&D===null&&td(),D!==null&&(D.f&De)!==0&&C===null&&ed(),Ht&&Qu()}function Ad(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function et(t,e,n,r=!0){var s=C;s!==null&&(s.f&Be)!==0&&(t|=Be);var i={ctx:Ae,deps:null,nodes_start:null,nodes_end:null,f:t|xe,first:null,fn:e,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(n)try{Xn(i),i.f|=js}catch(l){throw Ie(i),l}else e!==null&&Ut(i);if(r){var o=i;if(n&&o.deps===null&&o.teardown===null&&o.nodes_start===null&&o.first===o.last&&(o.f&Pt)===0&&(o=o.first),o!==null&&(o.parent=s,s!==null&&Ad(o,s),D!==null&&(D.f&we)!==0&&(t&mt)===0)){var a=D;(a.effects??=[]).push(o)}}return i}function Od(){return D!==null&&!ze}function sa(t){const e=et(Ls,null,!1);return he(e,le),e.teardown=t,e}function zs(t){xd();var e=C.f,n=!D&&(e<)!==0&&(e&js)===0;if(n){var r=Ae;(r.e??=[]).push(t)}else return ia(t)}function ia(t){return et(Ns|Vu,t,!1)}function Rd(t){Oe.ensure();const e=et(mt|Pt,t,!0);return()=>{Ie(e)}}function Id(t){Oe.ensure();const e=et(mt|Pt,t,!0);return(n={})=>new Promise(r=>{n.outro?mn(e,()=>{Ie(e),r(void 0)}):(Ie(e),r(void 0))})}function oa(t){return et(Ns,t,!1)}function $d(t){return et(Rr|Pt,t,!0)}function Ur(t,e=0){return et(Ls|e,t,!0)}function tt(t,e=[],n=[]){yd(e,n,r=>{et(Ls,()=>t(...r.map(T)),!0)})}function Ws(t,e=0){var n=et($t|e,t,!0);return n}function Fe(t,e=!0){return et(lt|Pt,t,!0,e)}function aa(t){var e=t.teardown;if(e!==null){const n=Ht,r=D;pa(!0),Ee(null);try{e.call(null)}finally{pa(n),Ee(r)}}}function la(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const s=n.ac;s!==null&&Fr(()=>{s.abort(zn)});var r=n.next;(n.f&mt)!==0?n.parent=null:Ie(n,e),n=r}}function Cd(t){for(var e=t.first;e!==null;){var n=e.next;(e.f<)===0&&Ie(e),e=n}}function Ie(t,e=!0){var n=!1;(e||(t.f&Ku)!==0)&&t.nodes_start!==null&&t.nodes_end!==null&&(ca(t.nodes_start,t.nodes_end),n=!0),la(t,e&&!n),Br(t,0),he(t,Ct);var r=t.transitions;if(r!==null)for(const i of r)i.stop();aa(t);var s=t.parent;s!==null&&s.first!==null&&ua(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function ca(t,e){for(;t!==null;){var n=t===e?null:He(t);t.remove(),t=n}}function ua(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function mn(t,e){var n=[];Gs(t,n,!0),da(n,()=>{Ie(t),e&&e()})}function da(t,e){var n=t.length;if(n>0){var r=()=>--n||e();for(var s of t)s.out(r)}else e()}function Gs(t,e,n){if((t.f&Be)===0){if(t.f^=Be,t.transitions!==null)for(const o of t.transitions)(o.is_global||n)&&e.push(o);for(var r=t.first;r!==null;){var s=r.next,i=(r.f&Or)!==0||(r.f<)!==0;Gs(r,e,i?n:!1),r=s}}}function Ks(t){ha(t,!0)}function ha(t,e){if((t.f&Be)!==0){t.f^=Be,(t.f&le)===0&&(he(t,xe),Ut(t));for(var n=t.first;n!==null;){var r=n.next,s=(n.f&Or)!==0||(n.f<)!==0;ha(n,s?e:!1),n=r}if(t.transitions!==null)for(const i of t.transitions)(i.is_global||e)&&i.in()}}let vn=!1;function fa(t){vn=t}let Ht=!1;function pa(t){Ht=t}let D=null,ze=!1;function Ee(t){D=t}let C=null;function nt(t){C=t}let ct=null;function ga(t){D!==null&&(ct===null?ct=[t]:ct.push(t))}let de=null,$e=0,Ue=null;function Pd(t){Ue=t}let _a=1,Yn=0,zt=Yn;function ma(t){zt=t}let wt=!1;function va(){return++_a}function Mr(t){var e=t.f;if((e&xe)!==0)return!0;if((e&vt)!==0){var n=t.deps,r=(e&De)!==0;if(n!==null){var s,i,o=(e&Ar)!==0,a=r&&C!==null&&!wt,l=n.length;if((o||a)&&(C===null||(C.f&Ct)===0)){var c=t,u=c.parent;for(s=0;s<l;s++)i=n[s],(o||!i?.reactions?.includes(c))&&(i.reactions??=[]).push(c);o&&(c.f^=Ar),a&&u!==null&&(u.f&De)===0&&(c.f^=De)}for(s=0;s<l;s++)if(i=n[s],Mr(i)&&Ko(i),i.wv>t.wv)return!0}(!r||C!==null&&!wt)&&he(t,le)}return!1}function ba(t,e,n=!0){var r=t.reactions;if(r!==null&&!ct?.includes(t))for(var s=0;s<r.length;s++){var i=r[s];(i.f&we)!==0?ba(i,e,!1):e===i&&(n?he(i,xe):(i.f&le)!==0&&he(i,vt),Ut(i))}}function ya(t){var e=de,n=$e,r=Ue,s=D,i=wt,o=ct,a=Ae,l=ze,c=zt,u=t.f;de=null,$e=0,Ue=null,wt=(u&De)!==0&&(ze||!vn||D===null),D=(u&(lt|mt))===0?t:null,ct=null,gn(t.ctx),ze=!1,zt=++Yn,t.ac!==null&&(Fr(()=>{t.ac.abort(zn)}),t.ac=null);try{t.f|=Fs;var d=t.fn,h=d(),f=t.deps;if(de!==null){var p;if(Br(t,$e),f!==null&&$e>0)for(f.length=$e+de.length,p=0;p<de.length;p++)f[$e+p]=de[p];else t.deps=f=de;if(!wt||(u&we)!==0&&t.reactions!==null)for(p=$e;p<f.length;p++)(f[p].reactions??=[]).push(t)}else f!==null&&$e<f.length&&(Br(t,$e),f.length=$e);if(Fo()&&Ue!==null&&!ze&&f!==null&&(t.f&(we|vt|xe))===0)for(p=0;p<Ue.length;p++)ba(Ue[p],t);return s!==null&&s!==t&&(Yn++,Ue!==null&&(r===null?r=Ue:r.push(...Ue))),(t.f&Nt)!==0&&(t.f^=Nt),h}catch(v){return Mo(v)}finally{t.f^=Fs,de=e,$e=n,Ue=r,D=s,wt=i,ct=o,gn(a),ze=l,zt=c}}function Nd(t,e){let n=e.reactions;if(n!==null){var r=Bu.call(n,t);if(r!==-1){var s=n.length-1;s===0?n=e.reactions=null:(n[r]=n[s],n.pop())}}n===null&&(e.f&we)!==0&&(de===null||!de.includes(e))&&(he(e,vt),(e.f&(De|Ar))===0&&(e.f^=Ar),Go(e),Br(e,0))}function Br(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)Nd(t,n[r])}function Xn(t){var e=t.f;if((e&Ct)===0){he(t,le);var n=C,r=vn;C=t,vn=!0;try{(e&$t)!==0?Cd(t):la(t),aa(t);var s=ya(t);t.teardown=typeof s=="function"?s:null,t.wv=_a;var i;Io&&dd&&(t.f&xe)!==0&&t.deps}finally{vn=r,C=n}}}async function Ld(){await Promise.resolve(),ue()}function T(t){var e=t.f,n=(e&we)!==0;if(D!==null&&!ze){var r=C!==null&&(C.f&Ct)!==0;if(!r&&!ct?.includes(t)){var s=D.deps;if((D.f&Fs)!==0)t.rv<Yn&&(t.rv=Yn,de===null&&s!==null&&s[$e]===t?$e++:de===null?de=[t]:(!wt||!de.includes(t))&&de.push(t));else{(D.deps??=[]).push(t);var i=t.reactions;i===null?t.reactions=[D]:i.includes(D)||i.push(D)}}}else if(n&&t.deps===null&&t.effects===null){var o=t,a=o.parent;a!==null&&(a.f&De)===0&&(o.f^=De)}if(Ht){if(bt.has(t))return bt.get(t);if(n){o=t;var l=o.v;return((o.f&le)===0&&o.reactions!==null||wa(o))&&(l=qs(o)),bt.set(o,l),l}}else n&&(o=t,Mr(o)&&Ko(o));if((t.f&Nt)!==0)throw t.v;return t.v}function wa(t){if(t.v===ae)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(bt.has(e)||(e.f&we)!==0&&wa(e))return!0;return!1}function qr(t){var e=ze;try{return ze=!0,t()}finally{ze=e}}const Dd=-7169;function he(t,e){t.f=t.f&Dd|e}const Ea=new Set,Vs=new Set;function jd(t){if(!N)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;e!==void 0&&(t.__e=void 0,queueMicrotask(()=>{t.isConnected&&t.dispatchEvent(e)}))}function Fd(t,e,n,r={}){function s(i){if(r.capture||Zn.call(e,i),!i.cancelBubble)return Fr(()=>n?.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?jt(()=>{e.addEventListener(t,s,r)}):e.addEventListener(t,s,r),s}function ka(t,e,n,r,s){var i={capture:r,passive:s},o=Fd(t,e,n,i);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&sa(()=>{e.removeEventListener(t,o,i)})}function Ud(t){for(var e=0;e<t.length;e++)Ea.add(t[e]);for(var n of Vs)n(t)}let Sa=null;function Zn(t){var e=this,n=e.ownerDocument,r=t.type,s=t.composedPath?.()||[],i=s[0]||t.target;Sa=t;var o=0,a=Sa===t&&t.__root;if(a){var l=s.indexOf(a);if(l!==-1&&(e===document||e===window)){t.__root=e;return}var c=s.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(i=s[o]||t.target,i!==e){hn(t,"currentTarget",{configurable:!0,get(){return i||n}});var u=D,d=C;Ee(null),nt(null);try{for(var h,f=[];i!==null;){var p=i.assignedSlot||i.parentNode||i.host||null;try{var v=i["__"+r];if(v!=null&&(!i.disabled||t.target===i))if(Cs(v)){var[b,...E]=v;b.apply(i,[t,...E])}else v.call(i,t)}catch(_){h?f.push(_):h=_}if(t.cancelBubble||p===e||p===null)break;i=p}if(h){for(let _ of f)queueMicrotask(()=>{throw _});throw h}}finally{t.__root=e,delete t.currentTarget,Ee(u),nt(d)}}}function Js(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function rt(t,e){var n=C;n.nodes_start===null&&(n.nodes_start=t,n.nodes_end=e)}function ee(t,e){var n=(e&Fu)!==0,r=(e&Uu)!==0,s,i=!t.startsWith("<!>");return()=>{if(N)return rt(L,null),L;s===void 0&&(s=Js(i?t:"<!>"+t),n||(s=je(s)));var o=r||Xo?document.importNode(s,!0):s.cloneNode(!0);if(n){var a=je(o),l=o.lastChild;rt(a,l)}else rt(o,o);return o}}function Md(t,e,n="svg"){var r=!t.startsWith("<!>"),s=`<${n}>${r?t:"<!>"+t}</${n}>`,i;return()=>{if(N)return rt(L,null),L;if(!i){var o=Js(s),a=je(o);i=je(a)}var l=i.cloneNode(!0);return rt(l,l),l}}function Ys(t,e){return Md(t,e,"svg")}function Qn(){if(N)return rt(L,null),L;var t=document.createDocumentFragment(),e=document.createComment(""),n=yt();return t.append(e,n),rt(e,n),t}function B(t,e){if(N){C.nodes_end=L,pn();return}t!==null&&t.before(e)}const Bd=["touchstart","touchmove"];function qd(t){return Bd.includes(t)}function Hr(t,e){var n=e==null?"":typeof e=="object"?e+"":e;n!==(t.__t??=t.nodeValue)&&(t.__t=n,t.nodeValue=n+"")}function Ta(t,e){return xa(t,e)}function Hd(t,e){Hs(),e.intro=e.intro??!1;const n=e.target,r=N,s=L;try{for(var i=je(n);i&&(i.nodeType!==Lt||i.data!==Ro);)i=He(i);if(!i)throw It;qe(!0),ce(i);const o=xa(t,{...e,anchor:i});return qe(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
|
|
2
|
-
`).some(a=>a.startsWith("https://svelte.dev/e/")))throw o;return o!==It&&console.warn("Failed to hydrate: ",o),e.recover===!1&&rd(),Hs(),ea(n),qe(!1),Ta(t,e)}finally{qe(r),ce(s)}}const bn=new Map;function xa(t,{target:e,anchor:n,props:r={},events:s,context:i,intro:o=!0}){Hs();var a=new Set,l=d=>{for(var h=0;h<d.length;h++){var f=d[h];if(!a.has(f)){a.add(f);var p=qd(f);e.addEventListener(f,Zn,{passive:p});var v=bn.get(f);v===void 0?(document.addEventListener(f,Zn,{passive:p}),bn.set(f,1)):bn.set(f,v+1)}}};l(Ps(Ea)),Vs.add(l);var c=void 0,u=Id(()=>{var d=n??e.appendChild(yt());return md(d,{pending:()=>{}},h=>{if(i){Cr({});var f=Ae;f.c=i}if(s&&(r.$$events=s),N&&rt(h,null),c=t(h,r)||{},N&&(C.nodes_end=L,L===null||L.nodeType!==Lt||L.data!==$s))throw Wn(),It;i&&Pr()}),()=>{for(var h of a){e.removeEventListener(h,Zn);var f=bn.get(h);--f===0?(document.removeEventListener(h,Zn),bn.delete(h)):bn.set(h,f)}Vs.delete(l),d!==n&&d.parentNode?.removeChild(d)}});return Xs.set(c,u),c}let Xs=new WeakMap;function zd(t,e){const n=Xs.get(t);return n?(Xs.delete(t),n(e)):Promise.resolve()}function Wd(t){Ae===null&&Xu(),zs(()=>{const e=qr(t);if(typeof e=="function")return e})}function fe(t,e,n=!1){N&&pn();var r=t,s=null,i=null,o=ae,a=n?Or:0,l=!1;const c=(f,p=!0)=>{l=!0,h(p,f)};var u=null;function d(){u!==null&&(u.lastChild.remove(),r.before(u),u=null);var f=o?s:i,p=o?i:s;f&&Ks(f),p&&mn(p,()=>{o?i=null:s=null})}const h=(f,p)=>{if(o===(o=f))return;let v=!1;if(N){const y=Lo(r)===Tr;!!o===y&&(r=$r(),ce(r),qe(!1),v=!0)}var b=ta(),E=r;if(b&&(u=document.createDocumentFragment(),u.append(E=yt())),o?s??=p&&Fe(()=>p(E)):i??=p&&Fe(()=>p(E)),b){var _=W,g=o?s:i,m=o?i:s;g&&_.skipped_effects.delete(g),m&&_.skipped_effects.add(m),_.add_callback(d)}else d();v&&qe(!0)};Ws(()=>{l=!1,e(c),l||h(null,null)},a),N&&(r=L)}function Zs(t,e){return e}function Gd(t,e,n){for(var r=t.items,s=[],i=e.length,o=0;o<i;o++)Gs(e[o].e,s,!0);var a=i>0&&s.length===0&&n!==null;if(a){var l=n.parentNode;ea(l),l.append(n),r.clear(),st(t,e[0].prev,e[i-1].next)}da(s,()=>{for(var c=0;c<i;c++){var u=e[c];a||(r.delete(u.k),st(t,u.prev,u.next)),Ie(u.e,!a)}})}function Qs(t,e,n,r,s,i=null){var o=t,a={flags:e,items:new Map,first:null};N&&pn();var l=null,c=!1,u=new Map,d=kd(()=>{var v=n();return Cs(v)?v:v==null?[]:Ps(v)}),h,f;function p(){Kd(f,h,a,u,o,s,e,r,n),i!==null&&(h.length===0?l?Ks(l):l=Fe(()=>i(o)):l!==null&&mn(l,()=>{l=null}))}Ws(()=>{f??=C,h=T(d);var v=h.length;if(c&&v===0)return;c=v===0;let b=!1;if(N){var E=Lo(o)===Tr;E!==(v===0)&&(o=$r(),ce(o),qe(!1),b=!0)}if(N){for(var _=null,g,m=0;m<v;m++){if(L.nodeType===Lt&&L.data===$s){o=L,b=!0,qe(!1);break}var y=h[m],w=r(y,m);g=ei(L,a,_,null,y,w,m,s,e,n),a.items.set(w,g),_=g}v>0&&ce($r())}if(N)v===0&&i&&(l=Fe(()=>i(o)));else if(ta()){var k=new Set,x=W;for(m=0;m<v;m+=1){y=h[m],w=r(y,m);var S=a.items.get(w)??u.get(w);S?Aa(S,y,m):(g=ei(null,a,null,null,y,w,m,s,e,n,!0),u.set(w,g)),k.add(w)}for(const[P,M]of a.items)k.has(P)||x.skipped_effects.add(M.e);x.add_callback(p)}else p();b&&qe(!0),T(d)}),N&&(o=L)}function Kd(t,e,n,r,s,i,o,a,l){var c=e.length,u=n.items,d=n.first,h=d,f,p=null,v=[],b=[],E,_,g,m;for(m=0;m<c;m+=1){if(E=e[m],_=a(E,m),g=u.get(_),g===void 0){var y=r.get(_);if(y!==void 0){r.delete(_),u.set(_,y);var w=p?p.next:h;st(n,p,y),st(n,y,w),ti(y,w,s),p=y}else{var k=h?h.e.nodes_start:s;p=ei(k,n,p,p===null?n.first:p.next,E,_,m,i,o,l)}u.set(_,p),v=[],b=[],h=p.next;continue}if(Aa(g,E,m),(g.e.f&Be)!==0&&Ks(g.e),g!==h){if(f!==void 0&&f.has(g)){if(v.length<b.length){var x=b[0],S;p=x.prev;var P=v[0],M=v[v.length-1];for(S=0;S<v.length;S+=1)ti(v[S],x,s);for(S=0;S<b.length;S+=1)f.delete(b[S]);st(n,P.prev,M.next),st(n,p,P),st(n,M,x),h=x,p=M,m-=1,v=[],b=[]}else f.delete(g),ti(g,h,s),st(n,g.prev,g.next),st(n,g,p===null?n.first:p.next),st(n,p,g),p=g;continue}for(v=[],b=[];h!==null&&h.k!==_;)(h.e.f&Be)===0&&(f??=new Set).add(h),b.push(h),h=h.next;if(h===null)continue;g=h}v.push(g),p=g,h=g.next}if(h!==null||f!==void 0){for(var oe=f===void 0?[]:Ps(f);h!==null;)(h.e.f&Be)===0&&oe.push(h),h=h.next;var Ye=oe.length;if(Ye>0){var me=null;Gd(n,oe,me)}}t.first=n.first&&n.first.e,t.last=p&&p.e;for(var O of r.values())Ie(O.e);r.clear()}function Aa(t,e,n,r){Vn(t.v,e),t.i=n}function ei(t,e,n,r,s,i,o,a,l,c,u){var d=(l&Lu)!==0,h=(l&ju)===0,f=d?h?Vo(s,!1,!1):Mt(s):s,p=(l&Du)===0?o:Mt(o),v={i:p,v:f,k:i,a:null,e:null,prev:n,next:r};try{if(t===null){var b=document.createDocumentFragment();b.append(t=yt())}return v.e=Fe(()=>a(t,f,p,c),N),v.e.prev=n&&n.e,v.e.next=r&&r.e,n===null?u||(e.first=v):(n.next=v,n.e.next=v.e),r!==null&&(r.prev=v,r.e.prev=v.e),v}finally{}}function ti(t,e,n){for(var r=t.next?t.next.e.nodes_start:n,s=e?e.e.nodes_start:n,i=t.e.nodes_start;i!==null&&i!==r;){var o=He(i);s.before(i),i=o}}function st(t,e,n){e===null?t.first=n:(e.next=n,e.e.next=n&&n.e),n!==null&&(n.prev=e,n.e.prev=e&&e.e)}function Vd(t,e,n=!1,r=!1,s=!1){var i=t,o="";tt(()=>{var a=C;if(o===(o=e()??"")){N&&pn();return}if(a.nodes_start!==null&&(ca(a.nodes_start,a.nodes_end),a.nodes_start=a.nodes_end=null),o!==""){if(N){L.data;for(var l=pn(),c=l;l!==null&&(l.nodeType!==Lt||l.data!=="");)c=l,l=He(l);if(l===null)throw Wn(),It;rt(L,c),i=ce(l);return}var u=o+"";n?u=`<svg>${u}</svg>`:r&&(u=`<math>${u}</math>`);var d=Js(u);if((n||r)&&(d=je(d)),rt(je(d),d.lastChild),n||r)for(;je(d);)i.before(je(d));else i.before(d)}})}function Oa(t,e){oa(()=>{var n=t.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector("#"+e.hash)){const s=document.createElement("style");s.id=e.hash,s.textContent=e.code,r.appendChild(s)}})}function Jd(t,e){return t==null?null:String(t)}function zr(t,e,n,r){var s=t.__style;if(N||s!==e){var i=Jd(e);(!N||i!==t.getAttribute("style"))&&(i==null?t.removeAttribute("style"):t.style.cssText=i),t.__style=e}return r}const Yd=Symbol("is custom element"),Xd=Symbol("is html");function Zd(t){if(N){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var r=t.value;er(t,"value",null),t.value=r}if(t.hasAttribute("checked")){var s=t.checked;er(t,"checked",null),t.checked=s}}};t.__on_r=n,jt(n),ra()}}function er(t,e,n,r){var s=Qd(t);N&&(s[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")||s[e]!==(s[e]=n)&&(e==="loading"&&(t[Yu]=n),n==null?t.removeAttribute(e):typeof n!="string"&&eh(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function Qd(t){return t.__attributes??={[Yd]:t.nodeName.includes("-"),[Xd]:t.namespaceURI===Mu}}var Ra=new Map;function eh(t){var e=t.getAttribute("is")||t.nodeName,n=Ra.get(e);if(n)return n;Ra.set(e,n=[]);for(var r,s=t,i=Element.prototype;i!==s;){r=qu(s);for(var o in r)r[o].set&&n.push(o);s=$o(s)}return n}function th(t,e,n=e){var r=new WeakSet;Td(t,"input",async s=>{var i=s?t.defaultValue:t.value;if(i=ni(t)?ri(i):i,n(i),W!==null&&r.add(W),await Ld(),i!==(i=e())){var o=t.selectionStart,a=t.selectionEnd;t.value=i??"",a!==null&&(t.selectionStart=o,t.selectionEnd=Math.min(a,t.value.length))}}),(N&&t.defaultValue!==t.value||qr(e)==null&&t.value)&&(n(ni(t)?ri(t.value):t.value),W!==null&&r.add(W)),Ur(()=>{var s=e();if(t===document.activeElement){var i=Lr??W;if(r.has(i))return}ni(t)&&s===ri(t.value)||t.type==="date"&&!s&&!t.value||s!==t.value&&(t.value=s??"")})}function ni(t){var e=t.type;return e==="number"||e==="range"}function ri(t){return t===""?null:+t}function Ia(t,e){return t===e||t?.[Ir]===e}function nh(t={},e,n,r){return oa(()=>{var s,i;return Ur(()=>{s=i,i=[],qr(()=>{t!==n(...i)&&(e(t,...i),s&&Ia(n(...s),t)&&e(null,...s))})}),()=>{jt(()=>{i&&Ia(n(...i),t)&&e(null,...i)})}}),t}function Ce(t,e,n,r){var s=r,i=!0,o=()=>(i&&(i=!1,s=r),s),a;a=t[e],a===void 0&&r!==void 0&&(a=o());var l;l=()=>{var h=t[e];return h===void 0?o():(i=!0,h)};var c=!1,u=jr(()=>(c=!1,l())),d=C;return(function(h,f){if(arguments.length>0){const p=f?T(u):h;return U(u,p),c=!0,s!==void 0&&(s=p),h}return Ht&&c||(d.f&Ct)!==0?u.v:T(u)})}function rh(t){return new sh(t)}class sh{#t;#e;constructor(e){var n=new Map,r=(i,o)=>{var a=Vo(o,!1,!1);return n.set(i,a),a};const s=new Proxy({...e.props||{},$$events:{}},{get(i,o){return T(n.get(o)??r(o,Reflect.get(i,o)))},has(i,o){return o===Ju?!0:(T(n.get(o)??r(o,Reflect.get(i,o))),Reflect.has(i,o))},set(i,o,a){return U(n.get(o)??r(o,a),a),Reflect.set(i,o,a)}});this.#e=(e.hydrate?Hd:Ta)(e.component,{target:e.target,anchor:e.anchor,props:s,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&ue(),this.#t=s.$$events;for(const i of Object.keys(this.#e))i==="$set"||i==="$destroy"||i==="$on"||hn(this,i,{get(){return this.#e[i]},set(o){this.#e[i]=o},enumerable:!0});this.#e.$set=i=>{Object.assign(s,i)},this.#e.$destroy=()=>{zd(this.#e)}}$set(e){this.#e.$set(e)}$on(e,n){this.#t[e]=this.#t[e]||[];const r=(...s)=>n.call(this,...s);return this.#t[e].push(r),()=>{this.#t[e]=this.#t[e].filter(s=>s!==r)}}$destroy(){this.#e.$destroy()}}let $a;typeof HTMLElement=="function"&&($a=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(t,e,n){super(),this.$$ctor=t,this.$$s=e,n&&this.attachShadow({mode:"open"})}addEventListener(t,e,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const r=this.$$c.$on(t,e);this.$$l_u.set(e,r)}super.addEventListener(t,e,n)}removeEventListener(t,e,n){if(super.removeEventListener(t,e,n),this.$$c){const r=this.$$l_u.get(e);r&&(r(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(r){return s=>{const i=document.createElement("slot");r!=="default"&&(i.name=r),B(s,i)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},n=ih(this);for(const r of this.$$s)r in n&&(r==="default"&&!this.$$d.children?(this.$$d.children=t(r),e.default=!0):e[r]=t(r));for(const r of this.attributes){const s=this.$$g_p(r.name);s in this.$$d||(this.$$d[s]=Wr(s,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=rh({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=Rd(()=>{Ur(()=>{this.$$r=!0;for(const r of xr(this.$$c)){if(!this.$$p_d[r]?.reflect)continue;this.$$d[r]=this.$$c[r];const s=Wr(r,this.$$d[r],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,s)}this.$$r=!1})});for(const r in this.$$l)for(const s of this.$$l[r]){const i=this.$$c.$on(r,s);this.$$l_u.set(s,i)}this.$$l={}}}attributeChangedCallback(t,e,n){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Wr(t,n,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return xr(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function Wr(t,e,n,r){const s=n[t]?.type;if(e=s==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(s){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(s){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function ih(t){const e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}function si(t,e,n,r,s,i){let o=class extends $a{constructor(){super(t,n,s),this.$$p_d=e}static get observedAttributes(){return xr(e).map(a=>(e[a].attribute||a).toLowerCase())}};return xr(e).forEach(a=>{hn(o.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(l){l=Wr(a,l,e),this.$$d[a]=l;var c=this.$$c;if(c){var u=fn(c,a)?.get;u?c[a]=l:c.$set({[a]:l})}}})}),r.forEach(a=>{hn(o.prototype,a,{get(){return this.$$c?.[a]}})}),t.element=o,o}const oh=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Promise.resolve().then(()=>xn).then(({default:r})=>r(...n)):e=fetch,(...n)=>e(...n)};class ii extends Error{constructor(e,n="FunctionsError",r){super(e),this.name=n,this.context=r}}class Ca extends ii{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Pa extends ii{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Na extends ii{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var oi;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(oi||(oi={}));var ah=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class lh{constructor(e,{headers:n={},customFetch:r,region:s=oi.Any}={}){this.url=e,this.headers=n,this.region=s,this.fetch=oh(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return ah(this,arguments,void 0,function*(n,r={}){var s;try{const{headers:i,method:o,body:a,signal:l}=r;let c={},{region:u}=r;u||(u=this.region);const d=new URL(`${this.url}/${n}`);u&&u!=="any"&&(c["x-region"]=u,d.searchParams.set("forceFunctionRegion",u));let h;a&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&(typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",h=a):typeof a=="string"?(c["Content-Type"]="text/plain",h=a):typeof FormData<"u"&&a instanceof FormData?h=a:(c["Content-Type"]="application/json",h=JSON.stringify(a)));const f=yield this.fetch(d.toString(),{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),i),body:h,signal:l}).catch(E=>{throw E.name==="AbortError"?E:new Ca(E)}),p=f.headers.get("x-relay-error");if(p&&p==="true")throw new Pa(f);if(!f.ok)throw new Na(f);let v=((s=f.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),b;return v==="application/json"?b=yield f.json():v==="application/octet-stream"?b=yield f.blob():v==="text/event-stream"?b=f:v==="multipart/form-data"?b=yield f.formData():b=yield f.text(),{data:b,error:null,response:f}}catch(i){return i instanceof Error&&i.name==="AbortError"?{data:null,error:new Ca(i)}:{data:null,error:i,response:i instanceof Na||i instanceof Pa?i.context:void 0}}})}}function ch(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function uh(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){var s=!1;try{s=this instanceof r}catch{}return s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var ie={},yn={},wn={},En={},kn={},Sn={},dh=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},Tn=dh();const hh=Tn.fetch,La=Tn.fetch.bind(Tn),Da=Tn.Headers,fh=Tn.Request,ph=Tn.Response,xn=Object.freeze(Object.defineProperty({__proto__:null,Headers:Da,Request:fh,Response:ph,default:La,fetch:hh},Symbol.toStringTag,{value:"Module"})),gh=uh(xn);var Gr={},ja;function Fa(){if(ja)return Gr;ja=1,Object.defineProperty(Gr,"__esModule",{value:!0});class t extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}}return Gr.default=t,Gr}var Ua;function Ma(){if(Ua)return Sn;Ua=1;var t=Sn&&Sn.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Sn,"__esModule",{value:!0});const e=t(gh),n=t(Fa());class r{constructor(i){var o,a;this.shouldThrowOnError=!1,this.method=i.method,this.url=i.url,this.headers=new Headers(i.headers),this.schema=i.schema,this.body=i.body,this.shouldThrowOnError=(o=i.shouldThrowOnError)!==null&&o!==void 0?o:!1,this.signal=i.signal,this.isMaybeSingle=(a=i.isMaybeSingle)!==null&&a!==void 0?a:!1,i.fetch?this.fetch=i.fetch:typeof fetch>"u"?this.fetch=e.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(i,o){return this.headers=new Headers(this.headers),this.headers.set(i,o),this}then(i,o){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const a=this.fetch;let l=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async c=>{var u,d,h,f;let p=null,v=null,b=null,E=c.status,_=c.statusText;if(c.ok){if(this.method!=="HEAD"){const w=await c.text();w===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((u=this.headers.get("Accept"))===null||u===void 0)&&u.includes("application/vnd.pgrst.plan+text"))?v=w:v=JSON.parse(w))}const m=(d=this.headers.get("Prefer"))===null||d===void 0?void 0:d.match(/count=(exact|planned|estimated)/),y=(h=c.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");m&&y&&y.length>1&&(b=parseInt(y[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(v)&&(v.length>1?(p={code:"PGRST116",details:`Results contain ${v.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},v=null,b=null,E=406,_="Not Acceptable"):v.length===1?v=v[0]:v=null)}else{const m=await c.text();try{p=JSON.parse(m),Array.isArray(p)&&c.status===404&&(v=[],p=null,E=200,_="OK")}catch{c.status===404&&m===""?(E=204,_="No Content"):p={message:m}}if(p&&this.isMaybeSingle&&(!((f=p?.details)===null||f===void 0)&&f.includes("0 rows"))&&(p=null,E=200,_="OK"),p&&this.shouldThrowOnError)throw new n.default(p)}return{error:p,data:v,count:b,status:E,statusText:_}});return this.shouldThrowOnError||(l=l.catch(c=>{var u,d,h;return{error:{message:`${(u=c?.name)!==null&&u!==void 0?u:"FetchError"}: ${c?.message}`,details:`${(d=c?.stack)!==null&&d!==void 0?d:""}`,hint:"",code:`${(h=c?.code)!==null&&h!==void 0?h:""}`},data:null,count:null,status:0,statusText:""}})),l.then(i,o)}returns(){return this}overrideTypes(){return this}}return Sn.default=r,Sn}var Ba;function qa(){if(Ba)return kn;Ba=1;var t=kn&&kn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(kn,"__esModule",{value:!0});const e=t(Ma());class n extends e.default{select(s){let i=!1;const o=(s??"*").split("").map(a=>/\s/.test(a)&&!i?"":(a==='"'&&(i=!i),a)).join("");return this.url.searchParams.set("select",o),this.headers.append("Prefer","return=representation"),this}order(s,{ascending:i=!0,nullsFirst:o,foreignTable:a,referencedTable:l=a}={}){const c=l?`${l}.order`:"order",u=this.url.searchParams.get(c);return this.url.searchParams.set(c,`${u?`${u},`:""}${s}.${i?"asc":"desc"}${o===void 0?"":o?".nullsfirst":".nullslast"}`),this}limit(s,{foreignTable:i,referencedTable:o=i}={}){const a=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(a,`${s}`),this}range(s,i,{foreignTable:o,referencedTable:a=o}={}){const l=typeof a>"u"?"offset":`${a}.offset`,c=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${s}`),this.url.searchParams.set(c,`${i-s+1}`),this}abortSignal(s){return this.signal=s,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:s=!1,verbose:i=!1,settings:o=!1,buffers:a=!1,wal:l=!1,format:c="text"}={}){var u;const d=[s?"analyze":null,i?"verbose":null,o?"settings":null,a?"buffers":null,l?"wal":null].filter(Boolean).join("|"),h=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${c}; for="${h}"; options=${d};`),c==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(s){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${s}`),this}}return kn.default=n,kn}var Ha;function ai(){if(Ha)return En;Ha=1;var t=En&&En.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(En,"__esModule",{value:!0});const e=t(qa());class n extends e.default{eq(s,i){return this.url.searchParams.append(s,`eq.${i}`),this}neq(s,i){return this.url.searchParams.append(s,`neq.${i}`),this}gt(s,i){return this.url.searchParams.append(s,`gt.${i}`),this}gte(s,i){return this.url.searchParams.append(s,`gte.${i}`),this}lt(s,i){return this.url.searchParams.append(s,`lt.${i}`),this}lte(s,i){return this.url.searchParams.append(s,`lte.${i}`),this}like(s,i){return this.url.searchParams.append(s,`like.${i}`),this}likeAllOf(s,i){return this.url.searchParams.append(s,`like(all).{${i.join(",")}}`),this}likeAnyOf(s,i){return this.url.searchParams.append(s,`like(any).{${i.join(",")}}`),this}ilike(s,i){return this.url.searchParams.append(s,`ilike.${i}`),this}ilikeAllOf(s,i){return this.url.searchParams.append(s,`ilike(all).{${i.join(",")}}`),this}ilikeAnyOf(s,i){return this.url.searchParams.append(s,`ilike(any).{${i.join(",")}}`),this}is(s,i){return this.url.searchParams.append(s,`is.${i}`),this}in(s,i){const o=Array.from(new Set(i)).map(a=>typeof a=="string"&&new RegExp("[,()]").test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(s,`in.(${o})`),this}contains(s,i){return typeof i=="string"?this.url.searchParams.append(s,`cs.${i}`):Array.isArray(i)?this.url.searchParams.append(s,`cs.{${i.join(",")}}`):this.url.searchParams.append(s,`cs.${JSON.stringify(i)}`),this}containedBy(s,i){return typeof i=="string"?this.url.searchParams.append(s,`cd.${i}`):Array.isArray(i)?this.url.searchParams.append(s,`cd.{${i.join(",")}}`):this.url.searchParams.append(s,`cd.${JSON.stringify(i)}`),this}rangeGt(s,i){return this.url.searchParams.append(s,`sr.${i}`),this}rangeGte(s,i){return this.url.searchParams.append(s,`nxl.${i}`),this}rangeLt(s,i){return this.url.searchParams.append(s,`sl.${i}`),this}rangeLte(s,i){return this.url.searchParams.append(s,`nxr.${i}`),this}rangeAdjacent(s,i){return this.url.searchParams.append(s,`adj.${i}`),this}overlaps(s,i){return typeof i=="string"?this.url.searchParams.append(s,`ov.${i}`):this.url.searchParams.append(s,`ov.{${i.join(",")}}`),this}textSearch(s,i,{config:o,type:a}={}){let l="";a==="plain"?l="pl":a==="phrase"?l="ph":a==="websearch"&&(l="w");const c=o===void 0?"":`(${o})`;return this.url.searchParams.append(s,`${l}fts${c}.${i}`),this}match(s){return Object.entries(s).forEach(([i,o])=>{this.url.searchParams.append(i,`eq.${o}`)}),this}not(s,i,o){return this.url.searchParams.append(s,`not.${i}.${o}`),this}or(s,{foreignTable:i,referencedTable:o=i}={}){const a=o?`${o}.or`:"or";return this.url.searchParams.append(a,`(${s})`),this}filter(s,i,o){return this.url.searchParams.append(s,`${i}.${o}`),this}}return En.default=n,En}var za;function Wa(){if(za)return wn;za=1;var t=wn&&wn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(wn,"__esModule",{value:!0});const e=t(ai());class n{constructor(s,{headers:i={},schema:o,fetch:a}){this.url=s,this.headers=new Headers(i),this.schema=o,this.fetch=a}select(s,i){const{head:o=!1,count:a}=i??{},l=o?"HEAD":"GET";let c=!1;const u=(s??"*").split("").map(d=>/\s/.test(d)&&!c?"":(d==='"'&&(c=!c),d)).join("");return this.url.searchParams.set("select",u),a&&this.headers.append("Prefer",`count=${a}`),new e.default({method:l,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(s,{count:i,defaultToNull:o=!0}={}){var a;const l="POST";if(i&&this.headers.append("Prefer",`count=${i}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(s)){const c=s.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);this.url.searchParams.set("columns",u.join(","))}}return new e.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:s,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}upsert(s,{onConflict:i,ignoreDuplicates:o=!1,count:a,defaultToNull:l=!0}={}){var c;const u="POST";if(this.headers.append("Prefer",`resolution=${o?"ignore":"merge"}-duplicates`),i!==void 0&&this.url.searchParams.set("on_conflict",i),a&&this.headers.append("Prefer",`count=${a}`),l||this.headers.append("Prefer","missing=default"),Array.isArray(s)){const d=s.reduce((h,f)=>h.concat(Object.keys(f)),[]);if(d.length>0){const h=[...new Set(d)].map(f=>`"${f}"`);this.url.searchParams.set("columns",h.join(","))}}return new e.default({method:u,url:this.url,headers:this.headers,schema:this.schema,body:s,fetch:(c=this.fetch)!==null&&c!==void 0?c:fetch})}update(s,{count:i}={}){var o;const a="PATCH";return i&&this.headers.append("Prefer",`count=${i}`),new e.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:s,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}delete({count:s}={}){var i;const o="DELETE";return s&&this.headers.append("Prefer",`count=${s}`),new e.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}}return wn.default=n,wn}var Ga;function _h(){if(Ga)return yn;Ga=1;var t=yn&&yn.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(yn,"__esModule",{value:!0});const e=t(Wa()),n=t(ai());class r{constructor(i,{headers:o={},schema:a,fetch:l}={}){this.url=i,this.headers=new Headers(o),this.schemaName=a,this.fetch=l}from(i){const o=new URL(`${this.url}/${i}`);return new e.default(o,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(i){return new r(this.url,{headers:this.headers,schema:i,fetch:this.fetch})}rpc(i,o={},{head:a=!1,get:l=!1,count:c}={}){var u;let d;const h=new URL(`${this.url}/rpc/${i}`);let f;a||l?(d=a?"HEAD":"GET",Object.entries(o).filter(([v,b])=>b!==void 0).map(([v,b])=>[v,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([v,b])=>{h.searchParams.append(v,b)})):(d="POST",f=o);const p=new Headers(this.headers);return c&&p.set("Prefer",`count=${c}`),new n.default({method:d,url:h,headers:p,schema:this.schemaName,body:f,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}}return yn.default=r,yn}var Ka;function mh(){if(Ka)return ie;Ka=1;var t=ie&&ie.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(ie,"__esModule",{value:!0}),ie.PostgrestError=ie.PostgrestBuilder=ie.PostgrestTransformBuilder=ie.PostgrestFilterBuilder=ie.PostgrestQueryBuilder=ie.PostgrestClient=void 0;const e=t(_h());ie.PostgrestClient=e.default;const n=t(Wa());ie.PostgrestQueryBuilder=n.default;const r=t(ai());ie.PostgrestFilterBuilder=r.default;const s=t(qa());ie.PostgrestTransformBuilder=s.default;const i=t(Ma());ie.PostgrestBuilder=i.default;const o=t(Fa());return ie.PostgrestError=o.default,ie.default={PostgrestClient:e.default,PostgrestQueryBuilder:n.default,PostgrestFilterBuilder:r.default,PostgrestTransformBuilder:s.default,PostgrestBuilder:i.default,PostgrestError:o.default},ie}var vh=mh();const bh=ch(vh),{PostgrestClient:yh,PostgrestQueryBuilder:Ly,PostgrestFilterBuilder:Dy,PostgrestTransformBuilder:jy,PostgrestBuilder:Fy,PostgrestError:Uy}=bh;class wh{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const n=process.versions;if(n&&n.node){const r=n.node,s=parseInt(r.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
1
|
+
(function(_t,Sr){typeof exports=="object"&&typeof module<"u"?Sr(exports):typeof define=="function"&&define.amd?define(["exports"],Sr):(_t=typeof globalThis<"u"?globalThis:_t||self,Sr(_t.KnestWidget={}))})(this,(function(_t){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const Lu=1,Du=2,ju=16,Uu=1,Fu=2,Oo="[",Tr="[!",Cs="]",It={},ae=Symbol(),Mu="http://www.w3.org/1999/xhtml",Io=!1;var Ps=Array.isArray,Bu=Array.prototype.indexOf,Ns=Array.from,xr=Object.keys,fn=Object.defineProperty,pn=Object.getOwnPropertyDescriptor,qu=Object.getOwnPropertyDescriptors,Hu=Object.prototype,zu=Array.prototype,$o=Object.getPrototypeOf,Co=Object.isExtensible;const Wu=()=>{};function Gu(t){for(var e=0;e<t.length;e++)t[e]()}function Po(){var t,e,n=new Promise((r,s)=>{t=r,e=s});return{promise:n,resolve:t,reject:e}}const Ee=2,Ls=4,Ds=8,$t=16,lt=32,mt=64,js=128,De=256,Ar=512,le=1024,xe=2048,vt=4096,Be=8192,Ct=16384,Us=32768,Rr=65536,No=1<<17,Ku=1<<18,Pt=1<<19,Vu=1<<20,Fs=1<<21,Or=1<<22,Nt=1<<23,Ir=Symbol("$state"),Ju=Symbol("legacy props"),Yu=Symbol(""),zn=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Ms=3,Lt=8;function Xu(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Zu(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Qu(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function ed(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function td(t){throw new Error("https://svelte.dev/e/effect_orphan")}function nd(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function rd(){throw new Error("https://svelte.dev/e/hydration_failed")}function sd(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function id(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function od(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ad(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function Wn(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function ld(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let N=!1;function qe(t){N=t}let L;function ue(t){if(t===null)throw Wn(),It;return L=t}function gn(){return ue(He(L))}function V(t){if(N){if(He(L)!==null)throw Wn(),It;L=t}}function cd(t=1){if(N){for(var e=t,n=L;e--;)n=He(n);L=n}}function $r(t=!0){for(var e=0,n=L;;){if(n.nodeType===Lt){var r=n.data;if(r===Cs){if(e===0)return n;e-=1}else(r===Oo||r===Tr)&&(e+=1)}var s=He(n);t&&n.remove(),n=s}}function Lo(t){if(!t||t.nodeType!==Lt)throw Wn(),It;return t.data}function Do(t){return t===this.v}function ud(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function jo(t){return!ud(t,this.v)}let dd=!1,Ae=null;function _n(t){Ae=t}function Cr(t,e=!1,n){Ae={p:Ae,c:null,e:null,s:t,x:null,l:null}}function Pr(t){var e=Ae,n=e.e;if(n!==null){e.e=null;for(var r of n)ia(r)}return t!==void 0&&(e.x=t),Ae=e.p,t??{}}function Uo(){return!0}let Dt=[];function Fo(){var t=Dt;Dt=[],Gu(t)}function jt(t){if(Dt.length===0&&!Gn){var e=Dt;queueMicrotask(()=>{e===Dt&&Fo()})}Dt.push(t)}function hd(){for(;Dt.length>0;)Fo()}const fd=new WeakMap;function Mo(t){var e=C;if(e===null)return D.f|=Nt,t;if((e.f&Us)===0){if((e.f&js)===0)throw!e.parent&&t instanceof Error&&Bo(t),t;e.b.error(t)}else mn(t,e)}function mn(t,e){for(;e!==null;){if((e.f&js)!==0)try{e.b.error(t);return}catch(n){t=n}e=e.parent}throw t instanceof Error&&Bo(t),t}function Bo(t){const e=fd.get(t);e&&(fn(t,"message",{value:e.message}),fn(t,"stack",{value:e.stack}))}const Nr=new Set;let G=null,Lr=null,Bs=new Set,Qe=[],Dr=null,qs=!1,Gn=!1;class Re{current=new Map;#t=new Map;#e=new Set;#u=0;#i=null;#l=[];#s=[];#r=[];#n=[];#o=[];#c=[];skipped_effects=new Set;process(e){Qe=[],Lr=null;var n=Re.apply(this);for(const i of e)this.#d(i);if(this.#u===0){this.#h();var r=this.#s,s=this.#r;this.#s=[],this.#r=[],this.#n=[],Lr=this,G=null,Ho(r),Ho(s),Lr=null,this.#i?.resolve()}else this.#a(this.#s),this.#a(this.#r),this.#a(this.#n);n();for(const i of this.#l)Xn(i);this.#l=[]}#d(e){e.f^=le;for(var n=e.first;n!==null;){var r=n.f,s=(r&(lt|mt))!==0,i=s&&(r&le)!==0,o=i||(r&Be)!==0||this.skipped_effects.has(n);if(!o&&n.fn!==null){s?n.f^=le:(r&Ls)!==0?this.#r.push(n):(r&le)===0&&((r&Or)!==0&&n.b?.is_pending()?this.#l.push(n):Br(n)&&((n.f&$t)!==0&&this.#n.push(n),Xn(n)));var a=n.first;if(a!==null){n=a;continue}}var l=n.parent;for(n=n.next;n===null&&l!==null;)n=l.next,l=l.parent}}#a(e){for(const n of e)((n.f&xe)!==0?this.#o:this.#c).push(n),fe(n,le);e.length=0}capture(e,n){this.#t.has(e)||this.#t.set(e,n),this.current.set(e,e.v)}activate(){G=this}deactivate(){G=null}flush(){if(Qe.length>0){if(this.activate(),qo(),G!==null&&G!==this)return}else this.#u===0&&this.#h();this.deactivate();for(const e of Bs)if(Bs.delete(e),e(),G!==null)break}#h(){for(const e of this.#e)e();if(this.#e.clear(),Nr.size>1){this.#t.clear();let e=!0;for(const n of Nr){if(n===this){e=!1;continue}for(const[r,s]of this.current){if(n.current.has(r))if(e)n.current.set(r,s);else continue;zo(r)}if(Qe.length>0){G=n;const r=Re.apply(n);for(const s of Qe)n.#d(s);Qe=[],r()}}G=null}Nr.delete(this)}increment(){this.#u+=1}decrement(){this.#u-=1;for(const e of this.#o)fe(e,xe),Ft(e);for(const e of this.#c)fe(e,vt),Ft(e);this.flush()}add_callback(e){this.#e.add(e)}settled(){return(this.#i??=Po()).promise}static ensure(){if(G===null){const e=G=new Re;Nr.add(G),Gn||Re.enqueue(()=>{G===e&&e.flush()})}return G}static enqueue(e){jt(e)}static apply(e){return Wu}}function de(t){var e=Gn;Gn=!0;try{for(var n;;){if(hd(),Qe.length===0&&(G?.flush(),Qe.length===0))return Dr=null,n;qo()}}finally{Gn=e}}function qo(){var t=bn;qs=!0;try{var e=0;for(fa(!0);Qe.length>0;){var n=Re.ensure();if(e++>1e3){var r,s;pd()}n.process(Qe),bt.clear()}}finally{qs=!1,fa(t),Dr=null}}function pd(){try{nd()}catch(t){mn(t,Dr)}}let Ut=null;function Ho(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&(Ct|Be))===0&&Br(r)&&(Ut=[],Xn(r),r.deps===null&&r.first===null&&r.nodes_start===null&&(r.teardown===null&&r.ac===null?ua(r):r.fn=null),Ut?.length>0)){bt.clear();for(const s of Ut)Xn(s);Ut=[]}}Ut=null}}function zo(t){if(t.reactions!==null)for(const e of t.reactions){const n=e.f;(n&Ee)!==0?zo(e):(n&(Or|$t))!==0&&(fe(e,xe),Ft(e))}}function Ft(t){for(var e=Dr=t;e.parent!==null;){e=e.parent;var n=e.f;if(qs&&e===C&&(n&$t)!==0)return;if((n&(mt|lt))!==0){if((n&le)===0)return;e.f^=le}}Qe.push(e)}function gd(t){let e=0,n=Mt(0),r;return()=>{Rd()&&(T(n),Mr(()=>(e===0&&(r=Hr(()=>t(()=>Jn(n)))),e+=1,()=>{jt(()=>{e-=1,e===0&&(r?.(),r=void 0,Jn(n))})})))}}var _d=Rr|Pt|js;function md(t,e,n){new vd(t,e,n)}class vd{parent;#t=!1;#e;#u=N?L:null;#i;#l;#s;#r=null;#n=null;#o=null;#c=null;#d=0;#a=0;#h=!1;#f=null;#m=()=>{this.#f&&Vn(this.#f,this.#d)};#v=gd(()=>(this.#f=Mt(this.#d),()=>{this.#f=null}));constructor(e,n,r){this.#e=e,this.#i=n,this.#l=r,this.parent=C.b,this.#t=!!this.#i.pending,this.#s=Ws(()=>{if(C.b=this,N){const s=this.#u;gn(),s.nodeType===Lt&&s.data===Tr?this.#y():this.#b()}else{try{this.#r=Ue(()=>r(this.#e))}catch(s){this.error(s)}this.#a>0?this.#g():this.#t=!1}},_d),N&&(this.#e=L)}#b(){try{this.#r=Ue(()=>this.#l(this.#e))}catch(e){this.error(e)}this.#t=!1}#y(){const e=this.#i.pending;e&&(this.#n=Ue(()=>e(this.#e)),Re.enqueue(()=>{this.#r=this.#p(()=>(Re.ensure(),Ue(()=>this.#l(this.#e)))),this.#a>0?this.#g():(vn(this.#n,()=>{this.#n=null}),this.#t=!1)}))}is_pending(){return this.#t||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#i.pending}#p(e){var n=C,r=D,s=Ae;nt(this.#s),ke(this.#s),_n(this.#s.ctx);try{return e()}catch(i){return Mo(i),null}finally{nt(n),ke(r),_n(s)}}#g(){const e=this.#i.pending;this.#r!==null&&(this.#c=document.createDocumentFragment(),bd(this.#r,this.#c)),this.#n===null&&(this.#n=Ue(()=>e(this.#e)))}#_(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#_(e);return}this.#a+=e,this.#a===0&&(this.#t=!1,this.#n&&vn(this.#n,()=>{this.#n=null}),this.#c&&(this.#e.before(this.#c),this.#c=null),jt(()=>{Re.ensure().flush()}))}update_pending_count(e){this.#_(e),this.#d+=e,Bs.add(this.#m)}get_effect_pending(){return this.#v(),T(this.#f)}error(e){var n=this.#i.onerror;let r=this.#i.failed;if(this.#h||!n&&!r)throw e;this.#r&&(Ie(this.#r),this.#r=null),this.#n&&(Ie(this.#n),this.#n=null),this.#o&&(Ie(this.#o),this.#o=null),N&&(ue(this.#u),cd(),ue($r()));var s=!1,i=!1;const o=()=>{if(s){ld();return}s=!0,i&&ad(),Re.ensure(),this.#d=0,this.#o!==null&&vn(this.#o,()=>{this.#o=null}),this.#t=this.has_pending_snippet(),this.#r=this.#p(()=>(this.#h=!1,Ue(()=>this.#l(this.#e)))),this.#a>0?this.#g():this.#t=!1};var a=D;try{ke(null),i=!0,n?.(e,o),i=!1}catch(l){mn(l,this.#s&&this.#s.parent)}finally{ke(a)}r&&jt(()=>{this.#o=this.#p(()=>{this.#h=!0;try{return Ue(()=>{r(this.#e,()=>e,()=>o)})}catch(l){return mn(l,this.#s.parent),null}finally{this.#h=!1}})})}}function bd(t,e){for(var n=t.nodes_start,r=t.nodes_end;n!==null;){var s=n===r?null:He(n);e.append(n),n=s}}function yd(t,e,n){const r=jr;if(e.length===0){n(t.map(r));return}var s=G,i=C,o=wd(),a=N;Promise.all(e.map(l=>Ed(l))).then(l=>{o();try{n([...t.map(r),...l])}catch(c){(i.f&Ct)===0&&mn(c,i)}a&&qe(!1),s?.deactivate(),Wo()}).catch(l=>{mn(l,i)})}function wd(){var t=C,e=D,n=Ae,r=G,s=N;if(s)var i=L;return function(){nt(t),ke(e),_n(n),r?.activate(),s&&(qe(!0),ue(i))}}function Wo(){nt(null),ke(null),_n(null)}function jr(t){var e=Ee|xe,n=D!==null&&(D.f&Ee)!==0?D:null;return C===null||n!==null&&(n.f&De)!==0?e|=De:C.f|=Pt,{ctx:Ae,deps:null,effects:null,equals:Do,f:e,fn:t,reactions:null,rv:0,v:ae,wv:0,parent:n??C,ac:null}}function Ed(t,e){let n=C;n===null&&Zu();var r=n.b,s=void 0,i=Mt(ae),o=!D,a=new Map;return $d(()=>{var l=Po();s=l.promise;try{Promise.resolve(t()).then(l.resolve,l.reject)}catch(h){l.reject(h)}var c=G,u=r.is_pending();o&&(r.update_pending_count(1),u||(c.increment(),a.get(c)?.reject(zn),a.set(c,l)));const d=(h,f=void 0)=>{u||c.activate(),f?f!==zn&&(i.f|=Nt,Vn(i,f)):((i.f&Nt)!==0&&(i.f^=Nt),Vn(i,h)),o&&(r.update_pending_count(-1),u||c.decrement()),Wo()};l.promise.then(d,h=>d(null,h||"unknown"))}),sa(()=>{for(const l of a.values())l.reject(zn)}),new Promise(l=>{function c(u){function d(){u===s?l(i):c(s)}u.then(d,d)}c(s)})}function Kn(t){const e=jr(t);return ga(e),e}function kd(t){const e=jr(t);return e.equals=jo,e}function Go(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)Ie(e[n])}}function Sd(t){for(var e=t.parent;e!==null;){if((e.f&Ee)===0)return e;e=e.parent}return null}function Hs(t){var e,n=C;nt(Sd(t));try{Go(t),e=ya(t)}finally{nt(n)}return e}function Ko(t){var e=Hs(t);if(t.equals(e)||(t.v=e,t.wv=va()),!Ht){var n=(wt||(t.f&De)!==0)&&t.deps!==null?vt:le;fe(t,n)}}const bt=new Map;function Mt(t,e){var n={f:0,v:t,reactions:null,equals:Do,rv:0,wv:0};return n}function Q(t,e){const n=Mt(t);return ga(n),n}function Vo(t,e=!1,n=!0){const r=Mt(t);return e||(r.equals=jo),r}function j(t,e,n=!1){D!==null&&(!ze||(D.f&No)!==0)&&Uo()&&(D.f&(Ee|$t|Or|No))!==0&&!ct?.includes(t)&&od();let r=n?Bt(e):e;return Vn(t,r)}function Vn(t,e){if(!t.equals(e)){var n=t.v;Ht?bt.set(t,e):bt.set(t,n),t.v=e;var r=Re.ensure();r.capture(t,n),(t.f&Ee)!==0&&((t.f&xe)!==0&&Hs(t),fe(t,(t.f&De)===0?le:vt)),t.wv=va(),Jo(t,xe),C!==null&&(C.f&le)!==0&&(C.f&(lt|mt))===0&&(Fe===null?Pd([t]):Fe.push(t))}return e}function Jn(t){j(t,t.v+1)}function Jo(t,e){var n=t.reactions;if(n!==null)for(var r=n.length,s=0;s<r;s++){var i=n[s],o=i.f,a=(o&xe)===0;a&&fe(i,e),(o&Ee)!==0?Jo(i,vt):a&&((o&$t)!==0&&Ut!==null&&Ut.push(i),Ft(i))}}function Bt(t){if(typeof t!="object"||t===null||Ir in t)return t;const e=$o(t);if(e!==Hu&&e!==zu)return t;var n=new Map,r=Ps(t),s=Q(0),i=zt,o=a=>{if(zt===i)return a();var l=D,c=zt;ke(null),ma(i);var u=a();return ke(l),ma(c),u};return r&&n.set("length",Q(t.length)),new Proxy(t,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&sd();var u=n.get(l);return u===void 0?u=o(()=>{var d=Q(c.value);return n.set(l,d),d}):j(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>Q(ae));n.set(l,u),Jn(s)}}else j(c,ae),Jn(s);return!0},get(a,l,c){if(l===Ir)return t;var u=n.get(l),d=l in a;if(u===void 0&&(!d||pn(a,l)?.writable)&&(u=o(()=>{var f=Bt(d?a[l]:ae),p=Q(f);return p}),n.set(l,u)),u!==void 0){var h=T(u);return h===ae?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=T(u))}else if(c===void 0){var d=n.get(l),h=d?.v;if(d!==void 0&&h!==ae)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){if(l===Ir)return!0;var c=n.get(l),u=c!==void 0&&c.v!==ae||Reflect.has(a,l);if(c!==void 0||C!==null&&(!u||pn(a,l)?.writable)){c===void 0&&(c=o(()=>{var h=u?Bt(a[l]):ae,f=Q(h);return f}),n.set(l,c));var d=T(c);if(d===ae)return!1}return u},set(a,l,c,u){var d=n.get(l),h=l in a;if(r&&l==="length")for(var f=c;f<d.v;f+=1){var p=n.get(f+"");p!==void 0?j(p,ae):f in a&&(p=o(()=>Q(ae)),n.set(f+"",p))}if(d===void 0)(!h||pn(a,l)?.writable)&&(d=o(()=>Q(void 0)),j(d,Bt(c)),n.set(l,d));else{h=d.v!==ae;var v=o(()=>Bt(c));j(d,v)}var b=Reflect.getOwnPropertyDescriptor(a,l);if(b?.set&&b.set.call(u,c),!h){if(r&&typeof l=="string"){var E=n.get("length"),_=Number(l);Number.isInteger(_)&&_>=E.v&&j(E,_+1)}Jn(s)}return!0},ownKeys(a){T(s);var l=Reflect.ownKeys(a).filter(d=>{var h=n.get(d);return h===void 0||h.v!==ae});for(var[c,u]of n)u.v!==ae&&!(c in a)&&l.push(c);return l},setPrototypeOf(){id()}})}var Yo,Xo,Zo,Qo;function zs(){if(Yo===void 0){Yo=window,Xo=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Zo=pn(e,"firstChild").get,Qo=pn(e,"nextSibling").get,Co(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),Co(n)&&(n.__t=void 0)}}function yt(t=""){return document.createTextNode(t)}function je(t){return Zo.call(t)}function He(t){return Qo.call(t)}function J(t,e){if(!N)return je(t);var n=je(L);if(n===null)n=L.appendChild(yt());else if(e&&n.nodeType!==Ms){var r=yt();return n?.before(r),ue(r),r}return ue(n),n}function qt(t,e=!1){if(!N){var n=je(t);return n instanceof Comment&&n.data===""?He(n):n}if(e&&L?.nodeType!==Ms){var r=yt();return L?.before(r),ue(r),r}return L}function Oe(t,e=1,n=!1){let r=N?L:t;for(var s;e--;)s=r,r=He(r);if(!N)return r;if(n&&r?.nodeType!==Ms){var i=yt();return r===null?s?.after(i):r.before(i),ue(i),i}return ue(r),r}function ea(t){t.textContent=""}function ta(){return!1}let na=!1;function ra(){na||(na=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{if(!t.defaultPrevented)for(const e of t.target.elements)e.__on_r?.()})},{capture:!0}))}function Ur(t){var e=D,n=C;ke(null),nt(null);try{return t()}finally{ke(e),nt(n)}}function Td(t,e,n,r=n){t.addEventListener(e,()=>Ur(n));const s=t.__on_r;s?t.__on_r=()=>{s(),r(!0)}:t.__on_r=()=>r(!0),ra()}function xd(t){C===null&&D===null&&td(),D!==null&&(D.f&De)!==0&&C===null&&ed(),Ht&&Qu()}function Ad(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function et(t,e,n,r=!0){var s=C;s!==null&&(s.f&Be)!==0&&(t|=Be);var i={ctx:Ae,deps:null,nodes_start:null,nodes_end:null,f:t|xe,first:null,fn:e,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(n)try{Xn(i),i.f|=Us}catch(l){throw Ie(i),l}else e!==null&&Ft(i);if(r){var o=i;if(n&&o.deps===null&&o.teardown===null&&o.nodes_start===null&&o.first===o.last&&(o.f&Pt)===0&&(o=o.first),o!==null&&(o.parent=s,s!==null&&Ad(o,s),D!==null&&(D.f&Ee)!==0&&(t&mt)===0)){var a=D;(a.effects??=[]).push(o)}}return i}function Rd(){return D!==null&&!ze}function sa(t){const e=et(Ds,null,!1);return fe(e,le),e.teardown=t,e}function Fr(t){xd();var e=C.f,n=!D&&(e<)!==0&&(e&Us)===0;if(n){var r=Ae;(r.e??=[]).push(t)}else return ia(t)}function ia(t){return et(Ls|Vu,t,!1)}function Od(t){Re.ensure();const e=et(mt|Pt,t,!0);return()=>{Ie(e)}}function Id(t){Re.ensure();const e=et(mt|Pt,t,!0);return(n={})=>new Promise(r=>{n.outro?vn(e,()=>{Ie(e),r(void 0)}):(Ie(e),r(void 0))})}function oa(t){return et(Ls,t,!1)}function $d(t){return et(Or|Pt,t,!0)}function Mr(t,e=0){return et(Ds|e,t,!0)}function tt(t,e=[],n=[]){yd(e,n,r=>{et(Ds,()=>t(...r.map(T)),!0)})}function Ws(t,e=0){var n=et($t|e,t,!0);return n}function Ue(t,e=!0){return et(lt|Pt,t,!0,e)}function aa(t){var e=t.teardown;if(e!==null){const n=Ht,r=D;pa(!0),ke(null);try{e.call(null)}finally{pa(n),ke(r)}}}function la(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const s=n.ac;s!==null&&Ur(()=>{s.abort(zn)});var r=n.next;(n.f&mt)!==0?n.parent=null:Ie(n,e),n=r}}function Cd(t){for(var e=t.first;e!==null;){var n=e.next;(e.f<)===0&&Ie(e),e=n}}function Ie(t,e=!0){var n=!1;(e||(t.f&Ku)!==0)&&t.nodes_start!==null&&t.nodes_end!==null&&(ca(t.nodes_start,t.nodes_end),n=!0),la(t,e&&!n),qr(t,0),fe(t,Ct);var r=t.transitions;if(r!==null)for(const i of r)i.stop();aa(t);var s=t.parent;s!==null&&s.first!==null&&ua(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function ca(t,e){for(;t!==null;){var n=t===e?null:He(t);t.remove(),t=n}}function ua(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function vn(t,e){var n=[];Gs(t,n,!0),da(n,()=>{Ie(t),e&&e()})}function da(t,e){var n=t.length;if(n>0){var r=()=>--n||e();for(var s of t)s.out(r)}else e()}function Gs(t,e,n){if((t.f&Be)===0){if(t.f^=Be,t.transitions!==null)for(const o of t.transitions)(o.is_global||n)&&e.push(o);for(var r=t.first;r!==null;){var s=r.next,i=(r.f&Rr)!==0||(r.f<)!==0;Gs(r,e,i?n:!1),r=s}}}function Ks(t){ha(t,!0)}function ha(t,e){if((t.f&Be)!==0){t.f^=Be,(t.f&le)===0&&(fe(t,xe),Ft(t));for(var n=t.first;n!==null;){var r=n.next,s=(n.f&Rr)!==0||(n.f<)!==0;ha(n,s?e:!1),n=r}if(t.transitions!==null)for(const i of t.transitions)(i.is_global||e)&&i.in()}}let bn=!1;function fa(t){bn=t}let Ht=!1;function pa(t){Ht=t}let D=null,ze=!1;function ke(t){D=t}let C=null;function nt(t){C=t}let ct=null;function ga(t){D!==null&&(ct===null?ct=[t]:ct.push(t))}let he=null,$e=0,Fe=null;function Pd(t){Fe=t}let _a=1,Yn=0,zt=Yn;function ma(t){zt=t}let wt=!1;function va(){return++_a}function Br(t){var e=t.f;if((e&xe)!==0)return!0;if((e&vt)!==0){var n=t.deps,r=(e&De)!==0;if(n!==null){var s,i,o=(e&Ar)!==0,a=r&&C!==null&&!wt,l=n.length;if((o||a)&&(C===null||(C.f&Ct)===0)){var c=t,u=c.parent;for(s=0;s<l;s++)i=n[s],(o||!i?.reactions?.includes(c))&&(i.reactions??=[]).push(c);o&&(c.f^=Ar),a&&u!==null&&(u.f&De)===0&&(c.f^=De)}for(s=0;s<l;s++)if(i=n[s],Br(i)&&Ko(i),i.wv>t.wv)return!0}(!r||C!==null&&!wt)&&fe(t,le)}return!1}function ba(t,e,n=!0){var r=t.reactions;if(r!==null&&!ct?.includes(t))for(var s=0;s<r.length;s++){var i=r[s];(i.f&Ee)!==0?ba(i,e,!1):e===i&&(n?fe(i,xe):(i.f&le)!==0&&fe(i,vt),Ft(i))}}function ya(t){var e=he,n=$e,r=Fe,s=D,i=wt,o=ct,a=Ae,l=ze,c=zt,u=t.f;he=null,$e=0,Fe=null,wt=(u&De)!==0&&(ze||!bn||D===null),D=(u&(lt|mt))===0?t:null,ct=null,_n(t.ctx),ze=!1,zt=++Yn,t.ac!==null&&(Ur(()=>{t.ac.abort(zn)}),t.ac=null);try{t.f|=Fs;var d=t.fn,h=d(),f=t.deps;if(he!==null){var p;if(qr(t,$e),f!==null&&$e>0)for(f.length=$e+he.length,p=0;p<he.length;p++)f[$e+p]=he[p];else t.deps=f=he;if(!wt||(u&Ee)!==0&&t.reactions!==null)for(p=$e;p<f.length;p++)(f[p].reactions??=[]).push(t)}else f!==null&&$e<f.length&&(qr(t,$e),f.length=$e);if(Uo()&&Fe!==null&&!ze&&f!==null&&(t.f&(Ee|vt|xe))===0)for(p=0;p<Fe.length;p++)ba(Fe[p],t);return s!==null&&s!==t&&(Yn++,Fe!==null&&(r===null?r=Fe:r.push(...Fe))),(t.f&Nt)!==0&&(t.f^=Nt),h}catch(v){return Mo(v)}finally{t.f^=Fs,he=e,$e=n,Fe=r,D=s,wt=i,ct=o,_n(a),ze=l,zt=c}}function Nd(t,e){let n=e.reactions;if(n!==null){var r=Bu.call(n,t);if(r!==-1){var s=n.length-1;s===0?n=e.reactions=null:(n[r]=n[s],n.pop())}}n===null&&(e.f&Ee)!==0&&(he===null||!he.includes(e))&&(fe(e,vt),(e.f&(De|Ar))===0&&(e.f^=Ar),Go(e),qr(e,0))}function qr(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)Nd(t,n[r])}function Xn(t){var e=t.f;if((e&Ct)===0){fe(t,le);var n=C,r=bn;C=t,bn=!0;try{(e&$t)!==0?Cd(t):la(t),aa(t);var s=ya(t);t.teardown=typeof s=="function"?s:null,t.wv=_a;var i;Io&&dd&&(t.f&xe)!==0&&t.deps}finally{bn=r,C=n}}}async function Ld(){await Promise.resolve(),de()}function T(t){var e=t.f,n=(e&Ee)!==0;if(D!==null&&!ze){var r=C!==null&&(C.f&Ct)!==0;if(!r&&!ct?.includes(t)){var s=D.deps;if((D.f&Fs)!==0)t.rv<Yn&&(t.rv=Yn,he===null&&s!==null&&s[$e]===t?$e++:he===null?he=[t]:(!wt||!he.includes(t))&&he.push(t));else{(D.deps??=[]).push(t);var i=t.reactions;i===null?t.reactions=[D]:i.includes(D)||i.push(D)}}}else if(n&&t.deps===null&&t.effects===null){var o=t,a=o.parent;a!==null&&(a.f&De)===0&&(o.f^=De)}if(Ht){if(bt.has(t))return bt.get(t);if(n){o=t;var l=o.v;return((o.f&le)===0&&o.reactions!==null||wa(o))&&(l=Hs(o)),bt.set(o,l),l}}else n&&(o=t,Br(o)&&Ko(o));if((t.f&Nt)!==0)throw t.v;return t.v}function wa(t){if(t.v===ae)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(bt.has(e)||(e.f&Ee)!==0&&wa(e))return!0;return!1}function Hr(t){var e=ze;try{return ze=!0,t()}finally{ze=e}}const Dd=-7169;function fe(t,e){t.f=t.f&Dd|e}const Ea=new Set,Vs=new Set;function jd(t){if(!N)return;t.removeAttribute("onload"),t.removeAttribute("onerror");const e=t.__e;e!==void 0&&(t.__e=void 0,queueMicrotask(()=>{t.isConnected&&t.dispatchEvent(e)}))}function Ud(t,e,n,r={}){function s(i){if(r.capture||Zn.call(e,i),!i.cancelBubble)return Ur(()=>n?.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?jt(()=>{e.addEventListener(t,s,r)}):e.addEventListener(t,s,r),s}function ka(t,e,n,r,s){var i={capture:r,passive:s},o=Ud(t,e,n,i);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&sa(()=>{e.removeEventListener(t,o,i)})}function Fd(t){for(var e=0;e<t.length;e++)Ea.add(t[e]);for(var n of Vs)n(t)}let Sa=null;function Zn(t){var e=this,n=e.ownerDocument,r=t.type,s=t.composedPath?.()||[],i=s[0]||t.target;Sa=t;var o=0,a=Sa===t&&t.__root;if(a){var l=s.indexOf(a);if(l!==-1&&(e===document||e===window)){t.__root=e;return}var c=s.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(i=s[o]||t.target,i!==e){fn(t,"currentTarget",{configurable:!0,get(){return i||n}});var u=D,d=C;ke(null),nt(null);try{for(var h,f=[];i!==null;){var p=i.assignedSlot||i.parentNode||i.host||null;try{var v=i["__"+r];if(v!=null&&(!i.disabled||t.target===i))if(Ps(v)){var[b,...E]=v;b.apply(i,[t,...E])}else v.call(i,t)}catch(_){h?f.push(_):h=_}if(t.cancelBubble||p===e||p===null)break;i=p}if(h){for(let _ of f)queueMicrotask(()=>{throw _});throw h}}finally{t.__root=e,delete t.currentTarget,ke(u),nt(d)}}}function Js(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function rt(t,e){var n=C;n.nodes_start===null&&(n.nodes_start=t,n.nodes_end=e)}function ee(t,e){var n=(e&Uu)!==0,r=(e&Fu)!==0,s,i=!t.startsWith("<!>");return()=>{if(N)return rt(L,null),L;s===void 0&&(s=Js(i?t:"<!>"+t),n||(s=je(s)));var o=r||Xo?document.importNode(s,!0):s.cloneNode(!0);if(n){var a=je(o),l=o.lastChild;rt(a,l)}else rt(o,o);return o}}function Md(t,e,n="svg"){var r=!t.startsWith("<!>"),s=`<${n}>${r?t:"<!>"+t}</${n}>`,i;return()=>{if(N)return rt(L,null),L;if(!i){var o=Js(s),a=je(o);i=je(a)}var l=i.cloneNode(!0);return rt(l,l),l}}function Ys(t,e){return Md(t,e,"svg")}function Qn(){if(N)return rt(L,null),L;var t=document.createDocumentFragment(),e=document.createComment(""),n=yt();return t.append(e,n),rt(e,n),t}function q(t,e){if(N){C.nodes_end=L,gn();return}t!==null&&t.before(e)}const Bd=["touchstart","touchmove"];function qd(t){return Bd.includes(t)}function zr(t,e){var n=e==null?"":typeof e=="object"?e+"":e;n!==(t.__t??=t.nodeValue)&&(t.__t=n,t.nodeValue=n+"")}function Ta(t,e){return xa(t,e)}function Hd(t,e){zs(),e.intro=e.intro??!1;const n=e.target,r=N,s=L;try{for(var i=je(n);i&&(i.nodeType!==Lt||i.data!==Oo);)i=He(i);if(!i)throw It;qe(!0),ue(i);const o=xa(t,{...e,anchor:i});return qe(!1),o}catch(o){if(o instanceof Error&&o.message.split(`
|
|
2
|
+
`).some(a=>a.startsWith("https://svelte.dev/e/")))throw o;return o!==It&&console.warn("Failed to hydrate: ",o),e.recover===!1&&rd(),zs(),ea(n),qe(!1),Ta(t,e)}finally{qe(r),ue(s)}}const yn=new Map;function xa(t,{target:e,anchor:n,props:r={},events:s,context:i,intro:o=!0}){zs();var a=new Set,l=d=>{for(var h=0;h<d.length;h++){var f=d[h];if(!a.has(f)){a.add(f);var p=qd(f);e.addEventListener(f,Zn,{passive:p});var v=yn.get(f);v===void 0?(document.addEventListener(f,Zn,{passive:p}),yn.set(f,1)):yn.set(f,v+1)}}};l(Ns(Ea)),Vs.add(l);var c=void 0,u=Id(()=>{var d=n??e.appendChild(yt());return md(d,{pending:()=>{}},h=>{if(i){Cr({});var f=Ae;f.c=i}if(s&&(r.$$events=s),N&&rt(h,null),c=t(h,r)||{},N&&(C.nodes_end=L,L===null||L.nodeType!==Lt||L.data!==Cs))throw Wn(),It;i&&Pr()}),()=>{for(var h of a){e.removeEventListener(h,Zn);var f=yn.get(h);--f===0?(document.removeEventListener(h,Zn),yn.delete(h)):yn.set(h,f)}Vs.delete(l),d!==n&&d.parentNode?.removeChild(d)}});return Xs.set(c,u),c}let Xs=new WeakMap;function zd(t,e){const n=Xs.get(t);return n?(Xs.delete(t),n(e)):Promise.resolve()}function Wd(t){Ae===null&&Xu(),Fr(()=>{const e=Hr(t);if(typeof e=="function")return e})}function pe(t,e,n=!1){N&&gn();var r=t,s=null,i=null,o=ae,a=n?Rr:0,l=!1;const c=(f,p=!0)=>{l=!0,h(p,f)};var u=null;function d(){u!==null&&(u.lastChild.remove(),r.before(u),u=null);var f=o?s:i,p=o?i:s;f&&Ks(f),p&&vn(p,()=>{o?i=null:s=null})}const h=(f,p)=>{if(o===(o=f))return;let v=!1;if(N){const y=Lo(r)===Tr;!!o===y&&(r=$r(),ue(r),qe(!1),v=!0)}var b=ta(),E=r;if(b&&(u=document.createDocumentFragment(),u.append(E=yt())),o?s??=p&&Ue(()=>p(E)):i??=p&&Ue(()=>p(E)),b){var _=G,g=o?s:i,m=o?i:s;g&&_.skipped_effects.delete(g),m&&_.skipped_effects.add(m),_.add_callback(d)}else d();v&&qe(!0)};Ws(()=>{l=!1,e(c),l||h(null,null)},a),N&&(r=L)}function Zs(t,e){return e}function Gd(t,e,n){for(var r=t.items,s=[],i=e.length,o=0;o<i;o++)Gs(e[o].e,s,!0);var a=i>0&&s.length===0&&n!==null;if(a){var l=n.parentNode;ea(l),l.append(n),r.clear(),st(t,e[0].prev,e[i-1].next)}da(s,()=>{for(var c=0;c<i;c++){var u=e[c];a||(r.delete(u.k),st(t,u.prev,u.next)),Ie(u.e,!a)}})}function Qs(t,e,n,r,s,i=null){var o=t,a={flags:e,items:new Map,first:null};N&&gn();var l=null,c=!1,u=new Map,d=kd(()=>{var v=n();return Ps(v)?v:v==null?[]:Ns(v)}),h,f;function p(){Kd(f,h,a,u,o,s,e,r,n),i!==null&&(h.length===0?l?Ks(l):l=Ue(()=>i(o)):l!==null&&vn(l,()=>{l=null}))}Ws(()=>{f??=C,h=T(d);var v=h.length;if(c&&v===0)return;c=v===0;let b=!1;if(N){var E=Lo(o)===Tr;E!==(v===0)&&(o=$r(),ue(o),qe(!1),b=!0)}if(N){for(var _=null,g,m=0;m<v;m++){if(L.nodeType===Lt&&L.data===Cs){o=L,b=!0,qe(!1);break}var y=h[m],w=r(y,m);g=ei(L,a,_,null,y,w,m,s,e,n),a.items.set(w,g),_=g}v>0&&ue($r())}if(N)v===0&&i&&(l=Ue(()=>i(o)));else if(ta()){var k=new Set,x=G;for(m=0;m<v;m+=1){y=h[m],w=r(y,m);var S=a.items.get(w)??u.get(w);S?Aa(S,y,m):(g=ei(null,a,null,null,y,w,m,s,e,n,!0),u.set(w,g)),k.add(w)}for(const[P,B]of a.items)k.has(P)||x.skipped_effects.add(B.e);x.add_callback(p)}else p();b&&qe(!0),T(d)}),N&&(o=L)}function Kd(t,e,n,r,s,i,o,a,l){var c=e.length,u=n.items,d=n.first,h=d,f,p=null,v=[],b=[],E,_,g,m;for(m=0;m<c;m+=1){if(E=e[m],_=a(E,m),g=u.get(_),g===void 0){var y=r.get(_);if(y!==void 0){r.delete(_),u.set(_,y);var w=p?p.next:h;st(n,p,y),st(n,y,w),ti(y,w,s),p=y}else{var k=h?h.e.nodes_start:s;p=ei(k,n,p,p===null?n.first:p.next,E,_,m,i,o,l)}u.set(_,p),v=[],b=[],h=p.next;continue}if(Aa(g,E,m),(g.e.f&Be)!==0&&Ks(g.e),g!==h){if(f!==void 0&&f.has(g)){if(v.length<b.length){var x=b[0],S;p=x.prev;var P=v[0],B=v[v.length-1];for(S=0;S<v.length;S+=1)ti(v[S],x,s);for(S=0;S<b.length;S+=1)f.delete(b[S]);st(n,P.prev,B.next),st(n,p,P),st(n,B,x),h=x,p=B,m-=1,v=[],b=[]}else f.delete(g),ti(g,h,s),st(n,g.prev,g.next),st(n,g,p===null?n.first:p.next),st(n,p,g),p=g;continue}for(v=[],b=[];h!==null&&h.k!==_;)(h.e.f&Be)===0&&(f??=new Set).add(h),b.push(h),h=h.next;if(h===null)continue;g=h}v.push(g),p=g,h=g.next}if(h!==null||f!==void 0){for(var oe=f===void 0?[]:Ns(f);h!==null;)(h.e.f&Be)===0&&oe.push(h),h=h.next;var Ye=oe.length;if(Ye>0){var ve=null;Gd(n,oe,ve)}}t.first=n.first&&n.first.e,t.last=p&&p.e;for(var R of r.values())Ie(R.e);r.clear()}function Aa(t,e,n,r){Vn(t.v,e),t.i=n}function ei(t,e,n,r,s,i,o,a,l,c,u){var d=(l&Lu)!==0,h=(l&ju)===0,f=d?h?Vo(s,!1,!1):Mt(s):s,p=(l&Du)===0?o:Mt(o),v={i:p,v:f,k:i,a:null,e:null,prev:n,next:r};try{if(t===null){var b=document.createDocumentFragment();b.append(t=yt())}return v.e=Ue(()=>a(t,f,p,c),N),v.e.prev=n&&n.e,v.e.next=r&&r.e,n===null?u||(e.first=v):(n.next=v,n.e.next=v.e),r!==null&&(r.prev=v,r.e.prev=v.e),v}finally{}}function ti(t,e,n){for(var r=t.next?t.next.e.nodes_start:n,s=e?e.e.nodes_start:n,i=t.e.nodes_start;i!==null&&i!==r;){var o=He(i);s.before(i),i=o}}function st(t,e,n){e===null?t.first=n:(e.next=n,e.e.next=n&&n.e),n!==null&&(n.prev=e,n.e.prev=e&&e.e)}function Vd(t,e,n=!1,r=!1,s=!1){var i=t,o="";tt(()=>{var a=C;if(o===(o=e()??"")){N&&gn();return}if(a.nodes_start!==null&&(ca(a.nodes_start,a.nodes_end),a.nodes_start=a.nodes_end=null),o!==""){if(N){L.data;for(var l=gn(),c=l;l!==null&&(l.nodeType!==Lt||l.data!=="");)c=l,l=He(l);if(l===null)throw Wn(),It;rt(L,c),i=ue(l);return}var u=o+"";n?u=`<svg>${u}</svg>`:r&&(u=`<math>${u}</math>`);var d=Js(u);if((n||r)&&(d=je(d)),rt(je(d),d.lastChild),n||r)for(;je(d);)i.before(je(d));else i.before(d)}})}function Ra(t,e){oa(()=>{var n=t.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector("#"+e.hash)){const s=document.createElement("style");s.id=e.hash,s.textContent=e.code,r.appendChild(s)}})}function Jd(t,e){return t==null?null:String(t)}function Wr(t,e,n,r){var s=t.__style;if(N||s!==e){var i=Jd(e);(!N||i!==t.getAttribute("style"))&&(i==null?t.removeAttribute("style"):t.style.cssText=i),t.__style=e}return r}const Yd=Symbol("is custom element"),Xd=Symbol("is html");function Zd(t){if(N){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var r=t.value;er(t,"value",null),t.value=r}if(t.hasAttribute("checked")){var s=t.checked;er(t,"checked",null),t.checked=s}}};t.__on_r=n,jt(n),ra()}}function er(t,e,n,r){var s=Qd(t);N&&(s[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")||s[e]!==(s[e]=n)&&(e==="loading"&&(t[Yu]=n),n==null?t.removeAttribute(e):typeof n!="string"&&eh(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function Qd(t){return t.__attributes??={[Yd]:t.nodeName.includes("-"),[Xd]:t.namespaceURI===Mu}}var Oa=new Map;function eh(t){var e=t.getAttribute("is")||t.nodeName,n=Oa.get(e);if(n)return n;Oa.set(e,n=[]);for(var r,s=t,i=Element.prototype;i!==s;){r=qu(s);for(var o in r)r[o].set&&n.push(o);s=$o(s)}return n}function th(t,e,n=e){var r=new WeakSet;Td(t,"input",async s=>{var i=s?t.defaultValue:t.value;if(i=ni(t)?ri(i):i,n(i),G!==null&&r.add(G),await Ld(),i!==(i=e())){var o=t.selectionStart,a=t.selectionEnd;t.value=i??"",a!==null&&(t.selectionStart=o,t.selectionEnd=Math.min(a,t.value.length))}}),(N&&t.defaultValue!==t.value||Hr(e)==null&&t.value)&&(n(ni(t)?ri(t.value):t.value),G!==null&&r.add(G)),Mr(()=>{var s=e();if(t===document.activeElement){var i=Lr??G;if(r.has(i))return}ni(t)&&s===ri(t.value)||t.type==="date"&&!s&&!t.value||s!==t.value&&(t.value=s??"")})}function ni(t){var e=t.type;return e==="number"||e==="range"}function ri(t){return t===""?null:+t}function Ia(t,e){return t===e||t?.[Ir]===e}function nh(t={},e,n,r){return oa(()=>{var s,i;return Mr(()=>{s=i,i=[],Hr(()=>{t!==n(...i)&&(e(t,...i),s&&Ia(n(...s),t)&&e(null,...s))})}),()=>{jt(()=>{i&&Ia(n(...i),t)&&e(null,...i)})}}),t}function Ce(t,e,n,r){var s=r,i=!0,o=()=>(i&&(i=!1,s=r),s),a;a=t[e],a===void 0&&r!==void 0&&(a=o());var l;l=()=>{var h=t[e];return h===void 0?o():(i=!0,h)};var c=!1,u=jr(()=>(c=!1,l())),d=C;return(function(h,f){if(arguments.length>0){const p=f?T(u):h;return j(u,p),c=!0,s!==void 0&&(s=p),h}return Ht&&c||(d.f&Ct)!==0?u.v:T(u)})}function rh(t){return new sh(t)}class sh{#t;#e;constructor(e){var n=new Map,r=(i,o)=>{var a=Vo(o,!1,!1);return n.set(i,a),a};const s=new Proxy({...e.props||{},$$events:{}},{get(i,o){return T(n.get(o)??r(o,Reflect.get(i,o)))},has(i,o){return o===Ju?!0:(T(n.get(o)??r(o,Reflect.get(i,o))),Reflect.has(i,o))},set(i,o,a){return j(n.get(o)??r(o,a),a),Reflect.set(i,o,a)}});this.#e=(e.hydrate?Hd:Ta)(e.component,{target:e.target,anchor:e.anchor,props:s,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&de(),this.#t=s.$$events;for(const i of Object.keys(this.#e))i==="$set"||i==="$destroy"||i==="$on"||fn(this,i,{get(){return this.#e[i]},set(o){this.#e[i]=o},enumerable:!0});this.#e.$set=i=>{Object.assign(s,i)},this.#e.$destroy=()=>{zd(this.#e)}}$set(e){this.#e.$set(e)}$on(e,n){this.#t[e]=this.#t[e]||[];const r=(...s)=>n.call(this,...s);return this.#t[e].push(r),()=>{this.#t[e]=this.#t[e].filter(s=>s!==r)}}$destroy(){this.#e.$destroy()}}let $a;typeof HTMLElement=="function"&&($a=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(t,e,n){super(),this.$$ctor=t,this.$$s=e,n&&this.attachShadow({mode:"open"})}addEventListener(t,e,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const r=this.$$c.$on(t,e);this.$$l_u.set(e,r)}super.addEventListener(t,e,n)}removeEventListener(t,e,n){if(super.removeEventListener(t,e,n),this.$$c){const r=this.$$l_u.get(e);r&&(r(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(r){return s=>{const i=document.createElement("slot");r!=="default"&&(i.name=r),q(s,i)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},n=ih(this);for(const r of this.$$s)r in n&&(r==="default"&&!this.$$d.children?(this.$$d.children=t(r),e.default=!0):e[r]=t(r));for(const r of this.attributes){const s=this.$$g_p(r.name);s in this.$$d||(this.$$d[s]=Gr(s,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=rh({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=Od(()=>{Mr(()=>{this.$$r=!0;for(const r of xr(this.$$c)){if(!this.$$p_d[r]?.reflect)continue;this.$$d[r]=this.$$c[r];const s=Gr(r,this.$$d[r],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,s)}this.$$r=!1})});for(const r in this.$$l)for(const s of this.$$l[r]){const i=this.$$c.$on(r,s);this.$$l_u.set(s,i)}this.$$l={}}}attributeChangedCallback(t,e,n){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Gr(t,n,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return xr(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function Gr(t,e,n,r){const s=n[t]?.type;if(e=s==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(s){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(s){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function ih(t){const e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}function si(t,e,n,r,s,i){let o=class extends $a{constructor(){super(t,n,s),this.$$p_d=e}static get observedAttributes(){return xr(e).map(a=>(e[a].attribute||a).toLowerCase())}};return xr(e).forEach(a=>{fn(o.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(l){l=Gr(a,l,e),this.$$d[a]=l;var c=this.$$c;if(c){var u=pn(c,a)?.get;u?c[a]=l:c.$set({[a]:l})}}})}),r.forEach(a=>{fn(o.prototype,a,{get(){return this.$$c?.[a]}})}),t.element=o,o}const oh=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Promise.resolve().then(()=>An).then(({default:r})=>r(...n)):e=fetch,(...n)=>e(...n)};class ii extends Error{constructor(e,n="FunctionsError",r){super(e),this.name=n,this.context=r}}class Ca extends ii{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Pa extends ii{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Na extends ii{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var oi;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(oi||(oi={}));var ah=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class lh{constructor(e,{headers:n={},customFetch:r,region:s=oi.Any}={}){this.url=e,this.headers=n,this.region=s,this.fetch=oh(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return ah(this,arguments,void 0,function*(n,r={}){var s;try{const{headers:i,method:o,body:a,signal:l}=r;let c={},{region:u}=r;u||(u=this.region);const d=new URL(`${this.url}/${n}`);u&&u!=="any"&&(c["x-region"]=u,d.searchParams.set("forceFunctionRegion",u));let h;a&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&(typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",h=a):typeof a=="string"?(c["Content-Type"]="text/plain",h=a):typeof FormData<"u"&&a instanceof FormData?h=a:(c["Content-Type"]="application/json",h=JSON.stringify(a)));const f=yield this.fetch(d.toString(),{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),i),body:h,signal:l}).catch(E=>{throw E.name==="AbortError"?E:new Ca(E)}),p=f.headers.get("x-relay-error");if(p&&p==="true")throw new Pa(f);if(!f.ok)throw new Na(f);let v=((s=f.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),b;return v==="application/json"?b=yield f.json():v==="application/octet-stream"?b=yield f.blob():v==="text/event-stream"?b=f:v==="multipart/form-data"?b=yield f.formData():b=yield f.text(),{data:b,error:null,response:f}}catch(i){return i instanceof Error&&i.name==="AbortError"?{data:null,error:new Ca(i)}:{data:null,error:i,response:i instanceof Na||i instanceof Pa?i.context:void 0}}})}}function ch(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function uh(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){var s=!1;try{s=this instanceof r}catch{}return s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var ie={},wn={},En={},kn={},Sn={},Tn={},dh=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},xn=dh();const hh=xn.fetch,La=xn.fetch.bind(xn),Da=xn.Headers,fh=xn.Request,ph=xn.Response,An=Object.freeze(Object.defineProperty({__proto__:null,Headers:Da,Request:fh,Response:ph,default:La,fetch:hh},Symbol.toStringTag,{value:"Module"})),gh=uh(An);var Kr={},ja;function Ua(){if(ja)return Kr;ja=1,Object.defineProperty(Kr,"__esModule",{value:!0});class t extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}}return Kr.default=t,Kr}var Fa;function Ma(){if(Fa)return Tn;Fa=1;var t=Tn&&Tn.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Tn,"__esModule",{value:!0});const e=t(gh),n=t(Ua());class r{constructor(i){var o,a;this.shouldThrowOnError=!1,this.method=i.method,this.url=i.url,this.headers=new Headers(i.headers),this.schema=i.schema,this.body=i.body,this.shouldThrowOnError=(o=i.shouldThrowOnError)!==null&&o!==void 0?o:!1,this.signal=i.signal,this.isMaybeSingle=(a=i.isMaybeSingle)!==null&&a!==void 0?a:!1,i.fetch?this.fetch=i.fetch:typeof fetch>"u"?this.fetch=e.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(i,o){return this.headers=new Headers(this.headers),this.headers.set(i,o),this}then(i,o){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const a=this.fetch;let l=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async c=>{var u,d,h,f;let p=null,v=null,b=null,E=c.status,_=c.statusText;if(c.ok){if(this.method!=="HEAD"){const w=await c.text();w===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((u=this.headers.get("Accept"))===null||u===void 0)&&u.includes("application/vnd.pgrst.plan+text"))?v=w:v=JSON.parse(w))}const m=(d=this.headers.get("Prefer"))===null||d===void 0?void 0:d.match(/count=(exact|planned|estimated)/),y=(h=c.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");m&&y&&y.length>1&&(b=parseInt(y[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(v)&&(v.length>1?(p={code:"PGRST116",details:`Results contain ${v.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},v=null,b=null,E=406,_="Not Acceptable"):v.length===1?v=v[0]:v=null)}else{const m=await c.text();try{p=JSON.parse(m),Array.isArray(p)&&c.status===404&&(v=[],p=null,E=200,_="OK")}catch{c.status===404&&m===""?(E=204,_="No Content"):p={message:m}}if(p&&this.isMaybeSingle&&(!((f=p?.details)===null||f===void 0)&&f.includes("0 rows"))&&(p=null,E=200,_="OK"),p&&this.shouldThrowOnError)throw new n.default(p)}return{error:p,data:v,count:b,status:E,statusText:_}});return this.shouldThrowOnError||(l=l.catch(c=>{var u,d,h;return{error:{message:`${(u=c?.name)!==null&&u!==void 0?u:"FetchError"}: ${c?.message}`,details:`${(d=c?.stack)!==null&&d!==void 0?d:""}`,hint:"",code:`${(h=c?.code)!==null&&h!==void 0?h:""}`},data:null,count:null,status:0,statusText:""}})),l.then(i,o)}returns(){return this}overrideTypes(){return this}}return Tn.default=r,Tn}var Ba;function qa(){if(Ba)return Sn;Ba=1;var t=Sn&&Sn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Sn,"__esModule",{value:!0});const e=t(Ma());class n extends e.default{select(s){let i=!1;const o=(s??"*").split("").map(a=>/\s/.test(a)&&!i?"":(a==='"'&&(i=!i),a)).join("");return this.url.searchParams.set("select",o),this.headers.append("Prefer","return=representation"),this}order(s,{ascending:i=!0,nullsFirst:o,foreignTable:a,referencedTable:l=a}={}){const c=l?`${l}.order`:"order",u=this.url.searchParams.get(c);return this.url.searchParams.set(c,`${u?`${u},`:""}${s}.${i?"asc":"desc"}${o===void 0?"":o?".nullsfirst":".nullslast"}`),this}limit(s,{foreignTable:i,referencedTable:o=i}={}){const a=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(a,`${s}`),this}range(s,i,{foreignTable:o,referencedTable:a=o}={}){const l=typeof a>"u"?"offset":`${a}.offset`,c=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${s}`),this.url.searchParams.set(c,`${i-s+1}`),this}abortSignal(s){return this.signal=s,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:s=!1,verbose:i=!1,settings:o=!1,buffers:a=!1,wal:l=!1,format:c="text"}={}){var u;const d=[s?"analyze":null,i?"verbose":null,o?"settings":null,a?"buffers":null,l?"wal":null].filter(Boolean).join("|"),h=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${c}; for="${h}"; options=${d};`),c==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(s){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${s}`),this}}return Sn.default=n,Sn}var Ha;function ai(){if(Ha)return kn;Ha=1;var t=kn&&kn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(kn,"__esModule",{value:!0});const e=t(qa());class n extends e.default{eq(s,i){return this.url.searchParams.append(s,`eq.${i}`),this}neq(s,i){return this.url.searchParams.append(s,`neq.${i}`),this}gt(s,i){return this.url.searchParams.append(s,`gt.${i}`),this}gte(s,i){return this.url.searchParams.append(s,`gte.${i}`),this}lt(s,i){return this.url.searchParams.append(s,`lt.${i}`),this}lte(s,i){return this.url.searchParams.append(s,`lte.${i}`),this}like(s,i){return this.url.searchParams.append(s,`like.${i}`),this}likeAllOf(s,i){return this.url.searchParams.append(s,`like(all).{${i.join(",")}}`),this}likeAnyOf(s,i){return this.url.searchParams.append(s,`like(any).{${i.join(",")}}`),this}ilike(s,i){return this.url.searchParams.append(s,`ilike.${i}`),this}ilikeAllOf(s,i){return this.url.searchParams.append(s,`ilike(all).{${i.join(",")}}`),this}ilikeAnyOf(s,i){return this.url.searchParams.append(s,`ilike(any).{${i.join(",")}}`),this}is(s,i){return this.url.searchParams.append(s,`is.${i}`),this}in(s,i){const o=Array.from(new Set(i)).map(a=>typeof a=="string"&&new RegExp("[,()]").test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(s,`in.(${o})`),this}contains(s,i){return typeof i=="string"?this.url.searchParams.append(s,`cs.${i}`):Array.isArray(i)?this.url.searchParams.append(s,`cs.{${i.join(",")}}`):this.url.searchParams.append(s,`cs.${JSON.stringify(i)}`),this}containedBy(s,i){return typeof i=="string"?this.url.searchParams.append(s,`cd.${i}`):Array.isArray(i)?this.url.searchParams.append(s,`cd.{${i.join(",")}}`):this.url.searchParams.append(s,`cd.${JSON.stringify(i)}`),this}rangeGt(s,i){return this.url.searchParams.append(s,`sr.${i}`),this}rangeGte(s,i){return this.url.searchParams.append(s,`nxl.${i}`),this}rangeLt(s,i){return this.url.searchParams.append(s,`sl.${i}`),this}rangeLte(s,i){return this.url.searchParams.append(s,`nxr.${i}`),this}rangeAdjacent(s,i){return this.url.searchParams.append(s,`adj.${i}`),this}overlaps(s,i){return typeof i=="string"?this.url.searchParams.append(s,`ov.${i}`):this.url.searchParams.append(s,`ov.{${i.join(",")}}`),this}textSearch(s,i,{config:o,type:a}={}){let l="";a==="plain"?l="pl":a==="phrase"?l="ph":a==="websearch"&&(l="w");const c=o===void 0?"":`(${o})`;return this.url.searchParams.append(s,`${l}fts${c}.${i}`),this}match(s){return Object.entries(s).forEach(([i,o])=>{this.url.searchParams.append(i,`eq.${o}`)}),this}not(s,i,o){return this.url.searchParams.append(s,`not.${i}.${o}`),this}or(s,{foreignTable:i,referencedTable:o=i}={}){const a=o?`${o}.or`:"or";return this.url.searchParams.append(a,`(${s})`),this}filter(s,i,o){return this.url.searchParams.append(s,`${i}.${o}`),this}}return kn.default=n,kn}var za;function Wa(){if(za)return En;za=1;var t=En&&En.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(En,"__esModule",{value:!0});const e=t(ai());class n{constructor(s,{headers:i={},schema:o,fetch:a}){this.url=s,this.headers=new Headers(i),this.schema=o,this.fetch=a}select(s,i){const{head:o=!1,count:a}=i??{},l=o?"HEAD":"GET";let c=!1;const u=(s??"*").split("").map(d=>/\s/.test(d)&&!c?"":(d==='"'&&(c=!c),d)).join("");return this.url.searchParams.set("select",u),a&&this.headers.append("Prefer",`count=${a}`),new e.default({method:l,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(s,{count:i,defaultToNull:o=!0}={}){var a;const l="POST";if(i&&this.headers.append("Prefer",`count=${i}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(s)){const c=s.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);this.url.searchParams.set("columns",u.join(","))}}return new e.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:s,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}upsert(s,{onConflict:i,ignoreDuplicates:o=!1,count:a,defaultToNull:l=!0}={}){var c;const u="POST";if(this.headers.append("Prefer",`resolution=${o?"ignore":"merge"}-duplicates`),i!==void 0&&this.url.searchParams.set("on_conflict",i),a&&this.headers.append("Prefer",`count=${a}`),l||this.headers.append("Prefer","missing=default"),Array.isArray(s)){const d=s.reduce((h,f)=>h.concat(Object.keys(f)),[]);if(d.length>0){const h=[...new Set(d)].map(f=>`"${f}"`);this.url.searchParams.set("columns",h.join(","))}}return new e.default({method:u,url:this.url,headers:this.headers,schema:this.schema,body:s,fetch:(c=this.fetch)!==null&&c!==void 0?c:fetch})}update(s,{count:i}={}){var o;const a="PATCH";return i&&this.headers.append("Prefer",`count=${i}`),new e.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:s,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}delete({count:s}={}){var i;const o="DELETE";return s&&this.headers.append("Prefer",`count=${s}`),new e.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}}return En.default=n,En}var Ga;function _h(){if(Ga)return wn;Ga=1;var t=wn&&wn.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(wn,"__esModule",{value:!0});const e=t(Wa()),n=t(ai());class r{constructor(i,{headers:o={},schema:a,fetch:l}={}){this.url=i,this.headers=new Headers(o),this.schemaName=a,this.fetch=l}from(i){const o=new URL(`${this.url}/${i}`);return new e.default(o,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(i){return new r(this.url,{headers:this.headers,schema:i,fetch:this.fetch})}rpc(i,o={},{head:a=!1,get:l=!1,count:c}={}){var u;let d;const h=new URL(`${this.url}/rpc/${i}`);let f;a||l?(d=a?"HEAD":"GET",Object.entries(o).filter(([v,b])=>b!==void 0).map(([v,b])=>[v,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([v,b])=>{h.searchParams.append(v,b)})):(d="POST",f=o);const p=new Headers(this.headers);return c&&p.set("Prefer",`count=${c}`),new n.default({method:d,url:h,headers:p,schema:this.schemaName,body:f,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}}return wn.default=r,wn}var Ka;function mh(){if(Ka)return ie;Ka=1;var t=ie&&ie.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(ie,"__esModule",{value:!0}),ie.PostgrestError=ie.PostgrestBuilder=ie.PostgrestTransformBuilder=ie.PostgrestFilterBuilder=ie.PostgrestQueryBuilder=ie.PostgrestClient=void 0;const e=t(_h());ie.PostgrestClient=e.default;const n=t(Wa());ie.PostgrestQueryBuilder=n.default;const r=t(ai());ie.PostgrestFilterBuilder=r.default;const s=t(qa());ie.PostgrestTransformBuilder=s.default;const i=t(Ma());ie.PostgrestBuilder=i.default;const o=t(Ua());return ie.PostgrestError=o.default,ie.default={PostgrestClient:e.default,PostgrestQueryBuilder:n.default,PostgrestFilterBuilder:r.default,PostgrestTransformBuilder:s.default,PostgrestBuilder:i.default,PostgrestError:o.default},ie}var vh=mh();const bh=ch(vh),{PostgrestClient:yh,PostgrestQueryBuilder:jy,PostgrestFilterBuilder:Uy,PostgrestTransformBuilder:Fy,PostgrestBuilder:My,PostgrestError:By}=bh;class wh{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const n=process.versions;if(n&&n.node){const r=n.node,s=parseInt(r.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
3
3
|
import ws from "ws"
|
|
4
4
|
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=`
|
|
5
5
|
|
|
6
|
-
Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const r=this.getWebSocketConstructor();return new r(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Eh="realtime-js/2.75.0",kh="1.0.0",li=1e4,Sh=1e3,Th=100;var tr;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(tr||(tr={}));var re;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(re||(re={}));var We;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(We||(We={}));var ci;(function(t){t.websocket="websocket"})(ci||(ci={}));var Wt;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Wt||(Wt={}));class xh{constructor(){this.HEADER_LENGTH=1}decode(e,n){return e.constructor===ArrayBuffer?n(this._binaryDecode(e)):n(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const n=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,n,r)}_decodeBroadcast(e,n,r){const s=n.getUint8(1),i=n.getUint8(2);let o=this.HEADER_LENGTH+2;const a=r.decode(e.slice(o,o+s));o=o+s;const l=r.decode(e.slice(o,o+i));o=o+i;const c=JSON.parse(r.decode(e.slice(o,e.byteLength)));return{ref:null,topic:a,event:l,payload:c}}}class Va{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var H;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(H||(H={}));const Ja=(t,e,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=Ah(o,t,e,s),i),{}):{}},Ah=(t,e,n,r)=>{const s=e.find(a=>a.name===t),i=s?.type,o=n[t];return i&&!r.includes(i)?Ya(i,o):ui(o)},Ya=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return $h(e,n)}switch(t){case H.bool:return Oh(e);case H.float4:case H.float8:case H.int2:case H.int4:case H.int8:case H.numeric:case H.oid:return Rh(e);case H.json:case H.jsonb:return Ih(e);case H.timestamp:return Ch(e);case H.abstime:case H.date:case H.daterange:case H.int4range:case H.int8range:case H.money:case H.reltime:case H.text:case H.time:case H.timestamptz:case H.timetz:case H.tsrange:case H.tstzrange:return ui(e);default:return ui(e)}},ui=t=>t,Oh=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Rh=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Ih=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},$h=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,r=t[n];if(t[0]==="{"&&r==="}"){let i;const o=t.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>Ya(e,a))}return t},Ch=t=>typeof t=="string"?t.replace(" ","T"):t,Xa=t=>{let e=t;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class di{constructor(e,n,r={},s=li){this.channel=e,this.event=n,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var r;return this._hasReceived(e)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Za;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Za||(Za={}));class nr{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=n?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},s=>{const{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=nr.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=nr.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel._on(r.diff,{},s=>{const{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=nr.syncDiff(this.state,s,i,o),a())}),this.onJoin((s,i,o)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:o})}),this.onLeave((s,i,o)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,r,s){const i=this.cloneDeep(e),o=this.transformState(n),a={},l={};return this.map(i,(c,u)=>{o[c]||(l[c]=u)}),this.map(o,(c,u)=>{const d=i[c];if(d){const h=u.map(b=>b.presence_ref),f=d.map(b=>b.presence_ref),p=u.filter(b=>f.indexOf(b.presence_ref)<0),v=d.filter(b=>h.indexOf(b.presence_ref)<0);p.length>0&&(a[c]=p),v.length>0&&(l[c]=v)}else a[c]=u}),this.syncDiff(i,{joins:a,leaves:l},r,s)}static syncDiff(e,n,r,s){const{joins:i,leaves:o}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(i,(a,l)=>{var c;const u=(c=e[a])!==null&&c!==void 0?c:[];if(e[a]=this.cloneDeep(l),u.length>0){const d=e[a].map(f=>f.presence_ref),h=u.filter(f=>d.indexOf(f.presence_ref)<0);e[a].unshift(...h)}r(a,u,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;const u=l.map(d=>d.presence_ref);c=c.filter(d=>u.indexOf(d.presence_ref)<0),e[a]=c,s(a,c,l),c.length===0&&delete e[a]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(r=>n(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,r)=>{const s=e[r];return"metas"in s?n[r]=s.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):n[r]=s,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Qa;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Qa||(Qa={}));var rr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(rr||(rr={}));var ut;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(ut||(ut={}));class hi{constructor(e,n={config:{}},r){var s,i;if(this.topic=e,this.params=n,this.socket=r,this.bindings={},this.state=re.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new di(this,We.join,this.params,this.timeout),this.rejoinTimer=new Va(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=re.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=re.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=re.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=re.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=re.errored,this.rejoinTimer.scheduleTimeout())}),this._on(We.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new nr(this),this.broadcastEndpointURL=Xa(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.state==re.closed){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[rr.PRESENCE]&&this.bindings[rr.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,d={},h={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(f=>e?.(ut.CHANNEL_ERROR,f)),this._onClose(()=>e?.(ut.CLOSED)),this.updateJoinPayload(Object.assign({config:h},d)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:f})=>{var p;if(this.socket.setAuth(),f===void 0){e?.(ut.SUBSCRIBED);return}else{const v=this.bindings.postgres_changes,b=(p=v?.length)!==null&&p!==void 0?p:0,E=[];for(let _=0;_<b;_++){const g=v[_],{filter:{event:m,schema:y,table:w,filter:k}}=g,x=f&&f[_];if(x&&x.event===m&&x.schema===y&&x.table===w&&x.filter===k)E.push(Object.assign(Object.assign({},g),{id:x.id}));else{this.unsubscribe(),this.state=re.errored,e?.(ut.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(ut.SUBSCRIBED);return}}).receive("error",f=>{this.state=re.errored,e?.(ut.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(ut.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,r){return this.state===re.joined&&e===rr.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,n,r)}async send(e,n={}){var r,s;if(!this._canPush()&&e.type==="broadcast"){const{event:i,payload:o}=e,l={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=re.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(We.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(s=>{r=new di(this,We.leave,{},e),r.receive("ok",()=>{n(),s("ok")}).receive("timeout",()=>{n(),s("timed out")}).receive("error",()=>{s("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=re.closed,this.bindings={}}async _fetchWithTimeout(e,n,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),o=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(i),o}_push(e,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new di(this,e,n,r);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Th){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,r){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,r){var s,i;const o=e.toLocaleLowerCase(),{close:a,error:l,leave:c,join:u}=We;if(r&&[a,l,c,u].indexOf(o)>=0&&r!==this._joinRef())return;let h=this._onMessage(o,n,r);if(n&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(f=>{var p,v,b;return((p=f.filter)===null||p===void 0?void 0:p.event)==="*"||((b=(v=f.filter)===null||v===void 0?void 0:v.event)===null||b===void 0?void 0:b.toLocaleLowerCase())===o}).map(f=>f.callback(h,r)):(i=this.bindings[o])===null||i===void 0||i.filter(f=>{var p,v,b,E,_,g;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){const m=f.id,y=(p=f.filter)===null||p===void 0?void 0:p.event;return m&&((v=n.ids)===null||v===void 0?void 0:v.includes(m))&&(y==="*"||y?.toLocaleLowerCase()===((b=n.data)===null||b===void 0?void 0:b.type.toLocaleLowerCase()))}else{const m=(_=(E=f?.filter)===null||E===void 0?void 0:E.event)===null||_===void 0?void 0:_.toLocaleLowerCase();return m==="*"||m===((g=n?.event)===null||g===void 0?void 0:g.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof h=="object"&&"ids"in h){const p=h.data,{schema:v,table:b,commit_timestamp:E,type:_,errors:g}=p;h=Object.assign(Object.assign({},{schema:v,table:b,commit_timestamp:E,eventType:_,new:{},old:{},errors:g}),this._getPayloadRecords(p))}f.callback(h,r)})}_isClosed(){return this.state===re.closed}_isJoined(){return this.state===re.joined}_isJoining(){return this.state===re.joining}_isLeaving(){return this.state===re.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,r){const s=e.toLocaleLowerCase(),i={type:s,filter:n,callback:r};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,n){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(s=>{var i;return!(((i=s.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===r&&hi.isEqual(s.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(We.close,{},e)}_onError(e){this._on(We.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=re.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Ja(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Ja(e.columns,e.old_record)),n}}const fi=()=>{},Kr={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Ph=[1e3,2e3,5e3,1e4],Nh=1e4,Lh=`
|
|
6
|
+
Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const r=this.getWebSocketConstructor();return new r(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Eh="realtime-js/2.75.0",kh="1.0.0",li=1e4,Sh=1e3,Th=100;var tr;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(tr||(tr={}));var re;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(re||(re={}));var We;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(We||(We={}));var ci;(function(t){t.websocket="websocket"})(ci||(ci={}));var Wt;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Wt||(Wt={}));class xh{constructor(){this.HEADER_LENGTH=1}decode(e,n){return e.constructor===ArrayBuffer?n(this._binaryDecode(e)):n(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const n=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,n,r)}_decodeBroadcast(e,n,r){const s=n.getUint8(1),i=n.getUint8(2);let o=this.HEADER_LENGTH+2;const a=r.decode(e.slice(o,o+s));o=o+s;const l=r.decode(e.slice(o,o+i));o=o+i;const c=JSON.parse(r.decode(e.slice(o,e.byteLength)));return{ref:null,topic:a,event:l,payload:c}}}class Va{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var z;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(z||(z={}));const Ja=(t,e,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=Ah(o,t,e,s),i),{}):{}},Ah=(t,e,n,r)=>{const s=e.find(a=>a.name===t),i=s?.type,o=n[t];return i&&!r.includes(i)?Ya(i,o):ui(o)},Ya=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return $h(e,n)}switch(t){case z.bool:return Rh(e);case z.float4:case z.float8:case z.int2:case z.int4:case z.int8:case z.numeric:case z.oid:return Oh(e);case z.json:case z.jsonb:return Ih(e);case z.timestamp:return Ch(e);case z.abstime:case z.date:case z.daterange:case z.int4range:case z.int8range:case z.money:case z.reltime:case z.text:case z.time:case z.timestamptz:case z.timetz:case z.tsrange:case z.tstzrange:return ui(e);default:return ui(e)}},ui=t=>t,Rh=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Oh=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Ih=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},$h=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,r=t[n];if(t[0]==="{"&&r==="}"){let i;const o=t.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>Ya(e,a))}return t},Ch=t=>typeof t=="string"?t.replace(" ","T"):t,Xa=t=>{let e=t;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class di{constructor(e,n,r={},s=li){this.channel=e,this.event=n,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var r;return this._hasReceived(e)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Za;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Za||(Za={}));class nr{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=n?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},s=>{const{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=nr.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=nr.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel._on(r.diff,{},s=>{const{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=nr.syncDiff(this.state,s,i,o),a())}),this.onJoin((s,i,o)=>{this.channel._trigger("presence",{event:"join",key:s,currentPresences:i,newPresences:o})}),this.onLeave((s,i,o)=>{this.channel._trigger("presence",{event:"leave",key:s,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,r,s){const i=this.cloneDeep(e),o=this.transformState(n),a={},l={};return this.map(i,(c,u)=>{o[c]||(l[c]=u)}),this.map(o,(c,u)=>{const d=i[c];if(d){const h=u.map(b=>b.presence_ref),f=d.map(b=>b.presence_ref),p=u.filter(b=>f.indexOf(b.presence_ref)<0),v=d.filter(b=>h.indexOf(b.presence_ref)<0);p.length>0&&(a[c]=p),v.length>0&&(l[c]=v)}else a[c]=u}),this.syncDiff(i,{joins:a,leaves:l},r,s)}static syncDiff(e,n,r,s){const{joins:i,leaves:o}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(i,(a,l)=>{var c;const u=(c=e[a])!==null&&c!==void 0?c:[];if(e[a]=this.cloneDeep(l),u.length>0){const d=e[a].map(f=>f.presence_ref),h=u.filter(f=>d.indexOf(f.presence_ref)<0);e[a].unshift(...h)}r(a,u,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;const u=l.map(d=>d.presence_ref);c=c.filter(d=>u.indexOf(d.presence_ref)<0),e[a]=c,s(a,c,l),c.length===0&&delete e[a]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(r=>n(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,r)=>{const s=e[r];return"metas"in s?n[r]=s.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):n[r]=s,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Qa;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Qa||(Qa={}));var rr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(rr||(rr={}));var ut;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(ut||(ut={}));class hi{constructor(e,n={config:{}},r){var s,i;if(this.topic=e,this.params=n,this.socket=r,this.bindings={},this.state=re.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new di(this,We.join,this.params,this.timeout),this.rejoinTimer=new Va(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=re.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=re.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=re.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=re.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=re.errored,this.rejoinTimer.scheduleTimeout())}),this._on(We.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new nr(this),this.broadcastEndpointURL=Xa(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.state==re.closed){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[rr.PRESENCE]&&this.bindings[rr.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,d={},h={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(f=>e?.(ut.CHANNEL_ERROR,f)),this._onClose(()=>e?.(ut.CLOSED)),this.updateJoinPayload(Object.assign({config:h},d)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:f})=>{var p;if(this.socket.setAuth(),f===void 0){e?.(ut.SUBSCRIBED);return}else{const v=this.bindings.postgres_changes,b=(p=v?.length)!==null&&p!==void 0?p:0,E=[];for(let _=0;_<b;_++){const g=v[_],{filter:{event:m,schema:y,table:w,filter:k}}=g,x=f&&f[_];if(x&&x.event===m&&x.schema===y&&x.table===w&&x.filter===k)E.push(Object.assign(Object.assign({},g),{id:x.id}));else{this.unsubscribe(),this.state=re.errored,e?.(ut.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(ut.SUBSCRIBED);return}}).receive("error",f=>{this.state=re.errored,e?.(ut.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(ut.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,r){return this.state===re.joined&&e===rr.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,n,r)}async send(e,n={}){var r,s;if(!this._canPush()&&e.type==="broadcast"){const{event:i,payload:o}=e,l={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=re.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(We.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(s=>{r=new di(this,We.leave,{},e),r.receive("ok",()=>{n(),s("ok")}).receive("timeout",()=>{n(),s("timed out")}).receive("error",()=>{s("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=re.closed,this.bindings={}}async _fetchWithTimeout(e,n,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),o=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(i),o}_push(e,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new di(this,e,n,r);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Th){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,r){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,r){var s,i;const o=e.toLocaleLowerCase(),{close:a,error:l,leave:c,join:u}=We;if(r&&[a,l,c,u].indexOf(o)>=0&&r!==this._joinRef())return;let h=this._onMessage(o,n,r);if(n&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(s=this.bindings.postgres_changes)===null||s===void 0||s.filter(f=>{var p,v,b;return((p=f.filter)===null||p===void 0?void 0:p.event)==="*"||((b=(v=f.filter)===null||v===void 0?void 0:v.event)===null||b===void 0?void 0:b.toLocaleLowerCase())===o}).map(f=>f.callback(h,r)):(i=this.bindings[o])===null||i===void 0||i.filter(f=>{var p,v,b,E,_,g;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){const m=f.id,y=(p=f.filter)===null||p===void 0?void 0:p.event;return m&&((v=n.ids)===null||v===void 0?void 0:v.includes(m))&&(y==="*"||y?.toLocaleLowerCase()===((b=n.data)===null||b===void 0?void 0:b.type.toLocaleLowerCase()))}else{const m=(_=(E=f?.filter)===null||E===void 0?void 0:E.event)===null||_===void 0?void 0:_.toLocaleLowerCase();return m==="*"||m===((g=n?.event)===null||g===void 0?void 0:g.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof h=="object"&&"ids"in h){const p=h.data,{schema:v,table:b,commit_timestamp:E,type:_,errors:g}=p;h=Object.assign(Object.assign({},{schema:v,table:b,commit_timestamp:E,eventType:_,new:{},old:{},errors:g}),this._getPayloadRecords(p))}f.callback(h,r)})}_isClosed(){return this.state===re.closed}_isJoined(){return this.state===re.joined}_isJoining(){return this.state===re.joining}_isLeaving(){return this.state===re.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,r){const s=e.toLocaleLowerCase(),i={type:s,filter:n,callback:r};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,n){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(s=>{var i;return!(((i=s.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===r&&hi.isEqual(s.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(We.close,{},e)}_onError(e){this._on(We.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=re.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Ja(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Ja(e.columns,e.old_record)),n}}const fi=()=>{},Vr={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Ph=[1e3,2e3,5e3,1e4],Nh=1e4,Lh=`
|
|
7
7
|
addEventListener("message", (e) => {
|
|
8
8
|
if (e.data.event === "start") {
|
|
9
9
|
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
10
10
|
}
|
|
11
|
-
});`;class Dh{constructor(e,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=li,this.transport=null,this.heartbeatIntervalMs=
|
|
11
|
+
});`;class Dh{constructor(e,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=li,this.transport=null,this.heartbeatIntervalMs=Vr.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=fi,this.ref=0,this.reconnectTimer=null,this.logger=fi,this.conn=null,this.sendBuffer=[],this.serializer=new xh,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=s=>{let i;return s?i=s:typeof fetch>"u"?i=(...o)=>Promise.resolve().then(()=>An).then(({default:a})=>a(...o)).catch(a=>{throw new Error(`Failed to load @supabase/node-fetch: ${a.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):i=fetch,(...o)=>i(...o)},!(!((r=n?.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${ci.websocket}`,this.httpEndpoint=Xa(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=wh.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n}
|
|
12
12
|
|
|
13
13
|
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
14
14
|
|
|
@@ -21,8 +21,8 @@ Option 2: Install and provide the "ws" package:
|
|
|
21
21
|
const client = new RealtimeClient(url, {
|
|
22
22
|
...options,
|
|
23
23
|
transport: ws
|
|
24
|
-
})`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:kh}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},e?this.conn.close(e,n??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,r){this.logger(e,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case tr.connecting:return Wt.Connecting;case tr.open:return Wt.Open;case tr.closing:return Wt.Closing;default:return Wt.Closed}}isConnected(){return this.connectionState()===Wt.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const r=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new hi(`realtime:${e}`,n,this);return this.channels.push(i),i}}push(e){const{topic:n,event:r,payload:s,ref:i}=e,o=()=>{this.encode(e,a=>{var l;(l=this.conn)===null||l===void 0||l.send(a)})};this.log("push",`${n} ${r} (${i})`,s),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(Sh,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},Kr.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:r,event:s,payload:i,ref:o}=n,a=o?`(${o})`:"",l=i.status||"";this.log("receive",`${l} ${r} ${s} ${a}`.trim(),i),this.channels.filter(c=>c._isMember(r)).forEach(c=>c._trigger(s,i,o)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this.workerRef.terminate()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(We.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const r=e.match(/\?/)?"&":"?",s=new URLSearchParams(n);return`${e}${r}${s}`}_workerObjectUrl(e){let n;if(e)n=e;else{const r=new Blob([Lh],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n;e?n=e:this.accessToken?n=await this.accessToken():n=this.accessTokenValue,this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(r=>{const s={access_token:n,version:Eh};n&&r.updateJoinPayload(s),r.joinedOnce&&r._isJoined()&&r._push(We.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(n=>{this.log("error",`error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(n)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new Va(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Kr.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,r,s,i,o,a,l,c,u;if(this.transport=(n=e?.transport)!==null&&n!==void 0?n:null,this.timeout=(r=e?.timeout)!==null&&r!==void 0?r:li,this.heartbeatIntervalMs=(s=e?.heartbeatIntervalMs)!==null&&s!==void 0?s:Kr.HEARTBEAT_INTERVAL,this.worker=(i=e?.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=e?.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(a=e?.heartbeatCallback)!==null&&a!==void 0?a:fi,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(l=e?.reconnectAfterMs)!==null&&l!==void 0?l:(d=>Ph[d-1]||Nh),this.encode=(c=e?.encode)!==null&&c!==void 0?c:((d,h)=>h(JSON.stringify(d))),this.decode=(u=e?.decode)!==null&&u!==void 0?u:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}}class pi extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function te(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class jh extends pi{constructor(e,n,r){super(e),this.name="StorageApiError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class gi extends pi{constructor(e,n){super(e),this.name="StorageUnknownError",this.originalError=n}}var Fh=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};const el=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Promise.resolve().then(()=>xn).then(({default:r})=>r(...n)):e=fetch,(...n)=>e(...n)},Uh=()=>Fh(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Promise.resolve().then(()=>xn)).Response:Response}),_i=t=>{if(Array.isArray(t))return t.map(n=>_i(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=_i(r)}),e},Mh=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};var Gt=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};const mi=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Bh=(t,e,n)=>Gt(void 0,void 0,void 0,function*(){const r=yield Uh();t instanceof r&&!n?.noResolveJson?t.json().then(s=>{const i=t.status||500,o=s?.statusCode||i+"";e(new jh(mi(s),i,o))}).catch(s=>{e(new gi(mi(s),s))}):e(new gi(mi(t),t))}),qh=(t,e,n,r)=>{const s={method:t,headers:e?.headers||{}};return t==="GET"||!r?s:(Mh(r)?(s.headers=Object.assign({"Content-Type":"application/json"},e?.headers),s.body=JSON.stringify(r)):s.body=r,e?.duplex&&(s.duplex=e.duplex),Object.assign(Object.assign({},s),n))};function sr(t,e,n,r,s,i){return Gt(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(n,qh(e,r,s,i)).then(l=>{if(!l.ok)throw l;return r?.noResolveJson?l:l.json()}).then(l=>o(l)).catch(l=>Bh(l,a,r))})})}function Vr(t,e,n,r){return Gt(this,void 0,void 0,function*(){return sr(t,"GET",e,n,r)})}function it(t,e,n,r,s){return Gt(this,void 0,void 0,function*(){return sr(t,"POST",e,r,s,n)})}function vi(t,e,n,r,s){return Gt(this,void 0,void 0,function*(){return sr(t,"PUT",e,r,s,n)})}function Hh(t,e,n,r){return Gt(this,void 0,void 0,function*(){return sr(t,"HEAD",e,Object.assign(Object.assign({},n),{noResolveJson:!0}),r)})}function tl(t,e,n,r,s){return Gt(this,void 0,void 0,function*(){return sr(t,"DELETE",e,r,s,n)})}var zh=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class Wh{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n}then(e,n){return this.execute().then(e,n)}execute(){return zh(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(te(e))return{data:null,error:e};throw e}})}}var Gh=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class Kh{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n}asStream(){return new Wh(this.downloadFn,this.shouldThrowOnError)}then(e,n){return this.execute().then(e,n)}execute(){return Gh(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(te(e))return{data:null,error:e};throw e}})}}var ke=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};const Vh={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},nl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class Jh{constructor(e,n={},r,s){this.shouldThrowOnError=!1,this.url=e,this.headers=n,this.bucketId=r,this.fetch=el(s)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,n,r,s){return ke(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},nl),s);let a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",this.encodeMetadata(l)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",this.encodeMetadata(l))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(l)))),s?.headers&&(a=Object.assign(Object.assign({},a),s.headers));const c=this._removeEmptyFolders(n),u=this._getFinalPath(c),d=yield(e=="PUT"?vi:it)(this.fetch,`${this.url}/object/${u}`,i,Object.assign({headers:a},o?.duplex?{duplex:o.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(te(i))return{data:null,error:i};throw i}})}upload(e,n,r){return ke(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,n,r)})}uploadToSignedUrl(e,n,r,s){return ke(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(e),o=this._getFinalPath(i),a=new URL(this.url+`/object/upload/sign/${o}`);a.searchParams.set("token",n);try{let l;const c=Object.assign({upsert:nl.upsert},s),u=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.append("cacheControl",c.cacheControl)):(l=r,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType);const d=yield vi(this.fetch,a.toString(),l,{headers:u});return{data:{path:i,fullPath:d.Key},error:null}}catch(l){if(this.shouldThrowOnError)throw l;if(te(l))return{data:null,error:l};throw l}})}createSignedUploadUrl(e,n){return ke(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e);const s=Object.assign({},this.headers);n?.upsert&&(s["x-upsert"]="true");const i=yield it(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:s}),o=new URL(this.url+i.url),a=o.searchParams.get("token");if(!a)throw new pi("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:a},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(te(r))return{data:null,error:r};throw r}})}update(e,n,r){return ke(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,n,r)})}move(e,n,r){return ke(this,void 0,void 0,function*(){try{return{data:yield it(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n,destinationBucket:r?.destinationBucket},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}copy(e,n,r){return ke(this,void 0,void 0,function*(){try{return{data:{path:(yield it(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n,destinationBucket:r?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}createSignedUrl(e,n,r){return ke(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e),i=yield it(this.fetch,`${this.url}/object/sign/${s}`,Object.assign({expiresIn:n},r?.transform?{transform:r.transform}:{}),{headers:this.headers});const o=r?.download?`&download=${r.download===!0?"":r.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}createSignedUrls(e,n,r){return ke(this,void 0,void 0,function*(){try{const s=yield it(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:e},{headers:this.headers}),i=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:s.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${i}`):null})),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}download(e,n){const s=typeof n?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(n?.transform||{}),o=i?`?${i}`:"",a=this._getFinalPath(e),l=()=>Vr(this.fetch,`${this.url}/${s}/${a}${o}`,{headers:this.headers,noResolveJson:!0});return new Kh(l,this.shouldThrowOnError)}info(e){return ke(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{const r=yield Vr(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:_i(r),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(te(r))return{data:null,error:r};throw r}})}exists(e){return ke(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{return yield Hh(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(te(r)&&r instanceof gi){const s=r.originalError;if([400,404].includes(s?.status))return{data:!1,error:r}}throw r}})}getPublicUrl(e,n){const r=this._getFinalPath(e),s=[],i=n?.download?`download=${n.download===!0?"":n.download}`:"";i!==""&&s.push(i);const a=typeof n?.transform<"u"?"render/image":"object",l=this.transformOptsToQueryString(n?.transform||{});l!==""&&s.push(l);let c=s.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${r}${c}`)}}}remove(e){return ke(this,void 0,void 0,function*(){try{return{data:yield tl(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(te(n))return{data:null,error:n};throw n}})}list(e,n,r){return ke(this,void 0,void 0,function*(){try{const s=Object.assign(Object.assign(Object.assign({},Vh),n),{prefix:e||""});return{data:yield it(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},r),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}listV2(e,n){return ke(this,void 0,void 0,function*(){try{const r=Object.assign({},e);return{data:yield it(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},n),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(te(r))return{data:null,error:r};throw r}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const n=[];return e.width&&n.push(`width=${e.width}`),e.height&&n.push(`height=${e.height}`),e.resize&&n.push(`resize=${e.resize}`),e.format&&n.push(`format=${e.format}`),e.quality&&n.push(`quality=${e.quality}`),n.join("&")}}const Yh={"X-Client-Info":"storage-js/2.75.0"};var An=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class Xh{constructor(e,n={},r,s){this.shouldThrowOnError=!1;const i=new URL(e);s?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Yh),n),this.fetch=el(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(){return An(this,void 0,void 0,function*(){try{return{data:yield Vr(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(te(e))return{data:null,error:e};throw e}})}getBucket(e){return An(this,void 0,void 0,function*(){try{return{data:yield Vr(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(te(n))return{data:null,error:n};throw n}})}createBucket(e){return An(this,arguments,void 0,function*(n,r={public:!1}){try{return{data:yield it(this.fetch,`${this.url}/bucket`,{id:n,name:n,type:r.type,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}updateBucket(e,n){return An(this,void 0,void 0,function*(){try{return{data:yield vi(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(te(r))return{data:null,error:r};throw r}})}emptyBucket(e){return An(this,void 0,void 0,function*(){try{return{data:yield it(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(te(n))return{data:null,error:n};throw n}})}deleteBucket(e){return An(this,void 0,void 0,function*(){try{return{data:yield tl(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(te(n))return{data:null,error:n};throw n}})}}class Zh extends Xh{constructor(e,n={},r,s){super(e,n,r,s)}from(e){return new Jh(this.url,this.headers,e,this.fetch)}}const Qh="2.75.0";let ir="";typeof Deno<"u"?ir="deno":typeof document<"u"?ir="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ir="react-native":ir="node";const ef={headers:{"X-Client-Info":`supabase-js-${ir}/${Qh}`}},tf={schema:"public"},nf={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},rf={};var sf=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};const of=t=>{let e;return t?e=t:typeof fetch>"u"?e=La:e=fetch,(...n)=>e(...n)},af=()=>typeof Headers>"u"?Da:Headers,lf=(t,e,n)=>{const r=of(n),s=af();return(i,o)=>sf(void 0,void 0,void 0,function*(){var a;const l=(a=yield e())!==null&&a!==void 0?a:t;let c=new s(o?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(i,Object.assign(Object.assign({},o),{headers:c}))})};var cf=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};function uf(t){return t.endsWith("/")?t:t+"/"}function df(t,e){var n,r;const{db:s,auth:i,realtime:o,global:a}=t,{db:l,auth:c,realtime:u,global:d}=e,h={db:Object.assign(Object.assign({},l),s),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},u),o),storage:{},global:Object.assign(Object.assign(Object.assign({},d),a),{headers:Object.assign(Object.assign({},(n=d?.headers)!==null&&n!==void 0?n:{}),(r=a?.headers)!==null&&r!==void 0?r:{})}),accessToken:()=>cf(this,void 0,void 0,function*(){return""})};return t.accessToken?h.accessToken=t.accessToken:delete h.accessToken,h}function hf(t){const e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(uf(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const rl="2.75.0",On=30*1e3,bi=3,yi=bi*On,ff="http://localhost:9999",pf="supabase.auth.token",gf={"X-Client-Info":`gotrue-js/${rl}`},wi="X-Supabase-Api-Version",sl={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},_f=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,mf=600*1e3;class or extends Error{constructor(e,n,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function A(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class vf extends or{constructor(e,n,r){super(e,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function bf(t){return A(t)&&t.name==="AuthApiError"}class Kt extends or{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class Et extends or{constructor(e,n,r,s){super(e,r,s),this.name=n,this.status=r}}class kt extends Et{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function yf(t){return A(t)&&t.name==="AuthSessionMissingError"}class Rn extends Et{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Jr extends Et{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Yr extends Et{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function wf(t){return A(t)&&t.name==="AuthImplicitGrantRedirectError"}class il extends Et{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Ei extends Et{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function ki(t){return A(t)&&t.name==="AuthRetryableFetchError"}class ol extends Et{constructor(e,n,r){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class Si extends Et{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Xr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),al=`
|
|
25
|
-
\r=`.split(""),Ef=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<al.length;e+=1)t[al[e].charCodeAt(0)]=-2;for(let e=0;e<Xr.length;e+=1)t[Xr[e].charCodeAt(0)]=e;return t})();function ll(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Xr[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Xr[r]),e.queuedBits-=6}}function cl(t,e,n){const r=Ef[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function ul(t){const e=[],n=o=>{e.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{Tf(o,r,n)};for(let o=0;o<t.length;o+=1)cl(t.charCodeAt(o),s,i);return e.join("")}function kf(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Sf(t,e){for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(t.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}kf(r,e)}}function Tf(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let r=1;r<6;r+=1)if((t>>7-r&1)===0){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function In(t){const e=[],n={queue:0,queuedBits:0},r=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)cl(t.charCodeAt(s),n,r);return new Uint8Array(e)}function xf(t){const e=[];return Sf(t,n=>e.push(n)),new Uint8Array(e)}function Vt(t){const e=[],n={queue:0,queuedBits:0},r=s=>{e.push(s)};return t.forEach(s=>ll(s,n,r)),ll(null,n,r),e.join("")}function Af(t){return Math.round(Date.now()/1e3)+t}function Of(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const Pe=()=>typeof window<"u"&&typeof document<"u",Jt={tested:!1,writable:!1},dl=()=>{if(!Pe())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Jt.tested)return Jt.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Jt.tested=!0,Jt.writable=!0}catch{Jt.tested=!0,Jt.writable=!1}return Jt.writable};function Rf(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return n.searchParams.forEach((r,s)=>{e[s]=r}),e}const hl=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Promise.resolve().then(()=>xn).then(({default:r})=>r(...n)):e=fetch,(...n)=>e(...n)},If=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",$n=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},Yt=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},St=async(t,e)=>{await t.removeItem(e)};class Zr{constructor(){this.promise=new Zr.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Zr.promiseConstructor=Promise;function Ti(t){const e=t.split(".");if(e.length!==3)throw new Si("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!_f.test(e[r]))throw new Si("JWT not in base64url format");return{header:JSON.parse(ul(e[0])),payload:JSON.parse(ul(e[1])),signature:In(e[2]),raw:{header:e[0],payload:e[1]}}}async function $f(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Cf(t,e){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){r(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function Pf(t){return("0"+t.toString(16)).substr(-2)}function Nf(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let i=0;i<56;i++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(e),Array.from(e,Pf).join("")}async function Lf(t){const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function Df(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await Lf(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Cn(t,e,n=!1){const r=Nf();let s=r;n&&(s+="/PASSWORD_RECOVERY"),await $n(t,`${e}-code-verifier`,s);const i=await Df(r);return[i,r===i?"plain":"s256"]}const jf=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Ff(t){const e=t.headers.get(wi);if(!e||!e.match(jf))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Uf(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Mf(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Bf=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Pn(t){if(!Bf.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function xi(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function fl(t){return JSON.parse(JSON.stringify(t))}var qf=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};const Xt=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Hf=[502,503,504];async function pl(t){var e;if(!If(t))throw new Ei(Xt(t),0);if(Hf.includes(t.status))throw new Ei(Xt(t),t.status);let n;try{n=await t.json()}catch(i){throw new Kt(Xt(i),i)}let r;const s=Ff(t);if(s&&s.getTime()>=sl["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new ol(Xt(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new kt}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new ol(Xt(n),t.status,n.weak_password.reasons);throw new vf(Xt(n),t.status||500,r)}const zf=(t,e,n,r)=>{const s={method:t,headers:e?.headers||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function I(t,e,n,r){var s;const i=Object.assign({},r?.headers);i[wi]||(i[wi]=sl["2024-01-01"].name),r?.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(s=r?.query)!==null&&s!==void 0?s:{};r?.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Wf(t,e,n+a,{headers:i,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(l):{data:Object.assign({},l),error:null}}async function Wf(t,e,n,r,s,i){const o=zf(e,r,s,i);let a;try{a=await t(n,Object.assign({},o))}catch(l){throw console.error(l),new Ei(Xt(l),0)}if(a.ok||await pl(a),r?.noResolveJson)return a;try{return await a.json()}catch(l){await pl(l)}}function Ge(t){var e;let n=null;Vf(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Af(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:r},error:null}}function gl(t){const e=Ge(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Tt(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Gf(t){return{data:t,error:null}}function Kf(t){const{action_link:e,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=t,o=qf(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function _l(t){return t}function Vf(t){return t.access_token&&t.refresh_token&&t.expires_in}const Ai=["global","local","others"];var Jf=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};class Yf{constructor({url:e="",headers:n={},fetch:r}){this.url=e,this.headers=n,this.fetch=hl(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=Ai[0]){if(Ai.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ai.join(", ")}`);try{return await I(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(A(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,n={}){try{return await I(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Tt})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:n}=e,r=Jf(e,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r?.newEmail,delete s.newEmail),await I(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Kf,redirectTo:n?.redirectTo})}catch(n){if(A(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await I(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Tt})}catch(n){if(A(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await I(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=e?.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:_l});if(u.error)throw u.error;const d=await u.json(),h=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const v=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(p.split(";")[1].split("=")[1]);c[`${b}Page`]=v}),c.total=parseInt(h)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(A(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Pn(e);try{return await I(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Tt})}catch(n){if(A(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){Pn(e);try{return await I(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Tt})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,n=!1){Pn(e);try{return await I(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Tt})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Pn(e.userId);try{const{data:n,error:r}=await I(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(A(n))return{data:null,error:n};throw n}}async _deleteFactor(e){Pn(e.userId),Pn(e.id);try{return{data:await I(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(A(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await I(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=e?.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:_l});if(u.error)throw u.error;const d=await u.json(),h=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const v=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(p.split(";")[1].split("=")[1]);c[`${b}Page`]=v}),c.total=parseInt(h)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(A(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await I(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await I(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await I(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await I(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}}function ml(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const Nn={debug:!!(globalThis&&dl()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class vl extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Xf extends vl{}async function Zf(t,e,n){Nn.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;return e>0&&setTimeout(()=>{r.abort(),Nn.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async s=>{if(s){Nn.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,s.name);try{return await n()}finally{Nn.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,s.name)}}else{if(e===0)throw Nn.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Xf(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Nn.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null," "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function Qf(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function bl(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function ep(t){return parseInt(t,16)}function tp(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function np(t){var e;const{chainId:n,domain:r,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:d,version:h}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(h!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
|
|
24
|
+
})`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:kh}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},e?this.conn.close(e,n??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,r){this.logger(e,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case tr.connecting:return Wt.Connecting;case tr.open:return Wt.Open;case tr.closing:return Wt.Closing;default:return Wt.Closed}}isConnected(){return this.connectionState()===Wt.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const r=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new hi(`realtime:${e}`,n,this);return this.channels.push(i),i}}push(e){const{topic:n,event:r,payload:s,ref:i}=e,o=()=>{this.encode(e,a=>{var l;(l=this.conn)===null||l===void 0||l.send(a)})};this.log("push",`${n} ${r} (${i})`,s),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(Sh,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},Vr.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:r,event:s,payload:i,ref:o}=n,a=o?`(${o})`:"",l=i.status||"";this.log("receive",`${l} ${r} ${s} ${a}`.trim(),i),this.channels.filter(c=>c._isMember(r)).forEach(c=>c._trigger(s,i,o)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this.workerRef.terminate()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(We.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const r=e.match(/\?/)?"&":"?",s=new URLSearchParams(n);return`${e}${r}${s}`}_workerObjectUrl(e){let n;if(e)n=e;else{const r=new Blob([Lh],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n;e?n=e:this.accessToken?n=await this.accessToken():n=this.accessTokenValue,this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(r=>{const s={access_token:n,version:Eh};n&&r.updateJoinPayload(s),r.joinedOnce&&r._isJoined()&&r._push(We.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(n=>{this.log("error",`error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(n)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new Va(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Vr.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,r,s,i,o,a,l,c,u;if(this.transport=(n=e?.transport)!==null&&n!==void 0?n:null,this.timeout=(r=e?.timeout)!==null&&r!==void 0?r:li,this.heartbeatIntervalMs=(s=e?.heartbeatIntervalMs)!==null&&s!==void 0?s:Vr.HEARTBEAT_INTERVAL,this.worker=(i=e?.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=e?.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(a=e?.heartbeatCallback)!==null&&a!==void 0?a:fi,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(l=e?.reconnectAfterMs)!==null&&l!==void 0?l:(d=>Ph[d-1]||Nh),this.encode=(c=e?.encode)!==null&&c!==void 0?c:((d,h)=>h(JSON.stringify(d))),this.decode=(u=e?.decode)!==null&&u!==void 0?u:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}}class pi extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function te(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class jh extends pi{constructor(e,n,r){super(e),this.name="StorageApiError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class gi extends pi{constructor(e,n){super(e),this.name="StorageUnknownError",this.originalError=n}}var Uh=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};const el=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Promise.resolve().then(()=>An).then(({default:r})=>r(...n)):e=fetch,(...n)=>e(...n)},Fh=()=>Uh(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Promise.resolve().then(()=>An)).Response:Response}),_i=t=>{if(Array.isArray(t))return t.map(n=>_i(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=_i(r)}),e},Mh=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};var Gt=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};const mi=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Bh=(t,e,n)=>Gt(void 0,void 0,void 0,function*(){const r=yield Fh();t instanceof r&&!n?.noResolveJson?t.json().then(s=>{const i=t.status||500,o=s?.statusCode||i+"";e(new jh(mi(s),i,o))}).catch(s=>{e(new gi(mi(s),s))}):e(new gi(mi(t),t))}),qh=(t,e,n,r)=>{const s={method:t,headers:e?.headers||{}};return t==="GET"||!r?s:(Mh(r)?(s.headers=Object.assign({"Content-Type":"application/json"},e?.headers),s.body=JSON.stringify(r)):s.body=r,e?.duplex&&(s.duplex=e.duplex),Object.assign(Object.assign({},s),n))};function sr(t,e,n,r,s,i){return Gt(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(n,qh(e,r,s,i)).then(l=>{if(!l.ok)throw l;return r?.noResolveJson?l:l.json()}).then(l=>o(l)).catch(l=>Bh(l,a,r))})})}function Jr(t,e,n,r){return Gt(this,void 0,void 0,function*(){return sr(t,"GET",e,n,r)})}function it(t,e,n,r,s){return Gt(this,void 0,void 0,function*(){return sr(t,"POST",e,r,s,n)})}function vi(t,e,n,r,s){return Gt(this,void 0,void 0,function*(){return sr(t,"PUT",e,r,s,n)})}function Hh(t,e,n,r){return Gt(this,void 0,void 0,function*(){return sr(t,"HEAD",e,Object.assign(Object.assign({},n),{noResolveJson:!0}),r)})}function tl(t,e,n,r,s){return Gt(this,void 0,void 0,function*(){return sr(t,"DELETE",e,r,s,n)})}var zh=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class Wh{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n}then(e,n){return this.execute().then(e,n)}execute(){return zh(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(te(e))return{data:null,error:e};throw e}})}}var Gh=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class Kh{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n}asStream(){return new Wh(this.downloadFn,this.shouldThrowOnError)}then(e,n){return this.execute().then(e,n)}execute(){return Gh(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(te(e))return{data:null,error:e};throw e}})}}var Se=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};const Vh={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},nl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class Jh{constructor(e,n={},r,s){this.shouldThrowOnError=!1,this.url=e,this.headers=n,this.bucketId=r,this.fetch=el(s)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,n,r,s){return Se(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},nl),s);let a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",this.encodeMetadata(l)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",this.encodeMetadata(l))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(l)))),s?.headers&&(a=Object.assign(Object.assign({},a),s.headers));const c=this._removeEmptyFolders(n),u=this._getFinalPath(c),d=yield(e=="PUT"?vi:it)(this.fetch,`${this.url}/object/${u}`,i,Object.assign({headers:a},o?.duplex?{duplex:o.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(te(i))return{data:null,error:i};throw i}})}upload(e,n,r){return Se(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,n,r)})}uploadToSignedUrl(e,n,r,s){return Se(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(e),o=this._getFinalPath(i),a=new URL(this.url+`/object/upload/sign/${o}`);a.searchParams.set("token",n);try{let l;const c=Object.assign({upsert:nl.upsert},s),u=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.append("cacheControl",c.cacheControl)):(l=r,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType);const d=yield vi(this.fetch,a.toString(),l,{headers:u});return{data:{path:i,fullPath:d.Key},error:null}}catch(l){if(this.shouldThrowOnError)throw l;if(te(l))return{data:null,error:l};throw l}})}createSignedUploadUrl(e,n){return Se(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e);const s=Object.assign({},this.headers);n?.upsert&&(s["x-upsert"]="true");const i=yield it(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:s}),o=new URL(this.url+i.url),a=o.searchParams.get("token");if(!a)throw new pi("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:a},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(te(r))return{data:null,error:r};throw r}})}update(e,n,r){return Se(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,n,r)})}move(e,n,r){return Se(this,void 0,void 0,function*(){try{return{data:yield it(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n,destinationBucket:r?.destinationBucket},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}copy(e,n,r){return Se(this,void 0,void 0,function*(){try{return{data:{path:(yield it(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:n,destinationBucket:r?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}createSignedUrl(e,n,r){return Se(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e),i=yield it(this.fetch,`${this.url}/object/sign/${s}`,Object.assign({expiresIn:n},r?.transform?{transform:r.transform}:{}),{headers:this.headers});const o=r?.download?`&download=${r.download===!0?"":r.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}createSignedUrls(e,n,r){return Se(this,void 0,void 0,function*(){try{const s=yield it(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:e},{headers:this.headers}),i=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:s.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${i}`):null})),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}download(e,n){const s=typeof n?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(n?.transform||{}),o=i?`?${i}`:"",a=this._getFinalPath(e),l=()=>Jr(this.fetch,`${this.url}/${s}/${a}${o}`,{headers:this.headers,noResolveJson:!0});return new Kh(l,this.shouldThrowOnError)}info(e){return Se(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{const r=yield Jr(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:_i(r),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(te(r))return{data:null,error:r};throw r}})}exists(e){return Se(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{return yield Hh(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(te(r)&&r instanceof gi){const s=r.originalError;if([400,404].includes(s?.status))return{data:!1,error:r}}throw r}})}getPublicUrl(e,n){const r=this._getFinalPath(e),s=[],i=n?.download?`download=${n.download===!0?"":n.download}`:"";i!==""&&s.push(i);const a=typeof n?.transform<"u"?"render/image":"object",l=this.transformOptsToQueryString(n?.transform||{});l!==""&&s.push(l);let c=s.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${r}${c}`)}}}remove(e){return Se(this,void 0,void 0,function*(){try{return{data:yield tl(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(te(n))return{data:null,error:n};throw n}})}list(e,n,r){return Se(this,void 0,void 0,function*(){try{const s=Object.assign(Object.assign(Object.assign({},Vh),n),{prefix:e||""});return{data:yield it(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},r),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}listV2(e,n){return Se(this,void 0,void 0,function*(){try{const r=Object.assign({},e);return{data:yield it(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},n),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(te(r))return{data:null,error:r};throw r}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const n=[];return e.width&&n.push(`width=${e.width}`),e.height&&n.push(`height=${e.height}`),e.resize&&n.push(`resize=${e.resize}`),e.format&&n.push(`format=${e.format}`),e.quality&&n.push(`quality=${e.quality}`),n.join("&")}}const Yh={"X-Client-Info":"storage-js/2.75.0"};var Rn=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class Xh{constructor(e,n={},r,s){this.shouldThrowOnError=!1;const i=new URL(e);s?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Yh),n),this.fetch=el(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(){return Rn(this,void 0,void 0,function*(){try{return{data:yield Jr(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(te(e))return{data:null,error:e};throw e}})}getBucket(e){return Rn(this,void 0,void 0,function*(){try{return{data:yield Jr(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(te(n))return{data:null,error:n};throw n}})}createBucket(e){return Rn(this,arguments,void 0,function*(n,r={public:!1}){try{return{data:yield it(this.fetch,`${this.url}/bucket`,{id:n,name:n,type:r.type,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(te(s))return{data:null,error:s};throw s}})}updateBucket(e,n){return Rn(this,void 0,void 0,function*(){try{return{data:yield vi(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(te(r))return{data:null,error:r};throw r}})}emptyBucket(e){return Rn(this,void 0,void 0,function*(){try{return{data:yield it(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(te(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Rn(this,void 0,void 0,function*(){try{return{data:yield tl(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(te(n))return{data:null,error:n};throw n}})}}class Zh extends Xh{constructor(e,n={},r,s){super(e,n,r,s)}from(e){return new Jh(this.url,this.headers,e,this.fetch)}}const Qh="2.75.0";let ir="";typeof Deno<"u"?ir="deno":typeof document<"u"?ir="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ir="react-native":ir="node";const ef={headers:{"X-Client-Info":`supabase-js-${ir}/${Qh}`}},tf={schema:"public"},nf={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},rf={};var sf=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};const of=t=>{let e;return t?e=t:typeof fetch>"u"?e=La:e=fetch,(...n)=>e(...n)},af=()=>typeof Headers>"u"?Da:Headers,lf=(t,e,n)=>{const r=of(n),s=af();return(i,o)=>sf(void 0,void 0,void 0,function*(){var a;const l=(a=yield e())!==null&&a!==void 0?a:t;let c=new s(o?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(i,Object.assign(Object.assign({},o),{headers:c}))})};var cf=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};function uf(t){return t.endsWith("/")?t:t+"/"}function df(t,e){var n,r;const{db:s,auth:i,realtime:o,global:a}=t,{db:l,auth:c,realtime:u,global:d}=e,h={db:Object.assign(Object.assign({},l),s),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},u),o),storage:{},global:Object.assign(Object.assign(Object.assign({},d),a),{headers:Object.assign(Object.assign({},(n=d?.headers)!==null&&n!==void 0?n:{}),(r=a?.headers)!==null&&r!==void 0?r:{})}),accessToken:()=>cf(this,void 0,void 0,function*(){return""})};return t.accessToken?h.accessToken=t.accessToken:delete h.accessToken,h}function hf(t){const e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(uf(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const rl="2.75.0",On=30*1e3,bi=3,yi=bi*On,ff="http://localhost:9999",pf="supabase.auth.token",gf={"X-Client-Info":`gotrue-js/${rl}`},wi="X-Supabase-Api-Version",sl={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},_f=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,mf=600*1e3;class or extends Error{constructor(e,n,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function A(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class vf extends or{constructor(e,n,r){super(e,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function bf(t){return A(t)&&t.name==="AuthApiError"}class Kt extends or{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class Et extends or{constructor(e,n,r,s){super(e,r,s),this.name=n,this.status=r}}class kt extends Et{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function yf(t){return A(t)&&t.name==="AuthSessionMissingError"}class In extends Et{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Yr extends Et{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Xr extends Et{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function wf(t){return A(t)&&t.name==="AuthImplicitGrantRedirectError"}class il extends Et{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Ei extends Et{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function ki(t){return A(t)&&t.name==="AuthRetryableFetchError"}class ol extends Et{constructor(e,n,r){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class Si extends Et{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Zr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),al=`
|
|
25
|
+
\r=`.split(""),Ef=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<al.length;e+=1)t[al[e].charCodeAt(0)]=-2;for(let e=0;e<Zr.length;e+=1)t[Zr[e].charCodeAt(0)]=e;return t})();function ll(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Zr[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Zr[r]),e.queuedBits-=6}}function cl(t,e,n){const r=Ef[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function ul(t){const e=[],n=o=>{e.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{Tf(o,r,n)};for(let o=0;o<t.length;o+=1)cl(t.charCodeAt(o),s,i);return e.join("")}function kf(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Sf(t,e){for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(t.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}kf(r,e)}}function Tf(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let r=1;r<6;r+=1)if((t>>7-r&1)===0){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function $n(t){const e=[],n={queue:0,queuedBits:0},r=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)cl(t.charCodeAt(s),n,r);return new Uint8Array(e)}function xf(t){const e=[];return Sf(t,n=>e.push(n)),new Uint8Array(e)}function Vt(t){const e=[],n={queue:0,queuedBits:0},r=s=>{e.push(s)};return t.forEach(s=>ll(s,n,r)),ll(null,n,r),e.join("")}function Af(t){return Math.round(Date.now()/1e3)+t}function Rf(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const Pe=()=>typeof window<"u"&&typeof document<"u",Jt={tested:!1,writable:!1},dl=()=>{if(!Pe())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Jt.tested)return Jt.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Jt.tested=!0,Jt.writable=!0}catch{Jt.tested=!0,Jt.writable=!1}return Jt.writable};function Of(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return n.searchParams.forEach((r,s)=>{e[s]=r}),e}const hl=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>Promise.resolve().then(()=>An).then(({default:r})=>r(...n)):e=fetch,(...n)=>e(...n)},If=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Cn=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},Yt=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},St=async(t,e)=>{await t.removeItem(e)};class Qr{constructor(){this.promise=new Qr.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}Qr.promiseConstructor=Promise;function Ti(t){const e=t.split(".");if(e.length!==3)throw new Si("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!_f.test(e[r]))throw new Si("JWT not in base64url format");return{header:JSON.parse(ul(e[0])),payload:JSON.parse(ul(e[1])),signature:$n(e[2]),raw:{header:e[0],payload:e[1]}}}async function $f(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Cf(t,e){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){r(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function Pf(t){return("0"+t.toString(16)).substr(-2)}function Nf(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let i=0;i<56;i++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(e),Array.from(e,Pf).join("")}async function Lf(t){const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function Df(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await Lf(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Pn(t,e,n=!1){const r=Nf();let s=r;n&&(s+="/PASSWORD_RECOVERY"),await Cn(t,`${e}-code-verifier`,s);const i=await Df(r);return[i,r===i?"plain":"s256"]}const jf=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Uf(t){const e=t.headers.get(wi);if(!e||!e.match(jf))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Ff(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Mf(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Bf=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Nn(t){if(!Bf.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function xi(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function fl(t){return JSON.parse(JSON.stringify(t))}var qf=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};const Xt=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Hf=[502,503,504];async function pl(t){var e;if(!If(t))throw new Ei(Xt(t),0);if(Hf.includes(t.status))throw new Ei(Xt(t),t.status);let n;try{n=await t.json()}catch(i){throw new Kt(Xt(i),i)}let r;const s=Uf(t);if(s&&s.getTime()>=sl["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new ol(Xt(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new kt}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new ol(Xt(n),t.status,n.weak_password.reasons);throw new vf(Xt(n),t.status||500,r)}const zf=(t,e,n,r)=>{const s={method:t,headers:e?.headers||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function I(t,e,n,r){var s;const i=Object.assign({},r?.headers);i[wi]||(i[wi]=sl["2024-01-01"].name),r?.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(s=r?.query)!==null&&s!==void 0?s:{};r?.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Wf(t,e,n+a,{headers:i,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(l):{data:Object.assign({},l),error:null}}async function Wf(t,e,n,r,s,i){const o=zf(e,r,s,i);let a;try{a=await t(n,Object.assign({},o))}catch(l){throw console.error(l),new Ei(Xt(l),0)}if(a.ok||await pl(a),r?.noResolveJson)return a;try{return await a.json()}catch(l){await pl(l)}}function Ge(t){var e;let n=null;Vf(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Af(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:r},error:null}}function gl(t){const e=Ge(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Tt(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Gf(t){return{data:t,error:null}}function Kf(t){const{action_link:e,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=t,o=qf(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function _l(t){return t}function Vf(t){return t.access_token&&t.refresh_token&&t.expires_in}const Ai=["global","local","others"];var Jf=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};class Yf{constructor({url:e="",headers:n={},fetch:r}){this.url=e,this.headers=n,this.fetch=hl(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=Ai[0]){if(Ai.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ai.join(", ")}`);try{return await I(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(A(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,n={}){try{return await I(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Tt})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:n}=e,r=Jf(e,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r?.newEmail,delete s.newEmail),await I(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Kf,redirectTo:n?.redirectTo})}catch(n){if(A(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await I(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Tt})}catch(n){if(A(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await I(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=e?.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:_l});if(u.error)throw u.error;const d=await u.json(),h=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const v=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(p.split(";")[1].split("=")[1]);c[`${b}Page`]=v}),c.total=parseInt(h)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(A(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Nn(e);try{return await I(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Tt})}catch(n){if(A(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){Nn(e);try{return await I(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:Tt})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,n=!1){Nn(e);try{return await I(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:Tt})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Nn(e.userId);try{const{data:n,error:r}=await I(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(A(n))return{data:null,error:n};throw n}}async _deleteFactor(e){Nn(e.userId),Nn(e.id);try{return{data:await I(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(A(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await I(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e?.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=e?.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:_l});if(u.error)throw u.error;const d=await u.json(),h=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const v=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),b=JSON.parse(p.split(";")[1].split("=")[1]);c[`${b}Page`]=v}),c.total=parseInt(h)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(A(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await I(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await I(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await I(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await I(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}}function ml(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const Ln={debug:!!(globalThis&&dl()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class vl extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Xf extends vl{}async function Zf(t,e,n){Ln.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;return e>0&&setTimeout(()=>{r.abort(),Ln.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async s=>{if(s){Ln.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,s.name);try{return await n()}finally{Ln.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,s.name)}}else{if(e===0)throw Ln.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Xf(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Ln.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null," "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function Qf(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function bl(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function ep(t){return parseInt(t,16)}function tp(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function np(t){var e;const{chainId:n,domain:r,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:d,version:h}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(h!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
|
|
26
26
|
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=bl(t.address),p=u?`${u}://${r}`:r,v=t.statement?`${t.statement}
|
|
27
27
|
`:"",b=`${p} wants you to sign in with your Ethereum account:
|
|
28
28
|
${f}
|
|
@@ -37,11 +37,11 @@ Not Before: ${a.toISOString()}`),l&&(E+=`
|
|
|
37
37
|
Request ID: ${l}`),c){let _=`
|
|
38
38
|
Resources:`;for(const g of c){if(!g||typeof g!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${g}`);_+=`
|
|
39
39
|
- ${g}`}E+=_}return`${b}
|
|
40
|
-
${E}`}class ne extends Error{constructor({message:e,code:n,cause:r,name:s}){var i;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=s??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}}class Qr extends ne{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function rp({error:t,options:e}){var n,r,s;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ne({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new ne({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new ne({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new ne({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new ne({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ne({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new ne({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ne({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(wl(o)){if(i.rp.id!==o)return new ne({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ne({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new ne({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new ne({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ne({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function sp({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ne({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ne({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(wl(r)){if(n.rpId!==r)return new ne({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ne({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ne({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ne({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}var yl=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};class ip{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const op=new ip;function ap(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:r}=t,s=yl(t,["challenge","user","excludeCredentials"]),i=In(e).buffer,o=Object.assign(Object.assign({},n),{id:In(n.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:In(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function lp(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,r=yl(t,["challenge","allowCredentials"]),s=In(e).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const a=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:In(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function cp(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:Vt(new Uint8Array(t.response.attestationObject)),clientDataJSON:Vt(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function up(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,r=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Vt(new Uint8Array(s.authenticatorData)),clientDataJSON:Vt(new Uint8Array(s.clientDataJSON)),signature:Vt(new Uint8Array(s.signature)),userHandle:s.userHandle?Vt(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function wl(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function El(){var t,e;return!!(Pe()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function dp(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Qr("Browser returned unexpected credential type",e)}:{data:null,error:new Qr("Empty credential response",e)}}catch(e){return{data:null,error:rp({error:e,options:t})}}}async function hp(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Qr("Browser returned unexpected credential type",e)}:{data:null,error:new Qr("Empty credential response",e)}}catch(e){return{data:null,error:sp({error:e,options:t})}}}const fp={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"},pp={userVerification:"preferred",hints:["security-key"]};function es(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),n=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of t)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(n(o))r[i]=o;else if(e(o)){const a=r[i];e(a)?r[i]=es(a,o):r[i]=es(o)}else r[i]=o}return r}function gp(t,e){return es(fp,t,e||{})}function _p(t,e){return es(pp,t,e||{})}class mp{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:r,signal:s},i){try{const{data:o,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!o)return{data:null,error:a};const l=s??op.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:c}=o.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${r}`),c.displayName||(c.displayName=c.name)}switch(o.webauthn.type){case"create":{const c=gp(o.webauthn.credential_options.publicKey,i?.create),{data:u,error:d}=await dp({publicKey:c,signal:l});return u?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:u}},error:null}:{data:null,error:d}}case"request":{const c=_p(o.webauthn.credential_options.publicKey,i?.request),{data:u,error:d}=await hp(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:c,signal:l}));return u?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:u}},error:null}:{data:null,error:d}}}}catch(o){return A(o)?{data:null,error:o}:{data:null,error:new Kt("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}},i){if(!n)return{data:null,error:new or("rpId is required for WebAuthn authentication")};try{if(!El())return{data:null,error:new Kt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(o){return A(o)?{data:null,error:o}:{data:null,error:new Kt("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s},i){if(!n)return{data:null,error:new or("rpId is required for WebAuthn registration")};try{if(!El())return{data:null,error:new Kt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(h=>h.factor_type==="webauthn"&&h.friendly_name===e&&h.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u?.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return A(o)?{data:null,error:o}:{data:null,error:new Kt("Unexpected error in register",o)}}}}Qf();const vp={url:ff,storageKey:pf,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:gf,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function kl(t,e,n){return await n()}const Ln={};class ar{get jwks(){var e,n;return(n=(e=Ln[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){Ln[this.storageKey]=Object.assign(Object.assign({},Ln[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=Ln[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ln[this.storageKey]=Object.assign(Object.assign({},Ln[this.storageKey]),{cachedAt:e})}constructor(e){var n,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=ar.nextInstanceID,ar.nextInstanceID+=1,this.instanceID>0&&Pe()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const s=Object.assign(Object.assign({},vp),e);if(this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.persistSession=s.persistSession,this.storageKey=s.storageKey,this.autoRefreshToken=s.autoRefreshToken,this.admin=new Yf({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=hl(s.fetch),this.lock=s.lock||kl,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,s.lock?this.lock=s.lock:Pe()&&(!((n=globalThis?.navigator)===null||n===void 0)&&n.locks)?this.lock=Zf:this.lock=kl,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new mp(this)},this.persistSession?(s.storage?this.storage=s.storage:dl()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ml(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=ml(this.memoryStorage)),Pe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(r=this.broadcastChannel)===null||r===void 0||r.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${rl}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const n=Rf(window.location.href);let r="none";if(this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce"),Pe()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),wf(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:o,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return A(n)?{error:n}:{error:new Kt("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,r,s;try{const i=await I(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=e?.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(s=e?.options)===null||s===void 0?void 0:s.captchaToken}},xform:Ge}),{data:o,error:a}=i;if(a||!o)return{data:{user:null,session:null},error:a};const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:c,session:l},error:null}}catch(i){if(A(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(e){var n,r,s;try{let i;if("email"in e){const{email:u,password:d,options:h}=e;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await Cn(this.storage,this.storageKey)),i=await I(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h?.emailRedirectTo,body:{email:u,password:d,data:(n=h?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:h?.captchaToken},code_challenge:f,code_challenge_method:p},xform:Ge})}else if("phone"in e){const{phone:u,password:d,options:h}=e;i=await I(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(r=h?.data)!==null&&r!==void 0?r:{},channel:(s=h?.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:Ge})}else throw new Jr("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return{data:{user:null,session:null},error:a};const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:c,session:l},error:null}}catch(i){if(A(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let n;if("email"in e){const{email:i,password:o,options:a}=e;n=await I(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:gl})}else if("phone"in e){const{phone:i,password:o,options:a}=e;n=await I(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:gl})}else throw new Jr("You must provide either an email or phone number and a password");const{data:r,error:s}=n;return s?{data:{user:null,session:null},error:s}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new Rn}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(A(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(e){var n,r,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,r,s,i,o,a,l,c,u,d,h;let f,p;if("message"in e)f=e.message,p=e.signature;else{const{chain:v,wallet:b,statement:E,options:_}=e;let g;if(Pe())if(typeof b=="object")g=b;else{const S=window;if("ethereum"in S&&typeof S.ethereum=="object"&&"request"in S.ethereum&&typeof S.ethereum.request=="function")g=S.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof b!="object"||!_?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");g=b}const m=new URL((n=_?.url)!==null&&n!==void 0?n:window.location.href),y=await g.request({method:"eth_requestAccounts"}).then(S=>S).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!y||y.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const w=bl(y[0]);let k=(r=_?.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!k){const S=await g.request({method:"eth_chainId"});k=ep(S)}const x={domain:m.host,address:w,statement:E,uri:m.href,version:"1",chainId:k,nonce:(s=_?.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=_?.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=_?.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=_?.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=_?.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=_?.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=np(x),p=await g.request({method:"personal_sign",params:[tp(f),w]})}try{const{data:v,error:b}=await I(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(h=e.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:Ge});if(b)throw b;return!v||!v.session||!v.user?{data:{user:null,session:null},error:new Rn}:(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),{data:Object.assign({},v),error:b})}catch(v){if(A(v))return{data:{user:null,session:null},error:v};throw v}}async signInWithSolana(e){var n,r,s,i,o,a,l,c,u,d,h,f;let p,v;if("message"in e)p=e.message,v=e.signature;else{const{chain:b,wallet:E,statement:_,options:g}=e;let m;if(Pe())if(typeof E=="object")m=E;else{const w=window;if("solana"in w&&typeof w.solana=="object"&&("signIn"in w.solana&&typeof w.solana.signIn=="function"||"signMessage"in w.solana&&typeof w.solana.signMessage=="function"))m=w.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!g?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");m=E}const y=new URL((n=g?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in m&&m.signIn){const w=await m.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},g?.signInWithSolana),{version:"1",domain:y.host,uri:y.href}),_?{statement:_}:null));let k;if(Array.isArray(w)&&w[0]&&typeof w[0]=="object")k=w[0];else if(w&&typeof w=="object"&&"signedMessage"in w&&"signature"in w)k=w;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in k&&"signature"in k&&(typeof k.signedMessage=="string"||k.signedMessage instanceof Uint8Array)&&k.signature instanceof Uint8Array)p=typeof k.signedMessage=="string"?k.signedMessage:new TextDecoder().decode(k.signedMessage),v=k.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in m)||typeof m.signMessage!="function"||!("publicKey"in m)||typeof m!="object"||!m.publicKey||!("toBase58"in m.publicKey)||typeof m.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${y.host} wants you to sign in with your Solana account:`,m.publicKey.toBase58(),..._?["",_,""]:[""],"Version: 1",`URI: ${y.href}`,`Issued At: ${(s=(r=g?.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=g?.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${g.signInWithSolana.notBefore}`]:[],...!((o=g?.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${g.signInWithSolana.expirationTime}`]:[],...!((a=g?.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${g.signInWithSolana.chainId}`]:[],...!((l=g?.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${g.signInWithSolana.nonce}`]:[],...!((c=g?.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${g.signInWithSolana.requestId}`]:[],...!((d=(u=g?.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...g.signInWithSolana.resources.map(k=>`- ${k}`)]:[]].join(`
|
|
41
|
-
`);const w=await m.signMessage(new TextEncoder().encode(p),"utf8");if(!w||!(w instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");v=w}}try{const{data:b,error:E}=await I(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:Vt(v)},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:Ge});if(E)throw E;return!b||!b.session||!b.user?{data:{user:null,session:null},error:new Rn}:(b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),{data:Object.assign({},b),error:E})}catch(b){if(A(b))return{data:{user:null,session:null},error:b};throw b}}async _exchangeCodeForSession(e){const n=await Yt(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{const{data:i,error:o}=await I(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:Ge});if(await St(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new Rn}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(A(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(e){try{const{options:n,provider:r,token:s,access_token:i,nonce:o}=e,a=await I(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:Ge}),{data:l,error:c}=a;return c?{data:{user:null,session:null},error:c}:!l||!l.session||!l.user?{data:{user:null,session:null},error:new Rn}:(l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),{data:l,error:c})}catch(n){if(A(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(e){var n,r,s,i,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Cn(this.storage,this.storageKey));const{error:d}=await I(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l?.data)!==null&&n!==void 0?n:{},create_user:(r=l?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l?.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l?.emailRedirectTo});return{data:{user:null,session:null},error:d}}if("phone"in e){const{phone:a,options:l}=e,{data:c,error:u}=await I(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=l?.data)!==null&&s!==void 0?s:{},create_user:(i=l?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l?.captchaToken},channel:(o=l?.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:c?.message_id},error:u}}throw new Jr("You must provide either an email or phone number.")}catch(a){if(A(a))return{data:{user:null,session:null},error:a};throw a}}async verifyOtp(e){var n,r;try{let s,i;"options"in e&&(s=(n=e.options)===null||n===void 0?void 0:n.redirectTo,i=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await I(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Ge});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l?.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),{data:{user:c,session:l},error:null}}catch(s){if(A(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithSSO(e){var n,r,s;try{let i=null,o=null;return this.flowType==="pkce"&&([i,o]=await Cn(this.storage,this.storageKey)),await I(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=e?.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:o}),headers:this.headers,xform:Gf})}catch(i){if(A(i))return{data:null,error:i};throw i}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)throw r;if(!n)throw new kt;const{error:s}=await I(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:s}})}catch(e){if(A(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:r,type:s,options:i}=e,{error:o}=await I(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:i?.captchaToken}},redirectTo:i?.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:r,type:s,options:i}=e,{data:o,error:a}=await I(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:i?.captchaToken}}});return{data:{user:null,session:null,messageId:o?.message_id},error:a}}throw new Jr("You must provide either an email or phone number and a type")}catch(n){if(A(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await Yt(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<yi:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const o=await Yt(this.userStorage,this.storageKey+"-user");o?.user?e.user=o.user:e.user=xi()}if(this.storage.isServer&&e.user){let o=this.suppressGetSessionWarning;e=new Proxy(e,{get:(l,c,u)=>(!o&&c==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),o=!0,this.suppressGetSessionWarning=!0),Reflect.get(l,c,u))})}return{data:{session:e},error:null}}const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:s},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await I(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Tt}):await this._useSession(async n=>{var r,s,i;const{data:o,error:a}=n;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new kt}:await I(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:Tt})})}catch(n){if(A(n))return yf(n)&&(await this._removeSession(),await St(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:n};throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new kt;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Cn(this.storage,this.storageKey));const{data:c,error:u}=await I(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:Tt});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new kt;const n=Date.now()/1e3;let r=n,s=!0,i=null;const{payload:o}=Ti(e.access_token);if(o.exp&&(r=o.exp,s=r<=n),s){const{data:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return{data:{user:null,session:null},error:l};if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)throw l;i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(n){if(A(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var r;if(!e){const{data:o,error:a}=n;if(a)throw a;e=(r=o.session)!==null&&r!==void 0?r:void 0}if(!e?.refresh_token)throw new kt;const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(A(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(e,n){try{if(!Pe())throw new Yr("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Yr(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new il("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Yr("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new il("No code detected.");const{data:_,error:g}=await this._exchangeCodeForSession(e.code);if(g)throw g;const m=new URL(window.location.href);return m.searchParams.delete("code"),window.history.replaceState(window.history.state,"",m.toString()),{data:{session:_.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:s,access_token:i,refresh_token:o,expires_in:a,expires_at:l,token_type:c}=e;if(!i||!a||!o||!c)throw new Yr("No session defined in URL");const u=Math.round(Date.now()/1e3),d=parseInt(a);let h=u+d;l&&(h=parseInt(l));const f=h-u;f*1e3<=On&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${d}s`);const p=h-d;u-p>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",p,h,u):u-p<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",p,h,u);const{data:v,error:b}=await this._getUser(i);if(b)throw b;const E={provider_token:r,provider_refresh_token:s,access_token:i,expires_in:d,expires_at:h,refresh_token:o,token_type:c,user:v.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:E,redirectType:e.type},error:null}}catch(r){if(A(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await Yt(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return{error:i};const o=(r=s.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(bf(a)&&(a.status===404||a.status===401||a.status===403)))return{error:a}}return e!=="others"&&(await this._removeSession(),await St(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const n=Of(),r={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async n=>{var r,s;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),console.error(i)}})}async resetPasswordForEmail(e,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await Cn(this.storage,this.storageKey,!0));try{return await I(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(A(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return{data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(n){if(A(n))return{data:null,error:n};throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:r,error:s}=await this._useSession(async i=>{var o,a,l,c,u;const{data:d,error:h}=i;if(h)throw h;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await I(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=d.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(s)throw s;return Pe()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r?.url),{data:{provider:e.provider,url:r?.url},error:null}}catch(r){if(A(r))return{data:{provider:e.provider,url:null},error:r};throw r}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var r;try{const{error:s,data:{session:i}}=n;if(s)throw s;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,d=await I(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:Ge}),{data:h,error:f}=d;return f?{data:{user:null,session:null},error:f}:!h||!h.session||!h.user?{data:{user:null,session:null},error:new Rn}:(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),{data:h,error:f})}catch(s){if(A(s))return{data:{user:null,session:null},error:s};throw s}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)throw o;return await I(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await Cf(async s=>(s>0&&await $f(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await I(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Ge})),(s,i)=>{const o=200*Math.pow(2,s);return i&&ki(i)&&Date.now()+o-r<On})}catch(r){if(this._debug(n,"error",r),A(r))return{data:{session:null,user:null},error:r};throw r}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",r),Pe()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await Yt(this.storage,this.storageKey);if(s&&this.userStorage){let o=await Yt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await $n(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o?.user)!==null&&e!==void 0?e:xi()}else if(s&&!s.user&&!s.user){const o=await Yt(this.storage,this.storageKey+"-user");o&&o?.user?(s.user=o.user,await St(this.storage,this.storageKey+"-user"),await $n(this.storage,this.storageKey,s)):s.user=xi()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const i=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<yi;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${yi}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),ki(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(s.access_token);!a&&o?.user?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var n,r;if(!e)throw new kt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new Zr;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new kt;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(s,"error",i),A(i)){const o={data:null,error:i};return ki(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,n,r=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,n)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const n=Object.assign({},e),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await $n(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const i=fl(s);await $n(this.storage,this.storageKey,i)}else{const s=fl(n);await $n(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),await St(this.storage,this.storageKey),await St(this.storage,this.storageKey+"-code-verifier"),await St(this.storage,this.storageKey+"-user"),this.userStorage&&await St(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Pe()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),On);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-e)/On);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${On}ms, refresh threshold is ${bi} ticks`),s<=bi&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof vl)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Pe()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,r){const s=[`provider=${encodeURIComponent(n)}`];if(r?.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await Cn(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(r?.queryParams){const i=new URLSearchParams(r.queryParams);s.push(i.toString())}return r?.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?{data:null,error:i}:await I(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _enroll(e){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await I(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=i?.session)===null||r===void 0?void 0:r.access_token});return c?{data:null,error:c}:(e.factorType==="totp"&&l.type==="totp"&&(!((s=l?.totp)===null||s===void 0)&&s.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),{data:l,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return{data:null,error:i};const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?cp(e.webauthn.credential_response):up(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await I(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:l})})}catch(n){if(A(n))return{data:null,error:n};throw n}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return{data:null,error:i};const o=await I(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:ap(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:lp(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(A(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(e){const{data:n,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=n?.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var n,r;const{data:{session:s},error:i}=e;if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Ti(s.access_token);let a=null;o.aal&&(a=o.aal);let l=a;((r=(n=s.user.factors)===null||n===void 0?void 0:n.filter(d=>d.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(l="aal2");const u=o.amr||[];return{data:{currentLevel:a,nextLevel:l,currentAuthenticationMethods:u},error:null}}))}async fetchJwk(e,n={keys:[]}){let r=n.keys.find(a=>a.kid===e);if(r)return r;const s=Date.now();if(r=this.jwks.keys.find(a=>a.kid===e),r&&this.jwks_cached_at+mf>s)return r;const{data:i,error:o}=await I(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,r=i.keys.find(a=>a.kid===e),!r)?null:r}async getClaims(e,n={}){try{let r=e;if(!r){const{data:f,error:p}=await this.getSession();if(p||!f.session)return{data:null,error:p};r=f.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=Ti(r);n?.allowExpired||Uf(i.exp);const c=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!c){const{error:f}=await this.getUser(r);if(f)throw f;return{data:{claims:i,header:s,signature:o},error:null}}const u=Mf(s.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,o,xf(`${a}.${l}`)))throw new Si("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(r){if(A(r))return{data:null,error:r};throw r}}}ar.nextInstanceID=0;const bp=ar;class yp extends bp{constructor(e){super(e)}}var wp=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class Ep{constructor(e,n,r){var s,i,o;this.supabaseUrl=e,this.supabaseKey=n;const a=hf(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const l=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:tf,realtime:rf,auth:Object.assign(Object.assign({},nf),{storageKey:l}),global:ef},u=df(r??{},c);this.storageKey=(s=u.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(i=u.global.headers)!==null&&i!==void 0?i:{},u.accessToken?(this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=u.auth)!==null&&o!==void 0?o:{},this.headers,u.global.fetch),this.fetch=lf(n,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.realtime)),this.rest=new yh(new URL("rest/v1",a).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new Zh(this.storageUrl.href,this.headers,this.fetch,r?.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new lh(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,n={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,n,r)}channel(e,n={config:{}}){return this.realtime.channel(e,n)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){return wp(this,void 0,void 0,function*(){var e,n;if(this.accessToken)return yield this.accessToken();const{data:r}=yield this.auth.getSession();return(n=(e=r.session)===null||e===void 0?void 0:e.access_token)!==null&&n!==void 0?n:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:n,detectSessionInUrl:r,storage:s,userStorage:i,storageKey:o,flowType:a,lock:l,debug:c},u,d){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new yp({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),u),storageKey:o,autoRefreshToken:e,persistSession:n,detectSessionInUrl:r,storage:s,userStorage:i,flowType:a,lock:l,debug:c,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Dh(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,r)=>{this._handleTokenChanged(n,"CLIENT",r?.access_token)})}_handleTokenChanged(e,n,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const kp=(t,e,n)=>new Ep(t,e,n);function Sp(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}Sp()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");function Oi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Zt=Oi();function Sl(t){Zt=t}var lr={exec:()=>null};function j(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(pe.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var Tp=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),pe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},xp=/^(?:[ \t]*(?:\n|$))+/,Ap=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Op=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,cr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Rp=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ri=/(?:[*+-]|\d{1,9}[.)])/,Tl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,xl=j(Tl).replace(/bull/g,Ri).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ip=j(Tl).replace(/bull/g,Ri).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ii=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$p=/^[^\n]+/,$i=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Cp=j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",$i).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pp=j(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ri).getRegex(),ts="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ci=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Np=j("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ci).replace("tag",ts).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Al=j(Ii).replace("hr",cr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ts).getRegex(),Lp=j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Al).getRegex(),Pi={blockquote:Lp,code:Ap,def:Cp,fences:Op,heading:Rp,hr:cr,html:Np,lheading:xl,list:Pp,newline:xp,paragraph:Al,table:lr,text:$p},Ol=j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",cr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ts).getRegex(),Dp={...Pi,lheading:Ip,table:Ol,paragraph:j(Ii).replace("hr",cr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ol).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ts).getRegex()},jp={...Pi,html:j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ci).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:lr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:j(Ii).replace("hr",cr).replace("heading",` *#{1,6} *[^
|
|
42
|
-
]`).replace("lheading",xl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},
|
|
40
|
+
${E}`}class ne extends Error{constructor({message:e,code:n,cause:r,name:s}){var i;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=s??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}}class es extends ne{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function rp({error:t,options:e}){var n,r,s;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ne({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new ne({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new ne({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new ne({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new ne({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ne({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new ne({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ne({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(wl(o)){if(i.rp.id!==o)return new ne({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ne({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new ne({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new ne({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ne({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function sp({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ne({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ne({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(wl(r)){if(n.rpId!==r)return new ne({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ne({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ne({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ne({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}var yl=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};class ip{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const op=new ip;function ap(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:r}=t,s=yl(t,["challenge","user","excludeCredentials"]),i=$n(e).buffer,o=Object.assign(Object.assign({},n),{id:$n(n.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:$n(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function lp(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,r=yl(t,["challenge","allowCredentials"]),s=$n(e).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const a=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:$n(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function cp(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:Vt(new Uint8Array(t.response.attestationObject)),clientDataJSON:Vt(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function up(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,r=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Vt(new Uint8Array(s.authenticatorData)),clientDataJSON:Vt(new Uint8Array(s.clientDataJSON)),signature:Vt(new Uint8Array(s.signature)),userHandle:s.userHandle?Vt(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function wl(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function El(){var t,e;return!!(Pe()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function dp(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new es("Browser returned unexpected credential type",e)}:{data:null,error:new es("Empty credential response",e)}}catch(e){return{data:null,error:rp({error:e,options:t})}}}async function hp(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new es("Browser returned unexpected credential type",e)}:{data:null,error:new es("Empty credential response",e)}}catch(e){return{data:null,error:sp({error:e,options:t})}}}const fp={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"},pp={userVerification:"preferred",hints:["security-key"]};function ts(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),n=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of t)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(n(o))r[i]=o;else if(e(o)){const a=r[i];e(a)?r[i]=ts(a,o):r[i]=ts(o)}else r[i]=o}return r}function gp(t,e){return ts(fp,t,e||{})}function _p(t,e){return ts(pp,t,e||{})}class mp{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:r,signal:s},i){try{const{data:o,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!o)return{data:null,error:a};const l=s??op.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:c}=o.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${r}`),c.displayName||(c.displayName=c.name)}switch(o.webauthn.type){case"create":{const c=gp(o.webauthn.credential_options.publicKey,i?.create),{data:u,error:d}=await dp({publicKey:c,signal:l});return u?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:u}},error:null}:{data:null,error:d}}case"request":{const c=_p(o.webauthn.credential_options.publicKey,i?.request),{data:u,error:d}=await hp(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:c,signal:l}));return u?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:u}},error:null}:{data:null,error:d}}}}catch(o){return A(o)?{data:null,error:o}:{data:null,error:new Kt("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}},i){if(!n)return{data:null,error:new or("rpId is required for WebAuthn authentication")};try{if(!El())return{data:null,error:new Kt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(o){return A(o)?{data:null,error:o}:{data:null,error:new Kt("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s},i){if(!n)return{data:null,error:new or("rpId is required for WebAuthn registration")};try{if(!El())return{data:null,error:new Kt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(h=>h.factor_type==="webauthn"&&h.friendly_name===e&&h.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u?.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return A(o)?{data:null,error:o}:{data:null,error:new Kt("Unexpected error in register",o)}}}}Qf();const vp={url:ff,storageKey:pf,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:gf,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function kl(t,e,n){return await n()}const Dn={};class ar{get jwks(){var e,n;return(n=(e=Dn[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){Dn[this.storageKey]=Object.assign(Object.assign({},Dn[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=Dn[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Dn[this.storageKey]=Object.assign(Object.assign({},Dn[this.storageKey]),{cachedAt:e})}constructor(e){var n,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=ar.nextInstanceID,ar.nextInstanceID+=1,this.instanceID>0&&Pe()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const s=Object.assign(Object.assign({},vp),e);if(this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.persistSession=s.persistSession,this.storageKey=s.storageKey,this.autoRefreshToken=s.autoRefreshToken,this.admin=new Yf({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=hl(s.fetch),this.lock=s.lock||kl,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,s.lock?this.lock=s.lock:Pe()&&(!((n=globalThis?.navigator)===null||n===void 0)&&n.locks)?this.lock=Zf:this.lock=kl,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new mp(this)},this.persistSession?(s.storage?this.storage=s.storage:dl()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ml(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=ml(this.memoryStorage)),Pe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(r=this.broadcastChannel)===null||r===void 0||r.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${rl}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const n=Of(window.location.href);let r="none";if(this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce"),Pe()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),wf(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:o,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return A(n)?{error:n}:{error:new Kt("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,r,s;try{const i=await I(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=e?.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(s=e?.options)===null||s===void 0?void 0:s.captchaToken}},xform:Ge}),{data:o,error:a}=i;if(a||!o)return{data:{user:null,session:null},error:a};const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:c,session:l},error:null}}catch(i){if(A(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(e){var n,r,s;try{let i;if("email"in e){const{email:u,password:d,options:h}=e;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await Pn(this.storage,this.storageKey)),i=await I(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h?.emailRedirectTo,body:{email:u,password:d,data:(n=h?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:h?.captchaToken},code_challenge:f,code_challenge_method:p},xform:Ge})}else if("phone"in e){const{phone:u,password:d,options:h}=e;i=await I(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(r=h?.data)!==null&&r!==void 0?r:{},channel:(s=h?.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:Ge})}else throw new Yr("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return{data:{user:null,session:null},error:a};const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),{data:{user:c,session:l},error:null}}catch(i){if(A(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let n;if("email"in e){const{email:i,password:o,options:a}=e;n=await I(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:gl})}else if("phone"in e){const{phone:i,password:o,options:a}=e;n=await I(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:gl})}else throw new Yr("You must provide either an email or phone number and a password");const{data:r,error:s}=n;return s?{data:{user:null,session:null},error:s}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new In}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(A(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(e){var n,r,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,r,s,i,o,a,l,c,u,d,h;let f,p;if("message"in e)f=e.message,p=e.signature;else{const{chain:v,wallet:b,statement:E,options:_}=e;let g;if(Pe())if(typeof b=="object")g=b;else{const S=window;if("ethereum"in S&&typeof S.ethereum=="object"&&"request"in S.ethereum&&typeof S.ethereum.request=="function")g=S.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof b!="object"||!_?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");g=b}const m=new URL((n=_?.url)!==null&&n!==void 0?n:window.location.href),y=await g.request({method:"eth_requestAccounts"}).then(S=>S).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!y||y.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const w=bl(y[0]);let k=(r=_?.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!k){const S=await g.request({method:"eth_chainId"});k=ep(S)}const x={domain:m.host,address:w,statement:E,uri:m.href,version:"1",chainId:k,nonce:(s=_?.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=_?.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=_?.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=_?.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=_?.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=_?.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=np(x),p=await g.request({method:"personal_sign",params:[tp(f),w]})}try{const{data:v,error:b}=await I(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(h=e.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:Ge});if(b)throw b;return!v||!v.session||!v.user?{data:{user:null,session:null},error:new In}:(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),{data:Object.assign({},v),error:b})}catch(v){if(A(v))return{data:{user:null,session:null},error:v};throw v}}async signInWithSolana(e){var n,r,s,i,o,a,l,c,u,d,h,f;let p,v;if("message"in e)p=e.message,v=e.signature;else{const{chain:b,wallet:E,statement:_,options:g}=e;let m;if(Pe())if(typeof E=="object")m=E;else{const w=window;if("solana"in w&&typeof w.solana=="object"&&("signIn"in w.solana&&typeof w.solana.signIn=="function"||"signMessage"in w.solana&&typeof w.solana.signMessage=="function"))m=w.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!g?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");m=E}const y=new URL((n=g?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in m&&m.signIn){const w=await m.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},g?.signInWithSolana),{version:"1",domain:y.host,uri:y.href}),_?{statement:_}:null));let k;if(Array.isArray(w)&&w[0]&&typeof w[0]=="object")k=w[0];else if(w&&typeof w=="object"&&"signedMessage"in w&&"signature"in w)k=w;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in k&&"signature"in k&&(typeof k.signedMessage=="string"||k.signedMessage instanceof Uint8Array)&&k.signature instanceof Uint8Array)p=typeof k.signedMessage=="string"?k.signedMessage:new TextDecoder().decode(k.signedMessage),v=k.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in m)||typeof m.signMessage!="function"||!("publicKey"in m)||typeof m!="object"||!m.publicKey||!("toBase58"in m.publicKey)||typeof m.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${y.host} wants you to sign in with your Solana account:`,m.publicKey.toBase58(),..._?["",_,""]:[""],"Version: 1",`URI: ${y.href}`,`Issued At: ${(s=(r=g?.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=g?.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${g.signInWithSolana.notBefore}`]:[],...!((o=g?.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${g.signInWithSolana.expirationTime}`]:[],...!((a=g?.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${g.signInWithSolana.chainId}`]:[],...!((l=g?.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${g.signInWithSolana.nonce}`]:[],...!((c=g?.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${g.signInWithSolana.requestId}`]:[],...!((d=(u=g?.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...g.signInWithSolana.resources.map(k=>`- ${k}`)]:[]].join(`
|
|
41
|
+
`);const w=await m.signMessage(new TextEncoder().encode(p),"utf8");if(!w||!(w instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");v=w}}try{const{data:b,error:E}=await I(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:Vt(v)},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:Ge});if(E)throw E;return!b||!b.session||!b.user?{data:{user:null,session:null},error:new In}:(b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),{data:Object.assign({},b),error:E})}catch(b){if(A(b))return{data:{user:null,session:null},error:b};throw b}}async _exchangeCodeForSession(e){const n=await Yt(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{const{data:i,error:o}=await I(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:Ge});if(await St(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new In}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(A(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(e){try{const{options:n,provider:r,token:s,access_token:i,nonce:o}=e,a=await I(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:Ge}),{data:l,error:c}=a;return c?{data:{user:null,session:null},error:c}:!l||!l.session||!l.user?{data:{user:null,session:null},error:new In}:(l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),{data:l,error:c})}catch(n){if(A(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(e){var n,r,s,i,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Pn(this.storage,this.storageKey));const{error:d}=await I(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l?.data)!==null&&n!==void 0?n:{},create_user:(r=l?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l?.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l?.emailRedirectTo});return{data:{user:null,session:null},error:d}}if("phone"in e){const{phone:a,options:l}=e,{data:c,error:u}=await I(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=l?.data)!==null&&s!==void 0?s:{},create_user:(i=l?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l?.captchaToken},channel:(o=l?.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:c?.message_id},error:u}}throw new Yr("You must provide either an email or phone number.")}catch(a){if(A(a))return{data:{user:null,session:null},error:a};throw a}}async verifyOtp(e){var n,r;try{let s,i;"options"in e&&(s=(n=e.options)===null||n===void 0?void 0:n.redirectTo,i=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await I(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:Ge});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l?.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),{data:{user:c,session:l},error:null}}catch(s){if(A(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithSSO(e){var n,r,s;try{let i=null,o=null;return this.flowType==="pkce"&&([i,o]=await Pn(this.storage,this.storageKey)),await I(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=e?.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:o}),headers:this.headers,xform:Gf})}catch(i){if(A(i))return{data:null,error:i};throw i}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)throw r;if(!n)throw new kt;const{error:s}=await I(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:s}})}catch(e){if(A(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:r,type:s,options:i}=e,{error:o}=await I(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:i?.captchaToken}},redirectTo:i?.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:r,type:s,options:i}=e,{data:o,error:a}=await I(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:i?.captchaToken}}});return{data:{user:null,session:null,messageId:o?.message_id},error:a}}throw new Yr("You must provide either an email or phone number and a type")}catch(n){if(A(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await Yt(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<yi:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const o=await Yt(this.userStorage,this.storageKey+"-user");o?.user?e.user=o.user:e.user=xi()}if(this.storage.isServer&&e.user){let o=this.suppressGetSessionWarning;e=new Proxy(e,{get:(l,c,u)=>(!o&&c==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),o=!0,this.suppressGetSessionWarning=!0),Reflect.get(l,c,u))})}return{data:{session:e},error:null}}const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:s},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await I(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Tt}):await this._useSession(async n=>{var r,s,i;const{data:o,error:a}=n;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new kt}:await I(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:Tt})})}catch(n){if(A(n))return yf(n)&&(await this._removeSession(),await St(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:n};throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new kt;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Pn(this.storage,this.storageKey));const{data:c,error:u}=await I(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:Tt});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new kt;const n=Date.now()/1e3;let r=n,s=!0,i=null;const{payload:o}=Ti(e.access_token);if(o.exp&&(r=o.exp,s=r<=n),s){const{data:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return{data:{user:null,session:null},error:l};if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)throw l;i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(n){if(A(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var r;if(!e){const{data:o,error:a}=n;if(a)throw a;e=(r=o.session)!==null&&r!==void 0?r:void 0}if(!e?.refresh_token)throw new kt;const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(A(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(e,n){try{if(!Pe())throw new Xr("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Xr(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new il("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Xr("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new il("No code detected.");const{data:_,error:g}=await this._exchangeCodeForSession(e.code);if(g)throw g;const m=new URL(window.location.href);return m.searchParams.delete("code"),window.history.replaceState(window.history.state,"",m.toString()),{data:{session:_.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:s,access_token:i,refresh_token:o,expires_in:a,expires_at:l,token_type:c}=e;if(!i||!a||!o||!c)throw new Xr("No session defined in URL");const u=Math.round(Date.now()/1e3),d=parseInt(a);let h=u+d;l&&(h=parseInt(l));const f=h-u;f*1e3<=On&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${d}s`);const p=h-d;u-p>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",p,h,u):u-p<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",p,h,u);const{data:v,error:b}=await this._getUser(i);if(b)throw b;const E={provider_token:r,provider_refresh_token:s,access_token:i,expires_in:d,expires_at:h,refresh_token:o,token_type:c,user:v.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:E,redirectType:e.type},error:null}}catch(r){if(A(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await Yt(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return{error:i};const o=(r=s.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(bf(a)&&(a.status===404||a.status===401||a.status===403)))return{error:a}}return e!=="others"&&(await this._removeSession(),await St(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const n=Rf(),r={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async n=>{var r,s;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),console.error(i)}})}async resetPasswordForEmail(e,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await Pn(this.storage,this.storageKey,!0));try{return await I(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(A(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return{data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(n){if(A(n))return{data:null,error:n};throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:r,error:s}=await this._useSession(async i=>{var o,a,l,c,u;const{data:d,error:h}=i;if(h)throw h;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await I(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=d.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(s)throw s;return Pe()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r?.url),{data:{provider:e.provider,url:r?.url},error:null}}catch(r){if(A(r))return{data:{provider:e.provider,url:null},error:r};throw r}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var r;try{const{error:s,data:{session:i}}=n;if(s)throw s;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,d=await I(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:Ge}),{data:h,error:f}=d;return f?{data:{user:null,session:null},error:f}:!h||!h.session||!h.user?{data:{user:null,session:null},error:new In}:(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),{data:h,error:f})}catch(s){if(A(s))return{data:{user:null,session:null},error:s};throw s}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)throw o;return await I(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await Cf(async s=>(s>0&&await $f(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await I(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Ge})),(s,i)=>{const o=200*Math.pow(2,s);return i&&ki(i)&&Date.now()+o-r<On})}catch(r){if(this._debug(n,"error",r),A(r))return{data:{session:null,user:null},error:r};throw r}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",r),Pe()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await Yt(this.storage,this.storageKey);if(s&&this.userStorage){let o=await Yt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Cn(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o?.user)!==null&&e!==void 0?e:xi()}else if(s&&!s.user&&!s.user){const o=await Yt(this.storage,this.storageKey+"-user");o&&o?.user?(s.user=o.user,await St(this.storage,this.storageKey+"-user"),await Cn(this.storage,this.storageKey,s)):s.user=xi()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const i=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<yi;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${yi}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),ki(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(s.access_token);!a&&o?.user?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var n,r;if(!e)throw new kt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new Qr;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new kt;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(s,"error",i),A(i)){const o={data:null,error:i};return ki(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,n,r=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,n)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const n=Object.assign({},e),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Cn(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const i=fl(s);await Cn(this.storage,this.storageKey,i)}else{const s=fl(n);await Cn(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),await St(this.storage,this.storageKey),await St(this.storage,this.storageKey+"-code-verifier"),await St(this.storage,this.storageKey+"-user"),this.userStorage&&await St(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Pe()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),On);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-e)/On);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${On}ms, refresh threshold is ${bi} ticks`),s<=bi&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof vl)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Pe()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,r){const s=[`provider=${encodeURIComponent(n)}`];if(r?.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await Pn(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(r?.queryParams){const i=new URLSearchParams(r.queryParams);s.push(i.toString())}return r?.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?{data:null,error:i}:await I(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _enroll(e){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await I(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=i?.session)===null||r===void 0?void 0:r.access_token});return c?{data:null,error:c}:(e.factorType==="totp"&&l.type==="totp"&&(!((s=l?.totp)===null||s===void 0)&&s.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),{data:l,error:null})})}catch(n){if(A(n))return{data:null,error:n};throw n}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return{data:null,error:i};const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?cp(e.webauthn.credential_response):up(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await I(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:l})})}catch(n){if(A(n))return{data:null,error:n};throw n}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return{data:null,error:i};const o=await I(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=s?.session)===null||r===void 0?void 0:r.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:ap(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:lp(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(A(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(e){const{data:n,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=n?.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var n,r;const{data:{session:s},error:i}=e;if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Ti(s.access_token);let a=null;o.aal&&(a=o.aal);let l=a;((r=(n=s.user.factors)===null||n===void 0?void 0:n.filter(d=>d.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(l="aal2");const u=o.amr||[];return{data:{currentLevel:a,nextLevel:l,currentAuthenticationMethods:u},error:null}}))}async fetchJwk(e,n={keys:[]}){let r=n.keys.find(a=>a.kid===e);if(r)return r;const s=Date.now();if(r=this.jwks.keys.find(a=>a.kid===e),r&&this.jwks_cached_at+mf>s)return r;const{data:i,error:o}=await I(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,r=i.keys.find(a=>a.kid===e),!r)?null:r}async getClaims(e,n={}){try{let r=e;if(!r){const{data:f,error:p}=await this.getSession();if(p||!f.session)return{data:null,error:p};r=f.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=Ti(r);n?.allowExpired||Ff(i.exp);const c=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!c){const{error:f}=await this.getUser(r);if(f)throw f;return{data:{claims:i,header:s,signature:o},error:null}}const u=Mf(s.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,o,xf(`${a}.${l}`)))throw new Si("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(r){if(A(r))return{data:null,error:r};throw r}}}ar.nextInstanceID=0;const bp=ar;class yp extends bp{constructor(e){super(e)}}var wp=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class Ep{constructor(e,n,r){var s,i,o;this.supabaseUrl=e,this.supabaseKey=n;const a=hf(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const l=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:tf,realtime:rf,auth:Object.assign(Object.assign({},nf),{storageKey:l}),global:ef},u=df(r??{},c);this.storageKey=(s=u.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(i=u.global.headers)!==null&&i!==void 0?i:{},u.accessToken?(this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=u.auth)!==null&&o!==void 0?o:{},this.headers,u.global.fetch),this.fetch=lf(n,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.realtime)),this.rest=new yh(new URL("rest/v1",a).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new Zh(this.storageUrl.href,this.headers,this.fetch,r?.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new lh(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,n={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,n,r)}channel(e,n={config:{}}){return this.realtime.channel(e,n)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){return wp(this,void 0,void 0,function*(){var e,n;if(this.accessToken)return yield this.accessToken();const{data:r}=yield this.auth.getSession();return(n=(e=r.session)===null||e===void 0?void 0:e.access_token)!==null&&n!==void 0?n:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:n,detectSessionInUrl:r,storage:s,userStorage:i,storageKey:o,flowType:a,lock:l,debug:c},u,d){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new yp({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),u),storageKey:o,autoRefreshToken:e,persistSession:n,detectSessionInUrl:r,storage:s,userStorage:i,flowType:a,lock:l,debug:c,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Dh(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,r)=>{this._handleTokenChanged(n,"CLIENT",r?.access_token)})}_handleTokenChanged(e,n,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const kp=(t,e,n)=>new Ep(t,e,n);function Sp(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}Sp()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");function Ri(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Zt=Ri();function Sl(t){Zt=t}var lr={exec:()=>null};function U(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(ge.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var Tp=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ge={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},xp=/^(?:[ \t]*(?:\n|$))+/,Ap=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Rp=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,cr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Op=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Oi=/(?:[*+-]|\d{1,9}[.)])/,Tl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,xl=U(Tl).replace(/bull/g,Oi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ip=U(Tl).replace(/bull/g,Oi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ii=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$p=/^[^\n]+/,$i=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Cp=U(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",$i).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pp=U(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Oi).getRegex(),ns="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ci=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Np=U("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ci).replace("tag",ns).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Al=U(Ii).replace("hr",cr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ns).getRegex(),Lp=U(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Al).getRegex(),Pi={blockquote:Lp,code:Ap,def:Cp,fences:Rp,heading:Op,hr:cr,html:Np,lheading:xl,list:Pp,newline:xp,paragraph:Al,table:lr,text:$p},Rl=U("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",cr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ns).getRegex(),Dp={...Pi,lheading:Ip,table:Rl,paragraph:U(Ii).replace("hr",cr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Rl).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ns).getRegex()},jp={...Pi,html:U(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ci).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:lr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:U(Ii).replace("hr",cr).replace("heading",` *#{1,6} *[^
|
|
42
|
+
]`).replace("lheading",xl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Up=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Fp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ol=/^( {2,}|\\)\n(?!\s*$)/,Mp=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,rs=/[\p{P}\p{S}]/u,Ni=/[\s\p{P}\p{S}]/u,Il=/[^\s\p{P}\p{S}]/u,Bp=U(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ni).getRegex(),$l=/(?!~)[\p{P}\p{S}]/u,qp=/(?!~)[\s\p{P}\p{S}]/u,Hp=/(?:[^\s\p{P}\p{S}]|~)/u,zp=U(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Tp?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Cl=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Wp=U(Cl,"u").replace(/punct/g,rs).getRegex(),Gp=U(Cl,"u").replace(/punct/g,$l).getRegex(),Pl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Kp=U(Pl,"gu").replace(/notPunctSpace/g,Il).replace(/punctSpace/g,Ni).replace(/punct/g,rs).getRegex(),Vp=U(Pl,"gu").replace(/notPunctSpace/g,Hp).replace(/punctSpace/g,qp).replace(/punct/g,$l).getRegex(),Jp=U("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Il).replace(/punctSpace/g,Ni).replace(/punct/g,rs).getRegex(),Yp=U(/\\(punct)/,"gu").replace(/punct/g,rs).getRegex(),Xp=U(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Zp=U(Ci).replace("(?:-->|$)","-->").getRegex(),Qp=U("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Zp).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ss=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,eg=U(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ss).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Nl=U(/^!?\[(label)\]\[(ref)\]/).replace("label",ss).replace("ref",$i).getRegex(),Ll=U(/^!?\[(ref)\](?:\[\])?/).replace("ref",$i).getRegex(),tg=U("reflink|nolink(?!\\()","g").replace("reflink",Nl).replace("nolink",Ll).getRegex(),Dl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Li={_backpedal:lr,anyPunctuation:Yp,autolink:Xp,blockSkip:zp,br:Ol,code:Fp,del:lr,emStrongLDelim:Wp,emStrongRDelimAst:Kp,emStrongRDelimUnd:Jp,escape:Up,link:eg,nolink:Ll,punctuation:Bp,reflink:Nl,reflinkSearch:tg,tag:Qp,text:Mp,url:lr},ng={...Li,link:U(/^!?\[(label)\]\((.*?)\)/).replace("label",ss).getRegex(),reflink:U(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ss).getRegex()},Di={...Li,emStrongRDelimAst:Vp,emStrongLDelim:Gp,url:U(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Dl).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:U(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Dl).getRegex()},rg={...Di,br:U(Ol).replace("{2,}","*").getRegex(),text:U(Di.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},is={normal:Pi,gfm:Dp,pedantic:jp},ur={normal:Li,gfm:Di,breaks:rg,pedantic:ng},sg={"&":"&","<":"<",">":">",'"':""","'":"'"},jl=t=>sg[t];function ot(t,e){if(e){if(ge.escapeTest.test(t))return t.replace(ge.escapeReplace,jl)}else if(ge.escapeTestNoEncode.test(t))return t.replace(ge.escapeReplaceNoEncode,jl);return t}function Ul(t){try{t=encodeURI(t).replace(ge.percentDecode,"%")}catch{return null}return t}function Fl(t,e){let n=t.replace(ge.findPipe,(i,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(ge.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(ge.slashPipe,"|");return r}function dr(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function ig(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ml(t,e,n,r,s){let i=e.href,o=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function og(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
|
|
43
43
|
`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(`
|
|
44
|
-
`)}var
|
|
44
|
+
`)}var os=class{options;rules;lexer;constructor(t){this.options=t||Zt}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:dr(n,`
|
|
45
45
|
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=og(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=dr(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:dr(e[0],`
|
|
46
46
|
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=dr(e[0],`
|
|
47
47
|
`).split(`
|
|
@@ -61,10 +61,10 @@ ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
61
61
|
`,1)[0],k;if(h=w,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),k=h):k=h.replace(this.rules.other.tabCharGlobal," "),g.test(h)||m.test(h)||y.test(h)||E.test(h)||_.test(h))break;if(k.search(this.rules.other.nonSpaceChar)>=p||!h.trim())u+=`
|
|
62
62
|
`+k.slice(p);else{if(f||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||g.test(d)||m.test(d)||_.test(d))break;u+=`
|
|
63
63
|
`+h}!f&&!h.trim()&&(f=!0),c+=w+`
|
|
64
|
-
`,t=t.substring(w.length+1),d=k.slice(p)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let v=null,b;this.options.gfm&&(v=this.rules.other.listIsTask.exec(u),v&&(b=v[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!v,checked:b,loose:!1,text:u,tokens:[]}),s.raw+=c}let a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){let c=s.items[l].tokens.filter(d=>d.type==="space"),u=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));s.loose=u}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:s}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=
|
|
65
|
-
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<n.length;o++)i.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:i.align[o]});for(let o of s)i.rows.push(
|
|
66
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=dr(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=ig(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Ml(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Ml(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(r=c.exec(e))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...r[0]][0].length,d=t.slice(0,s+r.index+u+o);if(Math.min(s,o)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},Ke=class Ao{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Zt,this.options.tokenizer=this.options.tokenizer||new
|
|
67
|
-
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){for(this.options.pedantic&&(e=e.replace(
|
|
64
|
+
`,t=t.substring(w.length+1),d=k.slice(p)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let v=null,b;this.options.gfm&&(v=this.rules.other.listIsTask.exec(u),v&&(b=v[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!v,checked:b,loose:!1,text:u,tokens:[]}),s.raw+=c}let a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){let c=s.items[l].tokens.filter(d=>d.type==="space"),u=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));s.loose=u}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:s}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=Fl(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
65
|
+
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<n.length;o++)i.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:i.align[o]});for(let o of s)i.rows.push(Fl(o,i.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[l]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
66
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=dr(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=ig(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Ml(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Ml(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(r=c.exec(e))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...r[0]][0].length,d=t.slice(0,s+r.index+u+o);if(Math.min(s,o)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},Ke=class Ao{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Zt,this.options.tokenizer=this.options.tokenizer||new os,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:ge,block:is.normal,inline:ur.normal};this.options.pedantic?(n.block=is.pedantic,n.inline=ur.pedantic):this.options.gfm&&(n.block=is.gfm,this.options.breaks?n.inline=ur.breaks:n.inline=ur.gfm),this.tokenizer.rules=n}static get rules(){return{block:is,inline:ur}}static lex(e,n){return new Ao(n).lex(e)}static lexInline(e,n){return new Ao(n).inlineTokens(e)}lex(e){e=e.replace(ge.carriageReturn,`
|
|
67
|
+
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){for(this.options.pedantic&&(e=e.replace(ge.tabCharGlobal," ").replace(ge.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(o=>(s=o.call({lexer:this},e,n))?(e=e.substring(s.raw.length),n.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=n.at(-1);s.raw.length===1&&o!==void 0?o.raw+=`
|
|
68
68
|
`:n.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
69
69
|
`)?"":`
|
|
70
70
|
`)+s.raw,o.text+=`
|
|
@@ -77,7 +77,7 @@ ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
77
77
|
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(s),r=i.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
78
78
|
`)?"":`
|
|
79
79
|
`)+s.raw,o.text+=`
|
|
80
|
-
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(s);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r=e,s=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let u=n.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(e,r,a)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),n.push(l);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,d=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},d),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(l=this.tokenizer.inlineText(c)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),o=!0;let u=n.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return n}},
|
|
80
|
+
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(s);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r=e,s=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let u=n.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(e,r,a)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),n.push(l);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,d=e.slice(1),h;this.options.extensions.startInline.forEach(f=>{h=f.call({lexer:this},d),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(l=this.tokenizer.inlineText(c)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),o=!0;let u=n.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return n}},as=class{options;parser;constructor(t){this.options=t||Zt}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(ge.notSpaceStart)?.[0],s=t.replace(ge.endingNewline,"")+`
|
|
81
81
|
`;return r?'<pre><code class="language-'+ot(r)+'">'+(n?s:ot(s,!0))+`</code></pre>
|
|
82
82
|
`:"<pre><code>"+(n?s:ot(s,!0))+`</code></pre>
|
|
83
83
|
`}blockquote({tokens:t}){return`<blockquote>
|
|
@@ -95,32 +95,32 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
95
95
|
`}tablerow({text:t}){return`<tr>
|
|
96
96
|
${t}</tr>
|
|
97
97
|
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
98
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${ot(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),s=
|
|
99
|
-
`+this.renderer.text(a);n?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):r+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,n=this.renderer){let r="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=a||"";continue}}let o=i;switch(o.type){case"escape":{r+=n.text(o);break}case"html":{r+=n.html(o);break}case"link":{r+=n.link(o);break}case"image":{r+=n.image(o);break}case"strong":{r+=n.strong(o);break}case"em":{r+=n.em(o);break}case"codespan":{r+=n.codespan(o);break}case"br":{r+=n.br(o);break}case"del":{r+=n.del(o);break}case"text":{r+=n.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},hr=class{options;block;constructor(t){this.options=t||Zt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?Ke.lex:Ke.lexInline}provideParser(){return this.block?Ve.parse:Ve.parseInline}},ag=class{defaults=
|
|
100
|
-
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+ot(r.message+"",!0)+"</pre>";return n?Promise.resolve(s):s}if(n)return Promise.reject(r);throw r}}},Qt=new ag;function F(t,e){return Qt.parse(t,e)}F.options=F.setOptions=function(t){return Qt.setOptions(t),F.defaults=Qt.defaults,Sl(F.defaults),F},F.getDefaults=
|
|
101
|
-
`);for(let a=r;a<o.length;a++){const l=o[a];if(l.length>1024)continue;const c=Hl.test(l)?l.replace(Hl,"$1"):l;if(!c.match(/\S*Error: /)){for(const u of e){const d=u(c);if(d){i.push(d);break}}if(i.length>=ql+s)break}}return _g(i.slice(s))}}function gg(t){return Array.isArray(t)?Wl(...t):t}function _g(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(
|
|
98
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${ot(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),s=Ul(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+ot(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=Ul(t);if(s===null)return ot(n);t=s;let i=`<img src="${t}" alt="${n}"`;return e&&(i+=` title="${ot(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:ot(t.text)}},ji=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Ve=class Ro{options;renderer;textRenderer;constructor(e){this.options=e||Zt,this.options.renderer=this.options.renderer||new as,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ji}static parse(e,n){return new Ro(n).parse(e)}static parseInline(e,n){return new Ro(n).parseInline(e)}parse(e,n=!0){let r="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let a=i,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){r+=l||"";continue}}let o=i;switch(o.type){case"space":{r+=this.renderer.space(o);continue}case"hr":{r+=this.renderer.hr(o);continue}case"heading":{r+=this.renderer.heading(o);continue}case"code":{r+=this.renderer.code(o);continue}case"table":{r+=this.renderer.table(o);continue}case"blockquote":{r+=this.renderer.blockquote(o);continue}case"list":{r+=this.renderer.list(o);continue}case"html":{r+=this.renderer.html(o);continue}case"def":{r+=this.renderer.def(o);continue}case"paragraph":{r+=this.renderer.paragraph(o);continue}case"text":{let a=o,l=this.renderer.text(a);for(;s+1<e.length&&e[s+1].type==="text";)a=e[++s],l+=`
|
|
99
|
+
`+this.renderer.text(a);n?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):r+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,n=this.renderer){let r="";for(let s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=a||"";continue}}let o=i;switch(o.type){case"escape":{r+=n.text(o);break}case"html":{r+=n.html(o);break}case"link":{r+=n.link(o);break}case"image":{r+=n.image(o);break}case"strong":{r+=n.strong(o);break}case"em":{r+=n.em(o);break}case"codespan":{r+=n.codespan(o);break}case"br":{r+=n.br(o);break}case"del":{r+=n.del(o);break}case"text":{r+=n.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},hr=class{options;block;constructor(t){this.options=t||Zt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?Ke.lex:Ke.lexInline}provideParser(){return this.block?Ve.parse:Ve.parseInline}},ag=class{defaults=Ri();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ve;Renderer=as;TextRenderer=ji;Lexer=Ke;Tokenizer=os;Hooks=hr;constructor(...e){this.use(...e)}walkTokens(e,n){let r=[];for(let s of e)switch(r=r.concat(n.call(this,s)),s.type){case"table":{let i=s;for(let o of i.header)r=r.concat(this.walkTokens(o.tokens,n));for(let o of i.rows)for(let a of o)r=r.concat(this.walkTokens(a.tokens,n));break}case"list":{let i=s;r=r.concat(this.walkTokens(i.items,n));break}default:{let i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(o=>{let a=i[o].flat(1/0);r=r.concat(this.walkTokens(a,n))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,n)))}}return r}use(...e){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let o=n.renderers[i.name];o?n.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:n.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=n[i.level];o?o.unshift(i.tokenizer):n[i.level]=[i.tokenizer],i.start&&(i.level==="block"?n.startBlock?n.startBlock.push(i.start):n.startBlock=[i.start]:i.level==="inline"&&(n.startInline?n.startInline.push(i.start):n.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(n.childTokens[i.name]=i.childTokens)}),s.extensions=n),r.renderer){let i=this.defaults.renderer||new as(this.defaults);for(let o in r.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d||""}}s.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new os(this.defaults);for(let o in r.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}s.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new hr;for(let o in r.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],c=i[a];hr.passThroughHooks.has(o)?i[a]=u=>{if(this.defaults.async&&hr.passThroughHooksRespectAsync.has(o))return(async()=>{let h=await l.call(i,u);return c.call(i,h)})();let d=l.call(i,u);return c.call(i,d)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let h=await l.apply(i,u);return h===!1&&(h=await c.apply(i,u)),h})();let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}s.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Ke.lex(e,n??this.defaults)}parser(e,n){return Ve.parse(e,n??this.defaults)}parseMarkdown(e){return(n,r)=>{let s={...r},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(n):n,l=await(i.hooks?await i.hooks.provideLexer():e?Ke.lex:Ke.lexInline)(a,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?Ve.parse:Ve.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(o);try{i.hooks&&(n=i.hooks.preprocess(n));let a=(i.hooks?i.hooks.provideLexer():e?Ke.lex:Ke.lexInline)(n,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?Ve.parse:Ve.parseInline)(a,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(e,n){return r=>{if(r.message+=`
|
|
100
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+ot(r.message+"",!0)+"</pre>";return n?Promise.resolve(s):s}if(n)return Promise.reject(r);throw r}}},Qt=new ag;function F(t,e){return Qt.parse(t,e)}F.options=F.setOptions=function(t){return Qt.setOptions(t),F.defaults=Qt.defaults,Sl(F.defaults),F},F.getDefaults=Ri,F.defaults=Zt,F.use=function(...t){return Qt.use(...t),F.defaults=Qt.defaults,Sl(F.defaults),F},F.walkTokens=function(t,e){return Qt.walkTokens(t,e)},F.parseInline=Qt.parseInline,F.Parser=Ve,F.parser=Ve.parse,F.Renderer=as,F.TextRenderer=ji,F.Lexer=Ke,F.lexer=Ke.lex,F.Tokenizer=os,F.Hooks=hr,F.parse=F,F.options,F.setOptions,F.use,F.walkTokens,F.parseInline,Ve.parse,Ke.lex;const $=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,H=globalThis,en="9.47.1";function ls(){return cs(H),H}function cs(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||en,e[en]=e[en]||{}}function fr(t,e,n=H){const r=n.__SENTRY__=n.__SENTRY__||{},s=r[en]=r[en]||{};return s[t]||(s[t]=e())}const lg=["debug","info","warn","error","log","assert","trace"],cg="Sentry Logger ",us={};function jn(t){if(!("console"in H))return t();const e=H.console,n={},r=Object.keys(us);r.forEach(s=>{const i=us[s];n[s]=e[s],e[s]=i});try{return t()}finally{r.forEach(s=>{e[s]=n[s]})}}function ug(){Fi().enabled=!0}function dg(){Fi().enabled=!1}function Bl(){return Fi().enabled}function hg(...t){Ui("log",...t)}function fg(...t){Ui("warn",...t)}function pg(...t){Ui("error",...t)}function Ui(t,...e){$&&Bl()&&jn(()=>{H.console[t](`${cg}[${t}]:`,...e)})}function Fi(){return $?fr("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const O={enable:ug,disable:dg,isEnabled:Bl,log:hg,warn:fg,error:pg},ql=50,tn="?",Hl=/\(error: (.*)\)/,zl=/captureMessage|captureException/;function Wl(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,s=0)=>{const i=[],o=n.split(`
|
|
101
|
+
`);for(let a=r;a<o.length;a++){const l=o[a];if(l.length>1024)continue;const c=Hl.test(l)?l.replace(Hl,"$1"):l;if(!c.match(/\S*Error: /)){for(const u of e){const d=u(c);if(d){i.push(d);break}}if(i.length>=ql+s)break}}return _g(i.slice(s))}}function gg(t){return Array.isArray(t)?Wl(...t):t}function _g(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(ds(e).function||"")&&e.pop(),e.reverse(),zl.test(ds(e).function||"")&&(e.pop(),zl.test(ds(e).function||"")&&e.pop()),e.slice(0,ql).map(n=>({...n,filename:n.filename||ds(e).filename,function:n.function||tn}))}function ds(t){return t[t.length-1]||{}}const Mi="<anonymous>";function xt(t){try{return!t||typeof t!="function"?Mi:t.name||Mi}catch{return Mi}}function Gl(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}const hs={},Kl={};function nn(t,e){hs[t]=hs[t]||[],hs[t].push(e)}function rn(t,e){if(!Kl[t]){Kl[t]=!0;try{e()}catch(n){$&&O.error(`Error while instrumenting ${t}`,n)}}}function Je(t,e){const n=t&&hs[t];if(n)for(const r of n)try{r(e)}catch(s){$&&O.error(`Error while triggering instrumentation handler.
|
|
102
102
|
Type: ${t}
|
|
103
103
|
Name: ${xt(r)}
|
|
104
|
-
Error:`,s)}}let Bi=null;function mg(t){const e="error";nn(e,t),rn(e,vg)}function vg(){Bi=q.onerror,q.onerror=function(t,e,n,r,s){return Je("error",{column:r,error:s,line:n,msg:t,url:e}),Bi?Bi.apply(this,arguments):!1},q.onerror.__SENTRY_INSTRUMENTED__=!0}let qi=null;function bg(t){const e="unhandledrejection";nn(e,t),rn(e,yg)}function yg(){qi=q.onunhandledrejection,q.onunhandledrejection=function(t){return Je("unhandledrejection",t),qi?qi.apply(this,arguments):!0},q.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Vl=Object.prototype.toString;function Hi(t){switch(Vl.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return At(t,Error)}}function jn(t,e){return Vl.call(t)===`[object ${e}]`}function Jl(t){return jn(t,"ErrorEvent")}function Yl(t){return jn(t,"DOMError")}function wg(t){return jn(t,"DOMException")}function dt(t){return jn(t,"String")}function zi(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Wi(t){return t===null||zi(t)||typeof t!="object"&&typeof t!="function"}function pr(t){return jn(t,"Object")}function hs(t){return typeof Event<"u"&&At(t,Event)}function Eg(t){return typeof Element<"u"&&At(t,Element)}function kg(t){return jn(t,"RegExp")}function fs(t){return!!(t?.then&&typeof t.then=="function")}function Sg(t){return pr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function At(t,e){try{return t instanceof e}catch{return!1}}function Xl(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Tg(t){return typeof Request<"u"&&At(t,Request)}const Gi=q,xg=80;function Zl(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,s=[];let i=0,o=0;const a=" > ",l=a.length;let c;const u=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||xg;for(;n&&i++<r&&(c=Ag(n,u),!(c==="html"||i>1&&o+s.length*l+c.length>=d));)s.push(c),o+=c.length,n=n.parentNode;return s.reverse().join(a)}catch{return"<unknown>"}}function Ag(t,e){const n=t,r=[];if(!n?.tagName)return"";if(Gi.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const s=e?.length?e.filter(o=>n.getAttribute(o)).map(o=>[o,n.getAttribute(o)]):null;if(s?.length)s.forEach(o=>{r.push(`[${o[0]}="${o[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const o=n.className;if(o&&dt(o)){const a=o.split(/\s+/);for(const l of a)r.push(`.${l}`)}}const i=["aria-label","type","name","title","alt"];for(const o of i){const a=n.getAttribute(o);a&&r.push(`[${o}="${a}"]`)}return r.join("")}function Ki(){try{return Gi.document.location.href}catch{return""}}function Og(t){if(!Gi.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function ps(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Ql(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const s=t[r];try{Xl(s)?n.push("[VueViewModel]"):n.push(String(s))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function Rg(t,e,n=!1){return dt(t)?kg(e)?e.test(t):dt(e)?n?t===e:t.includes(e):!1:!1}function gs(t,e=[],n=!1){return e.some(r=>Rg(t,r,n))}function Ne(t,e,n){if(!(e in t))return;const r=t[e];if(typeof r!="function")return;const s=n(r);typeof s=="function"&&ec(s,r);try{t[e]=s}catch{$&&R.log(`Failed to replace method "${e}" in object`,t)}}function sn(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{$&&R.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ec(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,sn(t,"__sentry_original__",e)}catch{}}function Vi(t){return t.__sentry_original__}function tc(t){if(Hi(t))return{message:t.message,name:t.name,stack:t.stack,...rc(t)};if(hs(t)){const e={type:t.type,target:nc(t.target),currentTarget:nc(t.currentTarget),...rc(t)};return typeof CustomEvent<"u"&&At(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function nc(t){try{return Eg(t)?Zl(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function rc(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function Ig(t,e=40){const n=Object.keys(tc(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return ps(r,e);for(let s=n.length;s>0;s--){const i=n.slice(0,s).join(", ");if(!(i.length>e))return s===n.length?i:ps(i,e)}return""}function $g(){const t=q;return t.crypto||t.msCrypto}function Me(t=$g()){let e=()=>Math.random()*16;try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{const n=new Uint8Array(1);return t.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(e()&15)>>n/4).toString(16))}function sc(t){return t.exception?.values?.[0]}function on(t){const{message:e,event_id:n}=t;if(e)return e;const r=sc(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Ji(t,e,n){const r=t.exception=t.exception||{},s=r.values=r.values||[],i=s[0]=s[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function Fn(t,e){const n=sc(t);if(!n)return;const r={type:"generic",handled:!0},s=n.mechanism;if(n.mechanism={...r,...s,...e},e&&"data"in e){const i={...s?.data,...e.data};n.mechanism.data=i}}function ic(t){if(Cg(t))return!0;try{sn(t,"__sentry_captured__",!0)}catch{}return!1}function Cg(t){try{return t.__sentry_captured__}catch{}}const oc=1e3;function gr(){return Date.now()/oc}function Pg(){const{performance:t}=q;if(!t?.now||!t.timeOrigin)return gr;const e=t.timeOrigin;return()=>(e+t.now())/oc}let ac;function ht(){return(ac??(ac=Pg()))()}function Ng(t){const e=ht(),n={sid:Me(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Dg(n)};return t&&Un(n,t),n}function Un(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||ht(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:Me()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Lg(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),Un(t,n)}function Dg(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function _r(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;const r={...t};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=_r(r[s],e[s],n-1));return r}function lc(){return Me()}function cc(){return Me().substring(16)}const Yi="_sentrySpan";function uc(t,e){e?sn(t,Yi,e):delete t[Yi]}function dc(t){return t[Yi]}const jg=100;class at{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:lc(),sampleRand:Math.random()}}clone(){const e=new at;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,uc(e,dc(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Un(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,r=n instanceof at?n.getScopeData():pr(n)?e:void 0,{tags:s,extra:i,user:o,contexts:a,level:l,fingerprint:c=[],propagationContext:u}=r||{};return this._tags={...this._tags,...s},this._extra={...this._extra,...i},this._contexts={...this._contexts,...a},o&&Object.keys(o).length&&(this._user=o),l&&(this._level=l),c.length&&(this._fingerprint=c),u&&(this._propagationContext=u),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,uc(this,void 0),this._attachments=[],this.setPropagationContext({traceId:lc(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:jg;if(r<=0)return this;const s={timestamp:gr(),...e,message:e.message?ps(e.message,2048):e.message};return this._breadcrumbs.push(s),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:dc(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=_r(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n?.event_id||Me();if(!this._client)return $&&R.warn("No client configured on scope - will not capture exception!"),r;const s=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:s,...n,event_id:r},this),r}captureMessage(e,n,r){const s=r?.event_id||Me();if(!this._client)return $&&R.warn("No client configured on scope - will not capture message!"),s;const i=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:i,...r,event_id:s},this),s}captureEvent(e,n){const r=n?.event_id||Me();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):($&&R.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Fg(){return fr("defaultCurrentScope",()=>new at)}function Ug(){return fr("defaultIsolationScope",()=>new at)}class Mg{constructor(e,n){let r;e?r=e:r=new at;let s;n?s=n:s=new at,this._stack=[{scope:r}],this._isolationScope=s}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(s){throw this._popScope(),s}return fs(r)?r.then(s=>(this._popScope(),s),s=>{throw this._popScope(),s}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Mn(){const t=as(),e=ls(t);return e.stack=e.stack||new Mg(Fg(),Ug())}function Bg(t){return Mn().withScope(t)}function qg(t,e){const n=Mn();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function hc(t){return Mn().withScope(()=>t(Mn().getIsolationScope()))}function Hg(){return{withIsolationScope:hc,withScope:Bg,withSetScope:qg,withSetIsolationScope:(t,e)=>hc(e),getCurrentScope:()=>Mn().getScope(),getIsolationScope:()=>Mn().getIsolationScope()}}function Xi(t){const e=ls(t);return e.acs?e.acs:Hg()}function Ot(){const t=as();return Xi(t).getCurrentScope()}function mr(){const t=as();return Xi(t).getIsolationScope()}function zg(){return fr("globalScope",()=>new at)}function Wg(...t){const e=as(),n=Xi(e);if(t.length===2){const[r,s]=t;return r?n.withSetScope(r,s):n.withScope(s)}return n.withScope(t[0])}function ge(){return Ot().getClient()}function Gg(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:s}=e,i={trace_id:n,span_id:s||cc()};return r&&(i.parent_span_id=r),i}const Kg="sentry.source",Vg="sentry.sample_rate",Jg="sentry.previous_trace_sample_rate",Yg="sentry.op",Xg="sentry.origin",fc="sentry.profile_id",pc="sentry.exclusive_time",Zg=0,Qg=1,e_="_sentryScope",t_="_sentryIsolationScope";function gc(t){return{scope:t[e_],isolationScope:t[t_]}}const n_="sentry-",r_=/^sentry-/;function s_(t){const e=i_(t);if(!e)return;const n=Object.entries(e).reduce((r,[s,i])=>{if(s.match(r_)){const o=s.slice(n_.length);r[o]=i}return r},{});if(Object.keys(n).length>0)return n}function i_(t){if(!(!t||!dt(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=_c(n);return Object.entries(r).forEach(([s,i])=>{e[s]=i}),e},{}):_c(t)}function _c(t){return t.split(",").map(e=>e.split("=").map(n=>{try{return decodeURIComponent(n.trim())}catch{return}})).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function o_(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const mc=1;let vc=!1;function a_(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),s=r?e:Zi(t).parent_span_id,i=gc(t).scope,o=r?i?.getPropagationContext().propagationSpanId||cc():e;return{parent_span_id:s,span_id:o,trace_id:n}}function l_(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...s},attributes:i})=>({span_id:e,trace_id:n,sampled:r===mc,attributes:i,...s}))}function bc(t){return typeof t=="number"?yc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?yc(t.getTime()):ht()}function yc(t){return t>9999999999?t/1e3:t}function Zi(t){if(u_(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(c_(t)){const{attributes:r,startTime:s,name:i,endTime:o,status:a,links:l}=t,c="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:n,data:r,description:i,parent_span_id:c,start_timestamp:bc(s),timestamp:bc(o)||void 0,status:h_(a),op:r[Yg],origin:r[Xg],links:l_(l)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function c_(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function u_(t){return typeof t.getSpanJSON=="function"}function d_(t){const{traceFlags:e}=t.spanContext();return e===mc}function h_(t){if(!(!t||t.code===Zg))return t.code===Qg?"ok":t.message||"unknown_error"}const f_="_sentryRootSpan";function wc(t){return t[f_]||t}function Ec(){vc||(Dn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),vc=!0)}function p_(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=t||ge()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const Qi="production",g_=/^o(\d+)\./,__=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function m_(t){return t==="http"||t==="https"}function _s(t,e=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function v_(t){const e=__.exec(t);if(!e){Dn(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,s="",i="",o="",a=""]=e.slice(1);let l="",c=a;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const d=c.match(/^\d+/);d&&(c=d[0])}return kc({host:i,pass:s,path:l,projectId:c,port:o,protocol:n,publicKey:r})}function kc(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function b_(t){if(!$)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(R.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?m_(r)?e&&isNaN(parseInt(e,10))?(R.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(R.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(R.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function y_(t){return t.match(g_)?.[1]}function w_(t){const e=typeof t=="string"?v_(t):kc(t);if(!(!e||!b_(e)))return e}const E_="_frozenDsc";function Sc(t,e){const n=e.getOptions(),{publicKey:r,host:s}=e.getDsn()||{};let i;n.orgId?i=String(n.orgId):s&&(i=y_(s));const o={environment:n.environment||Qi,release:n.release,public_key:r,trace_id:t,org_id:i};return e.emit("createDsc",o),o}function k_(t,e){const n=e.getPropagationContext();return n.dsc||Sc(n.traceId,t)}function S_(t){const e=ge();if(!e)return{};const n=wc(t),r=Zi(n),s=r.data,i=n.spanContext().traceState,o=i?.get("sentry.sample_rate")??s[Vg]??s[Jg];function a(p){return(typeof o=="number"||typeof o=="string")&&(p.sample_rate=`${o}`),p}const l=n[E_];if(l)return a(l);const c=i?.get("sentry.dsc"),u=c&&s_(c);if(u)return a(u);const d=Sc(t.spanContext().traceId,e),h=s[Kg],f=r.description;return h!=="url"&&f&&(d.transaction=f),p_()&&(d.sampled=String(d_(n)),d.sample_rand=i?.get("sentry.sample_rand")??gc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}function ft(t,e=100,n=1/0){try{return eo("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Tc(t,e=3,n=100*1024){const r=ft(t,e);return O_(r)>n?Tc(t,e-1,n):r}function eo(t,e,n=1/0,r=1/0,s=R_()){const[i,o]=s;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=T_(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(l===0)return a.replace("object ","");if(i(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{const f=c.toJSON();return eo("",f,l-1,r,s)}catch{}const u=Array.isArray(e)?[]:{};let d=0;const h=tc(e);for(const f in h){if(!Object.prototype.hasOwnProperty.call(h,f))continue;if(d>=r){u[f]="[MaxProperties ~]";break}const p=h[f];u[f]=eo(f,p,l-1,r,s),d++}return o(e),u}function T_(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Xl(e))return"[VueViewModel]";if(Sg(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${xt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=x_(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function x_(t){const e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function A_(t){return~-encodeURI(t).split(/%..|./).length}function O_(t){return A_(JSON.stringify(t))}function R_(){const t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function vr(t,e=[]){return[t,e]}function I_(t,e){const[n,r]=t;return[n,[...r,e]]}function xc(t,e){const n=t[1];for(const r of n){const s=r[0].type;if(e(r,s))return!0}return!1}function to(t){const e=ls(q);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function $_(t){const[e,n]=t;let r=JSON.stringify(e);function s(i){typeof r=="string"?r=typeof i=="string"?r+i:[to(r),i]:r.push(typeof i=="string"?to(i):i)}for(const i of n){const[o,a]=i;if(s(`
|
|
104
|
+
Error:`,s)}}let Bi=null;function mg(t){const e="error";nn(e,t),rn(e,vg)}function vg(){Bi=H.onerror,H.onerror=function(t,e,n,r,s){return Je("error",{column:r,error:s,line:n,msg:t,url:e}),Bi?Bi.apply(this,arguments):!1},H.onerror.__SENTRY_INSTRUMENTED__=!0}let qi=null;function bg(t){const e="unhandledrejection";nn(e,t),rn(e,yg)}function yg(){qi=H.onunhandledrejection,H.onunhandledrejection=function(t){return Je("unhandledrejection",t),qi?qi.apply(this,arguments):!0},H.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Vl=Object.prototype.toString;function Hi(t){switch(Vl.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return At(t,Error)}}function Un(t,e){return Vl.call(t)===`[object ${e}]`}function Jl(t){return Un(t,"ErrorEvent")}function Yl(t){return Un(t,"DOMError")}function wg(t){return Un(t,"DOMException")}function dt(t){return Un(t,"String")}function zi(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Wi(t){return t===null||zi(t)||typeof t!="object"&&typeof t!="function"}function pr(t){return Un(t,"Object")}function fs(t){return typeof Event<"u"&&At(t,Event)}function Eg(t){return typeof Element<"u"&&At(t,Element)}function kg(t){return Un(t,"RegExp")}function ps(t){return!!(t?.then&&typeof t.then=="function")}function Sg(t){return pr(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function At(t,e){try{return t instanceof e}catch{return!1}}function Xl(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Tg(t){return typeof Request<"u"&&At(t,Request)}const Gi=H,xg=80;function Zl(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,s=[];let i=0,o=0;const a=" > ",l=a.length;let c;const u=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||xg;for(;n&&i++<r&&(c=Ag(n,u),!(c==="html"||i>1&&o+s.length*l+c.length>=d));)s.push(c),o+=c.length,n=n.parentNode;return s.reverse().join(a)}catch{return"<unknown>"}}function Ag(t,e){const n=t,r=[];if(!n?.tagName)return"";if(Gi.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const s=e?.length?e.filter(o=>n.getAttribute(o)).map(o=>[o,n.getAttribute(o)]):null;if(s?.length)s.forEach(o=>{r.push(`[${o[0]}="${o[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const o=n.className;if(o&&dt(o)){const a=o.split(/\s+/);for(const l of a)r.push(`.${l}`)}}const i=["aria-label","type","name","title","alt"];for(const o of i){const a=n.getAttribute(o);a&&r.push(`[${o}="${a}"]`)}return r.join("")}function Ki(){try{return Gi.document.location.href}catch{return""}}function Rg(t){if(!Gi.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function gs(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Ql(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const s=t[r];try{Xl(s)?n.push("[VueViewModel]"):n.push(String(s))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function Og(t,e,n=!1){return dt(t)?kg(e)?e.test(t):dt(e)?n?t===e:t.includes(e):!1:!1}function _s(t,e=[],n=!1){return e.some(r=>Og(t,r,n))}function Ne(t,e,n){if(!(e in t))return;const r=t[e];if(typeof r!="function")return;const s=n(r);typeof s=="function"&&ec(s,r);try{t[e]=s}catch{$&&O.log(`Failed to replace method "${e}" in object`,t)}}function sn(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{$&&O.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ec(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,sn(t,"__sentry_original__",e)}catch{}}function Vi(t){return t.__sentry_original__}function tc(t){if(Hi(t))return{message:t.message,name:t.name,stack:t.stack,...rc(t)};if(fs(t)){const e={type:t.type,target:nc(t.target),currentTarget:nc(t.currentTarget),...rc(t)};return typeof CustomEvent<"u"&&At(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function nc(t){try{return Eg(t)?Zl(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function rc(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function Ig(t,e=40){const n=Object.keys(tc(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return gs(r,e);for(let s=n.length;s>0;s--){const i=n.slice(0,s).join(", ");if(!(i.length>e))return s===n.length?i:gs(i,e)}return""}function $g(){const t=H;return t.crypto||t.msCrypto}function Me(t=$g()){let e=()=>Math.random()*16;try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{const n=new Uint8Array(1);return t.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(e()&15)>>n/4).toString(16))}function sc(t){return t.exception?.values?.[0]}function on(t){const{message:e,event_id:n}=t;if(e)return e;const r=sc(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Ji(t,e,n){const r=t.exception=t.exception||{},s=r.values=r.values||[],i=s[0]=s[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function Fn(t,e){const n=sc(t);if(!n)return;const r={type:"generic",handled:!0},s=n.mechanism;if(n.mechanism={...r,...s,...e},e&&"data"in e){const i={...s?.data,...e.data};n.mechanism.data=i}}function ic(t){if(Cg(t))return!0;try{sn(t,"__sentry_captured__",!0)}catch{}return!1}function Cg(t){try{return t.__sentry_captured__}catch{}}const oc=1e3;function gr(){return Date.now()/oc}function Pg(){const{performance:t}=H;if(!t?.now||!t.timeOrigin)return gr;const e=t.timeOrigin;return()=>(e+t.now())/oc}let ac;function ht(){return(ac??(ac=Pg()))()}function Ng(t){const e=ht(),n={sid:Me(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Dg(n)};return t&&Mn(n,t),n}function Mn(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||ht(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:Me()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Lg(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),Mn(t,n)}function Dg(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function _r(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;const r={...t};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=_r(r[s],e[s],n-1));return r}function lc(){return Me()}function cc(){return Me().substring(16)}const Yi="_sentrySpan";function uc(t,e){e?sn(t,Yi,e):delete t[Yi]}function dc(t){return t[Yi]}const jg=100;class at{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:lc(),sampleRand:Math.random()}}clone(){const e=new at;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,uc(e,dc(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Mn(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,r=n instanceof at?n.getScopeData():pr(n)?e:void 0,{tags:s,extra:i,user:o,contexts:a,level:l,fingerprint:c=[],propagationContext:u}=r||{};return this._tags={...this._tags,...s},this._extra={...this._extra,...i},this._contexts={...this._contexts,...a},o&&Object.keys(o).length&&(this._user=o),l&&(this._level=l),c.length&&(this._fingerprint=c),u&&(this._propagationContext=u),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,uc(this,void 0),this._attachments=[],this.setPropagationContext({traceId:lc(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:jg;if(r<=0)return this;const s={timestamp:gr(),...e,message:e.message?gs(e.message,2048):e.message};return this._breadcrumbs.push(s),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:dc(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=_r(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n?.event_id||Me();if(!this._client)return $&&O.warn("No client configured on scope - will not capture exception!"),r;const s=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:s,...n,event_id:r},this),r}captureMessage(e,n,r){const s=r?.event_id||Me();if(!this._client)return $&&O.warn("No client configured on scope - will not capture message!"),s;const i=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:i,...r,event_id:s},this),s}captureEvent(e,n){const r=n?.event_id||Me();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):($&&O.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Ug(){return fr("defaultCurrentScope",()=>new at)}function Fg(){return fr("defaultIsolationScope",()=>new at)}class Mg{constructor(e,n){let r;e?r=e:r=new at;let s;n?s=n:s=new at,this._stack=[{scope:r}],this._isolationScope=s}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(s){throw this._popScope(),s}return ps(r)?r.then(s=>(this._popScope(),s),s=>{throw this._popScope(),s}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Bn(){const t=ls(),e=cs(t);return e.stack=e.stack||new Mg(Ug(),Fg())}function Bg(t){return Bn().withScope(t)}function qg(t,e){const n=Bn();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function hc(t){return Bn().withScope(()=>t(Bn().getIsolationScope()))}function Hg(){return{withIsolationScope:hc,withScope:Bg,withSetScope:qg,withSetIsolationScope:(t,e)=>hc(e),getCurrentScope:()=>Bn().getScope(),getIsolationScope:()=>Bn().getIsolationScope()}}function Xi(t){const e=cs(t);return e.acs?e.acs:Hg()}function Rt(){const t=ls();return Xi(t).getCurrentScope()}function mr(){const t=ls();return Xi(t).getIsolationScope()}function zg(){return fr("globalScope",()=>new at)}function Wg(...t){const e=ls(),n=Xi(e);if(t.length===2){const[r,s]=t;return r?n.withSetScope(r,s):n.withScope(s)}return n.withScope(t[0])}function _e(){return Rt().getClient()}function Gg(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:s}=e,i={trace_id:n,span_id:s||cc()};return r&&(i.parent_span_id=r),i}const Kg="sentry.source",Vg="sentry.sample_rate",Jg="sentry.previous_trace_sample_rate",Yg="sentry.op",Xg="sentry.origin",fc="sentry.profile_id",pc="sentry.exclusive_time",Zg=0,Qg=1,e_="_sentryScope",t_="_sentryIsolationScope";function gc(t){return{scope:t[e_],isolationScope:t[t_]}}const n_="sentry-",r_=/^sentry-/;function s_(t){const e=i_(t);if(!e)return;const n=Object.entries(e).reduce((r,[s,i])=>{if(s.match(r_)){const o=s.slice(n_.length);r[o]=i}return r},{});if(Object.keys(n).length>0)return n}function i_(t){if(!(!t||!dt(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=_c(n);return Object.entries(r).forEach(([s,i])=>{e[s]=i}),e},{}):_c(t)}function _c(t){return t.split(",").map(e=>e.split("=").map(n=>{try{return decodeURIComponent(n.trim())}catch{return}})).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function o_(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const mc=1;let vc=!1;function a_(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),s=r?e:Zi(t).parent_span_id,i=gc(t).scope,o=r?i?.getPropagationContext().propagationSpanId||cc():e;return{parent_span_id:s,span_id:o,trace_id:n}}function l_(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...s},attributes:i})=>({span_id:e,trace_id:n,sampled:r===mc,attributes:i,...s}))}function bc(t){return typeof t=="number"?yc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?yc(t.getTime()):ht()}function yc(t){return t>9999999999?t/1e3:t}function Zi(t){if(u_(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(c_(t)){const{attributes:r,startTime:s,name:i,endTime:o,status:a,links:l}=t,c="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:n,data:r,description:i,parent_span_id:c,start_timestamp:bc(s),timestamp:bc(o)||void 0,status:h_(a),op:r[Yg],origin:r[Xg],links:l_(l)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function c_(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function u_(t){return typeof t.getSpanJSON=="function"}function d_(t){const{traceFlags:e}=t.spanContext();return e===mc}function h_(t){if(!(!t||t.code===Zg))return t.code===Qg?"ok":t.message||"unknown_error"}const f_="_sentryRootSpan";function wc(t){return t[f_]||t}function Ec(){vc||(jn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),vc=!0)}function p_(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=t||_e()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const Qi="production",g_=/^o(\d+)\./,__=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function m_(t){return t==="http"||t==="https"}function ms(t,e=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function v_(t){const e=__.exec(t);if(!e){jn(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,s="",i="",o="",a=""]=e.slice(1);let l="",c=a;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const d=c.match(/^\d+/);d&&(c=d[0])}return kc({host:i,pass:s,path:l,projectId:c,port:o,protocol:n,publicKey:r})}function kc(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function b_(t){if(!$)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(O.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?m_(r)?e&&isNaN(parseInt(e,10))?(O.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(O.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(O.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function y_(t){return t.match(g_)?.[1]}function w_(t){const e=typeof t=="string"?v_(t):kc(t);if(!(!e||!b_(e)))return e}const E_="_frozenDsc";function Sc(t,e){const n=e.getOptions(),{publicKey:r,host:s}=e.getDsn()||{};let i;n.orgId?i=String(n.orgId):s&&(i=y_(s));const o={environment:n.environment||Qi,release:n.release,public_key:r,trace_id:t,org_id:i};return e.emit("createDsc",o),o}function k_(t,e){const n=e.getPropagationContext();return n.dsc||Sc(n.traceId,t)}function S_(t){const e=_e();if(!e)return{};const n=wc(t),r=Zi(n),s=r.data,i=n.spanContext().traceState,o=i?.get("sentry.sample_rate")??s[Vg]??s[Jg];function a(p){return(typeof o=="number"||typeof o=="string")&&(p.sample_rate=`${o}`),p}const l=n[E_];if(l)return a(l);const c=i?.get("sentry.dsc"),u=c&&s_(c);if(u)return a(u);const d=Sc(t.spanContext().traceId,e),h=s[Kg],f=r.description;return h!=="url"&&f&&(d.transaction=f),p_()&&(d.sampled=String(d_(n)),d.sample_rand=i?.get("sentry.sample_rand")??gc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}function ft(t,e=100,n=1/0){try{return eo("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Tc(t,e=3,n=100*1024){const r=ft(t,e);return R_(r)>n?Tc(t,e-1,n):r}function eo(t,e,n=1/0,r=1/0,s=O_()){const[i,o]=s;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=T_(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(l===0)return a.replace("object ","");if(i(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{const f=c.toJSON();return eo("",f,l-1,r,s)}catch{}const u=Array.isArray(e)?[]:{};let d=0;const h=tc(e);for(const f in h){if(!Object.prototype.hasOwnProperty.call(h,f))continue;if(d>=r){u[f]="[MaxProperties ~]";break}const p=h[f];u[f]=eo(f,p,l-1,r,s),d++}return o(e),u}function T_(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Xl(e))return"[VueViewModel]";if(Sg(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${xt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=x_(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function x_(t){const e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function A_(t){return~-encodeURI(t).split(/%..|./).length}function R_(t){return A_(JSON.stringify(t))}function O_(){const t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function vr(t,e=[]){return[t,e]}function I_(t,e){const[n,r]=t;return[n,[...r,e]]}function xc(t,e){const n=t[1];for(const r of n){const s=r[0].type;if(e(r,s))return!0}return!1}function to(t){const e=cs(H);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function $_(t){const[e,n]=t;let r=JSON.stringify(e);function s(i){typeof r=="string"?r=typeof i=="string"?r+i:[to(r),i]:r.push(typeof i=="string"?to(i):i)}for(const i of n){const[o,a]=i;if(s(`
|
|
105
105
|
${JSON.stringify(o)}
|
|
106
|
-
`),typeof a=="string"||a instanceof Uint8Array)s(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(ft(a))}s(l)}}return typeof r=="string"?r:C_(r)}function C_(t){const e=t.reduce((s,i)=>s+i.length,0),n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function P_(t){const e=typeof t.data=="string"?to(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const N_={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Ac(t){return N_[t]}function Oc(t){if(!t?.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function L_(t,e,n,r){const s=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:_s(r)},...s&&{trace:s}}}function D_(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function j_(t,e,n,r){const s=Oc(n),i={sent_at:new Date().toISOString(),...s&&{sdk:s},...!!r&&e&&{dsn:_s(e)}},o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return vr(i,[o])}function F_(t,e,n,r){const s=Oc(n),i=t.type&&t.type!=="replay_event"?t.type:"event";D_(t,n?.sdk);const o=L_(t,s,r,e);return delete t.sdkProcessingMetadata,vr(o,[[{type:i},t]])}const no=0,Rc=1,Ic=2;function an(t){return new Rt(e=>{e(t)})}function ms(t){return new Rt((e,n)=>{n(t)})}class Rt{constructor(e){this._state=no,this._handlers=[],this._runExecutor(e)}then(e,n){return new Rt((r,s)=>{this._handlers.push([!1,i=>{if(!e)r(i);else try{r(e(i))}catch(o){s(o)}},i=>{if(!n)s(i);else try{r(n(i))}catch(o){s(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Rt((n,r)=>{let s,i;return this.then(o=>{i=!1,s=o,e&&e()},o=>{i=!0,s=o,e&&e()}).then(()=>{if(i){r(s);return}n(s)})})}_executeHandlers(){if(this._state===no)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===Rc&&n[1](this._value),this._state===Ic&&n[2](this._value),n[0]=!0)})}_runExecutor(e){const n=(i,o)=>{if(this._state===no){if(fs(o)){o.then(r,s);return}this._state=i,this._value=o,this._executeHandlers()}},r=i=>{n(Rc,i)},s=i=>{n(Ic,i)};try{e(r,s)}catch(i){s(i)}}}function ro(t,e,n,r=0){return new Rt((s,i)=>{const o=t[r];if(e===null||typeof o!="function")s(e);else{const a=o({...e},n);$&&o.id&&a===null&&R.log(`Event processor "${o.id}" dropped event`),fs(a)?a.then(l=>ro(t,l,n,r+1).then(s)).then(null,i):ro(t,a,n,r+1).then(s).then(null,i)}})}function U_(t,e){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:i}=e;M_(t,e),r&&H_(t,r),z_(t,n),B_(t,s),q_(t,i)}function $c(t,e){const{extra:n,tags:r,user:s,contexts:i,level:o,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:u,attachments:d,propagationContext:h,transactionName:f,span:p}=e;vs(t,"extra",n),vs(t,"tags",r),vs(t,"user",s),vs(t,"contexts",i),t.sdkProcessingMetadata=_r(t.sdkProcessingMetadata,a,2),o&&(t.level=o),f&&(t.transactionName=f),p&&(t.span=p),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),c.length&&(t.fingerprint=[...t.fingerprint,...c]),u.length&&(t.eventProcessors=[...t.eventProcessors,...u]),d.length&&(t.attachments=[...t.attachments,...d]),t.propagationContext={...t.propagationContext,...h}}function vs(t,e,n){t[e]=_r(t[e],n,1)}function M_(t,e){const{extra:n,tags:r,user:s,contexts:i,level:o,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(s).length&&(t.user={...s,...t.user}),Object.keys(i).length&&(t.contexts={...i,...t.contexts}),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function B_(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function q_(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function H_(t,e){t.contexts={trace:a_(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:S_(e),...t.sdkProcessingMetadata};const n=wc(e),r=Zi(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function z_(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}let bs,Cc,ys;function W_(t){const e=q._sentryDebugIds;if(!e)return{};const n=Object.keys(e);return ys&&n.length===Cc||(Cc=n.length,ys=n.reduce((r,s)=>{bs||(bs={});const i=bs[s];if(i)r[i[0]]=i[1];else{const o=t(s);for(let a=o.length-1;a>=0;a--){const c=o[a]?.filename,u=e[s];if(c&&u){r[c]=u,bs[s]=[c,u];break}}}return r},{})),ys}function G_(t,e,n,r,s,i){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Me(),timestamp:e.timestamp||gr()},c=n.integrations||t.integrations.map(b=>b.name);K_(l,t),Y_(l,c),s&&s.emit("applyFrameMetadata",e),e.type===void 0&&V_(l,t.stackParser);const u=Z_(r,n.captureContext);n.mechanism&&Fn(l,n.mechanism);const d=s?s.getEventProcessors():[],h=zg().getScopeData();if(i){const b=i.getScopeData();$c(h,b)}if(u){const b=u.getScopeData();$c(h,b)}const f=[...n.attachments||[],...h.attachments];f.length&&(n.attachments=f),U_(l,h);const p=[...d,...h.eventProcessors];return ro(p,l,n).then(b=>(b&&J_(b),typeof o=="number"&&o>0?X_(b,o,a):b))}function K_(t,e){const{environment:n,release:r,dist:s,maxValueLength:i=250}=e;t.environment=t.environment||n||Qi,!t.release&&r&&(t.release=r),!t.dist&&s&&(t.dist=s);const o=t.request;o?.url&&(o.url=ps(o.url,i))}function V_(t,e){const n=W_(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(s=>{s.filename&&(s.debug_id=n[s.filename])})})}function J_(t){const e={};if(t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(s=>{s.debug_id&&(s.abs_path?e[s.abs_path]=s.debug_id:s.filename&&(e[s.filename]=s.debug_id),delete s.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([r,s])=>{n.push({type:"sourcemap",code_file:r,debug_id:s})})}function Y_(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function X_(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(s=>({...s,...s.data&&{data:ft(s.data,e,n)}}))},...t.user&&{user:ft(t.user,e,n)},...t.contexts&&{contexts:ft(t.contexts,e,n)},...t.extra&&{extra:ft(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=ft(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(s=>({...s,...s.data&&{data:ft(s.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=ft(t.contexts.flags,3,n)),r}function Z_(t,e){if(!e)return t;const n=t?t.clone():new at;return n.update(e),n}function Q_(t){if(t)return em(t)?{captureContext:t}:nm(t)?{captureContext:t}:t}function em(t){return t instanceof at||typeof t=="function"}const tm=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function nm(t){return Object.keys(t).some(e=>tm.includes(e))}function Pc(t,e){return Ot().captureException(t,Q_(e))}function Nc(t,e){return Ot().captureEvent(t,e)}function Lc(t){const e=mr(),n=Ot(),{userAgent:r}=q.navigator||{},s=Ng({user:n.getUser()||e.getUser(),...r&&{userAgent:r},...t}),i=e.getSession();return i?.status==="ok"&&Un(i,{status:"exited"}),Dc(),e.setSession(s),s}function Dc(){const t=mr(),n=Ot().getSession()||t.getSession();n&&Lg(n),jc(),t.setSession()}function jc(){const t=mr(),e=ge(),n=t.getSession();n&&e&&e.captureSession(n)}function Fc(t=!1){if(t){Dc();return}jc()}const rm="7";function sm(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function im(t){return`${sm(t)}${t.projectId}/envelope/`}function om(t,e){const n={sentry_version:rm};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function am(t,e,n){return e||`${im(t)}?${om(t,n)}`}const Uc=[];function lm(t){const e={};return t.forEach(n=>{const{name:r}=n,s=e[r];s&&!s.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function cm(t){const e=t.defaultIntegrations||[],n=t.integrations;e.forEach(s=>{s.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){const s=n(e);r=Array.isArray(s)?s:[s]}else r=e;return lm(r)}function um(t,e){const n={};return e.forEach(r=>{r&&Bc(t,r,n)}),n}function Mc(t,e){for(const n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function Bc(t,e,n){if(n[e.name]){$&&R.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,Uc.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Uc.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(s,i)=>r(s,i,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),s=Object.assign((i,o)=>r(i,o,t),{id:e.name});t.addEventProcessor(s)}$&&R.log(`Integration installed: ${e.name}`)}function Hy(t){return t}function dm(t,e,n){const r=[{type:"client_report"},{timestamp:gr(),discarded_events:t}];return vr(e?{dsn:e}:{},[r])}function qc(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function hm(t){const{trace_id:e,parent_span_id:n,span_id:r,status:s,origin:i,data:o,op:a}=t.contexts?.trace??{};return{data:o??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:s,timestamp:t.timestamp,trace_id:e??"",origin:i,profile_id:o?.[fc],exclusive_time:o?.[pc],measurements:t.measurements,is_segment:!0}}function fm(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[fc]:t.profile_id},...t.exclusive_time&&{[pc]:t.exclusive_time}}}},measurements:t.measurements}}const Hc="Not capturing exception because it's already been captured.",zc="Discarded session because of missing or non-string release",Wc=Symbol.for("SentryInternalError"),Gc=Symbol.for("SentryDoNotSendEventError");function ws(t){return{message:t,[Wc]:!0}}function so(t){return{message:t,[Gc]:!0}}function Kc(t){return!!t&&typeof t=="object"&&Wc in t}function Vc(t){return!!t&&typeof t=="object"&&Gc in t}class pm{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=w_(e.dsn):$&&R.warn("No DSN provided, client will not send events."),this._dsn){const n=am(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:n})}}captureException(e,n,r){const s=Me();if(ic(e))return $&&R.log(Hc),s;const i={event_id:s,...n};return this._process(this.eventFromException(e,i).then(o=>this._captureEvent(o,i,r))),i.event_id}captureMessage(e,n,r,s){const i={event_id:Me(),...r},o=zi(e)?e:String(e),a=Wi(e)?this.eventFromMessage(o,n,i):this.eventFromException(e,i);return this._process(a.then(l=>this._captureEvent(l,i,s))),i.event_id}captureEvent(e,n,r){const s=Me();if(n?.originalException&&ic(n.originalException))return $&&R.log(Hc),s;const i={event_id:s,...n},o=e.sdkProcessingMetadata||{},a=o.capturedSpanScope,l=o.capturedSpanIsolationScope;return this._process(this._captureEvent(e,i,a||r,l)),i.event_id}captureSession(e){this.sendSession(e),Un(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(s=>r&&s))):an(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];Bc(this,e,this._integrations),n||Mc(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=F_(e,this._dsn,this._options._metadata,this._options.tunnel);for(const i of n.attachments||[])r=I_(r,P_(i));const s=this.sendEnvelope(r);s&&s.then(i=>this.emit("afterSendEvent",e,i),null)}sendSession(e){const{release:n,environment:r=Qi}=this._options;if("aggregates"in e){const i=e.attrs||{};if(!i.release&&!n){$&&R.warn(zc);return}i.release=i.release||n,i.environment=i.environment||r,e.attrs=i}else{if(!e.release&&!n){$&&R.warn(zc);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);const s=j_(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(s)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){const s=`${e}:${n}`;$&&R.log(`Recording outcome: "${s}"${r>1?` (${r} times)`:""}`),this._outcomes[s]=(this._outcomes[s]||0)+r}}on(e,n){const r=this._hooks[e]=this._hooks[e]||[];return r.push(n),()=>{const s=r.indexOf(n);s>-1&&r.splice(s,1)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(s=>s(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>($&&R.error("Error while sending envelope:",n),n)):($&&R.error("Transport disabled"),an({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=um(this,e),Mc(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",s=!1;const i=n.exception?.values;if(i){s=!0;for(const l of i)if(l.mechanism?.handled===!1){r=!0;break}}const o=e.status==="ok";(o&&e.errors===0||o&&r)&&(Un(e,{...r&&{status:"crashed"},errors:e.errors||Number(s||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Rt(n=>{let r=0;const s=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),n(!0)):(r+=s,e&&r>=e&&(clearInterval(i),n(!1)))},s)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,s){const i=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&o?.length&&(n.integrations=o),this.emit("preprocessEvent",e,n),e.type||s.setLastEventId(e.event_id||n.event_id),G_(i,e,n,r,this,s).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:Gg(r),...a.contexts};const l=k_(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:l,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=Ot(),s=mr()){return $&&io(e)&&R.log(`Captured error event \`${qc(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,s).then(i=>i.event_id,i=>{$&&(Vc(i)?R.log(i.message):Kc(i)?R.warn(i.message):R.warn(i))})}_processEvent(e,n,r,s){const i=this.getOptions(),{sampleRate:o}=i,a=Jc(e),l=io(e),c=e.type||"error",u=`before send for type \`${c}\``,d=typeof o>"u"?void 0:o_(o);if(l&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error"),ms(so(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const h=c==="replay_event"?"replay":c;return this._prepareEvent(e,n,r,s).then(f=>{if(f===null)throw this.recordDroppedEvent("event_processor",h),so("An event processor returned `null`, will not send event.");if(n.data&&n.data.__sentry__===!0)return f;const v=_m(this,i,f,n);return gm(v,u)}).then(f=>{if(f===null){if(this.recordDroppedEvent("before_send",h),a){const E=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",E)}throw so(`${u} returned \`null\`, will not send event.`)}const p=r.getSession()||s.getSession();if(l&&p&&this._updateSessionFromEvent(p,f),a){const b=f.sdkProcessingMetadata?.spanCountBeforeProcessing||0,E=f.spans?f.spans.length:0,_=b-E;_>0&&this.recordDroppedEvent("before_send","span",_)}const v=f.transaction_info;if(a&&v&&f.transaction!==e.transaction){const b="custom";f.transaction_info={...v,source:b}}return this.sendEvent(f,n),f}).then(null,f=>{throw Vc(f)||Kc(f)?f:(this.captureException(f,{data:{__sentry__:!0},originalException:f}),ws(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
107
|
-
Reason: ${f}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[s,i]=n.split(":");return{reason:s,category:i,quantity:r}})}_flushOutcomes(){$&&
|
|
108
|
-
Event: ${on(t)}`),!0}else{if(Bm(t,e.ignoreErrors))return $&&
|
|
109
|
-
Event: ${on(t)}`),!0;if(Gm(t))return $&&
|
|
110
|
-
Event: ${on(t)}`),!0;if(Hm(t,e.denyUrls))return $&&
|
|
106
|
+
`),typeof a=="string"||a instanceof Uint8Array)s(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(ft(a))}s(l)}}return typeof r=="string"?r:C_(r)}function C_(t){const e=t.reduce((s,i)=>s+i.length,0),n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function P_(t){const e=typeof t.data=="string"?to(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const N_={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Ac(t){return N_[t]}function Rc(t){if(!t?.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function L_(t,e,n,r){const s=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:ms(r)},...s&&{trace:s}}}function D_(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function j_(t,e,n,r){const s=Rc(n),i={sent_at:new Date().toISOString(),...s&&{sdk:s},...!!r&&e&&{dsn:ms(e)}},o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return vr(i,[o])}function U_(t,e,n,r){const s=Rc(n),i=t.type&&t.type!=="replay_event"?t.type:"event";D_(t,n?.sdk);const o=L_(t,s,r,e);return delete t.sdkProcessingMetadata,vr(o,[[{type:i},t]])}const no=0,Oc=1,Ic=2;function an(t){return new Ot(e=>{e(t)})}function vs(t){return new Ot((e,n)=>{n(t)})}class Ot{constructor(e){this._state=no,this._handlers=[],this._runExecutor(e)}then(e,n){return new Ot((r,s)=>{this._handlers.push([!1,i=>{if(!e)r(i);else try{r(e(i))}catch(o){s(o)}},i=>{if(!n)s(i);else try{r(n(i))}catch(o){s(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Ot((n,r)=>{let s,i;return this.then(o=>{i=!1,s=o,e&&e()},o=>{i=!0,s=o,e&&e()}).then(()=>{if(i){r(s);return}n(s)})})}_executeHandlers(){if(this._state===no)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===Oc&&n[1](this._value),this._state===Ic&&n[2](this._value),n[0]=!0)})}_runExecutor(e){const n=(i,o)=>{if(this._state===no){if(ps(o)){o.then(r,s);return}this._state=i,this._value=o,this._executeHandlers()}},r=i=>{n(Oc,i)},s=i=>{n(Ic,i)};try{e(r,s)}catch(i){s(i)}}}function ro(t,e,n,r=0){return new Ot((s,i)=>{const o=t[r];if(e===null||typeof o!="function")s(e);else{const a=o({...e},n);$&&o.id&&a===null&&O.log(`Event processor "${o.id}" dropped event`),ps(a)?a.then(l=>ro(t,l,n,r+1).then(s)).then(null,i):ro(t,a,n,r+1).then(s).then(null,i)}})}function F_(t,e){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:i}=e;M_(t,e),r&&H_(t,r),z_(t,n),B_(t,s),q_(t,i)}function $c(t,e){const{extra:n,tags:r,user:s,contexts:i,level:o,sdkProcessingMetadata:a,breadcrumbs:l,fingerprint:c,eventProcessors:u,attachments:d,propagationContext:h,transactionName:f,span:p}=e;bs(t,"extra",n),bs(t,"tags",r),bs(t,"user",s),bs(t,"contexts",i),t.sdkProcessingMetadata=_r(t.sdkProcessingMetadata,a,2),o&&(t.level=o),f&&(t.transactionName=f),p&&(t.span=p),l.length&&(t.breadcrumbs=[...t.breadcrumbs,...l]),c.length&&(t.fingerprint=[...t.fingerprint,...c]),u.length&&(t.eventProcessors=[...t.eventProcessors,...u]),d.length&&(t.attachments=[...t.attachments,...d]),t.propagationContext={...t.propagationContext,...h}}function bs(t,e,n){t[e]=_r(t[e],n,1)}function M_(t,e){const{extra:n,tags:r,user:s,contexts:i,level:o,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(s).length&&(t.user={...s,...t.user}),Object.keys(i).length&&(t.contexts={...i,...t.contexts}),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function B_(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function q_(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function H_(t,e){t.contexts={trace:a_(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:S_(e),...t.sdkProcessingMetadata};const n=wc(e),r=Zi(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function z_(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}let ys,Cc,ws;function W_(t){const e=H._sentryDebugIds;if(!e)return{};const n=Object.keys(e);return ws&&n.length===Cc||(Cc=n.length,ws=n.reduce((r,s)=>{ys||(ys={});const i=ys[s];if(i)r[i[0]]=i[1];else{const o=t(s);for(let a=o.length-1;a>=0;a--){const c=o[a]?.filename,u=e[s];if(c&&u){r[c]=u,ys[s]=[c,u];break}}}return r},{})),ws}function G_(t,e,n,r,s,i){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Me(),timestamp:e.timestamp||gr()},c=n.integrations||t.integrations.map(b=>b.name);K_(l,t),Y_(l,c),s&&s.emit("applyFrameMetadata",e),e.type===void 0&&V_(l,t.stackParser);const u=Z_(r,n.captureContext);n.mechanism&&Fn(l,n.mechanism);const d=s?s.getEventProcessors():[],h=zg().getScopeData();if(i){const b=i.getScopeData();$c(h,b)}if(u){const b=u.getScopeData();$c(h,b)}const f=[...n.attachments||[],...h.attachments];f.length&&(n.attachments=f),F_(l,h);const p=[...d,...h.eventProcessors];return ro(p,l,n).then(b=>(b&&J_(b),typeof o=="number"&&o>0?X_(b,o,a):b))}function K_(t,e){const{environment:n,release:r,dist:s,maxValueLength:i=250}=e;t.environment=t.environment||n||Qi,!t.release&&r&&(t.release=r),!t.dist&&s&&(t.dist=s);const o=t.request;o?.url&&(o.url=gs(o.url,i))}function V_(t,e){const n=W_(e);t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(s=>{s.filename&&(s.debug_id=n[s.filename])})})}function J_(t){const e={};if(t.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(s=>{s.debug_id&&(s.abs_path?e[s.abs_path]=s.debug_id:s.filename&&(e[s.filename]=s.debug_id),delete s.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([r,s])=>{n.push({type:"sourcemap",code_file:r,debug_id:s})})}function Y_(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function X_(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(s=>({...s,...s.data&&{data:ft(s.data,e,n)}}))},...t.user&&{user:ft(t.user,e,n)},...t.contexts&&{contexts:ft(t.contexts,e,n)},...t.extra&&{extra:ft(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=ft(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(s=>({...s,...s.data&&{data:ft(s.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=ft(t.contexts.flags,3,n)),r}function Z_(t,e){if(!e)return t;const n=t?t.clone():new at;return n.update(e),n}function Q_(t){if(t)return em(t)?{captureContext:t}:nm(t)?{captureContext:t}:t}function em(t){return t instanceof at||typeof t=="function"}const tm=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function nm(t){return Object.keys(t).some(e=>tm.includes(e))}function Pc(t,e){return Rt().captureException(t,Q_(e))}function Nc(t,e){return Rt().captureEvent(t,e)}function Lc(t){const e=mr(),n=Rt(),{userAgent:r}=H.navigator||{},s=Ng({user:n.getUser()||e.getUser(),...r&&{userAgent:r},...t}),i=e.getSession();return i?.status==="ok"&&Mn(i,{status:"exited"}),Dc(),e.setSession(s),s}function Dc(){const t=mr(),n=Rt().getSession()||t.getSession();n&&Lg(n),jc(),t.setSession()}function jc(){const t=mr(),e=_e(),n=t.getSession();n&&e&&e.captureSession(n)}function Uc(t=!1){if(t){Dc();return}jc()}const rm="7";function sm(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function im(t){return`${sm(t)}${t.projectId}/envelope/`}function om(t,e){const n={sentry_version:rm};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function am(t,e,n){return e||`${im(t)}?${om(t,n)}`}const Fc=[];function lm(t){const e={};return t.forEach(n=>{const{name:r}=n,s=e[r];s&&!s.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function cm(t){const e=t.defaultIntegrations||[],n=t.integrations;e.forEach(s=>{s.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){const s=n(e);r=Array.isArray(s)?s:[s]}else r=e;return lm(r)}function um(t,e){const n={};return e.forEach(r=>{r&&Bc(t,r,n)}),n}function Mc(t,e){for(const n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function Bc(t,e,n){if(n[e.name]){$&&O.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,Fc.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Fc.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(s,i)=>r(s,i,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),s=Object.assign((i,o)=>r(i,o,t),{id:e.name});t.addEventProcessor(s)}$&&O.log(`Integration installed: ${e.name}`)}function Wy(t){return t}function dm(t,e,n){const r=[{type:"client_report"},{timestamp:gr(),discarded_events:t}];return vr(e?{dsn:e}:{},[r])}function qc(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function hm(t){const{trace_id:e,parent_span_id:n,span_id:r,status:s,origin:i,data:o,op:a}=t.contexts?.trace??{};return{data:o??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:s,timestamp:t.timestamp,trace_id:e??"",origin:i,profile_id:o?.[fc],exclusive_time:o?.[pc],measurements:t.measurements,is_segment:!0}}function fm(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[fc]:t.profile_id},...t.exclusive_time&&{[pc]:t.exclusive_time}}}},measurements:t.measurements}}const Hc="Not capturing exception because it's already been captured.",zc="Discarded session because of missing or non-string release",Wc=Symbol.for("SentryInternalError"),Gc=Symbol.for("SentryDoNotSendEventError");function Es(t){return{message:t,[Wc]:!0}}function so(t){return{message:t,[Gc]:!0}}function Kc(t){return!!t&&typeof t=="object"&&Wc in t}function Vc(t){return!!t&&typeof t=="object"&&Gc in t}class pm{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=w_(e.dsn):$&&O.warn("No DSN provided, client will not send events."),this._dsn){const n=am(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:n})}}captureException(e,n,r){const s=Me();if(ic(e))return $&&O.log(Hc),s;const i={event_id:s,...n};return this._process(this.eventFromException(e,i).then(o=>this._captureEvent(o,i,r))),i.event_id}captureMessage(e,n,r,s){const i={event_id:Me(),...r},o=zi(e)?e:String(e),a=Wi(e)?this.eventFromMessage(o,n,i):this.eventFromException(e,i);return this._process(a.then(l=>this._captureEvent(l,i,s))),i.event_id}captureEvent(e,n,r){const s=Me();if(n?.originalException&&ic(n.originalException))return $&&O.log(Hc),s;const i={event_id:s,...n},o=e.sdkProcessingMetadata||{},a=o.capturedSpanScope,l=o.capturedSpanIsolationScope;return this._process(this._captureEvent(e,i,a||r,l)),i.event_id}captureSession(e){this.sendSession(e),Mn(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(s=>r&&s))):an(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];Bc(this,e,this._integrations),n||Mc(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=U_(e,this._dsn,this._options._metadata,this._options.tunnel);for(const i of n.attachments||[])r=I_(r,P_(i));const s=this.sendEnvelope(r);s&&s.then(i=>this.emit("afterSendEvent",e,i),null)}sendSession(e){const{release:n,environment:r=Qi}=this._options;if("aggregates"in e){const i=e.attrs||{};if(!i.release&&!n){$&&O.warn(zc);return}i.release=i.release||n,i.environment=i.environment||r,e.attrs=i}else{if(!e.release&&!n){$&&O.warn(zc);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);const s=j_(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(s)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){const s=`${e}:${n}`;$&&O.log(`Recording outcome: "${s}"${r>1?` (${r} times)`:""}`),this._outcomes[s]=(this._outcomes[s]||0)+r}}on(e,n){const r=this._hooks[e]=this._hooks[e]||[];return r.push(n),()=>{const s=r.indexOf(n);s>-1&&r.splice(s,1)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(s=>s(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>($&&O.error("Error while sending envelope:",n),n)):($&&O.error("Transport disabled"),an({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=um(this,e),Mc(this,e)}_updateSessionFromEvent(e,n){let r=n.level==="fatal",s=!1;const i=n.exception?.values;if(i){s=!0;for(const l of i)if(l.mechanism?.handled===!1){r=!0;break}}const o=e.status==="ok";(o&&e.errors===0||o&&r)&&(Mn(e,{...r&&{status:"crashed"},errors:e.errors||Number(s||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Ot(n=>{let r=0;const s=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),n(!0)):(r+=s,e&&r>=e&&(clearInterval(i),n(!1)))},s)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,s){const i=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&o?.length&&(n.integrations=o),this.emit("preprocessEvent",e,n),e.type||s.setLastEventId(e.event_id||n.event_id),G_(i,e,n,r,this,s).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:Gg(r),...a.contexts};const l=k_(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:l,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=Rt(),s=mr()){return $&&io(e)&&O.log(`Captured error event \`${qc(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,s).then(i=>i.event_id,i=>{$&&(Vc(i)?O.log(i.message):Kc(i)?O.warn(i.message):O.warn(i))})}_processEvent(e,n,r,s){const i=this.getOptions(),{sampleRate:o}=i,a=Jc(e),l=io(e),c=e.type||"error",u=`before send for type \`${c}\``,d=typeof o>"u"?void 0:o_(o);if(l&&typeof d=="number"&&Math.random()>d)return this.recordDroppedEvent("sample_rate","error"),vs(so(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const h=c==="replay_event"?"replay":c;return this._prepareEvent(e,n,r,s).then(f=>{if(f===null)throw this.recordDroppedEvent("event_processor",h),so("An event processor returned `null`, will not send event.");if(n.data&&n.data.__sentry__===!0)return f;const v=_m(this,i,f,n);return gm(v,u)}).then(f=>{if(f===null){if(this.recordDroppedEvent("before_send",h),a){const E=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",E)}throw so(`${u} returned \`null\`, will not send event.`)}const p=r.getSession()||s.getSession();if(l&&p&&this._updateSessionFromEvent(p,f),a){const b=f.sdkProcessingMetadata?.spanCountBeforeProcessing||0,E=f.spans?f.spans.length:0,_=b-E;_>0&&this.recordDroppedEvent("before_send","span",_)}const v=f.transaction_info;if(a&&v&&f.transaction!==e.transaction){const b="custom";f.transaction_info={...v,source:b}}return this.sendEvent(f,n),f}).then(null,f=>{throw Vc(f)||Kc(f)?f:(this.captureException(f,{data:{__sentry__:!0},originalException:f}),Es(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
107
|
+
Reason: ${f}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[s,i]=n.split(":");return{reason:s,category:i,quantity:r}})}_flushOutcomes(){$&&O.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){$&&O.log("No outcomes to send");return}if(!this._dsn){$&&O.log("No dsn provided, will not send outcomes");return}$&&O.log("Sending outcomes:",e);const n=dm(e,this._options.tunnel&&ms(this._dsn));this.sendEnvelope(n)}}function gm(t,e){const n=`${e} must return \`null\` or a valid event.`;if(ps(t))return t.then(r=>{if(!pr(r)&&r!==null)throw Es(n);return r},r=>{throw Es(`${e} rejected with ${r}`)});if(!pr(t)&&t!==null)throw Es(n);return t}function _m(t,e,n,r){const{beforeSend:s,beforeSendTransaction:i,beforeSendSpan:o}=e;let a=n;if(io(a)&&s)return s(a,r);if(Jc(a)){if(o){const l=o(hm(a));if(l?a=_r(n,fm(l)):Ec(),a.spans){const c=[];for(const u of a.spans){const d=o(u);d?c.push(d):(Ec(),c.push(u))}a.spans=c}}if(i){if(a.spans){const l=a.spans.length;a.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return i(a,r)}}return a}function io(t){return t.type===void 0}function Jc(t){return t.type==="transaction"}function mm(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function vm(t,e,n,r){const s={};return e?.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=ms(r)),vr(s,[mm(t)])}function oo(t,e){const n=bm(t)??[];if(n.length===0)return;const r=t.getOptions(),s=vm(n,r._metadata,r.tunnel,t.getDsn());Yc().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(s)}function bm(t){return Yc().get(t)}function Yc(){return fr("clientToLogBufferMap",()=>new WeakMap)}function ym(t,e){e.debug===!0&&($?O.enable():jn(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Rt().update(e.initialScope);const r=new t(e);return wm(r),r.init(),r}function wm(t){Rt().setClient(t)}const Xc=Symbol.for("SentryBufferFullError");function Em(t){const e=[];function n(){return t===void 0||e.length<t}function r(o){return e.splice(e.indexOf(o),1)[0]||Promise.resolve(void 0)}function s(o){if(!n())return vs(Xc);const a=o();return e.indexOf(a)===-1&&e.push(a),a.then(()=>r(a)).then(null,()=>r(a).then(null,()=>{})),a}function i(o){return new Ot((a,l)=>{let c=e.length;if(!c)return a(!0);const u=setTimeout(()=>{o&&o>0&&a(!1)},o);e.forEach(d=>{an(d).then(()=>{--c||(clearTimeout(u),a(!0))},l)})})}return{$:e,add:s,drain:i}}const km=60*1e3;function Sm(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?km:r-e}function Tm(t,e){return t[e]||t.all||0}function xm(t,e,n=Date.now()){return Tm(t,e)>n}function Am(t,{statusCode:e,headers:n},r=Date.now()){const s={...t},i=n?.["x-sentry-rate-limits"],o=n?.["retry-after"];if(i)for(const a of i.trim().split(",")){const[l,c,,,u]=a.split(":",5),d=parseInt(l,10),h=(isNaN(d)?60:d)*1e3;if(!c)s.all=r+h;else for(const f of c.split(";"))f==="metric_bucket"?(!u||u.split(";").includes("custom"))&&(s[f]=r+h):s[f]=r+h}else o?s.all=r+Sm(o,r):e===429&&(s.all=r+60*1e3);return s}const Rm=64;function Om(t,e,n=Em(t.bufferSize||Rm)){let r={};const s=o=>n.drain(o);function i(o){const a=[];if(xc(o,(d,h)=>{const f=Ac(h);xm(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(d)}),a.length===0)return an({});const l=vr(o[0],a),c=d=>{xc(l,(h,f)=>{t.recordDroppedEvent(d,Ac(f))})},u=()=>e({body:$_(l)}).then(d=>(d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&$&&O.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=Am(r,d),d),d=>{throw c("network_error"),$&&O.error("Encountered error running transport request:",d),d});return n.add(u).then(d=>d,d=>{if(d===Xc)return $&&O.error("Skipped sending event because buffer is full."),c("queue_overflow"),an({});throw d})}return{send:i,flush:s}}function Im(t){t.user?.ip_address===void 0&&(t.user={...t.user,ip_address:"{{auto}}"})}function $m(t){"aggregates"in t?t.attrs?.ip_address===void 0&&(t.attrs={...t.attrs,ip_address:"{{auto}}"}):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function Cm(t,e,n=[e],r="npm"){const s=t._metadata||{};s.sdk||(s.sdk={name:`sentry.javascript.${e}`,packages:n.map(i=>({name:`${r}:@sentry/${i}`,version:en})),version:en}),t._metadata=s}const Pm=100;function ln(t,e){const n=_e(),r=mr();if(!n)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:i=Pm}=n.getOptions();if(i<=0)return;const a={timestamp:gr(),...t},l=s?jn(()=>s(a,e)):a;l!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",l,e),r.addBreadcrumb(l,i))}let Zc;const Nm="FunctionToString",Qc=new WeakMap,Lm=(()=>({name:Nm,setupOnce(){Zc=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=Vi(this),n=Qc.has(_e())&&e!==void 0?e:this;return Zc.apply(n,t)}}catch{}},setup(t){Qc.set(t,!0)}})),Dm=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],jm="EventFilters",Um=(t={})=>{let e;return{name:jm,setup(n){const r=n.getOptions();e=eu(t,r)},processEvent(n,r,s){if(!e){const i=s.getOptions();e=eu(t,i)}return Mm(n,e)?null:n}}},Fm=((t={})=>({...Um(t),name:"InboundFilters"}));function eu(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Dm],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Mm(t,e){if(t.type){if(t.type==="transaction"&&qm(t,e.ignoreTransactions))return $&&O.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
108
|
+
Event: ${on(t)}`),!0}else{if(Bm(t,e.ignoreErrors))return $&&O.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
109
|
+
Event: ${on(t)}`),!0;if(Gm(t))return $&&O.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
110
|
+
Event: ${on(t)}`),!0;if(Hm(t,e.denyUrls))return $&&O.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
111
111
|
Event: ${on(t)}.
|
|
112
|
-
Url: ${
|
|
112
|
+
Url: ${ks(t)}`),!0;if(!zm(t,e.allowUrls))return $&&O.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
113
113
|
Event: ${on(t)}.
|
|
114
|
-
Url: ${Es(t)}`),!0}return!1}function Bm(t,e){return e?.length?qc(t).some(n=>gs(n,e)):!1}function qm(t,e){if(!e?.length)return!1;const n=t.transaction;return n?gs(n,e):!1}function Hm(t,e){if(!e?.length)return!1;const n=Es(t);return n?gs(n,e):!1}function zm(t,e){if(!e?.length)return!0;const n=Es(t);return n?gs(n,e):!0}function Wm(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function Es(t){try{const n=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?Wm(n):null}catch{return $&&R.error(`Cannot extract url for event ${on(t)}`),null}}function Gm(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function Km(t,e,n,r,s,i){if(!s.exception?.values||!i||!At(i.originalException,Error))return;const o=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;o&&(s.exception.values=ao(t,e,r,i.originalException,n,s.exception.values,o,0))}function ao(t,e,n,r,s,i,o,a){if(i.length>=n+1)return i;let l=[...i];if(At(r[s],Error)){tu(o,a);const c=t(e,r[s]),u=l.length;nu(c,s,u,a),l=ao(t,e,n,r[s],s,[c,...l],c,u)}return Array.isArray(r.errors)&&r.errors.forEach((c,u)=>{if(At(c,Error)){tu(o,a);const d=t(e,c),h=l.length;nu(d,`errors[${u}]`,h,a),l=ao(t,e,n,c,s,[d,...l],d,h)}}),l}function tu(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function nu(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function Vm(t){const e="console";nn(e,t),rn(e,Jm)}function Jm(){"console"in q&&lg.forEach(function(t){t in q.console&&Ne(q.console,t,function(e){return cs[t]=e,function(...n){Je("console",{args:n,level:t}),cs[t]?.apply(q.console,n)}})})}function Ym(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const Xm="Dedupe",Zm=(()=>{let t;return{name:Xm,processEvent(e){if(e.type)return e;try{if(Qm(e,t))return $&&R.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}});function Qm(t,e){return e?!!(ev(t,e)||tv(t,e)):!1}function ev(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!su(t,e)||!ru(t,e))}function tv(t,e){const n=iu(e),r=iu(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!su(t,e)||!ru(t,e))}function ru(t,e){let n=Gl(t),r=Gl(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let s=0;s<r.length;s++){const i=r[s],o=n[s];if(i.filename!==o.filename||i.lineno!==o.lineno||i.colno!==o.colno||i.function!==o.function)return!1}return!0}function su(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function iu(t){return t.exception?.values?.[0]}function lo(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function ou(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}const br=q;function nv(){return"history"in br&&!!br.history}function rv(){if(!("fetch"in br))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function co(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function sv(){if(typeof EdgeRuntime=="string")return!0;if(!rv())return!1;if(co(br.fetch))return!0;let t=!1;const e=br.document;if(e&&typeof e.createElement=="function")try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow?.fetch&&(t=co(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){$&&R.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function iv(t,e){const n="fetch";nn(n,t),rn(n,()=>ov(void 0,e))}function ov(t,e=!1){e&&!sv()||Ne(q,"fetch",function(n){return function(...r){const s=new Error,{method:i,url:o}=av(r),a={args:r,fetchData:{method:i,url:o},startTimestamp:ht()*1e3,virtualError:s,headers:lv(r)};return Je("fetch",{...a}),n.apply(q,r).then(async l=>(Je("fetch",{...a,endTimestamp:ht()*1e3,response:l}),l),l=>{if(Je("fetch",{...a,endTimestamp:ht()*1e3,error:l}),Hi(l)&&l.stack===void 0&&(l.stack=s.stack,sn(l,"framesToPop",1)),l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{const c=new URL(a.fetchData.url);l.message=`${l.message} (${c.host})`}catch{}throw l})}})}function uo(t,e){return!!t&&typeof t=="object"&&!!t[e]}function au(t){return typeof t=="string"?t:t?uo(t,"url")?t.url:t.toString?t.toString():"":""}function av(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,r]=t;return{url:au(n),method:uo(r,"method")?String(r.method).toUpperCase():"GET"}}const e=t[0];return{url:au(e),method:uo(e,"method")?String(e.method).toUpperCase():"GET"}}function lv(t){const[e,n]=t;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Tg(e))return new Headers(e.headers)}catch{}}function cv(){return"npm"}const Y=q;let ho=0;function lu(){return ho>0}function uv(){ho++,setTimeout(()=>{ho--})}function Bn(t,e={}){function n(s){return typeof s=="function"}if(!n(t))return t;try{const s=t.__sentry_wrapped__;if(s)return typeof s=="function"?s:t;if(Vi(t))return t}catch{return t}const r=function(...s){try{const i=s.map(o=>Bn(o,e));return t.apply(this,i)}catch(i){throw uv(),Wg(o=>{o.addEventProcessor(a=>(e.mechanism&&(Ji(a,void 0),Fn(a,e.mechanism)),a.extra={...a.extra,arguments:s},a)),Pc(i)}),i}};try{for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}catch{}ec(r,t),sn(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}function dv(){const t=Ki(),{referrer:e}=Y.document||{},{userAgent:n}=Y.navigator||{},r={...e&&{Referer:e},...n&&{"User-Agent":n}};return{url:t,headers:r}}function fo(t,e){const n=go(t,e),r={type:_v(e),value:mv(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function hv(t,e,n,r){const i=ge()?.getOptions().normalizeDepth,o=Ev(e),a={__serialized__:Tc(e,i)};if(o)return{exception:{values:[fo(t,o)]},extra:a};const l={exception:{values:[{type:hs(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:yv(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=go(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function po(t,e){return{exception:{values:[fo(t,e)]}}}function go(t,e){const n=e.stacktrace||e.stack||"",r=pv(e),s=gv(e);try{return t(n,r,s)}catch{}return[]}const fv=/Minified React error #\d+;/i;function pv(t){return t&&fv.test(t.message)?1:0}function gv(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function cu(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function _v(t){const e=t?.name;return!e&&cu(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function mv(t){const e=t?.message;return cu(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function vv(t,e,n,r){const s=n?.syntheticException||void 0,i=_o(t,e,s,r);return Fn(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),an(i)}function bv(t,e,n="info",r,s){const i=r?.syntheticException||void 0,o=mo(t,e,i,s);return o.level=n,r?.event_id&&(o.event_id=r.event_id),an(o)}function _o(t,e,n,r,s){let i;if(Jl(e)&&e.error)return po(t,e.error);if(Yl(e)||wg(e)){const o=e;if("stack"in e)i=po(t,e);else{const a=o.name||(Yl(o)?"DOMError":"DOMException"),l=o.message?`${a}: ${o.message}`:a;i=mo(t,l,n,r),Ji(i,l)}return"code"in o&&(i.tags={...i.tags,"DOMException.code":`${o.code}`}),i}return Hi(e)?po(t,e):pr(e)||hs(e)?(i=hv(t,e,n,s),Fn(i,{synthetic:!0}),i):(i=mo(t,e,n,r),Ji(i,`${e}`),Fn(i,{synthetic:!0}),i)}function mo(t,e,n,r){const s={};if(r&&n){const i=go(t,n);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]}),Fn(s,{synthetic:!0})}if(zi(e)){const{__sentry_template_string__:i,__sentry_template_values__:o}=e;return s.logentry={message:i,params:o},s}return s.message=e,s}function yv(t,{isUnhandledRejection:e}){const n=Ig(t),r=e?"promise rejection":"exception";return Jl(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:hs(t)?`Event \`${wv(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function wv(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Ev(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}const kv=5e3;class Sv extends pm{constructor(e){const n=Tv(e),r=Y.SENTRY_SDK_SOURCE||cv();Cm(n,"browser",["browser"],r),super(n);const{sendDefaultPii:s,sendClientReports:i,enableLogs:o,_experiments:a}=this._options,l=o??a?.enableLogs;Y.document&&(i||l)&&Y.document.addEventListener("visibilitychange",()=>{Y.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),l&&oo(this))}),l&&(this.on("flush",()=>{oo(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{oo(this)},kv)})),s&&(this.on("postprocessEvent",Im),this.on("beforeSendSession",$m))}eventFromException(e,n){return vv(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return bv(this._options.stackParser,e,n,r,this._options.attachStacktrace)}_prepareEvent(e,n,r,s){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r,s)}}function Tv(t){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Y.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...t}}const xv=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,_e=q,Av=1e3;let uu,vo,bo;function Ov(t){nn("dom",t),rn("dom",Rv)}function Rv(){if(!_e.document)return;const t=Je.bind(null,"dom"),e=du(t,!0);_e.document.addEventListener("click",e,!1),_e.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const s=_e[n]?.prototype;s?.hasOwnProperty?.("addEventListener")&&(Ne(s,"addEventListener",function(i){return function(o,a,l){if(o==="click"||o=="keypress")try{const c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},u=c[o]=c[o]||{refCount:0};if(!u.handler){const d=du(t);u.handler=d,i.call(this,o,d,l)}u.refCount++}catch{}return i.call(this,o,a,l)}}),Ne(s,"removeEventListener",function(i){return function(o,a,l){if(o==="click"||o=="keypress")try{const c=this.__sentry_instrumentation_handlers__||{},u=c[o];u&&(u.refCount--,u.refCount<=0&&(i.call(this,o,u.handler,l),u.handler=void 0,delete c[o]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return i.call(this,o,a,l)}}))})}function Iv(t){if(t.type!==vo)return!1;try{if(!t.target||t.target._sentryId!==bo)return!1}catch{}return!0}function $v(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function du(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=Cv(n);if($v(n.type,r))return;sn(n,"_sentryCaptured",!0),r&&!r._sentryId&&sn(r,"_sentryId",Me());const s=n.type==="keypress"?"input":n.type;Iv(n)||(t({event:n,name:s,global:e}),vo=n.type,bo=r?r._sentryId:void 0),clearTimeout(uu),uu=_e.setTimeout(()=>{bo=void 0,vo=void 0},Av)}}function Cv(t){try{return t.target}catch{return null}}let ks;function hu(t){const e="history";nn(e,t),rn(e,Pv)}function Pv(){if(_e.addEventListener("popstate",()=>{const e=_e.location.href,n=ks;if(ks=e,n===e)return;Je("history",{from:n,to:e})}),!nv())return;function t(e){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const s=ks,i=Nv(String(r));if(ks=i,s===i)return e.apply(this,n);Je("history",{from:s,to:i})}return e.apply(this,n)}}Ne(_e.history,"pushState",t),Ne(_e.history,"replaceState",t)}function Nv(t){try{return new URL(t,_e.location.origin).toString()}catch{return t}}const Ss={};function Lv(t){const e=Ss[t];if(e)return e;let n=_e[t];if(co(n))return Ss[t]=n.bind(_e);const r=_e.document;if(r&&typeof r.createElement=="function")try{const s=r.createElement("iframe");s.hidden=!0,r.head.appendChild(s);const i=s.contentWindow;i?.[t]&&(n=i[t]),r.head.removeChild(s)}catch(s){xv&&R.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,s)}return n&&(Ss[t]=n.bind(_e))}function fu(t){Ss[t]=void 0}const yr="__sentry_xhr_v3__";function Dv(t){nn("xhr",t),rn("xhr",jv)}function jv(){if(!_e.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const s=new Error,i=ht()*1e3,o=dt(r[0])?r[0].toUpperCase():void 0,a=Fv(r[1]);if(!o||!a)return e.apply(n,r);n[yr]={method:o,url:a,request_headers:{}},o==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[yr];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}const u={endTimestamp:ht()*1e3,startTimestamp:i,xhr:n,virtualError:s};Je("xhr",u)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(c,u,d){return l(),c.apply(u,d)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,u,d){const[h,f]=d,p=u[yr];return p&&dt(h)&&dt(f)&&(p.request_headers[h.toLowerCase()]=f),c.apply(u,d)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const s=n[yr];if(!s)return e.apply(n,r);r[0]!==void 0&&(s.body=r[0]);const i={startTimestamp:ht()*1e3,xhr:n};return Je("xhr",i),e.apply(n,r)}})}function Fv(t){if(dt(t))return t;try{return t.toString()}catch{}}function Uv(t,e=Lv("fetch")){let n=0,r=0;function s(i){const o=i.body.length;n+=o,r++;const a={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return fu("fetch"),ms("No fetch implementation available");try{return e(t.url,a).then(l=>(n-=o,r--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return fu("fetch"),n-=o,r--,ms(l)}}return Rm(t,s)}const Mv=30,Bv=50;function yo(t,e,n,r){const s={filename:t,function:e==="<anonymous>"?tn:e,in_app:!0};return n!==void 0&&(s.lineno=n),r!==void 0&&(s.colno=r),s}const qv=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Hv=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,zv=/\((\S*)(?::(\d+))(?::(\d+))\)/,Wv=[Mv,t=>{const e=qv.exec(t);if(e){const[,r,s,i]=e;return yo(r,tn,+s,+i)}const n=Hv.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=zv.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[s,i]=pu(n[1]||tn,n[2]);return yo(i,s,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],Gv=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Kv=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Vv=Wl(...[Wv,[Bv,t=>{const e=Gv.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=Kv.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],s=e[1]||tn;return[s,r]=pu(s,r),yo(r,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]),pu=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:tn,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Ts=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,xs=1024,Jv="Breadcrumbs",gu=((t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:Jv,setup(n){e.console&&Vm(Zv(n)),e.dom&&Ov(Xv(n,e.dom)),e.xhr&&Dv(Qv(n)),e.fetch&&iv(eb(n)),e.history&&hu(tb(n)),e.sentry&&n.on("beforeSendEvent",Yv(n))}}});function Yv(t){return function(n){ge()===t&&ln({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:on(n)},{event:n})}}function Xv(t,e){return function(r){if(ge()!==t)return;let s,i,o=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>xs&&(Ts&&R.warn(`\`dom.maxStringLength\` cannot exceed ${xs}, but a value of ${a} was configured. Sentry will use ${xs} instead.`),a=xs),typeof o=="string"&&(o=[o]);try{const c=r.event,u=nb(c)?c.target:c;s=Zl(u,{keyAttrs:o,maxStringLength:a}),i=Og(u)}catch{s="<unknown>"}if(s.length===0)return;const l={category:`ui.${r.name}`,message:s};i&&(l.data={"ui.component_name":i}),ln(l,{event:r.event,name:r.name,global:r.global})}}function Zv(t){return function(n){if(ge()!==t)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:Ym(n.level),message:Ql(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${Ql(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;ln(r,{input:n.args,level:n.level})}}function Qv(t){return function(n){if(ge()!==t)return;const{startTimestamp:r,endTimestamp:s}=n,i=n.xhr[yr];if(!r||!s||!i)return;const{method:o,url:a,status_code:l,body:c}=i,u={method:o,url:a,status_code:l},d={xhr:n.xhr,input:c,startTimestamp:r,endTimestamp:s},h={category:"xhr",data:u,type:"http",level:ou(l)};t.emit("beforeOutgoingRequestBreadcrumb",h,d),ln(h,d)}}function eb(t){return function(n){if(ge()!==t)return;const{startTimestamp:r,endTimestamp:s}=n;if(s&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.fetchData.method,n.fetchData.url,n.error){const i=n.fetchData,o={data:n.error,input:n.args,startTimestamp:r,endTimestamp:s},a={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,o),ln(a,o)}else{const i=n.response,o={...n.fetchData,status_code:i?.status};n.fetchData.request_body_size,n.fetchData.response_body_size,i?.status;const a={input:n.args,response:i,startTimestamp:r,endTimestamp:s},l={category:"fetch",data:o,type:"http",level:ou(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",l,a),ln(l,a)}}}function tb(t){return function(n){if(ge()!==t)return;let r=n.from,s=n.to;const i=lo(Y.location.href);let o=r?lo(r):void 0;const a=lo(s);o?.path||(o=i),i.protocol===a.protocol&&i.host===a.host&&(s=a.relative),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),ln({category:"navigation",data:{from:r,to:s}})}}function nb(t){return!!t&&!!t.target}const rb=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],sb="BrowserApiErrors",ib=((t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...t};return{name:sb,setupOnce(){e.setTimeout&&Ne(Y,"setTimeout",_u),e.setInterval&&Ne(Y,"setInterval",_u),e.requestAnimationFrame&&Ne(Y,"requestAnimationFrame",ob),e.XMLHttpRequest&&"XMLHttpRequest"in Y&&Ne(XMLHttpRequest.prototype,"send",ab);const n=e.eventTarget;n&&(Array.isArray(n)?n:rb).forEach(s=>lb(s,e))}}});function _u(t){return function(...e){const n=e[0];return e[0]=Bn(n,{mechanism:{data:{function:xt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function ob(t){return function(e){return t.apply(this,[Bn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:xt(t)},handled:!1,type:"instrument"}})])}}function ab(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(s=>{s in n&&typeof n[s]=="function"&&Ne(n,s,function(i){const o={mechanism:{data:{function:s,handler:xt(i)},handled:!1,type:"instrument"}},a=Vi(i);return a&&(o.mechanism.data.handler=xt(a)),Bn(i,o)})}),t.apply(this,e)}}function lb(t,e){const r=Y[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ne(r,"addEventListener",function(s){return function(i,o,a){try{cb(o)&&(o.handleEvent=Bn(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:xt(o),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&ub(this,i,o),s.apply(this,[i,Bn(o,{mechanism:{data:{function:"addEventListener",handler:xt(o),target:t},handled:!1,type:"instrument"}}),a])}}),Ne(r,"removeEventListener",function(s){return function(i,o,a){try{const l=o.__sentry_wrapped__;l&&s.call(this,i,l,a)}catch{}return s.call(this,i,o,a)}}))}function cb(t){return typeof t.handleEvent=="function"}function ub(t,e,n){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,n)}const db=()=>({name:"BrowserSession",setupOnce(){if(typeof Y.document>"u"){Ts&&R.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Lc({ignoreDuration:!0}),Fc(),hu(({from:t,to:e})=>{t!==void 0&&t!==e&&(Lc({ignoreDuration:!0}),Fc())})}}),hb="GlobalHandlers",fb=((t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:hb,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(pb(n),mu("onerror")),e.onunhandledrejection&&(gb(n),mu("onunhandledrejection"))}}});function pb(t){mg(e=>{const{stackParser:n,attachStacktrace:r}=vu();if(ge()!==t||lu())return;const{msg:s,url:i,line:o,column:a,error:l}=e,c=vb(_o(n,l||s,void 0,r,!1),i,o,a);c.level="error",Nc(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function gb(t){bg(e=>{const{stackParser:n,attachStacktrace:r}=vu();if(ge()!==t||lu())return;const s=_b(e),i=Wi(s)?mb(s):_o(n,s,void 0,r,!0);i.level="error",Nc(i,{originalException:s,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function _b(t){if(Wi(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function mb(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function vb(t,e,n,r){const s=t.exception=t.exception||{},i=s.values=s.values||[],o=i[0]=i[0]||{},a=o.stacktrace=o.stacktrace||{},l=a.frames=a.frames||[],c=r,u=n,d=dt(e)&&e.length>0?e:Ki();return l.length===0&&l.push({colno:c,filename:d,function:tn,in_app:!0,lineno:u}),t}function mu(t){Ts&&R.log(`Global Handler attached: ${t}`)}function vu(){return ge()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const bb=()=>({name:"HttpContext",preprocessEvent(t){if(!Y.navigator&&!Y.location&&!Y.document)return;const e=dv(),n={...e.headers,...t.request?.headers};t.request={...e,...t.request,headers:n}}}),yb="cause",wb=5,Eb="LinkedErrors",kb=((t={})=>{const e=t.limit||wb,n=t.key||yb;return{name:Eb,preprocessEvent(r,s,i){const o=i.getOptions();Km(fo,o.stackParser,n,e,r,s)}}});function Sb(){return Tb()?(Ts&&Dn(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function Tb(){if(typeof Y.window>"u")return!1;const t=Y;if(t.nw||!(t.chrome||t.browser)?.runtime?.id)return!1;const n=Ki(),r=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(Y===Y.top&&r.some(i=>n.startsWith(`${i}://`)))}function xb(t){return[Um(),Lm(),ib(),gu(),fb(),kb(),Zm(),bb(),db()]}function Ab(t={}){const e=!t.skipBrowserExtensionCheck&&Sb(),n={...t,enabled:e?!1:t.enabled,stackParser:gg(t.stackParser||Vv),integrations:cm({integrations:t.integrations,defaultIntegrations:t.defaultIntegrations==null?xb():t.defaultIntegrations}),transport:t.transport||Uv};return ym(Sv,n)}const bu="https://useknest.com",yu="/api/v1",Ob="https://lghrsugmhzpccpriqhrx.supabase.co",Rb="sb_publishable_-KUwilDA78QM849gk662FA_kEzMezNS";function Ib(t=bu){return`${t}${yu}/chat-messages`}function $b(t=bu){return`${t}${yu}/widget-config`}const Cb="Sorry, I didn't get a response.",wu="Unknown error occurred",Eu="This domain is not authorized. Please add it to your allowed origins in the Knest dashboard.",Pb="This chatbot has reached its usage limit. Please contact the site owner to upgrade their plan.",Nb="https://useknest.com/default-avatar.svg",wo="#3b82f6",Lb="Hi! I'm your AI assistant. I'm trained to answer questions about your documentation. How can I help you today?",Db=["How do I get started?","What features are available?","How do I integrate this?"],jb="knest-widget-config-",Fb=1440*60*1e3;function Eo(t){return jb+t}function Ub(t,e){try{const n=localStorage.getItem(Eo(t));if(!n)return null;const{config:r,cachedAt:s}=JSON.parse(n);return Date.now()-s>Fb?(localStorage.removeItem(Eo(t)),null):(e&&r.updatedAt,r)}catch{return null}}function Mb(t,e){try{const n={config:e,cachedAt:Date.now()};localStorage.setItem(Eo(t),JSON.stringify(n))}catch{}}async function ku(t,e){try{const n=await fetch($b(e),{method:"GET",headers:{"X-Api-Key":t}});if(n.ok){const s=await n.json();return Mb(t,s),{config:s,error:null}}if(n.status===401||n.status===403){const s=await n.json().catch(()=>({}));return console.warn("Widget config auth error:",n.status,s),{config:null,error:"auth"}}const r=await n.text();return console.warn("Failed to fetch widget config:",n.status,r),{config:null,error:"network"}}catch(n){return console.error("Error fetching widget config:",n),{config:null,error:"network"}}}async function Bb(t,e,n){const r=Ub(t);return r?(n&&ku(t,e).then(s=>{s.config&&s.config.updatedAt!==r.updatedAt&&n(s.config)}),{config:r,error:null}):ku(t,e)}let qn=null,As=!1,Os=null;async function qb(t,e){return Os||(As&&qn?!0:(Os=(async()=>{try{qn=kp(t,e,{auth:{persistSession:!0,storageKey:"knest-widget-auth"}});const{data:{session:n}}=await qn.auth.getSession();if(n)return As=!0,!0;const{error:r}=await qn.auth.signInAnonymously();return r?(console.error("Widget auth error:",r.message),!1):(As=!0,!0)}catch(n){return console.error("Widget auth initialization failed:",n),!1}finally{Os=null}})(),Os))}async function Hb(){if(!qn)return null;const{data:{session:t}}=await qn.auth.getSession();return t?.access_token||null}function zb(){return As}async function Wb(t){const{publishableApiKey:e,content:n,threadId:r,callbacks:s,baseUrl:i}=t;try{if(!zb())throw new Error("Widget not authenticated. Call initWidgetAuth() first.");const o=await Hb();if(!o)throw new Error("No access token available. Please refresh and try again.");const a={content:n};r&&(a.threadId=r);const l=await fetch(Ib(i),{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":e,Authorization:`Bearer ${o}`},credentials:"include",body:JSON.stringify(a)});if(!l.ok){if(l.status===401||l.status===403)throw new Error(Eu);if(l.status===429){const p=await l.json();throw p.code==="USAGE_LIMIT_EXCEEDED"?new Error(Pb):new Error(p.error||"Rate limited")}const f=await l.json();throw new Error(f.error||"Failed to send message")}const c=l.body?.getReader();if(!c)throw new Error("Response body is not readable");const u=new TextDecoder;let d="",h=!1;for(;;){const{done:f,value:p}=await c.read();if(f)break;d+=u.decode(p,{stream:!0});const v=d.split(`
|
|
115
|
-
`);d=v.pop()||"";for(const b of v)if(b.startsWith("data: "))try{const E=JSON.parse(b.slice(6));if(E.type==="init")E.threadId&&s.onInit&&s.onInit(E.threadId);else if(E.type==="content")E.content&&(h=!0,s.onContent(E.content));else if(E.type==="complete")s.onComplete&&s.onComplete(E.sources||[]);else if(E.type==="error")throw new Error(E.error||wu)}catch(E){console.error("Error parsing SSE data:",E,b)}}h||s.onError(Cb)}catch(o){const a=o instanceof Error?o.message:wu;s.onError(a)}}var Su=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function
|
|
114
|
+
Url: ${ks(t)}`),!0}return!1}function Bm(t,e){return e?.length?qc(t).some(n=>_s(n,e)):!1}function qm(t,e){if(!e?.length)return!1;const n=t.transaction;return n?_s(n,e):!1}function Hm(t,e){if(!e?.length)return!1;const n=ks(t);return n?_s(n,e):!1}function zm(t,e){if(!e?.length)return!0;const n=ks(t);return n?_s(n,e):!0}function Wm(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function ks(t){try{const n=[...t.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?Wm(n):null}catch{return $&&O.error(`Cannot extract url for event ${on(t)}`),null}}function Gm(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function Km(t,e,n,r,s,i){if(!s.exception?.values||!i||!At(i.originalException,Error))return;const o=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;o&&(s.exception.values=ao(t,e,r,i.originalException,n,s.exception.values,o,0))}function ao(t,e,n,r,s,i,o,a){if(i.length>=n+1)return i;let l=[...i];if(At(r[s],Error)){tu(o,a);const c=t(e,r[s]),u=l.length;nu(c,s,u,a),l=ao(t,e,n,r[s],s,[c,...l],c,u)}return Array.isArray(r.errors)&&r.errors.forEach((c,u)=>{if(At(c,Error)){tu(o,a);const d=t(e,c),h=l.length;nu(d,`errors[${u}]`,h,a),l=ao(t,e,n,c,s,[d,...l],d,h)}}),l}function tu(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function nu(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function Vm(t){const e="console";nn(e,t),rn(e,Jm)}function Jm(){"console"in H&&lg.forEach(function(t){t in H.console&&Ne(H.console,t,function(e){return us[t]=e,function(...n){Je("console",{args:n,level:t}),us[t]?.apply(H.console,n)}})})}function Ym(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const Xm="Dedupe",Zm=(()=>{let t;return{name:Xm,processEvent(e){if(e.type)return e;try{if(Qm(e,t))return $&&O.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}});function Qm(t,e){return e?!!(ev(t,e)||tv(t,e)):!1}function ev(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!su(t,e)||!ru(t,e))}function tv(t,e){const n=iu(e),r=iu(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!su(t,e)||!ru(t,e))}function ru(t,e){let n=Gl(t),r=Gl(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let s=0;s<r.length;s++){const i=r[s],o=n[s];if(i.filename!==o.filename||i.lineno!==o.lineno||i.colno!==o.colno||i.function!==o.function)return!1}return!0}function su(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function iu(t){return t.exception?.values?.[0]}function lo(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function ou(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}const br=H;function nv(){return"history"in br&&!!br.history}function rv(){if(!("fetch"in br))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function co(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function sv(){if(typeof EdgeRuntime=="string")return!0;if(!rv())return!1;if(co(br.fetch))return!0;let t=!1;const e=br.document;if(e&&typeof e.createElement=="function")try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow?.fetch&&(t=co(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){$&&O.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}function iv(t,e){const n="fetch";nn(n,t),rn(n,()=>ov(void 0,e))}function ov(t,e=!1){e&&!sv()||Ne(H,"fetch",function(n){return function(...r){const s=new Error,{method:i,url:o}=av(r),a={args:r,fetchData:{method:i,url:o},startTimestamp:ht()*1e3,virtualError:s,headers:lv(r)};return Je("fetch",{...a}),n.apply(H,r).then(async l=>(Je("fetch",{...a,endTimestamp:ht()*1e3,response:l}),l),l=>{if(Je("fetch",{...a,endTimestamp:ht()*1e3,error:l}),Hi(l)&&l.stack===void 0&&(l.stack=s.stack,sn(l,"framesToPop",1)),l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{const c=new URL(a.fetchData.url);l.message=`${l.message} (${c.host})`}catch{}throw l})}})}function uo(t,e){return!!t&&typeof t=="object"&&!!t[e]}function au(t){return typeof t=="string"?t:t?uo(t,"url")?t.url:t.toString?t.toString():"":""}function av(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,r]=t;return{url:au(n),method:uo(r,"method")?String(r.method).toUpperCase():"GET"}}const e=t[0];return{url:au(e),method:uo(e,"method")?String(e.method).toUpperCase():"GET"}}function lv(t){const[e,n]=t;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Tg(e))return new Headers(e.headers)}catch{}}function cv(){return"npm"}const Y=H;let ho=0;function lu(){return ho>0}function uv(){ho++,setTimeout(()=>{ho--})}function qn(t,e={}){function n(s){return typeof s=="function"}if(!n(t))return t;try{const s=t.__sentry_wrapped__;if(s)return typeof s=="function"?s:t;if(Vi(t))return t}catch{return t}const r=function(...s){try{const i=s.map(o=>qn(o,e));return t.apply(this,i)}catch(i){throw uv(),Wg(o=>{o.addEventProcessor(a=>(e.mechanism&&(Ji(a,void 0),Fn(a,e.mechanism)),a.extra={...a.extra,arguments:s},a)),Pc(i)}),i}};try{for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}catch{}ec(r,t),sn(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}function dv(){const t=Ki(),{referrer:e}=Y.document||{},{userAgent:n}=Y.navigator||{},r={...e&&{Referer:e},...n&&{"User-Agent":n}};return{url:t,headers:r}}function fo(t,e){const n=go(t,e),r={type:_v(e),value:mv(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function hv(t,e,n,r){const i=_e()?.getOptions().normalizeDepth,o=Ev(e),a={__serialized__:Tc(e,i)};if(o)return{exception:{values:[fo(t,o)]},extra:a};const l={exception:{values:[{type:fs(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:yv(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=go(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function po(t,e){return{exception:{values:[fo(t,e)]}}}function go(t,e){const n=e.stacktrace||e.stack||"",r=pv(e),s=gv(e);try{return t(n,r,s)}catch{}return[]}const fv=/Minified React error #\d+;/i;function pv(t){return t&&fv.test(t.message)?1:0}function gv(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function cu(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function _v(t){const e=t?.name;return!e&&cu(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function mv(t){const e=t?.message;return cu(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function vv(t,e,n,r){const s=n?.syntheticException||void 0,i=_o(t,e,s,r);return Fn(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),an(i)}function bv(t,e,n="info",r,s){const i=r?.syntheticException||void 0,o=mo(t,e,i,s);return o.level=n,r?.event_id&&(o.event_id=r.event_id),an(o)}function _o(t,e,n,r,s){let i;if(Jl(e)&&e.error)return po(t,e.error);if(Yl(e)||wg(e)){const o=e;if("stack"in e)i=po(t,e);else{const a=o.name||(Yl(o)?"DOMError":"DOMException"),l=o.message?`${a}: ${o.message}`:a;i=mo(t,l,n,r),Ji(i,l)}return"code"in o&&(i.tags={...i.tags,"DOMException.code":`${o.code}`}),i}return Hi(e)?po(t,e):pr(e)||fs(e)?(i=hv(t,e,n,s),Fn(i,{synthetic:!0}),i):(i=mo(t,e,n,r),Ji(i,`${e}`),Fn(i,{synthetic:!0}),i)}function mo(t,e,n,r){const s={};if(r&&n){const i=go(t,n);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]}),Fn(s,{synthetic:!0})}if(zi(e)){const{__sentry_template_string__:i,__sentry_template_values__:o}=e;return s.logentry={message:i,params:o},s}return s.message=e,s}function yv(t,{isUnhandledRejection:e}){const n=Ig(t),r=e?"promise rejection":"exception";return Jl(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:fs(t)?`Event \`${wv(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function wv(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Ev(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}const kv=5e3;class Sv extends pm{constructor(e){const n=Tv(e),r=Y.SENTRY_SDK_SOURCE||cv();Cm(n,"browser",["browser"],r),super(n);const{sendDefaultPii:s,sendClientReports:i,enableLogs:o,_experiments:a}=this._options,l=o??a?.enableLogs;Y.document&&(i||l)&&Y.document.addEventListener("visibilitychange",()=>{Y.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),l&&oo(this))}),l&&(this.on("flush",()=>{oo(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{oo(this)},kv)})),s&&(this.on("postprocessEvent",Im),this.on("beforeSendSession",$m))}eventFromException(e,n){return vv(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return bv(this._options.stackParser,e,n,r,this._options.attachStacktrace)}_prepareEvent(e,n,r,s){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r,s)}}function Tv(t){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Y.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...t}}const xv=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,me=H,Av=1e3;let uu,vo,bo;function Rv(t){nn("dom",t),rn("dom",Ov)}function Ov(){if(!me.document)return;const t=Je.bind(null,"dom"),e=du(t,!0);me.document.addEventListener("click",e,!1),me.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const s=me[n]?.prototype;s?.hasOwnProperty?.("addEventListener")&&(Ne(s,"addEventListener",function(i){return function(o,a,l){if(o==="click"||o=="keypress")try{const c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},u=c[o]=c[o]||{refCount:0};if(!u.handler){const d=du(t);u.handler=d,i.call(this,o,d,l)}u.refCount++}catch{}return i.call(this,o,a,l)}}),Ne(s,"removeEventListener",function(i){return function(o,a,l){if(o==="click"||o=="keypress")try{const c=this.__sentry_instrumentation_handlers__||{},u=c[o];u&&(u.refCount--,u.refCount<=0&&(i.call(this,o,u.handler,l),u.handler=void 0,delete c[o]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return i.call(this,o,a,l)}}))})}function Iv(t){if(t.type!==vo)return!1;try{if(!t.target||t.target._sentryId!==bo)return!1}catch{}return!0}function $v(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function du(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=Cv(n);if($v(n.type,r))return;sn(n,"_sentryCaptured",!0),r&&!r._sentryId&&sn(r,"_sentryId",Me());const s=n.type==="keypress"?"input":n.type;Iv(n)||(t({event:n,name:s,global:e}),vo=n.type,bo=r?r._sentryId:void 0),clearTimeout(uu),uu=me.setTimeout(()=>{bo=void 0,vo=void 0},Av)}}function Cv(t){try{return t.target}catch{return null}}let Ss;function hu(t){const e="history";nn(e,t),rn(e,Pv)}function Pv(){if(me.addEventListener("popstate",()=>{const e=me.location.href,n=Ss;if(Ss=e,n===e)return;Je("history",{from:n,to:e})}),!nv())return;function t(e){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const s=Ss,i=Nv(String(r));if(Ss=i,s===i)return e.apply(this,n);Je("history",{from:s,to:i})}return e.apply(this,n)}}Ne(me.history,"pushState",t),Ne(me.history,"replaceState",t)}function Nv(t){try{return new URL(t,me.location.origin).toString()}catch{return t}}const Ts={};function Lv(t){const e=Ts[t];if(e)return e;let n=me[t];if(co(n))return Ts[t]=n.bind(me);const r=me.document;if(r&&typeof r.createElement=="function")try{const s=r.createElement("iframe");s.hidden=!0,r.head.appendChild(s);const i=s.contentWindow;i?.[t]&&(n=i[t]),r.head.removeChild(s)}catch(s){xv&&O.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,s)}return n&&(Ts[t]=n.bind(me))}function fu(t){Ts[t]=void 0}const yr="__sentry_xhr_v3__";function Dv(t){nn("xhr",t),rn("xhr",jv)}function jv(){if(!me.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const s=new Error,i=ht()*1e3,o=dt(r[0])?r[0].toUpperCase():void 0,a=Uv(r[1]);if(!o||!a)return e.apply(n,r);n[yr]={method:o,url:a,request_headers:{}},o==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[yr];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}const u={endTimestamp:ht()*1e3,startTimestamp:i,xhr:n,virtualError:s};Je("xhr",u)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(c,u,d){return l(),c.apply(u,d)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,u,d){const[h,f]=d,p=u[yr];return p&&dt(h)&&dt(f)&&(p.request_headers[h.toLowerCase()]=f),c.apply(u,d)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const s=n[yr];if(!s)return e.apply(n,r);r[0]!==void 0&&(s.body=r[0]);const i={startTimestamp:ht()*1e3,xhr:n};return Je("xhr",i),e.apply(n,r)}})}function Uv(t){if(dt(t))return t;try{return t.toString()}catch{}}function Fv(t,e=Lv("fetch")){let n=0,r=0;function s(i){const o=i.body.length;n+=o,r++;const a={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return fu("fetch"),vs("No fetch implementation available");try{return e(t.url,a).then(l=>(n-=o,r--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return fu("fetch"),n-=o,r--,vs(l)}}return Om(t,s)}const Mv=30,Bv=50;function yo(t,e,n,r){const s={filename:t,function:e==="<anonymous>"?tn:e,in_app:!0};return n!==void 0&&(s.lineno=n),r!==void 0&&(s.colno=r),s}const qv=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Hv=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,zv=/\((\S*)(?::(\d+))(?::(\d+))\)/,Wv=[Mv,t=>{const e=qv.exec(t);if(e){const[,r,s,i]=e;return yo(r,tn,+s,+i)}const n=Hv.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=zv.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[s,i]=pu(n[1]||tn,n[2]);return yo(i,s,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],Gv=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Kv=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Vv=Wl(...[Wv,[Bv,t=>{const e=Gv.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=Kv.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],s=e[1]||tn;return[s,r]=pu(s,r),yo(r,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]),pu=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:tn,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},xs=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,As=1024,Jv="Breadcrumbs",gu=((t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:Jv,setup(n){e.console&&Vm(Zv(n)),e.dom&&Rv(Xv(n,e.dom)),e.xhr&&Dv(Qv(n)),e.fetch&&iv(eb(n)),e.history&&hu(tb(n)),e.sentry&&n.on("beforeSendEvent",Yv(n))}}});function Yv(t){return function(n){_e()===t&&ln({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:on(n)},{event:n})}}function Xv(t,e){return function(r){if(_e()!==t)return;let s,i,o=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>As&&(xs&&O.warn(`\`dom.maxStringLength\` cannot exceed ${As}, but a value of ${a} was configured. Sentry will use ${As} instead.`),a=As),typeof o=="string"&&(o=[o]);try{const c=r.event,u=nb(c)?c.target:c;s=Zl(u,{keyAttrs:o,maxStringLength:a}),i=Rg(u)}catch{s="<unknown>"}if(s.length===0)return;const l={category:`ui.${r.name}`,message:s};i&&(l.data={"ui.component_name":i}),ln(l,{event:r.event,name:r.name,global:r.global})}}function Zv(t){return function(n){if(_e()!==t)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:Ym(n.level),message:Ql(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${Ql(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;ln(r,{input:n.args,level:n.level})}}function Qv(t){return function(n){if(_e()!==t)return;const{startTimestamp:r,endTimestamp:s}=n,i=n.xhr[yr];if(!r||!s||!i)return;const{method:o,url:a,status_code:l,body:c}=i,u={method:o,url:a,status_code:l},d={xhr:n.xhr,input:c,startTimestamp:r,endTimestamp:s},h={category:"xhr",data:u,type:"http",level:ou(l)};t.emit("beforeOutgoingRequestBreadcrumb",h,d),ln(h,d)}}function eb(t){return function(n){if(_e()!==t)return;const{startTimestamp:r,endTimestamp:s}=n;if(s&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.fetchData.method,n.fetchData.url,n.error){const i=n.fetchData,o={data:n.error,input:n.args,startTimestamp:r,endTimestamp:s},a={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,o),ln(a,o)}else{const i=n.response,o={...n.fetchData,status_code:i?.status};n.fetchData.request_body_size,n.fetchData.response_body_size,i?.status;const a={input:n.args,response:i,startTimestamp:r,endTimestamp:s},l={category:"fetch",data:o,type:"http",level:ou(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",l,a),ln(l,a)}}}function tb(t){return function(n){if(_e()!==t)return;let r=n.from,s=n.to;const i=lo(Y.location.href);let o=r?lo(r):void 0;const a=lo(s);o?.path||(o=i),i.protocol===a.protocol&&i.host===a.host&&(s=a.relative),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),ln({category:"navigation",data:{from:r,to:s}})}}function nb(t){return!!t&&!!t.target}const rb=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],sb="BrowserApiErrors",ib=((t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...t};return{name:sb,setupOnce(){e.setTimeout&&Ne(Y,"setTimeout",_u),e.setInterval&&Ne(Y,"setInterval",_u),e.requestAnimationFrame&&Ne(Y,"requestAnimationFrame",ob),e.XMLHttpRequest&&"XMLHttpRequest"in Y&&Ne(XMLHttpRequest.prototype,"send",ab);const n=e.eventTarget;n&&(Array.isArray(n)?n:rb).forEach(s=>lb(s,e))}}});function _u(t){return function(...e){const n=e[0];return e[0]=qn(n,{mechanism:{data:{function:xt(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function ob(t){return function(e){return t.apply(this,[qn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:xt(t)},handled:!1,type:"instrument"}})])}}function ab(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(s=>{s in n&&typeof n[s]=="function"&&Ne(n,s,function(i){const o={mechanism:{data:{function:s,handler:xt(i)},handled:!1,type:"instrument"}},a=Vi(i);return a&&(o.mechanism.data.handler=xt(a)),qn(i,o)})}),t.apply(this,e)}}function lb(t,e){const r=Y[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ne(r,"addEventListener",function(s){return function(i,o,a){try{cb(o)&&(o.handleEvent=qn(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:xt(o),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&ub(this,i,o),s.apply(this,[i,qn(o,{mechanism:{data:{function:"addEventListener",handler:xt(o),target:t},handled:!1,type:"instrument"}}),a])}}),Ne(r,"removeEventListener",function(s){return function(i,o,a){try{const l=o.__sentry_wrapped__;l&&s.call(this,i,l,a)}catch{}return s.call(this,i,o,a)}}))}function cb(t){return typeof t.handleEvent=="function"}function ub(t,e,n){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,n)}const db=()=>({name:"BrowserSession",setupOnce(){if(typeof Y.document>"u"){xs&&O.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Lc({ignoreDuration:!0}),Uc(),hu(({from:t,to:e})=>{t!==void 0&&t!==e&&(Lc({ignoreDuration:!0}),Uc())})}}),hb="GlobalHandlers",fb=((t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:hb,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(pb(n),mu("onerror")),e.onunhandledrejection&&(gb(n),mu("onunhandledrejection"))}}});function pb(t){mg(e=>{const{stackParser:n,attachStacktrace:r}=vu();if(_e()!==t||lu())return;const{msg:s,url:i,line:o,column:a,error:l}=e,c=vb(_o(n,l||s,void 0,r,!1),i,o,a);c.level="error",Nc(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function gb(t){bg(e=>{const{stackParser:n,attachStacktrace:r}=vu();if(_e()!==t||lu())return;const s=_b(e),i=Wi(s)?mb(s):_o(n,s,void 0,r,!0);i.level="error",Nc(i,{originalException:s,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function _b(t){if(Wi(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function mb(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function vb(t,e,n,r){const s=t.exception=t.exception||{},i=s.values=s.values||[],o=i[0]=i[0]||{},a=o.stacktrace=o.stacktrace||{},l=a.frames=a.frames||[],c=r,u=n,d=dt(e)&&e.length>0?e:Ki();return l.length===0&&l.push({colno:c,filename:d,function:tn,in_app:!0,lineno:u}),t}function mu(t){xs&&O.log(`Global Handler attached: ${t}`)}function vu(){return _e()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const bb=()=>({name:"HttpContext",preprocessEvent(t){if(!Y.navigator&&!Y.location&&!Y.document)return;const e=dv(),n={...e.headers,...t.request?.headers};t.request={...e,...t.request,headers:n}}}),yb="cause",wb=5,Eb="LinkedErrors",kb=((t={})=>{const e=t.limit||wb,n=t.key||yb;return{name:Eb,preprocessEvent(r,s,i){const o=i.getOptions();Km(fo,o.stackParser,n,e,r,s)}}});function Sb(){return Tb()?(xs&&jn(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function Tb(){if(typeof Y.window>"u")return!1;const t=Y;if(t.nw||!(t.chrome||t.browser)?.runtime?.id)return!1;const n=Ki(),r=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(Y===Y.top&&r.some(i=>n.startsWith(`${i}://`)))}function xb(t){return[Fm(),Lm(),ib(),gu(),fb(),kb(),Zm(),bb(),db()]}function Ab(t={}){const e=!t.skipBrowserExtensionCheck&&Sb(),n={...t,enabled:e?!1:t.enabled,stackParser:gg(t.stackParser||Vv),integrations:cm({integrations:t.integrations,defaultIntegrations:t.defaultIntegrations==null?xb():t.defaultIntegrations}),transport:t.transport||Fv};return ym(Sv,n)}const bu="https://useknest.com",yu="/api/v1",Rb="https://lghrsugmhzpccpriqhrx.supabase.co",Ob="sb_publishable_-KUwilDA78QM849gk662FA_kEzMezNS";function Ib(t=bu){return`${t}${yu}/chat-messages`}function $b(t=bu){return`${t}${yu}/widget-config`}const Cb="Sorry, I didn't get a response.",wu="Unknown error occurred",Eu="This domain is not authorized. Please add it to your allowed origins in the Knest dashboard.",Pb="This chatbot has reached its usage limit. Please contact the site owner to upgrade their plan.",Nb="https://useknest.com/default-avatar.svg",wo="#3b82f6",Lb="Hi! I'm your AI assistant. I'm trained to answer questions about your documentation. How can I help you today?",Db=["How do I get started?","What features are available?","How do I integrate this?"],jb="knest-widget-config-",Ub=1440*60*1e3;function Eo(t){return jb+t}function Fb(t,e){try{const n=localStorage.getItem(Eo(t));if(!n)return null;const{config:r,cachedAt:s}=JSON.parse(n);return Date.now()-s>Ub?(localStorage.removeItem(Eo(t)),null):(e&&r.updatedAt,r)}catch{return null}}function Mb(t,e){try{const n={config:e,cachedAt:Date.now()};localStorage.setItem(Eo(t),JSON.stringify(n))}catch{}}async function ku(t,e){try{const n=await fetch($b(e),{method:"GET",headers:{"X-Api-Key":t}});if(n.ok){const s=await n.json();return Mb(t,s),{config:s,error:null}}if(n.status===401||n.status===403){const s=await n.json().catch(()=>({}));return console.warn("Widget config auth error:",n.status,s),{config:null,error:"auth"}}const r=await n.text();return console.warn("Failed to fetch widget config:",n.status,r),{config:null,error:"network"}}catch(n){return console.error("Error fetching widget config:",n),{config:null,error:"network"}}}async function Bb(t,e,n){const r=Fb(t);return r?(n&&ku(t,e).then(s=>{s.config&&s.config.updatedAt!==r.updatedAt&&n(s.config)}),{config:r,error:null}):ku(t,e)}let cn=null,Rs=!1,Os=null;async function qb(t,e){return Os||(Rs&&cn?!0:(Os=(async()=>{try{cn=kp(t,e,{auth:{persistSession:!0,storageKey:"knest-widget-auth"}});const{data:{session:n}}=await cn.auth.getSession();if(n)return Rs=!0,!0;const{error:r}=await cn.auth.signInAnonymously();return r?(console.error("Widget auth error:",r.message),!1):(Rs=!0,!0)}catch(n){return console.error("Widget auth initialization failed:",n),!1}finally{Os=null}})(),Os))}async function Hb(){if(!cn)return null;const{data:{session:t}}=await cn.auth.getSession();return t?.access_token||null}function zb(){return Rs}function Wb(){return cn}async function Gb(t){const{publishableApiKey:e,content:n,threadId:r,callbacks:s,baseUrl:i}=t;try{if(!zb())throw new Error("Widget not authenticated. Call initWidgetAuth() first.");const o=await Hb();if(!o)throw new Error("No access token available. Please refresh and try again.");const a={content:n};r&&(a.threadId=r);const l=await fetch(Ib(i),{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":e,Authorization:`Bearer ${o}`},credentials:"include",body:JSON.stringify(a)});if(!l.ok){if(l.status===401||l.status===403)throw new Error(Eu);if(l.status===429){const p=await l.json();throw p.code==="USAGE_LIMIT_EXCEEDED"?new Error(Pb):new Error(p.error||"Rate limited")}const f=await l.json();throw new Error(f.error||"Failed to send message")}const c=l.body?.getReader();if(!c)throw new Error("Response body is not readable");const u=new TextDecoder;let d="",h=!1;for(;;){const{done:f,value:p}=await c.read();if(f)break;d+=u.decode(p,{stream:!0});const v=d.split(`
|
|
115
|
+
`);d=v.pop()||"";for(const b of v)if(b.startsWith("data: "))try{const E=JSON.parse(b.slice(6));if(E.type==="init")E.threadId&&s.onInit&&s.onInit(E.threadId);else if(E.type==="content")E.content&&(h=!0,s.onContent(E.content));else if(E.type==="complete")s.onComplete&&s.onComplete(E.sources||[]);else if(E.type==="done")E.humanTakeover&&(h=!0),s.onDone&&s.onDone({humanTakeover:E.humanTakeover});else if(E.type==="error")throw new Error(E.error||wu)}catch(E){console.error("Error parsing SSE data:",E,b)}}h||s.onError(Cb)}catch(o){const a=o instanceof Error?o.message:wu;s.onError(a)}}var Su=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Tu={exports:{}},xu;function Vb(){return xu||(xu=1,(function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
|
116
116
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
117
117
|
*
|
|
118
118
|
* @license MIT <https://opensource.org/licenses/MIT>
|
|
119
119
|
* @author Lea Verou <https://lea.verou.me>
|
|
120
120
|
* @namespace
|
|
121
121
|
* @public
|
|
122
|
-
*/var n=(function(r){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,i=0,o={},a={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function _(g){return g instanceof l?new l(g.type,_(g.content),g.alias):Array.isArray(g)?g.map(_):g.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(_){return Object.prototype.toString.call(_).slice(8,-1)},objId:function(_){return _.__id||Object.defineProperty(_,"__id",{value:++i}),_.__id},clone:function _(g,m){m=m||{};var y,w;switch(a.util.type(g)){case"Object":if(w=a.util.objId(g),m[w])return m[w];y={},m[w]=y;for(var k in g)g.hasOwnProperty(k)&&(y[k]=_(g[k],m));return y;case"Array":return w=a.util.objId(g),m[w]?m[w]:(y=[],m[w]=y,g.forEach(function(x,S){y[S]=_(x,m)}),y);default:return g}},getLanguage:function(_){for(;_;){var g=s.exec(_.className);if(g)return g[1].toLowerCase();_=_.parentElement}return"none"},setLanguage:function(_,g){_.className=_.className.replace(RegExp(s,"gi"),""),_.classList.add("language-"+g)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(y){var _=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(y.stack)||[])[1];if(_){var g=document.getElementsByTagName("script");for(var m in g)if(g[m].src==_)return g[m]}return null}},isActive:function(_,g,m){for(var y="no-"+g;_;){var w=_.classList;if(w.contains(g))return!0;if(w.contains(y))return!1;_=_.parentElement}return!!m}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(_,g){var m=a.util.clone(a.languages[_]);for(var y in g)m[y]=g[y];return m},insertBefore:function(_,g,m,y){y=y||a.languages;var w=y[_],k={};for(var x in w)if(w.hasOwnProperty(x)){if(x==g)for(var S in m)m.hasOwnProperty(S)&&(k[S]=m[S]);m.hasOwnProperty(x)||(k[x]=w[x])}var P=y[_];return y[_]=k,a.languages.DFS(a.languages,function(M,oe){oe===P&&M!=_&&(this[M]=k)}),k},DFS:function _(g,m,y,w){w=w||{};var k=a.util.objId;for(var x in g)if(g.hasOwnProperty(x)){m.call(g,x,g[x],y||x);var S=g[x],P=a.util.type(S);P==="Object"&&!w[k(S)]?(w[k(S)]=!0,_(S,m,null,w)):P==="Array"&&!w[k(S)]&&(w[k(S)]=!0,_(S,m,x,w))}}},plugins:{},highlightAll:function(_,g){a.highlightAllUnder(document,_,g)},highlightAllUnder:function(_,g,m){var y={callback:m,container:_,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",y),y.elements=Array.prototype.slice.apply(y.container.querySelectorAll(y.selector)),a.hooks.run("before-all-elements-highlight",y);for(var w=0,k;k=y.elements[w++];)a.highlightElement(k,g===!0,y.callback)},highlightElement:function(_,g,m){var y=a.util.getLanguage(_),w=a.languages[y];a.util.setLanguage(_,y);var k=_.parentElement;k&&k.nodeName.toLowerCase()==="pre"&&a.util.setLanguage(k,y);var x=_.textContent,S={element:_,language:y,grammar:w,code:x};function P(oe){S.highlightedCode=oe,a.hooks.run("before-insert",S),S.element.innerHTML=S.highlightedCode,a.hooks.run("after-highlight",S),a.hooks.run("complete",S),m&&m.call(S.element)}if(a.hooks.run("before-sanity-check",S),k=S.element.parentElement,k&&k.nodeName.toLowerCase()==="pre"&&!k.hasAttribute("tabindex")&&k.setAttribute("tabindex","0"),!S.code){a.hooks.run("complete",S),m&&m.call(S.element);return}if(a.hooks.run("before-highlight",S),!S.grammar){P(a.util.encode(S.code));return}if(g&&r.Worker){var M=new Worker(a.filename);M.onmessage=function(oe){P(oe.data)},M.postMessage(JSON.stringify({language:S.language,code:S.code,immediateClose:!0}))}else P(a.highlight(S.code,S.grammar,S.language))},highlight:function(_,g,m){var y={code:_,grammar:g,language:m};if(a.hooks.run("before-tokenize",y),!y.grammar)throw new Error('The language "'+y.language+'" has no grammar.');return y.tokens=a.tokenize(y.code,y.grammar),a.hooks.run("after-tokenize",y),l.stringify(a.util.encode(y.tokens),y.language)},tokenize:function(_,g){var m=g.rest;if(m){for(var y in m)g[y]=m[y];delete g.rest}var w=new d;return h(w,w.head,_),u(_,w,g,w.head,0),p(w)},hooks:{all:{},add:function(_,g){var m=a.hooks.all;m[_]=m[_]||[],m[_].push(g)},run:function(_,g){var m=a.hooks.all[_];if(!(!m||!m.length))for(var y=0,w;w=m[y++];)w(g)}},Token:l};r.Prism=a;function l(_,g,m,y){this.type=_,this.content=g,this.alias=m,this.length=(y||"").length|0}l.stringify=function _(g,m){if(typeof g=="string")return g;if(Array.isArray(g)){var y="";return g.forEach(function(P){y+=_(P,m)}),y}var w={type:g.type,content:_(g.content,m),tag:"span",classes:["token",g.type],attributes:{},language:m},k=g.alias;k&&(Array.isArray(k)?Array.prototype.push.apply(w.classes,k):w.classes.push(k)),a.hooks.run("wrap",w);var x="";for(var S in w.attributes)x+=" "+S+'="'+(w.attributes[S]||"").replace(/"/g,""")+'"';return"<"+w.tag+' class="'+w.classes.join(" ")+'"'+x+">"+w.content+"</"+w.tag+">"};function c(_,g,m,y){_.lastIndex=g;var w=_.exec(m);if(w&&y&&w[1]){var k=w[1].length;w.index+=k,w[0]=w[0].slice(k)}return w}function u(_,g,m,y,w,k){for(var x in m)if(!(!m.hasOwnProperty(x)||!m[x])){var S=m[x];S=Array.isArray(S)?S:[S];for(var P=0;P<S.length;++P){if(k&&k.cause==x+","+P)return;var M=S[P],oe=M.inside,Ye=!!M.lookbehind,me=!!M.greedy,O=M.alias;if(me&&!M.pattern.global){var z=M.pattern.toString().match(/[imsuy]*$/)[0];M.pattern=RegExp(M.pattern.source,z+"g")}for(var Se=M.pattern||M,G=y.next,K=w;G!==g.tail&&!(k&&K>=k.reach);K+=G.value.length,G=G.next){var se=G.value;if(g.length>_.length)return;if(!(se instanceof l)){var Xe=1,ve;if(me){if(ve=c(Se,K,_,Ye),!ve||ve.index>=_.length)break;var be=ve.index,wr=ve.index+ve[0].length,X=K;for(X+=G.value.length;be>=X;)G=G.next,X+=G.value.length;if(X-=G.value.length,K=X,G.value instanceof l)continue;for(var Z=G;Z!==g.tail&&(X<wr||typeof Z.value=="string");Z=Z.next)Xe++,X+=Z.value.length;Xe--,se=_.slice(K,X),ve.index-=K}else if(ve=c(Se,0,se,Ye),!ve)continue;var be=ve.index,Le=ve[0],Ze=se.slice(0,be),Te=se.slice(be+Le.length),pt=K+se.length;k&&pt>k.reach&&(k.reach=pt);var Hn=G.prev;Ze&&(Hn=h(g,Hn,Ze),K+=Ze.length),f(g,Hn,Xe);var Rs=new l(x,oe?a.tokenize(Le,oe):Le,O,Le);if(G=h(g,Hn,Rs),Te&&h(g,G,Te),Xe>1){var cn={cause:x+","+P,reach:pt};u(_,g,m,G.prev,K,cn),k&&cn.reach>k.reach&&(k.reach=cn.reach)}}}}}}function d(){var _={value:null,prev:null,next:null},g={value:null,prev:_,next:null};_.next=g,this.head=_,this.tail=g,this.length=0}function h(_,g,m){var y=g.next,w={value:m,prev:g,next:y};return g.next=w,y.prev=w,_.length++,w}function f(_,g,m){for(var y=g.next,w=0;w<m&&y!==_.tail;w++)y=y.next;g.next=y,y.prev=g,_.length-=w}function p(_){for(var g=[],m=_.head.next;m!==_.tail;)g.push(m.value),m=m.next;return g}if(!r.document)return r.addEventListener&&(a.disableWorkerMessageHandler||r.addEventListener("message",function(_){var g=JSON.parse(_.data),m=g.language,y=g.code,w=g.immediateClose;r.postMessage(a.highlight(y,a.languages[m],m)),w&&r.close()},!1)),a;var v=a.util.currentScript();v&&(a.filename=v.src,v.hasAttribute("data-manual")&&(a.manual=!0));function b(){a.manual||a.highlightAll()}if(!a.manual){var E=document.readyState;E==="loading"||E==="interactive"&&v&&v.defer?document.addEventListener("DOMContentLoaded",b):window.requestAnimationFrame?window.requestAnimationFrame(b):window.setTimeout(b,16)}return a})(e);t.exports&&(t.exports=n),typeof Su<"u"&&(Su.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&/,"&"))}),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(r,s){var i={};i["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[s]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var o={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};o["language-"+s]={pattern:/[\s\S]+/,inside:n.languages[s]};var a={};a[r]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return r}),"i"),lookbehind:!0,greedy:!0,inside:o},n.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(r,s){n.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:n.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,(function(r){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var i=r.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))})(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),n.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),n.languages.markup&&(n.languages.markup.tag.addInlined("script","javascript"),n.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),n.languages.js=n.languages.javascript,(function(){if(typeof n>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",s=function(v,b){return"✖ Error "+v+" while fetching file: "+b},i="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},a="data-src-status",l="loading",c="loaded",u="failed",d="pre[data-src]:not(["+a+'="'+c+'"]):not(['+a+'="'+l+'"])';function h(v,b,E){var _=new XMLHttpRequest;_.open("GET",v,!0),_.onreadystatechange=function(){_.readyState==4&&(_.status<400&&_.responseText?b(_.responseText):_.status>=400?E(s(_.status,_.statusText)):E(i))},_.send(null)}function f(v){var b=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(v||"");if(b){var E=Number(b[1]),_=b[2],g=b[3];return _?g?[E,Number(g)]:[E,void 0]:[E,E]}}n.hooks.add("before-highlightall",function(v){v.selector+=", "+d}),n.hooks.add("before-sanity-check",function(v){var b=v.element;if(b.matches(d)){v.code="",b.setAttribute(a,l);var E=b.appendChild(document.createElement("CODE"));E.textContent=r;var _=b.getAttribute("data-src"),g=v.language;if(g==="none"){var m=(/\.(\w+)$/.exec(_)||[,"none"])[1];g=o[m]||m}n.util.setLanguage(E,g),n.util.setLanguage(b,g);var y=n.plugins.autoloader;y&&y.loadLanguages(g),h(_,function(w){b.setAttribute(a,c);var k=f(b.getAttribute("data-range"));if(k){var x=w.split(/\r\n?|\n/g),S=k[0],P=k[1]==null?x.length:k[1];S<0&&(S+=x.length),S=Math.max(0,Math.min(S-1,x.length)),P<0&&(P+=x.length),P=Math.max(0,Math.min(P,x.length)),w=x.slice(S,P).join(`
|
|
123
|
-
`),b.hasAttribute("data-start")||b.setAttribute("data-start",String(S+1))}E.textContent=w,n.highlightElement(E)},function(w){b.setAttribute(a,u),E.textContent=w})}}),n.plugins.fileHighlight={highlight:function(v){for(var b=(v||document).querySelectorAll(d),E=0,_;_=b[E++];)n.highlightElement(_)}};var p=!1;n.fileHighlight=function(){p||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),p=!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(Tu)),Tu.exports}var Vb=Kb();const Au=Gb(Vb);var Jb={},Ou;function Yb(){return Ou||(Ou=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),Jb}Yb();var Xb={},Ru;function Zb(){return Ru||(Ru=1,(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var e=t.languages.extend("typescript",{});delete e["class-name"],t.languages.typescript["class-name"].inside=e,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),t.languages.ts=t.languages.typescript})(Prism)),Xb}Zb(),(function(t){var e="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+e),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+e),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+e),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+e),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=t.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=r.variable[1].inside,o=0;o<s.length;o++)i[s[o]]=t.languages.bash[s[o]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism),Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json,(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism),Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(t,e){var n={};n["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[e]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var s={};s[t]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",s)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(t,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};const Qb={js:"javascript",ts:"typescript",shell:"bash",sh:"bash",html:"markup",xml:"markup"};F.setOptions({breaks:!0,gfm:!0});const Iu=new F.Renderer;Iu.code=({text:t,lang:e})=>{const n=e?Qb[e]||e:"plaintext",r=Au.languages[n];if(r){const s=Au.highlight(t,r,n);return`<pre><code class="language-${n}">${s}</code></pre>`}return`<pre><code>${t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</code></pre>`},F.use({renderer:Iu});function ey(t){return F.parse(t)}const ty="https://005d25250a41bd0071570b0c0a2b2c4d@o4510467570073600.ingest.us.sentry.io/4510472944156672",ny=["@useknest","useknest","widget-core","widget-web","widget-react","widget.umd.js","widget.js","knest"];function ry(t){if(t.tags?.source==="knest-widget")return!0;const e=t.exception?.values?.[0]?.stacktrace?.frames;return!e||e.length===0?!1:e.some(n=>{const r=n.filename||"";return ny.some(s=>r.includes(s))})}let $u=!1;function Cu(){$u||(Ab({dsn:ty,tracesSampleRate:0,integrations:[gu({console:!1,dom:!0,fetch:!0,history:!1,xhr:!1})],initialScope:{tags:{source:"knest-widget"}},beforeSend(t){return ry(t)?t:null}}),$u=!0)}function sy(t,e){const n=typeof t=="string"?new Error(t):t;Pc(n,{tags:{source:"knest-widget"},extra:e})}var iy=ee('<div class="user-avatar svelte-19vup0k">AI</div>'),oy=ee('<img alt="Avatar" class="avatar-img svelte-19vup0k"/>'),ay=ee('<div class="user-avatar svelte-19vup0k">U</div>'),ly=ee('<div class="message-avatar svelte-19vup0k"><!></div>'),cy=ee('<div class="loading svelte-19vup0k"><div class="dot svelte-19vup0k"></div> <div class="dot svelte-19vup0k"></div> <div class="dot svelte-19vup0k"></div></div>'),uy=ee('<div class="source-breadcrumb svelte-19vup0k"> </div>'),dy=ee('<a target="_blank" rel="noopener noreferrer" class="source-item svelte-19vup0k"><svg class="source-icon svelte-19vup0k" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.746 0 3.332.477 4.5 1.253v13C19.832 18.477 18.246 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" class="svelte-19vup0k"></path></svg> <div class="source-text svelte-19vup0k"><!> <div class="source-title svelte-19vup0k"> </div></div></a>'),hy=ee('<div class="sources svelte-19vup0k"><div class="sources-label svelte-19vup0k">Sources</div> <!></div>'),fy=ee('<div class="message-wrapper svelte-19vup0k"><div class="message svelte-19vup0k"><!> <div class="message-content svelte-19vup0k"><!> <!></div></div></div>');const py={hash:"svelte-19vup0k",code:`.message-wrapper.svelte-19vup0k {display:flex;flex-direction:column;}.message.svelte-19vup0k {display:flex;gap:1rem;padding:1.25rem 1.5rem;align-items:flex-start;}.message-avatar.svelte-19vup0k {display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;flex-shrink:0;}.avatar-img.svelte-19vup0k {width:100%;height:100%;border-radius:0.25rem;object-fit:cover;}.user-avatar.svelte-19vup0k {width:2rem;height:2rem;border-radius:0.25rem;display:flex;align-items:center;justify-content:center;color:white;font-size:0.875rem;font-weight:500;}.message-content.svelte-19vup0k {flex:1;min-width:0;}.message-content.svelte-19vup0k p {margin:0 0 0.5rem 0;font-size:0.875rem;line-height:1.625;color:inherit;word-wrap:break-word;}.message-content.svelte-19vup0k p:last-child {margin-bottom:0;}.message-content.svelte-19vup0k code {background-color:#f3f4f6;padding:0.125rem 0.375rem;border-radius:0.25rem;font-family:ui-monospace, monospace;font-size:0.8125rem;color:#ef4444;}.message-content.svelte-19vup0k pre {background-color:#1f2937;color:#f9fafb;padding:12px;border-radius:6px;overflow-x:auto;margin:8px 0;font-size:0.8125rem;line-height:1.5;}.message-content.svelte-19vup0k pre code {background-color:transparent;padding:0;color:inherit;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;}
|
|
122
|
+
*/var n=(function(r){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,i=0,o={},a={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function _(g){return g instanceof l?new l(g.type,_(g.content),g.alias):Array.isArray(g)?g.map(_):g.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(_){return Object.prototype.toString.call(_).slice(8,-1)},objId:function(_){return _.__id||Object.defineProperty(_,"__id",{value:++i}),_.__id},clone:function _(g,m){m=m||{};var y,w;switch(a.util.type(g)){case"Object":if(w=a.util.objId(g),m[w])return m[w];y={},m[w]=y;for(var k in g)g.hasOwnProperty(k)&&(y[k]=_(g[k],m));return y;case"Array":return w=a.util.objId(g),m[w]?m[w]:(y=[],m[w]=y,g.forEach(function(x,S){y[S]=_(x,m)}),y);default:return g}},getLanguage:function(_){for(;_;){var g=s.exec(_.className);if(g)return g[1].toLowerCase();_=_.parentElement}return"none"},setLanguage:function(_,g){_.className=_.className.replace(RegExp(s,"gi"),""),_.classList.add("language-"+g)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(y){var _=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(y.stack)||[])[1];if(_){var g=document.getElementsByTagName("script");for(var m in g)if(g[m].src==_)return g[m]}return null}},isActive:function(_,g,m){for(var y="no-"+g;_;){var w=_.classList;if(w.contains(g))return!0;if(w.contains(y))return!1;_=_.parentElement}return!!m}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(_,g){var m=a.util.clone(a.languages[_]);for(var y in g)m[y]=g[y];return m},insertBefore:function(_,g,m,y){y=y||a.languages;var w=y[_],k={};for(var x in w)if(w.hasOwnProperty(x)){if(x==g)for(var S in m)m.hasOwnProperty(S)&&(k[S]=m[S]);m.hasOwnProperty(x)||(k[x]=w[x])}var P=y[_];return y[_]=k,a.languages.DFS(a.languages,function(B,oe){oe===P&&B!=_&&(this[B]=k)}),k},DFS:function _(g,m,y,w){w=w||{};var k=a.util.objId;for(var x in g)if(g.hasOwnProperty(x)){m.call(g,x,g[x],y||x);var S=g[x],P=a.util.type(S);P==="Object"&&!w[k(S)]?(w[k(S)]=!0,_(S,m,null,w)):P==="Array"&&!w[k(S)]&&(w[k(S)]=!0,_(S,m,x,w))}}},plugins:{},highlightAll:function(_,g){a.highlightAllUnder(document,_,g)},highlightAllUnder:function(_,g,m){var y={callback:m,container:_,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",y),y.elements=Array.prototype.slice.apply(y.container.querySelectorAll(y.selector)),a.hooks.run("before-all-elements-highlight",y);for(var w=0,k;k=y.elements[w++];)a.highlightElement(k,g===!0,y.callback)},highlightElement:function(_,g,m){var y=a.util.getLanguage(_),w=a.languages[y];a.util.setLanguage(_,y);var k=_.parentElement;k&&k.nodeName.toLowerCase()==="pre"&&a.util.setLanguage(k,y);var x=_.textContent,S={element:_,language:y,grammar:w,code:x};function P(oe){S.highlightedCode=oe,a.hooks.run("before-insert",S),S.element.innerHTML=S.highlightedCode,a.hooks.run("after-highlight",S),a.hooks.run("complete",S),m&&m.call(S.element)}if(a.hooks.run("before-sanity-check",S),k=S.element.parentElement,k&&k.nodeName.toLowerCase()==="pre"&&!k.hasAttribute("tabindex")&&k.setAttribute("tabindex","0"),!S.code){a.hooks.run("complete",S),m&&m.call(S.element);return}if(a.hooks.run("before-highlight",S),!S.grammar){P(a.util.encode(S.code));return}if(g&&r.Worker){var B=new Worker(a.filename);B.onmessage=function(oe){P(oe.data)},B.postMessage(JSON.stringify({language:S.language,code:S.code,immediateClose:!0}))}else P(a.highlight(S.code,S.grammar,S.language))},highlight:function(_,g,m){var y={code:_,grammar:g,language:m};if(a.hooks.run("before-tokenize",y),!y.grammar)throw new Error('The language "'+y.language+'" has no grammar.');return y.tokens=a.tokenize(y.code,y.grammar),a.hooks.run("after-tokenize",y),l.stringify(a.util.encode(y.tokens),y.language)},tokenize:function(_,g){var m=g.rest;if(m){for(var y in m)g[y]=m[y];delete g.rest}var w=new d;return h(w,w.head,_),u(_,w,g,w.head,0),p(w)},hooks:{all:{},add:function(_,g){var m=a.hooks.all;m[_]=m[_]||[],m[_].push(g)},run:function(_,g){var m=a.hooks.all[_];if(!(!m||!m.length))for(var y=0,w;w=m[y++];)w(g)}},Token:l};r.Prism=a;function l(_,g,m,y){this.type=_,this.content=g,this.alias=m,this.length=(y||"").length|0}l.stringify=function _(g,m){if(typeof g=="string")return g;if(Array.isArray(g)){var y="";return g.forEach(function(P){y+=_(P,m)}),y}var w={type:g.type,content:_(g.content,m),tag:"span",classes:["token",g.type],attributes:{},language:m},k=g.alias;k&&(Array.isArray(k)?Array.prototype.push.apply(w.classes,k):w.classes.push(k)),a.hooks.run("wrap",w);var x="";for(var S in w.attributes)x+=" "+S+'="'+(w.attributes[S]||"").replace(/"/g,""")+'"';return"<"+w.tag+' class="'+w.classes.join(" ")+'"'+x+">"+w.content+"</"+w.tag+">"};function c(_,g,m,y){_.lastIndex=g;var w=_.exec(m);if(w&&y&&w[1]){var k=w[1].length;w.index+=k,w[0]=w[0].slice(k)}return w}function u(_,g,m,y,w,k){for(var x in m)if(!(!m.hasOwnProperty(x)||!m[x])){var S=m[x];S=Array.isArray(S)?S:[S];for(var P=0;P<S.length;++P){if(k&&k.cause==x+","+P)return;var B=S[P],oe=B.inside,Ye=!!B.lookbehind,ve=!!B.greedy,R=B.alias;if(ve&&!B.pattern.global){var M=B.pattern.toString().match(/[imsuy]*$/)[0];B.pattern=RegExp(B.pattern.source,M+"g")}for(var ce=B.pattern||B,K=y.next,W=w;K!==g.tail&&!(k&&W>=k.reach);W+=K.value.length,K=K.next){var se=K.value;if(g.length>_.length)return;if(!(se instanceof l)){var Xe=1,be;if(ve){if(be=c(ce,W,_,Ye),!be||be.index>=_.length)break;var ye=be.index,wr=be.index+be[0].length,X=W;for(X+=K.value.length;ye>=X;)K=K.next,X+=K.value.length;if(X-=K.value.length,W=X,K.value instanceof l)continue;for(var Z=K;Z!==g.tail&&(X<wr||typeof Z.value=="string");Z=Z.next)Xe++,X+=Z.value.length;Xe--,se=_.slice(W,X),be.index-=W}else if(be=c(ce,0,se,Ye),!be)continue;var ye=be.index,Le=be[0],Ze=se.slice(0,ye),Te=se.slice(ye+Le.length),pt=W+se.length;k&&pt>k.reach&&(k.reach=pt);var Hn=K.prev;Ze&&(Hn=h(g,Hn,Ze),W+=Ze.length),f(g,Hn,Xe);var Is=new l(x,oe?a.tokenize(Le,oe):Le,R,Le);if(K=h(g,Hn,Is),Te&&h(g,K,Te),Xe>1){var un={cause:x+","+P,reach:pt};u(_,g,m,K.prev,W,un),k&&un.reach>k.reach&&(k.reach=un.reach)}}}}}}function d(){var _={value:null,prev:null,next:null},g={value:null,prev:_,next:null};_.next=g,this.head=_,this.tail=g,this.length=0}function h(_,g,m){var y=g.next,w={value:m,prev:g,next:y};return g.next=w,y.prev=w,_.length++,w}function f(_,g,m){for(var y=g.next,w=0;w<m&&y!==_.tail;w++)y=y.next;g.next=y,y.prev=g,_.length-=w}function p(_){for(var g=[],m=_.head.next;m!==_.tail;)g.push(m.value),m=m.next;return g}if(!r.document)return r.addEventListener&&(a.disableWorkerMessageHandler||r.addEventListener("message",function(_){var g=JSON.parse(_.data),m=g.language,y=g.code,w=g.immediateClose;r.postMessage(a.highlight(y,a.languages[m],m)),w&&r.close()},!1)),a;var v=a.util.currentScript();v&&(a.filename=v.src,v.hasAttribute("data-manual")&&(a.manual=!0));function b(){a.manual||a.highlightAll()}if(!a.manual){var E=document.readyState;E==="loading"||E==="interactive"&&v&&v.defer?document.addEventListener("DOMContentLoaded",b):window.requestAnimationFrame?window.requestAnimationFrame(b):window.setTimeout(b,16)}return a})(e);t.exports&&(t.exports=n),typeof Su<"u"&&(Su.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&/,"&"))}),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(r,s){var i={};i["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[s]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var o={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};o["language-"+s]={pattern:/[\s\S]+/,inside:n.languages[s]};var a={};a[r]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return r}),"i"),lookbehind:!0,greedy:!0,inside:o},n.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(r,s){n.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:n.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,(function(r){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var i=r.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))})(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),n.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),n.languages.markup&&(n.languages.markup.tag.addInlined("script","javascript"),n.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),n.languages.js=n.languages.javascript,(function(){if(typeof n>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",s=function(v,b){return"✖ Error "+v+" while fetching file: "+b},i="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},a="data-src-status",l="loading",c="loaded",u="failed",d="pre[data-src]:not(["+a+'="'+c+'"]):not(['+a+'="'+l+'"])';function h(v,b,E){var _=new XMLHttpRequest;_.open("GET",v,!0),_.onreadystatechange=function(){_.readyState==4&&(_.status<400&&_.responseText?b(_.responseText):_.status>=400?E(s(_.status,_.statusText)):E(i))},_.send(null)}function f(v){var b=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(v||"");if(b){var E=Number(b[1]),_=b[2],g=b[3];return _?g?[E,Number(g)]:[E,void 0]:[E,E]}}n.hooks.add("before-highlightall",function(v){v.selector+=", "+d}),n.hooks.add("before-sanity-check",function(v){var b=v.element;if(b.matches(d)){v.code="",b.setAttribute(a,l);var E=b.appendChild(document.createElement("CODE"));E.textContent=r;var _=b.getAttribute("data-src"),g=v.language;if(g==="none"){var m=(/\.(\w+)$/.exec(_)||[,"none"])[1];g=o[m]||m}n.util.setLanguage(E,g),n.util.setLanguage(b,g);var y=n.plugins.autoloader;y&&y.loadLanguages(g),h(_,function(w){b.setAttribute(a,c);var k=f(b.getAttribute("data-range"));if(k){var x=w.split(/\r\n?|\n/g),S=k[0],P=k[1]==null?x.length:k[1];S<0&&(S+=x.length),S=Math.max(0,Math.min(S-1,x.length)),P<0&&(P+=x.length),P=Math.max(0,Math.min(P,x.length)),w=x.slice(S,P).join(`
|
|
123
|
+
`),b.hasAttribute("data-start")||b.setAttribute("data-start",String(S+1))}E.textContent=w,n.highlightElement(E)},function(w){b.setAttribute(a,u),E.textContent=w})}}),n.plugins.fileHighlight={highlight:function(v){for(var b=(v||document).querySelectorAll(d),E=0,_;_=b[E++];)n.highlightElement(_)}};var p=!1;n.fileHighlight=function(){p||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),p=!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(Tu)),Tu.exports}var Jb=Vb();const Au=Kb(Jb);var Yb={},Ru;function Xb(){return Ru||(Ru=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),Yb}Xb();var Zb={},Ou;function Qb(){return Ou||(Ou=1,(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var e=t.languages.extend("typescript",{});delete e["class-name"],t.languages.typescript["class-name"].inside=e,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),t.languages.ts=t.languages.typescript})(Prism)),Zb}Qb(),(function(t){var e="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+e),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+e),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+e),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+e),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=t.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=r.variable[1].inside,o=0;o<s.length;o++)i[s[o]]=t.languages.bash[s[o]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism),Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json,(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism),Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(t,e){var n={};n["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[e]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var s={};s[t]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",s)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(t,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};const ey={js:"javascript",ts:"typescript",shell:"bash",sh:"bash",html:"markup",xml:"markup"};F.setOptions({breaks:!0,gfm:!0});const Iu=new F.Renderer;Iu.code=({text:t,lang:e})=>{const n=e?ey[e]||e:"plaintext",r=Au.languages[n];if(r){const s=Au.highlight(t,r,n);return`<pre><code class="language-${n}">${s}</code></pre>`}return`<pre><code>${t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</code></pre>`},F.use({renderer:Iu});function ty(t){return F.parse(t)}const ny="https://005d25250a41bd0071570b0c0a2b2c4d@o4510467570073600.ingest.us.sentry.io/4510472944156672",ry=["@useknest","useknest","widget-core","widget-web","widget-react","widget.umd.js","widget.js","knest"];function sy(t){if(t.tags?.source==="knest-widget")return!0;const e=t.exception?.values?.[0]?.stacktrace?.frames;return!e||e.length===0?!1:e.some(n=>{const r=n.filename||"";return ry.some(s=>r.includes(s))})}let $u=!1;function Cu(){$u||(Ab({dsn:ny,tracesSampleRate:0,integrations:[gu({console:!1,dom:!0,fetch:!0,history:!1,xhr:!1})],initialScope:{tags:{source:"knest-widget"}},beforeSend(t){return sy(t)?t:null}}),$u=!0)}function iy(t,e){const n=typeof t=="string"?new Error(t):t;Pc(n,{tags:{source:"knest-widget"},extra:e})}function oy(t,e){const n=Wb();if(!n)return()=>{};const r=n.channel(`thread:${t}`).on("broadcast",{event:"new-message"},s=>{e(s.payload)}).subscribe();return()=>{r.unsubscribe()}}var ay=ee('<div class="user-avatar svelte-19vup0k">AI</div>'),ly=ee('<img alt="Avatar" class="avatar-img svelte-19vup0k"/>'),cy=ee('<div class="user-avatar svelte-19vup0k">U</div>'),uy=ee('<div class="message-avatar svelte-19vup0k"><!></div>'),dy=ee('<div class="loading svelte-19vup0k"><div class="dot svelte-19vup0k"></div> <div class="dot svelte-19vup0k"></div> <div class="dot svelte-19vup0k"></div></div>'),hy=ee('<div class="source-breadcrumb svelte-19vup0k"> </div>'),fy=ee('<a target="_blank" rel="noopener noreferrer" class="source-item svelte-19vup0k"><svg class="source-icon svelte-19vup0k" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.746 0 3.332.477 4.5 1.253v13C19.832 18.477 18.246 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" class="svelte-19vup0k"></path></svg> <div class="source-text svelte-19vup0k"><!> <div class="source-title svelte-19vup0k"> </div></div></a>'),py=ee('<div class="sources svelte-19vup0k"><div class="sources-label svelte-19vup0k">Sources</div> <!></div>'),gy=ee('<div class="message-wrapper svelte-19vup0k"><div class="message svelte-19vup0k"><!> <div class="message-content svelte-19vup0k"><!> <!></div></div></div>');const _y={hash:"svelte-19vup0k",code:`.message-wrapper.svelte-19vup0k {display:flex;flex-direction:column;}.message.svelte-19vup0k {display:flex;gap:1rem;padding:1.25rem 1.5rem;align-items:center;}.message-avatar.svelte-19vup0k {display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;flex-shrink:0;}.avatar-img.svelte-19vup0k {width:100%;height:100%;border-radius:0.25rem;object-fit:contain;}.user-avatar.svelte-19vup0k {width:2rem;height:2rem;border-radius:0.25rem;display:flex;align-items:center;justify-content:center;color:white;font-size:0.875rem;font-weight:500;}.message-content.svelte-19vup0k {flex:1;min-width:0;}.message-content.svelte-19vup0k p {margin:0 0 0.5rem 0;font-size:0.875rem;line-height:1.625;color:inherit;word-wrap:break-word;}.message-content.svelte-19vup0k p:last-child {margin-bottom:0;}.message-content.svelte-19vup0k code {background-color:#f3f4f6;padding:0.125rem 0.375rem;border-radius:0.25rem;font-family:ui-monospace, monospace;font-size:0.8125rem;color:#ef4444;}.message-content.svelte-19vup0k pre {background-color:#1f2937;color:#f9fafb;padding:12px;border-radius:6px;overflow-x:auto;margin:8px 0;font-size:0.8125rem;line-height:1.5;}.message-content.svelte-19vup0k pre code {background-color:transparent;padding:0;color:inherit;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;}
|
|
124
124
|
|
|
125
125
|
/* Prism.js syntax highlighting - GitHub Dark theme */.message-content.svelte-19vup0k .token.keyword,
|
|
126
126
|
.message-content.svelte-19vup0k .token.builtin,
|
|
@@ -142,7 +142,7 @@ Url: ${Es(t)}`),!0}return!1}function Bm(t,e){return e?.length?qc(t).some(n=>gs(n
|
|
|
142
142
|
40% {
|
|
143
143
|
transform: scale(1);
|
|
144
144
|
}
|
|
145
|
-
}.sources.svelte-19vup0k {margin-top:0.75rem;}.sources-label.svelte-19vup0k {font-size:0.75rem;font-weight:500;color:#6b7280;margin-bottom:0.5rem;}.source-item.svelte-19vup0k {display:flex;gap:0.5rem;padding:0.5rem 0.75rem;margin-bottom:0.25rem;border:1px solid #e5e7eb;border-radius:0.375rem;background:#f9fafb;text-decoration:none;transition:all 0.15s;}.source-item.svelte-19vup0k:hover {border-color:#d1d5db;background:#f3f4f6;}.source-icon.svelte-19vup0k {width:1rem;height:1rem;color:#6b7280;flex-shrink:0;}.source-text.svelte-19vup0k {flex:1;min-width:0;}.source-breadcrumb.svelte-19vup0k {font-size:0.75rem;color:#6b7280;margin-bottom:0.125rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.source-title.svelte-19vup0k {font-size:0.875rem;font-weight:500;color:#374151;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}`};function ko(t,e){Cr(e,!0),
|
|
145
|
+
}.sources.svelte-19vup0k {margin-top:0.75rem;}.sources-label.svelte-19vup0k {font-size:0.75rem;font-weight:500;color:#6b7280;margin-bottom:0.5rem;}.source-item.svelte-19vup0k {display:flex;gap:0.5rem;padding:0.5rem 0.75rem;margin-bottom:0.25rem;border:1px solid #e5e7eb;border-radius:0.375rem;background:#f9fafb;text-decoration:none;transition:all 0.15s;}.source-item.svelte-19vup0k:hover {border-color:#d1d5db;background:#f3f4f6;}.source-icon.svelte-19vup0k {width:1rem;height:1rem;color:#6b7280;flex-shrink:0;}.source-text.svelte-19vup0k {flex:1;min-width:0;}.source-breadcrumb.svelte-19vup0k {font-size:0.75rem;color:#6b7280;margin-bottom:0.125rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.source-title.svelte-19vup0k {font-size:0.875rem;font-weight:500;color:#374151;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}`};function ko(t,e){Cr(e,!0),Ra(t,_y);let n=Ce(e,"message"),r=Ce(e,"isLoading",7,!1),s=Ce(e,"avatarUrl",7,"/default-avatar.svg"),i=Ce(e,"brandColor",7,wo),o=Ce(e,"showAvatar",7,!0),a=Q(!1);function l(){j(a,!0)}var c={get message(){return n()},set message(m){n(m),de()},get isLoading(){return r()},set isLoading(m=!1){r(m),de()},get avatarUrl(){return s()},set avatarUrl(m="/default-avatar.svg"){s(m),de()},get brandColor(){return i()},set brandColor(m=wo){i(m),de()},get showAvatar(){return o()},set showAvatar(m=!0){o(m),de()}},u=gy(),d=J(u),h=J(d);{var f=m=>{var y=uy(),w=J(y);{var k=S=>{var P=Qn(),B=qt(P);{var oe=ve=>{var R=ay();tt(()=>Wr(R,`background-color: ${i()??""}`)),q(ve,R)},Ye=ve=>{var R=ly();tt(()=>er(R,"src",s())),ka("error",R,l),jd(R),q(ve,R)};pe(B,ve=>{T(a)?ve(oe):ve(Ye,!1)})}q(S,P)},x=S=>{var P=cy();tt(()=>Wr(P,`background-color: ${i()??""}`)),q(S,P)};pe(w,S=>{n().role==="assistant"?S(k):S(x,!1)})}V(y),q(m,y)};pe(h,m=>{o()&&m(f)})}var p=Oe(h,2),v=J(p);{var b=m=>{var y=dy();q(m,y)},E=m=>{var y=Qn(),w=qt(y);Vd(w,()=>ty(n().content)),q(m,y)};pe(v,m=>{!n().content&&r()&&n().role==="assistant"?m(b):m(E,!1)})}var _=Oe(v,2);{var g=m=>{var y=py(),w=Oe(J(y),2);Qs(w,17,()=>n().sources.slice(0,1),Zs,(k,x)=>{var S=fy(),P=Oe(J(S),2),B=J(P);{var oe=R=>{var M=hy(),ce=J(M,!0);V(M),tt(()=>zr(ce,T(x).breadcrumb)),q(R,M)};pe(B,R=>{T(x).breadcrumb&&R(oe)})}var Ye=Oe(B,2),ve=J(Ye,!0);V(Ye),V(P),V(S),tt(()=>{er(S,"href",T(x).url),zr(ve,T(x).title)}),q(k,S)}),V(y),q(m,y)};pe(_,m=>{n().sources&&n().sources.length>0&&m(g)})}return V(p),V(d),V(u),q(t,u),Pr(c)}si(ko,{message:{},isLoading:{},avatarUrl:{},brandColor:{},showAvatar:{}},[],[],!0);var my=ee('<div class="loading-container svelte-7fg7a1"><div class="loading-content svelte-7fg7a1"><div class="spinner-ring svelte-7fg7a1"></div> <p class="loading-text svelte-7fg7a1">Loading chat...</p></div></div>'),vy=ee('<div class="error-container svelte-7fg7a1"><div class="error-content svelte-7fg7a1"><p class="error-text svelte-7fg7a1"> </p></div></div>'),by=ee('<div class="separator svelte-7fg7a1"></div>'),yy=ee("<!> <!>",1),wy=(t,e,n)=>e(T(n)),Ey=ee('<button class="example-btn svelte-7fg7a1"> </button>'),ky=ee('<div class="examples svelte-7fg7a1"><h3 class="svelte-7fg7a1">Example Questions</h3> <!></div>'),Sy=ee('<div class="footer svelte-7fg7a1"><a href="https://useknest.com" target="_blank" rel="noopener noreferrer" class="powered-by svelte-7fg7a1"><span>Powered by</span> <svg width="14" height="14" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="16" cy="16" r="3" fill="currentColor"></circle><path d="M16 6 A10 10 0 0 1 26 16" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" fill="none"></path><path d="M26 16 A10 10 0 0 1 16 26" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" fill="none"></path><path d="M16 26 A10 10 0 0 1 6 16" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" fill="none"></path><path d="M6 16 A10 10 0 0 1 16 6" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" fill="none"></path><circle cx="16" cy="5" r="2" fill="currentColor"></circle><circle cx="27" cy="16" r="2" fill="currentColor"></circle><circle cx="16" cy="27" r="2" fill="currentColor"></circle><circle cx="5" cy="16" r="2" fill="currentColor"></circle><circle cx="23" cy="9" r="1.5" fill="currentColor"></circle><circle cx="23" cy="23" r="1.5" fill="currentColor"></circle><circle cx="9" cy="23" r="1.5" fill="currentColor"></circle><circle cx="9" cy="9" r="1.5" fill="currentColor"></circle></svg> <span>Knest</span></a></div>'),Ty=ee('<div class="messages-container svelte-7fg7a1"><!> <!> <div></div></div> <div class="input-section svelte-7fg7a1"><div class="input-wrapper svelte-7fg7a1"><input type="text" placeholder="Ask me anything..." class="input-field svelte-7fg7a1"/> <button class="send-btn svelte-7fg7a1" aria-label="Send message"><svg class="send-icon svelte-7fg7a1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"></path></svg></button></div> <!></div>',1),xy=ee('<div class="chat-card svelte-7fg7a1"><!></div>'),Ay=ee('<div class="bubble-panel svelte-7fg7a1"><!></div>'),Ry=(t,e)=>j(e,!T(e)),Oy=Ys('<svg width="24" height="24" viewBox="0 0 24 24" fill="none" class="bubble-spinner svelte-7fg7a1"><circle cx="12" cy="12" r="9" stroke="currentColor" stroke-opacity="0.25" stroke-width="3" fill="none"></circle><path d="M12 3a9 9 0 0 1 9 9" stroke="currentColor" stroke-width="3" stroke-linecap="round" fill="none"></path></svg>'),Iy=Ys('<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"></path></svg>'),$y=Ys('<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path></svg>'),Cy=ee('<div class="bubble-container svelte-7fg7a1"><!> <button class="bubble-button svelte-7fg7a1"><!></button></div>');const Py={hash:"svelte-7fg7a1",code:`:host {display:block;font-family:system-ui,
|
|
146
146
|
-apple-system,
|
|
147
147
|
sans-serif;}.chat-card.svelte-7fg7a1 {display:flex;flex-direction:column;height:600px;background:white;color:#374151;border-radius:1rem;box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1);overflow:hidden;}.loading-container.svelte-7fg7a1 {display:flex;align-items:center;justify-content:center;height:100%;background:linear-gradient(135deg, #fdfbf7 0%, #ffffff 100%);}.loading-content.svelte-7fg7a1 {display:flex;flex-direction:column;align-items:center;gap:1.5rem;}.spinner-ring.svelte-7fg7a1 {width:3rem;height:3rem;border:3px solid #f3f4f6;border-top-color:#3b82f6;border-radius:50%;
|
|
148
148
|
animation: svelte-7fg7a1-spin 0.8s linear infinite;}
|
|
@@ -158,4 +158,4 @@ Url: ${Es(t)}`),!0}return!1}function Bm(t,e){return e?.length?qc(t).some(n=>gs(n
|
|
|
158
158
|
animation: svelte-7fg7a1-spin 1s linear infinite;}.bubble-panel.svelte-7fg7a1 {width:380px;height:520px;max-width:calc(100vw - 48px);max-height:calc(100vh - 100px);border-radius:1rem;border:1px solid rgba(0, 0, 0, 0.1);box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1);overflow:hidden;}.bubble-panel.svelte-7fg7a1 .chat-card:where(.svelte-7fg7a1) {height:100%;}
|
|
159
159
|
|
|
160
160
|
@media (max-width: 440px) {.bubble-container.svelte-7fg7a1 {bottom:16px;right:16px;}.bubble-panel.svelte-7fg7a1 {width:calc(100vw - 32px);height:calc(100vh - 100px);}
|
|
161
|
-
}`};function Pu(t,e){Cr(e,!0),
|
|
161
|
+
}`};function Pu(t,e){Cr(e,!0),Ra(t,Py);const n=R=>{var M=xy(),ce=J(M);{var K=se=>{var Xe=my();q(se,Xe)},W=se=>{var Xe=Qn(),be=qt(Xe);{var wr=Z=>{var ye=vy(),Le=J(ye),Ze=J(Le),Te=J(Ze,!0);V(Ze),V(Le),V(ye),tt(()=>zr(Te,Eu)),q(Z,ye)},X=Z=>{var ye=Ty(),Le=qt(ye),Ze=J(Le);Qs(Ze,17,()=>T(p),Zs,(we,gt,To)=>{var $s=yy(),kr=qt($s);{let hn=Kn(()=>!T(gt).content&&T(b)&&T(gt).role==="assistant");ko(kr,{get message(){return T(gt)},get isLoading(){return T(hn)},get avatarUrl(){return T(d)},get brandColor(){return T(f)}})}var xo=Oe(kr,2);{var dn=hn=>{var Dy=by();q(hn,Dy)};pe(xo,hn=>{To<T(p).length-1&&hn(dn)})}q(we,$s)});var Te=Oe(Ze,2);{var pt=we=>{var gt=ky(),To=Oe(J(gt),2);Qs(To,17,()=>T(h),Zs,($s,kr,xo)=>{var dn=Ey();dn.__click=[wy,S,kr];var hn=J(dn,!0);V(dn),tt(()=>{Wr(dn,xo===0?`border-color: ${T(f)}; border-width: 2px;`:""),zr(hn,T(kr))}),q($s,dn)}),V(gt),q(we,gt)};pe(Te,we=>{T(p).length===1&&!T(l)&&we(pt)})}var Hn=Oe(Te,2);nh(Hn,we=>j(E,we),()=>T(E)),V(Le);var Is=Oe(Le,2),un=J(Is),Er=J(un);Zd(Er);var Nu=Oe(Er,2);Nu.__click=k,V(un);var Ny=Oe(un,2);{var Ly=we=>{var gt=Sy();q(we,gt)};pe(Ny,we=>{we(Ly)})}V(Is),tt(we=>{Er.disabled=T(b)||!T(u),Nu.disabled=we},[()=>T(b)||!T(v).trim()||!T(u)]),ka("keypress",Er,x),th(Er,()=>T(v),we=>j(v,we)),q(Z,ye)};pe(be,Z=>{T(c)==="auth"?Z(wr):Z(X,!1)},!0)}q(se,Xe)};pe(ce,se=>{T(l)?se(K):se(W,!1)})}V(M),q(R,M)};let r=Ce(e,"publishableApiKey"),s=Ce(e,"mode",7,"inline"),i=Ce(e,"defaultOpen",7,!1),o=Ce(e,"_internal"),a=Q(null),l=Q(!0),c=Q(null),u=Q(!1),d=Kn(()=>T(a)?.avatarUrl||Nb),h=Kn(()=>T(a)?.exampleQuestions||Db),f=Kn(()=>T(a)?.brandColor||wo),p=Q(Bt([])),v=Q(""),b=Q(!1),E=Q(void 0),_=Q(void 0),g=Q(Bt(i())),m=Q(!1),y=null;Wd(()=>{typeof requestIdleCallback<"u"?requestIdleCallback(()=>Cu()):setTimeout(()=>Cu(),0)}),Fr(()=>{if(!r()||T(m))return;j(m,!0);const R=o()?.supabaseUrl||Rb,M=o()?.supabaseAnonKey||Ob;y=qb(R,M),w()});async function w(){const R=await Bb(r(),o()?.baseUrl,M=>{j(a,M,!0)});if(R.error){j(c,R.error,!0),j(l,!1);return}if(j(a,R.config,!0),j(l,!1),j(p,[{role:"assistant",content:R.config?.welcomeMessage||Lb}],!0),y){const M=await y;M||console.warn("Widget auth initialization failed"),j(u,M,!0)}}Fr(()=>{T(p).length>0&&T(E)&&T(E).scrollIntoView({behavior:"smooth"})}),Fr(()=>!T(_)||!T(u)?void 0:oy(T(_),M=>{M.role==="human"&&j(p,T(p).some(ce=>ce.id===M.id)?T(p):[...T(p),{id:M.id,role:"assistant",content:M.content}],!0)}));async function k(){if(!T(v).trim()||T(b)||!T(u))return;const R=T(v).trim();j(v,""),j(b,!0),j(p,[...T(p),{role:"user",content:R}],!0);const M=T(p).length;j(p,[...T(p),{role:"assistant",content:""}],!0);let ce="",K=[];await Gb({publishableApiKey:r(),content:R,threadId:T(_),baseUrl:o()?.baseUrl,callbacks:{onInit:W=>{T(_)||j(_,W,!0)},onContent:W=>{ce+=W,j(p,[...T(p).slice(0,M),{role:"assistant",content:ce},...T(p).slice(M+1)],!0)},onComplete:W=>{K=W,j(p,[...T(p).slice(0,M),{role:"assistant",content:ce,sources:K},...T(p).slice(M+1)],!0)},onDone:({humanTakeover:W})=>{W&&j(p,[...T(p).slice(0,M),...T(p).slice(M+1)],!0)},onError:W=>{iy(W,{userMessage:R,threadId:T(_),baseUrl:o()?.baseUrl}),j(p,[...T(p).slice(0,M),{role:"assistant",content:`Error: ${W}`},...T(p).slice(M+1)],!0)}}}),j(b,!1)}function x(R){R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),k())}async function S(R){j(v,R,!0),await k()}var P={get publishableApiKey(){return r()},set publishableApiKey(R){r(R),de()},get mode(){return s()},set mode(R="inline"){s(R),de()},get defaultOpen(){return i()},set defaultOpen(R=!1){i(R),de()},get _internal(){return o()},set _internal(R){o(R),de()}},B=Qn(),oe=qt(B);{var Ye=R=>{n(R)},ve=R=>{const M=Kn(()=>T(l)?"#9ca3af":T(f));var ce=Cy(),K=J(ce);{var W=X=>{var Z=Ay(),ye=J(Z);n(ye),V(Z),q(X,Z)};pe(K,X=>{T(g)&&X(W)})}var se=Oe(K,2);se.__click=[Ry,g];var Xe=J(se);{var be=X=>{var Z=Oy();q(X,Z)},wr=X=>{var Z=Qn(),ye=qt(Z);{var Le=Te=>{var pt=Iy();q(Te,pt)},Ze=Te=>{var pt=$y();q(Te,pt)};pe(ye,Te=>{T(g)?Te(Le):Te(Ze,!1)},!0)}q(X,Z)};pe(Xe,X=>{T(l)?X(be):X(wr,!1)})}V(se),V(ce),tt(()=>{er(se,"aria-label",T(l)?"Loading chat":T(g)?"Close chat":"Open chat"),Wr(se,`background-color: ${T(M)??""}`)}),q(R,ce)};pe(oe,R=>{s()==="inline"?R(Ye):R(ve,!1)})}return q(t,B),Pr(P)}Fd(["click"]),si(Pu,{publishableApiKey:{},mode:{},defaultOpen:{},_internal:{}},[],[],!0);function So(t,e){Cr(e,!0);let n=Ce(e,"publishableApiKey"),r=Ce(e,"mode",7,"inline"),s=Ce(e,"defaultOpen",7,!1),i=Ce(e,"_internal");var o={get publishableApiKey(){return n()},set publishableApiKey(a){n(a),de()},get mode(){return r()},set mode(a="inline"){r(a),de()},get defaultOpen(){return s()},set defaultOpen(a=!1){s(a),de()},get _internal(){return i()},set _internal(a){i(a),de()}};return Pu(t,{get publishableApiKey(){return n()},get mode(){return r()},get defaultOpen(){return s()},get _internal(){return i()}}),Pr(o)}customElements.define("knest-chat",si(So,{publishableApiKey:{attribute:"publishable-api-key",type:"String"},mode:{attribute:"mode",type:"String"},defaultOpen:{attribute:"default-open",type:"Boolean"},_internal:{type:"Object"}},[],[],!0)),_t.ChatMessage=ko,_t.ChatWidget=So,_t.default=So,Object.defineProperties(_t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|