- Consolidated duplicate UndoManagers to single instance - Fixed connection promise to only resolve on 'connected' status - Fixed WebSocketProvider import (WebsocketProvider) - Added proper doc.destroy() cleanup - Renamed isPresenceInitialized property to avoid conflict Co-Authored-By: Paperclip <noreply@paperclip.ing>
1 line
410 KiB
JavaScript
1 line
410 KiB
JavaScript
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var r in i)("object"==typeof exports?exports:t)[r]=i[r]}}(globalThis,()=>(()=>{var t,e,i,r={8388(t,e,i){"use strict";i(3560),i(6395),i(5254),i(4104),i(7548),i(954),i(8803),i(9162),i(5385),i(9342),i(9152),i(2949),i(8723),i(4086),i(2277);var r=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))(function(n,s){function a(t){try{l(r.next(t))}catch(t){s(t)}}function o(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){t.done?n(t.value):new i(function(e){e(t.value)}).then(a,o)}l((r=r.apply(t,e||[])).next())})},n=this&&this.__generator||function(t,e){var i,r,n,s,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){var l=[s,o];if(i)throw TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&l[0]?r.return:l[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,l[1])).done)return n;switch(r=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){a.label=l[1];break}if(6===l[0]&&a.label<n[1]){a.label=n[1],n=l;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(l);break}n[2]&&a.ops.pop(),a.trys.pop();continue}l=e.call(t,a)}catch(t){l=[6,t],r=0}finally{i=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}},s=this;Object.defineProperty(e,"__esModule",{value:!0});var a=i(8058),o="browser-tabs-lock-key",l={key:function(t){return r(s,void 0,void 0,function(){return n(this,function(t){throw Error("Unsupported")})})},getItem:function(t){return r(s,void 0,void 0,function(){return n(this,function(t){throw Error("Unsupported")})})},clear:function(){return r(s,void 0,void 0,function(){return n(this,function(t){return[2,window.localStorage.clear()]})})},removeItem:function(t){return r(s,void 0,void 0,function(){return n(this,function(t){throw Error("Unsupported")})})},setItem:function(t,e){return r(s,void 0,void 0,function(){return n(this,function(t){throw Error("Unsupported")})})},keySync:function(t){return window.localStorage.key(t)},getItemSync:function(t){return window.localStorage.getItem(t)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(t){return window.localStorage.removeItem(t)},setItemSync:function(t,e){return window.localStorage.setItem(t,e)}};function c(t){return new Promise(function(e){return setTimeout(e,t)})}function u(t){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",i="",r=0;r<t;r++){var n=Math.floor(Math.random()*e.length);i+=e[n]}return i}e.default=function(){function t(e){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+u(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=e,void 0===t.waiters&&(t.waiters=[])}return t.prototype.acquireLock=function(e,i){return void 0===i&&(i=5e3),r(this,void 0,void 0,function(){var r,s,a,h,d,p,f;return n(this,function(n){switch(n.label){case 0:r=Date.now()+u(4),s=Date.now()+i,a=o+"-"+e,h=void 0===this.storageHandler?l:this.storageHandler,n.label=1;case 1:if(!(Date.now()<s))return[3,8];return[4,c(30)];case 2:if(n.sent(),null!==h.getItemSync(a))return[3,5];return d=this.id+"-"+e+"-"+r,[4,c(Math.floor(25*Math.random()))];case 3:return n.sent(),h.setItemSync(a,JSON.stringify({id:this.id,iat:r,timeoutKey:d,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,c(30)];case 4:if(n.sent(),null!==(p=h.getItemSync(a))&&(f=JSON.parse(p)).id===this.id&&f.iat===r)return this.acquiredIatSet.add(r),this.refreshLockWhileAcquired(a,r),[2,!0];return[3,7];case 5:return t.lockCorrector(void 0===this.storageHandler?l:this.storageHandler),[4,this.waitForSomethingToChange(s)];case 6:n.sent(),n.label=7;case 7:return r=Date.now()+u(4),[3,1];case 8:return[2,!1]}})})},t.prototype.refreshLockWhileAcquired=function(t,e){return r(this,void 0,void 0,function(){var i=this;return n(this,function(s){return setTimeout(function(){return r(i,void 0,void 0,function(){var i,r,s;return n(this,function(n){switch(n.label){case 0:return[4,a.default().lock(e)];case 1:if(n.sent(),!this.acquiredIatSet.has(e)||null===(r=(i=void 0===this.storageHandler?l:this.storageHandler).getItemSync(t)))return a.default().unlock(e),[2];return(s=JSON.parse(r)).timeRefreshed=Date.now(),i.setItemSync(t,JSON.stringify(s)),a.default().unlock(e),this.refreshLockWhileAcquired(t,e),[2]}})})},1e3),[2]})})},t.prototype.waitForSomethingToChange=function(e){return r(this,void 0,void 0,function(){return n(this,function(i){switch(i.label){case 0:return[4,new Promise(function(i){var r=!1,n=Date.now(),s=!1;function a(){if(s||(window.removeEventListener("storage",a),t.removeFromWaiting(a),clearTimeout(o),s=!0),!r){r=!0;var e=50-(Date.now()-n);e>0?setTimeout(i,e):i(null)}}window.addEventListener("storage",a),t.addToWaiting(a);var o=setTimeout(a,Math.max(0,e-Date.now()))})];case 1:return i.sent(),[2]}})})},t.addToWaiting=function(e){this.removeFromWaiting(e),void 0!==t.waiters&&t.waiters.push(e)},t.removeFromWaiting=function(e){void 0!==t.waiters&&(t.waiters=t.waiters.filter(function(t){return t!==e}))},t.notifyWaiters=function(){void 0!==t.waiters&&t.waiters.slice().forEach(function(t){return t()})},t.prototype.releaseLock=function(t){return r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return[4,this.releaseLock__private__(t)];case 1:return[2,e.sent()]}})})},t.prototype.releaseLock__private__=function(e){return r(this,void 0,void 0,function(){var i,r,s,c;return n(this,function(n){switch(n.label){case 0:if(i=void 0===this.storageHandler?l:this.storageHandler,r=o+"-"+e,null===(s=i.getItemSync(r)))return[2];if((c=JSON.parse(s)).id!==this.id)return[3,2];return[4,a.default().lock(c.iat)];case 1:n.sent(),this.acquiredIatSet.delete(c.iat),i.removeItemSync(r),a.default().unlock(c.iat),t.notifyWaiters(),n.label=2;case 2:return[2]}})})},t.lockCorrector=function(e){for(var i=Date.now()-5e3,r=[],n=0;;){var s=e.keySync(n);if(null===s)break;r.push(s),n++}for(var a=!1,l=0;l<r.length;l++){var c=r[l];if(c.includes(o)){var u=e.getItemSync(c);if(null!==u){var h=JSON.parse(u);(void 0===h.timeRefreshed&&h.timeAcquired<i||void 0!==h.timeRefreshed&&h.timeRefreshed<i)&&(e.removeItemSync(c),a=!0)}}}a&&t.notifyWaiters()},t.waiters=void 0,t}()},8058(t,e,i){"use strict";i(6395),i(3584),i(3560),Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){var t=this;this.locked=new Map,this.addToLocked=function(e,i){var r=t.locked.get(e);void 0===r?void 0===i?t.locked.set(e,[]):t.locked.set(e,[i]):void 0!==i&&(r.unshift(i),t.locked.set(e,r))},this.isLocked=function(e){return t.locked.has(e)},this.lock=function(e){return new Promise(function(i,r){t.isLocked(e)?t.addToLocked(e,i):(t.addToLocked(e),i())})},this.unlock=function(e){var i=t.locked.get(e);if(void 0===i||0===i.length)return void t.locked.delete(e);var r=i.pop();t.locked.set(e,i),void 0!==r&&setTimeout(r,0)}}return t.getInstance=function(){return void 0===t.instance&&(t.instance=new t),t.instance},t}();e.default=function(){return r.getInstance()}},547(t,e,i){i(5254),i(2301),i(498),i(807),i(5281),t.exports=function(t,e){if("string"!=typeof t)throw TypeError("Expected a string");for(var i,r=String(t),n="",s=!!e&&!!e.extended,a=!!e&&!!e.globstar,o=!1,l=e&&"string"==typeof e.flags?e.flags:"",c=0,u=r.length;c<u;c++)switch(i=r[c]){case"/":case"$":case"^":case"+":case".":case"(":case")":case"=":case"!":case"|":n+="\\"+i;break;case"?":if(s){n+=".";break}case"[":case"]":if(s){n+=i;break}case"{":if(s){o=!0,n+="(";break}case"}":if(s){o=!1,n+=")";break}case",":if(o){n+="|";break}n+="\\"+i;break;case"*":for(var h=r[c-1],d=1;"*"===r[c+1];)d++,c++;var p=r[c+1];a?d>1&&("/"===h||void 0===h)&&("/"===p||void 0===p)?(n+="((?:[^/]*(?:/|$))*)",c++):n+="([^/]*)":n+=".*";break;default:n+=i}return l&&~l.indexOf("g")||(n="^"+n+"$"),new RegExp(n,l)}},860(t,e,i){"use strict";var r=i(8039),n=i(5229),s=TypeError;t.exports=function(t){if(r(t))return t;throw new s(n(t)+" is not a function")}},114(t,e,i){"use strict";var r=i(9811),n=i(5229),s=TypeError;t.exports=function(t){if(r(t))return t;throw new s(n(t)+" is not a constructor")}},216(t,e,i){"use strict";var r=i(643),n=String,s=TypeError;t.exports=function(t){if(r(t))return t;throw new s("Can't set "+n(t)+" as a prototype")}},7234(t,e,i){"use strict";var r=i(8260).has;t.exports=function(t){return r(t),t}},1643(t,e,i){"use strict";var r=i(5869),n=i(2326),s=i(3919).f,a=r("unscopables"),o=Array.prototype;void 0===o[a]&&s(o,a,{configurable:!0,value:n(null)}),t.exports=function(t){o[a][t]=!0}},2287(t,e,i){"use strict";var r=i(8445).charAt;t.exports=function(t,e,i){return e+(i?r(t,e).length:1)}},473(t,e,i){"use strict";var r=i(6227),n=TypeError;t.exports=function(t,e){if(r(e,t))return t;throw new n("Incorrect invocation")}},6177(t,e,i){"use strict";var r=i(8188),n=String,s=TypeError;t.exports=function(t){if(r(t))return t;throw new s(n(t)+" is not an object")}},3869(t){"use strict";t.exports="u">typeof ArrayBuffer&&"u">typeof DataView},2144(t,e,i){"use strict";var r=i(6974),n=i(6572),s=i(4026),a=r.ArrayBuffer,o=r.TypeError;t.exports=a&&n(a.prototype,"byteLength","get")||function(t){if("ArrayBuffer"!==s(t))throw new o("ArrayBuffer expected");return t.byteLength}},408(t,e,i){"use strict";var r=i(6974),n=i(3869),s=i(2144),a=r.DataView;t.exports=function(t){if(!n||0!==s(t))return!1;try{return new a(t),!1}catch(t){return!0}}},315(t,e,i){"use strict";var r=i(408),n=TypeError;t.exports=function(t){if(r(t))throw new n("ArrayBuffer is detached");return t}},2982(t,e,i){"use strict";var r=i(6974),n=i(2782),s=i(6572),a=i(6722),o=i(315),l=i(2144),c=i(7541),u=i(5698),h=r.structuredClone,d=r.ArrayBuffer,p=r.DataView,f=Math.min,_=d.prototype,g=p.prototype,v=n(_.slice),m=s(_,"resizable","get"),y=s(_,"maxByteLength","get"),w=n(g.getInt8),b=n(g.setInt8);t.exports=(u||c)&&function(t,e,i){var r,n=l(t),s=void 0===e?n:a(e),_=!m||!m(t);if(o(t),u&&(t=h(t,{transfer:[t]}),n===s&&(i||_)))return t;if(n>=s&&(!i||_))r=v(t,0,s);else{r=new d(s,i&&!_&&y?{maxByteLength:y(t)}:void 0);for(var g=new p(t),k=new p(r),S=f(s,n),A=0;A<S;A++)b(k,A,w(g,A))}return u||c(t),r}},7882(t,e,i){"use strict";var r,n,s,a=i(3869),o=i(9058),l=i(6974),c=i(8039),u=i(8188),h=i(6151),d=i(3485),p=i(5229),f=i(81),_=i(9430),g=i(7108),v=i(6227),m=i(9681),y=i(7261),w=i(5869),b=i(702),k=i(6935),S=k.enforce,A=k.get,I=l.Int8Array,U=I&&I.prototype,x=l.Uint8ClampedArray,C=x&&x.prototype,E=I&&m(I),P=U&&m(U),T=Object.prototype,O=l.TypeError,R=w("toStringTag"),M=b("TYPED_ARRAY_TAG"),N="TypedArrayConstructor",z=a&&!!y&&"Opera"!==d(l.opera),W=!1,F={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},D={BigInt64Array:8,BigUint64Array:8},L=function(t){var e=m(t);if(u(e)){var i=A(e);return i&&h(i,N)?i[N]:L(e)}},j=function(t){if(!u(t))return!1;var e=d(t);return h(F,e)||h(D,e)};for(r in F)(s=(n=l[r])&&n.prototype)?S(s)[N]=n:z=!1;for(r in D)(s=(n=l[r])&&n.prototype)&&(S(s)[N]=n);if((!z||!c(E)||E===Function.prototype)&&(E=function(){throw new O("Incorrect invocation")},z))for(r in F)l[r]&&y(l[r],E);if((!z||!P||P===T)&&(P=E.prototype,z))for(r in F)l[r]&&y(l[r].prototype,P);if(z&&m(C)!==P&&y(C,P),o&&!h(P,R))for(r in W=!0,g(P,R,{configurable:!0,get:function(){return u(this)?this[M]:void 0}}),F)l[r]&&f(l[r],M,r);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:z,TYPED_ARRAY_TAG:W&&M,aTypedArray:function(t){if(j(t))return t;throw new O("Target is not a typed array")},aTypedArrayConstructor:function(t){if(c(t)&&(!y||v(E,t)))return t;throw new O(p(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,i,r){if(o){if(i)for(var n in F){var s=l[n];if(s&&h(s.prototype,t))try{delete s.prototype[t]}catch(i){try{s.prototype[t]=e}catch(t){}}}(!P[t]||i)&&_(P,t,i?e:z&&U[t]||e,r)}},exportTypedArrayStaticMethod:function(t,e,i){var r,n;if(o){if(y){if(i){for(r in F)if((n=l[r])&&h(n,t))try{delete n[t]}catch(t){}}if(E[t]&&!i)return;try{return _(E,t,i?e:z&&E[t]||e)}catch(t){}}for(r in F)(n=l[r])&&(!n[t]||i)&&_(n,t,e)}},getTypedArrayConstructor:L,isView:function(t){if(!u(t))return!1;var e=d(t);return"DataView"===e||h(F,e)||h(D,e)},isTypedArray:j,TypedArray:E,TypedArrayPrototype:P}},1428(t,e,i){"use strict";var r=i(6974),n=i(2782),s=i(9058),a=i(3869),o=i(6916),l=i(81),c=i(7108),u=i(7597),h=i(9293),d=i(473),p=i(5825),f=i(7864),_=i(6722),g=i(1863),v=i(8484),m=i(9681),y=i(7261),w=i(5083),b=i(4766),k=i(3153),S=i(8770),A=i(2377),I=i(6935),U=o.PROPER,x=o.CONFIGURABLE,C="ArrayBuffer",E="DataView",P="prototype",T="Wrong index",O=I.getterFor(C),R=I.getterFor(E),M=I.set,N=r[C],z=N,W=z&&z[P],F=r[E],D=F&&F[P],L=Object.prototype,j=r.Array,B=r.RangeError,J=n(w),V=n([].reverse),K=v.pack,q=v.unpack,H=function(t){return[255&t]},G=function(t){return[255&t,t>>8&255]},$=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},Y=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},X=function(t){return K(g(t),23,4)},Q=function(t){return K(t,52,8)},Z=function(t,e,i){c(t[P],e,{configurable:!0,get:function(){return i(this)[e]}})},tt=function(t,e,i,r){var n=R(t),s=_(i);if(s+e>n.byteLength)throw new B(T);var a=n.bytes,o=s+n.byteOffset,l=b(a,o,o+e);return r?l:V(l)},te=function(t,e,i,r,n,s){var a=R(t),o=_(i),l=r(+n),c=!!s;if(o+e>a.byteLength)throw new B(T);for(var u=a.bytes,h=o+a.byteOffset,d=0;d<e;d++)u[h+d]=l[c?d:e-d-1]};if(a){var ti=U&&N.name!==C;!h(function(){N(1)})||!h(function(){new N(-1)})||h(function(){return new N,new N(1.5),new N(NaN),1!==N.length||ti&&!x})?((z=function(t){return d(this,W),k(new N(_(t)),this,z)})[P]=W,W.constructor=z,S(z,N)):ti&&x&&l(N,"name",C),y&&m(D)!==L&&y(D,L);var tr=new F(new z(2)),tn=n(D.setInt8);tr.setInt8(0,0x80000000),tr.setInt8(1,0x80000001),(tr.getInt8(0)||!tr.getInt8(1))&&u(D,{setInt8:function(t,e){tn(this,t,e<<24>>24)},setUint8:function(t,e){tn(this,t,e<<24>>24)}},{unsafe:!0})}else W=(z=function(t){d(this,W);var e=_(t);M(this,{type:C,bytes:J(j(e),0),byteLength:e}),s||(this.byteLength=e,this.detached=!1)})[P],D=(F=function(t,e,i){d(this,D),d(t,W);var r=O(t),n=r.byteLength,a=p(e);if(a<0||a>n)throw new B("Wrong offset");if(i=void 0===i?n-a:f(i),a+i>n)throw new B("Wrong length");M(this,{type:E,buffer:t,byteLength:i,byteOffset:a,bytes:r.bytes}),s||(this.buffer=t,this.byteLength=i,this.byteOffset=a)})[P],s&&(Z(z,"byteLength",O),Z(F,"buffer",R),Z(F,"byteLength",R),Z(F,"byteOffset",R)),u(D,{getInt8:function(t){return tt(this,1,t)[0]<<24>>24},getUint8:function(t){return tt(this,1,t)[0]},getInt16:function(t){var e=tt(this,2,t,arguments.length>1&&arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=tt(this,2,t,arguments.length>1&&arguments[1]);return e[1]<<8|e[0]},getInt32:function(t){return Y(tt(this,4,t,arguments.length>1&&arguments[1]))},getUint32:function(t){return Y(tt(this,4,t,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(t){return q(tt(this,4,t,arguments.length>1&&arguments[1]),23)},getFloat64:function(t){return q(tt(this,8,t,arguments.length>1&&arguments[1]),52)},setInt8:function(t,e){te(this,1,t,H,e)},setUint8:function(t,e){te(this,1,t,H,e)},setInt16:function(t,e){te(this,2,t,G,e,arguments.length>2&&arguments[2])},setUint16:function(t,e){te(this,2,t,G,e,arguments.length>2&&arguments[2])},setInt32:function(t,e){te(this,4,t,$,e,arguments.length>2&&arguments[2])},setUint32:function(t,e){te(this,4,t,$,e,arguments.length>2&&arguments[2])},setFloat32:function(t,e){te(this,4,t,X,e,arguments.length>2&&arguments[2])},setFloat64:function(t,e){te(this,8,t,Q,e,arguments.length>2&&arguments[2])}});A(z,C),A(F,E),t.exports={ArrayBuffer:z,DataView:F}},5083(t,e,i){"use strict";var r=i(2095),n=i(3108),s=i(2956);t.exports=function(t){for(var e=r(this),i=s(e),a=arguments.length,o=n(a>1?arguments[1]:void 0,i),l=a>2?arguments[2]:void 0,c=void 0===l?i:n(l,i);c>o;)e[o++]=t;return e}},1372(t,e,i){"use strict";var r=i(2956);t.exports=function(t,e,i){for(var n=0,s=arguments.length>2?i:r(e),a=new t(s);s>n;)a[n]=e[n++];return a}},7930(t,e,i){"use strict";var r=i(2254),n=i(3179),s=i(2095),a=i(5017),o=i(4623),l=i(9811),c=i(2956),u=i(4634),h=i(6563),d=i(8301),p=Array;t.exports=function(t){var e,i,f,_,g,v,m=s(t),y=l(this),w=arguments.length,b=w>1?arguments[1]:void 0,k=void 0!==b;k&&(b=r(b,w>2?arguments[2]:void 0));var S=d(m),A=0;if(S&&!(this===p&&o(S)))for(i=y?new this:[],g=(_=h(m,S)).next;!(f=n(g,_)).done;A++)v=k?a(_,b,[f.value,A],!0):f.value,u(i,A,v);else for(e=c(m),i=y?new this(e):p(e);e>A;A++)v=k?b(m[A],A):m[A],u(i,A,v);return i.length=A,i}},5383(t,e,i){"use strict";var r=i(1555),n=i(3108),s=i(2956),a=function(t){return function(e,i,a){var o,l=r(e),c=s(l);if(0===c)return!t&&-1;var u=n(a,c);if(t&&i!=i){for(;c>u;)if((o=l[u++])!=o)return!0}else for(;c>u;u++)if((t||u in l)&&l[u]===i)return t||u||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},1857(t,e,i){"use strict";var r=i(2254),n=i(4461),s=i(2095),a=i(2956),o=function(t){var e=1===t;return function(i,o,l){for(var c,u=s(i),h=n(u),d=a(h),p=r(o,l);d-- >0;)if(p(c=h[d],d,u))switch(t){case 0:return c;case 1:return d}return e?-1:void 0}};t.exports={findLast:o(0),findLastIndex:o(1)}},3831(t,e,i){"use strict";var r=i(2254),n=i(2782),s=i(4461),a=i(2095),o=i(2956),l=i(971),c=n([].push),u=function(t){var e=1===t,i=2===t,n=3===t,u=4===t,h=6===t,d=7===t,p=5===t||h;return function(f,_,g,v){for(var m,y,w=a(f),b=s(w),k=o(b),S=r(_,g),A=0,I=v||l,U=e?I(f,k):i||d?I(f,0):void 0;k>A;A++)if((p||A in b)&&(y=S(m=b[A],A,w),t))if(e)U[A]=y;else if(y)switch(t){case 3:return!0;case 5:return m;case 6:return A;case 2:c(U,m)}else switch(t){case 4:return!1;case 7:c(U,m)}return h?-1:n||u?u:U}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterReject:u(7)}},2604(t,e,i){"use strict";var r=i(9293);t.exports=function(t,e){var i=[][t];return!!i&&r(function(){i.call(null,e||function(){return 1},1)})}},184(t,e,i){"use strict";var r=i(860),n=i(2095),s=i(4461),a=i(2956),o=TypeError,l="Reduce of empty array with no initial value",c=function(t){return function(e,i,c,u){var h=n(e),d=s(h),p=a(h);if(r(i),0===p&&c<2)throw new o(l);var f=t?p-1:0,_=t?-1:1;if(c<2)for(;;){if(f in d){u=d[f],f+=_;break}if(f+=_,t?f<0:p<=f)throw new o(l)}for(;t?f>=0:p>f;f+=_)f in d&&(u=i(u,d[f],f,h));return u}};t.exports={left:c(!1),right:c(!0)}},7021(t,e,i){"use strict";var r=i(9058),n=i(7958),s=TypeError,a=Object.getOwnPropertyDescriptor;t.exports=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}()?function(t,e){if(n(t)&&!a(t,"length").writable)throw new s("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},4766(t,e,i){"use strict";t.exports=i(2782)([].slice)},1534(t,e,i){"use strict";var r=i(4766),n=Math.floor,s=function(t,e){var i=t.length;if(i<8)for(var a,o,l=1;l<i;){for(o=l,a=t[l];o&&e(t[o-1],a)>0;)t[o]=t[--o];o!==l++&&(t[o]=a)}else for(var c=n(i/2),u=s(r(t,0,c),e),h=s(r(t,c),e),d=u.length,p=h.length,f=0,_=0;f<d||_<p;)t[f+_]=f<d&&_<p?0>=e(u[f],h[_])?u[f++]:h[_++]:f<d?u[f++]:h[_++];return t};t.exports=s},5051(t,e,i){"use strict";var r=i(7958),n=i(9811),s=i(8188),a=i(5869)("species"),o=Array;t.exports=function(t){var e;return r(t)&&(n(e=t.constructor)&&(e===o||r(e.prototype))?e=void 0:s(e)&&null===(e=e[a])&&(e=void 0)),void 0===e?o:e}},971(t,e,i){"use strict";var r=i(5051);t.exports=function(t,e){return new(r(t))(0===e?0:e)}},4062(t,e,i){"use strict";var r=i(2956);t.exports=function(t,e){for(var i=r(t),n=new e(i),s=0;s<i;s++)n[s]=t[i-s-1];return n}},9718(t,e,i){"use strict";var r=i(2956),n=i(5825),s=RangeError;t.exports=function(t,e,i,a){var o=r(t),l=n(i),c=l<0?o+l:l;if(c>=o||c<0)throw new s("Incorrect index");for(var u=new e(o),h=0;h<o;h++)u[h]=h===c?a:t[h];return u}},5017(t,e,i){"use strict";var r=i(6177),n=i(5053);t.exports=function(t,e,i,s){try{return s?e(r(i)[0],i[1]):e(i)}catch(e){n(t,"throw",e)}}},366(t,e,i){"use strict";var r=i(5869)("iterator"),n=!1;try{var s=0,a={next:function(){return{done:!!s++}},return:function(){n=!0}};a[r]=function(){return this},Array.from(a,function(){throw 2})}catch(t){}t.exports=function(t,e){try{if(!e&&!n)return!1}catch(t){return!1}var i=!1;try{var s={};s[r]=function(){return{next:function(){return{done:i=!0}}}},t(s)}catch(t){}return i}},4026(t,e,i){"use strict";var r=i(2782),n=r({}.toString),s=r("".slice);t.exports=function(t){return s(n(t),8,-1)}},3485(t,e,i){"use strict";var r=i(3886),n=i(8039),s=i(4026),a=i(5869)("toStringTag"),o=Object,l="Arguments"===s(function(){return arguments}()),c=function(t,e){try{return t[e]}catch(t){}};t.exports=r?s:function(t){var e,i,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=c(e=o(t),a))?i:l?s(e):"Object"===(r=s(e))&&n(e.callee)?"Arguments":r}},8770(t,e,i){"use strict";var r=i(6151),n=i(3517),s=i(3069),a=i(3919);t.exports=function(t,e,i){for(var o=n(e),l=a.f,c=s.f,u=0;u<o.length;u++){var h=o[u];r(t,h)||i&&r(i,h)||l(t,h,c(e,h))}}},1109(t,e,i){"use strict";t.exports=!i(9293)(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},6827(t){"use strict";t.exports=function(t,e){return{value:t,done:e}}},81(t,e,i){"use strict";var r=i(9058),n=i(3919),s=i(6582);t.exports=r?function(t,e,i){return n.f(t,e,s(1,i))}:function(t,e,i){return t[e]=i,t}},6582(t){"use strict";t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},4634(t,e,i){"use strict";var r=i(9058),n=i(3919),s=i(6582);t.exports=function(t,e,i){r?n.f(t,e,s(0,i)):t[e]=i}},7108(t,e,i){"use strict";var r=i(2461),n=i(3919);t.exports=function(t,e,i){return i.get&&r(i.get,e,{getter:!0}),i.set&&r(i.set,e,{setter:!0}),n.f(t,e,i)}},9430(t,e,i){"use strict";var r=i(8039),n=i(3919),s=i(2461),a=i(5963);t.exports=function(t,e,i,o){o||(o={});var l=o.enumerable,c=void 0!==o.name?o.name:e;if(r(i)&&s(i,c,o),o.global)l?t[e]=i:a(e,i);else{try{o.unsafe?t[e]&&(l=!0):delete t[e]}catch(t){}l?t[e]=i:n.f(t,e,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return t}},7597(t,e,i){"use strict";var r=i(9430);t.exports=function(t,e,i){for(var n in e)r(t,n,e[n],i);return t}},5963(t,e,i){"use strict";var r=i(6974),n=Object.defineProperty;t.exports=function(t,e){try{n(r,t,{value:e,configurable:!0,writable:!0})}catch(i){r[t]=e}return e}},6152(t,e,i){"use strict";var r=i(5229),n=TypeError;t.exports=function(t,e){if(!delete t[e])throw new n("Cannot delete property "+r(e)+" of "+r(t))}},9058(t,e,i){"use strict";t.exports=!i(9293)(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},7541(t,e,i){"use strict";var r,n,s,a,o=i(6974),l=i(5423),c=i(5698),u=o.structuredClone,h=o.ArrayBuffer,d=o.MessageChannel,p=!1;if(c)p=function(t){u(t,{transfer:[t]})};else if(h)try{!d&&(r=l("worker_threads"))&&(d=r.MessageChannel),d&&(n=new d,s=new h(2),a=function(t){n.port1.postMessage(null,[t])},2===s.byteLength&&(a(s),0===s.byteLength&&(p=a)))}catch(t){}t.exports=p},5637(t,e,i){"use strict";var r=i(6974),n=i(8188),s=r.document,a=n(s)&&n(s.createElement);t.exports=function(t){return a?s.createElement(t):{}}},1959(t){"use strict";var e=TypeError;t.exports=function(t){if(t>0x1fffffffffffff)throw e("Maximum allowed index exceeded");return t}},4864(t){"use strict";t.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},1806(t){"use strict";t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},4098(t,e,i){"use strict";var r=i(5637)("span").classList,n=r&&r.constructor&&r.constructor.prototype;t.exports=n===Object.prototype?void 0:n},5985(t){"use strict";t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},1203(t,e,i){"use strict";var r=i(4857).match(/firefox\/(\d+)/i);t.exports=!!r&&+r[1]},3777(t,e,i){"use strict";var r=i(4857);t.exports=/MSIE|Trident/.test(r)},5587(t,e,i){"use strict";var r=i(4857);t.exports=/ipad|iphone|ipod/i.test(r)&&"u">typeof Pebble},7502(t,e,i){"use strict";var r=i(4857);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},5523(t,e,i){"use strict";t.exports="NODE"===i(229)},8338(t,e,i){"use strict";var r=i(4857);t.exports=/web0s(?!.*chrome)/i.test(r)},4857(t,e,i){"use strict";var r=i(6974).navigator,n=r&&r.userAgent;t.exports=n?String(n):""},6153(t,e,i){"use strict";var r,n,s=i(6974),a=i(4857),o=s.process,l=s.Deno,c=o&&o.versions||l&&l.version,u=c&&c.v8;u&&(n=(r=u.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!n&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(n=+r[1]),t.exports=n},2729(t,e,i){"use strict";var r=i(4857).match(/AppleWebKit\/(\d+)\./);t.exports=!!r&&+r[1]},229(t,e,i){"use strict";var r=i(6974),n=i(4857),s=i(4026),a=function(t){return n.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===s(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},747(t,e,i){"use strict";var r=i(2782),n=Error,s=r("".replace),a=String(new n("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,l=o.test(a);t.exports=function(t,e){if(l&&"string"==typeof t&&!n.prepareStackTrace)for(;e--;)t=s(t,o,"");return t}},7245(t,e,i){"use strict";var r=i(81),n=i(747),s=i(6041),a=Error.captureStackTrace;t.exports=function(t,e,i,o){s&&(a?a(t,e):r(t,"stack",n(i,o)))}},6041(t,e,i){"use strict";var r=i(9293),n=i(6582);t.exports=!r(function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",n(1,7)),7!==t.stack)})},4808(t,e,i){"use strict";var r=i(6974),n=i(3069).f,s=i(81),a=i(9430),o=i(5963),l=i(8770),c=i(6518);t.exports=function(t,e){var i,u,h,d,p,f=t.target,_=t.global,g=t.stat;if(i=_?r:g?r[f]||o(f,{}):r[f]&&r[f].prototype)for(u in e){if(d=e[u],h=t.dontCallGetSet?(p=n(i,u))&&p.value:i[u],!c(_?u:f+(g?".":"#")+u,t.forced)&&void 0!==h){if(typeof d==typeof h)continue;l(d,h)}(t.sham||h&&h.sham)&&s(d,"sham",!0),a(i,u,d,t)}}},9293(t){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},1298(t,e,i){"use strict";i(5281);var r=i(3179),n=i(9430),s=i(6565),a=i(9293),o=i(5869),l=i(81),c=o("species"),u=RegExp.prototype;t.exports=function(t,e,i,h){var d=o(t),p=!a(function(){var e={};return e[d]=function(){return 7},7!==""[t](e)}),f=p&&!a(function(){var e=!1,i=/a/;if("split"===t){var r={};r[c]=function(){return i},(i={constructor:r,flags:""})[d]=/./[d]}return i.exec=function(){return e=!0,null},i[d](""),!e});if(!p||!f||i){var _=/./[d],g=e(d,""[t],function(t,e,i,n,a){var o=e.exec;return o===s||o===u.exec?p&&!a?{done:!0,value:r(_,e,i,n)}:{done:!0,value:r(t,i,e,n)}:{done:!1}});n(String.prototype,t,g[0]),n(u,d,g[1])}h&&l(u[d],"sham",!0)}},6263(t,e,i){"use strict";var r=i(7470),n=Function.prototype,s=n.apply,a=n.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(s):function(){return a.apply(s,arguments)})},2254(t,e,i){"use strict";var r=i(3350),n=i(860),s=i(7470),a=r(r.bind);t.exports=function(t,e){return n(t),void 0===e?t:s?a(t,e):function(){return t.apply(e,arguments)}}},7470(t,e,i){"use strict";t.exports=!i(9293)(function(){var t=(function(){}).bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},3179(t,e,i){"use strict";var r=i(7470),n=Function.prototype.call;t.exports=r?n.bind(n):function(){return n.apply(n,arguments)}},6916(t,e,i){"use strict";var r=i(9058),n=i(6151),s=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,o=n(s,"name"),l=o&&(!r||r&&a(s,"name").configurable);t.exports={EXISTS:o,PROPER:o&&"something"===(function(){}).name,CONFIGURABLE:l}},6572(t,e,i){"use strict";var r=i(2782),n=i(860);t.exports=function(t,e,i){try{return r(n(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}}},3350(t,e,i){"use strict";var r=i(4026),n=i(2782);t.exports=function(t){if("Function"===r(t))return n(t)}},2782(t,e,i){"use strict";var r=i(7470),n=Function.prototype,s=n.call,a=r&&n.bind.bind(s,s);t.exports=r?a:function(t){return function(){return s.apply(t,arguments)}}},5423(t,e,i){"use strict";var r=i(6974),n=i(5523);t.exports=function(t){if(n){try{return r.process.getBuiltinModule(t)}catch(t){}try{return Function('return require("'+t+'")')()}catch(t){}}}},2485(t,e,i){"use strict";var r=i(6974),n=i(8039);t.exports=function(t,e){var i;return arguments.length<2?n(i=r[t])?i:void 0:r[t]&&r[t][e]}},9226(t){"use strict";t.exports=function(t){return{iterator:t,next:t.next,done:!1}}},8301(t,e,i){"use strict";var r=i(3485),n=i(5112),s=i(3563),a=i(9227),o=i(5869)("iterator");t.exports=function(t){if(!s(t))return n(t,o)||n(t,"@@iterator")||a[r(t)]}},6563(t,e,i){"use strict";var r=i(3179),n=i(860),s=i(6177),a=i(5229),o=i(8301),l=TypeError;t.exports=function(t,e){var i=arguments.length<2?o(t):e;if(n(i))return s(r(i,t));throw new l(a(t)+" is not iterable")}},5112(t,e,i){"use strict";var r=i(860),n=i(3563);t.exports=function(t,e){var i=t[e];return n(i)?void 0:r(i)}},5447(t,e,i){"use strict";var r=i(860),n=i(6177),s=i(3179),a=i(5825),o=i(9226),l="Invalid size",c=RangeError,u=TypeError,h=Math.max,d=function(t,e){this.set=t,this.size=h(e,0),this.has=r(t.has),this.keys=r(t.keys)};d.prototype={getIterator:function(){return o(n(s(this.keys,this.set)))},includes:function(t){return s(this.has,this.set,t)}},t.exports=function(t){n(t);var e=+t.size;if(e!=e)throw new u(l);var i=a(e);if(i<0)throw new c(l);return new d(t,i)}},7256(t,e,i){"use strict";var r=i(2782),n=i(2095),s=Math.floor,a=r("".charAt),o=r("".replace),l=r("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,u=/\$([$&'`]|\d{1,2})/g;t.exports=function(t,e,i,r,h,d){var p=i+t.length,f=r.length,_=u;return void 0!==h&&(h=n(h),_=c),o(d,_,function(n,o){var c;switch(a(o,0)){case"$":return"$";case"&":return t;case"`":return l(e,0,i);case"'":return l(e,p);case"<":c=h[l(o,1,-1)];break;default:var u=+o;if(0===u)return n;if(u>f){var d=s(u/10);if(0===d)return n;if(d<=f)return void 0===r[d-1]?a(o,1):r[d-1]+a(o,1);return n}c=r[u-1]}return void 0===c?"":c})}},6974(t,e,i){"use strict";var r=function(t){return t&&t.Math===Math&&t};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof i.g&&i.g)||r("object"==typeof this&&this)||function(){return this}()||Function("return this")()},6151(t,e,i){"use strict";var r=i(2782),n=i(2095),s=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return s(n(t),e)}},903(t){"use strict";t.exports={}},9823(t){"use strict";t.exports=function(t,e){try{1==arguments.length?console.error(t):console.error(t,e)}catch(t){}}},9247(t,e,i){"use strict";t.exports=i(2485)("document","documentElement")},299(t,e,i){"use strict";var r=i(9058),n=i(9293),s=i(5637);t.exports=!r&&!n(function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},8484(t){"use strict";var e=Array,i=Math.abs,r=Math.pow,n=Math.floor,s=Math.log,a=Math.LN2;t.exports={pack:function(t,o,l){var c,u,h,d=e(l),p=8*l-o-1,f=(1<<p)-1,_=f>>1,g=23===o?r(2,-24)-r(2,-77):0,v=+(t<0||0===t&&1/t<0),m=0;for((t=i(t))!=t||t===1/0?(u=+(t!=t),c=f):(h=r(2,-(c=n(s(t)/a))),t*h<1&&(c--,h*=2),c+_>=1?t+=g/h:t+=g*r(2,1-_),t*h>=2&&(c++,h/=2),c+_>=f?(u=0,c=f):c+_>=1?(u=(t*h-1)*r(2,o),c+=_):(u=t*r(2,_-1)*r(2,o),c=0));o>=8;)d[m++]=255&u,u/=256,o-=8;for(c=c<<o|u,p+=o;p>0;)d[m++]=255&c,c/=256,p-=8;return d[m-1]|=128*v,d},unpack:function(t,e){var i,n=t.length,s=8*n-e-1,a=(1<<s)-1,o=a>>1,l=s-7,c=n-1,u=t[c--],h=127&u;for(u>>=7;l>0;)h=256*h+t[c--],l-=8;for(i=h&(1<<-l)-1,h>>=-l,l+=e;l>0;)i=256*i+t[c--],l-=8;if(0===h)h=1-o;else{if(h===a)return i?NaN:u?-1/0:1/0;i+=r(2,e),h-=o}return(u?-1:1)*i*r(2,h-e)}}},4461(t,e,i){"use strict";var r=i(2782),n=i(9293),s=i(4026),a=Object,o=r("".split);t.exports=n(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"===s(t)?o(t,""):a(t)}:a},3153(t,e,i){"use strict";var r=i(8039),n=i(8188),s=i(7261);t.exports=function(t,e,i){var a,o;return s&&r(a=e.constructor)&&a!==i&&n(o=a.prototype)&&o!==i.prototype&&s(t,o),t}},9576(t,e,i){"use strict";var r=i(2782),n=i(8039),s=i(6851),a=r(Function.toString);n(s.inspectSource)||(s.inspectSource=function(t){return a(t)}),t.exports=s.inspectSource},5910(t,e,i){"use strict";var r=i(8188),n=i(81);t.exports=function(t,e){r(e)&&"cause"in e&&n(t,"cause",e.cause)}},6935(t,e,i){"use strict";var r,n,s,a=i(4232),o=i(6974),l=i(8188),c=i(81),u=i(6151),h=i(6851),d=i(6845),p=i(903),f="Object already initialized",_=o.TypeError,g=o.WeakMap;if(a||h.state){var v=h.state||(h.state=new g);v.get=v.get,v.has=v.has,v.set=v.set,r=function(t,e){if(v.has(t))throw new _(f);return e.facade=t,v.set(t,e),e},n=function(t){return v.get(t)||{}},s=function(t){return v.has(t)}}else{var m=d("state");p[m]=!0,r=function(t,e){if(u(t,m))throw new _(f);return e.facade=t,c(t,m,e),e},n=function(t){return u(t,m)?t[m]:{}},s=function(t){return u(t,m)}}t.exports={set:r,get:n,has:s,enforce:function(t){return s(t)?n(t):r(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=n(e)).type!==t)throw new _("Incompatible receiver, "+t+" required");return i}}}},4623(t,e,i){"use strict";var r=i(5869),n=i(9227),s=r("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(n.Array===t||a[s]===t)}},7958(t,e,i){"use strict";var r=i(4026);t.exports=Array.isArray||function(t){return"Array"===r(t)}},3633(t,e,i){"use strict";var r=i(3485);t.exports=function(t){var e=r(t);return"BigInt64Array"===e||"BigUint64Array"===e}},8039(t){"use strict";var e="object"==typeof document&&document.all;t.exports=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},9811(t,e,i){"use strict";var r=i(2782),n=i(9293),s=i(8039),a=i(3485),o=i(2485),l=i(9576),c=function(){},u=o("Reflect","construct"),h=/^\s*(?:class|function)\b/,d=r(h.exec),p=!h.test(c),f=function(t){if(!s(t))return!1;try{return u(c,[],t),!0}catch(t){return!1}},_=function(t){if(!s(t))return!1;switch(a(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!d(h,l(t))}catch(t){return!0}};_.sham=!0,t.exports=!u||n(function(){var t;return f(f.call)||!f(Object)||!f(function(){t=!0})||t})?_:f},6518(t,e,i){"use strict";var r=i(9293),n=i(8039),s=/#|\.prototype\./,a=function(t,e){var i=l[o(t)];return i===u||i!==c&&(n(e)?r(e):!!e)},o=a.normalize=function(t){return String(t).replace(s,".").toLowerCase()},l=a.data={},c=a.NATIVE="N",u=a.POLYFILL="P";t.exports=a},1037(t,e,i){"use strict";var r=i(8188),n=Math.floor;t.exports=Number.isInteger||function(t){return!r(t)&&isFinite(t)&&n(t)===t}},3563(t){"use strict";t.exports=function(t){return null==t}},8188(t,e,i){"use strict";var r=i(8039);t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},643(t,e,i){"use strict";var r=i(8188);t.exports=function(t){return r(t)||null===t}},1201(t){"use strict";t.exports=!1},7494(t,e,i){"use strict";var r=i(8188),n=i(4026),s=i(5869)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[s])?!!e:"RegExp"===n(t))}},2131(t,e,i){"use strict";var r=i(2485),n=i(8039),s=i(6227),a=i(5058),o=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return n(e)&&s(e.prototype,o(t))}},1885(t,e,i){"use strict";var r=i(3179);t.exports=function(t,e,i){for(var n,s,a=i?t:t.iterator,o=t.next;!(n=r(o,a)).done;)if(void 0!==(s=e(n.value)))return s}},2150(t,e,i){"use strict";var r=i(2254),n=i(3179),s=i(6177),a=i(5229),o=i(4623),l=i(2956),c=i(6227),u=i(6563),h=i(8301),d=i(5053),p=TypeError,f=function(t,e){this.stopped=t,this.result=e},_=f.prototype;t.exports=function(t,e,i){var g,v,m,y,w,b,k,S=i&&i.that,A=!!(i&&i.AS_ENTRIES),I=!!(i&&i.IS_RECORD),U=!!(i&&i.IS_ITERATOR),x=!!(i&&i.INTERRUPTED),C=r(e,S),E=function(t){return g&&d(g,"normal"),new f(!0,t)},P=function(t){return A?(s(t),x?C(t[0],t[1],E):C(t[0],t[1])):x?C(t,E):C(t)};if(I)g=t.iterator;else if(U)g=t;else{if(!(v=h(t)))throw new p(a(t)+" is not iterable");if(o(v)){for(m=0,y=l(t);y>m;m++)if((w=P(t[m]))&&c(_,w))return w;return new f(!1)}g=u(t,v)}for(b=I?t.next:g.next;!(k=n(b,g)).done;){try{w=P(k.value)}catch(t){d(g,"throw",t)}if("object"==typeof w&&w&&c(_,w))return w}return new f(!1)}},3795(t,e,i){"use strict";var r=i(5053);t.exports=function(t,e,i){for(var n=t.length-1;n>=0;n--)if(void 0!==t[n])try{i=r(t[n].iterator,e,i)}catch(t){e="throw",i=t}if("throw"===e)throw i;return i}},5053(t,e,i){"use strict";var r=i(3179),n=i(6177),s=i(5112);t.exports=function(t,e,i){var a,o;n(t);try{if(!(a=s(t,"return"))){if("throw"===e)throw i;return i}a=r(a,t)}catch(t){o=!0,a=t}if("throw"===e)throw i;if(o)throw a;return n(a),i}},652(t,e,i){"use strict";var r=i(6479).IteratorPrototype,n=i(2326),s=i(6582),a=i(2377),o=i(9227),l=function(){return this};t.exports=function(t,e,i,c){var u=e+" Iterator";return t.prototype=n(r,{next:s(+!c,i)}),a(t,u,!1,!0),o[u]=l,t}},1352(t,e,i){"use strict";var r=i(3179),n=i(2326),s=i(81),a=i(7597),o=i(5869),l=i(6935),c=i(5112),u=i(6479).IteratorPrototype,h=i(6827),d=i(5053),p=i(3795),f=o("toStringTag"),_="IteratorHelper",g="WrapForValidIterator",v="normal",m="throw",y=l.set,w=function(t){var e=l.getterFor(t?g:_);return a(n(u),{next:function(){var i=e(this);if(t)return i.nextHandler();if(i.done)return h(void 0,!0);try{var r=i.nextHandler();return i.returnHandlerResult?r:h(r,i.done)}catch(t){throw i.done=!0,t}},return:function(){var i=e(this),n=i.iterator;if(i.done=!0,t){var s=c(n,"return");return s?r(s,n):h(void 0,!0)}if(i.inner)try{d(i.inner.iterator,v)}catch(t){return d(n,m,t)}if(i.openIters)try{p(i.openIters,v)}catch(t){return d(n,m,t)}return n&&d(n,v),h(void 0,!0)}})},b=w(!0),k=w(!1);s(k,f,"Iterator Helper"),t.exports=function(t,e,i){var r=function(r,n){n?(n.iterator=r.iterator,n.next=r.next):n=r,n.type=e?g:_,n.returnHandlerResult=!!i,n.nextHandler=t,n.counter=0,n.done=!1,y(this,n)};return r.prototype=e?b:k,r}},2274(t,e,i){"use strict";var r=i(4808),n=i(3179),s=i(1201),a=i(6916),o=i(8039),l=i(652),c=i(9681),u=i(7261),h=i(2377),d=i(81),p=i(9430),f=i(5869),_=i(9227),g=i(6479),v=a.PROPER,m=a.CONFIGURABLE,y=g.IteratorPrototype,w=g.BUGGY_SAFARI_ITERATORS,b=f("iterator"),k="keys",S="values",A="entries",I=function(){return this};t.exports=function(t,e,i,a,f,g,U){l(i,e,a);var x,C,E,P=function(t){if(t===f&&N)return N;if(!w&&t&&t in R)return R[t];switch(t){case k:case S:case A:return function(){return new i(this,t)}}return function(){return new i(this)}},T=e+" Iterator",O=!1,R=t.prototype,M=R[b]||R["@@iterator"]||f&&R[f],N=!w&&M||P(f),z="Array"===e&&R.entries||M;if(z&&(x=c(z.call(new t)))!==Object.prototype&&x.next&&(!s&&c(x)!==y&&(u?u(x,y):o(x[b])||p(x,b,I)),h(x,T,!0,!0),s&&(_[T]=I)),v&&f===S&&M&&M.name!==S&&(!s&&m?d(R,"name",S):(O=!0,N=function(){return n(M,this)})),f)if(C={values:P(S),keys:g?N:P(k),entries:P(A)},U)for(E in C)!w&&!O&&E in R||p(R,E,C[E]);else r({target:e,proto:!0,forced:w||O},C);return(!s||U)&&R[b]!==N&&p(R,b,N,{name:f}),_[e]=N,C}},5682(t){"use strict";t.exports=function(t,e){var i="function"==typeof Iterator&&Iterator.prototype[t];if(i)try{i.call({next:null},e).next()}catch(t){return!0}}},6655(t,e,i){"use strict";var r=i(6974);t.exports=function(t,e){var i=r.Iterator,n=i&&i.prototype,s=n&&n[t],a=!1;if(s)try{s.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(t){t instanceof e||(a=!1)}if(!a)return s}},6479(t,e,i){"use strict";var r,n,s,a=i(9293),o=i(8039),l=i(8188),c=i(2326),u=i(9681),h=i(9430),d=i(5869),p=i(1201),f=d("iterator"),_=!1;[].keys&&("next"in(s=[].keys())?(n=u(u(s)))!==Object.prototype&&(r=n):_=!0),!l(r)||a(function(){var t={};return r[f].call(t)!==t})?r={}:p&&(r=c(r)),o(r[f])||h(r,f,function(){return this}),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:_}},9227(t){"use strict";t.exports={}},2956(t,e,i){"use strict";var r=i(7864);t.exports=function(t){return r(t.length)}},2461(t,e,i){"use strict";var r=i(2782),n=i(9293),s=i(8039),a=i(6151),o=i(9058),l=i(6916).CONFIGURABLE,c=i(9576),u=i(6935),h=u.enforce,d=u.get,p=String,f=Object.defineProperty,_=r("".slice),g=r("".replace),v=r([].join),m=o&&!n(function(){return 8!==f(function(){},"length",{value:8}).length}),y=String(String).split("String"),w=t.exports=function(t,e,i){"Symbol("===_(p(e),0,7)&&(e="["+g(p(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!a(t,"name")||l&&t.name!==e)&&(o?f(t,"name",{value:e,configurable:!0}):t.name=e),m&&i&&a(i,"arity")&&t.length!==i.arity&&f(t,"length",{value:i.arity});try{i&&a(i,"constructor")&&i.constructor?o&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=h(t);return a(r,"source")||(r.source=v(y,"string"==typeof e?e:"")),t};Function.prototype.toString=w(function(){return s(this)&&d(this).source||c(this)},"toString")},5834(t,e,i){"use strict";var r=i(1632),n=i(4356),s=Math.abs;t.exports=function(t,e,i,a){var o=+t,l=s(o),c=r(o);if(l<a)return c*n(l/a/e)*a*e;var u=(1+e/2220446049250313e-31)*l,h=u-(u-l);return h>i||h!=h?1/0*c:c*h}},1863(t,e,i){"use strict";var r=i(5834);t.exports=Math.fround||function(t){return r(t,11920928955078125e-23,34028234663852886e22,11754943508222875e-54)}},4356(t){"use strict";t.exports=function(t){return t+0x10000000000000-0x10000000000000}},1632(t){"use strict";t.exports=Math.sign||function(t){var e=+t;return 0===e||e!=e?e:e<0?-1:1}},3427(t){"use strict";var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var r=+t;return(r>0?i:e)(r)}},2885(t,e,i){"use strict";var r,n,s,a,o,l=i(6974),c=i(6255),u=i(2254),h=i(1523).set,d=i(8663),p=i(7502),f=i(5587),_=i(8338),g=i(5523),v=l.MutationObserver||l.WebKitMutationObserver,m=l.document,y=l.process,w=l.Promise,b=c("queueMicrotask");if(!b){var k=new d,S=function(){var t,e;for(g&&(t=y.domain)&&t.exit();e=k.get();)try{e()}catch(t){throw k.head&&r(),t}t&&t.enter()};p||g||_||!v||!m?!f&&w&&w.resolve?((a=w.resolve(void 0)).constructor=w,o=u(a.then,a),r=function(){o(S)}):g?r=function(){y.nextTick(S)}:(h=u(h,l),r=function(){h(S)}):(n=!0,s=m.createTextNode(""),new v(S).observe(s,{characterData:!0}),r=function(){s.data=n=!n}),b=function(t){k.head||r(),k.add(t)}}t.exports=b},3761(t,e,i){"use strict";var r=i(860),n=TypeError,s=function(t){var e,i;this.promise=new t(function(t,r){if(void 0!==e||void 0!==i)throw new n("Bad Promise constructor");e=t,i=r}),this.resolve=r(e),this.reject=r(i)};t.exports.f=function(t){return new s(t)}},4901(t,e,i){"use strict";var r=i(3641);t.exports=function(t,e){return void 0===t?arguments.length<2?"":e:r(t)}},7187(t,e,i){"use strict";var r=i(9058),n=i(2782),s=i(3179),a=i(9293),o=i(2262),l=i(4343),c=i(4639),u=i(2095),h=i(4461),d=Object.assign,p=Object.defineProperty,f=n([].concat);t.exports=!d||a(function(){if(r&&1!==d({b:1},d(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},i=Symbol("assign detection"),n="abcdefghijklmnopqrst";return t[i]=7,n.split("").forEach(function(t){e[t]=t}),7!==d({},t)[i]||o(d({},e)).join("")!==n})?function(t,e){for(var i=u(t),n=arguments.length,a=1,d=l.f,p=c.f;n>a;)for(var _,g=h(arguments[a++]),v=d?f(o(g),d(g)):o(g),m=v.length,y=0;m>y;)_=v[y++],(!r||s(p,g,_))&&(i[_]=g[_]);return i}:d},2326(t,e,i){"use strict";var r,n=i(6177),s=i(3827),a=i(5985),o=i(903),l=i(9247),c=i(5637),u=i(6845),h="prototype",d="script",p=u("IE_PROTO"),f=function(){},_=function(t){return"<"+d+">"+t+"</"+d+">"},g=function(t){t.write(_("")),t.close();var e=t.parentWindow.Object;return t=null,e},v=function(){var t,e=c("iframe");return e.style.display="none",l.appendChild(e),e.src=String("java"+d+":"),(t=e.contentWindow.document).open(),t.write(_("document.F=Object")),t.close(),t.F},m=function(){try{r=new ActiveXObject("htmlfile")}catch(t){}m="u">typeof document?document.domain&&r?g(r):v():g(r);for(var t=a.length;t--;)delete m[h][a[t]];return m()};o[p]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(f[h]=n(t),i=new f,f[h]=null,i[p]=t):i=m(),void 0===e?i:s.f(i,e)}},3827(t,e,i){"use strict";var r=i(9058),n=i(8636),s=i(3919),a=i(6177),o=i(1555),l=i(2262);e.f=r&&!n?Object.defineProperties:function(t,e){a(t);for(var i,r=o(e),n=l(e),c=n.length,u=0;c>u;)s.f(t,i=n[u++],r[i]);return t}},3919(t,e,i){"use strict";var r=i(9058),n=i(299),s=i(8636),a=i(6177),o=i(1611),l=TypeError,c=Object.defineProperty,u=Object.getOwnPropertyDescriptor,h="enumerable",d="configurable",p="writable";e.f=r?s?function(t,e,i){if(a(t),e=o(e),a(i),"function"==typeof t&&"prototype"===e&&"value"in i&&p in i&&!i[p]){var r=u(t,e);r&&r[p]&&(t[e]=i.value,i={configurable:d in i?i[d]:r[d],enumerable:h in i?i[h]:r[h],writable:!1})}return c(t,e,i)}:c:function(t,e,i){if(a(t),e=o(e),a(i),n)try{return c(t,e,i)}catch(t){}if("get"in i||"set"in i)throw new l("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},3069(t,e,i){"use strict";var r=i(9058),n=i(3179),s=i(4639),a=i(6582),o=i(1555),l=i(1611),c=i(6151),u=i(299),h=Object.getOwnPropertyDescriptor;e.f=r?h:function(t,e){if(t=o(t),e=l(e),u)try{return h(t,e)}catch(t){}if(c(t,e))return a(!n(s.f,t,e),t[e])}},2482(t,e,i){"use strict";var r=i(6730),n=i(5985).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,n)}},4343(t,e){"use strict";e.f=Object.getOwnPropertySymbols},9681(t,e,i){"use strict";var r=i(6151),n=i(8039),s=i(2095),a=i(6845),o=i(1109),l=a("IE_PROTO"),c=Object,u=c.prototype;t.exports=o?c.getPrototypeOf:function(t){var e=s(t);if(r(e,l))return e[l];var i=e.constructor;return n(i)&&e instanceof i?i.prototype:e instanceof c?u:null}},6227(t,e,i){"use strict";t.exports=i(2782)({}.isPrototypeOf)},6730(t,e,i){"use strict";var r=i(2782),n=i(6151),s=i(1555),a=i(5383).indexOf,o=i(903),l=r([].push);t.exports=function(t,e){var i,r=s(t),c=0,u=[];for(i in r)!n(o,i)&&n(r,i)&&l(u,i);for(;e.length>c;)n(r,i=e[c++])&&(~a(u,i)||l(u,i));return u}},2262(t,e,i){"use strict";var r=i(6730),n=i(5985);t.exports=Object.keys||function(t){return r(t,n)}},4639(t,e){"use strict";var i={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor;e.f=r&&!i.call({1:2},1)?function(t){var e=r(this,t);return!!e&&e.enumerable}:i},7261(t,e,i){"use strict";var r=i(6572),n=i(8188),s=i(5804),a=i(216);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=r(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,r){return s(i),a(r),n(i)&&(e?t(i,r):i.__proto__=r),i}}():void 0)},8424(t,e,i){"use strict";var r=i(3179),n=i(8039),s=i(8188),a=TypeError;t.exports=function(t,e){var i,o;if("string"===e&&n(i=t.toString)&&!s(o=r(i,t))||n(i=t.valueOf)&&!s(o=r(i,t))||"string"!==e&&n(i=t.toString)&&!s(o=r(i,t)))return o;throw new a("Can't convert object to primitive value")}},3517(t,e,i){"use strict";var r=i(2485),n=i(2782),s=i(2482),a=i(4343),o=i(6177),l=n([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=s.f(o(t)),i=a.f;return i?l(e,i(t)):e}},977(t,e,i){"use strict";t.exports=i(6974)},2181(t){"use strict";t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},3586(t,e,i){"use strict";var r=i(6974),n=i(5940),s=i(8039),a=i(6518),o=i(9576),l=i(5869),c=i(229),u=i(1201),h=i(6153),d=n&&n.prototype,p=l("species"),f=!1,_=s(r.PromiseRejectionEvent);t.exports={CONSTRUCTOR:a("Promise",function(){var t=o(n),e=t!==String(n);if(!e&&66===h||u&&!(d.catch&&d.finally))return!0;if(!h||h<51||!/native code/.test(t)){var i=new n(function(t){t(1)}),r=function(t){t(function(){},function(){})};if((i.constructor={})[p]=r,!(f=i.then(function(){})instanceof r))return!0}return!e&&("BROWSER"===c||"DENO"===c)&&!_}),REJECTION_EVENT:_,SUBCLASSING:f}},5940(t,e,i){"use strict";t.exports=i(6974).Promise},1864(t,e,i){"use strict";var r=i(6177),n=i(8188),s=i(3761);t.exports=function(t,e){if(r(t),n(e)&&e.constructor===t)return e;var i=s.f(t);return(0,i.resolve)(e),i.promise}},7435(t,e,i){"use strict";var r=i(5940),n=i(366);t.exports=i(3586).CONSTRUCTOR||!n(function(t){r.all(t).then(void 0,function(){})})},4122(t,e,i){"use strict";var r=i(3919).f;t.exports=function(t,e,i){i in t||r(t,i,{configurable:!0,get:function(){return e[i]},set:function(t){e[i]=t}})}},8663(t){"use strict";var e=function(){this.head=null,this.tail=null};e.prototype={add:function(t){var e={item:t,next:null},i=this.tail;i?i.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},t.exports=e},4464(t,e,i){"use strict";var r=i(3179),n=i(6177),s=i(8039),a=i(4026),o=i(6565),l=TypeError;t.exports=function(t,e){var i=t.exec;if(s(i)){var c=r(i,t,e);return null!==c&&n(c),c}if("RegExp"===a(t))return r(o,t,e);throw new l("RegExp#exec called on incompatible receiver")}},6565(t,e,i){"use strict";var r,n,s=i(3179),a=i(2782),o=i(3641),l=i(2337),c=i(7764),u=i(5219),h=i(2326),d=i(6935).get,p=i(5369),f=i(3596),_=u("native-string-replace",String.prototype.replace),g=RegExp.prototype.exec,v=g,m=a("".charAt),y=a("".indexOf),w=a("".replace),b=a("".slice),k=(n=/b*/g,s(g,r=/a/,"a"),s(g,n,"a"),0!==r.lastIndex||0!==n.lastIndex),S=c.BROKEN_CARET,A=void 0!==/()??/.exec("")[1];(k||A||S||p||f)&&(v=function(t){var e,i,r,n,a,c,u,p=d(this),f=o(t),I=p.raw;if(I)return I.lastIndex=this.lastIndex,e=s(v,I,f),this.lastIndex=I.lastIndex,e;var U=p.groups,x=S&&this.sticky,C=s(l,this),E=this.source,P=0,T=f;if(x&&(-1===y(C=w(C,"y",""),"g")&&(C+="g"),T=b(f,this.lastIndex),this.lastIndex>0&&(!this.multiline||this.multiline&&"\n"!==m(f,this.lastIndex-1))&&(E="(?: "+E+")",T=" "+T,P++),i=RegExp("^(?:"+E+")",C)),A&&(i=RegExp("^"+E+"$(?!\\s)",C)),k&&(r=this.lastIndex),n=s(g,x?i:this,T),x?n?(n.input=b(n.input,P),n[0]=b(n[0],P),n.index=this.lastIndex,this.lastIndex+=n[0].length):this.lastIndex=0:k&&n&&(this.lastIndex=this.global?n.index+n[0].length:r),A&&n&&n.length>1&&s(_,n[0],i,function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(n[a]=void 0)}),n&&U)for(a=0,n.groups=c=h(null);a<U.length;a++)c[(u=U[a])[0]]=n[u[1]];return n}),t.exports=v},6823(t,e,i){"use strict";var r=i(6974),n=i(9293),s=r.RegExp;t.exports={correct:!n(function(){var t=!0;try{s(".","d")}catch(e){t=!1}var e={},i="",r=t?"dgimsy":"gimsy",n=function(t,r){Object.defineProperty(e,t,{get:function(){return i+=r,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in t&&(a.hasIndices="d"),a)n(o,a[o]);return Object.getOwnPropertyDescriptor(s.prototype,"flags").get.call(e)!==r||i!==r})}},2337(t,e,i){"use strict";var r=i(6177);t.exports=function(){var t=r(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e}},1148(t,e,i){"use strict";var r=i(3179),n=i(6151),s=i(6227),a=i(6823),o=i(2337),l=RegExp.prototype;t.exports=a.correct?function(t){return t.flags}:function(t){return!a.correct&&s(l,t)&&!n(t,"flags")?r(o,t):t.flags}},7764(t,e,i){"use strict";var r=i(9293),n=i(6974).RegExp,s=r(function(){var t=n("a","y");return t.lastIndex=2,null!==t.exec("abcd")}),a=s||r(function(){return!n("a","y").sticky});t.exports={BROKEN_CARET:s||r(function(){var t=n("^r","gy");return t.lastIndex=2,null!==t.exec("str")}),MISSED_STICKY:a,UNSUPPORTED_Y:s}},5369(t,e,i){"use strict";var r=i(9293),n=i(6974).RegExp;t.exports=r(function(){var t=n(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)})},3596(t,e,i){"use strict";var r=i(9293),n=i(6974).RegExp;t.exports=r(function(){var t=n("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})},5804(t,e,i){"use strict";var r=i(3563),n=TypeError;t.exports=function(t){if(r(t))throw new n("Can't call method on "+t);return t}},6255(t,e,i){"use strict";var r=i(6974),n=i(9058),s=Object.getOwnPropertyDescriptor;t.exports=function(t){if(!n)return r[t];var e=s(r,t);return e&&e.value}},7988(t,e,i){"use strict";var r=i(8260),n=i(5475),s=r.Set,a=r.add;t.exports=function(t){var e=new s;return n(t,function(t){a(e,t)}),e}},5474(t,e,i){"use strict";var r=i(7234),n=i(8260),s=i(7988),a=i(1888),o=i(5447),l=i(5475),c=i(1885),u=n.has,h=n.remove;t.exports=function(t){var e=r(this),i=o(t),n=s(e);return a(e)<=i.size?l(e,function(t){i.includes(t)&&h(n,t)}):c(i.getIterator(),function(t){u(n,t)&&h(n,t)}),n}},8260(t,e,i){"use strict";var r=i(2782),n=Set.prototype;t.exports={Set:Set,add:r(n.add),has:r(n.has),remove:r(n.delete),proto:n}},8396(t,e,i){"use strict";var r=i(7234),n=i(8260),s=i(1888),a=i(5447),o=i(5475),l=i(1885),c=n.Set,u=n.add,h=n.has;t.exports=function(t){var e=r(this),i=a(t),n=new c;return s(e)>i.size?l(i.getIterator(),function(t){h(e,t)&&u(n,t)}):o(e,function(t){i.includes(t)&&u(n,t)}),n}},6839(t,e,i){"use strict";var r=i(7234),n=i(8260).has,s=i(1888),a=i(5447),o=i(5475),l=i(1885),c=i(5053);t.exports=function(t){var e=r(this),i=a(t);if(s(e)<=i.size)return!1!==o(e,function(t){if(i.includes(t))return!1},!0);var u=i.getIterator();return!1!==l(u,function(t){if(n(e,t))return c(u,"normal",!1)})}},3388(t,e,i){"use strict";var r=i(7234),n=i(1888),s=i(5475),a=i(5447);t.exports=function(t){var e=r(this),i=a(t);return!(n(e)>i.size)&&!1!==s(e,function(t){if(!i.includes(t))return!1},!0)}},3965(t,e,i){"use strict";var r=i(7234),n=i(8260).has,s=i(1888),a=i(5447),o=i(1885),l=i(5053);t.exports=function(t){var e=r(this),i=a(t);if(s(e)<i.size)return!1;var c=i.getIterator();return!1!==o(c,function(t){if(!n(e,t))return l(c,"normal",!1)})}},5475(t,e,i){"use strict";var r=i(2782),n=i(1885),s=i(8260),a=s.Set,o=s.proto,l=r(o.forEach),c=r(o.keys),u=c(new a).next;t.exports=function(t,e,i){return i?n({iterator:c(t),next:u},e):l(t,e)}},4206(t,e,i){"use strict";var r=i(2485),n=function(t){return{size:t,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},s=function(t){return{size:t,has:function(){return!0},keys:function(){throw Error("e")}}};t.exports=function(t,e){var i=r("Set");try{new i()[t](n(0));try{return new i()[t](n(-1)),!1}catch(r){if(!e)return!0;try{return new i()[t](s(-1/0)),!1}catch(r){var a=new i([1,2]);return e(a[t](s(1/0)))}}}catch(t){return!1}}},9617(t){"use strict";t.exports=function(t){try{var e=new Set,i=e[t]({size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return e.clear(),e.add(4),function(){return{done:!0}}}})}});return 1===i.size&&4===i.values().next().value}catch(t){return!1}}},1888(t,e,i){"use strict";t.exports=i(6572)(i(8260).proto,"size","get")||function(t){return t.size}},3263(t,e,i){"use strict";var r=i(2485),n=i(7108),s=i(5869),a=i(9058),o=s("species");t.exports=function(t){var e=r(t);a&&e&&!e[o]&&n(e,o,{configurable:!0,get:function(){return this}})}},3264(t,e,i){"use strict";var r=i(7234),n=i(8260),s=i(7988),a=i(5447),o=i(1885),l=n.add,c=n.has,u=n.remove;t.exports=function(t){var e=r(this),i=a(t).getIterator(),n=s(e);return o(i,function(t){c(e,t)?u(n,t):l(n,t)}),n}},2377(t,e,i){"use strict";var r=i(3919).f,n=i(6151),s=i(5869)("toStringTag");t.exports=function(t,e,i){t&&!i&&(t=t.prototype),t&&!n(t,s)&&r(t,s,{configurable:!0,value:e})}},1898(t,e,i){"use strict";var r=i(7234),n=i(8260).add,s=i(7988),a=i(5447),o=i(1885);t.exports=function(t){var e=r(this),i=a(t).getIterator(),l=s(e);return o(i,function(t){n(l,t)}),l}},6845(t,e,i){"use strict";var r=i(5219),n=i(702),s=r("keys");t.exports=function(t){return s[t]||(s[t]=n(t))}},6851(t,e,i){"use strict";var r=i(1201),n=i(6974),s=i(5963),a="__core-js_shared__",o=t.exports=n[a]||s(a,{});(o.versions||(o.versions=[])).push({version:"3.47.0",mode:r?"pure":"global",copyright:"\xa9 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5219(t,e,i){"use strict";var r=i(6851);t.exports=function(t,e){return r[t]||(r[t]=e||{})}},2767(t,e,i){"use strict";var r=i(6177),n=i(114),s=i(3563),a=i(5869)("species");t.exports=function(t,e){var i,o=r(t).constructor;return void 0===o||s(i=r(o)[a])?e:n(i)}},8445(t,e,i){"use strict";var r=i(2782),n=i(5825),s=i(3641),a=i(5804),o=r("".charAt),l=r("".charCodeAt),c=r("".slice),u=function(t){return function(e,i){var r,u,h=s(a(e)),d=n(i),p=h.length;return d<0||d>=p?t?"":void 0:(r=l(h,d))<55296||r>56319||d+1===p||(u=l(h,d+1))<56320||u>57343?t?o(h,d):r:t?c(h,d,d+2):(r-55296<<10)+(u-56320)+65536}};t.exports={codeAt:u(!1),charAt:u(!0)}},9855(t,e,i){"use strict";var r=i(2782),n=/[^\0-\u007E]/,s=/[.\u3002\uFF0E\uFF61]/g,a="Overflow: input needs wider integers to process",o=RangeError,l=r(s.exec),c=Math.floor,u=String.fromCharCode,h=r("".charCodeAt),d=r([].join),p=r([].push),f=r("".replace),_=r("".split),g=r("".toLowerCase),v=function(t){for(var e=[],i=0,r=t.length;i<r;){var n=h(t,i++);if(n>=55296&&n<=56319&&i<r){var s=h(t,i++);(64512&s)==56320?p(e,((1023&n)<<10)+(1023&s)+65536):(p(e,n),i--)}else p(e,n)}return e},m=function(t){return t+22+75*(t<26)},y=function(t,e,i){var r=0;for(t=i?c(t/700):t>>1,t+=c(t/e);t>455;)t=c(t/35),r+=36;return c(r+36*t/(t+38))},w=function(t){var e,i,r=[],n=(t=v(t)).length,s=128,l=0,h=72;for(e=0;e<t.length;e++)(i=t[e])<128&&p(r,u(i));var f=r.length,_=f;for(f&&p(r,"-");_<n;){var g=0x7fffffff;for(e=0;e<t.length;e++)(i=t[e])>=s&&i<g&&(g=i);var w=_+1;if(g-s>c((0x7fffffff-l)/w))throw new o(a);for(l+=(g-s)*w,s=g,e=0;e<t.length;e++){if((i=t[e])<s&&++l>0x7fffffff)throw new o(a);if(i===s){for(var b=l,k=36;;){var S=k<=h?1:k>=h+26?26:k-h;if(b<S)break;var A=b-S,I=36-S;p(r,u(m(S+A%I))),b=c(A/I),k+=36}p(r,u(m(b))),h=y(l,w,_===f),l=0,_++}}l++,s++}return d(r,"")};t.exports=function(t){var e,i,r=[],a=_(f(g(t),s,"."),".");for(e=0;e<a.length;e++)p(r,l(n,i=a[e])?"xn--"+w(i):i);return d(r,".")}},5698(t,e,i){"use strict";var r=i(6974),n=i(9293),s=i(6153),a=i(229),o=r.structuredClone;t.exports=!!o&&!n(function(){if("DENO"===a&&s>92||"NODE"===a&&s>94||"BROWSER"===a&&s>97)return!1;var t=new ArrayBuffer(8),e=o(t,{transfer:[t]});return 0!==t.byteLength||8!==e.byteLength})},8953(t,e,i){"use strict";var r=i(6153),n=i(9293),s=i(6974).String;t.exports=!!Object.getOwnPropertySymbols&&!n(function(){var t=Symbol("symbol detection");return!s(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41})},1523(t,e,i){"use strict";var r,n,s,a,o=i(6974),l=i(6263),c=i(2254),u=i(8039),h=i(6151),d=i(9293),p=i(9247),f=i(4766),_=i(5637),g=i(6406),v=i(7502),m=i(5523),y=o.setImmediate,w=o.clearImmediate,b=o.process,k=o.Dispatch,S=o.Function,A=o.MessageChannel,I=o.String,U=0,x={},C="onreadystatechange";d(function(){r=o.location});var E=function(t){if(h(x,t)){var e=x[t];delete x[t],e()}},P=function(t){return function(){E(t)}},T=function(t){E(t.data)},O=function(t){o.postMessage(I(t),r.protocol+"//"+r.host)};y&&w||(y=function(t){g(arguments.length,1);var e=u(t)?t:S(t),i=f(arguments,1);return x[++U]=function(){l(e,void 0,i)},n(U),U},w=function(t){delete x[t]},m?n=function(t){b.nextTick(P(t))}:k&&k.now?n=function(t){k.now(P(t))}:A&&!v?(a=(s=new A).port2,s.port1.onmessage=T,n=c(a.postMessage,a)):o.addEventListener&&u(o.postMessage)&&!o.importScripts&&r&&"file:"!==r.protocol&&!d(O)?(n=O,o.addEventListener("message",T,!1)):n=C in _("script")?function(t){p.appendChild(_("script"))[C]=function(){p.removeChild(this),E(t)}}:function(t){setTimeout(P(t),0)}),t.exports={set:y,clear:w}},3108(t,e,i){"use strict";var r=i(5825),n=Math.max,s=Math.min;t.exports=function(t,e){var i=r(t);return i<0?n(i+e,0):s(i,e)}},2216(t,e,i){"use strict";var r=i(8535),n=TypeError;t.exports=function(t){var e=r(t,"number");if("number"==typeof e)throw new n("Can't convert number to bigint");return BigInt(e)}},6722(t,e,i){"use strict";var r=i(5825),n=i(7864),s=RangeError;t.exports=function(t){if(void 0===t)return 0;var e=r(t),i=n(e);if(e!==i)throw new s("Wrong length or index");return i}},1555(t,e,i){"use strict";var r=i(4461),n=i(5804);t.exports=function(t){return r(n(t))}},5825(t,e,i){"use strict";var r=i(3427);t.exports=function(t){var e=+t;return e!=e||0===e?0:r(e)}},7864(t,e,i){"use strict";var r=i(5825),n=Math.min;t.exports=function(t){var e=r(t);return e>0?n(e,0x1fffffffffffff):0}},2095(t,e,i){"use strict";var r=i(5804),n=Object;t.exports=function(t){return n(r(t))}},7751(t,e,i){"use strict";var r=i(1280),n=RangeError;t.exports=function(t,e){var i=r(t);if(i%e)throw new n("Wrong offset");return i}},1280(t,e,i){"use strict";var r=i(5825),n=RangeError;t.exports=function(t){var e=r(t);if(e<0)throw new n("The argument can't be less than 0");return e}},8535(t,e,i){"use strict";var r=i(3179),n=i(8188),s=i(2131),a=i(5112),o=i(8424),l=i(5869),c=TypeError,u=l("toPrimitive");t.exports=function(t,e){if(!n(t)||s(t))return t;var i,l=a(t,u);if(l){if(void 0===e&&(e="default"),!n(i=r(l,t,e))||s(i))return i;throw new c("Can't convert object to primitive value")}return void 0===e&&(e="number"),o(t,e)}},1611(t,e,i){"use strict";var r=i(8535),n=i(2131);t.exports=function(t){var e=r(t,"string");return n(e)?e:e+""}},3886(t,e,i){"use strict";var r=i(5869)("toStringTag"),n={};n[r]="z",t.exports="[object z]"===String(n)},3641(t,e,i){"use strict";var r=i(3485),n=String;t.exports=function(t){if("Symbol"===r(t))throw TypeError("Cannot convert a Symbol value to a string");return n(t)}},205(t){"use strict";var e=Math.round;t.exports=function(t){var i=e(t);return i<0?0:i>255?255:255&i}},5229(t){"use strict";var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},1853(t,e,i){"use strict";var r=i(4808),n=i(6974),s=i(3179),a=i(9058),o=i(5087),l=i(7882),c=i(1428),u=i(473),h=i(6582),d=i(81),p=i(1037),f=i(7864),_=i(6722),g=i(7751),v=i(205),m=i(1611),y=i(6151),w=i(3485),b=i(8188),k=i(2131),S=i(2326),A=i(6227),I=i(7261),U=i(2482).f,x=i(6705),C=i(3831).forEach,E=i(3263),P=i(7108),T=i(3919),O=i(3069),R=i(1372),M=i(6935),N=i(3153),z=M.get,W=M.set,F=M.enforce,D=T.f,L=O.f,j=n.RangeError,B=c.ArrayBuffer,J=B.prototype,V=c.DataView,K=l.NATIVE_ARRAY_BUFFER_VIEWS,q=l.TYPED_ARRAY_TAG,H=l.TypedArray,G=l.TypedArrayPrototype,$=l.isTypedArray,Y="BYTES_PER_ELEMENT",X="Wrong length",Q=function(t,e){P(t,e,{configurable:!0,get:function(){return z(this)[e]}})},Z=function(t){var e;return A(J,t)||"ArrayBuffer"===(e=w(t))||"SharedArrayBuffer"===e},tt=function(t,e){return $(t)&&!k(e)&&e in t&&p(+e)&&e>=0},te=function(t,e){return tt(t,e=m(e))?h(2,t[e]):L(t,e)},ti=function(t,e,i){return tt(t,e=m(e))&&b(i)&&y(i,"value")&&!y(i,"get")&&!y(i,"set")&&!i.configurable&&(!y(i,"writable")||i.writable)&&(!y(i,"enumerable")||i.enumerable)?(t[e]=i.value,t):D(t,e,i)};a?(K||(O.f=te,T.f=ti,Q(G,"buffer"),Q(G,"byteOffset"),Q(G,"byteLength"),Q(G,"length")),r({target:"Object",stat:!0,forced:!K},{getOwnPropertyDescriptor:te,defineProperty:ti}),t.exports=function(t,e,i){var a=t.match(/\d+/)[0]/8,l=t+(i?"Clamped":"")+"Array",c="get"+t,h="set"+t,p=n[l],m=p,y=m&&m.prototype,w={},k=function(t,e){var i=z(t);return i.view[c](e*a+i.byteOffset,!0)},A=function(t,e,r){var n=z(t);n.view[h](e*a+n.byteOffset,i?v(r):r,!0)},P=function(t,e){D(t,e,{get:function(){return k(this,e)},set:function(t){return A(this,e,t)},enumerable:!0})};K?o&&(m=e(function(t,e,i,r){return u(t,y),N(b(e)?Z(e)?void 0!==r?new p(e,g(i,a),r):void 0!==i?new p(e,g(i,a)):new p(e):$(e)?R(m,e):s(x,m,e):new p(_(e)),t,m)}),I&&I(m,H),C(U(p),function(t){t in m||d(m,t,p[t])}),m.prototype=y):(m=e(function(t,e,i,r){u(t,y);var n,o,l,c=0,h=0;if(b(e))if(Z(e)){n=e,h=g(i,a);var d=e.byteLength;if(void 0===r){if(d%a||(o=d-h)<0)throw new j(X)}else if((o=f(r)*a)+h>d)throw new j(X);l=o/a}else if($(e))return R(m,e);else return s(x,m,e);else n=new B(o=(l=_(e))*a);for(W(t,{buffer:n,byteOffset:h,byteLength:o,length:l,view:new V(n)});c<l;)P(t,c++)}),I&&I(m,H),y=m.prototype=S(G)),y.constructor!==m&&d(y,"constructor",m),F(y).TypedArrayConstructor=m,q&&d(y,q,l);var T=m!==p;w[l]=m,r({global:!0,constructor:!0,forced:T,sham:!K},w),Y in m||d(m,Y,a),Y in y||d(y,Y,a),E(l)}):t.exports=function(){}},5087(t,e,i){"use strict";var r=i(6974),n=i(9293),s=i(366),a=i(7882).NATIVE_ARRAY_BUFFER_VIEWS,o=r.ArrayBuffer,l=r.Int8Array;t.exports=!a||!n(function(){l(1)})||!n(function(){new l(-1)})||!s(function(t){new l,new l(null),new l(1.5),new l(t)},!0)||n(function(){return 1!==new l(new o(2),1,void 0).length})},6705(t,e,i){"use strict";var r=i(2254),n=i(3179),s=i(114),a=i(2095),o=i(2956),l=i(6563),c=i(8301),u=i(4623),h=i(3633),d=i(7882).aTypedArrayConstructor,p=i(2216);t.exports=function(t){var e,i,f,_,g,v,m,y,w=s(this),b=a(t),k=arguments.length,S=k>1?arguments[1]:void 0,A=void 0!==S,I=c(b);if(I&&!u(I))for(y=(m=l(b,I)).next,b=[];!(v=n(y,m)).done;)b.push(v.value);for(A&&k>2&&(S=r(S,arguments[2])),i=o(b),_=h(f=new(d(w))(i)),e=0;i>e;e++)g=A?S(b[e],e):b[e],f[e]=_?p(g):+g;return f}},702(t,e,i){"use strict";var r=i(2782),n=0,s=Math.random(),a=r(1.1.toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++n+s,36)}},9542(t,e,i){"use strict";var r=i(9293),n=i(5869),s=i(9058),a=i(1201),o=n("iterator");t.exports=!r(function(){var t=new URL("b?a=1&b=2&c=3","https://a"),e=t.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),r="";return t.pathname="c%20d",e.forEach(function(t,i){e.delete("b"),r+=i+t}),i.delete("a",2),i.delete("b",void 0),a&&(!t.toJSON||!i.has("a",1)||i.has("a",2)||!i.has("a",void 0)||i.has("b"))||!e.size&&(a||!s)||!e.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[o]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==r||"x"!==new URL("https://x",void 0).host})},5058(t,e,i){"use strict";t.exports=i(8953)&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8636(t,e,i){"use strict";var r=i(9058),n=i(9293);t.exports=r&&n(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},6406(t){"use strict";var e=TypeError;t.exports=function(t,i){if(t<i)throw new e("Not enough arguments");return t}},4232(t,e,i){"use strict";var r=i(6974),n=i(8039),s=r.WeakMap;t.exports=n(s)&&/native code/.test(String(s))},5869(t,e,i){"use strict";var r=i(6974),n=i(5219),s=i(6151),a=i(702),o=i(8953),l=i(5058),c=r.Symbol,u=n("wks"),h=l?c.for||c:c&&c.withoutSetter||a;t.exports=function(t){return s(u,t)||(u[t]=o&&s(c,t)?c[t]:h("Symbol."+t)),u[t]}},859(t,e,i){"use strict";var r=i(2485),n=i(6151),s=i(81),a=i(6227),o=i(7261),l=i(8770),c=i(4122),u=i(3153),h=i(4901),d=i(5910),p=i(7245),f=i(9058),_=i(1201);t.exports=function(t,e,i,g){var v="stackTraceLimit",m=g?2:1,y=t.split("."),w=y[y.length-1],b=r.apply(null,y);if(b){var k=b.prototype;if(!_&&n(k,"cause")&&delete k.cause,!i)return b;var S=r("Error"),A=e(function(t,e){var i=h(g?e:t,void 0),r=g?new b(t):new b;return void 0!==i&&s(r,"message",i),p(r,A,r.stack,2),this&&a(k,this)&&u(r,this,A),arguments.length>m&&d(r,arguments[m]),r});if(A.prototype=k,"Error"!==w?o?o(A,S):l(A,S,{name:!0}):f&&v in b&&(c(A,b,v),c(A,b,"prepareStackTrace")),l(A,b),!_)try{k.name!==w&&s(k,"name",w),k.constructor=A}catch(t){}return A}}},303(t,e,i){"use strict";var r=i(9058),n=i(7108),s=i(408),a=ArrayBuffer.prototype;!r||"detached"in a||n(a,"detached",{configurable:!0,get:function(){return s(this)}})},6106(t,e,i){"use strict";var r=i(4808),n=i(2982);n&&r({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return n(this,arguments.length?arguments[0]:void 0,!1)}})},9166(t,e,i){"use strict";var r=i(4808),n=i(2982);n&&r({target:"ArrayBuffer",proto:!0},{transfer:function(){return n(this,arguments.length?arguments[0]:void 0,!0)}})},2277(t,e,i){"use strict";var r=i(4808),n=i(5383).includes,s=i(9293),a=i(1643);r({target:"Array",proto:!0,forced:s(function(){return![,].includes()})},{includes:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),a("includes")},2886(t,e,i){"use strict";var r=i(1555),n=i(1643),s=i(9227),a=i(6935),o=i(3919).f,l=i(2274),c=i(6827),u=i(1201),h=i(9058),d="Array Iterator",p=a.set,f=a.getterFor(d);t.exports=l(Array,"Array",function(t,e){p(this,{type:d,target:r(t),index:0,kind:e})},function(){var t=f(this),e=t.target,i=t.index++;if(!e||i>=e.length)return t.target=null,c(void 0,!0);switch(t.kind){case"keys":return c(i,!1);case"values":return c(e[i],!1)}return c([i,e[i]],!1)},"values");var _=s.Arguments=s.Array;if(n("keys"),n("values"),n("entries"),!u&&h&&"values"!==_.name)try{o(_,"name",{value:"values"})}catch(t){}},4104(t,e,i){"use strict";var r=i(4808),n=i(2095),s=i(2956),a=i(7021),o=i(1959);r({target:"Array",proto:!0,arity:1,forced:i(9293)(function(){return 0x100000001!==[].push.call({length:0x100000000},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}}()},{push:function(t){var e=n(this),i=s(e),r=arguments.length;o(i+r);for(var l=0;l<r;l++)e[i]=arguments[l],i++;return a(e,i),i}})},1949(t,e,i){"use strict";var r=i(4808),n=i(184).left,s=i(2604),a=i(6153);r({target:"Array",proto:!0,forced:!i(5523)&&a>79&&a<83||!s("reduce")},{reduce:function(t){var e=arguments.length;return n(this,t,e,e>1?arguments[1]:void 0)}})},9780(t,e,i){"use strict";i(1643)("flat")},3584(t,e,i){"use strict";var r=i(4808),n=i(2095),s=i(2956),a=i(7021),o=i(6152),l=i(1959);r({target:"Array",proto:!0,arity:1,forced:1!==[].unshift(0)||!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(t){return t instanceof TypeError}}()},{unshift:function(t){var e=n(this),i=s(e),r=arguments.length;if(r){l(i+r);for(var c=i;c--;){var u=c+r;c in e?e[u]=e[c]:o(e,u)}for(var h=0;h<r;h++)e[h]=arguments[h]}return a(e,i+r)}})},5254(t,e,i){"use strict";var r=i(4808),n=i(6974),s=i(6263),a=i(859),o="WebAssembly",l=n[o],c=7!==Error("e",{cause:7}).cause,u=function(t,e){var i={};i[t]=a(t,e,c),r({global:!0,constructor:!0,arity:1,forced:c},i)},h=function(t,e){if(l&&l[t]){var i={};i[t]=a(o+"."+t,e,c),r({target:o,stat:!0,constructor:!0,arity:1,forced:c},i)}};u("Error",function(t){return function(e){return s(t,this,arguments)}}),u("EvalError",function(t){return function(e){return s(t,this,arguments)}}),u("RangeError",function(t){return function(e){return s(t,this,arguments)}}),u("ReferenceError",function(t){return function(e){return s(t,this,arguments)}}),u("SyntaxError",function(t){return function(e){return s(t,this,arguments)}}),u("TypeError",function(t){return function(e){return s(t,this,arguments)}}),u("URIError",function(t){return function(e){return s(t,this,arguments)}}),h("CompileError",function(t){return function(e){return s(t,this,arguments)}}),h("LinkError",function(t){return function(e){return s(t,this,arguments)}}),h("RuntimeError",function(t){return function(e){return s(t,this,arguments)}})},2949(t,e,i){"use strict";var r=i(4808),n=i(6974),s=i(473),a=i(6177),o=i(8039),l=i(9681),c=i(7108),u=i(4634),h=i(9293),d=i(6151),p=i(5869),f=i(6479).IteratorPrototype,_=i(9058),g=i(1201),v="constructor",m="Iterator",y=p("toStringTag"),w=TypeError,b=n[m],k=g||!o(b)||b.prototype!==f||!h(function(){b({})}),S=function(){if(s(this,f),l(this)===f)throw new w("Abstract class Iterator not directly constructable")},A=function(t,e){_?c(f,t,{configurable:!0,get:function(){return e},set:function(e){if(a(this),this===f)throw new w("You can't redefine this property");d(this,t)?this[t]=e:u(this,t,e)}}):f[t]=e};d(f,y)||A(y,m),(k||!d(f,v)||f[v]===Object)&&A(v,S),S.prototype=f,r({global:!0,constructor:!0,forced:k},{Iterator:S})},1178(t,e,i){"use strict";var r=i(4808),n=i(3179),s=i(2150),a=i(860),o=i(6177),l=i(9226),c=i(5053),u=i(6655)("every",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{every:function(t){o(this);try{a(t)}catch(t){c(this,"throw",t)}if(u)return n(u,this,t);var e=l(this),i=0;return!s(e,function(e,r){if(!t(e,i++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},8723(t,e,i){"use strict";var r=i(4808),n=i(3179),s=i(860),a=i(6177),o=i(9226),l=i(1352),c=i(5017),u=i(1201),h=i(5053),d=i(5682),p=i(6655),f=!u&&!d("filter",function(){}),_=!u&&!f&&p("filter",TypeError),g=u||f||_,v=l(function(){for(var t,e,i=this.iterator,r=this.predicate,s=this.next;;){if(t=a(n(s,i)),this.done=!!t.done)return;if(c(i,r,[e=t.value,this.counter++],!0))return e}});r({target:"Iterator",proto:!0,real:!0,forced:g},{filter:function(t){a(this);try{s(t)}catch(t){h(this,"throw",t)}return _?n(_,this,t):new v(o(this),{predicate:t})}})},9678(t,e,i){"use strict";var r=i(4808),n=i(3179),s=i(2150),a=i(860),o=i(6177),l=i(9226),c=i(5053),u=i(6655)("find",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{find:function(t){o(this);try{a(t)}catch(t){c(this,"throw",t)}if(u)return n(u,this,t);var e=l(this),i=0;return s(e,function(e,r){if(t(e,i++))return r(e)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})},4086(t,e,i){"use strict";var r=i(4808),n=i(3179),s=i(2150),a=i(860),o=i(6177),l=i(9226),c=i(5053),u=i(6655)("forEach",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{forEach:function(t){o(this);try{a(t)}catch(t){c(this,"throw",t)}if(u)return n(u,this,t);var e=l(this),i=0;s(e,function(e){t(e,i++)},{IS_RECORD:!0})}})},7891(t,e,i){"use strict";var r=i(4808),n=i(3179),s=i(860),a=i(6177),o=i(9226),l=i(1352),c=i(5017),u=i(5053),h=i(5682),d=i(6655),p=i(1201),f=!p&&!h("map",function(){}),_=!p&&!f&&d("map",TypeError),g=p||f||_,v=l(function(){var t=this.iterator,e=a(n(this.next,t));if(!(this.done=!!e.done))return c(t,this.mapper,[e.value,this.counter++],!0)});r({target:"Iterator",proto:!0,real:!0,forced:g},{map:function(t){a(this);try{s(t)}catch(t){u(this,"throw",t)}return _?n(_,this,t):new v(o(this),{mapper:t})}})},6455(t,e,i){"use strict";var r=i(4808),n=i(2150),s=i(860),a=i(6177),o=i(9226),l=i(5053),c=i(6655),u=i(6263),h=i(9293),d=TypeError,p=h(function(){[].keys().reduce(function(){},void 0)}),f=!p&&c("reduce",d);r({target:"Iterator",proto:!0,real:!0,forced:p||f},{reduce:function(t){a(this);try{s(t)}catch(t){l(this,"throw",t)}var e=arguments.length<2,i=e?void 0:arguments[1];if(f)return u(f,this,e?[t]:[t,i]);var r=o(this),c=0;if(n(r,function(r){e?(e=!1,i=r):i=t(i,r,c),c++},{IS_RECORD:!0}),e)throw new d("Reduce of empty iterator with no initial value");return i}})},2021(t,e,i){"use strict";var r=i(4808),n=i(3179),s=i(2150),a=i(860),o=i(6177),l=i(9226),c=i(5053),u=i(6655)("some",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:u},{some:function(t){o(this);try{a(t)}catch(t){c(this,"throw",t)}if(u)return n(u,this,t);var e=l(this),i=0;return s(e,function(e,r){if(t(e,i++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},509(t,e,i){"use strict";var r=i(4808),n=i(3179),s=i(860),a=i(3761),o=i(2181),l=i(2150);r({target:"Promise",stat:!0,forced:i(7435)},{all:function(t){var e=this,i=a.f(e),r=i.resolve,c=i.reject,u=o(function(){var i=s(e.resolve),a=[],o=0,u=1;l(t,function(t){var s=o++,l=!1;u++,n(i,e,t).then(function(t){!l&&(l=!0,a[s]=t,--u||r(a))},c)}),--u||r(a)});return u.error&&c(u.value),i.promise}})},8965(t,e,i){"use strict";var r=i(4808),n=i(1201),s=i(3586).CONSTRUCTOR,a=i(5940),o=i(2485),l=i(8039),c=i(9430),u=a&&a.prototype;if(r({target:"Promise",proto:!0,forced:s,real:!0},{catch:function(t){return this.then(void 0,t)}}),!n&&l(a)){var h=o("Promise").prototype.catch;u.catch!==h&&c(u,"catch",h,{unsafe:!0})}},3750(t,e,i){"use strict";var r,n,s,a,o=i(4808),l=i(1201),c=i(5523),u=i(6974),h=i(977),d=i(3179),p=i(9430),f=i(7261),_=i(2377),g=i(3263),v=i(860),m=i(8039),y=i(8188),w=i(473),b=i(2767),k=i(1523).set,S=i(2885),A=i(9823),I=i(2181),U=i(8663),x=i(6935),C=i(5940),E=i(3586),P=i(3761),T="Promise",O=E.CONSTRUCTOR,R=E.REJECTION_EVENT,M=E.SUBCLASSING,N=x.getterFor(T),z=x.set,W=C&&C.prototype,F=C,D=W,L=u.TypeError,j=u.document,B=u.process,J=P.f,V=J,K=!!(j&&j.createEvent&&u.dispatchEvent),q="unhandledrejection",H=function(t){var e;return!!(y(t)&&m(e=t.then))&&e},G=function(t,e){var i,r,n,s=e.value,a=1===e.state,o=a?t.ok:t.fail,l=t.resolve,c=t.reject,u=t.domain;try{o?(a||(2===e.rejection&&Z(e),e.rejection=1),!0===o?i=s:(u&&u.enter(),i=o(s),u&&(u.exit(),n=!0)),i===t.promise?c(new L("Promise-chain cycle")):(r=H(i))?d(r,i,l,c):l(i)):c(s)}catch(t){u&&!n&&u.exit(),c(t)}},$=function(t,e){t.notified||(t.notified=!0,S(function(){for(var i,r=t.reactions;i=r.get();)G(i,t);t.notified=!1,e&&!t.rejection&&X(t)}))},Y=function(t,e,i){var r,n;K?((r=j.createEvent("Event")).promise=e,r.reason=i,r.initEvent(t,!1,!0),u.dispatchEvent(r)):r={promise:e,reason:i},!R&&(n=u["on"+t])?n(r):t===q&&A("Unhandled promise rejection",i)},X=function(t){d(k,u,function(){var e,i=t.facade,r=t.value;if(Q(t)&&(e=I(function(){c?B.emit("unhandledRejection",r,i):Y(q,i,r)}),t.rejection=c||Q(t)?2:1,e.error))throw e.value})},Q=function(t){return 1!==t.rejection&&!t.parent},Z=function(t){d(k,u,function(){var e=t.facade;c?B.emit("rejectionHandled",e):Y("rejectionhandled",e,t.value)})},tt=function(t,e,i){return function(r){t(e,r,i)}},te=function(t,e,i){t.done||(t.done=!0,i&&(t=i),t.value=e,t.state=2,$(t,!0))},ti=function(t,e,i){if(!t.done){t.done=!0,i&&(t=i);try{if(t.facade===e)throw new L("Promise can't be resolved itself");var r=H(e);r?S(function(){var i={done:!1};try{d(r,e,tt(ti,i,t),tt(te,i,t))}catch(e){te(i,e,t)}}):(t.value=e,t.state=1,$(t,!1))}catch(e){te({done:!1},e,t)}}};if(O&&(D=(F=function(t){w(this,D),v(t),d(r,this);var e=N(this);try{t(tt(ti,e),tt(te,e))}catch(t){te(e,t)}}).prototype,(r=function(t){z(this,{type:T,done:!1,notified:!1,parent:!1,reactions:new U,rejection:!1,state:0,value:null})}).prototype=p(D,"then",function(t,e){var i=N(this),r=J(b(this,F));return i.parent=!0,r.ok=!m(t)||t,r.fail=m(e)&&e,r.domain=c?B.domain:void 0,0===i.state?i.reactions.add(r):S(function(){G(r,i)}),r.promise}),n=function(){var t=new r,e=N(t);this.promise=t,this.resolve=tt(ti,e),this.reject=tt(te,e)},P.f=J=function(t){return t===F||t===s?new n(t):V(t)},!l&&m(C)&&W!==Object.prototype)){a=W.then,M||p(W,"then",function(t,e){var i=this;return new F(function(t,e){d(a,i,t,e)}).then(t,e)},{unsafe:!0});try{delete W.constructor}catch(t){}f&&f(W,D)}o({global:!0,constructor:!0,wrap:!0,forced:O},{Promise:F}),s=h.Promise,_(F,T,!1,!0),g(T)},6449(t,e,i){"use strict";var r=i(4808),n=i(1201),s=i(5940),a=i(9293),o=i(2485),l=i(8039),c=i(2767),u=i(1864),h=i(9430),d=s&&s.prototype;if(r({target:"Promise",proto:!0,real:!0,forced:!!s&&a(function(){d.finally.call({then:function(){}},function(){})})},{finally:function(t){var e=c(this,o("Promise")),i=l(t);return this.then(i?function(i){return u(e,t()).then(function(){return i})}:t,i?function(i){return u(e,t()).then(function(){throw i})}:t)}}),!n&&l(s)){var p=o("Promise").prototype.finally;d.finally!==p&&h(d,"finally",p,{unsafe:!0})}},3560(t,e,i){"use strict";i(3750),i(509),i(8965),i(7797),i(3475),i(3610)},7797(t,e,i){"use strict";var r=i(4808),n=i(3179),s=i(860),a=i(3761),o=i(2181),l=i(2150);r({target:"Promise",stat:!0,forced:i(7435)},{race:function(t){var e=this,i=a.f(e),r=i.reject,c=o(function(){var a=s(e.resolve);l(t,function(t){n(a,e,t).then(i.resolve,r)})});return c.error&&r(c.value),i.promise}})},3475(t,e,i){"use strict";var r=i(4808),n=i(3761);r({target:"Promise",stat:!0,forced:i(3586).CONSTRUCTOR},{reject:function(t){var e=n.f(this);return(0,e.reject)(t),e.promise}})},3610(t,e,i){"use strict";var r=i(4808),n=i(2485),s=i(1201),a=i(5940),o=i(3586).CONSTRUCTOR,l=i(1864),c=n("Promise"),u=s&&!o;r({target:"Promise",stat:!0,forced:s||o},{resolve:function(t){return l(u&&this===c?a:this,t)}})},498(t,e,i){"use strict";var r=i(9058),n=i(6974),s=i(2782),a=i(6518),o=i(3153),l=i(81),c=i(2326),u=i(2482).f,h=i(6227),d=i(7494),p=i(3641),f=i(1148),_=i(7764),g=i(4122),v=i(9430),m=i(9293),y=i(6151),w=i(6935).enforce,b=i(3263),k=i(5869),S=i(5369),A=i(3596),I=k("match"),U=n.RegExp,x=U.prototype,C=n.SyntaxError,E=s(x.exec),P=s("".charAt),T=s("".replace),O=s("".indexOf),R=s("".slice),M=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,N=/a/g,z=/a/g,W=new U(N)!==N,F=_.MISSED_STICKY,D=_.UNSUPPORTED_Y,L=r&&(!W||F||S||A||m(function(){return z[I]=!1,U(N)!==N||U(z)===z||"/a/i"!==String(U(N,"i"))})),j=function(t){for(var e,i=t.length,r=0,n="",s=!1;r<=i;r++){if("\\"===(e=P(t,r))){n+=e+P(t,++r);continue}s||"."!==e?("["===e?s=!0:"]"===e&&(s=!1),n+=e):n+="[\\s\\S]"}return n},B=function(t){for(var e,i=t.length,r=0,n="",s=[],a=c(null),o=!1,l=!1,u=0,h="";r<=i;r++){if("\\"===(e=P(t,r)))e+=P(t,++r);else if("]"===e)o=!1;else if(!o)switch(!0){case"["===e:o=!0;break;case"("===e:if(n+=e,"?:"===R(t,r+1,r+3))continue;E(M,R(t,r+1))&&(r+=2,l=!0),u++;continue;case">"===e&&l:if(""===h||y(a,h))throw new C("Invalid capture group name");a[h]=!0,s[s.length]=[h,u],l=!1,h="";continue}l?h+=e:n+=e}return[n,s]};if(a("RegExp",L)){for(var J=function(t,e){var i,r,n,s,a,c,u=h(x,this),_=d(t),g=void 0===e,v=[],m=t;if(!u&&_&&g&&t.constructor===J)return t;if((_||h(x,t))&&(t=t.source,g&&(e=f(m))),t=void 0===t?"":p(t),e=void 0===e?"":p(e),m=t,S&&"dotAll"in N&&(r=!!e&&O(e,"s")>-1)&&(e=T(e,/s/g,"")),i=e,F&&"sticky"in N&&(n=!!e&&O(e,"y")>-1)&&D&&(e=T(e,/y/g,"")),A&&(t=(s=B(t))[0],v=s[1]),a=o(U(t,e),u?this:x,J),(r||n||v.length)&&(c=w(a),r&&(c.dotAll=!0,c.raw=J(j(t),i)),n&&(c.sticky=!0),v.length&&(c.groups=v)),t!==m)try{l(a,"source",""===m?"(?:)":m)}catch(t){}return a},V=u(U),K=0;V.length>K;)g(J,U,V[K++]);x.constructor=J,J.prototype=x,v(n,"RegExp",J,{constructor:!0})}b("RegExp")},807(t,e,i){"use strict";var r=i(9058),n=i(5369),s=i(4026),a=i(7108),o=i(6935).get,l=RegExp.prototype,c=TypeError;r&&n&&a(l,"dotAll",{configurable:!0,get:function(){if(this!==l){if("RegExp"===s(this))return!!o(this).dotAll;throw new c("Incompatible receiver, RegExp required")}}})},5281(t,e,i){"use strict";var r=i(4808),n=i(6565);r({target:"RegExp",proto:!0,forced:/./.exec!==n},{exec:n})},2301(t,e,i){"use strict";var r=i(9058),n=i(7108),s=i(6823),a=i(2337);r&&!s.correct&&(n(RegExp.prototype,"flags",{configurable:!0,get:a}),s.correct=!0)},7548(t,e,i){"use strict";var r=i(4808),n=i(5474),s=i(9293);r({target:"Set",proto:!0,real:!0,forced:!i(4206)("difference",function(t){return 0===t.size})||s(function(){var t=new Set([1,2,3,4]);return 3!==t.difference({size:1,has:function(){return!0},keys:function(){var e=0;return{next:function(){var i=e++>1;return t.has(1)&&t.clear(),{done:i,value:2}}}}}).size})},{difference:n})},954(t,e,i){"use strict";var r=i(4808),n=i(9293),s=i(8396);r({target:"Set",proto:!0,real:!0,forced:!i(4206)("intersection",function(t){return 2===t.size&&t.has(1)&&t.has(2)})||n(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))})},{intersection:s})},8803(t,e,i){"use strict";var r=i(4808),n=i(6839);r({target:"Set",proto:!0,real:!0,forced:!i(4206)("isDisjointFrom",function(t){return!t})},{isDisjointFrom:n})},9162(t,e,i){"use strict";var r=i(4808),n=i(3388);r({target:"Set",proto:!0,real:!0,forced:!i(4206)("isSubsetOf",function(t){return t})},{isSubsetOf:n})},5385(t,e,i){"use strict";var r=i(4808),n=i(3965);r({target:"Set",proto:!0,real:!0,forced:!i(4206)("isSupersetOf",function(t){return!t})},{isSupersetOf:n})},9342(t,e,i){"use strict";var r=i(4808),n=i(3264),s=i(9617);r({target:"Set",proto:!0,real:!0,forced:!i(4206)("symmetricDifference")||!s("symmetricDifference")},{symmetricDifference:n})},9152(t,e,i){"use strict";var r=i(4808),n=i(1898),s=i(9617);r({target:"Set",proto:!0,real:!0,forced:!i(4206)("union")||!s("union")},{union:n})},583(t,e,i){"use strict";var r=i(4808),n=i(2782),s=i(3108),a=RangeError,o=String.fromCharCode,l=String.fromCodePoint,c=n([].join);r({target:"String",stat:!0,arity:1,forced:!!l&&1!==l.length},{fromCodePoint:function(t){for(var e,i=[],r=arguments.length,n=0;r>n;){if(e=+arguments[n++],s(e,1114111)!==e)throw new a(e+" is not a valid code point");i[n]=e<65536?o(e):o(((e-=65536)>>10)+55296,e%1024+56320)}return c(i,"")}})},7166(t,e,i){"use strict";var r=i(8445).charAt,n=i(3641),s=i(6935),a=i(2274),o=i(6827),l="String Iterator",c=s.set,u=s.getterFor(l);a(String,"String",function(t){c(this,{type:l,string:n(t),index:0})},function(){var t,e=u(this),i=e.string,n=e.index;return n>=i.length?o(void 0,!0):(t=r(i,n),e.index+=t.length,o(t,!1))})},9381(t,e,i){"use strict";var r=i(4808),n=i(3179),s=i(3350),a=i(652),o=i(6827),l=i(5804),c=i(7864),u=i(3641),h=i(6177),d=i(8188),p=i(4026),f=i(7494),_=i(1148),g=i(5112),v=i(9430),m=i(9293),y=i(5869),w=i(2767),b=i(2287),k=i(4464),S=i(6935),A=i(1201),I=y("matchAll"),U="RegExp String",x=U+" Iterator",C=S.set,E=S.getterFor(x),P=RegExp.prototype,T=TypeError,O=s("".indexOf),R=s("".matchAll),M=!!R&&!m(function(){R("a",/./)}),N=a(function(t,e,i,r){C(this,{type:x,regexp:t,string:e,global:i,unicode:r,done:!1})},U,function(){var t=E(this);if(t.done)return o(void 0,!0);var e=t.regexp,i=t.string,r=k(e,i);return null===r?(t.done=!0,o(void 0,!0)):(t.global?""===u(r[0])&&(e.lastIndex=b(i,c(e.lastIndex),t.unicode)):t.done=!0,o(r,!1))}),z=function(t){var e,i,r,n=h(this),s=u(t),a=w(n,RegExp),o=u(_(n));return e=new a(a===RegExp?n.source:n,o),i=!!~O(o,"g"),r=!!~O(o,"u"),e.lastIndex=c(n.lastIndex),new N(e,s,i,r)};r({target:"String",proto:!0,forced:M},{matchAll:function(t){var e,i,r,s=l(this);if(d(t)){if(f(t)&&!~O(u(l(_(t))),"g"))throw new T("`.matchAll` does not allow non-global regexes");if(M)return R(s,t);if(void 0===(i=g(t,I))&&A&&"RegExp"===p(t)&&(i=z),i)return n(i,t,s)}else if(M)return R(s,t);return e=u(s),r=RegExp(t,"g"),A?n(z,r,e):r[I](e)}}),A||I in P||v(P,I,z)},6954(t,e,i){"use strict";var r=i(6263),n=i(3179),s=i(2782),a=i(1298),o=i(9293),l=i(6177),c=i(8039),u=i(8188),h=i(5825),d=i(7864),p=i(3641),f=i(5804),_=i(2287),g=i(5112),v=i(7256),m=i(1148),y=i(4464),w=i(5869)("replace"),b=Math.max,k=Math.min,S=s([].concat),A=s([].push),I=s("".indexOf),U=s("".slice),x="$0"==="a".replace(/./,"$0"),C=!!/./[w]&&""===/./[w]("a","$0");a("replace",function(t,e,i){var s=C?"$":"$0";return[function(t,i){var r=f(this),s=u(t)?g(t,w):void 0;return s?n(s,t,r,i):n(e,p(r),t,i)},function(t,n){var a=l(this),o=p(t);if("string"==typeof n&&-1===I(n,s)&&-1===I(n,"$<")){var u=i(e,a,o,n);if(u.done)return u.value}var f=c(n);f||(n=p(n));var g=p(m(a)),w=-1!==I(g,"g");w&&(O=-1!==I(g,"u"),a.lastIndex=0);for(var x=[];null!==(M=y(a,o))&&(A(x,M),w);){;""===p(M[0])&&(a.lastIndex=_(o,d(a.lastIndex),O))}for(var C="",E=0,P=0;P<x.length;P++){for(var T,O,R,M=x[P],N=p(M[0]),z=b(k(h(M.index),o.length),0),W=[],F=1;F<M.length;F++)A(W,void 0===(T=M[F])?T:String(T));var D=M.groups;if(f){var L=S([N],W,z,o);void 0!==D&&A(L,D),R=p(r(n,void 0,L))}else R=v(N,o,z,W,D,n);z>=E&&(C+=U(o,E,z)+R,E=z+N.length)}return C+U(o,E)}]},!!o(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})||!x||C)},2742(t,e,i){"use strict";var r=i(7882),n=i(2956),s=i(5825),a=r.aTypedArray;(0,r.exportTypedArrayMethod)("at",function(t){var e=a(this),i=n(e),r=s(t),o=r>=0?r:i+r;return o<0||o>=i?void 0:e[o]})},4330(t,e,i){"use strict";var r=i(7882),n=i(5083),s=i(2216),a=i(3485),o=i(3179),l=i(2782),c=i(9293),u=r.aTypedArray,h=r.exportTypedArrayMethod,d=l("".slice);h("fill",function(t){var e=arguments.length;return u(this),o(n,this,"Big"===d(a(this),0,3)?s(t):+t,e>1?arguments[1]:void 0,e>2?arguments[2]:void 0)},c(function(){var t=0;return new Int8Array(2).fill({valueOf:function(){return t++}}),1!==t}))},2148(t,e,i){"use strict";var r=i(7882),n=i(1857).findLastIndex,s=r.aTypedArray;(0,r.exportTypedArrayMethod)("findLastIndex",function(t){return n(s(this),t,arguments.length>1?arguments[1]:void 0)})},7553(t,e,i){"use strict";var r=i(7882),n=i(1857).findLast,s=r.aTypedArray;(0,r.exportTypedArrayMethod)("findLast",function(t){return n(s(this),t,arguments.length>1?arguments[1]:void 0)})},9055(t,e,i){"use strict";var r=i(6974),n=i(3179),s=i(7882),a=i(2956),o=i(7751),l=i(2095),c=i(9293),u=r.RangeError,h=r.Int8Array,d=h&&h.prototype,p=d&&d.set,f=s.aTypedArray,_=s.exportTypedArrayMethod,g=!c(function(){var t=new Uint8ClampedArray(2);return n(p,t,{length:1,0:3},1),3!==t[1]}),v=g&&s.NATIVE_ARRAY_BUFFER_VIEWS&&c(function(){var t=new h(2);return t.set(1),t.set("2",1),0!==t[0]||2!==t[1]});_("set",function(t){f(this);var e=o(arguments.length>1?arguments[1]:void 0,1),i=l(t);if(g)return n(p,this,i,e);var r=this.length,s=a(i),c=0;if(s+e>r)throw new u("Wrong length");for(;c<s;)this[e+c]=i[c++]},!g||v)},1435(t,e,i){"use strict";var r=i(6974),n=i(3350),s=i(9293),a=i(860),o=i(1534),l=i(7882),c=i(1203),u=i(3777),h=i(6153),d=i(2729),p=l.aTypedArray,f=l.exportTypedArrayMethod,_=r.Uint16Array,g=_&&n(_.prototype.sort),v=!!g&&!(s(function(){g(new _(2),null)})&&s(function(){g(new _(2),{})})),m=!!g&&!s(function(){if(h)return h<74;if(c)return c<67;if(u)return!0;if(d)return d<602;var t,e,i=new _(516),r=Array(516);for(t=0;t<516;t++)e=t%4,i[t]=515-t,r[t]=t-2*e+3;for(g(i,function(t,e){return(t/4|0)-(e/4|0)}),t=0;t<516;t++)if(i[t]!==r[t])return!0});f("sort",function(t){return(void 0!==t&&a(t),m)?g(this,t):o(p(this),function(e,i){return void 0!==t?+t(e,i)||0:i!=i?-1:e!=e?1:0===e&&0===i?1/e>0&&1/i<0?1:-1:e>i})},!m||v)},4586(t,e,i){"use strict";var r=i(4062),n=i(7882),s=n.aTypedArray,a=n.exportTypedArrayMethod,o=n.getTypedArrayConstructor;a("toReversed",function(){return r(s(this),o(this))})},5850(t,e,i){"use strict";var r=i(7882),n=i(2782),s=i(860),a=i(1372),o=r.aTypedArray,l=r.getTypedArrayConstructor,c=r.exportTypedArrayMethod,u=n(r.TypedArrayPrototype.sort);c("toSorted",function(t){void 0!==t&&s(t);var e=o(this);return u(a(l(e),e),t)})},3619(t,e,i){"use strict";i(1853)("Uint8",function(t){return function(e,i,r){return t(this,e,i,r)}})},5135(t,e,i){"use strict";var r=i(9718),n=i(7882),s=i(3633),a=i(5825),o=i(2216),l=n.aTypedArray,c=n.getTypedArrayConstructor,u=n.exportTypedArrayMethod,h=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}(),d=h&&function(){try{new Int8Array(1).with(-.5,1)}catch(t){return!0}}();u("with",{with:function(t,e){var i=l(this),n=a(t),u=s(i)?o(e):+e;return r(i,c(i),n,u)}}.with,!h||d)},6395(t,e,i){"use strict";var r=i(6974),n=i(1806),s=i(4098),a=i(2886),o=i(81),l=i(2377),c=i(5869)("iterator"),u=a.values,h=function(t,e){if(t){if(t[c]!==u)try{o(t,c,u)}catch(e){t[c]=u}if(l(t,e,!0),n[e]){for(var i in a)if(t[i]!==a[i])try{o(t,i,a[i])}catch(e){t[i]=a[i]}}}};for(var d in n)h(r[d]&&r[d].prototype,d);h(s,"DOMTokenList")},2037(t,e,i){"use strict";var r=i(4808),n=i(6974),s=i(2485),a=i(6582),o=i(3919).f,l=i(6151),c=i(473),u=i(3153),h=i(4901),d=i(4864),p=i(747),f=i(9058),_=i(1201),g="DOMException",v=s("Error"),m=s(g),y=function(){c(this,w);var t=arguments.length,e=h(t<1?void 0:arguments[0]),i=h(t<2?void 0:arguments[1],"Error"),r=new m(e,i),n=new v(e);return n.name=g,o(r,"stack",a(1,p(n.stack,1))),u(r,this,y),r},w=y.prototype=m.prototype,b="stack"in new v(g),k="stack"in new m(1,2),S=m&&f&&Object.getOwnPropertyDescriptor(n,g),A=!!S&&!(S.writable&&S.configurable),I=b&&!A&&!k;r({global:!0,constructor:!0,forced:_||I},{DOMException:I?y:m});var U=s(g),x=U.prototype;if(x.constructor!==U){for(var C in _||o(x,"constructor",a(1,U)),d)if(l(d,C)){var E=d[C],P=E.s;l(U,P)||o(U,P,a(6,E.c))}}},2033(t,e,i){"use strict";var r=i(4808),n=i(6974),s=i(7108),a=i(9058),o=TypeError,l=Object.defineProperty,c=n.self!==n;try{if(a){var u=Object.getOwnPropertyDescriptor(n,"self");!c&&u&&u.get&&u.enumerable||s(n,"self",{get:function(){return n},set:function(t){if(this!==n)throw new o("Illegal invocation");l(n,"self",{value:t,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}else r({global:!0,simple:!0,forced:c},{self:n})}catch(t){}},5556(t,e,i){"use strict";i(2886),i(583);var r=i(4808),n=i(6974),s=i(6255),a=i(2485),o=i(3179),l=i(2782),c=i(9058),u=i(9542),h=i(9430),d=i(7108),p=i(7597),f=i(2377),_=i(652),g=i(6935),v=i(473),m=i(8039),y=i(6151),w=i(2254),b=i(3485),k=i(6177),S=i(8188),A=i(3641),I=i(2326),U=i(6582),x=i(6563),C=i(8301),E=i(6827),P=i(6406),T=i(5869),O=i(1534),R=T("iterator"),M="URLSearchParams",N=M+"Iterator",z=g.set,W=g.getterFor(M),F=g.getterFor(N),D=s("fetch"),L=s("Request"),j=s("Headers"),B=L&&L.prototype,J=j&&j.prototype,V=n.TypeError,K=n.encodeURIComponent,q=String.fromCharCode,H=a("String","fromCodePoint"),G=parseInt,$=l("".charAt),Y=l([].join),X=l([].push),Q=l("".replace),Z=l([].shift),tt=l([].splice),te=l("".split),ti=l("".slice),tr=l(/./.exec),tn=/\+/g,ts=/^[0-9a-f]+$/i,ta=function(t,e){var i=ti(t,e,e+2);return tr(ts,i)?G(i,16):NaN},to=function(t){for(var e=0,i=128;i>0&&(t&i)!=0;i>>=1)e++;return e},tl=function(t){var e=null;switch(t.length){case 1:e=t[0];break;case 2:e=(31&t[0])<<6|63&t[1];break;case 3:e=(15&t[0])<<12|(63&t[1])<<6|63&t[2];break;case 4:e=(7&t[0])<<18|(63&t[1])<<12|(63&t[2])<<6|63&t[3]}return e>1114111?null:e},tc=function(t){for(var e=(t=Q(t,tn," ")).length,i="",r=0;r<e;){var n=$(t,r);if("%"===n){if("%"===$(t,r+1)||r+3>e){i+="%",r++;continue}var s=ta(t,r+1);if(s!=s){i+=n,r++;continue}r+=2;var a=to(s);if(0===a)n=q(s);else{if(1===a||a>4){i+="<22>",r++;continue}for(var o=[s],l=1;l<a&&!(++r+3>e)&&"%"===$(t,r);){var c=ta(t,r+1);if(c!=c){r+=3;break}if(c>191||c<128)break;X(o,c),r+=2,l++}if(o.length!==a){i+="<22>";continue}var u=tl(o);null===u?i+="<22>":n=H(u)}}i+=n,r++}return i},tu=/[!'()~]|%20/g,th={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},td=function(t){return th[t]},tp=function(t){return Q(K(t),tu,td)},tf=_(function(t,e){z(this,{type:N,target:W(t).entries,index:0,kind:e})},M,function(){var t=F(this),e=t.target,i=t.index++;if(!e||i>=e.length)return t.target=null,E(void 0,!0);var r=e[i];switch(t.kind){case"keys":return E(r.key,!1);case"values":return E(r.value,!1)}return E([r.key,r.value],!1)},!0),t_=function(t){this.entries=[],this.url=null,void 0!==t&&(S(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===$(t,0)?ti(t,1):t:A(t)))};t_.prototype={type:M,bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var e,i,r,n,s,a,l,c=this.entries,u=C(t);if(u)for(i=(e=x(t,u)).next;!(r=o(i,e)).done;){if((a=o(s=(n=x(k(r.value))).next,n)).done||(l=o(s,n)).done||!o(s,n).done)throw new V("Expected sequence with length 2");X(c,{key:A(a.value),value:A(l.value)})}else for(var h in t)y(t,h)&&X(c,{key:h,value:A(t[h])})},parseQuery:function(t){if(t)for(var e,i,r=this.entries,n=te(t,"&"),s=0;s<n.length;)(e=n[s++]).length&&X(r,{key:tc(Z(i=te(e,"="))),value:tc(Y(i,"="))})},serialize:function(){for(var t,e=this.entries,i=[],r=0;r<e.length;)X(i,tp((t=e[r++]).key)+"="+tp(t.value));return Y(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var tg=function(){v(this,tv);var t=arguments.length>0?arguments[0]:void 0,e=z(this,new t_(t));c||(this.size=e.entries.length)},tv=tg.prototype;if(p(tv,{append:function(t,e){var i=W(this);P(arguments.length,2),X(i.entries,{key:A(t),value:A(e)}),!c&&this.size++,i.updateURL()},delete:function(t){for(var e=W(this),i=P(arguments.length,1),r=e.entries,n=A(t),s=i<2?void 0:arguments[1],a=void 0===s?s:A(s),o=0;o<r.length;){var l=r[o];if(l.key===n&&(void 0===a||l.value===a)){if(tt(r,o,1),void 0!==a)break}else o++}c||(this.size=r.length),e.updateURL()},get:function(t){var e=W(this).entries;P(arguments.length,1);for(var i=A(t),r=0;r<e.length;r++)if(e[r].key===i)return e[r].value;return null},getAll:function(t){var e=W(this).entries;P(arguments.length,1);for(var i=A(t),r=[],n=0;n<e.length;n++)e[n].key===i&&X(r,e[n].value);return r},has:function(t){for(var e=W(this).entries,i=P(arguments.length,1),r=A(t),n=i<2?void 0:arguments[1],s=void 0===n?n:A(n),a=0;a<e.length;){var o=e[a++];if(o.key===r&&(void 0===s||o.value===s))return!0}return!1},set:function(t,e){var i,r=W(this);P(arguments.length,1);for(var n=r.entries,s=!1,a=A(t),o=A(e),l=0;l<n.length;l++)(i=n[l]).key===a&&(s?tt(n,l--,1):(s=!0,i.value=o));s||X(n,{key:a,value:o}),c||(this.size=n.length),r.updateURL()},sort:function(){var t=W(this);O(t.entries,function(t,e){return t.key>e.key?1:-1}),t.updateURL()},forEach:function(t){for(var e,i=W(this).entries,r=w(t,arguments.length>1?arguments[1]:void 0),n=0;n<i.length;)r((e=i[n++]).value,e.key,this)},keys:function(){return new tf(this,"keys")},values:function(){return new tf(this,"values")},entries:function(){return new tf(this,"entries")}},{enumerable:!0}),h(tv,R,tv.entries,{name:"entries"}),h(tv,"toString",function(){return W(this).serialize()},{enumerable:!0}),c&&d(tv,"size",{get:function(){return W(this).entries.length},configurable:!0,enumerable:!0}),f(tg,M),r({global:!0,constructor:!0,forced:!u},{URLSearchParams:tg}),!u&&m(j)){var tm=l(J.has),ty=l(J.set),tw=function(t){if(S(t)){var e,i=t.body;if(b(i)===M)return tm(e=t.headers?new j(t.headers):new j,"content-type")||ty(e,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),I(t,{body:U(0,A(i)),headers:U(0,e)})}return t};if(m(D)&&r({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return D(t,arguments.length>1?tw(arguments[1]):{})}}),m(L)){var tb=function(t){return v(this,B),new L(t,arguments.length>1?tw(arguments[1]):{})};B.constructor=tb,tb.prototype=B,r({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:tb})}}t.exports={URLSearchParams:tg,getState:W}},2205(t,e,i){"use strict";var r=i(9430),n=i(2782),s=i(3641),a=i(6406),o=URLSearchParams,l=o.prototype,c=n(l.append),u=n(l.delete),h=n(l.forEach),d=n([].push),p=new o("a=1&a=2&b=3");p.delete("a",1),p.delete("b",void 0),p+""!="a=2"&&r(l,"delete",function(t){var e,i=arguments.length,r=i<2?void 0:arguments[1];if(i&&void 0===r)return u(this,t);var n=[];h(this,function(t,e){d(n,{key:e,value:t})}),a(i,1);for(var o=s(t),l=s(r),p=0,f=0,_=!1,g=n.length;p<g;)e=n[p++],_||e.key===o?(_=!0,u(this,e.key)):f++;for(;f<g;)((e=n[f++]).key!==o||e.value!==l)&&c(this,e.key,e.value)},{enumerable:!0,unsafe:!0})},768(t,e,i){"use strict";var r=i(9430),n=i(2782),s=i(3641),a=i(6406),o=URLSearchParams,l=o.prototype,c=n(l.getAll),u=n(l.has),h=new o("a=1");(h.has("a",2)||!h.has("a",void 0))&&r(l,"has",function(t){var e=arguments.length,i=e<2?void 0:arguments[1];if(e&&void 0===i)return u(this,t);var r=c(this,t);a(e,1);for(var n=s(i),o=0;o<r.length;)if(r[o++]===n)return!0;return!1},{enumerable:!0,unsafe:!0})},8978(t,e,i){"use strict";i(5556)},6235(t,e,i){"use strict";var r=i(9058),n=i(2782),s=i(7108),a=URLSearchParams.prototype,o=n(a.forEach);!r||"size"in a||s(a,"size",{get:function(){var t=0;return o(this,function(){t++}),t},configurable:!0,enumerable:!0})},6184(t,e,i){"use strict";i(7166);var r,n=i(4808),s=i(9058),a=i(9542),o=i(6974),l=i(2254),c=i(2782),u=i(9430),h=i(7108),d=i(473),p=i(6151),f=i(7187),_=i(7930),g=i(4766),v=i(8445).codeAt,m=i(9855),y=i(3641),w=i(2377),b=i(6406),k=i(5556),S=i(6935),A=S.set,I=S.getterFor("URL"),U=k.URLSearchParams,x=k.getState,C=o.URL,E=o.TypeError,P=o.parseInt,T=Math.floor,O=Math.pow,R=c("".charAt),M=c(/./.exec),N=c([].join),z=c(1.1.toString),W=c([].pop),F=c([].push),D=c("".replace),L=c([].shift),j=c("".split),B=c("".slice),J=c("".toLowerCase),V=c([].unshift),K="Invalid scheme",q="Invalid host",H="Invalid port",G=/[a-z]/i,$=/[\d+-.a-z]/i,Y=/\d/,X=/^0x/i,Q=/^[0-7]+$/,Z=/^\d+$/,tt=/^[\da-f]+$/i,te=/[\0\t\n\r #%/:<>?@[\\\]^|]/,ti=/[\0\t\n\r #/:<>?@[\\\]^|]/,tr=/^[\u0000-\u0020]+/,tn=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ts=/[\t\n\r]/g,ta=function(t){var e,i,r,n,s,a,o,l=j(t,".");if(l.length&&""===l[l.length-1]&&l.length--,(e=l.length)>4)return t;for(r=0,i=[];r<e;r++){if(""===(n=l[r]))return t;if(s=10,n.length>1&&"0"===R(n,0)&&(s=M(X,n)?16:8,n=B(n,8===s?1:2)),""===n)a=0;else{if(!M(10===s?Z:8===s?Q:tt,n))return t;a=P(n,s)}F(i,a)}for(r=0;r<e;r++)if(a=i[r],r===e-1){if(a>=O(256,5-e))return null}else if(a>255)return null;for(r=0,o=W(i);r<i.length;r++)o+=i[r]*O(256,3-r);return o},to=function(t){var e,i,r,n,s,a,o,l=[0,0,0,0,0,0,0,0],c=0,u=null,h=0,d=function(){return R(t,h)};if(":"===d()){if(":"!==R(t,1))return;h+=2,u=++c}for(;d();){if(8===c)return;if(":"===d()){if(null!==u)return;h++,u=++c;continue}for(e=i=0;i<4&&M(tt,d());)e=16*e+P(d(),16),h++,i++;if("."===d()){if(0===i||(h-=i,c>6))return;for(r=0;d();){if(n=null,r>0)if("."!==d()||!(r<4))return;else h++;if(!M(Y,d()))return;for(;M(Y,d());){if(s=P(d(),10),null===n)n=s;else{if(0===n)return;n=10*n+s}if(n>255)return;h++}l[c]=256*l[c]+n,(2==++r||4===r)&&c++}if(4!==r)return;break}if(":"===d()){if(h++,!d())return}else if(d())return;l[c++]=e}if(null!==u)for(a=c-u,c=7;0!==c&&a>0;)o=l[c],l[c--]=l[u+a-1],l[u+--a]=o;else if(8!==c)return;return l},tl=function(t){for(var e=null,i=1,r=null,n=0,s=0;s<8;s++)0!==t[s]?(n>i&&(e=r,i=n),r=null,n=0):(null===r&&(r=s),++n);return n>i?r:e},tc=function(t){var e,i,r,n;if("number"==typeof t){for(i=0,e=[];i<4;i++)V(e,t%256),t=T(t/256);return N(e,".")}if("object"==typeof t){for(i=0,e="",r=tl(t);i<8;i++)(!n||0!==t[i])&&(n&&(n=!1),r===i?(e+=i?":":"::",n=!0):(e+=z(t[i],16),i<7&&(e+=":")));return"["+e+"]"}return t},tu={},th=f({},tu,{" ":1,'"':1,"<":1,">":1,"`":1}),td=f({},th,{"#":1,"?":1,"{":1,"}":1}),tp=f({},td,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),tf=function(t,e){var i=v(t,0);return i>32&&i<127&&!p(e,t)?t:encodeURIComponent(t)},t_={ftp:21,file:null,http:80,https:443,ws:80,wss:443},tg=function(t,e){var i;return 2===t.length&&M(G,R(t,0))&&(":"===(i=R(t,1))||!e&&"|"===i)},tv=function(t){var e;return t.length>1&&tg(B(t,0,2))&&(2===t.length||"/"===(e=R(t,2))||"\\"===e||"?"===e||"#"===e)},tm={},ty={},tw={},tb={},tk={},tS={},tA={},tI={},tU={},tx={},tC={},tE={},tP={},tT={},tO={},tR={},tM={},tN={},tz={},tW={},tF={},tD=function(t,e,i){var r,n,s,a=y(t);if(e){if(n=this.parse(a))throw new E(n);this.searchParams=null}else{if(void 0!==i&&(r=new tD(i,!0)),n=this.parse(a,null,r))throw new E(n);(s=x(new U)).bindURL(this),this.searchParams=s}};tD.prototype={type:"URL",parse:function(t,e,i){var n=e||tm,s=0,a="",o=!1,l=!1,c=!1;for(t=y(t),e||(this.scheme="",this.username="",this.password="",this.host=null,this.port=null,this.path=[],this.query=null,this.fragment=null,this.cannotBeABaseURL=!1,t=D(t,tr,""),t=D(t,tn,"$1")),u=_(t=D(t,ts,""));s<=u.length;){switch(h=u[s],n){case tm:if(h&&M(G,h))a+=J(h),n=ty;else{if(e)return K;n=tw;continue}break;case ty:if(h&&(M($,h)||"+"===h||"-"===h||"."===h))a+=J(h);else if(":"===h){if(e&&(this.isSpecial()!==p(t_,a)||"file"===a&&(this.includesCredentials()||null!==this.port)||"file"===this.scheme&&!this.host))return;if(this.scheme=a,e){this.isSpecial()&&t_[this.scheme]===this.port&&(this.port=null);return}a="","file"===this.scheme?n=tT:this.isSpecial()&&i&&i.scheme===this.scheme?n=tb:this.isSpecial()?n=tI:"/"===u[s+1]?(n=tk,s++):(this.cannotBeABaseURL=!0,F(this.path,""),n=tz)}else{if(e)return K;a="",n=tw,s=0;continue}break;case tw:if(!i||i.cannotBeABaseURL&&"#"!==h)return K;if(i.cannotBeABaseURL&&"#"===h){this.scheme=i.scheme,this.path=g(i.path),this.query=i.query,this.fragment="",this.cannotBeABaseURL=!0,n=tF;break}n="file"===i.scheme?tT:tS;continue;case tb:if("/"===h&&"/"===u[s+1])n=tU,s++;else{n=tS;continue}break;case tk:if("/"===h){n=tx;break}n=tN;continue;case tS:if(this.scheme=i.scheme,h===r)this.username=i.username,this.password=i.password,this.host=i.host,this.port=i.port,this.path=g(i.path),this.query=i.query;else if("/"===h||"\\"===h&&this.isSpecial())n=tA;else if("?"===h)this.username=i.username,this.password=i.password,this.host=i.host,this.port=i.port,this.path=g(i.path),this.query="",n=tW;else if("#"===h)this.username=i.username,this.password=i.password,this.host=i.host,this.port=i.port,this.path=g(i.path),this.query=i.query,this.fragment="",n=tF;else{this.username=i.username,this.password=i.password,this.host=i.host,this.port=i.port,this.path=g(i.path),this.path.length--,n=tN;continue}break;case tA:if(this.isSpecial()&&("/"===h||"\\"===h))n=tU;else if("/"===h)n=tx;else{this.username=i.username,this.password=i.password,this.host=i.host,this.port=i.port,n=tN;continue}break;case tI:if(n=tU,"/"!==h||"/"!==R(a,s+1))continue;s++;break;case tU:if("/"!==h&&"\\"!==h){n=tx;continue}break;case tx:if("@"===h){o&&(a="%40"+a),o=!0,d=_(a);for(var u,h,d,f,v,m,w=0;w<d.length;w++){var b=d[w];if(":"===b&&!c){c=!0;continue}var k=tf(b,tp);c?this.password+=k:this.username+=k}a=""}else if(h===r||"/"===h||"?"===h||"#"===h||"\\"===h&&this.isSpecial()){if(o&&""===a)return"Invalid authority";s-=_(a).length+1,a="",n=tC}else a+=h;break;case tC:case tE:if(e&&"file"===this.scheme){n=tR;continue}if(":"!==h||l)if(h===r||"/"===h||"?"===h||"#"===h||"\\"===h&&this.isSpecial()){if(this.isSpecial()&&""===a)return q;if(e&&""===a&&(this.includesCredentials()||null!==this.port))return;if(f=this.parseHost(a))return f;if(a="",n=tM,e)return;continue}else"["===h?l=!0:"]"===h&&(l=!1),a+=h;else{if(""===a)return q;if(f=this.parseHost(a))return f;if(a="",n=tP,e===tE)return}break;case tP:if(M(Y,h))a+=h;else{if(!(h===r||"/"===h||"?"===h||"#"===h||"\\"===h&&this.isSpecial())&&!e)return H;if(""!==a){var S=P(a,10);if(S>65535)return H;this.port=this.isSpecial()&&S===t_[this.scheme]?null:S,a=""}if(e)return;n=tM;continue}break;case tT:if(this.scheme="file","/"===h||"\\"===h)n=tO;else if(i&&"file"===i.scheme)switch(h){case r:this.host=i.host,this.path=g(i.path),this.query=i.query;break;case"?":this.host=i.host,this.path=g(i.path),this.query="",n=tW;break;case"#":this.host=i.host,this.path=g(i.path),this.query=i.query,this.fragment="",n=tF;break;default:tv(N(g(u,s),""))||(this.host=i.host,this.path=g(i.path),this.shortenPath()),n=tN;continue}else{n=tN;continue}break;case tO:if("/"===h||"\\"===h){n=tR;break}i&&"file"===i.scheme&&!tv(N(g(u,s),""))&&(tg(i.path[0],!0)?F(this.path,i.path[0]):this.host=i.host),n=tN;continue;case tR:if(h===r||"/"===h||"\\"===h||"?"===h||"#"===h){if(!e&&tg(a))n=tN;else if(""===a){if(this.host="",e)return;n=tM}else{if(f=this.parseHost(a))return f;if("localhost"===this.host&&(this.host=""),e)return;a="",n=tM}continue}a+=h;break;case tM:if(this.isSpecial()){if(n=tN,"/"!==h&&"\\"!==h)continue}else if(e||"?"!==h)if(e||"#"!==h){if(h!==r&&(n=tN,"/"!==h))continue}else this.fragment="",n=tF;else this.query="",n=tW;break;case tN:if(h===r||"/"===h||"\\"===h&&this.isSpecial()||!e&&("?"===h||"#"===h)){if(".."===(v=J(v=a))||"%2e."===v||".%2e"===v||"%2e%2e"===v?(this.shortenPath(),"/"===h||"\\"===h&&this.isSpecial()||F(this.path,"")):"."===(m=a)||"%2e"===J(m)?"/"===h||"\\"===h&&this.isSpecial()||F(this.path,""):("file"===this.scheme&&!this.path.length&&tg(a)&&(this.host&&(this.host=""),a=R(a,0)+":"),F(this.path,a)),a="","file"===this.scheme&&(h===r||"?"===h||"#"===h))for(;this.path.length>1&&""===this.path[0];)L(this.path);"?"===h?(this.query="",n=tW):"#"===h&&(this.fragment="",n=tF)}else a+=tf(h,td);break;case tz:"?"===h?(this.query="",n=tW):"#"===h?(this.fragment="",n=tF):h!==r&&(this.path[0]+=tf(h,tu));break;case tW:e||"#"!==h?h!==r&&("'"===h&&this.isSpecial()?this.query+="%27":"#"===h?this.query+="%23":this.query+=tf(h,tu)):(this.fragment="",n=tF);break;case tF:h!==r&&(this.fragment+=tf(h,th))}s++}},parseHost:function(t){var e,i,r;if("["===R(t,0)){if("]"!==R(t,t.length-1)||!(e=to(B(t,1,-1))))return q;this.host=e}else if(this.isSpecial()){if(M(te,t=m(t))||null===(e=ta(t)))return q;this.host=e}else{if(M(ti,t))return q;for(r=0,e="",i=_(t);r<i.length;r++)e+=tf(i[r],tu);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return p(t_,this.scheme)},shortenPath:function(){var t=this.path,e=t.length;e&&("file"!==this.scheme||1!==e||!tg(t[0],!0))&&t.length--},serialize:function(){var t=this.scheme,e=this.username,i=this.password,r=this.host,n=this.port,s=this.path,a=this.query,o=this.fragment,l=t+":";return null!==r?(l+="//",this.includesCredentials()&&(l+=e+(i?":"+i:"")+"@"),l+=tc(r),null!==n&&(l+=":"+n)):"file"===t&&(l+="//"),l+=this.cannotBeABaseURL?s[0]:s.length?"/"+N(s,"/"):"",null!==a&&(l+="?"+a),null!==o&&(l+="#"+o),l},setHref:function(t){var e=this.parse(t);if(e)throw new E(e);this.searchParams.update()},getOrigin:function(){var t=this.scheme,e=this.port;if("blob"===t)try{return new tL(t.path[0]).origin}catch(t){return"null"}return"file"!==t&&this.isSpecial()?t+"://"+tc(this.host)+(null!==e?":"+e:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(t){this.parse(y(t)+":",tm)},getUsername:function(){return this.username},setUsername:function(t){var e=_(y(t));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<e.length;i++)this.username+=tf(e[i],tp)}},getPassword:function(){return this.password},setPassword:function(t){var e=_(y(t));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<e.length;i++)this.password+=tf(e[i],tp)}},getHost:function(){var t=this.host,e=this.port;return null===t?"":null===e?tc(t):tc(t)+":"+e},setHost:function(t){this.cannotBeABaseURL||this.parse(t,tC)},getHostname:function(){var t=this.host;return null===t?"":tc(t)},setHostname:function(t){this.cannotBeABaseURL||this.parse(t,tE)},getPort:function(){var t=this.port;return null===t?"":y(t)},setPort:function(t){this.cannotHaveUsernamePasswordPort()||(""===(t=y(t))?this.port=null:this.parse(t,tP))},getPathname:function(){var t=this.path;return this.cannotBeABaseURL?t[0]:t.length?"/"+N(t,"/"):""},setPathname:function(t){this.cannotBeABaseURL||(this.path=[],this.parse(t,tM))},getSearch:function(){var t=this.query;return t?"?"+t:""},setSearch:function(t){""===(t=y(t))?this.query=null:("?"===R(t,0)&&(t=B(t,1)),this.query="",this.parse(t,tW)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var t=this.fragment;return t?"#"+t:""},setHash:function(t){if(""===(t=y(t))){this.fragment=null;return}"#"===R(t,0)&&(t=B(t,1)),this.fragment="",this.parse(t,tF)},update:function(){this.query=this.searchParams.serialize()||null}};var tL=function(t){var e=d(this,tj),i=b(arguments.length,1)>1?arguments[1]:void 0,r=A(e,new tD(t,!1,i));s||(e.href=r.serialize(),e.origin=r.getOrigin(),e.protocol=r.getProtocol(),e.username=r.getUsername(),e.password=r.getPassword(),e.host=r.getHost(),e.hostname=r.getHostname(),e.port=r.getPort(),e.pathname=r.getPathname(),e.search=r.getSearch(),e.searchParams=r.getSearchParams(),e.hash=r.getHash())},tj=tL.prototype,tB=function(t,e){return{get:function(){return I(this)[t]()},set:e&&function(t){return I(this)[e](t)},configurable:!0,enumerable:!0}};if(s&&(h(tj,"href",tB("serialize","setHref")),h(tj,"origin",tB("getOrigin")),h(tj,"protocol",tB("getProtocol","setProtocol")),h(tj,"username",tB("getUsername","setUsername")),h(tj,"password",tB("getPassword","setPassword")),h(tj,"host",tB("getHost","setHost")),h(tj,"hostname",tB("getHostname","setHostname")),h(tj,"port",tB("getPort","setPort")),h(tj,"pathname",tB("getPathname","setPathname")),h(tj,"search",tB("getSearch","setSearch")),h(tj,"searchParams",tB("getSearchParams")),h(tj,"hash",tB("getHash","setHash"))),u(tj,"toJSON",function(){return I(this).serialize()},{enumerable:!0}),u(tj,"toString",function(){return I(this).serialize()},{enumerable:!0}),C){var tJ=C.createObjectURL,tV=C.revokeObjectURL;tJ&&u(tL,"createObjectURL",l(tJ,C)),tV&&u(tL,"revokeObjectURL",l(tV,C))}w(tL,"URL"),n({global:!0,constructor:!0,forced:!a,sham:!s},{URL:tL})},4302(t,e,i){"use strict";i(6184)},686(t,e,i){"use strict";var r=i(4808),n=i(3179);r({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return n(URL.prototype.toString,this)}})},7213(t,e,i){"use strict";function r(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}i.d(e,{_:()=>r})},4813(t,e,i){"use strict";i(3560)},1118(t,e,i){"use strict";i.d(e,{t:()=>r});let r=function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i]}},9536(t,e,i){"use strict";function r(t){return Promise.all(Array.from(t).map(t=>t.then(t=>({status:"fulfilled",value:t}),t=>({status:"rejected",reason:t}))))}i.d(e,{a:()=>r}),i(2949),i(7891),i(3560),i(6395),i(7548),i(954),i(8803),i(9162),i(5385),i(9342),i(9152)},7009(t,e,i){"use strict";function r(t,e,i){return"function"==typeof t?t(e):void 0!==t?t:void 0!==i?i:void 0}i.d(e,{vd:()=>s.a,VK:()=>r,lQ:()=>n.t});var n=i(1118);i(4813);var s=i(9536)}},n={};function s(t){var e=n[t];if(void 0!==e)return e.exports;var i=n[t]={exports:{}};return r[t].call(i.exports,i,i.exports,s),i.exports}s.m=r,s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},o=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,s.t=function(t,e){if(1&e&&(t=this(t)),8&e||"object"==typeof t&&t&&(4&e&&t.__esModule||16&e&&"function"==typeof t.then))return t;var i=Object.create(null);s.r(i);var r={};a=a||[null,o({}),o([]),o(o)];for(var n=2&e&&t;("object"==typeof n||"function"==typeof n)&&!~a.indexOf(n);n=o(n))Object.getOwnPropertyNames(n).forEach(e=>{r[e]=()=>t[e]});return r.default=()=>t,s.d(i,r),i},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.f={},s.e=t=>Promise.all(Object.keys(s.f).reduce((e,i)=>(s.f[i](t,e),e),[])),s.u=t=>""+(({279:"stripe-vendors",545:"vendors",662:"query-core-vendors",729:"zxcvbn-ts-core",811:"cookieSuffix",873:"zxcvbn-common",929:"coinbase-wallet-sdk",994:"base-account-sdk"})[t]||t)+"_clerk.legacy.browser_"+s.h().slice(0,6)+"_6.7.5.js",s.h=()=>"c12ce2028caca739",s.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}})(),s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),l={},s.l=function(t,e,i,r){if(l[t])return void l[t].push(e);if(void 0!==i)for(var n,a,o=document.getElementsByTagName("script"),c=0;c<o.length;c++){var u=o[c];if(u.getAttribute("src")==t||u.getAttribute("data-rspack")=="@clerk/clerk-js:"+i){n=u;break}}n||(a=!0,(n=document.createElement("script")).timeout=120,s.nc&&n.setAttribute("nonce",s.nc),n.setAttribute("data-rspack","@clerk/clerk-js:"+i),n.src=t),l[t]=[e];var h=function(e,i){n.onerror=n.onload=null,clearTimeout(d);var r=l[t];if(delete l[t],n.parentNode&&n.parentNode.removeChild(n),r&&r.forEach(function(t){return t(i)}),e)return e(i)},d=setTimeout(h.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=h.bind(null,n.onerror),n.onload=h.bind(null,n.onload),a&&document.head.appendChild(n)},s.r=t=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.g.importScripts&&(c=s.g.location+"");var a,o,l,c,u=s.g.document;if(!c&&u&&(u.currentScript&&"SCRIPT"===u.currentScript.tagName.toUpperCase()&&(c=u.currentScript.src),!c)){var h=u.getElementsByTagName("script");if(h.length)for(var d=h.length-1;d>-1&&(!c||!/^http(s?):/.test(c));)c=h[d--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");return s.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={236:0},s.f.j=function(e,i){var r=s.o(t,e)?t[e]:void 0;if(0!==r)if(r)i.push(r[2]);else{var n=new Promise((i,n)=>r=t[e]=[i,n]);i.push(r[2]=n);var a=s.p+s.u(e),o=Error();s.l(a,function(i){if(s.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var n=i&&("load"===i.type?"missing":i.type),a=i&&i.target&&i.target.src;o.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",o.name="ChunkLoadError",o.type=n,o.request=a,r[1](o)}},"chunk-"+e,e)}},e=(e,i)=>{var r,n,[a,o,l]=i,c=0;if(a.some(e=>0!==t[e])){for(r in o)s.o(o,r)&&(s.m[r]=o[r]);l&&l(s)}for(e&&e(i);c<a.length;c++)n=a[c],s.o(t,n)&&t[n]&&t[n][0](),t[n]=0},(i=globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i)),(()=>{"use strict";let t,e,i,r;s(6395),s(4302),s(686),s(8978),s(2205),s(768),s(6235),s(5281),s(6954);try{let t=new URL(document.currentScript.src),e=new URL(t.href.split("/").slice(0,-1).join("/")).href;s.p=(e+=e.endsWith("/")?"":"/").replace(/(^.*\/@clerk\/clerk-js@)(.+?)(\/dist.*)/,"$1".concat("6.7.5","$3"))}catch{}function n(t,e){return e.get?e.get.call(t):e.value}function a(t,e,i){if(!e.has(t))throw TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function o(t,e){var i=a(t,e,"get");return n(t,i)}function l(t,e){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object")}function c(t,e,i){l(t,e),e.set(t,i)}function u(t,e,i){var r=a(t,e,"set");if(r.set)r.set.call(t,i);else{if(!r.writable)throw TypeError("attempted to set read only private field");r.value=i}return i}function h(t,e,i){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return i}function d(t,e){l(t,e),e.add(t)}s(5254);var p,f,_,g,v,m,y,w,b,k,S,A,I,U,x,C,E,P,T,O,R,M,N,z,W,F,D,L,j,B,J,V,K,q,H,G,$,Y,X,Q,Z,tt,te,ti,tr,tn,ts,ta,to,tl,tc,tu,th,td=s(7213);function tp(){return"u">typeof window}s(3560),s(2949),s(9678),s(4104),s(8723),s(2277),s(2021),s(1178),s(6449),s(7891),s(498),s(807);let tf=RegExp("bot|spider|crawl|APIs-Google|AdsBot|Googlebot|mediapartners|Google Favicon|FeedFetcher|Google-Read-Aloud|DuplexWeb-Google|googleweblight|bing|yandex|baidu|duckduck|yahoo|ecosia|ia_archiver|facebook|instagram|pinterest|reddit|slack|twitter|whatsapp|youtube|semrush","i");function t_(){var t,e;let i=tp()?null==(t=window)?void 0:t.navigator:null;return!!i&&!((e=null==i?void 0:i.userAgent)&&tf.test(e))&&!(null==i?void 0:i.webdriver)}function tg(){var t;let e=tp()?null==(t=window)?void 0:t.navigator:null;return!!e&&("boolean"!=typeof e.onLine||!!e.onLine)}function tv(){return tg()&&t_()}let tm=(t,e,i,r,n)=>{let{notify:s}=n||{},a=t.get(i);a||(a=[],t.set(i,a)),a.push(r),s&&e.has(i)&&r(e.get(i))},ty=(t,e,i)=>(t.get(e)||[]).map(t=>t(i)),tw=(t,e,i)=>{let r=t.get(e);r&&(i?r.splice(r.indexOf(i)>>>0,1):t.set(e,[]))},tb=()=>{let t=new Map,e=new Map,i=new Map;return{on:function(){for(var i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];return tm(t,e,...r)},prioritizedOn:function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return tm(i,e,...r)},emit:(r,n)=>{e.set(r,n),ty(i,r,n),ty(t,r,n)},off:function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];return tw(t,...i)},prioritizedOff:function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return tw(i,...e)},internal:{retrieveListeners:e=>t.get(e)||[]}}},tk="status";function tS(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function tA(t){return function(e){let i=null!=e?e:this;if(!i)throw TypeError("".concat(t.kind||t.name," type guard requires an error object"));if(t.kind&&"object"==typeof i&&null!==i&&"constructor"in i){var r;if((null==(r=i.constructor)?void 0:r.kind)===t.kind)return!0}return i instanceof t}}var tI=(f=class t extends Error{get name(){return this.constructor.name}toString(){return"[".concat(this.name,"]\nMessage:").concat(this.message)}static formatMessage(t,e,i,r){let n="Clerk:",s=RegExp(n.replace(" ","\\s*"),"i");return e=e.replace(s,""),e="".concat(n," ").concat(e.trim(),'\n\n(code="').concat(i,'")\n\n'),r&&(e+="\n\nDocs: ".concat(r)),e}constructor(e){super(new.target.formatMessage(new.target.kind,e.message,e.code,e.docsUrl),{cause:e.cause}),tS(this,"clerkError",!0),tS(this,"code",void 0),tS(this,"longMessage",void 0),tS(this,"docsUrl",void 0),tS(this,"cause",void 0),Object.setPrototypeOf(this,t.prototype),this.code=e.code,this.docsUrl=e.docsUrl,this.longMessage=e.longMessage,this.cause=e.cause}},tS(f,"kind","ClerkError"),f),tU=(_=class t extends tI{constructor(e,i){super({...i,message:e}),tS(this,"clerkRuntimeError",!0),Object.setPrototypeOf(this,t.prototype)}},tS(_,"kind","ClerkRuntimeError"),_);let tx=tA(tU);function tC(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}s(9381);var tE=(g=class{constructor(t){var e,i,r,n,s,a,o;tC(this,"code",void 0),tC(this,"message",void 0),tC(this,"longMessage",void 0),tC(this,"meta",void 0);const l={code:t.code,message:t.message,longMessage:t.long_message,meta:{paramName:null==(e=t.meta)?void 0:e.param_name,sessionId:null==(i=t.meta)?void 0:i.session_id,emailAddresses:null==(r=t.meta)?void 0:r.email_addresses,identifiers:null==(n=t.meta)?void 0:n.identifiers,zxcvbn:null==(s=t.meta)?void 0:s.zxcvbn,plan:null==(a=t.meta)?void 0:a.plan,isPlanUpgradePossible:null==(o=t.meta)?void 0:o.is_plan_upgrade_possible}};this.code=l.code,this.message=l.message,this.longMessage=l.longMessage,this.meta=l.meta}},tC(g,"kind","ClerkAPIError"),g);tA(tE);var tP=(v=class t extends tI{toString(){let t="[".concat(this.name,"]\nMessage:").concat(this.message,"\nStatus:").concat(this.status,"\nSerialized errors: ").concat(this.errors.map(t=>JSON.stringify(t)));return this.clerkTraceId&&(t+="\nClerk Trace ID: ".concat(this.clerkTraceId)),t}static formatMessage(t,e,i,r){return e}constructor(e,i){const{data:r,status:n,clerkTraceId:s,retryAfter:a}=i;super({...i,message:e,code:"api_response_error"}),tC(this,"status",void 0),tC(this,"clerkTraceId",void 0),tC(this,"retryAfter",void 0),tC(this,"errors",void 0),Object.setPrototypeOf(this,t.prototype),this.status=n,this.clerkTraceId=s,this.retryAfter=a,this.errors=(r||[]).map(t=>new tE(t))}},tC(v,"kind","ClerkAPIResponseError"),v);let tT=tA(tP);var tO=(tC(m=class t extends tP{static is(e){return tT(e)&&e.status===t.STATUS&&e.errors.length>0&&e.errors[0].code===t.ERROR_CODE}},"kind","MissingExpiredTokenError"),tC(m,"ERROR_CODE","missing_expired_token"),tC(m,"STATUS",422),m),tR=(tC(y=class t extends tU{static is(e){return null!=e&&(e instanceof t||tx(e)&&e.code===t.ERROR_CODE)}constructor(e){super(e,{code:t.ERROR_CODE}),Object.setPrototypeOf(this,t.prototype)}},"kind","ClerkOfflineError"),tC(y,"ERROR_CODE","clerk_offline"),y);let tM=Object.freeze({InvalidProxyUrlErrorMessage:"The proxyUrl passed to Clerk is invalid. The expected value for proxyUrl is an absolute URL or a relative path with a leading '/'. (key={{url}})",InvalidPublishableKeyErrorMessage:"The publishableKey passed to Clerk is invalid. You can get your Publishable key at https://dashboard.clerk.com/last-active?path=api-keys. (key={{key}})",MissingPublishableKeyErrorMessage:"Missing publishableKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingSecretKeyErrorMessage:"Missing secretKey. You can get your key at https://dashboard.clerk.com/last-active?path=api-keys.",MissingClerkProvider:"{{source}} can only be used within the <ClerkProvider /> component. Learn more: https://clerk.com/docs/components/clerk-provider"});function tN(t){let{packageName:e,customMessages:i}=t,r=e;function n(t,e){if(!e)return"".concat(r,": ").concat(t);let i=t;for(let r of t.matchAll(/{{([a-zA-Z0-9-_]+)}}/g)){let t=(e[r[1]]||"").toString();i=i.replace("{{".concat(r[1],"}}"),t)}return"".concat(r,": ").concat(i)}let s={...tM,...i};return{setPackageName(t){let{packageName:e}=t;return"string"==typeof e&&(r=e),this},setMessages(t){let{customMessages:e}=t;return Object.assign(s,e||{}),this},throwInvalidPublishableKeyError(t){throw Error(n(s.InvalidPublishableKeyErrorMessage,t))},throwInvalidProxyUrl(t){throw Error(n(s.InvalidProxyUrlErrorMessage,t))},throwMissingPublishableKeyError(){throw Error(n(s.MissingPublishableKeyErrorMessage))},throwMissingSecretKeyError(){throw Error(n(s.MissingSecretKeyErrorMessage))},throwMissingClerkProviderError(t){throw Error(n(s.MissingClerkProvider,t))},throw(t){throw Error(n(t))}}}var tz=class t extends Error{constructor(e){super(e),tC(this,"code",void 0),this.code=e,this.name="EmailLinkError",Object.setPrototypeOf(this,t.prototype)}},tW=class extends tU{constructor(t,e){super(t,e),tC(this,"code",void 0),this.code=e.code}};function tF(t){return["captcha_invalid","captcha_not_enabled","captcha_missing_token"].includes(t.errors[0].code)}function tD(t){let e=null==t?void 0:t.status;return!!e&&e>=400&&e<500}function tL(t){let e=null==t?void 0:t.status;return 401===e||422===e}function tj(t){for(let[e,i]of Object.entries({isClerkAPIResponseError:tT,isClerkRuntimeError:tx}))Object.assign(t,{[e]:i});return t}let tB=(t,e)=>!!(t.isSignedIn&&(null==e?void 0:e.authConfig.singleSessionMode)),tJ=(t,e)=>!(null==e?void 0:e.commerceSettings.billing.user.enabled)&&!(null==e?void 0:e.commerceSettings.billing.organization.enabled),tV=(t,e)=>{var i;return!(null==e||null==(i=e.apiKeysSettings)?void 0:i.user_api_keys_enabled)},tK=(t,e)=>{var i;return!(null==e||null==(i=e.apiKeysSettings)?void 0:i.orgs_api_keys_enabled)},tq="__clerk_synced",tH="false",tG="true",t$="suffixed_cookies",tY="__clerk_satellite_url",tX="clerk-captcha",tQ="clerk-invisible-captcha";s(4086),s(2037);let tZ=t=>"u">typeof atob&&"function"==typeof atob?atob(t):void 0!==globalThis.Buffer?globalThis.Buffer.from(t,"base64").toString():t;s(303),s(9166),s(6106),s(3619),s(2742),s(4330),s(7553),s(2148),s(9055),s(1435),s(4586),s(5850),s(5135);let t0=[".lcl.dev",".lclstage.dev",".lclclerk.com"],t1=[".accounts.dev",".accountsstage.dev",".accounts.lclclerk.com"],t2=[".lcl.dev",".stg.dev",".lclstage.dev",".stgstage.dev",".dev.lclclerk.com",".stg.lclclerk.com",".accounts.lclclerk.com","accountsstage.dev","accounts.dev"],t8="pk_live_";function t3(t){if(!t.endsWith("$"))return!1;let e=t.slice(0,-1);return!e.includes("$")&&e.includes(".")}function t5(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t=t||"")||!t6(t)){if(i.fatal&&!t)throw Error("Publishable key is missing. Ensure that your publishable key is correctly configured. Double-check your environment configuration for your keys, or access them here: https://dashboard.clerk.com/last-active?path=api-keys");if(i.fatal&&!t6(t))throw Error("Publishable key not valid.");return null}let r=t.startsWith(t8)?"production":"development";try{e=tZ(t.split("_")[2])}catch{if(i.fatal)throw Error("Publishable key not valid: Failed to decode key.");return null}if(!t3(e)){if(i.fatal)throw Error("Publishable key not valid: Decoded key has invalid format.");return null}let n=e.slice(0,-1);return i.proxyUrl?n=i.proxyUrl:"development"!==r&&i.domain&&i.isSatellite&&(n="clerk.".concat(i.domain)),{instanceType:r,frontendApi:n}}function t6(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{if(!(t.startsWith(t8)||t.startsWith("pk_test_")))return!1;let e=t.split("_");if(3!==e.length)return!1;let i=e[2];if(!i)return!1;return t3(tZ(i))}catch{return!1}}async function t4(t){var e;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:globalThis.crypto.subtle,r=new TextEncoder().encode(t);return(e=String.fromCharCode(...new Uint8Array(await i.digest("sha-1",r))),"u">typeof btoa&&"function"==typeof btoa?btoa(e):void 0!==globalThis.Buffer?globalThis.Buffer.from(e).toString("base64"):e).replace(/\+/gi,"-").replace(/\//gi,"_").substring(0,8)}let t9=(t,e)=>"".concat(t,"_").concat(e);var t7=s(547);function et(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(t||"").replace(/^.+:\/\//,"")}let ee=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/;s(7548),s(954),s(8803),s(9162),s(5385),s(9342),s(9152);let ei=new Set,er=t=>{ei.has(t)||(ei.add(t),console.warn(t))};s(1949),s(6455);let en=(t,e)=>{let i={};for(let r in t)i[r]=e(t[r],r);return i},es=(t,e)=>{let i={};for(let r in t)t[r]&&e(t[r])&&(i[r]=t[r]);return i};function ea(t){return t?t.replace(/([-_][a-z])/g,t=>t.toUpperCase().replace(/-|_/,"")):""}function eo(t){return t?t.replace(/[A-Z]/g,t=>"_".concat(t.toLowerCase())):""}let el=t=>{let e=i=>{if(!i)return i;if(Array.isArray(i))return i.map(t=>"object"==typeof t||Array.isArray(t)?e(t):t);let r={...i};for(let i of Object.keys(r)){let n=t(i.toString());n!==i&&(r[n]=r[i],delete r[i]),"object"==typeof r[n]&&(r[n]=e(r[n]))}return r};return e},ec=el(eo),eu=el(ea);function eh(t){if("boolean"==typeof t)return t;if(null==t)return!1;if("string"==typeof t){if("true"===t.toLowerCase())return!0;if("false"===t.toLowerCase())return!1}let e=parseInt(t,10);return!isNaN(e)&&e>0}let ed=RegExp("/{1,}","g"),ep=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==t||!t||"object"!=typeof t)return"";let i=new URLSearchParams;return Object.keys(t).forEach(r=>{let n=e.keyEncoder?e.keyEncoder(r):r,s=t[r];if(Array.isArray(s))s.forEach(t=>void 0!==t&&i.append(n,t||""));else{if(void 0===s)return;"object"==typeof s&&null!==s?i.append(n,JSON.stringify(s)):i.append(n,String(null!=s?s:""))}}),i.toString()};s(9780);let ef="http://clerk-dummy",e_=["javascript:"],{isDevOrStagingUrl:eg}=(r=new Map,{isDevOrStagingUrl:t=>{if(!t)return!1;let e="string"==typeof t?t:t.hostname,i=r.get(e);return void 0===i&&(i=t2.some(t=>e.endsWith(t)),r.set(e,i)),i}}),ev=new Map;function em(t){return t.replace("clerk.","")}function ey(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{base:i,hashPath:r,hashSearch:n,searchParams:s,hashSearchParams:a,...o}=t,l=new URL(i||"","u">typeof window&&window.location?window.location.href:"http://react-native-fake-base-url");if(s instanceof URLSearchParams&&s.forEach((t,e)=>{null!=t&&l.searchParams.set(eo(e),t)}),Object.assign(l,o),r||n||a){var c;let t,e=new URL(ef+l.hash.substring(1));for(let[i,s]of(c=e.pathname,e.pathname=[c,r||""].filter(t=>t).join("/").replace(ed,"/"),Object.entries((t={},new URLSearchParams(n||"").forEach((e,i)=>{if(i in t){let r=t[i];Array.isArray(r)?r.push(e):t[i]=[r,e]}else t[i]=e}),t))))e.searchParams.append(i,s);if(a)for(let t of Array.isArray(a)?a:[a])(t instanceof URLSearchParams||"object"==typeof t)&&new URLSearchParams(t).forEach((t,i)=>{null!=t&&e.searchParams.set(eo(i),t)});let i=e.href.replace(ef,"");"/"!==i&&(l.hash=i)}let{stringify:u,skipOrigin:h}=e;return u?h?l.href.replace(l.origin,""):l.href:l}function ew(t){return void 0===window.location&&"string"==typeof t?t:(t=new URL(t.toString(),window.location.origin)).href.replace(t.origin,"")}let eb=t=>(t||"").replace(/\/+$/,"");function ek(t,e){try{return new URL(t)}catch{return new URL(t,e)}}let eS=[/\0/,/^\/\//,/[\x00-\x1F]/],eA=["/oauth/authorize"],eI=["/v1/verify","/v1/tickets/accept","/oauth/authorize-with-immediate-redirect","/oauth/end_session"];function eU(t,e){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object")}function ex(t,e){var i=function(t,e){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return e.get(t)}(t,e);return i.get?i.get.call(t):i.value}function eC(t,e,i){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return i}function eE(t,e){eU(t,e),e.add(t)}function eP(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var eT=(w=new WeakSet,b=new WeakSet,k=new WeakSet,S=new WeakSet,A=new WeakSet,I=new WeakSet,U=new WeakSet,x=new WeakMap,C=class{getAfterSignInUrl(){return eC(this,S,eN).call(this,"signIn")}getAfterSignUpUrl(){return eC(this,S,eN).call(this,"signUp")}getPreservedSearchParams(){return eC(this,w,eO).call(this,eC(this,b,eR).call(this))}toSearchParams(){return eC(this,w,eO).call(this,eC(this,k,eM).call(this))}constructor(t,e={},i={},r){eE(this,w),eE(this,b),eE(this,k),eE(this,S),eE(this,A),eE(this,I),eE(this,U),eP(this,"options",void 0),eP(this,"fromOptions",void 0),eP(this,"fromProps",void 0),eP(this,"fromSearchParams",void 0),eP(this,"mode",void 0),function(t,e,i){eU(t,e),e.set(t,i)}(this,x,{writable:!0,value:t=>{var e;let i,r;return es(t,(i=null==(e=this.options)?void 0:e.allowedRedirectOrigins,r=window.location.origin,t=>{let e=t;if("string"==typeof e&&(e=ek(e,r)),!i)return!0;let n=r===e.origin,s=!function(t){if(function(t){if(!function(t){if(!t)return!1;try{return new URL(t),!0}catch{return!1}}(t))return!1;let e=new URL(t).protocol;return e_.some(t=>t===e)}(t))return!0;for(let e of eS)if(e.test(t.pathname))return!0;return!1}(e)&&(n||i.map(t=>"string"==typeof t?(t=>{try{return t7(t)}catch(e){throw Error("Invalid pattern: ".concat(t,".\nConsult the documentation of glob-to-regexp here: https://www.npmjs.com/package/glob-to-regexp.\n").concat(e.message))}})(eb(t)):t).some(t=>t.test(eb(e.origin))));return s||er("Clerk: Redirect URL ".concat(e," is not on one of the allowedRedirectOrigins, falling back to the default redirect URL.")),s}))}}),this.options=t,this.fromOptions=eC(this,A,ez).call(this,t||{}),this.fromProps=eC(this,A,ez).call(this,e||{}),this.fromSearchParams=eC(this,I,eW).call(this,i||{}),this.mode=r}},eP(C,"keys",["signInForceRedirectUrl","signInFallbackRedirectUrl","signUpForceRedirectUrl","signUpFallbackRedirectUrl","redirectUrl"]),eP(C,"preserved",["redirectUrl"]),C);function eO(t){return new URLSearchParams(Object.entries(Object.fromEntries(Object.entries(t).map(t=>{let[e,i]=t;return[eo(e),i]}))).reduce((t,e)=>{let[i,r]=e;return null!=r&&(t[i]=r),t},{}))}function eR(){return Object.fromEntries(Object.entries({...this.fromSearchParams}).filter(t=>{let[e]=t;return C.preserved.includes(e)}))}function eM(){let t=this.fromSearchParams.signUpForceRedirectUrl||this.fromProps.signUpForceRedirectUrl||this.fromOptions.signUpForceRedirectUrl,e=this.fromSearchParams.signUpFallbackRedirectUrl||this.fromProps.signUpFallbackRedirectUrl||this.fromOptions.signUpFallbackRedirectUrl,i=this.fromSearchParams.signInForceRedirectUrl||this.fromProps.signInForceRedirectUrl||this.fromOptions.signInForceRedirectUrl,r={signUpForceRedirectUrl:t,signUpFallbackRedirectUrl:e,signInFallbackRedirectUrl:this.fromSearchParams.signInFallbackRedirectUrl||this.fromProps.signInFallbackRedirectUrl||this.fromOptions.signInFallbackRedirectUrl,signInForceRedirectUrl:i,redirectUrl:this.fromSearchParams.redirectUrl||this.fromProps.redirectUrl};return t&&delete r.signUpFallbackRedirectUrl,i&&delete r.signInFallbackRedirectUrl,r}function eN(t){let e,i="".concat(t,"ForceRedirectUrl"),r="".concat(t,"FallbackRedirectUrl");return((e=this.fromSearchParams[i]||this.fromProps[i]||this.fromOptions[i])||(e=this.fromSearchParams.redirectUrl),e||(e=this.fromSearchParams[r]||this.fromProps[r]||this.fromOptions[r]),e||"modal"!==this.mode)?e||"/":window.location.href}function ez(t){let e={};return C.keys.forEach(i=>{e[i]=t[i]}),en(ex(this,x).call(this,eC(this,U,eF).call(this,es(e,Boolean))),t=>t.toString())}function eW(t){let e={};return C.keys.forEach(i=>{t instanceof URLSearchParams?e[i]=t.get(eo(i)):e[i]=t[eo(i)]}),en(ex(this,x).call(this,eC(this,U,eF).call(this,es(e,Boolean))),t=>t.toString())}function eF(t){return en(t,t=>ek(t,window.location.origin))}let eD="__clerk_netlify_cache_bust",eL=["__clerk_status","__clerk_created_session","__clerk_invitation_token","__clerk_ticket","__clerk_modal_state","__clerk_handshake","__clerk_handshake_nonce","__clerk_help",eD,tq,tY,t$];function ej(t){return new URL(window.location.href).searchParams.get(t)||null}function eB(t){let e=new URL(window.location.href);e.searchParams.has(t)&&(e.searchParams.delete(t),window.history.replaceState(window.history.state,"",e))}function eJ(t){let e=new URLSearchParams(window.location.search),i=t||new URLSearchParams;for(let t of eL){let r=e.get(t);r&&i.set(t,r)}return i}let eV={"choose-organization":"choose-organization","reset-password":"reset-password","setup-mfa":"setup-mfa"},eK=t=>"/tasks/".concat(eV[t.key]);function eq(t,e){let{navigate:i,baseUrl:r}=e,n=t.currentTask;if(n){var s;let t;return i((s={base:r},t=eJ(),ey({base:s.base,hashPath:eK(n),searchParams:t},{stringify:!0})))}}let eH=t=>"\uD83D\uDD12 Clerk:\n".concat(t.trim(),"\n(This notice only appears in development)"),eG=t=>eH("".concat(t," as a function is not supported in this environment. The value will be ignored. Provide an absolute URL instead.")),e$={proxyUrlAsFunctionNotSupported:eG("proxyUrl"),domainAsFunctionNotSupported:eG("domain"),cannotRenderComponentWhenSessionExists:"The <SignUp/> and <SignIn/> components cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the Home URL instead.",cannotRenderSignUpComponentWhenSessionExists:"The <SignUp/> component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the value set in `afterSignUp` URL instead.",cannotRenderSignUpComponentWhenTaskExists:"The <SignUp/> component cannot render when a user has a pending task, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the task instead.",cannotRenderComponentWhenTaskDoesNotExist:"<TaskChooseOrganization/> cannot render unless a session task is pending. Clerk is redirecting to the value set in `redirectUrlComplete` instead.",cannotRenderSignInComponentWhenSessionExists:"The <SignIn/> component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the `afterSignIn` URL instead.",cannotRenderSignInComponentWhenTaskExists:"The <SignIn/> component cannot render when a user has a pending task, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the task instead.",cannotRenderComponentWhenUserDoesNotExist:"<UserProfile/> cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotRenderComponentWhenOrgDoesNotExist:"<OrganizationProfile/> cannot render unless an organization is active. Since no organization is currently active, this is no-op.",cannotRenderAnyOrganizationComponent:t=>eH("The <".concat(t,"/> cannot be rendered when the feature is turned off. Visit 'dashboard.clerk.com' to enable the feature. Since the feature is turned off, this is no-op.")),cannotRenderAnyBillingComponent:t=>eH("The <".concat(t,"/> component cannot be rendered when billing is disabled. Visit 'https://dashboard.clerk.com/last-active?path=billing/settings' to follow the necessary steps to enable billing. Since billing is disabled, this is no-op.")),cannotOpenUserProfile:"The UserProfile modal cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotOpenCheckout:"The Checkout drawer cannot render unless a user is signed in. Since no user is signed in, this is no-op.",cannotOpenSignInOrSignUp:"The SignIn or SignUp modals do not render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, this is no-op.",cannotRenderAPIKeysComponent:"The <APIKeys/> component cannot be rendered when API keys is disabled. Since API keys is disabled, this is no-op.",cannotRenderAPIKeysComponentForOrgWhenUnauthorized:"The <APIKeys/> component cannot be rendered for an organization unless a user has the required permissions. Since the user does not have the necessary permissions, this is no-op.",cannotRenderAPIKeysComponentForUserWhenDisabled:"The <APIKeys/> component cannot be rendered when user API keys are disabled. Since user API keys are disabled, this is no-op.",cannotRenderAPIKeysComponentForOrgWhenDisabled:"The <APIKeys/> component cannot be rendered when organization API keys are disabled. Since organization API keys are disabled, this is no-op.",cannotRenderOAuthConsentComponentWhenUserDoesNotExist:"<OAuthConsent/> cannot render unless a user is signed in. Since no user is signed in, this is no-op."};for(let t of Object.keys(e$)){let e=e$[t];"function"!=typeof e&&(e$[t]=eH(e))}let eY="clerk:beforeunload",eX=["http:","https:","wails:","chrome-extension:"];function eQ(t){let e=new URL(t,window.location.href);window.dispatchEvent(new CustomEvent(eY)),window.location.href=e.href}function eZ(t){return/^http(s)?:\/\//.test(t||"")}function e0(t){return t.startsWith("/")}function e1(t,e){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object")}function e2(t,e,i){if(!e.has(t))throw TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function e8(t,e){var i=e2(t,e,"get");return i.get?i.get.call(t):i.value}function e3(t,e,i){e1(t,e),e.set(t,i)}function e5(t,e,i){var r=e2(t,e,"set");if(r.set)r.set.call(t,i);else{if(!r.writable)throw TypeError("attempted to set read only private field");r.value=i}return i}function e6(t,e,i){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return i}function e4(t,e){e1(t,e),e.add(t)}var e9=(E=new WeakMap,P=new WeakMap,T=new WeakSet,class{isEventThrottled(t){let e=Date.now(),i=e6(this,T,iu).call(this,t),r=e8(this,E).getItem(i);return!(!r||e-r>e8(this,P))||(e8(this,E).setItem(i,e),!1)}constructor(t){e4(this,T),e3(this,E,{writable:!0,value:void 0}),e3(this,P,{writable:!0,value:864e5}),e5(this,E,t)}}),e7=(O=new WeakMap,R=new WeakSet,class{getItem(t){return e6(this,R,ih).call(this)[t]}setItem(t,e){try{let i=e6(this,R,ih).call(this);i[t]=e,localStorage.setItem(e8(this,O),JSON.stringify(i))}catch(t){t instanceof DOMException&&("QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name)&&localStorage.length>0&&localStorage.removeItem(e8(this,O))}}removeItem(t){try{let e=e6(this,R,ih).call(this);delete e[t],localStorage.setItem(e8(this,O),JSON.stringify(e))}catch{}}static isSupported(){return"u">typeof window&&!!window.localStorage}constructor(){e4(this,R),e3(this,O,{writable:!0,value:"clerk_telemetry_throttler"})}}),it=(M=new WeakMap,N=new WeakMap,class{getItem(t){return e8(this,M).size>e8(this,N)?void e8(this,M).clear():e8(this,M).get(t)}setItem(t,e){e8(this,M).set(t,e)}removeItem(t){e8(this,M).delete(t)}constructor(){e3(this,M,{writable:!0,value:new Map}),e3(this,N,{writable:!0,value:1e4})}});let ie=new Set(["error","warn","info","debug","trace"]);var ii=(z=new WeakMap,W=new WeakMap,F=new WeakMap,D=new WeakMap,L=new WeakMap,j=new WeakSet,B=new WeakSet,J=new WeakSet,V=new WeakSet,K=new WeakSet,q=new WeakSet,H=new WeakSet,G=new WeakSet,$=new WeakSet,class{get isEnabled(){var t,e;return!("development"!==e8(this,F).instanceType||e8(this,z).disabled||"u">typeof process&&process.env&&eh(process.env.CLERK_TELEMETRY_DISABLED)||"u">typeof window&&(null==(e=window)||null==(t=e.navigator)?void 0:t.webdriver))}get isDebug(){return e8(this,z).debug||"u">typeof process&&process.env&&eh(process.env.CLERK_TELEMETRY_DEBUG)}record(t){try{let e=e6(this,G,iw).call(this,t.event,t.payload);if(e6(this,q,im).call(this,e.event,e),!e6(this,j,id).call(this,e,t.eventSamplingRate))return;e8(this,D).push({kind:"event",value:e}),e6(this,V,ig).call(this)}catch(t){console.error("[clerk/telemetry] Error recording telemetry event",t)}}recordLog(t){try{var e;if(!e6(this,B,ip).call(this,t))return;let i="string"==typeof(null==t?void 0:t.level)&&ie.has(t.level),r="string"==typeof(null==t?void 0:t.message)&&t.message.trim().length>0,n=null,s=null==t?void 0:t.timestamp;if("number"==typeof s||"string"==typeof s){let t=new Date(s);Number.isNaN(t.getTime())||(n=t)}if(!i||!r||null===n){this.isDebug&&"u">typeof console&&console.warn("[clerk/telemetry] Dropping invalid telemetry log entry",{levelIsValid:i,messageIsValid:r,timestampIsValid:null!==n});return}let a=e6(this,H,iy).call(this),o={sdk:a.name,sdkv:a.version,cv:null!=(e=e8(this,F).clerkVersion)?e:"",lvl:t.level,msg:t.message,ts:n.toISOString(),pk:e8(this,F).publishableKey||null,payload:e6(this,$,ib).call(this,t.context)};e8(this,D).push({kind:"log",value:o}),e6(this,V,ig).call(this)}catch(t){console.error("[clerk/telemetry] Error recording telemetry log entry",t)}}constructor(t){var e,i,r,n,s,a,o;e4(this,j),e4(this,B),e4(this,J),e4(this,V),e4(this,K),e4(this,q),e4(this,H),e4(this,G),e4(this,$),e3(this,z,{writable:!0,value:void 0}),e3(this,W,{writable:!0,value:void 0}),e3(this,F,{writable:!0,value:{}}),e3(this,D,{writable:!0,value:[]}),e3(this,L,{writable:!0,value:null}),e5(this,z,{maxBufferSize:null!=(e=t.maxBufferSize)?e:5,samplingRate:null!=(i=t.samplingRate)?i:1,perEventSampling:null==(r=t.perEventSampling)||r,disabled:null!=(n=t.disabled)&&n,debug:null!=(s=t.debug)&&s,endpoint:"https://clerk-telemetry.com"}),!t.clerkVersion&&"u"<typeof window?e8(this,F).clerkVersion="":e8(this,F).clerkVersion=null!=(a=t.clerkVersion)?a:"",e8(this,F).sdk=t.sdk,e8(this,F).sdkVersion=t.sdkVersion,e8(this,F).publishableKey=null!=(o=t.publishableKey)?o:"";const l=t5(t.publishableKey);l&&(e8(this,F).instanceType=l.instanceType),t.secretKey&&(e8(this,F).secretKey=t.secretKey.substring(0,16)),e5(this,W,new e9(e7.isSupported()?new e7:new it))}});let ir="COMPONENT_MOUNTED",is=new Set(["SignIn","SignUp"]);function ia(t){return function(e,i,r){var n,s,a;return{event:t,eventSamplingRate:t===ir?is.has(e)?1:.1:.1,payload:{component:e,appearanceProp:!!(null==i?void 0:i.appearance),theme:!!(null==i||null==(n=i.appearance)?void 0:n.theme),elements:!!(null==i||null==(s=i.appearance)?void 0:s.elements),variables:!!(null==i||null==(a=i.appearance)?void 0:a.variables),...r}}}}function io(t,e,i){return ia(ir)(t,e,i)}function il(t,e,i){return ia("COMPONENT_OPENED")(t,e,i)}function ic(t){return"string"==typeof t?t:"object"==typeof t&&null!==t&&"name"in t&&"string"==typeof t.name?t.name:void 0}function iu(t){let{sk:e,pk:i,payload:r,...n}=t,s={...r,...n};return JSON.stringify(Object.keys({...r,...n}).sort().map(t=>s[t]))}function ih(){try{let t=localStorage.getItem(e8(this,O));if(!t)return{};return JSON.parse(t)}catch{return{}}}function id(t,e){return this.isEnabled&&!this.isDebug&&e6(this,J,i_).call(this,t,e)}function ip(t){return!0}function i_(t,e){let i=Math.random();return!!(i<=e8(this,z).samplingRate&&(!1===e8(this,z).perEventSampling||void 0===e||i<=e))&&!e8(this,W).isEventThrottled(t)}function ig(){if("u"<typeof window)return void e6(this,K,iv).call(this);if(e8(this,D).length>=e8(this,z).maxBufferSize){e8(this,L)&&("u">typeof cancelIdleCallback?cancelIdleCallback(Number(e8(this,L))):clearTimeout(Number(e8(this,L)))),e6(this,K,iv).call(this);return}e8(this,L)||("requestIdleCallback"in window?e5(this,L,requestIdleCallback(()=>{e6(this,K,iv).call(this),e5(this,L,null)})):e5(this,L,setTimeout(()=>{e6(this,K,iv).call(this),e5(this,L,null)},0)))}function iv(){let t=[...e8(this,D)];if(e5(this,D,[]),e5(this,L,null),0===t.length)return;let e=t.filter(t=>"event"===t.kind).map(t=>t.value),i=t.filter(t=>"log"===t.kind).map(t=>t.value);e.length>0&&fetch(new URL("/v1/event",e8(this,z).endpoint),{headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST",body:JSON.stringify({events:e})}).catch(()=>void 0),i.length>0&&fetch(new URL("/v1/logs",e8(this,z).endpoint),{headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST",body:JSON.stringify({logs:i})}).catch(()=>void 0)}function im(t,e){this.isDebug&&(void 0!==console.groupCollapsed?(console.groupCollapsed("[clerk/telemetry]",t),console.log(e),console.groupEnd()):console.log("[clerk/telemetry]",t,e))}function iy(){let t={name:e8(this,F).sdk,version:e8(this,F).sdkVersion};if("u">typeof window){let e=window;if(e.Clerk){let i=e.Clerk;if("object"==typeof i&&null!==i&&"constructor"in i&&"function"==typeof i.constructor&&i.constructor.sdkMetadata){let{name:e,version:r}=i.constructor.sdkMetadata;void 0!==e&&(t.name=e),void 0!==r&&(t.version=r)}}}return t}function iw(t,e){var i,r;let n=e6(this,H,iy).call(this);return{event:t,cv:null!=(i=e8(this,F).clerkVersion)?i:"",it:null!=(r=e8(this,F).instanceType)?r:"",sdk:n.name,sdkv:n.version,...e8(this,F).publishableKey?{pk:e8(this,F).publishableKey}:{},...e8(this,F).secretKey?{sk:e8(this,F).secretKey}:{},payload:e}}function ib(t){if(null==t||"object"!=typeof t)return null;try{let e=JSON.parse(JSON.stringify(t));if(e&&"object"==typeof e&&!Array.isArray(e))return e;return null}catch{return null}}var ik=s(7009);let iS=!1,iA=null,iI=!1,iU=[];function ix(t,e,i,r){iS&&(iU.push({level:t,message:e,context:i,source:r,ts:Date.now()}),iU.length>200&&iU.shift())}async function iC(t){try{if(!iS||iA)return;let{getDebugLogger:e}=await Promise.all([s.e("545"),s.e("698")]).then(s.bind(s,1521)),i=await e({logLevel:null==t?void 0:t.logLevel,telemetryCollector:null==t?void 0:t.telemetryCollector});if(i&&(iA=i)&&0!==iU.length){for(let t of iU){let e={...t.context||{},__preInit:!0,__preInitTs:t.ts};switch(t.level){case"error":iA.error(t.message,e,t.source);break;case"warn":iA.warn(t.message,e,t.source);break;case"info":iA.info(t.message,e,t.source);break;case"debug":iA.debug(t.message,e,t.source)}}iU.length=0}}catch(t){try{var e,i;null==(e=(i=console).debug)||e.call(i,"Debug logger initialization failed",t)}catch{}return}}let iE={debug(t,e,i){iA?iA.debug(t,e,i):ix("debug",t,e,i)},error(t,e,i){iA?iA.error(t,e,i):ix("error",t,e,i)},info(t,e,i){iA?iA.info(t,e,i):ix("info",t,e,i)},warn(t,e,i){iA?iA.warn(t,e,i):ix("warn",t,e,i)}},iP={initialDelay:125,maxDelayBetweenRetries:0,factor:2,shouldRetry:(t,e)=>e<5,retryImmediately:!1,jitter:!0},iT=async t=>new Promise(e=>setTimeout(e,t)),iO=(t,e)=>e?t*(1+Math.random()):t,iR=async function(t){var e;let i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,{shouldRetry:s,initialDelay:a,maxDelayBetweenRetries:o,factor:l,retryImmediately:c,jitter:u,onBeforeRetry:h}={...iP,...r},d=(e={initialDelay:a,maxDelayBetweenRetries:o,factor:l,jitter:u},i=0,async()=>{let t;await iT((t=iO(t=e.initialDelay*Math.pow(e.factor,i),e.jitter),Math.min(e.maxDelayBetweenRetries||t,t))),i++});for(;;)try{return await t()}catch(t){if(!s(t,++n))throw t;h&&await h(n),c&&1===n?await iT(iO(100,u)):await d()}},iM=async t=>iR(t,{initialDelay:100,shouldRetry:(t,e)=>e<=3,retryImmediately:!0,factor:2});var iN=new WeakMap;class iz{import(t){return o(this,iN)[t]?o(this,iN)[t]():Promise.resolve(void 0)}constructor(){c(this,iN,{writable:!0,value:{"@zxcvbn-ts/core":()=>iM(()=>Promise.all([s.e("729"),s.e("545")]).then(s.bind(s,1835))),"@zxcvbn-ts/language-common":()=>iM(()=>s.e("873").then(s.bind(s,3618))),"@base-org/account":()=>iM(()=>Promise.all([s.e("994"),s.e("929"),s.e("545")]).then(s.bind(s,5540))),"@coinbase/wallet-sdk":()=>iM(()=>Promise.all([s.e("994"),s.e("929"),s.e("545")]).then(s.bind(s,9589))),"@stripe/stripe-js":()=>iM(()=>s.e("279").then(s.bind(s,8755)))}})}}let iW=function(){let t,e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!i)return{track:async t=>{await t()},isUnloading:()=>!1};let r=(t=!1,e=()=>t=!0,{startListening:()=>{window.addEventListener("beforeunload",e),window.addEventListener(eY,e)},stopListening:()=>{window.removeEventListener("beforeunload",e),window.removeEventListener(eY,e)},isUnloading:()=>t});return{track:async t=>{r.startListening(),await t(),r.stopListening()},isUnloading:r.isUnloading}},iF=t=>({amount:t.amount,amountFormatted:t.amount_formatted,currency:t.currency,currencySymbol:t.currency_symbol}),iD=t=>({proration:t.proration?{amount:iF(t.proration.amount),cycleDaysRemaining:t.proration.cycle_days_remaining,cycleDaysTotal:t.proration.cycle_days_total,cycleRemainingPercent:t.proration.cycle_remaining_percent}:null,payer:t.payer?{remainingBalance:iF(t.payer.remaining_balance),appliedAmount:iF(t.payer.applied_amount)}:null,total:iF(t.total)}),iL=t=>{let e={grandTotal:iF(t.grand_total),subtotal:iF(t.subtotal),taxTotal:iF(t.tax_total)};return"past_due"in t&&(e.pastDue=t.past_due?iF(t.past_due):null),"credit"in t&&(e.credit=t.credit?iF(t.credit):null),"per_unit_totals"in t&&(e.perUnitTotals=t.per_unit_totals?t.per_unit_totals.map(t=>({name:t.name,blockSize:t.block_size,tiers:t.tiers.map(t=>({quantity:t.quantity,feePerBlock:iF(t.fee_per_block),total:iF(t.total)}))})):void 0),"credits"in t&&(e.credits=t.credits?iD(t.credits):null),"total_due_now"in t&&(e.totalDueNow=iF(t.total_due_now)),"total_due_after_free_trial"in t&&(e.totalDueAfterFreeTrial=t.total_due_after_free_trial?iF(t.total_due_after_free_trial):null),e};function ij(t){return decodeURIComponent(globalThis.atob(t.replace(/_/g,"/").replace(/-/g,"+")).split("").map(t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join(""))}function iB(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return t.errors&&!!t.errors.find(t=>t.code===e)}let iJ=tN({packageName:"@clerk/clerk-js"});function iV(t){let e=(t||"").split("."),[i,r,n]=e;if(3!==e.length||!i||!r||!n)throw Error("JWT could not be decoded");let s=JSON.parse(ij(r)),a={__raw:t};return Object.keys(s).forEach(t=>{a[t]=s[t]}),{encoded:{header:i,payload:r,signature:n},header:JSON.parse(ij(i)),claims:a}}function iK(){if(!tp())return null;try{var t;let e=null==(t=navigator)?void 0:t.language;if(!e||"string"!=typeof e||""===e.trim())return null;return e}catch{return null}}function iq(){return void 0!==globalThis.document}function iH(){if(!function(){if(!iq())return!1;try{return window.self!==window.top}catch{return!0}}())return!1;try{var t;return null==(t=window.top)||t.location.href,!1}catch{return!0}}s(2033);let iG={build:(t,e,i)=>[t,e,i].filter(Boolean).join("-"),parse:(t,e,i)=>{let r=iG.extractTemplate(t,e,i);return{organizationId:i,sessionId:e,template:r}},extractTemplate:(t,e,i)=>{if(t===e||i&&t==="".concat(e,"-").concat(i))return;let r=t.slice(e.length+1);return i&&r.endsWith("-".concat(i))&&(r=r.slice(0,-(i.length+1))),r||void 0}},i$="ClerkJS:";function iY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";throw Error("".concat(i$," Something went wrong initializing Clerk in development mode.").concat(t&&" ".concat(t)))}function iX(t){throw Error("".concat(i$," Something went wrong initializing Clerk during the ").concat(t," flow. Please contact support."))}function iQ(t){throw Error("".concat(i$," You need to start a ").concat(t," flow by calling ").concat(t,".create() first."))}function iZ(t,e){throw Error("".concat(i$,' Strategy "').concat(e,'" is not a valid strategy for ').concat(t,"."))}function i0(t){throw Error("".concat(i$," You need to start a ").concat(t," flow by calling ").concat(t,".create({ identifier: 'your web3 wallet address' }) first"))}function i1(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";throw Error("".concat(i$," Missing '").concat(t,"' option"))}function i2(t,e){throw Error("".concat(i$," Response: ").concat(t||0," not supported yet.\nFor more information contact us at ").concat(e))}function i8(t){throw Error("".concat(i$," Missing publicKey. When calling 'navigator.credentials.").concat(t,"()' it is required to pass a publicKey object."))}function i3(t,e){return e.get?e.get.call(t):e.value}function i5(t,e){if(void 0===t)throw TypeError("attempted to "+e+" private static field before its declaration")}function i6(t,e){var i=function(t,e){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return e.get(t)}(t,e);return i3(t,i)}function i4(t,e,i){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object");e.set(t,i)}function i9(t,e,i){return i7(t,e),i5(i,"get"),i3(t,i)}function i7(t,e){if(t!==e)throw TypeError("Private static access of wrong provenance")}var rt=(Y=new WeakMap,X=new WeakMap,Q=new WeakMap,Z=class t{static getInstance(){return i9(t,Z,tt)||function(t,e,i,r){i7(t,e),i5(i,"set");if(i.set)i.set.call(t,r);else{if(!i.writable)throw TypeError("attempted to set read only private field");i.value=r}}(t,Z,tt,new t),i9(t,Z,tt)}constructor(){if(i4(this,Y,{writable:!0,value:[]}),i4(this,X,{writable:!0,value:{metamask:"MetaMask",okx_wallet:"OKX Wallet"}}),!function(t,e){"get"in t?Object.defineProperty(t,"get",{value:e,enumerable:!0,configurable:!0,writable:!0}):t.get=e}(this,t=>{var e;let i=null==(e=i6(this,Y).find(e=>e.info.name===i6(this,X)[t]))?void 0:e.provider;return void 0!==i?i:window.ethereum}),i4(this,Q,{writable:!0,value:t=>{i6(this,Y).some(e=>e.info.uuid===t.detail.info.uuid)||i6(this,Y).push(t.detail)}}),"u"<typeof window)return;window.addEventListener("eip6963:announceProvider",i6(this,Q)),window.dispatchEvent(new Event("eip6963:requestProvider"))}},tt={writable:!0,value:null},Z);function re(t,e){if(e.has(t))throw TypeError("Cannot initialize the same private elements twice on an object")}function ri(t,e){return e.get?e.get.call(t):e.value}function rr(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw TypeError("attempted to set read only private field");e.value=i}}function rn(t,e){if(void 0===t)throw TypeError("attempted to "+e+" private static field before its declaration")}function rs(t,e,i){if(!e.has(t))throw TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function ra(t,e){var i=rs(t,e,"get");return ri(t,i)}function ro(t,e,i){re(t,e),e.set(t,i)}function rl(t,e,i){var r=rs(t,e,"set");return rr(t,r,i),i}function rc(t,e,i){if(!e.has(t))throw TypeError("attempted to get private field on non-instance");return i}function ru(t,e){re(t,e),e.add(t)}function rh(t,e,i){return rd(t,e),rn(i,"get"),ri(t,i)}function rd(t,e){if(t!==e)throw TypeError("Private static access of wrong provenance")}var rp=(te=new WeakMap,ti=new WeakMap,tr=new WeakSet,tn=new WeakSet,ts=new WeakSet,ta=class t{static getInstance(){var e,i,r;return rh(t,ta,to)||(e=ta,i=to,r=new t,rd(t,e),rn(i,"set"),rr(t,i,r)),rh(t,ta,to)}constructor(){ru(this,tr),ru(this,tn),ru(this,ts),ro(this,te,{writable:!0,value:void 0}),ro(this,ti,{writable:!0,value:!1}),function(t,e){"get"in t?Object.defineProperty(t,"get",{value:e,enumerable:!0,configurable:!0,writable:!0}):t.get=e}(this,async t=>{await rc(this,tr,rf).call(this);let e=(ra(this,te)||[]).find(e=>e.name===t&&rc(this,tn,r_).call(this,e)&&rc(this,ts,rg).call(this,e));if(e&&rc(this,tn,r_).call(this,e))return e;if("u"<typeof window)return;let i=window.solana;if(i&&"function"==typeof i.connect&&"function"==typeof i.signMessage)return i})}},to={writable:!0,value:null},ta);async function rf(){if(ra(this,ti))return;rl(this,ti,!0);let t=await s.e("647").then(s.bind(s,7410)).then(t=>t.getWallets());rl(this,te,t.get()),t.on("register",()=>{rl(this,te,t.get())}),t.on("unregister",()=>{rl(this,te,t.get())})}function r_(t){var e,i;return null!=(e=null==(i=t.chains)?void 0:i.some(t=>t.startsWith("solana:")))&&e}function rg(t){return"solana:signMessage"in t.features}let rv=()=>(function(t){let e=tN({packageName:"@clerk/shared"});async function i(t){let{provider:e,walletName:i}=t,r=await f(e,i);if(!r)return"";if("solana"===e){let t=await r.features["standard:connect"].connect();return t&&t.accounts[0].address||""}let n=await r.request({method:"eth_requestAccounts"});return n&&n[0]||""}let r=async t=>{let{identifier:e,nonce:i,provider:r,walletName:n=""}=t,s=await f(r,n);if(!s)return"";if("solana"===r)try{var a,o;let t=s.accounts.find(t=>t.address===e);if(!t)return console.warn("Wallet account with address ".concat(e," not found")),"";let r=await (null==(a=s.features["solana:signMessage"])?void 0:a.signMessage({account:t,message:new TextEncoder().encode(i)}));return(null==r||null==(o=r[0])?void 0:o.signature)?btoa(String.fromCharCode(...r[0].signature)):""}catch(t){if(t instanceof Error&&t.message.includes("User rejected the request."))throw new tU("Web3 signature request was rejected by the user.",{code:"web3_signature_request_rejected"});throw new tU("An error occurred while generating the Solana signature.",{code:"web3_solana_signature_generation_failed",cause:t instanceof Error?t:void 0})}return await s.request({method:"personal_sign",params:["0x".concat(i.split("").map(t=>t.charCodeAt(0).toString(16).padStart(2,"0")).join("")),e]})};async function n(){return await i({provider:"metamask"})}async function s(){return await i({provider:"coinbase_wallet"})}async function a(){return await i({provider:"okx_wallet"})}async function o(){return await i({provider:"base"})}async function l(t){return await i({provider:"solana",walletName:t})}async function c(t){return await r({...t,provider:"metamask"})}async function u(t){return await r({...t,provider:"coinbase_wallet"})}async function h(t){return await r({...t,provider:"okx_wallet"})}async function d(t){return await r({...t,provider:"base"})}async function p(t){return await r({...t,provider:"solana"})}async function f(i,r){var n,s,a,o,l,c;if("coinbase_wallet"===i){let e=await t.import("@coinbase/wallet-sdk");return e?e.createCoinbaseWalletSDK({appName:"u">typeof window&&(null==(a=window.Clerk)||null==(s=a.__internal_environment)||null==(n=s.displayConfig)?void 0:n.applicationName)||"u">typeof document&&document.title||"Web3 Application",preference:{options:"all"}}).getProvider():null}if("base"===i)try{let e=await t.import("@base-org/account");if(!e)return null;return e.createBaseAccountSDK({appName:"u">typeof window&&(null==(c=window.Clerk)||null==(l=c.__internal_environment)||null==(o=l.displayConfig)?void 0:o.applicationName)||"u">typeof document&&document.title||"Web3 Application"}).getProvider()}catch{return null}return"solana"===i?r&&0!==r.length?await rp.getInstance().get(r):void e.throw("Wallet name must be provided to get Solana wallet provider"):rt.getInstance().get(i)}return{getWeb3Identifier:i,generateWeb3Signature:r,getMetamaskIdentifier:n,getCoinbaseWalletIdentifier:s,getOKXWalletIdentifier:a,getBaseIdentifier:o,getSolanaIdentifier:l,generateSignatureWithMetamask:c,generateSignatureWithCoinbaseWallet:u,generateSignatureWithOKXWallet:h,generateSignatureWithBase:d,generateSignatureWithSolana:p}})(new iz),rm="environment",ry=JSON.stringify,rw=JSON.parse;class rb{static _key(t){return"".concat("__clerk_").concat(t)}static isExpired(t){return!!t.exp&&Date.now()>t.exp}static setItem(t,e,i){try{let r={value:e,...i&&{exp:Date.now()+i}};window.localStorage.setItem(this._key(t),ry(r))}catch{}}static getItem(t,e){try{var i;let r=window.localStorage.getItem(this._key(t));if(!r)return e;let n=rw(r);if(!n)return e;if(this.isExpired(n))return this.removeItem(t),e;return null!=(i=null==n?void 0:n.value)?i:e}catch{return e}}static removeItem(t){try{window.localStorage.removeItem(this._key(t))}catch{}}}async function rk(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,{async:i,defer:r,beforeLoad:n,crossOrigin:s,nonce:a}=e||{};return iR(()=>new Promise((e,o)=>{t||o(Error("loadScript cannot be called without a src")),document&&document.body||o(Error("loadScript cannot be called when document does not exist"));let l=document.createElement("script");s&&l.setAttribute("crossorigin",s),l.async=i||!1,l.defer=r||!1,l.addEventListener("load",()=>{l.remove(),e(l)}),l.addEventListener("error",e=>{var i;l.remove(),o(null!=(i=e.error)?i:Error("failed to load script: ".concat(t)))}),l.src=t,l.nonce=a,null==n||n(l),document.body.appendChild(l)}),{shouldRetry:(t,e)=>e<=5})}async function rS(t){return window.turnstile||await rA(t).catch(()=>{throw{captchaError:"captcha_script_failed_to_load"}}),window.turnstile}async function rA(t){try{return await rk("https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",{defer:!0,nonce:t})}catch(t){throw console.warn("Clerk: Failed to load the CAPTCHA script from Cloudflare. If you see a CSP error in your browser, please add the necessary CSP rules to your app. Visit https://clerk.com/docs/security/clerk-csp for more information."),t}}function rI(t){try{let e=t.getAttribute("data-cl-theme")||void 0,i=t.getAttribute("data-cl-language")||void 0,r=t.getAttribute("data-cl-size")||void 0;return{theme:e,language:i,size:r}}catch{return{theme:void 0,language:void 0,size:void 0}}}let rU=async t=>{let e,i,r,n,{siteKey:s,widgetType:a,invisibleSiteKey:o,nonce:l}=t,{modalContainerQuerySelector:c,modalWrapperQuerySelector:u,closeModal:h,openModal:d}=t,p=await rS(l),f=[],_="",g="",v=s,m=0,y=null,w="invisible";if(c&&u){y=a,n=c,w="modal";try{await (null==d?void 0:d())}catch{throw{captchaError:"modal_component_not_ready"}}let t=await new Promise(t=>{if(document.querySelector(c))return t(document.querySelector(c));let e=new MutationObserver(()=>{document.querySelector(c)&&(e.disconnect(),t(document.querySelector(c)))});e.observe(document.body,{childList:!0,subtree:!0})});if(t){let{theme:n,language:s,size:a}=rI(t);e=n,r=s,i=a}}if(!n&&"smart"===a){let t=document.getElementById(tX);if(t){w="smart",y="smart",n="#".concat(tX),t.style.maxHeight="0";let{theme:s,language:a,size:o}=rI(t);e=s,r=a,i=o}else console.error("Cannot initialize Smart CAPTCHA widget because the `clerk-captcha` DOM element was not found; falling back to Invisible CAPTCHA widget. If you are using a custom flow, visit https://clerk.com/docs/guides/development/custom-flows/authentication/bot-sign-up-protection for instructions")}if(!n){w="invisible",v=o,y="invisible",n=".".concat(tQ);let t=document.createElement("div");t.classList.add(tQ),t.style.display="none",document.body.appendChild(t)}let b=async()=>new Promise((s,a)=>{try{let o=p.render(n,{sitekey:v,appearance:"interaction-only",theme:e||"auto",size:i||"normal",language:r||"auto",action:t.action,retry:"never","refresh-expired":"auto",callback:function(t){null==h||h(),s([t,o])},"before-interactive-callback":()=>{if(u){let t=document.querySelector(u);null==t||t.style.setProperty("visibility","visible"),null==t||t.style.setProperty("pointer-events","all")}else{let t=document.getElementById(tX);t&&(t.style.maxHeight="unset",t.style.minHeight="compact"===i?"140px":"68px",t.style.marginBottom="1.5rem")}},"error-callback":function(t){var e;(f.push(t),m<2&&(e=t.toString(),["crashed","undefined_error","102","103","104","106","110600","300","600"].find(t=>e.startsWith(t))))?setTimeout(()=>{n&&!document.querySelector(n)?a([f.join(","),o]):(p.reset(o),m++)},250):a([f.join(","),o])},"unsupported-callback":function(){return a(["This browser is not supported by the CAPTCHA.",o]),!0}})}catch(t){a([t,void 0])}});try{[_,g]=await b(),p.remove(g)}catch(i){let[t,e]=i;throw e&&p.remove(e),{captchaError:t}}finally{if("modal"===w&&(null==h||h()),"invisible"===w){let t=document.querySelector(".".concat(tQ));t&&document.body.removeChild(t)}if("smart"===w){let t=document.getElementById(tX);t&&(t.style.maxHeight="0",t.style.minHeight="unset",t.style.marginBottom="unset")}}return{captchaToken:_,captchaWidgetType:y}},rx=t=>{var e;let i=t.__internal_environment,r=i?i.displayConfig.captchaProvider:"turnstile",n=null==(e=t.__internal_getOption)?void 0:e.call(t,"nonce");return{captchaSiteKey:i?i.displayConfig.captchaPublicKey:null,captchaWidgetType:i?i.displayConfig.captchaWidgetType:null,captchaProvider:r,captchaPublicKeyInvisible:i?i.displayConfig.captchaPublicKeyInvisible:null,canUseCaptcha:i?i.userSettings.signUp.captcha_enabled&&t.isStandardBrowser:null,nonce:n||void 0}};class rC{async invisible(t){let{captchaSiteKey:e,canUseCaptcha:i,captchaPublicKeyInvisible:r,nonce:n}=rx(this.clerk);return i&&e&&r?{...await rU({action:null==t?void 0:t.action,captchaProvider:"turnstile",invisibleSiteKey:r,nonce:(null==t?void 0:t.nonce)||n||void 0,siteKey:r,widgetType:"invisible"}).catch(t=>t.captchaError?{captchaError:t.captchaError}:{captchaError:(null==t?void 0:t.message)||t||"unexpected_captcha_error"}),captchaAction:null==t?void 0:t.action}:{captchaError:"captcha_unavailable",captchaAction:null==t?void 0:t.action}}async managedOrInvisible(t){let{captchaSiteKey:e,canUseCaptcha:i,captchaWidgetType:r,captchaProvider:n,captchaPublicKeyInvisible:s,nonce:a}=rx(this.clerk);if(i&&e&&s){let i=await rU({captchaProvider:n,invisibleSiteKey:s,nonce:a||void 0,siteKey:e,widgetType:r,...t}).catch(e=>e.captchaError?{captchaError:e.captchaError}:(null==t?void 0:t.action)==="verify"?{captchaError:(null==e?void 0:e.message)||e||"unexpected_captcha_error"}:void 0);return(null==t?void 0:t.action)==="verify"?{...i,captchaAction:"verify"}:i}return(null==t?void 0:t.action)==="verify"?{captchaError:"captcha_unavailable",captchaAction:null==t?void 0:t.action}:{}}async managedInModal(t){if("u"<typeof document)throw new tU("Captcha is not supported in non-browser environments",{code:"captcha_unavailable"});return this.managedOrInvisible({modalWrapperQuerySelector:"#cl-modal-captcha-wrapper",modalContainerQuerySelector:"#cl-modal-captcha-container",openModal:()=>this.clerk.__internal_openBlankCaptchaModal(),closeModal:()=>this.clerk.__internal_closeBlankCaptchaModal(),action:null==t?void 0:t.action})}constructor(t){(0,td._)(this,"clerk",void 0),this.clerk=t}}class rE{static getInstance(){return rE.instance||(rE.instance=new rE(nL,rC)),rE.instance}async execute(t,e){if(this.captchaAttemptsExceeded())throw new tU("Security verification failed. Please try again by refreshing the page, clearing your browser cookies, or using a different web browser.",{code:"captcha_client_attempts_exceeded"});try{return this.inflightException&&await this.inflightException,await e()}catch(n){var i;let r;if(!tT(n)||tx(n)&&"network_error"===n.code||(null==(i=n.errors[0])?void 0:i.code)!=="requires_captcha")throw n;if(this.inflightException)return await this.inflightException,await e();this.inflightException=new Promise(t=>r=t);try{let e=await this.managedChallenge(t);(null==e?void 0:e.captchaError)!=="modal_component_not_ready"&&(await this.client.getOrCreateInstance().__internal_sendCaptchaToken(e),this.captchaRetryCount=0)}catch(t){throw this.captchaRetryCount++,t}finally{r(),this.inflightException=null}return await e()}}managedChallenge(t){return new this.CaptchaChallengeImpl(t).managedInModal({action:"verify"})}constructor(t,e){(0,td._)(this,"client",void 0),(0,td._)(this,"CaptchaChallengeImpl",void 0),(0,td._)(this,"inflightException",void 0),(0,td._)(this,"captchaRetryCount",void 0),(0,td._)(this,"MAX_RETRY_ATTEMPTS",void 0),(0,td._)(this,"captchaAttemptsExceeded",void 0),this.client=t,this.CaptchaChallengeImpl=e,this.inflightException=null,this.captchaRetryCount=0,this.MAX_RETRY_ATTEMPTS=3,this.captchaAttemptsExceeded=()=>this.captchaRetryCount>=this.MAX_RETRY_ATTEMPTS}}(0,td._)(rE,"instance",void 0);class rP{static get fapiClient(){return rP.clerk.getFapiClient()}async reload(t){let{rotatingTokenNonce:e}=t||{};return this._baseGet({forceUpdateClient:!0,rotatingTokenNonce:e})}isNew(){return!this.id}static async _fetch(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return rE.getInstance().execute(this.clerk,()=>this._baseFetch(t,e))}static async _baseFetch(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};rP.fapiClient||function(){throw Error("".concat(i$," Missing FAPI client in resources."))}();let{fetchMaxTries:r}=i;try{e=await rP.fapiClient.request(t,{fetchMaxTries:r})}catch(e){if(this.shouldRethrowOfflineNetworkErrors())throw new tU((null==e?void 0:e.message)||e,{code:"network_error"});if(!tv())return iE.warn("Network request failed while offline, returning null",{method:t.method,path:t.path},"baseResource"),null;throw e}let{payload:n,status:s,statusText:a,headers:o}=e;if(o){let t=o.get("x-country");this.clerk.__internal_setCountry(t?t.toLowerCase():null)}if(("GET"!==t.method||i.forceUpdateClient)&&!i.skipUpdateClient&&this._updateClient(n),s>=200&&s<=299)return n;if(s>=400){var l,c;let t=null==n?void 0:n.errors,e=null==t||null==(l=t[0])?void 0:l.long_message,i=null==t||null==(c=t[0])?void 0:c.code;401===s&&"dev_browser_unauthenticated"===i?await rP.clerk.__internal_handleUnauthenticatedDevBrowser():401===s&&"requires_captcha"!==i&&await rP.clerk.handleUnauthenticated(),function(t,e){var i;if(!e||!e[0])return;let r=e[0],n=r.long_message;if("origin_invalid"===r.code&&((i=rP.clerk.publishableKey).startsWith("live_")||i.startsWith("pk_live_"))){let i=rP.clerk.frontendApi.replace("clerk.","");throw new tP('Clerk: Production Keys are only allowed for domain "'.concat(i,'". \nAPI Error: ').concat(n),{data:e,status:t})}}(s,t);let r={data:t,status:s};if(429===s&&o){let t=o.get("retry-after");if(t){let e=parseInt(t,10);isNaN(e)||(r.retryAfter=e)}}throw new tP(e||a,r)}return null}static _updateClient(t){let e=nD(t);e&&rP.clerk&&rP.clerk.updateClient(e)}path(t){let e=this.pathRoot;if(this.isNew())return e;let i=e.replace(/[^/]$/,"$&/")+encodeURIComponent(this.id);return t?i.replace(/[^/]$/,"$&/")+encodeURIComponent(t):i}withDefault(t,e){return null!=t?t:e}async _baseGet(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=await rP._fetch({method:"GET",path:this.path(),rotatingTokenNonce:t.rotatingTokenNonce},t);return this.fromJSON((null==e?void 0:e.response)||e)}async _baseMutate(t){let{action:e,body:i,method:r,path:n}=t,s=await rP._fetch({method:r,path:n||this.path(e),body:i});return this.fromJSON((null==s?void 0:s.response)||s)}async _baseMutateBypass(t){let{action:e,body:i,method:r,path:n}=t,s=await rP._baseFetch({method:r,path:n||this.path(e),body:i});return this.fromJSON((null==s?void 0:s.response)||s)}async _basePost(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._baseMutate({...t,method:"POST"})}async _basePostBypass(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._baseMutateBypass({...t,method:"POST"})}async _basePut(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._baseMutate({...t,method:"PUT"})}async _basePatch(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._baseMutate({...t,method:"PATCH"})}async _baseDelete(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};await this._baseMutate({...t,method:"DELETE"})}static shouldRethrowOfflineNetworkErrors(){var t,e;let i=null==(e=rP.clerk)||null==(t=e.__internal_getOption)?void 0:t.call(e,"experimental");return(null==i?void 0:i.rethrowOfflineNetworkErrors)||!1}constructor(){(0,td._)(this,"id",void 0),(0,td._)(this,"pathRoot","")}}function rT(t){let e=new Date(t||new Date);return e instanceof Date&&!isNaN(e.getTime())?e:new Date}(0,td._)(rP,"clerk",void 0);class rO extends rP{fromJSON(t){return t&&(this.id=t.id,this.type=t.type,this.name=t.name,this.subject=t.subject,this.scopes=t.scopes,this.claims=t.claims,this.revoked=t.revoked,this.revocationReason=t.revocation_reason,this.expired=t.expired,this.expiration=t.expiration?rT(t.expiration):null,this.createdBy=t.created_by,this.description=t.description,this.secret=t.secret,this.lastUsedAt=t.last_used_at?rT(t.last_used_at):null,this.updatedAt=rT(t.updated_at),this.createdAt=rT(t.created_at)),this}__internal_toSnapshot(){return{object:"api_key",id:this.id,type:this.type,name:this.name,subject:this.subject,scopes:this.scopes,claims:this.claims,revoked:this.revoked,revocation_reason:this.revocationReason,expired:this.expired,expiration:this.expiration?this.expiration.getTime():null,created_by:this.createdBy,description:this.description,last_used_at:this.lastUsedAt?this.lastUsedAt.getTime():null,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}constructor(t){super(),(0,td._)(this,"pathRoot","/api_keys"),(0,td._)(this,"id",void 0),(0,td._)(this,"type",void 0),(0,td._)(this,"name",void 0),(0,td._)(this,"subject",void 0),(0,td._)(this,"scopes",void 0),(0,td._)(this,"claims",void 0),(0,td._)(this,"revoked",void 0),(0,td._)(this,"revocationReason",void 0),(0,td._)(this,"expired",void 0),(0,td._)(this,"expiration",void 0),(0,td._)(this,"createdBy",void 0),(0,td._)(this,"description",void 0),(0,td._)(this,"secret",void 0),(0,td._)(this,"lastUsedAt",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),this.fromJSON(t)}}class rR extends rP{fromJSON(t){return t&&(this.claimedAt=this.withDefault(t.claimed_at?rT(t.claimed_at):null,this.claimedAt),this.reverification=this.withDefault(t.reverification,this.reverification),this.singleSessionMode=this.withDefault(t.single_session_mode,this.singleSessionMode),this.preferredChannels=this.withDefault(t.preferred_channels,this.preferredChannels),this.sessionMinter=this.withDefault(t.session_minter,this.sessionMinter)),this}__internal_toSnapshot(){var t;return{claimed_at:this.claimedAt?this.claimedAt.getTime():null,id:null!=(t=this.id)?t:"",object:"auth_config",reverification:this.reverification,single_session_mode:this.singleSessionMode,session_minter:this.sessionMinter}}constructor(t=null){super(),(0,td._)(this,"claimedAt",null),(0,td._)(this,"reverification",!1),(0,td._)(this,"singleSessionMode",!1),(0,td._)(this,"preferredChannels",null),(0,td._)(this,"sessionMinter",!1),this.fromJSON(t)}}s(2301),(p=tl||(tl={}))[p.None=0]="None",p[p.Mutable=1]="Mutable",p[p.Watching=2]="Watching",p[p.RecursedCheck=4]="RecursedCheck",p[p.Recursed=8]="Recursed",p[p.Dirty=16]="Dirty",p[p.Pending=32]="Pending";let rM=[],{link:rN,unlink:rz,propagate:rW,checkDirty:rF,endTracking:rD,startTracking:rL,shallowPropagate:rj}=function(t){let{update:e,notify:i,unwatched:r}=t,n=0;return{link:function(t,e){let i,r=e.depsTail;if(void 0!==r&&r.dep===t)return;if(4&e.flags&&void 0!==(i=void 0!==r?r.nextDep:e.deps)&&i.dep===t){i.version=n,e.depsTail=i;return}let s=t.subsTail;if(void 0!==s&&s.version===n&&s.sub===e)return;let a=e.depsTail=t.subsTail={version:n,dep:t,sub:e,prevDep:r,nextDep:i,prevSub:s,nextSub:void 0};void 0!==i&&(i.prevDep=a),void 0!==r?r.nextDep=a:e.deps=a,void 0!==s?s.nextSub=a:t.subs=a},unlink:s,propagate:function(t){let e,r=t.nextSub;t:for(;;){let n=t.sub,s=n.flags;if(3&s&&(60&s?12&s?4&s?!(48&s)&&function(t,e){let i=e.depsTail;if(void 0!==i){let r=e.deps;do{if(r===t)return!0;if(r===i)break;r=r.nextDep}while(void 0!==r)}return!1}(t,n)?(n.flags=40|s,s&=1):s=0:n.flags=-9&s|32:s=0:n.flags=32|s,2&s&&i(n),1&s)){let i=n.subs;if(void 0!==i){t=i,void 0!==i.nextSub&&(e={value:r,prev:e},r=t.nextSub);continue}}if(void 0!==(t=r)){r=t.nextSub;continue}for(;void 0!==e;)if(t=e.value,e=e.prev,void 0!==t){r=t.nextSub;continue t}break}},checkDirty:function(t,i){let r,n=0;t:for(;;){let s=t.dep,o=s.flags,l=!1;if(16&i.flags)l=!0;else if((17&o)==17){if(e(s)){let t=s.subs;void 0!==t.nextSub&&a(t),l=!0}}else if((33&o)==33){(void 0!==t.nextSub||void 0!==t.prevSub)&&(r={value:t,prev:r}),t=s.deps,i=s,++n;continue}if(!l&&void 0!==t.nextDep){t=t.nextDep;continue}for(;n;){--n;let s=i.subs,o=void 0!==s.nextSub;if(o?(t=r.value,r=r.prev):t=s,l){if(e(i)){o&&a(s),i=t.sub;continue}}else i.flags&=-33;if(i=t.sub,void 0!==t.nextDep){t=t.nextDep;continue t}l=!1}return l}},endTracking:function(t){let e=t.depsTail,i=void 0!==e?e.nextDep:t.deps;for(;void 0!==i;)i=s(i,t);t.flags&=-5},startTracking:function(t){++n,t.depsTail=void 0,t.flags=-57&t.flags|4},shallowPropagate:a};function s(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.sub,i=t.dep,n=t.prevDep,s=t.nextDep,a=t.nextSub,o=t.prevSub;return void 0!==s?s.prevDep=n:e.depsTail=n,void 0!==n?n.nextDep=s:e.deps=s,void 0!==a?a.prevSub=o:i.subsTail=o,void 0!==o?o.nextSub=a:void 0===(i.subs=a)&&r(i),s}function a(t){do{let e=t.sub,r=t.nextSub,n=e.flags;(48&n)==32&&(e.flags=16|n,2&n&&i(e)),t=r}while(void 0!==t)}}({update:t=>"getter"in t?r$(t):rY(t,t.value),notify:function t(e){let i=e.flags;if(!(64&i)){e.flags=64|i;let r=e.subs;void 0!==r?t(r.sub):rM[rV++]=e}},unwatched(t){if("getter"in t){let e=t.deps;if(void 0!==e){t.flags=17;do e=rz(e,t);while(void 0!==e)}}else"previousValue"in t||r0.call(t)}}),rB=0,rJ=0,rV=0;function rK(e){let i=t;return t=e,i}function rq(t){return rZ.bind({previousValue:t,value:t,subs:void 0,subsTail:void 0,flags:1})}function rH(t){return rQ.bind({value:void 0,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:17,getter:t})}function rG(i){let r={fn:i,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:2};void 0!==t?rN(r,t):void 0!==e&&rN(r,e);let n=rK(r);try{r.fn()}finally{rK(n)}return r0.bind(r)}function r$(t){let e=rK(t);rL(t);try{let e=t.value;return e!==(t.value=t.getter(e))}finally{rK(e),rD(t)}}function rY(t,e){return t.flags=1,t.previousValue!==(t.previousValue=e)}function rX(){for(;rJ<rV;){let t=rM[rJ];rM[rJ++]=void 0,function t(e,i){if(16&i||32&i&&rF(e.deps,e)){let t=rK(e);rL(e);try{e.fn()}finally{rK(t),rD(e)}return}32&i&&(e.flags=-33&i);let r=e.deps;for(;void 0!==r;){let e=r.dep,i=e.flags;64&i&&t(e,e.flags=-65&i),r=r.nextDep}}(t,t.flags&=-65)}rJ=0,rV=0}function rQ(){let i=this.flags;if(16&i||32&i&&rF(this.deps,this)){if(r$(this)){let t=this.subs;void 0!==t&&rj(t)}}else 32&i&&(this.flags=-33&i);return void 0!==t?rN(this,t):void 0!==e&&rN(this,e),this.value}function rZ(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];if(i.length){let t=i[0];if(this.value!==(this.value=t)){this.flags=17;let t=this.subs;void 0!==t&&(rW(t),rB||rX())}}else{let e=this.value;if(16&this.flags&&rY(this,e)){let t=this.subs;void 0!==t&&rj(t)}return void 0!==t&&rN(this,t),e}}function r0(){let t=this.deps;for(;void 0!==t;)t=rz(t,this);let e=this.subs;void 0!==e&&rz(e),this.flags=0}function r1(t,e,i){if(t!==e)throw TypeError("Private static access of wrong provenance");if(void 0===i)throw TypeError("attempted to get private static field before its declaration");return n(t,i)}function r2(t){let{pageSize:e,initialPage:i,...r}=t||{},n=null!=e?e:10;return new URLSearchParams({...Object.entries(r).reduce((t,e)=>{let[i,r]=e;return void 0!==r&&(t[i]=r),t},{}),limit:n+"",offset:((null!=i?i:1)-1)*n+""})}class r8{static path(t,e){let{orgId:i}=e||{};return"".concat(i?"/organizations/".concat(i):"/me").concat(r1(r8,r8,r3)).concat(t)}constructor(){(0,td._)(this,"getPlans",async t=>{let{for:e,...i}=t||{},r={...i,payer_type:"organization"===e?"org":"user"};return await rP._fetch({path:"".concat(r1(r8,r8,r3),"/plans"),method:"GET",search:r2(r)}).then(t=>{let{data:e,total_count:i}=t;return{total_count:i,data:e.map(t=>new nm(t))}})}),(0,td._)(this,"getPlan",async t=>new nm(await rP._fetch({path:"".concat(r1(r8,r8,r3),"/plans/").concat(t.id),method:"GET"}))),(0,td._)(this,"getSubscription",async t=>await rP._fetch({path:r8.path("/subscription",{orgId:t.orgId}),method:"GET"}).then(t=>new nb(null==t?void 0:t.response))),(0,td._)(this,"getStatements",async t=>{let{orgId:e,...i}=t;return await rP._fetch({path:r8.path("/statements",{orgId:e}),method:"GET",search:r2(i)}).then(t=>{let{data:e,total_count:i}=null==t?void 0:t.response;return{total_count:i,data:e.map(t=>new ny(t))}})}),(0,td._)(this,"getStatement",async t=>{var e;return new ny(null==(e=await rP._fetch({path:r8.path("/statements/".concat(t.id),{orgId:t.orgId}),method:"GET"}))?void 0:e.response)}),(0,td._)(this,"getPaymentAttempts",async t=>{let{orgId:e,...i}=t;return await rP._fetch({path:r8.path("/payment_attempts",{orgId:e}),method:"GET",search:r2(i)}).then(t=>{let{data:e,total_count:i}=t;return{total_count:i,data:e.map(t=>new nh(t))}})}),(0,td._)(this,"getPaymentAttempt",async t=>new nh(await rP._fetch({path:r8.path("/payment_attempts/".concat(t.id),{orgId:t.orgId}),method:"GET"}))),(0,td._)(this,"startCheckout",async t=>{var e;let{orgId:i,...r}=t;return new nc(null==(e=await rP._fetch({path:r8.path("/checkouts",{orgId:i}),method:"POST",body:r}))?void 0:e.response)})}}var r3={writable:!0,value:"/billing"};let r5=rq({resource:null}),r6=rq({error:null}),r4=rq({status:"idle"}),r9=rH(()=>{let t=r5().resource,e=r6().error,i=r4().status;return{errors:no(e,{identifier:null,password:null,code:null}),fetchStatus:i,signIn:t?t.__internal_future:null}}),r7=rq({resource:null}),nt=rq({error:null}),ne=rq({status:"idle"}),ni=rH(()=>{let t=r7().resource,e=nt().error,i=ne().status;return{errors:no(e,{firstName:null,lastName:null,emailAddress:null,phoneNumber:null,password:null,username:null,code:null,captcha:null,legalAccepted:null}),fetchStatus:i,signUp:t?t.__internal_future:null}}),nr=rq({resource:null}),nn=rq({error:null}),ns=rq({status:"idle"}),na=rH(()=>{let t=nr().resource,e=nn().error,i=ns().status;return{errors:no(e,{emailAddress:null}),fetchStatus:i,waitlist:t}});function no(t,e){let i={fields:{...e},raw:null,global:null};if(!t)return i;if(!tT(t))return i.raw=[t],i.global=[tj(t)],i;function r(t){return"meta"in t&&t.meta&&"paramName"in t.meta&&void 0!==t.meta.paramName}return t.errors.some(r)?t.errors.forEach(t=>{if(i.raw?i.raw.push(t):i.raw=[t],r(t)){let e=ea(t.meta.paramName);e in i.fields&&(i.fields[e]=t)}}):(i.raw=[t],i.global=[tj(t)]),i}class nl extends rP{fromJSON(t){return t&&(this.id=t.id,t.created_at&&(this.createdAt=rT(t.created_at)),t.updated_at&&(this.updatedAt=rT(t.updated_at)),this.imageUrl=t.image_url,this.userId=t.user_id,this.email=t.email,this.firstName=t.first_name,this.lastName=t.last_name,this.organizationId=t.organization_id,this.organizationName=t.organization_name),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"imageUrl",void 0),(0,td._)(this,"userId",null),(0,td._)(this,"email",void 0),(0,td._)(this,"firstName",void 0),(0,td._)(this,"lastName",void 0),(0,td._)(this,"organizationId",null),(0,td._)(this,"organizationName",void 0),this.fromJSON(t)}}class nc extends rP{fromJSON(t){return t&&(this.id=t.id,this.externalClientSecret=t.external_client_secret,this.externalGatewayId=t.external_gateway_id,this.paymentMethod=t.payment_method?new ng(t.payment_method):void 0,this.plan=new nm(t.plan),this.planPeriod=t.plan_period,this.planPeriodStart=t.plan_period_start,this.status=t.status,this.totals=iL(t.totals),this.isImmediatePlanChange=t.is_immediate_plan_change,t.free_trial_ends_at&&(this.freeTrialEndsAt=rT(t.free_trial_ends_at)),this.payer=new nl(t.payer),this.needsPaymentMethod=t.needs_payment_method),this}constructor(t=null){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"externalClientSecret",void 0),(0,td._)(this,"externalGatewayId",void 0),(0,td._)(this,"paymentMethod",void 0),(0,td._)(this,"plan",void 0),(0,td._)(this,"planPeriod",void 0),(0,td._)(this,"planPeriodStart",void 0),(0,td._)(this,"status",void 0),(0,td._)(this,"totals",void 0),(0,td._)(this,"isImmediatePlanChange",void 0),(0,td._)(this,"freeTrialEndsAt",void 0),(0,td._)(this,"payer",void 0),(0,td._)(this,"needsPaymentMethod",void 0),(0,td._)(this,"confirm",t=>iR(()=>this._basePatch({path:r8.path("/checkouts/".concat(this.id,"/confirm"),{orgId:this.payer.organizationId}),body:t}),{factor:1.1,maxDelayBetweenRetries:2e3,initialDelay:2e3,jitter:!1,shouldRetry(t,e){var i,r;if(!tT(t)||e>=4)return!1;let n=null==t?void 0:t.status,s=409===n&&(null==(r=t.errors)||null==(i=r[0])?void 0:i.code)==="checkout_already_in_progress";return n>=500||s}})),this.fromJSON(t)}}class nu{get status(){var t;return null!=(t=this.resource.status)?t:"needs_initialization"}get externalClientSecret(){return this.resource.externalClientSecret}get externalGatewayId(){return this.resource.externalGatewayId}get plan(){return this.resource.plan}get planPeriod(){return this.resource.planPeriod}get totals(){return this.resource.totals}get isImmediatePlanChange(){return this.resource.isImmediatePlanChange}get freeTrialEndsAt(){return this.resource.freeTrialEndsAt}get payer(){return this.resource.payer}get paymentMethod(){var t;return null!=(t=this.resource.paymentMethod)?t:null}get planPeriodStart(){return this.resource.planPeriodStart}get needsPaymentMethod(){return this.resource.needsPaymentMethod}async start(){return this.runAsyncCheckoutTask("start",async()=>{var t;let e=await (null==(t=nc.clerk.billing)?void 0:t.startCheckout(this.config));this.resource=e},()=>{this.resource=new nc(null),this.signals.resourceSignal({resource:this})})}async confirm(t){if(!this.resource.id)throw Error("Clerk: `start()` must be called before `confirm()`");return this.runAsyncCheckoutTask("confirm",async()=>{await this.resource.confirm(t)})}async finalize(t){let{navigate:e}=t||{};return this.runAsyncCheckoutTask("finalize",async()=>{var t;if("completed"!==this.resource.status)throw Error("Clerk: `confirm()` must be called before `finalize()`");await nc.clerk.setActive({session:null==(t=nc.clerk.session)?void 0:t.id,navigate:e})})}runAsyncCheckoutTask(t,e,i){var r,n,s;return void 0===nc.clerk.user?(console.warn("Clerk: Checkout operations cannot be performed during transitive state"),{error:null}):(r=this,n=this.signals,s=this.pendingOperations,async(t,e,i)=>{if(s.get(t))return s.get(t);let a=(async()=>{++rB,n.errorSignal({error:null}),n.fetchSignal({status:"fetching"}),null==i||i(),--rB||rX(),++rB;try{return await e(),n.resourceSignal({resource:r}),{error:null}}catch(t){return n.errorSignal({error:t}),{error:t}}finally{s.delete(t),n.fetchSignal({status:"idle"}),--rB||rX()}})();return s.set(t,a),a})(t,e,i)}constructor(t,e){(0,td._)(this,"resource",new nc(null)),(0,td._)(this,"config",void 0),(0,td._)(this,"signals",void 0),(0,td._)(this,"pendingOperations",new Map),this.config=e,this.signals=t,this.signals.resourceSignal({resource:this})}}class nh extends rP{fromJSON(t){return t&&(this.id=t.id,this.amount=iF(t.amount),this.paidAt=t.paid_at?rT(t.paid_at):null,this.failedAt=t.failed_at?rT(t.failed_at):null,this.updatedAt=rT(t.updated_at),this.paymentMethod=t.payment_method?new ng(t.payment_method):null,this.subscriptionItem=new nk(t.subscription_item),this.chargeType=t.charge_type,this.status=t.status),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"amount",void 0),(0,td._)(this,"failedAt",null),(0,td._)(this,"paidAt",null),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"paymentMethod",null),(0,td._)(this,"subscriptionItem",void 0),(0,td._)(this,"chargeType",void 0),(0,td._)(this,"status",void 0),this.fromJSON(t)}}let nd="/payment_methods",np=async t=>{var e;let{orgId:i,...r}=t;return new nv(null==(e=await rP._fetch({path:r8.path("".concat(nd,"/initialize"),{orgId:i}),method:"POST",body:r}))?void 0:e.response)},nf=async t=>{var e;let{orgId:i,...r}=t;return new ng(null==(e=await rP._fetch({path:r8.path(nd,{orgId:i}),method:"POST",body:r}))?void 0:e.response)},n_=async t=>{let{orgId:e,...i}=null!=t?t:{};return await rP._fetch({path:r8.path(nd,{orgId:e}),method:"GET",search:r2(i)}).then(t=>{let{data:e,total_count:i}=null==t?void 0:t.response;return{total_count:i,data:e.map(t=>new ng(t))}})};class ng extends rP{fromJSON(t){return t&&(this.id=t.id,this.last4=t.last4,this.paymentType=t.payment_type,this.cardType=t.card_type,this.isDefault=t.is_default,this.isRemovable=t.is_removable,this.status=t.status,this.walletType=t.wallet_type,this.expiryYear=t.expiry_year,this.expiryMonth=t.expiry_month,this.createdAt=null==t.created_at?t.created_at:rT(t.created_at),this.updatedAt=null==t.updated_at?t.updated_at:rT(t.updated_at)),this}async remove(t){var e;let{orgId:i}=null!=t?t:{};return new nB(null==(e=await rP._fetch({path:r8.path("/payment_methods/".concat(this.id),{orgId:i}),method:"DELETE"}))?void 0:e.response)}async makeDefault(t){let{orgId:e}=null!=t?t:{};return await rP._fetch({path:r8.path("/payers/default_payment_method",{orgId:e}),method:"PUT",body:{payment_method_id:this.id}}),null}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"last4",null),(0,td._)(this,"paymentType",void 0),(0,td._)(this,"cardType",null),(0,td._)(this,"isDefault",void 0),(0,td._)(this,"isRemovable",void 0),(0,td._)(this,"status",void 0),(0,td._)(this,"walletType",void 0),(0,td._)(this,"expiryYear",void 0),(0,td._)(this,"expiryMonth",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),this.fromJSON(t)}}class nv extends rP{fromJSON(t){var e;return t&&(this.externalClientSecret=t.external_client_secret,this.externalGatewayId=t.external_gateway_id,this.paymentMethodOrder=null!=(e=t.payment_method_order)?e:["card"]),this}constructor(t){super(),(0,td._)(this,"externalClientSecret",void 0),(0,td._)(this,"externalGatewayId",void 0),(0,td._)(this,"paymentMethodOrder",void 0),this.fromJSON(t)}}class nm extends rP{fromJSON(t){var e;return t&&(this.id=t.id,this.name=t.name,this.fee=t.fee?iF(t.fee):null,this.annualFee=t.annual_fee?iF(t.annual_fee):null,this.annualMonthlyFee=t.annual_monthly_fee?iF(t.annual_monthly_fee):null,this.description=t.description,this.isDefault=t.is_default,this.isRecurring=t.is_recurring,this.hasBaseFee=t.has_base_fee,this.forPayerType=t.for_payer_type,this.publiclyVisible=t.publicly_visible,this.slug=t.slug,this.avatarUrl=t.avatar_url,this.freeTrialDays=this.withDefault(t.free_trial_days,null),this.freeTrialEnabled=this.withDefault(t.free_trial_enabled,!1),this.features=(t.features||[]).map(t=>new sr(t)),this.unitPrices=null==(e=t.unit_prices)?void 0:e.map(t=>({name:t.name,blockSize:t.block_size,tiers:t.tiers.map(t=>({id:t.id,startsAtBlock:t.starts_at_block,endsAfterBlock:t.ends_after_block,feePerBlock:iF(t.fee_per_block)}))}))),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"name",void 0),(0,td._)(this,"fee",null),(0,td._)(this,"annualFee",null),(0,td._)(this,"annualMonthlyFee",null),(0,td._)(this,"description",null),(0,td._)(this,"isDefault",void 0),(0,td._)(this,"isRecurring",void 0),(0,td._)(this,"hasBaseFee",void 0),(0,td._)(this,"forPayerType",void 0),(0,td._)(this,"publiclyVisible",void 0),(0,td._)(this,"slug",void 0),(0,td._)(this,"avatarUrl",null),(0,td._)(this,"features",void 0),(0,td._)(this,"unitPrices",void 0),(0,td._)(this,"freeTrialDays",void 0),(0,td._)(this,"freeTrialEnabled",void 0),this.fromJSON(t)}}class ny extends rP{fromJSON(t){return t&&(this.id=t.id,this.status=t.status,this.timestamp=rT(t.timestamp),this.totals=iL(t.totals),this.groups=t.groups.map(t=>new nw(t))),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"status",void 0),(0,td._)(this,"timestamp",void 0),(0,td._)(this,"totals",void 0),(0,td._)(this,"groups",void 0),this.fromJSON(t)}}class nw{fromJSON(t){return t&&(this.id=t.id,this.timestamp=rT(t.timestamp),this.items=t.items.map(t=>new nh(t))),this}constructor(t){(0,td._)(this,"id",void 0),(0,td._)(this,"timestamp",void 0),(0,td._)(this,"items",void 0),this.fromJSON(t)}}class nb extends rP{fromJSON(t){return t&&(this.id=t.id,this.status=t.status,this.createdAt=rT(t.created_at),this.updatedAt=t.updated_at?rT(t.updated_at):null,this.activeAt=rT(t.active_at),this.pastDueAt=t.past_due_at?rT(t.past_due_at):null,t.next_payment&&(this.nextPayment={amount:iF(t.next_payment.amount),date:rT(t.next_payment.date)}),this.subscriptionItems=(t.subscription_items||[]).map(t=>new nk(t)),this.eligibleForFreeTrial=this.withDefault(t.eligible_for_free_trial,!1)),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"status",void 0),(0,td._)(this,"activeAt",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"pastDueAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"nextPayment",void 0),(0,td._)(this,"subscriptionItems",void 0),(0,td._)(this,"eligibleForFreeTrial",void 0),this.fromJSON(t)}}class nk extends rP{fromJSON(t){return t&&(this.id=t.id,this.plan=new nm(t.plan),this.planPeriod=t.plan_period,this.status=t.status,this.createdAt=rT(t.created_at),this.pastDueAt=t.past_due_at?rT(t.past_due_at):null,this.periodStart=rT(t.period_start),this.periodEnd=t.period_end?rT(t.period_end):null,this.canceledAt=t.canceled_at?rT(t.canceled_at):null,this.amount=t.amount?iF(t.amount):void 0,this.credit=t.credit&&t.credit.amount?{amount:iF(t.credit.amount)}:void 0,this.seats=t.seats?{quantity:t.seats.quantity}:void 0,this.credits=t.credits?iD(t.credits):void 0,this.isFreeTrial=this.withDefault(t.is_free_trial,!1)),this}async cancel(t){var e;let{orgId:i}=t;return new nB(null==(e=await rP._fetch({path:r8.path("/subscription_items/".concat(this.id),{orgId:i}),method:"DELETE"}))?void 0:e.response)}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"plan",void 0),(0,td._)(this,"planPeriod",void 0),(0,td._)(this,"status",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"periodStart",void 0),(0,td._)(this,"periodEnd",void 0),(0,td._)(this,"canceledAt",void 0),(0,td._)(this,"pastDueAt",void 0),(0,td._)(this,"amount",void 0),(0,td._)(this,"credit",void 0),(0,td._)(this,"seats",void 0),(0,td._)(this,"credits",void 0),(0,td._)(this,"isFreeTrial",void 0),this.fromJSON(t)}}let nS="token:update",nA="user:signOut",nI="environment:update",nU="session:tokenResolved",nx=tb();var nC=s(1118),nE='const respond=r=>{self.postMessage(r)},workerToTabIds={};self.addEventListener("message",r=>{const e=r.data;switch(e.type){case"setTimeout":workerToTabIds[e.id]=setTimeout(()=>{respond({id:e.id}),delete workerToTabIds[e.id]},e.ms);break;case"clearTimeout":workerToTabIds[e.id]&&(clearTimeout(workerToTabIds[e.id]),delete workerToTabIds[e.id]);break;case"setInterval":workerToTabIds[e.id]=setInterval(()=>{respond({id:e.id})},e.ms);break;case"clearInterval":workerToTabIds[e.id]&&(clearInterval(workerToTabIds[e.id]),delete workerToTabIds[e.id]);break}});\n';let nP=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("u"<typeof Worker)return null;try{let i=new Blob([t],{type:"application/javascript; charset=utf-8"}),r=globalThis.URL.createObjectURL(i);return new Worker(r,e)}catch{return console.warn("Clerk: Cannot create worker from blob. Consider adding worker-src blob:; to your CSP"),null}},nT=()=>{let t=0,e=()=>t++,i=new Map,r=(t,e)=>null==t?void 0:t.postMessage(e),n=t=>{var e;null==(e=i.get(t.data.id))||e()},s=nP(nE,{name:"clerk-timers"});if(null==s||s.addEventListener("message",n),!s)return{setTimeout:globalThis.setTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis),cleanup:nC.t};let a=()=>{s||null==(s=nP(nE,{name:"clerk-timers"}))||s.addEventListener("message",n)};return{setTimeout:(t,n)=>{a();let o=e();return i.set(o,()=>{t(),i.delete(o)}),r(s,{type:"setTimeout",id:o,ms:n}),o},setInterval:(t,n)=>{a();let o=e();return i.set(o,t),r(s,{type:"setInterval",id:o,ms:n}),o},clearTimeout:t=>{a(),i.delete(t),r(s,{type:"clearTimeout",id:t})},clearInterval:t=>{a(),i.delete(t),r(s,{type:"clearInterval",id:t})},cleanup:()=>{s&&(s.terminate(),s=null,i.clear())}}};var nO=s(8388),nR=s.n(nO);class nM{startPollingForSessionToken(t){if(this.timerId||this.initiated)return;let e=async()=>{this.initiated=!0,await this.lock.acquireLockAndRun(t),this.timerId=this.workerTimers.setTimeout(e,5e3)};e()}stopPollingForSessionToken(){null!=this.timerId&&(this.workerTimers.clearTimeout(this.timerId),this.timerId=null),this.initiated=!1}constructor(){(0,td._)(this,"lock",function(t){let e=new(nR());return{acquireLockAndRun:async i=>{if("locks"in navigator&&isSecureContext){let e=new AbortController,r=setTimeout(()=>e.abort(),4999);return await navigator.locks.request(t,{signal:e.signal},async()=>(clearTimeout(r),await i())).catch(()=>!1)}if(await e.acquireLock(t,5e3))try{return await i()}finally{await e.releaseLock(t)}}}}("clerk.lock.refreshSessionToken")),(0,td._)(this,"workerTimers",nT()),(0,td._)(this,"timerId",null),(0,td._)(this,"initiated",!1)}}let nN={broadcast:!0},nz={broadcast:!1};class nW{static fromKey(t){let[e,i,r=""]=t.split("::");return new nW(e,{audience:r,tokenId:i})}toKey(){let{tokenId:t,audience:e}=this.data;return[this.prefix,t,e||""].join("::")}constructor(t,e){(0,td._)(this,"prefix",void 0),(0,td._)(this,"data",void 0),this.prefix=t,this.data=e,this.prefix=t,this.data=e}}let nF=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"clerk",e=new Map,i=Math.random().toString(36).slice(2),r=null,n=()=>r||("u"<typeof BroadcastChannel?null:((r=new BroadcastChannel("clerk:session_token")).addEventListener("message",t=>{a(t)}),r));n();let s=i=>{var r;n();let s=new nW(t,i),a=e.get(s.toKey());if(!a)return;let o=Math.floor(Date.now()/1e3)-a.createdAt;if((null!=(r=a.expiresIn)?r:1/0)-o<=5){void 0!==a.timeoutId&&clearTimeout(a.timeoutId),void 0!==a.refreshTimeoutId&&clearTimeout(a.refreshTimeoutId),e.delete(s.toKey());return}return{entry:a.entry}},a=async t=>{var e,r,n,a,l,c;let u,{data:h}=t,d=iG.build(h.sessionId,h.template,h.organizationId);if(h.tokenId!==d)return void iE.warn("Ignoring token broadcast with mismatched tokenId",{expectedTokenId:d,organizationId:h.organizationId,receivedTokenId:h.tokenId,tabId:i,template:h.template,traceId:h.traceId},"tokenCache");try{u=new ae({id:h.tokenId,jwt:h.tokenRaw,object:"token"})}catch(t){iE.warn("Failed to parse token from broadcast, skipping cache update",{error:t,tabId:i,tokenId:h.tokenId,traceId:h.traceId},"tokenCache");return}let p=null==(r=u.jwt)||null==(e=r.claims)?void 0:e.iat,f=null==(a=u.jwt)||null==(n=a.claims)?void 0:n.exp;if(!p||!f)return void iE.warn("Token missing iat/exp claim, skipping cache update",{tabId:i,tokenId:h.tokenId,traceId:h.traceId},"tokenCache");try{let t=s({tokenId:h.tokenId});if(t){let e=null==(c=(await t.entry.tokenResolver).jwt)||null==(l=c.claims)?void 0:l.iat;if(e&&e>=p)return void iE.debug("Ignoring older token broadcast",{existingIat:e,incomingIat:p,tabId:i,tokenId:h.tokenId,traceId:h.traceId},"tokenCache")}}catch(t){iE.warn("Existing entry compare failed; proceeding with broadcast update",{error:t,tabId:i,tokenId:h.tokenId,traceId:h.traceId},"tokenCache")}iE.info("Updating token cache from broadcast",{iat:p,organizationId:h.organizationId,tabId:i,template:h.template,tokenId:h.tokenId,traceId:h.traceId},"tokenCache"),o({createdAt:p,tokenId:h.tokenId,tokenResolver:Promise.resolve(u)},nz)},o=function(n){var s;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nN,o=new nW(t,{audience:n.audience,tokenId:n.tokenId}).toKey(),l=e.get(o);clearTimeout(null==l?void 0:l.timeoutId),clearTimeout(null==l?void 0:l.refreshTimeoutId);let c=Math.floor(Date.now()/1e3),u={createdAt:null!=(s=n.createdAt)?s:c,entry:n,expiresIn:void 0},h=()=>{let t=e.get(o);t===u&&(void 0!==t.timeoutId&&clearTimeout(t.timeoutId),void 0!==t.refreshTimeoutId&&clearTimeout(t.refreshTimeoutId),e.delete(o))};e.set(o,u),n.tokenResolver.then(t=>{var s,l;if(e.get(o)!==u)return;n.resolvedToken=t;let c=null==(s=t.jwt)?void 0:s.claims;if(!c||"number"!=typeof c.exp||"number"!=typeof c.iat)return h();let d=c.exp,p=c.iat,f=d-p;u.createdAt=p,u.expiresIn=f;let _=setTimeout(h,1e3*f);u.timeoutId=_,"function"==typeof _.unref&&_.unref();let g=f-15-2;if(g>0&&n.onRefresh){let t=setTimeout(()=>{var t;null==(t=n.onRefresh)||t.call(n)},1e3*g);u.refreshTimeoutId=t,"function"==typeof t.unref&&t.unref()}let v=r;if(v&&a.broadcast){let e=t.getRawString();if(e&&c.sid){let t=c.sid,r=c.org_id||(null==(l=c.o)?void 0:l.id),s=iG.extractTemplate(n.tokenId,t,r),a=iG.build(t,s,r);if(n.tokenId===a){let a="bc_".concat(Date.now(),"_").concat(Math.random().toString(36).substring(2,11));iE.info("Broadcasting token update to other tabs",{organizationId:r,sessionId:t,tabId:i,template:s,tokenId:n.tokenId,traceId:a},"tokenCache");let o={organizationId:r,sessionId:t,template:s,tokenId:n.tokenId,tokenRaw:e,traceId:a};v.postMessage(o)}}}}).catch(()=>{h()})};return{clear:()=>{e.forEach(t=>{void 0!==t.timeoutId&&clearTimeout(t.timeoutId),void 0!==t.refreshTimeoutId&&clearTimeout(t.refreshTimeoutId)}),e.clear()},close:()=>{r&&(r.close(),r=null)},get:s,set:t=>{n(),o(t,nN)},size:()=>e.size}}();function nD(t){var e;if(!t)return;let i=t.client||(null==(e=t.meta)?void 0:e.client);return i?nL.getOrCreateInstance().fromJSON(i):void 0}class nL extends rP{static getOrCreateInstance(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return nL.instance||(nL.instance=new nL(t)),nL.instance}static clearInstance(){nL.instance=null}static isClientResource(t){return!!t&&t instanceof nL}get signUpAttempt(){return this.signUp}get signInAttempt(){return this.signIn}get signedInSessions(){return this.sessions.filter(t=>"active"===t.status||"pending"===t.status)}create(){return this._basePut()}fetch(){let{fetchMaxTries:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._baseGet({fetchMaxTries:t})}async destroy(){return this._baseDelete({path:"/client"}).then(()=>{nF.clear(),this.id="",this.sessions=[],this.signUp=new s2(null),this.signIn=new sX(null),this.lastActiveSessionId=null,this.lastAuthenticationStrategy=null,this.cookieExpiresAt=null,this.createdAt=null,this.updatedAt=null})}removeSessions(){return this._baseDelete({path:this.path()+"/sessions"}).then(t=>(nF.clear(),t))}resetSignIn(){this.signIn=new sX(null),nx.emit("resource:error",{resource:this.signIn,error:null})}resetSignUp(){this.signUp=new s2(null),nx.emit("resource:error",{resource:this.signUp,error:null})}clearCache(){return this.sessions.forEach(t=>t.clearCache())}isEligibleForTouch(){return!!this.cookieExpiresAt&&this.cookieExpiresAt.getTime()-Date.now()<=6912e5}buildTouchUrl(t){let{redirectUrl:e}=t;return rP.fapiClient.buildUrl({method:"GET",path:"/client/touch",pathPrefix:"v1",search:{redirect_url:e.toString()}}).toString()}__internal_sendCaptchaToken(t){return this._basePostBypass({body:t,path:this.path()+"/verify"})}fromJSON(t){return t&&(this.id=t.id,this.sessions=(t.sessions||[]).map(t=>new sz(t)),t.sign_up&&this.signUp instanceof s2&&this.signUp.id===t.sign_up.id?this.signUp.__internal_updateFromJSON(t.sign_up):this.signUp=new s2(t.sign_up),t.sign_in&&this.signIn instanceof sX&&this.signIn.id===t.sign_in.id?this.signIn.__internal_updateFromJSON(t.sign_in):this.signIn=new sX(t.sign_in),this.lastActiveSessionId=t.last_active_session_id,this.captchaBypass=t.captcha_bypass||!1,this.cookieExpiresAt=t.cookie_expires_at?rT(t.cookie_expires_at):null,this.lastAuthenticationStrategy=t.last_authentication_strategy||null,this.createdAt=rT(t.created_at||void 0),this.updatedAt=rT(t.updated_at||void 0)),this}__internal_toSnapshot(){var t,e,i,r,n;return{object:"client",id:this.id||"",sessions:this.sessions.map(t=>t.__internal_toSnapshot()),sign_up:this.signUp.__internal_toSnapshot(),sign_in:this.signIn.__internal_toSnapshot(),last_active_session_id:this.lastActiveSessionId,captcha_bypass:this.captchaBypass,cookie_expires_at:this.cookieExpiresAt?this.cookieExpiresAt.getTime():null,last_authentication_strategy:null!=(t=this.lastAuthenticationStrategy)?t:null,created_at:null!=(e=null==(r=this.createdAt)?void 0:r.getTime())?e:null,updated_at:null!=(i=null==(n=this.updatedAt)?void 0:n.getTime())?i:null}}path(){return this.pathRoot}constructor(t=null){super(),(0,td._)(this,"pathRoot","/client"),(0,td._)(this,"sessions",[]),(0,td._)(this,"signUp",new s2),(0,td._)(this,"signIn",new sX),(0,td._)(this,"lastActiveSessionId",null),(0,td._)(this,"captchaBypass",!1),(0,td._)(this,"cookieExpiresAt",null),(0,td._)(this,"lastAuthenticationStrategy",null),(0,td._)(this,"createdAt",null),(0,td._)(this,"updatedAt",null),this.fromJSON(t)}}(0,td._)(nL,"instance",void 0);class nj extends rP{fromJSON(t){return t&&(this.billing.stripePublishableKey=t.billing.stripe_publishable_key,this.billing.organization.enabled=t.billing.organization.enabled,this.billing.organization.hasPaidPlans=t.billing.organization.has_paid_plans,this.billing.user.enabled=t.billing.user.enabled,this.billing.user.hasPaidPlans=t.billing.user.has_paid_plans),this}__internal_toSnapshot(){return{billing:{stripe_publishable_key:this.billing.stripePublishableKey,organization:{enabled:this.billing.organization.enabled,has_paid_plans:this.billing.organization.hasPaidPlans},user:{enabled:this.billing.user.enabled,has_paid_plans:this.billing.user.hasPaidPlans}}}}constructor(t=null){super(),(0,td._)(this,"billing",{stripePublishableKey:null,organization:{enabled:!1,hasPaidPlans:!1},user:{enabled:!1,hasPaidPlans:!1}}),this.fromJSON(t)}}class nB{fromJSON(t){return t&&(this.object=t.object,this.id=t.id,this.slug=t.slug,this.deleted=t.deleted),this}constructor(t){(0,td._)(this,"object",""),(0,td._)(this,"id",void 0),(0,td._)(this,"slug",void 0),(0,td._)(this,"deleted",!1),this.fromJSON(t)}}class nJ extends rP{fromJSON(t){return t&&(this.afterCreateOrganizationUrl=this.withDefault(t.after_create_organization_url,this.afterCreateOrganizationUrl),this.afterJoinWaitlistUrl=this.withDefault(t.after_join_waitlist_url,this.afterJoinWaitlistUrl),this.afterLeaveOrganizationUrl=this.withDefault(t.after_leave_organization_url,this.afterLeaveOrganizationUrl),this.afterSignInUrl=this.withDefault(t.after_sign_in_url,this.afterSignInUrl),this.afterSignOutAllUrl=this.withDefault(t.after_sign_out_all_url,this.afterSignOutAllUrl),this.afterSignOutOneUrl=this.withDefault(t.after_sign_out_one_url,this.afterSignOutOneUrl),this.afterSignUpUrl=this.withDefault(t.after_sign_up_url,this.afterSignUpUrl),this.afterSwitchSessionUrl=this.withDefault(t.after_switch_session_url,this.afterSwitchSessionUrl),this.applicationName=this.withDefault(t.application_name,this.applicationName),this.branded=this.withDefault(t.branded,this.branded),this.captchaHeartbeat=this.withDefault(t.captcha_heartbeat,this.captchaHeartbeat),this.captchaHeartbeatIntervalMs=this.withDefault(t.captcha_heartbeat_interval_ms,this.captchaHeartbeatIntervalMs),this.captchaOauthBypass=this.withDefault(t.captcha_oauth_bypass,this.captchaOauthBypass),this.captchaProvider=this.withDefault(t.captcha_provider,this.captchaProvider),this.captchaPublicKey=this.withDefault(t.captcha_public_key,this.captchaPublicKey),this.captchaPublicKeyInvisible=this.withDefault(t.captcha_public_key_invisible,this.captchaPublicKeyInvisible),this.captchaWidgetType=this.withDefault(t.captcha_widget_type,this.captchaWidgetType),this.clerkJSVersion=this.withDefault(t.clerk_js_version,this.clerkJSVersion),this.createOrganizationUrl=this.withDefault(t.create_organization_url,this.createOrganizationUrl),this.faviconImageUrl=this.withDefault(t.favicon_image_url,this.faviconImageUrl),this.googleOneTapClientId=this.withDefault(t.google_one_tap_client_id,this.googleOneTapClientId),this.homeUrl=this.withDefault(t.home_url,this.homeUrl),this.id=this.withDefault(t.id,this.id),this.instanceEnvironmentType=this.withDefault(t.instance_environment_type,this.instanceEnvironmentType),this.logoImageUrl=this.withDefault(t.logo_image_url,this.logoImageUrl),this.organizationProfileUrl=this.withDefault(t.organization_profile_url,this.organizationProfileUrl),this.preferredSignInStrategy=this.withDefault(t.preferred_sign_in_strategy,this.preferredSignInStrategy),this.privacyPolicyUrl=this.withDefault(t.privacy_policy_url,this.privacyPolicyUrl),this.showDevModeWarning=this.withDefault(t.show_devmode_warning,this.showDevModeWarning),this.signInUrl=this.withDefault(t.sign_in_url,this.signInUrl),this.signUpUrl=this.withDefault(t.sign_up_url,this.signUpUrl),this.supportEmail=this.withDefault(t.support_email,this.supportEmail),this.termsUrl=this.withDefault(t.terms_url,this.termsUrl),this.theme=this.withDefault(t.theme,this.theme),this.userProfileUrl=this.withDefault(t.user_profile_url,this.userProfileUrl),this.waitlistUrl=this.withDefault(t.waitlist_url,this.waitlistUrl)),this}__internal_toSnapshot(){return{object:"display_config",after_create_organization_url:this.afterCreateOrganizationUrl,after_join_waitlist_url:this.afterJoinWaitlistUrl,after_leave_organization_url:this.afterLeaveOrganizationUrl,after_sign_in_url:this.afterSignInUrl,after_sign_out_all_url:this.afterSignOutAllUrl,after_sign_out_one_url:this.afterSignOutOneUrl,after_sign_up_url:this.afterSignUpUrl,after_switch_session_url:this.afterSwitchSessionUrl,application_name:this.applicationName,branded:this.branded,captcha_heartbeat_interval_ms:this.captchaHeartbeatIntervalMs,captcha_heartbeat:this.captchaHeartbeat,captcha_oauth_bypass:this.captchaOauthBypass,captcha_provider:this.captchaProvider,captcha_public_key_invisible:this.captchaPublicKeyInvisible,captcha_public_key:this.captchaPublicKey,captcha_widget_type:this.captchaWidgetType,clerk_js_version:this.clerkJSVersion,create_organization_url:this.createOrganizationUrl,favicon_image_url:this.faviconImageUrl,google_one_tap_client_id:this.googleOneTapClientId,home_url:this.homeUrl,id:this.id,instance_environment_type:this.instanceEnvironmentType,logo_image_url:this.logoImageUrl,organization_profile_url:this.organizationProfileUrl,preferred_sign_in_strategy:this.preferredSignInStrategy,privacy_policy_url:this.privacyPolicyUrl,show_devmode_warning:this.showDevModeWarning,sign_in_url:this.signInUrl,sign_up_url:this.signUpUrl,support_email:this.supportEmail,terms_url:this.termsUrl,theme:this.theme,user_profile_url:this.userProfileUrl,waitlist_url:this.waitlistUrl}}constructor(t=null){super(),(0,td._)(this,"afterCreateOrganizationUrl",""),(0,td._)(this,"afterJoinWaitlistUrl",""),(0,td._)(this,"afterLeaveOrganizationUrl",""),(0,td._)(this,"afterSignInUrl",""),(0,td._)(this,"afterSignOutAllUrl",""),(0,td._)(this,"afterSignOutOneUrl",""),(0,td._)(this,"afterSignOutUrl",""),(0,td._)(this,"afterSignUpUrl",""),(0,td._)(this,"afterSwitchSessionUrl",""),(0,td._)(this,"applicationName",""),(0,td._)(this,"backendHost",""),(0,td._)(this,"branded",!1),(0,td._)(this,"captchaHeartbeat",!1),(0,td._)(this,"captchaHeartbeatIntervalMs",void 0),(0,td._)(this,"captchaOauthBypass",["oauth_google","oauth_microsoft","oauth_apple"]),(0,td._)(this,"captchaProvider","turnstile"),(0,td._)(this,"captchaPublicKey",null),(0,td._)(this,"captchaPublicKeyInvisible",null),(0,td._)(this,"captchaWidgetType",null),(0,td._)(this,"clerkJSVersion",void 0),(0,td._)(this,"createOrganizationUrl",""),(0,td._)(this,"faviconImageUrl",""),(0,td._)(this,"googleOneTapClientId",void 0),(0,td._)(this,"homeUrl",""),(0,td._)(this,"id",""),(0,td._)(this,"instanceEnvironmentType",""),(0,td._)(this,"logoImageUrl",""),(0,td._)(this,"organizationProfileUrl",""),(0,td._)(this,"preferredSignInStrategy","password"),(0,td._)(this,"privacyPolicyUrl",""),(0,td._)(this,"showDevModeWarning",!1),(0,td._)(this,"signInUrl",""),(0,td._)(this,"signUpUrl",""),(0,td._)(this,"supportEmail",""),(0,td._)(this,"termsUrl",""),(0,td._)(this,"theme",{}),(0,td._)(this,"userProfileUrl",""),(0,td._)(this,"waitlistUrl",""),this.fromJSON(t)}}function nV(){let t,{delayInMs:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{delayInMs:1e3},i=nT(),r=!1,n=()=>{t&&(i.clearTimeout(t),i.cleanup()),r=!0},s=async a=>{r=!1,await a(n),r||(t=i.setTimeout(()=>{s(a)},e))};return{run:s,stop:n}}class nK extends rP{create(){return this._basePost({body:{email_address:this.emailAddress}})}fromJSON(t){return t&&(this.id=t.id,this.emailAddress=t.email_address,this.verification=new n2(t.verification),this.matchesSsoConnection=t.matches_sso_connection,this.linkedTo=(t.linked_to||[]).map(t=>new sn(t))),this}__internal_toSnapshot(){return{object:"email_address",id:this.id,email_address:this.emailAddress,verification:this.verification.__internal_toSnapshot(),linked_to:this.linkedTo.map(t=>t.__internal_toSnapshot()),matches_sso_connection:this.matchesSsoConnection}}constructor(t,e){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"emailAddress",""),(0,td._)(this,"matchesSsoConnection",!1),(0,td._)(this,"linkedTo",[]),(0,td._)(this,"verification",void 0),(0,td._)(this,"prepareVerification",t=>this._basePost({action:"prepare_verification",body:{...t}})),(0,td._)(this,"attemptVerification",t=>{let{code:e}=t||{};return this._basePost({action:"attempt_verification",body:{code:e}})}),(0,td._)(this,"createEmailLinkFlow",()=>{let{run:t,stop:e}=nV();return{startEmailLinkFlow:async i=>{let{redirectUrl:r}=i;return await this.prepareVerification({strategy:"email_link",redirectUrl:r}),new Promise((i,r)=>{t(()=>this.reload().then(t=>{"verified"===t.verification.status&&(e(),i(t))}).catch(t=>{e(),r(t)}))})},cancelEmailLinkFlow:e}}),(0,td._)(this,"createEnterpriseSSOLinkFlow",()=>{let{run:t,stop:e}=nV();return{startEnterpriseSSOLinkFlow:async i=>{let{redirectUrl:r}=i;if(!(await this.prepareVerification({strategy:"enterprise_sso",redirectUrl:r})).verification.externalVerificationRedirectURL)throw Error("Unexpected: External verification redirect URL is missing");return new Promise((i,r)=>{t(()=>this.reload().then(t=>{"verified"===t.verification.status&&(e(),i(t))}).catch(t=>{e(),r(t)}))})},cancelEnterpriseSSOLinkFlow:e}}),(0,td._)(this,"destroy",()=>this._baseDelete()),(0,td._)(this,"toString",()=>this.emailAddress),this.pathRoot=e,this.fromJSON(t)}}var nq=class{static encode(t){return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}static decode(t){let e=atob(t.replace(/-/g,"+").replace(/_/g,"/")),i=e.length,r=new Uint8Array(i);for(let t=0;t<i;t++)r[t]=e.charCodeAt(t);return r.buffer}};async function nH(t){try{let e=await navigator.credentials.create({publicKey:t});if(!e)return{error:new tW("Browser failed to create credential",{code:"passkey_registration_failed"}),publicKeyCredential:null};return{publicKeyCredential:e,error:null}}catch(t){var e;return{error:"InvalidStateError"===(e=t).name?new tW(e.message,{code:"passkey_already_exists"}):"NotAllowedError"===e.name?new tW(e.message,{code:"passkey_registration_cancelled"}):nY(e),publicKeyCredential:null}}}let nG=new class{__abort(){if(!this.controller)return;let t=Error();t.name="AbortError",this.controller.abort(t)}createAbortSignal(){this.__abort();let t=new AbortController;return this.controller=t,t.signal}abort(){this.__abort(),this.controller=void 0}constructor(){!function(t,e,i){e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i}(this,"controller",void 0)}};async function n$(t){let{publicKeyOptions:e,conditionalUI:i}=t;try{let t=await navigator.credentials.get({publicKey:e,mediation:i?"conditional":"optional",signal:nG.createAbortSignal()});if(!t)return{error:new tW("Browser failed to get credential",{code:"passkey_retrieval_failed"}),publicKeyCredential:null};return{publicKeyCredential:t,error:null}}catch(t){var r;return{error:"NotAllowedError"===(r=t).name?new tW(r.message,{code:"passkey_retrieval_cancelled"}):nY(r),publicKeyCredential:null}}}function nY(t){return"AbortError"===t.name?new tW(t.message,{code:"passkey_operation_aborted"}):"SecurityError"===t.name?new tW(t.message,{code:"passkey_invalid_rpID_or_domain",docsUrl:"https://clerk.com/docs/deployments/overview#authentication-across-subdomains"}):t}function nX(t){let e=n1(t.challenge),i=(t.allowCredentials||[]).map(t=>({...t,id:n1(t.id)}));return{...t,allowCredentials:i,challenge:e}}function nQ(t){return{type:t.type,id:t.id,rawId:n0(t.rawId),authenticatorAttachment:t.authenticatorAttachment}}function nZ(t){let e=t.response;return{...nQ(t),response:{clientDataJSON:n0(e.clientDataJSON),authenticatorData:n0(e.authenticatorData),signature:n0(e.signature),userHandle:e.userHandle?n0(e.userHandle):null}}}let n0=nq.encode.bind(nq),n1=nq.decode.bind(nq);class n2 extends rP{fromJSON(t){return t&&(this.status=t.status,this.verifiedAtClient=t.verified_at_client,this.strategy=t.strategy,this.nonce=t.nonce||null,this.message=t.message||null,t.external_verification_redirect_url?this.externalVerificationRedirectURL=new URL(t.external_verification_redirect_url):this.externalVerificationRedirectURL=null,this.attempts=t.attempts,this.expireAt=rT(t.expire_at||void 0),this.error=t.error?new tE(t.error):null,this.channel=t.channel||void 0),this}__internal_toSnapshot(){var t,e,i,r,n,s,a,o,l,c;return{object:"verification",id:this.id||"",status:this.status,strategy:this.strategy,nonce:this.nonce,message:this.message,external_verification_redirect_url:(null==(t=this.externalVerificationRedirectURL)?void 0:t.toString())||null,attempts:this.attempts,expire_at:(null==(e=this.expireAt)?void 0:e.getTime())||null,error:{code:(null==(i=this.error)?void 0:i.code)||"",message:(null==i?void 0:i.message)||"",long_message:null==i?void 0:i.longMessage,meta:{param_name:null==i||null==(r=i.meta)?void 0:r.paramName,session_id:null==i||null==(n=i.meta)?void 0:n.sessionId,email_addresses:null==i||null==(s=i.meta)?void 0:s.emailAddresses,identifiers:null==i||null==(a=i.meta)?void 0:a.identifiers,zxcvbn:null==i||null==(o=i.meta)?void 0:o.zxcvbn,plan:null==i||null==(l=i.meta)?void 0:l.plan,is_plan_upgrade_possible:null==i||null==(c=i.meta)?void 0:c.isPlanUpgradePossible}},verified_at_client:this.verifiedAtClient}}constructor(t){super(),(0,td._)(this,"pathRoot",""),(0,td._)(this,"status",null),(0,td._)(this,"strategy",null),(0,td._)(this,"nonce",null),(0,td._)(this,"message",null),(0,td._)(this,"externalVerificationRedirectURL",null),(0,td._)(this,"attempts",null),(0,td._)(this,"expireAt",null),(0,td._)(this,"error",null),(0,td._)(this,"verifiedAtClient",null),(0,td._)(this,"channel",void 0),(0,td._)(this,"verifiedFromTheSameClient",()=>{var t,e;return this.verifiedAtClient===(null==(e=rP.clerk)||null==(t=e.client)?void 0:t.id)}),this.fromJSON(t)}}class n8 extends n2{fromJSON(t){var e;let i,r,n;return super.fromJSON(t),(null==t?void 0:t.nonce)&&(this.publicKey=(i=n1((e=JSON.parse(t.nonce)).user.id),r=n1(e.challenge),n=(e.excludeCredentials||[]).map(t=>({...t,id:n1(t.id)})),{...e,excludeCredentials:n,challenge:r,user:{...e.user,id:i}})),this}constructor(t){super(t),(0,td._)(this,"publicKey",null),this.fromJSON(t)}}class n3{__internal_toSnapshot(){return{email_address:this.emailAddress.__internal_toSnapshot(),phone_number:this.phoneNumber.__internal_toSnapshot(),web3_wallet:this.web3Wallet.__internal_toSnapshot(),external_account:this.externalAccount.__internal_toSnapshot()}}constructor(t){(0,td._)(this,"emailAddress",void 0),(0,td._)(this,"phoneNumber",void 0),(0,td._)(this,"web3Wallet",void 0),(0,td._)(this,"externalAccount",void 0),t?(this.emailAddress=new n5(t.email_address),this.phoneNumber=new n5(t.phone_number),this.web3Wallet=new n5(t.web3_wallet),this.externalAccount=new n2(t.external_account)):(this.emailAddress=new n5(null),this.phoneNumber=new n5(null),this.web3Wallet=new n5(null),this.externalAccount=new n2(null))}}class n5 extends n2{__internal_toSnapshot(){return{...super.__internal_toSnapshot(),next_action:this.nextAction,supported_strategies:this.supportedStrategies}}constructor(t){super(t),(0,td._)(this,"nextAction",void 0),(0,td._)(this,"supportedStrategies",void 0),t?(this.nextAction=t.next_action,this.supportedStrategies=t.supported_strategies):(this.nextAction="",this.supportedStrategies=[])}}class n6 extends rP{fromJSON(t){return t&&(this.id=t.id,this.provider=t.provider,this.protocol=t.protocol,this.providerUserId=t.provider_user_id,this.active=t.active,this.emailAddress=t.email_address,this.firstName=t.first_name,this.lastName=t.last_name,this.publicMetadata=t.public_metadata,this.lastAuthenticatedAt=t.last_authenticated_at?rT(t.last_authenticated_at):null,this.enterpriseConnectionId=t.enterprise_connection_id,t.verification&&(this.verification=new n2(t.verification)),t.enterprise_connection&&(this.enterpriseConnection=new n4(t.enterprise_connection))),this}__internal_toSnapshot(){var t,e;return{object:"enterprise_account",id:this.id,provider:this.provider,protocol:this.protocol,provider_user_id:this.providerUserId,active:this.active,email_address:this.emailAddress,first_name:this.firstName,last_name:this.lastName,public_metadata:this.publicMetadata,verification:(null==(t=this.verification)?void 0:t.__internal_toSnapshot())||null,enterprise_connection:(null==(e=this.enterpriseConnection)?void 0:e.__internal_toSnapshot())||null,last_authenticated_at:this.lastAuthenticatedAt?this.lastAuthenticatedAt.getTime():null,enterprise_connection_id:this.enterpriseConnectionId}}constructor(t,e){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"protocol",void 0),(0,td._)(this,"provider",void 0),(0,td._)(this,"providerUserId",null),(0,td._)(this,"active",void 0),(0,td._)(this,"emailAddress",""),(0,td._)(this,"firstName",""),(0,td._)(this,"lastName",""),(0,td._)(this,"publicMetadata",{}),(0,td._)(this,"verification",null),(0,td._)(this,"enterpriseConnection",null),(0,td._)(this,"lastAuthenticatedAt",null),(0,td._)(this,"enterpriseConnectionId",null),(0,td._)(this,"destroy",()=>this._baseDelete()),this.pathRoot=e,this.fromJSON(t)}}class n4 extends rP{fromJSON(t){return t&&(this.id=t.id,this.name=t.name,this.domain=t.domain,this.active=t.active,this.provider=t.provider,this.logoPublicUrl=t.logo_public_url,this.syncUserAttributes=t.sync_user_attributes,this.allowSubdomains=t.allow_subdomains,this.allowIdpInitiated=t.allow_idp_initiated,this.disableAdditionalIdentifications=t.disable_additional_identifications,this.allowOrganizationAccountLinking=t.allow_organization_account_linking,this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at),this.enterpriseConnectionId=t.enterprise_connection_id),this}__internal_toSnapshot(){return{object:"enterprise_account_connection",id:this.id,name:this.name,domain:this.domain,active:this.active,protocol:this.protocol,provider:this.provider,logo_public_url:this.logoPublicUrl,sync_user_attributes:this.syncUserAttributes,allow_subdomains:this.allowSubdomains,allow_idp_initiated:this.allowIdpInitiated,disable_additional_identifications:this.disableAdditionalIdentifications,allow_organization_account_linking:this.allowOrganizationAccountLinking,enterprise_connection_id:this.enterpriseConnectionId,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"active",void 0),(0,td._)(this,"allowIdpInitiated",void 0),(0,td._)(this,"allowSubdomains",void 0),(0,td._)(this,"disableAdditionalIdentifications",void 0),(0,td._)(this,"domain",void 0),(0,td._)(this,"logoPublicUrl",""),(0,td._)(this,"name",void 0),(0,td._)(this,"protocol",void 0),(0,td._)(this,"provider",void 0),(0,td._)(this,"syncUserAttributes",void 0),(0,td._)(this,"allowOrganizationAccountLinking",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"enterpriseConnectionId",""),this.fromJSON(t)}}class n9 extends rP{fromJSON(t){var e,i,r,n,s,a,o;return t?(this.id=t.id,this.name=t.name,this.active=t.active,this.provider=t.provider,this.logoPublicUrl=null!=(e=t.logo_public_url)?e:null,this.domains=null!=(i=t.domains)?i:[],this.organizationId=null!=(r=t.organization_id)?r:null,this.syncUserAttributes=t.sync_user_attributes,this.disableAdditionalIdentifications=t.disable_additional_identifications,this.allowOrganizationAccountLinking=null!=(n=t.allow_organization_account_linking)&&n,this.customAttributes=null!=(s=t.custom_attributes)?s:[],this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at),this.samlConnection=t.saml_connection?{id:(a=t.saml_connection).id,name:a.name,active:a.active,idpEntityId:a.idp_entity_id,idpSsoUrl:a.idp_sso_url,idpCertificate:a.idp_certificate,idpMetadataUrl:a.idp_metadata_url,idpMetadata:a.idp_metadata,acsUrl:a.acs_url,spEntityId:a.sp_entity_id,spMetadataUrl:a.sp_metadata_url,allowSubdomains:a.allow_subdomains,allowIdpInitiated:a.allow_idp_initiated,forceAuthn:a.force_authn}:null,this.oauthConfig=t.oauth_config?{id:(o=t.oauth_config).id,name:o.name,clientId:o.client_id,providerKey:o.provider_key,discoveryUrl:o.discovery_url,logoPublicUrl:o.logo_public_url,requiresPkce:o.requires_pkce,createdAt:rT(o.created_at),updatedAt:rT(o.updated_at)}:null,this):this}__internal_toSnapshot(){var t,e,i,r,n,s,a,o,l,c;return{object:"enterprise_connection",id:this.id,name:this.name,active:this.active,provider:this.provider,logo_public_url:this.logoPublicUrl,domains:this.domains,organization_id:this.organizationId,sync_user_attributes:this.syncUserAttributes,disable_additional_identifications:this.disableAdditionalIdentifications,allow_organization_account_linking:this.allowOrganizationAccountLinking,custom_attributes:this.customAttributes,saml_connection:this.samlConnection?{id:(n=this.samlConnection).id,name:n.name,active:n.active,idp_entity_id:n.idpEntityId,idp_sso_url:n.idpSsoUrl,idp_certificate:n.idpCertificate,idp_metadata_url:n.idpMetadataUrl,idp_metadata:n.idpMetadata,acs_url:n.acsUrl,sp_entity_id:n.spEntityId,sp_metadata_url:n.spMetadataUrl,allow_subdomains:n.allowSubdomains,allow_idp_initiated:n.allowIdpInitiated,force_authn:n.forceAuthn}:void 0,oauth_config:this.oauthConfig?{id:(s=this.oauthConfig).id,name:s.name,client_id:s.clientId,provider_key:s.providerKey,discovery_url:s.discoveryUrl,logo_public_url:s.logoPublicUrl,requires_pkce:s.requiresPkce,created_at:null!=(a=null==(l=s.createdAt)?void 0:l.getTime())?a:0,updated_at:null!=(o=null==(c=s.updatedAt)?void 0:c.getTime())?o:0}:void 0,created_at:null!=(t=null==(i=this.createdAt)?void 0:i.getTime())?t:0,updated_at:null!=(e=null==(r=this.updatedAt)?void 0:r.getTime())?e:0}}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"name",void 0),(0,td._)(this,"active",void 0),(0,td._)(this,"provider",void 0),(0,td._)(this,"logoPublicUrl",null),(0,td._)(this,"domains",[]),(0,td._)(this,"organizationId",null),(0,td._)(this,"syncUserAttributes",void 0),(0,td._)(this,"disableAdditionalIdentifications",void 0),(0,td._)(this,"allowOrganizationAccountLinking",void 0),(0,td._)(this,"customAttributes",[]),(0,td._)(this,"oauthConfig",null),(0,td._)(this,"samlConnection",null),(0,td._)(this,"createdAt",null),(0,td._)(this,"updatedAt",null),this.fromJSON(t)}}class n7 extends rP{fromJSON(t){return t&&(this.user_api_keys_enabled=t.user_api_keys_enabled,this.orgs_api_keys_enabled=t.orgs_api_keys_enabled),this}__internal_toSnapshot(){return{user_api_keys_enabled:this.user_api_keys_enabled,orgs_api_keys_enabled:this.orgs_api_keys_enabled}}constructor(t=null){super(),(0,td._)(this,"user_api_keys_enabled",!1),(0,td._)(this,"orgs_api_keys_enabled",!1),this.fromJSON(t)}}class st extends rP{fromJSON(t){return t&&(t.actions&&(this.actions.adminDelete=this.withDefault(t.actions.admin_delete,this.actions.adminDelete)),t.domains&&(this.domains.enabled=this.withDefault(t.domains.enabled,this.domains.enabled),this.domains.enrollmentModes=this.withDefault(t.domains.enrollment_modes,this.domains.enrollmentModes),this.domains.defaultRole=this.withDefault(t.domains.default_role,this.domains.defaultRole)),t.slug&&(this.slug.disabled=this.withDefault(t.slug.disabled,this.slug.disabled)),t.organization_creation_defaults&&(this.organizationCreationDefaults.enabled=this.withDefault(t.organization_creation_defaults.enabled,this.organizationCreationDefaults.enabled)),this.enabled=this.withDefault(t.enabled,this.enabled),this.maxAllowedMemberships=this.withDefault(t.max_allowed_memberships,this.maxAllowedMemberships),this.forceOrganizationSelection=this.withDefault(t.force_organization_selection,this.forceOrganizationSelection)),this}__internal_toSnapshot(){return{actions:{admin_delete:this.actions.adminDelete},domains:{enabled:this.domains.enabled,enrollment_modes:this.domains.enrollmentModes,default_role:this.domains.defaultRole},enabled:this.enabled,max_allowed_memberships:this.maxAllowedMemberships}}constructor(t=null){super(),(0,td._)(this,"actions",{adminDelete:!1}),(0,td._)(this,"domains",{enabled:!1,enrollmentModes:[],defaultRole:null}),(0,td._)(this,"slug",{disabled:!1}),(0,td._)(this,"organizationCreationDefaults",{enabled:!1}),(0,td._)(this,"enabled",!1),(0,td._)(this,"maxAllowedMemberships",1),(0,td._)(this,"forceOrganizationSelection",void 0),this.fromJSON(t)}}class se extends rP{static getInstance(){return se.instance||(se.instance=new se),se.instance}fromJSON(t){return t&&(this.authConfig=new rR(t.auth_config),this.displayConfig=new nJ(t.display_config),this.maintenanceMode=this.withDefault(t.maintenance_mode,this.maintenanceMode),this.clientDebugMode=this.withDefault(t.client_debug_mode,this.clientDebugMode),this.partitionedCookies=this.withDefault(t.partitioned_cookies,this.partitionedCookies),this.organizationSettings=new st(t.organization_settings),this.userSettings=new ac(t.user_settings),this.commerceSettings=new nj(t.commerce_settings),this.apiKeysSettings=new n7(t.api_keys_settings),this.protectConfig=new sy(t.protect_config)),this}fetch(){let{touch:t,fetchMaxTries:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{touch:!1};return(t?this._basePatch({}):this._baseGet({fetchMaxTries:e})).then(t=>(nx.emit(nI,null),t))}__internal_toSnapshot(){var t;return{object:"environment",auth_config:this.authConfig.__internal_toSnapshot(),display_config:this.displayConfig.__internal_toSnapshot(),id:null!=(t=this.id)?t:"",maintenance_mode:this.maintenanceMode,client_debug_mode:this.clientDebugMode,partitioned_cookies:this.partitionedCookies,organization_settings:this.organizationSettings.__internal_toSnapshot(),user_settings:this.userSettings.__internal_toSnapshot(),commerce_settings:this.commerceSettings.__internal_toSnapshot(),api_keys_settings:this.apiKeysSettings.__internal_toSnapshot(),protect_config:this.protectConfig.__internal_toSnapshot()}}async __internal_enableEnvironmentSetting(t){await this._basePatch({path:"/dev_tools/enable_environment_setting",body:t})}constructor(t=null){super(),(0,td._)(this,"authConfig",new rR),(0,td._)(this,"displayConfig",new nJ),(0,td._)(this,"maintenanceMode",!1),(0,td._)(this,"clientDebugMode",!1),(0,td._)(this,"partitionedCookies",!1),(0,td._)(this,"pathRoot","/environment"),(0,td._)(this,"userSettings",new ac),(0,td._)(this,"organizationSettings",new st),(0,td._)(this,"commerceSettings",new nj),(0,td._)(this,"apiKeysSettings",new n7),(0,td._)(this,"protectConfig",new sy),(0,td._)(this,"isDevelopmentOrStaging",()=>!this.isProduction()),(0,td._)(this,"isProduction",()=>"production"===this.displayConfig.instanceEnvironmentType),(0,td._)(this,"isSingleSession",()=>this.authConfig.singleSessionMode),(0,td._)(this,"onWindowLocationHost",()=>this.displayConfig.backendHost===window.location.host),this.fromJSON(t)}}(0,td._)(se,"instance",void 0);class si extends rP{fromJSON(t){return t&&(this.id=t.id,this.identificationId=t.identification_id,this.providerUserId=t.provider_user_id,this.approvedScopes=t.approved_scopes,this.imageUrl=t.image_url,this.emailAddress=t.email_address,this.firstName=t.first_name,this.lastName=t.last_name,this.provider=(t.provider||"").replace("oauth_",""),this.username=t.username,this.phoneNumber=t.phone_number,this.publicMetadata=t.public_metadata,this.label=t.label,t.verification&&(this.verification=new n2(t.verification))),this}__internal_toSnapshot(){var t;return{object:"external_account",id:this.id,identification_id:this.identificationId,provider:this.provider,provider_user_id:this.providerUserId,email_address:this.emailAddress,approved_scopes:this.approvedScopes,first_name:this.firstName,last_name:this.lastName,image_url:this.imageUrl,username:this.username,phone_number:this.phoneNumber,public_metadata:this.publicMetadata,label:this.label,verification:(null==(t=this.verification)?void 0:t.__internal_toSnapshot())||null}}providerSlug(){return this.provider}providerTitle(){let t;return[(t=this.providerSlug()||"").charAt(0).toUpperCase()+t.slice(1),"Account"].join(" ")}accountIdentifier(){return this.username||this.emailAddress||this.label}constructor(t,e){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"identificationId",void 0),(0,td._)(this,"provider",void 0),(0,td._)(this,"providerUserId",""),(0,td._)(this,"emailAddress",""),(0,td._)(this,"approvedScopes",""),(0,td._)(this,"firstName",""),(0,td._)(this,"lastName",""),(0,td._)(this,"imageUrl",""),(0,td._)(this,"username",""),(0,td._)(this,"phoneNumber",""),(0,td._)(this,"publicMetadata",{}),(0,td._)(this,"label",""),(0,td._)(this,"verification",null),(0,td._)(this,"reauthorize",t=>{let{additionalScopes:e,redirectUrl:i}=t||{};return this._basePatch({action:"reauthorize",body:{additional_scope:e,redirect_url:i}})}),(0,td._)(this,"destroy",()=>this._baseDelete()),this.pathRoot=e,this.fromJSON(t)}}class sr extends rP{fromJSON(t){return t&&(this.id=t.id,this.name=t.name,this.description=t.description,this.slug=t.slug,this.avatarUrl=t.avatar_url),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"name",void 0),(0,td._)(this,"description",null),(0,td._)(this,"slug",void 0),(0,td._)(this,"avatarUrl",null),this.fromJSON(t)}}class sn extends rP{fromJSON(t){return t&&(this.id=t.id,this.type=t.type),this}__internal_toSnapshot(){return{object:"identification_link",id:this.id,type:this.type}}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"type",void 0),this.fromJSON(t)}}class ss extends rP{static async create(t){var e;let i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r;return"string"==typeof r.file?(n=r.file,i=new Headers({"Content-Type":"application/octet-stream"})):r.file&&(n=new FormData).append("file",r.file),new ss(null==(e=await rP._fetch({path:t,method:"POST",body:n,headers:i}))?void 0:e.response)}static async delete(t){var e;return new ss(null==(e=await rP._fetch({path:t,method:"DELETE"}))?void 0:e.response)}fromJSON(t){return t&&(this.id=t.id,this.name=t.name,this.publicUrl=t.public_url),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"name",null),(0,td._)(this,"publicUrl",null),this.fromJSON(t)}}class sa extends rP{static async create(t,e){var i;let{name:r}=e;return new sa(null==(i=await rP._fetch({path:"/organizations/".concat(t,"/domains"),method:"POST",body:{name:r}}))?void 0:i.response)}fromJSON(t){return t&&(this.id=t.id,this.name=t.name,this.organizationId=t.organization_id,this.enrollmentMode=t.enrollment_mode,this.affiliationEmailAddress=t.affiliation_email_address,this.totalPendingSuggestions=t.total_pending_suggestions,this.totalPendingInvitations=t.total_pending_invitations,t.verification?this.verification={status:t.verification.status,strategy:t.verification.strategy,attempts:t.verification.attempts,expiresAt:rT(t.verification.expires_at)}:this.verification=null),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"name",void 0),(0,td._)(this,"organizationId",void 0),(0,td._)(this,"enrollmentMode",void 0),(0,td._)(this,"verification",void 0),(0,td._)(this,"affiliationEmailAddress",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"totalPendingInvitations",void 0),(0,td._)(this,"totalPendingSuggestions",void 0),(0,td._)(this,"prepareAffiliationVerification",async t=>this._basePost({path:"/organizations/".concat(this.organizationId,"/domains/").concat(this.id,"/prepare_affiliation_verification"),method:"POST",body:t})),(0,td._)(this,"attemptAffiliationVerification",async t=>this._basePost({path:"/organizations/".concat(this.organizationId,"/domains/").concat(this.id,"/attempt_affiliation_verification"),method:"POST",body:t})),(0,td._)(this,"updateEnrollmentMode",t=>this._basePost({path:"/organizations/".concat(this.organizationId,"/domains/").concat(this.id,"/update_enrollment_mode"),body:t})),(0,td._)(this,"delete",()=>this._baseDelete({path:"/organizations/".concat(this.organizationId,"/domains/").concat(this.id)})),this.fromJSON(t)}}class so extends rP{fromJSON(t){return t&&(this.id=t.id,this.organizationId=t.organization_id,this.status=t.status,this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at),t.public_user_data&&(this.publicUserData=new sw(t.public_user_data))),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"organizationId",void 0),(0,td._)(this,"status",void 0),(0,td._)(this,"publicUserData",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"accept",async()=>await this._basePost({path:"/organizations/".concat(this.organizationId,"/membership_requests/").concat(this.id,"/accept")})),(0,td._)(this,"reject",async()=>await this._basePost({path:"/organizations/".concat(this.organizationId,"/membership_requests/").concat(this.id,"/reject")})),this.fromJSON(t)}}class sl extends rP{fromJSON(t){return t&&(this.id=t.id,this.key=t.key,this.name=t.name,this.description=t.description,this.type=t.type,this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at)),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"key",void 0),(0,td._)(this,"name",void 0),(0,td._)(this,"description",void 0),(0,td._)(this,"type",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),this.fromJSON(t)}}class sc extends rP{fromJSON(t){return t&&(this.id=t.id,this.key=t.key,this.name=t.name,this.description=t.description,this.permissions=t.permissions.map(t=>new sl(t)),this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at)),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"key",void 0),(0,td._)(this,"name",void 0),(0,td._)(this,"description",void 0),(0,td._)(this,"permissions",[]),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),this.fromJSON(t)}}class su extends rP{static async create(t){var e;return new su(null==(e=await rP._fetch({path:"/organizations",method:"POST",body:t}))?void 0:e.response)}static async get(t){var e;return new su(null==(e=await rP._fetch({path:"/organizations/".concat(t),method:"GET"}))?void 0:e.response)}fromJSON(t){return t&&(this.id=t.id,this.name=t.name,this.slug=t.slug,this.imageUrl=t.image_url||"",this.hasImage=t.has_image||!1,this.publicMetadata=t.public_metadata||{},this.membersCount=t.members_count||0,this.pendingInvitationsCount=t.pending_invitations_count||0,this.maxAllowedMemberships=t.max_allowed_memberships||0,this.adminDeleteEnabled=t.admin_delete_enabled||!1,this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at)),this}__internal_toSnapshot(){return{object:"organization",id:this.id,name:this.name,slug:this.slug,image_url:this.imageUrl,has_image:this.hasImage,public_metadata:this.publicMetadata,members_count:this.membersCount,pending_invitations_count:this.pendingInvitationsCount,max_allowed_memberships:this.maxAllowedMemberships,admin_delete_enabled:this.adminDeleteEnabled,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}async reload(t){var e;let{rotatingTokenNonce:i}=t||{},r=null==(e=await rP._fetch({path:"/organizations/".concat(this.id),method:"GET",rotatingTokenNonce:i},{forceUpdateClient:!0}))?void 0:e.response;return this.fromJSON(r)}constructor(t){super(),(0,td._)(this,"pathRoot","/organizations"),(0,td._)(this,"id",void 0),(0,td._)(this,"name",void 0),(0,td._)(this,"slug",void 0),(0,td._)(this,"imageUrl",void 0),(0,td._)(this,"hasImage",void 0),(0,td._)(this,"publicMetadata",{}),(0,td._)(this,"adminDeleteEnabled",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"membersCount",0),(0,td._)(this,"pendingInvitationsCount",0),(0,td._)(this,"maxAllowedMemberships",void 0),(0,td._)(this,"update",async t=>this._basePatch({body:t})),(0,td._)(this,"getRoles",async t=>await rP._fetch({path:"/organizations/".concat(this.id,"/roles"),method:"GET",search:r2(t)},{forceUpdateClient:!0}).then(t=>{let{data:e,total_count:i,has_role_set_migration:r}=null==t?void 0:t.response;return{data:e.map(t=>new sc(t)),total_count:i,has_role_set_migration:r}})),(0,td._)(this,"getDomains",async t=>await rP._fetch({path:"/organizations/".concat(this.id,"/domains"),method:"GET",search:r2(t)},{forceUpdateClient:!0}).then(t=>{let{data:e,total_count:i}=null==t?void 0:t.response;return{total_count:i,data:e.map(t=>new sa(t))}})),(0,td._)(this,"getDomain",async t=>{var e;let{domainId:i}=t;return new sa(null==(e=await rP._fetch({path:"/organizations/".concat(this.id,"/domains/").concat(i),method:"GET"}))?void 0:e.response)}),(0,td._)(this,"getMembershipRequests",async t=>await rP._fetch({path:"/organizations/".concat(this.id,"/membership_requests"),method:"GET",search:r2(t)}).then(t=>{let{data:e,total_count:i}=null==t?void 0:t.response;return{total_count:i,data:e.map(t=>new so(t))}})),(0,td._)(this,"createDomain",async t=>sa.create(this.id,{name:t})),(0,td._)(this,"getMemberships",async t=>await rP._fetch({path:"/organizations/".concat(this.id,"/memberships"),method:"GET",search:r2({...t,paginated:!0})}).then(t=>{let{data:e,total_count:i}=null==t?void 0:t.response;return{total_count:i,data:e.map(t=>new sd(t))}})),(0,td._)(this,"getInvitations",async t=>await rP._fetch({path:"/organizations/".concat(this.id,"/invitations"),method:"GET",search:r2(t)},{forceUpdateClient:!0}).then(t=>{let{data:e,total_count:i}=null==t?void 0:t.response;return{total_count:i,data:e.map(t=>new sh(t))}})),(0,td._)(this,"addMember",async t=>{let{userId:e,role:i}=t;return await rP._fetch({method:"POST",path:"/organizations/".concat(this.id,"/memberships"),body:{userId:e,role:i}}).then(t=>new sd(null==t?void 0:t.response))}),(0,td._)(this,"inviteMember",async t=>sh.create(this.id,t)),(0,td._)(this,"inviteMembers",async t=>sh.createBulk(this.id,t)),(0,td._)(this,"updateMember",async t=>{let{userId:e,role:i}=t;return await rP._fetch({method:"PATCH",path:"/organizations/".concat(this.id,"/memberships/").concat(e),body:{role:i}}).then(t=>new sd(null==t?void 0:t.response))}),(0,td._)(this,"removeMember",async t=>await rP._fetch({method:"DELETE",path:"/organizations/".concat(this.id,"/memberships/").concat(t)}).then(t=>new sd(null==t?void 0:t.response))),(0,td._)(this,"destroy",async()=>this._baseDelete()),(0,td._)(this,"setLogo",async t=>{let e,i,{file:r}=t;return null===r?await rP._fetch({path:"/organizations/".concat(this.id,"/logo"),method:"DELETE"}).then(t=>new su(null==t?void 0:t.response)):("string"==typeof r?(e=r,i=new Headers({"Content-Type":"application/octet-stream"})):(e=new FormData).append("file",r),await rP._fetch({path:"/organizations/".concat(this.id,"/logo"),method:"PUT",body:e,headers:i}).then(t=>new su(null==t?void 0:t.response)))}),(0,td._)(this,"initializePaymentMethod",t=>np({...t,orgId:this.id})),(0,td._)(this,"addPaymentMethod",t=>nf({...t,orgId:this.id})),(0,td._)(this,"getPaymentMethods",t=>n_({...t,orgId:this.id})),this.fromJSON(t)}}class sh extends rP{static async create(t,e){var i;let{emailAddress:r,role:n}=e;return new sh(null==(i=await rP._fetch({path:"/organizations/".concat(t,"/invitations"),method:"POST",body:{email_address:r,role:n}}))?void 0:i.response)}static async createBulk(t,e){var i;let{emailAddresses:r,role:n}=e;return(null==(i=await rP._fetch({path:"/organizations/".concat(t,"/invitations/bulk"),method:"POST",body:{email_address:r,role:n}}))?void 0:i.response).map(t=>new sh(t))}fromJSON(t){return t&&(this.id=t.id,this.emailAddress=t.email_address,this.organizationId=t.organization_id,this.publicMetadata=t.public_metadata,this.role=t.role,this.roleName=t.role_name,this.status=t.status,this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at)),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"emailAddress",void 0),(0,td._)(this,"organizationId",void 0),(0,td._)(this,"publicMetadata",{}),(0,td._)(this,"status",void 0),(0,td._)(this,"role",void 0),(0,td._)(this,"roleName",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"revoke",async()=>await this._basePost({path:"/organizations/".concat(this.organizationId,"/invitations/").concat(this.id,"/revoke")})),this.fromJSON(t)}}class sd extends rP{fromJSON(t){return t&&(this.id=t.id,this.organization=new su(t.organization),this.publicMetadata=t.public_metadata||{},t.public_user_data&&(this.publicUserData=new sw(t.public_user_data)),this.permissions=Array.isArray(t.permissions)?[...t.permissions]:[],this.role=t.role,this.roleName=t.role_name,this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at)),this}__internal_toSnapshot(){var t;return{object:"organization_membership",id:this.id,organization:this.organization.__internal_toSnapshot(),public_metadata:this.publicMetadata,public_user_data:null==(t=this.publicUserData)?void 0:t.__internal_toSnapshot(),permissions:this.permissions,role:this.role,role_name:this.roleName,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}reload(t){throw Error("".concat(i$," Calling ").concat("OrganizationMembership",".reload is not currently supported. Please contact support."))}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"publicMetadata",{}),(0,td._)(this,"publicUserData",void 0),(0,td._)(this,"organization",void 0),(0,td._)(this,"permissions",[]),(0,td._)(this,"role",void 0),(0,td._)(this,"roleName",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"destroy",async()=>{var t;return await this._baseDelete({path:"/organizations/".concat(this.organization.id,"/memberships/").concat(null==(t=this.publicUserData)?void 0:t.userId)})}),(0,td._)(this,"update",async t=>{var e;let{role:i}=t;return await this._basePatch({path:"/organizations/".concat(this.organization.id,"/memberships/").concat(null==(e=this.publicUserData)?void 0:e.userId),body:{role:i}})}),this.fromJSON(t)}}(0,td._)(sd,"retrieve",async t=>await rP._fetch({path:"/me/organization_memberships",method:"GET",search:r2({...t,paginated:!0})}).then(t=>{let{data:e,total_count:i}=null==t?void 0:t.response;return{total_count:i,data:e.map(t=>new sd(t))}}));class sp extends rP{static async retrieve(t){return await rP._fetch({path:"/me/organization_suggestions",method:"GET",search:r2(t)}).then(t=>{let{data:e,total_count:i}=null==t?void 0:t.response;return{total_count:i,data:e.map(t=>new sp(t))}})}fromJSON(t){return t&&(this.id=t.id,this.status=t.status,this.publicOrganizationData={hasImage:t.public_organization_data.has_image,imageUrl:t.public_organization_data.image_url,name:t.public_organization_data.name,id:t.public_organization_data.id,slug:t.public_organization_data.slug},this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at)),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"publicOrganizationData",void 0),(0,td._)(this,"status",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"accept",async()=>await this._basePost({path:"/me/organization_suggestions/".concat(this.id,"/accept")})),this.fromJSON(t)}}function sf(){return t_()&&"function"==typeof window.PublicKeyCredential}async function s_(){try{return sf()&&await window.PublicKeyCredential.isConditionalMediationAvailable()}catch{return!1}}async function sg(){try{return"u">typeof window&&await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}}class sv extends rP{static async create(){return rP._fetch({path:"/me/passkeys",method:"POST"}).then(t=>new sv(null==t?void 0:t.response))}static async attemptVerification(t,e){let i,r=(i=e.response,{...nQ(e),response:{clientDataJSON:n0(i.clientDataJSON),attestationObject:n0(i.attestationObject),transports:i.getTransports()}});return rP._fetch({path:"/me/passkeys/".concat(t,"/attempt_verification"),method:"POST",body:{strategy:"passkey",publicKeyCredential:JSON.stringify(r)}}).then(t=>new sv(null==t?void 0:t.response))}static async registerPasskey(){var t;let e=sv.clerk.__internal_isWebAuthnSupported||sf,i=sv.clerk.__internal_createPublicCredentials||nH,r=sv.clerk.__internal_isWebAuthnPlatformAuthenticatorSupported||sg;if(!e())throw new tW("Passkeys are not supported on this device.",{code:"passkey_not_supported"});let n=await this.create(),{verification:s}=n,a=null==s?void 0:s.publicKey;if(a||i8("create"),(null==(t=a.authenticatorSelection)?void 0:t.authenticatorAttachment)==="platform"&&!await r())throw new tW("Registration requires a platform authenticator but the device does not support it.",{code:"passkey_pa_not_supported"});let{publicKeyCredential:o,error:l}=await i(a);if(!o)throw l;return this.attemptVerification(n.id,o)}fromJSON(t){return t&&(this.id=t.id,this.name=t.name,this.lastUsedAt=t.last_used_at?rT(t.last_used_at):null,this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at),t.verification&&(this.verification=new n8(t.verification))),this}__internal_toSnapshot(){var t,e;return{object:"passkey",id:this.id,name:this.name,verification:(null==(t=this.verification)?void 0:t.__internal_toSnapshot())||null,last_used_at:(null==(e=this.lastUsedAt)?void 0:e.getTime())||null,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"pathRoot","/me/passkeys"),(0,td._)(this,"verification",null),(0,td._)(this,"name",null),(0,td._)(this,"lastUsedAt",null),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"update",t=>this._basePatch({body:t})),(0,td._)(this,"delete",async()=>{var t;return new nB(null==(t=await rP._fetch({path:this.path(),method:"DELETE"}))?void 0:t.response)}),this.fromJSON(t)}}class sm extends rP{fromJSON(t){return t&&(this.id=t.id,this.phoneNumber=t.phone_number,this.reservedForSecondFactor=t.reserved_for_second_factor,this.defaultSecondFactor=t.default_second_factor,this.verification=new n2(t.verification),this.linkedTo=(t.linked_to||[]).map(t=>new sn(t)),this.backupCodes=t.backup_codes),this}__internal_toSnapshot(){return{object:"phone_number",id:this.id||"",phone_number:this.phoneNumber,reserved_for_second_factor:this.reservedForSecondFactor,default_second_factor:this.defaultSecondFactor,verification:this.verification.__internal_toSnapshot(),linked_to:this.linkedTo.map(t=>t.__internal_toSnapshot()),backup_codes:this.backupCodes}}constructor(t,e){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"phoneNumber",""),(0,td._)(this,"reservedForSecondFactor",!1),(0,td._)(this,"defaultSecondFactor",!1),(0,td._)(this,"linkedTo",[]),(0,td._)(this,"verification",void 0),(0,td._)(this,"backupCodes",void 0),(0,td._)(this,"create",()=>this._basePost({body:{phone_number:this.phoneNumber}})),(0,td._)(this,"prepareVerification",()=>this._basePost({action:"prepare_verification",body:{strategy:"phone_code"}})),(0,td._)(this,"attemptVerification",t=>{let{code:e}=t||{};return this._basePost({action:"attempt_verification",body:{code:e}})}),(0,td._)(this,"setReservedForSecondFactor",t=>{let{reserved:e}=t||{};return this._basePatch({body:{reserved_for_second_factor:e}})}),(0,td._)(this,"makeDefaultSecondFactor",()=>this._basePatch({body:{default_second_factor:!0}})),(0,td._)(this,"destroy",()=>this._baseDelete()),(0,td._)(this,"toString",()=>{let t=this.phoneNumber.match(/^(\d{3})(\d{3})(\d{4})$/);return t?"("+t[1]+") "+t[2]+"-"+t[3]:this.phoneNumber}),this.pathRoot=e,this.fromJSON(t)}}class sy extends rP{fromJSON(t){return t&&(this.id=this.withDefault(t.id,this.id),this.loaders=this.withDefault(t.loaders,this.loaders)),this}__internal_toSnapshot(){return{object:"protect_config",id:this.id,loaders:this.loaders}}constructor(t=null){super(),(0,td._)(this,"id",""),(0,td._)(this,"loaders",void 0),(0,td._)(this,"rollout",void 0),this.fromJSON(t)}}class sw{fromJSON(t){if(t){var e;this.firstName=t.first_name||null,this.lastName=t.last_name||null,this.imageUrl=t.image_url||"",this.hasImage=t.has_image||!1,this.identifier=t.identifier||"",this.userId=t.user_id,this.username=t.username,this.banned=null!=(e=t.banned)?e:void 0}return this}__internal_toSnapshot(){return{first_name:this.firstName,last_name:this.lastName,image_url:this.imageUrl,has_image:this.hasImage,identifier:this.identifier,user_id:this.userId,username:this.username,banned:this.banned}}constructor(t){(0,td._)(this,"firstName",void 0),(0,td._)(this,"lastName",void 0),(0,td._)(this,"imageUrl",void 0),(0,td._)(this,"hasImage",void 0),(0,td._)(this,"identifier",void 0),(0,td._)(this,"userId",void 0),(0,td._)(this,"username",void 0),(0,td._)(this,"banned",void 0),this.fromJSON(t)}}let sb={strict_mfa:{afterMinutes:10,level:"multi_factor"},strict:{afterMinutes:10,level:"second_factor"},moderate:{afterMinutes:60,level:"second_factor"},lax:{afterMinutes:1440,level:"second_factor"}},sk=new Set(["first_factor","second_factor","multi_factor"]),sS=new Set(["strict_mfa","strict","moderate","lax"]),sA=new Set(["o","org","organization"]),sI=new Set(["u","user"]),sU=t=>"number"==typeof t&&Number.isFinite(t)&&(-1===t||t>=0),sx=(t,e)=>{let{org:i,user:r}=sC(t),[n,s]=e.split(":"),a=void 0!==s,o=s||n;if(a&&!sA.has(n)&&!sI.has(n))throw Error("Invalid scope: ".concat(n));if(a){if(sA.has(n))return i.includes(o);if(sI.has(n))return r.includes(o)}return[...i,...r].includes(o)},sC=t=>{let e=[],i=[];if(!t)return{org:e,user:i};let r=t.split(",");for(let t=0;t<r.length;t++){let n=r[t].trim(),s=n.indexOf(":");if(-1===s)throw Error("Invalid claim element (missing colon): ".concat(n));let a=n.slice(0,s),o=n.slice(s+1);"o"===a?e.push(o):"u"===a?i.push(o):("ou"===a||"uo"===a)&&(e.push(o),i.push(o))}return{org:e,user:i}};class sE extends rP{fromJSON(t){return t&&(this.id=t.id,this.status=t.status,this.session=new sz(t.session),this.level=t.level,this.supportedFirstFactors=eu(t.supported_first_factors),this.supportedSecondFactors=eu(t.supported_second_factors),this.firstFactorVerification=new n2(t.first_factor_verification),this.secondFactorVerification=new n2(t.second_factor_verification)),this}constructor(t=null){super(),(0,td._)(this,"status",void 0),(0,td._)(this,"level",void 0),(0,td._)(this,"session",void 0),(0,td._)(this,"supportedFirstFactors",[]),(0,td._)(this,"supportedSecondFactors",[]),(0,td._)(this,"firstFactorVerification",new n2(null)),(0,td._)(this,"secondFactorVerification",new n2(null)),this.fromJSON(t)}}var sP=new WeakMap,sT=new WeakSet,sO=new WeakSet,sR=new WeakSet,sM=new WeakSet,sN=new WeakSet;class sz extends rP{static isSessionResource(t){return!!t&&t instanceof sz}fromJSON(t){var e;return t&&(this.id=t.id,this.status=t.status,this.expireAt=rT(t.expire_at),this.abandonAt=rT(t.abandon_at),this.factorVerificationAge=t.factor_verification_age,this.lastActiveAt=rT(t.last_active_at||void 0),this.lastActiveOrganizationId=t.last_active_organization_id,this.actor=t.actor||null,this.agent=(null==(e=t.actor)?void 0:e.type)==="agent"?t.actor:null,this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at),this.user=new as(t.user),this.tasks=t.tasks||null,t.public_user_data&&(this.publicUserData=new sw(t.public_user_data)),this.lastActiveToken=t.last_active_token?new ae(t.last_active_token):null),this}__internal_toSnapshot(){var t,e;return{object:"session",id:this.id,status:this.status,expire_at:this.expireAt.getTime(),abandon_at:this.abandonAt.getTime(),factor_verification_age:this.factorVerificationAge,last_active_at:this.lastActiveAt.getTime(),last_active_organization_id:this.lastActiveOrganizationId,actor:this.actor,tasks:this.tasks,user:(null==(t=this.user)?void 0:t.__internal_toSnapshot())||null,public_user_data:this.publicUserData.__internal_toSnapshot(),last_active_token:(null==(e=this.lastActiveToken)?void 0:e.__internal_toSnapshot())||null,created_at:this.createdAt.getTime(),updated_at:this.updatedAt.getTime()}}async _getToken(t){let e;if(!this.user)return null;let{skipCache:i=!1,template:r}=t||{},n=void 0===(null==t?void 0:t.organizationId)?this.lastActiveOrganizationId:null==t?void 0:t.organizationId,s=h(this,sT,sF).call(this,r,n),a=i?void 0:nF.get({tokenId:s}),o=!r&&n===this.lastActiveOrganizationId;if(a){var l;let t=null!=(l=a.entry.resolvedToken)?l:await a.entry.tokenResolver;o&&t.getRawString()&&nx.emit(nS,{token:t}),e=t.getRawString()||null}else if(tg())e=await h(this,sM,sj).call(this,r,n,s,o,i);else throw new tU("Browser is offline, skipping token fetch",{code:"network_error"});if(null===e&&!tv())throw new tU("Network request failed while offline",{code:"network_error"});return e}get currentTask(){var t;let[e]=null!=(t=this.tasks)?t:[];return e}constructor(t){var e;super(),e=this,d(this,sT),d(this,sO),d(this,sR),d(this,sM),d(this,sN),(0,td._)(this,"pathRoot","/client/sessions"),(0,td._)(this,"id",void 0),(0,td._)(this,"status",void 0),(0,td._)(this,"lastActiveAt",void 0),(0,td._)(this,"lastActiveToken",void 0),(0,td._)(this,"lastActiveOrganizationId",void 0),(0,td._)(this,"actor",void 0),(0,td._)(this,"agent",void 0),(0,td._)(this,"user",void 0),(0,td._)(this,"publicUserData",void 0),(0,td._)(this,"factorVerificationAge",null),(0,td._)(this,"tasks",null),(0,td._)(this,"expireAt",void 0),(0,td._)(this,"abandonAt",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"end",()=>(nF.clear(),this._basePost({action:"end"}))),(0,td._)(this,"remove",()=>(nF.clear(),this._basePost({action:"remove"}))),(0,td._)(this,"_touchPost",async function(){let{intent:t,skipUpdateClient:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{skipUpdateClient:!1},r=await rP._fetch({method:"POST",path:e.path("touch"),body:{active_organization_id:e.lastActiveOrganizationId,intent:t}},{skipUpdateClient:i});return e.fromJSON((null==r?void 0:r.response)||r),r}),(0,td._)(this,"touch",async function(){let{intent:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return await e._touchPost({intent:t,skipUpdateClient:!1}),e.lastActiveToken&&nx.emit(nS,{token:e.lastActiveToken}),e}),(0,td._)(this,"__internal_touch",async function(){let{intent:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return nD(await e._touchPost({intent:t,skipUpdateClient:!0}))}),(0,td._)(this,"clearCache",()=>nF.clear()),(0,td._)(this,"getToken",async t=>{try{let e=await iR(()=>this._getToken(t),{factor:1.55,initialDelay:3e3,maxDelayBetweenRetries:5e4,jitter:!1,shouldRetry:(t,e)=>(!tD(t)||(null==t?void 0:t.status)===429)&&(tv()?e<=8:e<=3)});if(!e&&!tv())throw new tR("Network request failed while offline. The browser appears to be disconnected.");return e}catch(t){if(!tv())throw new tR("Network request failed while offline. The browser appears to be disconnected.");throw t}}),(0,td._)(this,"checkAuthorization",t=>{var e,i,r,n,s,a,o;let l,c=((null==(e=this.user)?void 0:e.organizationMemberships)||[]).find(t=>t.organization.id===this.lastActiveOrganizationId);return(l={userId:null==(i=this.user)?void 0:i.id,factorVerificationAge:this.factorVerificationAge,orgId:null==c||null==(r=c.organization)?void 0:r.id,orgRole:null==c?void 0:c.role,orgPermissions:null==c?void 0:c.permissions,features:(null==(s=this.lastActiveToken)||null==(n=s.jwt)?void 0:n.claims.fea)||"",plans:(null==(o=this.lastActiveToken)||null==(a=o.jwt)?void 0:a.claims.pla)||""},t=>{let e;return!!l.userId&&(e=[((t,e)=>{let{orgId:i,orgRole:r,orgPermissions:n}=e,s=void 0!==t.role,a=void 0!==t.permission;return s||a?s&&"string"!=typeof t.role||a&&"string"!=typeof t.permission||!i||s&&("string"!=typeof r||!r||r.replace(/^(org:)*/,"org:")!==t.role.replace(/^(org:)*/,"org:"))||a&&(!Array.isArray(n)||!n.includes(t.permission.replace(/^(org:)*/,"org:")))?"fail":"pass":"skip"})(t,l),((t,e)=>{let{features:i,plans:r}=e,n=void 0!==t.feature,s=void 0!==t.plan;if(!n&&!s)return"skip";if(n&&"string"!=typeof t.feature||s&&"string"!=typeof t.plan)return"fail";if(n){if("string"!=typeof i||!i)return"fail";try{if(!sx(i,t.feature))return"fail"}catch{return"fail"}}if(s){if("string"!=typeof r||!r)return"fail";try{if(!sx(r,t.plan))return"fail"}catch{return"fail"}}return"pass"})(t,l),((t,e)=>{let{factorVerificationAge:i}=e;if(void 0===t.reverification)return"skip";if(!i||!Array.isArray(i)||2!==i.length||!sU(i[0])||!sU(i[1]))return"fail";let r=(t=>{let e,i;if(!t)return!1;let r="string"==typeof t&&sS.has(t),n="object"==typeof t&&(e=t.level,sk.has(e))&&"number"==typeof(i=t.afterMinutes)&&i>0;return(!!r||!!n)&&(t=>"string"==typeof t?sb[t]:t).bind(null,t)})(t.reverification);if(!r)return"fail";let{level:n,afterMinutes:s}=r(),[a,o]=i;if(-1===a&&-1===o)return"fail";let l=-1!==a&&s>a,c=-1!==o&&s>o;switch(n){case"first_factor":return l?"pass":"fail";case"second_factor":if(-1===o)return l?"pass":"fail";return c?"pass":"fail";case"multi_factor":if(-1===o)return l?"pass":"fail";if(-1===a)return"fail";return l&&c?"pass":"fail"}})(t,l)]).some(t=>"pass"===t)&&e.every(t=>"pass"===t||"skip"===t)})(t)}),c(this,sP,{writable:!0,value:t=>{if(t){let e=h(this,sT,sF).call(this);nF.set({tokenId:e,tokenResolver:Promise.resolve(t),onRefresh:()=>h(this,sN,sB).call(this,void 0,this.lastActiveOrganizationId,e,!0)})}}}),(0,td._)(this,"startVerification",async t=>{var e;let{level:i}=t;return new sE(null==(e=await rP._fetch({method:"POST",path:"/client/sessions/".concat(this.id,"/verify"),body:{level:i}}))?void 0:e.response)}),(0,td._)(this,"prepareFirstFactorVerification",async t=>{var e;let i;switch(t.strategy){case"email_code":i={emailAddressId:t.emailAddressId};break;case"phone_code":i={phoneNumberId:t.phoneNumberId,default:t.default};break;case"passkey":i={};break;case"enterprise_sso":i={emailAddressId:t.emailAddressId,enterpriseConnectionId:t.enterpriseConnectionId,redirectUrl:t.redirectUrl};break;default:iZ("Session.prepareFirstFactorVerification",t.strategy)}return new sE(null==(e=await rP._fetch({method:"POST",path:"/client/sessions/".concat(this.id,"/verify/prepare_first_factor"),body:{...i,strategy:t.strategy}}))?void 0:e.response)}),(0,td._)(this,"attemptFirstFactorVerification",async t=>{var e;let i;return i="passkey"===t.strategy?{publicKeyCredential:JSON.stringify(nZ(t.publicKeyCredential))}:{...t},new sE(null==(e=await rP._fetch({method:"POST",path:"/client/sessions/".concat(this.id,"/verify/attempt_first_factor"),body:{...i,strategy:t.strategy}}))?void 0:e.response)}),(0,td._)(this,"verifyWithPasskey",async()=>{let{nonce:t=null}=(await this.prepareFirstFactorVerification({strategy:"passkey"})).firstFactorVerification,e=sz.clerk.__internal_isWebAuthnSupported||sf,i=sz.clerk.__internal_getPublicCredentials||n$;if(!e())throw new tW("Passkeys are not supported",{code:"passkey_not_supported"});let r=t?nX(JSON.parse(t)):null;r||i8("get");let{publicKeyCredential:n,error:s}=await i({publicKeyOptions:r,conditionalUI:!1});if(!n)throw s;return this.attemptFirstFactorVerification({strategy:"passkey",publicKeyCredential:n})}),(0,td._)(this,"prepareSecondFactorVerification",async t=>{var e;return new sE(null==(e=await rP._fetch({method:"POST",path:"/client/sessions/".concat(this.id,"/verify/prepare_second_factor"),body:t}))?void 0:e.response)}),(0,td._)(this,"attemptSecondFactorVerification",async t=>{var e;return new sE(null==(e=await rP._fetch({method:"POST",path:"/client/sessions/".concat(this.id,"/verify/attempt_second_factor"),body:t}))?void 0:e.response)}),this.fromJSON(t),o(this,sP).call(this,this.lastActiveToken)}}var sW={writable:!0,value:new Set};function sF(t,e){let i=void 0===e?this.lastActiveOrganizationId:e;return iG.build(this.id,t,i)}function sD(t,e,i){var r,n,s,a;let o=t?"".concat(this.path(),"/tokens/").concat(t):"".concat(this.path(),"/tokens"),l=null==(s=sz.clerk)||null==(n=s.__internal_environment)||null==(r=n.authConfig)?void 0:r.sessionMinter,c=t?{}:{organizationId:null!=e?e:null,...l&&this.lastActiveToken?{token:this.lastActiveToken.getRawString()}:{},...l&&i?{forceOrigin:"true"}:{}};if(l)return ae.create(o,c,i?{debug:"skip_cache"}:void 0);let u=null==(a=this.lastActiveToken)?void 0:a.getRawString();return ae.create(o,c,i?{debug:"skip_cache"}:void 0).catch(t=>{if(tO.is(t)&&u)return ae.create(o,{...c},{expired_token:u});throw t})}function sL(t,e){!e||t.getRawString()&&(nx.emit(nS,{token:t}),t.jwt&&(this.lastActiveToken=t,nx.emit(nU,null)))}function sj(t,e,i,r,n){iE.info("Fetching new token from API",{organizationId:e,template:t,tokenId:i},"session");let s=h(this,sO,sD).call(this,t,e,n);return nF.set({tokenId:i,tokenResolver:s,onRefresh:()=>h(this,sN,sB).call(this,t,e,i,r)}),s.then(t=>{let e=t.getRawString();if(!e)throw new tU("Token fetch returned empty response",{code:"network_error"});return h(this,sR,sL).call(this,t,r),e})}function sB(t,e,i,r){var n,s,a,o,l;if(r1(sz,sz,sW).has(i))return;r1(sz,sz,sW).add(i);let c=null==(s=sz.clerk)||null==(n=s.__internal_getOption)?void 0:n.call(s,"experimental"),u=(null==c?void 0:c.runtimeEnvironment)==="headless",d=null==(l=this.lastActiveToken)||null==(o=l.jwt)||null==(a=o.claims)?void 0:a.exp;u&&d&&Date.now()/1e3>d?r1(sz,sz,sW).delete(i):h(this,sO,sD).call(this,t,e,!1).then(n=>{n.getRawString()&&(nF.set({tokenId:i,tokenResolver:Promise.resolve(n),onRefresh:()=>h(this,sN,sB).call(this,t,e,i,r)}),h(this,sR,sL).call(this,n,r))}).catch(t=>{iE.warn("Background token refresh failed",{error:t,tokenId:i},"session")}).finally(()=>{r1(sz,sz,sW).delete(i)})}class sJ extends rP{static retrieve(){var t;let e=null==(t=rP.clerk.session)?void 0:t.id;return this.clerk.getFapiClient().request({method:"GET",path:"/me/sessions/active",sessionId:e}).then(t=>t.payload.map(t=>new sJ(t,"/me/sessions"))).catch(()=>[])}revoke(){return this._basePost({action:"revoke",body:{}})}fromJSON(t){var e;let i;return t?(this.id=t.id,this.status=t.status,this.expireAt=rT(t.expire_at),this.abandonAt=rT(t.abandon_at),this.lastActiveAt=rT(t.last_active_at||void 0),this.latestActivity={id:(i=null!=(e=t.latest_activity)?e:{}).id,deviceType:i.device_type,browserName:i.browser_name,browserVersion:i.browser_version,country:i.country,city:i.city,isMobile:i.is_mobile,ipAddress:i.ip_address},this.actor=t.actor,this):this}constructor(t,e){super(),(0,td._)(this,"pathRoot",""),(0,td._)(this,"id",void 0),(0,td._)(this,"status",void 0),(0,td._)(this,"abandonAt",void 0),(0,td._)(this,"expireAt",void 0),(0,td._)(this,"lastActiveAt",void 0),(0,td._)(this,"latestActivity",void 0),(0,td._)(this,"actor",void 0),this.pathRoot=e,this.fromJSON(t)}}s(4813),s(9536);let sV=(t,e,i)=>{let{onValidation:r=nC.t,onValidationComplexity:n=nC.t}=i||{},{show_zxcvbn:s,validatePassword:a}=e,o=t=>((t,e)=>{let{max_length:i,min_length:r,require_special_char:n,require_lowercase:s,require_numbers:a,require_uppercase:o}=e,l=(t=>{let e;if(t.allowed_special_characters){let i=t.allowed_special_characters.replace("[","\\[");i=i.replace("]","\\]"),e=new RegExp("[".concat(i,"]"))}else e=/[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/;return(t,i)=>{let{minLength:r,maxLength:n}=i;return{max_length:t.length<n,min_length:t.length>=r,require_numbers:/\d/.test(t),require_lowercase:/[a-z]/.test(t),require_uppercase:/[A-Z]/.test(t),require_special_char:e.test(t)}}})(e)(t,{maxLength:e.max_length,minLength:e.min_length}),c={max_length:i,min_length:r,require_special_char:n,require_lowercase:s,require_numbers:a,require_uppercase:o},u=new Map;for(let t in c)c[t]&&!l[t]&&u.set(t,!0);return Object.freeze(Object.fromEntries(u))})(t,e),l=(t=>{let{min_zxcvbn_strength:e,onResult:i}=t;return t=>r=>{let n=t(r);return(null==i||i(n),n.score>=e&&n.score<3)?{state:"pass",keys:["unstable__errors.zxcvbn.couldBeStronger"],result:n}:n.score>=e?{state:"excellent",result:n}:{state:"fail",keys:["unstable__errors.zxcvbn.notEnough",...n.feedback.suggestions.map(t=>"unstable__errors.zxcvbn.suggestions.".concat(t))],result:n}}})(e),c={};return(e,i)=>{let{onValidation:u=r,onValidationComplexity:h=n}=i||{};if(!a)return;let d=o(e);h(0===Object.keys(d).length),c={...c,complexity:d},s&&t().then(t=>{let i=l(t)(e);u({...c={...c,strength:i},strength:i})}),c.complexity&&0===Object.keys(c.complexity).length&&s||u(c)}};function sK(t){return t?"https://".concat(t.replace(/clerk\.accountsstage\./,"accountsstage.").replace(/clerk\.accounts\.|clerk\./,"accounts.")):""}async function sq(t,e,i,r,n){if(!t.client||!r.popup)return;let s=sK(t.frontendApi),{redirectUrl:a}=r,o=new URL(a);o.searchParams.set("sign_in_force_redirect_url",r.redirectUrlComplete),o.searchParams.set("sign_up_force_redirect_url",r.redirectUrlComplete),o.searchParams.set("intent",e);let l=t.buildUrlWithAuth(o.toString()),c=t.buildUrlWithAuth("".concat(s,"/popup-callback")),u=t.buildUrlWithAuth("".concat(s,"/popup-callback?return_url=").concat(encodeURIComponent(l))),h=async e=>{if(e.origin!==s)return;let i=!1;if(e.data.session){var n,a;if(!(null==(n=t.client)?void 0:n.sessions.find(t=>t.id===e.data.session)))try{await (null==(a=t.client)?void 0:a.reload())}catch(t){console.error(t)}await t.setActive({session:e.data.session,redirectUrl:r.redirectUrlComplete}),i=!0}else e.data.return_url&&(t.navigate(e.data.return_url),i=!0);i&&window.removeEventListener("message",h)};window.addEventListener("message",h),await i({...r,redirectUrlComplete:c,redirectUrl:u},n)}function sH(t,e){let{redirectCallbackUrl:i,redirectUrl:r}=e,n=sK(t.frontendApi),s=new URL(i);s.searchParams.set("sign_in_force_redirect_url",r),s.searchParams.set("sign_up_force_redirect_url",r);let a=t.buildUrlWithAuth(s.toString()),o=t.buildUrlWithAuth("".concat(n,"/popup-callback"));return{redirectCallbackUrl:t.buildUrlWithAuth("".concat(n,"/popup-callback?return_url=").concat(encodeURIComponent(a))),redirectUrl:o}}function sG(t,e){return new Promise((i,r)=>{if(!t.client||!e.popup)return void r();let n=async e=>{e.origin===sK(t.frontendApi)&&(e.data.session||e.data.return_url?(window.removeEventListener("message",n),i()):r())};window.addEventListener("message",n),e.popup.location.href=e.externalVerificationRedirectURL.toString()})}async function s$(t,e){nx.emit("resource:error",{resource:t,error:null}),nx.emit("resource:fetch",{resource:t,status:"fetching"});try{return{result:await e(),error:null}}catch(e){return nx.emit("resource:error",{resource:t,error:e}),{error:e}}finally{nx.emit("resource:fetch",{resource:t,status:"idle"})}}let sY=()=>{var t;return(t=new iz,{loadZxcvbn:()=>Promise.all([t.import("@zxcvbn-ts/core"),t.import("@zxcvbn-ts/language-common")]).then(t=>{let[e,i]=t;if(!e||!i)throw Error("Failed to load zxcvbn modules");let{zxcvbnOptions:r,zxcvbn:n}=e,{dictionary:s,adjacencyGraphs:a}=i;return r.setOptions({dictionary:{...s},graphs:a}),n})}).loadZxcvbn};class sX extends rP{get status(){return this._status}set status(t){let e=this._status;this._status=t,t&&e!==t&&iE.debug("SignIn.status",{id:this.id,from:e,to:t})}fromJSON(t){if(t){var e;this.id=t.id,this.status=t.status,this.supportedIdentifiers=t.supported_identifiers,this.identifier=t.identifier,this.supportedFirstFactors=eu(t.supported_first_factors),this.supportedSecondFactors=eu(t.supported_second_factors),this.firstFactorVerification=new n2(t.first_factor_verification),this.secondFactorVerification=new n2(t.second_factor_verification),this.createdSessionId=t.created_session_id,this.userData=new aa(t.user_data),this.clientTrustState=null!=(e=t.client_trust_state)?e:void 0}return nx.emit("resource:update",{resource:this}),this}clientBypass(){var t;return null==(t=sX.clerk.client)?void 0:t.captchaBypass}shouldRequireCaptcha(t){return"signUpIfMissing"in t&&!!t.signUpIfMissing}shouldBypassCaptchaForAttempt(t){var e,i,r,n;let s=sX.clerk.__internal_environment.displayConfig.captchaOauthBypass;if(t.transfer&&(null==(n=sX.clerk.client)||null==(r=n.signUp)||null==(i=r.verifications)||null==(e=i.externalAccount)?void 0:e.status)==="transferable"){let t=sX.clerk.client.signUp.verifications.externalAccount.strategy;return!!t&&s.some(e=>e===t)}return"strategy"in t&&!!t.strategy&&s.some(e=>e===t.strategy)}__internal_updateFromJSON(t){return this.fromJSON(t)}__internal_toSnapshot(){return{object:"sign_in",id:this.id||"",status:this.status||null,supported_identifiers:this.supportedIdentifiers,supported_first_factors:ec(this.supportedFirstFactors),supported_second_factors:ec(this.supportedSecondFactors),first_factor_verification:this.firstFactorVerification.__internal_toSnapshot(),second_factor_verification:this.secondFactorVerification.__internal_toSnapshot(),identifier:this.identifier,created_session_id:this.createdSessionId,user_data:this.userData.__internal_toSnapshot()}}constructor(t=null){super(),(0,td._)(this,"pathRoot","/client/sign_ins"),(0,td._)(this,"id",void 0),(0,td._)(this,"_status",null),(0,td._)(this,"supportedIdentifiers",[]),(0,td._)(this,"supportedFirstFactors",[]),(0,td._)(this,"supportedSecondFactors",null),(0,td._)(this,"firstFactorVerification",new n2(null)),(0,td._)(this,"secondFactorVerification",new n2(null)),(0,td._)(this,"identifier",null),(0,td._)(this,"createdSessionId",null),(0,td._)(this,"userData",new aa(null)),(0,td._)(this,"clientTrustState",void 0),(0,td._)(this,"__internal_future",new s0(this)),(0,td._)(this,"__internal_basePost",this._basePost.bind(this)),(0,td._)(this,"__internal_baseGet",this._baseGet.bind(this)),(0,td._)(this,"create",async t=>{iE.debug("SignIn.create",{id:this.id,strategy:"strategy"in t?t.strategy:void 0});let e={...t},i=iK();if(i&&(e.locale=i),this.shouldRequireCaptcha(t)&&!this.clientBypass()&&!this.shouldBypassCaptchaForAttempt(t)){let t=new rC(sX.clerk),i=await t.managedOrInvisible({action:"signin"});if(!i)throw new tU("",{code:"captcha_unavailable"});e={...e,...i}}return this._basePost({path:this.pathRoot,body:e})}),(0,td._)(this,"resetPassword",t=>this._basePost({body:t,action:"reset_password"})),(0,td._)(this,"prepareFirstFactor",t=>{let e;switch(iE.debug("SignIn.prepareFirstFactor",{id:this.id,strategy:t.strategy}),t.strategy){case"passkey":e={};break;case"email_link":e={emailAddressId:t.emailAddressId,redirectUrl:t.redirectUrl};break;case"email_code":case"reset_password_email_code":e={emailAddressId:t.emailAddressId};break;case"phone_code":e={phoneNumberId:t.phoneNumberId,default:t.default,channel:t.channel};break;case"web3_metamask_signature":case"web3_base_signature":case"web3_coinbase_wallet_signature":case"web3_okx_wallet_signature":case"web3_solana_signature":e={web3WalletId:t.web3WalletId};break;case"reset_password_phone_code":e={phoneNumberId:t.phoneNumberId};break;case"enterprise_sso":e={redirectUrl:t.redirectUrl,actionCompleteRedirectUrl:t.actionCompleteRedirectUrl,oidcPrompt:t.oidcPrompt,enterpriseConnectionId:t.enterpriseConnectionId};break;default:iZ("SignIn.prepareFirstFactor",t.strategy)}return this._basePost({body:{...e,strategy:t.strategy},action:"prepare_first_factor"})}),(0,td._)(this,"attemptFirstFactor",t=>{let e;return iE.debug("SignIn.attemptFirstFactor",{id:this.id,strategy:t.strategy}),e="passkey"===t.strategy?{publicKeyCredential:JSON.stringify(nZ(t.publicKeyCredential))}:{...t},this._basePost({body:{...e,strategy:t.strategy},action:"attempt_first_factor"})}),(0,td._)(this,"createEmailLinkFlow",()=>{let{run:t,stop:e}=nV();return{startEmailLinkFlow:async i=>{let{emailAddressId:r,redirectUrl:n}=i;this.id||iQ("SignIn");let s={strategy:"email_link",emailAddressId:r,redirectUrl:n},a="needs_second_factor"===this.status||"needs_client_trust"===this.status,o=a?"secondFactorVerification":"firstFactorVerification";return a?await this.prepareSecondFactor(s):await this.prepareFirstFactor(s),new Promise((i,r)=>{t(()=>this.reload().then(t=>{let r=t[o].status;("verified"===r||"expired"===r)&&(e(),i(t))}).catch(t=>{e(),r(t)}))})},cancelEmailLinkFlow:e}}),(0,td._)(this,"prepareSecondFactor",t=>(iE.debug("SignIn.prepareSecondFactor",{id:this.id,strategy:t.strategy}),this._basePost({body:t,action:"prepare_second_factor"}))),(0,td._)(this,"attemptSecondFactor",t=>(iE.debug("SignIn.attemptSecondFactor",{id:this.id,strategy:t.strategy}),this._basePost({body:t,action:"attempt_second_factor"}))),(0,td._)(this,"authenticateWithRedirectOrPopup",async(t,e)=>{let{strategy:i,redirectUrlComplete:r,identifier:n,oidcPrompt:s,continueSignIn:a,enterpriseConnectionId:o}=t||{},l=sX.clerk.buildUrlWithAuth(t.redirectUrl);this.id&&a||await this.create({strategy:i,identifier:n,redirectUrl:l,actionCompleteRedirectUrl:r}),"enterprise_sso"===i&&await this.prepareFirstFactor({strategy:i,redirectUrl:l,actionCompleteRedirectUrl:r,oidcPrompt:s,enterpriseConnectionId:o});let{status:c,externalVerificationRedirectURL:u}=this.firstFactorVerification;"unverified"===c&&u?e(u):i2(c,sX.fapiClient.buildEmailAddress("support"))}),(0,td._)(this,"authenticateWithRedirect",async t=>this.authenticateWithRedirectOrPopup(t,eQ)),(0,td._)(this,"authenticateWithPopup",async t=>{let{popup:e}=t||{};return e||i1("popup"),sq(sX.clerk,"signIn",this.authenticateWithRedirectOrPopup,t,t=>{e.location.href=t.toString()})}),(0,td._)(this,"authenticateWithWeb3",async t=>{var e;let i,{identifier:r,generateSignature:n,strategy:s="web3_metamask_signature",walletName:a}=t||{},o=s.replace("web3_","").replace("_signature","");"function"!=typeof n&&i1("generateSignature"),"solana"!==o||a||i1("walletName"),await this.create({identifier:r});let l=null==(e=this.supportedFirstFactors)?void 0:e.find(t=>t.strategy===s);l||i0("SignIn"),await this.prepareFirstFactor(l);let{message:c}=this.firstFactorVerification;c||i0("SignIn");try{i=await n({identifier:r,nonce:c,walletName:a,provider:o})}catch(t){if("coinbase_wallet"===o&&4001===t.code)i=await n({identifier:r,nonce:c,provider:o,walletName:a});else throw t}return this.attemptFirstFactor({signature:i,strategy:s})}),(0,td._)(this,"authenticateWithMetamask",async()=>{let t=await rv().getMetamaskIdentifier();return this.authenticateWithWeb3({identifier:t,generateSignature:rv().generateSignatureWithMetamask,strategy:"web3_metamask_signature"})}),(0,td._)(this,"authenticateWithCoinbaseWallet",async()=>{let t=await rv().getCoinbaseWalletIdentifier();return this.authenticateWithWeb3({identifier:t,generateSignature:rv().generateSignatureWithCoinbaseWallet,strategy:"web3_coinbase_wallet_signature"})}),(0,td._)(this,"authenticateWithBase",async()=>{let t=await rv().getBaseIdentifier();return this.authenticateWithWeb3({identifier:t,generateSignature:rv().generateSignatureWithBase,strategy:"web3_base_signature"})}),(0,td._)(this,"authenticateWithOKXWallet",async()=>{let t=await rv().getOKXWalletIdentifier();return this.authenticateWithWeb3({identifier:t,generateSignature:rv().generateSignatureWithOKXWallet,strategy:"web3_okx_wallet_signature"})}),(0,td._)(this,"authenticateWithSolana",async t=>{let{walletName:e}=t,i=await rv().getSolanaIdentifier(e);return this.authenticateWithWeb3({identifier:i,generateSignature:t=>rv().generateSignatureWithSolana({...t,walletName:e}),strategy:"web3_solana_signature",walletName:e})}),(0,td._)(this,"authenticateWithPasskey",async t=>{let{flow:e}=t||{},i=sX.clerk.__internal_isWebAuthnSupported||sf,r=sX.clerk.__internal_getPublicCredentials||n$,n=sX.clerk.__internal_isWebAuthnAutofillSupported||s_;if(!i())throw new tW("Passkeys are not supported",{code:"passkey_not_supported"});if("autofill"===e||"discoverable"===e)await this.create({strategy:"passkey"});else{let t=this.supportedFirstFactors.find(t=>"passkey"===t.strategy);t||function(){throw Error("".concat(i$," You need to start a SignIn flow by calling SignIn.create({ strategy: 'passkey' }) first"))}(),await this.prepareFirstFactor(t)}let{nonce:s}=this.firstFactorVerification,a=s?nX(JSON.parse(s)):null;a||i8("get");let o=!1;"autofill"===e&&(o=await n());let{publicKeyCredential:l,error:c}=await r({publicKeyOptions:a,conditionalUI:o});if(!l)throw c;return this.attemptFirstFactor({publicKeyCredential:l,strategy:"passkey"})}),(0,td._)(this,"validatePassword",(t,e)=>{var i,r;if(null==(i=sX.clerk.__internal_environment)?void 0:i.userSettings.passwordSettings)return sV(sY(),{...null==(r=sX.clerk.__internal_environment)?void 0:r.userSettings.passwordSettings,validatePassword:!0})(t,e)}),this.fromJSON(t)}}var sQ=new WeakMap,sZ=new WeakMap;class s0{get id(){return o(this,sZ).id}get identifier(){return o(this,sZ).identifier}get createdSessionId(){return o(this,sZ).createdSessionId}get userData(){return o(this,sZ).userData}get status(){return o(this,sZ).status||"needs_identifier"}get supportedFirstFactors(){var t;return null!=(t=o(this,sZ).supportedFirstFactors)?t:[]}get supportedSecondFactors(){var t;return null!=(t=o(this,sZ).supportedSecondFactors)?t:[]}get isTransferable(){return"transferable"===o(this,sZ).firstFactorVerification.status}get existingSession(){var t,e,i,r,n;if("failed"===o(this,sZ).firstFactorVerification.status&&(null==(t=o(this,sZ).firstFactorVerification.error)?void 0:t.code)==="identifier_already_signed_in"&&(null==(i=o(this,sZ).firstFactorVerification.error)||null==(e=i.meta)?void 0:e.sessionId))return{sessionId:null==(n=o(this,sZ).firstFactorVerification.error)||null==(r=n.meta)?void 0:r.sessionId}}get firstFactorVerification(){return o(this,sZ).firstFactorVerification}get secondFactorVerification(){return o(this,sZ).secondFactorVerification}get canBeDiscarded(){return o(this,sQ)}async sendResetPasswordEmailCode(){if(!o(this,sZ).id)throw Error("Cannot reset password without a sign in.");return s$(o(this,sZ),async()=>{var t;let e=null==(t=o(this,sZ).supportedFirstFactors)?void 0:t.find(t=>"reset_password_email_code"===t.strategy);if(!e)throw new tU("Reset password email code factor not found",{code:"factor_not_found"});let{emailAddressId:i}=e;await o(this,sZ).__internal_basePost({body:{emailAddressId:i,strategy:"reset_password_email_code"},action:"prepare_first_factor"})})}async verifyResetPasswordEmailCode(t){let{code:e}=t;return s$(o(this,sZ),async()=>{await o(this,sZ).__internal_basePost({body:{code:e,strategy:"reset_password_email_code"},action:"attempt_first_factor"})})}async sendResetPasswordPhoneCode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{phoneNumber:e}=t;if(!o(this,sZ).id&&!e)throw Error("signIn.resetPasswordPhoneCode.sendCode() cannot be called without a phoneNumber if an existing signIn does not exist.");return s$(o(this,sZ),async()=>{var t;e&&await this._create({identifier:e});let i=null==(t=o(this,sZ).supportedFirstFactors)?void 0:t.find(t=>"reset_password_phone_code"===t.strategy);if(!i)throw new tU("Reset password phone code factor not found",{code:"factor_not_found"});let{phoneNumberId:r}=i;await o(this,sZ).__internal_basePost({body:{phoneNumberId:r,strategy:"reset_password_phone_code"},action:"prepare_first_factor"})})}async verifyResetPasswordPhoneCode(t){let{code:e}=t;return s$(o(this,sZ),async()=>{await o(this,sZ).__internal_basePost({body:{code:e,strategy:"reset_password_phone_code"},action:"attempt_first_factor"})})}async submitResetPassword(t){let{password:e,signOutOfOtherSessions:i=!0}=t;return s$(o(this,sZ),async()=>{await o(this,sZ).__internal_basePost({body:{password:e,signOutOfOtherSessions:i},action:"reset_password"})})}shouldRequireCaptcha(t){return!!t.signUpIfMissing}shouldBypassCaptchaForAttempt(t){var e,i,r,n;let s=sX.clerk.__internal_environment.displayConfig.captchaOauthBypass;if(t.transfer&&(null==(n=sX.clerk.client)||null==(r=n.signUp)||null==(i=r.verifications)||null==(e=i.externalAccount)?void 0:e.status)==="transferable"){let t=sX.clerk.client.signUp.verifications.externalAccount.strategy;return!!t&&s.some(e=>e===t)}return!!t.strategy&&s.some(e=>e===t.strategy)}async getCaptchaToken(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.shouldRequireCaptcha(e)||(null==(t=sX.clerk.client)?void 0:t.captchaBypass)||this.shouldBypassCaptchaForAttempt(e))return{captchaToken:void 0,captchaWidgetType:void 0,captchaError:void 0};let i=new rC(sX.clerk),r=await i.managedOrInvisible({action:"signin"});if(!r)throw Error("Captcha challenge failed");let{captchaError:n,captchaToken:s,captchaWidgetType:a}=r;return{captchaToken:s,captchaWidgetType:a,captchaError:n}}async _create(t){let{captchaToken:e,captchaWidgetType:i,captchaError:r}=await this.getCaptchaToken(t),n={...t,captchaToken:e,captchaWidgetType:i,captchaError:r,locale:iK()||void 0};await o(this,sZ).__internal_basePost({path:o(this,sZ).pathRoot,body:n})}async create(t){return s$(o(this,sZ),async()=>{await this._create(t)})}async password(t){if([t.identifier,t.emailAddress,t.phoneNumber].filter(Boolean).length>1)throw Error("Only one of identifier, emailAddress, or phoneNumber can be provided");return s$(o(this,sZ),async()=>{let e=t.identifier||t.emailAddress||t.phoneNumber,i=o(this,sZ).identifier,r=iK();await o(this,sZ).__internal_basePost({path:o(this,sZ).pathRoot,body:{identifier:e||i,password:t.password,...r?{locale:r}:{}}})})}async sendEmailCode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{emailAddress:e,emailAddressId:i}=t;if(!o(this,sZ).id&&i)throw Error("signIn.emailCode.sendCode() cannot be called with an emailAddressId if an existing signIn does not exist.");if(!o(this,sZ).id&&!e)throw Error("signIn.emailCode.sendCode() cannot be called without an emailAddress if an existing signIn does not exist.");return s$(o(this,sZ),async()=>{e&&await this._create({identifier:e});let t=this.selectFirstFactor({strategy:"email_code",emailAddressId:i});if(!t)throw new tU("Email code factor not found",{code:"factor_not_found"});await o(this,sZ).__internal_basePost({body:{emailAddressId:t.emailAddressId,strategy:"email_code"},action:"prepare_first_factor"})})}async verifyEmailCode(t){let{code:e}=t;return s$(o(this,sZ),async()=>{await o(this,sZ).__internal_basePost({body:{code:e,strategy:"email_code"},action:"attempt_first_factor"})})}async sendEmailLink(t){let{emailAddress:e,verificationUrl:i,emailAddressId:r}=t;if(!o(this,sZ).id&&r)throw Error("signIn.emailLink.sendLink() cannot be called with an emailAddressId if an existing signIn does not exist.");if(!o(this,sZ).id&&!e)throw Error("signIn.emailLink.sendLink() cannot be called without an emailAddress if an existing signIn does not exist.");return s$(o(this,sZ),async()=>{e&&await this._create({identifier:e});let t=this.selectFirstFactor({strategy:"email_link",emailAddressId:r});if(!t)throw new tU("Email link factor not found",{code:"factor_not_found"});let n=i;try{new URL(i)}catch{n=window.location.origin+i}await o(this,sZ).__internal_basePost({body:{emailAddressId:t.emailAddressId,redirectUrl:n,strategy:"email_link"},action:"prepare_first_factor"})})}async waitForEmailLinkVerification(){return s$(o(this,sZ),async()=>{let{run:t,stop:e}=nV();await new Promise((i,r)=>{t(async()=>{try{let t=await o(this,sZ).__internal_baseGet(),r=t.firstFactorVerification.status;("verified"===r||"expired"===r)&&(e(),i(t))}catch(t){e(),r(t)}})})})}async sendPhoneCode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{phoneNumber:e,phoneNumberId:i,channel:r="sms"}=t;if(!o(this,sZ).id&&i)throw Error("signIn.phoneCode.sendCode() cannot be called with an phoneNumberId if an existing signIn does not exist.");if(!o(this,sZ).id&&!e)throw Error("signIn.phoneCode.sendCode() cannot be called without an phoneNumber if an existing signIn does not exist.");return s$(o(this,sZ),async()=>{e&&await this._create({identifier:e});let t=this.selectFirstFactor({strategy:"phone_code",phoneNumberId:i});if(!t)throw new tU("Phone code factor not found",{code:"factor_not_found"});await o(this,sZ).__internal_basePost({body:{phoneNumberId:t.phoneNumberId,strategy:"phone_code",channel:r},action:"prepare_first_factor"})})}async verifyPhoneCode(t){let{code:e}=t;return s$(o(this,sZ),async()=>{await o(this,sZ).__internal_basePost({body:{code:e,strategy:"phone_code"},action:"attempt_first_factor"})})}async sso(t){let{strategy:e,redirectUrl:i,redirectCallbackUrl:r,popup:n,oidcPrompt:s,enterpriseConnectionId:a,identifier:l}=t;return s$(o(this,sZ),async()=>{let t=i;try{new URL(i)}catch{t=window.location.origin+i}let c={redirectUrl:sX.clerk.buildUrlWithAuth(r),actionCompleteRedirectUrl:t};if(n){let e=sH(sX.clerk,{redirectCallbackUrl:c.redirectUrl,redirectUrl:t});c.redirectUrl=e.redirectCallbackUrl,c.actionCompleteRedirectUrl=e.redirectUrl}o(this,sZ).id||await this._create({strategy:e,...c,identifier:l}),"enterprise_sso"===e&&await o(this,sZ).__internal_basePost({body:{...c,oidcPrompt:s,enterpriseConnectionId:a,strategy:"enterprise_sso"},action:"prepare_first_factor"});let{status:u,externalVerificationRedirectURL:h}=o(this,sZ).firstFactorVerification;"unverified"===u&&h&&(n?(await sG(sX.clerk,{popup:n,externalVerificationRedirectURL:h}),await o(this,sZ).reload()):eQ(h))})}async web3(t){let{strategy:e}=t,i=e.replace("web3_","").replace("_signature","");return s$(o(this,sZ),async()=>{var r;let n,s,a;switch(i){case"metamask":n=await rv().getMetamaskIdentifier(),s=rv().generateSignatureWithMetamask;break;case"coinbase_wallet":n=await rv().getCoinbaseWalletIdentifier(),s=rv().generateSignatureWithCoinbaseWallet;break;case"base":n=await rv().getBaseIdentifier(),s=rv().generateSignatureWithBase;break;case"okx_wallet":n=await rv().getOKXWalletIdentifier(),s=rv().generateSignatureWithOKXWallet;break;case"solana":if(!t.walletName)throw new tU("Wallet name is required for Solana authentication.",{code:"web3_solana_wallet_name_required"});n=await rv().getSolanaIdentifier(t.walletName),s=e=>rv().generateSignatureWithSolana({...e,walletName:t.walletName});break;default:throw Error("Unsupported Web3 provider: ".concat(i))}await this._create({identifier:n});let l=null==(r=o(this,sZ).supportedFirstFactors)?void 0:r.find(t=>t.strategy===e);if(!l)throw new tU("Web3 first factor not found",{code:"factor_not_found"});await o(this,sZ).__internal_basePost({body:{web3WalletId:l.web3WalletId,strategy:e},action:"prepare_first_factor"});let{message:c}=this.firstFactorVerification;if(!c)throw new tU("Web3 nonce not found",{code:"web3_nonce_not_found"});try{a=await s({identifier:n,nonce:c,walletName:null==t?void 0:t.walletName,provider:i})}catch(t){if("coinbase_wallet"===i&&4001===t.code)a=await s({identifier:n,nonce:c,provider:i});else throw t}await o(this,sZ).__internal_basePost({body:{signature:a,strategy:e},action:"attempt_first_factor"})})}async passkey(t){let{flow:e}=t||{},i=sX.clerk.__internal_isWebAuthnSupported||sf,r=sX.clerk.__internal_getPublicCredentials||n$,n=sX.clerk.__internal_isWebAuthnAutofillSupported||s_;if(!i())throw new tW("Passkeys are not supported",{code:"passkey_not_supported"});return s$(o(this,sZ),async()=>{if("autofill"===e||"discoverable"===e)await this._create({strategy:"passkey"});else{if(!this.supportedFirstFactors.find(t=>"passkey"===t.strategy))throw new tU("Passkey factor not found",{code:"factor_not_found"});await o(this,sZ).__internal_basePost({body:{strategy:"passkey"},action:"prepare_first_factor"})}let{nonce:t}=this.firstFactorVerification,i=t?nX(JSON.parse(t)):null;if(!i)throw new tU("Missing public key options",{code:"missing_public_key_options"});let s=!1;"autofill"===e&&(s=await n());let{publicKeyCredential:a,error:l}=await r({publicKeyOptions:i,conditionalUI:s});if(!a)throw new tW(l.message,{code:"passkey_retrieval_failed"});await o(this,sZ).__internal_basePost({body:{publicKeyCredential:JSON.stringify(nZ(a)),strategy:"passkey"},action:"attempt_first_factor"})})}async sendMFAPhoneCode(){return s$(o(this,sZ),async()=>{var t;let e=null==(t=o(this,sZ).supportedSecondFactors)?void 0:t.find(t=>"phone_code"===t.strategy);if(!e)throw new tU("Phone code factor not found",{code:"factor_not_found"});let{phoneNumberId:i}=e;await o(this,sZ).__internal_basePost({body:{phoneNumberId:i,strategy:"phone_code"},action:"prepare_second_factor"})})}async verifyMFAPhoneCode(t){let{code:e}=t;return s$(o(this,sZ),async()=>{await o(this,sZ).__internal_basePost({body:{code:e,strategy:"phone_code"},action:"attempt_second_factor"})})}async sendMFAEmailCode(){return s$(o(this,sZ),async()=>{var t;let e=null==(t=o(this,sZ).supportedSecondFactors)?void 0:t.find(t=>"email_code"===t.strategy);if(!e)throw new tU("Email code factor not found",{code:"factor_not_found"});let{emailAddressId:i}=e;await o(this,sZ).__internal_basePost({body:{emailAddressId:i,strategy:"email_code"},action:"prepare_second_factor"})})}async verifyMFAEmailCode(t){let{code:e}=t;return s$(o(this,sZ),async()=>{await o(this,sZ).__internal_basePost({body:{code:e,strategy:"email_code"},action:"attempt_second_factor"})})}async verifyTOTP(t){let{code:e}=t;return s$(o(this,sZ),async()=>{await o(this,sZ).__internal_basePost({body:{code:e,strategy:"totp"},action:"attempt_second_factor"})})}async verifyBackupCode(t){let{code:e}=t;return s$(o(this,sZ),async()=>{await o(this,sZ).__internal_basePost({body:{code:e,strategy:"backup_code"},action:"attempt_second_factor"})})}async ticket(t){var e;let i=null!=(e=null==t?void 0:t.ticket)?e:ej("__clerk_ticket");return this.create({ticket:null!=i?i:void 0})}async finalize(t){let{navigate:e}=t||{};if(!o(this,sZ).createdSessionId)throw Error("Cannot finalize sign-in without a created session.");return s$(o(this,sZ),async()=>{sX.clerk.client&&!sX.clerk.client.sessions.some(t=>t.id===o(this,sZ).createdSessionId)&&await sX.clerk.client.reload(),u(this,sQ,!0),await sX.clerk.setActive({session:o(this,sZ).createdSessionId,navigate:e})})}reset(){if(!sX.clerk.client)throw Error("Cannot reset sign-in without a client.");return u(this,sQ,!0),sX.clerk.client.resetSignIn(),Promise.resolve({error:null})}selectFirstFactor(t){let{strategy:e,emailAddressId:i,phoneNumberId:r}=t;if(!o(this,sZ).supportedFirstFactors)return null;if(i){let t=o(this,sZ).supportedFirstFactors.find(t=>t.strategy===e&&t.emailAddressId===i);if(t)return t}if(r){let t=o(this,sZ).supportedFirstFactors.find(t=>t.strategy===e&&t.phoneNumberId===r);if(t)return t}let n=o(this,sZ).supportedFirstFactors.find(t=>t.strategy===e&&t.safeIdentifier===o(this,sZ).identifier);if(n)return n;let s=o(this,sZ).supportedFirstFactors.find(t=>t.strategy===e);return s||null}constructor(t){(0,td._)(this,"emailCode",{sendCode:this.sendEmailCode.bind(this),verifyCode:this.verifyEmailCode.bind(this)}),(0,td._)(this,"emailLink",{sendLink:this.sendEmailLink.bind(this),waitForVerification:this.waitForEmailLinkVerification.bind(this),get verification(){if(!tp())return null;const t=ej("__clerk_status"),e=ej("__clerk_created_session");if(!t||!e)return null;const i="verified"===t&&void 0!==sX.clerk.client&&sX.clerk.client.sessions.some(t=>t.id===e);return{status:t,createdSessionId:e,verifiedFromTheSameClient:i}}}),(0,td._)(this,"resetPasswordEmailCode",{sendCode:this.sendResetPasswordEmailCode.bind(this),verifyCode:this.verifyResetPasswordEmailCode.bind(this),submitPassword:this.submitResetPassword.bind(this)}),(0,td._)(this,"resetPasswordPhoneCode",{sendCode:this.sendResetPasswordPhoneCode.bind(this),verifyCode:this.verifyResetPasswordPhoneCode.bind(this),submitPassword:this.submitResetPassword.bind(this)}),(0,td._)(this,"phoneCode",{sendCode:this.sendPhoneCode.bind(this),verifyCode:this.verifyPhoneCode.bind(this)}),(0,td._)(this,"mfa",{sendPhoneCode:this.sendMFAPhoneCode.bind(this),verifyPhoneCode:this.verifyMFAPhoneCode.bind(this),sendEmailCode:this.sendMFAEmailCode.bind(this),verifyEmailCode:this.verifyMFAEmailCode.bind(this),verifyTOTP:this.verifyTOTP.bind(this),verifyBackupCode:this.verifyBackupCode.bind(this)}),c(this,sQ,{writable:!0,value:!1}),c(this,sZ,{writable:!0,value:void 0}),u(this,sZ,t)}}function s1(t){let{unsafeMetadata:e}={...t},i=e?"object"==typeof e?JSON.stringify(e):e:"";return{...t,...e?{unsafeMetadata:i}:{}}}class s2 extends rP{get status(){return this._status}set status(t){let e=this._status;this._status=t,t&&e!==t&&iE.debug("SignUp.status",{id:this.id,from:e,to:t})}fromJSON(t){return t&&(this.id=t.id,this.status=t.status,this.requiredFields=t.required_fields,this.optionalFields=t.optional_fields,this.missingFields=t.missing_fields,this.unverifiedFields=t.unverified_fields,this.verifications=new n3(t.verifications),this.username=t.username,this.firstName=t.first_name,this.lastName=t.last_name,this.emailAddress=t.email_address,this.phoneNumber=t.phone_number,this.hasPassword=t.has_password,this.unsafeMetadata=t.unsafe_metadata,this.createdSessionId=t.created_session_id,this.createdUserId=t.created_user_id,this.abandonAt=t.abandon_at,this.web3wallet=t.web3_wallet,this.legalAcceptedAt=t.legal_accepted_at,this.locale=t.locale),nx.emit("resource:update",{resource:this}),this}__internal_updateFromJSON(t){return this.fromJSON(t)}__internal_toSnapshot(){var t;return{object:"sign_up",id:this.id||"",status:this.status||null,required_fields:this.requiredFields,optional_fields:this.optionalFields,missing_fields:this.missingFields,unverified_fields:this.unverifiedFields,verifications:this.verifications.__internal_toSnapshot(),username:this.username,first_name:this.firstName,last_name:this.lastName,email_address:this.emailAddress,phone_number:this.phoneNumber,has_password:this.hasPassword,unsafe_metadata:this.unsafeMetadata,created_session_id:this.createdSessionId,created_user_id:this.createdUserId,abandon_at:this.abandonAt,web3_wallet:this.web3wallet,legal_accepted_at:this.legalAcceptedAt,locale:this.locale,external_account:this.externalAccount,external_account_strategy:null==(t=this.externalAccount)?void 0:t.strategy}}clientBypass(){var t;return null==(t=s2.clerk.client)?void 0:t.captchaBypass}shouldBypassCaptchaForAttempt(t){let e=s2.clerk.__internal_environment.displayConfig.captchaOauthBypass;if(t.transfer){let t=s2.clerk.client.signIn.firstFactorVerification.strategy;if(e.some(e=>e===t)||s3(t))return!0}return!!(t.strategy&&e.some(e=>e===t.strategy))}constructor(t=null){super(),(0,td._)(this,"pathRoot","/client/sign_ups"),(0,td._)(this,"id",void 0),(0,td._)(this,"_status",null),(0,td._)(this,"requiredFields",[]),(0,td._)(this,"missingFields",[]),(0,td._)(this,"optionalFields",[]),(0,td._)(this,"unverifiedFields",[]),(0,td._)(this,"verifications",new n3(null)),(0,td._)(this,"username",null),(0,td._)(this,"firstName",null),(0,td._)(this,"lastName",null),(0,td._)(this,"emailAddress",null),(0,td._)(this,"phoneNumber",null),(0,td._)(this,"web3wallet",null),(0,td._)(this,"externalAccount",void 0),(0,td._)(this,"hasPassword",!1),(0,td._)(this,"unsafeMetadata",{}),(0,td._)(this,"createdSessionId",null),(0,td._)(this,"createdUserId",null),(0,td._)(this,"abandonAt",null),(0,td._)(this,"legalAcceptedAt",null),(0,td._)(this,"locale",null),(0,td._)(this,"__internal_future",new s7(this)),(0,td._)(this,"__internal_basePost",this._basePost.bind(this)),(0,td._)(this,"__internal_basePatch",this._basePatch.bind(this)),(0,td._)(this,"create",async t=>{iE.debug("SignUp.create",{id:this.id,strategy:t.strategy});let e={...t};if(!e.locale){let t=iK();t&&(e.locale=t)}if(!this.clientBypass()&&!this.shouldBypassCaptchaForAttempt(t)){let t=new rC(s2.clerk),i=await t.managedOrInvisible({action:"signup"});if(!i)throw new tU("",{code:"captcha_unavailable"});e={...e,...i}}return this._basePost({path:this.pathRoot,body:s1(e)})}),(0,td._)(this,"prepareVerification",t=>(iE.debug("SignUp.prepareVerification",{id:this.id,strategy:t.strategy}),this._basePost({body:t,action:"prepare_verification"}))),(0,td._)(this,"attemptVerification",t=>(iE.debug("SignUp.attemptVerification",{id:this.id,strategy:t.strategy}),this._basePost({body:t,action:"attempt_verification"}))),(0,td._)(this,"prepareEmailAddressVerification",t=>this.prepareVerification(t||{strategy:"email_code"})),(0,td._)(this,"attemptEmailAddressVerification",t=>this.attemptVerification({...t,strategy:"email_code"})),(0,td._)(this,"createEmailLinkFlow",()=>{let{run:t,stop:e}=nV();return{startEmailLinkFlow:async i=>{let{redirectUrl:r}=i;return this.id||iQ("SignUp"),await this.prepareEmailAddressVerification({strategy:"email_link",redirectUrl:r}),new Promise((i,r)=>{t(()=>this.reload().then(t=>{let r=t.verifications.emailAddress.status;("verified"===r||"expired"===r)&&(e(),i(t))}).catch(t=>{e(),r(t)}))})},cancelEmailLinkFlow:e}}),(0,td._)(this,"preparePhoneNumberVerification",t=>this.prepareVerification(t||{strategy:"phone_code"})),(0,td._)(this,"attemptPhoneNumberVerification",t=>this.attemptVerification({...t,strategy:"phone_code"})),(0,td._)(this,"prepareWeb3WalletVerification",t=>this.prepareVerification({strategy:"web3_metamask_signature",...t})),(0,td._)(this,"attemptWeb3WalletVerification",async t=>{let{signature:e,strategy:i="web3_metamask_signature"}=t;return this.attemptVerification({signature:e,strategy:i})}),(0,td._)(this,"authenticateWithWeb3",async t=>{let e,{generateSignature:i,identifier:r,unsafeMetadata:n,strategy:s="web3_metamask_signature",legalAccepted:a,walletName:o}=t||{},l=s.replace("web3_","").replace("_signature","");"function"!=typeof i&&i1("generateSignature");let c=r||this.web3wallet;await this.create({web3Wallet:c,unsafeMetadata:n,legalAccepted:a}),await this.prepareWeb3WalletVerification({strategy:s});let{message:u}=this.verifications.web3Wallet;u||i0("SignUp");try{e=await i({identifier:r,nonce:u,provider:l,walletName:o})}catch(t){if("coinbase_wallet"===l&&4001===t.code)e=await i({identifier:r,nonce:u,provider:l});else throw t}return this.attemptWeb3WalletVerification({signature:e,strategy:s})}),(0,td._)(this,"authenticateWithMetamask",async t=>{let e=await rv().getMetamaskIdentifier();return this.authenticateWithWeb3({identifier:e,generateSignature:rv().generateSignatureWithMetamask,unsafeMetadata:null==t?void 0:t.unsafeMetadata,strategy:"web3_metamask_signature",legalAccepted:null==t?void 0:t.legalAccepted})}),(0,td._)(this,"authenticateWithCoinbaseWallet",async t=>{let e=await rv().getCoinbaseWalletIdentifier();return this.authenticateWithWeb3({identifier:e,generateSignature:rv().generateSignatureWithCoinbaseWallet,unsafeMetadata:null==t?void 0:t.unsafeMetadata,strategy:"web3_coinbase_wallet_signature",legalAccepted:null==t?void 0:t.legalAccepted})}),(0,td._)(this,"authenticateWithBase",async t=>{let e=await rv().getBaseIdentifier();return this.authenticateWithWeb3({identifier:e,generateSignature:rv().generateSignatureWithBase,unsafeMetadata:null==t?void 0:t.unsafeMetadata,strategy:"web3_base_signature",legalAccepted:null==t?void 0:t.legalAccepted})}),(0,td._)(this,"authenticateWithOKXWallet",async t=>{let e=await rv().getOKXWalletIdentifier();return this.authenticateWithWeb3({identifier:e,generateSignature:rv().generateSignatureWithOKXWallet,unsafeMetadata:null==t?void 0:t.unsafeMetadata,strategy:"web3_okx_wallet_signature",legalAccepted:null==t?void 0:t.legalAccepted})}),(0,td._)(this,"authenticateWithSolana",async t=>{let{walletName:e,unsafeMetadata:i,legalAccepted:r}=t,n=await rv().getSolanaIdentifier(e);return this.authenticateWithWeb3({identifier:n,generateSignature:t=>rv().generateSignatureWithSolana({...t,walletName:e}),unsafeMetadata:i,strategy:"web3_solana_signature",legalAccepted:r,walletName:e})}),(0,td._)(this,"authenticateWithRedirectOrPopup",async(t,e)=>{let{redirectUrl:i,redirectUrlComplete:r,strategy:n,continueSignUp:s=!1,unsafeMetadata:a,emailAddress:o,legalAccepted:l,oidcPrompt:c,enterpriseConnectionId:u}=t,h=s2.clerk.buildUrlWithAuth(i),d=()=>{let t={strategy:n,redirectUrl:h,actionCompleteRedirectUrl:r,unsafeMetadata:a,emailAddress:o,legalAccepted:l,oidcPrompt:c,enterpriseConnectionId:u};return s&&this.id?this.update(t):this.create(t)},{verifications:p}=await d().catch(async t=>{if(tT(t)&&tF(t))return await s2.clerk.__internal_environment.reload(),d();throw t}),{externalAccount:f}=p,{status:_,externalVerificationRedirectURL:g}=f;"unverified"===_&&g?e(g):i2(_,s2.fapiClient.buildEmailAddress("support"))}),(0,td._)(this,"authenticateWithRedirect",async t=>this.authenticateWithRedirectOrPopup(t,eQ)),(0,td._)(this,"authenticateWithPopup",async t=>{let{popup:e}=t||{};return e||i1("popup"),sq(s2.clerk,"signUp",this.authenticateWithRedirectOrPopup,t,t=>{e.location.href=t instanceof URL?t.toString():t})}),(0,td._)(this,"update",t=>this._basePatch({body:s1(t)})),(0,td._)(this,"upsert",t=>this.id?this.update(t):this.create(t)),(0,td._)(this,"validatePassword",(t,e)=>{var i,r;if(null==(i=s2.clerk.__internal_environment)?void 0:i.userSettings.passwordSettings)return sV(sY(),{...null==(r=s2.clerk.__internal_environment)?void 0:r.userSettings.passwordSettings,validatePassword:!0})(t,e)}),(0,td._)(this,"__experimental_getEnterpriseConnections",()=>rP._fetch({path:"/client/sign_ups/".concat(this.id,"/enterprise_connections"),method:"GET"}).then(t=>(null==t?void 0:t.response).map(t=>new at(t)))),this.fromJSON(t)}}let s8=new Set(["email_link","email_code","phone_code"]);function s3(t){return!!t&&(s8.has(t)||t.startsWith("web3_"))}var s5=new WeakMap;class s6{get emailAddress(){return o(this,s5).verifications.emailAddress}get phoneNumber(){return o(this,s5).verifications.phoneNumber}get web3Wallet(){return o(this,s5).verifications.web3Wallet}get externalAccount(){return o(this,s5).verifications.externalAccount}get emailLinkVerification(){if(!tp())return null;let t=ej("__clerk_status"),e=ej("__clerk_created_session");if(!t||!e)return null;let i="verified"===t&&void 0!==s2.clerk.client&&s2.clerk.client.sessions.some(t=>t.id===e);return{status:t,createdSessionId:e,verifiedFromTheSameClient:i}}constructor(t,e){c(this,s5,{writable:!0,value:void 0}),(0,td._)(this,"sendEmailCode",void 0),(0,td._)(this,"verifyEmailCode",void 0),(0,td._)(this,"sendEmailLink",void 0),(0,td._)(this,"waitForEmailLinkVerification",void 0),(0,td._)(this,"sendPhoneCode",void 0),(0,td._)(this,"verifyPhoneCode",void 0),u(this,s5,t),this.sendEmailCode=e.sendEmailCode,this.verifyEmailCode=e.verifyEmailCode,this.sendEmailLink=e.sendEmailLink,this.waitForEmailLinkVerification=e.waitForEmailLinkVerification,this.sendPhoneCode=e.sendPhoneCode,this.verifyPhoneCode=e.verifyPhoneCode}}var s4=new WeakMap,s9=new WeakMap;class s7{get id(){return o(this,s9).id}get requiredFields(){return o(this,s9).requiredFields}get optionalFields(){return o(this,s9).optionalFields}get missingFields(){return o(this,s9).missingFields}get status(){return o(this,s9).status||"missing_requirements"}get username(){return o(this,s9).username}get firstName(){return o(this,s9).firstName}get lastName(){return o(this,s9).lastName}get emailAddress(){return o(this,s9).emailAddress}get phoneNumber(){return o(this,s9).phoneNumber}get web3Wallet(){return o(this,s9).web3wallet}get hasPassword(){return o(this,s9).hasPassword}get unsafeMetadata(){return o(this,s9).unsafeMetadata}get createdSessionId(){return o(this,s9).createdSessionId}get createdUserId(){return o(this,s9).createdUserId}get abandonAt(){return o(this,s9).abandonAt}get legalAcceptedAt(){return o(this,s9).legalAcceptedAt}get locale(){return o(this,s9).locale}get unverifiedFields(){return o(this,s9).unverifiedFields}get isTransferable(){var t;return"transferable"===o(this,s9).verifications.externalAccount.status&&(null==(t=o(this,s9).verifications.externalAccount.error)?void 0:t.code)==="external_account_exists"}get existingSession(){var t,e,i,r,n;if(("failed"===o(this,s9).verifications.externalAccount.status||"unverified"===o(this,s9).verifications.externalAccount.status)&&(null==(t=o(this,s9).verifications.externalAccount.error)?void 0:t.code)==="identifier_already_signed_in"&&(null==(i=o(this,s9).verifications.externalAccount.error)||null==(e=i.meta)?void 0:e.sessionId))return{sessionId:null==(n=o(this,s9).verifications.externalAccount.error)||null==(r=n.meta)?void 0:r.sessionId}}get canBeDiscarded(){return o(this,s4)}shouldBypassCaptchaForAttempt(t){let e=s2.clerk.__internal_environment.displayConfig.captchaOauthBypass;if(t.transfer){let t=s2.clerk.client.signIn.firstFactorVerification.strategy;if(e.some(e=>e===t)||s3(t))return!0}return!!(t.strategy&&e.some(e=>e===t.strategy))}async getCaptchaToken(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((null==(t=s2.clerk.client)?void 0:t.captchaBypass)||this.shouldBypassCaptchaForAttempt(e))return{captchaToken:void 0,captchaWidgetType:void 0,captchaError:void 0};let i=new rC(s2.clerk),r=await i.managedOrInvisible({action:"signup"});if(!r)throw Error("Captcha challenge failed");let{captchaError:n,captchaToken:s,captchaWidgetType:a}=r;return{captchaToken:s,captchaWidgetType:a,captchaError:n}}async _create(t){var e;let{captchaToken:i,captchaWidgetType:r,captchaError:n}=await this.getCaptchaToken(t),s={transfer:t.transfer,captchaToken:i,captchaWidgetType:r,captchaError:n,...t,unsafeMetadata:t.unsafeMetadata?s1(t.unsafeMetadata):void 0,locale:null!=(e=t.locale)?e:iK()};await o(this,s9).__internal_basePost({path:o(this,s9).pathRoot,body:s})}async create(t){return s$(o(this,s9),async()=>{await this._create(t)})}async update(t){return s$(o(this,s9),async()=>{let e={...t,unsafeMetadata:t.unsafeMetadata?s1(t.unsafeMetadata):void 0};await o(this,s9).__internal_basePatch({path:o(this,s9).pathRoot,body:e})})}async password(t){return s$(o(this,s9),async()=>{let{captchaToken:e,captchaWidgetType:i,captchaError:r}=await this.getCaptchaToken(),n={strategy:"password",captchaToken:e,captchaWidgetType:i,captchaError:r,...t,unsafeMetadata:t.unsafeMetadata?s1(t.unsafeMetadata):void 0};o(this,s9).id?await o(this,s9).__internal_basePatch({body:n}):await o(this,s9).__internal_basePost({path:o(this,s9).pathRoot,body:n})})}async sendEmailCode(){return s$(o(this,s9),async()=>{await o(this,s9).__internal_basePost({body:{strategy:"email_code"},action:"prepare_verification"})})}async verifyEmailCode(t){let{code:e}=t;return s$(o(this,s9),async()=>{await o(this,s9).__internal_basePost({body:{strategy:"email_code",code:e},action:"attempt_verification"})})}async sendPhoneCode(t){let{channel:e="sms"}=t||{};return s$(o(this,s9),async()=>{await o(this,s9).__internal_basePost({body:{strategy:"phone_code",channel:e},action:"prepare_verification"})})}async verifyPhoneCode(t){let{code:e}=t;return s$(o(this,s9),async()=>{await o(this,s9).__internal_basePost({body:{strategy:"phone_code",code:e},action:"attempt_verification"})})}async sendEmailLink(t){let{verificationUrl:e}=t;return s$(o(this,s9),async()=>{let t=e;try{new URL(e)}catch{t=window.location.origin+e}await o(this,s9).__internal_basePost({body:{strategy:"email_link",redirectUrl:t},action:"prepare_verification"})})}async waitForEmailLinkVerification(){return s$(o(this,s9),async()=>{let{run:t,stop:e}=nV();await new Promise((i,r)=>{t(()=>o(this,s9).reload().then(t=>{let r=t.verifications.emailAddress.status;("verified"===r||"expired"===r)&&(e(),i(t))}).catch(t=>{e(),r(t)}))})})}async sso(t){let{strategy:e,redirectUrl:i,redirectCallbackUrl:r,unsafeMetadata:n,legalAccepted:s,oidcPrompt:a,enterpriseConnectionId:l,emailAddress:c,popup:u}=t;return s$(o(this,s9),async()=>{let{captchaToken:t,captchaWidgetType:h,captchaError:d}=await this.getCaptchaToken({strategy:e}),p=i;try{new URL(i)}catch{p=window.location.origin+i}let f={redirectUrl:s2.clerk.buildUrlWithAuth(r),actionCompleteRedirectUrl:p};if(u){let t=sH(s2.clerk,{redirectCallbackUrl:f.redirectUrl,redirectUrl:p});f.redirectUrl=t.redirectCallbackUrl,f.actionCompleteRedirectUrl=t.redirectUrl}let _=()=>{let i={strategy:e,...f,unsafeMetadata:n,legalAccepted:s,oidcPrompt:a,enterpriseConnectionId:l,emailAddress:c,captchaToken:t,captchaWidgetType:h,captchaError:d};return o(this,s9).id?o(this,s9).__internal_basePatch({path:o(this,s9).pathRoot,body:i}):o(this,s9).__internal_basePost({path:o(this,s9).pathRoot,body:i})};await _().catch(async t=>{if(tT(t)&&tF(t))return await s2.clerk.__internal_environment.reload(),_();throw t});let{status:g,externalVerificationRedirectURL:v}=o(this,s9).verifications.externalAccount;"unverified"===g&&v&&(u?(await sG(s2.clerk,{popup:u,externalVerificationRedirectURL:v}),await o(this,s9).reload()):eQ(v))})}async web3(t){let{strategy:e,unsafeMetadata:i,legalAccepted:r}=t,n=e.replace("web3_","").replace("_signature","");return s$(o(this,s9),async()=>{let t,s,a;switch(n){case"metamask":t=await rv().getMetamaskIdentifier(),s=rv().generateSignatureWithMetamask;break;case"coinbase_wallet":t=await rv().getCoinbaseWalletIdentifier(),s=rv().generateSignatureWithCoinbaseWallet;break;case"base":t=await rv().getBaseIdentifier(),s=rv().generateSignatureWithBase;break;case"okx_wallet":t=await rv().getOKXWalletIdentifier(),s=rv().generateSignatureWithOKXWallet;break;default:throw Error("Unsupported Web3 provider: ".concat(n))}let l=t||o(this,s9).web3wallet;await this._create({web3Wallet:l,unsafeMetadata:i,legalAccepted:r}),await o(this,s9).__internal_basePost({body:{strategy:e},action:"prepare_verification"});let{message:c}=o(this,s9).verifications.web3Wallet;c||i0("SignUp");try{a=await s({identifier:t,nonce:c})}catch(e){if("coinbase_wallet"===n&&4001===e.code)a=await s({identifier:t,nonce:c});else throw e}await o(this,s9).__internal_basePost({body:{signature:a,strategy:e},action:"attempt_verification"})})}async ticket(t){var e;let i=null!=(e=null==t?void 0:t.ticket)?e:ej("__clerk_ticket");return this.create({...t,ticket:null!=i?i:void 0})}async finalize(t){let{navigate:e}=t||{};return s$(o(this,s9),async()=>{if(!o(this,s9).createdSessionId)throw Error("Cannot finalize sign-up without a created session.");u(this,s4,!0),await s2.clerk.setActive({session:o(this,s9).createdSessionId,navigate:e})})}reset(){if(!s2.clerk.client)throw Error("Cannot reset sign-up without a client.");return u(this,s4,!0),s2.clerk.client.resetSignUp(),Promise.resolve({error:null})}constructor(t){(0,td._)(this,"verifications",void 0),c(this,s4,{writable:!0,value:!1}),c(this,s9,{writable:!0,value:void 0}),u(this,s9,t),this.verifications=new s6(o(this,s9),{sendEmailCode:this.sendEmailCode.bind(this),verifyEmailCode:this.verifyEmailCode.bind(this),sendEmailLink:this.sendEmailLink.bind(this),waitForEmailLinkVerification:this.waitForEmailLinkVerification.bind(this),sendPhoneCode:this.sendPhoneCode.bind(this),verifyPhoneCode:this.verifyPhoneCode.bind(this)})}}class at extends rP{fromJSON(t){return t&&(this.id=t.id,this.name=t.name),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"name",void 0),this.fromJSON(t)}}class ae extends rP{static async create(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new ae(await rP._fetch({method:"POST",path:t,body:e,search:i}),t)}fromJSON(t){return t&&(this.jwt=iV(t.jwt)),this}__internal_toSnapshot(){return{object:"token",id:this.id||"",jwt:this.getRawString()}}constructor(t,e){super(),(0,td._)(this,"pathRoot","tokens"),(0,td._)(this,"jwt",void 0),(0,td._)(this,"getRawString",()=>{var t;return(null==(t=this.jwt)?void 0:t.claims.__raw)||""}),e&&(this.pathRoot=e),(null==t?void 0:t.jwt)&&(this.jwt=iV(t.jwt))}}class ai extends rP{fromJSON(t){return t&&(this.id=t.id,this.secret=t.secret,this.uri=t.uri,this.verified=t.verified,this.backupCodes=t.backup_codes,this.updatedAt=rT(t.updated_at),this.createdAt=rT(t.created_at)),this}constructor(t){super(),(0,td._)(this,"pathRoot","/me"),(0,td._)(this,"id",""),(0,td._)(this,"secret",void 0),(0,td._)(this,"uri",void 0),(0,td._)(this,"verified",!1),(0,td._)(this,"backupCodes",void 0),(0,td._)(this,"updatedAt",null),(0,td._)(this,"createdAt",null),this.fromJSON(t)}}class ar extends rP{fromJSON(t){return t&&(this.id=t.id,this.codes=t.codes,this.updatedAt=rT(t.updated_at),this.createdAt=rT(t.created_at)),this}constructor(t){super(),(0,td._)(this,"pathRoot","/me"),(0,td._)(this,"id",void 0),(0,td._)(this,"codes",[]),(0,td._)(this,"updatedAt",null),(0,td._)(this,"createdAt",null),this.fromJSON(t)}}class an extends rP{fromJSON(t){if(!t)return this;if(t.advisory){var e;this.advisory=this.withDefault(t.advisory,null!=(e=this.advisory)?e:null)}return t.form&&(this.form.name=this.withDefault(t.form.name,this.form.name),this.form.slug=this.withDefault(t.form.slug,this.form.slug),this.form.logo=this.withDefault(t.form.logo,this.form.logo),this.form.blurHash=this.withDefault(t.form.blur_hash,this.form.blurHash)),this}static async retrieve(){return await rP._fetch({path:"/me/organization_creation_defaults",method:"GET"}).then(t=>new an(null==t?void 0:t.response))}__internal_toSnapshot(){return{advisory:this.advisory?{code:this.advisory.code,meta:this.advisory.meta,severity:this.advisory.severity}:null,form:{name:this.form.name,slug:this.form.slug,logo:this.form.logo,blur_hash:this.form.blurHash}}}constructor(t=null){super(),(0,td._)(this,"advisory",null),(0,td._)(this,"form",{name:"",slug:"",logo:null,blurHash:null}),this.fromJSON(t)}}class as extends rP{static isUserResource(t){return!!t&&t instanceof as}path(){return this.pathRoot}get verifiedExternalAccounts(){return this.externalAccounts.filter(t=>{var e;return(null==(e=t.verification)?void 0:e.status)=="verified"})}get unverifiedExternalAccounts(){return this.externalAccounts.filter(t=>{var e;return(null==(e=t.verification)?void 0:e.status)!="verified"})}get verifiedWeb3Wallets(){return this.web3Wallets.filter(t=>{var e;return(null==(e=t.verification)?void 0:e.status)=="verified"})}get hasVerifiedEmailAddress(){return this.emailAddresses.filter(t=>"verified"===t.verification.status).length>0}get hasVerifiedPhoneNumber(){return this.phoneNumbers.filter(t=>"verified"===t.verification.status).length>0}fromJSON(t){return t&&(this.id=t.id,this.externalId=t.external_id||null,this.firstName=t.first_name||null,this.lastName=t.last_name||null,(this.firstName||this.lastName)&&(this.fullName=(t=>{let{firstName:e,lastName:i,name:r}=t;return r||[e,i].join(" ").trim()||""})({firstName:this.firstName,lastName:this.lastName})),this.imageUrl=t.image_url||"",this.hasImage=t.has_image||!1,this.username=t.username||null,this.passwordEnabled=t.password_enabled||!1,this.emailAddresses=(t.email_addresses||[]).map(t=>new nK(t,this.path()+"/email_addresses")),this.primaryEmailAddressId=t.primary_email_address_id||null,this.primaryEmailAddress=this.emailAddresses.find(t=>{let{id:e}=t;return e===this.primaryEmailAddressId})||null,this.phoneNumbers=(t.phone_numbers||[]).map(t=>new sm(t,this.path()+"/phone_numbers")),this.primaryPhoneNumberId=t.primary_phone_number_id||null,this.primaryPhoneNumber=this.phoneNumbers.find(t=>{let{id:e}=t;return e===this.primaryPhoneNumberId})||null,this.web3Wallets=(t.web3_wallets||[]).map(t=>new au(t,this.path()+"/web3_wallets")),this.primaryWeb3WalletId=t.primary_web3_wallet_id||null,this.primaryWeb3Wallet=this.web3Wallets.find(t=>{let{id:e}=t;return e===this.primaryWeb3WalletId})||null,this.externalAccounts=(t.external_accounts||[]).map(t=>new si(t,this.path()+"/external_accounts")),this.passkeys=(t.passkeys||[]).map(t=>new sv(t)),this.organizationMemberships=(t.organization_memberships||[]).map(t=>new sd(t)),this.enterpriseAccounts=(t.enterprise_accounts||[]).map(t=>new n6(t,this.path()+"/enterprise_accounts")),this.publicMetadata=t.public_metadata||{},this.unsafeMetadata=t.unsafe_metadata||{},this.totpEnabled=t.totp_enabled||!1,this.backupCodeEnabled=t.backup_code_enabled||!1,this.twoFactorEnabled=t.two_factor_enabled||!1,this.createOrganizationEnabled=t.create_organization_enabled||!1,this.createOrganizationsLimit=t.create_organizations_limit||null,this.deleteSelfEnabled=t.delete_self_enabled||!1,t.last_sign_in_at&&(this.lastSignInAt=rT(t.last_sign_in_at)),t.legal_accepted_at&&(this.legalAcceptedAt=rT(t.legal_accepted_at)),this.updatedAt=rT(t.updated_at||void 0),this.createdAt=rT(t.created_at||void 0)),this}__internal_toSnapshot(){var t,e,i,r;return{object:"user",id:this.id,external_id:this.externalId,first_name:this.firstName,last_name:this.lastName,username:this.username,public_metadata:this.publicMetadata,unsafe_metadata:this.unsafeMetadata,image_url:this.imageUrl,has_image:this.hasImage,email_addresses:this.emailAddresses.map(t=>t.__internal_toSnapshot()),phone_numbers:this.phoneNumbers.map(t=>t.__internal_toSnapshot()),web3_wallets:this.web3Wallets.map(t=>t.__internal_toSnapshot()),external_accounts:this.externalAccounts.map(t=>t.__internal_toSnapshot()),passkeys:this.passkeys.map(t=>t.__internal_toSnapshot()),organization_memberships:this.organizationMemberships.map(t=>t.__internal_toSnapshot()),enterprise_accounts:this.enterpriseAccounts.map(t=>t.__internal_toSnapshot()),totp_enabled:this.totpEnabled,backup_code_enabled:this.backupCodeEnabled,two_factor_enabled:this.twoFactorEnabled,create_organization_enabled:this.createOrganizationEnabled,create_organizations_limit:this.createOrganizationsLimit,delete_self_enabled:this.deleteSelfEnabled,primary_email_address_id:this.primaryEmailAddressId,primary_phone_number_id:this.primaryPhoneNumberId,primary_web3_wallet_id:this.primaryWeb3WalletId,password_enabled:this.passwordEnabled,profile_image_id:this.imageUrl,last_sign_in_at:(null==(t=this.lastSignInAt)?void 0:t.getTime())||null,legal_accepted_at:(null==(e=this.legalAcceptedAt)?void 0:e.getTime())||null,updated_at:(null==(i=this.updatedAt)?void 0:i.getTime())||null,created_at:(null==(r=this.createdAt)?void 0:r.getTime())||null}}constructor(t){super(),(0,td._)(this,"pathRoot","/me"),(0,td._)(this,"id",""),(0,td._)(this,"externalId",null),(0,td._)(this,"username",null),(0,td._)(this,"emailAddresses",[]),(0,td._)(this,"phoneNumbers",[]),(0,td._)(this,"web3Wallets",[]),(0,td._)(this,"externalAccounts",[]),(0,td._)(this,"enterpriseAccounts",[]),(0,td._)(this,"passkeys",[]),(0,td._)(this,"organizationMemberships",[]),(0,td._)(this,"passwordEnabled",!1),(0,td._)(this,"firstName",null),(0,td._)(this,"lastName",null),(0,td._)(this,"fullName",null),(0,td._)(this,"primaryEmailAddressId",null),(0,td._)(this,"primaryEmailAddress",null),(0,td._)(this,"primaryPhoneNumberId",null),(0,td._)(this,"primaryPhoneNumber",null),(0,td._)(this,"primaryWeb3WalletId",null),(0,td._)(this,"primaryWeb3Wallet",null),(0,td._)(this,"imageUrl",""),(0,td._)(this,"hasImage",!1),(0,td._)(this,"twoFactorEnabled",!1),(0,td._)(this,"totpEnabled",!1),(0,td._)(this,"backupCodeEnabled",!1),(0,td._)(this,"publicMetadata",{}),(0,td._)(this,"unsafeMetadata",{}),(0,td._)(this,"createOrganizationEnabled",!1),(0,td._)(this,"createOrganizationsLimit",null),(0,td._)(this,"deleteSelfEnabled",!1),(0,td._)(this,"lastSignInAt",null),(0,td._)(this,"legalAcceptedAt",null),(0,td._)(this,"updatedAt",null),(0,td._)(this,"createdAt",null),(0,td._)(this,"cachedSessionsWithActivities",null),(0,td._)(this,"isPrimaryIdentification",t=>{switch(t.constructor){case nK:return this.primaryEmailAddressId===t.id;case sm:return this.primaryPhoneNumberId===t.id;case au:return this.primaryWeb3WalletId===t.id;default:return!1}}),(0,td._)(this,"createEmailAddress",t=>{let{email:e}=t||{};return new nK({email_address:e},this.path()+"/email_addresses/").create()}),(0,td._)(this,"createPasskey",()=>sv.registerPasskey()),(0,td._)(this,"createPhoneNumber",t=>{let{phoneNumber:e}=t||{};return new sm({phone_number:e},this.path()+"/phone_numbers/").create()}),(0,td._)(this,"createWeb3Wallet",t=>{let{web3Wallet:e}=t||{};return new au({web3_wallet:e},this.path()+"/web3_wallets/").create()}),(0,td._)(this,"createExternalAccount",async t=>{var e;let{strategy:i,redirectUrl:r,additionalScopes:n,enterpriseConnectionId:s}=t||{};return new si(null==(e=await rP._fetch({path:"/me/external_accounts",method:"POST",body:{strategy:i,redirect_url:r,additional_scope:n,enterprise_connection_id:s}}))?void 0:e.response,this.path()+"/external_accounts")}),(0,td._)(this,"createTOTP",async()=>{var t;return new ai(null==(t=await rP._fetch({path:"/me/totp",method:"POST"}))?void 0:t.response)}),(0,td._)(this,"verifyTOTP",async t=>{var e;let{code:i}=t;return new ai(null==(e=await rP._fetch({path:"/me/totp/attempt_verification",method:"POST",body:{code:i}}))?void 0:e.response)}),(0,td._)(this,"disableTOTP",async()=>{var t;return new nB(null==(t=await rP._fetch({path:"/me/totp",method:"DELETE"}))?void 0:t.response)}),(0,td._)(this,"createBackupCode",async()=>{var t;return new ar(null==(t=await rP._fetch({path:this.path()+"/backup_codes/",method:"POST"}))?void 0:t.response)}),(0,td._)(this,"update",t=>this._basePatch({body:s1(t)})),(0,td._)(this,"updatePassword",t=>this._basePost({body:t,path:"".concat(this.path(),"/change_password")})),(0,td._)(this,"removePassword",t=>this._basePost({body:t,path:"".concat(this.path(),"/remove_password")})),(0,td._)(this,"delete",()=>this._baseDelete({path:"/me"}).then(t=>(nx.emit(nA,null),t))),(0,td._)(this,"getSessions",async()=>{if(this.cachedSessionsWithActivities)return this.cachedSessionsWithActivities;let t=await sJ.retrieve();return this.cachedSessionsWithActivities=t,t}),(0,td._)(this,"setProfileImage",t=>{let{file:e}=t||{};return null===e?ss.delete("".concat(this.path(),"/profile_image")):ss.create("".concat(this.path(),"/profile_image"),{file:e})}),(0,td._)(this,"getOrganizationInvitations",t=>ao.retrieve(t)),(0,td._)(this,"getOrganizationSuggestions",t=>sp.retrieve(t)),(0,td._)(this,"getOrganizationMemberships",t=>sd.retrieve(t)),(0,td._)(this,"getOrganizationCreationDefaults",()=>an.retrieve()),(0,td._)(this,"leaveOrganization",async t=>{var e;return new nB(null==(e=await rP._fetch({path:"".concat(this.path(),"/organization_memberships/").concat(t),method:"DELETE"}))?void 0:e.response)}),(0,td._)(this,"getEnterpriseConnections",async t=>{var e;let{withOrganizationAccountLinking:i}=t||{};return((null==(e=await rP._fetch({path:"/me/enterprise_connections",method:"GET",...void 0!==i?{search:{with_organization_account_linking:String(i)}}:{}}))?void 0:e.response)||[]).map(t=>new n9(t))}),(0,td._)(this,"initializePaymentMethod",t=>np(t)),(0,td._)(this,"addPaymentMethod",t=>nf(t)),(0,td._)(this,"getPaymentMethods",t=>n_(t)),this.fromJSON(t)}}class aa{fromJSON(t){if(t){var e,i;this.firstName=t.first_name,this.lastName=t.last_name,this.imageUrl=null!=(e=t.image_url)?e:void 0,this.hasImage=null!=(i=t.has_image)?i:void 0}return this}__internal_toSnapshot(){return{first_name:this.firstName,last_name:this.lastName,image_url:this.imageUrl||null,has_image:this.hasImage||null}}constructor(t){(0,td._)(this,"firstName",void 0),(0,td._)(this,"lastName",void 0),(0,td._)(this,"imageUrl",void 0),(0,td._)(this,"hasImage",void 0),this.fromJSON(t)}}class ao extends rP{static async retrieve(t){return await rP._fetch({path:"/me/organization_invitations",method:"GET",search:r2(t)}).then(t=>{let{data:e,total_count:i}=null==t?void 0:t.response;return{total_count:i,data:e.map(t=>new ao(t))}})}fromJSON(t){return t&&(this.id=t.id,this.emailAddress=t.email_address,this.publicOrganizationData={hasImage:t.public_organization_data.has_image,imageUrl:t.public_organization_data.image_url,name:t.public_organization_data.name,id:t.public_organization_data.id,slug:t.public_organization_data.slug},this.publicMetadata=t.public_metadata,this.role=t.role,this.status=t.status,this.createdAt=rT(t.created_at),this.updatedAt=rT(t.updated_at)),this}constructor(t){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"emailAddress",void 0),(0,td._)(this,"publicOrganizationData",void 0),(0,td._)(this,"publicMetadata",{}),(0,td._)(this,"status",void 0),(0,td._)(this,"role",void 0),(0,td._)(this,"createdAt",void 0),(0,td._)(this,"updatedAt",void 0),(0,td._)(this,"accept",async()=>await this._basePost({path:"/me/organization_invitations/".concat(this.id,"/accept")})),this.fromJSON(t)}}let al={enabled:!1,first_factors:[],name:"phone_number",required:!1,second_factors:[],used_for_first_factor:!1,used_for_second_factor:!1,verifications:[],verify_at_sign_up:!1};class ac extends rP{get authenticatableSocialStrategies(){return this.social?Object.entries(this.social).filter(t=>{let[,e]=t;return e.enabled&&e.authenticatable}).map(t=>{let[,e]=t;return e.strategy}).sort():[]}get enabledFirstFactorIdentifiers(){return this.attributes?Object.entries(this.attributes).filter(t=>{let[e,i]=t;return i.used_for_first_factor&&!e.startsWith("web3")}).map(t=>{let[e]=t;return e}):[]}get socialProviderStrategies(){return this.social?Object.entries(this.social).filter(t=>{let[,e]=t;return e.enabled}).map(t=>{let[,e]=t;return e.strategy}).sort():[]}get web3FirstFactors(){return this.attributes?Object.entries(this.attributes).filter(t=>{let[e,i]=t;return i.used_for_first_factor&&e.startsWith("web3")}).map(t=>{let[,e]=t;return e.first_factors}).flat():[]}get alternativePhoneCodeChannels(){return this.attributes?Object.entries(this.attributes).filter(t=>{let[e,i]=t;return i.used_for_first_factor&&"phone_number"===e}).map(t=>{var e;let[,i]=t;return(null==i||null==(e=i.channels)?void 0:e.filter(t=>"sms"!==t))||[]}).flat():[]}get instanceIsPasswordBased(){var t,e;return!!(null==(e=this.attributes)||null==(t=e.password)?void 0:t.enabled)}get hasValidAuthFactor(){var t,e,i,r,n,s;return!!((null==(e=this.attributes)||null==(t=e.email_address)?void 0:t.enabled)||(null==(r=this.attributes)||null==(i=r.phone_number)?void 0:i.enabled)||(null==(n=this.attributes.password)?void 0:n.required)&&(null==(s=this.attributes.username)?void 0:s.required))}fromJSON(t){var e,i,r,n,s,a,o,l,c;return t&&(this.attributes=this.withDefault(t.attributes?Object.fromEntries(Object.entries(t.attributes).map(t=>[t[0],{...t[1],name:t[0]}])):null,this.attributes),this.actions=this.withDefault(t.actions,this.actions),this.enterpriseSSO=this.withDefault(t.enterprise_sso,this.enterpriseSSO),this.passkeySettings=this.withDefault(t.passkey_settings,this.passkeySettings),this.passwordSettings=t.password_settings?{...t.password_settings,min_length:Math.max(null!=(e=null==(s=t.password_settings)?void 0:s.min_length)?e:8,8),max_length:(null==(a=t.password_settings)?void 0:a.max_length)===0?72:Math.min(null!=(i=null==(o=t.password_settings)?void 0:o.max_length)?i:72,72)}:this.passwordSettings,this.signIn=this.withDefault(t.sign_in,this.signIn),this.signUp=this.withDefault(t.sign_up,this.signUp),this.social=this.withDefault(t.social,this.social),this.usernameSettings=t.username_settings?{...t.username_settings,min_length:Math.max(null!=(r=null==(l=t.username_settings)?void 0:l.min_length)?r:4,4),max_length:Math.min(null!=(n=null==(c=t.username_settings)?void 0:c.max_length)?n:64,64)}:this.usernameSettings),this}__internal_toSnapshot(){return{actions:this.actions,attributes:this.attributes,passkey_settings:this.passkeySettings,password_settings:this.passwordSettings,sign_in:this.signIn,sign_up:this.signUp,social:this.social}}constructor(t=null){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"actions",{create_organization:!1,delete_self:!1}),(0,td._)(this,"attributes",{email_address:{enabled:!0,first_factors:["email_code"],name:"email_address",required:!0,second_factors:[],used_for_first_factor:!0,used_for_second_factor:!1,verifications:["email_code"],verify_at_sign_up:!0},phone_number:{...al,name:"phone_number"},username:{...al,name:"username"},web3_wallet:{...al,name:"web3_wallet"},first_name:{...al,name:"first_name"},last_name:{...al,name:"last_name"},password:{enabled:!0,first_factors:[],name:"password",required:!0,second_factors:[],used_for_first_factor:!1,used_for_second_factor:!1,verifications:[],verify_at_sign_up:!1},authenticator_app:{...al,name:"authenticator_app"},backup_code:{...al,name:"backup_code"},passkey:{...al,name:"passkey"}}),(0,td._)(this,"enterpriseSSO",{enabled:!1}),(0,td._)(this,"passkeySettings",{allow_autofill:!1,show_sign_in_button:!1}),(0,td._)(this,"passwordSettings",{}),(0,td._)(this,"signIn",{second_factor:{required:!1,enabled:!1}}),(0,td._)(this,"signUp",{allowlist_only:!1,captcha_enabled:!1,legal_consent_enabled:!1,mode:"public",progressive:!0,mfa:{required:!1}}),(0,td._)(this,"social",{}),(0,td._)(this,"usernameSettings",{}),this.fromJSON(t)}}class au extends rP{create(){return this._basePost({body:{web3_wallet:this.web3Wallet}})}destroy(){return this._baseDelete()}toString(){return this.web3Wallet}fromJSON(t){return t&&(this.id=t.id,this.web3Wallet=t.web3_wallet,this.verification=new n2(t.verification)),this}__internal_toSnapshot(){return{object:"web3_wallet",id:this.id,web3_wallet:this.web3Wallet,verification:this.verification.__internal_toSnapshot()}}constructor(t,e){super(),(0,td._)(this,"id",void 0),(0,td._)(this,"web3Wallet",""),(0,td._)(this,"verification",void 0),(0,td._)(this,"prepareVerification",t=>this._basePost({action:"prepare_verification",body:{...t}})),(0,td._)(this,"attemptVerification",t=>{let{signature:e}=t;return this._basePost({action:"attempt_verification",body:{signature:e}})}),this.pathRoot=e,this.fromJSON(t)}}class ah extends rP{fromJSON(t){return t&&(this.id=t.id,this.updatedAt=rT(t.updated_at),this.createdAt=rT(t.created_at),nx.emit("resource:update",{resource:this})),this}async join(t){return s$(this,async()=>{await ah.join(t)})}static async join(t){return new ah(await rP._fetch({path:"/waitlist",method:"POST",body:t}))}constructor(t=null){super(),(0,td._)(this,"pathRoot","/waitlist"),(0,td._)(this,"id",""),(0,td._)(this,"updatedAt",null),(0,td._)(this,"createdAt",null),this.fromJSON(t)}}function ad(t,e){var i,r,n,s;return t.id!==e.id||t.updatedAt.getTime()<e.updatedAt.getTime()||(i=e,r=t,i.organizationMemberships.length!==r.organizationMemberships.length||(null==(n=i.organizationMemberships[0])?void 0:n.updatedAt)!==(null==(s=r.organizationMemberships[0])?void 0:s.updatedAt))}function ap(t,e){return!function(t,e){if(!t&&e||t&&!e)return!0;if(!t&&t===e)return!1;if(!t||!e)return!0;try{var i,r,n,s,a,o,l,c;if(nL.isClientResource(t))return t.id!==e.id||t.updatedAt.getTime()<e.updatedAt.getTime()||t.sessions.length!==e.sessions.length;if(sz.isSessionResource(t)){return t.id!==e.id||t.updatedAt.getTime()<e.updatedAt.getTime()||(null==(n=t.lastActiveToken)||null==(r=n.jwt)||null==(i=r.claims)?void 0:i.__raw)!==(null==(o=e.lastActiveToken)||null==(a=o.jwt)||null==(s=a.claims)?void 0:s.__raw)||function(t,e){var i,r,n,s,a,o;if(t.lastActiveOrganizationId!==e.lastActiveOrganizationId)return!0;let l=null==(r=t.user)||null==(i=r.organizationMemberships)?void 0:i.find(e=>e.organization.id===t.lastActiveOrganizationId),c=null==(s=e.user)||null==(n=s.organizationMemberships)?void 0:n.find(e=>e.organization.id===t.lastActiveOrganizationId);return(null==l||null==(a=l.permissions)?void 0:a.length)!==(null==c||null==(o=c.permissions)?void 0:o.length)}(t,e)||(l=t,c=e,!!l.user!=!!c.user||!!l.user&&!!c.user&&ad(l.user,c.user))}if(as.isUserResource(t))return ad(t,e)}catch{}return!0}(t,e)?t:e}let af="__clerk_db_jwt";function a_(t,e){let i=new URL(t),r=i.searchParams.get(af);i.searchParams.delete(af);let n=r||e;return n&&i.searchParams.set(af,n),i}let ag=t=>{let e=new URL(t);return e.searchParams.delete(af),e},av=t=>{let e=new URL(t);return e.searchParams.delete("__dev_session"),e.hash=decodeURI(e.hash).replace(/__clerk_db_jwt\[(.*)\]/,""),e.href.endsWith("#")&&(e.hash=""),e};function am(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)t[r]=i[r]}return t}var ay=function t(e,i){function r(t,r,n){if("u">typeof document){"number"==typeof(n=am({},i,n)).expires&&(n.expires=new Date(Date.now()+864e5*n.expires)),n.expires&&(n.expires=n.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in n)n[a]&&(s+="; "+a,!0!==n[a]&&(s+="="+n[a].split(";")[0]));return document.cookie=t+"="+e.write(r,t)+s}}return Object.create({set:r,get:function(t){if("u">typeof document&&(!arguments.length||t)){for(var i=document.cookie?document.cookie.split("; "):[],r={},n=0;n<i.length;n++){var s=i[n].split("="),a=s.slice(1).join("=");try{var o=decodeURIComponent(s[0]);if(r[o]=e.read(a,o),t===o)break}catch(t){}}return t?r[t]:r}},remove:function(t,e){r(t,"",am({},e,{expires:-1}))},withAttributes:function(e){return t(this.converter,am({},this.attributes,e))},withConverter:function(e){return t(am({},this.converter,e),this.attributes)}},{attributes:{value:Object.freeze(i)},converter:{value:Object.freeze(e)}})}({read:function(t){return'"'===t[0]&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});function aw(t){return{get:()=>ay.get(t),set(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ay.set(t,e,i)},remove(e){ay.remove(t,e)}}}let ab=t=>"https:"===window.location.protocol||"None"===t&&void 0===window.safari&&(void 0!==window.isSecureContext?window.isSecureContext:"localhost"===window.location.hostname);function ak(t,e){let i=function(t){try{return new Date(t||new Date)}catch{return new Date}}(t);return i.setFullYear(i.getFullYear()+e),i}let aS=aw("__clerk_test_etld"),aA=[".lovable.app",".lovableproject.com",".webcontainer-api.io",".vusercontent.net",".v0.dev",".v0.app",".lp.dev",".replit.dev"];function aI(){try{return aA.some(t=>window.location.hostname.endsWith(t))}catch{return!1}}let aU="__client_uat",ax="__session",aC=t=>{let e=t.usePartitionedCookies(),i=e||iH()||aI()?"None":"Lax",r=ab(i);return{sameSite:i,secure:r,partitioned:e&&r}};async function aE(t){let e;try{e=await t4(t)}catch(o){var i;i="Suffixed cookie failed due to ".concat(o.message," (secure-context: ").concat(window.isSecureContext,", url: ").concat(window.location.href,")"),ei.has(i)||(console.log(i),ei.add(i));let{default:r}=await Promise.all([s.e("545"),s.e("811")]).then(s.t.bind(s,3515,23)),{default:n}=await Promise.all([s.e("545"),s.e("811")]).then(s.t.bind(s,5662,23)),a=r(t);e=n.stringify(a).replace(/\+/gi,"-").replace(/\//gi,"_").substring(0,8)}return e}let aP=t=>{let e=t.usePartitionedCookies(),i=e||iH()||aI()?"None":"Lax",r=ab(i);return{sameSite:i,secure:r,partitioned:e&&r}};class aT{static async create(t,e,i,r){let n=await aE(t.publishableKey),s=new aT(t,e,n,i,r);return await s.setup(),s}async setup(){return"production"===this.instanceType?this.setupProduction():this.setupDevelopment()}isSignedOut(){return this.clerk.loaded?!this.clerk.user:0>=this.clientUat.get()}async handleUnauthenticatedDevBrowser(){this.devBrowser.clear(),await this.devBrowser.setup()}decorateUrlWithDevBrowserToken(t){let e=this.devBrowser.getDevBrowser();if(!e)throw Error("".concat(i$," Missing dev browser. Please contact support."));return a_(t,e)}async setupDevelopment(){await this.devBrowser.setup()}setupProduction(){this.devBrowser.clear()}startPollingForToken(){this.poller||(this.poller=new nM,this.poller.startPollingForSessionToken(()=>this.refreshSessionToken()))}stopPollingForToken(){this.poller&&(this.poller.stopPollingForSessionToken(),this.poller=null)}refreshTokenOnFocus(){window.addEventListener("focus",()=>{"visible"===document.visibilityState&&this.refreshSessionToken({updateCookieImmediately:!0})})}async refreshSessionToken(){let{updateCookieImmediately:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.clerk.session)try{let e=await this.clerk.session.getToken();t&&this.updateSessionCookie(e)}catch(t){return this.handleGetTokenError(t)}}updateSessionCookie(t){if(document.hasFocus()||this.isCurrentContextActive()){if(!t&&!tv()){var e;iE.warn("Removing session cookie (offline)",{sessionId:null==(e=this.clerk.session)?void 0:e.id},"authCookieService")}return this.setActiveContextInStorage(),t?this.sessionCookie.set(t):this.sessionCookie.remove()}}setClientUatCookieForDevelopmentInstances(){"production"!==this.instanceType&&this.inCustomDevelopmentDomain()&&this.clientUat.set(this.clerk.client)}inCustomDevelopmentDomain(){let t=this.clerk.frontendApi.replace("clerk.","");return!window.location.host.endsWith(t)}handleGetTokenError(t){if(tT(t)||tx(t)||("".concat(t.message).concat(t.name)||"").toLowerCase().replace(/\s+/g,"").includes("networkerror")){if(tL(t))return void this.clerk.handleUnauthenticated().catch(ik.lQ);this.clerkEventBus.emit(tk,"degraded")}}handleSignOut(){this.activeCookie.remove(),this.sessionCookie.remove(),this.setClientUatCookieForDevelopmentInstances()}setActiveContextInStorage(){var t,e;let i=(null==(t=this.clerk.session)?void 0:t.id)||"",r=(null==(e=this.clerk.organization)?void 0:e.id)||"",n="".concat(i,":").concat(r);":"!==n?this.activeCookie.set(n):this.activeCookie.remove()}isCurrentContextActive(){var t,e;let i=this.activeCookie.get();if(!i)return!0;let[r,n]=i.split(":"),s=(null==(t=this.clerk.session)?void 0:t.id)||"",a=(null==(e=this.clerk.organization)?void 0:e.id)||"";return r===s&&n===a}getSessionCookie(){return this.sessionCookie.get()}constructor(t,e,r,n,s){(0,td._)(this,"clerk",void 0),(0,td._)(this,"instanceType",void 0),(0,td._)(this,"clerkEventBus",void 0),(0,td._)(this,"poller",void 0),(0,td._)(this,"clientUat",void 0),(0,td._)(this,"sessionCookie",void 0),(0,td._)(this,"activeCookie",void 0),(0,td._)(this,"devBrowser",void 0),this.clerk=t,this.instanceType=n,this.clerkEventBus=s,this.poller=null,nx.on(nS,t=>{let{token:e}=t;this.updateSessionCookie(e&&e.getRawString()),this.setClientUatCookieForDevelopmentInstances()}),nx.on(nA,()=>this.handleSignOut()),nx.on(nI,()=>{this.devBrowser.refreshCookies()}),this.refreshTokenOnFocus(),this.startPollingForToken();const a={usePartitionedCookies:()=>se.getInstance().partitionedCookies};this.clientUat=((t,e)=>{let r=aw(aU),n=aw(t9(aU,t));return{set:t=>{let s=ak(Date.now(),1),a=e.usePartitionedCookies(),o=a||iH()||aI()?"None":"Strict",l=ab(o),c=a&&l,u=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.hostname,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aS,r=arguments.length>2?arguments[2]:void 0;if(i)return i;if(["localhost","127.0.0.1","0.0.0.0"].includes(t))return t;let n=t.split(".");if(1===n.length)return t;for(let t=n.length-2;t>=0;t--){let s=n.slice(t).join(".");if(e.set("1",{...r,domain:s}),"1"===e.get())return e.remove({...r,domain:s}),i=s,s;e.remove({...r,domain:s})}return i=t,t}(void 0,void 0,{sameSite:o,secure:l}),h="0";t&&t.updatedAt&&t.signedInSessions.length>0&&(h=Math.floor(t.updatedAt.getTime()/1e3).toString()),n.remove(),r.remove(),n.set(h,{domain:u,expires:s,partitioned:c,sameSite:o,secure:l}),r.set(h,{domain:u,expires:s,partitioned:c,sameSite:o,secure:l})},get:()=>parseInt(n.get()||r.get()||"0",10)}})(r,a),this.sessionCookie=((t,e)=>{let i=aw(ax),r=aw(t9(ax,t));return{set:t=>{let n=ak(Date.now(),1),{sameSite:s,secure:a,partitioned:o}=aC(e);o&&(i.remove(),r.remove()),i.set(t,{expires:n,sameSite:s,secure:a,partitioned:o}),r.set(t,{expires:n,sameSite:s,secure:a,partitioned:o})},remove:()=>{let t=aC(e);i.remove(t),r.remove(t),t.partitioned&&(i.remove(),r.remove())},get:()=>r.get()||i.get()}})(r,a),this.activeCookie=(()=>{let t=aw("clerk_active_context"),e={secure:ab("None")};return{set:i=>{t.set(i,e)},get:()=>t.get(),remove:()=>t.remove(e)}})(),this.devBrowser=function(t){let e,i,r,{cookieSuffix:n,frontendApi:s,fapiClient:a,cookieOptions:o}=t,l=(e=aw(af),i=aw(t9(af,n)),{get:()=>i.get()||e.get(),set:t=>{let r=ak(Date.now(),1),{sameSite:n,secure:s,partitioned:a}=aP(o);a&&(i.remove(),e.remove()),i.set(t,{expires:r,sameSite:n,secure:s,partitioned:a}),e.set(t,{expires:r,sameSite:n,secure:s,partitioned:a})},remove:()=>{let t=aP(o);i.remove(t),e.remove(t),t.partitioned&&(i.remove(),e.remove())}});function c(){return r||l.get()}function u(t){r=t,l.set(t)}function h(){r=void 0,l.remove()}return{clear:function(){h()},setup:async function t(){var t;let e,i;if(!eg(s))return;a.onBeforeRequest(t=>{let e=c();e&&(null==t?void 0:t.url)&&(t.url=a_(t.url,e))}),a.onAfterResponse((t,e)=>{var i;let r=null==e||null==(i=e.headers)?void 0:i.get("Clerk-Db-Jwt");r&&u(r)});let n=(e=(t=new URL(window.location.href)).searchParams.get(af)||"",(i=ag(av(t))).href!==t.href&&void 0!==globalThis.history&&globalThis.history.replaceState(null,"",i),e);if(n)return void u(n);let o=l.get();if(o){r=o;return}let h=a.buildUrl({path:"/dev_browser"}),d=await fetch(h.toString(),{method:"POST"});if(!d.ok){let t=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.length>0?t.map(t=>new tE(t)):[]}((await d.json()).errors);t[0]?iY(t[0].longMessage):iY()}let p=await d.json();u(null==p?void 0:p.id)},getDevBrowser:c,setDevBrowser:u,removeDevBrowser:h,refreshCookies:function(){let t=c();t&&u(t)}}}({frontendApi:t.frontendApi,fapiClient:e,cookieSuffix:r,cookieOptions:a})}}class aO{async start(){this.isEnabled()&&(await this.challengeAndSend(),this.timers.setInterval(()=>{this.challengeAndSend()},this.intervalInMs()))}async challengeAndSend(){if(!(!this.clerk.client||this.clientBypass()))try{let t=await this.captchaChallenge.invisible({action:"heartbeat"});await this.clerk.client.__internal_sendCaptchaToken(t)}catch{}}isEnabled(){var t,e;return!!(null==(e=this.clerk.__internal_environment)||null==(t=e.displayConfig)?void 0:t.captchaHeartbeat)}clientBypass(){var t;return null==(t=this.clerk.client)?void 0:t.captchaBypass}intervalInMs(){var t,e,i;return null!=(t=null==(i=this.clerk.__internal_environment)||null==(e=i.displayConfig)?void 0:e.captchaHeartbeatIntervalMs)?t:6e5}constructor(t,e=new rC(t),i=nT()){(0,td._)(this,"clerk",void 0),(0,td._)(this,"captchaChallenge",void 0),(0,td._)(this,"timers",void 0),this.clerk=t,this.captchaChallenge=e,this.timers=i}}let aR=["/client","/waitlist"];var aM=new WeakSet;class aN{async getAll(t){var e,i,r,n,s,a;return rP._fetch({...await h(this,aM,aW).call(this),method:"GET",path:r1(aN,aN,az),search:r2({...t,subject:null!=(e=null!=(i=null!=(r=null==t?void 0:t.subject)?r:null==(s=rP.clerk.organization)?void 0:s.id)?i:null==(a=rP.clerk.user)?void 0:a.id)?e:"",query:null!=(n=null==t?void 0:t.query)?n:""})}).then(t=>{let{data:e,total_count:i}=t;return{total_count:i,data:e.map(t=>new rO(t))}})}async create(t){var e,i,r,n,s;return new rO(await rP._fetch({...await h(this,aM,aW).call(this),path:r1(aN,aN,az),method:"POST",body:JSON.stringify({type:"api_key",name:t.name,subject:null!=(e=null!=(i=null!=(r=t.subject)?r:null==(n=rP.clerk.organization)?void 0:n.id)?i:null==(s=rP.clerk.user)?void 0:s.id)?e:"",description:t.description,seconds_until_expiration:t.secondsUntilExpiration})}))}async revoke(t){return new rO(await rP._fetch({...await h(this,aM,aW).call(this),method:"POST",path:"".concat(r1(aN,aN,az),"/").concat(t.apiKeyID,"/revoke"),body:JSON.stringify({revocation_reason:t.revocationReason})}))}constructor(){d(this,aM)}}var az={writable:!0,value:"/api_keys"};async function aW(){var t;let e=await (null==(t=rP.clerk.session)?void 0:t.getToken());if(!e)throw new tU("No valid session token available",{code:"no_session_token"});return{pathPrefix:"",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},credentials:"same-origin"}}let aF=new Map;class aD{async getConsentInfo(t){var e,i,r;let{oauthClientId:n,scope:s}=t,a=await rP._fetch({method:"GET",path:"/me/oauth/consent/".concat(encodeURIComponent(n)),search:void 0!==s?{scope:s}:void 0},{skipUpdateClient:!0});if(!a)throw new tU("Network request failed while offline",{code:"network_error"});let o=null!=(e=a.response)?e:a;return{oauthApplicationName:o.oauth_application_name,oauthApplicationLogoUrl:o.oauth_application_logo_url,oauthApplicationUrl:o.oauth_application_url,clientId:o.client_id,state:o.state,scopes:null!=(i=null==(r=o.scopes)?void 0:r.map(t=>({scope:t.scope,description:t.description,requiresConsent:t.requires_consent})))?i:[]}}buildConsentActionUrl(t){var e;let{clientId:i}=t,r=rP.fapiClient.buildUrl({path:"/me/oauth/consent/".concat(encodeURIComponent(i)),sessionId:null==(e=rP.clerk.session)?void 0:e.id});return rP.clerk.buildUrlWithAuth(r.toString())}}var aL=new WeakMap;class aj{load(t){let e=null==t?void 0:t.protectConfig;if(!(!(null==e?void 0:e.loaders)||!Array.isArray(e.loaders)||0===e.loaders.length||o(this,aL))){if(tp())for(let t of(u(this,aL,!0),e.loaders))try{this.applyLoader(t)}catch(t){er("[protect] failed to apply loader: ".concat(t))}}}applyLoader(t){if(void 0!==t.rollout){let e=t.rollout;if("number"!=typeof e||e<0)return void er("[protect] loader rollout value is invalid: ".concat(e));if(0===e||Math.random()>e)return}let e=t.type||"script",i=t.target||"body",r=document.createElement(e);if(t.attributes)for(let[e,i]of Object.entries(t.attributes))switch(typeof i){case"string":case"number":case"boolean":r.setAttribute(e,String(i));break;default:er("[protect] loader attribute is invalid type: ".concat(e,"=").concat(i))}switch(t.textContent&&"string"==typeof t.textContent&&(r.textContent=t.textContent),i){case"head":document.head.appendChild(r);break;case"body":document.body.appendChild(r);break;default:if(null==i?void 0:i.startsWith("#")){let t=document.getElementById(i.substring(1));if(!t)return void er("[protect] loader target element not found: ".concat(i));t.appendChild(r);return}er("[protect] loader target is invalid: ".concat(i))}}constructor(){c(this,aL,{writable:!0,value:!1})}}class aB{get __internal_waitlist(){return this._waitlistInstance}constructor(){(0,td._)(this,"signInResourceSignal",r5),(0,td._)(this,"signInErrorSignal",r6),(0,td._)(this,"signInFetchSignal",r4),(0,td._)(this,"signInSignal",r9),(0,td._)(this,"signUpResourceSignal",r7),(0,td._)(this,"signUpErrorSignal",nt),(0,td._)(this,"signUpFetchSignal",ne),(0,td._)(this,"signUpSignal",ni),(0,td._)(this,"waitlistResourceSignal",nr),(0,td._)(this,"waitlistErrorSignal",nn),(0,td._)(this,"waitlistFetchSignal",ns),(0,td._)(this,"waitlistSignal",na),(0,td._)(this,"_waitlistInstance",void 0),(0,td._)(this,"__internal_effect",rG),(0,td._)(this,"__internal_computed",rH),(0,td._)(this,"onResourceError",t=>{t.resource instanceof sX&&this.signInErrorSignal({error:t.error}),t.resource instanceof s2&&this.signUpErrorSignal({error:t.error}),t.resource instanceof ah&&this.waitlistErrorSignal({error:t.error})}),(0,td._)(this,"onResourceUpdated",t=>{if(t.resource instanceof sX){if(aJ(this.signInResourceSignal().resource,t.resource))return;this.signInResourceSignal({resource:t.resource})}if(t.resource instanceof s2){if(aJ(this.signUpResourceSignal().resource,t.resource))return;this.signUpResourceSignal({resource:t.resource})}t.resource instanceof ah&&(this._waitlistInstance=t.resource,this.waitlistResourceSignal({resource:t.resource}))}),(0,td._)(this,"onResourceFetch",t=>{t.resource instanceof sX&&this.signInFetchSignal({status:t.status}),t.resource instanceof s2&&this.signUpFetchSignal({status:t.status}),t.resource instanceof ah&&this.waitlistFetchSignal({status:t.status})}),nx.on("resource:update",this.onResourceUpdated),nx.on("resource:error",this.onResourceError),nx.on("resource:fetch",this.onResourceFetch),this._waitlistInstance=new ah(null),this.waitlistResourceSignal({resource:this._waitlistInstance})}}function aJ(t,e){var i;return!(null==e?void 0:e.id)&&t&&(null==(i=t.__internal_future)?void 0:i.canBeDiscarded)===!1}let aV="cannot_render_billing_disabled",aK="cannot_render_user_missing",aq="cannot_render_organizations_disabled",aH="cannot_render_organization_missing",aG="cannot_render_single_session_enabled",a$={polling:!0,standardBrowser:!0,touchSession:!0,isSatellite:!1,signInUrl:void 0,signUpUrl:void 0,afterSignOutUrl:void 0,signInFallbackRedirectUrl:void 0,signUpFallbackRedirectUrl:void 0,signInForceRedirectUrl:void 0,signUpForceRedirectUrl:void 0,newSubscriptionRedirectUrl:void 0};var aY=new WeakMap,aX=new WeakMap,aQ=new WeakMap,aZ=new WeakMap,a0=new WeakMap,a1=new WeakMap,a2=new WeakMap,a8=new WeakMap,a3=new WeakMap,a5=new WeakMap,a6=new WeakMap,a4=new WeakMap,a9=new WeakMap,a7=new WeakMap,ot=new WeakMap,oe=new WeakMap,oi=new WeakMap,or=new WeakMap,on=new WeakSet,os=new WeakMap,oa=new WeakMap,oo=new WeakMap,ol=new WeakMap,oc=new WeakMap,ou=new WeakMap,oh=new WeakMap,od=new WeakMap,op=new WeakMap,of=new WeakMap,o_=new WeakMap,og=new WeakMap,ov=new WeakMap,om=new WeakMap,oy=new WeakMap,ow=new WeakMap,ob=new WeakMap,ok=new WeakMap,oS=new WeakMap,oA=new WeakMap,oI=new WeakMap,oU=new WeakMap,ox=new WeakMap,oC=new WeakMap,oE=new WeakMap,oP=new WeakMap,oT=new WeakMap,oO=new WeakMap,oR=new WeakMap,oM=new WeakSet;class oN{get __internal_queryClient(){return o(this,aY)||Promise.all([s.e("662"),s.e("10")]).then(s.bind(s,1753)).then(t=>t.QueryClient).then(t=>{o(this,aY)||(u(this,aY,new t),o(this,or).emit("queryClientStatus","ready"))}),o(this,aY)?{__tag:"clerk-rq-client",client:o(this,aY)}:void 0}get publishableKey(){return o(this,aX)}get version(){return oN.version}set sdkMetadata(t){oN.sdkMetadata=t}get sdkMetadata(){return oN.sdkMetadata}get loaded(){return"degraded"===this.status||"ready"===this.status}get status(){return o(this,a4)}get isSatellite(){return!!iq()&&(0,ik.VK)(o(this,ot).isSatellite,new URL(window.location.href),!1)}get domain(){if(iq()){let t=et((0,ik.VK)(o(this,aQ),new URL(window.location.href)));if("production"===o(this,a6)){let e;if(!t)return"";if(t.match(/^(clerk\.)+\w*$/))e=/(clerk\.)*(?=clerk\.)/;else{if(t.match(/\.clerk.accounts/))return t;e=/^(clerk\.)*/gi}return"clerk.".concat(t.replace(e,""))}return t}return"function"==typeof o(this,aQ)?(er(e$.domainAsFunctionNotSupported),""):et(o(this,aQ)||"")}get proxyUrl(){if(iq()){let t=(0,ik.VK)(o(this,aZ),new URL(window.location.href));return!t||eZ(t)||e0(t)||iJ.throwInvalidProxyUrl({url:t}),t?e0(t)?new URL(t,window.location.origin).toString():t:""}return"function"==typeof o(this,aZ)?(er(e$.proxyUrlAsFunctionNotSupported),""):o(this,aZ)||""}get frontendApi(){let t=t5(this.publishableKey);return t?t.frontendApi:iJ.throwInvalidPublishableKeyError({key:this.publishableKey})}get instanceType(){return o(this,a6)}get isStandardBrowser(){return o(this,ot).standardBrowser||!1}get billing(){return oN._billing||(oN._billing=new r8),oN._billing}get apiKeys(){return oN._apiKeys||(oN._apiKeys=new aN),oN._apiKeys}get oauthApplication(){return oN._oauthApplication||(oN._oauthApplication=new aD),oN._oauthApplication}__experimental_checkout(t){return this._checkout||(this._checkout=t=>(function(t,e){var i,r,n;let s,a,o,l,{for:c,planId:u,planPeriod:h}=e;if(null===t.user)throw Error("Clerk: User is not authenticated");if("organization"===c&&null===t.organization)throw Error("Clerk: The current session does not have an active organization. Use `setActive` to set the organization");let d=function(t){let{userId:e,orgId:i,planId:r,planPeriod:n}=t;return"".concat(e,"-").concat(i||"user","-").concat(r,"-").concat(n)}({userId:(null==(i=t.user)?void 0:i.id)||"",orgId:"organization"===c?null==(r=t.organization)?void 0:r.id:void 0,planId:u,planPeriod:h}),p=aF.get(d);if(p)return p.signals.computedSignal();let f=(s=rq({resource:null}),a=rq({error:null}),o=rq({status:"idle"}),l=rH(()=>{let t=s().resource,e=a().error,i=o().status;return{errors:no(e,{}),fetchStatus:i,checkout:t}}),{resourceSignal:s,errorSignal:a,fetchSignal:o,computedSignal:l}),_=new nu(f,{..."organization"===c?{orgId:null==(n=t.organization)?void 0:n.id}:{},planId:u,planPeriod:h});return aF.set(d,{resource:_,signals:f}),f.computedSignal()})(this,t)),this._checkout(t)}__internal_getOption(t){return o(this,ot)[t]}get isSignedIn(){var t;return(null===this||void 0===this||null==(t=this.session)?void 0:t.status)!=="pending"&&!!this.session}buildUrlWithAuth(t){if("production"===o(this,a6))return t;let e=new URL(t,window.location.origin);return e.origin!==window.location.origin&&o(this,a0)?o(this,a0).decorateUrlWithDevBrowserToken(e).href:e.href}buildSignInUrl(t){let e=(null==t?void 0:t.redirectUrl)||window.location.href;this.isSatellite&&(e=o(this,os).call(this,e));let i=this.isSatellite?o(this,oa).call(this,t):t;return o(this,oE).call(this,"signInUrl",{...i,redirectUrl:e},null==t?void 0:t.initialValues)}buildSignUpUrl(t){let e=(null==t?void 0:t.redirectUrl)||window.location.href;this.isSatellite&&(e=o(this,os).call(this,e));let i=this.isSatellite?o(this,oa).call(this,t):t;return o(this,oE).call(this,"signUpUrl",{...i,redirectUrl:e},null==t?void 0:t.initialValues)}buildUserProfileUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.userProfileUrl):""}buildHomeUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.homeUrl):""}buildAfterSignInUrl(){let{params:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.buildUrlWithAuth(new eT(o(this,ot),{},t).getAfterSignInUrl())}buildAfterSignUpUrl(){let{params:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.buildUrlWithAuth(new eT(o(this,ot),{},t).getAfterSignUpUrl())}buildAfterSignOutUrl(){return o(this,ot).afterSignOutUrl?this.buildUrlWithAuth(o(this,ot).afterSignOutUrl):"/"}buildNewSubscriptionRedirectUrl(){return o(this,ot).newSubscriptionRedirectUrl?o(this,ot).newSubscriptionRedirectUrl:this.buildAfterSignInUrl()}buildWaitlistUrl(t){return this.environment&&this.environment.displayConfig?ey({base:o(this,ot).waitlistUrl||this.environment.displayConfig.waitlistUrl,hashSearchParams:[new URLSearchParams((null==t?void 0:t.initialValues)||{})]},{stringify:!0}):""}buildAfterMultiSessionSingleSignOutUrl(){return this.environment?o(this,ot).afterMultiSessionSingleSignOutUrl?this.buildUrlWithAuth(o(this,ot).afterMultiSessionSingleSignOutUrl):o(this,ot).signInUrl?this.buildUrlWithAuth(ey({base:o(this,ot).signInUrl,hashPath:"choose"},{stringify:!0})):this.buildUrlWithAuth(this.environment.displayConfig.afterSignOutOneUrl):""}buildCreateOrganizationUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.createOrganizationUrl):""}buildOrganizationProfileUrl(){return this.environment&&this.environment.displayConfig?this.buildUrlWithAuth(this.environment.displayConfig.organizationProfileUrl):""}buildTasksUrl(t){var e,i;let r=null==(e=this.session)?void 0:e.currentTask;if(!r)return"";let n=null==(i=o(this,ot).taskUrls)?void 0:i[r.key];return n||ey({base:this.buildSignInUrl(t),hashPath:eK(r)},{stringify:!0})}updateEnvironment(t){this.environment=t}get __internal_last_error(){let t=this.internal_last_error;return this.internal_last_error=null,t}set __internal_last_error(t){this.internal_last_error=t}get __internal_environment(){return this.environment}__internal_navigateWithError(t,e){return this.__internal_last_error=e,this.navigate(t)}assertComponentsReady(t){if(!t)throw Error("Clerk was not loaded with Ui components")}constructor(t,e){var i,r=this;if(d(this,on),c(this,oR,{get:oW,set:void 0}),d(this,oM),(0,td._)(this,"_checkout",void 0),(0,td._)(this,"client",void 0),(0,td._)(this,"session",void 0),(0,td._)(this,"organization",void 0),(0,td._)(this,"user",void 0),(0,td._)(this,"__internal_country",void 0),(0,td._)(this,"telemetry",void 0),(0,td._)(this,"__internal_state",new aB),(0,td._)(this,"internal_last_error",null),(0,td._)(this,"environment",void 0),c(this,aY,{writable:!0,value:void 0}),c(this,aX,{writable:!0,value:""}),c(this,aQ,{writable:!0,value:void 0}),c(this,aZ,{writable:!0,value:void 0}),c(this,a0,{writable:!0,value:void 0}),c(this,a1,{writable:!0,value:void 0}),c(this,a2,{writable:!0,value:void 0}),c(this,a8,{writable:!0,value:null}),c(this,a3,{writable:!0,value:void 0}),c(this,a5,{writable:!0,value:void 0}),c(this,a6,{writable:!0,value:void 0}),c(this,a4,{writable:!0,value:"loading"}),c(this,a9,{writable:!0,value:[]}),c(this,a7,{writable:!0,value:[]}),c(this,ot,{writable:!0,value:{}}),c(this,oe,{writable:!0,value:null}),c(this,oi,{writable:!0,value:0}),c(this,or,{writable:!0,value:tb()}),(0,td._)(this,"__internal_getCachedResources",void 0),(0,td._)(this,"__internal_createPublicCredentials",void 0),(0,td._)(this,"__internal_getPublicCredentials",void 0),(0,td._)(this,"__internal_isWebAuthnSupported",void 0),(0,td._)(this,"__internal_isWebAuthnAutofillSupported",void 0),(0,td._)(this,"__internal_isWebAuthnPlatformAuthenticatorSupported",void 0),(0,td._)(this,"__internal_setActiveInProgress",!1),(0,td._)(this,"getFapiClient",()=>o(this,a5)),(0,td._)(this,"load",async t=>{var e,i,r,n,s,a;if(iE.info("load() start",{},"clerk"),!this.loaded){if("development"!==o(this,a6)||(null==t?void 0:t.unsafe_disableDevelopmentModeConsoleWarning)||er("Clerk: Clerk has been loaded with development keys. Development instances have strict usage limits and should not be used when deploying your application to production. Learn more: https://clerk.com/docs/deployments/overview"),u(this,ot,o(this,oT).call(this,t)),(null==(e=o(this,ot).ui)?void 0:e.ClerkUI)&&u(this,a3,Promise.resolve(o(this,ot).ui.ClerkUI).then(t=>new t(()=>this,()=>this.environment,o(this,ot),new iz))),"development"===o(this,a6)&&(o(this,ot).routerPush||o(this,ot).routerReplace)&&(!o(this,ot).routerPush||!o(this,ot).routerReplace)){let t=o(this,ot).routerPush?"routerReplace":"routerPush";er("Clerk: Both `routerPush` and `routerReplace` need to be defined, but `".concat(t,"` is not defined. This may cause issues with navigation in your application."))}nx.on(nU,()=>{o(this,oI).call(this,this.session)}),o(this,ot).sdkMetadata&&(oN.sdkMetadata=o(this,ot).sdkMetadata),!1!==o(this,ot).telemetry&&(this.telemetry=new ii({clerkVersion:oN.version,samplingRate:1,perEventSampling:!o(this,ot).__internal_keyless_claimKeylessApplicationUrl&&void 0,publishableKey:this.publishableKey,...o(this,ot).telemetry}),o(this,ot).appearance&&this.telemetry.record({event:"THEME_USAGE",eventSamplingRate:1,payload:function(t){let e;if(!t||"object"!=typeof t)return{};let i=t.theme;if(!i)return{};if(Array.isArray(i))for(let t of i){let i=ic(t);if(i){e=i;break}}else e=ic(i);return{themeName:e}}(o(this,ot).appearance)}));try{o(this,ot).standardBrowser?await o(this,o_).call(this):await o(this,og).call(this);let t=o(this,ot).telemetry,e=!1!==t&&!(null==t?void 0:t.disabled),l=!!o(this,ot).__internal_keyless_claimKeylessApplicationUrl,c=!!(null==(r=this.environment)?void 0:r.clientDebugMode),u=null!=(i=null==(s=this.environment)||null==(n=s.isProduction)?void 0:n.call(s))&&i,h=c||l&&!u,d=l&&!c?"error":void 0;h&&function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(iI)return;let{enabled:e=!1,...i}=t;e&&(iS=!0,iI=!0,iC(i))}({enabled:!0,...d?{logLevel:d}:{},...e&&this.telemetry?{telemetryCollector:this.telemetry}:{}}),null==(a=o(this,a1))||a.load(this.environment),iE.info("load() complete",{},"clerk")}catch(t){throw o(this,or).emit(tk,"error"),iE.error("load() failed",{error:t},"clerk"),t}}}),(0,td._)(this,"signOut",async(t,e)=>{var i,r,n,s,a,l;if(!this.client||0===this.client.sessions.length)return;let c="u">typeof window&&"function"==typeof window.__internal_onBeforeSetActive?window.__internal_onBeforeSetActive:ik.lQ,u="u">typeof window&&"function"==typeof window.__internal_onAfterSetActive?window.__internal_onAfterSetActive:ik.lQ,h=t&&"object"==typeof t?t:e||{},d=(null==h?void 0:h.redirectUrl)||this.buildAfterSignOutUrl();iE.debug("signOut() start",{hasClient:!!this.client,multiSessionCount:null!=(i=null==(n=this.client)?void 0:n.signedInSessions.length)?i:0,redirectUrl:d,sessionTarget:null!=(r=null==h?void 0:h.sessionId)?r:null},"clerk");let p="function"==typeof t?t:void 0,f=async()=>{let t=iW(o(this,ot).standardBrowser);nx.emit(nA,null),await t.track(async()=>{p?await p():await this.navigate(d)}),t.isUnloading()||(o(this,oI).call(this),await u())};if(await c(),!h.sessionId||1===this.client.signedInSessions.length){o(this,ok).call(this),null==(a=null==(l=o(this,ot).experimental)?void 0:l.persistClient)||a?await this.client.removeSessions():await this.client.destroy(),await f(),iE.info("signOut() complete",{redirectUrl:ew(d)},"clerk");return}let _=this.client.signedInSessions.find(t=>t.id===h.sessionId);(null==_?void 0:_.id)&&(null==(s=this.session)?void 0:s.id)===_.id?(o(this,ok).call(this),await (null==_?void 0:_.remove()),await f(),iE.info("signOut() complete",{redirectUrl:ew(d)},"clerk")):await (null==_?void 0:_.remove())}),(0,td._)(this,"openGoogleOneTap",t=>{var e;this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted()).then(e=>e.openModal("googleOneTap",t||{})),null==(e=this.telemetry)||e.record(il("GoogleOneTap",t))}),(0,td._)(this,"closeGoogleOneTap",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeModal("googleOneTap"))}),(0,td._)(this,"openSignIn",t=>{var e,i;if(tB(this,this.environment)){if("development"===o(this,a6))throw new tU(e$.cannotOpenSignInOrSignUp,{code:aG});return}this.assertComponentsReady(o(this,a3));let r="SignIn";o(this,a3).then(t=>t.ensureMounted({preloadHint:r})).then(e=>e.openModal("signIn",t||{}));let n={withSignUp:null!=(e=null==t?void 0:t.withSignUp)?e:h(this,on,oz).call(this)};null==(i=this.telemetry)||i.record(il(r,t,n))}),(0,td._)(this,"closeSignIn",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeModal("signIn"))}),(0,td._)(this,"__internal_openCheckout",t=>{if(tJ(this,this.environment)){if("development"===o(this,a6))throw new tU(e$.cannotRenderAnyBillingComponent("Checkout"),{code:aV});return}if(!this.user){if("development"===o(this,a6))throw new tU(e$.cannotOpenCheckout,{code:aK});return}this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted()).then(e=>e.openDrawer("checkout",t||{}))}),(0,td._)(this,"__internal_closeCheckout",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeDrawer("checkout"))}),(0,td._)(this,"__internal_openPlanDetails",t=>{var e;if(tJ(this,this.environment)){if("development"===o(this,a6))throw new tU(e$.cannotRenderAnyBillingComponent("PlanDetails"),{code:aV});return}this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted()).then(e=>e.openDrawer("planDetails",t||{})),null==(e=this.telemetry)||e.record(il("PlanDetails",t))}),(0,td._)(this,"__internal_closePlanDetails",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeDrawer("planDetails"))}),(0,td._)(this,"__internal_openSubscriptionDetails",t=>{this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted()).then(e=>e.openDrawer("subscriptionDetails",t||{}))}),(0,td._)(this,"__internal_closeSubscriptionDetails",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeDrawer("subscriptionDetails"))}),(0,td._)(this,"__internal_openReverification",t=>{var e;if(!this.user){if("development"===o(this,a6))throw new tU(e$.cannotOpenUserProfile,{code:aK});return}this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted()).then(e=>e.openModal("userVerification",t||{})),null==(e=this.telemetry)||e.record(il("UserVerification",t))}),(0,td._)(this,"__internal_closeReverification",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeModal("userVerification"))}),(0,td._)(this,"__internal_attemptToEnableEnvironmentSetting",t=>{let{for:e,caller:i}=t;if(this.user||"development"!==o(this,a6)||er('Clerk: "'.concat(i,'" requires an active user session. Ensure a user is signed in before executing ').concat(i,".")),"organizations"===e){var r,n;let e;return(null==(e=this.environment)?void 0:e.organizationSettings.enabled)||(null==(n=this.session)||null==(r=n.currentTask)?void 0:r.key)==="choose-organization"?{isEnabled:!0}:("development"===o(this,a6)&&this.__internal_openEnableOrganizationsPrompt({caller:i,onSuccess:()=>window.location.reload(),onClose:t.onClose}),{isEnabled:!1})}throw Error('Attempted to enable an unknown or unsupported setting "'.concat(e,'".'))}),(0,td._)(this,"__internal_openEnableOrganizationsPrompt",t=>{var e;this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted({preloadHint:"EnableOrganizationsPrompt"})).then(e=>e.openModal("enableOrganizationsPrompt",t||{})),null==(e=this.telemetry)||e.record(io("EnableOrganizationsPrompt",t))}),(0,td._)(this,"__internal_closeEnableOrganizationsPrompt",()=>{var t;this.assertComponentsReady(o(this,a3)),null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeModal("enableOrganizationsPrompt"))}),(0,td._)(this,"__internal_openBlankCaptchaModal",()=>(this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted()).then(t=>t.openModal("blankCaptcha",{})))),(0,td._)(this,"__internal_closeBlankCaptchaModal",()=>(this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted()).then(t=>t.closeModal("blankCaptcha")))),(0,td._)(this,"__internal_loadStripeJs",async()=>{let{loadStripe:t}=await s.e("279").then(s.bind(s,8755));return t}),(0,td._)(this,"openSignUp",t=>{var e;if(tB(this,this.environment)){if("development"===o(this,a6))throw new tU(e$.cannotOpenSignInOrSignUp,{code:aG});return}this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted({preloadHint:"SignUp"})).then(e=>e.openModal("signUp",t||{})),null==(e=this.telemetry)||e.record(il("SignUp",t))}),(0,td._)(this,"closeSignUp",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeModal("signUp"))}),(0,td._)(this,"openUserProfile",t=>{var e,i;if(!this.user){if("development"===o(this,a6))throw new tU(e$.cannotOpenUserProfile,{code:aK});return}this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted({preloadHint:"UserProfile"})).then(e=>e.openModal("userProfile",t||{}));let r=((null==t||null==(e=t.customPages)?void 0:e.length)||0)>0?{customPages:!0}:void 0;null==(i=this.telemetry)||i.record(il("UserProfile",t,r))}),(0,td._)(this,"closeUserProfile",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeModal("userProfile"))}),(0,td._)(this,"openOrganizationProfile",t=>{var e;let{isEnabled:i}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"OrganizationProfile",onClose:()=>{throw new tU(e$.cannotRenderAnyOrganizationComponent("OrganizationProfile"),{code:aq})}});if(i){if(!this.organization){if("development"===o(this,a6))throw new tU(e$.cannotRenderComponentWhenOrgDoesNotExist,{code:aH});return}this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted({preloadHint:"OrganizationProfile"})).then(e=>e.openModal("organizationProfile",t||{})),null==(e=this.telemetry)||e.record(il("OrganizationProfile",t))}}),(0,td._)(this,"closeOrganizationProfile",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeModal("organizationProfile"))}),(0,td._)(this,"openCreateOrganization",t=>{var e;let{isEnabled:i}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"CreateOrganization",onClose:()=>{throw new tU(e$.cannotRenderAnyOrganizationComponent("CreateOrganization"),{code:aq})}});i&&(this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted({preloadHint:"CreateOrganization"})).then(e=>e.openModal("createOrganization",t||{})),null==(e=this.telemetry)||e.record(il("CreateOrganization",t)))}),(0,td._)(this,"closeCreateOrganization",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeModal("createOrganization"))}),(0,td._)(this,"openWaitlist",t=>{var e;this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted({preloadHint:"Waitlist"})).then(e=>e.openModal("waitlist",t||{})),null==(e=this.telemetry)||e.record(il("Waitlist",t))}),(0,td._)(this,"closeWaitlist",()=>{var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>t.closeModal("waitlist"))}),(0,td._)(this,"mountSignIn",(t,e)=>{var i,r;this.assertComponentsReady(o(this,a3));let n="SignIn";o(this,a3).then(t=>t.ensureMounted({preloadHint:n})).then(i=>i.mountComponent({name:n,appearanceKey:"signIn",node:t,props:e}));let s={withSignUp:null!=(i=null==e?void 0:e.withSignUp)?i:h(this,on,oz).call(this)};null==(r=this.telemetry)||r.record(io(n,e,s))}),(0,td._)(this,"unmountSignIn",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountUserAvatar",(t,e)=>{var i;this.assertComponentsReady(o(this,a3));let r="UserAvatar";o(this,a3).then(t=>t.ensureMounted({preloadHint:r})).then(i=>i.mountComponent({name:r,appearanceKey:"userAvatar",node:t,props:e})),null==(i=this.telemetry)||i.record(io(r,e))}),(0,td._)(this,"unmountUserAvatar",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountSignUp",(t,e)=>{var i;this.assertComponentsReady(o(this,a3));let r="SignUp";o(this,a3).then(t=>t.ensureMounted({preloadHint:r})).then(i=>i.mountComponent({name:r,appearanceKey:"signUp",node:t,props:e})),null==(i=this.telemetry)||i.record(io(r,e))}),(0,td._)(this,"unmountSignUp",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountUserProfile",(t,e)=>{var i,r;if(!this.user){if("development"===o(this,a6))throw new tU(e$.cannotRenderComponentWhenUserDoesNotExist,{code:aK});return}this.assertComponentsReady(o(this,a3));let n="UserProfile";o(this,a3).then(t=>t.ensureMounted({preloadHint:n})).then(i=>i.mountComponent({name:n,appearanceKey:"userProfile",node:t,props:e}));let s=((null==e||null==(i=e.customPages)?void 0:i.length)||0)>0?{customPages:!0}:void 0;null==(r=this.telemetry)||r.record(io(n,e,s))}),(0,td._)(this,"unmountUserProfile",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountOrganizationProfile",(t,e)=>{var i;let{isEnabled:r}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"OrganizationProfile",onClose:()=>{throw new tU(e$.cannotRenderAnyOrganizationComponent("OrganizationProfile"),{code:aq})}});if(!r)return;let n=!!this.user;if(!this.organization&&n){if("development"===o(this,a6))throw new tU(e$.cannotRenderComponentWhenOrgDoesNotExist,{code:aH});return}this.assertComponentsReady(o(this,a3));let s="OrganizationProfile";o(this,a3).then(t=>t.ensureMounted({preloadHint:s})).then(i=>i.mountComponent({name:s,appearanceKey:"userProfile",node:t,props:e})),null==(i=this.telemetry)||i.record(io(s,e))}),(0,td._)(this,"unmountOrganizationProfile",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountCreateOrganization",(t,e)=>{var i;let{isEnabled:r}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"CreateOrganization",onClose:()=>{throw new tU(e$.cannotRenderAnyOrganizationComponent("CreateOrganization"),{code:aq})}});if(!r)return;this.assertComponentsReady(o(this,a3));let n="CreateOrganization";o(this,a3).then(t=>t.ensureMounted({preloadHint:n})).then(i=>i.mountComponent({name:n,appearanceKey:"createOrganization",node:t,props:e})),null==(i=this.telemetry)||i.record(io(n,e))}),(0,td._)(this,"unmountCreateOrganization",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountOrganizationSwitcher",(t,e)=>{var i,r;let{isEnabled:n}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"OrganizationSwitcher",onClose:()=>{throw new tU(e$.cannotRenderAnyOrganizationComponent("OrganizationSwitcher"),{code:aq})}});if(!n)return;this.assertComponentsReady(o(this,a3));let s="OrganizationSwitcher";o(this,a3).then(t=>t.ensureMounted({preloadHint:s})).then(i=>i.mountComponent({name:s,appearanceKey:"organizationSwitcher",node:t,props:e})),null==(r=this.telemetry)||r.record(io(s,{...e,forceOrganizationSelection:null==(i=this.environment)?void 0:i.organizationSettings.forceOrganizationSelection}))}),(0,td._)(this,"unmountOrganizationSwitcher",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"__experimental_prefetchOrganizationSwitcher",()=>{this.assertComponentsReady(o(this,a3)),o(this,a3).then(t=>t.ensureMounted()).then(t=>t.prefetch("organizationSwitcher"))}),(0,td._)(this,"mountOrganizationList",(t,e)=>{var i,r;let{isEnabled:n}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"OrganizationList",onClose:()=>{throw new tU(e$.cannotRenderAnyOrganizationComponent("OrganizationList"),{code:aq})}});if(!n)return;this.assertComponentsReady(o(this,a3));let s="OrganizationList";o(this,a3).then(t=>t.ensureMounted({preloadHint:s})).then(i=>i.mountComponent({name:s,appearanceKey:"organizationList",node:t,props:e})),null==(r=this.telemetry)||r.record(io(s,{...e,forceOrganizationSelection:null==(i=this.environment)?void 0:i.organizationSettings.forceOrganizationSelection}))}),(0,td._)(this,"unmountOrganizationList",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountUserButton",(t,e)=>{var i,r;this.assertComponentsReady(o(this,a3));let n="UserButton";o(this,a3).then(t=>t.ensureMounted({preloadHint:n})).then(i=>i.mountComponent({name:n,appearanceKey:"userButton",node:t,props:e}));let s={...(null==e||null==(i=e.customMenuItems)?void 0:i.length)||0?{customItems:!0}:void 0,...(null==e?void 0:e.__experimental_asStandalone)?{standalone:!0}:void 0};null==(r=this.telemetry)||r.record(io(n,e,s))}),(0,td._)(this,"unmountUserButton",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountWaitlist",(t,e)=>{var i;this.assertComponentsReady(o(this,a3));let r="Waitlist";o(this,a3).then(t=>t.ensureMounted({preloadHint:r})).then(i=>i.mountComponent({name:r,appearanceKey:"waitlist",node:t,props:e})),null==(i=this.telemetry)||i.record(io(r,e))}),(0,td._)(this,"unmountWaitlist",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountPricingTable",(t,e)=>{var i;if(tJ(this,this.environment)){if("development"===o(this,a6))throw new tU(e$.cannotRenderAnyBillingComponent("PricingTable"),{code:aV});return}this.assertComponentsReady(o(this,a3));let r="PricingTable";o(this,a3).then(t=>t.ensureMounted({preloadHint:r})).then(i=>i.mountComponent({name:r,appearanceKey:"pricingTable",node:t,props:e})),null==(i=this.telemetry)||i.record(io(r,e))}),(0,td._)(this,"unmountPricingTable",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"__internal_mountOAuthConsent",(t,e)=>{if(!this.user){if("development"===o(this,a6))throw new tU(e$.cannotRenderOAuthConsentComponentWhenUserDoesNotExist,{code:aK});return}this.assertComponentsReady(o(this,a3));let i="OAuthConsent";o(this,a3).then(t=>t.ensureMounted({preloadHint:i})).then(r=>r.mountComponent({name:i,appearanceKey:"__internal_oauthConsent",node:t,props:e}))}),(0,td._)(this,"__internal_unmountOAuthConsent",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountAPIKeys",(t,e)=>{var i;let r;if(tV(this,r=this.environment)&&tK(this,r)){if("development"===o(this,a6))throw new tU(e$.cannotRenderAPIKeysComponent,{code:"cannot_render_api_keys_disabled"});return}if(this.organization&&tK(this,this.environment)){if("development"===o(this,a6))throw new tU(e$.cannotRenderAPIKeysComponentForOrgWhenDisabled,{code:"cannot_render_api_keys_org_disabled"});return}if(tV(this,this.environment)){if("development"===o(this,a6))throw new tU(e$.cannotRenderAPIKeysComponentForUserWhenDisabled,{code:"cannot_render_api_keys_user_disabled"});return}this.assertComponentsReady(o(this,a3));let n="APIKeys";o(this,a3).then(t=>t.ensureMounted({preloadHint:n})).then(i=>i.mountComponent({name:n,appearanceKey:"apiKeys",node:t,props:e})),null==(i=this.telemetry)||i.record(io(n,e))}),(0,td._)(this,"unmountAPIKeys",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountTaskChooseOrganization",(t,e)=>{var i;let{isEnabled:r}=this.__internal_attemptToEnableEnvironmentSetting({for:"organizations",caller:"TaskChooseOrganization",onClose:()=>{throw new tU(e$.cannotRenderAnyOrganizationComponent("TaskChooseOrganization"),{code:aq})}});if(!r)return;this.assertComponentsReady(o(this,a3));let n="TaskChooseOrganization";o(this,a3).then(t=>t.ensureMounted({preloadHint:n})).then(i=>i.mountComponent({name:n,appearanceKey:"taskChooseOrganization",node:t,props:e})),null==(i=this.telemetry)||i.record(io(n,e))}),(0,td._)(this,"unmountTaskChooseOrganization",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountTaskResetPassword",(t,e)=>{var i;this.assertComponentsReady(o(this,a3));let r="TaskResetPassword";o(this,a3).then(t=>t.ensureMounted({preloadHint:r})).then(i=>i.mountComponent({name:r,appearanceKey:"taskResetPassword",node:t,props:e})),null==(i=this.telemetry)||i.record(io("TaskResetPassword",e))}),(0,td._)(this,"unmountTaskResetPassword",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"mountTaskSetupMFA",(t,e)=>{var i;this.assertComponentsReady(o(this,a3));let r="TaskSetupMFA";o(this,a3).then(t=>t.ensureMounted({preloadHint:r})).then(i=>i.mountComponent({name:r,appearanceKey:"taskSetupMfa",node:t,props:e})),null==(i=this.telemetry)||i.record(io("TaskSetupMFA",e))}),(0,td._)(this,"unmountTaskSetupMFA",t=>{var e;null==(e=o(this,a3))||e.then(t=>t.ensureMounted()).then(e=>e.unmountComponent({node:t}))}),(0,td._)(this,"setActive",async t=>{var e,i,r,n,s,a,l,c;let{organization:u,redirectUrl:h,navigate:d}=t,{session:p}=t;this.__internal_setActiveInProgress=!0,iE.debug("setActive() start",{hasClient:!!this.client,sessionTarget:"string"==typeof p?p:null!=(e=null!=(i=null==p?void 0:p.id)?i:p)?e:null,organizationTarget:"string"==typeof u?u:null!=(r=null!=(n=null==u?void 0:u.id)?n:u)?r:null,redirectUrl:null!=h?h:null},"clerk");try{let e;if(!this.client)throw iE.warn("Clerk setActive called before client is loaded",{},"clerk"),Error("setActive is being called before the client is loaded. Wait for init.");if(void 0===p&&!this.session)throw iE.warn("Clerk setActive precondition not met: no target session and no active session",{},"clerk"),Error("setActive should either be called with a session param or there should be already an active session.");"string"==typeof p&&(p=this.client.sessions.find(t=>t.id===p)||null);let i="u">typeof window&&"function"==typeof window.__internal_onBeforeSetActive?window.__internal_onBeforeSetActive:ik.lQ,r="u">typeof window&&"function"==typeof window.__internal_onAfterSetActive?window.__internal_onAfterSetActive:ik.lQ,n=void 0===p?this.session:p;(null==n?void 0:n.status)==="pending"&&(c={...o(this,ot),...t},e=["taskUrls","navigate"],Object.keys(c).some(t=>e.includes(t))||er('Clerk: Session has pending tasks but no handling is configured. To handle pending tasks, provide either "taskUrls" for navigation to custom URLs or "navigate" for programmatic navigation. Without these options, users may get stuck on incomplete flows.'));let f=void 0!==u;if(n&&f){let t="string"==typeof u?u:null==u?void 0:u.id;if("string"==typeof t&&t.startsWith("org_"))n.lastActiveOrganizationId=t||null;else{let e=n.user.organizationMemberships.find(e=>e.organization.slug===t),i=(null==e?void 0:e.organization.id)||null,r=null===i;if((null==(l=this.environment)||null==(a=l.organizationSettings)?void 0:a.forceOrganizationSelection)&&r)return;n.lastActiveOrganizationId=i}}(null==n?void 0:n.status)!=="pending"&&await i(null===n?"sign-out":void 0);let _=(null==n?void 0:n.status)==="pending"&&(null==n?void 0:n.currentTask)&&(null==(s=o(this,ot).taskUrls)?void 0:s[null==n?void 0:n.currentTask.key]),g=!!(h||_||d),v=f?"select_org":"select_session";if(iq()&&globalThis.document.hasFocus()||!o(this,ot).standardBrowser){let t;if(g&&n)try{(t=await n.__internal_touch({intent:v}))&&this.updateClient(t,{__internal_dangerouslySkipEmit:!0})}catch(t){if(tL(t))this.handleUnauthenticated();else throw t}else await o(this,oy).call(this,n,v);n=o(this,oU).call(this,null==n?void 0:n.id,t)}try{await (null==n?void 0:n.getToken())||nx.emit(nS,{token:null})}catch(t){if(tR.is(t))iE.warn("Token fetch failed when setting active session (offline). Preserving existing auth state.",{sessionId:null==n?void 0:n.id},"clerk");else throw t}let m=iW(o(this,ot).standardBrowser);if(g&&await m.track(async()=>{if(this.client){if((null==n?void 0:n.status)!=="pending"&&o(this,ok).call(this),_){let t=h?ey({base:_,hashSearchParams:{redirectUrl:h}},{stringify:!0}):_;await this.navigate(t)}else if(d&&n){let t=!1,e=e=>{var i;if(t=!0,!(null==(i=this.client)?void 0:i.isEligibleForTouch()))return e;let r=new URL(e,window.location.href),n=this.client.buildTouchUrl({redirectUrl:r});return this.buildUrlWithAuth(n)};await d({session:n,decorateUrl:e}),"development"===o(this,a6)&&!t&&this.client.isEligibleForTouch()&&er("Clerk: The navigate callback in setActive() did not call decorateUrl(). In Safari, sessions may be limited to 7 days due to Intelligent Tracking Prevention (ITP). Use decorateUrl() to wrap your destination URL to enable the ITP workaround. Learn more: https://clerk.com/docs/troubleshooting/safari-itp")}else if(h){if(this.client.isEligibleForTouch()){let t=new URL(h,window.location.href),e=this.buildUrlWithAuth(this.client.buildTouchUrl({redirectUrl:t}));await this.navigate(e)}await this.navigate(h)}}}),m.isUnloading())return;o(this,oI).call(this,n),(null==n?void 0:n.status)!=="pending"&&await r()}finally{this.__internal_setActiveInProgress=!1}}),(0,td._)(this,"addListener",(t,e)=>{var i;let r;return i=t,t=t=>{var e;r||(r={...t}),i(r={...{client:ap((e=r).client,t.client),session:ap(e.session,t.session),user:ap(e.user,t.user),organization:ap(e.organization,t.organization)}})},o(this,a9).push(t),!this.client||(null==e?void 0:e.skipInitialEmit)||t({client:this.client,session:this.session,user:this.user,organization:this.organization}),()=>{u(this,a9,o(this,a9).filter(e=>e!==t))}}),(0,td._)(this,"on",function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];o(r,or).on(...e)}),(0,td._)(this,"off",function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];o(r,or).off(...e)}),(0,td._)(this,"__internal_addNavigationListener",t=>(o(this,a7).push(t),()=>{u(this,a7,o(this,a7).filter(e=>e!==t))})),(0,td._)(this,"navigate",async(t,e)=>{if(!t||!iq())return;if(void 0===window.location){let i=(null==e?void 0:e.replace)&&o(this,ot).routerReplace?o(this,ot).routerReplace:o(this,ot).routerPush;return i?(iE.info("Clerk is navigating to: ".concat(t)),await i(t,{windowNavigate:eQ})):void 0}setTimeout(()=>{o(this,ob).call(this)},0);let i=new URL(t,window.location.href);o(this,oR).includes(i.protocol)||(console.warn('Clerk: "'.concat(i.protocol,'" is not a valid protocol. Redirecting to "/" instead. If you think this is a mistake, please open an issue.')),i=new URL("/",window.location.href));let r=(null==e?void 0:e.replace)&&o(this,ot).routerReplace?o(this,ot).routerReplace:o(this,ot).routerPush;if(iE.info("Clerk is navigating to: ".concat(i)),o(this,ot).routerDebug&&console.log("Clerk is navigating to: ".concat(i)),"null"!==i.origin&&i.origin!==window.location.origin||!r)return void eQ(i);let n={...(null==e?void 0:e.metadata)?{__internal_metadata:null==e?void 0:e.metadata}:{},windowNavigate:eQ};return await r(ew(i),n)}),c(this,os,{writable:!0,value:t=>{try{let e=new URL(t,window.location.origin);return e.searchParams.set(tq,tH),e.toString()}catch{return t}}}),c(this,oa,{writable:!0,value:t=>{if(!t)return t;let e={...t};return e.signInForceRedirectUrl&&(e.signInForceRedirectUrl=o(this,os).call(this,e.signInForceRedirectUrl)),e.signInFallbackRedirectUrl&&(e.signInFallbackRedirectUrl=o(this,os).call(this,e.signInFallbackRedirectUrl)),e.signUpForceRedirectUrl&&(e.signUpForceRedirectUrl=o(this,os).call(this,e.signUpForceRedirectUrl)),e.signUpFallbackRedirectUrl&&(e.signUpFallbackRedirectUrl=o(this,os).call(this,e.signUpFallbackRedirectUrl)),e}}),c(this,oo,{writable:!0,value:async()=>{if(!iq())return;let t=new URLSearchParams({[tq]:tG}),e=ej(tY);e&&eZ(e)||function(){throw Error("".concat(i$," Invalid redirect_url. A valid http or https url should be used for the redirection."))}();let i=ey({base:ej(tY),searchParams:t},{stringify:!0});return this.navigate(this.buildUrlWithAuth(i))}}),(0,td._)(this,"redirectWithAuth",async t=>{if(iq())return this.navigate(this.buildUrlWithAuth(t))}),(0,td._)(this,"redirectToSignIn",async t=>{if(iq())return this.navigate(this.buildSignInUrl(t))}),(0,td._)(this,"redirectToSignUp",async t=>{if(iq())return this.navigate(this.buildSignUpUrl(t))}),(0,td._)(this,"redirectToUserProfile",async()=>{if(iq())return this.navigate(this.buildUserProfileUrl())}),(0,td._)(this,"redirectToCreateOrganization",async()=>{if(iq())return this.navigate(this.buildCreateOrganizationUrl())}),(0,td._)(this,"redirectToOrganizationProfile",async()=>{if(iq())return this.navigate(this.buildOrganizationProfileUrl())}),(0,td._)(this,"redirectToAfterSignIn",async()=>{if(iq())return this.navigate(this.buildAfterSignInUrl())}),(0,td._)(this,"redirectToAfterSignUp",async()=>{if(iq())return this.navigate(this.buildAfterSignUpUrl())}),(0,td._)(this,"redirectToAfterSignOut",async()=>{if(iq())return this.navigate(this.buildAfterSignOutUrl())}),(0,td._)(this,"redirectToWaitlist",async()=>{if(iq())return this.navigate(this.buildWaitlistUrl())}),(0,td._)(this,"redirectToTasks",async t=>{if(iq())return this.navigate(this.buildTasksUrl(t))}),(0,td._)(this,"handleEmailLinkVerification",async(t,e)=>{if(!this.client)return;let i=ej("__clerk_status");if("expired"===i)throw new tz("expired");if("client_mismatch"===i)throw new tz("client_mismatch");if("verified"!==i)throw new tz("failed");let r=ej("__clerk_created_session"),{signIn:n,signUp:s,sessions:a}=this.client,o=a.some(t=>t.id===r),l="needs_second_factor"===n.status||"missing_requirements"===s.status,c=t=>e&&"function"==typeof e?e(t):this.navigate(t),u=t.redirectUrl?()=>c(t.redirectUrl):ik.lQ;return o?this.setActive({session:r,redirectUrl:t.redirectUrlComplete}):l?u():("function"==typeof t.onVerifiedOnOtherDevice&&t.onVerifiedOnOtherDevice(),null)}),(0,td._)(this,"handleGoogleOneTapCallback",async(t,e,i)=>{if(!this.loaded||!this.environment||!this.client)return;let{signIn:r,signUp:n}=this.client,s="identifier"in(t||{})?t:r,a="missingFields"in(t||{})?t:n,o=t=>i&&"function"==typeof i?i(this.buildUrlWithAuth(t)):this.navigate(this.buildUrlWithAuth(t));return this._handleRedirectCallback(e,{signUp:a,signIn:s,navigate:o})}),(0,td._)(this,"_handleRedirectCallback",async(t,e)=>{var i,r,n,s,a,l,c,u;let{signIn:h,signUp:d,navigate:p}=e;if(!this.loaded||!this.environment||!this.client)return;if(!window.opener&&t.reloadResource)try{"signIn"===t.reloadResource?await h.reload():"signUp"===t.reloadResource&&await d.reload()}catch{}let{displayConfig:f}=this.environment,{firstFactorVerification:_}=h,{externalAccount:g}=d.verifications,v={status:d.status,missingFields:d.missingFields,externalAccountStatus:g.status,externalAccountErrorCode:null==(i=g.error)?void 0:i.code,externalAccountSessionId:null==(n=g.error)||null==(r=n.meta)?void 0:r.sessionId,sessionId:d.createdSessionId},m={status:h.status,firstFactorVerificationStatus:_.status,firstFactorVerificationErrorCode:null==(s=_.error)?void 0:s.code,firstFactorVerificationSessionId:null==(l=_.error)||null==(a=l.meta)?void 0:a.sessionId,sessionId:h.createdSessionId},y=t=>()=>p(t),w=y(t.signInUrl||f.signInUrl),b=y(t.signUpUrl||f.signUpUrl),k=y(t.firstFactorUrl||ey({base:f.signInUrl,hashPath:"/factor-one"},{stringify:!0})),S=y(t.secondFactorUrl||ey({base:f.signInUrl,hashPath:"/factor-two"},{stringify:!0})),A=y(t.resetPasswordUrl||ey({base:f.signInUrl,hashPath:"/reset-password"},{stringify:!0})),I=new eT(o(this,ot),t),U=y(t.continueSignUpUrl||ey({base:f.signUpUrl,hashPath:"/continue"},{stringify:!0})),x=e=>{let{missingFields:i}=e;return i.length?U():(t=>{let{signUp:e,verifyEmailPath:i,verifyPhonePath:r,continuePath:n,navigate:s,handleComplete:a,redirectUrl:o="",redirectUrlComplete:l="",oidcPrompt:c}=t;if("complete"===e.status)return a&&a();if("missing_requirements"===e.status){var u,h;if(e.missingFields.some(t=>"enterprise_sso"===t))return e.authenticateWithRedirect({strategy:"enterprise_sso",redirectUrl:o,redirectUrlComplete:l,continueSignUp:!0,oidcPrompt:c});let t=eJ();if((null==(u=e.unverifiedFields)?void 0:u.includes("email_address"))&&i)return s(i,{searchParams:t});if((null==(h=e.unverifiedFields)?void 0:h.includes("phone_number"))&&r)return s(r,{searchParams:t});if(n)return s(n,{searchParams:t})}})({signUp:d,verifyEmailPath:t.verifyEmailAddressUrl||ey({base:f.signUpUrl,hashPath:"/verify-email-address"},{stringify:!0}),verifyPhonePath:t.verifyPhoneNumberUrl||ey({base:f.signUpUrl,hashPath:"/verify-phone-number"},{stringify:!0}),navigate:p})},C=t.signInUrl||f.signInUrl,E=t.signUpUrl||f.signUpUrl,P=async t=>{let{session:e,baseUrl:i,redirectUrl:r}=t;e.currentTask?await eq(e,{baseUrl:i,navigate:this.navigate}):await this.navigate(r)};if("complete"===m.status)return this.setActive({session:m.sessionId,navigate:async t=>{let{session:e}=t;await P({session:e,baseUrl:C,redirectUrl:I.getAfterSignInUrl()})}});if("transferable"===v.externalAccountStatus&&"external_account_exists"===v.externalAccountErrorCode){let t=await h.create({transfer:!0});switch(t.status){case"complete":return this.setActive({session:t.createdSessionId,navigate:async t=>{let{session:e}=t;await P({session:e,baseUrl:E,redirectUrl:I.getAfterSignInUrl()})}});case"needs_first_factor":return k();case"needs_second_factor":return S();case"needs_new_password":return A();default:iX("sign in")}}let T="user_locked"===v.externalAccountErrorCode,O="user_locked"===m.firstFactorVerificationErrorCode;if(T)return b();if(O)return w();if("needs_first_factor"===m.status&&!(null==(c=h.supportedFirstFactors)?void 0:c.every(t=>"enterprise_sso"===t.strategy)))return k();if("needs_new_password"===m.status)return A();if("transferable"===m.firstFactorVerificationStatus){if(!1===t.transferable)return w();let e=await d.create({transfer:!0,unsafeMetadata:t.unsafeMetadata});switch(e.status){case"complete":return this.setActive({session:e.createdSessionId,navigate:async t=>{let{session:e}=t;await P({session:e,baseUrl:E,redirectUrl:I.getAfterSignUpUrl()})}});case"missing_requirements":return x({missingFields:e.missingFields});default:iX("sign in")}}if("complete"===v.status)return this.setActive({session:v.sessionId,navigate:async t=>{let{session:e}=t;await P({session:e,baseUrl:E,redirectUrl:I.getAfterSignUpUrl()})}});if("needs_second_factor"===m.status)return S();let R=("failed"===v.externalAccountStatus||"unverified"===v.externalAccountStatus)&&"identifier_already_signed_in"===v.externalAccountErrorCode&&v.externalAccountSessionId,M="failed"===m.firstFactorVerificationStatus&&"identifier_already_signed_in"===m.firstFactorVerificationErrorCode&&m.firstFactorVerificationSessionId;if(R||M){let t=m.firstFactorVerificationSessionId||v.externalAccountSessionId;if(t)return this.setActive({session:t,navigate:async t=>{let{session:e}=t;await P({session:e,baseUrl:R?E:C,redirectUrl:I.getAfterSignInUrl()})}})}return(t=>{let{externalAccount:e}=t.verifications;return!!e.error})(d)?b():"verified"===v.externalAccountStatus&&"missing_requirements"===v.status?x({missingFields:d.missingFields}):(null==(u=this.session)?void 0:u.currentTask)?void await this.redirectToTasks({redirectUrl:this.buildAfterSignInUrl()}):w()}),(0,td._)(this,"handleRedirectCallback",async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;if(!r.loaded||!r.environment||!r.client)return;let{signIn:i,signUp:n}=r.client;return r._handleRedirectCallback(t,{signUp:n,signIn:i,navigate:t=>e&&"function"==typeof e?e(t):r.navigate(t)})}),(0,td._)(this,"handleUnauthenticated",async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{broadcast:!0};if(r.client&&r.session)try{let e=await nL.getOrCreateInstance().fetch();if(r.updateClient(e),r.session)return;return t.broadcast&&nx.emit(nA,null),r.setActive({session:null})}catch(t){if(tT(t)&&[403,500].includes(t.status))return r.setActive({session:null});throw t}}),(0,td._)(this,"__internal_handleUnauthenticatedDevBrowser",async()=>{o(this,a0)&&await o(this,a0).handleUnauthenticatedDevBrowser()}),(0,td._)(this,"authenticateWithGoogleOneTap",async t=>{var e;return null==(e=this.client)?void 0:e.signIn.create({strategy:"google_one_tap",token:t.token}).catch(e=>{if(tT(e)&&"external_account_not_found"===e.errors[0].code){var i;return null==(i=this.client)?void 0:i.signUp.create({strategy:"google_one_tap",token:t.token,legalAccepted:t.legalAccepted})}throw e})}),(0,td._)(this,"authenticateWithMetamask",async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};await r.authenticateWithWeb3({...t,strategy:"web3_metamask_signature"})}),(0,td._)(this,"authenticateWithCoinbaseWallet",async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};await r.authenticateWithWeb3({...t,strategy:"web3_coinbase_wallet_signature"})}),(0,td._)(this,"authenticateWithBase",async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};await r.authenticateWithWeb3({...t,strategy:"web3_base_signature"})}),(0,td._)(this,"authenticateWithOKXWallet",async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};await r.authenticateWithWeb3({...t,strategy:"web3_okx_wallet_signature"})}),(0,td._)(this,"authenticateWithSolana",async t=>{await this.authenticateWithWeb3({...t,strategy:"web3_solana_signature"})}),(0,td._)(this,"authenticateWithWeb3",async t=>{let e,i,{redirectUrl:r,signUpContinueUrl:n,customNavigate:s,unsafeMetadata:a,strategy:o,legalAccepted:l,secondFactorUrl:c,walletName:u}=t;if(!this.client||!this.environment)return;let{displayConfig:h}=this.environment,d=o.replace("web3_","").replace("_signature",""),p=await rv().getWeb3Identifier({provider:d,walletName:u});switch(d){case"metamask":e=rv().generateSignatureWithMetamask;break;case"base":e=rv().generateSignatureWithBase;break;case"coinbase_wallet":e=rv().generateSignatureWithCoinbaseWallet;break;case"solana":if(!u)throw new tU("Wallet name is required for Solana authentication.",{code:"web3_solana_wallet_name_required"});e=t=>rv().generateSignatureWithSolana({...t,walletName:u});break;default:e=rv().generateSignatureWithOKXWallet}let f=t=>()=>s&&"function"==typeof s?s(t):this.navigate(t),_=f(c||ey({base:h.signInUrl,hashPath:"/factor-two"},{stringify:!0})),g=f(n||ey({base:h.signUpUrl,hashPath:"/continue"},{stringify:!0}));try{i=await this.client.signIn.authenticateWithWeb3({identifier:p,generateSignature:e,strategy:o,walletName:u})}catch(t){if(iB(t,"form_identifier_not_found"))i=await this.client.signUp.authenticateWithWeb3({identifier:p,generateSignature:e,unsafeMetadata:a,strategy:o,legalAccepted:l,walletName:u}),n&&"missing_requirements"===i.status&&"verified"===i.verifications.web3Wallet.status&&await g();else throw t}let v=async t=>{let{session:e,redirectUrl:i}=t;e.currentTask?await eq(e,{baseUrl:h.signInUrl,navigate:this.navigate}):await this.navigate(i)};switch(i.status){case"needs_second_factor":await _();break;case"complete":i.createdSessionId&&await this.setActive({session:i.createdSessionId,navigate:async t=>{let{session:e}=t;await v({session:e,redirectUrl:null!=r?r:this.buildAfterSignInUrl()})}});break;default:return}}),(0,td._)(this,"createOrganization",async t=>{let{name:e,slug:i}=t;return su.create({name:e,slug:i})}),(0,td._)(this,"getOrganization",async t=>su.get(t)),(0,td._)(this,"joinWaitlist",async t=>{let{emailAddress:e}=t;return ah.join({emailAddress:e})}),(0,td._)(this,"__internal_setCountry",t=>{this.__internal_country||(this.__internal_country=t)}),(0,td._)(this,"updateClient",(t,e)=>{if(!this.client){let e=o(this,ot).selectInitialSession?o(this,ot).selectInitialSession(t):o(this,ov).call(this,t);o(this,oI).call(this,e,{dangerouslySkipEmit:!0})}if(this.client=t,this.session){var i,r,n;let e=o(this,oU).call(this,this.session.id,t);"active"===this.session.status&&(null==e?void 0:e.status)==="pending"&&("u">typeof window&&"function"==typeof window.__internal_onAfterSetActive?window.__internal_onAfterSetActive:ik.lQ)(),o(this,oI).call(this,e,{dangerouslySkipEmit:!0}),(null==(i=this.session)?void 0:i.lastActiveToken)||tv()||iE.warn("No last active token when updating client (offline)",{sessionId:null==(n=this.session)?void 0:n.id},"clerk"),nx.emit(nS,{token:null==(r=this.session)?void 0:r.lastActiveToken})}(null==e?void 0:e.__internal_dangerouslySkipEmit)||o(this,ow).call(this)}),(0,td._)(this,"__internal_setEnvironment",async t=>{this.environment=new se(t)}),(0,td._)(this,"__internal_onBeforeRequest",t=>{o(this,a5).onBeforeRequest(t)}),(0,td._)(this,"__internal_onAfterResponse",t=>{o(this,a5).onAfterResponse(t)}),(0,td._)(this,"__internal_updateProps",t=>{var e;let i={...t,options:o(this,oT).call(this,{...o(this,ot),...t.options})};return null==(e=o(this,a3))?void 0:e.then(t=>t.ensureMounted()).then(t=>t.updateProps(i))}),c(this,ol,{writable:!0,value:()=>{let t=new URLSearchParams({[tY]:window.location.href});return ey({base:o(this,ot).signInUrl,searchParams:t},{stringify:!0})}}),c(this,oc,{writable:!0,value:()=>{let t;if(this.proxyUrl){let e=new URL(this.proxyUrl);t=new URL("".concat(e.pathname,"/v1/client/sync"),e.origin)}else this.domain&&(t=new URL("/v1/client/sync","https://".concat(this.domain)));return null==t||t.searchParams.append("redirect_url",window.location.href),(null==t?void 0:t.toString())||""}}),c(this,ou,{writable:!0,value:()=>{var t;let e=ej(tq);return e!==tG&&!!this.isSatellite&&(e===tH||!0===o(this,ot).satelliteAutoSync&&!!(null==(t=o(this,a0))?void 0:t.isSignedOut()))}}),c(this,oh,{writable:!0,value:()=>"production"!==o(this,a6)&&!this.isSatellite&&!!ej(tY)}),c(this,od,{writable:!0,value:async()=>{"development"===this.instanceType?await this.navigate(o(this,ol).call(this)):"production"===this.instanceType&&await this.navigate(o(this,oc).call(this))}}),c(this,op,{writable:!0,value:(t,e)=>{let i;try{i=new URL(t)}catch{throw Error("".concat(i$," The signInUrl needs to have a absolute url format."))}i.origin===e&&function(){throw Error("".concat(i$," The signInUrl needs to be on a different origin than your satellite application."))}()}}),c(this,of,{writable:!0,value:()=>{this.isSatellite&&("development"!==o(this,a6)||o(this,ot).signInUrl||function(){throw Error("".concat(i$," Missing signInUrl. A satellite application needs to specify the signInUrl for development instances."))}(),this.proxyUrl||this.domain||function(){throw Error("".concat(i$," Missing domain and proxyUrl. A satellite application needs to specify a domain or a proxyUrl."))}(),o(this,ot).signInUrl&&o(this,op).call(this,o(this,ot).signInUrl,window.location.origin))}}),c(this,o_,{writable:!0,value:async()=>{var t,e;if(u(this,a0,await aT.create(this,o(this,a5),o(this,a6),o(this,or))),o(this,of).call(this),o(this,ou).call(this))return void await o(this,od).call(this);if(o(this,oh).call(this))return void await o(this,oo).call(this);u(this,oe,(()=>{if(!tp())return{onPageFocus:ik.lQ};let t=[];return window.addEventListener("focus",()=>{"visible"===document.visibilityState&&t.forEach(t=>t())}),{onPageFocus:e=>{t.push(e)}}})()),"u">typeof BroadcastChannel&&u(this,a8,new BroadcastChannel("clerk")),o(this,om).call(this);let i=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.hostname;if(!t)return!1;let e=ev.get(t);void 0===e&&(e=t0.some(e=>t.startsWith("accounts.")&&t.endsWith(e))||t1.some(e=>t.endsWith(e)&&!t.endsWith(".clerk"+e)),ev.set(t,e));return e}(null==(t=window)?void 0:t.location.hostname),r="development"===o(this,a6)&&!i,n=0,s=0;for(;s<2;){s++;try{let t=se.getInstance().fetch({touch:r}).then(t=>this.updateEnvironment(t)).catch(()=>{++n;let t=rb.getItem(rm,null);t&&this.updateEnvironment(new se(t))}),i=async()=>nL.getOrCreateInstance().fetch().then(t=>this.updateClient(t)).catch(async t=>{var e,i,r;if(tD(t))throw t;++n;let s=null==(e=o(this,a0))?void 0:e.getSessionCookie(),a=function(t){let e;try{e=new ae({jwt:t||"",object:"token",id:void 0})}catch{e=null}if(nL.clearInstance(),!(null==e?void 0:e.jwt))return nL.getOrCreateInstance({object:"client",last_active_session_id:null,id:"client_init",sessions:[]});let{sessionId:i,userId:r,orgId:n,orgRole:s,orgPermissions:a,orgSlug:o,factorVerificationAge:l}=(t=>{var e,i,r,n,s,a,o,l;let c,u,h,d,p=null!=(e=t.fva)?e:null,f=null!=(i=t.sts)?i:null;if(2===t.v){if(t.o){c=null==(r=t.o)?void 0:r.id,h=null==(n=t.o)?void 0:n.slg,(null==(s=t.o)?void 0:s.rol)&&(u="org:".concat(null==(a=t.o)?void 0:a.rol));let{org:e}=sC(t.fea),{permissions:i,featurePermissionMap:p}=(t=>{let{per:e,fpm:i}=t;if(!e||!i)return{permissions:[],featurePermissionMap:[]};let r=e.split(",").map(t=>t.trim());return{permissions:r,featurePermissionMap:i.split(",").map(t=>Number.parseInt(t.trim(),10)).map(t=>t.toString(2).padStart(r.length,"0").split("").map(t=>Number.parseInt(t,10)).reverse()).filter(Boolean)}})({per:null==(o=t.o)?void 0:o.per,fpm:null==(l=t.o)?void 0:l.fpm});d=function(t){let{features:e,permissions:i,featurePermissionMap:r}=t;if(!e||!i||!r)return[];let n=[];for(let t=0;t<e.length;t++){let s=e[t];if(t>=r.length)continue;let a=r[t];if(a)for(let t=0;t<a.length;t++)1===a[t]&&n.push("org:".concat(s,":").concat(i[t]))}return n}({features:e,featurePermissionMap:p,permissions:i})}}else c=t.org_id,u=t.org_role,h=t.org_slug,d=t.org_permissions;return{sessionClaims:t,sessionId:t.sid,sessionStatus:f,actor:t.act,userId:t.sub,orgId:c,orgRole:u,orgSlug:h,orgPermissions:d,factorVerificationAge:p}})(e.jwt.claims),c={object:"client",last_active_session_id:i,id:"client_init",sessions:[{object:"session",id:i,status:"active",last_active_organization_id:n||null,last_active_token:{id:void 0,object:"token",jwt:t},factor_verification_age:l||null,public_user_data:{user_id:r},user:{object:"user",id:r,organization_memberships:n&&o&&s?[{object:"organization_membership",id:n,role:s,permissions:a||[],organization:{object:"organization",id:n,name:o,slug:o,members_count:1,max_allowed_memberships:1}}]:[]}}]};return nL.getOrCreateInstance(c)}(s);return this.updateClient(a),null==(i=o(this,a0))||i.stopPollingForToken(),await (null==(r=this.session)?void 0:r.getToken({skipCache:!0}).catch(()=>null).finally(()=>{var t;null==(t=o(this,a0))||t.startPollingForToken()})),null}),[,s]=await (0,ik.vd)([t,i()]);if("rejected"===s.status){let t=s.reason;if(iB(t,"requires_captcha"))await i();else throw t}if(null==(e=o(this,a0))||e.setClientUatCookieForDevelopmentInstances(),await o(this,oP).call(this))return;break}catch(t){if(iB(t,"dev_browser_unauthenticated"))await o(this,a0).handleUnauthenticatedDevBrowser();else if(!tv())return void console.warn(t);else throw t}s>=2&&function(){throw Error("".concat(i$," Something went wrong initializing Clerk."))}()}u(this,a2,new aO(this)),o(this,a2).start(),o(this,oO).call(this),o(this,ox).call(this),o(this,oC).call(this),o(this,or).emit(tk,n>0?"degraded":"ready")}}),(0,td._)(this,"shouldFallbackToCachedResources",()=>!!this.__internal_getCachedResources),c(this,og,{writable:!0,value:async()=>{let t,e,i=this.shouldFallbackToCachedResources()?1:void 0,r=0;try{[t,e]=await Promise.all([se.getInstance().fetch({touch:!1,fetchMaxTries:i}),nL.getOrCreateInstance().fetch({fetchMaxTries:i})])}catch(i){if(tx(i)&&"network_error"===i.code&&this.shouldFallbackToCachedResources()){var n;let i=await (null==(n=this.__internal_getCachedResources)?void 0:n.call(this));t=new se(null==i?void 0:i.environment),nL.clearInstance(),e=nL.getOrCreateInstance(null==i?void 0:i.client),++r}else throw i}this.updateClient(e),this.updateEnvironment(t),o(this,or).emit(tk,r>0?"degraded":"ready")}}),(0,td._)(this,"__internal_reloadInitialResources",async()=>{let[t,e]=await Promise.all([se.getInstance().fetch({touch:!1,fetchMaxTries:1}),nL.getOrCreateInstance().fetch({fetchMaxTries:1})]);this.updateClient(e),this.updateEnvironment(t),o(this,ow).call(this)}),c(this,ov,{writable:!0,value:t=>{if(t.lastActiveSessionId){let e=t.signedInSessions.find(e=>e.id===t.lastActiveSessionId);if(e)return e}return t.signedInSessions[0]||null}}),c(this,om,{writable:!0,value:()=>{var t,e;tp()&&(null==(t=o(this,oe))||t.onPageFocus(()=>{this.session&&!(!(this.environment&&!this.environment.authConfig.singleSessionMode)&&o(this,oi)>Date.now())&&(u(this,oi,Date.now()+5e3),o(this,ot).touchSession&&o(this,oy).call(this,this.session,"focus"))}),null==(e=o(this,a8))||e.addEventListener("message",t=>{var e;(null==(e=t.data)?void 0:e.type)==="signout"&&this.handleUnauthenticated({broadcast:!1})}),nx.on(nA,()=>{var t;null==(t=o(this,a8))||t.postMessage({type:"signout"})}),nx.on(nI,()=>{var t;rb.setItem(rm,null==(t=this.environment)?void 0:t.__internal_toSnapshot(),864e5)}))}}),c(this,oy,{writable:!0,value:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"focus";if(!t)return Promise.resolve();await t.touch({intent:e}).catch(t=>{if(tL(t))r.handleUnauthenticated();else throw t})}}),(0,td._)(this,"__internal_lastEmittedResources",void 0),c(this,ow,{writable:!0,value:()=>{if(this.client){let t={client:this.client,session:this.session,user:this.user,organization:this.organization};for(let e of(this.__internal_lastEmittedResources=t,o(this,a9)))e(t)}}}),c(this,ob,{writable:!0,value:()=>{for(let t of o(this,a7))t()}}),c(this,ok,{writable:!0,value:()=>{this.session=void 0,this.organization=void 0,this.user=void 0,o(this,ow).call(this)}}),c(this,oS,{writable:!0,value:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.session;return((null==t?void 0:t.user.organizationMemberships)||[]).map(t=>t.organization).find(e=>e.id===(null==t?void 0:t.lastActiveOrganizationId))||null}}),c(this,oA,{writable:!0,value:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.session;return{session:t||null,organization:o(r,oS).call(r,t),user:t?t.user:null}}}),c(this,oI,{writable:!0,value:(t,e)=>{let{session:i,organization:r,user:n}=o(this,oA).call(this,t);this.session=i,this.organization=r,this.user=n,(null==e?void 0:e.dangerouslySkipEmit)||o(this,ow).call(this)}}),c(this,oU,{writable:!0,value:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.client;return(null==e?void 0:e.signedInSessions.find(e=>e.id===t))||null}}),c(this,ox,{writable:!0,value:()=>{this.addListener(t=>{let{session:e}=t;if(null==e?void 0:e.actor){var i;null==(i=o(this,a3))||i.then(t=>t.ensureMounted()).then(t=>t.mountImpersonationFab())}})}}),c(this,oC,{writable:!0,value:()=>{if(o(this,ot).__internal_keyless_claimKeylessApplicationUrl){var t;null==(t=o(this,a3))||t.then(t=>t.ensureMounted()).then(t=>{t.updateProps({options:{__internal_keyless_claimKeylessApplicationUrl:o(this,ot).__internal_keyless_claimKeylessApplicationUrl,__internal_keyless_copyInstanceKeysUrl:o(this,ot).__internal_keyless_copyInstanceKeysUrl,__internal_keyless_dismissPrompt:o(this,ot).__internal_keyless_dismissPrompt}})})}}}),c(this,oE,{writable:!0,value:(t,e,i)=>{if(!t||!this.loaded||!this.environment||!this.environment.displayConfig)return"";let r=o(this,ot)[t]||this.environment.displayConfig[t];h(this,on,oz).call(this)&&(r=o(this,ot).signInUrl);let n=new eT(o(this,ot),e).toSearchParams(),s=new URLSearchParams(i||{}),a=ey({base:r,hashPath:h(this,on,oz).call(this)&&"signUpUrl"===t?"/create":"",hashSearchParams:[s,n]},{stringify:!0});return this.buildUrlWithAuth(a)}}),c(this,oP,{writable:!0,value:async()=>{var t,e,i;let r,n,s,a,l=new URLSearchParams(window.location.search).get("redirect_url"),c="production"===this.instanceType,u=null!==l&&(i=this.frontendApi,n=(r=new URL(l,ef)).pathname,s=eA.includes(n)||eI.includes(n),i===r.host&&s);if(c||!u)return!1;let h=this.session,d=o(this,ot).signInUrl||(null==(t=this.environment)?void 0:t.displayConfig.signInUrl),p=d&&window.location.href.startsWith(d),f=o(this,ot).signUpUrl||(null==(e=this.environment)?void 0:e.displayConfig.signUpUrl),_=f&&window.location.href.startsWith(f);return a=new URL(l,ef),(!eA.includes(a.pathname)||!!h||!p&&!_)&&(await this.navigate(this.buildUrlWithAuth(l)),!0)}}),c(this,oT,{writable:!0,value:t=>{var e;let i=null!=(e=null==t?void 0:t.clerkUICtor)?e:null==t?void 0:t.clerkUiCtor,r=i?{...null==t?void 0:t.ui,ClerkUI:i}:null==t?void 0:t.ui;return{...a$,...t,ui:r,allowedRedirectOrigins:function(t,e,i){if(Array.isArray(t)&&t.length)return t;let r=[];return"u">typeof window&&window.location&&r.push(window.location.origin),r.push("https://".concat(em(e))),r.push("https://*.".concat(em(e))),"development"===i&&r.push("https://".concat(e)),r}(null==t?void 0:t.allowedRedirectOrigins,this.frontendApi,this.instanceType)}}}),c(this,oO,{writable:!0,value:()=>{try{eB(tq),eB(eD),eB(t$),eB("__clerk_handshake"),eB("__clerk_handshake_nonce"),eB("__clerk_help")}catch{}}}),!(t=(t||"").trim()))return iJ.throwMissingPublishableKeyError();const n=t5(t);if(!n)return iJ.throwInvalidPublishableKeyError({key:t});u(this,aQ,null==e?void 0:e.domain),u(this,aZ,null==e?void 0:e.proxyUrl),this.environment=se.getInstance(),u(this,a6,n.instanceType),u(this,aX,t),u(this,a5,function(t){let e=[],i=[];async function r(t){for await(let i of["u">typeof window&&window.__internal_onBeforeRequest,...e].filter(t=>t))if(await i(t)===!1)return!1;return!0}async function n(t,e){for await(let r of["u">typeof window&&window.__internal_onAfterResponse,...i].filter(t=>t))if(await r(t,e)===!1)return!1;return!0}function s(e){let{method:i,path:r,sessionId:n,search:s,rotatingTokenNonce:a}=e,o=new URLSearchParams(s);return o.append("__clerk_api_version","2025-11-10"),o.append("_clerk_js_version","6.7.5"),a&&o.append("rotating_token_nonce",a),t.domain&&"development"===t.instanceType&&t.isSatellite&&o.append("__domain",t.domain),i&&"GET"!==i&&"POST"!==i&&o.append("_method",i),r&&!aR.some(t=>r.startsWith(t))&&n&&o.append("_clerk_session_id",n),ep([...o.entries()].reduce((t,e)=>{let[i,r]=e;return t[i]=r.includes(",")?r.split(","):r,t},{}))}function a(e){let{path:i,pathPrefix:r="v1"}=e;if(t.proxyUrl){let n=new URL(t.proxyUrl),a=n.pathname.slice(1);return a.endsWith("/")&&(a=a.slice(0,-1)),ey({base:n.origin,pathname:"".concat(a,"/").concat(r).concat(i),search:s(e)},{stringify:!1})}let n="production"===t.instanceType?t.domain:"";return ey({base:"https://".concat(n||t.frontendApi),pathname:"".concat(r).concat(i),search:s(e)},{stringify:!1})}async function o(e,i){let s,o={...e},{method:l="GET",body:c}=o;!c||"object"!=typeof c||c instanceof FormData||(o.body=function(t){if(!t||"object"!=typeof t||Object.getPrototypeOf(t)!==Object.prototype)return t;let e={};for(let[i,r]of Object.entries(t))void 0!==r&&(e[i]=r);return e}(c)),o.url=a({...o,sessionId:t.getSessionId()}),o.headers=new Headers(o.headers),"GET"===l||c instanceof FormData||o.headers.has("content-type")||o.headers.set("content-type","application/x-www-form-urlencoded"),"application/x-www-form-urlencoded"===o.headers.get("content-type")&&(o.body=c?ep(c,{keyEncoder:eo}):c);let u=await r(o),h="GET"===l?"GET":"POST",d=o.url,p={...o,method:h,credentials:o.credentials||"include"};try{if(u){var f;let t=null!=(f=null==i?void 0:i.fetchMaxTries)?f:tg()?4:11;s=await iR(()=>fetch(d,p),{retryImmediately:!0,initialDelay:700,maxDelayBetweenRetries:5e3,shouldRetry:(e,i)=>"GET"===h&&i<t,onBeforeRetry:t=>{d.searchParams.set("_clerk_retry_attempt",t.toString())}})}else s=new Response("{}",o)}catch(e){let t=d.toString();iE.error("network error",{error:e,url:t,method:l},"fapiClient");throw Error("".concat(i$,' Network error at "').concat(t,'" - ').concat(e,". Please try again."))}let _=204!==s.status?await s.json():null,g=Object.assign(s,{payload:_});return s.ok||iE.error("request failed",{method:l,path:o.path,status:s.status},"fapiClient"),await n(o,g),g}return{buildEmailAddress:function(e){return function(t){let{localPart:e,frontendApi:i}=t;return"".concat(e,"@").concat(i?i.replace("clerk.",""):"clerk.com")}({localPart:e,frontendApi:t.frontendApi})},buildUrl:a,onAfterResponse:function(t){i.push(t)},onBeforeRequest:function(t){e.push(t)},request:o}}({domain:this.domain,frontendApi:this.frontendApi,instanceType:this.instanceType,isSatellite:this.isSatellite,getSessionId:()=>{var t;return null==(t=this.session)?void 0:t.id},proxyUrl:this.proxyUrl})),o(this,or).emit(tk,"loading"),o(this,or).prioritizedOn(tk,t=>u(this,a4,t)),o(this,or).on(tk,t=>{var e,i;iq()&&("ready"===t||"degraded"===t?(null==(e=window.__clerk_internal_ready)?void 0:e.__resolve)&&h(this,oM,oF).call(this)&&window.__clerk_internal_ready.__resolve(this):"error"===t&&(null==(i=window.__clerk_internal_ready)?void 0:i.__reject)&&window.__clerk_internal_ready.__reject(new tU("Clerk failed to initialize.",{code:"clerk_init_failed"})))}),iq()&&("ready"===o(this,a4)||"degraded"===o(this,a4))&&h(this,oM,oF).call(this)&&(null==(i=window.__clerk_internal_ready)?void 0:i.__resolve)&&window.__clerk_internal_ready.__resolve(this),rP.clerk=this,u(this,a1,new aj)}}function oz(){let t;return!!(!o(this,ot).signUpUrl&&o(this,ot).signInUrl&&(t=o(this,ot).signInUrl,!ee.test(t)))}function oW(){let t=eX;return o(this,ot).allowedRedirectProtocols&&(t=t.concat(o(this,ot).allowedRedirectProtocols)),t}function oF(){return void 0!==this.client}(0,td._)(oN,"version","6.7.5"),(0,td._)(oN,"sdkMetadata",{name:"@clerk/clerk-js",version:"6.7.5"}),(0,td._)(oN,"_billing",void 0),(0,td._)(oN,"_apiKeys",void 0),(0,td._)(oN,"_oauthApplication",void 0);let oD=(null==(tc=document.querySelector("script[data-clerk-publishable-key]"))?void 0:tc.getAttribute("data-clerk-publishable-key"))||window.__clerk_publishable_key||"",oL=(null==(tu=document.querySelector("script[data-clerk-proxy-url]"))?void 0:tu.getAttribute("data-clerk-proxy-url"))||window.__clerk_proxy_url||"",oj=(null==(th=document.querySelector("script[data-clerk-domain]"))?void 0:th.getAttribute("data-clerk-domain"))||window.__clerk_domain||"";window.Clerk||(window.Clerk=new oN(oD,{proxyUrl:oL,domain:oj}))})(),{}})()); |