PageSourceSearch

https://promptpeak.ai/assets/index-DEWh94L9.js

js promptpeak.ai collected 2026-10-05 14:10:57 UTC 1,200,979 bytes, 711 lines download raw bytes

vendor: 4,518 bytes, lines 1-9
1var SP=Object.defineProperty;var gy=t=>{throw TypeError(t)};var TP=(t,e,n)=>e in t?SP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Cr=(t,e,n)=>TP(t,typeof e!="symbol"?e+"":e,n),Ih=(t,e,n)=>e.has(t)||gy("Cannot "+n);var j=(t,e,n)=>(Ih(t,e,"read from private field"),n?n.call(t):e.get(t)),xe=(t,e,n)=>e.has(t)?gy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),le=(t,e,n,r)=>(Ih(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Et=(t,e,n)=>(Ih(t,e,"access private method"),n);var xc=(t,e,n,r)=>({set _(i){le(t,e,i,n)},get _(){return j(t,e,r)}});function CP(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function cc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nx={exports:{}},Md={},Ax={exports:{}},pe={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var uc=Symbol.for("react.element"),EP=Symbol.for("react.portal"),_P=Symbol.for("react.fragment"),PP=Symbol.for("react.strict_mode"),RP=Symbol.for("react.profiler"),IP=Symbol.for("react.provider"),NP=Symbol.for("react.context"),AP=Symbol.for("react.forward_ref"),OP=Symbol.for("react.suspense"),MP=Symbol.for("react.memo"),jP=Symbol.for("react.lazy"),vy=Symbol.iterator;function DP(t){return t===null||typeof t!="object"?null:(t=vy&&t[vy]||t["@@iterator"],typeof t=="function"?t:null)}var Ox={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Mx=Object.assign,jx={};function xa(t,e,n){this.props=t,this.context=e,this.refs=jx,this.updater=n||Ox}xa.prototype.isReactComponent={};xa.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};xa.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Dx(){}Dx.prototype=xa.prototype;function ig(t,e,n){this.props=t,this.context=e,this.refs=jx,this.updater=n||Ox}var sg=ig.prototype=new Dx;sg.constructor=ig;Mx(sg,xa.prototype);sg.isPureReactComponent=!0;var yy=Array.isArray,Lx=Object.prototype.hasOwnProperty,og={current:null},Ux={key:!0,ref:!0,__self:!0,__source:!0};function Fx(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Lx.call(e,r)&&!Ux.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:uc,type:t,key:s,ref:o,props:i,_owner:og.current}}function LP(t,e){return{$$typeof:uc,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function ag(t){return typeof t=="object"&&t!==null&&t.$$typeof===uc}function UP(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var by=/\/+/g;function Nh(t,e){return typeof t=="object"&&t!==null&&t.key!=null?UP(""+t.key):e.toString(36)}function su(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case uc:case EP:o=!0}}
vendor: 4,573 bytes, lines 9-17
9if(o)return o=t,i=i(o),t=r===""?"."+Nh(o,0):r,yy(i)?(n="",t!=null&&(n=t.replace(by,"$&/")+"/"),su(i,e,n,"",function(c){return c})):i!=null&&(ag(i)&&(i=LP(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(by,"$&/")+"/")+t)),e.push(i)),1;if(o=0,r=r===""?".":r+":",yy(t))for(var a=0;a<t.length;a++){s=t[a];var l=r+Nh(s,a);o+=su(s,e,n,l,i)}else if(l=DP(t),typeof l=="function")for(t=l.call(t),a=0;!(s=t.next()).done;)s=s.value,l=r+Nh(s,a++),o+=su(s,e,n,l,i);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function kc(t,e,n){if(t==null)return t;var r=[],i=0;return su(t,r,"","",function(s){return e.call(n,s,i++)}),r}function FP(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Bt={current:null},ou={transition:null},BP={ReactCurrentDispatcher:Bt,ReactCurrentBatchConfig:ou,ReactCurrentOwner:og};function Bx(){throw Error("act(...) is not supported in production builds of React.")}pe.Children={map:kc,forEach:function(t,e,n){kc(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return kc(t,function(){e++}),e},toArray:function(t){return kc(t,function(e){return e})||[]},only:function(t){if(!ag(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};pe.Component=xa;pe.Fragment=_P;pe.Profiler=RP;pe.PureComponent=ig;pe.StrictMode=PP;pe.Suspense=OP;pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=BP;pe.act=Bx;pe.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=Mx({},t.props),i=t.key,s=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=og.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(l in e)Lx.call(e,l)&&!Ux.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:uc,type:t.type,key:i,ref:s,props:r,_owner:o}};pe.createContext=function(t){return t={$$typeof:NP,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:IP,_context:t},t.Consumer=t};pe.createElement=Fx;pe.createFactory=function(t){var e=Fx.bind(null,t);return e.type=t,e};pe.createRef=function(){return{current:null}};pe.forwardRef=function(t){return{$$typeof:AP,render:t}};pe.isValidElement=ag;pe.lazy=function(t){return{$$typeof:jP,_payload:{_status:-1,_result:t},_init:FP}};pe.memo=function(t,e){return{$$typeof:MP,type:t,compare:e===void 0?null:e}};pe.startTransition=function(t){var e=ou.transition;ou.transition={};try{t()}finally{ou.transition=e}};pe.unstable_act=Bx;pe.useCallback=function(t,e){return Bt.current.useCallback(t,e)};pe.useContext=function(t){return Bt.current.useContext(t)};pe.useDebugValue=function(){};pe.useDeferredValue=function(t){return Bt.current.useDeferredValue(t)};pe.useEffect=function(t,e){return Bt.current.useEffect(t,e)};pe.useId=function(){return Bt.current.useId()};pe.useImperativeHandle=function(t,e,n){return Bt.current.useImperativeHandle(t,e,n)};pe.useInsertionEffect=function(t,e){return Bt.current.useInsertionEffect(t,e)};pe.useLayoutEffect=function(t,e){return Bt.current.useLayoutEffect(t,e)};pe.useMemo=function(t,e){return Bt.current.useMemo(t,e)};pe.useReducer=function(t,e,n){return Bt.current.useReducer(t,e,n)};pe.useRef=function(t){return Bt.current.useRef(t)};pe.useState=function(t){return Bt.current.useState(t)};pe.useSyncExternalStore=function(t,e,n){return Bt.current.useSyncExternalStore(t,e,n)};pe.useTransition=function(){return Bt.current.useTransition()};pe.version="18.3.1";Ax.exports=pe;var x=Ax.exports;const z=cc(x),lg=CP({__proto__:null,default:z},[x]);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var zP=x,$P=Symbol.for("react.element"),VP=Symbol.for("react.fragment"),WP=Object.prototype.hasOwnProperty,qP=zP.__SECRET_INT
vendor: 11,435 bytes, lines 17-34
17ERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,HP={key:!0,ref:!0,__self:!0,__source:!0};function zx(t,e,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)WP.call(e,r)&&!HP.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:$P,type:t,key:s,ref:o,props:i,_owner:qP.current}}Md.Fragment=VP;Md.jsx=zx;Md.jsxs=zx;Nx.exports=Md;var d=Nx.exports,$x={exports:{}},un={},Vx={exports:{}},Wx={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(t){function e(N,M){var H=N.length;N.push(M);e:for(;0<H;){var te=H-1>>>1,X=N[te];if(0<i(X,M))N[te]=M,N[H]=X,H=te;else break e}}function n(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var M=N[0],H=N.pop();if(H!==M){N[0]=H;e:for(var te=0,X=N.length,se=X>>>1;te<se;){var oe=2*(te+1)-1,Pe=N[oe],Oe=oe+1,G=N[Oe];if(0>i(Pe,H))Oe<X&&0>i(G,Pe)?(N[te]=G,N[Oe]=H,te=Oe):(N[te]=Pe,N[oe]=H,te=oe);else if(Oe<X&&0>i(G,H))N[te]=G,N[Oe]=H,te=Oe;else break e}}return M}function i(N,M){var H=N.sortIndex-M.sortIndex;return H!==0?H:N.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,f=3,m=!1,b=!1,p=!1,g=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(N){for(var M=n(c);M!==null;){if(M.callback===null)r(c);else if(M.startTime<=N)r(c),M.sortIndex=M.expirationTime,e(l,M);else break;M=n(c)}}function k(N){if(p=!1,w(N),!b)if(n(l)!==null)b=!0,V(S);else{var M=n(c);M!==null&&Q(k,M.startTime-N)}}function S(N,M){b=!1,p&&(p=!1,v(_),_=-1),m=!0;var H=f;try{for(w(M),h=n(l);h!==null&&(!(h.expirationTime>M)||N&&!A());){var te=h.callback;if(typeof te=="function"){h.callback=null,f=h.priorityLevel;var X=te(h.expirationTime<=M);M=t.unstable_now(),typeof X=="function"?h.callback=X:h===n(l)&&r(l),w(M)}else r(l);h=n(l)}if(h!==null)var se=!0;else{var oe=n(c);oe!==null&&Q(k,oe.startTime-M),se=!1}return se}finally{h=null,f=H,m=!1}}var T=!1,C=null,_=-1,P=5,R=-1;function A(){return!(t.unstable_now()-R<P)}function O(){if(C!==null){var N=t.unstable_now();R=N;var M=!0;try{M=C(!0,N)}finally{M?K():(T=!1,C=null)}}else T=!1}var K;if(typeof y=="function")K=function(){y(O)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,Y=F.port2;F.port1.onmessage=O,K=function(){Y.postMessage(null)}}else K=function(){g(O,0)};function V(N){C=N,T||(T=!0,K())}function Q(N,M){_=g(function(){N(t.unstable_now())},M)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(N){N.callback=null},t.unstable_continueExecution=function(){b||m||(b=!0,V(S))},t.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<N?Math.floor(1e3/N):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(N){switch(f){case 1:case 2:case 3:var M=3;break;default:M=f}var H=f;f=M;try{return N()}finally{f=H}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(N,M){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var H=f;f=N;try{return M()}finally{f=H}},t.unstable_scheduleCallback=function(N,M,H){var te=t.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?te+H:te):H=te,N){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=H+X,N={id:u++,callback:M,priorityLevel:N,startTime:H,expirationTime:X,sortIndex:-1},H>te?(N.sortIndex=H,e(c,N),n(l)===null&&N===n(c)&&(p?(v(_),_=-1):p=!0,Q(k,H-te))):(N.sortIndex=X,e(l,N),b||m||(b=!0,V(S))),N},t.unstable_shouldYield=A,t.unstable_wrapCallback=function(N){var M=f;return function(){var H=f;f=M;try{return N.apply(this,arguments)}finally{f=H}}}})(Wx);Vx.exports=Wx;var KP=Vx.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var GP=x,ln=KP;function B(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var qx=new Set,kl={};function Vs(t,e){aa(t,e),aa(t+"Capture",e)}function aa(t,e){for(kl[t]=e,t=0;t<e.length;t++)qx.add(e[t])}var Wr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jf=Object.prototype.hasOwnProperty,JP=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,wy={},xy={};function YP(t){return Jf.call(xy,t)?!0:Jf.call(wy,t)?!1:JP.test(t)?xy[t]=!0:(wy[t]=!0,!1)}function QP(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function XP(t,e,n,r){if(e===null||typeof e>"u"||QP(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function zt(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var St={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){St[t]=new zt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];St[e]=new zt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){St[t]=new zt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){St[t]=new zt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){St[t]=new zt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){St[t]=new zt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){St[t]=new zt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){St[t]=new zt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){St[t]=new zt(t,5,!1,t.toLowerCase(),null,!1,!1)});var cg=/[\-:]([a-z])/g;function ug(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(cg,ug);St[e]=new zt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(cg,ug);St[e]=new zt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(cg,ug);St[e]=new zt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){St[t]=new zt(t,1,!1,t.toLowerCase(),null,!1,!1)});St.xlinkHref=new zt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){St[t]=new zt(t,1,!1,t.toLowerCase(),null,!0,!0)});function dg(t,e,n,r){var i=St.hasOwnProperty(e)?St[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(XP(e,n,i,r)&&(n=null),r||i===null?YP(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Yr=GP.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Sc=Symbol.for("react.element"),go=Symbol.for("react.portal"),vo=Symbol.for("react.fragment"),hg=Symbol.for("react.strict_mode"),Yf=Symbol.for("react.profiler"),Hx=Symbol.for("react.provider"),Kx=Symbol.for("react.context"),fg=Symbol.for("react.forward_ref"),Qf=Symbol.for("react.suspense"),Xf=Symbol.for("react.suspense_list"),mg=Symbol.for("react.memo"),di=Symbol.for("react.lazy"),Gx=Symbol.for("react.offscreen"),ky=Symbol.iterator;function Aa(t){return t===null||typeof t!="object"?null:(t=ky&&t[ky]||t["@@iterator"],typeof t=="function"?t:null)}var He=Object.assign,Ah;function Qa(t){if(Ah===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Ah=e&&e[1]||""}return`
34`+Ah+t}var Oh=!1;function Mh(t,e){if(!t||Oh)return"";Oh=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}
vendor: 16,621 bytes, lines 34-37
34catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
35`),s=r.stack.split(`
36`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
37`+i[o].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{Oh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Qa(t):""}function ZP(t){switch(t.tag){case 5:return Qa(t.type);case 16:return Qa("Lazy");case 13:return Qa("Suspense");case 19:return Qa("SuspenseList");case 0:case 2:case 15:return t=Mh(t.type,!1),t;case 11:return t=Mh(t.type.render,!1),t;case 1:return t=Mh(t.type,!0),t;default:return""}}function Zf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case vo:return"Fragment";case go:return"Portal";case Yf:return"Profiler";case hg:return"StrictMode";case Qf:return"Suspense";case Xf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Kx:return(t.displayName||"Context")+".Consumer";case Hx:return(t._context.displayName||"Context")+".Provider";case fg:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case mg:return e=t.displayName||null,e!==null?e:Zf(t.type)||"Memo";case di:e=t._payload,t=t._init;try{return Zf(t(e))}catch{}}return null}function eR(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Zf(e);case 8:return e===hg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Ui(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Jx(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function tR(t){var e=Jx(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Tc(t){t._valueTracker||(t._valueTracker=tR(t))}function Yx(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Jx(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Lu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function em(t,e){var n=e.checked;return He({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Sy(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Ui(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Qx(t,e){e=e.checked,e!=null&&dg(t,"checked",e,!1)}function tm(t,e){Qx(t,e);var n=Ui(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?nm(t,e.type,n):e.hasOwnProperty("defaultValue")&&nm(t,e.type,Ui(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Ty(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function nm(t,e,n){(e!=="number"||Lu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Xa=Array.isArray;function Ao(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Ui(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function rm(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(B(91));return He({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Cy(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(B(92));if(Xa(n)){if(1<n.length)throw Error(B(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Ui(n)}}function Xx(t,e){var n=Ui(e.value),r=Ui(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function Ey(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Zx(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function im(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Zx(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Cc,ek=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Cc=Cc||document.createElement("div"),Cc.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Cc.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Sl(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var sl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},nR=["Webkit","ms","Moz","O"];Object.keys(sl).forEach(function(t){nR.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),sl[e]=sl[t]})});function tk(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||sl.hasOwnProperty(t)&&sl[t]?(""+e).trim():e+"px"}function nk(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=tk(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var rR=He({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function sm(t,e){if(e){if(rR[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(B(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(B(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(B(61))}if(e.style!=null&&typeof e.style!="object")throw Error(B(62))}}function om(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var am=null;function pg(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var lm=null,Oo=null,Mo=null;function _y(t){if(t=fc(t)){if(typeof lm!="function")throw Error(B(280));var e=t.stateNode;e&&(e=Fd(e),lm(t.stateNode,t.type,e))}}function rk(t){Oo?Mo?Mo.push(t):Mo=[t]:Oo=t}function ik(){if(Oo){var t=Oo,e=Mo;if(Mo=Oo=null,_y(t),e)for(t=0;t<e.length;t++)_y(e[t])}}function sk(t,e){return t(e)}function ok(){}var jh=!1;function ak(t,e,n){if(jh)return t(e,n);jh=!0;try{return sk(t,e,n)}finally{jh=!1,(Oo!==null||Mo!==null)&&(ok(),ik())}}function Tl(t,e){var n=t.stateNode;if(n===null)return null;var r=Fd(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(B(231,e,typeof n));return n}var cm=!1;if(Wr)try{var Oa={};Object.defineProperty(Oa,"passive",{get:function(){cm=!0}}),window.addEventListener("test",Oa,Oa),window.removeEventListener("test",Oa,Oa)}catch{cm=!1}function iR(t,e,n,r,i,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var ol=!1,Uu=null,Fu=!1,um=null,sR={onError:function(t){ol=!0,Uu=t}};function oR(t,e,n,r,i,s,o,a,l){ol=!1,Uu=null,iR.apply(sR,arguments)}function aR(t,e,n,r,i,s,o,a,l){if(oR.apply(this,arguments),ol){if(ol){var c=Uu;ol=!1,Uu=null}else throw Error(B(198));Fu||(Fu=!0,um=c)}}function Ws(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function lk(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Py(t){if(Ws(t)!==t)throw Error(B(188))}function lR(t){var e=t.alternate;if(!e){if(e=Ws(t),e===null)throw Error(B(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return Py(i),t;if(s===r)return Py(i),e;s=s.sibling}throw Error(B(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(B(189))}}if(n.alternate!==r)throw Error(B(190))}if(n.tag!==3)throw Error(B(188));return n.stateNode.current===n?t:e}function ck(t){return t=lR(t),t!==null?uk(t):null}function uk(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=uk(t);if(e!==null)return e;t=t.sibling}return null}var dk=ln.unstable_scheduleCallback,Ry=ln.unstable_cancelCallback,cR=ln.unstable_shouldYield,uR=ln.unstable_requestPaint,nt=ln.unstable_now,dR=ln.unstable_getCurrentPriorityLevel,gg=ln.unstable_ImmediatePriority,hk=ln.unstable_UserBlockingPriority,Bu=ln.unstable_NormalPriority,hR=ln.unstable_LowPriority,fk=ln.unstable_IdlePriority,jd=null,gr=null;function fR(t){if(gr&&typeof gr.onCommitFiberRoot=="function")try{gr.onCommitFiberRoot(jd,t,void 0,(t.current.flags&128)===128)}catch{}}var Gn=Math.clz32?Math.clz32:gR,mR=Math.log,pR=Math.LN2;function gR(t){return t>>>=0,t===0?32:31-(mR(t)/pR|0)|0}var Ec=64,_c=4194304;function Za(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function zu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=Za(a):(s&=o,s!==0&&(r=Za(s)))}else o=n&~i,o!==0?r=Za(o):s!==0&&(r=Za(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-Gn(e),i=1<<n,r|=t[n],e&=~i;return r}function vR(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function yR(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var o=31-Gn(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=vR(a,e)):l<=e&&(t.expiredLanes|=a),s&=~a}}function dm(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function mk(){var t=Ec;return Ec<<=1,!(Ec&4194240)&&(Ec=64),t}function Dh(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function dc(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Gn(e),t[e]=n}function bR(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-Gn(n),s=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~s}}function vg(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Gn(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var Ee=0;function pk(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var gk,yg,vk,yk,bk,hm=!1,Pc=[],_i=null,Pi=null,Ri=null,Cl=new Map,El=new Map,mi=[],wR="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Iy(t,e){switch(t){case"focusin":case"focusout":_i=null;break;case"dragenter":case"dragleave":Pi=null;break;case"mouseover":case"mouseout":Ri=null;break;case"pointerover":case"pointerout":Cl.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":El.delete(e.pointerId)}}function Ma(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=fc(e),e!==null&&yg(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function xR(t,e,n,r,i){switch(e){case"focusin":return _i=Ma(_i,t,e,n,r,i),!0;case"dragenter":return Pi=Ma(Pi,t,e,n,r,i),!0;case"mouseover":return Ri=Ma(Ri,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return Cl.set(s,Ma(Cl.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,El.set(s,Ma(El.get(s)||null,t,e,n,r,i)),!0}return!1}function wk(t){var e=ps(t.target);if(e!==null){var n=Ws(e);if(n!==null){if(e=n.tag,e===13){if(e=lk(n),e!==null){t.blockedOn=e,bk(t.priority,function(){vk(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function au(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=fm(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);am=r,n.target.dispatchEvent(r),am=null}else return e=fc(n),e!==null&&yg(e),t.blockedOn=n,!1;e.shift()}return!0}function Ny(t,e,n){au(t)&&n.delete(e)}
vendor: 11,957 bytes, line 37
37function kR(){hm=!1,_i!==null&&au(_i)&&(_i=null),Pi!==null&&au(Pi)&&(Pi=null),Ri!==null&&au(Ri)&&(Ri=null),Cl.forEach(Ny),El.forEach(Ny)}function ja(t,e){t.blockedOn===e&&(t.blockedOn=null,hm||(hm=!0,ln.unstable_scheduleCallback(ln.unstable_NormalPriority,kR)))}function _l(t){function e(i){return ja(i,t)}if(0<Pc.length){ja(Pc[0],t);for(var n=1;n<Pc.length;n++){var r=Pc[n];r.blockedOn===t&&(r.blockedOn=null)}}for(_i!==null&&ja(_i,t),Pi!==null&&ja(Pi,t),Ri!==null&&ja(Ri,t),Cl.forEach(e),El.forEach(e),n=0;n<mi.length;n++)r=mi[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<mi.length&&(n=mi[0],n.blockedOn===null);)wk(n),n.blockedOn===null&&mi.shift()}var jo=Yr.ReactCurrentBatchConfig,$u=!0;function SR(t,e,n,r){var i=Ee,s=jo.transition;jo.transition=null;try{Ee=1,bg(t,e,n,r)}finally{Ee=i,jo.transition=s}}function TR(t,e,n,r){var i=Ee,s=jo.transition;jo.transition=null;try{Ee=4,bg(t,e,n,r)}finally{Ee=i,jo.transition=s}}function bg(t,e,n,r){if($u){var i=fm(t,e,n,r);if(i===null)Hh(t,e,r,Vu,n),Iy(t,r);else if(xR(i,t,e,n,r))r.stopPropagation();else if(Iy(t,r),e&4&&-1<wR.indexOf(t)){for(;i!==null;){var s=fc(i);if(s!==null&&gk(s),s=fm(t,e,n,r),s===null&&Hh(t,e,r,Vu,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else Hh(t,e,r,null,n)}}var Vu=null;function fm(t,e,n,r){if(Vu=null,t=pg(r),t=ps(t),t!==null)if(e=Ws(t),e===null)t=null;else if(n=e.tag,n===13){if(t=lk(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Vu=t,null}function xk(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(dR()){case gg:return 1;case hk:return 4;case Bu:case hR:return 16;case fk:return 536870912;default:return 16}default:return 16}}var Si=null,wg=null,lu=null;function kk(){if(lu)return lu;var t,e=wg,n=e.length,r,i="value"in Si?Si.value:Si.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===i[s-r];r++);return lu=i.slice(t,1<r?1-r:void 0)}function cu(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Rc(){return!0}function Ay(){return!1}function dn(t){function e(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Rc:Ay,this.isPropagationStopped=Ay,this}return He(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Rc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Rc)},persist:function(){},isPersistent:Rc}),e}var ka={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xg=dn(ka),hc=He({},ka,{view:0,detail:0}),CR=dn(hc),Lh,Uh,Da,Dd=He({},hc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kg,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Da&&(Da&&t.type==="mousemove"?(Lh=t.screenX-Da.screenX,Uh=t.screenY-Da.screenY):Uh=Lh=0,Da=t),Lh)},movementY:function(t){return"movementY"in t?t.movementY:Uh}}),Oy=dn(Dd),ER=He({},Dd,{dataTransfer:0}),_R=dn(ER),PR=He({},hc,{relatedTarget:0}),Fh=dn(PR),RR=He({},ka,{animationName:0,elapsedTime:0,pseudoElement:0}),IR=dn(RR),NR=He({},ka,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),AR=dn(NR),OR=He({},ka,{data:0}),My=dn(OR),MR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jR={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},DR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function LR(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=DR[t])?!!e[t]:!1}function kg(){return LR}var UR=He({},hc,{key:function(t){if(t.key){var e=MR[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=cu(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?jR[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kg,charCode:function(t){return t.type==="keypress"?cu(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?cu(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),FR=dn(UR),BR=He({},Dd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jy=dn(BR),zR=He({},hc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kg}),$R=dn(zR),VR=He({},ka,{propertyName:0,elapsedTime:0,pseudoElement:0}),WR=dn(VR),qR=He({},Dd,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),HR=dn(qR),KR=[9,13,27,32],Sg=Wr&&"CompositionEvent"in window,al=null;Wr&&"documentMode"in document&&(al=document.documentMode);var GR=Wr&&"TextEvent"in window&&!al,Sk=Wr&&(!Sg||al&&8<al&&11>=al),Dy=" ",Ly=!1;function Tk(t,e){switch(t){case"keyup":return KR.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ck(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var yo=!1;function JR(t,e){switch(t){case"compositionend":return Ck(e);case"keypress":return e.which!==32?null:(Ly=!0,Dy);case"textInput":return t=e.data,t===Dy&&Ly?null:t;default:return null}}function YR(t,e){if(yo)return t==="compositionend"||!Sg&&Tk(t,e)?(t=kk(),lu=wg=Si=null,yo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Sk&&e.locale!=="ko"?null:e.data;default:return null}}var QR={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Uy(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!QR[t.type]:e==="textarea"}function Ek(t,e,n,r){rk(r),e=Wu(e,"onChange"),0<e.length&&(n=new xg("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var ll=null,Pl=null;function XR(t){Lk(t,0)}function Ld(t){var e=xo(t);if(Yx(e))return t}function ZR(t,e){if(t==="change")return e}var _k=!1;if(Wr){var Bh;if(Wr){var zh="oninput"in document;if(!zh){var Fy=document.createElement("div");Fy.setAttribute("oninput","return;"),zh=typeof Fy.oninput=="function"}Bh=zh}else Bh=!1;_k=Bh&&(!document.documentMode||9<document.documentMode)}function By(){ll&&(ll.detachEvent("onpropertychange",Pk),Pl=ll=null)}function Pk(t){if(t.propertyName==="value"&&Ld(Pl)){var e=[];Ek(e,Pl,t,pg(t)),ak(XR,e)}}function eI(t,e,n){t==="focusin"?(By(),ll=e,Pl=n,ll.attachEvent("onpropertychange",Pk)):t==="focusout"&&By()}function tI(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ld(Pl)}function nI(t,e){if(t==="click")return Ld(e)}function rI(t,e){if(t==="input"||t==="change")return Ld(e)}function iI(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Yn=typeof Object.is=="function"?Object.is:iI;function Rl(t,e){if(Yn(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Jf.call(e,i)||!Yn(t[i],e[i]))return!1}return!0}function zy(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function $y(t,e){var n=zy(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=zy(n)}}function Rk(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Rk(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Ik(){for(var t=window,e=Lu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Lu(t.document)}return e}function Tg(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function sI(t){var e=Ik(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Rk(n.ownerDocument.documentElement,n)){if(r!==null&&Tg(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=$y(n,s);var o=$y(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var oI=Wr&&"documentMode"in document&&11>=document.documentMode,bo=null,mm=null,cl=null,pm=!1;function Vy(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;pm||bo==null||bo!==Lu(r)||(r=bo,"selectionStart"in r&&Tg(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 4,501 bytes, line 37
37sNode:r.focusNode,focusOffset:r.focusOffset}),cl&&Rl(cl,r)||(cl=r,r=Wu(mm,"onSelect"),0<r.length&&(e=new xg("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=bo)))}function Ic(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var wo={animationend:Ic("Animation","AnimationEnd"),animationiteration:Ic("Animation","AnimationIteration"),animationstart:Ic("Animation","AnimationStart"),transitionend:Ic("Transition","TransitionEnd")},$h={},Nk={};Wr&&(Nk=document.createElement("div").style,"AnimationEvent"in window||(delete wo.animationend.animation,delete wo.animationiteration.animation,delete wo.animationstart.animation),"TransitionEvent"in window||delete wo.transitionend.transition);function Ud(t){if($h[t])return $h[t];if(!wo[t])return t;var e=wo[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Nk)return $h[t]=e[n];return t}var Ak=Ud("animationend"),Ok=Ud("animationiteration"),Mk=Ud("animationstart"),jk=Ud("transitionend"),Dk=new Map,Wy="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Hi(t,e){Dk.set(t,e),Vs(e,[t])}for(var Vh=0;Vh<Wy.length;Vh++){var Wh=Wy[Vh],aI=Wh.toLowerCase(),lI=Wh[0].toUpperCase()+Wh.slice(1);Hi(aI,"on"+lI)}Hi(Ak,"onAnimationEnd");Hi(Ok,"onAnimationIteration");Hi(Mk,"onAnimationStart");Hi("dblclick","onDoubleClick");Hi("focusin","onFocus");Hi("focusout","onBlur");Hi(jk,"onTransitionEnd");aa("onMouseEnter",["mouseout","mouseover"]);aa("onMouseLeave",["mouseout","mouseover"]);aa("onPointerEnter",["pointerout","pointerover"]);aa("onPointerLeave",["pointerout","pointerover"]);Vs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Vs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Vs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Vs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Vs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Vs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var el="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),cI=new Set("cancel close invalid load scroll toggle".split(" ").concat(el));function qy(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,aR(r,e,void 0,t),t.currentTarget=null}function Lk(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;qy(i,a,c),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;qy(i,a,c),s=l}}}if(Fu)throw t=um,Fu=!1,um=null,t}function Ue(t,e){var n=e[wm];n===void 0&&(n=e[wm]=new Set);var r=t+"__bubble";n.has(r)||(Uk(e,t,2,!1),n.add(r))}function qh(t,e,n){var r=0;e&&(r|=4),Uk(n,t,r,e)}var Nc="_reactListening"+Math.random().toString(36).slice(2);function Il(t){if(!t[Nc]){t[Nc]=!0,qx.forEach(function(n){n!=="selectionchange"&&(cI.has(n)||qh(n,!1,t),qh(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Nc]||(e[Nc]=!0,qh("selectionchange",!1,e))}}function Uk(t,e,n,r){switch(xk(e)){case 1:var i=SR;break;case 4:i=TR;break;default:i=bg}n=i.bind(null,e,n,t),i=void 0,!cm||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function Hh(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;
vendor: 5,316 bytes, lines 37-38
37if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=ps(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}ak(function(){var c=s,u=pg(n),h=[];e:{var f=Dk.get(t);if(f!==void 0){var m=xg,b=t;switch(t){case"keypress":if(cu(n)===0)break e;case"keydown":case"keyup":m=FR;break;case"focusin":b="focus",m=Fh;break;case"focusout":b="blur",m=Fh;break;case"beforeblur":case"afterblur":m=Fh;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=Oy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=_R;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=$R;break;case Ak:case Ok:case Mk:m=IR;break;case jk:m=WR;break;case"scroll":m=CR;break;case"wheel":m=HR;break;case"copy":case"cut":case"paste":m=AR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=jy}var p=(e&4)!==0,g=!p&&t==="scroll",v=p?f!==null?f+"Capture":null:f;p=[];for(var y=c,w;y!==null;){w=y;var k=w.stateNode;if(w.tag===5&&k!==null&&(w=k,v!==null&&(k=Tl(y,v),k!=null&&p.push(Nl(y,k,w)))),g)break;y=y.return}0<p.length&&(f=new m(f,b,null,n,u),h.push({event:f,listeners:p}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",m=t==="mouseout"||t==="pointerout",f&&n!==am&&(b=n.relatedTarget||n.fromElement)&&(ps(b)||b[qr]))break e;if((m||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,m?(b=n.relatedTarget||n.toElement,m=c,b=b?ps(b):null,b!==null&&(g=Ws(b),b!==g||b.tag!==5&&b.tag!==6)&&(b=null)):(m=null,b=c),m!==b)){if(p=Oy,k="onMouseLeave",v="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(p=jy,k="onPointerLeave",v="onPointerEnter",y="pointer"),g=m==null?f:xo(m),w=b==null?f:xo(b),f=new p(k,y+"leave",m,n,u),f.target=g,f.relatedTarget=w,k=null,ps(u)===c&&(p=new p(v,y+"enter",b,n,u),p.target=w,p.relatedTarget=g,k=p),g=k,m&&b)t:{for(p=m,v=b,y=0,w=p;w;w=Zs(w))y++;for(w=0,k=v;k;k=Zs(k))w++;for(;0<y-w;)p=Zs(p),y--;for(;0<w-y;)v=Zs(v),w--;for(;y--;){if(p===v||v!==null&&p===v.alternate)break t;p=Zs(p),v=Zs(v)}p=null}else p=null;m!==null&&Hy(h,f,m,p,!1),b!==null&&g!==null&&Hy(h,g,b,p,!0)}}e:{if(f=c?xo(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var S=ZR;else if(Uy(f))if(_k)S=rI;else{S=tI;var T=eI}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(S=nI);if(S&&(S=S(t,c))){Ek(h,S,n,u);break e}T&&T(t,f,c),t==="focusout"&&(T=f._wrapperState)&&T.controlled&&f.type==="number"&&nm(f,"number",f.value)}switch(T=c?xo(c):window,t){case"focusin":(Uy(T)||T.contentEditable==="true")&&(bo=T,mm=c,cl=null);break;case"focusout":cl=mm=bo=null;break;case"mousedown":pm=!0;break;case"contextmenu":case"mouseup":case"dragend":pm=!1,Vy(h,n,u);break;case"selectionchange":if(oI)break;case"keydown":case"keyup":Vy(h,n,u)}var C;if(Sg)e:{switch(t){case"compositionstart":var _="onCompositionStart";break e;case"compositionend":_="onCompositionEnd";break e;case"compositionupdate":_="onCompositionUpdate";break e}_=void 0}else yo?Tk(t,n)&&(_="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(_="onCompositionStart");_&&(Sk&&n.locale!=="ko"&&(yo||_!=="onCompositionStart"?_==="onCompositionEnd"&&yo&&(C=kk()):(Si=u,wg="value"in Si?Si.value:Si.textContent,yo=!0)),T=Wu(c,_),0<T.length&&(_=new My(_,t,null,n,u),h.push({event:_,listeners:T}),C?_.data=C:(C=Ck(n),C!==null&&(_.data=C)))),(C=GR?JR(t,n):YR(t,n))&&(c=Wu(c,"onBeforeInput"),0<c.length&&(u=new My("onBeforeInput","beforeinput",null,n,u),h.push({event:u,listeners:c}),u.data=C))}Lk(h,e)})}function Nl(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Wu(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Tl(t,n),s!=null&&r.unshift(Nl(t,s,i)),s=Tl(t,e),s!=null&&r.push(Nl(t,s,i))),t=t.return}return r}function Zs(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Hy(t,e,n,r,i){for(var s=e._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=Tl(n,s),l!=null&&o.unshift(Nl(n,l,a))):i||(l=Tl(n,s),l!=null&&o.push(Nl(n,l,a)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var uI=/\r\n?/g,dI=/\u0000|\uFFFD/g;function Ky(t){return(typeof t=="string"?t:""+t).replace(uI,`
38`).replace(dI,"")}function Ac(t,e,n){if(e=Ky(e),Ky(t)!==e&&n)throw Error(B(425))}function qu(){}var gm=null,vm=null;function ym(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var bm=typeof setTimeout=="function"?setTimeout:void 0,hI=typeof clearTimeout=="function"?clearTimeout:void 0,Gy=typeof Promise=="function"?Promise:void 0,fI=typeof queueMicrotask=="function"?queueMicrotask:typeof Gy<"u"?function(t){return Gy.resolve(null).then(t).cat
vendor: 4,793 bytes, line 38
38ch(mI)}:bm;function mI(t){setTimeout(function(){throw t})}function Kh(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),_l(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);_l(e)}function Ii(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Jy(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Sa=Math.random().toString(36).slice(2),hr="__reactFiber$"+Sa,Al="__reactProps$"+Sa,qr="__reactContainer$"+Sa,wm="__reactEvents$"+Sa,pI="__reactListeners$"+Sa,gI="__reactHandles$"+Sa;function ps(t){var e=t[hr];if(e)return e;for(var n=t.parentNode;n;){if(e=n[qr]||n[hr]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Jy(t);t!==null;){if(n=t[hr])return n;t=Jy(t)}return e}t=n,n=t.parentNode}return null}function fc(t){return t=t[hr]||t[qr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function xo(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(B(33))}function Fd(t){return t[Al]||null}var xm=[],ko=-1;function Ki(t){return{current:t}}function Fe(t){0>ko||(t.current=xm[ko],xm[ko]=null,ko--)}function je(t,e){ko++,xm[ko]=t.current,t.current=e}var Fi={},At=Ki(Fi),Gt=Ki(!1),Ns=Fi;function la(t,e){var n=t.type.contextTypes;if(!n)return Fi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Jt(t){return t=t.childContextTypes,t!=null}function Hu(){Fe(Gt),Fe(At)}function Yy(t,e,n){if(At.current!==Fi)throw Error(B(168));je(At,e),je(Gt,n)}function Fk(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(B(108,eR(t)||"Unknown",i));return He({},n,r)}function Ku(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Fi,Ns=At.current,je(At,t),je(Gt,Gt.current),!0}function Qy(t,e,n){var r=t.stateNode;if(!r)throw Error(B(169));n?(t=Fk(t,e,Ns),r.__reactInternalMemoizedMergedChildContext=t,Fe(Gt),Fe(At),je(At,t)):Fe(Gt),je(Gt,n)}var Ar=null,Bd=!1,Gh=!1;function Bk(t){Ar===null?Ar=[t]:Ar.push(t)}function vI(t){Bd=!0,Bk(t)}function Gi(){if(!Gh&&Ar!==null){Gh=!0;var t=0,e=Ee;try{var n=Ar;for(Ee=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Ar=null,Bd=!1}catch(i){throw Ar!==null&&(Ar=Ar.slice(t+1)),dk(gg,Gi),i}finally{Ee=e,Gh=!1}}return null}var So=[],To=0,Gu=null,Ju=0,yn=[],bn=0,As=null,Br=1,zr="";function as(t,e){So[To++]=Ju,So[To++]=Gu,Gu=t,Ju=e}function zk(t,e,n){yn[bn++]=Br,yn[bn++]=zr,yn[bn++]=As,As=t;var r=Br;t=zr;var i=32-Gn(r)-1;r&=~(1<<i),n+=1;var s=32-Gn(e)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Br=1<<32-Gn(e)+i|n<<i|r,zr=s+t}else Br=1<<s|n<<i|r,zr=t}function Cg(t){t.return!==null&&(as(t,1),zk(t,1,0))}function Eg(t){for(;t===Gu;)Gu=So[--To],So[To]=null,Ju=So[--To],So[To]=null;for(;t===As;)As=yn[--bn],yn[bn]=null,zr=yn[--bn],yn[bn]=null,Br=yn[--bn],yn[bn]=null}var on=null,rn=null,ze=!1,$n=null;function $k(t,e){var n=wn(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function Xy(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,on=t,rn=Ii(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,on=t,rn=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=As!==null?{id:Br,overflow:zr}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=wn(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,on=t,rn=null,!0):!1;default:return!1}}function km(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Sm(t){if(ze){var e=rn;if(e){var n=e;if(!Xy(t,e)){if(km(t))throw Error(B(418));e=Ii(n.nextSibling);var r=on;e&&Xy(t,e)?$k(r,n):(t.flags=t.flags&-4097|2,ze=!1,on=t)}}else{if(km(t))throw Error(B(418));t.flags=t.flags&-4097|2,ze=!1,on=t}}}function Zy(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;on=t}function Oc(t){if(t!==on)return!1;if(!ze)return Zy(t),ze=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!ym(t.type,t.memoizedProps)),e&&(e=rn)){if(km(t))throw Vk(),Error(B(418));for(;e;)$k(t,e),e=Ii(e.nextSibling)}if(Zy(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(B(317)
vendor: 25,627 bytes, lines 38-40
38);e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){rn=Ii(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}rn=null}}else rn=on?Ii(t.stateNode.nextSibling):null;return!0}function Vk(){for(var t=rn;t;)t=Ii(t.nextSibling)}function ca(){rn=on=null,ze=!1}function _g(t){$n===null?$n=[t]:$n.push(t)}var yI=Yr.ReactCurrentBatchConfig;function La(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(B(309));var r=n.stateNode}if(!r)throw Error(B(147,t));var i=r,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof t!="string")throw Error(B(284));if(!n._owner)throw Error(B(290,t))}return t}function Mc(t,e){throw t=Object.prototype.toString.call(e),Error(B(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function e0(t){var e=t._init;return e(t._payload)}function Wk(t){function e(v,y){if(t){var w=v.deletions;w===null?(v.deletions=[y],v.flags|=16):w.push(y)}}function n(v,y){if(!t)return null;for(;y!==null;)e(v,y),y=y.sibling;return null}function r(v,y){for(v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function i(v,y){return v=Mi(v,y),v.index=0,v.sibling=null,v}function s(v,y,w){return v.index=w,t?(w=v.alternate,w!==null?(w=w.index,w<y?(v.flags|=2,y):w):(v.flags|=2,y)):(v.flags|=1048576,y)}function o(v){return t&&v.alternate===null&&(v.flags|=2),v}function a(v,y,w,k){return y===null||y.tag!==6?(y=tf(w,v.mode,k),y.return=v,y):(y=i(y,w),y.return=v,y)}function l(v,y,w,k){var S=w.type;return S===vo?u(v,y,w.props.children,k,w.key):y!==null&&(y.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===di&&e0(S)===y.type)?(k=i(y,w.props),k.ref=La(v,y,w),k.return=v,k):(k=gu(w.type,w.key,w.props,null,v.mode,k),k.ref=La(v,y,w),k.return=v,k)}function c(v,y,w,k){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=nf(w,v.mode,k),y.return=v,y):(y=i(y,w.children||[]),y.return=v,y)}function u(v,y,w,k,S){return y===null||y.tag!==7?(y=_s(w,v.mode,k,S),y.return=v,y):(y=i(y,w),y.return=v,y)}function h(v,y,w){if(typeof y=="string"&&y!==""||typeof y=="number")return y=tf(""+y,v.mode,w),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Sc:return w=gu(y.type,y.key,y.props,null,v.mode,w),w.ref=La(v,null,y),w.return=v,w;case go:return y=nf(y,v.mode,w),y.return=v,y;case di:var k=y._init;return h(v,k(y._payload),w)}if(Xa(y)||Aa(y))return y=_s(y,v.mode,w,null),y.return=v,y;Mc(v,y)}return null}function f(v,y,w,k){var S=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return S!==null?null:a(v,y,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Sc:return w.key===S?l(v,y,w,k):null;case go:return w.key===S?c(v,y,w,k):null;case di:return S=w._init,f(v,y,S(w._payload),k)}if(Xa(w)||Aa(w))return S!==null?null:u(v,y,w,k,null);Mc(v,w)}return null}function m(v,y,w,k,S){if(typeof k=="string"&&k!==""||typeof k=="number")return v=v.get(w)||null,a(y,v,""+k,S);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Sc:return v=v.get(k.key===null?w:k.key)||null,l(y,v,k,S);case go:return v=v.get(k.key===null?w:k.key)||null,c(y,v,k,S);case di:var T=k._init;return m(v,y,w,T(k._payload),S)}if(Xa(k)||Aa(k))return v=v.get(w)||null,u(y,v,k,S,null);Mc(y,k)}return null}function b(v,y,w,k){for(var S=null,T=null,C=y,_=y=0,P=null;C!==null&&_<w.length;_++){C.index>_?(P=C,C=null):P=C.sibling;var R=f(v,C,w[_],k);if(R===null){C===null&&(C=P);break}t&&C&&R.alternate===null&&e(v,C),y=s(R,y,_),T===null?S=R:T.sibling=R,T=R,C=P}if(_===w.length)return n(v,C),ze&&as(v,_),S;if(C===null){for(;_<w.length;_++)C=h(v,w[_],k),C!==null&&(y=s(C,y,_),T===null?S=C:T.sibling=C,T=C);return ze&&as(v,_),S}for(C=r(v,C);_<w.length;_++)P=m(C,v,_,w[_],k),P!==null&&(t&&P.alternate!==null&&C.delete(P.key===null?_:P.key),y=s(P,y,_),T===null?S=P:T.sibling=P,T=P);return t&&C.forEach(function(A){return e(v,A)}),ze&&as(v,_),S}function p(v,y,w,k){var S=Aa(w);if(typeof S!="function")throw Error(B(150));if(w=S.call(w),w==null)throw Error(B(151));for(var T=S=null,C=y,_=y=0,P=null,R=w.next();C!==null&&!R.done;_++,R=w.next()){C.index>_?(P=C,C=null):P=C.sibling;var A=f(v,C,R.value,k);if(A===null){C===null&&(C=P);break}t&&C&&A.alternate===null&&e(v,C),y=s(A,y,_),T===null?S=A:T.sibling=A,T=A,C=P}if(R.done)return n(v,C),ze&&as(v,_),S;if(C===null){for(;!R.done;_++,R=w.next())R=h(v,R.value,k),R!==null&&(y=s(R,y,_),T===null?S=R:T.sibling=R,T=R);return ze&&as(v,_),S}for(C=r(v,C);!R.done;_++,R=w.next())R=m(C,v,_,R.value,k),R!==null&&(t&&R.alternate!==null&&C.delete(R.key===null?_:R.key),y=s(R,y,_),T===null?S=R:T.sibling=R,T=R);return t&&C.forEach(function(O){return e(v,O)}),ze&&as(v,_),S}function g(v,y,w,k){if(typeof w=="object"&&w!==null&&w.type===vo&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Sc:e:{for(var S=w.key,T=y;T!==null;){if(T.key===S){if(S=w.type,S===vo){if(T.tag===7){n(v,T.sibling),y=i(T,w.props.children),y.return=v,v=y;break e}}else if(T.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===di&&e0(S)===T.type){n(v,T.sibling),y=i(T,w.props),y.ref=La(v,T,w),y.return=v,v=y;break e}n(v,T);break}else e(v,T);T=T.sibling}w.type===vo?(y=_s(w.props.children,v.mode,k,w.key),y.return=v,v=y):(k=gu(w.type,w.key,w.props,null,v.mode,k),k.ref=La(v,y,w),k.return=v,v=k)}return o(v);case go:e:{for(T=w.key;y!==null;){if(y.key===T)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(v,y.sibling),y=i(y,w.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else e(v,y);y=y.sibling}y=nf(w,v.mode,k),y.return=v,v=y}return o(v);case di:return T=w._init,g(v,y,T(w._payload),k)}if(Xa(w))return b(v,y,w,k);if(Aa(w))return p(v,y,w,k);Mc(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(n(v,y.sibling),y=i(y,w),y.return=v,v=y):(n(v,y),y=tf(w,v.mode,k),y.return=v,v=y),o(v)):n(v,y)}return g}var ua=Wk(!0),qk=Wk(!1),Yu=Ki(null),Qu=null,Co=null,Pg=null;function Rg(){Pg=Co=Qu=null}function Ig(t){var e=Yu.current;Fe(Yu),t._currentValue=e}function Tm(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Do(t,e){Qu=t,Pg=Co=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ht=!0),t.firstContext=null)}function Sn(t){var e=t._currentValue;if(Pg!==t)if(t={context:t,memoizedValue:e,next:null},Co===null){if(Qu===null)throw Error(B(308));Co=t,Qu.dependencies={lanes:0,firstContext:t}}else Co=Co.next=t;return e}var gs=null;function Ng(t){gs===null?gs=[t]:gs.push(t)}function Hk(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,Ng(e)):(n.next=i.next,i.next=n),e.interleaved=n,Hr(t,r)}function Hr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var hi=!1;function Ag(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Kk(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Vr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ni(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,be&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Hr(t,n)}return i=r.interleaved,i===null?(e.next=e,Ng(r)):(e.next=i.next,i.next=e),r.interleaved=e,Hr(t,n)}function uu(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,vg(t,n)}}function t0(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Xu(t,e,n,r){var i=t.updateQueue;hi=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=t.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var h=i.baseState;o=0,u=c=l=null,a=s;do{var f=a.lane,m=a.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var b=t,p=a;switch(f=e,m=n,p.tag){case 1:if(b=p.payload,typeof b=="function"){h=b.call(m,h,f);break e}h=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=p.payload,f=typeof b=="function"?b.call(m,h,f):b,f==null)break e;h=He({},h,f);break e;case 2:hi=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else m={eventTime:m,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=m,l=h):u=u.next=m,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(u===null&&(l=h),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Ms|=o,t.lanes=o,t.memoizedState=h}}function n0(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(B(191,i));i.call(r)}}}var mc={},vr=Ki(mc),Ol=Ki(mc),Ml=Ki(mc);function vs(t){if(t===mc)throw Error(B(174));return t}function Og(t,e){switch(je(Ml,e),je(Ol,t),je(vr,mc),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:im(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=im(e,t)}Fe(vr),je(vr,e)}function da(){Fe(vr),Fe(Ol),Fe(Ml)}function Gk(t){vs(Ml.current);var e=vs(vr.current),n=im(e,t.type);e!==n&&(je(Ol,t),je(vr,n))}function Mg(t){Ol.current===t&&(Fe(vr),Fe(Ol))}var We=Ki(0);function Zu(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Jh=[];function jg(){for(var t=0;t<Jh.length;t++)Jh[t]._workInProgressVersionPrimary=null;Jh.length=0}var du=Yr.ReactCurrentDispatcher,Yh=Yr.ReactCurrentBatchConfig,Os=0,qe=null,ut=null,ht=null,ed=!1,ul=!1,jl=0,bI=0;function _t(){throw Error(B(321))}function Dg(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Yn(t[n],e[n]))return!1;return!0}function Lg(t,e,n,r,i,s){if(Os=s,qe=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,du.current=t===null||t.memoizedState===null?SI:TI,t=n(r,i),ul){s=0;do{if(ul=!1,jl=0,25<=s)throw Error(B(301));s+=1,ht=ut=null,e.updateQueue=null,du.current=CI,t=n(r,i)}while(ul)}if(du.current=td,e=ut!==null&&ut.next!==null,Os=0,ht=ut=qe=null,ed=!1,e)throw Error(B(300));return t}function Ug(){var t=jl!==0;return jl=0,t}function or(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ht===null?qe.memoizedState=ht=t:ht=ht.next=t,ht}function Tn(){if(ut===null){var t=qe.alternate;t=t!==null?t.memoizedState:null}else t=ut.next;var e=ht===null?qe.memoizedState:ht.next;if(e!==null)ht=e,ut=t;else{if(t===null)throw Error(B(310));ut=t,t={memoizedState:ut.memoizedState,baseState:ut.baseState,baseQueue:ut.baseQueue,queue:ut.queue,next:null},ht===null?qe.memoizedState=ht=t:ht=ht.next=t}return ht}function Dl(t,e){return typeof e=="function"?e(t):e}function Qh(t){var e=Tn(),n=e.queue;if(n===null)throw Error(B(311));n.lastRenderedReducer=t;var r=ut,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,c=s;do{var u=c.lane;if((Os&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var h={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=h,o=r):l=l.next=h,qe.lanes|=u,Ms|=u}c=c.next}while(c!==null&&c!==s);l===null?o=r:l.next=a,Yn(r,e.memoizedState)||(Ht=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do s=i.lane,qe.lanes|=s,Ms|=s,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Xh(t){var e=Tn(),n=e.queue;if(n===null)throw Error(B(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=t(s,o.action),o=o.next;while(o!==i);Yn(s,e.memoizedState)||(Ht=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function Jk(){}function Yk(t,e){var n=qe,r=Tn(),i=e(),s=!Yn(r.memoizedState,i);if(s&&(r.memoizedState=i,Ht=!0),r=r.queue,Fg(Zk.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||ht!==null&&ht.memoizedState.tag&1){if(n.flags|=2048,Ll(9,Xk.bind(null,n,r,i,e),void 0,null),gt===null)throw Error(B(349));Os&30||Qk(n,e,i)}return i}function Qk(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=qe.updateQueue,e===null?(e={lastEffect:null,stores:null},qe.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function Xk(t,e,n,r){e.value=n,e.getSnapshot=r,eS(e)&&tS(t)}function Zk(t,e,n){return n(function(){eS(e)&&tS(t)})}function eS(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Yn(t,n)}catch{return!0}}function tS(t){var e=Hr(t,1);e!==null&&Jn(e,t,1,-1)}function r0(t){var e=or();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Dl,lastRenderedState:t},e.queue=t,t=t.dispatch=kI.bind(null,qe,t),[e.memoizedState,t]}function Ll(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=qe.updateQueue,e===null?(e={lastEffect:null,stores:null},qe.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function nS(){return Tn().memoizedState}function hu(t,e,n,r){var i=or();qe.flags|=t,i.memoizedState=Ll(1|e,n,void 0,r===void 0?null:r)}function zd(t,e,n,r){var i=Tn();r=r===void 0?null:r;var s=void 0;if(ut!==null){var o=ut.memoizedState;if(s=o.destroy,r!==null&&Dg(r,o.deps)){i.memoizedState=Ll(e,n,s,r);return}}qe.flags|=t,i.memoizedState=Ll(1|e,n,s,r)}function i0(t,e){return hu(8390656,8,t,e)}function Fg(t,e){return zd(2048,8,t,e)}function rS(t,e){return zd(4,2,t,e)}function iS(t,e){return zd(4,4,t,e)}function sS(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function oS(t,e,n){return n=n!=null?n.concat([t]):null,zd(4,4,sS.bind(null,e,t),n)}function Bg(){}function aS(t,e){var n=Tn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Dg(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function lS(t,e){var n=Tn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Dg(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function cS(t,e,n){return Os&21?(Yn(n,e)||(n=mk(),qe.lanes|=n,Ms|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Ht=!0),t.memoizedState=n)}function wI(t,e){var n=Ee;Ee=n!==0&&4>n?n:4,t(!0);var r=Yh.transition;Yh.transition={};try{t(!1),e()}finally{Ee=n,Yh.transition=r}}function uS(){return Tn().memoizedState}function xI(t,e,n){var r=Oi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},dS(t))hS(e,n);else if(n=Hk(t,e,n,r),n!==null){var i=Ut();Jn(n,t,r,i),fS(n,e,r)}}function kI(t,e,n){var r=Oi(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(dS(t))hS(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,Yn(a,o)){var l=e.interleaved;l===null?(i.next=i,Ng(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=Hk(t,e,i,r),n!==null&&(i=Ut(),Jn(n,t,r,i),fS(n,e,r))}}function dS(t){var e=t.alternate;return t===qe||e!==null&&e===qe}function hS(t,e){ul=ed=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function fS(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,vg(t,n)}}var td={readContext:Sn,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useInsertionEffect:_t,useLayoutEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useMutableSource:_t,useSyncExternalStore:_t,useId:_t,unstable_isNewReconciler:!1},SI={readContext:Sn,useCallback:function(t,e){return or().memoizedState=[t,e===void 0?null:e],t},useContext:Sn,useEffect:i0,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,hu(4194308,4,sS.bind(null,e,t),n)},useLayoutEffect:function(t,e){return hu(4194308,4,t,e)},useInsertionEffect:function(t,e){return hu(4,2,t,e)},useMemo:function(t,e){var n=or();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=or();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=xI.bind(null,qe,t),[r.memoizedState,t]},useRef:function(t){var e=or();return t={current:t},e.memoizedState=t},useState:r0,useDebugValue:Bg,useDeferredValue:function(t){return or().memoizedState=t},useTransition:function(){var t=r0(!1),e=t[0];return t=wI.bind(null,t[1]),or().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=qe,i=or();if(ze){if(n===void 0)throw Error(B(407));n=n()}else{if(n=e(),gt===null)throw Error(B(349));Os&30||Qk(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,i0(Zk.bind(null,r,s,t),[t]),r.flags|=2048,Ll(9,Xk.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=or(),e=gt.identifierPrefix;if(ze){var n=zr,r=Br;n=(r&~(1<<32-Gn(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=jl++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=bI++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},TI={readContext:Sn,useCallback:aS,useContext:Sn,useEffect:Fg,useImperativeHandle:oS,useInsertionEffect:rS,useLayoutEffect:iS,useMemo:lS,useReducer:Qh,useRef:nS,useState:function(){return Qh(Dl)},useDebugValue:Bg,useDeferredValue:function(t){var e=Tn();return cS(e,ut.memoizedState,t)},useTransition:function(){var t=Qh(Dl)[0],e=Tn().memoizedState;return[t,e]},useMutableSource:Jk,useSyncExternalStore:Yk,useId:uS,unstable_isNewReconciler:!1},CI={readContext:Sn,useCallback:aS,useContext:Sn,useEffect:Fg,useImperativeHandle:oS,useInsertionEffect:rS,useLayoutEffect:iS,useMemo:lS,useReducer:Xh,useRef:nS,useState:function(){return Xh(Dl)},useDebugValue:Bg,useDeferredValue:function(t){var e=Tn();return ut===null?e.memoizedState=t:cS(e,ut.memoizedState,t)},useTransition:function(){var t=Xh(Dl)[0],e=Tn().memoizedState;return[t,e]},useMutableSource:Jk,useSyncExternalStore:Yk,useId:uS,unstable_isNewReconciler:!1};function Mn(t,e){if(t&&t.defaultProps){e=He({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Cm(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:He({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var $d={isMounted:function(t){return(t=t._reactInternals)?Ws(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Ut(),i=Oi(t),s=Vr(r,i);s.payload=e,n!=null&&(s.callback=n),e=Ni(t,s,i),e!==null&&(Jn(e,t,i,r),uu(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Ut(),i=Oi(t),s=Vr(r,i);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=Ni(t,s,i),e!==null&&(Jn(e,t,i,r),uu(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Ut(),r=Oi(t),i=Vr(n,r);i.tag=2,e!=null&&(i.callback=e),e=Ni(t,i,r),e!==null&&(Jn(e,t,r,n),uu(e,t,r))}};function s0(t,e,n,r,i,s,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,o):e.prototype&&e.prototype.isPureReactComponent?!Rl(n,r)||!Rl(i,s):!0}function mS(t,e,n){var r=!1,i=Fi,s=e.contextType;return typeof s=="object"&&s!==null?s=Sn(s):(i=Jt(e)?Ns:At.current,r=e.contextTypes,s=(r=r!=null)?la(t,i):Fi),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=$d,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function o0(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&$d.enqueueReplaceState(e,e.state,null)}function Em(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},Ag(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=Sn(s):(s=Jt(e)?Ns:At.current,i.context=la(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(Cm(t,e,s,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&$d.enqueueReplaceState(i,i.state,null),Xu(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function ha(t,e){try{var n="",r=e;do n+=ZP(r),r=r.return;while(r);var i=n}catch(s){i=`
39Error generating stack: `+s.message+`
40`+s.stack}return{value:t,source:e,stack:i,digest:null}}function Zh(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function _m(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var EI=typeof WeakMap=="function"?WeakMap:Map;function pS(t,e,n){n=Vr(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){rd||(rd=!0,Lm=r),_m(t,e)},n}function gS(t,e,n){n=Vr(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){_m(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){_m(t,e),typeof r!="function"&&(Ai===null?Ai=new Set([this]):Ai.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function a0(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new EI;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=BI.bind(null,t,e,n),e.then(t,t))}function l0(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function c0(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=Vr(-1,1),e.tag=2,Ni(n,e,1))),n.lanes|=1),t)}var _I=Yr.ReactCurrentOwner,Ht=!1;function Mt(t,e,n,r){e.child=t===null?qk(e,null,n,r):ua(e,t.child,n,r)}function u0(t,e,n,r,i){n=n.render;var s=e.ref;return Do(e,i),r=Lg(t,e,n,r,s,i),n=Ug(),t!==null&&!Ht?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Kr(t,e,i)):(ze&&n&&Cg(e),e.flags|=1,Mt(t,e,r,i),e.child)}function d0(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!Gg(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,vS(t,e,s,r,i)):(t=gu(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:Rl,n(o,r)&&t.ref===e.ref)return Kr(t,e,i)}return e.flags|=1,t=Mi(s,r),t.ref=e.ref,t.return=e,e.child=t}function vS(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(Rl(s,r)&&t.ref===e.ref)if(Ht=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(Ht=!0);else return e.lanes=t.lanes,Kr(t,e,i)}return Pm(t,e,n,r,i)}function yS(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},je(_o,en),en|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,je(_o,en),en|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,je(_o,en),en|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,je(_o,en),en|=r;return Mt(t,e,i,n),e.child}function bS(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}
vendor: 5,244 bytes, line 40
40function Pm(t,e,n,r,i){var s=Jt(n)?Ns:At.current;return s=la(e,s),Do(e,i),n=Lg(t,e,n,r,s,i),r=Ug(),t!==null&&!Ht?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Kr(t,e,i)):(ze&&r&&Cg(e),e.flags|=1,Mt(t,e,n,i),e.child)}function h0(t,e,n,r,i){if(Jt(n)){var s=!0;Ku(e)}else s=!1;if(Do(e,i),e.stateNode===null)fu(t,e),mS(e,n,r),Em(e,n,r,i),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=Sn(c):(c=Jt(n)?Ns:At.current,c=la(e,c));var u=n.getDerivedStateFromProps,h=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==c)&&o0(e,o,r,c),hi=!1;var f=e.memoizedState;o.state=f,Xu(e,r,o,i),l=e.memoizedState,a!==r||f!==l||Gt.current||hi?(typeof u=="function"&&(Cm(e,n,u,r),l=e.memoizedState),(a=hi||s0(e,n,a,r,f,l,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,Kk(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Mn(e.type,a),o.props=c,h=e.pendingProps,f=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Sn(l):(l=Jt(n)?Ns:At.current,l=la(e,l));var m=n.getDerivedStateFromProps;(u=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||f!==l)&&o0(e,o,r,l),hi=!1,f=e.memoizedState,o.state=f,Xu(e,r,o,i);var b=e.memoizedState;a!==h||f!==b||Gt.current||hi?(typeof m=="function"&&(Cm(e,n,m,r),b=e.memoizedState),(c=hi||s0(e,n,c,r,f,b,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,b,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,b,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=b),o.props=r,o.state=b,o.context=l,r=c):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return Rm(t,e,n,r,s,i)}function Rm(t,e,n,r,i,s){bS(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&Qy(e,n,!1),Kr(t,e,s);r=e.stateNode,_I.current=e;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=ua(e,t.child,null,s),e.child=ua(e,null,a,s)):Mt(t,e,a,s),e.memoizedState=r.state,i&&Qy(e,n,!0),e.child}function wS(t){var e=t.stateNode;e.pendingContext?Yy(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Yy(t,e.context,!1),Og(t,e.containerInfo)}function f0(t,e,n,r,i){return ca(),_g(i),e.flags|=256,Mt(t,e,n,r),e.child}var Im={dehydrated:null,treeContext:null,retryLane:0};function Nm(t){return{baseLanes:t,cachePool:null,transitions:null}}function xS(t,e,n){var r=e.pendingProps,i=We.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),je(We,i&1),t===null)return Sm(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=qd(o,r,0,null),t=_s(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=Nm(n),e.memoizedState=Im,t):zg(e,o));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return PI(t,e,o,r,a,i,n);if(s){s=r.fallback,o=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=Mi(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=Mi(a,s):(s=_s(s,o,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=t.child.memoizedState,o=o===null?Nm(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~n,e.memoizedState=Im,r}return s=t.child,t=s.sibling,r=Mi(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function zg(t,e){return e=qd({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function jc(t,e,n,r){return r!==null&&_g(r),ua(e,t.child,null,n),t=zg(e,e.pen
vendor: 4,861 bytes, line 40
40dingProps.children),t.flags|=2,e.memoizedState=null,t}function PI(t,e,n,r,i,s,o){if(n)return e.flags&256?(e.flags&=-257,r=Zh(Error(B(422))),jc(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=qd({mode:"visible",children:r.children},i,0,null),s=_s(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&ua(e,t.child,null,o),e.child.memoizedState=Nm(o),e.memoizedState=Im,s);if(!(e.mode&1))return jc(t,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(B(419)),r=Zh(s,r,void 0),jc(t,e,o,r)}if(a=(o&t.childLanes)!==0,Ht||a){if(r=gt,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Hr(t,i),Jn(r,t,i,-1))}return Kg(),r=Zh(Error(B(421))),jc(t,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=zI.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,rn=Ii(i.nextSibling),on=e,ze=!0,$n=null,t!==null&&(yn[bn++]=Br,yn[bn++]=zr,yn[bn++]=As,Br=t.id,zr=t.overflow,As=e),e=zg(e,r.children),e.flags|=4096,e)}function m0(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Tm(t.return,e,n)}function ef(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function kS(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(Mt(t,e,r.children,n),r=We.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&m0(t,n,e);else if(t.tag===19)m0(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(je(We,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&Zu(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),ef(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Zu(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}ef(e,!0,n,null,s);break;case"together":ef(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function fu(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Kr(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Ms|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(B(153));if(e.child!==null){for(t=e.child,n=Mi(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Mi(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function RI(t,e,n){switch(e.tag){case 3:wS(e),ca();break;case 5:Gk(e);break;case 1:Jt(e.type)&&Ku(e);break;case 4:Og(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;je(Yu,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(je(We,We.current&1),e.flags|=128,null):n&e.child.childLanes?xS(t,e,n):(je(We,We.current&1),t=Kr(t,e,n),t!==null?t.sibling:null);je(We,We.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return kS(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),je(We,We.current),r)break;return null;case 22:case 23:return e.lanes=0,yS(t,e,n)}return Kr(t,e,n)}var SS,Am,TS,CS;SS=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Am=function(){};TS=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,vs(vr.current);var s=null;switch(n){case"input":i=em(t,i),r=em(t,r),s=[];break;case"select":i=He({},i,{value:void 0}),r=He({},r,{value:void 0}),s=[];break;case"textarea":i=rm(t,i),r=rm(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=qu)}sm(n,r);var o;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(kl.hasOwnProperty(c)?s||
vendor: 5,320 bytes, line 40
40(s=[]):(s=s||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(kl.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ue("scroll",t),s||a===l||(s=[])):(s=s||[]).push(c,l))}n&&(s=s||[]).push("style",n);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};CS=function(t,e,n,r){n!==r&&(e.flags|=4)};function Ua(t,e){if(!ze)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Pt(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function II(t,e,n){var r=e.pendingProps;switch(Eg(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(e),null;case 1:return Jt(e.type)&&Hu(),Pt(e),null;case 3:return r=e.stateNode,da(),Fe(Gt),Fe(At),jg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Oc(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,$n!==null&&(Bm($n),$n=null))),Am(t,e),Pt(e),null;case 5:Mg(e);var i=vs(Ml.current);if(n=e.type,t!==null&&e.stateNode!=null)TS(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(B(166));return Pt(e),null}if(t=vs(vr.current),Oc(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[hr]=e,r[Al]=s,t=(e.mode&1)!==0,n){case"dialog":Ue("cancel",r),Ue("close",r);break;case"iframe":case"object":case"embed":Ue("load",r);break;case"video":case"audio":for(i=0;i<el.length;i++)Ue(el[i],r);break;case"source":Ue("error",r);break;case"img":case"image":case"link":Ue("error",r),Ue("load",r);break;case"details":Ue("toggle",r);break;case"input":Sy(r,s),Ue("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Ue("invalid",r);break;case"textarea":Cy(r,s),Ue("invalid",r)}sm(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Ac(r.textContent,a,t),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Ac(r.textContent,a,t),i=["children",""+a]):kl.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&Ue("scroll",r)}switch(n){case"input":Tc(r),Ty(r,s,!0);break;case"textarea":Tc(r),Ey(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=qu)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Zx(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[hr]=e,t[Al]=r,SS(t,e,!1,!1),e.stateNode=t;e:{switch(o=om(n,r),n){case"dialog":Ue("cancel",t),Ue("close",t),i=r;break;case"iframe":case"object":case"embed":Ue("load",t),i=r;break;case"video":case"audio":for(i=0;i<el.length;i++)Ue(el[i],t);i=r;break;case"source":Ue("error",t),i=r;break;case"img":case"image":case"link":Ue("error",t),Ue("load",t),i=r;break;case"details":Ue("toggle",t),i=r;break;case"input":Sy(t,r),i=em(t,r),Ue("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=He({},r,{value:void 0}),Ue("invalid",t);break;case"textarea":Cy(t,r),i=rm(t,r),Ue("invalid",t);break;default:i=r}sm(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?nk(t,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&ek(t,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Sl(t,l):typeof l=="number"&&Sl(t,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(kl.hasOwnProperty(s)?l!=null&&s==="onScroll"&&Ue("scroll",t):l!=null&&dg(t,s,l,o))}switch(n){case"input":Tc(t),Ty(t,r,!1);break;case"textarea":Tc(t),Ey(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Ui(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?Ao(t,!!r.multiple,s,!1):r.defaultValue!=null&&Ao(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=qu)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}
vendor: 27,620 bytes, line 40
40return Pt(e),null;case 6:if(t&&e.stateNode!=null)CS(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(B(166));if(n=vs(Ml.current),vs(vr.current),Oc(e)){if(r=e.stateNode,n=e.memoizedProps,r[hr]=e,(s=r.nodeValue!==n)&&(t=on,t!==null))switch(t.tag){case 3:Ac(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Ac(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[hr]=e,e.stateNode=r}return Pt(e),null;case 13:if(Fe(We),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(ze&&rn!==null&&e.mode&1&&!(e.flags&128))Vk(),ca(),e.flags|=98560,s=!1;else if(s=Oc(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(B(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(B(317));s[hr]=e}else ca(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Pt(e),s=!1}else $n!==null&&(Bm($n),$n=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||We.current&1?dt===0&&(dt=3):Kg())),e.updateQueue!==null&&(e.flags|=4),Pt(e),null);case 4:return da(),Am(t,e),t===null&&Il(e.stateNode.containerInfo),Pt(e),null;case 10:return Ig(e.type._context),Pt(e),null;case 17:return Jt(e.type)&&Hu(),Pt(e),null;case 19:if(Fe(We),s=e.memoizedState,s===null)return Pt(e),null;if(r=(e.flags&128)!==0,o=s.rendering,o===null)if(r)Ua(s,!1);else{if(dt!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=Zu(t),o!==null){for(e.flags|=128,Ua(s,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)s=n,t=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,t=o.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return je(We,We.current&1|2),e.child}t=t.sibling}s.tail!==null&&nt()>fa&&(e.flags|=128,r=!0,Ua(s,!1),e.lanes=4194304)}else{if(!r)if(t=Zu(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ua(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!ze)return Pt(e),null}else 2*nt()-s.renderingStartTime>fa&&n!==1073741824&&(e.flags|=128,r=!0,Ua(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=nt(),e.sibling=null,n=We.current,je(We,r?n&1|2:n&1),e):(Pt(e),null);case 22:case 23:return Hg(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?en&1073741824&&(Pt(e),e.subtreeFlags&6&&(e.flags|=8192)):Pt(e),null;case 24:return null;case 25:return null}throw Error(B(156,e.tag))}function NI(t,e){switch(Eg(e),e.tag){case 1:return Jt(e.type)&&Hu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return da(),Fe(Gt),Fe(At),jg(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Mg(e),null;case 13:if(Fe(We),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(B(340));ca()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Fe(We),null;case 4:return da(),null;case 10:return Ig(e.type._context),null;case 22:case 23:return Hg(),null;case 24:return null;default:return null}}var Dc=!1,It=!1,AI=typeof WeakSet=="function"?WeakSet:Set,J=null;function Eo(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qe(t,e,r)}else n.current=null}function Om(t,e,n){try{n()}catch(r){Qe(t,e,r)}}var p0=!1;function OI(t,e){if(gm=$u,t=Ik(),Tg(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,h=t,f=null;t:for(;;){for(var m;h!==n||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)f=h,h=m;for(;;){if(h===t)break t;if(f===n&&++c===i&&(a=o),f===s&&++u===r&&(l=o),(m=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(vm={focusedElem:t,selectionRange:n},$u=!1,J=e;J!==null;)if(e=J,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,J=t;else for(;J!==null;){e=J;try{var b=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var p=b.memoizedProps,g=b.memoizedState,v=e.stateNode,y=v.getSnapshotBeforeUpdate(e.elementType===e.type?p:Mn(e.type,p),g);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(B(163))}}catch(k){Qe(e,e.return,k)}if(t=e.sibling,t!==null){t.return=e.return,J=t;break}J=e.return}return b=p0,p0=!1,b}function dl(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Om(e,n,s)}i=i.next}while(i!==r)}}function Vd(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Mm(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function ES(t){var e=t.alternate;e!==null&&(t.alternate=null,ES(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[hr],delete e[Al],delete e[wm],delete e[pI],delete e[gI])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function _S(t){return t.tag===5||t.tag===3||t.tag===4}function g0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||_S(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function jm(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=qu));else if(r!==4&&(t=t.child,t!==null))for(jm(t,e,n),t=t.sibling;t!==null;)jm(t,e,n),t=t.sibling}function Dm(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Dm(t,e,n),t=t.sibling;t!==null;)Dm(t,e,n),t=t.sibling}var bt=null,Fn=!1;function ni(t,e,n){for(n=n.child;n!==null;)PS(t,e,n),n=n.sibling}function PS(t,e,n){if(gr&&typeof gr.onCommitFiberUnmount=="function")try{gr.onCommitFiberUnmount(jd,n)}catch{}switch(n.tag){case 5:It||Eo(n,e);case 6:var r=bt,i=Fn;bt=null,ni(t,e,n),bt=r,Fn=i,bt!==null&&(Fn?(t=bt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):bt.removeChild(n.stateNode));break;case 18:bt!==null&&(Fn?(t=bt,n=n.stateNode,t.nodeType===8?Kh(t.parentNode,n):t.nodeType===1&&Kh(t,n),_l(t)):Kh(bt,n.stateNode));break;case 4:r=bt,i=Fn,bt=n.stateNode.containerInfo,Fn=!0,ni(t,e,n),bt=r,Fn=i;break;case 0:case 11:case 14:case 15:if(!It&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Om(n,e,o),i=i.next}while(i!==r)}ni(t,e,n);break;case 1:if(!It&&(Eo(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Qe(n,e,a)}ni(t,e,n);break;case 21:ni(t,e,n);break;case 22:n.mode&1?(It=(r=It)||n.memoizedState!==null,ni(t,e,n),It=r):ni(t,e,n);break;default:ni(t,e,n)}}function v0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new AI),e.forEach(function(r){var i=$I.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Rn(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:bt=a.stateNode,Fn=!1;break e;case 3:bt=a.stateNode.containerInfo,Fn=!0;break e;case 4:bt=a.stateNode.containerInfo,Fn=!0;break e}a=a.return}if(bt===null)throw Error(B(160));PS(s,o,i),bt=null,Fn=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Qe(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)RS(e,t),e=e.sibling}function RS(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Rn(e,t),ir(t),r&4){try{dl(3,t,t.return),Vd(3,t)}catch(p){Qe(t,t.return,p)}try{dl(5,t,t.return)}catch(p){Qe(t,t.return,p)}}break;case 1:Rn(e,t),ir(t),r&512&&n!==null&&Eo(n,n.return);break;case 5:if(Rn(e,t),ir(t),r&512&&n!==null&&Eo(n,n.return),t.flags&32){var i=t.stateNode;try{Sl(i,"")}catch(p){Qe(t,t.return,p)}}if(r&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,o=n!==null?n.memoizedProps:s,a=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&Qx(i,s),om(a,o);var c=om(a,s);for(o=0;o<l.length;o+=2){var u=l[o],h=l[o+1];u==="style"?nk(i,h):u==="dangerouslySetInnerHTML"?ek(i,h):u==="children"?Sl(i,h):dg(i,u,h,c)}switch(a){case"input":tm(i,s);break;case"textarea":Xx(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var m=s.value;m!=null?Ao(i,!!s.multiple,m,!1):f!==!!s.multiple&&(s.defaultValue!=null?Ao(i,!!s.multiple,s.defaultValue,!0):Ao(i,!!s.multiple,s.multiple?[]:"",!1))}i[Al]=s}catch(p){Qe(t,t.return,p)}}break;case 6:if(Rn(e,t),ir(t),r&4){if(t.stateNode===null)throw Error(B(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(p){Qe(t,t.return,p)}}break;case 3:if(Rn(e,t),ir(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{_l(e.containerInfo)}catch(p){Qe(t,t.return,p)}break;case 4:Rn(e,t),ir(t);break;case 13:Rn(e,t),ir(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Wg=nt())),r&4&&v0(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(It=(c=It)||u,Rn(e,t),It=c):Rn(e,t),ir(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(J=t,u=t.child;u!==null;){for(h=J=u;J!==null;){switch(f=J,m=f.child,f.tag){case 0:case 11:case 14:case 15:dl(4,f,f.return);break;case 1:Eo(f,f.return);var b=f.stateNode;if(typeof b.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,b.props=e.memoizedProps,b.state=e.memoizedState,b.componentWillUnmount()}catch(p){Qe(r,n,p)}}break;case 5:Eo(f,f.return);break;case 22:if(f.memoizedState!==null){b0(h);continue}}m!==null?(m.return=f,J=m):b0(h)}u=u.sibling}e:for(u=null,h=t;;){if(h.tag===5){if(u===null){u=h;try{i=h.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=tk("display",o))}catch(p){Qe(t,t.return,p)}}}else if(h.tag===6){if(u===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(p){Qe(t,t.return,p)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;u===h&&(u=null),h=h.return}u===h&&(u=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Rn(e,t),ir(t),r&4&&v0(t);break;case 21:break;default:Rn(e,t),ir(t)}}function ir(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(_S(n)){var r=n;break e}n=n.return}throw Error(B(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Sl(i,""),r.flags&=-33);var s=g0(t);Dm(t,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=g0(t);jm(t,a,o);break;default:throw Error(B(161))}}catch(l){Qe(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function MI(t,e,n){J=t,IS(t)}function IS(t,e,n){for(var r=(t.mode&1)!==0;J!==null;){var i=J,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Dc;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||It;a=Dc;var c=It;if(Dc=o,(It=l)&&!c)for(J=i;J!==null;)o=J,l=o.child,o.tag===22&&o.memoizedState!==null?w0(i):l!==null?(l.return=o,J=l):w0(i);for(;s!==null;)J=s,IS(s),s=s.sibling;J=i,Dc=a,It=c}y0(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,J=s):y0(t)}}function y0(t){for(;J!==null;){var e=J;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:It||Vd(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!It)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:Mn(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&n0(e,s,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}n0(e,o,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var h=u.dehydrated;h!==null&&_l(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(B(163))}It||e.flags&512&&Mm(e)}catch(f){Qe(e,e.return,f)}}if(e===t){J=null;break}if(n=e.sibling,n!==null){n.return=e.return,J=n;break}J=e.return}}function b0(t){for(;J!==null;){var e=J;if(e===t){J=null;break}var n=e.sibling;if(n!==null){n.return=e.return,J=n;break}J=e.return}}function w0(t){for(;J!==null;){var e=J;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Vd(4,e)}catch(l){Qe(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){Qe(e,i,l)}}var s=e.return;try{Mm(e)}catch(l){Qe(e,s,l)}break;case 5:var o=e.return;try{Mm(e)}catch(l){Qe(e,o,l)}}}catch(l){Qe(e,e.return,l)}if(e===t){J=null;break}var a=e.sibling;if(a!==null){a.return=e.return,J=a;break}J=e.return}}var jI=Math.ceil,nd=Yr.ReactCurrentDispatcher,$g=Yr.ReactCurrentOwner,kn=Yr.ReactCurrentBatchConfig,be=0,gt=null,at=null,kt=0,en=0,_o=Ki(0),dt=0,Ul=null,Ms=0,Wd=0,Vg=0,hl=null,Wt=null,Wg=0,fa=1/0,Ir=null,rd=!1,Lm=null,Ai=null,Lc=!1,Ti=null,id=0,fl=0,Um=null,mu=-1,pu=0;function Ut(){return be&6?nt():mu!==-1?mu:mu=nt()}function Oi(t){return t.mode&1?be&2&&kt!==0?kt&-kt:yI.transition!==null?(pu===0&&(pu=mk()),pu):(t=Ee,t!==0||(t=window.event,t=t===void 0?16:xk(t.type)),t):1}function Jn(t,e,n,r){if(50<fl)throw fl=0,Um=null,Error(B(185));dc(t,n,r),(!(be&2)||t!==gt)&&(t===gt&&(!(be&2)&&(Wd|=n),dt===4&&pi(t,kt)),Yt(t,r),n===1&&be===0&&!(e.mode&1)&&(fa=nt()+500,Bd&&Gi()))}function Yt(t,e){var n=t.callbackNode;yR(t,e);var r=zu(t,t===gt?kt:0);if(r===0)n!==null&&Ry(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&Ry(n),e===1)t.tag===0?vI(x0.bind(null,t)):Bk(x0.bind(null,t)),fI(function(){!(be&6)&&Gi()}),n=null;else{switch(pk(r)){case 1:n=gg;break;case 4:n=hk;break;case 16:n=Bu;break;case 536870912:n=fk;break;default:n=Bu}n=US(n,NS.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function NS(t,e){if(mu=-1,pu=0,be&6)throw Error(B(327));var n=t.callbackNode;if(Lo()&&t.callbackNode!==n)return null;var r=zu(t,t===gt?kt:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=sd(t,r);else{e=r;var i=be;be|=2;var s=OS();(gt!==t||kt!==e)&&(Ir=null,fa=nt()+500,Es(t,e));do try{UI();break}catch(a){AS(t,a)}while(!0);Rg(),nd.current=s,be=i,at!==null?e=0:(gt=null,kt=0,e=dt)}if(e!==0){if(e===2&&(i=dm(t),i!==0&&(r=i,e=Fm(t,i))),e===1)throw n=Ul,Es(t,0),pi(t,r),Yt(t,nt()),n;if(e===6)pi(t,r);else{if(i=t.current.alternate,!(r&30)&&!DI(i)&&(e=sd(t,r),e===2&&(s=dm(t),s!==0&&(r=s,e=Fm(t,s))),e===1))throw n=Ul,Es(t,0),pi(t,r),Yt(t,nt()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(B(345));case 2:ls(t,Wt,Ir);break;case 3:if(pi(t,r),(r&130023424)===r&&(e=Wg+500-nt(),10<e)){if(zu(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){Ut(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=bm(ls.bind(null,t,Wt,Ir),e);break}ls(t,Wt,Ir);break;case 4:if(pi(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var o=31-Gn(r);s=1<<o,o=e[o],o>i&&(i=o),r&=~s}if(r=i,r=nt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*jI(r/1960))-r,10<r){t.timeoutHandle=bm(ls.bind(null,t,Wt,Ir),r);break}ls(t,Wt,Ir);break;case 5:ls(t,Wt,Ir);break;default:throw Error(B(329))}}}return Yt(t,nt()),t.callbackNode===n?NS.bind(null,t):null}function Fm(t,e){var n=hl;return t.current.memoizedState.isDehydrated&&(Es(t,e).flags|=256),t=sd(t,e),t!==2&&(e=Wt,Wt=n,e!==null&&Bm(e)),t}function Bm(t){Wt===null?Wt=t:Wt.push.apply(Wt,t)}function DI(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!Yn(s(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function pi(t,e){for(e&=~Vg,e&=~Wd,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Gn(e),r=1<<n;t[n]=-1,e&=~r}}function x0(t){if(be&6)throw Error(B(327));Lo();var e=zu(t,0);if(!(e&1))return Yt(t,nt()),null;var n=sd(t,e);if(t.tag!==0&&n===2){var r=dm(t);r!==0&&(e=r,n=Fm(t,r))}if(n===1)throw n=Ul,Es(t,0),pi(t,e),Yt(t,nt()),n;if(n===6)throw Error(B(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,ls(t,Wt,Ir),Yt(t,nt()),null}function qg(t,e){var n=be;be|=1;try{return t(e)}finally{be=n,be===0&&(fa=nt()+500,Bd&&Gi())}}function js(t){Ti!==null&&Ti.tag===0&&!(be&6)&&Lo();var e=be;be|=1;var n=kn.transition,r=Ee;try{if(kn.transition=null,Ee=1,t)return t()}finally{Ee=r,kn.transition=n,be=e,!(be&6)&&Gi()}}function Hg(){en=_o.current,Fe(_o)}function Es(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,hI(n)),at!==null)for(n=at.return;n!==null;){var r=n;switch(Eg(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Hu();break;case 3:da(),Fe(Gt),Fe(At),jg();break;case 5:Mg(r);break;case 4:da();break;case 13:Fe(We);break;case 19:Fe(We);break;case 10:Ig(r.type._context);break;case 22:case 23:Hg()}n=n.return}if(gt=t,at=t=Mi(t.current,null),kt=en=e,dt=0,Ul=null,Vg=Wd=Ms=0,Wt=hl=null,gs!==null){for(e=0;e<gs.length;e++)if(n=gs[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}gs=null}return t}function AS(t,e){do{var n=at;try{if(Rg(),du.current=td,ed){for(var r=qe.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}ed=!1}if(Os=0,ht=ut=qe=null,ul=!1,jl=0,$g.current=null,n===null||n.return===null){dt=1,Ul=e,at=null;break}e:{var s=t,o=n.return,a=n,l=e;if(e=kt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,h=u.tag;if(!(u.mode&1)&&(h===0||h===11||h===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var m=l0(o);if(m!==null){m.flags&=-257,c0(m,o,a,s,e),m.mode&1&&a0(s,c,e),e=m,l=c;var b=e.updateQueue;if(b===null){var p=new Set;p.add(l),e.updateQueue=p}else b.add(l);break e}else{if(!(e&1)){a0(s,c,e),Kg();break e}l=Error(B(426))}}else if(ze&&a.mode&1){var g=l0(o);if(g!==null){!(g.flags&65536)&&(g.flags|=256),c0(g,o,a,s,e),_g(ha(l,a));break e}}s=l=ha(l,a),dt!==4&&(dt=2),hl===null?hl=[s]:hl.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var v=pS(s,l,e);t0(s,v);break e;case 1:a=l;var y=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof y.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Ai===null||!Ai.has(w)))){s.flags|=65536,e&=-e,s.lanes|=e;var k=gS(s,a,e);t0(s,k);break e}}s=s.return}while(s!==null)}jS(n)}catch(S){e=S,at===n&&n!==null&&(at=n=n.return);continue}break}while(!0)}function OS(){var t=nd.current;return nd.current=td,t===null?td:t}function Kg(){(dt===0||dt===3||dt===2)&&(dt=4),gt===null||!(Ms&268435455)&&!(Wd&268435455)||pi(gt,kt)}function sd(t,e){var n=be;be|=2;var r=OS();(gt!==t||kt!==e)&&(Ir=null,Es(t,e));do try{LI();break}catch(i){AS(t,i)}while(!0);if(Rg(),be=n,nd.current=r,at!==null)throw Error(B(261));return gt=null,kt=0,dt}function LI(){for(;at!==null;)MS(at)}function UI(){for(;at!==null&&!cR();)MS(at)}function MS(t){var e=LS(t.alternate,t,en);t.memoizedProps=t.pendingProps,e===null?jS(t):at=e,$g.current=null}function jS(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=NI(n,e),n!==null){n.flags&=32767,at=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{dt=6,at=null;return}}else if(n=II(n,e,en),n!==null){at=n;return}if(e=e.sibling,e!==null){at=e;return}at=e=t}while(e!==null);dt===0&&(dt=5)}function ls(t,e,n){var r=Ee,i=kn.transition;try{kn.transition=null,Ee=1,FI(t,e,n,r)}finally{kn.transition=i,Ee=r}return null}function FI(t,e,n,r){do Lo();while(Ti!==null);if(be&6)throw Error(B(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(B(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(bR(t,s),t===gt&&(at=gt=null,kt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Lc||(Lc=!0,US(Bu,function(){return Lo(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=kn.transition,kn.transition=null;var o=Ee;Ee=1;var a=be;be|=4,$g.current=null,OI(t,n),RS(n,t),sI(vm),$u=!!gm,vm=gm=null,t.current=n,MI(n),uR(),be=a,Ee=o,kn.transition=s}else t.current=n;if(Lc&&(Lc=!1,Ti=t,id=i),s=t.pendingLanes,s===0&&(Ai=null),fR(n.stateNode),Yt(t,nt()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(rd)throw rd=!1,t=Lm,Lm=null,t;return id&1&&t.tag!==0&&Lo(),s=t.pendingLanes,s&1?t===Um?fl++:(fl=0,Um=t):fl=0,Gi(),null}function Lo(){if(Ti!==null){var t=pk(id),e=kn.transition,n=Ee;try{if(kn.transition=null,Ee=16>t?16:t,Ti===null)var r=!1;else{if(t=Ti,Ti=null,id=0,be&6)throw Error(B(331));var i=be;for(be|=4,J=t.current;J!==null;){var s=J,o=s.child;if(J.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(J=c;J!==null;){var u=J;switch(u.tag){case 0:case 11:case 15:dl(8,u,s)}var h=u.child;if(h!==null)h.return=u,J=h;else for(;J!==null;){u=J;var f=u.sibling,m=u.return;if(ES(u),u===c){J=null;break}if(f!==null){f.return=m,J=f;break}J=m}}}var b=s.alternate;if(b!==null){var p=b.child;if(p!==null){b.child=null;do{var g=p.sibling;p.sibling=null,p=g}while(p!==null)}}J=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,J=o;else e:for(;J!==null;){if(s=J,s.flags&2048)switch(s.tag){case 0:case 11:case 15:dl(9,s,s.return)}var v=s.sibling;if(v!==null){v.return=s.return,J=v;break e}J=s.return}}var y=t.current;for(J=y;J!==null;){o=J;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,J=w;else e:for(o=y;J!==null;){if(a=J,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Vd(9,a)}}catch(S){Qe(a,a.return,S)}if(a===o){J=null;break e}var k=a.sibling;if(k!==null){k.return=a.return,J=k;break e}J=a.return}}if(be=i,Gi(),gr&&typeof gr.onPostCommitFiberRoot=="function")try{gr.onPostCommitFiberRoot(jd,t)}catch{}r=!0}return r}finally{Ee=n,kn.transition=e}}return!1}function k0(t,e,n){e=ha(n,e),e=pS(t,e,1),t=Ni(t,e,1),e=Ut(),t!==null&&(dc(t,1,e),Yt(t,e))}function Qe(t,e,n){if(t.tag===3)k0(t,t,n);else for(;e!==null;){if(e.tag===3){k0(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ai===null||!Ai.has(r))){t=ha(n,t),t=gS(e,t,1),e=Ni(e,t,1),t=Ut(),e!==null&&(dc(e,1,t),Yt(e,t));break}}e=e.return}}function BI(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Ut(),t.pingedLanes|=t.suspendedLanes&n,gt===t&&(kt&n)===n&&(dt===4||dt===3&&(kt&130023424)===kt&&500>nt()-Wg?Es(t,0):Vg|=n),Yt(t,e)}function DS(t,e){e===0&&(t.mode&1?(e=_c,_c<<=1,!(_c&130023424)&&(_c=4194304)):e=1);var n=Ut();t=Hr(t,e),t!==null&&(dc(t,e,n),Yt(t,n))}function zI(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),DS(t,n)}function $I(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(B(314))}r!==null&&r.delete(e),DS(t,n)}var LS;LS=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Gt.current)Ht=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ht=!1,RI(t,e,n);Ht=!!(t.flags&131072)}else Ht=!1,ze&&e.flags&1048576&&zk(e,Ju,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;fu(t,e),t=e.pendingProps;var i=la(e,At.current);Do(e,n),i=Lg(null,e,r,t,i,n);var s=Ug();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Jt(r)?(s=!0,Ku(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ag(e),i.updater=$d,e.stateNode=i,i._reactInternals=e,Em(e,r,t,n),e=Rm(null,e,r,!0,s,n)):(e.tag=0,ze&&s&&Cg(e),Mt(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(fu(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=WI(r),t=Mn(r,t),i){case 0:e=Pm(null,e,r,t,n);break e;case 1:e=h0(null,e,r,t,n);break e;case 11:e=u0(null,e,r,t,n);break e;case 14:e=d0(null,e,r,Mn(r.type,t),n);break e}throw Error(B(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Mn(r,i),Pm(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Mn(r,i),h0(t,e,r,i,n);case 3:e:{if(wS(e),t===null)throw Error(B(387));r=e.pendingProps,s=e.memoizedState,i=s.element,Kk(t,e),Xu(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=ha(Error(B(423)),e),e=f0(t,e,r,n,i);break e}else if(r!==i){i=ha(Error(B(424)),e),e=f0(t,e,r,n,i);break e}else for(rn=Ii(e.stateNode.containerInfo.firstChild),on=e,ze=!0,$n=null,n=qk(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ca(),r===i){e=Kr(t,e,n);break e}Mt(t,e,r,n)}e=e.child}return e;case 5:return Gk(e),t===null&&Sm(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,ym(r,i)?o=null:s!==null&&ym(r,s)&&(e.flags|=32),bS(t,e),Mt(t,e,o,n),e.child;case 6:return t===null&&Sm(e),null;case 13:return xS(t,e,n);case 4:return Og(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ua(e,null,r,n):Mt(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Mn(r,i),u0(t,e,r,i,n);case 7:return Mt(t,e,e.pendingProps,n),e.child;case 8:return Mt(t,e,e.pendingProps.children,n),e.child;case 12:return Mt(t,e,e.pendingProps.children,n),e.child;
vendor: 1,277 bytes, line 40
40case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,je(Yu,r._currentValue),r._currentValue=o,s!==null)if(Yn(s.value,o)){if(s.children===i.children&&!Gt.current){e=Kr(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Vr(-1,n&-n),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Tm(s.return,n,e),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(B(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Tm(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Mt(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Do(e,n),i=Sn(i),r=r(i),e.flags|=1,Mt(t,e,r,n),e.child;case 14:return r=e.type,i=Mn(r,e.pendingProps),i=Mn(r.type,i),d0(t,e,r,i,n);case 15:return vS(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Mn(r,i),fu
vendor: 7,863 bytes, line 40
40(t,e),e.tag=1,Jt(r)?(t=!0,Ku(e)):t=!1,Do(e,n),mS(e,r,i),Em(e,r,i,n),Rm(null,e,r,!0,t,n);case 19:return kS(t,e,n);case 22:return yS(t,e,n)}throw Error(B(156,e.tag))};function US(t,e){return dk(t,e)}function VI(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wn(t,e,n,r){return new VI(t,e,n,r)}function Gg(t){return t=t.prototype,!(!t||!t.isReactComponent)}function WI(t){if(typeof t=="function")return Gg(t)?1:0;if(t!=null){if(t=t.$$typeof,t===fg)return 11;if(t===mg)return 14}return 2}function Mi(t,e){var n=t.alternate;return n===null?(n=wn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function gu(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")Gg(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case vo:return _s(n.children,i,s,e);case hg:o=8,i|=8;break;case Yf:return t=wn(12,n,e,i|2),t.elementType=Yf,t.lanes=s,t;case Qf:return t=wn(13,n,e,i),t.elementType=Qf,t.lanes=s,t;case Xf:return t=wn(19,n,e,i),t.elementType=Xf,t.lanes=s,t;case Gx:return qd(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Hx:o=10;break e;case Kx:o=9;break e;case fg:o=11;break e;case mg:o=14;break e;case di:o=16,r=null;break e}throw Error(B(130,t==null?t:typeof t,""))}return e=wn(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function _s(t,e,n,r){return t=wn(7,t,r,e),t.lanes=n,t}function qd(t,e,n,r){return t=wn(22,t,r,e),t.elementType=Gx,t.lanes=n,t.stateNode={isHidden:!1},t}function tf(t,e,n){return t=wn(6,t,null,e),t.lanes=n,t}function nf(t,e,n){return e=wn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function qI(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Dh(0),this.expirationTimes=Dh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dh(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Jg(t,e,n,r,i,s,o,a,l){return t=new qI(t,e,n,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=wn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ag(s),t}function HI(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:go,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function FS(t){if(!t)return Fi;t=t._reactInternals;e:{if(Ws(t)!==t||t.tag!==1)throw Error(B(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Jt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(B(171))}if(t.tag===1){var n=t.type;if(Jt(n))return Fk(t,n,e)}return e}function BS(t,e,n,r,i,s,o,a,l){return t=Jg(n,r,!0,t,i,s,o,a,l),t.context=FS(null),n=t.current,r=Ut(),i=Oi(n),s=Vr(r,i),s.callback=e??null,Ni(n,s,i),t.current.lanes=i,dc(t,i,r),Yt(t,r),t}function Hd(t,e,n,r){var i=e.current,s=Ut(),o=Oi(i);return n=FS(n),e.context===null?e.context=n:e.pendingContext=n,e=Vr(s,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Ni(i,e,o),t!==null&&(Jn(t,i,o,s),uu(t,i,o)),o}function od(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function S0(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Yg(t,e){S0(t,e),(t=t.alternate)&&S0(t,e)}function KI(){return null}var zS=typeof reportError=="function"?reportError:function(t){console.error(t)};function Qg(t){this._internalRoot=t}Kd.prototype.render=Qg.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(B(409));Hd(t,e,null,null)};Kd.prototype.unmount=Qg.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;js(function(){Hd(null,t,null,null)}),e[qr]=null}};function Kd(t){this._internalRoot=t}Kd.prototype.unstable_scheduleHydration=function(t){if(t){var e=yk();t={blockedOn:null,target:t,priority:e};for(var n=0;n<mi.length&&e!==0&&e<mi[n].priority;n++);mi.splice(n,0,t),n===0&&wk(t)}};function Xg(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Gd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function T0(){}function GI(t,e,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var c=od(o);s.call(c)}}var o=BS(e,r,t,0,null,!1,!1,"",T0);return t._reactRootContainer=o,t[qr]=o.current,Il(t.nodeType===8?t.parentNode:t),js(),o}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=od(l);a.call(c)}}var l=Jg(t,0,!1,null,null,!1,!1,"",T0);return t._reactRootContainer=l,t[qr]=l.current,Il(t.nodeType===8?t.parentNode:t),js(function(){Hd(e,l,n,r)}),l}function Jd(t,e,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=od(o);a.call(l)}}Hd(e,o,t,i)}else o=GI(n,e,t,i,r);return od(o)}gk=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Za(e.pendingLanes);n!==0&&(vg(e,n|1),Yt(e,nt()),!(be&6)&&(fa=nt()+500,Gi()))}break;case 13:js(function(){var r=Hr(t,1);if(r!==null){var i=Ut();Jn(r,t,1,i)}}),Yg(t,1)}};yg=function(t){if(t.tag===13){var e=Hr(t,134217728);if(e!==null){var n=Ut();Jn(e,t,134217728,n)}Yg(t,134217728)}};vk=function(t){if(t.tag===13){var e=Oi(t),n=Hr(t,e);if(n!==null){var r=Ut();Jn(n,t,e,r)}Yg(t,e)}};yk=function(){return Ee};bk=function(t,e){var n=Ee;try{return Ee=t,e()}finally{Ee=n}};lm=function(t,e,n){switch(e){case"input":if(tm(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=Fd(r);if(!i)throw Error(B(90));Yx(r),tm(r,i)}}}break;case"textarea":Xx(t,n);break;case"select":e=n.value,e!=null&&Ao(t,!!n.multiple,e,!1)}};sk=qg;ok=js;var JI={usingClientEntryPoint:!1,Events:[fc,xo,Fd,rk,ik,qg]},Fa={findFiberByHostInstance:ps,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},YI={bundleType:Fa.bundleType,version:Fa.version,rendererPackageName:Fa.rendererPackageName,rendererConfig:Fa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Yr.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=ck(t),t===null?null:t.stateNode},findFiberByHostInstance:Fa.findFiberByHostInstance||KI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};
40if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Uc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Uc.isDisabled&&Uc.supportsFiber)try{jd=Uc.inject(YI),gr=Uc}catch{}}un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=JI;un.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Xg(e))throw Error(B(200));return HI(t,e,null,n)};un.createRoot=function(t,e){if(!Xg(t))throw Error(B(299));var n=!1,r="",i=zS;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=Jg(t,1,!1,null,null,n,!1,r,i),t[qr]=e.current,Il(t.nodeType===8?t.parentNode:t),new Qg(e)};un.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(B(188)):(t=Object.keys(t).join(","),Error(B(268,t)));return t=ck(e),t=t===null?null:t.stateNode,t};un.flushSync=function(t){return js(t)};un.hydrate=function(t,e,n){if(!Gd(e))throw Error(B(200));return Jd(null,t,e,!0,n)};un.hydrateRoot=function(t,e,n){if(!Xg(t))throw Error(B(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=zS;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=BS(e,null,t,1,n??null,i,!1,s,o),t[qr]=e.current,Il(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new Kd(e)};un.render=function(t,e,n){if(!Gd(e))throw Error(B(200));return Jd(null,t,e,!1,n)};un.unmountComponentAtNode=function(t){if(!Gd(t))throw Error(B(40));return t._reactRootContainer?(js(function(){Jd(null,null,t,!1,function(){t._reactRootContainer=null,t[qr]=null})}),!0):!1};un.unstable_batchedUpdates=qg;un.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Gd(n))throw Error(B(200));if(t==null||t._reactInternals===void 0)throw Error(B(38));return Jd(t,e,n,!1,r)};un.version="18.3.1-next-f1338f8080-20240426";function $S(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($S)}catch(t){console.error(t)}}$S(),$x.exports=un;var qs=$x.exports;const VS=cc(qs);var WS,C0=qs;WS=C0.createRoot,C0.hydrateRoot;const QI=1,XI=1e6;let rf=0;function ZI(){return rf=(rf+1)%Number.MAX_SAFE_INTEGER,rf.toString()}const sf=new Map,E0=t=>{if(sf.has(t))return;const e=setTimeout(()=>{sf.delete(t),ml({type:"REMOVE_TOAST",toastId:t})},XI);sf.set(t,e)},eN=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,QI)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?E0(n):t.toasts.forEach(r=>{E0(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},vu=[];let yu={toasts:[]};function ml(t){yu=eN(yu,t),vu.forEach(e=>{e(yu)})}function tN({...t}){const e=ZI(),n=i=>ml({type:"UPDATE_TOAST",toast:{...i,id:e}}),r=()=>ml({type:"DISMISS_TOAST",toastId:e});return ml({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}function Zg(){const[t,e]=x.useState(yu);return x.useEffect(()=>(vu.push(e),()=>{const n=vu.indexOf(e);n>-1&&vu.splice(n,1)}),[t]),{...t,toast:tN,dismiss:n=>ml({type:"DISMISS_TOAST",toastId:n})}}function ge(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function _0(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function qS(...t){return e=>{let n=!1;const r=t.map(i=>{const s=_0(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():_0(t[i],null)}}}}function et(...t){return x.useCallback(qS(...t),t)}function pc(t,e=[]){let n=[];function r(s,o){const a=x.createContext(o),l=n.length;n=[...n,o];const c=h=>{var v;const{scope:f,children:m,...b}=h,p=((v=f==null?void 0:f[t])==null?void 0:v[l])||a,g=x.useMemo(()=>b,Object.values(b));return d.jsx(p.Provider,{value:g,children:m})};c.displayName=s+"Provider";function u(h,f){var p;const m=((p=f==null?void 0:f[t])==null?void 0:p[l])||a,b=x.useContext(m);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=n.map(o=>x.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return x.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,nN(i,...e)]}function nN(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c}
vendor: 10,190 bytes, line 40
40)=>{const h=l(s)[`__scope${c}`];return{...a,...h}},{});return x.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function Fl(t){const e=iN(t),n=x.forwardRef((r,i)=>{const{children:s,...o}=r,a=x.Children.toArray(s),l=a.find(oN);if(l){const c=l.props.children,u=a.map(h=>h===l?x.Children.count(c)>1?x.Children.only(null):x.isValidElement(c)?c.props.children:null:h);return d.jsx(e,{...o,ref:i,children:x.isValidElement(c)?x.cloneElement(c,void 0,u):null})}return d.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var rN=Fl("Slot");function iN(t){const e=x.forwardRef((n,r)=>{const{children:i,...s}=n;if(x.isValidElement(i)){const o=lN(i),a=aN(s,i.props);return i.type!==x.Fragment&&(a.ref=r?qS(r,o):o),x.cloneElement(i,a)}return x.Children.count(i)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var HS=Symbol("radix.slottable");function sN(t){const e=({children:n})=>d.jsx(d.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=HS,e}function oN(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===HS}function aN(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function lN(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function KS(t){const e=t+"CollectionProvider",[n,r]=pc(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:g,children:v}=p,y=z.useRef(null),w=z.useRef(new Map).current;return d.jsx(i,{scope:g,itemMap:w,collectionRef:y,children:v})};o.displayName=e;const a=t+"CollectionSlot",l=Fl(a),c=z.forwardRef((p,g)=>{const{scope:v,children:y}=p,w=s(a,v),k=et(g,w.collectionRef);return d.jsx(l,{ref:k,children:y})});c.displayName=a;const u=t+"CollectionItemSlot",h="data-radix-collection-item",f=Fl(u),m=z.forwardRef((p,g)=>{const{scope:v,children:y,...w}=p,k=z.useRef(null),S=et(g,k),T=s(u,v);return z.useEffect(()=>(T.itemMap.set(k,{ref:k,...w}),()=>void T.itemMap.delete(k))),d.jsx(f,{[h]:"",ref:S,children:y})});m.displayName=u;function b(p){const g=s(t+"CollectionConsumer",p);return z.useCallback(()=>{const y=g.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${h}]`));return Array.from(g.itemMap.values()).sort((T,C)=>w.indexOf(T.ref.current)-w.indexOf(C.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:c,ItemSlot:m},b,r]}var cN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_e=cN.reduce((t,e)=>{const n=Fl(`Primitive.${e}`),r=x.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function GS(t,e){t&&qs.flushSync(()=>t.dispatchEvent(e))}function Qn(t){const e=x.useRef(t);return x.useEffect(()=>{e.current=t}),x.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function uN(t,e=globalThis==null?void 0:globalThis.document){const n=Qn(t);x.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var dN="DismissableLayer",zm="dismissableLayer.update",hN="dismissableLayer.pointerDownOutside",fN="dismissableLayer.focusOutside",P0,JS=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Yd=x.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=x.useContext(JS),[u,h]=x.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=x.useState({}),b=et(e,C=>h(C)),p=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=p.indexOf(g),y=u?p.indexOf(u):-1,w=c.layersWithOutsidePointerEventsDisabled.size>0,k=y>=v,S=pN(C=>{const _=C.target,P=[...c.branches].some(R=>R.contains(_));!k||P||(i==null||i(C),o==null||o(C),C.defaultPrevented||a==null||a())},f),T=gN(C=>{const _=C.target;[...c.branches].some(R=>R.contains(_))||(s==null||s(C),o==null||o(C),C.defaultPrevented||a==null||a())},f);return uN(C=>{y===c.layers.size-1&&(r==null||r(C),!C.defaultPrevented&&a&&(C.preventDefault(),a()))},f),x.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(P0=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),R0(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=P0)}},[u,f,n,c]),x.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),R0())},[u,c]),x.useEffect(()=>{const C=()=>m({});return document.addEventListener(zm,C),()=>document.removeEventListener(zm,C)},[]),d.jsx(_e.div,{...l,ref:b,style:{pointerEvents:w?k?"auto":"none":void 0,...t.style},onFocusCapture:ge(t.onFocusCapture,T.onFocusCapture),onBlurCapture:ge(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:ge(t.onPointerDownCapture,S.onPointerDownCapture)})});Yd.displayName=dN;var mN="DismissableLayerBranch",YS=x.forwardRef((t,e)=>{const n=x.useContext(JS),r=x.useRef(null),i=et(e,r);return x.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),d.jsx(_e.div,{...t,ref:i})});YS.displayName=mN;function pN(t,e=globalThis==null?void 0:globalThis.document){const n=Qn(t),r=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){QS(hN,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function gN(t,e=globalThis==null?void 0:globalThis.document){const n=Qn(t),r=x.useRef(!1);return x.useEffect(()=>{const i=s=>{s.target&&!r.current&&QS(fN,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function R0(){const t=new CustomEvent(zm);document.dispatchEvent(t)}function QS(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?GS(i,s):i.dispatchEvent(s)}var vN=Yd,yN=YS,Tt=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},bN="Portal",ev=x.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=x.useState(!1);Tt(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?VS.createPortal(d.jsx(_e.div,{...r,ref:e}),o):null});ev.displayName=bN;function wN(t,e){return x.useReducer((n,r)=>e[n][r]??n,t)}var tv=t=>{const{present:e,children:n}=t,r=xN(e),i=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),s=et(r.ref,kN(i));return typeof n=="function"||r.isPresent?x.cloneElement(i,{ref:s}):null};tv.displayName="Presence";function xN(t){const[e,n]=x.useState(),r=x.useRef(null),i=x.useRef(t),s=x.useRef("none"),o=t?"mounted":"unmounted",[a,l]=wN(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const c=Fc(r.current);s.current=a==="mounted"?c:"none"},[a]),Tt(()=>{const c=r.current,u=i.current;if(u!==t){const f=s.current,m=Fc(c);t?l("MOUNT"):m==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Tt(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,h=m=>{const p=Fc(r.current).includes(m.animationName);if(m.target===e&&p&&(l("ANIMATION_END"),!i.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=m=>{m.target===e&&(s.current=Fc(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:x.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Fc(t){return(t==null?void 0:t.animationName)||"none"}function kN(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var SN=lg[" useInsertionEffect ".trim().toString()]||Tt;function $m({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=TN({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const u=x.useRef(t!==void 0);x.useEffect(()=>{const h=u.current;h!==a&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=x.useCallback(u=>{var h;if(a){const f=CN(u)?u(t):u;f!==t&&((h=o.current)==null||h.call(o,f))}else s(u)},[a,t,s,o]);return[l,c]}function TN({defaultProp:t,onChange:e}
40){const[n,r]=x.useState(t),i=x.useRef(n),s=x.useRef(e);return SN(()=>{s.current=e},[e]),x.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function CN(t){return typeof t=="function"}var XS=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),EN="VisuallyHidden",Qd=x.forwardRef((t,e)=>d.jsx(_e.span,{...t,ref:e,style:{...XS,...t.style}}));Qd.displayName=EN;var _N=Qd,nv="ToastProvider",[rv,PN,RN]=KS("Toast"),[ZS,xV]=pc("Toast",[RN]),[IN,Xd]=ZS(nv),eT=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:s=50,children:o}=t,[a,l]=x.useState(null),[c,u]=x.useState(0),h=x.useRef(!1),f=x.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${nv}\`. Expected non-empty \`string\`.`),d.jsx(rv.Provider,{scope:e,children:d.jsx(IN,{scope:e,label:n,duration:r,swipeDirection:i,swipeThreshold:s,toastCount:c,viewport:a,onViewportChange:l,onToastAdd:x.useCallback(()=>u(m=>m+1),[]),onToastRemove:x.useCallback(()=>u(m=>m-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:f,children:o})})};eT.displayName=nv;var tT="ToastViewport",NN=["F8"],Vm="toast.viewportPause",Wm="toast.viewportResume",nT=x.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=NN,label:i="Notifications ({hotkey})",...s}=t,o=Xd(tT,n),a=PN(n),l=x.useRef(null),c=x.useRef(null),u=x.useRef(null),h=x.useRef(null),f=et(e,h,o.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=o.toastCount>0;x.useEffect(()=>{const g=v=>{var w;r.length!==0&&r.every(k=>v[k]||v.code===k)&&((w=h.current)==null||w.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]),x.useEffect(()=>{const g=l.current,v=h.current;if(b&&g&&v){const y=()=>{if(!o.isClosePausedRef.current){const T=new CustomEvent(Vm);v.dispatchEvent(T),o.isClosePausedRef.current=!0}},w=()=>{if(o.isClosePausedRef.current){const T=new CustomEvent(Wm);v.dispatchEvent(T),o.isClosePausedRef.current=!1}},k=T=>{!g.contains(T.relatedTarget)&&w()},S=()=>{g.contains(document.activeElement)||w()};return g.addEventListener("focusin",y),g.addEventListener("focusout",k),g.addEventListener("pointermove",y),g.addEventListener("pointerleave",S),window.addEventListener("blur",y),window.addEventListener("focus",w),()=>{g.removeEventListener("focusin",y),g.removeEventListener("focusout",k),g.removeEventListener("pointermove",y),g.removeEventListener("pointerleave",S),window.removeEventListener("blur",y),window.removeEventListener("focus",w)}}},[b,o.isClosePausedRef]);const p=x.useCallback(({tabbingDirection:g})=>{const y=a().map(w=>{const k=w.ref.current,S=[k,...WN(k)];return g==="forwards"?S:S.reverse()});return(g==="forwards"?y.reverse():y).flat()},[a]);return x.useEffect(()=>{const g=h.current;if(g){const v=y=>{var S,T,C;const w=y.altKey||y.ctrlKey||y.metaKey;if(y.key==="Tab"&&!w){const _=document.activeElement,P=y.shiftKey;if(y.target===g&&P){(S=c.current)==null||S.focus();return}const O=p({tabbingDirection:P?"backwards":"forwards"}),K=O.findIndex(F=>F===_);of(O.slice(K+1))?y.preventDefault():P?(T=c.current)==null||T.focus():(C=u.current)==null||C.focus()}};return g.addEventListener("keydown",v),()=>g.removeEventListener("keydown",v)}},[a,p]),d.jsxs(yN,{ref:l,role:"region","aria-label":i.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&d.jsx(qm,{ref:c,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"forwards"});of(g)}}),d.jsx(rv.Slot,{scope:n,children:d.jsx(_e.ol,{tabIndex:-1,...s,ref:f})}),b&&d.jsx(qm,{ref:u,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"backwards"});of(g)}})]})});nT.displayName=tT;var rT="ToastFocusProxy",qm=x.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=t,s=Xd(rT,n);return d.jsx(Qd,{"aria-hidden":!0,tabIndex:0,...i,ref:e,style:{position:"fixed"},onFocus:o=>{var c;const a=o.relatedTarget;!((c=s.viewport)!=null&&c.contains(a))&&r()}})});qm.displayName=rT;var gc="Toast",AN="toast.swipeStart",ON="toast.swipeMove",MN="toast.swipeCancel",jN="toast.swipeEnd",iT=x.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:i,onOpenChange:s,...o}=t,[a,l]=$m({prop:r,defaultProp:i??!0,onChange:s,caller:gc});return d.jsx(tv,{present:n||a,children:d.jsx(UN,{open:a,...o,ref:e,onClose:()=>l(!1),onPause:Qn(t.onPause),onResume:Qn(t.onResume),onSwipeStart:ge(t.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ge(t.onSwipeMove,c=>{const{x:u,y:h}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:ge(t.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ge(t.onSwipeEnd,c=>{const{x:u,y:h}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),l(!1)})})})});iT.displayName=gc;var[DN,LN]=ZS(gc,{onClose(){}}),UN=x.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:i,open:s,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:c,onSwipeStart:u,onSwipeMove:h,onSwipeCancel:f,onSwipeEnd:m,...b}=t,p=Xd(gc,n),[g,v]=x.useState(null),y=et(e,F=>v(F)),w=x.useRef(null),k=x.useRef(null),S=i||p.duration,T=x.useRef(0),C=x.useRef(S),_=x.useRef(0),{onToastAdd:P,onToastRemove:R}=p,A=Qn(()=>{var Y;(g==null?void 0:g.contains(document.activeElement))&&((Y=p.viewport)==null||Y.focus()),o()}),O=x.useCallback(F=>
40{!F||F===1/0||(window.clearTimeout(_.current),T.current=new Date().getTime(),_.current=window.setTimeout(A,F))},[A]);x.useEffect(()=>{const F=p.viewport;if(F){const Y=()=>{O(C.current),c==null||c()},V=()=>{const Q=new Date().getTime()-T.current;C.current=C.current-Q,window.clearTimeout(_.current),l==null||l()};return F.addEventListener(Vm,V),F.addEventListener(Wm,Y),()=>{F.removeEventListener(Vm,V),F.removeEventListener(Wm,Y)}}},[p.viewport,S,l,c,O]),x.useEffect(()=>{s&&!p.isClosePausedRef.current&&O(S)},[s,S,p.isClosePausedRef,O]),x.useEffect(()=>(P(),()=>R()),[P,R]);const K=x.useMemo(()=>g?dT(g):null,[g]);return p.viewport?d.jsxs(d.Fragment,{children:[K&&d.jsx(FN,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:K}),d.jsx(DN,{scope:n,onClose:A,children:qs.createPortal(d.jsx(rv.ItemSlot,{scope:n,children:d.jsx(vN,{asChild:!0,onEscapeKeyDown:ge(a,()=>{p.isFocusedToastEscapeKeyDownRef.current||A(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:d.jsx(_e.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":p.swipeDirection,...b,ref:y,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:ge(t.onKeyDown,F=>{F.key==="Escape"&&(a==null||a(F.nativeEvent),F.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,A()))}),onPointerDown:ge(t.onPointerDown,F=>{F.button===0&&(w.current={x:F.clientX,y:F.clientY})}),onPointerMove:ge(t.onPointerMove,F=>{if(!w.current)return;const Y=F.clientX-w.current.x,V=F.clientY-w.current.y,Q=!!k.current,N=["left","right"].includes(p.swipeDirection),M=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,H=N?M(0,Y):0,te=N?0:M(0,V),X=F.pointerType==="touch"?10:2,se={x:H,y:te},oe={originalEvent:F,delta:se};Q?(k.current=se,Bc(ON,h,oe,{discrete:!1})):I0(se,p.swipeDirection,X)?(k.current=se,Bc(AN,u,oe,{discrete:!1}),F.target.setPointerCapture(F.pointerId)):(Math.abs(Y)>X||Math.abs(V)>X)&&(w.current=null)}),onPointerUp:ge(t.onPointerUp,F=>{const Y=k.current,V=F.target;if(V.hasPointerCapture(F.pointerId)&&V.releasePointerCapture(F.pointerId),k.current=null,w.current=null,Y){const Q=F.currentTarget,N={originalEvent:F,delta:Y};I0(Y,p.swipeDirection,p.swipeThreshold)?Bc(jN,m,N,{discrete:!0}):Bc(MN,f,N,{discrete:!0}),Q.addEventListener("click",M=>M.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),FN=t=>{const{__scopeToast:e,children:n,...r}=t,i=Xd(gc,e),[s,o]=x.useState(!1),[a,l]=x.useState(!1);return $N(()=>o(!0)),x.useEffect(()=>{const c=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(c)},[]),a?null:d.jsx(ev,{asChild:!0,children:d.jsx(Qd,{...r,children:s&&d.jsxs(d.Fragment,{children:[i.label," ",n]})})})},BN="ToastTitle",sT=x.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return d.jsx(_e.div,{...r,ref:e})});sT.displayName=BN;var zN="ToastDescription",oT=x.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return d.jsx(_e.div,{...r,ref:e})});oT.displayName=zN;var aT="ToastAction",lT=x.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?d.jsx(uT,{altText:n,asChild:!0,children:d.jsx(iv,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${aT}\`. Expected non-empty \`string\`.`),null)});lT.displayName=aT;var cT="ToastClose",iv=x.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,i=LN(cT,n);return d.jsx(uT,{asChild:!0,children:d.jsx(_e.button,{type:"button",...r,ref:e,onClick:ge(t.onClick,i.onClose)})})});iv.displayName=cT;var uT=x.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...i}=t;return d.jsx(_e.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...i,ref:e})});function dT(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),VN(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!i)if(s){const o=r.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(...dT(r))}}),e}function Bc(t,e,n,{discrete:r}){const i=n.originalEvent.currentTarget,s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?GS(i,s):i.dispatchEvent(s)}var I0=(t,e,n=0)=>{const r=Math.abs(t.x),i=Math.abs(t.y),s=r>i;return e==="left"||e==="right"?s&&r>n:!s&&i>n};function $N(t=()=>{}){const e=Qn(t);Tt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function VN(t){return t.nodeType===t.ELEMENT_NODE}function WN(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function of(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var qN=eT,hT=nT,fT=iT,mT=sT,pT=oT,gT=lT,vT=iv;function yT(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=yT(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function bT(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=yT(t))&&(r&&(r+=" "),r+=e);return r}const N0=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,A0=bT,sv=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return A0(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(c=>{const u=n==null?void 0:n[c],h=s==null?void 0:s[c];if(u===null)return null;const f=N0(u)||N0(h);return i[c][f]}),a=n&&Object.entries(n).reduce((c,u)=>{let[h,f]=u;return f===void 0||(c[h]=f),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:h,className:f,...m}=u;return Object.entries(m).every(b=>{let[p,g]=b;return Array.isArray(g)?g.includes({...s,...a}[p]):{...s,...a}[p]===g})?[...c,h,f]:c},[]);return A0(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)};/**
41 * @license lucide-react v0.462.0 - ISC
42 *
43 * This source code is licensed under the ISC license.
44 * See the LICENSE file in the root directory of this source tree.
45 */const HN=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wT=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/**
46 * @license lucide-react v0.462.0 - ISC
47 *
48 * This source code is licensed under the ISC license.
49 * See the LICENSE file in the root directory of this source tree.
50 */var KN={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
51 * @license lucide-react v0.462.0 - ISC
52 *
53 * This source code is licensed under the ISC license.
54 * See the LICENSE file in the root directory of this source tree.
55 */const GN=x.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>x.createElement("svg",{ref:l,...KN,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:wT("lucide",i),...a},[...o.map(([c,u])=>x.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
56 * @license lucide-react v0.462.0 - ISC
57 *
58 * This source code is licensed under the ISC license.
59 * See the LICENSE file in the root directory of this source tree.
60 */const ee=(t,e)=>{const n=x.forwardRef(({className:r,...i},s)=>x.createElement(GN,{ref:s,iconNode:e,className:wT(`lucide-${HN(t)}`,r),...i}));return n.displayName=`${t}`,n};/**
61 * @license lucide-react v0.462.0 - ISC
62 *
63 * This source code is licensed under the ISC license.
64 * See the LICENSE file in the root directory of this source tree.
65 */const JN=ee("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
66 * @license lucide-react v0.462.0 - ISC
67 *
68 * This source code is licensed under the ISC license.
69 * See the LICENSE file in the root directory of this source tree.
70 */const YN=ee("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
71 * @license lucide-react v0.462.0 - ISC
72 *
73 * This source code is licensed under the ISC license.
74 * See the LICENSE file in the root directory of this source tree.
75 */const cn=ee("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
76 * @license lucide-react v0.462.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */const QN=ee("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/**
81 * @license lucide-react v0.462.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const XN=ee("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
86 * @license lucide-react v0.462.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const Hm=ee("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
91 * @license lucide-react v0.462.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const ZN=ee("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
96 * @license lucide-react v0.462.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const xT=ee("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
101 * @license lucide-react v0.462.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const ov=ee("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}
105],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
106 * @license lucide-react v0.462.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const Zd=ee("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
111 * @license lucide-react v0.462.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const kT=ee("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
116 * @license lucide-react v0.462.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const eA=ee("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
121 * @license lucide-react v0.462.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const ST=ee("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
126 * @license lucide-react v0.462.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const tA=ee("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
131 * @license lucide-react v0.462.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const nA=ee("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
136 * @license lucide-react v0.462.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const rA=ee("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
141 * @license lucide-react v0.462.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const iA=ee("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}
145],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
146 * @license lucide-react v0.462.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const O0=ee("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
151 * @license lucide-react v0.462.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const M0=ee("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
156 * @license lucide-react v0.462.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const sA=ee("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);/**
161 * @license lucide-react v0.462.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const oA=ee("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/**
166 * @license lucide-react v0.462.0 - ISC
167 *
168 * This source code is licensed under the ISC license.
169 * See the LICENSE file in the root directory of this source tree.
170 */const aA=ee("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
171 * @license lucide-react v0.462.0 - ISC
172 *
173 * This source code is licensed under the ISC license.
174 * See the LICENSE file in the root directory of this source tree.
175 */const TT=ee("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
176 * @license lucide-react v0.462.0 - ISC
177 *
178 * This source code is licensed under the ISC license.
179 * See the LICENSE file in the root directory of this source tree.
180 */const lA=ee("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
181 * @license lucide-react v0.462.0 - ISC
182 *
183 * This source code is licensed under the ISC license.
184 * See the LICENSE file in the root directory of this source tree.
185 */const cA=ee("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
186 * @license lucide-react v0.462.0 - ISC
187 *
188 * This source code is licensed under the ISC license.
189 * See the LICENSE file in the root directory of this source tree.
190 */const j0=ee("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
191 * @license lucide-react v0.462.0 - ISC
192 *
193 * This source code is licensed under the ISC license.
194 * See the LICENSE file in the root directory of this source tree.
195 */const av=ee("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
196 * @license lucide-react v0.462.0 - ISC
197 *
198 * This source code is licensed under the ISC license.
199 * See the LICENSE file in the root directory of this source tree.
200 */const uA=ee("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
201 * @license lucide-react v0.462.0 - ISC
202 *
203 * This source code is licensed under the ISC license.
204 * See the LICENSE file in the root directory of this source tree.
205 */const ma=ee("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
206 * @license lucide-react v0.462.0 - ISC
207 *
208 * This source code is licensed under the ISC license.
209 * See the LICENSE file in the root directory of this source tree.
210 */const CT=ee("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
211 * @license lucide-react v0.462.0 - ISC
212 *
213 * This source code is licensed under the ISC license.
214 * See the LICENSE file in the root directory of this source tree.
215 */const dA=ee("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
216 * @license lucide-react v0.462.0 - ISC
217 *
218 * This source code is licensed under the ISC license.
219 * See the LICENSE file in the root directory of this source tree.
220 */const hA=ee("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/**
221 * @license lucide-react v0.462.0 - ISC
222 *
223 * This source code is licensed under the ISC license.
224 * See the LICENSE file in the root directory of this source tree.
225 */const ET=ee("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
226 * @license lucide-react v0.462.0 - ISC
227 *
228 * This source code is licensed under the ISC license.
229 * See the LICENSE file in the root directory of this source tree.
230 */const fA=ee("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
231 * @license lucide-react v0.462.0 - ISC
232 *
233 * This source code is licensed under the ISC license.
234 * See the LICENSE file in the root directory of this source tree.
235 */const mA=ee("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
236 * @license lucide-react v0.462.0 - ISC
237 *
238 * This source code is licensed under the ISC license.
239 * See the LICENSE file in the root directory of this source tree.
240 */const Km=ee("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
241 * @license lucide-react v0.462.0 - ISC
242 *
243 * This source code is licensed under the ISC license.
244 * See the LICENSE file in the root directory of this source tree.
245 */const pA=ee("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m
245-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/**
246 * @license lucide-react v0.462.0 - ISC
247 *
248 * This source code is licensed under the ISC license.
249 * See the LICENSE file in the root directory of this source tree.
250 */const gA=ee("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
251 * @license lucide-react v0.462.0 - ISC
252 *
253 * This source code is licensed under the ISC license.
254 * See the LICENSE file in the root directory of this source tree.
255 */const vA=ee("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/**
256 * @license lucide-react v0.462.0 - ISC
257 *
258 * This source code is licensed under the ISC license.
259 * See the LICENSE file in the root directory of this source tree.
260 */const _T=ee("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/**
261 * @license lucide-react v0.462.0 - ISC
262 *
263 * This source code is licensed under the ISC license.
264 * See the LICENSE file in the root directory of this source tree.
265 */const lv=ee("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
266 * @license lucide-react v0.462.0 - ISC
267 *
268 * This source code is licensed under the ISC license.
269 * See the LICENSE file in the root directory of this source tree.
270 */const cv=ee("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
271 * @license lucide-react v0.462.0 - ISC
272 *
273 * This source code is licensed under the ISC license.
274 * See the LICENSE file in the root directory of this source tree.
275 */const uv=ee("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
276 * @license lucide-react v0.462.0 - ISC
277 *
278 * This source code is licensed under the ISC license.
279 * See the LICENSE file in the root directory of this source tree.
280 */const yA=ee("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
281 * @license lucide-react v0.462.0 - ISC
282 *
283 * This source code is licensed under the ISC license.
284 * See the LICENSE file in the root directory of this source tree.
285 */const dv=ee("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
286 * @license lucide-react v0.462.0 - ISC
287 *
288 * This source code is licensed under the ISC license.
289 * See the LICENSE file in the root directory of this source tree.
290 */const Gm=ee("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}
290],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/**
291 * @license lucide-react v0.462.0 - ISC
292 *
293 * This source code is licensed under the ISC license.
294 * See the LICENSE file in the root directory of this source tree.
295 */const bA=ee("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
296 * @license lucide-react v0.462.0 - ISC
297 *
298 * This source code is licensed under the ISC license.
299 * See the LICENSE file in the root directory of this source tree.
300 */const wA=ee("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
301 * @license lucide-react v0.462.0 - ISC
302 *
303 * This source code is licensed under the ISC license.
304 * See the LICENSE file in the root directory of this source tree.
305 */const D0=ee("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
306 * @license lucide-react v0.462.0 - ISC
307 *
308 * This source code is licensed under the ISC license.
309 * See the LICENSE file in the root directory of this source tree.
310 */const PT=ee("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
311 * @license lucide-react v0.462.0 - ISC
312 *
313 * This source code is licensed under the ISC license.
314 * See the LICENSE file in the root directory of this source tree.
315 */const xA=ee("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
316 * @license lucide-react v0.462.0 - ISC
317 *
318 * This source code is licensed under the ISC license.
319 * See the LICENSE file in the root directory of this source tree.
320 */const kA=ee("UserSearch",[["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}],["path",{d:"M10.3 15H7a4 4 0 0 0-4 4v2",key:"3bnktk"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}]]);/**
321 * @license lucide-react v0.462.0 - ISC
322 *
323 * This source code is licensed under the ISC license.
324 * See the LICENSE file in the root directory of this source tree.
325 */const pa=ee("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
326 * @license lucide-react v0.462.0 - ISC
327 *
328 * This source code is licensed under the ISC license.
329 * See the LICENSE file in the root directory of this source tree.
330 */const SA=ee("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
331 * @license lucide-react v0.462.0 - ISC
332 *
333 * This source code is licensed under the ISC license.
334 * See the LICENSE file in the root directory of this source tree.
335 */const TA=ee("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
336 * @license lucide-react v0.462.0 - ISC
337 *
338 * This source code is licensed under the ISC license.
339 * See the LICENSE file in the root directory of this source tree.
340 */const RT=ee("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
vendor: 5,742 bytes, lines 340-345
340],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
341 * @license lucide-react v0.462.0 - ISC
342 *
343 * This source code is licensed under the ISC license.
344 * See the LICENSE file in the root directory of this source tree.
345 */const IT=ee("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),hv="-",CA=t=>{const e=_A(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(hv);return a[0]===""&&a.length!==1&&a.shift(),NT(a,e)||EA(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},NT=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?NT(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(hv);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},L0=/^\[(.+)\]$/,EA=t=>{if(L0.test(t)){const e=L0.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},_A=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return RA(Object.entries(t.classGroups),n).forEach(([s,o])=>{Jm(o,r,s,e)}),r},Jm=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:U0(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(PA(i)){Jm(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{Jm(o,U0(e,s),n,r)})})},U0=(t,e)=>{let n=t;return e.split(hv).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},PA=t=>t.isThemeGetter,RA=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[n,i]}):t,IA=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},AT="!",NA=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=a=>{const l=[];let c=0,u=0,h;for(let g=0;g<a.length;g++){let v=a[g];if(c===0){if(v===i&&(r||a.slice(g,g+s)===e)){l.push(a.slice(u,g)),u=g+s;continue}if(v==="/"){h=g;continue}}v==="["?c++:v==="]"&&c--}const f=l.length===0?a:a.substring(u),m=f.startsWith(AT),b=m?f.substring(1):f,p=h&&h>u?h-u:void 0;return{modifiers:l,hasImportantModifier:m,baseClassName:b,maybePostfixModifierPosition:p}};return n?a=>n({className:a,parseClassName:o}):o},AA=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},OA=t=>({cache:IA(t.cacheSize),parseClassName:NA(t),...CA(t)}),MA=/\s+/,jA=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(MA);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:u,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:m}=n(c);let b=!!m,p=r(b?f.substring(0,m):f);if(!p){if(!b){a=c+(a.length>0?" "+a:a);continue}if(p=r(f),!p){a=c+(a.length>0?" "+a:a);continue}b=!1}const g=AA(u).join(":"),v=h?g+AT:g,y=v+p;if(s.includes(y))continue;s.push(y);const w=i(p,b);for(let k=0;k<w.length;++k){const S=w[k];s.push(v+S)}a=c+(a.length>0?" "+a:a)}return a};function DA(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=OT(e))&&(r&&(r+=" "),r+=n);return r}const OT=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=OT(t[r]))&&(n&&(n+=" "),n+=e);return n};function LA(t,...e){let n,r,i,s=o;function o(l){const c=e.reduce((u,h)=>h(u),t());return n=OA(c),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=jA(l,n);return i(l,u),u}return function(){return s(DA.apply(null,arguments))}}const Le=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},MT=/^\[(?:([a-z-]+):)?(.+)\]$/i,UA=/^\d+\/\d+$/,FA=new Set(["px","full","screen"]),BA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,$A=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,VA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,WA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Er=t=>Uo(t)||FA.has(t)||UA.test(t),ri=t=>Ta(t,"length",XA),Uo=t=>!!t&&!Number.isNaN(Number(t)),af=t=>Ta(t,"number",Uo),Ba=t=>!!t&&Number.isInteger(Number(t)),qA=t=>t.endsWith("%")&&Uo(t.slice(0,-1)),ue=t=>MT.test(t),ii=t=>BA.test(t),HA=new Set(["length","size","percentage"]),KA=t=>Ta(t,HA,jT),GA=t=>Ta(t,"position",jT),JA=new Set(["image","url"]),YA=t=>Ta(t,JA,eO),QA=t=>Ta(t,"",ZA),za=()=>!0,Ta=(t,e,n)=>{const r=MT.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},XA=t=>zA.test(t)&&!$A.test(t),jT=()=>!1,ZA=t=>VA.test(t),eO=t=>WA.test(t),tO=()=>{const t=Le("colors"),e=Le("spacing"),n=Le("blur"),r=Le("brightness"),i=Le("borderColor"),s=Le("borderRadius"),o=Le("borderSpacing"),a=Le("borderWidth"),l=Le("contrast"),c=Le("grayscale"),u=Le("hueRotate"),h=Le("invert"),f=Le("gap"),m=Le("gradientColorStops"),b=Le("gradientColorStopPositions"),p=Le("inset"),g=Le("margin"),v=Le("opacity"),y=Le("padding"),w=Le("saturate"),k=Le("scale"),S=Le("sepia"),T=Le("skew"),C=Le("space"),_=Le("translate"),P=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",ue,e],O=()=>[ue,e],K=()=>["",Er,ri],F=()=>["auto",Uo,ue],Y=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],
vendor: 11,786 bytes, line 345
345V=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],N=()=>["start","end","center","between","around","evenly","stretch"],M=()=>["","0",ue],H=()=>["auto","avoid","all","avoid-page","page","left","right","column"],te=()=>[Uo,ue];return{cacheSize:500,separator:":",theme:{colors:[za],spacing:[Er,ri],blur:["none","",ii,ue],brightness:te(),borderColor:[t],borderRadius:["none","","full",ii,ue],borderSpacing:O(),borderWidth:K(),contrast:te(),grayscale:M(),hueRotate:te(),invert:M(),gap:O(),gradientColorStops:[t],gradientColorStopPositions:[qA,ri],inset:A(),margin:A(),opacity:te(),padding:O(),saturate:te(),scale:te(),sepia:M(),skew:te(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",ue]}],container:["container"],columns:[{columns:[ii]}],"break-after":[{"break-after":H()}],"break-before":[{"break-before":H()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Y(),ue]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ba,ue]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ue]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",Ba,ue]}],"grid-cols":[{"grid-cols":[za]}],"col-start-end":[{col:["auto",{span:["full",Ba,ue]},ue]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[za]}],"row-start-end":[{row:["auto",{span:[Ba,ue]},ue]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ue]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ue]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...N()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...N(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...N(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ue,e]}],"min-w":[{"min-w":[ue,e,"min","max","fit"]}],"max-w":[{"max-w":[ue,e,"none","full","min","max","fit","prose",{screen:[ii]},ii]}],h:[{h:[ue,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ue,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ue,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ue,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ii,ri]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",af]}],"font-family":[{font:[za]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ue]}],"line-clamp":[{"line-clamp":["none",Uo,af]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Er,ue]}],"list-image":[{"list-image":["none",ue]}],"list-style-type":[{list:["none","disc","decimal",ue]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Er,ri]}],"underline-offset":[{"underline-offset":["auto",Er,ue]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Y(),GA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",KA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},YA]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:V()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[Er,ue]}],"outline-w":[{outline:[Er,ri]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Er,ri]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",ii,QA]}],"shadow-color":[{shadow:[za]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ii,ue]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[h]}],saturate:[{saturate:[w]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ue]}],duration:[{duration:te()}],ease:[{ease:["linear","in","out","in-out",ue]}],delay:[{delay:te()}],animate:[{animate:["none","spin","ping","pulse","bounce",ue]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Ba,ue]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ue]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ue]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}
vendor: 4,942 bytes, line 345
345],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ue]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Er,ri,af]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},nO=LA(tO);function ce(...t){return nO(bT(t))}const rO=qN,DT=x.forwardRef(({className:t,...e},n)=>d.jsx(hT,{ref:n,className:ce("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));DT.displayName=hT.displayName;const iO=sv("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),LT=x.forwardRef(({className:t,variant:e,...n},r)=>d.jsx(fT,{ref:r,className:ce(iO({variant:e}),t),...n}));LT.displayName=fT.displayName;const sO=x.forwardRef(({className:t,...e},n)=>d.jsx(gT,{ref:n,className:ce("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",t),...e}));sO.displayName=gT.displayName;const UT=x.forwardRef(({className:t,...e},n)=>d.jsx(vT,{ref:n,className:ce("absolute right-2 top-2 rounded-md p-1 text-foreground
345/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:d.jsx(RT,{className:"h-4 w-4"})}));UT.displayName=vT.displayName;const FT=x.forwardRef(({className:t,...e},n)=>d.jsx(mT,{ref:n,className:ce("text-sm font-semibold",t),...e}));FT.displayName=mT.displayName;const BT=x.forwardRef(({className:t,...e},n)=>d.jsx(pT,{ref:n,className:ce("text-sm opacity-90",t),...e}));BT.displayName=pT.displayName;function oO(){const{toasts:t}=Zg();return d.jsxs(rO,{children:[t.map(function({id:e,title:n,description:r,action:i,...s}){return d.jsxs(LT,{...s,children:[d.jsxs("div",{className:"grid gap-1",children:[n&&d.jsx(FT,{children:n}),r&&d.jsx(BT,{children:r})]}),i,d.jsx(UT,{})]},e)}),d.jsx(DT,{})]})}var F0=["light","dark"],aO="(prefers-color-scheme: dark)",lO=x.createContext(void 0),cO={setTheme:t=>{},themes:[]},uO=()=>{var t;return(t=x.useContext(lO))!=null?t:cO};x.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:s,value:o,attrs:a,nonce:l})=>{let c=s==="system",u=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(b=>`'${b}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,h=i?F0.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(b,p=!1,g=!0)=>{let v=o?o[b]:b,y=p?b+"|| ''":`'${v}'`,w="";return i&&g&&!p&&F0.includes(b)&&(w+=`d.style.colorScheme = '${b}';`),n==="class"?p||v?w+=`c.add(${y})`:w+="null":v&&(w+=`d[s](n,${y})`),w},m=t?`!function(){${u}${f(t)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${c})){var t='${aO}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}${c?"":"else{"+f(s,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${e}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}else{${f(s,!1,!1)};}${h}}catch(t){}}();`;return x.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:m}})});var dO=t=>{switch(t){case"success":return mO;case"info":return gO;case"warning":return pO;case"error":return vO;default:return null}},hO=Array(12).fill(0),fO=({visible:t,className:e})=>z.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},z.createElement("div",{className:"sonner-spinner"},hO.map((n,r)=>z.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),mO=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),pO=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),gO=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),vO=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},z.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),yO=z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},z.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),z.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),bO=()=>{let[t,e]=z.useState(document.hidden);return z.useEffect(()=>{let n=()=>{e(document.hidden)};
345return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},Ym=1,wO=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:Ym++,s=this.toasts.find(a=>a.id===i),o=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),s?this.toasts=this.toasts.map(a=>a.id===i?(this.publish({...a,...t,id:i,title:n}),{...a,...t,id:i,dismissible:o,title:n}):a):this.addToast({title:n,...r,dismissible:o,id:i}),i},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),i=n!==void 0,s,o=r.then(async l=>{if(s=["resolve",l],z.isValidElement(l))i=!1,this.create({id:n,type:"default",message:l});else if(kO(l)&&!l.ok){i=!1;let c=typeof e.error=="function"?await e.error(`HTTP error! status: ${l.status}`):e.error,u=typeof e.description=="function"?await e.description(`HTTP error! status: ${l.status}`):e.description;this.create({id:n,type:"error",message:c,description:u})}else if(e.success!==void 0){i=!1;let c=typeof e.success=="function"?await e.success(l):e.success,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:n,type:"success",message:c,description:u})}}).catch(async l=>{if(s=["reject",l],e.error!==void 0){i=!1;let c=typeof e.error=="function"?await e.error(l):e.error,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:n,type:"error",message:c,description:u})}}).finally(()=>{var l;i&&(this.dismiss(n),n=void 0),(l=e.finally)==null||l.call(e)}),a=()=>new Promise((l,c)=>o.then(()=>s[0]==="reject"?c(s[1]):l(s[1])).catch(c));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||Ym++;return this.create({jsx:t(n),id:n,...e}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Vt=new wO,xO=(t,e)=>{let n=(e==null?void 0:e.id)||Ym++;return Vt.addToast({title:t,...e,id:n}),n},kO=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",SO=xO,TO=()=>Vt.toasts,CO=()=>Vt.getActiveToasts();Object.assign(SO,{success:Vt.success,info:Vt.info,warning:Vt.warning,error:Vt.error,custom:Vt.custom,message:Vt.message,promise:Vt.promise,dismiss:Vt.dismiss,loading:Vt.loading},{getHistory:TO,getToasts:CO});function EO(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}EO(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
345left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
345:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
345--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
346`);function zc(t){return t.label!==void 0}var _O=3,PO="32px",RO="16px",B0=4e3,IO=356,NO=14,AO=20,OO=200;function In(...t){return t.filter(Boolean).join(" ")}function MO(t){let[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}var jO=t=>{var e,n,r,i,s,o,a,l,c,u,h;let{invert:f,toast:m,unstyled:b,interacting:p,setHeights:g,visibleToasts:v,heights:y,index:w,toasts:k,expanded:S,removeToast:T,defaultRichColors:C,closeButton:_,style:P,cancelButtonStyle:R,actionButtonStyle:A,className:O="",descriptionClassName:K="",duration:F,position:Y,gap:V,loadingIcon:Q,expandByDefault:N,classNames:M,icons:H,closeButtonAriaLabel:te="Close toast",pauseWhenPageIsHidden:X}=t,[se,oe]=z.useState(null),[Pe,Oe]=z.useState(null),[G,Te]=z.useState(!1),[Ge,Se]=z.useState(!1),[ve,we]=z.useState(!1),[Ct,hn]=z.useState(!1),[ts,Xr]=z.useState(!1),[ns,Ia]=z.useState(0),[Js,uy]=z.useState(0),Na=z.useRef(m.duration||F||B0),dy=z.useRef(null),rs=z.useRef(null),mP=w===0,pP=w+1<=v,fn=m.type,Ys=m.dismissible!==!1,gP=m.className||"",vP=m.descriptionClassName||"",wc=z.useMemo(()=>y.findIndex(ae=>ae.toastId===m.id)||0,[y,m.id]),yP=z.useMemo(()=>{var ae;return(ae=m.closeButton)!=null?ae:_},[m.closeButton,_]),hy=z.useMemo(()=>m.duration||F||B0,[m.duration,F]),Ph=z.useRef(0),Qs=z.useRef(0),fy=z.useRef(0),Xs=z.useRef(null),[bP,wP]=Y.split("-"),my=z.useMemo(()=>y.reduce((ae,Re,Be)=>Be>=wc?ae:ae+Re.height,0),[y,wc]),py=bO(),xP=m.invert||f,Rh=fn==="loading";Qs.current=z.useMemo(()=>wc*V+my,[wc,my]),z.useEffect(()=>{Na.current=hy},[hy]),z.useEffect(()=>{Te(!0)},[]),z.useEffect(()=>{let ae=rs.current;if(ae){let Re=ae.getBoundingClientRect().height;return uy(Re),g(Be=>[{toastId:m.id,height:Re,position:m.position},...Be]),()=>g(Be=>Be.filter(En=>En.toastId!==m.id))}},[g,m.id]),z.useLayoutEffect(()=>{if(!G)return;let ae=rs.current,Re=ae.style.height;ae.style.height="auto";let Be=ae.getBoundingClientRect().height;ae.style.height=Re,uy(Be),g(En=>En.find(_n=>_n.toastId===m.id)?En.map(_n=>_n.toastId===m.id?{..._n,height:Be}:_n):[{toastId:m.id,height:Be,position:m.position},...En])},[G,m.title,m.description,g,m.id]);let Zr=z.useCallback(()=>{Se(!0),Ia(Qs.current),g(ae=>ae.filter(Re=>Re.toastId!==m.id)),setTimeout(()=>{T(m)},OO)},[m,T,g,Qs]);z.useEffect(()=>{if(m.promise&&fn==="loading"||m.duration===1/0||m.type==="loading")return;let ae;return S||p||X&&py?(()=>{if(fy.current<Ph.current){let Re=new Date().getTime()-Ph.current;Na.current=Na.current-Re}
346fy.current=new Date().getTime()})():Na.current!==1/0&&(Ph.current=new Date().getTime(),ae=setTimeout(()=>{var Re;(Re=m.onAutoClose)==null||Re.call(m,m),Zr()},Na.current)),()=>clearTimeout(ae)},[S,p,m,fn,X,py,Zr]),z.useEffect(()=>{m.delete&&Zr()},[Zr,m.delete]);function kP(){var ae,Re,Be;return H!=null&&H.loading?z.createElement("div",{className:In(M==null?void 0:M.loader,(ae=m==null?void 0:m.classNames)==null?void 0:ae.loader,"sonner-loader"),"data-visible":fn==="loading"},H.loading):Q?z.createElement("div",{className:In(M==null?void 0:M.loader,(Re=m==null?void 0:m.classNames)==null?void 0:Re.loader,"sonner-loader"),"data-visible":fn==="loading"},Q):z.createElement(fO,{className:In(M==null?void 0:M.loader,(Be=m==null?void 0:m.classNames)==null?void 0:Be.loader),visible:fn==="loading"})}return z.createElement("li",{tabIndex:0,ref:rs,className:In(O,gP,M==null?void 0:M.toast,(e=m==null?void 0:m.classNames)==null?void 0:e.toast,M==null?void 0:M.default,M==null?void 0:M[fn],(n=m==null?void 0:m.classNames)==null?void 0:n[fn]),"data-sonner-toast":"","data-rich-colors":(r=m.richColors)!=null?r:C,"data-styled":!(m.jsx||m.unstyled||b),"data-mounted":G,"data-promise":!!m.promise,"data-swiped":ts,"data-removed":Ge,"data-visible":pP,"data-y-position":bP,"data-x-position":wP,"data-index":w,"data-front":mP,"data-swiping":ve,"data-dismissible":Ys,"data-type":fn,"data-invert":xP,"data-swipe-out":Ct,"data-swipe-direction":Pe,"data-expanded":!!(S||N&&G),style:{"--index":w,"--toasts-before":w,"--z-index":k.length-w,"--offset":`${Ge?ns:Qs.current}px`,"--initial-height":N?"auto":`${Js}px`,...P,...m.style},onDragEnd:()=>{we(!1),oe(null),Xs.current=null},onPointerDown:ae=>{Rh||!Ys||(dy.current=new Date,Ia(Qs.current),ae.target.setPointerCapture(ae.pointerId),ae.target.tagName!=="BUTTON"&&(we(!0),Xs.current={x:ae.clientX,y:ae.clientY}))},onPointerUp:()=>{var ae,Re,Be,En;if(Ct||!Ys)return;Xs.current=null;let _n=Number(((ae=rs.current)==null?void 0:ae.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ei=Number(((Re=rs.current)==null?void 0:Re.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),is=new Date().getTime()-((Be=dy.current)==null?void 0:Be.getTime()),Pn=se==="x"?_n:ei,ti=Math.abs(Pn)/is;if(Math.abs(Pn)>=AO||ti>.11){Ia(Qs.current),(En=m.onDismiss)==null||En.call(m,m),Oe(se==="x"?_n>0?"right":"left":ei>0?"down":"up"),Zr(),hn(!0),Xr(!1);return}we(!1),oe(null)},onPointerMove:ae=>{var Re,Be,En,_n;if(!Xs.current||!Ys||((Re=window.getSelection())==null?void 0:Re.toString().length)>0)return;let ei=ae.clientY-Xs.current.y,is=ae.clientX-Xs.current.x,Pn=(Be=t.swipeDirections)!=null?Be:MO(Y);!se&&(Math.abs(is)>1||Math.abs(ei)>1)&&oe(Math.abs(is)>Math.abs(ei)?"x":"y");let ti={x:0,y:0};se==="y"?(Pn.includes("top")||Pn.includes("bottom"))&&(Pn.includes("top")&&ei<0||Pn.includes("bottom")&&ei>0)&&(ti.y=ei):se==="x"&&(Pn.includes("left")||Pn.includes("right"))&&(Pn.includes("left")&&is<0||Pn.includes("right")&&is>0)&&(ti.x=is),(Math.abs(ti.x)>0||Math.abs(ti.y)>0)&&Xr(!0),(En=rs.current)==null||En.style.setProperty("--swipe-amount-x",`${ti.x}px`),(_n=rs.current)==null||_n.style.setProperty("--swipe-amount-y",`${ti.y}px`)}},yP&&!m.jsx?z.createElement("button",{"aria-label":te,"data-disabled":Rh,"data-close-button":!0,onClick:Rh||!Ys?()=>{}:()=>{var ae;Zr(),(ae=m.onDismiss)==null||ae.call(m,m)},className:In(M==null?void 0:M.closeButton,(i=m==null?void 0:m.classNames)==null?void 0:i.closeButton)},(s=H==null?void 0:H.close)!=null?s:yO):null,m.jsx||x.isValidElement(m.title)?m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title:z.createElement(z.Fragment,null,fn||m.icon||m.promise?z.createElement("div",{"data-icon":"",className:In(M==null?void 0:M.icon,(o=m==null?void 0:m.classNames)==null?void 0:o.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||kP():null,m.type!=="loading"?m.
vendor: 6,670 bytes, line 346
346icon||(H==null?void 0:H[fn])||dO(fn):null):null,z.createElement("div",{"data-content":"",className:In(M==null?void 0:M.content,(a=m==null?void 0:m.classNames)==null?void 0:a.content)},z.createElement("div",{"data-title":"",className:In(M==null?void 0:M.title,(l=m==null?void 0:m.classNames)==null?void 0:l.title)},typeof m.title=="function"?m.title():m.title),m.description?z.createElement("div",{"data-description":"",className:In(K,vP,M==null?void 0:M.description,(c=m==null?void 0:m.classNames)==null?void 0:c.description)},typeof m.description=="function"?m.description():m.description):null),x.isValidElement(m.cancel)?m.cancel:m.cancel&&zc(m.cancel)?z.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||R,onClick:ae=>{var Re,Be;zc(m.cancel)&&Ys&&((Be=(Re=m.cancel).onClick)==null||Be.call(Re,ae),Zr())},className:In(M==null?void 0:M.cancelButton,(u=m==null?void 0:m.classNames)==null?void 0:u.cancelButton)},m.cancel.label):null,x.isValidElement(m.action)?m.action:m.action&&zc(m.action)?z.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||A,onClick:ae=>{var Re,Be;zc(m.action)&&((Be=(Re=m.action).onClick)==null||Be.call(Re,ae),!ae.defaultPrevented&&Zr())},className:In(M==null?void 0:M.actionButton,(h=m==null?void 0:m.classNames)==null?void 0:h.actionButton)},m.action.label):null))};function z0(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function DO(t,e){let n={};return[t,e].forEach((r,i)=>{let s=i===1,o=s?"--mobile-offset":"--offset",a=s?RO:PO;function l(c){["top","right","bottom","left"].forEach(u=>{n[`${o}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${o}-${c}`]=a:n[`${o}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}var LO=x.forwardRef(function(t,e){let{invert:n,position:r="bottom-right",hotkey:i=["altKey","KeyT"],expand:s,closeButton:o,className:a,offset:l,mobileOffset:c,theme:u="light",richColors:h,duration:f,style:m,visibleToasts:b=_O,toastOptions:p,dir:g=z0(),gap:v=NO,loadingIcon:y,icons:w,containerAriaLabel:k="Notifications",pauseWhenPageIsHidden:S}=t,[T,C]=z.useState([]),_=z.useMemo(()=>Array.from(new Set([r].concat(T.filter(X=>X.position).map(X=>X.position)))),[T,r]),[P,R]=z.useState([]),[A,O]=z.useState(!1),[K,F]=z.useState(!1),[Y,V]=z.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Q=z.useRef(null),N=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=z.useRef(null),H=z.useRef(!1),te=z.useCallback(X=>{C(se=>{var oe;return(oe=se.find(Pe=>Pe.id===X.id))!=null&&oe.delete||Vt.dismiss(X.id),se.filter(({id:Pe})=>Pe!==X.id)})},[]);return z.useEffect(()=>Vt.subscribe(X=>{if(X.dismiss){C(se=>se.map(oe=>oe.id===X.id?{...oe,delete:!0}:oe));return}setTimeout(()=>{VS.flushSync(()=>{C(se=>{let oe=se.findIndex(Pe=>Pe.id===X.id);return oe!==-1?[...se.slice(0,oe),{...se[oe],...X},...se.slice(oe+1)]:[X,...se]})})})}),[]),z.useEffect(()=>{if(u!=="system"){V(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;let X=window.matchMedia("(prefers-color-scheme: dark)");try{X.addEventListener("change",({matches:se})=>{V(se?"dark":"light")})}catch{X.addListener(({matches:oe})=>{try{V(oe?"dark":"light")}catch(Pe){console.error(Pe)}})}},[u]),z.useEffect(()=>{T.length<=1&&O(!1)},[T]),z.useEffect(()=>{let X=se=>{var oe,Pe;i.every(Oe=>se[Oe]||se.code===Oe)&&(O(!0),(oe=Q.current)==null||oe.focus()),se.code==="Escape"&&(document.activeElement===Q.current||(Pe=Q.current)!=null&&Pe.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[i]),z.useEffect(()=>{if(Q.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,H.current=!1)}},[Q.current]),z.createElement("section",{ref:e,"aria-label":`${k} ${N}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((X,se)=>{var oe;let[Pe,Oe]=X.split("-");return T.length?z.createElement("ol",{key:X,dir:g==="auto"?z0():g,tabIndex:-1,ref:Q,className:a,"data-sonner-toaster":!0,"data-theme":Y,"data-y-position":Pe,"data-lifted":A&&T.length>1&&!s,"data-x-position":Oe,style:{"--front-toast-height":`${((oe=P[0])==null?void 0:oe.height)||0}px`,"--width":`${IO}px`,"--gap":`${v}px`,...m,...DO(l,c)},onBlur:G=>{H.current&&!G.currentTarget.contains(G.relatedTarget)&&(H.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:G=>{G.target instanceof HTMLElement&&G.target.dataset.dismissible==="false"||H.current||(H.current=!0,M.current=G.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{K||O(!1)},onDragEnd:()=>O(!1),onPointerDown:G=>{G.target instanceof HTMLElement&&G.target.dataset.dismissible==="false"||F(!0)},onPointerUp:()=>F(!1)},T.filter(G=>!G.position&&se===0||G.position===X).map((G,Te)=>{var Ge,Se;return z.createElement(jO,{key:G.id,icons:w,index:Te,toast:G,defaultRichColors:h,duration:(Ge=p==null?void 0:p.duration)!=null?Ge:f,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:n,visibleToasts:b,closeButton:(Se=p==null?void 0:p.closeButton)!=null?Se:o,interacting:K,position:X,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:te,toasts:T.filter(ve=>ve.position==G.position),heights:P.filter(ve=>ve.position==G.position),setHeights:R,expandByDefault:s,gap:v,loadingIcon:y,expanded:A,pauseWhenPageIsHidden:S,swipeDirections:t.swipeDirections})})):null}))});const UO=({...t})=>{const{theme:e="system"}=uO();return d.jsx(LO,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var FO=lg[" useId ".trim().toString()]||(()=>{}),BO=0;function fv(t){const[e,n]=x.useState(FO());return Tt(()=>{n(r=>r??String(BO++))},[t]),e?`radix-${e}
346`:""}const zO=["top","right","bottom","left"],Bi=Math.min,tn=Math.max,ad=Math.round,$c=Math.floor,zi=t=>({x:t,y:t}),$O={left:"right",right:"left",bottom:"top",top:"bottom"},VO={start:"end",end:"start"};function Qm(t,e,n){return tn(t,Bi(e,n))}function Gr(t,e){return typeof t=="function"?t(e):t}function Jr(t){return t.split("-")[0]}function Ca(t){return t.split("-")[1]}function mv(t){return t==="x"?"y":"x"}function pv(t){return t==="y"?"height":"width"}function $i(t){return["top","bottom"].includes(Jr(t))?"y":"x"}function gv(t){return mv($i(t))}function WO(t,e,n){n===void 0&&(n=!1);const r=Ca(t),i=gv(t),s=pv(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ld(o)),[o,ld(o)]}function qO(t){const e=ld(t);return[Xm(t),e,Xm(e)]}function Xm(t){return t.replace(/start|end/g,e=>VO[e])}function HO(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function KO(t,e,n,r){const i=Ca(t);let s=HO(Jr(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Xm)))),s}function ld(t){return t.replace(/left|right|bottom|top/g,e=>$O[e])}function GO(t){return{top:0,right:0,bottom:0,left:0,...t}}function zT(t){return typeof t!="number"?GO(t):{top:t,right:t,bottom:t,left:t}}function cd(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function $0(t,e,n){let{reference:r,floating:i}=t;const s=$i(e),o=gv(e),a=pv(o),l=Jr(e),c=s==="y",u=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let m;switch(l){case"top":m={x:u,y:r.y-i.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:h};break;case"left":m={x:r.x-i.width,y:h};break;default:m={x:r.x,y:r.y}}switch(Ca(e)){case"start":m[o]-=f*(n&&c?-1:1);break;case"end":m[o]+=f*(n&&c?-1:1);break}return m}const JO=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:h}=$0(c,r,l),f=r,m={},b=0;for(let p=0;p<a.length;p++){const{name:g,fn:v}=a[p],{x:y,y:w,data:k,reset:S}=await v({x:u,y:h,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:c,platform:o,elements:{reference:t,floating:e}});u=y??u,h=w??h,m={...m,[g]:{...m[g],...k}},S&&b<=50&&(b++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(c=S.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):S.rects),{x:u,y:h}=$0(c,f,l)),p=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:m}};async function Bl(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:m=0}=Gr(e,t),b=zT(m),g=a[f?h==="floating"?"reference":"floating":h],v=cd(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),y=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),k=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},S=cd(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:l}):y);return{top:(v.top-S.top+b.top)/k.y,bottom:(S.bottom-v.bottom+b.bottom)/k.y,left:(v.left-S.left+b.left)/k.x,right:(S.right-v.right+b.right)/k.x}}const YO=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Gr(t,e)||{};if(c==null)return{};const h=zT(u),f={x:n,y:r},m=gv(i),b=pv(m),p=await o.getDimensions(c),g=m==="y",v=g?"top":"left",y=g?"bottom":"right",w=g?"clientHeight":"clientWidth",k=s.reference[b]+s.reference[m]-f[m]-s.floating[b],S=f[m]-s.reference[m],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let C=T?T[w]:0;(!C||!await(o.isElement==null?void 0:o.isElement(T)))&&(C=a.floating[w]||s.floating[b]);const _=k/2-S/2,P=C/2-p[b]/2-1,R=Bi(h[v],P),A=Bi(h[y],P),O=R,K=C-p[b]-A,F=C/2-p[b]/2+_,Y=Qm(O,F,K),V=!l.arrow&&Ca(i)!=null&&F!==Y&&s.reference[b]/2-(F<O?R:A)-p[b]/2<0,Q=V?F<O?F-O:F-K:0;return{[m]:f[m]+Q,data:{[m]:Y,centerOffset:F-Y-Q,...V&&{alignmentOffset:Q}},reset:V}}}),QO=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:p=!0,...g}=Gr(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=Jr(i),y=$i(a),w=Jr(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=f||(w||!p?[ld(a)]:qO(a)),T=b!=="none";!f&&T&&S.push(...KO(a,p,b,k));const C=[a,...S],_=await Bl(e,g),P=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&P.push(_[v]),h){const F=WO(i,o,k);P.push(_[F[0]],_[F[1]])}if(R=[...R,{placement:i,overflows:P}],!P.every(F=>F<=0)){var A,O;const F=(((A=s.flip)==null?void 0:A.index)||0)+1,Y=C[F];if(Y)return{data:{index:F,overflows:R},reset:{placement:Y}};let V=(O=R.filter(Q=>Q.overflows[0]<=0).sort((Q,N)=>Q.overflows[1]-N.overflows[1])[0])==null?void 0:O.placement;if(!V)switch(m){case"bestFit":{var K;const Q=(K=R.filter(N=>{if(T){const M=$i(N.placement);return M===y||M==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(M=>M>0).reduce((M,H)=>M+H,0)]).sort((N,M)=>N[1]-M[1])[0])==null?void 0:K[0];Q&&(V=Q);break}case"initialPlacement":V=a;break}if(i!==V)return{reset:{placement:V}}}return{}}}};function V0(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function W0(t){return zO.some(e=>t[e]>=0)}const XO=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=Gr(t,e);switch(r){case"referenceHidden":{const s=await Bl(e,{...i,elementContext:"reference"}),o=V0(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:W0(o)}}}case"escaped":{const s=await Bl(e,{...i,altBoundary:!0}),o=V0(s,n.floating);return{data:{escapedOffsets:o,escaped:W0(o)}}}default:return{}}}}};async function ZO(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Jr(n),a=Ca(n),l=$i(n)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,h=Gr(e,t);let{mainAxis:f,crossAxis:m,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}
vendor: 5,601 bytes, line 346
346:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof b=="number"&&(m=a==="end"?b*-1:b),l?{x:m*u,y:f*c}:{x:f*c,y:m*u}}const eM=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await ZO(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},tM=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:g=>{let{x:v,y}=g;return{x:v,y}}},...l}=Gr(t,e),c={x:n,y:r},u=await Bl(e,l),h=$i(Jr(i)),f=mv(h);let m=c[f],b=c[h];if(s){const g=f==="y"?"top":"left",v=f==="y"?"bottom":"right",y=m+u[g],w=m-u[v];m=Qm(y,m,w)}if(o){const g=h==="y"?"top":"left",v=h==="y"?"bottom":"right",y=b+u[g],w=b-u[v];b=Qm(y,b,w)}const p=a.fn({...e,[f]:m,[h]:b});return{...p,data:{x:p.x-n,y:p.y-r,enabled:{[f]:s,[h]:o}}}}}},nM=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Gr(t,e),u={x:n,y:r},h=$i(i),f=mv(h);let m=u[f],b=u[h];const p=Gr(a,e),g=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const w=f==="y"?"height":"width",k=s.reference[f]-s.floating[w]+g.mainAxis,S=s.reference[f]+s.reference[w]-g.mainAxis;m<k?m=k:m>S&&(m=S)}if(c){var v,y;const w=f==="y"?"width":"height",k=["top","left"].includes(Jr(i)),S=s.reference[h]-s.floating[w]+(k&&((v=o.offset)==null?void 0:v[h])||0)+(k?0:g.crossAxis),T=s.reference[h]+s.reference[w]+(k?0:((y=o.offset)==null?void 0:y[h])||0)-(k?g.crossAxis:0);b<S?b=S:b>T&&(b=T)}return{[f]:m,[h]:b}}}},rM=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=Gr(t,e),u=await Bl(e,c),h=Jr(i),f=Ca(i),m=$i(i)==="y",{width:b,height:p}=s.floating;let g,v;h==="top"||h==="bottom"?(g=h,v=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(v=h,g=f==="end"?"top":"bottom");const y=p-u.top-u.bottom,w=b-u.left-u.right,k=Bi(p-u[g],y),S=Bi(b-u[v],w),T=!e.middlewareData.shift;let C=k,_=S;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(_=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(C=y),T&&!f){const R=tn(u.left,0),A=tn(u.right,0),O=tn(u.top,0),K=tn(u.bottom,0);m?_=b-2*(R!==0||A!==0?R+A:tn(u.left,u.right)):C=p-2*(O!==0||K!==0?O+K:tn(u.top,u.bottom))}await l({...e,availableWidth:_,availableHeight:C});const P=await o.getDimensions(a.floating);return b!==P.width||p!==P.height?{reset:{rects:!0}}:{}}}};function eh(){return typeof window<"u"}function Ea(t){return $T(t)?(t.nodeName||"").toLowerCase():"#document"}function an(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Sr(t){var e;return(e=($T(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function $T(t){return eh()?t instanceof Node||t instanceof an(t).Node:!1}function Xn(t){return eh()?t instanceof Element||t instanceof an(t).Element:!1}function br(t){return eh()?t instanceof HTMLElement||t instanceof an(t).HTMLElement:!1}function q0(t){return!eh()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof an(t).ShadowRoot}function vc(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Zn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function iM(t){return["table","td","th"].includes(Ea(t))}function th(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function vv(t){const e=yv(),n=Xn(t)?Zn(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function sM(t){let e=Vi(t);for(;br(e)&&!ga(e);){if(vv(e))return e;if(th(e))return null;e=Vi(e)}return null}function yv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ga(t){return["html","body","#document"].includes(Ea(t))}function Zn(t){return an(t).getComputedStyle(t)}function nh(t){return Xn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Vi(t){if(Ea(t)==="html")return t;const e=t.assignedSlot||t.parentNode||q0(t)&&t.host||Sr(t);return q0(e)?e.host:e}function VT(t){const e=Vi(t);return ga(e)?t.ownerDocument?t.ownerDocument.body:t.body:br(e)&&vc(e)?e:VT(e)}function zl(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=VT(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=an(i);if(s){const a=Zm(o);return e.concat(o,o.visualViewport||[],vc(i)?i:[],a&&n?zl(a):[])}return e.concat(i,zl(i,[],n))}function Zm(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function WT(t){const e=Zn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=br(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=ad(n)!==s||ad(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function bv(t){return Xn(t)?t:t.contextElement}function Fo(t){const e=bv(t);if(!br(e))return zi(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=WT(e);let o=(s?ad(n.width):n.width)/r,a=(s?ad(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const oM=zi(0);function qT(t){const e=an(t);
vendor: 5,412 bytes, line 346
346return!yv()||!e.visualViewport?oM:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function aM(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==an(t)?!1:e}function Ds(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=bv(t);let o=zi(1);e&&(r?Xn(r)&&(o=Fo(r)):o=Fo(t));const a=aM(s,n,r)?qT(s):zi(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,h=i.height/o.y;if(s){const f=an(s),m=r&&Xn(r)?an(r):r;let b=f,p=Zm(b);for(;p&&r&&m!==b;){const g=Fo(p),v=p.getBoundingClientRect(),y=Zn(p),w=v.left+(p.clientLeft+parseFloat(y.paddingLeft))*g.x,k=v.top+(p.clientTop+parseFloat(y.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,h*=g.y,l+=w,c+=k,b=an(p),p=Zm(b)}}return cd({width:u,height:h,x:l,y:c})}function lM(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Sr(r),a=e?th(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=zi(1);const u=zi(0),h=br(r);if((h||!h&&!s)&&((Ea(r)!=="body"||vc(o))&&(l=nh(r)),br(r))){const f=Ds(r);c=Fo(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}}function cM(t){return Array.from(t.getClientRects())}function ep(t,e){const n=nh(t).scrollLeft;return e?e.left+n:Ds(Sr(t)).left+n}function uM(t){const e=Sr(t),n=nh(t),r=t.ownerDocument.body,i=tn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=tn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+ep(t);const a=-n.scrollTop;return Zn(r).direction==="rtl"&&(o+=tn(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}function dM(t,e){const n=an(t),r=Sr(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=yv();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function hM(t,e){const n=Ds(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=br(t)?Fo(t):zi(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function H0(t,e,n){let r;if(e==="viewport")r=dM(t,n);else if(e==="document")r=uM(Sr(t));else if(Xn(e))r=hM(e,n);else{const i=qT(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return cd(r)}function HT(t,e){const n=Vi(t);return n===e||!Xn(n)||ga(n)?!1:Zn(n).position==="fixed"||HT(n,e)}function fM(t,e){const n=e.get(t);if(n)return n;let r=zl(t,[],!1).filter(a=>Xn(a)&&Ea(a)!=="body"),i=null;const s=Zn(t).position==="fixed";let o=s?Vi(t):t;for(;Xn(o)&&!ga(o);){const a=Zn(o),l=vv(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||vc(o)&&!l&&HT(t,o))?r=r.filter(u=>u!==o):i=a,o=Vi(o)}return e.set(t,r),r}function mM(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?th(e)?[]:fM(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,u)=>{const h=H0(e,u,i);return c.top=tn(h.top,c.top),c.right=Bi(h.right,c.right),c.bottom=Bi(h.bottom,c.bottom),c.left=tn(h.left,c.left),c},H0(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function pM(t){const{width:e,height:n}=WT(t);return{width:e,height:n}}function gM(t,e,n){const r=br(e),i=Sr(e),s=n==="fixed",o=Ds(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=zi(0);if(r||!r&&!s)if((Ea(e)!=="body"||vc(i))&&(a=nh(e)),r){const m=Ds(e,!0,s,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else i&&(l.x=ep(i));let c=0,u=0;if(i&&!r&&!s){const m=i.getBoundingClientRect();u=m.top+a.scrollTop,c=m.left+a.scrollLeft-ep(i,m)}const h=o.left+a.scrollLeft-l.x-c,f=o.top+a.scrollTop-l.y-u;return{x:h,y:f,width:o.width,height:o.height}}function lf(t){return Zn(t).position==="static"}function K0(t,e){if(!br(t)||Zn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Sr(t)===n&&(n=n.ownerDocument.body),n}function KT(t,e){const n=an(t);if(th(t))return n;if(!br(t)){let i=Vi(t);for(;i&&!ga(i);){if(Xn(i)&&!lf(i))return i;i=Vi(i)}return n}let r=K0(t,e);for(;r&&iM(r)&&lf(r);)r=K0(r,e);return r&&ga(r)&&lf(r)&&!vv(r)?n:r||sM(t)||n}const vM=async function(t){const e=this.getOffsetParent||KT,n=this.getDimensions,r=await n(t.floating);return{reference:gM(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yM(t){return Zn(t).direction==="rtl"}const bM={convertOffsetParentRelativeRectToViewportRelativeRect:lM,getDocumentElement:Sr,getClippingRect:mM,getOffsetParent:KT,getElementRects:vM,getClientRects:cM,getDimensions:pM,getScale:Fo,isElement:Xn,isRTL:yM};function wM(t,e){let n=null,r;const i=Sr(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:c,top:u,width:h,height:f}=t.getBoundingClientRect();if(a||e(),!h||!f)return;const m=$c(u),b=$c(i.clientWidth-(c+h)),p=$c(i.clientHeight-(u+f)),g=$c(c),y={rootMargin:-m+"px "+-b+"px "+-p+"px "+-g+"px",threshold:tn(0,Bi(1,l))||1};let w=!0;function k(S){const T=S[0].intersectionRatio;if(T!==l){if(!w)return o();T?o(!1,T):r=setTimeout(()=>{o(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(k,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,y)}n.observe(t)}return o(!0),s}function xM(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}
vendor: 4,780 bytes, line 346
346=r,c=bv(t),u=i||s?[...c?zl(c):[],...zl(e)]:[];u.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const h=c&&a?wM(c,n):null;let f=-1,m=null;o&&(m=new ResizeObserver(v=>{let[y]=v;y&&y.target===c&&m&&(m.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(e)})),n()}),c&&!l&&m.observe(c),m.observe(e));let b,p=l?Ds(t):null;l&&g();function g(){const v=Ds(t);p&&(v.x!==p.x||v.y!==p.y||v.width!==p.width||v.height!==p.height)&&n(),p=v,b=requestAnimationFrame(g)}return n(),()=>{var v;u.forEach(y=>{i&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),h==null||h(),(v=m)==null||v.disconnect(),m=null,l&&cancelAnimationFrame(b)}}const kM=eM,SM=tM,TM=QO,CM=rM,EM=XO,G0=YO,_M=nM,PM=(t,e,n)=>{const r=new Map,i={platform:bM,...n},s={...i.platform,_c:r};return JO(t,e,{...i,platform:s})};var bu=typeof document<"u"?x.useLayoutEffect:x.useEffect;function ud(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!ud(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!ud(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function GT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function J0(t,e){const n=GT(t);return Math.round(e*n)/n}function cf(t){const e=x.useRef(t);return bu(()=>{e.current=t}),e}function RM(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[u,h]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,m]=x.useState(r);ud(f,r)||m(r);const[b,p]=x.useState(null),[g,v]=x.useState(null),y=x.useCallback(N=>{N!==T.current&&(T.current=N,p(N))},[]),w=x.useCallback(N=>{N!==C.current&&(C.current=N,v(N))},[]),k=s||b,S=o||g,T=x.useRef(null),C=x.useRef(null),_=x.useRef(u),P=l!=null,R=cf(l),A=cf(i),O=cf(c),K=x.useCallback(()=>{if(!T.current||!C.current)return;const N={placement:e,strategy:n,middleware:f};A.current&&(N.platform=A.current),PM(T.current,C.current,N).then(M=>{const H={...M,isPositioned:O.current!==!1};F.current&&!ud(_.current,H)&&(_.current=H,qs.flushSync(()=>{h(H)}))})},[f,e,n,A,O]);bu(()=>{c===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,h(N=>({...N,isPositioned:!1})))},[c]);const F=x.useRef(!1);bu(()=>(F.current=!0,()=>{F.current=!1}),[]),bu(()=>{if(k&&(T.current=k),S&&(C.current=S),k&&S){if(R.current)return R.current(k,S,K);K()}},[k,S,K,R,P]);const Y=x.useMemo(()=>({reference:T,floating:C,setReference:y,setFloating:w}),[y,w]),V=x.useMemo(()=>({reference:k,floating:S}),[k,S]),Q=x.useMemo(()=>{const N={position:n,left:0,top:0};if(!V.floating)return N;const M=J0(V.floating,u.x),H=J0(V.floating,u.y);return a?{...N,transform:"translate("+M+"px, "+H+"px)",...GT(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:H}},[n,a,V.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:K,refs:Y,elements:V,floatingStyles:Q}),[u,K,Y,V,Q])}const IM=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?G0({element:r.current,padding:i}).fn(n):{}:r?G0({element:r,padding:i}).fn(n):{}}}},NM=(t,e)=>({...kM(t),options:[t,e]}),AM=(t,e)=>({...SM(t),options:[t,e]}),OM=(t,e)=>({..._M(t),options:[t,e]}),MM=(t,e)=>({...TM(t),options:[t,e]}),jM=(t,e)=>({...CM(t),options:[t,e]}),DM=(t,e)=>({...EM(t),options:[t,e]}),LM=(t,e)=>({...IM(t),options:[t,e]});var UM="Arrow",JT=x.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return d.jsx(_e.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});JT.displayName=UM;var FM=JT;function BM(t){const[e,n]=x.useState(void 0);return Tt(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var wv="Popper",[YT,rh]=pc(wv),[zM,QT]=YT(wv),XT=t=>{const{__scopePopper:e,children:n}=t,[r,i]=x.useState(null);return d.jsx(zM,{scope:e,anchor:r,onAnchorChange:i,children:n})};
vendor: 4,561 bytes, line 346
346XT.displayName=wv;var ZT="PopperAnchor",eC=x.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=QT(ZT,n),o=x.useRef(null),a=et(e,o);return x.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:d.jsx(_e.div,{...i,ref:a})});eC.displayName=ZT;var xv="PopperContent",[$M,VM]=YT(xv),tC=x.forwardRef((t,e)=>{var G,Te,Ge,Se,ve,we;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:m="optimized",onPlaced:b,...p}=t,g=QT(xv,n),[v,y]=x.useState(null),w=et(e,Ct=>y(Ct)),[k,S]=x.useState(null),T=BM(k),C=(T==null?void 0:T.width)??0,_=(T==null?void 0:T.height)??0,P=r+(s!=="center"?"-"+s:""),R=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},A=Array.isArray(c)?c:[c],O=A.length>0,K={padding:R,boundary:A.filter(qM),altBoundary:O},{refs:F,floatingStyles:Y,placement:V,isPositioned:Q,middlewareData:N}=RM({strategy:"fixed",placement:P,whileElementsMounted:(...Ct)=>xM(...Ct,{animationFrame:m==="always"}),elements:{reference:g.anchor},middleware:[NM({mainAxis:i+_,alignmentAxis:o}),l&&AM({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?OM():void 0,...K}),l&&MM({...K}),jM({...K,apply:({elements:Ct,rects:hn,availableWidth:ts,availableHeight:Xr})=>{const{width:ns,height:Ia}=hn.reference,Js=Ct.floating.style;Js.setProperty("--radix-popper-available-width",`${ts}px`),Js.setProperty("--radix-popper-available-height",`${Xr}px`),Js.setProperty("--radix-popper-anchor-width",`${ns}px`),Js.setProperty("--radix-popper-anchor-height",`${Ia}px`)}}),k&&LM({element:k,padding:a}),HM({arrowWidth:C,arrowHeight:_}),f&&DM({strategy:"referenceHidden",...K})]}),[M,H]=iC(V),te=Qn(b);Tt(()=>{Q&&(te==null||te())},[Q,te]);const X=(G=N.arrow)==null?void 0:G.x,se=(Te=N.arrow)==null?void 0:Te.y,oe=((Ge=N.arrow)==null?void 0:Ge.centerOffset)!==0,[Pe,Oe]=x.useState();return Tt(()=>{v&&Oe(window.getComputedStyle(v).zIndex)},[v]),d.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...Y,transform:Q?Y.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Pe,"--radix-popper-transform-origin":[(Se=N.transformOrigin)==null?void 0:Se.x,(ve=N.transformOrigin)==null?void 0:ve.y].join(" "),...((we=N.hide)==null?void 0:we.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx($M,{scope:n,placedSide:M,onArrowChange:S,arrowX:X,arrowY:se,shouldHideArrow:oe,children:d.jsx(_e.div,{"data-side":M,"data-align":H,...p,ref:w,style:{...p.style,animation:Q?void 0:"none"}})})})});tC.displayName=xv;var nC="PopperArrow",WM={top:"bottom",right:"left",bottom:"top",left:"right"},rC=x.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=VM(nC,r),o=WM[s.placedSide];return d.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:d.jsx(FM,{...i,ref:n,style:{...i.style,display:"block"}})})});rC.displayName=nC;function qM(t){return t!==null}var HM=t=>({name:"transformOrigin",options:t,fn(e){var g,v,y;const{placement:n,rects:r,middlewareData:i}=e,o=((g=i.arrow)==null?void 0:g.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,u]=iC(n),h={start:"0%",center:"50%",end:"100%"}[u],f=(((v=i.arrow)==null?void 0:v.x)??0)+a/2,m=(((y=i.arrow)==null?void 0:y.y)??0)+l/2;let b="",p="";return c==="bottom"?(b=o?h:`${f}px`,p=`${-l}px`):c==="top"?(b=o?h:`${f}px`,p=`${r.floating.height+l}px`):c==="right"?(b=`${-l}px`,p=o?h:`${m}px`):c==="left"&&(b=`${r.floating.width+l}px`,p=o?h:`${m}px`),{data:{x:b,y:p}}}});function iC(t){const[e,n="center"]=t.split("-");return[e,n]}var KM=XT,sC=eC,oC=tC,aC=rC,[ih,kV]=pc("Tooltip",[rh]),kv=rh(),lC="TooltipProvider",GM=700,Y0="tooltip.open",[JM,cC]=ih(lC),uC=t=>{const{__scopeTooltip:e,delayDuration:n=GM,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,o=x.useRef(!0),a=x.useRef(!1),l=x.useRef(0);return x.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),d.jsx(JM,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>
vendor: 5,838 bytes, line 346
346o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:x.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})};uC.displayName=lC;var dC="Tooltip",[SV,sh]=ih(dC),tp="TooltipTrigger",YM=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=sh(tp,n),s=cC(tp,n),o=kv(n),a=x.useRef(null),l=et(e,a,i.onTriggerChange),c=x.useRef(!1),u=x.useRef(!1),h=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),d.jsx(sC,{asChild:!0,...o,children:d.jsx(_e.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:ge(t.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:ge(t.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:ge(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ge(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:ge(t.onBlur,i.onClose),onClick:ge(t.onClick,i.onClose)})})});YM.displayName=tp;var QM="TooltipPortal",[TV,XM]=ih(QM,{forceMount:void 0}),va="TooltipContent",hC=x.forwardRef((t,e)=>{const n=XM(va,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=sh(va,t.__scopeTooltip);return d.jsx(tv,{present:r||o.open,children:o.disableHoverableContent?d.jsx(fC,{side:i,...s,ref:e}):d.jsx(ZM,{side:i,...s,ref:e})})}),ZM=x.forwardRef((t,e)=>{const n=sh(va,t.__scopeTooltip),r=cC(va,t.__scopeTooltip),i=x.useRef(null),s=et(e,i),[o,a]=x.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:h}=r,f=x.useCallback(()=>{a(null),h(!1)},[h]),m=x.useCallback((b,p)=>{const g=b.currentTarget,v={x:b.clientX,y:b.clientY},y=ij(v,g.getBoundingClientRect()),w=sj(v,y),k=oj(p.getBoundingClientRect()),S=lj([...w,...k]);a(S),h(!0)},[h]);return x.useEffect(()=>()=>f(),[f]),x.useEffect(()=>{if(l&&u){const b=g=>m(g,u),p=g=>m(g,l);return l.addEventListener("pointerleave",b),u.addEventListener("pointerleave",p),()=>{l.removeEventListener("pointerleave",b),u.removeEventListener("pointerleave",p)}}},[l,u,m,f]),x.useEffect(()=>{if(o){const b=p=>{const g=p.target,v={x:p.clientX,y:p.clientY},y=(l==null?void 0:l.contains(g))||(u==null?void 0:u.contains(g)),w=!aj(v,o);y?f():w&&(f(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[l,u,o,c,f]),d.jsx(fC,{...t,ref:s})}),[ej,tj]=ih(dC,{isInside:!1}),nj=sN("TooltipContent"),fC=x.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=t,l=sh(va,n),c=kv(n),{onClose:u}=l;return x.useEffect(()=>(document.addEventListener(Y0,u),()=>document.removeEventListener(Y0,u)),[u]),x.useEffect(()=>{if(l.trigger){const h=f=>{const m=f.target;m!=null&&m.contains(l.trigger)&&u()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,u]),d.jsx(Yd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:u,children:d.jsxs(oC,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(nj,{children:r}),d.jsx(ej,{scope:n,isInside:!0,children:d.jsx(_N,{id:l.contentId,role:"tooltip",children:i||r})})]})})});hC.displayName=va;var mC="TooltipArrow",rj=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=kv(n);return tj(mC,n).isInside?null:d.jsx(aC,{...i,...r,ref:e})});rj.displayName=mC;function ij(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function sj(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function oj(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function aj(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s],l=e[o],c=a.x,u=a.y,h=l.x,f=l.y;u>r!=f>r&&n<(h-c)*(r-u)/(f-u)+c&&(i=!i)}return i}function lj(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),cj(e)}function cj(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var uj=uC,pC=hC;const dj=uj,hj=x.forwardRef(({className:t,sideOffset:e=4,...n},r)=>d.jsx(pC,{ref:r,sideOffset:e,className:ce("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
346de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));hj.displayName=pC.displayName;var oh=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ah=typeof window>"u"||"Deno"in globalThis;function jn(){}function fj(t,e){return typeof t=="function"?t(e):t}function mj(t){return typeof t=="number"&&t>=0&&t!==1/0}function pj(t,e){return Math.max(t+(e||0)-Date.now(),0)}function np(t,e){return typeof t=="function"?t(e):t}function gj(t,e){return typeof t=="function"?t(e):t}function Q0(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==Sv(o,e.options))return!1}else if(!Vl(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function X0(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if($l(e.options.mutationKey)!==$l(s))return!1}else if(!Vl(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Sv(t,e){return((e==null?void 0:e.queryKeyHashFn)||$l)(t)}function $l(t){return JSON.stringify(t,(e,n)=>rp(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Vl(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Vl(t[n],e[n])):!1}function gC(t,e){if(t===e)return t;const n=Z0(t)&&Z0(e);if(n||rp(t)&&rp(e)){const r=n?t:Object.keys(t),i=r.length,s=n?e:Object.keys(e),o=s.length,a=n?[]:{},l=new Set(r);let c=0;for(let u=0;u<o;u++){const h=n?u:s[u];(!n&&l.has(h)||n)&&t[h]===void 0&&e[h]===void 0?(a[h]=void 0,c++):(a[h]=gC(t[h],e[h]),a[h]===t[h]&&t[h]!==void 0&&c++)}return i===o&&c===i?t:a}return e}function Z0(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function rp(t){if(!eb(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!eb(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function eb(t){return Object.prototype.toString.call(t)==="[object Object]"}function vj(t){return new Promise(e=>{setTimeout(e,t)})}function yj(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?gC(t,e):e}function bj(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function wj(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Tv=Symbol();function vC(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Tv?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var bs,yi,Zo,Sx,xj=(Sx=class extends oh{constructor(){super();xe(this,bs);xe(this,yi);xe(this,Zo);le(this,Zo,e=>{if(!ah&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){j(this,yi)||this.setEventListener(j(this,Zo))}onUnsubscribe(){var e;this.hasListeners()||((e=j(this,yi))==null||e.call(this),le(this,yi,void 0))}setEventListener(e){var n;le(this,Zo,e),(n=j(this,yi))==null||n.call(this),le(this,yi,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){j(this,bs)!==e&&(le(this,bs,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof j(this,bs)=="boolean"?j(this,bs):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},bs=new WeakMap,yi=new WeakMap,Zo=new WeakMap,Sx),yC=new xj,ea,bi,ta,Tx,kj=(Tx=class extends oh{constructor(){super();xe(this,ea,!0);xe(this,bi);xe(this,ta);le(this,ta,e=>{if(!ah&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){j(this,bi)||this.setEventListener(j(this,ta))}onUnsubscribe(){var e;this.hasListeners()||((e=j(this,bi))==null||e.call(this),le(this,bi,void 0))}setEventListener(e){var n;le(this,ta,e),(n=j(this,bi))==null||n.call(this),le(this,bi,e(this.setOnline.bind(this)))}setOnline(e){j(this,ea)!==e&&(le(this,ea,e),this.listeners.forEac
vendor: 19,428 bytes, line 346
346h(r=>{r(e)}))}isOnline(){return j(this,ea)}},ea=new WeakMap,bi=new WeakMap,ta=new WeakMap,Tx),dd=new kj;function Sj(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function Tj(t){return Math.min(1e3*2**t,3e4)}function bC(t){return(t??"online")==="online"?dd.isOnline():!0}var wC=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function uf(t){return t instanceof wC}function xC(t){let e=!1,n=0,r=!1,i;const s=Sj(),o=p=>{var g;r||(f(new wC(p)),(g=t.abort)==null||g.call(t))},a=()=>{e=!0},l=()=>{e=!1},c=()=>yC.isFocused()&&(t.networkMode==="always"||dd.isOnline())&&t.canRun(),u=()=>bC(t.networkMode)&&t.canRun(),h=p=>{var g;r||(r=!0,(g=t.onSuccess)==null||g.call(t,p),i==null||i(),s.resolve(p))},f=p=>{var g;r||(r=!0,(g=t.onError)==null||g.call(t,p),i==null||i(),s.reject(p))},m=()=>new Promise(p=>{var g;i=v=>{(r||c())&&p(v)},(g=t.onPause)==null||g.call(t)}).then(()=>{var p;i=void 0,r||(p=t.onContinue)==null||p.call(t)}),b=()=>{if(r)return;let p;const g=n===0?t.initialPromise:void 0;try{p=g??t.fn()}catch(v){p=Promise.reject(v)}Promise.resolve(p).then(h).catch(v=>{var T;if(r)return;const y=t.retry??(ah?0:3),w=t.retryDelay??Tj,k=typeof w=="function"?w(n,v):w,S=y===!0||typeof y=="number"&&n<y||typeof y=="function"&&y(n,v);if(e||!S){f(v);return}n++,(T=t.onFail)==null||T.call(t,n,v),vj(k).then(()=>c()?void 0:m()).then(()=>{e?f(v):b()})})};return{promise:s,cancel:o,continue:()=>(i==null||i(),s),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?b():m().then(b),s)}}var Cj=t=>setTimeout(t,0);function Ej(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=Cj;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Dt=Ej(),ws,Cx,kC=(Cx=class{constructor(){xe(this,ws)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mj(this.gcTime)&&le(this,ws,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(ah?1/0:5*60*1e3))}clearGcTimeout(){j(this,ws)&&(clearTimeout(j(this,ws)),le(this,ws,void 0))}},ws=new WeakMap,Cx),na,xs,vn,ks,Rt,ac,Ss,Ln,Pr,Ex,_j=(Ex=class extends kC{constructor(e){super();xe(this,Ln);xe(this,na);xe(this,xs);xe(this,vn);xe(this,ks);xe(this,Rt);xe(this,ac);xe(this,Ss);le(this,Ss,!1),le(this,ac,e.defaultOptions),this.setOptions(e.options),this.observers=[],le(this,ks,e.client),le(this,vn,j(this,ks).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,le(this,na,Rj(this.options)),this.state=e.state??j(this,na),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=j(this,Rt))==null?void 0:e.promise}setOptions(e){this.options={...j(this,ac),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&j(this,vn).remove(this)}setData(e,n){const r=yj(this.state.data,e,this.options);return Et(this,Ln,Pr).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Et(this,Ln,Pr).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=j(this,Rt))==null?void 0:r.promise;return(i=j(this,Rt))==null||i.cancel(e),n?n.then(jn).catch(jn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(j(this,na))}isActive(){return this.observers.some(e=>gj(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Tv||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>np(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!pj(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=j(this,Rt))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=j(this,Rt))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),j(this,vn).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(j(this,Rt)&&(j(this,Ss)?j(this,Rt).cancel({revert:!0}):j(this,Rt).cancelRetry()),this.scheduleGc()),j(this,vn).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Et(this,Ln,Pr).call(this,{type:"invalidate"})}fetch(e,n){var c,u,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(j(this,Rt))return j(this,Rt).continueRetry(),j(this,Rt).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(le(this,Ss,!0),r.signal)})},s=()=>{const f=vC(this.options,n),b=(()=>{const p={client:j(this,ks),queryKey:this.queryKey,meta:this.meta};return i(p),p})();return le(this,Ss,!1),this.options.persister?this.options.persister(f,b,this):f(b)},a=(()=>{const f={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:j(this,ks),state:this.state,fetchFn:s};return i(f),f})();(c=this.options.behavior)==null||c.onFetch(a,this),le(this,xs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&Et(this,Ln,Pr).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=f=>{var m,b,p,g;uf(f)&&f.silent||Et(this,Ln,Pr).call(this,{type:"error",error:f}),uf(f)||((b=(m=j(this,vn).config).onError)==null||b.call(m,f,this),(g=(p=j(this,vn).config).onSettled)==null||g.call(p,this.state.data,f,this)),this.scheduleGc()};return le(this,Rt,xC({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var m,b,p,g;if(f===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(v){l(v);return}(b=(m=j(this,vn).config).onSuccess)==null||b.call(m,f,this),(g=(p=j(this,vn).config).onSettled)==null||g.call(p,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,m)=>{Et(this,Ln,Pr).call(this,{type:"failed",failureCount:f,error:m})},onPause:()=>{Et(this,Ln,Pr).call(this,{type:"pause"})},onContinue:()=>{Et(this,Ln,Pr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),j(this,Rt).start()}},na=new WeakMap,xs=new WeakMap,vn=new WeakMap,ks=new WeakMap,Rt=new WeakMap,ac=new WeakMap,Ss=new WeakMap,Ln=new WeakSet,Pr=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Pj(r.data,this.options),fetchMeta:e.meta??null};case"success":return le(this,xs,void 0),{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return uf(i)&&i.revert&&j(this,xs)?{...j(this,xs),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Dt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),j(this,vn).notify({query:this,type:"updated",action:e})})},Ex);function Pj(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:bC(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Rj(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var lr,_x,Ij=(_x=class extends oh{constructor(e={}){super();xe(this,lr);this.config=e,le(this,lr,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??Sv(i,n);let o=this.get(s);return o||(o=new _j({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){j(this,lr).has(e.queryHash)||(j(this,lr).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=j(this,lr).get(e.queryHash);n&&(e.destroy(),n===e&&j(this,lr).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Dt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return j(this,lr).get(e)}getAll(){return[...j(this,lr).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Q0(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>Q0(e,r)):n}notify(e){Dt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Dt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Dt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},lr=new WeakMap,_x),cr,Ot,Ts,ur,li,Px,Nj=(Px=class extends kC{constructor(e){super();xe(this,ur);xe(this,cr);xe(this,Ot);xe(this,Ts);this.mutationId=e.mutationId,le(this,Ot,e.mutationCache),le(this,cr,[]),this.state=e.state||Aj(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){j(this,cr).includes(e)||(j(this,cr).push(e),this.clearGcTimeout(),j(this,Ot).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){le(this,cr,j(this,cr).filter(n=>n!==e)),this.scheduleGc(),j(this,Ot).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){j(this,cr).length||(this.state.status==="pending"?this.scheduleGc():j(this,Ot).remove(this))}continue(){var e;return((e=j(this,Ts))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var s,o,a,l,c,u,h,f,m,b,p,g,v,y,w,k,S,T,C,_;const n=()=>{Et(this,ur,li).call(this,{type:"continue"})};le(this,Ts,xC({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(P,R)=>{Et(this,ur,li).call(this,{type:"failed",failureCount:P,error:R})},onPause:()=>{Et(this,ur,li).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>j(this,Ot).canRun(this)}));const r=this.state.status==="pending",i=!j(this,Ts).canStart();try{if(r)n();else{Et(this,ur,li).call(this,{type:"pending",variables:e,isPaused:i}),await((o=(s=j(this,Ot).config).onMutate)==null?void 0:o.call(s,e,this));const R=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,e));R!==this.state.context&&Et(this,ur,li).call(this,{type:"pending",context:R,variables:e,isPaused:i})}const P=await j(this,Ts).start();return await((u=(c=j(this,Ot).config).onSuccess)==null?void 0:u.call(c,P,e,this.state.context,this)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,P,e,this.state.context)),await((b=(m=j(this,Ot).config).onSettled)==null?void 0:b.call(m,P,null,this.state.variables,this.state.context,this)),await((g=(p=this.options).onSettled)==null?void 0:g.call(p,P,null,e,this.state.context)),Et(this,ur,li).call(this,{type:"success",data:P}),P}catch(P){try{throw await((y=(v=j(this,Ot).config).onError)==null?void 0:y.call(v,P,e,this.state.context,this)),await((k=(w=this.options).onError)==null?void 0:k.call(w,P,e,this.state.context)),await((T=(S=j(this,Ot).config).onSettled)==null?void 0:T.call(S,void 0,P,this.state.variables,this.state.context,this)),await((_=(C=this.options).onSettled)==null?void 0:_.call(C,void 0,P,e,this.state.context)),P}finally{Et(this,ur,li).call(this,{type:"error",error:P})}}finally{j(this,Ot).runNext(this)}}},cr=new WeakMap,Ot=new WeakMap,Ts=new WeakMap,ur=new WeakSet,li=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Dt.batch(()=>{j(this,cr).forEach(r=>{r.onMutationUpdate(e)}),j(this,Ot).notify({mutation:this,type:"updated",action:e})})},Px);function Aj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var jr,Un,lc,Rx,Oj=(Rx=class extends oh{constructor(e={}){super();xe(this,jr);xe(this,Un);xe(this,lc);this.config=e,le(this,jr,new Set),le(this,Un,new Map),le(this,lc,0)}build(e,n,r){const i=new Nj({mutationCache:this,mutationId:++xc(this,lc)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){j(this,jr).add(e);const n=Vc(e);if(typeof n=="string"){const r=j(this,Un).get(n);r?r.push(e):j(this,Un).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(j(this,jr).delete(e)){const n=Vc(e);if(typeof n=="string"){const r=j(this,Un).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&j(this,Un).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Vc(e);if(typeof n=="string"){const r=j(this,Un).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=Vc(e);if(typeof n=="string"){const i=(r=j(this,Un).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Dt.batch(()=>{j(this,jr).forEach(e=>{this.notify({type:"removed",mutation:e})}),j(this,jr).clear(),j(this,Un).clear()})}getAll(){return Array.from(j(this,jr))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>X0(n,r))}findAll(e={}){return this.getAll().filter(n=>X0(e,n))}notify(e){Dt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Dt.batch(()=>Promise.all(e.map(n=>n.continue().catch(jn))))}},jr=new WeakMap,Un=new WeakMap,lc=new WeakMap,Rx);function Vc(t){var e;return(e=t.options.scope)==null?void 0:e.id}function tb(t){return{onFetch:(e,n)=>{var u,h,f,m,b;const r=e.options,i=(f=(h=(u=e.fetchOptions)==null?void 0:u.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,s=((m=e.state.data)==null?void 0:m.pages)||[],o=((b=e.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let p=!1;const g=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?p=!0:e.signal.addEventListener("abort",()=>{p=!0}),e.signal)})},v=vC(e.options,e.fetchOptions),y=async(w,k,S)=>{if(p)return Promise.reject();if(k==null&&w.pages.length)return Promise.resolve(w);const C=(()=>{const A={client:e.client,queryKey:e.queryKey,pageParam:k,direction:S?"backward":"forward",meta:e.options.meta};return g(A),A})(),_=await v(C),{maxPages:P}=e.options,R=S?wj:bj;return{pages:R(w.pages,_,P),pageParams:R(w.pageParams,k,P)}};if(i&&s.length){const w=i==="backward",k=w?Mj:nb,S={pages:s,pageParams:o},T=k(r,S);a=await y(S,T,w)}else{const w=t??s.length;do{const k=l===0?o[0]??r.initialPageParam:nb(r,a);if(l>0&&k==null)break;a=await y(a,k),l++}while(l<w)}return a};e.options.persister?e.fetchFn=()=>{var p,g;return(g=(p=e.options).persister)==null?void 0:g.call(p,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function nb(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function Mj(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Je,wi,xi,ra,ia,ki,sa,oa,Ix,jj=(Ix=class{constructor(t={}){xe(this,Je);xe(this,wi);xe(this,xi);xe(this,ra);xe(this,ia);xe(this,ki);xe(this,sa);xe(this,oa);le(this,Je,t.queryCache||new Ij),le(this,wi,t.mutationCache||new Oj),le(this,xi,t.defaultOptions||{}),le(this,ra,new Map),le(this,ia,new Map),le(this,ki,0)}mount(){xc(this,ki)._++,j(this,ki)===1&&(le(this,sa,yC.subscribe(async t=>{t&&(await this.resumePausedMutations(),j(this,Je).onFocus())})),le(this,oa,dd.subscribe(async t=>{t&&(await this.resumePausedMutations(),j(this,Je).onOnline())})))}unmount(){var t,e;xc(this,ki)._--,j(this,ki)===0&&((t=j(this,sa))==null||t.call(this),le(this,sa,void 0),(e=j(this,oa))==null||e.call(this),le(this,oa,void 0))}isFetching(t){return j(this,Je).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return j(this,wi).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=j(this,Je).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=j(this,Je).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(np(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return j(this,Je).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=j(this,Je).get(r.queryHash),s=i==null?void 0:i.state.data,o=fj(e,s);if(o!==void 0)return j(this,Je).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Dt.batch(()=>j(this,Je).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=j(this,Je).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=j(this,Je);Dt.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=j(this,Je);return Dt.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Dt.batch(()=>j(this,Je).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(jn).catch(jn)}invalidateQueries(t,e={}){return Dt.batch(()=>(j(this,Je).findAll(t).forEach(n=>
346{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Dt.batch(()=>j(this,Je).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(jn)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(jn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=j(this,Je).build(this,e);return n.isStaleByTime(np(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(jn).catch(jn)}fetchInfiniteQuery(t){return t.behavior=tb(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(jn).catch(jn)}ensureInfiniteQueryData(t){return t.behavior=tb(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return dd.isOnline()?j(this,wi).resumePausedMutations():Promise.resolve()}getQueryCache(){return j(this,Je)}getMutationCache(){return j(this,wi)}getDefaultOptions(){return j(this,xi)}setDefaultOptions(t){le(this,xi,t)}setQueryDefaults(t,e){j(this,ra).set($l(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...j(this,ra).values()],n={};return e.forEach(r=>{Vl(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){j(this,ia).set($l(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...j(this,ia).values()],n={};return e.forEach(r=>{Vl(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...j(this,xi).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Sv(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Tv&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...j(this,xi).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){j(this,Je).clear(),j(this,wi).clear()}},Je=new WeakMap,wi=new WeakMap,xi=new WeakMap,ra=new WeakMap,ia=new WeakMap,ki=new WeakMap,sa=new WeakMap,oa=new WeakMap,Ix),Dj=x.createContext(void 0),Lj=({client:t,children:e})=>(x.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),d.jsx(Dj.Provider,{value:t,children:e}));/**
347 * @remix-run/router v1.23.0
348 *
349 * Copyright (c) Remix Software Inc.
350 *
351 * This source code is licensed under the MIT license found in the
352 * LICENSE.md file in the root directory of this source tree.
353 *
354 * @license MIT
355 */function Wl(){return Wl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Wl.apply(this,arguments)}var Ci;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(Ci||(Ci={}));const rb="popstate";function Uj(t){t===void 0&&(t={});function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return ip("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:hd(i)}return Bj(e,n,null,t)}function lt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function SC(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Fj(){return Math.random().toString(36).substr(2,8)}function ib(t,e){return{usr:t.state,key:t.key,idx:e}}function ip(t,e,n,r){return n===void 0&&(n=null),Wl({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?_a(e):e,{state:n,key:e&&e.key||r||Fj()})}function hd(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function _a(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function Bj(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a=Ci.Pop,l=null,c=u();c==null&&(c=0,o.replaceState(Wl({},o.state,{idx:c}),""));function u(){return(o.state||{idx:null}).idx}function h(){a=Ci.Pop;let g=u(),v=g==null?null:g-c;c=g,l&&l({action:a,location:p.location,delta:v})}function f(g,v){a=Ci.Push;let y=ip(p.location,g,v);c=u()+1;let w=ib(y,c),k=p.createHref(y);try{o.pushState(w,"",k)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;i.location.assign(k)}s&&l&&l({action:a,location:p.location,delta:1})}function m(g,v){a=Ci.Replace;let y=ip(p.location,g,v);c=u();let w=ib(y,c),k=p.createHref(y);o.replaceState(w,"",k),s&&l&&l({action:a,location:p.location,delta:0})}function b(g){let v=i.location.origin!=="null"?i.location.origin:i.location.href,y=typeof g=="string"?g:hd(g);return y=y.replace(/ $/,"%20"),lt(v,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,v)}let p={get action(){return a},get location(){return t(i,o)},listen(g){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(rb,h),l=g,()=>{i.removeEventListener(rb,h),l=null}},createHref(g){return e(i,g)},createURL:b,encodeLocation(g){let v=b(g);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:f,replace:m,go(g){return o.go(g)}};return p}var sb;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(sb||(sb={}));function zj(t,e,n){return n===void 0&&(n="/"),$j(t,e,n,!1)}function $j(t,e,n,r){let i=typeof e=="string"?_a(e):e,s=Cv(i.pathname||"/",n);if(s==null)return null;let o=TC(t);Vj(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=eD(s);a=Xj(o[l],c,r)}return a}function TC(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let i=(s,o,a)=>{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(lt(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not val
355id. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let c=ji([r,l.relativePath]),u=n.concat(l);s.children&&s.children.length>0&&(lt(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),TC(s.children,e,u,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:Yj(c,s.index),routesMeta:u})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of CC(s.path))i(s,o,l)}),e}function CC(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=CC(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function Vj(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:Qj(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Wj=/^:[\w-]+$/,qj=3,Hj=2,Kj=1,Gj=10,Jj=-2,ob=t=>t==="*";function Yj(t,e){let n=t.split("/"),r=n.length;return n.some(ob)&&(r+=Jj),e&&(r+=Hj),n.filter(i=>!ob(i)).reduce((i,s)=>i+(Wj.test(s)?qj:s===""?Kj:Gj),r)}function Qj(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function Xj(t,e,n){let{routesMeta:r}=t,i={},s="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],c=a===r.length-1,u=s==="/"?e:e.slice(s.length)||"/",h=ab({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),f=l.route;if(!h&&c&&n&&!r[r.length-1].route.index&&(h=ab({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!h)return null;
vendor: 9,263 bytes, lines 355-364
355Object.assign(i,h.params),o.push({params:i,pathname:ji([s,h.pathname]),pathnameBase:iD(ji([s,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(s=ji([s,h.pathnameBase]))}return o}function ab(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=Zj(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((c,u,h)=>{let{paramName:f,isOptional:m}=u;if(f==="*"){let p=a[h]||"";o=s.slice(0,s.length-p.length).replace(/(.)\/+$/,"$1")}const b=a[h];return m&&!b?c[f]=void 0:c[f]=(b||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:t}}function Zj(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),SC(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function eD(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return SC(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Cv(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function tD(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?_a(t):t;return{pathname:n?n.startsWith("/")?n:nD(n,e):e,search:sD(r),hash:oD(i)}}function nD(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function df(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"].  Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function rD(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function EC(t,e){let n=rD(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function _C(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=_a(t):(i=Wl({},t),lt(!i.pathname||!i.pathname.includes("?"),df("?","pathname","search",i)),lt(!i.pathname||!i.pathname.includes("#"),df("#","pathname","hash",i)),lt(!i.search||!i.search.includes("#"),df("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let h=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;i.pathname=f.join("/")}a=h>=0?e[h]:"/"}let l=tD(i,a),c=o&&o!=="/"&&o.endsWith("/"),u=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const ji=t=>t.join("/").replace(/\/\/+/g,"/"),iD=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),sD=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,oD=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function aD(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const PC=["post","put","patch","delete"];new Set(PC);const lD=["get",...PC];new Set(lD);/**
356 * React Router v6.30.1
357 *
358 * Copyright (c) Remix Software Inc.
359 *
360 * This source code is licensed under the MIT license found in the
361 * LICENSE.md file in the root directory of this source tree.
362 *
363 * @license MIT
364 */function ql(){return ql=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ql.apply(this,arguments)}const Ev=x.createContext(null),cD=x.createContext(null),Hs=x.createContext(null),lh=x.createContext(null),Ji=x.createContext({outlet:null,matches:[],isDataRoute:!1}),RC=x.createContext(null);function uD(t,e){let{relative:n}=e===void 0?{}:e;yc()||lt(!1);let{basename:r,navigator:i}=x.useContext(Hs),{hash:s,pathname:o,search:a}=NC(t,{relative:n}),l=o;return r!=="/"&&(l=o==="/"?r:ji([r,o])),i.createHref({pathname:l,search:a,hash:s})}function yc(){return x.useContext(lh)!=null}function Ks(){return yc()||lt(!1),x.useContext(lh).location}function IC(t){x.useContext(Hs).static||x.useLayoutEffect(t)}function _v(){let{isDataRoute:t}=x.useContext(Ji);return t?TD():dD()}function dD(){yc()||lt(!1);let t=x.useContext(Ev),{basename:e,future:n,navigator:r}=x.useContext(Hs),{matches:i}=x.useContext(Ji),{pathname:s}=Ks(),o=JSON.stringify(EC(i,n.v7_relativeSplatPath)),a=x.useRef(!1);return IC(()=>{a.current=!0}),x.useCallback(function(c,u){if(u===void 0&&(u={}),!a.current)return;if(typeof c=="number"){r.go(c);return}let h=_C(c,JSON.parse(o),s,u.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:ji([e,h.pathname])),(u.replace?r.replace:r.push)(h,u.state,u)},[e,r,o,s,t])}function hD(){let{matches:t}=x.useContext(Ji),e=t[t.length-1];return e?e.params:{}}function NC(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=x.useContext(Hs),{matches:i}=x.useContext(Ji),{pathname:s}=Ks(),o=JSON.stringify(EC(i,r.v7_relativeSplatPath));return x.useMemo(()=>_C(t,JSON.parse(o),s,n==="path"),[t,o,s,n])}function fD(t,e){return mD(t,e)}function mD(t,e,n,r){yc()||lt(!1);let{navigator:i}=x.useContext(Hs),{matches:s}=x.useContext(Ji),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=Ks(),u;if(e){var h;let g=typeof e=="string"?_a(e):e;l==="/"||(h=g.pathname)!=null&&h.startsWith(l)||lt(!1),u=g}else u=c;let f=u.pathname||"/",m=f;if(l!=="/"){let g=l.replace(/^\//,"").split("/");m="/"+f.replace(/^\//,"").split("/").slice(g.length).join("/")}let b=zj(t,{pathname:m}),p=bD(b&&b.map(g=>Object.assign({},g,{params:Object.assign({},a,g.params),pathname:ji([l,i.encodeLocation?i.encodeLocation(g.pathname).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?l:ji([l,i.encodeLocation?i.encodeLocation(g.pathnameBase).pathname:g.pathnameBase])})),s,n,r);return e&&p?x.createElement(lh.Provider,{value:{location:ql({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:Ci.Pop}},p):p}function pD(){let t=SD(),e=aD(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},e),n?x.createElement("pre",{style:i},n):null,null)}const gD=x.createElement(pD,null);class vD extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?x.createElement(Ji.Provider,{value:this.props.routeContext},x.createElement(RC.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function yD(t){let{routeContext:e,match:n,children:r}=t,i=x.useContext(Ev);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(Ji.Provider,{value:e},r)}function bD(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if(!n)return null;if(n.errors)t=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=(i=n)==null?void 0:i.errors;if(a!=null){let u=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);u>=0||lt(!1),o=o.slice(0,Math.min(o.length,u+1))}let l=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<o.length;u++){let h=o[u];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(c=u),h.route.id){let{loaderData:f,errors:m}=n,b=h.route.loader&&f[h.route.id]===void 0&&(!m||m[h.route.id]===void 0);if(h.route.lazy||b){l=!0,c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((u,h,f)=>{let m,b=!1,p=null,g=null;n&&(m=a&&h.route.id?a[h.route.id]:void 0,p=h.route.errorElement||gD,l&&(c<0&&f===0?(b=!0,g=null):c===f&&(b=!0,g=h.route.hydrateFallbackElement||null)));let v=e.concat(o.slice(0,f+1)),y=()=>{let w;return m?w=p:b?w=g:h.route.Component?w=x.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=u,x.createElement(yD,{match:h,routeC
364ontext:{outlet:u,matches:v,isDataRoute:n!=null},children:w})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?x.createElement(vD,{location:n.location,revalidation:n.revalidation,component:p,error:m,children:y(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):y()},null)}var AC=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(AC||{}),fd=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(fd||{});function wD(t){let e=x.useContext(Ev);return e||lt(!1),e}function xD(t){let e=x.useContext(cD);return e||lt(!1),e}function kD(t){let e=x.useContext(Ji);return e||lt(!1),e}function OC(t){let e=kD(),n=e.matches[e.matches.length-1];return n.route.id||lt(!1),n.route.id}function SD(){var t;let e=x.useContext(RC),n=xD(fd.UseRouteError),r=OC(fd.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function TD(){let{router:t}=wD(AC.UseNavigateStable),e=OC(fd.UseNavigateStable),n=x.useRef(!1);return IC(()=>{n.current=!0}),x.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,ql({fromRouteId:e},s)))},[t,e])}function CD(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Xt(t){lt(!1)}function ED(t){let{basename:e="/",children:n=null,location:r,navigationType:i=Ci.Pop,navigator:s,static:o=!1,future:a}=t;yc()&&lt(!1);let l=e.replace(/^\/*/,"/"),c=x.useMemo(()=>({basename:l,navigator:s,static:o,future:ql({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof r=="string"&&(r=_a(r));let{pathname:u="/",search:h="",hash:f="",state:m=null,key:b="default"}=r,p=x.useMemo(()=>{let g=Cv(u,l);return g==null?null:{location:{pathname:g,search:h,hash:f,state:m,key:b},navigationType:i}},[l,u,h,f,m,b,i]);return p==null?null:x.createElement(Hs.Provider,{value:c},x.createElement(lh.Provider,{children:n,value:p}))}function _D(t){let{children:e,location:n}=t;return fD(sp(e),n)}new Promise(()=>{});function sp(t,e){e===void 0&&(e=[]);let n=[];return x.Children.forEach(t,(r,i)=>{if(!x.isValidElement(r))return;let s=[...e,i];if(r.type===x.Fragment){n.push.apply(n,sp(r.props.children,s));return}r.type!==Xt&&lt(!1),!r.props.index||!r.props.children||lt(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=sp(r.props.children,s)),n.push(o)}),n}/**
365 * React Router DOM v6.30.1
366 *
367 * Copyright (c) Remix Software Inc.
368 *
369 * This source code is licensed under the MIT license found in the
370 * LICENSE.md file in the root directory of this source tree.
371 *
372 * @license MIT
373 */function op(){return op=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},op.apply(this,arguments)}function PD(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function RD(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function ID(t,e){return t.button===0&&(!e||e==="_self")&&!RD(t)}const ND=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],AD="6";try{window.__reactRouterVersion=AD}catch{}const OD="startTransition",lb=lg[OD];function MD(t){let{basename:e,children:n,future:r,window:i}=t,s=x.useRef();s.current==null&&(s.current=Uj({window:i,v5Compat:!0}));let o=s.current,[a,l]=x.useState({action:o.action,location:o.location}),{v7_startTransition:c}=r||{},u=x.useCallback(h=>{c&&lb?lb(()=>l(h)):l(h)},[l,c]);return x.useLayoutEffect(()=>o.listen(u),[o,u]),x.useEffect(()=>CD(r),[r]),x.createElement(ED,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const jD=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",DD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pt=x.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:a,target:l,to:c,preventScrollReset:u,viewTransition:h}=e,f=PD(e,ND),{basename:m}=x.useContext(Hs),b,p=!1;if(typeof c=="string"&&DD.test(c)&&(b=c,jD))try{let w=new URL(window.location.href),k=c.startsWith("//")?new URL(w.protocol+c):new URL(c),S=Cv(k.pathname,m);k.origin===w.origin&&S!=null?c=S+k.search+k.hash:p=!0}catch{}let g=uD(c,{relative:i}),v=LD(c,{replace:o,state:a,target:l,preventScrollReset:u,relative:i,viewTransition:h});function y(w){r&&r(w),w.defaultPrevented||v(w)}return x.createElement("a",op({},f,{href:b||g,onClick:p||s?r:y,ref:n,target:l}))});var cb;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(cb||(cb={}));var ub;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ub||(ub={}));function LD(t,e){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:a}=e===void 0?{}:e,l=_v(),c=Ks(),u=NC(t,{relative:o});return x.useCallback(h=>{if(ID(h,n)){h.preventDefault();let f=r!==void 0?r:hd(c)===hd(u);l(t,{replace:f,state:i,preventScrollReset:s,relative:o,viewTransition:a})}},[c,l,u,r,i,n,t,s,o,a])}var UD=typeof Element<"u",FD=typeof Map=="function",BD=typeof Set=="function",zD=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function wu(t,e){if(t===e)return!0;
373if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!wu(t[r],e[r]))return!1;return!0}var s;if(FD&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(s=t.entries();!(r=s.next()).done;)if(!e.has(r.value[0]))return!1;for(s=t.entries();!(r=s.next()).done;)if(!wu(r.value[1],e.get(r.value[0])))return!1;return!0}if(BD&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(s=t.entries();!(r=s.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(zD&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof e.valueOf=="function")return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof e.toString=="function")return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(UD&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&t.$$typeof)&&!wu(t[i[r]],e[i[r]]))return!1;return!0}return t!==t&&e!==e}var $D=function(e,n){try{return wu(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const VD=cc($D);var WD=function(t,e,n,r,i,s,o,a){if(!t){var l;if(e===void 0)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,s,o,a],u=0;l=new Error(e.replace(/%s/g,function(){return c[u++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}},qD=WD;const db=cc(qD);var HD=function(e,n,r,i){var s=r?r.call(i,e,n):void 0;if(s!==void 0)return!!s;if(e===n)return!0;if(typeof e!="object"||!e||typeof n!="object"||!n)return!1;var o=Object.keys(e),a=Object.keys(n);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(n),c=0;c<o.length;c++){var u=o[c];if(!l(u))return!1;var h=e[u],f=n[u];if(s=r?r.call(i,h,f,u):void 0,s===!1||s===void 0&&h!==f)return!1}return!0};const KD=cc(HD);var MC=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(MC||{}),hf={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},hb=Object.values(MC),Pv={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},GD=Object.entries(Pv).reduce((t,[e,n])=>(t[n]=e,t),{}),Hn="data-rh",Bo={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},zo=(t,e)=>{for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(Object.prototype.hasOwnProperty.call(r,e))return r[e]}return null},JD=t=>{let e=zo(t,"title");const n=zo(t,Bo.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const r=zo(t,Bo.DEFAULT_TITLE);return e||r||void 0},YD=t=>zo(t,Bo.ON_CHANGE_CLIENT_STATE)||(()=>{}),ff=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,r)=>({...n,...r}),{}),QD=(t,e)=>e.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,r)=>{if(!n.length){const i=Object.keys(r);for(let s=0;s<i.length;s+=1){const a=i[s].toLowerCase();if(t.indexOf(a)!==-1&&r[a])return n.concat(r)}}return n},[]),XD=t=>console&&typeof console.warn=="function"&&console.warn(t),$a=(t,e,n)=>{const r={};return n.filter(i=>Array.isArray(i[t])?!0:(typeof i[t]<"u"&&XD(`Helmet: ${t} should be of type "Array". Instead found type "${typeof i[t]}"`),!1)).map(i=>i[t]).reverse().reduce((i,s)=>{const o={};s.filter(l=>{let c;const u=Object.keys(l);for(let f=0;f<u.length;f+=1){const m=u[f],b=m.toLowerCase();e.indexOf(b)!==-1&&!(c==="rel"&&l[c].toLowerCase()==="canonical")&&!(b==="rel"&&l[b].toLowerCase()==="stylesheet")&&(c=b),e.indexOf(m)!==-1&&(m==="innerHTML"||m==="cssText"||m==="itemprop")&&(c=m)}if(!c||!l[c])return!1;const h=l[c].toLowerCase();return r[c]||(r[c]={}),o[c]||(o[c]={}),r[c][h]?!1:(o[c][h]=!0,!0)}
373).reverse().forEach(l=>i.push(l));const a=Object.keys(o);for(let l=0;l<a.length;l+=1){const c=a[l],u={...r[c],...o[c]};r[c]=u}return i},[]).reverse()},ZD=(t,e)=>{if(Array.isArray(t)&&t.length){for(let n=0;n<t.length;n+=1)if(t[n][e])return!0}return!1},e2=t=>({baseTag:QD(["href"],t),bodyAttributes:ff("bodyAttributes",t),defer:zo(t,Bo.DEFER),encode:zo(t,Bo.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:ff("htmlAttributes",t),linkTags:$a("link",["rel","href"],t),metaTags:$a("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:$a("noscript",["innerHTML"],t),onChangeClientState:YD(t),scriptTags:$a("script",["src","innerHTML"],t),styleTags:$a("style",["cssText"],t),title:JD(t),titleAttributes:ff("titleAttributes",t),prioritizeSeoTags:ZD(t,Bo.PRIORITIZE_SEO_TAGS)}),jC=t=>Array.isArray(t)?t.join(""):t,t2=(t,e)=>{const n=Object.keys(t);for(let r=0;r<n.length;r+=1)if(e[n[r]]&&e[n[r]].includes(t[n[r]]))return!0;return!1},mf=(t,e)=>Array.isArray(t)?t.reduce((n,r)=>(t2(r,e)?n.priority.push(r):n.default.push(r),n),{priority:[],default:[]}):{default:t,priority:[]},fb=(t,e)=>({...t,[e]:void 0}),n2=["noscript","script","style"],ap=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;"),DC=t=>Object.keys(t).reduce((e,n)=>{const r=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${r}`:r},""),r2=(t,e,n,r)=>{const i=DC(n),s=jC(e);return i?`<${t} ${Hn}="true" ${i}>${ap(s,r)}</${t}>`:`<${t} ${Hn}="true">${ap(s,r)}</${t}>`},i2=(t,e,n=!0)=>e.reduce((r,i)=>{const s=i,o=Object.keys(s).filter(c=>!(c==="innerHTML"||c==="cssText")).reduce((c,u)=>{const h=typeof s[u]>"u"?u:`${u}="${ap(s[u],n)}"`;return c?`${c} ${h}`:h},""),a=s.innerHTML||s.cssText||"",l=n2.indexOf(t)===-1;return`${r}<${t} ${Hn}="true" ${o}${l?"/>":`>${a}</${t}>`}`},""),LC=(t,e={})=>Object.keys(t).reduce((n,r)=>{const i=Pv[r];return n[i||r]=t[r],n},e),s2=(t,e,n)=>{const r={key:e,[Hn]:!0},i=LC(n,r);return[z.createElement("title",i,e)]},xu=(t,e)=>e.map((n,r)=>{const i={key:r,[Hn]:!0};return Object.keys(n).forEach(s=>{const a=Pv[s]||s;if(a==="innerHTML"||a==="cssText"){const l=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:l}}else i[a]=n[s]}),z.createElement(t,i)}),pn=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>s2(t,e.title,e.titleAttributes),toString:()=>r2(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>LC(e),toString:()=>DC(e)};default:return{toComponent:()=>xu(t,e),toString:()=>i2(t,e,n)}}},o2=({metaTags:t,linkTags:e,scriptTags:n,encode:r})=>{const i=mf(t,hf.meta),s=mf(e,hf.link),o=mf(n,hf.script);return{priorityMethods:{toComponent:()=>[...xu("meta",i.priority),...xu("link",s.priority),...xu("script",o.priority)],toString:()=>`${pn("meta",i.priority,r)} ${pn("link",s.priority,r)} ${pn("script",o.priority,r)}`},metaTags:i.default,linkTags:s.default,scriptTags:o.default}},a2=t=>{const{baseTag:e,bodyAttributes:n,encode:r=!0,htmlAttributes:i,noscriptTags:s,styleTags:o,title:a="",titleAttributes:l,prioritizeSeoTags:c}=t;let{linkTags:u,metaTags:h,scriptTags:f}=t,m={toComponent:()=>{},toString:()=>""};return c&&({priorityMethods:m,linkTags:u,metaTags:h,scriptTags:f}=o2(t)),{priority:m,base:pn("base",e,r),bodyAttributes:pn("bodyAttributes",n,r),htmlAttributes:pn("htmlAttributes",i,r),link:pn("link",u,r),meta:pn("meta",h,r),noscript:pn("noscript",s,r),script:pn("script",f,r),style:pn("style",o,r),title:pn("title",{title:a,titleAttributes:l},r)}},lp=a2,Wc=[],UC=!!(typeof window<"u"&&window.document&&window.document.createElement),cp=class{constructor(t,e){Cr(this,"instances",[]);Cr(this,"canUseDOM",UC);Cr(this,"context");Cr(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?Wc:this.instances,add:t=>{(this.canUseDOM?Wc:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?Wc:this.instances).indexOf(t);(this.canUseDOM?Wc:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=lp({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},l2={},FC=z.createContext(l2),Cs,BC=(Cs=class extends x.Component{constructor(n){super(n);Cr(this,"helmetData");this.helmetData=new cp(this.props.context||{},Cs.canUseDOM)}render(){return z.createElement(FC.Provider,{value:this.helmetData.value},this.props.children)}},Cr(Cs,"canUseDOM",UC),Cs),eo=(t,e)=>{const n=document.head||document.querySelector("head"),r=n.querySelectorAll(`${t}[${Hn}]`),i=[].slice.call(r),s=[];let o;return e&&e.length&&e.forEach(a=>{const l=document.createElement(t);for(const c in a)if(Object.prototype.hasOwnProperty.call(a,c))if(c==="innerHTML")l.innerHTML=a.innerHTML;else if(c==="cssText")l.styleSheet?l.styleSheet.cssText=a.cssText:l.appendChild(document.createTextNode(a.cssText));else{const u=c,h=typeof a[u]>
373"u"?"":a[u];l.setAttribute(c,h)}l.setAttribute(Hn,"true"),i.some((c,u)=>(o=u,l.isEqualNode(c)))?i.splice(o,1):s.push(l)}),i.forEach(a=>{var l;return(l=a.parentNode)==null?void 0:l.removeChild(a)}),s.forEach(a=>n.appendChild(a)),{oldTags:i,newTags:s}},up=(t,e)=>{const n=document.getElementsByTagName(t)[0];if(!n)return;const r=n.getAttribute(Hn),i=r?r.split(","):[],s=[...i],o=Object.keys(e);for(const a of o){const l=e[a]||"";n.getAttribute(a)!==l&&n.setAttribute(a,l),i.indexOf(a)===-1&&i.push(a);const c=s.indexOf(a);c!==-1&&s.splice(c,1)}for(let a=s.length-1;a>=0;a-=1)n.removeAttribute(s[a]);i.length===s.length?n.removeAttribute(Hn):n.getAttribute(Hn)!==o.join(",")&&n.setAttribute(Hn,o.join(","))},c2=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=jC(t)),up("title",e)},mb=(t,e)=>{const{baseTag:n,bodyAttributes:r,htmlAttributes:i,linkTags:s,metaTags:o,noscriptTags:a,onChangeClientState:l,scriptTags:c,styleTags:u,title:h,titleAttributes:f}=t;up("body",r),up("html",i),c2(h,f);const m={baseTag:eo("base",n),linkTags:eo("link",s),metaTags:eo("meta",o),noscriptTags:eo("noscript",a),scriptTags:eo("script",c),styleTags:eo("style",u)},b={},p={};Object.keys(m).forEach(g=>{const{newTags:v,oldTags:y}=m[g];v.length&&(b[g]=v),y.length&&(p[g]=m[g].oldTags)}),e&&e(),l(t,b,p)},Va=null,u2=t=>{Va&&cancelAnimationFrame(Va),t.defer?Va=requestAnimationFrame(()=>{mb(t,()=>{Va=null})}):(mb(t),Va=null)},d2=u2,pb=class extends x.Component{constructor(){super(...arguments);Cr(this,"rendered",!1)}shouldComponentUpdate(e){return!KD(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:n}=this.props.context;let r=null;const i=e2(e.get().map(s=>{const o={...s.props};return delete o.context,o}));BC.canUseDOM?d2(i):lp&&(r=lp(i)),n(r)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},Gf,er=(Gf=class extends x.Component{shouldComponentUpdate(t){return!VD(fb(this.props,"helmetData"),fb(t,"helmetData"))}mapNestedChildrenToProps(t,e){if(!e)return null;switch(t.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,e,n,r){return{...e,[t.type]:[...e[t.type]||[],{...n,...this.mapNestedChildrenToProps(t,r)}]}}mapObjectTypeChildren(t,e,n,r){switch(t.type){case"title":return{...e,[t.type]:r,titleAttributes:{...n}};case"body":return{...e,bodyAttributes:{...n}};case"html":return{...e,htmlAttributes:{...n}};default:return{...e,[t.type]:{...n}}}}mapArrayTypeChildrenToProps(t,e){let n={...e};return Object.keys(t).forEach(r=>{n={...n,[r]:t[r]}}),n}warnOnInvalidChildren(t,e){return db(hb.some(n=>t.type===n),typeof t.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${hb.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),db(!e||typeof e=="string"||Array.isArray(e)&&!e.some(n=>typeof n!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`}</${t.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(t,e){let n={};return z.Children.forEach(t,r=>{if(!r||!r.props)return;const{children:i,...s}=r.props,o=Object.keys(s).reduce((l,c)=>(l[GD[c]||c]=s[c],l),{});let{type:a}=r;
373switch(typeof a=="symbol"?a=a.toString():this.warnOnInvalidChildren(r,i),a){case"Symbol(react.fragment)":e=this.mapChildrenToProps(i,e);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(r,n,o,i);break;default:e=this.mapObjectTypeChildren(r,e,o,i);break}}),this.mapArrayTypeChildrenToProps(n,e)}render(){const{children:t,...e}=this.props;let n={...e},{helmetData:r}=e;if(t&&(n=this.mapChildrenToProps(t,n)),r&&!(r instanceof cp)){const i=r;r=new cp(i.context,!0),delete n.helmetData}return r?z.createElement(pb,{...n,context:r.value}):z.createElement(FC.Consumer,null,i=>z.createElement(pb,{...n,context:i}))}},Cr(Gf,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),Gf);const h2={theme:"system",setTheme:()=>null},zC=x.createContext(h2);function f2({children:t,defaultTheme:e="system",storageKey:n="promptpeak-theme",...r}){const[i,s]=x.useState(()=>localStorage.getItem(n)||e);x.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),i==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(i)},[i]);const o={theme:i,setTheme:a=>{localStorage.setItem(n,a),s(a)}};return d.jsx(zC.Provider,{...r,value:o,children:t})}const m2=()=>{const t=x.useContext(zC);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},$C=x.createContext(void 0),p2=({children:t})=>{const[e,n]=x.useState(()=>localStorage.getItem("promptpeak-lang")||"de"),r=x.useCallback(()=>{n(s=>{const o=s==="de"?"en":"de";return localStorage.setItem("promptpeak-lang",o),o})},[]),i=x.useCallback((s,o)=>e==="de"?s:o,[e]);return d.jsx($C.Provider,{value:{language:e,toggleLanguage:r,t:i},children:t})},Ke=()=>{const t=x.useContext($C);if(!t)throw new Error("useLanguage must be used within LanguageProvider");return t}
373,g2=()=>{const{pathname:t}=Ks();return x.useEffect(()=>{window.scrollTo(0,0)},[t]),null},v2=sv("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),De=x.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},s)=>{const o=r?rN:"button";return d.jsx(o,{className:ce(v2({variant:e,size:n,className:t})),ref:s,...i})});De.displayName="Button";const VC="/assets/logo-CQszeGR3.svg";function gb(){const{theme:t,setTheme:e}=m2(),n=()=>{if(t==="dark")e("light");else if(t==="light")e("dark");else{const r=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";e(r==="dark"?"light":"dark")}};return d.jsxs(De,{variant:"ghost",size:"icon",onClick:n,className:"text-muted-foreground hover:text-foreground",children:[d.jsx(wA,{className:"h-5 w-5 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),d.jsx(mA,{className:"absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),d.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}const vb=()=>{const{language:t,toggleLanguage:e}=Ke();return d.jsxs(De,{variant:"ghost",size:"icon",onClick:e,className:"relative","aria-label":t==="de"?"Switch to English":"Auf Deutsch wechseln",children:[d.jsx(lA,{className:"h-4 w-4"}),d.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 text-[9px] font-bold leading-none",children:t==="de"?"EN":"DE"})]})},tr=()=>{const[t,e]=x.useState(!1),n=Ks(),{t:r}=Ke(),i=[{name:"LexVault",href:"/legal",description:r("Legal","Legal")},{name:"OfficePulse",href:"/kmu",description:r("KMU","SME")},{name:"Douplét",href:"/culture",description:r("Culture","Culture")}];return d.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-glass border-b border-border/50",children:d.jsxs("div",{className:"container mx-auto px-6",children:[d.jsxs("div",{className:"flex items-center justify-between h-20",children:[d.jsx(pt,{to:"/",className:"flex items-center",children:d.jsx("img",{src:VC,alt:"PromptPeak",className:"h-8"})}),d.jsx("div",{className:"hidden md:flex items-center gap-8",children:i.map(s=>d.jsx(pt,{to:s.href,className:ce("text-muted-foreground hover:text-foreground transition-colors duration-300 font-medium",n.pathname===s.href&&"text-foreground"),children:s.name},s.name))}),d.jsxs("div",{className:"hidden md:flex items-center gap-2",children:[d.jsx(vb,{}),d.jsx(gb,{}),d.jsx("a",{href:"mailto:[email protected]",children:d.jsx(De,{className:"bg-gradient-primary hover:opacity-90 transition-opacity shadow-glow-primary font-semibold",children:r("Kontakt","Contact")})})]}),d.jsxs("div",{className:"md:hidden flex items-center gap-2",children:[d.jsx(vb,{}),d.jsx(gb,{}),d.jsx("button",{className:"text-foreground",onClick:()=>e(!t),"aria-label":"Toggle menu",children:t?d.jsx(RT,{size:24}):d.jsx(dA,{size:24})})]})]}),t&&d.jsx("div",{className:"md:hidden py-6 border-t border-border/50 animate-fade-in",children:d.jsxs("div",{className:"flex flex-col gap-4",children:[i.map(s=>d.jsxs(pt,{to:s.href,className:ce("text-muted-foreground hover:text-foreground transition-colors duration-300 font-medium py-2",n.pathname===s.href&&"text-foreground"),onClick:()=>e(!1),children:[d.jsx("span",{children:s.name}),d.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["(",s.description,")"]})]},s.name)),d.jsx("a",{href:"mailto:[email protected]",onClick:()=>e(!1),children:d.jsx(De,{className:"bg-gradient-primary hover:opacity-90 transition-opacity shadow-glow-primary font-semibold mt-4 w-full",children:r("Kontakt","Contact")})})]})})]})})};var yb={};
vendor: 11,815 bytes, line 373
373function y2(t,e){return e.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(r){if(r!=="default"&&!(r in t)){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}})}),Object.freeze(t)}var b2=Object.defineProperty,w2=(t,e,n)=>e in t?b2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bb=(t,e,n)=>w2(t,typeof e!="symbol"?e+"":e,n);let Ft=class{constructor(){bb(this,"_locking"),bb(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const n=new Promise(i=>e=()=>{this._locks-=1,i()}),r=this._locking.then(()=>e);return this._locking=this._locking.then(()=>n),r}};function Xe(t,e){if(!t)throw new Error(e)}const x2=34028234663852886e22,k2=-34028234663852886e22,S2=4294967295,T2=2147483647,C2=-2147483648;function ku(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>T2||t<C2)throw new Error("invalid int 32: "+t)}function dp(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>S2||t<0)throw new Error("invalid uint 32: "+t)}function WC(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>x2||t<k2))throw new Error("invalid float 32: "+t)}const qC=Symbol("@bufbuild/protobuf/enum-type");function E2(t){const e=t[qC];return Xe(e,"missing enum type on enum object"),e}function HC(t,e,n,r){t[qC]=KC(e,n.map(i=>({no:i.no,name:i.name,localName:t[i.no]})))}function KC(t,e,n){const r=Object.create(null),i=Object.create(null),s=[];for(const o of e){const a=GC(o);s.push(a),r[o.name]=a,i[o.no]=a}return{typeName:t,values:s,findName(o){return r[o]},findNumber(o){return i[o]}}}function _2(t,e,n){const r={};for(const i of e){const s=GC(i);r[s.localName]=s.no,r[s.no]=s.localName}return HC(r,t,e),r}function GC(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class Rv{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){const r=this.getType(),i=r.runtime.bin,s=i.makeReadOptions(n);return i.readMessage(this,s.readerFactory(e),e.byteLength,s),this}fromJson(e,n){const r=this.getType(),i=r.runtime.json,s=i.makeReadOptions(n);return i.readMessage(r,e,s,this),this}fromJsonString(e,n){let r;try{r=JSON.parse(e)}catch(i){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(i instanceof Error?i.message:String(i)))}return this.fromJson(r,n)}toBinary(e){const n=this.getType(),r=n.runtime.bin,i=r.makeWriteOptions(e),s=i.writerFactory();return r.writeMessage(this,s,i),s.finish()}toJson(e){const n=this.getType(),r=n.runtime.json,i=r.makeWriteOptions(e);return r.writeMessage(this,i)}toJsonString(e){var n;const r=this.toJson(e);return JSON.stringify(r,null,(n=e==null?void 0:e.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function P2(t,e,n,r){var i;const s=(i=r==null?void 0:r.localName)!==null&&i!==void 0?i:e.substring(e.lastIndexOf(".")+1),o={[s]:function(a){t.util.initFields(this),t.util.initPartial(a,this)}}[s];return Object.setPrototypeOf(o.prototype,new Rv),Object.assign(o,{runtime:t,typeName:e,fields:t.util.newFieldList(n),fromBinary(a,l){return new o().fromBinary(a,l)},fromJson(a,l){return new o().fromJson(a,l)},fromJsonString(a,l){return new o().fromJsonString(a,l)},equals(a,l){return t.util.equals(o,a,l)}}),o}function R2(){let t=0,e=0;for(let r=0;r<28;r+=7){let i=this.buf[this.pos++];if(t|=(i&127)<<r,!(i&128))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(n&15)<<28,e=(n&112)>>4,!(n&128))return this.assertBounds(),[t,e];for(let r=3;r<=31;r+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<r,!(i&128))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function pf(t,e,n){for(let s=0;s<28;s=s+7){const o=t>>>s,a=!(!(o>>>7)&&e==0),l=(a?o|128:o)&255;if(n.push(l),!a)return}const r=t>>>28&15|(e&7)<<4,i=!!(e>>3);if(n.push((i?r|128:r)&255),!!i){for(let s=3;s<31;s=s+7){const o=e>>>s,a=!!(o>>>7),l=(a?o|128:o)&255;if(n.push(l),!a)return}n.push(e>>>31&1)}}const Su=4294967296;function wb(t){const e=t[0]==="-";e&&(t=t.slice(1));const n=1e6;let r=0,i=0;function s(o,a){const l=Number(t.slice(o,a));i*=n,r=r*n+l,r>=Su&&(i=i+(r/Su|0),r=r%Su)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),e?YC(r,i):Iv(r,i)}function I2(t,e){let n=Iv(t,e);const r=n.hi&2147483648;r&&(n=YC(n.lo,n.hi));const i=JC(n.lo,n.hi);return r?"-"+i:i}function JC(t,e){if({lo:t,hi:e}=N2(t,e),e<=2097151)return String(Su*e+t);const n=t&16777215,r=(t>>>24|e<<8)&16777215,i=e>>16&65535;let s=n+r*6777216+i*6710656,o=r+i*8147497,a=i*2;const l=1e7;return s>=l&&(o+=Math.floor(s/l),s%=l),o>=l&&(a+=Math.floor(o/l),o%=l),a.toString()+xb(o)+xb(s)}function N2(t,e){return{lo:t>>>0,hi:e>>>0}}function Iv(t,e){return{lo:t|0,hi:e|0}}function YC(t,e){return e=~e,t?t=~t+1:e+=1,Iv(t,e)}const xb=t=>{const e=String(t);return"0000000".slice(e.length)+e};function kb(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function A2(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;t&128&&n<10;n++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function O2(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof yb!="object"||yb.BUF_BIGINT_DISABLE!=="1")){const i=BigInt("-9223372036854775808"),s=BigInt("9223372036854775807"),o=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(l){const c=typeof l=="bigint"?l:BigInt(l);if(c>s||c<i)throw new Error("int64 invalid: ".concat(l));return c},uParse(l){const c=typeof l=="bigint"?l:BigInt(l);if(c>a||c<o)throw new Error("uint64 invalid: ".concat(l));return c},enc(l){return t.setBigInt64(0,this.parse(l),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(l){return t.setBigInt64(0,this.uParse(l),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(l,c){return t.setInt32(0,l,!0),t.setInt32(4,c,!0),t.getBigInt64(0,!0)},uDec(l,c){return t.setInt32(0,l,!0),t.setInt32(4,c,!0),t.getBigUint64(0,!0)}}}const n=i=>Xe(/^-?[0-9]+$/.test(i),"int64 invalid: ".concat(i)),r=i=>Xe(/^[0-9]+$/.test(i),"uint64 invalid: ".concat(i));return{zero:"0",supported:!1,parse(i){return typeof i!="string"&&(i=i.toString()),n(i),i},uParse(i){return typeof i!="string"&&(i=i.toString()),r(i),i},enc(i){return typeof i!="string"&&(i=i.toString()),n(i),wb(i)},uEnc(i){return typeof i!="string"&&(i=i.toString()),r(i),wb(i)},dec(i,s){return I2(i,s)},uDec(i,s){return JC(i,s)}}}const $e=O2();var L;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(L||(L={}));var Wi;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(Wi||(Wi={}));function si(t,e,n){if(e===n)return!0;if(t==L.BYTES){if(!(e instanceof Uint8Array)||!(n instanceof Uint8Array)||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}switch(t){case L.UINT64:case L.FIXED64:case L.INT64:case L.SFIXED64:case L.SINT64:return e==n}return!1}function ya(t,e){switch(t){case L.BOOL:return!1;case L.UINT64:case L.FIXED64:case L.INT64:case L.SFIXED64:case L.SINT64:return e==0?$e.zero:"0";case L.DOUBLE:case L.FLOAT:return 0;case L.BYTES:return new Uint8Array(0);case L.STRING:return"";default:return 0}}function QC(t,e){switch(t){case L.BOOL:return e===!1;case L.STRING:return e==="";case L.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var rt;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(rt||(rt={}));class M2{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let n=new Uint8Array(e),r=0;for(let i=0;i<this.chunks.length;i++)n.set(this.chunks[i],r),r+=this.chunks[i].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(dp(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return ku(e),kb(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){WC(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){dp(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){ku(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return ku(e),e=(e<<1^e>>31)>>>0,kb(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),i=$e.enc(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),i=$e.uEnc(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}int64(e){let n=$e.enc(e);return pf(n.lo,n.hi,this.buf),this}sint64(e){let n=$e.enc(e),r=n.hi>>31,i=n.lo<<1^r,s=(n.hi<<1|n.lo>>>31)^r;return pf(i,s,this.buf),this}uint64(e){let n=$e.uEnc(e);return pf(n.lo,n.hi,this.buf),this}}class j2{constructor(e,n){this.varint64=R2,this.uint32=A2,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,r=e&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(e,n){let r=this.pos;switch(e){case rt.Varint:for(;this.buf[this.pos++]&128;);break;case rt.Bit64:this.pos+=4;case rt.Bit32:this.pos+=4;break;case rt.LengthDelimited:let i=this.uint32();this.pos+=i;break;case rt.StartGroup:for(;;){const[s,o]=this.tag();if(o===rt.EndGroup){if(n!==void 0&&s!==n)throw new Error("invalid end group tag");break}this.skip(o,s)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return $e.dec(...this.varint64())}uint64(){return $e.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),r=-(e&1);return e=(e>>>1|(n&1)<<31)^r,n=n>>>
vendor: 4,522 bytes, lines 373-374
3731^r,$e.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return $e.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return $e.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function D2(t,e,n,r){let i;return{typeName:e,extendee:n,get field(){if(!i){const s=typeof r=="function"?r():r;s.name=e.split(".").pop(),s.jsonName="[".concat(e,"]"),i=t.util.newFieldList([s]).list()[0]}return i},runtime:t}}function XC(t){const e=t.field.localName,n=Object.create(null);return n[e]=L2(t),[n,()=>n[e]]}function L2(t){const e=t.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return ya(e.T,e.L);case"message":const n=e.T,r=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(r):r;case"map":throw"map fields are not allowed to be extensions"}}function U2(t,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let n=t.length-1;n>=0;--n)if(t[n].no==e.no)return[t[n]];return[]}return t.filter(n=>n.no===e.no)}let Dr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ch=[];for(let t=0;t<Dr.length;t++)ch[Dr[t].charCodeAt(0)]=t;ch[45]=Dr.indexOf("+");ch[95]=Dr.indexOf("/");const ZC={dec(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n=new Uint8Array(e),r=0,i=0,s,o=0;for(let a=0;a<t.length;a++){if(s=ch[t.charCodeAt(a)],s===void 0)switch(t[a]){case"=":i=0;case`
374`:case"\r":case"	":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:o=s,i=1;break;case 1:n[r++]=o<<2|(s&48)>>4,o=s,i=2;break;case 2:n[r++]=(o&15)<<4|(s&60)>>2,o=s,i=3;break;case 3:n[r++]=(o&3)<<6|s,i=0;break}}if(i==1)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(t){let e="",n=0,r,i=0;for(let s=0;s<t.length;s++)switch(r=t[s],n){case 0:e+=Dr[r>>2],i=(r&3)<<4,n=1;break;case 1:e+=Dr[i|r>>4],i=(r&15)<<2,n=2;break;case 2:e+=Dr[i|r>>6],e+=Dr[r&63],n=0;break}return n&&(e+=Dr[i],e+="=",n==1&&(e+="=")),e}};function F2(t,e,n){t1(e,t);const r=e.runtime.bin.makeReadOptions(n),i=U2(t.getType().runtime.bin.listUnknownFields(t),e.field),[s,o]=XC(e);for(const a of i)e.runtime.bin.readField(s,r.readerFactory(a.data),e.field,a.wireType,r);return o()}function B2(t,e,n,r){t1(e,t);const i=e.runtime.bin.makeReadOptions(r),s=e.runtime.bin.makeWriteOptions(r);if(e1(t,e)){const c=t.getType().runtime.bin.listUnknownFields(t).filter(u=>u.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const u of c)t.getType().runtime.bin.onUnknownField(t,u.no,u.wireType,u.data)}const o=s.writerFactory();let a=e.field;!a.opt&&!a.repeated&&(a.kind=="enum"||a.kind=="scalar")&&(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,n,o,s);const l=i.readerFactory(o.finish());for(;l.pos<l.len;){const[c,u]=l.tag(),h=l.skip(u,c);t.getType().runtime.bin.onUnknownField(t,c,u,h)}}function e1(t,e){const n=t.getType();return e.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(t).find(r=>r.no==e.field.no)}function t1(t,e){Xe(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function n1(t,e){const n=t.localName;if(t.repeated)return e[n].length>0;if(t.oneof)return e[t.oneof.localName].case===n;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[n]!==void 0:t.kind=="enum"?e[n]!==t.T.values[0].no:!QC(t.T,e[n]);case"message":return e[n]!==void 0;case"map":return Object.keys(e[n]).length>0}}function Sb(t,e){const n=t.localName,r=!t.opt&&!t.req;if(t.repeated)e[n]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[n]={};break;case"enum":e[n]=r?t.T.values[0].no:void 0;break;case"scalar":e[n]=r?ya(t.T,t.L):void 0;break;case"message":e[n]=void 0;break}}function Lr(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(Rv.prototype).every(r=>r in t&&typeof t[r]=="function"))return!1;const n=t.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:e===void 0?!0:n.typeName==e.typeName}function r1(t,e){return Lr(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}
vendor: 19,602 bytes, line 374
374L.DOUBLE,L.FLOAT,L.INT64,L.UINT64,L.INT32,L.UINT32,L.BOOL,L.STRING,L.BYTES;const Tb={ignoreUnknownFields:!1},Cb={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function z2(t){return t?Object.assign(Object.assign({},Tb),t):Tb}function $2(t){return t?Object.assign(Object.assign({},Cb),t):Cb}const md=Symbol(),Tu=Symbol();function V2(){return{makeReadOptions:z2,makeWriteOptions:$2,readMessage(t,e,n,r){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(t.typeName," from JSON: ").concat(ar(e)));r=r??new t;const i=new Map,s=n.typeRegistry;for(const[o,a]of Object.entries(e)){const l=t.fields.findJsonName(o);if(l){if(l.oneof){if(a===null&&l.kind=="scalar")continue;const c=i.get(l.oneof);if(c!==void 0)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: multiple keys for oneof "').concat(l.oneof.name,'" present: "').concat(c,'", "').concat(o,'"'));i.set(l.oneof,o)}Eb(r,a,l,n,t)}else{let c=!1;if(s!=null&&s.findExtension&&o.startsWith("[")&&o.endsWith("]")){const u=s.findExtension(o.substring(1,o.length-1));if(u&&u.extendee.typeName==t.typeName){c=!0;const[h,f]=XC(u);Eb(h,a,u.field,n,u),B2(r,u,f(),n)}}if(!c&&!n.ignoreUnknownFields)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: key "').concat(o,'" is unknown'))}}return r},writeMessage(t,e){const n=t.getType(),r={};let i;try{for(i of n.fields.byNumber()){if(!n1(i,t)){if(i.req)throw"required field not set";if(!e.emitDefaultValues||!q2(i))continue}const o=i.oneof?t[i.oneof.localName].value:t[i.localName],a=_b(i,o,e);a!==void 0&&(r[e.useProtoFieldName?i.name:i.jsonName]=a)}const s=e.typeRegistry;if(s!=null&&s.findExtensionFor)for(const o of n.runtime.bin.listUnknownFields(t)){const a=s.findExtensionFor(n.typeName,o.no);if(a&&e1(t,a)){const l=F2(t,a,e),c=_b(a.field,l,e);c!==void 0&&(r[a.field.jsonName]=c)}}}catch(s){const o=i?"cannot encode field ".concat(n.typeName,".").concat(i.name," to JSON"):"cannot encode message ".concat(n.typeName," to JSON"),a=s instanceof Error?s.message:String(s);throw new Error(o+(a.length>0?": ".concat(a):""))}return r},readScalar(t,e,n){return pl(t,e,n??Wi.BIGINT,!0)},writeScalar(t,e,n){if(e!==void 0&&(n||QC(t,e)))return Cu(t,e)},debug:ar}}function ar(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":'"'.concat(t.split('"').join('\\"'),'"');default:return String(t)}}function Eb(t,e,n,r,i){let s=n.localName;if(n.repeated){if(Xe(n.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(ar(e)));const o=t[s];for(const a of e){if(a===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(ar(a)));switch(n.kind){case"message":o.push(n.T.fromJson(a,r));break;case"enum":const l=gf(n.T,a,r.ignoreUnknownFields,!0);l!==Tu&&o.push(l);break;case"scalar":try{o.push(pl(n.T,a,n.L,!0))}catch(c){let u="cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(ar(a));throw c instanceof Error&&c.message.length>0&&(u+=": ".concat(c.message)),new Error(u)}break}}}else if(n.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(ar(e)));const o=t[s];for(const[a,l]of Object.entries(e)){if(l===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: map value null"));let c;try{c=W2(n.K,a)}catch(u){let h="cannot decode map key for field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(ar(e));throw u instanceof Error&&u.message.length>0&&(h+=": ".concat(u.message)),new Error(h)}switch(n.V.kind){case"message":o[c]=n.V.T.fromJson(l,r);break;case"enum":const u=gf(n.V.T,l,r.ignoreUnknownFields,!0);u!==Tu&&(o[c]=u);break;case"scalar":try{o[c]=pl(n.V.T,l,Wi.BIGINT,!0)}catch(h){let f="cannot decode map value for field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(ar(e));throw h instanceof Error&&h.message.length>0&&(f+=": ".concat(h.message)),new Error(f)}break}}}else switch(n.oneof&&(t=t[n.oneof.localName]={case:s},s="value"),n.kind){case"message":const o=n.T;if(e===null&&o.typeName!="google.protobuf.Value")return;let a=t[s];Lr(a)?a.fromJson(e,r):(t[s]=a=o.fromJson(e,r),o.fieldWrapper&&!n.oneof&&(t[s]=o.fieldWrapper.unwrapField(a)));break;case"enum":const l=gf(n.T,e,r.ignoreUnknownFields,!1);switch(l){case md:Sb(n,t);break;case Tu:break;default:t[s]=l;break}break;case"scalar":try{const c=pl(n.T,e,n.L,!1);switch(c){case md:Sb(n,t);break;default:t[s]=c;break}}catch(c){let u="cannot decode field ".concat(i.typeName,".").concat(n.name," from JSON: ").concat(ar(e));throw c instanceof Error&&c.message.length>0&&(u+=": ".concat(c.message)),new Error(u)}break}}function W2(t,e){if(t===L.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return pl(t,e,Wi.BIGINT,!0).toString()}function pl(t,e,n,r){if(e===null)return r?ya(t,n):md;switch(t){case L.DOUBLE:case L.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const i=Number(e);if(Number.isNaN(i)||!Number.isFinite(i))break;return t==L.FLOAT&&WC(i),i;case L.INT32:case L.FIXED32:case L.SFIXED32:case L.SINT32:case L.UINT32:let s;if(typeof e=="number"?s=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(s=Number(e)),s===void 0)break;return t==L.UINT32||t==L.FIXED32?dp(s):ku(s),s;case L.INT64:case L.SFIXED64:case L.SINT64:if(typeof e!="number"&&typeof e!="string")break;const o=$e.parse(e);return n?o.toString():o;case L.FIXED64:case L.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=$e.uParse(e);return n?a.toString():a;case L.BOOL:if(typeof e!="boolean")break;return e;case L.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case L.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return ZC.dec(e)}throw new Error}function gf(t,e,n,r){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:r?t.values[0].no:md;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const i=t.findName(e);if(i!==void 0)return i.no;if(n)return Tu;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(ar(e)))}function q2(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function _b(t,e,n){if(t.kind=="map"){Xe(typeof e=="object"&&e!=null);const r={},i=Object.entries(e);switch(t.V.kind){case"scalar":for(const[o,a]of i)r[o.toString()]=Cu(t.V.T,a);break;case"message":for(const[o,a]of i)r[o.toString()]=a.toJson(n);break;case"enum":const s=t.V.T;for(const[o,a]of i)r[o.toString()]=vf(s,a,n.enumAsInteger);break}return n.emitDefaultValues||i.length>0?r:void 0}if(t.repeated){Xe(Array.isArray(e));const r=[];switch(t.kind){case"scalar":for(let i=0;i<e.length;i++)r.push(Cu(t.T,e[i]));break;case"enum":for(let i=0;i<e.length;i++)r.push(vf(t.T,e[i],n.enumAsInteger));break;case"message":for(let i=0;i<e.length;i++)r.push(e[i].toJson(n));break}return n.emitDefaultValues||r.length>0?r:void 0}switch(t.kind){case"scalar":return Cu(t.T,e);case"enum":return vf(t.T,e,n.enumAsInteger);case"message":return r1(t.T,e).toJson(n)}}function vf(t,e,n){var r;if(Xe(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(n)return e;const i=t.findNumber(e);return(r=i==null?void 0:i.name)!==null&&r!==void 0?r:e}function Cu(t,e){switch(t){case L.INT32:case L.SFIXED32:case L.SINT32:case L.FIXED32:case L.UINT32:return Xe(typeof e=="number"),e;case L.FLOAT:case L.DOUBLE:return Xe(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case L.STRING:return Xe(typeof e=="string"),e;case L.BOOL:return Xe(typeof e=="boolean"),e;case L.UINT64:case L.FIXED64:case L.INT64:case L.SFIXED64:case L.SINT64:return Xe(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case L.BYTES:return Xe(e instanceof Uint8Array),ZC.enc(e)}}const to=Symbol("@bufbuild/protobuf/unknown-fields"),Pb={readUnknownFields:!0,readerFactory:t=>new j2(t)},Rb={writeUnknownFields:!0,writerFactory:()=>new M2};function H2(t){return t?Object.assign(Object.assign({},Pb),t):Pb}function K2(t){return t?Object.assign(Object.assign({},Rb),t):Rb}function G2(){return{makeReadOptions:H2,makeWriteOptions:K2,listUnknownFields(t){var e;return(e=t[to])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[to]},writeUnknownFields(t,e){const r=t[to];if(r)for(const i of r)e.tag(i.no,i.wireType).raw(i.data)},onUnknownField(t,e,n,r){const i=t;Array.isArray(i[to])||(i[to]=[]),i[to].push({no:e,wireType:n,data:r})},readMessage(t,e,n,r,i){const s=t.getType(),o=i?e.len:e.pos+n;let a,l;for(;e.pos<o&&([a,l]=e.tag(),!(i===!0&&l==rt.EndGroup));){const c=s.fields.find(a);if(!c){const u=e.skip(l,a);r.readUnknownFields&&this.onUnknownField(t,a,l,u);continue}Ib(t,e,c,l,r)}if(i&&(l!=rt.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:Ib,writeMessage(t,e,n){const r=t.getType();for(const i of r.fields.byNumber()){if(!n1(i,t)){if(i.req)throw new Error("cannot encode field ".concat(r.typeName,".").concat(i.name," to binary: required field not set"));continue}const s=i.oneof?t[i.oneof.localName].value:t[i.localName];Nb(i,s,e,n)}return n.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,n,r){e!==void 0&&Nb(t,e,n,r)}}}function Ib(t,e,n,r,i){let{repeated:s,localName:o}=n;switch(n.oneof&&(t=t[n.oneof.localName],t.case!=o&&delete t.value,t.case=o,o="value"),n.kind){case"scalar":case"enum":const a=n.kind=="enum"?L.INT32:n.T;let l=pd;if(n.kind=="scalar"&&n.L>0&&(l=Y2),s){let f=t[o];if(r==rt.LengthDelimited&&a!=L.STRING&&a!=L.BYTES){let b=e.uint32()+e.pos;for(;e.pos<b;)f.push(l(e,a))}else f.push(l(e,a))}else t[o]=l(e,a);break;case"message":const c=n.T;s?t[o].push(Eu(e,new c,i,n)):Lr(t[o])?Eu(e,t[o],i,n):(t[o]=Eu(e,new c,i,n),c.fieldWrapper&&!n.oneof&&!n.repeated&&(t[o]=c.fieldWrapper.unwrapField(t[o])));break;case"map":let[u,h]=J2(n,e,i);t[o][u]=h;break}}function Eu(t,e,n,r){const i=e.getType().runtime.bin,s=r==null?void 0:r.delimited;return i.readMessage(e,t,s?r.no:t.uint32(),n,s),e}function J2(t,e,n){const r=e.uint32(),i=e.pos+r;let s,o;for(;e.pos<i;){const[a]=e.tag();switch(a){case 1:s=pd(e,t.K);break;case 2:switch(t.V.kind){case"scalar":o=pd(e,t.V.T);break;case"enum":o=e.int32();break;case"message":o=Eu(e,new t.V.T,n,void 0);break}break}}if(s===void 0&&(s=ya(t.K,Wi.BIGINT)),typeof s!="string"&&typeof s!="number"&&(s=s.toString()),o===void 0)switch(t.V.kind){case"scalar":o=ya(t.V.T,Wi.BIGINT);break;case"enum":o=t.V.T.values[0].no;break;case"message":o=new t.V.T;break}return[s,o]}function Y2(t,e){const n=pd(t,e);return typeof n=="bigint"?n.toString():n}function pd(t,e){switch(e){case L.STRING:return t.string();case L.BOOL:return t.bool();case L.DOUBLE:return t.double();case L.FLOAT:return t.float();case L.INT32:return t.int32();case L.INT64:return t.int64();case L.UINT64:return t.uint64();case L.FIXED64:return t.fixed64();case L.BYTES:return t.bytes();case L.FIXED32:return t.fixed32();case L.SFIXED32:return t.sfixed32();case L.SFIXED64:return t.sfixed64();case L.SINT64:return t.sint64();case L.UINT32:return t.uint32();case L.SINT32:return t.sint32()}}function Nb(t,e,n,r){Xe(e!==void 0);const i=t.repeated;switch(t.kind){case"scalar":case"enum":let s=t.kind=="enum"?L.INT32:t.T;if(i)if(Xe(Array.isArray(e)),t.packed)X2(n,s,t.no,e);else for(const o of e)gl(n,s,t.no,o);else gl(n,s,t.no,e);break;case"message":if(i){Xe(Array.isArray(e));for(const o of e)Ab(n,r,t,o)}else Ab(n,r,t,e);break;case"map":Xe(typeof e=="object"&&e!=null);for(const[o,a]of Object.entries(e))Q2(n,r,t,o,a);break}}function Q2(t,e,n,r,i){t.tag(n.no,rt.LengthDelimited),t.fork();let s=r;switch(n.K){case L.INT32:case L.FIXED32:case L.UINT32:case L.SFIXED32:case L.SINT32:s=Number.parseInt(r);break;case L.BOOL:Xe(r=="true"||r=="false"),s=r=="true";break}switch(gl(t,n.K,1,s),n.V.kind){case"scalar":gl(t,n.V.T,2,i);break;case"enum":gl(t,L.INT32,2,i);break;case"message":Xe(i!==void 0),t.tag(2,rt.LengthDelimited).bytes(i.toBinary(e));break}t.join()}function Ab(t,e,n,r){const i=r1(n.T,r);n.delimited?t.tag(n.no,rt.StartGroup).raw(i.toBinary(e)).tag(n.no,rt.EndGroup):t.tag(n.no,rt.LengthDelimited).bytes(i.toBinary(e))}function gl(t,e,n,r){Xe(r!==void 0);let[i,s]=i1(e);t.tag(n,i)[s](r)}function X2(t,e,n,r){if(!r.length)return;t.tag(n,rt.LengthDelimited).fork();let[,i]=i1(e);for(let s=0;s<r.length;s++)t[i](r[s]);t.join()}function i1(t){let e=rt.Varint;switch(t){case L.BYTES:case L.STRING:e=rt.LengthDelimited;break;case L.DOUBLE:case L.FIXED64:case L.SFIXED64:e=rt.Bit64;break;case L.FIXED32:case L.SFIXED32:case L.FLOAT:e=rt.Bit32;break}const n=L[t].toLowerCase();return[e,n]}function Z2(){return{setEnumType:HC,initPartial(t,e){if(t===void 0)return;const n=e.getType();for(const r of n.fields.byMember()){const i=r.localName,s=e,o=t;if(o[i]!=null)switch(r.kind){case"oneof":const a=o[i].case;if(a===void 0)continue;const l=r.findField(a);let c=o[i].value;l&&l.kind=="message"&&!Lr(c,l.T)?c=new l.T(c):l&&l.kind==="scalar"&&l.T===L.BYTES&&(c=Wa(c)),s[i]={case:a,value:c};break;case"scalar":case"enum":let u=o[i];r.T===L.BYTES&&(u=r.repeated?u.map(Wa):Wa(u)),s[i]=u;break;case"map":switch(r.V.kind){case"scalar":case"enum":if(r.V.T===L.BYTES)for(const[m,b]of Object.entries(o[i]))s[i][m]=Wa(b);else Object.assign(s[i],o[i]);break;case"message":const f=r.V.T;for(const m of Object.keys(o[i])){let b=o[i][m];f.fieldWrapper||(b=new f(b)),s[i][m]=b}break}break;case"message":const h=r.T;if(r.repeated)s[i]=o[i].map(f=>Lr(f,h)?f:new h(f));else{const f=o[i];h.fieldWrapper?h.typeName==="google.protobuf.BytesValue"?s[i]=Wa(f):s[i]=f:s[i]=Lr(f,h)?f:new h(f)}break}}},equals(t,e,n){return e===n?!0:!e||!n?!1:t.fields.byMember().every(r=>{const i=e[r.localName],s=n[r.localName];if(r.repeated){if(i.length!==s.length)return!1;switch(r.kind){case"message":return i.every((o,a)=>r.T.equals(o,s[a]));case"scalar":return i.every((o,a)=>si(r.T,o,s[a]));case"enum":return i.every((o,a)=>si(L.INT32,o,s[a]))}throw new Error("repeated cannot contain ".concat(r.kind))}switch(r.kind){case"message":let o=i,a=s;return r.T.fieldWrapper&&(o!==void 0&&!Lr(o)&&(o=r.T.fieldWrapper.wrapField(o)),a!==void 0&&!Lr(a)&&(a=r.T.fieldWrapper.wrapField(a))),r.T.equals(o,a);case"enum":return si(L.INT32,i,s);case"scalar":return si(r.T,i,s);case"oneof":if(i.case!==s.case)return!1;const l=r.findField(i.case);if(l===void 0)return!0;switch(l.kind){case"message":return l.T.equals(i.value,s.value);case"enum":return si(L.INT32,i.value,s.value);case"scalar":return si(l.T,i.value,s.value)}throw new Error("oneof cannot contain ".concat(l.kind));case"map":const c=Object.keys(i).concat(Object.keys(s));switch(r.V.kind){case"message":const u=r.V.T;return c.every(f=>u.equals(i[f],s[f]));case"enum":return c.every(f=>si(L.INT32,i[f],s[f]));case"scalar":const h=r.V.T;return c.every(f=>si(h,i[f],s[f]))}break}})},clone(t){const e=t.getType(),n=new e,r=n;for(const i of e.fields.byMember()){const s=t[i.localName];let o;if(i.repeated)o=s.map(qc);else if(i.kind=="map"){o=r[i.localName];for(const[a,l]of Object.entries(s))o[a]=qc(l)}else i.kind=="oneof"?o=i.findField(s.case)?{case:s.case,value:qc(s.value)}:{case:void 0}:o=qc(s);r[i.localName]=o}for(const i of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(r,i.no,i.wireType,i.data);return n}}}function qc(t){if(t===void 0)return t;if(Lr(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function Wa(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function eL(t,e,n){return{syntax:t,json:V2(),bin:G2(),util:Object.assign(Object.assign({},Z2()),{newFieldList:e,initFields:n}),makeMessageType(r,i,s){return P2(this,r,i,s)},makeEnum:_2,makeEnumType:KC,getEnumType:E2,makeExtension(r,i,s){return D2(this,r,i,s)}}}class tL{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){const n={};for(const r of this.list())n[r.jsonName]=n[r.name]=r;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){const n={};for(const r of this.list())n[r.no]=r;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let n;for(const r of this.list())r.oneof?r.oneof!==n&&(n=r.oneof,e.push(n)):e.push(r)}return this.members}}function s1(t,e){const n=o1(t);return e?n:aL(oL(n))}function nL(t){return s1(t,!1)}const rL=o1;function o1(t){let e=!1;const n=[];for(let r=0;r<t.length;r++){let i=t.charAt(r);switch(i){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(i),e=!1;break;default:e&&(e=!1,i=i.toUpperCase()),n.push(i);break}}return n.join("")}const iL=new Set(["constructor","toString","toJSON","valueOf"]),sL=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),a1=t=>"".concat(t,"$"),oL=t=>sL.has(t)?a1(t):t,aL=t=>iL.has(t)?a1(t):t;class lL{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=nL(e)}addField(e){Xe(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n<this.fields.length;n++)this._lookup[this.fields[n].localName]=this.fields[n]}return this._lookup[e]}}function cL(t,e){var n,r,i,s,o,a;const l=[];let c;for(const u of typeof t=="function"?t():t){const h=u;if(h.localName=s1(u.name,u.oneof!==void 0),h.jsonName=(n=u.jsonName)!==null&&n!==void 0?n:rL(u.name),h.repeated=(r=u.repeated)!==null&&r!==void 0?r:!1,u.kind=="scalar"&&(h.L=(i=u.L)!==null&&i!==void 0?i:Wi.BIGINT),h.delimited=(s=u.delimited)!==null&&s!==void 0?s:!1,h.req=(o=u.req)!==null&&o!==void 0?o:!1,h.opt=(a=u.opt)!==null&&a!==void 0?a:!1,u.packed===void 0&&(h.packed=u.kind=="enum"||u.kind=="scalar"&&u.T!=L.BYTES&&u.T!=L.STRING),u.oneof!==void 0){const f=typeof u.oneof=="string"?u.oneof:u.oneof.name;(!c||c.name!=f)&&(c=new lL(f)),h.oneof=c,c.addField(h)}l.push(h)}return l}const I=eL("proto3",t=>new tL(t,e=>cL(e)),t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const n=e.localName,r=t;if(e.repeated){r[n]=[];continue}switch(e.kind){case"oneof":r[n]={case:void 0};break;case"enum":r[n]=0;break;case"map":r[n]={};break;case"scalar":r[n]=ya(e.T,e.L);break}}});class qt extends Rv{constructor(e){super(),this.seconds=$e.zero,this.nanos=0,I.util.initPartial(e,this)}fromJson(e,n){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(I.json.debug(e)));const r=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!r)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const i=Date.parse(r[1]+"-"+r[2]+"-"+r[3]+"T"+r[4]+":"+r[5]+":"+r[6]+(r[8]?r[8]:"Z"));if(Number.isNaN(i))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invali
374d RFC 3339 string");if(i<Date.parse("0001-01-01T00:00:00Z")||i>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=$e.parse(i/1e3),this.nanos=0,r[7]&&(this.nanos=parseInt("1"+r[7]+"0".repeat(9-r[7].length))-1e9),this}toJson(e){const n=Number(this.seconds)*1e3;if(n<Date.parse("0001-01-01T00:00:00Z")||n>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let r="Z";if(this.nanos>0){const i=(this.nanos+1e9).toString().substring(1);i.substring(3)==="000000"?r="."+i.substring(0,3)+"Z":i.substring(6)==="000"?r="."+i.substring(0,6)+"Z":r="."+i+"Z"}return new Date(n).toISOString().replace(".000Z",r)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return qt.fromDate(new Date)}static fromDate(e){const n=e.getTime();return new qt({seconds:$e.parse(Math.floor(n/1e3)),nanos:n%1e3*1e6})}static fromBinary(e,n){return new qt().fromBinary(e,n)}static fromJson(e,n){return new qt().fromJson(e,n)}static fromJsonString(e,n){return new qt().fromJsonString(e,n)}static equals(e,n){return I.util.equals(qt,e,n)}}qt.runtime=I;qt.typeName="google.protobuf.Timestamp";qt.fields=I.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const uL=I.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:qt},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:dL,repeated:!0},{no:5,name:"events",kind:"message",T:fL,repeated:!0}]),dL=I.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:hL,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),hL=I.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:qt},{no:3,name:"value",kind:"scalar",T:2}]),fL=I.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:qt},{no:7,name:"normalized_end_timestamp",kind:"message",T:qt,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),l1=I.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),Vn=I.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),ot=I.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),Nv=I.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),tl=I.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),Hl=I.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Kn=I.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"},{no:15,name:"MEDIA_FAILURE"}]),cs=I.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),mL=I.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),ft=I.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),uh=I.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:gd,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:x1}]),gd=I.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),pL=I.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:I.getEnumType(ot),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}]),Ls=I.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:I.getEnumType($o)},{no:4,name:"tracks",kind:"message",T:Po,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:pL},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:I.getEnumType(Kl)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:I.getEnumType(Kn)},{no:18,name:"kind_details",kind:"enum",T:I.getEnumType(gL),repeated:!0},{no:19,name:"data_tracks",kind:"message",T:Av,repeated:!0}]),$o=I.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Kl=I.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"},{no:7,name:"CONNECTOR"},{no:8,name:"BRIDGE"}]),gL=I.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"},{no:2,name:"CONNECTOR_WHATSAPP"},{no:3,name:"CONNECTOR_TWILIO"},{no:4,name:"BRIDGE_RTSP"}]),it=I.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),vL=I.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:Di,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:I.getEnumType(c1)},{no:6,name:"sdp_cid",kind:"scalar",T:9}]),Po=I.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:I.getEnumType(Vn)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:I.getEnumType(ot)},{no:10,name:"layers",kind:"message",T:Di,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:vL,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:I.getEnumType(it)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:x1},{no:19,name:"audio_features",kind:"enum",T:I.getEnumType(ft),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:I.getEnumType(l1)}]),Av=I.makeMessageType("livekit.DataTrackInfo",()=>[{no:1,name:"pub_handle",kind:"scalar",T:13},{no:2,name:"sid",kind:"scalar",T:9},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"encryption",kind:"enum",T:I.getEnumType(it)}]),yL=I.makeMessageType("livekit.DataTrackSubscriptionOptions",()=>[{no:1,name:"target_fps",kind:"scalar",T:13,opt:!0}]),Di=I.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:I.getEnumType(Nv)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13},{no:6,name:"spatial_layer",kind:"scalar",T:5},{no:7,name:"rid",kind:"scalar",T:9},{no:8,name:"repair_ssrc",kind:"scalar",T:13}]),c1=I.makeEnum("livekit.VideoLayer.Mode",[{no:0,name:"MODE_UNUSED"},{no:1,name:"ONE_SPATIAL_LAYER_PER_STREAM"},{no:2,name:"MULTIPLE_SPATIAL_LAYERS_PER_STREAM"},{no:3,name:"ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR"}]),Lt=I.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:I.getEnumType(he)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:Ov,oneof:"value"},{no:3,name:"speaker",kind:"message",T:bL,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:f1,oneof:"value"},{no:7,name:"transcription",kind:"message",T:wL,oneof:"value"},{no:8,name:"metrics",kind:"message",T:uL,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:vd,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:Mv,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:jv,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:Dv,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:yd,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:bd,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:wd,oneof:"value"},{no:18,name:"encrypted_packet",kind:"message",T:u1,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),he=I.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),u1=I.makeMessageType("livekit.EncryptedPacket",()=>[{no:1,name:"encryption_type",kind:"enum",T:I.getEnumType(it)},{no:2,name:"iv",kind:"scalar",T:12},{no:3,name:"key_index",kind:"scalar",T:13},{no:4,name:"encrypted_value",kind:"scalar",T:12}]),d1=I.makeMessageType("livekit.EncryptedPacketPayload",()=>[{no:1,name:"user",kind:"message",T:Ov,oneof:"value"},{no:3,name:"chat_message",kind:"message",T:vd,oneof:"value"},{no:4,name:"rpc_request",kind:"message",T:Mv,oneof:"value"},{no:5,name:"rpc_ack",kind:"message",T:jv,oneof:"value"},{no:6,name:"rpc_response",kind:"message",T:Dv,oneof:"value"},{no:7,name:"stream_header",kind:"message",T:yd,oneof:"value"},{no:8,name:"stream_chunk",kind:"message",T:bd,oneof:"value"},{no:9,name:"stream_trailer",kind:"message",T:wd,oneof:"value"}]),bL=I.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:h1,repeated:!0}]),h1=I.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),Ov=I.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),f1=I.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),wL=I.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:xL,repeated:!0}]),xL=I.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),vd=I.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),Mv=I.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}]),jv=I.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),Dv=I.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:m1,oneof:"value"}]),m1=I.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),p1=I.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),g1=I.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:I.getEnumType(v1)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),v1=I.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),y1=I.makeMessageType("livekit.ClientInfo",()=>
vendor: 9,754 bytes, line 374
374[{no:1,name:"sdk",kind:"enum",T:I.getEnumType(b1)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9}]),b1=I.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"},{no:14,name:"ESP32"}]),w1=I.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:Ob},{no:2,name:"screen",kind:"message",T:Ob},{no:3,name:"resume_connection",kind:"enum",T:I.getEnumType(Hl)},{no:4,name:"disabled_codecs",kind:"message",T:kL},{no:5,name:"force_relay",kind:"enum",T:I.getEnumType(Hl)}]),Ob=I.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:I.getEnumType(Hl)}]),kL=I.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:gd,repeated:!0},{no:2,name:"publish",kind:"message",T:gd,repeated:!0}]),x1=I.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),hp=I.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),k1=I.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:I.getEnumType(hp)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),S1=I.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),yd=I.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:I.getEnumType(it)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:k1,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:S1,oneof:"content_header"}],{localName:"DataStream_Header"}),bd=I.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),wd=I.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),SL=I.makeMessageType("livekit.SubscribedAudioCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"enabled",kind:"scalar",T:8}]),Wn=I.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),fp=I.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),TL=I.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),CL=I.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:qi,oneof:"message"},{no:2,name:"answer",kind:"message",T:qi,oneof:"message"},{no:3,name:"trickle",kind:"message",T:dh,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Gl,oneof:"message"},{no:5,name:"mute",kind:"message",T:hh,oneof:"message"},{no:6,name:"subscription",kind:"message",T:fh,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:_1,oneof:"message"},{no:8,name:"leave",kind:"message",T:mh,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:R1,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:A1,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:zv,oneof:"message"},{no:13,name:"simulate",kind:"message",T:sr,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:Fv,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:j1,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:Uv,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:P1,oneof:"message"},{no:19,name:"publish_data_track_request",kind:"message",T:T1,oneof:"message"},{no:20,name:"unpublish_data_track_request",kind:"message",T:E1,oneof:"message"},{no:21,name:"update_data_subscription",kind:"message",T:OL,oneof:"message"}]),Mb=I.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:RL,oneof:"message"},{no:2,name:"answer",kind:"message",T:qi,oneof:"message"},{no:3,name:"offer",kind:"message",T:qi,oneof:"message"},{no:4,name:"trickle",kind:"message",T:dh,oneof:"message"},{no:5,name:"update",kind:"message",T:AL,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Lv,oneof:"message"},{no:8,name:"leave",kind:"message",T:mh,oneof:"message"},{no:9,name:"mute",kind:"message",T:hh,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:jL,oneof:"message"},{no:11,name:"room_update",kind:"message",T:DL,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:UL,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:BL,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:$L,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:WL,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:NL,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:IL,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:HL,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:JL,oneof:"message"},{no:22,name:"request_response",kind:"message",T:YL,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:QL,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:qL,oneof:"message"},{no:25,name:"media_sections_requirement",kind:"message",T:t3,oneof:"message"},{no:26,name:"subscribed_audio_codec_update",kind:"message",T:VL,oneof:"message"},{no:27,name:"publish_data_track_response",kind:"message",T:C1,oneof:"message"},{no:28,name:"unpublish_data_track_response",kind:"message",T:EL,oneof:"message"},{no:29,name:"data_track_subscriber_handles",kind:"message",T:_L,oneof:"message"}]),mp=I.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:Di,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:I.getEnumType(c1)}]),Gl=I.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:I.getEnumType(Vn)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:I.getEnumType(ot)},{no:9,name:"layers",kind:"message",T:Di,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:mp,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:I.getEnumType(it)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:I.getEnumType(l1)},{no:17,name:"audio_features",kind:"enum",T:I.getEnumType(ft),repeated:!0}]),T1=I.makeMessageType("livekit.PublishDataTrackRequest",()=>[{no:1,name:"pub_handle",kind:"scalar",T:13},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"encryption",kind:"enum",T:I.getEnumType(it)}]),C1=I.makeMessageType("livekit.PublishDataTrackResponse",()=>[{no:1,name:"info",kind:"message",T:Av}]),E1=I.makeMessageType("livekit.UnpublishDataTrackRequest",()=>[{no:1,name:"pub_handle",kind:"scalar",T:13}]),EL=I.makeMessageType("livekit.UnpublishDataTrackResponse",()=>[{no:1,name:"info",kind:"message",T:Av}]),_L=I.makeMessageType("livekit.DataTrackSubscriberHandles",()=>[{no:1,name:"sub_handles",kind:"map",K:13,V:{kind:"message",T:PL}}]),PL=I.makeMessageType("livekit.DataTrackSubscriberHandles.PublishedDataTrack",()=>[{no:1,name:"publisher_identity",kind:"scalar",T:9},{no:2,name:"publisher_sid",kind:"scalar",T:9},{no:3,name:"track_sid",kind:"scalar",T:9}],{localName:"DataTrackSubscriberHandles_PublishedDataTrack"}),dh=I.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:I.getEnumType(Wn)},{no:3,name:"final",kind:"scalar",T:8}]),hh=I.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),RL=I.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:uh},{no:2,name:"participant",kind:"message",T:Ls},{no:3,name:"other_participants",kind:"message",T:Ls,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:I1,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:w1}
vendor: 9,023 bytes, line 374
374,{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:g1},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:gd,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),IL=I.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:I1,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:w1},{no:3,name:"server_info",kind:"message",T:g1},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),Lv=I.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Po}]),NL=I.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),qi=I.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"id",kind:"scalar",T:13},{no:4,name:"mid_to_track_id",kind:"map",K:9,V:{kind:"scalar",T:9}}]),AL=I.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:Ls,repeated:!0}]),fh=I.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:p1,repeated:!0}]),OL=I.makeMessageType("livekit.UpdateDataSubscription",()=>[{no:1,name:"updates",kind:"message",T:ML,repeated:!0}]),ML=I.makeMessageType("livekit.UpdateDataSubscription.Update",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"options",kind:"message",T:yL}],{localName:"UpdateDataSubscription_Update"}),_1=I.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:I.getEnumType(Nv)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),Uv=I.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:I.getEnumType(ft),repeated:!0}]),P1=I.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),mh=I.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:I.getEnumType(Kn)},{no:3,name:"action",kind:"enum",T:I.getEnumType(Vo)},{no:4,name:"regions",kind:"message",T:KL}]),Vo=I.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),R1=I.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:Di,repeated:!0}]),Fv=I.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),I1=I.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),jL=I.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:h1,repeated:!0}]),DL=I.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:uh}]),LL=I.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:I.getEnumType(tl)},{no:3,name:"score",kind:"scalar",T:2}]),UL=I.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:LL,repeated:!0}]),FL=I.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:I.getEnumType(fp)}]),BL=I.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:FL,repeated:!0}]),Bv=I.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:I.getEnumType(Nv)},{no:2,name:"enabled",kind:"scalar",T:8}]),zL=I.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:Bv,repeated:!0}]),$L=I.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:Bv,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:zL,repeated:!0}]),VL=I.makeMessageType("livekit.SubscribedAudioCodecUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_audio_codecs",kind:"message",T:SL,repeated:!0}]),N1=I.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),A1=I.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:N1,repeated:!0}]),WL=I.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),qL=I.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:uh},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:Ls},{no:4,name:"other_participants",kind:"message",T:Ls,repeated:!0}]),zv=I.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:qi},{no:2,name:"subscription",kind:"message",T:fh},{no:3,name:"publish_tracks",kind:"message",T:Lv,repeated:!0},{no:4,name:"data_channels",kind:"message",T:M1,repeated:!0},{no:5,name:"offer",kind:"message",T:qi},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:O1,repeated:!0},{no:8,name:"publish_data_tracks",kind:"message",T:C1,repeated:!0}]),O1=I.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),M1=I.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:I.getEnumType(Wn)}]),sr=I.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:I.getEnumType(TL),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),j1=I.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),HL=I.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),KL=I.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:GL,repeated:!0}]),GL=I.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),JL=I.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:I.getEnumType(mL)}]),YL=I.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:I.getEnumType($v)},{no:3,name:"message",kind:"scalar",T:9},{no:4,name:"trickle",kind:"message",T:dh,oneof:"request"},{no:5,name:"add_track",kind:"message",T:Gl,oneof:"request"},{no:6,name:"mute",kind:"message",T:hh,oneof:"request"},{no:7,name:"update_metadata",kind:"message",T:Fv,oneof:"request"},{no:8,name:"update_audio_track",kind:"message",T:Uv,oneof:"request"},{no:9,name:"update_video_track",kind:"message",T:P1,oneof:"request"},{no:10,name:"publish_data_track",kind:"message",T:T1,oneof:"request"},{no:11,name:"unpublish_data_track",kind:"message",T:E1,oneof:"request"}]),$v=I.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"},{no:4,name:"QUEUED"},{no:5,name:"UNSUPPORTED_TYPE"},{no:6,name:"UNCLASSIFIED_ERROR"},{no:7,name:"INVALID_HANDLE"}
vendor: 10,927 bytes, line 374
374,{no:8,name:"INVALID_NAME"},{no:9,name:"DUPLICATE_HANDLE"},{no:10,name:"DUPLICATE_NAME"}]),QL=I.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),D1=I.makeMessageType("livekit.ConnectionSettings",()=>[{no:1,name:"auto_subscribe",kind:"scalar",T:8},{no:2,name:"adaptive_stream",kind:"scalar",T:8},{no:3,name:"subscriber_allow_pause",kind:"scalar",T:8,opt:!0},{no:4,name:"disable_ice_lite",kind:"scalar",T:8},{no:5,name:"auto_subscribe_data_track",kind:"scalar",T:8,opt:!0}]),XL=I.makeMessageType("livekit.JoinRequest",()=>[{no:1,name:"client_info",kind:"message",T:y1},{no:2,name:"connection_settings",kind:"message",T:D1},{no:3,name:"metadata",kind:"scalar",T:9},{no:4,name:"participant_attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:5,name:"add_track_requests",kind:"message",T:Gl,repeated:!0},{no:6,name:"publisher_offer",kind:"message",T:qi},{no:7,name:"reconnect",kind:"scalar",T:8},{no:8,name:"reconnect_reason",kind:"enum",T:I.getEnumType(cs)},{no:9,name:"participant_sid",kind:"scalar",T:9},{no:10,name:"sync_state",kind:"message",T:zv}]),ZL=I.makeMessageType("livekit.WrappedJoinRequest",()=>[{no:1,name:"compression",kind:"enum",T:I.getEnumType(e3)},{no:2,name:"join_request",kind:"scalar",T:12}]),e3=I.makeEnum("livekit.WrappedJoinRequest.Compression",[{no:0,name:"NONE"},{no:1,name:"GZIP"}]),t3=I.makeMessageType("livekit.MediaSectionsRequirement",()=>[{no:1,name:"num_audios",kind:"scalar",T:13},{no:2,name:"num_videos",kind:"scalar",T:13}]);function n3(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _u={exports:{}},r3=_u.exports,jb;function i3(){return jb||(jb=1,function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(r3,function(){var e=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],s={},o=null;function a(p,g){var v=p[g];if(typeof v.bind=="function")return v.bind(p);try{return Function.prototype.bind.call(v,p)}catch{return function(){return Function.prototype.apply.apply(v,[p,arguments])}}}function l(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(p){return p==="debug"&&(p="log"),typeof console===n?!1:p==="trace"&&r?l:console[p]!==void 0?a(console,p):console.log!==void 0?a(console,"log"):e}function u(){for(var p=this.getLevel(),g=0;g<i.length;g++){var v=i[g];this[v]=g<p?e:this.methodFactory(v,p,this.name)}if(this.log=this.debug,typeof console===n&&p<this.levels.SILENT)return"No console available for logging"}function h(p){return function(){typeof console!==n&&(u.call(this),this[p].apply(this,arguments))}}function f(p,g,v){return c(p)||h.apply(this,arguments)}function m(p,g){var v=this,y,w,k,S="loglevel";typeof p=="string"?S+=":"+p:typeof p=="symbol"&&(S=void 0);function T(A){var O=(i[A]||"silent").toUpperCase();if(!(typeof window===n||!S)){try{window.localStorage[S]=O;return}catch{}try{window.document.cookie=encodeURIComponent(S)+"="+O+";"}catch{}}}function C(){var A;if(!(typeof window===n||!S)){try{A=window.localStorage[S]}catch{}if(typeof A===n)try{var O=window.document.cookie,K=encodeURIComponent(S),F=O.indexOf(K+"=");F!==-1&&(A=/^([^;]+)/.exec(O.slice(F+K.length+1))[1])}catch{}return v.levels[A]===void 0&&(A=void 0),A}}function _(){if(!(typeof window===n||!S)){try{window.localStorage.removeItem(S)}catch{}try{window.document.cookie=encodeURIComponent(S)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function P(A){var O=A;if(typeof O=="string"&&v.levels[O.toUpperCase()]!==void 0&&(O=v.levels[O.toUpperCase()]),typeof O=="number"&&O>=0&&O<=v.levels.SILENT)return O;throw new TypeError("log.setLevel() called with invalid level: "+A)}v.name=p,v.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},v.methodFactory=g||f,v.getLevel=function(){return k??w??y},v.setLevel=function(A,O){return k=P(A),O!==!1&&T(k),u.call(v)},v.setDefaultLevel=function(A){w=P(A),C()||v.setLevel(A,!1)},v.resetLevel=function(){k=null,_(),u.call(v)},v.enableAll=function(A){v.setLevel(v.levels.TRACE,A)},v.disableAll=function(A){v.setLevel(v.levels.SILENT,A)},v.rebuild=function(){if(o!==v&&(y=P(o.getLevel())),u.call(v),o===v)for(var A in s)s[A].rebuild()},y=P(o?o.getLevel():"WARN");var R=C();R!=null&&(k=P(R)),u.call(v)}o=new m,o.getLogger=function(g){if(typeof g!="symbol"&&typeof g!="string"||g==="")throw new TypeError("You must supply a name when creating a logger.");var v=s[g];return v||(v=s[g]=new m(g,o.methodFactory)),v};var b=typeof window!==n?window.log:void 0;return o.noConflict=function(){return typeof window!==n&&window.log===o&&(window.log=b),o},o.getLoggers=function(){return s},o.default=o,o})}(_u)),_u.exports}var ph=i3(),pp;(function(t){t[t.trace=0]="trace",t[t.debug=1]="debug",t[t.info=2]="info",t[t.warn=3]="warn",t[t.error=4]="error",t[t.silent=5]="silent"})(pp||(pp={}));var Cn;(function(t){t.Default="livekit",t.Room="livekit-room",t.TokenSource="livekit-token-source",t.Participant="livekit-participant",t.Track="livekit-track",t.Publication="livekit-track-publication",t.Engine="livekit-engine",t.Signal="livekit-signal",t.PCManager="livekit-pc-manager",t.PCTransport="livekit-pc-transport",t.E2EE="lk-e2ee",t.DataTracks="livekit-data-tracks"})(Cn||(Cn={}));let de=ph.getLogger("livekit");Object.values(Cn).map(t=>ph.getLogger(t));de.setDefaultLevel(pp.info);function wr(t){const e=ph.getLogger(t);return e.setDefaultLevel(de.getLevel()),e}const s3=ph.getLogger("lk-e2ee"),qa=7e3,o3=[0,300,2*2*300,3*3*300,4*4*300,qa,qa,qa,qa,qa];class a3{constructor(e){this._retryDelays=e!==void 0?[...e]:o3}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const n=this._retryDelays[e.retryCount];return e.retryCount<=1?n:n+Math.random()*1e3}}function l3(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function E(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})}function Db(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ur(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Db=="function"?Db(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(a,l){o=t[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(c){s({value:c,done:a})},o)}}var Hc={exports:{}},Lb;function c3(){if(Lb)return Hc.exports;Lb=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(S,T,C){return Function.prototype.apply.call(S,T,C)},n;t&&typeof t.ownKeys=="function"?n=t.ownKeys:Object.getOwnPropertySymbols?n=function(S){return Object.getOwnPropertyNames(S).concat(Object.getOwnPropertySymbols(S))}:n=function(S){return Object.getOwnPropertyNames(S)};function r(k){console&&console.warn&&console.warn(k)}var i=Number.isNaN||function(S){return S!==S};function s(){s.init.call(this)}Hc.exports=s,Hc.exports.once=v,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(k){if(typeof k!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof k)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(k){if(typeof k!="number"||k<0||i(k))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+k+".");o=k}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(S){if(typeof S!="number"||S<0||i(S))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+S+".");return this._maxListeners=S,this};function l(k){return k._maxListeners===void 0?s.defaultMaxListeners:k._maxListeners}s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(S){for(var T=[],C=1;C<arguments.length;C++)T.push(arguments[C]);var _=S==="error",P=this._events;if(P!==void 0)_=_&&P.error===void 0;else if(!_)return!1;if(_){var R;if(T.length>0&&(R=T[0]),R instanceof Error)throw R;var A=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw A.context=R,A}var O=P[S];if(O===void 0)return!1;if(typeof O=="function")e(O,this,T);else for(var K=O.length,F=b(O,K),C=0;C<K;++C)e(F[C],this,T);return!0};function c(k,S,T,C){var _,P,R;if(a(T),P=k._events,P===void 0?(P=k._events=Object.create(null),k._eventsCount=0):(P.newListener!==void 0&&(k.emit("newListener",S,T.listener?T.listener:T),P=k._events),R=P[S]),R===void 0)R=P[S]=T,++k._eventsCount;else if(typeof R=="function"?R=P[S]=C?[T,R]:[R,T]:C?R.unshift(T):R.push(T),_=l(k),_>0&&R.length>_&&!R.warned){R.warned=!0;var A=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");A.name="MaxListenersExceededWarning",A.emitter=k,A.type=S,A.count=R.length,r(A)}return k}s.prototype.addListener=function(S,T){return c(this,S,T,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(S,T){return c(this,S,T,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(k,S,T){var C={fired:!1,wrapFn:void 0,target:k,type:S,listener:T},_=u.bind(C);return _.listener=T,C.wrapFn=_,_}s.prototype.once=function(S,T){return a(T),this.on(S,h(this,S,T)),this},s.prototype.prependOnceListener=function(S,T){return a(T),this.prependListener(S,h(this,S,T)),this},s.prototype.removeListener=function(S,T){var C,_,P,R,A;if(a(T),_=this._events,_===void 0)return this;if(C=_[S],C===void 0)return this;if(C===T||C.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete _[S],_.removeListener&&this.emit
vendor: 52,949 bytes, lines 374-408
374("removeListener",S,C.listener||T));else if(typeof C!="function"){for(P=-1,R=C.length-1;R>=0;R--)if(C[R]===T||C[R].listener===T){A=C[R].listener,P=R;break}if(P<0)return this;P===0?C.shift():p(C,P),C.length===1&&(_[S]=C[0]),_.removeListener!==void 0&&this.emit("removeListener",S,A||T)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(S){var T,C,_;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[S]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[S]),this;if(arguments.length===0){var P=Object.keys(C),R;for(_=0;_<P.length;++_)R=P[_],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(T=C[S],typeof T=="function")this.removeListener(S,T);else if(T!==void 0)for(_=T.length-1;_>=0;_--)this.removeListener(S,T[_]);return this};function f(k,S,T){var C=k._events;if(C===void 0)return[];var _=C[S];return _===void 0?[]:typeof _=="function"?T?[_.listener||_]:[_]:T?g(_):b(_,_.length)}s.prototype.listeners=function(S){return f(this,S,!0)},s.prototype.rawListeners=function(S){return f(this,S,!1)},s.listenerCount=function(k,S){return typeof k.listenerCount=="function"?k.listenerCount(S):m.call(k,S)},s.prototype.listenerCount=m;function m(k){var S=this._events;if(S!==void 0){var T=S[k];if(typeof T=="function")return 1;if(T!==void 0)return T.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function b(k,S){for(var T=new Array(S),C=0;C<S;++C)T[C]=k[C];return T}function p(k,S){for(;S+1<k.length;S++)k[S]=k[S+1];k.pop()}function g(k){for(var S=new Array(k.length),T=0;T<S.length;++T)S[T]=k[T].listener||k[T];return S}function v(k,S){return new Promise(function(T,C){function _(R){k.removeListener(S,P),C(R)}function P(){typeof k.removeListener=="function"&&k.removeListener("error",_),T([].slice.call(arguments))}w(k,S,P,{once:!0}),S!=="error"&&y(k,_,{once:!0})})}function y(k,S,T){typeof k.on=="function"&&w(k,"error",S,T)}function w(k,S,T,C){if(typeof k.on=="function")C.once?k.once(S,T):k.on(S,T);else if(typeof k.addEventListener=="function")k.addEventListener(S,function _(P){C.once&&k.removeEventListener(S,_),T(P)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof k)}return Hc.exports}var Tr=c3();let L1=!0,U1=!0;function nl(t,e,n){const r=t.match(e);return r&&r.length>=n&&parseFloat(r[n],10)}function Gs(t,e,n){if(!t.RTCPeerConnection)return;const r=t.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(o,a){if(o!==e)return i.apply(this,arguments);const l=c=>{const u=n(c);u&&(a.handleEvent?a.handleEvent(u):a(u))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,l),i.apply(this,[o,l])};const s=r.removeEventListener;r.removeEventListener=function(o,a){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(a))return s.apply(this,arguments);const l=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,l])},Object.defineProperty(r,"on"+e,{get(){return this["_on"+e]},set(o){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),o&&this.addEventListener(e,this["_on"+e]=o)},enumerable:!0,configurable:!0})}function u3(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(L1=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function d3(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(U1=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function F1(){if(typeof window=="object"){if(L1)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Vv(t,e){U1&&console.warn(t+" is deprecated, please use "+e+" instead.")}function h3(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:n}=t;if(n.userAgentData&&n.userAgentData.brands){const r=n.userAgentData.brands.find(i=>i.brand==="Chromium");if(r)return{browser:"chrome",version:parseInt(r.version,10)}}if(n.mozGetUserMedia)e.browser="firefox",e.version=parseInt(nl(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=parseInt(nl(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(t.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=parseInt(nl(n.userAgent,/AppleWebKit\/(\d+)\./,1)),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype,e._safariVersion=nl(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return e.browser="Not a supported browser.",e;return e}function Ub(t){return Object.prototype.toString.call(t)==="[object Object]"}function B1(t){return Ub(t)?Object.keys(t).reduce(function(e,n){const r=Ub(t[n]),i=r?B1(t[n]):t[n],s=r&&!Object.keys(i).length;return i===void 0||s?e:Object.assign(e,{[n]:i})},{}):t}function gp(t,e,n){!e||n.has(e.id)||(n.set(e.id,e),Object.keys(e).forEach(r=>{r.endsWith("Id")?gp(t,t.get(e[r]),n):r.endsWith("Ids")&&e[r].forEach(i=>{gp(t,t.get(i),n)})}))}function Fb(t,e,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const s=[];return t.forEach(o=>{o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(o=>{t.forEach(a=>{a.type===r&&a.trackId===o.id&&gp(t,a,i)})}),i}const Bb=F1;function z1(t,e){const n=t&&t.navigator;if(!n.mediaDevices)return;const r=function(a){if(typeof a!="object"||a.mandatory||a.optional)return a;const l={};return Object.keys(a).forEach(c=>{if(c==="require"||c==="advanced"||c==="mediaSource")return;const u=typeof a[c]=="object"?a[c]:{ideal:a[c]};u.exact!==void 0&&typeof u.exact=="number"&&(u.min=u.max=u.exact);const h=function(f,m){return f?f+m.charAt(0).toUpperCase()+m.slice(1):m==="deviceId"?"sourceId":m};if(u.ideal!==void 0){l.optional=l.optional||[];let f={};typeof u.ideal=="number"?(f[h("min",c)]=u.ideal,l.optional.push(f),f={},f[h("max",c)]=u.ideal,l.optional.push(f)):(f[h("",c)]=u.ideal,l.optional.push(f))}u.exact!==void 0&&typeof u.exact!="number"?(l.mandatory=l.mandatory||{},l.mandatory[h("",c)]=u.exact):["min","max"].forEach(f=>{u[f]!==void 0&&(l.mandatory=l.mandatory||{},l.mandatory[h(f,c)]=u[f])})}),a.advanced&&(l.optional=(l.optional||[]).concat(a.advanced)),l},i=function(a,l){if(e.version>=61)return l(a);if(a=JSON.parse(JSON.stringify(a)),a&&typeof a.audio=="object"){const c=function(u,h,f){h in u&&!(f in u)&&(u[f]=u[h],delete u[h])};a=JSON.parse(JSON.stringify(a)),c(a.audio,"autoGainControl","googAutoGainControl"),c(a.audio,"noiseSuppression","googNoiseSuppression"),a.audio=r(a.audio)}if(a&&typeof a.video=="object"){let c=a.video.facingMode;c=c&&(typeof c=="object"?c:{ideal:c});const u=e.version<66;if(c&&(c.exact==="user"||c.exact==="environment"||c.ideal==="user"||c.ideal==="environment")&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!u)){delete a.video.facingMode;let h;if(c.exact==="environment"||c.ideal==="environment"?h=["back","rear"]:(c.exact==="user"||c.ideal==="user")&&(h=["front"]),h)return n.mediaDevices.enumerateDevices().then(f=>{f=f.filter(b=>b.kind==="videoinput");let m=f.find(b=>h.some(p=>b.label.toLowerCase().includes(p)));return!m&&f.length&&h.includes("back")&&(m=f[f.length-1]),m&&(a.video.deviceId=c.exact?{exact:m.deviceId}:{ideal:m.deviceId}),a.video=r(a.video),Bb("chrome: "+JSON.stringify(a)),l(a)})}a.video=r(a.video)}return Bb("chrome: "+JSON.stringify(a)),l(a)},s=function(a){return e.version>=64?a:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[a.name]||a.name,message:a.message,constraint:a.constraint||a.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},o=function(a,l,c){i(a,u=>{n.webkitGetUserMedia(u,l,h=>{c&&c(s(h))})})};if(n.getUserMedia=o.bind(n),n.mediaDevices.getUserMedia){const a=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(l){return i(l,c=>a(c).then(u=>{if(c.audio&&!u.getAudioTracks().length||c.video&&!u.getVideoTracks().length)throw u.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return u},u=>Promise.reject(s(u))))}}}function $1(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function V1(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(n){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=n)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=r=>{r.stream.addEventListener("addtrack",i=>{let s;t.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===i.track.id):s={track:i.track};const o=new Event("track");o.track=i.track,o.receiver=s,o.transceiver={receiver:s},o.streams=[r.stream],this.dispatchEvent(o)}),r.stream.getTracks().forEach(i=>{let s;t.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===i.id):s={track:i};const o=new Event("track");o.track=i,o.receiver=s,o.transceiver={receiver:s},o.streams=[r.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else Gs(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function W1(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(i,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=i.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:i}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(a,l){let c=i.apply(this,arguments);return c||(c=e(this,a),this._senders.push(c)),c};const s=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(a){s.apply(this,arguments);const l=this._senders.indexOf(a);l!==-1&&this._senders.splice(l,1)}}const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],n.apply(this,[s]),s.getTracks().forEach(o=>{this._senders.push(e(this,o))})};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],r.apply(this,[s]),s.getTracks().forEach(o=>{const a=this._senders.find(l=>l.track===o);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const r=e.apply(this,[]);return r.forEach(i=>i._pc=this),r},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function q1(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const n=t.RTCPeerConnection.prototype.getSenders;n&&(t.RTCPeerConnection.prototype.getSenders=function(){const s=n.apply(this,[]);return s.forEach(o=>o._pc=this),s});const r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){const s=r.apply(this,arguments);return s._pc=this,s}),t.RTCRtpSender.prototype.getStats=function(){const s=this;return this._pc.getStats().then(o=>Fb(o,s.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const n=t.RTCPeerConnection.prototype.getReceivers;n&&(t.RTCPeerConnection.prototype.getReceivers=function(){const i=n.apply(this,[]);return i.forEach(s=>s._pc=this),i}),Gs(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(s=>Fb(s,i.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const r=arguments[0];let i,s,o;return this.getSenders().forEach(a=>{a.track===r&&(i?o=!0:i=a)}),this.getReceivers().forEach(a=>(a.track===r&&(s?o=!0:s=a),a.track===r)),o||i&&s?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():s?s.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function H1(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(o,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const l=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(l)===-1&&this._shimmedLocalStreams[a.id].push(l):this._shimmedLocalStreams[a.id]=[a,l],l};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(c=>{if(this.getSenders().find(h=>h.track===c))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();n.apply(this,arguments);const l=this.getSenders().filter(c=>a.indexOf(c)===-1);this._shimmedLocalStreams[o.id]=[o].concat(l)};const r=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],r.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const l=this._shimmedLocalStreams[a].indexOf(o);l!==-1&&this._shimmedLocalStreams[a].splice(l,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),i.apply(this,arguments)}}function K1(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return H1(t);const n=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const u=n.apply(this);return this._reverseStreams=this._reverseStreams||{},u.map(h=>this._reverseStreams[h.id])};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(u){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},u.getTracks().forEach(h=>{if(this.getSenders().find(m=>m.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[u.id]){const h=new t.MediaStream(u.getTracks());this._streams[u.id]=h,this._reverseStreams[h.id]=u,u=h}r.apply(this,[u])};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(u){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[u.id]||u]),delete this._reverseStreams[this._streams[u.id]?this._streams[u.id].id:u.id],delete this._streams[u.id]},t.RTCPeerConnection.prototype.addTrack=function(u,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const f=[].slice.call(arguments,1);if(f.length!==1||!f[0].getTracks().find(p=>p===u))throw new DOMException("The adapter.js addTrack polyfill only supports a single  stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(p=>p.track===u))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const b=this._streams[h.id];if(b)b.addTrack(u),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const p=new t.MediaStream([u]);this._streams[h.id]=p,this._reverseStreams[p.id]=h,this.addStream(p)}return this.getSenders().find(p=>p.track===u)};function s(c,u){let h=u.sdp;return Object.keys(c._reverseStreams||[]).forEach(f=>{const m=c._reverseStreams[f],b=c._streams[m.id];h=h.replace(new RegExp(b.id,"g"),m.id)}),new RTCSessionDescription({type:u.type,sdp:h})}function o(c,u){let h=u.sdp;return Object.keys(c._reverseStreams||[]).forEach(f=>{const m=c._reverseStreams[f],b=c._streams[m.id];h=h.replace(new RegExp(m.id,"g"),b.id)}),new RTCSessionDescription({type:u.type,sdp:h})}["createOffer","createAnswer"].forEach(function(c){const u=t.RTCPeerConnection.prototype[c],h={[c](){const f=arguments;return arguments.length&&typeof arguments[0]=="function"?u.apply(this,[b=>{const p=s(this,b);f[0].apply(null,[p])},b=>{f[1]&&f[1].apply(null,b)},arguments[2]]):u.apply(this,arguments).then(b=>s(this,b))}};t.RTCPeerConnection.prototype[c]=h[c]});const a=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?a.apply(this,arguments):(arguments[0]=o(this,arguments[0]),a.apply(this,arguments))};const l=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const c=l.get.apply(this);return c.type===""?c:s(this,c)}}),t.RTCPeerConnection.prototype.removeTrack=function(u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!u._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(u._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let f;Object.keys(this._streams).forEach(m=>{this._streams[m].getTracks().find(p=>u.track===p)&&(f=this._streams[m])}),f&&(f.getTracks().length===1?this.removeStream(this._reverseStreams[f.id]):f.removeTrack(u.track),this.dispatchEvent(new Event("negotiationneeded")))}}function vp(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){const r=t.RTCPeerConnection.prototype[n],i={[n](){return arguments[0]=new(n==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};t.RTCPeerConnection.prototype[n]=i[n]})}function G1(t,e){Gs(t,"negotiationneeded",n=>{const r=n.target;if(!((e.version<72||r.getConfiguration&&r.getConfiguration().sdpSemantics==="plan-b")&&r.signalingState!=="stable"))return n})}var zb=Object.freeze({__proto__:null,fixNegotiationNeeded:G1,shimAddTrackRemoveTrack:K1,shimAddTrackRemoveTrackWithNative:H1,shimGetSendersWithDtmf:W1,shimGetUserMedia:z1,shimMediaStream:$1,shimOnTrack:V1,shimPeerConnection:vp,shimSenderReceiverGetStats:q1});function J1(t,e){const n=t&&t.navigator,r=t&&t.MediaStreamTrack;if(n.getUserMedia=function(i,s,o){Vv("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(i).then(s,o)},!(e.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const i=function(o,a,l){a in o&&!(l in o)&&(o[l]=o[a],delete o[a])},s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(o){return typeof o=="object"&&typeof o.audio=="object"&&(o=JSON.parse(JSON.stringify(o)),i(o.audio,"autoGainControl","mozAutoGainControl"),i(o.audio,"noiseSuppression","mozNoiseSuppression")),s(o)},r&&r.prototype.getSettings){const o=r.prototype.getSettings;r.prototype.getSettings=function(){const a=o.apply(this,arguments);return i(a,"mozAutoGainControl","autoGainControl"),i(a,"mozNoiseSuppression","noiseSuppression"),a}}if(r&&r.prototype.applyConstraints){const o=r.prototype.applyConstraints;r.prototype.applyConstraints=function(a){return this.kind==="audio"&&typeof a=="object"&&(a=JSON.parse(JSON.stringify(a)),i(a,"autoGainControl","mozAutoGainControl"),i(a,"noiseSuppression","mozNoiseSuppression")),o.apply(this,[a])}}}}function f3(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(r){if(!(r&&r.video)){const i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return r.video===!0?r.video={mediaSource:e}:r.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(r)})}function Y1(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function yp(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const s=t.RTCPeerConnection.prototype[i],o={[i](){return arguments[0]=new(i==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),s.apply(this,arguments)}};t.RTCPeerConnection.prototype[i]=o[i]});const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[s,o,a]=arguments;return r.apply(this,[s||null]).then(l=>{if(e.version<53&&!o)try{l.forEach(c=>{c.type=n[c.type]||c.type})}catch(c){if(c.name!=="TypeError")throw c;l.forEach((u,h)=>{l.set(h,Object.assign({},u,{type:n[u.type]||u.type}))})}return l}).then(o,a)}}function Q1(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(s=>s._pc=this),i});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const i=n.apply(this,arguments);return i._pc=this,i}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function X1(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const r=e.apply(this,[]);return r.forEach(i=>i._pc=this),r}),Gs(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Z1(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){Vv("removeStream","removeTrack"),this.getSenders().forEach(r=>{r.track&&n.getTracks().includes(r.track)&&this.removeTrack(r)})})}function eE(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function tE(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let r=arguments[1]&&arguments[1].sendEncodings;r===void 0&&(r=[]),r=[...r];const i=r.length>0;i&&r.forEach(o=>{if("rid"in o&&!/^[a-z0-9]{0,16}$/i.test(o.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in o&&!(parseFloat(o.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in o&&!(parseFloat(o.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const s=e.apply(this,arguments);if(i){const{sender:o}=s,a=o.getParameters();(!("encodings"in a)||a.encodings.length===1&&Object.keys(a.encodings[0]).length===0)&&(a.encodings=r,o.sendEncodings=r,this.setParametersPromises.push(o.setParameters(a).then(()=>{delete o.sendEncodings}).catch(()=>{delete o.sendEncodings})))}return s})}function nE(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const r=e.apply(this,arguments);return"encodings"in r||(r.encodings=[].concat(this.sendEncodings||[{}])),r})}function rE(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function iE(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var $b=Object.freeze({__proto__:null,shimAddTransceiver:tE,shimCreateAnswer:iE,shimCreateOffer:rE,shimGetDisplayMedia:f3,shimGetParameters:nE,shimGetUserMedia:J1,shimOnTrack:Y1,shimPeerConnection:yp,shimRTCDataChannel:eE,shimReceiverGetStats:X1,shimRemoveStream:Z1,shimSenderGetStats:Q1});function sE(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(r){this._localStreams||(this._localStreams=[]),this._localStreams.includes(r)||this._localStreams.push(r),r.getAudioTracks().forEach(i=>e.call(this,i,r)),r.getVideoTracks().forEach(i=>e.call(this,i,r))},t.RTCPeerConnection.prototype.addTrack=function(r){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];return s&&s.forEach(a=>{this._localStreams?this._localStreams.includes(a)||this._localStreams.push(a):this._localStreams=[a]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(n){this._localStreams||(this._localStreams=[]);const r=this._localStreams.indexOf(n);if(r===-1)return;this._localStreams.splice(r,1);const i=n.getTracks();this.getSenders().forEach(s=>{i.includes(s.track)&&this.removeTrack(s)})})}}function oE(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(n){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=n),this.addEventListener("track",this._onaddstreampoly=r=>{r.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const s=new Event("addstream");s.stream=i,this.dispatchEvent(s)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const r=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(s=>{if(r._remoteStreams||(r._remoteStreams=[]),r._remoteStreams.indexOf(s)>=0)return;r._remoteStreams.push(s);const o=new Event("addstream");o.stream=s,r.dispatchEvent(o)})}),e.apply(r,arguments)}}}function aE(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,n=e.createOffer,r=e.createAnswer,i=e.setLocalDescription,s=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(c,u){const h=arguments.length>=2?arguments[2]:arguments[0],f=n.apply(this,[h]);return u?(f.then(c,u),Promise.resolve()):f},e.createAnswer=function(c,u){const h=arguments.length>=2?arguments[2]:arguments[0],f=r.apply(this,[h]);return u?(f.then(c,u),Promise.resolve()):f};let a=function(l,c,u){const h=i.apply(this,[l]);return u?(h.then(c,u),Promise.resolve()):h};e.setLocalDescription=a,a=function(l,c,u){const h=s.apply(this,[l]);return u?(h.then(c,u),Promise.resolve()):h},e.setRemoteDescription=a,a=function(l,c,u){const h=o.apply(this,[l]);return u?(h.then(c,u),Promise.resolve()):h},e.addIceCandidate=a}function lE(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const n=e.mediaDevices,r=n.getUserMedia.bind(n);e.mediaDevices.getUserMedia=i=>r(cE(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(r,i,s){e.mediaDevices.getUserMedia(r).then(i,s)}).bind(e))}function cE(t){return t&&t.video!==void 0?Object.assign({},t,{video:B1(t.video)}):t}function uE(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(r,i){if(r&&r.iceServers){const s=[];for(let o=0;o<r.iceServers.length;o++){let a=r.iceServers[o];a.urls===void 0&&a.url?(Vv("RTCIceServer.url","RTCIceServer.urls"),a=JSON.parse(JSON.stringify(a)),a.urls=a.url,delete a.url,s.push(a)):s.push(r.iceServers[o])}r.iceServers=s}return new e(r,i)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function dE(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function hE(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(r){if(r){typeof r.offerToReceiveAudio<"u"&&(r.offerToReceiveAudio=!!r.offerToReceiveAudio);const i=this.getTransceivers().find(o=>o.receiver.track.kind==="audio");r.offerToReceiveAudio===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):r.offerToReceiveAudio===!0&&!i&&this.addTransceiver("audio",{direction:"recvonly"}),typeof r.offerToReceiveVideo<"u"&&(r.offerToReceiveVideo=!!r.offerToReceiveVideo);const s=this.getTransceivers().find(o=>o.receiver.track.kind==="video");r.offerToReceiveVideo===!1&&s?s.direction==="sendrecv"?s.setDirection?s.setDirection("sendonly"):s.direction="sendonly":s.direction==="recvonly"&&(s.setDirection?s.setDirection("inactive"):s.direction="inactive"):r.offerToReceiveVideo===!0&&!s&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function fE(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var Vb=Object.freeze({__proto__:null,shimAudioContext:fE,shimCallbacksAPI:aE,shimConstraints:cE,shimCreateOfferLegacy:hE,shimGetUserMedia:lE,shimLocalStreamsAPI:sE,shimRTCIceServerUrls:uE,shimRemoteStreamsAPI:oE,shimTrackEventTransceiver:dE}),yf={exports:{}},Wb;function m3(){return Wb||(Wb=1,function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(n){return n.trim().split(`
375`).map(r=>r.trim())},e.splitSections=function(n){return n.split(`
376m=`).map((i,s)=>(s>0?"m="+i:i).trim()+`\r
377`)},e.getDescription=function(n){const r=e.splitSections(n);return r&&r[0]},e.getMediaSections=function(n){const r=e.splitSections(n);return r.shift(),r},e.matchPrefix=function(n,r){return e.splitLines(n).filter(i=>i.indexOf(r)===0)},e.parseCandidate=function(n){let r;n.indexOf("a=candidate:")===0?r=n.substring(12).split(" "):r=n.substring(10).split(" ");const i={foundation:r[0],component:{1:"rtp",2:"rtcp"}[r[1]]||r[1],protocol:r[2].toLowerCase(),priority:parseInt(r[3],10),ip:r[4],address:r[4],port:parseInt(r[5],10),type:r[7]};for(let s=8;s<r.length;s+=2)switch(r[s]){case"raddr":i.relatedAddress=r[s+1];break;case"rport":i.relatedPort=parseInt(r[s+1],10);break;case"tcptype":i.tcpType=r[s+1];break;case"ufrag":i.ufrag=r[s+1],i.usernameFragment=r[s+1];break;default:i[r[s]]===void 0&&(i[r[s]]=r[s+1]);break}return i},e.writeCandidate=function(n){const r=[];r.push(n.foundation);const i=n.component;i==="rtp"?r.push(1):i==="rtcp"?r.push(2):r.push(i),r.push(n.protocol.toUpperCase()),r.push(n.priority),r.push(n.address||n.ip),r.push(n.port);const s=n.type;return r.push("typ"),r.push(s),s!=="host"&&n.relatedAddress&&n.relatedPort&&(r.push("raddr"),r.push(n.relatedAddress),r.push("rport"),r.push(n.relatedPort)),n.tcpType&&n.protocol.toLowerCase()==="tcp"&&(r.push("tcptype"),r.push(n.tcpType)),(n.usernameFragment||n.ufrag)&&(r.push("ufrag"),r.push(n.usernameFragment||n.ufrag)),"candidate:"+r.join(" ")},e.parseIceOptions=function(n){return n.substring(14).split(" ")},e.parseRtpMap=function(n){let r=n.substring(9).split(" ");const i={payloadType:parseInt(r.shift(),10)};return r=r[0].split("/"),i.name=r[0],i.clockRate=parseInt(r[1],10),i.channels=r.length===3?parseInt(r[2],10):1,i.numChannels=i.channels,i},e.writeRtpMap=function(n){let r=n.payloadType;n.preferredPayloadType!==void 0&&(r=n.preferredPayloadType);const i=n.channels||n.numChannels||1;return"a=rtpmap:"+r+" "+n.name+"/"+n.clockRate+(i!==1?"/"+i:"")+`\r
378`},e.parseExtmap=function(n){const r=n.substring(9).split(" ");return{id:parseInt(r[0],10),direction:r[0].indexOf("/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1],attributes:r.slice(2).join(" ")}},e.writeExtmap=function(n){return"a=extmap:"+(n.id||n.preferredId)+(n.direction&&n.direction!=="sendrecv"?"/"+n.direction:"")+" "+n.uri+(n.attributes?" "+n.attributes:"")+`\r
379`},e.parseFmtp=function(n){const r={};let i;const s=n.substring(n.indexOf(" ")+1).split(";");for(let o=0;o<s.length;o++)i=s[o].trim().split("="),r[i[0].trim()]=i[1];return r},e.writeFmtp=function(n){let r="",i=n.payloadType;if(n.preferredPayloadType!==void 0&&(i=n.preferredPayloadType),n.parameters&&Object.keys(n.parameters).length){const s=[];Object.keys(n.parameters).forEach(o=>{n.parameters[o]!==void 0?s.push(o+"="+n.parameters[o]):s.push(o)}),r+="a=fmtp:"+i+" "+s.join(";")+`\r
380`}return r},e.parseRtcpFb=function(n){const r=n.substring(n.indexOf(" ")+1).split(" ");return{type:r.shift(),parameter:r.join(" ")}},e.writeRtcpFb=function(n){let r="",i=n.payloadType;return n.preferredPayloadType!==void 0&&(i=n.preferredPayloadType),n.rtcpFeedback&&n.rtcpFeedback.length&&n.rtcpFeedback.forEach(s=>{r+="a=rtcp-fb:"+i+" "+s.type+(s.parameter&&s.parameter.length?" "+s.parameter:"")+`\r
381`}),r},e.parseSsrcMedia=function(n){const r=n.indexOf(" "),i={ssrc:parseInt(n.substring(7,r),10)},s=n.indexOf(":",r);return s>-1?(i.attribute=n.substring(r+1,s),i.value=n.substring(s+1)):i.attribute=n.substring(r+1),i},e.parseSsrcGroup=function(n){const r=n.substring(13).split(" ");return{semantics:r.shift(),ssrcs:r.map(i=>parseInt(i,10))}},e.getMid=function(n){const r=e.matchPrefix(n,"a=mid:")[0];if(r)return r.substring(6)},e.parseFingerprint=function(n){const r=n.substring(14).split(" ");return{algorithm:r[0].toLowerCase(),value:r[1].toUpperCase()}},e.getDtlsParameters=function(n,r){return{role:"auto",fingerprints:e.matchPrefix(n+r,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(n,r){let i="a=setup:"+r+`\r
382`;return n.fingerprints.forEach(s=>{i+="a=fingerprint:"+s.algorithm+" "+s.value+`\r
383`}),i},e.parseCryptoLine=function(n){const r=n.substring(9).split(" ");return{tag:parseInt(r[0],10),cryptoSuite:r[1],keyParams:r[2],sessionParams:r.slice(3)}},e.writeCryptoLine=function(n){return"a=crypto:"+n.tag+" "+n.cryptoSuite+" "+(typeof n.keyParams=="object"?e.writeCryptoKeyParams(n.keyParams):n.keyParams)+(n.sessionParams?" "+n.sessionParams.join(" "):"")+`\r
384`},e.parseCryptoKeyParams=function(n){if(n.indexOf("inline:")!==0)return null;const r=n.substring(7).split("|");return{keyMethod:"inline",keySalt:r[0],lifeTime:r[1],mkiValue:r[2]?r[2].split(":")[0]:void 0,mkiLength:r[2]?r[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(n){return n.keyMethod+":"+n.keySalt+(n.lifeTime?"|"+n.lifeTime:"")+(n.mkiValue&&n.mkiLength?"|"+n.mkiValue+":"+n.mkiLength:"")},e.getCryptoParameters=function(n,r){return e.matchPrefix(n+r,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(n,r){const i=e.matchPrefix(n+r,"a=ice-ufrag:")[0],s=e.matchPrefix(n+r,"a=ice-pwd:")[0];return i&&s?{usernameFragment:i.substring(12),password:s.substring(10)}:null},e.writeIceParameters=function(n){let r="a=ice-ufrag:"+n.usernameFragment+`\r
385a=ice-pwd:`+n.password+`\r
386`;return n.iceLite&&(r+=`a=ice-lite\r
387`),r},e.parseRtpParameters=function(n){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},s=e.splitLines(n)[0].split(" ");r.profile=s[2];for(let a=3;a<s.length;a++){const l=s[a],c=e.matchPrefix(n,"a=rtpmap:"+l+" ")[0];if(c){const u=e.parseRtpMap(c),h=e.matchPrefix(n,"a=fmtp:"+l+" ");switch(u.parameters=h.length?e.parseFmtp(h[0]):{},u.rtcpFeedback=e.matchPrefix(n,"a=rtcp-fb:"+l+" ").map(e.parseRtcpFb),r.codecs.push(u),u.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(u.name.toUpperCase());break}}}e.matchPrefix(n,"a=extmap:").forEach(a=>{r.headerExtensions.push(e.parseExtmap(a))});const o=e.matchPrefix(n,"a=rtcp-fb:* ").map(e.parseRtcpFb);return r.codecs.forEach(a=>{o.forEach(l=>{a.rtcpFeedback.find(u=>u.type===l.type&&u.parameter===l.parameter)||a.rtcpFeedback.push(l)})}),r},e.writeRtpDescription=function(n,r){let i="";i+="m="+n+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map(o=>o.preferredPayloadType!==void 0?o.preferredPayloadType:o.payloadType).join(" ")+`\r
388`,i+=`c=IN IP4 0.0.0.0\r
389`,i+=`a=rtcp:9 IN IP4 0.0.0.0\r
390`,r.codecs.forEach(o=>{i+=e.writeRtpMap(o),i+=e.writeFmtp(o),i+=e.writeRtcpFb(o)});let s=0;return r.codecs.forEach(o=>{o.maxptime>s&&(s=o.maxptime)}),s>0&&(i+="a=maxptime:"+s+`\r
391`),r.headerExtensions&&r.headerExtensions.forEach(o=>{i+=e.writeExtmap(o)}),i},e.parseRtpEncodingParameters=function(n){const r=[],i=e.parseRtpParameters(n),s=i.fecMechanisms.indexOf("RED")!==-1,o=i.fecMechanisms.indexOf("ULPFEC")!==-1,a=e.matchPrefix(n,"a=ssrc:").map(f=>e.parseSsrcMedia(f)).filter(f=>f.attribute==="cname"),l=a.length>0&&a[0].ssrc;let c;const u=e.matchPrefix(n,"a=ssrc-group:FID").map(f=>f.substring(17).split(" ").map(b=>parseInt(b,10)));u.length>0&&u[0].length>1&&u[0][0]===l&&(c=u[0][1]),i.codecs.forEach(f=>{if(f.name.toUpperCase()==="RTX"&&f.parameters.apt){let m={ssrc:l,codecPayloadType:parseInt(f.parameters.apt,10)};l&&c&&(m.rtx={ssrc:c}),r.push(m),s&&(m=JSON.parse(JSON.stringify(m)),m.fec={ssrc:l,mechanism:o?"red+ulpfec":"red"},r.push(m))}}),r.length===0&&l&&r.push({ssrc:l});let h=e.matchPrefix(n,"b=");return h.length&&(h[0].indexOf("b=TIAS:")===0?h=parseInt(h[0].substring(7),10):h[0].indexOf("b=AS:")===0?h=parseInt(h[0].substring(5),10)*1e3*.95-50*40*8:h=void 0,r.forEach(f=>{f.maxBitrate=h})),r},e.parseRtcpParameters=function(n){const r={},i=e.matchPrefix(n,"a=ssrc:").map(a=>e.parseSsrcMedia(a)).filter(a=>a.attribute==="cname")[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);const s=e.matchPrefix(n,"a=rtcp-rsize");r.reducedSize=s.length>0,r.compound=s.length===0;const o=e.matchPrefix(n,"a=rtcp-mux");return r.mux=o.length>0,r},e.writeRtcpParameters=function(n){let r="";return n.reducedSize&&(r+=`a=rtcp-rsize\r
392`),n.mux&&(r+=`a=rtcp-mux\r
393`),n.ssrc!==void 0&&n.cname&&(r+="a=ssrc:"+n.ssrc+" cname:"+n.cname+`\r
394`),r},e.parseMsid=function(n){let r;const i=e.matchPrefix(n,"a=msid:");if(i.length===1)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};const s=e.matchPrefix(n,"a=ssrc:").map(o=>e.parseSsrcMedia(o)).filter(o=>o.attribute==="msid");if(s.length>0)return r=s[0].value.split(" "),{stream:r[0],track:r[1]}},e.parseSctpDescription=function(n){const r=e.parseMLine(n),i=e.matchPrefix(n,"a=max-message-size:");let s;i.length>0&&(s=parseInt(i[0].substring(19),10)),isNaN(s)&&(s=65536);const o=e.matchPrefix(n,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:r.fmt,maxMessageSize:s};const a=e.matchPrefix(n,"a=sctpmap:");if(a.length>0){const l=a[0].substring(10).split(" ");return{port:parseInt(l[0],10),protocol:l[1],maxMessageSize:s}}},e.writeSctpDescription=function(n,r){let i=[];return n.protocol!=="DTLS/SCTP"?i=["m="+n.kind+" 9 "+n.protocol+" "+r.protocol+`\r
395`,`c=IN IP4 0.0.0.0\r
396`,"a=sctp-port:"+r.port+`\r
397`]:i=["m="+n.kind+" 9 "+n.protocol+" "+r.port+`\r
398`,`c=IN IP4 0.0.0.0\r
399`,"a=sctpmap:"+r.port+" "+r.protocol+` 65535\r
400`],r.maxMessageSize!==void 0&&i.push("a=max-message-size:"+r.maxMessageSize+`\r
401`),i.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,22)},e.writeSessionBoilerplate=function(n,r,i){let s;const o=r!==void 0?r:2;return n?s=n:s=e.generateSessionId(),`v=0\r
402o=`+(i||"thisisadapterortc")+" "+s+" "+o+` IN IP4 127.0.0.1\r
403s=-\r
404t=0 0\r
405`},e.getDirection=function(n,r){const i=e.splitLines(n);for(let s=0;s<i.length;s++)switch(i[s]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[s].substring(2)}return r?e.getDirection(r):"sendrecv"},e.getKind=function(n){return e.splitLines(n)[0].split(" ")[0].substring(2)},e.isRejected=function(n){return n.split(" ",2)[1]==="0"},e.parseMLine=function(n){const i=e.splitLines(n)[0].substring(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},e.parseOLine=function(n){const i=e.matchPrefix(n,"o=")[0].substring(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},e.isValidSDP=function(n){if(typeof n!="string"||n.length===0)return!1;const r=e.splitLines(n);for(let i=0;i<r.length;i++)if(r[i].length<2||r[i].charAt(1)!=="=")return!1;return!0},t.exports=e}(yf)),yf.exports}var mE=m3(),Wo=n3(mE),p3=y2({__proto__:null,default:Wo},[mE]);function Pu(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(r){if(typeof r=="object"&&r.candidate&&r.candidate.indexOf("a=")===0&&(r=JSON.parse(JSON.stringify(r)),r.candidate=r.candidate.substring(2)),r.candidate&&r.candidate.length){const i=new e(r),s=Wo.parseCandidate(r.candidate);for(const o in s)o in i||Object.defineProperty(i,o,{value:s[o]});return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(r)},t.RTCIceCandidate.prototype=e.prototype,Gs(t,"icecandidate",n=>(n.candidate&&Object.defineProperty(n,"candidate",{value:new t.RTCIceCandidate(n.candidate),writable:"false"}),n))}function bp(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||Gs(t,"icecandidate",e=>{if(e.candidate){const n=Wo.parseCandidate(e.candidate.candidate);n.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[n.priority>>24])}return e})}function Ru(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const n=function(a){if(!a||!a.sdp)return!1;const l=Wo.splitSections(a.sdp);return l.shift(),l.some(c=>{const u=Wo.parseMLine(c);return u&&u.kind==="application"&&u.protocol.indexOf("SCTP")!==-1})},r=function(a){const l=a.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(l===null||l.length<2)return-1;const c=parseInt(l[1],10);return c!==c?-1:c},i=function(a){let l=65536;return e.browser==="firefox"&&(e.version<57?a===-1?l=16384:l=2147483637:e.version<60?l=e.version===57?65535:65536:l=2147483637),l},s=function(a,l){let c=65536;e.browser==="firefox"&&e.version===57&&(c=65535);const u=Wo.matchPrefix(a.sdp,"a=max-message-size:");return u.length>0?c=parseInt(u[0].substring(19),10):e.browser==="firefox"&&l!==-1&&(c=2147483637),c},o=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:l}=this.getConfiguration();l==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const l=r(arguments[0]),c=i(l),u=s(arguments[0],l);let h;c===0&&u===0?h=Number.POSITIVE_INFINITY:c===0||u===0?h=Math.max(c,u):h=Math.min(c,u);const f={};Object.defineProperty(f,"maxMessageSize",{get(){return h}}),this._sctp=f}return o.apply(this,arguments)}}function Iu(t){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype))return;function e(r,i){const s=r.send;r.send=function(){const a=arguments[0],l=a.length||a.size||a.byteLength;if(r.readyState==="open"&&i.sctp&&l>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return s.apply(r,arguments)}}const n=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const i=n.apply(this,arguments);return e(i,this),i},Gs(t,"datachannel",r=>(e(r.channel,r.target),r))}function wp(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(n){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),n&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=n)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(n=>{const r=e[n];e[n]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const s=i.target;if(s._lastConnectionState!==s.connectionState){s._lastConnectionState=s.connectionState;const o=new Event("connectionstatechange",i);s.dispatchEvent(o)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function xp(t,e){if(!t.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e._safariVersion>=13.1)return;const n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(i){if(i&&i.sdp&&i.sdp.indexOf(`
406a=extmap-allow-mixed`)!==-1){const s=i.sdp.split(`
407`).filter(o=>o.trim()!=="a=extmap-allow-mixed").join(`
408`);t.RTCSessionDescription&&i instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:i.type,sdp:s}):i.sdp=s}return n.apply(this,arguments)}}function Nu(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Au(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const n=t.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let i=arguments[0]||{};if(typeof i!="object"||i.type&&i.sdp)return n.apply(this,arguments);if(i={type:i.type,sdp:i.sdp},!i.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer";break}return i.sdp||i.type!=="offer"&&i.type!=="answer"?n.apply(this,[i]):(i.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(o=>n.apply(this,[o]))})}var g3=Object.freeze({__proto__:null,removeExtmapAllowMixed:xp,shimAddIceCandidateNullOrEmpty:Nu,shimConnectionState:wp,shimMaxMessageSize:Ru,shimParameterlessSetLocalDescription:Au,shimRTCIceCandidate:Pu,shimRTCIceCandidateRelayProtocol:bp,shimSendThrowTypeError:Iu});function v3(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const n=F1,r=h3(t),i={browserDetails:r,commonShim:g3,extractVersion:nl,disableLog:u3,disableWarnings:d3,sdp:p3};switch(r.browser){case"chrome":if(!zb||!vp||!e.shimChrome)return n("Chrome shim is not included in this adapter release."),i;if(r.version===null)return n("Chrome shim can not determine version, not shimming."),i;n("adapter.js shimming chrome."),i.browserShim=zb,Nu(t,r),Au(t),z1(t,r),$1(t),vp(t,r),V1(t),K1(t,r),W1(t),q1(t),G1(t,r),Pu(t),bp(t),wp(t),Ru(t,r),Iu(t),xp(t,r);break;case"firefox":if(!$b||!yp||!e.shimFirefox)return n("Firefox shim is not included in this adapter release."),i;n("adapter.js shimming firefox."),i.browserShim=$b,Nu(t,r),Au(t),J1(t,r),yp(t,r),Y1(t),Z1(t),Q1(t),X1(t),eE(t),tE(t),nE(t),rE(t),iE(t),Pu(t),wp(t),Ru(t,r),Iu(t);break;case"safari":if(!Vb||!e.shimSafari)return n("Safari shim is not included in this adapter release."),i;n("adapter.js shimming safari."),i.browserShim=Vb,Nu(t,r),Au(t),uE(t),hE(t),aE(t),sE(t),oE(t),dE(t),lE(t),fE(t),Pu(t),bp(t),Ru(t,r),Iu(t),xp(t,r);break;default:n("Unsupported browser!");break}return i}v3({window:typeof window>"u"?void 0:window});var kp,pE;class Nt extends(pE=Promise){constructor(e){super(e)}catch(e){return super.catch(e)}static reject(e){return super.reject(e)}static all(e){return super.all(e)}static race(e){return super.race(e)}}kp=Nt;Nt.resolve=t=>Reflect.get(pE,"resolve",kp).call(kp,t);const y3=/version\/(\d+(\.?_?\d+)+)/i;let bf;function Qt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const n=navigator.userAgent.toLowerCase();if(bf===void 0||e){const r=b3.find(i=>{let{test:s}=i;return s.test(n)});bf=r==null?void 0:r.describe(n)}return bf}const b3=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:Ou(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:wf(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:Ou(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:wf(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:Ou(y3,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:wf(t)}}}];function Ou(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const r=e.match(t);return r&&r.length>=n&&r[n]||""}function wf(t){return t.includes("mac os")?Ou(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var w3="2.17.2";const x3=w3,k3=16;
408class Yi extends Error{constructor(e,n,r){super(n||"an error has occurred"),this.name="LiveKitError",this.code=e,typeof(r==null?void 0:r.cause)<"u"&&(this.cause=r==null?void 0:r.cause)}}class Wv extends Yi{}var Ae;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.ServerUnreachable=1]="ServerUnreachable",t[t.InternalError=2]="InternalError",t[t.Cancelled=3]="Cancelled",t[t.LeaveRequest=4]="LeaveRequest",t[t.Timeout=5]="Timeout",t[t.WebSocket=6]="WebSocket",t[t.ServiceNotFound=7]="ServiceNotFound"})(Ae||(Ae={}));class re extends Wv{constructor(e,n,r,i){super(1,e),this.name="ConnectionError",this.status=r,this.reason=n,this.context=i,this.reasonName=Ae[n]}static notAllowed(e,n,r){return new re(e,Ae.NotAllowed,n,r)}static timeout(e){return new re(e,Ae.Timeout)}static leaveRequest(e,n){return new re(e,Ae.LeaveRequest,void 0,n)}static internal(e,n){return new re(e,Ae.InternalError,void 0,n)}static cancelled(e){return new re(e,Ae.Cancelled)}static serverUnreachable(e,n){return new re(e,Ae.ServerUnreachable,n)}static websocket(e,n,r){return new re(e,Ae.WebSocket,n,r)}static serviceNotFound(e,n){return new re(e,Ae.ServiceNotFound,void 0,n)}}class qv extends Yi{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class Fr extends Yi{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class S3 extends Yi{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class tt extends Yi{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class Ps extends Yi{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class qb extends Yi{constructor(e,n){super(15,e),this.name="PublishTrackError",this.status=n}}class Hb extends Wv{constructor(e,n){super(15,e),this.name="SignalRequestError",this.reason=n,this.reasonName=typeof n=="string"?n:$v[n]}}var jt;(function(t){t[t.AlreadyOpened=0]="AlreadyOpened",t[t.AbnormalEnd=1]="AbnormalEnd",t[t.DecodeFailed=2]="DecodeFailed",t[t.LengthExceeded=3]="LengthExceeded",t[t.Incomplete=4]="Incomplete",t[t.HandlerAlreadyRegistered=7]="HandlerAlreadyRegistered",t[t.EncryptionTypeMismatch=8]="EncryptionTypeMismatch"})(jt||(jt={}));class gn extends Wv{constructor(e,n){super(16,e),this.name="DataStreamError",this.reason=n,this.reasonName=jt[n]}}class no extends Yi{constructor(e){super(18,e),this.name="SignalReconnectError"}}var xd;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(xd||(xd={}));(function(t){function e(n){if(n&&"name"in n)return n.name==="NotFoundError"||n.name==="DevicesNotFoundError"?t.NotFound:n.name==="NotAllowedError"||n.name==="PermissionDeniedError"?t.PermissionDenied:n.name==="NotReadableError"||n.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=e})(xd||(xd={}));class wt{}wt.setTimeout=function(){return setTimeout(...arguments)};wt.setInterval=function(){return setInterval(...arguments)};wt.clearTimeout=function(){return clearTimeout(...arguments)};wt.clearInterval=function(){return clearInterval(...arguments)};var U;(function(t){t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting",t.Reconnected="reconnected",t.Disconnected="disconnected",t.ConnectionStateChanged="connectionStateChanged",t.Moved="moved",t.MediaDevicesChanged="mediaDevicesChanged",t.ParticipantConnected="participantConnected",t.ParticipantDisconnected="participantDisconnected",t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalAudioSilenceDetected="localAudioSilenceDetected",t.ActiveSpeakersChanged="activeSpeakersChanged",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.ParticipantAttributesChanged="participantAttributesChanged",t.ParticipantActive="participantActive",t.RoomMetadataChanged="roomMetadataChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.AudioPlaybackStatusChanged="audioPlaybackChanged",t.VideoPlaybackStatusChanged="videoPlaybackChanged",t.MediaDevicesError="mediaDevicesError",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.SignalConnected="signalConnected",t.RecordingStatusChanged="recordingStatusChanged",t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ActiveDeviceChanged="activeDeviceChanged",t.ChatMessage="chatMessage",t.LocalTrackSubscribed="localTrackSubscribed",t.MetricsReceived="metricsReceived"})(U||(U={}));var q;(function(t){t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackCpuConstrained="localTrackCpuConstrained",t.LocalSenderCreated="localSenderCreated",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.IsSpeakingChanged="isSpeakingChanged",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.TrackCpuConstrained="trackCpuConstrained",t.MediaDevicesError="mediaDevicesError",t.AudioStreamAcquired="audioStreamAcquired",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.PCTrackAdded="pcTrackAdded",t.AttributesChanged="attributesChanged",t.LocalTrackSubscribed="localTrackSubscribed",t.ChatMessage="chatMessage",t.Active="active"})(q||(q={}));var W;(function(t){t.TransportsCreated="transportsCreated",t.Connected="connected",t.Disconnected="disconnected",t.Resuming="resuming",t.Resumed="resumed",t.Restarting="restarting",t.Restarted="restarted",t.SignalResumed="signalResumed",t.SignalRestarted="signalRestarted",t.Closing="closing",t.MediaTrackAdded="mediaTrackAdded",t.ActiveSpeakersUpdate="activeSpeakersUpdate",t.DataPacketReceived="dataPacketReceived",t.RTPVideoMapUpdate="rtpVideoMapUpdate",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ParticipantUpdate="participantUpdate",t.RoomUpdate="roomUpdate",t.SpeakersChanged="speakersChanged",t.StreamStateChanged="streamStateChanged",t.ConnectionQualityUpdate="connectionQualityUpdate",t.SubscriptionError="subscriptionError",t.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",t.RemoteMute="remoteMute",t.SubscribedQualityUpdate="subscribedQualityUpdate",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackSubscribed="localTrackSubscribed",t.Offline="offline",t.SignalRequestResponse="signalRequestResponse",t.SignalConnected="signalConnected",t.RoomMoved="roomMoved"})(W||(W={}));var $;(function(t){t.Message="message",t.Muted="muted",t.Unmuted="unmuted",t.Restarted="restarted",t.Ended="ended",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed",t.CpuConstrained="cpuConstrained",t.UpdateSettings="updateSettings",t.UpdateSubscription="updateSubscription",t.AudioPlaybackStarted="audioPlaybackStarted",t.AudioPlaybackFailed="audioPlaybackFailed",t.AudioSilenceDetected="audioSilenceDetected",t.VisibilityChanged="visibilityChanged",t.VideoDimensionsChanged="videoDimensionsChanged",t.VideoPlaybackStarted="videoPlaybackStarted",t.VideoPlaybackFailed="videoPlaybackFailed",t.ElementAttached="elementAttached",t.ElementDetached="elementDetached",t.UpstreamPaused="upstreamPaused",t.UpstreamResumed="upstreamResumed",t.SubscriptionPermissionChanged="subscriptionPermissionChanged",t.SubscriptionStatusChanged="subscriptionStatusChanged",t.SubscriptionFailed="subscriptionFailed",t.TrackProcessorUpdate="trackProcessorUpdate",t.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",t.TranscriptionReceived="transcriptionReceived",t.TimeSyncUpdate="timeSyncUpdate",t.PreConnectBufferFlushed="preConnectBufferFlushed"})($||($={}));function T3(t){return typeof t>"u"?t:typeof structuredClone=="function"?typeof t=="object"&&t!==null?structuredClone(Object.assign({},t)):structuredClone(t):JSON.parse(JSON.stringify(t))}class Ie{constructor(e,n,r,i,s){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(n!==void 0&&r!==void 0)this.width=e,this.height=n,this.aspectRatio=e/n,this.encoding={maxBitrate:r,maxFramerate:i,priority:s};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const C3=["vp8","h264"],E3=["vp8","h264","vp9","av1","h265"];function _3(t){return!!C3.find(e=>e===t)}const P3=_3;var Kb;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(Kb||(Kb={}));var Sp;(function(t){t.telephone={maxBitrate:12e3}
vendor: 18,017 bytes, line 408
408,t.speech={maxBitrate:24e3},t.music={maxBitrate:48e3},t.musicStereo={maxBitrate:64e3},t.musicHighQuality={maxBitrate:96e3},t.musicHighQualityStereo={maxBitrate:128e3}})(Sp||(Sp={}));const Jl={h90:new Ie(160,90,9e4,20),h180:new Ie(320,180,16e4,20),h216:new Ie(384,216,18e4,20),h360:new Ie(640,360,45e4,20),h540:new Ie(960,540,8e5,25),h720:new Ie(1280,720,17e5,30),h1080:new Ie(1920,1080,3e6,30),h1440:new Ie(2560,1440,5e6,30),h2160:new Ie(3840,2160,8e6,30)},Tp={h120:new Ie(160,120,7e4,20),h180:new Ie(240,180,125e3,20),h240:new Ie(320,240,14e4,20),h360:new Ie(480,360,33e4,20),h480:new Ie(640,480,5e5,20),h540:new Ie(720,540,6e5,25),h720:new Ie(960,720,13e5,30),h1080:new Ie(1440,1080,23e5,30),h1440:new Ie(1920,1440,38e5,30)},Hv={h360fps3:new Ie(640,360,2e5,3,"medium"),h360fps15:new Ie(640,360,4e5,15,"medium"),h720fps5:new Ie(1280,720,8e5,5,"medium"),h720fps15:new Ie(1280,720,15e5,15,"medium"),h720fps30:new Ie(1280,720,2e6,30,"medium"),h1080fps15:new Ie(1920,1080,25e5,15,"medium"),h1080fps30:new Ie(1920,1080,5e6,30,"medium"),original:new Ie(0,0,7e6,30,"medium")};function gE(t,e,n){var r,i,s,o;const{optionsWithoutProcessor:a,audioProcessor:l,videoProcessor:c}=bE(t??{}),u=e==null?void 0:e.processor,h=n==null?void 0:n.processor,f=a??{};return f.audio===!0&&(f.audio={}),f.video===!0&&(f.video={}),f.audio&&(Cp(f.audio,e),(r=(s=f.audio).deviceId)!==null&&r!==void 0||(s.deviceId={ideal:"default"}),(l||u)&&(f.audio.processor=l??u)),f.video&&(Cp(f.video,n),(i=(o=f.video).deviceId)!==null&&i!==void 0||(o.deviceId={ideal:"default"}),(c||h)&&(f.video.processor=c??h)),f}function Cp(t,e){return Object.keys(e).forEach(n=>{t[n]===void 0&&(t[n]=e[n])}),t}function Kv(t){var e,n,r,i;const s={};if(t.video)if(typeof t.video=="object"){const o={},a=o,l=t.video;Object.keys(l).forEach(c=>{switch(c){case"resolution":Cp(a,l.resolution);break;default:a[c]=l[c]}}),s.video=o,(e=(r=s.video).deviceId)!==null&&e!==void 0||(r.deviceId={ideal:"default"})}else s.video=t.video?{deviceId:{ideal:"default"}}:!1;else s.video=!1;return t.audio?typeof t.audio=="object"?(s.audio=t.audio,(n=(i=s.audio).deviceId)!==null&&n!==void 0||(i.deviceId={ideal:"default"})):s.audio={deviceId:{ideal:"default"}}:s.audio=!1,s}function vE(t){return E(this,arguments,void 0,function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const r=yE();if(r){const i=r.createAnalyser();i.fftSize=2048;const s=i.frequencyBinCount,o=new Uint8Array(s);r.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(i),yield xt(n),i.getByteTimeDomainData(o);const l=o.some(c=>c!==128&&c!==0);return r.close(),!l}return!1}()})}function yE(){var t;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const n=new e({latencyHint:"interactive"});if(n.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const r=()=>E(this,void 0,void 0,function*(){var i;try{n.state==="suspended"&&(yield n.resume())}catch(s){console.warn("Error trying to auto-resume audio context",s)}finally{(i=window.document.body)===null||i===void 0||i.removeEventListener("click",r)}});n.addEventListener("statechange",()=>{var i;n.state==="closed"&&((i=window.document.body)===null||i===void 0||i.removeEventListener("click",r))}),window.document.body.addEventListener("click",r)}return n}}function R3(t){return t==="audioinput"?D.Source.Microphone:t==="videoinput"?D.Source.Camera:D.Source.Unknown}function Ep(t){return t===D.Source.Microphone?"audioinput":t===D.Source.Camera?"videoinput":void 0}function I3(t){var e,n;let r=(e=t.video)!==null&&e!==void 0?e:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(r=typeof r=="boolean"?{}:r,Fs()?r=Object.assign(Object.assign({},r),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):r=Object.assign(Object.assign({},r),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(n=t.audio)!==null&&n!==void 0?n:!1,video:r,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function vl(t){return t.split("/")[1].toLowerCase()}function N3(t){const e=[];return t.forEach(n=>{n.track!==void 0&&e.push(new Lv({cid:n.track.mediaStreamID,track:n.trackInfo}))}),e}function fe(t){return"mediaStreamTrack"in t?{trackID:t.sid,source:t.source,muted:t.isMuted,enabled:t.mediaStreamTrack.enabled,kind:t.kind,streamID:t.mediaStreamID,streamTrackID:t.mediaStreamTrack.id}:{trackID:t.trackSid,enabled:t.isEnabled,muted:t.isMuted,trackInfo:Object.assign({mimeType:t.mimeType,name:t.trackName,encrypted:t.isEncrypted,kind:t.kind,source:t.source},t.track?fe(t.track):{})}}function A3(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function O3(t,e){var n;t===void 0&&(t={}),e===void 0&&(e={});const r=[...Object.keys(e),...Object.keys(t)],i={};for(const s of r)t[s]!==e[s]&&(i[s]=(n=e[s])!==null&&n!==void 0?n:"");return i}function bE(t){const e=Object.assign({},t);let n,r;return typeof e.audio=="object"&&e.audio.processor&&(n=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(r=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:n,videoProcessor:r,optionsWithoutProcessor:T3(e)}}function M3(t){switch(t){case ot.CAMERA:return D.Source.Camera;case ot.MICROPHONE:return D.Source.Microphone;case ot.SCREEN_SHARE:return D.Source.ScreenShare;case ot.SCREEN_SHARE_AUDIO:return D.Source.ScreenShareAudio;default:return D.Source.Unknown}}function Gb(t,e){return t.width*t.height<e.width*e.height}function j3(t,e){var n;return(n=t.layers)===null||n===void 0?void 0:n.find(r=>r.quality===e)}const D3=5e3,Ha=[];var sn;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(sn||(sn={}));class D extends Tr.EventEmitter{get streamState(){return this._streamState}setStreamState(e){this._streamState=e}constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var i;super(),this.attachedElements=[],this.isMuted=!1,this._streamState=D.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=de,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),D3):this.handleAppVisibilityChanged()},this.log=wr((i=r.loggerName)!==null&&i!==void 0?i:Cn.Track),this.loggerContextCb=r.loggerContextCb,this.setMaxListeners(100),this.kind=n,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=D.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),fe(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let n="audio";this.kind===D.Kind.Video&&(n="video"),this.attachedElements.length===0&&this.kind===D.Kind.Video&&this.addAppVisibilityListener(),e||(n==="audio"&&(Ha.forEach(s=>{s.parentElement===null&&!e&&(e=s)}),e&&Ha.splice(Ha.indexOf(e),1)),e||(e=document.createElement(n))),this.attachedElements.includes(e)||this.attachedElements.push(e),Ro(this.mediaStreamTrack,e);const r=e.srcObject.getTracks(),i=r.some(s=>s.kind==="audio");return e.play().then(()=>{this.emit(i?$.AudioPlaybackStarted:$.VideoPlaybackStarted)}).catch(s=>{s.name==="NotAllowedError"?this.emit(i?$.AudioPlaybackFailed:$.VideoPlaybackFailed,s):s.name==="AbortError"?de.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):de.warn("could not playback ".concat(i?"audio":"video"),s),i&&e&&r.some(o=>o.kind==="video")&&s.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit($.ElementAttached,e),e}detach(e){try{if(e){qo(this.mediaStreamTrack,e);const r=this.attachedElements.indexOf(e);return r>=0&&(this.attachedElements.splice(r,1),this.recycleElement(e),this.emit($.ElementDetached,e)),e}const n=[];return this.attachedElements.forEach(r=>{qo(this.mediaStreamTrack,r),n.push(r),this.recycleElement(r),this.emit($.ElementDetached,r)}),this.attachedElements=[],n}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=wr(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let n=!0;e.pause(),Ha.forEach(r=>{r.parentElement||(n=!1)}),n&&Ha.push(e)}}handleAppVisibilityChanged(){return E(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===D.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){Kt()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Kt()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function Ro(t,e){let n;e.srcObject instanceof MediaStream?n=e.srcObject:n=new MediaStream;let r;t.kind==="audio"?r=n.getAudioTracks():r=n.getVideoTracks(),r.includes(t)||(r.forEach(i=>{n.removeTrack(i)}),n.addTrack(t)),(!Fs()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=n.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==n&&(e.srcObject=n,(Fs()||Us())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=n,e.play().catch(()=>{})},0))}function qo(t,e){if(e.srcObject instanceof MediaStream){const n=e.srcObject;n.removeTrack(t),n.getTracks().length>0?e.srcObject=n:e.srcObject=null}}(function(t){let e;(function(c){c.Audio="audio",c.Video="video",c.Unknown="unknown"})(e=t.Kind||(t.Kind={}));let n;(function(c){c.Camera="camera",c.Microphone="microphone",c.ScreenShare="screen_share",c.ScreenShareAudio="screen_share_audio",c.Unknown="unknown"})(n=t.Source||(t.Source={}));let r;(function(c){c.Active="active",c.Paused="paused",c.Unknown="unknown"})(r=t.StreamState||(t.StreamState={}));function i(c){switch(c){case e.Audio:return Vn.AUDIO;case e.Video:return Vn.VIDEO;default:return Vn.DATA}}t.kindToProto=i;function s(c){switch(c){case Vn.AUDIO:return e.Audio;case Vn.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=s;function o(c){switch(c){case n.Camera:return ot.CAMERA;case n.Microphone:return ot.MICROPHONE;case n.ScreenShare:return ot.SCREEN_SHARE;case n.ScreenShareAudio:return ot.SCREEN_SHARE_AUDIO;default:return ot.UNKNOWN}}t.sourceToProto=o;function a(c){switch(c){case ot.CAMERA:return n.Camera;case ot.MICROPHONE:return n.Microphone;case ot.SCREEN_SHARE:return n.ScreenShare;case ot.SCREEN_SHARE_AUDIO:return n.ScreenShareAudio;default:return n.Unknown}}t.sourceFromProto=a;function l(c){switch(c){case fp.ACTIVE:return r.Active;case fp.PAUSED:return r.Paused;default:return r.Unknown}}t.streamStateFromProto=l})(D||(D={}));const L3="|",Jb="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function U3(t){const e=t.split(L3);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function xt(t){return new Nt(e=>wt.setTimeout(e,t))}function _p(){return"addTransceiver"in RTCPeerConnection.prototype}function Pp(){return"addTrack"in RTCPeerConnection.prototype}function F3(){if(!("getCapabilities"in RTCRtpSender)||Fs()||Us())return!1;const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType.toLowerCase()==="video/av1"){e=!0;break}}return e}function B3(){if(!("getCapabilities"in RTCRtpSender)||Us())return!1;if(Fs()){const n=Qt();if(n!=null&&n.version&&kr(n.version,"16")<0||(n==null?void 0:n.os)==="iOS"&&(n!=null&&n.osVersion)&&kr(n.osVersion,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const n of t.codecs)if(n.mimeType.toLowerCase()==="video/vp9"){e=!0;break}}return e}function qn(t){return t==="av1"||t==="vp9"}function Rp(t){return!document||Yl()?!1:(t||(t=document.createElement("audio")),"setSinkId"in t)}function z3(){return typeof RTCPeerConnection>"u"?!1:_p()||Pp()}function Us(){var t;return((t=Qt())===null||t===void 0?void 0:t.name)==="Firefox"}function Yb(){const t=Qt();return!!t&&t.name==="Chrome"&&t.os!=="iOS"}function Fs(){var t;return((t=Qt())===null||t===void 0?void 0:t.name)==="Safari"}function Yl(){const t=Qt();return(t==null?void 0:t.name)==="Safari"||(t==null?void 0:t.os)==="iOS"}function $3(){const t=Qt();return(t==null?void 0:t.name)==="Safari"&&t.version.startsWith("17.")||(t==null?void 0:t.os)==="iOS"&&!!(t!=null&&t.osVersion)&&kr(t.osVersion,"17")>=0}function V3(t){return t||(t=Qt()),(t==null?void 0:t.name)==="Safari"&&kr(t.version,"18.3")>0||(t==null?void 0:t.os)==="iOS"&&!!(t!=null&&t.osVersion)&&kr(t.osVersion,"18.3")>0}function wE(){var t,e;return Kt()?(e=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function W3(){const t=Qt(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&kr(t.osVersion,e)>=0?!0:t.name==="Safari"&&kr(t.version,e)>=0}function Kt(){return typeof document<"u"}function xr(){return navigator.product=="ReactNative"}function ba(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function xf(t){return ba(t)?t.hostname.split(".")[0]:null}function xE(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function kE(){if(!xr())return;let t=xE();if(t)return t.platform}function Qb(){if(Kt())return window.devicePixelRatio;if(xr()){let t=xE();if(t)return t.devicePixelRatio}return 1}function kr(t,e){const n=t.split("."),r=e.split("."),i=Math.min(n.length,r.length);for(let s=0;s<i;++s){const o=parseInt(n[s],10),a=parseInt(r[s],10);if(o>a)return 1;if(o<a)return-1;if(s===i-1&&o===a)return 0}return t===""&&e!==""?-1:e===""?1:n.length==r.length?0:n.length<r.length?-1:1}function q3(t){for(const e of t)e.target.handleResize(e)}function H3(t){for(const e of t)e.target.handleVisibilityChanged(e)}let kf=null;const Xb=()=>(kf||(kf=new ResizeObserver(q3)),kf);let Sf=null;const Zb=()=>(Sf||(Sf=new IntersectionObserver(H3,{root:null,rootMargin:"0px"})),Sf);function K3(){var t;const e=new y1({sdk:b1.JS,protocol:k3,version:x3});return xr()&&(e.os=(t=kE())!==null&&t!==void 0?t:""),e}function ew(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const i=document.createElement("canvas");i.width=t,i.height=e;const s=i.getContext("2d");s==null||s.fillRect(0,0,i.width,i.height),r&&s&&(s.beginPath(),s.arc(t/2,e/2,50,0,Math.PI*2,!0),s.closePath(),s.fillStyle="grey",s.fill());const o=i.captureStream(),[a]=o.getTracks();if(!a)throw Error("Could not get empty media stream video track");return a.enabled=n,a}let Ka;function Tf(){if(!Ka){const t=new AudioContext,e=t.createOscillator(),n=t.createGain();n.gain.setValueAtTime(0,0);const r=t.createMediaStreamDestination();if(e.connect(n),n.connect(r),e.start(),[Ka]=r.stream.getAudioTracks(),!Ka)throw Error("Could not get empty media stream audio track");Ka.enabled=!1}return Ka.clone()}class xn{get isResolved(){return this._isResolved}constructor(e,n){this._isResolved=!1,this.onFinally=n,this.promise=new Promise((r,i)=>E(this,void 0,void 0,function*(){this.resolve=r,this.reject=i,e&&(yield e(r,i))})).finally(()=>{var r;this._isResolved=!0,(r=this.onFinally)===null||r===void 0||r.call(this)})}}function G3(t){return E3.includes(t)}function Rs(t){if(typeof t=="string"||typeof t=="number")return t;if(Array.isArray(t))return t[0];if(t.exact!==void 0)return Array.isArray(t.exact)?t.exact[0]:t.exact;if(t.ideal!==void 0)return Array.isArray(t.ideal)?t.ideal[0]:t.ideal;throw Error("could not unwrap constraint")}function J3(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function Ql(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function Y3(t,e){return t.segments.map(n=>{let{id:r,text:i,language:s,startTime:o,endTime:a,final:l}=n;var c;const u=(c=e.get(r))!==null&&c!==void 0?c:Date.now(),h=Date.now();return l?e.delete(r):e.set(r,u),{id:r,text:i,startTime:Number.parseInt(o.toString()),endTime:Number.parseInt(a.toString()),final:l,language:s,firstReceivedTime:u,lastReceivedTime:h}})}function Q3(t){const{id:e,timestamp:n,message:r,editTimestamp:i}=t;return{id:e,timestamp:Number.parseInt(n.toString()),editTimestamp:i?Number.parseInt(i.toString()):void 0,message:r}}function tw(t){switch(t.reason){case Ae.LeaveRequest:return t.context;case Ae.Cancelled:return Kn.CLIENT_INITIATED;case Ae.NotAllowed:return Kn.USER_REJECTED;case Ae.ServerUnreachable:return Kn.JOIN_FAILURE;default:return Kn.UNKNOWN_REASON}}function Mu(t){return t!==void 0?Number(t):void 0}function us(t){return t!==void 0?BigInt(t):void 0}function Ho(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function yr(t){return!!t&&t.kind==D.Kind.Audio}function Qi(t){return!!t&&t.kind==D.Kind.Video}function oi(t){return Ho(t)&&Qi(t)}function Rr(t){return Ho(t)&&yr(t)}function Ip(t){return!!t&&!t.isLocal}function X3(t){return!!t&&!t.isLocal}function Cf(t){return Ip(t)&&Qi(t)}function Z3(t){return t.isLocal}function eU(t,e){const n=[];let r=new TextEncoder().encode(t);for(;r.length>e;){let i=e;for(;i>0;){const s=r[i];if(s!==void 0&&(s&192)!==128)break;
408i--}n.push(r.slice(0,i)),r=r.slice(i)}return r.length>0&&n.push(r),n}function tU(t){var e;const n=t.get("Cache-Control");if(n){const r=(e=n.match(/(?:^|[,\s])max-age=(\d+)/))===null||e===void 0?void 0:e[1];if(r)return parseInt(r,10)}}function nU(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const r=rU(t,e);return n?r:Gv(r,"v1")}function rU(t,e){const n=new URL(J3(t));return e.forEach((r,i)=>{n.searchParams.set(i,r)}),Gv(n,"rtc")}function iU(t){const e=new URL(Ql(t));return Gv(e,"validate")}function SE(t){return t.endsWith("/")?t:"".concat(t,"/")}function Gv(t,e){return t.pathname="".concat(SE(t.pathname)).concat(e),t}function nw(t){if(typeof t=="string")return Mb.fromJson(JSON.parse(t),{ignoreUnknownFields:!0});if(t instanceof ArrayBuffer)return Mb.fromBinary(new Uint8Array(t));throw new Error("could not decode websocket message: ".concat(typeof t))}function sU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Unknown reason";if(!(t instanceof AbortSignal))return e;const n=t.reason;switch(typeof n){case"string":return n;case"object":return n instanceof Error?n.message:e;default:return"toString"in n?n.toString():e}}const oU=10,Ga="lk_e2ee",aU="LKFrameEncryptionKey",lU={sharedKey:!1,ratchetSalt:aU,ratchetWindowSize:8,failureTolerance:oU,keyringSize:16};var Li;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(Li||(Li={}));var rw;(function(t){t.KeyRatcheted="keyRatcheted"})(rw||(rw={}));var Ei;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(Ei||(Ei={}));var iw;(function(t){t.Error="cryptorError"})(iw||(iw={}));function cU(){return uU()||Np()}function Np(){return typeof window.RTCRtpScriptTransform<"u"}function uU(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}function dU(t){var e,n,r,i,s;if(((e=t.value)===null||e===void 0?void 0:e.case)!=="sipDtmf"&&((n=t.value)===null||n===void 0?void 0:n.case)!=="metrics"&&((r=t.value)===null||r===void 0?void 0:r.case)!=="speaker"&&((i=t.value)===null||i===void 0?void 0:i.case)!=="transcription"&&((s=t.value)===null||s===void 0?void 0:s.case)!=="encryptedPacket")return new d1({value:t.value})}class EV extends Tr.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(n,r,i)=>{de.debug("key ratcheted event received",{ratchetResult:n,participantId:r,keyIndex:i})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},lU),e),this.on(Li.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,n,r){const i={key:e,participantIdentity:n,keyIndex:r};if(!this.options.sharedKey&&!n)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(n??"shared","-").concat(r??0),i),this.emit(Li.SetKey,i)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,n){this.emit(Li.RatchetRequest,e,n)}}var sw;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(sw||(sw={}));class hU extends Tr.EventEmitter{constructor(e,n){super(),this.decryptDataRequests=new Map,this.encryptDataRequests=new Map,this.onWorkerMessage=r=>{var i,s;const{kind:o,data:a}=r.data;switch(o){case"error":if(de.error(a.error.message),a.uuid){const u=this.decryptDataRequests.get(a.uuid);if(u!=null&&u.reject){u.reject(a.error);break}const h=this.encryptDataRequests.get(a.uuid);if(h!=null&&h.reject){h.reject(a.error);break}}this.emit(Ei.EncryptionError,a.error,a.participantIdentity);break;case"initAck":a.enabled&&this.keyProvider.getKeys().forEach(u=>{this.postKey(u)});break;case"enable":if(a.enabled&&this.keyProvider.getKeys().forEach(u=>{this.postKey(u)}),this.encryptionEnabled!==a.enabled&&a.participantIdentity===((i=this.room)===null||i===void 0?void 0:i.localParticipant.identity))this.emit(Ei.ParticipantEncryptionStatusChanged,a.enabled,this.room.localParticipant),this.encryptionEnabled=a.enabled;else if(a.participantIdentity){const u=(s=this.room)===null||s===void 0?void 0:s.getParticipantByIdentity(a.participantIdentity);if(!u)throw TypeError("couldn't set encryption status, participant not found".concat(a.participantIdentity));
408this.emit(Ei.ParticipantEncryptionStatusChanged,a.enabled,u)}break;case"ratchetKey":this.keyProvider.emit(Li.KeyRatcheted,a.ratchetResult,a.participantIdentity,a.keyIndex);break;case"decryptDataResponse":const l=this.decryptDataRequests.get(a.uuid);l!=null&&l.resolve&&l.resolve(a);break;case"encryptDataResponse":const c=this.encryptDataRequests.get(a.uuid);c!=null&&c.resolve&&c.resolve(a);break}},this.onWorkerError=r=>{de.error("e2ee worker encountered an error:",{error:r.error}),this.emit(Ei.EncryptionError,r.error,void 0)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1,this.dataChannelEncryptionEnabled=n}get isEnabled(){return this.encryptionEnabled}get isDataChannelEncryptionEnabled(){return this.isEnabled&&this.dataChannelEncryptionEnabled}setup(e){if(!cU())throw new qv("tried to setup end-to-end encryption on an unsupported browser");if(de.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const n={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:s3.getLevel()}};this.worker&&(de.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(n))}}setParticipantCryptorEnabled(e,n){de.debug("set e2ee to ".concat(e," for participant ").concat(n)),this.postEnable(e,n)}setSifTrailer(e){!e||e.length===0?de.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(W.RTPVideoMapUpdate,n=>{this.postRTPMap(n)})}setupEventListeners(e,n){e.on(U.TrackPublished,(r,i)=>this.setParticipantCryptorEnabled(r.trackInfo.encryption!==it.NONE,i.identity)),e.on(U.ConnectionStateChanged,r=>
408{r===ke.Connected&&e.remoteParticipants.forEach(i=>{i.trackPublications.forEach(s=>{this.setParticipantCryptorEnabled(s.trackInfo.encryption!==it.NONE,i.identity)})})}).on(U.TrackUnsubscribed,(r,i,s)=>{var o;const a={kind:"removeTransform",data:{participantIdentity:s.identity,trackId:r.mediaStreamID}};(o=this.worker)===null||o===void 0||o.postMessage(a)}).on(U.TrackSubscribed,(r,i,s)=>{this.setupE2EEReceiver(r,s.identity,i.trackInfo)}).on(U.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");n.getKeys().forEach(r=>{this.postKey(r)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(q.LocalSenderCreated,(r,i)=>E(this,void 0,void 0,function*(){this.setupE2EESender(i,r)})),e.localParticipant.on(q.LocalTrackPublished,r=>{if(!Qi(r.track)||!Yl())return;const i={kind:"updateCodec",data:{trackId:r.track.mediaStreamID,codec:vl(r.trackInfo.codecs[0].mimeType),participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(i)}),n.on(Li.SetKey,r=>this.postKey(r)).on(Li.RatchetRequest,(r,i)=>this.postRatchetRequest(r,i))}encryptData(e){return E(this,void 0,void 0,function*(){if(!this.worker)throw Error("could not encrypt data, worker is missing");const n=crypto.randomUUID(),r={kind:"encryptDataRequest",data:{uuid:n,payload:e,participantIdentity:this.room.localParticipant.identity}},i=new xn;return i.onFinally=()=>{this.encryptDataRequests.delete(n)},this.encryptDataRequests.set(n,i),this.worker.postMessage(r),i.promise})}handleEncryptedData(e,n,r,i){if(!this.worker)throw Error("could not handle encrypted data, worker is missing");const s=crypto.randomUUID(),o={kind:"decryptDataRequest",data:{uuid:s,payload:e,iv:n,participantIdentity:r,keyIndex:i}},a=new xn;return a.onFinally=()=>{this.decryptDataRequests.delete(s)},this.decryptDataRequests.set(s,a),this.worker.postMessage(o),a.promise}postRatchetRequest(e,n){if(!this.worker)throw Error("could not ratchet key, worker is missing");const r={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:n}};this.worker.postMessage(r)}postKey(e){let{key:n,participantIdentity:r,keyIndex:i}=e;var s;if(!this.worker)throw Error("could not set key, worker is missing");const o={kind:"setKey",data:{participantIdentity:r,isPublisher:r===((s=this.room)===null||s===void 0?void 0:s.localParticipant.identity),key:n,keyIndex:i}};this.worker.postMessage(o)}postEnable(e,n){if(this.worker){const r={kind:"enable",data:{enabled:e,participantIdentity:n}};this.worker.postMessage(r)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var n;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((n=this.room)===null||n===void 0)&&n.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const r={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(r)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const n={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(n)}setupE2EEReceiver(e,n,r){if(e.receiver){if(!(r!=null&&r.mimeType)||r.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,n,e.kind==="video"?vl(r.mimeType):void 0)}}setupE2EESender(e,n){if(!Ho(e)||!n){n||de.warn("early return because sender is not ready");return}this.handleSender(n,e.mediaStreamID,void 0)}handleReceiver(e,n,r,i){return E(this,void 0,void 0,function*(){if(this.worker){if(Np()&&!Yb()){const s={kind:"decode",participantIdentity:r,trackId:n,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{if(Ga in e&&i){const l={kind:"updateCodec",data:{trackId:n,codec:i,participantIdentity:r}};this.worker.postMessage(l);return}let s=e.writableStream,o=e.readableStream;if(!s||!o){const l=e.createEncodedStreams();e.writableStream=l.writable,s=l.writable,e.readableStream=l.readable,o=l.readable}const a={kind:"decode",data:{readableStream:o,writableStream:s,trackId:n,codec:i,participantIdentity:r,isReuse:Ga in e}};
408this.worker.postMessage(a,[o,s])}e[Ga]=!0}})}handleSender(e,n,r){var i;if(!(Ga in e||!this.worker)){if(!(!((i=this.room)===null||i===void 0)&&i.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(Np()&&!Yb()){de.info("initialize script transform");const s={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:n,codec:r};e.transform=new RTCRtpScriptTransform(this.worker,s)}else{de.info("initialize encoded streams");const s=e.createEncodedStreams(),o={kind:"encode",data:{readableStream:s.readable,writableStream:s.writable,codec:r,trackId:n,participantIdentity:this.room.localParticipant.identity,isReuse:!1}};this.worker.postMessage(o,[s.readable,s.writable])}e[Ga]=!0}}}const fU=500,mU=15e3;class Ko{constructor(){this.failedConnectionAttempts=new Map,this.backOffPromises=new Map}static getInstance(){return this._instance||(this._instance=new Ko),this._instance}addFailedConnectionAttempt(e){var n;const r=new URL(e),i=xf(r);if(!i)return;let s=(n=this.failedConnectionAttempts.get(i))!==null&&n!==void 0?n:0;this.failedConnectionAttempts.set(i,s+1),this.backOffPromises.set(i,xt(Math.min(fU*Math.pow(2,s),mU)))}getBackOffPromise(e){const n=new URL(e),r=n&&xf(n);return r&&this.backOffPromises.get(r)||Promise.resolve()}resetFailedConnectionAttempts(e){const n=new URL(e),r=n&&xf(n);r&&(this.failedConnectionAttempts.set(r,0),this.backOffPromises.set(r,Promise.resolve()))}resetAll(){this.backOffPromises.clear(),this.failedConnectionAttempts.clear()}}Ko._instance=null;const Ef="default";class mt{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new mt),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return E(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;if(((s=mt.userMediaPromiseMap)===null||s===void 0?void 0:s.size)>0){de.debug("awaiting getUserMedia promise");try{n?yield mt.userMediaPromiseMap.get(n):yield Promise.all(mt.userMediaPromiseMap.values())}catch{de.warn("error waiting for media permissons")}}let o=yield navigator.mediaDevices.enumerateDevices();if(i&&!(Fs()&&r.hasDeviceInUse(n))&&(o.filter(l=>l.kind===n).length===0||o.some(l=>{const c=l.label==="",u=n?l.kind===n:!0;return c&&u}))){const l={video:n!=="audioinput"&&n!=="audiooutput",audio:n!=="videoinput"&&{deviceId:{ideal:"default"}}},c=yield navigator.mediaDevices.getUserMedia(l);o=yield navigator.mediaDevices.enumerateDevices(),c.getTracks().forEach(u=>{u.stop()})}return r._previousDevices=o,n&&(o=o.filter(a=>a.kind===n)),o}()})}normalizeDeviceId(e,n,r){return E(this,void 0,void 0,function*(){if(n!==Ef)return n;const i=yield this.getDevices(e),s=i.find(a=>a.deviceId===Ef);if(!s){de.warn("could not reliably determine default device");return}const o=i.find(a=>a.deviceId!==Ef&&a.groupId===(r??s.groupId));if(!o){de.warn("could not reliably determine default device");return}return o==null?void 0:o.deviceId})}hasDeviceInUse(e){return e?mt.userMediaPromiseMap.has(e):mt.userMediaPromiseMap.size>0}}mt.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];mt.userMediaPromiseMap=new Map;var yl;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(yl||(yl={}));class pU{constructor(){this.pendingTasks=new Map,this.taskMutex=new Ft,this.nextTaskIndex=0}run(e){return E(this,void 0,void 0,function*(){const n={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:yl.WAITING};this.pendingTasks.set(n.id,n);const r=yield this.taskMutex.lock();try{return n.executedAt=Date.now(),n.status=yl.RUNNING,yield e()}finally{n.status=yl.COMPLETED,this.pendingTasks.delete(n.id),r()}})}flush(){return E(this,void 0,void 0,function*(){return this.run(()=>E(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}class gU{get readyState(){return this.ws.readyState}constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r,i;if(!((r=n.signal)===null||r===void 0)&&r.aborted)throw new DOMException("This operation was aborted","AbortError");this.url=e;const s=new WebSocket(e,(i=n.protocols)!==null&&i!==void 0?i:[]);s.binaryType="arraybuffer",this.ws=s;const o=function(){let{closeCode:a,reason:l}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return s.close(a,l)};this.opened=new Nt((a,l)=>{const c=()=>
408{l(re.websocket("Encountered websocket error during connection establishment"))};s.onopen=()=>{a({readable:new ReadableStream({start(u){s.onmessage=h=>{let{data:f}=h;return u.enqueue(f)},s.onerror=h=>u.error(h)},cancel:o}),writable:new WritableStream({write(u){s.send(u)},abort(){s.close()},close:o}),protocol:s.protocol,extensions:s.extensions}),s.removeEventListener("error",c)},s.addEventListener("error",c)}),this.closed=new Nt((a,l)=>{const c=()=>E(this,void 0,void 0,function*(){const u=new Nt(f=>{s.readyState!==WebSocket.CLOSED&&s.addEventListener("close",m=>{f(m)},{once:!0})}),h=yield Nt.race([xt(250),u]);h?a(h):l(re.websocket("Encountered unspecified websocket error without a timely close event"))});s.onclose=u=>{let{code:h,reason:f}=u;a({closeCode:h,reason:f}),s.removeEventListener("error",c)},s.addEventListener("error",c)}),n.signal&&(n.signal.onabort=()=>s.close()),this.close=o}}const vU=["syncState","trickle","offer","answer","simulate","leave"];function yU(t){const e=vU.indexOf(t.case)>=0;return de.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var Ne;(function(t){t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.RECONNECTING=2]="RECONNECTING",t[t.DISCONNECTING=3]="DISCONNECTING",t[t.DISCONNECTED=4]="DISCONNECTED"})(Ne||(Ne={}));const bU=250;class Jv{get currentState(){return this.state}get isDisconnected(){return this.state===Ne.DISCONNECTING||this.state===Ne.DISCONNECTED}get isEstablishingConnection(){return this.state===Ne.CONNECTING||this.state===Ne.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r;this.rtt=0,this.state=Ne.DISCONNECTED,this.log=de,this._requestId=0,this.useV0SignalPath=!1,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0,this.onMediaSectionsRequirement=void 0},this.log=wr((r=n.loggerName)!==null&&r!==void 0?r:Cn.Signal),this.loggerContextCb=n.loggerContextCb,this.useJSON=e,this.requestQueue=new pU,this.queuedRequests=[],this.closingLock=new Ft,this.connectionLock=new Ft,this.state=Ne.DISCONNECTED}get logContext(){var e,n;return(n=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&n!==void 0?n:{}}join(e,n,r,i){return E(this,arguments,void 0,function(s,o,a,l){var c=this;let u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return function*(){return c.state=Ne.CONNECTING,c.options=a,yield c.connect(s,o,a,l,u)}()})}reconnect(e,n,r,i){return E(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=Ne.RECONNECTING,this.clearPingInterval(),yield this.connect(e,n,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:r,reconnectReason:i}),void 0,this.useV0SignalPath)})}connect(e,n,r,i){return E(this,arguments,void 0,function(s,o,a,l){var c=this;let u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return function*(){const h=yield c.connectionLock.lock();c.connectOptions=a,c.useV0SignalPath=u;const f=K3(),m=u?wU(o,f,a):xU(o,f,a),b=nU(s,m,u).toString(),p=iU(b).toString();return new Promise((g,v)=>E(c,void 0,void 0,function*(){var y,w;try{let k=!1;const S=R=>E(this,void 0,void 0,function*(){if(k)return;k=!0;const A=R instanceof Event?R.currentTarget:R,O=sU(A,"Abort handler called");this.streamWriter&&!this.isDisconnected?this.sendLeave().then(()=>this.close(O)).catch(K=>{this.log.error(K),this.close()}):this.close(),T(),v(re.cancelled(O))});l==null||l.addEventListener("abort",S);const T=()=>{clearTimeout(C),l==null||l.removeEventListener("abort",S)},C=setTimeout(()=>{S(re.timeout("room connection has timed out (signal)"))},a.websocketTimeout),_=(R,A)=>{this.handleSignalConnected(R,C,A)},P=new URL(b);P.searchParams.has("access_token")&&P.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(P),Object.assign({reconnect:a.reconnect,reconnectReason:a.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new gU(b);try{this.ws.closed.then(V=>{var Q;this.isEstablishingConnection&&v(re.internal("Websocket got closed during a (re)connection attempt: ".concat(V.reason))),V.closeCode!==1e3&&(this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:V.reason,code:V.closeCode,wasClean:V.closeCode===1e3,state:this.state})),this.state===Ne.CONNECTED&&this.handleOnClose((Q=V.reason)!==null&&Q!==void 0?Q:"Unexpected WS error"))}).catch(V=>{this.isEstablishingConnection&&v(re.internal("Websocket error during a (re)connection attempt: ".concat(V)))});
408const R=yield this.ws.opened.catch(V=>E(this,void 0,void 0,function*(){if(this.state!==Ne.CONNECTED){this.state=Ne.DISCONNECTED,clearTimeout(C);const Q=yield this.handleConnectionError(V,p);v(Q);return}this.handleWSError(V),v(V)}));if(clearTimeout(C),!R)return;const A=R.readable.getReader();this.streamWriter=R.writable.getWriter();const O=yield A.read();if(A.releaseLock(),!O.value)throw re.internal("no message received as first message");const K=nw(O.value),F=this.validateFirstMessage(K,(y=a.reconnect)!==null&&y!==void 0?y:!1);if(!F.isValid){v(F.error);return}((w=K.message)===null||w===void 0?void 0:w.case)==="join"&&(this.pingTimeoutDuration=K.message.value.pingTimeout,this.pingIntervalDuration=K.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})));const Y=F.shouldProcessFirstMessage?K:void 0;_(R,Y),g(F.response)}catch(R){v(R)}finally{T()}}finally{h()}}))}()})}startReadingLoop(e,n){return E(this,void 0,void 0,function*(){for(n&&this.handleSignalResponse(n);;){this.signalLatency&&(yield xt(this.signalLatency));const{done:r,value:i}=yield e.read();if(r)break;const s=nw(i);this.handleSignalResponse(s)}})}close(){return E(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Close method called on signal client";return function*(){if([Ne.DISCONNECTING||Ne.DISCONNECTED].includes(e.state)){e.log.debug("ignoring signal close as it's already in disconnecting state");return}const i=yield e.closingLock.lock();try{if(e.clearPingInterval(),n&&(e.state=Ne.DISCONNECTING),e.ws){e.ws.close({closeCode:1e3,reason:r});const s=e.ws.closed;e.ws=void 0,e.streamWriter=void 0,yield Promise.race([s,xt(bU)])}}catch(s){e.log.debug("websocket error while closing",Object.assign(Object.assign({},e.logContext),{error:s}))}finally{n&&(e.state=Ne.DISCONNECTED),i()}}()})}sendOffer(e,n){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:Io(e,n)})}sendAnswer(e,n){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:Io(e,n)})}sendIceCandidate(e,n){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new dh({candidateInit:JSON.stringify(e),target:n})})}sendMuteTrack(e,n){return this.sendRequest({case:"mute",value:new hh({sid:e,muted:n})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,n){return E(this,arguments,void 0,function(r,i){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const a=s.getNextRequestId();return yield s.sendRequest({case:"updateMetadata",value:new Fv({requestId:a,metadata:r,name:i,attributes:o})}),a}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,n){return this.sendRequest({case:"updateLayers",value:new R1({trackSid:e,layers:n})})}sendUpdateSubscriptionPermissions(e,n){return this.sendRequest({case:"subscriptionPermission",value:new A1({allParticipants:e,trackPermissions:n})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:$e.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new j1({timestamp:$e.parse(Date.now()),rtt:$e.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,n){return this.sendRequest({case:"updateAudioTrack",value:new Uv({trackSid:e,features:n})})}sendLeave(){return this.sendRequest({case:"leave",value:new mh({reason:Kn.CLIENT_INITIATED,action:Vo.DISCONNECT})})}sendRequest(e){return E(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!i&&!yU(n)&&r.state===Ne.RECONNECTING){r.queuedRequests.push(()=>E(r,void 0,void 0,function*(){yield this.sendRequest(n,!0)}));return}if(i||(yield r.requestQueue.flush()),r.signalLatency&&(yield xt(r.signalLatency)),r.isDisconnected){r.log.debug("skipping signal request (type: ".concat(n.case,") - SignalClient disconnected"));return}if(!r.streamWriter){r.log.error("cannot send signal request before connected, type: ".concat(n==null?void 0:n.case),r.logContext);return}const o=new CL({message:n});try{r.useJSON?yield r.streamWriter.write(o.toJsonString()):yield r.streamWriter.write(o.toBinary())}catch(a){r.log.error("error sending signal message",Object.assign(Object.assign({},r.logContext),{error:a}))}}()})}handleSignalResponse(e){var n,r;const i=e.message;if(i==null){this.log.debug("received unsupported message",this.logContext);return}let s=!1;if(i.case==="answer"){const o=ow(i.value);this.onAnswer&&this.onAnswer(o,i.value.id,i.value.midToTrackId)}else if(i.case==="offer"){const o=ow(i.value);this.onOffer&&this.onOffer(o,i.value.id,i.value.midToTrackId)}else if(i.case==="trickle"){const o=JSON.parse(i.value.candidateInit);this.onTrickle&&this.onTrickle(o,i.value.target)}else i.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((n=i.value.participants)!==null&&n!==void 0?n:[]):i.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(i.value):i.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((r=i.value.speakers)!==null&&r!==void 0?r:[]):i.case==="leave"?this.onLeave&&this.onLeave(i.value):i.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(i.value.sid,i.value.muted):i.case==="roomUpdate"?this.onRoomUpdate&&i.value.room&&this.onRoomUpdate(i.value.room):i.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(i.value):i.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(i.value):i.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(i.value):i.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(i.value):i.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(i.value):i.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(i.value):i.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(i.value):i.case==="pong"||(i.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(i.value.lastPingTimestamp.toString()),this.resetPingTimeout(),s=!0):i.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(i.value):i.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(i.value.trackSid):i.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(i.value.token),this.onRoomMoved&&this.onRoomMoved(i.value)):i.case==="mediaSectionsRequirement"?this.onMediaSectionsRequirement&&this.onMediaSectionsRequirement
408(i.value):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:i.case})));s||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return E(this,void 0,void 0,function*(){if(this.state===Ne.DISCONNECTED)return;const n=this.onClose;yield this.close(void 0,e),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),n&&n(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=wt.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&wt.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=wt.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&wt.clearInterval(this.pingInterval)}handleSignalConnected(e,n,r){this.state=Ne.CONNECTED,clearTimeout(n),this.startPingInterval(),this.startReadingLoop(e.readable.getReader(),r)}validateFirstMessage(e,n){var r,i,s,o,a;return((r=e.message)===null||r===void 0?void 0:r.case)==="join"?{isValid:!0,response:e.message.value}:this.state===Ne.RECONNECTING&&((i=e.message)===null||i===void 0?void 0:i.case)!=="leave"?((s=e.message)===null||s===void 0?void 0:s.case)==="reconnect"?{isValid:!0,response:e.message.value}:(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),{isValid:!0,response:void 0,shouldProcessFirstMessage:!0}):this.isEstablishingConnection&&((o=e.message)===null||o===void 0?void 0:o.case)==="leave"?{isValid:!1,error:re.leaveRequest("Received leave request while trying to (re)connect",e.message.value.reason)}:n?{isValid:!1,error:re.internal("Unexpected first message")}:{isValid:!1,error:re.internal("did not receive join response, got ".concat((a=e.message)===null||a===void 0?void 0:a.case," instead"))}}handleConnectionError(e,n){return E(this,void 0,void 0,function*(){try{const r=yield fetch(n);switch(r.status){case 404:return re.serviceNotFound("v1 RTC path not found. Consider upgrading your LiveKit server version","v0-rtc");case 401:case 403:const i=yield r.text();return re.notAllowed(i,r.status);default:break}return e instanceof re?e:re.internal("Encountered unknown websocket error during connection: ".concat(e),{status:r.status,statusText:r.statusText})}catch(r){return r instanceof re?r:re.serverUnreachable(r instanceof Error?r.message:"server was not reachable")}})}}function ow(t){const e={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=t.type;break}return e}function Io(t,e){return new qi({sdp:t.sdp,type:t.type,id:e})}function wU(t,e,n){var r;const i=new URLSearchParams;return i.set("access_token",t),n.reconnect&&(i.set("reconnect","1"),n.sid&&i.set("sid",n.sid)),i.set("auto_subscribe",n.autoSubscribe?"1":"0"),i.set("sdk",xr()?"reactnative":"js"),i.set("version",e.version),i.set("protocol",e.protocol.toString()),e.deviceModel&&i.set("device_model",e.deviceModel),e.os&&i.set("os",e.os),e.osVersion&&i.set("os_version",e.osVersion),e.browser&&i.set("browser",e.browser),e.browserVersion&&i.set("browser_version",e.browserVersion),n.adaptiveStream&&i.set("adaptive_stream","1"),n.reconnectReason&&i.set("reconnect_reason",n.reconnectReason.toString()),!((r=navigator.connection)===null||r===void 0)&&r.type&&i.set("network",navigator.connection.type),i}
408function xU(t,e,n){const r=new URLSearchParams;r.set("access_token",t);const i=new XL({clientInfo:e,connectionSettings:new D1({autoSubscribe:!!n.autoSubscribe,adaptiveStream:!!n.adaptiveStream}),reconnect:!!n.reconnect,participantSid:n.sid?n.sid:void 0});n.reconnectReason&&(i.reconnectReason=n.reconnectReason);const s=new ZL({joinRequest:i.toBinary()});return r.set("join_request",btoa(new TextDecoder("utf-8").decode(s.toBinary()))),r}class aw{constructor(){this.buffer=[],this._totalSize=0}push(e){this.buffer.push(e),this._totalSize+=e.data.byteLength}pop(){const e=this.buffer.shift();return e&&(this._totalSize-=e.data.byteLength),e}getAll(){return this.buffer.slice()}popToSequence(e){for(;this.buffer.length>0&&this.buffer[0].sequence<=e;)this.pop()}alignBufferedAmount(e){for(;this.buffer.length>0;){const n=this.buffer[0];if(this._totalSize-n.data.byteLength<=e)break;this.pop()}}get length(){return this.buffer.length}}class kU{constructor(e){this._map=new Map,this._lastCleanup=0,this.ttl=e}set(e,n){const r=Date.now();r-this._lastCleanup>this.ttl/2&&this.cleanup();const i=r+this.ttl;return this._map.set(e,{value:n,expiresAt:i}),this}get(e){const n=this._map.get(e);if(n){if(n.expiresAt<Date.now()){this._map.delete(e);return}return n.value}}has(e){const n=this._map.get(e);return n?n.expiresAt<Date.now()?(this._map.delete(e),!1):!0:!1}delete(e){return this._map.delete(e)}clear(){this._map.clear()}cleanup(){const e=Date.now();for(const[n,r]of this._map.entries())r.expiresAt<e&&this._map.delete(n);this._lastCleanup=e}get size(){return this.cleanup(),this._map.size}forEach(e){this.cleanup();for(const[n,r]of this._map.entries())r.expiresAt>=Date.now()&&e(r.value,n,this.asValueMap())}map(e){this.cleanup();const n=[],r=this.asValueMap();for(const[i,s]of r.entries())n.push(e(s,i,r));return n}asValueMap(){const e=new Map;for(const[n,r]of this._map.entries())r.expiresAt>=Date.now()&&e.set(n,r.value);return e}}var Nn={},_f={},Pf={exports:{}},lw;function Yv(){if(lw)return Pf.exports;lw=1;var t=Pf.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var n="candidate:%s %d %s %d %s %d typ %s";return n+=e.raddr!=null?" raddr %s rport %d":"%v%v",n+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(n+=" generation %d"),n+=e["network-id"]!=null?" network-id %d":"%v",n+=e["network-cost"]!=null?" network-cost %d":"%v",n}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var n="ssrc:%d";return e.attribute!=null&&(n+=" %s",e.value!=null&&(n+=":%s")),n}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","max
408MessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var n="mediaclk:";return n+=e.id!=null?"id=%s %s":"%v%s",n+=e.mediaClockValue!=null?"=%s":"",n+=e.rateNumerator!=null?" rate=%s":"",n+=e.rateDenominator!=null?"/%s":"",n}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(t).forEach(function(e){var n=t[e];n.forEach(function(r){r.reg||(r.reg=/(.*)/),r.format||(r.format="%s")})}),Pf.exports}var cw;function SU(){return cw||(cw=1,function(t){var e=function(a){return String(Number(a))===a?Number(a):a},n=function(a,l,c,u){if(u&&!c)l[u]=e(a[1]);else for(var h=0;h<c.length;h+=1)a[h+1]!=null&&(l[c[h]]=e(a[h+1]))},r=function(a,l,c){var u=a.name&&a.names;a.push&&!l[a.push]?l[a.push]=[]:u&&!l[a.name]&&(l[a.name]={});var h=a.push?{}:u?l[a.name]:l;n(c.match(a.reg),h,a.names,a.name),a.push&&l[a.push].push(h)},i=Yv(),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(a){var l={},c=[],u=l;return a.split(/(\r\n|\r|\n)/).filter(s).forEach(function(h){var f=h[0],m=h.slice(2);f==="m"&&(c.push({rtp:[],fmtp:[]}),u=c[c.length-1]);for(var b=0;b<(i[f]||[]).length;b+=1){var p=i[f][b];if(p.reg.test(m))return r(p,u,m)}}),l.media=c,l};var o=function(a,l){var c=l.split(/=(.+)/,2);return c.length===2?a[c[0]]=e(c[1]):c.length===1&&l.length>1&&(a[c[0]]=void 0),a};t.parseParams=function(a){return a.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(a){return a.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(a){for(var l=[],c=a.split(" ").map(e),u=0;u<c.length;u+=3)l.push({component:c[u],ip:c[u+1],port:c[u+2]});return l},t.parseImageAttributes=function(a){return a.split(" ").map(function(l){return l.substring(1,l.length-1).split(",").reduce(o,{})})},t.parseSimulcastStreamList=function(a){return a.split(";").map(function(l){return l.split(",").map(function(c){var u,h=!1;return c[0]!=="~"?u=e(c):(u=e(c.substring(1,c.length)),h=!0),{scid:u,paused:h}})})}}(_f)),_f}var Rf,uw;function TU(){if(uw)return Rf;uw=1;var t=Yv(),e=/%[sdv%]/g,n=function(o){var a=1,l=arguments,c=l.length;return o.replace(e,function(u){if(a>=c)return u;var h=l[a];switch(a+=1,u){case"%%":return"%";case"%s":return String(h);case"%d":return Number(h);case"%v":return""}})},r=function(o,a,l){var c=a.format instanceof Function?a.format(a.push?l:l[a.name]):a.format,u=[o+"="+c];if(a.names)for(var h=0;h<a.names.length;h+=1){var f=a.names[h];a.name?u.push(l[a.name][f]):u.push(l[a.names[h]])}else u.push(l[a.name]);return n.apply(null,u)},i=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];return Rf=function(o,a){a=a||{},o.version==null&&(o.version=0),o.name==null&&(o.name=" "),o.media.forEac
vendor: 4,595 bytes, lines 408-410
408h(function(h){h.payloads==null&&(h.payloads="")});var l=a.outerOrder||i,c=a.innerOrder||s,u=[];return l.forEach(function(h){t[h].forEach(function(f){f.name in o&&o[f.name]!=null?u.push(r(h,f,o)):f.push in o&&o[f.push]!=null&&o[f.push].forEach(function(m){u.push(r(h,f,m))})})}),o.media.forEach(function(h){u.push(r("m",t.m[0],h)),c.forEach(function(f){t[f].forEach(function(m){m.name in h&&h[m.name]!=null?u.push(r(f,m,h)):m.push in h&&h[m.push]!=null&&h[m.push].forEach(function(b){u.push(r(f,m,b))})})})}),u.join(`\r
409`)+`\r
410`},Rf}var dw;function CU(){if(dw)return Nn;dw=1;var t=SU(),e=TU(),n=Yv();return Nn.grammar=n,Nn.write=e,Nn.parse=t.parse,Nn.parseParams=t.parseParams,Nn.parseFmtpConfig=t.parseFmtpConfig,Nn.parsePayloads=t.parsePayloads,Nn.parseRemoteCandidates=t.parseRemoteCandidates,Nn.parseImageAttributes=t.parseImageAttributes,Nn.parseSimulcastStreamList=t.parseSimulcastStreamList,Nn}var ci=CU();function Qv(t,e,n){var r,i,s;e===void 0&&(e=50),n===void 0&&(n={});var o=(r=n.isImmediate)!=null&&r,a=(i=n.callback)!=null&&i,l=n.maxWait,c=Date.now(),u=[];function h(){if(l!==void 0){var m=Date.now()-c;if(m+e>=l)return l-m}return e}var f=function(){var m=[].slice.call(arguments),b=this;return new Promise(function(p,g){var v=o&&s===void 0;if(s!==void 0&&clearTimeout(s),s=setTimeout(function(){if(s=void 0,c=Date.now(),!o){var w=t.apply(b,m);a&&a(w),u.forEach(function(k){return(0,k.resolve)(w)}),u=[]}},h()),v){var y=t.apply(b,m);return a&&a(y),p(y)}u.push({resolve:p,reject:g})})};return f.cancel=function(m){s!==void 0&&clearTimeout(s),u.forEach(function(b){return(0,b.reject)(m)}),u=[]},f}const EU=.7,_U=20,Is={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class hw extends Tr.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var r;super(),this.log=de,this.ddExtID=0,this.latestOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=Qv(i=>E(this,void 0,void 0,function*(){this.emit(Is.NegotiationStarted);try{yield this.createAndSendOffer()}catch(s){if(i)i(s);else throw s}}),_U),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=wr((r=n.loggerName)!==null&&r!==void 0?r:Cn.PCTransport),this.loggerOptions=n,this.config=e,this._pc=this.createPC(),this.offerLock=new Ft}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=n=>{var r;n.candidate&&((r=this.onIceCandidate)===null||r===void 0||r.call(this,n.candidate))},e.onicecandidateerror=n=>{var r;(r=this.onIceCandidateError)===null||r===void 0||r.call(this,n)},e.oniceconnectionstatechange=()=>{var n;(n=this.onIceConnectionStateChange)===null||n===void 0||n.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var n;(n=this.onSignalingStatechange)===null||n===void 0||n.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var n;(n=this.onConnectionStateChange)===null||n===void 0||n.call(this,e.connectionState)},e.ondatachannel=n=>{var r;(r=this.onDataChannel)===null||r===void 0||r.call(this,n)},e.ontrack=n=>{var r;(r=this.onTrack)===null||r===void 0||r.call(this,n)},e}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return E(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e,n){return E(this,void 0,void 0,function*(){var r;if(e.type==="answer"&&this.latestOfferId>0&&n>0&&n!==this.latestOfferId)return this.log.warn("ignoring answer for old offer",Object.assign(Object.assign({},this.logContext),{offerId:n,latestOfferId:this.latestOfferId})),!1;let i;if(e.type==="offer"){let{stereoMids:s,nackMids:o}=PU(e);this.remoteStereoMids=s,this.remoteNackMids=o}else if(e.type==="answer"){const s=ci.parse((r=e.sdp)!==null&&r!==void 0?r:"");
410s.media.forEach(o=>{const a=Xv(o.mid);o.type==="audio"&&this.trackBitrates.some(l=>{if(!l.transceiver||a!=l.transceiver.mid)return!1;let c=0;if(o.rtp.some(h=>h.codec.toUpperCase()===l.codec.toUpperCase()?(c=h.payload,!0):!1),c===0)return!0;let u=!1;for(const h of o.fmtp)if(h.payload===c){h.config=h.config.split(";").filter(f=>!f.includes("maxaveragebitrate")).join(";"),l.maxbr>0&&(h.config+=";maxaveragebitrate=".concat(l.maxbr*1e3)),u=!0;break}return u||l.maxbr>0&&o.fmtp.push({payload:c,config:"maxaveragebitrate=".concat(l.maxbr*1e3)}),!0})}),i=ci.write(s)}return yield this.setMungedSDP(e,i,!0),this.pendingCandidates.forEach(s=>{this.pc.addIceCandidate(s)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(Is.NegotiationComplete),e.sdp&&ci.parse(e.sdp).media.forEach(o=>{o.type==="video"&&this.emit(Is.RTPVideoPayloadTypes,o.rtp)})),!0})}createAndSendOffer(e){return E(this,void 0,void 0,function*(){var n;const r=yield this.offerLock.lock();try{if(this.onOffer===void 0)return;if(e!=null&&e.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const a=this._pc.remoteDescription;if(e!=null&&e.iceRestart&&a)yield this._pc.setRemoteDescription(a);else{this.renegotiate=!0,this.log.debug("requesting renegotiation",Object.assign({},this.logContext));return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const i=this.latestOfferId+1;this.latestOfferId=i;const s=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:s.sdp},this.logContext));const o=ci.parse((n=s.sdp)!==null&&n!==void 0?n:"");if(o.media.forEach(a=>{mw(a),a.type==="audio"?fw(a,["all"],[]):a.type==="video"&&this.trackBitrates.some(l=>{if(!a.msid||!l.cid||!a.msid.includes(l.cid))return!1;let c=0;if(a.rtp.some(h=>h.codec.toUpperCase()===l.codec.toUpperCase()?(c=h.payload,!0):!1),c===0||(qn(l.codec)&&!Fs()&&this.ensureVideoDDExtensionForSVC(a,o),!qn(l.codec)))return!0;const u=Math.round(l.maxbr*EU);for(const h of a.fmtp)if(h.payload===c){h.config.includes("x-google-start-bitrate")||(h.config+=";x-google-start-bitrate=".concat(u));break}return!0})}),this.latestOfferId>i){this.log.warn("latestOfferId mismatch",Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:i}));return}yield this.setMungedSDP(s,ci.write(o)),this.onOffer(s,this.latestOfferId)}finally{r()}})}createAndSetAnswer(){return E(this,void 0,void 0,function*(){var e;const n=yield this.pc.createAnswer(),r=ci.parse((e=n.sdp)!==null&&e!==void 0?e:"");return r.media.forEach(i=>{mw(i),i.type==="audio"&&fw(i,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(n,ci.write(r)),n})}createDataChannel(e,n){return this.pc.createDataChannel(e,n)}addTransceiver(e,n){return this.pc.addTransceiver(e,n)}addTransceiverOfKind(e,n){return this.pc.addTransceiver(e,n)}addTrack(e){if(!this._pc)throw new tt("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var n;if(!this._pc)throw new tt("PC closed, cannot configure");return(n=this._pc)===null||n===void 0?void 0:n.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var n;return(n=this._pc)===null||n===void 0?void 0:n.removeTrack(e)}getConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&n!==void 0?n:"closed"}getICEConnectionState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&n!==void 0?n:"closed"}getSignallingState(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&n!==void 0?n:"closed"}getTransceivers(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&n!==void 0?n:[]}getSenders(){var e,n;return(n=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&n!==void 0?n:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return E(this,void 0,void 0,function*(){var e;if(!this._pc)return;let n="";const r=new Map,i=new Map;
410if((yield this._pc.getStats()).forEach(a=>{switch(a.type){case"transport":n=a.selectedCandidatePairId;break;case"candidate-pair":n===""&&a.selected&&(n=a.id),r.set(a.id,a);break;case"remote-candidate":i.set(a.id,"".concat(a.address,":").concat(a.port));break}}),n==="")return;const o=(e=r.get(n))===null||e===void 0?void 0:e.remoteCandidateId;if(o!==void 0)return i.get(o)})}setMungedSDP(e,n,r){return E(this,void 0,void 0,function*(){if(n){const i=e.sdp;e.sdp=n;try{this.log.debug("setting munged ".concat(r?"remote":"local"," description"),this.logContext),r?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(s){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:s,sdp:n})),e.sdp=i}}try{r?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(i){let s="unknown error";i instanceof Error?s=i.message:typeof i=="string"&&(s=i);const o={error:s,sdp:e.sdp};throw!r&&this.pc.remoteDescription&&(o.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:o})),new Ps(s)}})}ensureVideoDDExtensionForSVC(e,n){var r,i;if(!((r=e.ext)===null||r===void 0?void 0:r.some(o=>o.uri===Jb))){if(this.ddExtID===0){let o=0;n.media.forEach(a=>{var l;a.type==="video"&&((l=a.ext)===null||l===void 0||l.forEach(c=>{c.value>o&&(o=c.value)}))}),this.ddExtID=o+1}(i=e.ext)===null||i===void 0||i.push({value:this.ddExtID,uri:Jb})}}}function fw(t,e,n){const r=Xv(t.mid);let i=0;t.rtp.some(s=>s.codec==="opus"?(i=s.payload,!0):!1),i>0&&(t.rtcpFb||(t.rtcpFb=[]),n.includes(r)&&!t.rtcpFb.some(s=>s.payload===i&&s.type==="nack")&&t.rtcpFb.push({payload:i,type:"nack"}),(e.includes(r)||e.length===1&&e[0]==="all")&&t.fmtp.some(s=>s.payload===i?(s.config.includes("stereo=1")||(s.config+=";stereo=1"),!0):!1))}function PU(t){var e;const n=[],r=[],i=ci.parse((e=t.sdp)!==null&&e!==void 0?e:"");let s=0;return i.media.forEach(o=>{var a;const l=Xv(o.mid);o.type==="audio"&&(o.rtp.some(c=>c.codec==="opus"?(s=c.payload,!0):!1),!((a=o.rtcpFb)===null||a===void 0)&&a.some(c=>c.payload===s&&c.type==="nack")&&r.push(l),o.fmtp.some(c=>c.payload===s?(c.config.includes("sprop-stereo=1")&&n.push(l),!0):!1))}),{stereoMids:n,nackMids:r}}function mw(t){if(t.connection){const e=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&e||t.connection.version===6&&!e)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}function Xv(t){return typeof t=="number"?t.toFixed(0):t}const Ap="vp8",RU={audioPreset:Sp.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:Hv.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:Ap,backupCodec:!0,preConnectBuffer:!1},TE={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},CE={deviceId:{ideal:"default"},resolution:Jl.h720.resolution},IU={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new a3,disconnectOnPageLeave:!0,webAudioMix:!1,singlePeerConnection:!0},Zv={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Ve;(function(t){t[t.NEW=0]="NEW",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.FAILED=3]="FAILED",t[t.CLOSING=4]="CLOSING",t[t.CLOSED=5]="CLOSED"})(Ve||(Ve={}));class NU{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}get mode(){return this._mode}constructor(e,n,r){var i;this.peerConnectionTimeout=Zv.peerConnectionTimeout,this.log=de,this.updateState=()=>{var s,o;const a=this.state,l=this.requiredTransports.map(c=>c.getConnectionState());l.every(c=>c==="connected")?this.state=Ve.CONNECTED:l.some(c=>c==="failed")?this.state=Ve.FAILED:l.some(c=>c==="connecting")?this.state=Ve.CONNECTING:l.every(c=>c==="closed")?this.state=Ve.CLOSED:l.some(c=>c==="closed")?this.state=Ve.CLOSING:l.every(c=>c==="new")&&(this.state=Ve.NEW),a!==this.state&&(this.log.debug("pc state change: from ".concat(Ve[a]," to ").concat(Ve[this.state]),this.logContext),(s=this.onStateChange)===null||s===void 0||s.call(this,this.state,this.publisher.getConnectionState(),(o=this.subscriber)===null||o===void 0?void 0:o.getConnectionState()))},this.log=wr((i=r.loggerName)!==null&&i!==void 0?i:Cn.PCManager),this.loggerOptions=r,this.isPublisherConnectionRequired=n!=="subscriber-primary",this.isSubscriberConnectionRequired=n==="subscriber-primary",this.publisher=new hw(e,r),this._mode=n,n!=="publisher-only"&&(this.subscriber=new hw(e,r),this.subscriber.onConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.subscriber.onIceCandidate=s=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,s,Wn.SUBSCRIBER)},this.subscriber.onDataChannel=s=>{var o;(o=this.onDataChannel)===null||o===void 0||o.call(this,s)},this.subscriber.onTrack=s=>{var o;(o=this.onTrack)===null||o===void 0||o.call(this,s)}),this.publisher.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=s=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,s,Wn.PUBLISHER)},this.publisher.onTrack=s=>{var o;(o=this.onTrack)===null||o===void 0||o.call(this,s)},this.publisher.onOffer=(s,o)=>{var a;(a=this.onPublisherOffer)===null||a===void 0||a.call(this,s,o)},this.state=Ve.NEW,this.connectionLock=new Ft,this.remoteOfferLock=new Ft}get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions).loggerContextCb)===null||n===void 0?void 0:n.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e,n){return this.publisher.setRemoteDescription(e,n)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return E(this,void 0,void 0,function*(){var e;if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const n=this.publisher;for(const r of n.getSenders())try{n.canRemoveTrack()&&n.removeTrack(r)}catch(i){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:i}))}}yield Promise.all([this.publisher.close(),(e=this.subscriber)===null||e===void 0?void 0:e.close()]),this.updateState()})}triggerIceRestart(){return E(this,void 0,void 0,function*(){this.subscriber&&(this.subscriber.restartingIce=!0),this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,n){return E(this,void 0,void 0,function*(){var r;n===Wn.PUBLISHER?yield this.publisher.addIceCandidate(e):yield(r=this.subscriber)===null||r===void 0?void 0:r.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e,n){return E(this,void 0,void 0,function*(){var r,i,s;this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:(r=this.subscriber)===null||r===void 0?void 0:r.getSignallingState().toString()}));const o=yield this.remoteOfferLock.lock();try{return(yield(i=this.subscriber)===null||i===void 0?void 0:i.setRemoteDescription(e,n))?yield(s=this.subscriber)===null||s===void 0?void 0:s.createAndSetAnswer():void 0}finally{o()}})}updateConfiguration(e,n){var r;this.publisher.setConfiguration(e),(r=this.subscriber)===null||r===void 0||r.setConfiguration(e),n&&this.triggerIceRestart()}ensurePCTransportConnection(e,n){return E(this,void 0,void 0,function*(){var r;const i=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((r=this.requiredTransports)===null||r===void 0?void 0:r.map(s=>
410this.ensureTransportConnected(s,e,n)))}finally{i()}})}negotiate(e){return E(this,void 0,void 0,function*(){return new Nt((n,r)=>E(this,void 0,void 0,function*(){let i=setTimeout(()=>{r(new Ps("negotiation timed out"))},this.peerConnectionTimeout);const s=()=>{clearTimeout(i),this.publisher.off(Is.NegotiationStarted,a),e.signal.removeEventListener("abort",o)},o=()=>{s(),r(new Ps("negotiation aborted"))},a=()=>{e.signal.aborted||(clearTimeout(i),i=setTimeout(()=>{s(),r(new Ps("negotiation timed out"))},this.peerConnectionTimeout))};e.signal.addEventListener("abort",o),this.publisher.on(Is.NegotiationStarted,a),this.publisher.once(Is.NegotiationComplete,()=>{s(),n()}),yield this.publisher.negotiate(l=>{s(),l instanceof Error?r(l):r(new Error(String(l)))})}))})}addPublisherTransceiver(e,n){return this.publisher.addTransceiver(e,n)}addPublisherTransceiverOfKind(e,n){return this.publisher.addTransceiverOfKind(e,n)}getMidForReceiver(e){const r=(this.subscriber?this.subscriber.getTransceivers():this.publisher.getTransceivers()).find(i=>i.receiver===e);return r==null?void 0:r.mid}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,n){return this.publisher.createDataChannel(e,n)}getConnectedAddress(e){return e===Wn.PUBLISHER?this.publisher.getConnectedAddress():e===Wn.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&this.subscriber&&e.push(this.subscriber),e}ensureTransportConnected(e,n){return E(this,arguments,void 0,function(r,i){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(r.getConnectionState()!=="connected")return new Promise((l,c)=>E(s,void 0,void 0,function*(){const u=()=>{this.log.warn("abort transport connection",this.logContext),wt.clearTimeout(h),c(re.cancelled("room connection has been cancelled"))};i!=null&&i.signal.aborted&&u(),i==null||i.signal.addEventListener("abort",u);const h=wt.setTimeout(()=>{i==null||i.signal.removeEventListener("abort",u),c(re.internal("could not establish pc connection"))},o);for(;this.state!==Ve.CONNECTED;)if(yield xt(50),i!=null&&i.signal.aborted){c(re.cancelled("room connection has been cancelled"));return}wt.clearTimeout(h),i==null||i.signal.removeEventListener("abort",u),l()}))}()})}}const EE=5e3,AU=3e4;class ye{static fetchRegionSettings(e,n,r){return E(this,void 0,void 0,function*(){const i=yield ye.fetchLock.lock();try{const s=yield fetch("".concat(OU(e),"/regions"),{headers:{authorization:"Bearer ".concat(n)},signal:r});if(s.ok){const o=tU(s.headers),a=o?o*1e3:EE;return{regionSettings:yield s.json(),updatedAtInMs:Date.now(),maxAgeInMs:a}}else throw s.status===401?re.notAllowed("Could not fetch region settings: ".concat(s.statusText),s.status):re.internal("Could not fetch region settings: ".concat(s.statusText))}catch(s){throw s instanceof re?s:r!=null&&r.aborted?re.cancelled("Region fetching was aborted"):re.serverUnreachable("Could not fetch region settings, ".concat(s instanceof Error?"".concat(s.name,": ").concat(s.message):s))}finally{i()}})}static scheduleRefetch(e,n,r){return E(this,void 0,void 0,function*(){const i=ye.settingsTimeouts.get(e.hostname);clearTimeout(i),ye.settingsTimeouts.set(e.hostname,setTimeout(()=>E(this,void 0,void 0,function*(){try{const s=yield ye.fetchRegionSettings(e,n);ye.updateCachedRegionSettings(e,n,s)}catch(s){if(s instanceof re&&s.reason===Ae.NotAllowed){de.debug("token is not valid, cancelling auto region refresh");return}de.debug("auto refetching of region settings failed",{error:s}),ye.scheduleRefetch(e,n,r)}}),r))})}static updateCachedRegionSettings(e,n,r){ye.cache.set(e.hostname,r),ye.scheduleRefetch(e,n,r.maxAgeInMs)}static stopRefetch(e){const n=ye.settingsTimeouts.get(e);n&&(clearTimeout(n),ye.settingsTimeouts.delete(e))}static scheduleCleanup(e){let n=ye.connectionTrackers.get(e);n&&(n.cleanupTimeout&&clearTimeout(n.cleanupTimeout),n.cleanupTimeout=setTimeout(()=>{const r=ye.connectionTrackers.get(e);r&&r.connectionCount===0&&(de.debug("stopping region refetch after disconnect delay",{hostname:e}),ye.stopRefetch(e)),r&&(r.cleanupTimeout=void 0)},AU))}static cancelCleanup(e){const n=ye.connectionTrackers.get(e);n!=null&&n.cleanupTimeout&&(clearTimeout(n.cleanupTimeout),n.cleanupTimeout=void 0)}notifyConnected(){const e=this.serverUrl.hostname;let n=ye.connectionTrackers.get(e);n||(n={connectionCount:0},ye.connectionTrackers.set(e,n)),n.connectionCount++,ye.cancelCleanup(e)}notifyDisconnected(){const e=this.serverUrl.hostname,n=ye.connectionTrackers.get(e);n&&(n.connectionCount=Math.max(0,n.connectionCount-1),n.connectionCount===0&&ye.scheduleCleanup(e))}constructor(e,n){this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=n}updateToken(e){this.token=e}isCloud(){return ba(this.serverUrl)}getServerUrl(){return this.serverUrl}fetchRegionSettings(e){return E(this,void 0,void 0,function*(){return ye.fetchRegionSettings(this.serverUrl,this.token,e)})}getNextBestRegionUrl(e){return E(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");let n=ye.cache.get(this.serverUrl.hostname);(!n||Date.now()-n.updatedAtInMs>n.maxAgeInMs)&&(n=yield this.fetchRegionSettings(e),ye.updateCachedRegionSettings(this.serverUrl,this.token,n));const r=n.regionSettings.regions.filter(i=>!this.attemptedRegions.find(s=>s.url===i.url));if(r.length>0){const i=r[0];return this.attemptedRegions.push(i),de.debug("next region: ".concat(i.region)),i.url}else return null})}resetAttempts(){this.attemptedRegions=[]}setServerReportedRegions(e){ye.updateCachedRegionSettings(this.serverUrl,this.token,e)}}ye.cache=new Map;ye.settingsTimeouts=new Map;ye.connectionTrackers=new Map;ye.fetchLock=new Ft;function OU(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}
410class Ze extends Error{constructor(e,n,r){super(n),this.code=e,this.message=pw(n,Ze.MAX_MESSAGE_BYTES),this.data=r?pw(r,Ze.MAX_DATA_BYTES):void 0}static fromProto(e){return new Ze(e.code,e.message,e.data)}toProto(){return new m1({code:this.code,message:this.message,data:this.data})}static builtIn(e,n){return new Ze(Ze.ErrorCode[e],Ze.ErrorMessage[e],n)}}Ze.MAX_MESSAGE_BYTES=256;Ze.MAX_DATA_BYTES=15360;Ze.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404};Ze.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const _E=15360;function ey(t){return new TextEncoder().encode(t).length}function pw(t,e){if(ey(t)<=e)return t;let n=0,r=t.length;const i=new TextEncoder;for(;n<r;){const s=Math.floor((n+r+1)/2);i.encode(t.slice(0,s)).length<=e?n=s:r=s-1}return t.slice(0,n)}const ty=2e3;function gh(t,e){if(!e)return 0;let n,r;return"bytesReceived"in t?(n=t.bytesReceived,r=e.bytesReceived):"bytesSent"in t&&(n=t.bytesSent,r=e.bytesSent),n===void 0||r===void 0||t.timestamp===void 0||e.timestamp===void 0?0:(n-r)*8*1e3/(t.timestamp-e.timestamp)}const ny=typeof MediaRecorder<"u";class MU{constructor(){throw new Error("MediaRecorder is not available in this environment")}}const jU=ny?MediaRecorder:MU;class DU extends jU{constructor(e,n){if(!ny)throw new Error("MediaRecorder is not available in this environment");super(new MediaStream([e.mediaStreamTrack]),n);let r,i;const s=()=>i===void 0,o=()=>{this.removeEventListener("dataavailable",r),this.removeEventListener("stop",o),this.removeEventListener("error",a),i==null||i.close(),i=void 0},a=l=>{i==null||i.error(l),this.removeEventListener("dataavailable",r),this.removeEventListener("stop",o),this.removeEventListener("error",a),i=void 0};this.byteStream=new ReadableStream({start:l=>{i=l,r=c=>E(this,void 0,void 0,function*(){let u;if(c.data.arrayBuffer){const h=yield c.data.arrayBuffer();u=new Uint8Array(h)}else if(c.data.byteArray)u=c.data.byteArray;else throw new Error("no data available!");s()||l.enqueue(u)}),this.addEventListener("dataavailable",r)},cancel:()=>{o()}}),this.addEventListener("stop",o),this.addEventListener("error",a)}}function LU(){return ny}const UU=1e3,FU=1e4;class PE extends D{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=arguments.length>4?arguments[4]:void 0;super(e,n,s),this.manuallyStopped=!1,this.pendingDeviceChange=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=Qv(()=>E(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>E(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit($.Ended,this)},this.reacquireTrack=!1,this.providedByUser=i,this.muteLock=new Ft,this.pauseUpstreamLock=new Ft,this.trackChangeLock=new Ft,this.trackChangeLock.lock().then(o=>E(this,void 0,void 0,function*(){try{yield this.setMediaStreamTrack(e,!0)}finally{o()}})),this._constraints=e.getConstraints(),r&&(this._constraints=r)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==D.Kind.Video)return;const{width:e,height:n}=this._mediaStreamTrack.getSettings();if(e&&n)return{width:e,height:n}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,n;return(n=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&n!==void 0?n:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,n){return E(this,void 0,void 0,function*(){var r;if(e===this._mediaStreamTrack&&!n)return;
vendor: 5,876 bytes, line 410
410this._mediaStreamTrack&&(this.attachedElements.forEach(s=>{qo(this._mediaStreamTrack,s)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let i;if(this.processor&&e){if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(Ro(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),i=this.processor.processedTrack}this.sender&&((r=this.sender.transport)===null||r===void 0?void 0:r.state)!=="closed"&&(yield this.sender.replaceTrack(i??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(s=>{Ro(i??e,s)}))})}waitForDimensions(){return E(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:UU;return function*(){var r;if(e.kind===D.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((r=Qt())===null||r===void 0?void 0:r.os)==="iOS"&&(yield xt(10));const i=Date.now();for(;Date.now()-i<n;){const s=e.dimensions;if(s)return s;yield xt(50)}throw new Fr("unable to get track dimensions after timeout")}()})}setDeviceId(e){return E(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===Rs(e)?!0:(this._constraints.deviceId=e,this.isMuted?(this.pendingDeviceChange=!0,!0):(yield this.restartTrack(),Rs(e)===this._mediaStreamTrack.getSettings().deviceId))})}getDeviceId(){return E(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===D.Source.ScreenShare)return;const{deviceId:r,groupId:i}=e._mediaStreamTrack.getSettings(),s=e.kind===D.Kind.Audio?"audioinput":"videoinput";return n?mt.getInstance().normalizeDeviceId(s,r,i):r}()})}mute(){return E(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return E(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,n){return E(this,void 0,void 0,function*(){const r=yield this.trackChangeLock.lock();try{if(!this.sender)throw new Fr("unable to replace an unpublished track");let i,s;return typeof n=="boolean"?i=n:n!==void 0&&(i=n.userProvidedTrack,s=n.stopProcessor),this.providedByUser=i??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),s&&this.processor&&(yield this.internalStopProcessor()),this}finally{r()}})}restart(e){return E(this,void 0,void 0,function*(){this.manuallyStopped=!1;const n=yield this.trackChangeLock.lock();try{e||(e=this._constraints);const{deviceId:r,facingMode:i}=e,s=l3(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const o={audio:!1,video:!1};this.kind===D.Kind.Video?o.video=r||i?{deviceId:r,facingMode:i}:!0:o.audio=r?Object.assign({deviceId:r},s):!0,this.attachedElements.forEach(c=>{qo(this.mediaStreamTrack,c)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const l=(yield navigator.mediaDevices.getUserMedia(o)).getTracks()[0];return this.kind===D.Kind.Video&&(yield l.applyConstraints(s)),l.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(l),this._constraints=e,this.pendingDeviceChange=!1,this.emit($.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{n()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?$.Muted:$.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return E(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),wE()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return E(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit($.UpstreamPaused,this);
410const r=Qt();if((r==null?void 0:r.name)==="Safari"&&kr(r.version,"12.0")<0)throw new qv("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{n()}})}resumeUpstream(){return E(this,void 0,void 0,function*(){var e;const n=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit($.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{n()}})}getRTCStatsReport(){return E(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return E(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s;const o=yield r.trackChangeLock.lock();try{r.log.debug("setting up processor",r.logContext);const a=document.createElement(r.kind),l={kind:r.kind,track:r._mediaStreamTrack,element:a,audioContext:r.audioContext};if(yield n.init(l),r.log.debug("processor initialized",r.logContext),r.processor&&(yield r.internalStopProcessor()),r.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(Ro(r._mediaStreamTrack,a),a.muted=!0,a.play().catch(c=>{c instanceof DOMException&&c.name==="AbortError"?(r.log.warn("failed to play processor element, retrying",Object.assign(Object.assign({},r.logContext),{error:c})),setTimeout(()=>{a.play().catch(u=>{r.log.error("failed to play processor element",Object.assign(Object.assign({},r.logContext),{err:u}))})},100)):r.log.error("failed to play processor element",Object.assign(Object.assign({},r.logContext),{error:c}))}),r.processor=n,r.processorElement=a,r.processor.processedTrack){for(const c of r.attachedElements)c!==r.processorElement&&i&&(qo(r._mediaStreamTrack,c),Ro(r.processor.processedTrack,c));yield(s=r.sender)===null||s===void 0?void 0:s.replaceTrack(r.processor.processedTrack)}r.emit($.TrackProcessorUpdate,r.processor)}finally{o()}}()})}getProcessor(){return this.processor}stopProcessor(){return E(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const r=yield e.trackChangeLock.lock();try{yield e.internalStopProcessor(n)}finally{r()}}()})}internalStopProcessor(){return E(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var r,i;e.processor&&(e.log.debug("stopping processor",e.logContext),(r=e.processor.processedTrack)===null||r===void 0||r.stop(),yield e.processor.destroy(),e.processor=void 0,n||((i=e.processorElement)===null||i===void 0||i.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit($.TrackProcessorUpdate))}()})}startPreConnectBuffer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!LU()){this.log.warn("MediaRecorder is not available, cannot start preconnect buffer",this.logContext);return}if(this.localTrackRecorder){this.log.warn("preconnect buffer already started");return}else{let n="audio/webm;codecs=opus";MediaRecorder.isTypeSupported(n)||(n="video/mp4"),this.localTrackRecorder=new DU(this,{mimeType:n})}this.localTrackRecorder.start(e),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},FU)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&(this.localTrackRecorder.stop(),this.localTrackRecorder=void 0)}getPreConnectBuffer(){var e;return(e=this.localTrackRecorder)===null||e===void 0?void 0:e.byteStream}getPreConnectBufferMimeType(){var e;return(e=this.localTrackRecorder)===null||e===void 0?void 0:e.mimeType}}class kd extends PE{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;super(e,D.Kind.Audio,n,r,s),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>E(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let o;
vendor: 18,067 bytes, line 410
410try{o=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}o&&this.prevStats&&(this._currentBitrate=gh(o,this.prevStats)),this.prevStats=o}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit($.AudioTrackFeatureUpdate,this,ft.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit($.AudioTrackFeatureUpdate,this,ft.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=i,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return E(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===D.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return E(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.source===D.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||this.pendingDeviceChange)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{n()}})}restartTrack(e){return E(this,void 0,void 0,function*(){let n;if(e){const r=Kv({audio:e});typeof r.audio!="boolean"&&(n=r.audio)}yield this.restart(n)})}restart(e){const n=Object.create(null,{restart:{get:()=>super.restart}});return E(this,void 0,void 0,function*(){const r=yield n.restart.call(this,e);return this.checkForSilence(),r})}startMonitor(){Kt()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},ty)))}setProcessor(e){return E(this,void 0,void 0,function*(){var n;const r=yield this.trackChangeLock.lock();try{if(!xr()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.internalStopProcessor());const i={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(i),this.processor=e,this.processor.processedTrack&&(yield(n=this.sender)===null||n===void 0?void 0:n.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit($.TrackProcessorUpdate,this.processor)}finally{r()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return E(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const n=yield this.sender.getStats();let r;return n.forEach(i=>{i.type==="outbound-rtp"&&(r={type:"audio",streamId:i.id,packetsSent:i.packetsSent,packetsLost:i.packetsLost,bytesSent:i.bytesSent,timestamp:i.timestamp,roundTripTime:i.roundTripTime,jitter:i.jitter})}),r})}checkForSilence(){return E(this,void 0,void 0,function*(){const e=yield vE(this);return e&&(this.isMuted||this.log.debug("silence detected on local audio track",this.logContext),this.emit($.AudioSilenceDetected)),e})}}function BU(t,e,n){switch(t.kind){case"audio":return new kd(t,e,!1,void 0,n);case"video":return new Sd(t,e,!1,n);default:throw new Fr("unsupported track type: ".concat(t.kind))}}const zU=Object.values(Jl),$U=Object.values(Tp),VU=Object.values(Hv),WU=[Jl.h180,Jl.h360],qU=[Tp.h180,Tp.h360],HU=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(n=>{var r,i;return new Ie(Math.floor(t.width/n.scaleResolutionDownBy),Math.floor(t.height/n.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(n.scaleResolutionDownBy,2)*(((r=t.encoding.maxFramerate)!==null&&r!==void 0?r:30)/((i=n.fps)!==null&&i!==void 0?i:30))))),n.fps,t.encoding.priority)}),Op=["q","h","f"];function Mp(t,e,n,r){var i,s;let o=r==null?void 0:r.videoEncoding;t&&(o=r==null?void 0:r.screenShareEncoding);const a=r==null?void 0:r.simulcast,l=r==null?void 0:r.scalabilityMode,c=r==null?void 0:r.videoCodec;if(!o&&!a&&!l||!e||!n)return[{}];o||(o=GU(t,e,n,c),de.debug("using video encoding",o));const u=o.maxFramerate,h=new Ie(e,n,o.maxBitrate,o.maxFramerate,o.priority);if(l&&qn(c)){const b=new RE(l),p=[];if(b.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(l));const g=Qt();if(Yl()||xr()||(g==null?void 0:g.name)==="Chrome"&&kr(g==null?void 0:g.version,"113")<0){const v=b.suffix=="h"?2:3,y=V3(g);for(let w=0;w<b.spatial;w+=1)p.push({rid:Op[2-w],maxBitrate:o.maxBitrate/Math.pow(v,w),maxFramerate:h.encoding.maxFramerate,scaleResolutionDownBy:y?Math.pow(2,w):void 0});p[0].scalabilityMode=l}else p.push({maxBitrate:o.maxBitrate,maxFramerate:h.encoding.maxFramerate,scalabilityMode:l});return h.encoding.priority&&(p[0].priority=h.encoding.priority,p[0].networkPriority=h.encoding.priority),de.debug("using svc encoding",{encodings:p}),p}if(!a)return[o];let f=[];t?f=(i=vw(r==null?void 0:r.screenShareSimulcastLayers))!==null&&i!==void 0?i:gw(t,h):f=(s=vw(r==null?void 0:r.videoSimulcastLayers))!==null&&s!==void 0?s:gw(t,h);let m;if(f.length>0){const b=f[0];f.length>1&&([,m]=f);const p=Math.max(e,n);if(p>=960&&m)return If(e,n,[b,m,h],u);if(p>=480)return If(e,n,[b,h],u)}return If(e,n,[h])}function KU(t,e,n){var r,i,s,o;if(!n.backupCodec||n.backupCodec===!0||n.backupCodec.codec===n.videoCodec)return;e!==n.backupCodec.codec&&de.warn("requested a different codec than specified as backup",{serverRequested:e,backup:n.backupCodec.codec}),n.videoCodec=e,n.videoEncoding=n.backupCodec.encoding;const a=t.mediaStreamTrack.getSettings(),l=(r=a.width)!==null&&r!==void 0?r:(i=t.dimensions)===null||i===void 0?void 0:i.width,c=(s=a.height)!==null&&s!==void 0?s:(o=t.dimensions)===null||o===void 0?void 0:o.height;return t.source===D.Source.ScreenShare&&n.simulcast&&(n.simulcast=!1),Mp(t.source===D.Source.ScreenShare,l,c,n)}function GU(t,e,n,r){const i=JU(t,e,n);let{encoding:s}=i[0];const o=Math.max(e,n);for(let a=0;a<i.length;a+=1){const l=i[a];if(s=l.encoding,l.width>=o)break}if(r)switch(r){case"av1":case"h265":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.7;break;case"vp9":s=Object.assign({},s),s.maxBitrate=s.maxBitrate*.85;break}return s}function JU(t,e,n){if(t)return VU;const r=e>n?e/n:n/e;return Math.abs(r-16/9)<Math.abs(r-4/3)?zU:$U}function gw(t,e){if(t)return HU(e);const{width:n,height:r}=e,i=n>r?n/r:r/n;return Math.abs(i-16/9)<Math.abs(i-4/3)?WU:qU}function If(t,e,n,r){const i=[];if(n.forEach((s,o)=>{if(o>=Op.length)return;const a=Math.min(t,e),c={rid:Op[o],scaleResolutionDownBy:Math.max(1,a/Math.min(s.width,s.height)),maxBitrate:s.encoding.maxBitrate},u=r&&s.encoding.maxFramerate?Math.min(r,s.encoding.maxFramerate):s.encoding.maxFramerate;u&&(c.maxFramerate=u);const h=Us()||o===0;s.encoding.priority&&h&&(c.priority=s.encoding.priority,c.networkPriority=s.encoding.priority),i.push(c)}),xr()&&kE()==="ios"){let s;i.forEach(a=>{s?a.maxFramerate&&a.maxFramerate>s&&(s=a.maxFramerate):s=a.maxFramerate});let o=!0;i.forEach(a=>{var l;a.maxFramerate!=s&&(o&&(o=!1,de.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),de.info('Setting framerate of encoding "'.concat((l=a.rid)!==null&&l!==void 0?l:"",'" to ').concat(s)),a.maxFramerate=s)})}return i}function vw(t){if(t)return t.sort((e,n)=>{const{encoding:r}=e,{encoding:i}=n;return r.maxBitrate>i.maxBitrate?1:r.maxBitrate<i.maxBitrate?-1:r.maxBitrate===i.maxBitrate&&r.maxFramerate&&i.maxFramerate?r.maxFramerate>i.maxFramerate?1:-1:0})}class RE{constructor(e){const n=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!n)throw new Error("invalid scalability mode");if(this.spatial=parseInt(n[1]),this.temporal=parseInt(n[2]),n.length>3)switch(n[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=n[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function YU(t){return t.source===D.Source.ScreenShare||t.constraints.height&&Rs(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const QU=5e3;class Sd extends PE{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0;super(e,D.Kind.Video,n,r,i),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.isCpuConstrained=!1,this.optimizeForPerformance=!1,this.monitorSender=()=>E(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(l){this.log.error("could not get video sender stats",Object.assign(Object.assign({},this.logContext),{error:l}));return}const o=new Map(s.map(l=>[l.rid,l])),a=s.some(l=>l.qualityLimitationReason==="cpu");if(a!==this.isCpuConstrained&&(this.isCpuConstrained=a,this.isCpuConstrained&&this.emit($.CpuConstrained)),this.prevStats){let l=0;o.forEach((c,u)=>{var h;const f=(h=this.prevStats)===null||h===void 0?void 0:h.get(u);l+=gh(c,f)}),this._currentBitrate=l}this.prevStats=o}),this.senderLock=new Ft}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var n;if(this.signalClient=e,!Kt())return;const r=(n=this.sender)===null||n===void 0?void 0:n.getParameters();r&&(this.encodings=r.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},ty))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return E(this,void 0,void 0,function*(){var n,r,i,s,o;yield e.pauseUpstream.call(this);try{for(var a=!0,l=Ur(this.simulcastCodecs.values()),c;c=yield l.next(),n=c.done,!n;a=!0)s=c.value,a=!1,yield(o=s.sender)===null||o===void 0?void 0:o.replaceTrack(null)}catch(u){r={error:u}}finally{try{!a&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return E(this,void 0,void 0,function*(){var n,r,i,s,o;yield e.resumeUpstream.call(this);try{for(var a=!0,l=Ur(this.simulcastCodecs.values()),c;c=yield l.next(),n=c.done,!n;a=!0){s=c.value,a=!1;const u=s;yield(o=u.sender)===null||o===void 0?void 0:o.replaceTrack(u.mediaStreamTrack)}}catch(u){r={error:u}}finally{try{!a&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return E(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===D.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{n()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return E(this,void 0,void 0,function*(){const n=yield this.muteLock.lock();try{return this.isMuted?(this.source===D.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{n()}})}setTrackMuted(e){super.setTrackMuted(e);for(const n of this.simulcastCodecs.values())n.mediaStreamTrack.enabled=!e}getSenderStats(){return E(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const n=[],r=yield this.sender.getStats();return r.forEach(i=>{var s;if(i.type==="outbound-rtp"){const o={type:"video",streamId:i.id,frameHeight:i.frameHeight,frameWidth:i.frameWidth,framesPerSecond:i.framesPerSecond,framesSent:i.framesSent,firCount:i.firCount,pliCount:i.pliCount,nackCount:i.nackCount,packetsSent:i.packetsSent,bytesSent:i.bytesSent,qualityLimitationReason:i.qualityLimitationReason,qualityLimitationDurations:i.qualityLimitationDurations,qualityLimitationResolutionChanges:i.qualityLimitationResolutionChanges,rid:(s=i.rid)!==null&&s!==void 0?s:i.id,retransmittedPacketsSent:i.retransmittedPacketsSent,targetBitrate:i.targetBitrate,timestamp:i.timestamp},a=r.get(i.remoteId);a&&(o.jitter=a.jitter,o.packetsLost=a.packetsLost,o.roundTripTime=a.roundTripTime),n.push(o)}}),n.sort((i,s)=>{var o,a;return((o=s.frameWidth)!==null&&o!==void 0?o:0)-((a=i.frameWidth)!==null&&a!==void 0?a:0)}),n})}setPublishingQuality(e){const n=[];for(let r=sn.LOW;r<=sn.HIGH;r+=1)n.push(new Bv({quality:r,enabled:r<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(qn(this.codec),n)}restartTrack(e){return E(this,void 0,void 0,function*(){var n,r,i,s,o;let a;if(e){const h=Kv({video:e});typeof h.video!="boolean"&&(a=h.video)}yield this.restart(a),this.isCpuConstrained=!1;try{for(var l=!0,c=Ur(this.simulcastCodecs.values()),u;u=yield c.next(),n=u.done,!n;l=!0){s=u.value,l=!1;const h=s;h.sender&&((o=h.sender.transport)===null||o===void 0?void 0:o.state)!=="closed"&&(h.mediaStreamTrack=this.mediaStreamTrack.clone(),yield h.sender.replaceTrack(h.mediaStreamTrack))}}catch(h){r={error:h}}finally{try{!l&&!n&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}})}setProcessor(e){const n=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return E(this,arguments,void 0,function(r){var i=this;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var o,a,l,c,u,h;if(yield n.setProcessor.call(i,r,s),!((u=i.processor)===null||u===void 0)&&u.processedTrack)try{for(var f=!0,m=Ur(i.simulcastCodecs.values()),b;b=yield m.next(),o=b.done,!o;f=!0)c=b.value,f=!1,yield(h=c.sender)===null||h===void 0?void 0:h.replaceTrack(i.processor.processedTrack)}catch(p){a={error:p}}finally{try{!f&&!o&&(l=m.return)&&(yield l.call(m))}finally{if(a)throw a.error}}}()})}setDegradationPreference(e){return E(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const n=this.sender.getParameters();n.degradationPreference=e,this.sender.setParameters(n)}catch(n){this.log.warn("failed to set degradationPreference",Object.assign({error:n},this.logContext))}})}addSimulcastTrack(e,n){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const r={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:n};return this.simulcastCodecs.set(e,r),r}setSimulcastTrackSender(e,n){const r=this.simulcastCodecs.get(e);r&&(r.sender=n,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},QU))}setPublishingCodecs(e){return E(this,void 0,void 0,function*(){var n,r,i,s,o,a,l;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(qn(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const c=[];try{for(n=!0,r=Ur(e);i=yield r.next(),s=i.done,!s;n=!0){l=i.value,n=!1;const u=l;if(!this.codec||this.codec===u.codec)yield this.setPublishingLayers(qn(u.codec),u.qualities);else{const h=this.simulcastCodecs.get(u.codec);if(this.log.debug("try setPublishingCodec for ".concat(u.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:h})),!h||!h.sender){for(const f of u.qualities)if(f.enabled){c.push(u.codec);break}}else h.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(u.codec),this.logContext),yield yw(h.sender,h.encodings,u.qualities,this.senderLock,qn(u.codec),this.log,this.logContext))}}}catch(u){o={error:u}}finally{try{!n&&!s&&(a=r.return)&&(yield a.call(r))}finally{if(o)throw o.error}}return c})}setPublishingLayers(e,n){return E(this,void 0,void 0,function*(){if(this.optimizeForPerformance){this.log.info("skipping setPublishingLayers due to optimized publishing performance",Object.assign(Object.assign({},this.logContext),{qualities:n}));return}this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:n})),!(!this.sender||!this.encodings)&&(yield yw(this.sender,this.encodings,n,this.senderLock,e,this.log,this.logContext))})}prioritizePerformance(){return E(this,void 0,void 0,function*(){if(!this.sender)throw new Error("sender not found");const e=yield this.senderLock.lock();try{this.optimizeForPerformance=!0;const n=this.sender.getParameters();n.encodings=n.encodings.map((r,i)=>{var s;return Object.assign(Object.assign({},r),{active:i===0,scaleResolutionDownBy:Math.max(1,Math.ceil(((s=this.mediaStreamTrack.getSettings().height)!==null&&s!==void 0?s:360)/360)),scalabilityMode:i===0&&qn(this.codec)?"L1T3":void 0,maxFramerate:i===0?15:0,maxBitrate:i===0?r.maxBitrate:0})}),this.log.debug("setting performance optimised encodings",Object.assign(Object.assign({},this.logContext),{encodings:n.encodings})),this.encodings=n.encodings,yield this.sender.setParameters(n)}catch(n){this.log.error("failed to set performance optimised encodings",Object.assign(Object.assign({},this.logContext),{error:n})),this.optimizeForPerformance=!1}finally{e()}})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return E(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),wE()&&this.isInBackgroun
410d&&this.source===D.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function yw(t,e,n,r,i,s,o){return E(this,void 0,void 0,function*(){const a=yield r.lock();s.debug("setPublishingLayersForSender",Object.assign(Object.assign({},o),{sender:t,qualities:n,senderEncodings:e}));try{const l=t.getParameters(),{encodings:c}=l;if(!c)return;if(c.length!==e.length){s.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},o),{encodings:c,senderEncodings:e}));return}let u=!1;!1&&c[0].scalabilityMode||(i&&n.some(m=>m.enabled)&&n.forEach(m=>m.enabled=!0),c.forEach((f,m)=>{var b;let p=(b=f.rid)!==null&&b!==void 0?b:"";p===""&&(p="q");const g=IE(p),v=n.find(y=>y.quality===g);v&&f.active!==v.enabled&&(u=!0,f.active=v.enabled,s.debug("setting layer ".concat(v.quality," to ").concat(f.active?"enabled":"disabled"),o),Us()&&(v.enabled?(f.scaleResolutionDownBy=e[m].scaleResolutionDownBy,f.maxBitrate=e[m].maxBitrate,f.maxFrameRate=e[m].maxFrameRate):(f.scaleResolutionDownBy=4,f.maxBitrate=10,f.maxFrameRate=2)))})),u&&(l.encodings=c,s.debug("setting encodings",Object.assign(Object.assign({},o),{encodings:l.encodings})),yield t.setParameters(l))}finally{a()}})}function IE(t){switch(t){case"f":return sn.HIGH;case"h":return sn.MEDIUM;case"q":return sn.LOW;default:return sn.HIGH}}function bw(t,e,n,r){if(!n)return[new Di({quality:sn.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(r){const i=n[0].scalabilityMode,s=new RE(i),o=[],a=s.suffix=="h"?1.5:2,l=s.suffix=="h"?2:3;for(let c=0;c<s.spatial;c+=1)o.push(new Di({quality:Math.min(sn.HIGH,s.spatial-1)-c,width:Math.ceil(t/Math.pow(a,c)),height:Math.ceil(e/Math.pow(a,c)),bitrate:n[0].maxBitrate?Math.ceil(n[0].maxBitrate/Math.pow(l,c)):0,ssrc:0}));return o}return n.map(i=>{var s,o,a;const l=(s=i.scaleResolutionDownBy)!==null&&s!==void 0?s:1;let c=IE((o=i.rid)!==null&&o!==void 0?o:"");return new Di({quality:c,width:Math.ceil(t/l),height:Math.ceil(e/l),bitrate:(a=i.maxBitrate)!==null&&a!==void 0?a:0,ssrc:0})})}const ww="_lossy",xw="_reliable",XU=2*1e3,Nf="leave-reconnect",ZU=3e4,e4=8*1024,t4=256*1024;var mn;(function(t){t[t.New=0]="New",t[t.Connected=1]="Connected",t[t.Disconnected=2]="Disconnected",t[t.Reconnecting=3]="Reconnecting",t[t.Closed=4]="Closed"})(mn||(mn={}));class n4 extends Tr.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var n;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=Zv.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=mn.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=de,this.reliableDataSequence=1,this.reliableMessageBuffer=new aw,this.reliableReceivedState=new kU(ZU),this.lossyDataStatCurrentBytes=0,this.lossyDataStatByterate=0,this.lossyDataDropCount=0,this.midToTrackId={},this.isWaitingForNetworkReconnect=!1,this.handleDataChannel=r=>E(this,[r],void 0,function(i){var s=this;let{channel:o}=i;return function*(){if(o){if(o.label===xw)s.reliableDCSub=o;else if(o.label===ww)s.lossyDCSub=o;else return;s.log.debug("on data channel ".concat(o.id,", ").concat(o.label),s.logContext),o.onmessage=s.handleDataMessage}}()}),this.handleDataMessage=r=>E(this,void 0,void 0,function*(){var i,s,o,a,l;const c=yield this.dataProcessLock.lock();try{let u;if(r.data instanceof ArrayBuffer)u=r.data;else if(r.data instanceof Blob)u=yield r.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:r.data}));return}const h=Lt.fromBinary(new Uint8Array(u));if(h.sequence>0&&h.participantSid!==""){const f=this.reliableReceivedState.get(h.participantSid);if(f&&h.sequence<=f)return;this.reliableReceivedState.set(h.participantSid,h.sequence)}if(((i=h.value)===null||i===void 0?void 0:i.case)==="speaker")this.emit(W.ActiveSpeakersUpdate,h.value.value.speakers);else if(((s=h.value)===null||s===void 0?void 0:s.case)==="encryptedPacket"){if(!this.e2eeManager){this.log.error("Received encrypted packet but E2EE not set up",this.logContext);return}const f=yield(o=this.e2eeManager)===null||o===void 0?void 0:o.handleEncryptedData(h.value.value.encryptedValue,h.value.value.iv,h.participantIdentity,h.value.value.keyIndex),m=d1.fromBinary(f.payload),b=new Lt({value:m.value,participantIdentity:h.participantIdentity,participantSid:h.participantSid});((a=b.value)===null||a===void 0?void 0:a.case)==="user"&&kw(b,b.value.value),this.emit
410(W.DataPacketReceived,b,h.value.value.encryptionType)}else((l=h.value)===null||l===void 0?void 0:l.case)==="user"&&kw(h,h.value.value),this.emit(W.DataPacketReceived,h,it.NONE)}finally{c()}}),this.handleDataError=r=>{const s=r.currentTarget.maxRetransmits===0?"lossy":"reliable";if(r instanceof ErrorEvent&&r.error){const{error:o}=r.error;this.log.error("DataChannel error on ".concat(s,": ").concat(r.message),Object.assign(Object.assign({},this.logContext),{error:o}))}else this.log.error("Unknown DataChannel error on ".concat(s),Object.assign(Object.assign({},this.logContext),{event:r}))},this.handleBufferedAmountLow=r=>{const s=r.currentTarget.maxRetransmits===0?he.LOSSY:he.RELIABLE;this.updateAndEmitDCBufferStatus(s)},this.handleDisconnect=(r,i)=>{if(this._isClosed)return;this.log.warn("".concat(r," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const s=l=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(l,"ms. giving up"),this.logContext),this.emit(W.Disconnected),this.close()},o=Date.now()-this.reconnectStart;let a=this.getNextRetryDelay({elapsedMs:o,retryCount:this.reconnectAttempts});if(a===null){s(o);return}r===Nf&&(a=0),this.log.debug("reconnecting in ".concat(a,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=wt.setTimeout(()=>this.attemptReconnect(i).finally(()=>this.reconnectTimeout=void 0),a)},this.waitForRestarted=()=>new Promise((r,i)=>{this.pcState===mn.Connected&&r();const s=()=>{this.off(W.Disconnected,o),r()},o=()=>{this.off(W.Restarted,s),i()};this.once(W.Restarted,s),this.once(W.Disconnected,o)}),this.updateAndEmitDCBufferStatus=r=>{if(r===he.RELIABLE){const s=this.dataChannelForKind(r);s&&this.reliableMessageBuffer.alignBufferedAmount(s.bufferedAmount)}const i=this.isBufferStatusLow(r);typeof i<"u"&&i!==this.dcBufferStatus.get(r)&&(this.dcBufferStatus.set(r,i),this.emit(W.DCBufferStatusChanged,i,r))},this.isBufferStatusLow=r=>{const i=this.dataChannelForKind(r);if(i)return i.bufferedAmount<=i.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>E(this,void 0,void 0,function*(){!this.url||!(yield fetch(Ql(this.url),{method:"HEAD"}).then(i=>i.ok).catch(()=>!1))||(this.log.info("detected network reconnected"),(this.client.currentState===Ne.RECONNECTING||this.isWaitingForNetworkReconnect&&this.client.currentState===Ne.CONNECTED)&&(this.clearReconnectTimeout(),this.attemptReconnect(cs.RR_SIGNAL_DISCONNECTED),this.isWaitingForNetworkReconnect=!1))}),this.handleBrowserOffline=()=>E(this,void 0,void 0,function*(){if(this.url)try{yield Promise.race([fetch(Ql(this.url),{method:"HEAD"}),xt(4e3).then(()=>Promise.reject())])}catch{window.navigator.onLine===!1&&(this.log.info("detected network interruption"),this.isWaitingForNetworkReconnect=!0)}}),this.log=wr((n=e.loggerName)!==null&&n!==void 0?n:Cn.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new Jv(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.closingLock=new Ft,this.dataProcessLock=new Ft,this.dcBufferStatus=new Map([[he.LOSSY,!0],[he.RELIABLE,!0]]),this.client.onParticipantUpdate=r=>this.emit(W.ParticipantUpdate,r),this.client.onConnectionQuality=r=>this.emit(W.ConnectionQualityUpdate,r),this.client.onRoomUpdate=r=>this.emit(W.RoomUpdate,r),this.client.onSubscriptionError=r=>this.emit(W.SubscriptionError,r),this.client.onSubscriptionPermissionUpdate=r=>this.emit(W.SubscriptionPermissionUpdate,r),this.client.onSpeakersChanged=r=>this.emit(W.SpeakersChanged,r),this.client.onStreamStateUpdate=r=>this.emit(W.StreamStateChanged,r),this.client.onRequestResponse=r=>this.emit(W.SignalRequestResponse,r)}get logContext(){var e,n,r,i,s,o;return{room:(n=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||n===void 0?void 0:n.name,roomID:(i=(r=this.latestJoinResponse)===null||r===void 0?void 0:r.room)===null||i===void 0?void 0:i.sid,participant:(o=(s=this.latestJoinResponse)===null||s===void 0?void 0:s.participant)===null||o===void 0?void 0:o.identity,pID:this.participantSid}}join(e,n,r,i){return E(this,arguments,void 0,function(s,o,a,l){var c=this;let u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return function*(){c.url=s,c.token=o,c.signalOpts=a,c.maxJoinAttempts=a.maxRetries;try{c.joinAttempts+=1,c.setupSignalClientCallbacks();const h=yield c.client.join(s,o,a,l,u);return c._isClosed=!1,c.latestJoinResponse=h,c.subscriberPrimary=h.subscriberPrimary,c.pcManager||(yield c.configure(h,!u)),(!c.subscriberPrimary||h.fastPublish)&&c.negotiate().catch(f=>{de.error(f,c.logContext)}),c.registerOnLineListener(),c.clientConfiguration=h.clientConfiguration,c.emit(W.SignalConnected,h),h}catch(h){if(h instanceof re){if(h.reason===Ae.ServerUnreachable){if(c.log.warn("Couldn't connect to server, attempt ".concat(c.joinAttempts," of ").concat(c.maxJoinAttempts),c.logContext),c.joinAttempts<c.maxJoinAttempts)return c.join(s,o,a,l,u)}else if(h.reason===Ae.ServiceNotFound)return c.log.warn("Initial connection failed: ".concat(h.message," – Retrying")),c.join(s,o,a,l,!0)}throw h}}()})}close(){return E(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}
vendor: 5,139 bytes, line 410
410try{this._isClosed=!0,this.joinAttempts=0,this.emit(W.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),this.cleanupLossyDataStats(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return E(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const n=r=>{r&&(r.close(),r.onbufferedamountlow=null,r.onclose=null,r.onclosing=null,r.onerror=null,r.onmessage=null,r.onopen=null)};n(this.lossyDC),n(this.lossyDCSub),n(this.reliableDC),n(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.reliableMessageBuffer=new aw,this.reliableDataSequence=1,this.reliableReceivedState.clear()})}cleanupLossyDataStats(){this.lossyDataStatByterate=0,this.lossyDataStatCurrentBytes=0,this.lossyDataStatInterval&&(clearInterval(this.lossyDataStatInterval),this.lossyDataStatInterval=void 0),this.lossyDataDropCount=0}cleanupClient(){return E(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new Fr("a track with the same ID has already been published");return new Promise((n,r)=>{const i=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],r(re.timeout("publication of local track timed out, no response from server"))},1e4);this.pendingTrackResolvers[e.cid]={resolve:s=>{clearTimeout(i),n(s)},reject:()=>{clearTimeout(i),r(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:n}=this.pendingTrackResolvers[e.track.id];n&&n(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(n){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:n}))}return!1}updateMuteStatus(e,n){this.client.sendMuteTrack(e,n)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return E(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e,n){return E(this,void 0,void 0,function*(){var r,i;if(this.pcManager&&this.pcManager.currentState!==Ve.NEW)return;this.participantSid=(r=e.participant)===null||r===void 0?void 0:r.sid;const s=this.makeRTCConfiguration(e);this.pcManager=new NU(s,n?"publisher-only":e.subscriberPrimary?"subscriber-primary":"publisher-primary",this.loggerOptions),this.emit(W.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(o,a)=>{this.client.sendIceCandidate(o,a)},this.pcManager.onPublisherOffer=(o,a)=>{this.client.sendOffer(o,a)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(o,a,l)=>E(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(o),this.logContext),["closed","disconnected","failed"].includes(a)&&(this.publisherConnectionPromise=void 0),o===Ve.CONNECTED){const h=this.pcState===mn.New;this.pcState=mn.Connected,h&&this.emit(W.Connected,e)}else o===Ve.FAILED&&(this.pcState===mn.Connected||this.pcState===mn.Reconnecting)&&(this.pcState=mn.Disconnected,this.handleDisconnect("peerconnection failed",l==="failed"?cs.RR_SUBSCRIBER_FAILED:cs.RR_PUBLISHER_FAILED));const c=this.client.isDisconnected||this.client.currentState===Ne.RECONNECTING,u=[Ve.FAILED,Ve.CLOSING,Ve.CLOSED].includes(o);c&&u&&!this._isClosed&&this.emit(W.Offline)}),this.pcManager.onTrack=o=>{o.streams.length!==0&&this.emit(W.MediaTrackAdded,o.track,o.streams[0],o.receiver)},r4((i=e.serverInfo)===null||i===void 0?void 0:i.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=(e,n,r)=>E(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,midToTrackId:r})),this.midToTrackId=r,yield this.pcManager.setPublisherAnswer(e,n))}),this.client.onTrickle=(e,n)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:n})),this.pcManager.addIceCandidate(e,n))},this.client.onOffer=(e,n,r)=>E(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=n,!this.pcManager)return;this.midToTrackId=r;const i=yield this.pcManager.createSubscriberAnswerFromOffer(e,n);i&&this.client.sendAnswer(i,n)}),this.client.onLocalTrackPublished=e=>{var n;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(n=e.track)===null||n===void 0?void 0:n.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:r}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],r(e.track)},this.client.onLocalTrackUnpublished=e=>
vendor: 8,190 bytes, line 410
410{this.emit(W.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(W.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{var n;this.token=e,(n=this.regionUrlProvider)===null||n===void 0||n.updateToken(e)},this.client.onRemoteMuteChanged=(e,n)=>{this.emit(W.RemoteMute,e,n)},this.client.onSubscribedQualityUpdate=e=>{this.emit(W.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var n;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=e.room),this.emit(W.RoomMoved,e)},this.client.onMediaSectionsRequirement=e=>{var n,r;const i={direction:"recvonly"};for(let s=0;s<e.numAudios;s++)(n=this.pcManager)===null||n===void 0||n.addPublisherTransceiverOfKind("audio",i);for(let s=0;s<e.numVideos;s++)(r=this.pcManager)===null||r===void 0||r.addPublisherTransceiverOfKind("video",i);this.negotiate()},this.client.onClose=()=>{this.handleDisconnect("signal",cs.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e==null?void 0:e.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions({updatedAtInMs:Date.now(),maxAgeInMs:EE,regionSettings:e.regions})),e.action){case Vo.DISCONNECT:this.emit(W.Disconnected,e==null?void 0:e.reason),this.close();break;case Vo.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Nf);break;case Vo.RESUME:this.handleDisconnect(Nf)}}}makeRTCConfiguration(e){var n;const r=Object.assign({},this.rtcConfig);if(!((n=this.signalOpts)===null||n===void 0)&&n.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),r.encodedInsertableStreams=!0),e.iceServers&&!r.iceServers){const i=[];e.iceServers.forEach(s=>{const o={urls:s.urls};s.username&&(o.username=s.username),s.credential&&(o.credential=s.credential),i.push(o)}),r.iceServers=i}return e.clientConfiguration&&e.clientConfiguration.forceRelay===Hl.ENABLED&&(r.iceTransportPolicy="relay"),r.sdpSemantics="unified-plan",r.continualGatheringPolicy="gather_continually",r}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(ww,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(xw,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow,this.cleanupLossyDataStats(),this.lossyDataStatInterval=setInterval(()=>{this.lossyDataStatByterate=this.lossyDataStatCurrentBytes,this.lossyDataStatCurrentBytes=0;const e=this.dataChannelForKind(he.LOSSY);if(e){const n=this.lossyDataStatByterate/10;e.bufferedAmountLowThreshold=Math.min(Math.max(n,e4),t4)}},1e3))}createSender(e,n,r){return E(this,void 0,void 0,function*(){if(_p())return yield this.createTransceiverRTCRtpSender(e,n,r);if(Pp())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new tt("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,n,r,i){return E(this,void 0,void 0,function*(){if(_p())return this.createSimulcastTransceiverSender(e,n,r,i);if(Pp())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new tt("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,n,r){return E(this,void 0,void 0,function*(){if(!this.pcManager)throw new tt("publisher is closed");const i=[];e.mediaStream&&i.push(e.mediaStream),Qi(e)&&(e.codec=n.videoCodec);const s={direction:"sendonly",streams:i};return r&&(s.sendEncodings=r),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,s)).sender})}createSimulcastTransceiverSender(e,n,r,i){return E(this,void 0,void 0,function*(){if(!this.pcManager)throw new tt("publisher is closed");const s={direction:"sendonly"};i&&(s.sendEncodings=i);const o=yield this.pcManager.addPublisherTransceiver(n.mediaStreamTrack,s);if(r.videoCodec)return e.setSimulcastTrackSender(r.videoCodec,o.sender),o.sender})}createRTCRtpSender(e){return E(this,void 0,void 0,function*(){if(!this.pcManager)throw new tt("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return E(this,void 0,void 0,function*(){var n,r,i;if(!this._isClosed){if(this.attemptingReconnect){de.warn("already attempting reconnect, returning early",this.logContext);return}(((n=this.clientConfiguration)===null||n===void 0?void 0:n.resumeConnection)===Hl.DISABLED||((i=(r=this.pcManager)===null||r===void 0?void 0:r.currentState)!==null&&i!==void 0?i:Ve.NEW)===Ve.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(s){this.reconnectAttempts+=1;let o=!0;s instanceof tt?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:s})),o=!1):s instanceof no||(this.fullReconnectOnNext=!0),o?this.handleDisconnect("reconnect",cs.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(W.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(n){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:n}))}return null}restartConnection(e){return E(this,void 0,void 0,function*(){var n,r,i;try{if(!this.url||!this.token)throw new tt("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(W.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let s;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new no;s=yield this.join(e??this.url,this.token,this.signalOpts,void 0,!this.options.singlePeerConnection)}catch(o){throw o instanceof re&&o.reason===Ae.NotAllowed?new tt("could not reconnect, token might be expired"):new no}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(W.SignalRestarted,s),yield this.waitForPCReconnected(),this.client.currentState!==Ne.CONNECTED)throw new no("Signal connection got severed during reconnect");(n=this.regionUrlProvider)===null||n===void 0||n.resetAttempts(),this.emit(W.Restarted)}catch(s){const o=yield(r=this.regionUrlProvider)===null||r===void 0?void 0:r.getNextBestRegionUrl();if(o){yield this.restartConnection(o);return}else throw(i=this.regionUrlProvider)===null||i===void 0||i.resetAttempts(),s}})}resumeConnection(e){return E(this,void 0,void 0,function*(){var n;if(!this.url||!this.token)throw new tt("could not reconnect, url or token not saved");if(!this.pcManager)throw new tt("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(W.Resuming);let r;try{this.setupSignalClientCallbacks(),r=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(i){let s="";throw i instanceof Error&&(s=i.message,this.log.error(i.message,Object.assign(Object.assign({},this.logContext),{error:i}))),i instanceof re&&i.reason===Ae.NotAllowed?new tt("could not reconnect, token might be expired"):i instanceof re&&i.reason===Ae.LeaveRequest?i:new no(s)}
410if(this.emit(W.SignalResumed),r){const i=this.makeRTCConfiguration(r);this.pcManager.updateConfiguration(i),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=r.serverInfo)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==Ne.CONNECTED)throw new no("Signal connection got severed during reconnect");this.client.setReconnected(),((n=this.reliableDC)===null||n===void 0?void 0:n.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),r!=null&&r.lastMessageSeq&&this.resendReliableMessagesForResume(r.lastMessageSeq),this.emit(W.Resumed)})}waitForPCInitialConnection(e,n){return E(this,void 0,void 0,function*(){if(!this.pcManager)throw new tt("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(n,e)})}waitForPCReconnected(){return E(this,void 0,void 0,function*(){this.pcState=mn.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield xt(XU),!this.pcManager)throw new tt("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=mn.Connected}catch(e){throw this.pcState=mn.Disconnected,re.internal("could not establish PC connection, ".concat(e.message))}})}publishRpcResponse(e,n,r,i){return E(this,void 0,void 0,function*(){const s=new Lt({destinationIdentities:[e],kind:he.RELIABLE,value:{case:"rpcResponse",value:new Dv({requestId:n,value:i?{case:"error",value:i.toProto()}:{case:"payload",value:r??""}})}});yield this.sendDataPacket(s,he.RELIABLE)})}publishRpcAck(e,n){return E(this,void 0,void 0,function*(){const r=new Lt({destinationIdentities:[e],kind:he.RELIABLE,value:{case:"rpcAck",value:new jv({requestId:n})}});yield this.sendDataPacket(r,he.RELIABLE)})}sendDataPacket(e,n){return E(this,void 0,void 0,function*(){if(yield this.ensurePublisherConnected(n),this.e2eeManager&&this.e2eeManager.isDataChannelEncryptionEnabled){const s=dU(e);if(s){const o=yield this.e2eeManager.encryptData(s.toBinary());e.value={case:"encryptedPacket",value:new u1({encryptedValue:o.payload,iv:o.iv,keyIndex:o.keyIndex})}}}n===he.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const r=e.toBinary(),i=this.dataChannelForKind(n);if(i){if(n===he.RELIABLE)yield this.waitForBufferStatusLow(n),this.reliableMessageBuffer.push({data:r,sequence:e.sequence});else{if(!this.isBufferStatusLow(n)){this.lossyDataDropCount+=1,this.lossyDataDropCount%100===0&&this.log.warn("dropping lossy data channel messages, total dropped: ".concat(this.lossyDataDropCount),this.logContext);return}this.lossyDataStatCurrentBytes+=r.byteLength}if(this.attemptingReconnect)return;i.send(r)}this.updateAndEmitDCBufferStatus(n)})}resendReliableMessagesForResume(e){return E(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(he.RELIABLE);const n=this.dataChannelForKind(he.RELIABLE);n&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(r=>{n.send(r.data)})),this.updateAndEmitDCBufferStatus(he.RELIABLE)})}waitForBufferStatusLow(e){return new Nt((n,r)=>E(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))n();else{const i=()=>r(new tt("engine closed"));for(this.once(W.Closing,i);!this.dcBufferStatus.get(e);)yield xt(10);this.off(W.Closing,i),n()}}))}ensureDataTransportConnected(e){return E(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var s;if(!r.pcManager)throw new tt("PC manager is closed");const o=i?r.pcManager.subscriber:r.pcManager.publisher,a=i?"Subscriber":"Publisher";if(!o)throw re.internal("".concat(a," connection not set"));let l=!1;!i&&!r.dataChannelForKind(n,i)&&(r.createDataChannels(),l=!0),!l&&!i&&!r.pcManager.publisher.isICEConnected&&r.pcManager.publisher.getICEConnectionState()!=="checking"&&(l=!0),l&&r.negotiate().catch(h=>{de.error(h,r.logContext)});const c=r.dataChannelForKind(n,i);if((c==null?void 0:c.readyState)==="open")return;const u=new Date().getTime()+r.peerConnectionTimeout;for(;new Date().getTime()<u;){if(o.isICEConnected&&((s=r.dataChannelForKind(n,i))===null||s===void 0?void 0:s.readyState)==="open")return;yield xt(50)}throw re.internal("could not establish ".concat(a," connection, state: ").concat(o.getICEConnectionState()))}()})}ensurePublisherConnected(e){return E(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||![Ve.CONNECTING,Ve.CONNECTED].includes(this.pcManager.currentState)||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return E(this,void 0,void 0,function*(){return new Nt((e,n)=>E(this,void 0,void 0,function*(){if(!this.pcManager){n(new Ps("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const r=new AbortController,i=()=>{r.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&n(new Ps("cannot negotiate on closed engine")),this.on(W.Closing,i),this.on(W.Restarting,i),this.pcManager.publisher.once(Is.RTPVideoPayloadTypes,s=>{const o=new Map;
410s.forEach(a=>{const l=a.codec.toLowerCase();G3(l)&&o.set(a.payload,l)}),this.emit(W.RTPVideoMapUpdate,o)});try{yield this.pcManager.negotiate(r),e()}catch(s){if(r.signal.aborted){e();return}s instanceof Ps&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",cs.RR_UNKNOWN),s instanceof Error?n(s):n(new Error(String(s)))}finally{this.off(W.Closing,i),this.off(W.Restarting,i)}}))})}dataChannelForKind(e,n){if(n){if(e===he.LOSSY)return this.lossyDCSub;if(e===he.RELIABLE)return this.reliableDCSub}else{if(e===he.LOSSY)return this.lossyDC;if(e===he.RELIABLE)return this.reliableDC}}sendSyncState(e,n){var r,i,s,o;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const a=this.pcManager.publisher.getLocalDescription(),l=this.pcManager.publisher.getRemoteDescription(),c=(r=this.pcManager.subscriber)===null||r===void 0?void 0:r.getRemoteDescription(),u=(i=this.pcManager.subscriber)===null||i===void 0?void 0:i.getLocalDescription(),h=(o=(s=this.signalOpts)===null||s===void 0?void 0:s.autoSubscribe)!==null&&o!==void 0?o:!0,f=new Array,m=new Array;e.forEach(b=>{b.isDesired!==h&&f.push(b.trackSid),b.isEnabled||m.push(b.trackSid)}),this.client.sendSyncState(new zv({answer:this.pcManager.mode==="publisher-only"?l?Io({sdp:l.sdp,type:l.type}):void 0:u?Io({sdp:u.sdp,type:u.type}):void 0,offer:this.pcManager.mode==="publisher-only"?a?Io({sdp:a.sdp,type:a.type}):void 0:c?Io({sdp:c.sdp,type:c.type}):void 0,subscription:new fh({trackSids:f,subscribe:!h,participantTracks:[]}),publishTracks:N3(n),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:m,datachannelReceiveStates:this.reliableReceivedState.map((b,p)=>new O1({publisherSid:p,lastSeq:b}))}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],n=(r,i)=>{(r==null?void 0:r.id)!==void 0&&r.id!==null&&e.push(new M1({label:r.label,id:r.id,target:i}))};return n(this.dataChannelForKind(he.LOSSY),Wn.PUBLISHER),n(this.dataChannelForKind(he.RELIABLE),Wn.PUBLISHER),n(this.dataChannelForKind(he.LOSSY,!0),Wn.SUBSCRIBER),n(this.dataChannelForKind(he.RELIABLE,!0),Wn.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&wt.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Kt()&&(window.addEventListener("online",this.handleBrowserOnLine),window.addEventListener("offline",this.handleBrowserOffline))}deregisterOnLineListener(){Kt()&&(window.removeEventListener("online",this.handleBrowserOnLine),window.removeEventListener("offline",this.handleBrowserOffline))}getTrackIdForReceiver(e){var n;const r=(n=this.pcManager)===null||n===void 0?void 0:n.getMidForReceiver(e);if(r){const i=Object.entries(this.midToTrackId).find(s=>{let[o]=s;return o===r});if(i)return i[1]}}}function r4(t){return t!==void 0&&t>13}function kw(t,e){const n=t.participantIdentity?t.participantIdentity:e.participantIdentity;t.participantIdentity=n,e.participantIdentity=n;const r=t.destinationIdentities.length!==0?t.destinationIdentities:e.destinationIdentities;t.destinationIdentities=r,e.destinationIdentities=r}class NE{get info(){return this._info}validateBytesReceived(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(typeof this.totalByteSize!="number"||this.totalByteSize===0)){if(e&&this.bytesReceived<this.totalByteSize)throw new gn("Not enough chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, only received ").concat(this.bytesReceived," bytes"),jt.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new gn("Extra chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, received ").concat(this.bytesReceived," bytes"),jt.LengthExceeded)}}constructor(e,n,r,i){this.reader=n,this.totalByteSize=r,this._info=e,this.bytesReceived=0,this.outOfBandFailureRejectingFuture=i}}class i4 extends NE{handleChunkReceived(e){var n;this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const r=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,r)}[Symbol.asyncIterator](){const e=this.reader.getReader();let n=new xn,r=null,i=null;if(this.signal){const o=this.signal;i=()=>{var a;(a=n.reject)===null||a===void 0||a.call(n,o.reason)},o.addEventListener("abort",i),r=o}const s=()=>{e.releaseLock(),r&&i&&r.removeEventListener("abort",i),this.signal=void 0};return{next:()=>E(this,void 0,void 0,function*(){var o,a;try{const{done:l,value:c}=yield Promise.race([e.read(),n.promise,(a=(o=this.outOfBandFailureRejectingFuture)===null||o===void 0?void 0:o.promise)!==null&&a!==void 0?a:new Promise(()=>{})]);return l?(this.validateBytesReceived(!0),{done:!0,value:void 0}):(this.handleChunkReceived(c),{done:!1,value:c.content})}catch(l){throw s(),l}}),return(){return E(this,void 0,void 0,function*(){return s(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return E(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return function*(){var r,i,s,o;let a=new Set;const l=n.signal?e.withAbortSignal(n.signal):e;try{for(var c=!0,u=Ur(l),h;h=yield u.next(),r=h.done,!r;c=!0){o=h.value,c=!1;const f=o;a.add(f)}}catch(f){i={error:f}}finally{try{!c&&!r&&(s=u.return)&&(yield s.call(u))}finally{if(i)throw i.error}}return Array.from(a)}()})}}class s4 extends NE{constructor(e,n,r,i){super(e,n,r,i),this.receivedChunks=new Map}handleChunkReceived(e){var n;const r=Mu(e.chunkIndex),i=this.receivedChunks.get(r);if(i&&i.version>e.version)return;this.receivedChunks.set(r,e),this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const s=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(n=this.onProgress)===null||n===void 0||n.call(this,s)}[Symbol.asyncIterator](){const e=this.reader.getReader(),n=new TextDecoder("utf-8",{fatal:!0});let r=new xn,i=null,s=null;if(this.signal){const a=this.signal;s=()=>{var l;(l=r.reject)===null||l===void 0||l.call(r,a.reason)},a.addEventListener("abort",s),i=a}const o=()=>{e.releaseLock(),i&&s&&i.removeEventListener("abort",s),this.signal=void 0};return{next:()=>E(this,void 0,void 0,function*(){var a,l;try{const{done:c,value:u}=yield Promise.race([e.read(),r.promise,(l=(a=this.outOfBandFailureRejectingFuture)===null||a===void 0?void 0:a.promise)!==null&&l!==void 0?l:new Promise(()=>{})]);if(c)return this.validateBytesReceived(!0),{done:!0,value:void 0};{this.handleChunkReceived(u);let h;try{h=n.decode(u.content)}catch(f){throw new gn("Cannot decode datastream chunk ".concat(u.chunkIndex," as text: ").concat(f),jt.DecodeFailed)}return{done:!1,value:h}}}catch(c){throw o(),c}}),return(){return E(this,void 0,void 0,function*(){return o(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return E(this,arguments,void 0,function(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return function*(){var r,i,s,o;let a="";const l=n.signal?e.withAbortSignal(n.signal):e;try{for(var c=!0,u=Ur(l),h;h=yield u.next(),r=h.done,!r;c=!0)o=h.value,c=!1,a+=o}catch(f){i={error:f}}finally{try{!c&&!r&&(s=u.return)&&(yield s.call(u))}finally{if(i)throw i.error}}return a}()})}}class o4{constructor(){this.log=de,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map}registerTextStreamHandler(e,n){if(this.textStreamHandlers.has(e))throw new gn('A text stream handler for topic "'.concat(e,'" has already been set.'),jt.HandlerAlreadyRegistered);this.textStreamHandlers.set(e,n)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,n){if(this.byteStreamHandlers.has(e))throw new gn('A byte stream handler for topic "'.concat(e,'" has already been set.'),jt.HandlerAlreadyRegistered);this.byteStreamHandlers.set(e,n)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}clearControllers(){this.byteStreamControllers.clear(),this.textStreamControllers.clear()}
410validateParticipantHasNoActiveDataStreams(e){var n,r,i,s;const o=Array.from(this.textStreamControllers.entries()).filter(l=>l[1].sendingParticipantIdentity===e),a=Array.from(this.byteStreamControllers.entries()).filter(l=>l[1].sendingParticipantIdentity===e);if(o.length>0||a.length>0){const l=new gn("Participant ".concat(e," unexpectedly disconnected in the middle of sending data"),jt.AbnormalEnd);for(const[c,u]of a)(r=(n=u.outOfBandFailureRejectingFuture).reject)===null||r===void 0||r.call(n,l),this.byteStreamControllers.delete(c);for(const[c,u]of o)(s=(i=u.outOfBandFailureRejectingFuture).reject)===null||s===void 0||s.call(i,l),this.textStreamControllers.delete(c)}}handleDataStreamPacket(e,n){return E(this,void 0,void 0,function*(){switch(e.value.case){case"streamHeader":return this.handleStreamHeader(e.value.value,e.participantIdentity,n);case"streamChunk":return this.handleStreamChunk(e.value.value,n);case"streamTrailer":return this.handleStreamTrailer(e.value.value,n);default:throw new Error('DataPacket of value "'.concat(e.value.case,'" is not data stream related!'))}})}handleStreamHeader(e,n,r){return E(this,void 0,void 0,function*(){var i;if(e.contentHeader.case==="byteHeader"){const s=this.byteStreamHandlers.get(e.topic);if(!s){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let o;const a=new xn;a.promise.catch(u=>{this.log.error(u)});const l={id:e.streamId,name:(i=e.contentHeader.value.name)!==null&&i!==void 0?i:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Mu(e.timestamp),attributes:e.attributes,encryptionType:r},c=new ReadableStream({start:u=>{if(o=u,this.textStreamControllers.has(e.streamId))throw new gn("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),jt.AlreadyOpened);this.byteStreamControllers.set(e.streamId,{info:l,controller:o,startTime:Date.now(),sendingParticipantIdentity:n,outOfBandFailureRejectingFuture:a})}});s(new i4(l,c,Mu(e.totalLength),a),{identity:n})}else if(e.contentHeader.case==="textHeader"){const s=this.textStreamHandlers.get(e.topic);if(!s){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let o;const a=new xn;a.promise.catch(u=>{this.log.error(u)});const l={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes,encryptionType:r,attachedStreamIds:e.contentHeader.value.attachedStreamIds},c=new ReadableStream({start:u=>{if(o=u,this.textStreamControllers.has(e.streamId))throw new gn("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),jt.AlreadyOpened);this.textStreamControllers.set(e.streamId,{info:l,controller:o,startTime:Date.now(),sendingParticipantIdentity:n,outOfBandFailureRejectingFuture:a})}});s(new s4(l,c,Mu(e.totalLength),a),{identity:n})}})}handleStreamChunk(e,n){const r=this.byteStreamControllers.get(e.streamId);r&&(r.info.encryptionType!==n?(r.controller.error(new gn("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(n,", got ").concat(r.info.encryptionType),jt.EncryptionTypeMismatch)),this.byteStreamControllers.delete(e.streamId)):e.content.length>0&&r.controller.enqueue(e));const i=this.textStreamControllers.get(e.streamId);i&&(i.info.encryptionType!==n?(i.controller.error(new gn("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(n,", got ").concat(i.info.encryptionType),jt.EncryptionTypeMismatch)),this.textStreamControllers.delete(e.streamId)):e.content.length>0&&i.controller.enqueue(e))}handleStreamTrailer(e,n){const r=this.textStreamControllers.get(e.streamId);r&&(r.info.encryptionType!==n?r.controller.error(new gn("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(n,", got ").concat(r.info.encryptionType),jt.EncryptionTypeMismatch)):(r.info.attributes=Object.assign(Object.assign({},r.info.attributes),e.attributes),r.controller.close(),this.textStreamControllers.delete(e.streamId)));const i=this.byteStreamControllers.get(e.streamId);i&&(i.info.encryptionType!==n?i.controller.error(new gn("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(n,", got ").concat(i.info.encryptionType),jt.EncryptionTypeMismatch)):(i.info.attributes=Object.assign(Object.assign({},i.info.attributes),e.attributes),i.controller.close()),this.byteStreamControllers.delete(e.streamId))}}class AE{constructor(e,n,r){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=r,this.info=n}write(e){return this.defaultWriter.write(e)}close(){return E(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class a4 extends AE{}class l4 extends AE{}const Sw=15e3;class c4{constructor(e,n){this.engine=e,this.log=n}setupEngine(e){this.engine=e}sendText(e,n){return E(this,void 0,void 0,function*(){var r;const i=crypto.randomUUID(),o=new TextEncoder().encode(e).byteLength,a=(r=n==null?void 0:n.attachments)===null||r===void 0?void 0:r.map(()=>crypto.randomUUID()),l=new Array(a?a.length+1:1).fill(0),c=(h,f)=>{var m;l[f]=h;const b=l.reduce((p,g)=>p+g,0);(m=n==null?void 0:n.onProgress)===null||m===void 0||m.call(n,b)},u=yield this.streamText({streamId:i,totalSize:o,destinationIdentities:n==null?void 0:n.destinationIdentities,topic:n==null?void 0:n.topic,attachedStreamIds:a,attributes:n==null?void 0:n.attributes});return yield u.write(e),c(1,0),yield u.close(),n!=null&&n.attachments&&a&&(yield Promise.all(n.attachments.map((h,f)=>E(this,void 0,void 0,function*(){return this._sendFile(a[f],h,{topic:n.topic,mimeType:h.type,onProgress:m=>{c(m,f+1)}})})))),u.info})}streamText(e){return E(this,void 0,void 0,function*(){var n,r,i;const s=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),o={id:s,mimeType:"text/plain",timestamp:Date.now(),topic:(r=e==null?void 0:e.topic)!==null&&r!==void 0?r:"",size:e==null?void 0:e.totalSize,attributes:e==null?void 0:e.attributes,encryptionType:!((i=this.engine.e2eeManager)===null||i===void 0)&&i.isDataChannelEncryptionEnabled?
vendor: 18,809 bytes, line 410
410it.GCM:it.NONE,attachedStreamIds:e==null?void 0:e.attachedStreamIds},a=new yd({streamId:s,mimeType:o.mimeType,topic:o.topic,timestamp:us(o.timestamp),totalLength:us(e==null?void 0:e.totalSize),attributes:o.attributes,contentHeader:{case:"textHeader",value:new k1({version:e==null?void 0:e.version,attachedStreamIds:o.attachedStreamIds,replyToStreamId:e==null?void 0:e.replyToStreamId,operationType:(e==null?void 0:e.type)==="update"?hp.UPDATE:hp.CREATE})}}),l=e==null?void 0:e.destinationIdentities,c=new Lt({destinationIdentities:l,value:{case:"streamHeader",value:a}});yield this.engine.sendDataPacket(c,he.RELIABLE);let u=0;const h=this.engine,f=new WritableStream({write(p){return E(this,void 0,void 0,function*(){for(const g of eU(p,Sw)){const v=new bd({content:g,streamId:s,chunkIndex:us(u)}),y=new Lt({destinationIdentities:l,value:{case:"streamChunk",value:v}});yield h.sendDataPacket(y,he.RELIABLE),u+=1}})},close(){return E(this,void 0,void 0,function*(){const p=new wd({streamId:s}),g=new Lt({destinationIdentities:l,value:{case:"streamTrailer",value:p}});yield h.sendDataPacket(g,he.RELIABLE)})},abort(p){console.log("Sink error:",p)}});let m=()=>E(this,void 0,void 0,function*(){yield b.close()});h.once(W.Closing,m);const b=new a4(f,o,()=>this.engine.off(W.Closing,m));return b})}sendFile(e,n){return E(this,void 0,void 0,function*(){const r=crypto.randomUUID();return yield this._sendFile(r,e,n),{id:r}})}_sendFile(e,n,r){return E(this,void 0,void 0,function*(){var i;const s=yield this.streamBytes({streamId:e,totalSize:n.size,name:n.name,mimeType:(i=r==null?void 0:r.mimeType)!==null&&i!==void 0?i:n.type,topic:r==null?void 0:r.topic,destinationIdentities:r==null?void 0:r.destinationIdentities}),o=n.stream().getReader();for(;;){const{done:a,value:l}=yield o.read();if(a)break;yield s.write(l)}return yield s.close(),s.info})}streamBytes(e){return E(this,void 0,void 0,function*(){var n,r,i,s,o,a;const l=(n=e==null?void 0:e.streamId)!==null&&n!==void 0?n:crypto.randomUUID(),c=e==null?void 0:e.destinationIdentities,u={id:l,mimeType:(r=e==null?void 0:e.mimeType)!==null&&r!==void 0?r:"application/octet-stream",topic:(i=e==null?void 0:e.topic)!==null&&i!==void 0?i:"",timestamp:Date.now(),attributes:e==null?void 0:e.attributes,size:e==null?void 0:e.totalSize,name:(s=e==null?void 0:e.name)!==null&&s!==void 0?s:"unknown",encryptionType:!((o=this.engine.e2eeManager)===null||o===void 0)&&o.isDataChannelEncryptionEnabled?it.GCM:it.NONE},h=new yd({totalLength:us((a=u.size)!==null&&a!==void 0?a:0),mimeType:u.mimeType,streamId:l,topic:u.topic,timestamp:us(Date.now()),attributes:u.attributes,contentHeader:{case:"byteHeader",value:new S1({name:u.name})}}),f=new Lt({destinationIdentities:c,value:{case:"streamHeader",value:h}});yield this.engine.sendDataPacket(f,he.RELIABLE);let m=0;const b=new Ft,p=this.engine,g=this.log,v=new WritableStream({write(w){return E(this,void 0,void 0,function*(){const k=yield b.lock();let S=0;try{for(;S<w.byteLength;){const T=w.slice(S,S+Sw),C=new Lt({destinationIdentities:c,value:{case:"streamChunk",value:new bd({content:T,streamId:l,chunkIndex:us(m)})}});yield p.sendDataPacket(C,he.RELIABLE),m+=1,S+=T.byteLength}}finally{k()}})},close(){return E(this,void 0,void 0,function*(){const w=new wd({streamId:l}),k=new Lt({destinationIdentities:c,value:{case:"streamTrailer",value:w}});yield p.sendDataPacket(k,he.RELIABLE)})},abort(w){g.error("Sink error:",w)}});return new l4(v,u)})}}class OE extends D{constructor(e,n,r,i,s){super(e,r,s),this.sid=n,this.receiver=i}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?$.Muted:$.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const n=r=>{r.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",n),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit($.Ended,this))};e.addEventListener("removetrack",n)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return E(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),ty)),A3()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var n;this.timeSyncHandle=requestAnimationFrame(()=>e());const r=(n=this.receiver)===null||n===void 0?void 0:n.getSynchronizationSources()[0];if(r){const{timestamp:i,rtpTimestamp:s}=r;s&&this.rtpTimestamp!==s&&(this.emit($.TimeSyncUpdate,{timestamp:i,rtpTimestamp:s}),this.rtpTimestamp=s)}};e()}}class u4 extends OE{constructor(e,n,r,i,s,o){super(e,n,D.Kind.Audio,r,o),this.monitorReceiver=()=>E(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const a=yield this.getReceiverStats();a&&this.prevStats&&this.receiver&&(this._currentBitrate=gh(a,this.prevStats)),this.prevStats=a}),this.audioContext=i,this.webAudioPluginNodes=[],s&&(this.sinkId=s.deviceId)}setVolume(e){var n;for(const r of this.attachedElements)this.audioContext?(n=this.gainNode)===null||n===void 0||n.gain.setTargetAtTime(e,0,.1):r.volume=e;xr()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(xr())return 1;let e=0;return this.attachedElements.forEach(n=>{n.volume>e&&(e=n.volume)}),e}setSinkId(e){return E(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(n=>{if(Rp(n))return n.setSinkId(e)}))})}attach(e){const n=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&Rp(e)&&e.setSinkId(this.sinkId).catch(r=>{this.log.error("Failed to set sink id on remote audio track",r,this.logContext)}),this.audioContext&&n&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let n;return e?(n=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(n=super.detach(),this.disconnectWebAudio()),n}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,n){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(n.srcObject);let r=this.sourceNode;this.webAudioPluginNodes.forEach(i=>{r.connect(i),r=i}),this.gainNode=e.createGain(),r.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit($.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(i=>{this.emit($.AudioPlaybackFailed,i)})}disconnectWebAudio(){var e,n;(e=this.gainNode)===null||e===void 0||e.disconnect(),(n=this.sourceNode)===null||n===void 0||n.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return E(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n;return e.forEach(r=>{r.type==="inbound-rtp"&&(n={type:"audio",streamId:r.id,timestamp:r.timestamp,jitter:r.jitter,bytesReceived:r.bytesReceived,concealedSamples:r.concealedSamples,concealmentEvents:r.concealmentEvents,silentConcealedSamples:r.silentConcealedSamples,silentConcealmentEvents:r.silentConcealmentEvents,totalAudioEnergy:r.totalAudioEnergy,totalSamplesDuration:r.totalSamplesDuration})}),n})}}const Af=100;class d4 extends OE{constructor(e,n,r,i,s){super(e,n,D.Kind.Video,r,s),this.elementInfos=[],this.monitorReceiver=()=>E(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const o=yield this.getReceiverStats();o&&this.prevStats&&this.receiver&&(this._currentBitrate=gh(o,this.prevStats)),this.prevStats=o}),this.debouncedHandleResize=Qv(()=>{this.updateDimensions()},Af),this.adaptiveStreamSettings=i}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}setStreamState(e){super.setStreamState(e),this.log.debug("setStreamState",e),this.isAdaptiveStream&&e===D.StreamState.Active&&this.updateVisibility()}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(n=>{e?qo(this._mediaStreamTrack,n):Ro(this._mediaStreamTrack,n)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(n=>n.element===e)===void 0){const n=new h4(e);this.observeElementInfo(n)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(n=>n===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const n=this.elementInfos.filter(r=>r===e);for(const r of n)r.stopObserving();this.elementInfos=this.elementInfos.filter(r=>r!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let n=[];if(e)return this.stopObservingElement(e),super.detach(e);n=super.detach();for(const r of n)this.stopObservingElement(r);return n}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return E(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let n,r="",i=new Map;return e.forEach(s=>{s.type==="inbound-rtp"?(r=s.codecId,n={type:"video",streamId:s.id,framesDecoded:s.framesDecoded,framesDropped:s.framesDropped,framesReceived:s.framesReceived,packetsReceived:s.packetsReceived,packetsLost:s.packetsLost,frameWidth:s.frameWidth,frameHeight:s.frameHeight,pliCount:s.pliCount,firCount:s.firCount,nackCount:s.nackCount,jitter:s.jitter,timestamp:s.timestamp,bytesReceived:s.bytesReceived,decoderImplementation:s.decoderImplementation}):s.type==="codec"&&i.set(s.id,s)}),n&&r!==""&&i.get(r)&&(n.mimeType=i.get(r).mimeType),n})}stopObservingElement(e){const n=this.elementInfos.filter(r=>r.element===e);for(const r of n)this.stopObservingElementInfo(r)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return E(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(e){var n,r;const i=this.elementInfos.reduce((l,c)=>Math.max(l,c.visibilityChangedAt||0),0),s=!((r=(n=this.adaptiveStreamSettings)===null||n===void 0?void 0:n.pauseVideoInBackground)!==null&&r!==void 0)||r?this.isInBackground:!1,o=this.elementInfos.some(l=>l.pictureInPicture),a=this.elementInfos.some(l=>l.visible)&&!s||o;if(!(this.lastVisible===a&&!e)){if(!a&&Date.now()-i<Af){wt.setTimeout(()=>{this.updateVisibility()},Af);return}this.lastVisible=a,this.emit($.VisibilityChanged,a,this)}}updateDimensions(){var e,n;let r=0,i=0;const s=this.getPixelDensity();for(const o of this.elementInfos){const a=o.width()*s,l=o.height()*s;a+l>r+i&&(r=a,i=l)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===r&&((n=this.lastDimensions)===null||n===void 0?void 0:n.height)===i||(this.lastDimensions={width:r,height:i},this.emit($.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const n=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return n==="screen"?Qb():n||(Qb()>2?2:1)}}class h4{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,n){this.onVisibilityChanged=r=>{var i;const{target:s,isIntersecting:o}=r;s===this.element&&(this.isIntersecting=o,this.isPiP=Ja(this.element),this.visibilityChangedAt=Date.now(),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this))},this.onEnterPiP=()=>{var r,i,s;(i=(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP),this.isPiP=Ja(this.element),(s=this.handleVisibilityChanged)===null||s===void 0||s.call(this)},this.onLeavePiP=()=>{var r;this.isPiP=Ja(this.element),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this)},this.element=e,this.isIntersecting=n??jp(e),this.isPiP=Kt()&&Ja(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,n,r;this.isIntersecting=jp(this.element),this.isPiP=Ja(this.element),this.element.handleResize=()=>{var i;(i=this.handleResize)===null||i===void 0||i.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,Zb().observe(this.element),Xb().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(r=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||r===void 0||r.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,n,r,i,s;(e=Zb())===null||e===void 0||e.unobserve(this.element),(n=Xb())===null||n===void 0||n.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(r=window.documentPictureInPicture)===null||r===void 0||r.removeEventListener("enter",this.onEnterPiP),(s=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||s===void 0||s.removeEventListener("pagehide",this.onLeavePiP)}}function Ja(t){var e,n;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?jp(t,(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window):!1}function jp(t,e){const n=e||window;let r=t.offsetTop,i=t.offsetLeft;const s=t.offsetWidth,o=t.offsetHeight,{hidden:a}=t,{display:l}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,r+=t.offsetTop,i+=t.offsetLeft;return r<n.pageYOffset+n.innerHeight&&i<n.pageXOffset+n.innerWidth&&r+o>n.pageYOffset&&i+s>n.pageXOffset&&!a&&l!=="none"}class Or extends Tr.EventEmitter{constructor(e,n,r,i){var s;super(),this.metadataMuted=!1,this.encryption=it.NONE,this.log=de,this.handleMuted=()=>{this.emit($.Muted)},this.handleUnmuted=()=>{this.emit($.Unmuted)},this.log=wr((s=i==null?void 0:i.loggerName)!==null&&s!==void 0?s:Cn.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=n,this.trackName=r,this.source=D.Source.Unknown}setTrack(e){this.track&&(this.track.off($.Muted,this.handleMuted),this.track.off($.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on($.Muted,this.handleMuted),e.on($.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),fe(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==it.NONE}get audioTrack(){if(yr(this.track))return this.track}get videoTrack(){if(Qi(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=D.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===D.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(t){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(t.PermissionStatus||(t.PermissionStatus={}))})(Or||(Or={}));class Dp extends Or{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,n,r,i){super(e,n.sid,n.name,i),this.track=void 0,this.handleTrackEnded=()=>{this.emit($.Ended)},this.handleCpuConstrained=()=>{this.track&&Qi(this.track)&&this.emit($.CpuConstrained,this.track)},this.updateInfo(n),this.setTrack(r)}setTrack(e){this.track&&(this.track.off($.Ended,this.handleTrackEnded),this.track.off($.CpuConstrained,this.handleCpuConstrained)),super.setTrack(e),e&&(e.on($.Ended,this.handleTrackEnded),e.on($.CpuConstrained,this.handleCpuConstrained))}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return E(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return E(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return E(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return E(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(yr(this.track)){const n=this.track.getSourceTrackSettings(),r=new Set;return n.autoGainControl&&r.add(ft.TF_AUTO_GAIN_CONTROL),n.echoCancellation&&r.add(ft.TF_ECHO_CANCELLATION),n.noiseSuppression&&r.add(ft.TF_NOISE_SUPPRESSION),n.channelCount&&n.channelCount>1&&r.add(ft.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||r.add(ft.TF_NO_DTX),this.track.enhancedNoiseCancellation&&r.add(ft.TF_ENHANCED_NOISE_CANCELLATION),Array.from(r.values())}else return[]}}function vh(t,e){return E(this,void 0,void 0,function*(){t??(t={});let n=!1;const{audioProcessor:r,videoProcessor:i,optionsWithoutProcessor:s}=bE(t);let o=s.audio,a=s.video;
410if(r&&typeof s.audio=="object"&&(s.audio.processor=r),i&&typeof s.video=="object"&&(s.video.processor=i),t.audio&&typeof s.audio=="object"&&typeof s.audio.deviceId=="string"){const h=s.audio.deviceId;s.audio.deviceId={exact:h},n=!0,o=Object.assign(Object.assign({},s.audio),{deviceId:{ideal:h}})}if(s.video&&typeof s.video=="object"&&typeof s.video.deviceId=="string"){const h=s.video.deviceId;s.video.deviceId={exact:h},n=!0,a=Object.assign(Object.assign({},s.video),{deviceId:{ideal:h}})}s.audio===!0?s.audio={deviceId:"default"}:typeof s.audio=="object"&&s.audio!==null&&(s.audio=Object.assign(Object.assign({},s.audio),{deviceId:s.audio.deviceId||"default"})),s.video===!0?s.video={deviceId:"default"}:typeof s.video=="object"&&!s.video.deviceId&&(s.video.deviceId="default");const l=gE(s,TE,CE),c=Kv(l),u=navigator.mediaDevices.getUserMedia(c);s.audio&&(mt.userMediaPromiseMap.set("audioinput",u),u.catch(()=>mt.userMediaPromiseMap.delete("audioinput"))),s.video&&(mt.userMediaPromiseMap.set("videoinput",u),u.catch(()=>mt.userMediaPromiseMap.delete("videoinput")));try{const h=yield u;return yield Promise.all(h.getTracks().map(f=>E(this,void 0,void 0,function*(){const m=f.kind==="audio";let b=m?l.audio:l.video;(typeof b=="boolean"||!b)&&(b={});let p;const g=m?c.audio:c.video;typeof g!="boolean"&&(p=g);const v=f.getSettings().deviceId;p!=null&&p.deviceId&&Rs(p.deviceId)!==v?p.deviceId=v:p||(p={deviceId:v});const y=BU(f,p,e);return y.kind===D.Kind.Video?y.source=D.Source.Camera:y.kind===D.Kind.Audio&&(y.source=D.Source.Microphone),y.mediaStream=h,yr(y)&&r?yield y.setProcessor(r):Qi(y)&&i&&(yield y.setProcessor(i)),y})))}catch(h){if(!n)throw h;return vh(Object.assign(Object.assign({},t),{audio:o,video:a}),e)}})}function f4(t){return E(this,void 0,void 0,function*(){return(yield vh({audio:!1,video:!0}))[0]})}function ME(t){return E(this,void 0,void 0,function*(){return(yield vh({audio:t??!0,video:!1}
vendor: 23,495 bytes, line 410
410))[0]})}var gi;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(gi||(gi={}));function m4(t){switch(t){case tl.EXCELLENT:return gi.Excellent;case tl.GOOD:return gi.Good;case tl.POOR:return gi.Poor;case tl.LOST:return gi.Lost;default:return gi.Unknown}}class jE extends Tr.EventEmitter{get logContext(){var e,n;return Object.assign({},(n=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||n===void 0?void 0:n.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===Kl.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===$o.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,n,r,i,s,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:Kl.STANDARD;var l;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=gi.Unknown,this.log=de,this.log=wr((l=o==null?void 0:o.loggerName)!==null&&l!==void 0?l:Cn.Participant),this.loggerOptions=o,this.setMaxListeners(100),this.sid=e,this.identity=n,this.name=r,this.metadata=i,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=a,this._attributes=s??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,n]of this.trackPublications)if(n.source===e)return n}getTrackPublicationByName(e){for(const[,n]of this.trackPublications)if(n.trackName===e)return n}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new xn,this.once(q.Active,()=>{var e,n;(n=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||n===void 0||n.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const n=this.getTrackPublication(D.Source.Camera);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const n=this.getTrackPublication(D.Source.Microphone);return!(!((e=n==null?void 0:n.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(D.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var n;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===$o.ACTIVE&&((n=this.participantInfo)===null||n===void 0?void 0:n.state)!==$o.ACTIVE&&this.emit(q.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const n=this.metadata!==e,r=this.metadata;this.metadata=e,n&&this.emit(q.ParticipantMetadataChanged,r)}_setName(e){const n=this.name!==e;this.name=e,n&&this.emit(q.ParticipantNameChanged,e)}_setAttributes(e){const n=O3(this.attributes,e);this._attributes=e,Object.keys(n).length>0&&this.emit(q.AttributesChanged,n)}setPermissions(e){var n,r,i,s,o,a;const l=this.permissions,c=e.canPublish!==((n=this.permissions)===null||n===void 0?void 0:n.canPublish)||e.canSubscribe!==((r=this.permissions)===null||r===void 0?void 0:r.canSubscribe)||e.canPublishData!==((i=this.permissions)===null||i===void 0?void 0:i.canPublishData)||e.hidden!==((s=this.permissions)===null||s===void 0?void 0:s.hidden)||e.recorder!==((o=this.permissions)===null||o===void 0?void 0:o.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((u,h)=>{var f;return u!==((f=this.permissions)===null||f===void 0?void 0:f.canPublishSources[h])})||e.canSubscribeMetrics!==((a=this.permissions)===null||a===void 0?void 0:a.canSubscribeMetrics);return this.permissions=e,c&&this.emit(q.ParticipantPermissionsChanged,l),c}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(q.IsSpeakingChanged,e))}setConnectionQuality(e){const n=this._connectionQuality;this._connectionQuality=m4(e),n!==this._connectionQuality&&this.emit(q.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,n;this.activeFuture&&((n=(e=this.activeFuture).reject)===null||n===void 0||n.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(n=>yr(n.track)&&n.track.setAudioContext(e))}addTrackPublication(e){e.on($.Muted,()=>{this.emit(q.TrackMuted,e)}),e.on($.Unmuted,()=>{this.emit(q.TrackUnmuted,e)});const n=e;switch(n.track&&(n.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case D.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case D.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function p4(t){var e,n,r;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new N1({participantIdentity:(e=t.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(n=t.participantSid)!==null&&n!==void 0?n:"",allTracks:(r=t.allowAll)!==null&&r!==void 0?r:!1,trackSids:t.allowedTrackSids||[]})}class g4 extends jE{constructor(e,n,r,i,s,o){super(e,n,void 0,void 0,void 0,{loggerName:i.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=it.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new xn)},this.handleReconnected=()=>{var a,l;(l=(a=this.reconnectFuture)===null||a===void 0?void 0:a.resolve)===null||l===void 0||l.call(a),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleClosing=()=>{var a,l,c,u,h,f;this.reconnectFuture&&(this.reconnectFuture.promise.catch(m=>this.log.warn(m.message,this.logContext)),(l=(a=this.reconnectFuture)===null||a===void 0?void 0:a.reject)===null||l===void 0||l.call(a,new Error("Got disconnected during reconnection attempt")),this.reconnectFuture=void 0),this.signalConnectedFuture&&((u=(c=this.signalConnectedFuture).reject)===null||u===void 0||u.call(c,new Error("Got disconnected without signal connected")),this.signalConnectedFuture=void 0),(f=(h=this.activeAgentFuture)===null||h===void 0?void 0:h.reject)===null||f===void 0||f.call(h,new Error("Got disconnected without active agent present")),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=a=>{var l,c;a.participant&&this.updateInfo(a.participant),this.signalConnectedFuture||(this.signalConnectedFuture=new xn),(c=(l=this.signalConnectedFuture).resolve)===null||c===void 0||c.call(l)},this.handleSignalRequestResponse=a=>{const{requestId:l,reason:c,message:u}=a,h=this.pendingSignalRequests.get(l);h&&(c!==$v.OK&&h.reject(new Hb(u,c)),this.pendingSignalRequests.delete(l))},this.handleDataPacket=a=>{switch(a.value.case){case"rpcResponse":let l=a.value.value,c=null,u=null;l.value.case==="payload"?c=l.value.value:l.value.case==="error"&&(u=Ze.fromProto(l.value.value)),this.handleIncomingRpcResponse(l.requestId,c,u);break;case"rpcAck":let h=a.value.value;this.handleIncomingRpcAck(h.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(a=>p4(a)))},this.onTrackUnmuted=a=>{this.onTrackMuted(a,a.isUpstreamPaused)},this.onTrackMuted=(a,l)=>{if(l===void 0&&(l=!0),!a.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),fe(a)));return}this.engine.updateMuteStatus(a.sid,l)},this.onTrackUpstreamPaused=a=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),fe(a))),this.onTrackMuted(a,!0)},this.onTrackUpstreamResumed=a=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),fe(a))),this.onTrackMuted(a,a.isMuted)},this.onTrackFeatureUpdate=a=>{const l=this.audioTrackPublications.get(a.sid);if(!l){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(a.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(l.trackSid,l.getTrackFeatures())},this.onTrackCpuConstrained=(a,l)=>{this.log.debug("track cpu constrained",Object.assign(Object.assign({},this.logContext),fe(l))),this.emit(q.LocalTrackCpuConstrained,a,l)},this.handleSubscribedQualityUpdate=a=>E(this,void 0,void 0,function*(){var l,c,u,h,f;if(!(!((f=this.roomOptions)===null||f===void 0)&&f.dynacast))return;const m=this.videoTrackPublications.get(a.trackSid);if(!m){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:a.trackSid}));return}if(!m.videoTrack)return;const b=yield m.videoTrack.setPublishingCodecs(a.subscribedCodecs);try{for(var p=!0,g=Ur(b),v;v=yield g.next(),l=v.done,!l;p=!0){h=v.value,p=!1;const y=h;P3(y)&&(this.log.debug("publish ".concat(y," for ").concat(m.videoTrack.sid),Object.assign(Object.assign({},this.logContext),fe(m))),yield this.publishAdditionalCodecForTrack(m.videoTrack,y,m.options))}}catch(y){c={error:y}}finally{try{!p&&!l&&(u=g.return)&&(yield u.call(g))}finally{if(c)throw c.error}}}),this.handleLocalTrackUnpublished=a=>{const l=this.trackPublications.get(a.trackSid);if(!l){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:a.trackSid}));return}this.unpublishTrack(l.track)},this.handleTrackEnded=a=>E(this,void 0,void 0,function*(){if(a.source===D.Source.ScreenShare||a.source===D.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),fe(a))),this.unpublishTrack(a);else if(a.isUserProvided)yield a.mute();else if(Rr(a)||oi(a))try{if(Kt())try{const l=yield navigator==null?void 0:navigator.permissions.query({name:a.source===D.Source.Camera?"camera":"microphone"});if(l&&l.state==="denied")throw this.log.warn("user has revoked access to ".concat(a.source),Object.assign(Object.assign({},this.logContext),fe(a))),l.onchange=()=>{l.state!=="denied"&&(a.isMuted||a.restartTrack(),l.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}a.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),fe(a))),Rr(a)?yield a.restartTrack({deviceId:"default"}):yield a.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),fe(a))),yield a.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=r,this.roomOptions=i,this.setupEngine(r),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=s,this.roomOutgoingDataStreamManager=o}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==it.NONE}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setupEngine(e){var n;this.engine=e,this.engine.on(W.RemoteMute,(r,i)=>{const s=this.trackPublications.get(r);!s||!s.track||(i?s.mute():s.unmute())}),!((n=this.signalConnectedFuture)===null||n===void 0)&&n.isResolved&&(this.signalConnectedFuture=void 0),this.engine.on(W.Connected,this.handleReconnected).on(W.SignalConnected,this.handleSignalConnected).on(W.SignalRestarted,this.handleReconnected).on(W.SignalResumed,this.handleReconnected).on(W.Restarting,this.handleReconnecting).on(W.Resuming,this.handleReconnecting).on(W.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(W.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(W.Closing,this.handleClosing).on(W.SignalRequestResponse,this.handleSignalRequestResponse).on(W.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return E(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return E(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return E(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return E(this,arguments,void 0,function(n){var r=this;let{metadata:i,name:s,attributes:o}=n;return function*(){return new Nt((a,l)=>E(r,void 0,void 0,function*(){var c,u;try{let h=!1;const f=yield this.engine.client.sendUpdateLocalMetadata((c=i??this.metadata)!==null&&c!==void 0?c:"",(u=s??this.name)!==null&&u!==void 0?u:"",o),m=performance.now();for(this.pendingSignalRequests.set(f,{resolve:a,reject:b=>{l(b),h=!0},values:{name:s,metadata:i,attributes:o}});performance.now()-m<5e3&&!h;){if((!s||this.name===s)&&(!i||this.metadata===i)&&(!o||Object.entries(o).every(b=>{let[p,g]=b;return this.attributes[p]===g||g===""&&!this.attributes[p]}))){this.pendingSignalRequests.delete(f),a();return}yield xt(50)}l(new Hb("Request to update local metadata timed out","TimeoutError"))}catch(h){h instanceof Error?l(h):l(new Error(String(h)))}}))}()})}setCameraEnabled(e,n,r){return this.setTrackEnabled(D.Source.Camera,e,n,r)}setMicrophoneEnabled(e,n,r){return this.setTrackEnabled(D.Source.Microphone,e,n,r)}setScreenShareEnabled(e,n,r){return this.setTrackEnabled(D.Source.ScreenShare,e,n,r)}setE2EEEnabled(e){return E(this,void 0,void 0,function*(){this.encryptionType=e?it.GCM:it.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,n,r,i){return E(this,void 0,void 0,function*(){var s,o;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:n})),this.republishPromise&&(yield this.republishPromise);let a=this.getTrackPublication(e);if(n)if(a)yield a.unmute();else{let l;if(this.pendingPublishing.has(e)){const c=yield this.waitForPendingPublicationOfSource(e);return c||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield c==null?void 0:c.unmute(),c}this.pendingPublishing.add(e);try{switch(e){case D.Source.Camera:l=yield this.createTracks({video:(s=r)!==null&&s!==void 0?s:!0});break;case D.Source.Microphone:l=yield this.createTracks({audio:(o=r)!==null&&o!==void 0?o:!0});break;case D.Source.ScreenShare:l=yield this.createScreenTracks(Object.assign({},r));break;default:throw new Fr(e)}}catch(c){throw l==null||l.forEach(u=>{u.stop()}),c instanceof Error&&this.emit(q.MediaDevicesError,c,Ep(e)),this.pendingPublishing.delete(e),c}for(const c of l){const u=Object.assign(Object.assign({},this.roomOptions.publishDefaults),r);e===D.Source.Microphone&&yr(c)&&u.preConnectBuffer&&(this.log.info("starting preconnect buffer for microphone",Object.assign({},this.logContext)),c.startPreConnectBuffer())}try{const c=[];for(const h of l)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),fe(h))),c.push(this.publishTrack(h,i));[a]=yield Promise.all(c)}catch(c){throw l==null||l.forEach(u=>{u.stop()}),c}finally{this.pendingPublishing.delete(e)}}else if(!(a!=null&&a.track)&&this.pendingPublishing.has(e)&&(a=yield this.waitForPendingPublicationOfSource(e),a||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),a&&a.track)if(e===D.Source.ScreenShare){a=yield this.unpublishTrack(a.track);const l=this.getTrackPublication(D.Source.ScreenShareAudio);l&&l.track&&this.unpublishTrack(l.track)}else yield a.mute();return a})}enableCameraAndMicrophone(){return E(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(D.Source.Camera)||this.pendingPublishing.has(D.Source.Microphone))){this.pendingPublishing.add(D.Source.Camera),this.pendingPublishing.add(D.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(n=>this.publishTrack(n)))}finally{this.pendingPublishing.delete(D.Source.Camera),this.pendingPublishing.delete(D.Source.Microphone)}}})}createTracks(e){return E(this,void 0,void 0,function*(){var n,r;e??(e={});const i=gE(e,(n=this.roomOptions)===null||n===void 0?void 0:n.audioCaptureDefaults,(r=this.roomOptions)===null||r===void 0?void 0:r.videoCaptureDefaults);try{return(yield vh(i,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(a=>(yr(a)&&(this.microphoneError=void 0,a.setAudioContext(this.audioContext),a.source=D.Source.Microphone,this.emit(q.AudioStreamAcquired)),Qi(a)&&(this.cameraError=void 0,a.source=D.Source.Camera),a))}catch(s){throw s instanceof Error&&(e.audio&&(this.microphoneError=s),e.video&&(this.cameraError=s)),s}})}createScreenTracks(e){return E(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new qv("getDisplayMedia not supported");e.resolution===void 0&&!$3()&&(e.resolution=Hv.h1080fps30.resolution);const n=I3(e),r=yield navigator.mediaDevices.getDisplayMedia(n),i=r.getVideoTracks();if(i.length===0)throw new Fr("no video track found");const s=new Sd(i[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});s.source=D.Source.ScreenShare,e.contentHint&&(s.mediaStreamTrack.contentHint=e.contentHint);const o=[s];if(r.getAudioTracks().length>0){this.emit(q.AudioStreamAcquired);const a=new kd(r.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});a.source=D.Source.ScreenShareAudio,o.push(a)}return o})}publishTrack(e,n){return E(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,n)})}publishOrRepublishTrack(e,n){return E(this,arguments,void 0,function(r,i){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var a,l,c,u;Rr(r)&&r.setAudioContext(s.audioContext),yield(a=s.reconnectFuture)===null||a===void 0?void 0:a.promise,s.republishPromise&&!o&&(yield s.republishPromise),Ho(r)&&s.pendingPublishPromises.has(r)&&(yield s.pendingPublishPromises.get(r));let h;if(r instanceof MediaStreamTrack)h=r.getConstraints();else{h=r.constraints;let v;switch(r.source){case D.Source.Microphone:v="audioinput";break;case D.Source.Camera:v="videoinput"}v&&s.activeDeviceMap.has(v)&&(h=Object.assign(Object.assign({},h),{deviceId:s.activeDeviceMap.get(v)}))}if(r instanceof MediaStreamTrack)switch(r.kind){case"audio":r=new kd(r,h,!0,s.audioContext,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;case"video":r=new Sd(r,h,!0,{loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});break;default:throw new Fr("unsupported MediaStreamTrack kind ".concat(r.kind))}else r.updateLoggerOptions({loggerName:s.roomOptions.loggerName,loggerContextCb:()=>s.logContext});let f;if(s.trackPublications.forEach(v=>{v.track&&v.track===r&&(f=v)}),f)return s.log.warn("track has already been published, skipping",Object.assign(Object.assign({},s.logContext),fe(f))),f;const m=Object.assign(Object.assign({},s.roomOptions.publishDefaults),i),b="channelCount"in r.mediaStreamTrack.getSettings()&&r.mediaStreamTrack.getSettings().channelCount===2||r.mediaStreamTrack.getConstraints().channelCount===2,p=(l=m.forceStereo)!==null&&l!==void 0?l:b;p&&(m.dtx===void 0&&s.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},s.logContext),fe(r))),m.red===void 0&&s.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(c=m.dtx)!==null&&c!==void 0||(m.dtx=!1),(u=m.red)!==null&&u!==void 0||(m.red=!1)),!W3()&&s.roomOptions.e2ee&&(s.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},s.logContext)),m.simulcast=!1),m.source&&(r.source=m.source);const g=new Promise((v,y)=>E(s,void 0,void 0,function*(){try{if(this.engine.client.currentState!==Ne.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:fe(r)}));let w=!1;const k=setTimeout(()=>{w=!0,r.stop(),y(new qb("publishing rejected as engine not connected within timeout",408))},15e3);if(yield this.waitUntilEngineConnected(),clearTimeout(k),w)return;const S=yield this.publish(r,m,p);v(S)}else try{const w=yield this.publish(r,m,p);v(w)}catch(w){y(w)}}catch(w){y(w)}}));s.pendingPublishPromises.set(r,g);try{return yield g}catch(v){throw v}finally{s.pendingPublishPromises.delete(r)}}()})}waitUntilEngineConnected(){return this.signalConnectedFuture||(this.signalConnectedFuture=new xn),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),fe(e))),!1;const{canPublish:n,canPublishSources:r}=this.permissions;return n&&(r.length===0||r.map(i=>M3(i)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),fe(e))),!1)}publish(e,n,r){return E(this,void 0,void 0,function*(){var i,s,o,a,l,c,u,h,f,m;if(!this.hasPermissionsToPublish(e))throw new qb("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(P=>Ho(e)&&P.source===e.source)&&e.source!==D.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),fe(e))),n.stopMicTrackOnMute&&yr(e)&&(e.stopOnMute=!0),e.source===D.Source.ScreenShare&&Us()&&(n.simulcast=!1),n.videoCodec==="av1"&&!F3()&&(n.videoCodec=void 0),n.videoCodec==="vp9"&&!B3()&&(n.videoCodec=void 0),n.videoCodec===void 0&&(n.videoCodec=Ap),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(P=>n.videoCodec===vl(P.mime))||(n.videoCodec=vl(this.enabledPublishVideoCodecs[0].mime)));const p=n.videoCodec;e.on($.Muted,this.onTrackMuted),e.on($.Unmuted,this.onTrackUnmuted),e.on($.Ended,this.handleTrackEnded),e.on($.UpstreamPaused,this.onTrackUpstreamPaused),e.on($.UpstreamResumed,this.onTrackUpstreamResumed),e.on($.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const g=[],v=!(!((i=n.dtx)!==null&&i!==void 0)||i),y=e.getSourceTrackSettings();y.autoGainControl&&g.push(ft.TF_AUTO_GAIN_CONTROL),y.echoCancellation&&g.push(ft.TF_ECHO_CANCELLATION),y.noiseSuppression&&g.push(ft.TF_NOISE_SUPPRESSION),y.channelCount&&y.channelCount>1&&g.push(ft.TF_STEREO),v&&g.push(ft.TF_NO_DTX),Rr(e)&&e.hasPreConnectBuffer&&g.push(ft.TF_PRECONNECT_BUFFER);
410const w=new Gl({cid:e.mediaStreamTrack.id,name:n.name,type:D.kindToProto(e.kind),muted:e.isMuted,source:D.sourceToProto(e.source),disableDtx:v,encryption:this.encryptionType,stereo:r,disableRed:this.isE2EEEnabled||!(!((s=n.red)!==null&&s!==void 0)||s),stream:n==null?void 0:n.stream,backupCodecPolicy:n==null?void 0:n.backupCodecPolicy,audioFeatures:g});let k;if(e.kind===D.Kind.Video){let P={width:0,height:0};try{P=yield e.waitForDimensions()}catch{const A=(a=(o=this.roomOptions.videoCaptureDefaults)===null||o===void 0?void 0:o.resolution)!==null&&a!==void 0?a:Jl.h720.resolution;P={width:A.width,height:A.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),fe(e)),{dims:P}))}w.width=P.width,w.height=P.height,oi(e)&&(qn(p)&&(e.source===D.Source.ScreenShare&&(n.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),fe(e))))),n.scalabilityMode=(l=n.scalabilityMode)!==null&&l!==void 0?l:"L3T3_KEY"),w.simulcastCodecs=[new mp({codec:p,cid:e.mediaStreamTrack.id})],n.backupCodec===!0&&(n.backupCodec={codec:Ap}),n.backupCodec&&p!==n.backupCodec.codec&&w.encryption===it.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),w.simulcastCodecs.push(new mp({codec:n.backupCodec.codec,cid:""})))),k=Mp(e.source===D.Source.ScreenShare,w.width,w.height,n),w.layers=bw(w.width,w.height,k,qn(n.videoCodec))}else e.kind===D.Kind.Audio&&(k=[{maxBitrate:(c=n.audioPreset)===null||c===void 0?void 0:c.maxBitrate,priority:(h=(u=n.audioPreset)===null||u===void 0?void 0:u.priority)!==null&&h!==void 0?h:"high",networkPriority:(m=(f=n.audioPreset)===null||f===void 0?void 0:f.priority)!==null&&m!==void 0?m:"high"}]);if(!this.engine||this.engine.isClosed)throw new tt("cannot publish track when not connected");const S=()=>E(this,void 0,void 0,function*(){var P,R,A;if(!this.engine.pcManager)throw new tt("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,n,k),this.emit(q.LocalSenderCreated,e.sender,e),oi(e)&&((P=n.degradationPreference)!==null&&P!==void 0||(n.degradationPreference=YU(e)),e.setDegradationPreference(n.degradationPreference)),k)if(Us()&&e.kind===D.Kind.Audio){let O;for(const K of this.engine.pcManager.publisher.getTransceivers())if(K.sender===e.sender){O=K;break}O&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:O,codec:"opus",maxbr:!((R=k[0])===null||R===void 0)&&R.maxBitrate?k[0].maxBitrate/1e3:0})}else e.codec&&qn(e.codec)&&(!((A=k[0])===null||A===void 0)&&A.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:w.cid,codec:e.codec,maxbr:k[0].maxBitrate/1e3});yield this.engine.negotiate()});let T;const C=new Promise((P,R)=>E(this,void 0,void 0,function*(){var A;try{T=yield this.engine.addTrack(w),P(T)}catch(O){e.sender&&(!((A=this.engine.pcManager)===null||A===void 0)&&A.publisher)&&(this.engine.pcManager.publisher.removeTrack(e.sender),yield this.engine.negotiate().catch(K=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign(Object.assign({},this.logContext),fe(e)),{error:K}))})),R(O)}}));if(this.enabledPublishVideoCodecs.length>0)T=(yield Promise.all([C,S()]))[0];else{T=yield C;let P;if(T.codecs.forEach(R=>{P===void 0&&(P=R.mimeType)}),P&&e.kind===D.Kind.Video){const R=vl(P);R!==p&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),fe(e)),{codec:R})),n.videoCodec=R,k=Mp(e.source===D.Source.ScreenShare,w.width,w.height,n))}yield S()}const _=new Dp(e.kind,T,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(_.on($.CpuConstrained,P=>this.onTrackCpuConstrained(P,_)),_.options=n,e.sid=T.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:k,trackInfo:T})),oi(e)?e.startMonitor(this.engine.client):Rr(e)&&e.startMonitor(),this.addTrackPublication(_),this.emit
vendor: 4,723 bytes, line 410
410(q.LocalTrackPublished,_),Rr(e)&&T.audioFeatures.includes(ft.TF_PRECONNECT_BUFFER)){const P=e.getPreConnectBuffer(),R=e.getPreConnectBufferMimeType();this.on(q.LocalTrackSubscribed,A=>{if(A.trackSid===T.sid){if(!e.hasPreConnectBuffer){this.log.warn("subscribe event came to late, buffer already closed",this.logContext);return}this.log.debug("finished recording preconnect buffer",Object.assign(Object.assign({},this.logContext),fe(e))),e.stopPreConnectBuffer()}}),P&&new Promise((O,K)=>E(this,void 0,void 0,function*(){var F,Y,V,Q,N,M;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),fe(e)));const se=setTimeout(()=>{K(new Error("agent not active within 10 seconds"))},1e4),oe=yield this.waitUntilActiveAgentPresent();clearTimeout(se),this.log.debug("sending preconnect buffer",Object.assign(Object.assign({},this.logContext),fe(e)));const Pe=yield this.streamBytes({name:"preconnect-buffer",mimeType:R,topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[oe.identity],attributes:{trackId:_.trackSid,sampleRate:String((N=y.sampleRate)!==null&&N!==void 0?N:"48000"),channels:String((M=y.channelCount)!==null&&M!==void 0?M:"1")}});try{for(var H=!0,te=Ur(P),X;X=yield te.next(),F=X.done,!F;H=!0){Q=X.value,H=!1;const Oe=Q;yield Pe.write(Oe)}}catch(Oe){Y={error:Oe}}finally{try{!H&&!F&&(V=te.return)&&(yield V.call(te))}finally{if(Y)throw Y.error}}yield Pe.close(),O()}catch(se){K(se)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),fe(e)))}).catch(O=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),fe(e)),{error:O}))})}return _})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,n,r){return E(this,void 0,void 0,function*(){var i;if(this.encryptionType!==it.NONE)return;let s;if(this.trackPublications.forEach(m=>{m.track&&m.track===e&&(s=m)}),!s)throw new Fr("track is not published");if(!oi(e))throw new Fr("track is not a video track");const o=Object.assign(Object.assign({},(i=this.roomOptions)===null||i===void 0?void 0:i.publishDefaults),r),a=KU(e,n,o);if(!a){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),fe(e)));return}const l=e.addSimulcastTrack(n,a);if(!l)return;const c=new Gl({cid:l.mediaStreamTrack.id,type:D.kindToProto(e.kind),muted:e.isMuted,source:D.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:o.videoCodec,cid:l.mediaStreamTrack.id}]});if(c.layers=bw(c.width,c.height,a),!this.engine||this.engine.isClosed)throw new tt("cannot publish track when not connected");const u=()=>E(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,l,o,a),yield this.engine.negotiate()}),f=(yield Promise.all([this.engine.addTrack(c),u()]))[0];this.log.debug("published ".concat(n," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:a,trackInfo:f}))})}unpublishTrack(e,n){return E(this,void 0,void 0,function*(){var r,i;if(Ho(e)){const c=this.pendingPublishPromises.get(e);c&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),fe(e))),yield c)}const s=this.getPublicationForTrack(e),o=s?fe(s):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),o)),!s||!s.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),o));return}e=s.track,e.off($.Muted,this.onTrackMuted),e.off($.Unmuted,this.onTrackUnmuted),e.off($.Ended,this.handleTrackEnded),e.off($.UpstreamPaused,this.onTrackUpstreamPaused),e.off($.UpstreamResumed,this.onTrackUpstreamResumed),e.off($.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),n===void 0&&(n=(i=(r=this.roomOptions)===null||r===void 0?void 0:r.stopLocalTrackOnUnpublish)!==null&&i!==void 0?i:!0),n?e.stop():e.stopMonitor();let a=!1;const l=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Ve.FAILED&&l)try{for(const c of this.engine.pcManager.publisher.getTransceivers())c.sender===l&&(c.direction="inactive",a=!0);if(this.engine.removeTrack(l)&&(a=!0),oi(e)){for(const[,c]of e.simulcastCodecs)c.sender&&(this.engine.removeTrack(c.sender)&&(a=!0),c.sender=void 0);e.simulcastCodecs.clear()}}catch(c){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),o),{error:c}))}switch(this.trackPublications.delete(s.trackSid),s.kind){case D.Kind.Audio:this.audioTrackPublications.delete(s.trackSid);break;case D.Kind.Video:this.videoTrackPublications.delete(s.trackSid);break}
vendor: 9,743 bytes, line 410
410return this.emit(q.LocalTrackUnpublished,s),s.setTrack(void 0),a&&(yield this.engine.negotiate()),s})}unpublishTracks(e){return E(this,void 0,void 0,function*(){return(yield Promise.all(e.map(r=>this.unpublishTrack(r)))).filter(r=>!!r)})}republishAllTracks(e){return E(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){r.republishPromise&&(yield r.republishPromise),r.republishPromise=new Nt((s,o)=>E(r,void 0,void 0,function*(){try{const a=[];this.trackPublications.forEach(l=>{l.track&&(n&&(l.options=Object.assign(Object.assign({},l.options),n)),a.push(l))}),yield Promise.all(a.map(l=>E(this,void 0,void 0,function*(){const c=l.track;yield this.unpublishTrack(c,!1),i&&!c.isMuted&&c.source!==D.Source.ScreenShare&&c.source!==D.Source.ScreenShareAudio&&(Rr(c)||oi(c))&&!c.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:l.trackSid})),yield c.restartTrack()),yield this.publishOrRepublishTrack(c,l.options,!0)}))),s()}catch(a){a instanceof Error?o(a):o(new Error(String(a)))}finally{this.republishPromise=void 0}})),yield r.republishPromise}()})}publishData(e){return E(this,arguments,void 0,function(n){var r=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const s=i.reliable?he.RELIABLE:he.LOSSY,o=i.destinationIdentities,a=i.topic;let l=new Ov({participantIdentity:r.identity,payload:n,destinationIdentities:o,topic:a});const c=new Lt({kind:s,value:{case:"user",value:l}});yield r.engine.sendDataPacket(c,s)}()})}publishDtmf(e,n){return E(this,void 0,void 0,function*(){const r=new Lt({kind:he.RELIABLE,value:{case:"sipDtmf",value:new f1({code:e,digit:n})}});yield this.engine.sendDataPacket(r,he.RELIABLE)})}sendChatMessage(e,n){return E(this,void 0,void 0,function*(){const r={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:n==null?void 0:n.attachments},i=new Lt({value:{case:"chatMessage",value:new vd(Object.assign(Object.assign({},r),{timestamp:$e.parse(r.timestamp)}))}});return yield this.engine.sendDataPacket(i,he.RELIABLE),this.emit(q.ChatMessage,r),r})}editChatMessage(e,n){return E(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},n),{message:e,editTimestamp:Date.now()}),i=new Lt({value:{case:"chatMessage",value:new vd(Object.assign(Object.assign({},r),{timestamp:$e.parse(r.timestamp),editTimestamp:$e.parse(r.editTimestamp)}))}});return yield this.engine.sendDataPacket(i,he.RELIABLE),this.emit(q.ChatMessage,r),r})}sendText(e,n){return E(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendText(e,n)})}streamText(e){return E(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamText(e)})}sendFile(e,n){return E(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendFile(e,n)})}streamBytes(e){return E(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamBytes(e)})}performRpc(e){let{destinationIdentity:n,method:r,payload:i,responseTimeout:s=15e3}=e;const o=7e3,a=o+1e3;return new Nt((l,c)=>E(this,void 0,void 0,function*(){var u,h,f,m;if(ey(i)>_E){c(Ze.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((h=(u=this.engine.latestJoinResponse)===null||u===void 0?void 0:u.serverInfo)===null||h===void 0)&&h.version&&kr((m=(f=this.engine.latestJoinResponse)===null||f===void 0?void 0:f.serverInfo)===null||m===void 0?void 0:m.version,"1.8.0")<0){c(Ze.builtIn("UNSUPPORTED_SERVER"));return}const b=Math.max(s,a),p=crypto.randomUUID();yield this.publishRpcRequest(n,p,r,i,b);const g=setTimeout(()=>{this.pendingAcks.delete(p),c(Ze.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(p),clearTimeout(v)},o);this.pendingAcks.set(p,{resolve:()=>{clearTimeout(g)},participantIdentity:n});const v=setTimeout(()=>{this.pendingResponses.delete(p),c(Ze.builtIn("RESPONSE_TIMEOUT"))},s);this.pendingResponses.set(p,{resolve:(y,w)=>{clearTimeout(v),this.pendingAcks.has(p)&&(this.log.warn("RPC response received before ack",p),this.pendingAcks.delete(p),clearTimeout(g)),w?c(w):l(y??"")},participantIdentity:n})}))}registerRpcMethod(e,n){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=n,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const n=this.pendingAcks.get(e);n?(n.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,n,r){const i=this.pendingResponses.get(e);i?(i.resolve(n,r),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,n,r,i,s){return E(this,void 0,void 0,function*(){const o=new Lt({destinationIdentities:[e],kind:he.RELIABLE,value:{case:"rpcRequest",value:new Mv({id:n,method:r,payload:i,responseTimeoutMs:s,version:1})}});yield this.engine.sendDataPacket(o,he.RELIABLE)})}handleParticipantDisconnected(e){for(const[n,{participantIdentity:r}]of this.pendingAcks)r===e&&this.pendingAcks.delete(n);for(const[n,{participantIdentity:r,resolve:i}]of this.pendingResponses)r===e&&(i(null,Ze.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(n))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(n=>n.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(n=>{var r,i;const s=this.trackPublications.get(n.sid);if(s){const o=s.isMuted||((i=(r=s.track)===null||r===void 0?void 0:r.isUpstreamPaused)!==null&&i!==void 0?i:!1);o!==n.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),fe(s)),{mutedOnServer:o})),this.engine.client.sendMuteTrack(n.sid,o))}}),!0):!1}setActiveAgent(e){var n,r,i,s;this.firstActiveAgent=e,e&&!this.firstActiveAgent&&(this.firstActiveAgent=e),e?(r=(n=this.activeAgentFuture)===null||n===void 0?void 0:n.resolve)===null||r===void 0||r.call(n,e):(s=(i=this.activeAgentFuture)===null||i===void 0?void 0:i.reject)===null||s===void 0||s.call(i,new Error("Agent disconnected")),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||(this.activeAgentFuture=new xn),this.activeAgentFuture.promise)}getPublicationForTrack(e){let n;return this.trackPublications.forEach(r=>{const i=r.track;i&&(e instanceof MediaStreamTrack?(Rr(i)||oi(i))&&i.mediaStreamTrack===e&&(n=r):e===i&&(n=r))}),n}waitForPendingPublicationOfSource(e){return E(this,void 0,void 0,function*(){const r=Date.now();for(;Date.now()<r+1e4;){const i=Array.from(this.pendingPublishPromises.entries()).find(s=>{let[o]=s;return o.source===e});if(i)return i[1];yield xt(20)}})}}class v4 extends Or{constructor(e,n,r,i){super(e,n.sid,n.name,i),this.track=void 0,this.allowed=!0,this.requestedDisabled=void 0,this.visible=!0,this.handleEnded=s=>{this.setTrack(void 0),this.emit($.Ended,s)},this.handleVisibilityChange=s=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(s),this.logContext),this.visible=s,this.emitTrackUpdate()},this.handleVideoDimensionsChange=s=>{this.log.debug("adaptivestream video dimensions ".concat(s.width,"x").concat(s.height),this.logContext),this.videoDimensionsAdaptiveStream=s,this.emitTrackUpdate()},this.subscribed=r,this.updateInfo(n)}setSubscribed(e){const n=this.subscriptionStatus,r=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const i=new fh({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new p1({participantSid:"",trackSids:[this.trackSid]})]});this.emit($.UpdateSubscription,i),this.emitSubscriptionUpdateIfChanged(n),this.emitPermissionUpdateIfChanged(r)}get subscriptionStatus(){return this.subscribed===!1?Or.SubscriptionStatus.Unsubscribed:super.isSubscribed?Or.SubscriptionStatus.Subscribed:Or.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Or.PermissionStatus.Allowed:Or.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return this.requestedDisabled!==void 0?!this.requestedDisabled:this.isAdaptiveStream?this.visible:!0}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.requestedDisabled===!e||(this.requestedDisabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.requestedMaxQuality===e||(this.requestedMaxQuality=e,this.requestedVideoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var n,r;this.isManualOperationAllowed()&&(((n=this.requestedVideoDimensions)===null||n===void 0?void 0:n.width)===e.width&&((r=this.requestedVideoDimensions)===null||r===void 0?void 0:r.height)===e.height||(Cf(this.track)&&(this.requestedVideoDimensions=e),this.requestedMaxQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&Cf(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){var e;return(e=this.requestedMaxQuality)!==null&&e!==void 0?e:sn.HIGH}setTrack(e){const n=this.subscriptionStatus,r=this.permissionStatus,i=this.track;i!==e&&(i&&(i.off($.VideoDimensionsChanged,this.handleVideoDimensionsChange),i.off($.VisibilityChanged,this.handleVisibilityChange),i.off($.Ended,this.handleEnded),i.detach(),i.stopMonitor(),this.emit
vendor: 4,703 bytes, line 410
410($.Unsubscribed,i)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on($.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on($.VisibilityChanged,this.handleVisibilityChange),e.on($.Ended,this.handleEnded),this.emit($.Subscribed,e)),this.emitPermissionUpdateIfChanged(r),this.emitSubscriptionUpdateIfChanged(n))}setAllowed(e){const n=this.subscriptionStatus,r=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(r),this.emitSubscriptionUpdateIfChanged(n)}setSubscriptionError(e){this.emit($.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const n=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):n!==e.muted&&this.emit(e.muted?$.Muted:$.Unmuted)}emitSubscriptionUpdateIfChanged(e){const n=this.subscriptionStatus;e!==n&&this.emit($.SubscriptionStatusChanged,n,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit($.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return Cf(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new _1({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===D.Kind.Video){let n=this.requestedVideoDimensions;if(this.videoDimensionsAdaptiveStream!==void 0)if(n)Gb(this.videoDimensionsAdaptiveStream,n)&&(this.log.debug("using adaptive stream dimensions instead of requested",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream);else if(this.requestedMaxQuality!==void 0&&this.trackInfo){const r=j3(this.trackInfo,this.requestedMaxQuality);r&&Gb(this.videoDimensionsAdaptiveStream,r)&&(this.log.debug("using adaptive stream dimensions instead of max quality layer",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream)}else this.log.debug("using adaptive stream dimensions",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream;n?(e.width=Math.ceil(n.width),e.height=Math.ceil(n.height)):this.requestedMaxQuality!==void 0?(this.log.debug("using requested max quality",Object.assign(Object.assign({},this.logContext),{quality:this.requestedMaxQuality})),e.quality=this.requestedMaxQuality):(this.log.debug("using default quality",Object.assign(Object.assign({},this.logContext),{quality:sn.HIGH})),e.quality=sn.HIGH)}this.emit($.UpdateSettings,e)}}class Td extends jE{static fromParticipantInfo(e,n,r){return new Td(e,n.sid,n.identity,n.name,n.metadata,n.attributes,r,n.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,n,r,i,s,o,a){let l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:Kl.STANDARD;super(n,r||"",i,s,o,a,l),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on($.UpdateSettings,n=>{this.log.debug("send update settings",Object.assign(Object.assign(Object.assign({},this.logContext),fe(e)),{settings:n})),this.signalClient.sendUpdateTrackSettings(n)}),e.on($.UpdateSubscription,n=>{n.participantTracks.forEach(r=>{r.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(n)}),e.on($.SubscriptionPermissionChanged,n=>{this.emit(q.TrackSubscriptionPermissionChanged,e,n)}),e.on($.SubscriptionStatusChanged,n=>{this.emit(q.TrackSubscriptionStatusChanged,e,n)}),e.on($.Subscribed,n=>{this.emit(q.TrackSubscribed,n,e)}),e.on($.Unsubscribed,n=>{this.emit(q.TrackUnsubscribed,n,e)}),e.on($.SubscriptionFailed,n=>{this.emit(q.TrackSubscriptionFailed,e.trackSid,n)})}getTrackPublication(e){const n=super.getTrackPublication(e);if(n)return n}getTrackPublicationByName(e){const n=super.getTrackPublicationByName(e);if(n)return n}setVolume(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:D.Source.Microphone;this.volumeMap.set(n,e);const r=this.getTrackPublication(n);r&&r.track&&r.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D.Source.Microphone;const n=this.getTrackPublication(e);return n&&n.track?n.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,n,r,i,s,o){let a=this.getTrackPublicationBySid(n);if(a||n.startsWith("TR")||this.trackPublications.forEach(u=>{!a&&e.kind===u.kind.toString()&&(a=u)}),!a){if(o===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:n}
vendor: 9,205 bytes, line 410
410)),this.emit(q.TrackSubscriptionFailed,n);return}o===void 0&&(o=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,n,r,i,s,o-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),fe(a))),this.emit(q.TrackSubscriptionFailed,n);return}const l=e.kind==="video";let c;return l?c=new d4(e,n,i,s):c=new u4(e,n,i,this.audioContext,this.audioOutput),c.source=a.source,c.isMuted=a.isMuted,c.setMediaStream(r),c.start(),a.setTrack(c),this.volumeMap.has(a.source)&&Ip(c)&&yr(c)&&c.setVolume(this.volumeMap.get(a.source)),a}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const n=new Map,r=new Map;return e.tracks.forEach(i=>{var s,o;let a=this.getTrackPublicationBySid(i.sid);if(a)a.updateInfo(i);else{const l=D.kindFromProto(i.type);if(!l)return;a=new v4(l,i,(s=this.signalClient.connectOptions)===null||s===void 0?void 0:s.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(o=this.loggerOptions)===null||o===void 0?void 0:o.loggerName}),a.updateInfo(i),r.set(i.sid,a);const c=Array.from(this.trackPublications.values()).find(u=>u.source===(a==null?void 0:a.source));c&&a.source!==D.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(a.source),Object.assign(Object.assign({},this.logContext),{oldTrack:fe(c),newTrack:fe(a)})),this.addTrackPublication(a)}n.set(i.sid,a)}),this.trackPublications.forEach(i=>{n.has(i.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),fe(i))),this.unpublishTrack(i.trackSid,!0))}),r.forEach(i=>{this.emit(q.TrackPublished,i)}),!0}unpublishTrack(e,n){const r=this.trackPublications.get(e);if(!r)return;const{track:i}=r;switch(i&&(i.stop(),r.setTrack(void 0)),this.trackPublications.delete(e),r.kind){case D.Kind.Audio:this.audioTrackPublications.delete(e);break;case D.Kind.Video:this.videoTrackPublications.delete(e);break}n&&this.emit(q.TrackUnpublished,r)}setAudioOutput(e){return E(this,void 0,void 0,function*(){this.audioOutput=e;const n=[];this.audioTrackPublications.forEach(r=>{var i;yr(r.track)&&Ip(r.track)&&n.push(r.track.setSinkId((i=e.deviceId)!==null&&i!==void 0?i:"default"))}),yield Promise.all(n)})}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:r})),super.emit(e,...r)}}var ke;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(ke||(ke={}));const y4=4*1e3;class wa extends Tr.EventEmitter{get hasE2EESetup(){return this.e2eeManager!==void 0}constructor(e){var n,r,i,s,o;if(super(),n=this,this.state=ke.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=de,this.bufferedEvents=[],this.isResuming=!1,this.rpcHandlers=new Map,this.connect=(a,l,c)=>E(this,void 0,void 0,function*(){var u;if(!z3())throw xr()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const h=yield this.disconnectLock.lock();if(this.state===ke.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),h(),Promise.resolve();if(this.connectFuture)return h(),this.connectFuture.promise;this.setAndEmitConnectionState(ke.Connecting),((u=this.regionUrlProvider)===null||u===void 0?void 0:u.getServerUrl().toString())!==SE(a)&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),ba(new URL(a))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new ye(a,l):this.regionUrlProvider.updateToken(l),this.regionUrlProvider.fetchRegionSettings().then(b=>{var p;(p=this.regionUrlProvider)===null||p===void 0||p.setServerReportedRegions(b)}).catch(b=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:b}))}));const f=(b,p,g)=>E(this,void 0,void 0,function*(){var v,y;this.abortController&&this.abortController.abort();const w=new AbortController;this.abortController=w,h==null||h();try{if(yield Ko.getInstance().getBackOffPromise(a),w.signal.aborted)throw re.cancelled("Connection attempt aborted");yield this.attemptConnection(g??a,l,c,w),this.abortController=void 0,b()}catch(k){if(this.regionUrlProvider&&k instanceof re&&k.reason!==Ae.Cancelled&&k.reason!==Ae.NotAllowed){let S=null;try{this.log.debug("Fetching next region"),S=yield this.regionUrlProvider.getNextBestRegionUrl((v=this.abortController)===null||v===void 0?void 0:v.signal)}catch(T){if(T instanceof re&&(T.status===401||T.reason===Ae.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),p(T);return}}[Ae.InternalError,Ae.ServerUnreachable,Ae.Timeout].includes(k.reason)&&(this.log.debug("Adding failed connection attempt to back off"),Ko.getInstance().addFailedConnectionAttempt(a)),S&&!(!((y=this.abortController)===null||y===void 0)&&y.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(k.message,". Retrying with another region: ").concat(S),this.logContext),this.recreateEngine(),yield f(b,p,S)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,tw(k)),p(k))}else{let S=Kn.UNKNOWN_REASON;k instanceof re&&(S=tw(k)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,S),p(k)}}}),m=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new xn((b,p)=>{f(b,p,m)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(a,l,c,u,h,f)=>E(this,void 0,void 0,function*(){var m,b,p;const g=yield c.join(a,l,{autoSubscribe:u.autoSubscribe,adaptiveStream:typeof h.adaptiveStream=="object"?!0:h.adaptiveStream,maxRetries:u.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:u.websocketTimeout},f.signal,!h.singlePeerConnection);let v=g.serverInfo;if(v||(v={version:g.serverVersion,region:g.serverRegion}),this.serverInfo=v,this.log.debug("connected to Livekit Server ".concat(Object.entries(v).map(y=>{let[w,k]=y;return"".concat(w,": ").concat(k)}).join(", ")),{room:(m=g.room)===null||m===void 0?void 0:m.name,roomSid:(b=g.room)===null||b===void 0?void 0:b.sid,identity:(p=g.participant)===null||p===void 0?void 0:p.identity}),!v.version)throw new S3("unknown server version");return v.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),h.dynacast=!1),g}),this.applyJoinResponse=a=>{const l=a.participant;if(this.localParticipant.sid=l.sid,this.localParticipant.identity=l.identity,this.localParticipant.setEnabledPublishCodecs(a.enabledPublishCodecs),this.e2eeManager)try{this.e2eeManager.setSifTrailer(a.sifTrailer)}catch(c){this.log.error(c instanceof Error?c.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:c}))}this.handleParticipantUpdates([l,...a.otherParticipants]),a.room&&this.handleRoomUpdate(a.room)},this.attemptConnection=(a,l,c,u)=>E(this,void 0,void 0,function*(){var h,f;this.state===ke.Reconnecting||this.isResuming||!((h=this.engine)===null||h===void 0)&&h.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((f=this.regionUrlProvider)===null||f===void 0)&&f.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},Zv),c),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const m=yield this.connectSignal(a,l,this.engine,this.connOptions,this.options,u);this.applyJoinResponse(m),this.setupLocalParticipantEvents(),this.emit(U.SignalConnected)}catch(m){yield this.engine.close(),this.recreateEngine();const b=u.signal.aborted?re.cancelled("Signal connection aborted"):re.serverUnreachable("could not establish signal connection");throw m instanceof Error&&(b.message="".concat(b.message,": ").concat(m.message)),m instanceof re&&(b.reason=m.reason,b.status=m.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:m})),b}if(u.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),re.cancelled("Connection attempt aborted");try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,u)}catch(m){throw yield this.engine.close(),this.recreateEngine(),m}Kt()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Kt()&&window.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(ke.Connected),this.emit
410(U.Connected),Ko.getInstance().resetFailedConnectionAttempts(a),this.registerConnectionReconcile(),this.regionUrlProvider&&this.regionUrlProvider.notifyConnected()}),this.disconnect=function(){for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return E(n,[...l],void 0,function(){var u=this;let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var f,m,b;const p=yield u.disconnectLock.lock();try{if(u.state===ke.Disconnected){u.log.debug("already disconnected",u.logContext);return}if(u.log.info("disconnect from room",Object.assign({},u.logContext)),u.state===ke.Connecting||u.state===ke.Reconnecting||u.isResuming){const g="Abort connection attempt due to user initiated disconnect";u.log.warn(g,u.logContext),(f=u.abortController)===null||f===void 0||f.abort(g),(b=(m=u.connectFuture)===null||m===void 0?void 0:m.reject)===null||b===void 0||b.call(m,re.cancelled("Client initiated disconnect")),u.connectFuture=void 0}u.engine&&(u.engine.client.isDisconnected||(yield u.engine.client.sendLeave()),yield u.engine.close()),u.handleDisconnect(h,Kn.CLIENT_INITIATED),u.engine=void 0}finally{p()}}()})},this.onPageLeave=()=>E(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>E(this,void 0,void 0,function*(){const a=[],l=Qt();if(l&&l.os==="iOS"){const c="livekit-dummy-audio-el";let u=document.getElementById(c);if(!u){u=document.createElement("audio"),u.id=c,u.autoplay=!0,u.hidden=!0;const h=Tf();h.enabled=!0;const f=new MediaStream([h]);u.srcObject=f,document.addEventListener("visibilitychange",()=>{u&&(u.srcObject=document.hidden?null:f,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(u),this.once(U.Disconnected,()=>{u==null||u.remove(),u=null})}a.push(u)}
vendor: 11,685 bytes, line 410
410this.remoteParticipants.forEach(c=>{c.audioTrackPublications.forEach(u=>{u.track&&u.track.attachedElements.forEach(h=>{a.push(h)})})});try{yield Promise.all([this.acquireAudioContext(),...a.map(c=>(c.muted=!1,c.play()))]),this.handleAudioPlaybackStarted()}catch(c){throw this.handleAudioPlaybackFailed(c),c}}),this.startVideo=()=>E(this,void 0,void 0,function*(){const a=[];for(const l of this.remoteParticipants.values())l.videoTrackPublications.forEach(c=>{var u;(u=c.track)===null||u===void 0||u.attachedElements.forEach(h=>{a.includes(h)||a.push(h)})});yield Promise.all(a.map(l=>l.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(l=>{l.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const a of this.remoteParticipants.values())this.handleParticipantDisconnected(a.identity,a);this.setAndEmitConnectionState(ke.Reconnecting)&&this.emit(U.Reconnecting)},this.handleSignalRestarted=a=>E(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(a.serverRegion),Object.assign(Object.assign({},this.logContext),{region:a.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(a);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(l){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:l}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:a.serverRegion}))}catch{return}this.setAndEmitConnectionState(ke.Connected),this.emit(U.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=a=>{a.forEach(l=>{var c;if(l.identity===this.localParticipant.identity){this.localParticipant.updateInfo(l);return}l.identity===""&&(l.identity=(c=this.sidToIdentity.get(l.sid))!==null&&c!==void 0?c:"");let u=this.remoteParticipants.get(l.identity);l.state===$o.DISCONNECTED?this.handleParticipantDisconnected(l.identity,u):u=this.getOrCreateParticipant(l.identity,l)})},this.handleActiveSpeakersUpdate=a=>{const l=[],c={};a.forEach(u=>{if(c[u.sid]=!0,u.sid===this.localParticipant.sid)this.localParticipant.audioLevel=u.level,this.localParticipant.setIsSpeaking(!0),l.push(this.localParticipant);else{const h=this.getRemoteParticipantBySid(u.sid);h&&(h.audioLevel=u.level,h.setIsSpeaking(!0),l.push(h))}}),c[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(u=>{c[u.sid]||(u.audioLevel=0,u.setIsSpeaking(!1))}),this.activeSpeakers=l,this.emitWhenConnected(U.ActiveSpeakersChanged,l)},this.handleSpeakersChanged=a=>{const l=new Map;this.activeSpeakers.forEach(u=>{const h=this.remoteParticipants.get(u.identity);h&&h.sid!==u.sid||l.set(u.sid,u)}),a.forEach(u=>{let h=this.getRemoteParticipantBySid(u.sid);u.sid===this.localParticipant.sid&&(h=this.localParticipant),h&&(h.audioLevel=u.level,h.setIsSpeaking(u.active),u.active?l.set(u.sid,h):l.delete(u.sid))});const c=Array.from(l.values());c.sort((u,h)=>h.audioLevel-u.audioLevel),this.activeSpeakers=c,this.emitWhenConnected(U.ActiveSpeakersChanged,c)},this.handleStreamStateUpdate=a=>{a.streamStates.forEach(l=>{const c=this.getRemoteParticipantBySid(l.participantSid);if(!c)return;const u=c.getTrackPublicationBySid(l.trackSid);if(!u||!u.track)return;const h=D.streamStateFromProto(l.state);u.track.setStreamState(h),h!==u.track.streamState&&(c.emit(q.TrackStreamStateChanged,u,u.track.streamState),this.emitWhenConnected(U.TrackStreamStateChanged,u,u.track.streamState,c))})},this.handleSubscriptionPermissionUpdate=a=>{const l=this.getRemoteParticipantBySid(a.participantSid);if(!l)return;const c=l.getTrackPublicationBySid(a.trackSid);c&&c.setAllowed(a.allowed)},this.handleSubscriptionError=a=>{const l=Array.from(this.remoteParticipants.values()).find(u=>u.trackPublications.has(a.trackSid));if(!l)return;const c=l.getTrackPublicationBySid(a.trackSid);c&&c.setSubscriptionError(a.err)},this.handleDataPacket=(a,l)=>{const c=this.remoteParticipants.get(a.participantIdentity);if(a.value.case==="user")this.handleUserPacket(c,a.value.value,a.kind,l);else if(a.value.case==="transcription")this.handleTranscription(c,a.value.value);else if(a.value.case==="sipDtmf")this.handleSipDtmf(c,a.value.value);else if(a.value.case==="chatMessage")this.handleChatMessage(c,a.value.value);else if(a.value.case==="metrics")this.handleMetrics(a.value.value,c);else if(a.value.case==="streamHeader"||a.value.case==="streamChunk"||a.value.case==="streamTrailer")this.handleDataStream(a,l);else if(a.value.case==="rpcRequest"){const u=a.value.value;this.handleIncomingRpcRequest(a.participantIdentity,u.id,u.method,u.payload,u.responseTimeoutMs,u.version)}},this.handleUserPacket=(a,l,c,u)=>{this.emit(U.DataReceived,l.payload,a,c,l.topic,u),a==null||a.emit(q.DataReceived,l.payload,c,u)},this.handleSipDtmf=(a,l)=>{this.emit(U.SipDTMFReceived,l,a),a==null||a.emit(q.SipDTMFReceived,l)},this.handleTranscription=(a,l)=>{const c=l.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(l.transcribedParticipantIdentity),u=c==null?void 0:c.trackPublications.get(l.trackId),h=Y3(l,this.transcriptionReceivedTimes);u==null||u.emit($.TranscriptionReceived,h),c==null||c.emit(q.TranscriptionReceived,h,u),this.emit(U.TranscriptionReceived,h,c,u)},this.handleChatMessage=(a,l)=>{const c=Q3(l);this.emit(U.ChatMessage,c,a)},this.handleMetrics=(a,l)=>{this.emit(U.MetricsReceived,a,l)},this.handleDataStream=(a,l)=>{this.incomingDataStreamManager.handleDataStreamPacket(a,l)},this.bufferedSegments=new Map,this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(U.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=a=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:a})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(U.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(U.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(U.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>E(this,void 0,void 0,function*(){var a;((a=Qt())===null||a===void 0?void 0:a.os)!=="iOS"&&(yield this.selectDefaultDevices()),this.emit(U.MediaDevicesChanged)}),this.handleRoomUpdate=a=>{const l=this.roomInfo;this.roomInfo=a,l&&l.metadata!==a.metadata&&this.emitWhenConnected(U.RoomMetadataChanged,a.metadata),(l==null?void 0:l.activeRecording)!==a.activeRecording&&this.emitWhenConnected(U.RecordingStatusChanged,a.activeRecording)},this.handleConnectionQualityUpdate=a=>{a.updates.forEach(l=>{if(l.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(l.quality);return}const c=this.getRemoteParticipantBySid(l.participantSid);c&&c.setConnectionQuality(l.quality)})},this.onLocalParticipantMetadataChanged=a=>{this.emit(U.ParticipantMetadataChanged,a,this.localParticipant)},this.onLocalParticipantNameChanged=a=>{this.emit(U.ParticipantNameChanged,a,this.localParticipant)},this.onLocalAttributesChanged=a=>{this.emit(U.ParticipantAttributesChanged,a,this.localParticipant)},this.onLocalTrackMuted=a=>{this.emit(U.TrackMuted,a,this.localParticipant)},this.onLocalTrackUnmuted=a=>{this.emit(U.TrackUnmuted,a,this.localParticipant)},this.onTrackProcessorUpdate=a=>{var l;(l=a==null?void 0:a.onPublish)===null||l===void 0||l.call(a,this)},this.onLocalTrackPublished=a=>E(this,void 0,void 0,function*(){var l,c,u,h,f,m;(l=a.track)===null||l===void 0||l.on($.TrackProcessorUpdate,this.onTrackProcessorUpdate),(c=a.track)===null||c===void 0||c.on($.Restarted,this.onLocalTrackRestarted),(f=(h=(u=a.track)===null||u===void 0?void 0:u.getProcessor())===null||h===void 0?void 0:h.onPublish)===null||f===void 0||f.call(h,this),this.emit(U.LocalTrackPublished,a,this.localParticipant),Rr(a.track)&&(yield a.track.checkForSilence())&&this.emit(U.LocalAudioSilenceDetected,a);const b=yield(m=a.track)===null||m===void 0?void 0:m.getDeviceId(!1),p=Ep(a.source);p&&b&&b!==this.localParticipant.activeDeviceMap.get(p)&&(this.localParticipant.activeDeviceMap.set(p,b),this.emit(U.ActiveDeviceChanged,p,b))}),this.onLocalTrackUnpublished=a=>{var l,c;(l=a.track)===null||l===void 0||l.off($.TrackProcessorUpdate,this.onTrackProcessorUpdate),(c=a.track)===null||c===void 0||c.off($.Restarted,this.onLocalTrackRestarted),this.emit(U.LocalTrackUnpublished,a,this.localParticipant)},this.onLocalTrackRestarted=a=>E(this,void 0,void 0,function*(){const l=yield a.getDeviceId(!1),c=Ep(a.source);c&&l&&l!==this.localParticipant.activeDeviceMap.get(c)&&(this.log.debug("local track restarted, setting ".concat(c," ").concat(l," active"),this.logContext),this.localParticipant.activeDeviceMap.set(c,l),this.emit(U.ActiveDeviceChanged,c,l))}),this.onLocalConnectionQualityChanged=a=>{this.emit(U.ConnectionQualityChanged,a,this.localParticipant)},this.onMediaDevicesError=(a,l)=>{this.emit(U.MediaDevicesError,a,l)},this.onLocalParticipantPermissionsChanged=a=>{this.emit(U.ParticipantPermissionsChanged,a,this.localParticipant)},this.onLocalChatMessageSent=a=>{this.emit(U.ChatMessage,a,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},IU),e),this.log=wr((r=this.options.loggerName)!==null&&r!==void 0?r:Cn.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},TE),e==null?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},CE),e==null?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},RU),e==null?void 0:e.publishDefaults),this.maybeCreateEngine(),this.incomingDataStreamManager=new o4,this.outgoingDataStreamManager=new c4(this.engine,this.log),this.disconnectLock=new Ft,this.localParticipant=new g4("","",this.engine,this.options,this.rpcHandlers,this.outgoingDataStreamManager),(this.options.e2ee||this.options.encryption)&&this.setupE2EE(),this.engine.e2eeManager=this.e2eeManager,this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Rs(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Rs(this.options.audioCaptureDefaults.deviceId)),!((i=this.options.audioOutput)===null||i===void 0)&&i.deviceId&&this.switchActiveDevice("audiooutput",Rs(this.options.audioOutput.deviceId)).catch(a=>this.log.warn("Could not set audio output: ".concat(a.message),this.logContext)),Kt()){const a=new AbortController;(o=(s=navigator.mediaDevices)===null||s===void 0?void 0:s.addEventListener)===null||o===void 0||o.call(s,"devicechange",this.handleDeviceChange,{signal:a.signal}),wa.cleanupRegistry&&wa.cleanupRegistry.register(this,()=>{a.abort()})}}registerTextStreamHandler(e,n){return this.incomingDataStreamManager.registerTextStreamHandler(e,n)}unregisterTextStreamHandler(e){return this.incomingDataStreamManager.unregisterTextStreamHandler(e)}registerByteStreamHandler(e,n){return this.incomingDataStreamManager.registerByteStreamHandler(e,n)}unregisterByteStreamHandler(e){return this.incomingDataStreamManager.unregisterByteStreamHandler(e)}
410registerRpcMethod(e,n){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,n)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setE2EEEnabled(e){return E(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;const n=!!this.options.encryption,r=this.options.encryption||this.options.e2ee;r&&("e2eeManager"in r?(this.e2eeManager=r.e2eeManager,this.e2eeManager.isDataChannelEncryptionEnabled=n):this.e2eeManager=new hU(r,n),this.e2eeManager.on(Ei.ParticipantEncryptionStatusChanged,(i,s)=>{Z3(s)&&(this.isE2EEEnabled=i),this.emit(U.ParticipantEncryptionStatusChanged,i,s)}),this.e2eeManager.on(Ei.EncryptionError,(i,s)=>{const o=s?this.getParticipantByIdentity(s):void 0;this.emit(U.EncryptionError,i,o)}),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&n!==void 0?n:!1}getSid(){return this.state===ke.Disconnected?Nt.resolve(""):this.roomInfo&&this.roomInfo.sid!==""?Nt.resolve(this.roomInfo.sid):new Nt((e,n)=>{const r=i=>{i.sid!==""&&(this.engine.off(W.RoomUpdate,r),e(i.sid))};this.engine.on(W.RoomUpdate,r),this.once(U.Disconnected,()=>{this.engine.off(W.RoomUpdate,r),n(new tt("Room disconnected before room server id was available"))})})}get name(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&n!==void 0?n:0}get numPublishers(){var e,n;return(n=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&n!==void 0?n:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new n4(this.options),this.engine.e2eeManager=this.e2eeManager,this.engine.on(W.ParticipantUpdate,this.handleParticipantUpdates).on(W.RoomUpdate,this.handleRoomUpdate).on(W.SpeakersChanged,this.handleSpeakersChanged).on(W.StreamStateChanged,this.handleStreamStateUpdate).on(W.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(W.SubscriptionError,this.handleSubscriptionError).on(W.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(W.MediaTrackAdded,(e,n,r)=>{this.onTrackAdded(e,n,r)}).on(W.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(W.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(W.DataPacketReceived,this.handleDataPacket).on(W.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(ke.SignalReconnecting)&&this.emit(U.SignalReconnecting)}).on(W.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(ke.Connected)&&this.emit(U.Reconnected)}).on(W.SignalResumed,()=>{this.bufferedEvents=[],(this.state===ke.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(W.Restarting,this.handleRestarting).on(W.SignalRestarted,this.handleSignalRestarted).on(W.Offline,()=>{this.setAndEmitConnectionState(ke.Reconnecting)&&this.emit(U.Reconnecting)}).on(W.DCBufferStatusChanged,(e,n)=>{this.emit(U.DCBufferStatusChanged,e,n)}).on(W.LocalTrackSubscribed,e=>{const n=this.localParticipant.getTrackPublications().find(r=>{let{trackSid:i}=r;return i===e});if(!n){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(q.LocalTrackSubscribed,n),this.emitWhenConnected(U.LocalTrackSubscribed,n,this.localParticipant)}).on(W.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEac
vendor: 4,821 bytes, line 410
410h((n,r)=>{this.handleParticipantDisconnected(r,n)}),this.emit(U.Moved,e.room.name),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine),this.outgoingDataStreamManager&&this.outgoingDataStreamManager.setupEngine(this.engine))}static getLocalDevices(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return mt.getInstance().getDevices(e,n)}prepareConnection(e,n){return E(this,void 0,void 0,function*(){if(this.state===ke.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(ba(new URL(e))&&n){this.regionUrlProvider=new ye(e,n);const r=yield this.regionUrlProvider.getNextBestRegionUrl();r&&this.state===ke.Disconnected&&(this.regionUrl=r,yield fetch(Ql(r),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(r),this.logContext))}else yield fetch(Ql(e),{method:"HEAD"})}catch(r){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:r}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,n){return E(this,void 0,void 0,function*(){let r=()=>E(this,void 0,void 0,function*(){}),i;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":i=new sr({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":i=new sr({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":i=new sr({scenario:{case:"serverLeave",value:!0}});break;case"migration":i=new sr({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":r=()=>E(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new sr({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":r=()=>E(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new sr({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":i=new sr({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),r=()=>E(this,void 0,void 0,function*(){const s=this.engine.client.onLeave;s&&s(new mh({reason:Kn.CLIENT_INITIATED,action:Vo.RECONNECT}))});break;case"subscriber-bandwidth":if(n===void 0||typeof n!="number")throw new Error("subscriber-bandwidth requires a number as argument");i=new sr({scenario:{case:"subscriberBandwidth",value:us(n)}});break;case"leave-full-reconnect":i=new sr({scenario:{case:"leaveRequestFullReconnect",value:!0}})}i&&(yield this.engine.client.sendSimulateScenario(i),yield r())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,n){return E(this,arguments,void 0,function(r,i){var s=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var a,l,c,u,h,f,m;let b=!0,p=!1;const g=o?{exact:i}:i;if(r==="audioinput"){p=s.localParticipant.audioTrackPublications.size===0;const v=(a=s.getActiveDevice(r))!==null&&a!==void 0?a:s.options.audioCaptureDefaults.deviceId;s.options.audioCaptureDefaults.deviceId=g;const y=Array.from(s.localParticipant.audioTrackPublications.values()).filter(k=>k.source===D.Source.Microphone);try{b=(yield Promise.all(y.map(k=>{var S;return(S=k.audioTrack)===null||S===void 0?void 0:S.setDeviceId(g)}))).every(k=>k===!0)}catch(k){throw s.options.audioCaptureDefaults.deviceId=v,k}const w=y.some(k=>{var S,T;return(T=(S=k.track)===null||S===void 0?void 0:S.isMuted)!==null&&T!==void 0?T:!1});b&&w&&(p=!0)}else if(r==="videoinput"){p=s.localParticipant.videoTrackPublications.size===0;const v=(l=s.getActiveDevice(r))!==null&&l!==void 0?l:s.options.videoCaptureDefaults.deviceId;s.options.videoCaptureDefaults.deviceId=g;const y=Array.from(s.localParticipant.videoTrackPublications.values()).filter(k=>k.source===D.Source.Camera);try{b=(yield Promise.all(y.map(k=>{var S;return(S=k.videoTrack)===null||S===void 0?void 0:S.setDeviceId(g)}))).every(k=>k===!0)}catch(k){throw s.options.videoCaptureDefaults.deviceId=v,k}const w=y.some(k=>{var S,T;return(T=(S=k.track)===null||S===void 0?void 0:S.isMuted)!==null&&T!==void 0?T:!1});b&&w&&(p=!0)}
410else if(r==="audiooutput"){if(p=!0,!Rp()&&!s.options.webAudioMix||s.options.webAudioMix&&s.audioContext&&!("setSinkId"in s.audioContext))throw new Error("cannot switch audio output, the current browser does not support it");s.options.webAudioMix&&(i=(c=yield mt.getInstance().normalizeDeviceId("audiooutput",i))!==null&&c!==void 0?c:""),(u=(m=s.options).audioOutput)!==null&&u!==void 0||(m.audioOutput={});const v=(h=s.getActiveDevice(r))!==null&&h!==void 0?h:s.options.audioOutput.deviceId;s.options.audioOutput.deviceId=i;try{s.options.webAudioMix&&((f=s.audioContext)===null||f===void 0||f.setSinkId(i)),yield Promise.all(Array.from(s.remoteParticipants.values()).map(y=>y.setAudioOutput({deviceId:i})))}catch(y){throw s.options.audioOutput.deviceId=v,y}}return p&&(s.localParticipant.activeDeviceMap.set(r,i),s.emit(U.ActiveDeviceChanged,r,i)),b}()})}setupLocalParticipantEvents(){this.localParticipant.on(q.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(q.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(q.AttributesChanged,this.onLocalAttributesChanged).on(q.TrackMuted,this.onLocalTrackMuted).on(q.TrackUnmuted,this.onLocalTrackUnmuted).on(q.LocalTrackPublished,this.onLocalTrackPublished).on(q.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(q.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(q.MediaDevicesError,this.onMediaDevicesError).on(q.AudioStreamAcquired,this.startAudio).on(q.ChatMessage,this.onLocalChatMessageSent).on(q.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,n,r){if(this.state===ke.Connecting||this.state===ke.Reconnecting){const h=()=>{this.log.debug("deferring on track for later",{mediaTrackId:e.id,mediaStreamId:n.id,tracksInStream:n.getTracks().map(m=>m.id)}),this.onTrackAdded(e,n,r),f()},f=()=>{this.off(U.Reconnected,h),this.off(U.Connected,h),this.off(U.Disconnected,f)};this.once(U.Reconnected,h),this.once(U.Connected,h),this.once(U.Disconnected,f);return}if(this.state===ke.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const i=U3(n.id),s=i[0];let o=i[1],a=e.id;if(o&&o.startsWith("TR")&&(a=o),s===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const l=Array.from(this.remoteParticipants.values()).find(h=>h.sid===s);if(!l){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(s),this.logContext);return}if(!a.startsWith("TR")){const h=this.engine.getTrackIdForReceiver(r);if(!h){this.log.error("Tried to add a track whose 'sid' could not be found for a participant, that's not present. Sid: ".concat(s),this.logContext);return}a=h}a.startsWith("TR")||this.log.warn("Tried to add a track whose 'sid' could not be determined for a participant, that's not present. Sid: ".concat(s,", streamId: ").concat(o,", trackId: ").concat(a),Object.assign(Object.assign({},this.logContext),{rpID:s,streamId:o,trackId:a}));let c;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?c=this.options.adaptiveStream:c={});const u=l.addSubscribedMediaTrack(e,a,n,r,c);u!=null&&u.isEncrypted&&!this.e2eeManager&&this.emit(U.EncryptionError,new Error("Encrypted ".concat(u.source," track received from participant ").concat(l.sid,", but room does not have encryption enabled!")))}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=arguments.length>1?arguments[1]:void 0;var r,i;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.incomingDataStreamManager.clearControllers(),this.state!==ke.Disconnected){this.regionUrl=void 0,this.regionUrlProvider&&this.regionUrlProvider.notifyDisconnected();
vendor: 21,167 bytes, line 410
410try{this.remoteParticipants.forEach(s=>{s.trackPublications.forEach(o=>{s.unpublishTrack(o.trackSid)})}),this.localParticipant.trackPublications.forEach(s=>{var o,a,l;s.track&&this.localParticipant.unpublishTrack(s.track,e),e?((o=s.track)===null||o===void 0||o.detach(),(a=s.track)===null||a===void 0||a.stop()):(l=s.track)===null||l===void 0||l.stopMonitor()}),this.localParticipant.off(q.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(q.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(q.AttributesChanged,this.onLocalAttributesChanged).off(q.TrackMuted,this.onLocalTrackMuted).off(q.TrackUnmuted,this.onLocalTrackUnmuted).off(q.LocalTrackPublished,this.onLocalTrackPublished).off(q.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(q.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(q.MediaDevicesError,this.onMediaDevicesError).off(q.AudioStreamAcquired,this.startAudio).off(q.ChatMessage,this.onLocalChatMessageSent).off(q.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),Kt()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(i=(r=navigator.mediaDevices)===null||r===void 0?void 0:r.removeEventListener)===null||i===void 0||i.call(r,"devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(ke.Disconnected),this.emit(U.Disconnected,n)}}}handleParticipantDisconnected(e,n){var r;this.remoteParticipants.delete(e),n&&(this.incomingDataStreamManager.validateParticipantHasNoActiveDataStreams(e),n.trackPublications.forEach(i=>{n.unpublishTrack(i.trackSid,!0)}),this.emit(U.ParticipantDisconnected,n),n.setDisconnected(),(r=this.localParticipant)===null||r===void 0||r.handleParticipantDisconnected(n.identity))}handleIncomingRpcRequest(e,n,r,i,s,o){return E(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,n),o!==1){yield this.engine.publishRpcResponse(e,n,null,Ze.builtIn("UNSUPPORTED_VERSION"));return}const a=this.rpcHandlers.get(r);if(!a){yield this.engine.publishRpcResponse(e,n,null,Ze.builtIn("UNSUPPORTED_METHOD"));return}let l=null,c=null;try{const u=yield a({requestId:n,callerIdentity:e,payload:i,responseTimeout:s});ey(u)>_E?(l=Ze.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),this.log.warn("RPC Response payload too large for ".concat(r))):c=u}catch(u){u instanceof Ze?l=u:(this.log.warn("Uncaught error returned by RPC handler for ".concat(r,". Returning APPLICATION_ERROR instead."),u),l=Ze.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,n,c,l)})}selectDefaultDevices(){return E(this,void 0,void 0,function*(){var e,n,r;const i=mt.getInstance().previousDevices,s=yield mt.getInstance().getDevices(void 0,!1),o=Qt();if((o==null?void 0:o.name)==="Chrome"&&o.os!=="iOS")for(let l of s){const c=i.find(u=>u.deviceId===l.deviceId);c&&c.label!==""&&c.kind===l.kind&&c.label!==l.label&&this.getActiveDevice(l.kind)==="default"&&this.emit(U.ActiveDeviceChanged,l.kind,l.deviceId)}const a=["audiooutput","audioinput","videoinput"];for(let l of a){const c=R3(l),u=this.localParticipant.getTrackPublication(c);if(u&&(!((e=u.track)===null||e===void 0)&&e.isUserProvided))continue;const h=s.filter(m=>m.kind===l),f=this.getActiveDevice(l);if(f===((n=i.filter(m=>m.kind===l)[0])===null||n===void 0?void 0:n.deviceId)&&h.length>0&&((r=h[0])===null||r===void 0?void 0:r.deviceId)!==f){yield this.switchActiveDevice(l,h[0].deviceId);continue}l==="audioinput"&&!Yl()||l==="videoinput"||h.length>0&&!h.find(m=>m.deviceId===this.getActiveDevice(l))&&(l!=="audiooutput"||!Yl())&&(yield this.switchActiveDevice(l,h[0].deviceId))}})}acquireAudioContext(){return E(this,void 0,void 0,function*(){var e,n;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=yE())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(i=>i.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),xt(200)])}catch(i){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:i}))}const r=((n=this.audioContext)===null||n===void 0?void 0:n.state)==="running";r!==this.canPlaybackAudio&&(this.audioEnabled=r,this.emit(U.AudioPlaybackStatusChanged,r))})}createParticipant(e,n){var r;let i;return n?i=Td.fromParticipantInfo(this.engine.client,n,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):i=new Td(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&i.setAudioContext(this.audioContext),!((r=this.options.audioOutput)===null||r===void 0)&&r.deviceId&&i.setAudioOutput(this.options.audioOutput).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message),this.logContext)),i}getOrCreateParticipant(e,n){if(this.remoteParticipants.has(e)){const i=this.remoteParticipants.get(e);return n&&i.updateInfo(n)&&this.sidToIdentity.set(n.sid,n.identity),i}const r=this.createParticipant(e,n);return this.remoteParticipants.set(e,r),this.sidToIdentity.set(n.sid,n.identity),this.emitWhenConnected(U.ParticipantConnected,r),r.on(q.TrackPublished,i=>{this.emitWhenConnected(U.TrackPublished,i,r)}).on(q.TrackSubscribed,(i,s)=>{i.kind===D.Kind.Audio?(i.on($.AudioPlaybackStarted,this.handleAudioPlaybackStarted),i.on($.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):i.kind===D.Kind.Video&&(i.on($.VideoPlaybackFailed,this.handleVideoPlaybackFailed),i.on($.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(U.TrackSubscribed,i,s,r)}).on(q.TrackUnpublished,i=>{this.emit(U.TrackUnpublished,i,r)}).on(q.TrackUnsubscribed,(i,s)=>{this.emit(U.TrackUnsubscribed,i,s,r)}).on(q.TrackMuted,i=>{this.emitWhenConnected(U.TrackMuted,i,r)}).on(q.TrackUnmuted,i=>{this.emitWhenConnected(U.TrackUnmuted,i,r)}).on(q.ParticipantMetadataChanged,i=>{this.emitWhenConnected(U.ParticipantMetadataChanged,i,r)}).on(q.ParticipantNameChanged,i=>{this.emitWhenConnected(U.ParticipantNameChanged,i,r)}).on(q.AttributesChanged,i=>{this.emitWhenConnected(U.ParticipantAttributesChanged,i,r)}).on(q.ConnectionQualityChanged,i=>{this.emitWhenConnected(U.ConnectionQualityChanged,i,r)}).on(q.ParticipantPermissionsChanged,i=>{this.emitWhenConnected(U.ParticipantPermissionsChanged,i,r)}).on(q.TrackSubscriptionStatusChanged,(i,s)=>{this.emitWhenConnected(U.TrackSubscriptionStatusChanged,i,s,r)}).on(q.TrackSubscriptionFailed,(i,s)=>{this.emit(U.TrackSubscriptionFailed,i,r,s)}).on(q.TrackSubscriptionPermissionChanged,(i,s)=>{this.emitWhenConnected(U.TrackSubscriptionPermissionChanged,i,s,r)}).on(q.Active,()=>{this.emitWhenConnected(U.ParticipantActive,r),r.kind===Kl.AGENT&&this.localParticipant.setActiveAgent(r)}),n&&r.updateInfo(n),r}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((r,i)=>(r.push(...i.getTrackPublications()),r),[]),n=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,n)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const n of e.videoTrackPublications.values())n.isSubscribed&&X3(n)&&n.emitTrackUpdate()}getRemoteParticipantBySid(e){const n=this.sidToIdentity.get(e);if(n)return this.remoteParticipants.get(n)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=wt.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnectedOrConnecting:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Kn.STATE_MISMATCH))):e=0},y4)}clearConnectionReconcile(){this.connectionReconcileInterval&&wt.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(U.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[n,r]=e;this.emit(n,...r)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(this.state===ke.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,r]);else if(this.state===ke.Connected)return this.emit(e,...r);return!1}simulateParticipants(e){return E(this,void 0,void 0,function*(){var n,r,i,s;const o=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),a=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new uh({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:$e.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new Ls({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(U.SignalConnected),this.emit(U.Connected),this.setAndEmitConnectionState(ke.Connected),o.video){const l=new Dp(D.Kind.Video,new Po({source:ot.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Vn.AUDIO,name:"video-dummy"}),new Sd(o.useRealTracks&&(!((n=window.navigator.mediaDevices)===null||n===void 0)&&n.getUserMedia)?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:ew(160*((r=a.aspectRatios[0])!==null&&r!==void 0?r:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(l),this.localParticipant.emit(q.LocalTrackPublished,l)}if(o.audio){const l=new Dp(D.Kind.Audio,new Po({source:ot.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Vn.AUDIO}),new kd(o.useRealTracks&&(!((i=navigator.mediaDevices)===null||i===void 0)&&i.getUserMedia)?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:Tf(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(l),this.localParticipant.emit(q.LocalTrackPublished,l)}for(let l=0;l<a.count-1;l+=1){let c=new Ls({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(l),state:$o.ACTIVE,tracks:[],joinedAt:$e.parse(Date.now())});const u=this.getOrCreateParticipant(c.identity,c);if(a.video){const h=ew(160*((s=a.aspectRatios[l%a.aspectRatios.length])!==null&&s!==void 0?s:1),160,!1,!0),f=new Po({source:ot.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Vn.AUDIO});u.addSubscribedMediaTrack(h,f.sid,new MediaStream([h]),new RTCRtpReceiver),c.tracks=[...c.tracks,f]}if(a.audio){const h=Tf(),f=new Po({source:ot.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Vn.AUDIO});u.addSubscribedMediaTrack(h,f.sid,new MediaStream([h]),new RTCRtpReceiver),c.tracks=[...c.tracks,f]}u.updateInfo(c)}})}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(e!==U.ActiveSpeakersChanged&&e!==U.TranscriptionReceived){const s=DE(r).filter(o=>o!==void 0);(e===U.TrackSubscribed||e===U.TrackUnsubscribed)&&this.log.trace("subscribe trace: ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:s})),this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:s}))}return super.emit(e,...r)}}wa.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function DE(t){return t.map(e=>{if(e)return Array.isArray(e)?DE(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var Tw;(function(t){t[t.TooShort=0]="TooShort",t[t.HeaderOverrun=1]="HeaderOverrun",t[t.MissingExtWords=2]="MissingExtWords",t[t.UnsupportedVersion=3]="UnsupportedVersion",t[t.InvalidHandle=4]="InvalidHandle",t[t.MalformedExt=5]="MalformedExt"})(Tw||(Tw={}));var Cw;(function(t){t[t.TooSmallForHeader=0]="TooSmallForHeader",t[t.TooSmallForPayload=1]="TooSmallForPayload"})(Cw||(Cw={}));var Cd;(function(t){t[t.UserTimestamp=2]="UserTimestamp",t[t.E2ee=1]="E2ee"})(Cd||(Cd={}));Cd.UserTimestamp;Cd.E2ee;var Ew;(function(t){t[t.Reserved=0]="Reserved",t[t.TooLarge=1]="TooLarge"})(Ew||(Ew={}));var _w;(function(t){t[t.Start=0]="Start",t[t.Inter=1]="Inter",t[t.Final=2]="Final",t[t.Single=3]="Single"})(_w||(_w={}));var Pw;(function(t){t[t.MtuTooShort=0]="MtuTooShort"})(Pw||(Pw={}));wr(Cn.DataTracks);var Rw;(function(t){t[t.Interrupted=0]="Interrupted",t[t.UnknownFrame=1]="UnknownFrame",t[t.BufferFull=2]="BufferFull",t[t.Incomplete=3]="Incomplete"})(Rw||(Rw={}));var Bn;(function(t){t[t.IDLE=0]="IDLE",t[t.RUNNING=1]="RUNNING",t[t.SKIPPED=2]="SKIPPED",t[t.SUCCESS=3]="SUCCESS",t[t.FAILED=4]="FAILED"})(Bn||(Bn={}));class Xi extends Tr.EventEmitter{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=Bn.IDLE,this.logs=[],this.options={},this.url=e,this.token=n,this.name=this.constructor.name,this.room=new wa(r.roomOptions),this.connectOptions=r.connectOptions,this.options=r}run(e){return E(this,void 0,void 0,function*(){if(this.status!==Bn.IDLE)throw Error("check is running already");this.setStatus(Bn.RUNNING);try{yield this.perform()}catch(n){n instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(n.message):this.appendError(n.message))}return yield this.disconnect(),yield new Promise(n=>setTimeout(n,500)),this.status!==Bn.SKIPPED&&this.setStatus(this.isSuccess()?Bn.SUCCESS:Bn.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return E(this,void 0,void 0,function*(){return this.room.state===ke.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return E(this,void 0,void 0,function*(){this.room&&this.room.state!==ke.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(Bn.SKIPPED)}switchProtocol(e){return E(this,void 0,void 0,function*(){let n=!1,r=!1;if(this.room.on(U.Reconnecting,()=>{n=!0}),this.room.once(U.Reconnected,()=>{r=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(s=>setTimeout(s,1e3)),!n)return;const i=Date.now()+1e4;for(;Date.now()<i;){if(r)return;yield xt(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class b4 extends Xi{get description(){return"Cloud regions"}perform(){return E(this,void 0,void 0,function*(){const e=new ye(this.url,this.token);if(!e.isCloud()){this.skip();return}const n=[],r=new Set;for(let s=0;s<3;s++){const o=yield e.getNextBestRegionUrl();if(!o)break;if(r.has(o))continue;r.add(o);const a=yield this.checkCloudRegion(o);this.appendMessage("".concat(a.region," RTT: ").concat(a.rtt,"ms, duration: ").concat(a.duration,"ms")),n.push(a)}n.sort((s,o)=>(s.duration-o.duration)*.5+(s.rtt-o.rtt)*.5);const i=n[0];this.bestStats=i,this.appendMessage("best Cloud region: ".concat(i.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return E(this,void 0,void 0,function*(){var n,r;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const i=(n=this.room.serverInfo)===null||n===void 0?void 0:n.region;if(!i)throw new Error("Region not found");const s=yield this.room.localParticipant.streamText({topic:"test"}),o=1e3,l=1e6/o,c="A".repeat(o),u=Date.now();for(let b=0;b<l;b++)yield s.write(c);yield s.close();const h=Date.now(),f=yield(r=this.room.engine.pcManager)===null||r===void 0?void 0:r.publisher.getStats(),m={region:i,rtt:1e4,duration:h-u};return f==null||f.forEach(b=>{b.type==="candidate-pair"&&b.nominated&&(m.rtt=b.currentRoundTripTime*1e3)}),yield this.disconnect(),m})}}const Of=1e4;class w4 extends Xi{get description(){return"Connection via UDP vs TCP"}perform(){return E(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),n=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-n.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-n.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=n):this.appendMessage("best connection quality via udp");const r=this.bestStats;this.appendMessage("upstream bitrate: ".concat((r.bitrateTotal/r.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((r.rttTotal/r.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((r.jitterTotal/r.count*1e3).toFixed(2)," ms")),r.packetsLost>0&&this.appendWarning("packets lost: ".concat((r.packetsLost/r.packetsSent*100).toFixed(2),"%")),r.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((r.qualityLimitationDurations.bandwidth/(Of/1e3)*100).toFixed(2),"%")),r.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((r.qualityLimitationDurations.cpu/(Of/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return E(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const n=document.createElement("canvas");n.width=1280,n.height=720;const r=n.getContext("2d");if(!r)throw new Error("Could not get canvas context");let i=0;const s=()=>{i=(i+1)%360,r.fillStyle="hsl(".concat(i,", 100%, 50%)"),r.fillRect(0,0,n.width,n.height),requestAnimationFrame(s)};s();const a=n.captureStream(30).getVideoTracks()[0],c=(yield this.room.localParticipant.publishTrack(a,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,u={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},h=setInterval(()=>E(this,void 0,void 0,function*(){const f=yield c.getRTCStatsReport();f==null||f.forEach(m=>{m.type==="outbound-rtp"?(u.packetsSent=m.packetsSent,u.qualityLimitationDurations=m.qualityLimitationDurations,u.bitrateTotal+=m.targetBitrate,u.count++):m.type==="remote-inbound-rtp"&&(u.packetsLost=m.packetsLost,u.rttTotal+=m.roundTripTime,u.jitterTotal+=m.jitter)})}),1e3);return yield new Promise(f=>setTimeout(f,Of)),clearInterval(h),a.stop(),n.remove(),yield this.disconnect(),u})}}class x4 extends Xi{get description(){return"Can publish audio"}perform(){return E(this,void 0,void 0,function*(){var e;const n=yield this.connect(),r=yield ME();if(yield vE(r,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),n.localParticipant.publishTrack(r),yield new Promise(a=>setTimeout(a,3e3));const s=yield(e=r.sender)===null||e===void 0?void 0:e.getStats();if(!s)throw new Error("Could not get RTCStats");let o=0;if(s.forEach(a=>{a.type==="outbound-rtp"&&(a.kind==="audio"||!a.kind&&a.mediaType==="audio")&&(o=a.packetsSent)}),o===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(o," audio packets"))})}}class k4 extends Xi{get description(){return"Can publish video"}perform(){return E(this,void 0,void 0,function*(){var e;const n=yield this.connect(),r=yield f4();yield this.checkForVideo(r.mediaStreamTrack),n.localParticipant.publishTrack(r),yield new Promise(o=>setTimeout(o,5e3));const i=yield(e=r.sender)===null||e===void 0?void 0:e.getStats();if(!i)throw new Error("Could not get RTCStats");let s=0;if(i.forEach(o=>{o.type==="outbound-rtp"&&(o.kind==="video"||!o.kind&&o.mediaType==="video")&&(s+=o.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," video packets"))})}checkForVideo(e){return E(this,void 0,void 0,function*(){const n=new MediaStream;n.addTrack(e.clone());const r=document.createElement("video");
410r.srcObject=n,r.muted=!0,r.autoplay=!0,r.playsInline=!0,r.setAttribute("playsinline","true"),document.body.appendChild(r),yield new Promise(i=>{r.onplay=()=>{setTimeout(()=>{var s,o,a,l;const c=document.createElement("canvas"),u=e.getSettings(),h=(o=(s=u.width)!==null&&s!==void 0?s:r.videoWidth)!==null&&o!==void 0?o:1280,f=(l=(a=u.height)!==null&&a!==void 0?a:r.videoHeight)!==null&&l!==void 0?l:720;c.width=h,c.height=f;const m=c.getContext("2d");m.drawImage(r,0,0);const p=m.getImageData(0,0,c.width,c.height).data;let g=!0;for(let v=0;v<p.length;v+=4)if(p[v]!==0||p[v+1]!==0||p[v+2]!==0){g=!1;break}g?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),i()},1e3)},r.play()}),n.getTracks().forEach(i=>i.stop()),r.remove()})}}class S4 extends Xi{get description(){return"Resuming connection after interruption"}perform(){return E(this,void 0,void 0,function*(){var e;const n=yield this.connect();let r=!1,i=!1,s;const o=new Promise(c=>{setTimeout(c,5e3),s=c}),a=()=>{r=!0};n.on(U.SignalReconnecting,a).on(U.Reconnecting,a).on(U.Reconnected,()=>{i=!0,s(!0)}),(e=n.engine.client.ws)===null||e===void 0||e.close();const l=n.engine.client.onClose;if(l&&l(""),yield o,r){if(!i||n.state!==ke.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class T4 extends Xi{get description(){return"Can connect via TURN"}perform(){return E(this,void 0,void 0,function*(){var e,n,r;ba(new URL(this.url))&&(this.appendMessage("Using region specific url"),this.url=(e=yield new ye(this.url,this.token).getNextBestRegionUrl())!==null&&e!==void 0?e:this.url);const i=new Jv,s=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0);let o=!1,a=!1,l=!1;for(let c of s.iceServers)for(let u of c.urls)u.startsWith("turn:")?(a=!0,l=!0):u.startsWith("turns:")&&(a=!0,l=!0,o=!0),u.startsWith("stun:")&&(l=!0);l?a&&!o&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield i.close(),!((r=(n=this.connectOptions)===null||n===void 0?void 0:n.rtcConfig)===null||r===void 0)&&r.iceServers||a?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(c=>setTimeout(c,0)))})}}class C4 extends Xi{get description(){return"Establishing WebRTC connection"}perform(){return E(this,void 0,void 0,function*(){let e=!1,n=!1;this.room.on(U.SignalConnected,()=>{var r;const i=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(s,o)=>{if(s.candidate){const a=new RTCIceCandidate(s);let l="".concat(a.protocol," ").concat(a.address,":").concat(a.port," ").concat(a.type);a.address&&(E4(a.address)?l+=" (private)":a.protocol==="tcp"&&a.tcpType==="passive"?(e=!0,l+=" (passive)"):a.protocol==="udp"&&(n=!0)),this.appendMessage(l)}i&&i(s,o)},!((r=this.room.engine.pcManager)===null||r===void 0)&&r.subscriber&&(this.room.engine.pcManager.subscriber.onIceCandidateError=s=>{s instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(s.errorCode," ").concat(s.errorText," ").concat(s.url))})});try{yield this.connect(),de.info("now the room is connected")}catch(r){throw this.appendWarning("ports need to be open on firewall in order to connect."),r}e||this.appendWarning("Server is not configured for ICE/TCP"),n||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function E4(t){const e=t.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const n=parseInt(e[1],10);if(n>=16&&n<=31)return!0}}return!1}class _4 extends Xi{get description(){return"Connecting to signal connection via WebSocket"}perform(){return E(this,void 0,void 0,function*(){var e,n,r;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let i=new Jv,s;try{s=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0)}catch(o){if(ba(new URL(this.url))){this.appendMessage("Initial connection failed with error ".concat(o.message,". Retrying with region fallback"));const l=yield new ye(this.url,this.token).getNextBestRegionUrl();l&&(s=yield i.join(l,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0),this.appendMessage("Fallback to region worked. To avoid initial connections failing, ensure you're calling room.prepareConnection() ahead of time"))}}s?(this.appendMessage("Connected to server, version ".concat(s.serverVersion,".")),((e=s.serverInfo)===null||e===void 0?void 0:e.edition)===v1.Cloud&&(!((n=s.serverInfo)===null||n===void 0)&&n.region)&&this.appendMessage("LiveKit Cloud: ".concat((r=s.serverInfo)===null||r===void 0?void 0:r.region))):this.appendError("Websocket connection could not be established"),yield i.close()})}}class _V extends Tr.EventEmitter{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=n,this.options=r}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:Bn.IDLE,name:"",description:""}),e}
410updateCheck(e,n){this.checkResults.set(e,n),this.emit("checkUpdate",e,n)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==Bn.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return E(this,void 0,void 0,function*(){const n=this.getNextCheckId(),r=new e(this.url,this.token,this.options),i=o=>{this.updateCheck(n,o)};r.on("update",i);const s=yield r.run();return r.off("update",i),s})}checkWebsocket(){return E(this,void 0,void 0,function*(){return this.createAndRunCheck(_4)})}checkWebRTC(){return E(this,void 0,void 0,function*(){return this.createAndRunCheck(C4)})}checkTURN(){return E(this,void 0,void 0,function*(){return this.createAndRunCheck(T4)})}checkReconnect(){return E(this,void 0,void 0,function*(){return this.createAndRunCheck(S4)})}checkPublishAudio(){return E(this,void 0,void 0,function*(){return this.createAndRunCheck(x4)})}checkPublishVideo(){return E(this,void 0,void 0,function*(){return this.createAndRunCheck(k4)})}checkConnectionProtocol(){return E(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(w4);if(e.data&&"protocol"in e.data){const n=e.data;this.options.protocol=n.protocol}return e})}checkCloudRegion(){return E(this,void 0,void 0,function*(){return this.createAndRunCheck(b4)})}}function me(t,e,n){return(e=R4(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function P4(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function R4(t){var e=P4(t,"string");return typeof e=="symbol"?e:e+""}new TextEncoder;new TextDecoder;class $t extends Error{constructor(e,n){var r;super(e,n),me(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}}
410me($t,"code","ERR_JOSE_GENERIC");class I4 extends $t{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(e,{cause:{claim:r,reason:i,payload:n}}),me(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),me(this,"claim",void 0),me(this,"reason",void 0),me(this,"payload",void 0),this.claim=r,this.reason=i,this.payload=n}}me(I4,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class N4 extends $t{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(e,{cause:{claim:r,reason:i,payload:n}}),me(this,"code","ERR_JWT_EXPIRED"),me(this,"claim",void 0),me(this,"reason",void 0),me(this,"payload",void 0),this.claim=r,this.reason=i,this.payload=n}}me(N4,"code","ERR_JWT_EXPIRED");class A4 extends $t{constructor(){super(...arguments),me(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}me(A4,"code","ERR_JOSE_ALG_NOT_ALLOWED");class O4 extends $t{constructor(){super(...arguments),me(this,"code","ERR_JOSE_NOT_SUPPORTED")}}me(O4,"code","ERR_JOSE_NOT_SUPPORTED");class M4 extends $t{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"decryption operation failed",n=arguments.length>1?arguments[1]:void 0;super(e,n),me(this,"code","ERR_JWE_DECRYPTION_FAILED")}}me(M4,"code","ERR_JWE_DECRYPTION_FAILED");class j4 extends $t{constructor(){super(...arguments),me(this,"code","ERR_JWE_INVALID")}}me(j4,"code","ERR_JWE_INVALID");class D4 extends $t{constructor(){super(...arguments),me(this,"code","ERR_JWS_INVALID")}}me(D4,"code","ERR_JWS_INVALID");class L4 extends $t{constructor(){super(...arguments),me(this,"code","ERR_JWT_INVALID")}}me(L4,"code","ERR_JWT_INVALID");class U4 extends $t{constructor(){super(...arguments),me(this,"code","ERR_JWK_INVALID")}}me(U4,"code","ERR_JWK_INVALID");class F4 extends $t{constructor(){super(...arguments),me(this,"code","ERR_JWKS_INVALID")}}me(F4,"code","ERR_JWKS_INVALID");class B4 extends $t{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"no applicable key found in the JSON Web Key Set",n=arguments.length>1?arguments[1]:void 0;super(e,n),me(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}me(B4,"code","ERR_JWKS_NO_MATCHING_KEY");class z4 extends $t{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"multiple matching keys found in the JSON Web Key Set",n=arguments.length>1?arguments[1]:void 0;super(e,n),me(this,Symbol.asyncIterator,void 0),me(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}me(z4,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class $4 extends $t{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"request timed out",n=arguments.length>1?arguments[1]:void 0;super(e,n),me(this,"code","ERR_JWKS_TIMEOUT")}}me($4,"code","ERR_JWKS_TIMEOUT");class V4 extends $t{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"signature verification failed",n=arguments.length>1?arguments[1]:void 0;super(e,n),me(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}me(V4,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function $r(){return $r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},$r.apply(null,arguments)}const Iw=new Uint8Array(0);class Xl{static getFullOptions(e){return $r({clientTools:{},onConnect:()=>{},onDebug:()=>{},onDisconnect:()=>{},onError:()=>{},onMessage:()=>{},onAudio:()=>{},onModeChange:()=>{},onStatusChange:()=>{},onCanSendFeedbackChange:()=>{},onInterruption:()=>{}},e)}constructor(e,n){var r=this;this.options=void 0,this.connection=void 0,this.lastInterruptTimestamp=0,this.mode="listening",this.status="connecting",this.volume=1,this.currentEventId=1,this.lastFeedbackEventId=0,this.canSendFeedback=!1,this.endSessionWithDetails=async function(i){r.status!=="connected"&&r.status!=="connecting"||(r.updateStatus("disconnecting"),await r.handleEndSession(),r.updateStatus("disconnected"),r.options.onDisconnect&&r.options.onDisconnect(i))},this.onMessage=async function(i){switch(i.type){case"interruption":return void r.handleInterruption(i);case"agent_response":return void r.handleAgentResponse(i);case"user_transcript":return void r.handleUserTranscript(i);case"internal_tentative_agent_response":return void r.handleTentativeAgentResponse(i);case"client_tool_call":try{await r.handleClientToolCall(i)}catch(s){r.onError(`Unexpected error in client tool call handling: ${s instanceof Error?s.message:String(s)}`,{clientToolName:i.client_tool_call.tool_name,toolCallId:i.client_tool_call.tool_call_id})}return;case"audio":return void r.handleAudio(i);case"vad_score":return void r.handleVadScore(i);case"ping":return void r.connection.sendMessage({type:"pong",event_id:i.ping_event.event_id});case"mcp_tool_call":return void r.handleMCPToolCall(i);case"mcp_connection_status":return void r.handleMCPConnectionStatus(i);
vendor: 5,971 bytes, line 410
410case"agent_tool_request":return void r.handleAgentToolRequest(i);case"agent_tool_response":return void r.handleAgentToolResponse(i);case"conversation_initiation_metadata":return void r.handleConversationMetadata(i);case"asr_initiation_metadata":return void r.handleAsrInitiationMetadata(i);case"agent_chat_response_part":return void r.handleAgentChatResponsePart(i);case"error":return void r.handleErrorEvent(i);default:return void(r.options.onDebug&&r.options.onDebug(i))}},this.setVolume=({volume:i})=>{this.volume=i},this.options=e,this.connection=n,this.options.onConnect&&this.options.onConnect({conversationId:n.conversationId}),this.connection.onMessage(this.onMessage),this.connection.onDisconnect(this.endSessionWithDetails),this.connection.onModeChange(i=>this.updateMode(i)),this.updateStatus("connected")}endSession(){return this.endSessionWithDetails({reason:"user"})}async handleEndSession(){this.connection.close()}updateMode(e){e!==this.mode&&(this.mode=e,this.options.onModeChange&&this.options.onModeChange({mode:e}))}updateStatus(e){e!==this.status&&(this.status=e,this.options.onStatusChange&&this.options.onStatusChange({status:e}))}updateCanSendFeedback(){const e=this.currentEventId!==this.lastFeedbackEventId;this.canSendFeedback!==e&&(this.canSendFeedback=e,this.options.onCanSendFeedbackChange&&this.options.onCanSendFeedbackChange({canSendFeedback:e}))}handleInterruption(e){e.interruption_event&&(this.lastInterruptTimestamp=e.interruption_event.event_id,this.options.onInterruption&&this.options.onInterruption({event_id:e.interruption_event.event_id}))}handleAgentResponse(e){this.options.onMessage&&this.options.onMessage({source:"ai",role:"agent",message:e.agent_response_event.agent_response})}handleUserTranscript(e){this.options.onMessage&&this.options.onMessage({source:"user",role:"user",message:e.user_transcription_event.user_transcript})}handleTentativeAgentResponse(e){this.options.onDebug&&this.options.onDebug({type:"tentative_agent_response",response:e.tentative_agent_response_internal_event.tentative_agent_response})}handleVadScore(e){this.options.onVadScore&&this.options.onVadScore({vadScore:e.vad_score_event.vad_score})}async handleClientToolCall(e){if(Object.prototype.hasOwnProperty.call(this.options.clientTools,e.client_tool_call.tool_name))try{var n;const r=(n=await this.options.clientTools[e.client_tool_call.tool_name](e.client_tool_call.parameters))!=null?n:"Client tool execution successful.",i=typeof r=="object"?JSON.stringify(r):String(r);this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:i,is_error:!1})}catch(r){this.onError(`Client tool execution failed with following error: ${r==null?void 0:r.message}`,{clientToolName:e.client_tool_call.tool_name}),this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:`Client tool execution failed: ${r==null?void 0:r.message}`,is_error:!0})}else{if(this.options.onUnhandledClientToolCall)return void this.options.onUnhandledClientToolCall(e.client_tool_call);this.onError(`Client tool with name ${e.client_tool_call.tool_name} is not defined on client`,{clientToolName:e.client_tool_call.tool_name}),this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:`Client tool with name ${e.client_tool_call.tool_name} is not defined on client`,is_error:!0})}}handleAudio(e){}handleMCPToolCall(e){this.options.onMCPToolCall&&this.options.onMCPToolCall(e.mcp_tool_call)}handleMCPConnectionStatus(e){this.options.onMCPConnectionStatus&&this.options.onMCPConnectionStatus(e.mcp_connection_status)}handleAgentToolRequest(e){this.options.onAgentToolRequest&&this.options.onAgentToolRequest(e.agent_tool_request)}handleAgentToolResponse(e){e.agent_tool_response.tool_name==="end_call"&&this.endSessionWithDetails({reason:"agent",context:new CloseEvent("end_call",{reason:"Agent ended the call"})}),this.options.onAgentToolResponse&&this.options.onAgentToolResponse(e.agent_tool_response)}handleConversationMetadata(e){this.options.onConversationMetadata&&this.options.onConversationMetadata(e.conversation_initiation_metadata_event)}handleAsrInitiationMetadata(e){this.options.onAsrInitiationMetadata&&this.options.onAsrInitiationMetadata(e.asr_initiation_metadata_event)}handleAgentChatResponsePart(e){this.options.onAgentChatResponsePart&&this.options.onAgentChatResponsePart(e.text_response_part)}handleErrorEvent(e){const n=e.error_event.error_type,r=e.error_event.message||e.error_event.reason||"Unknown error";n!=="max_duration_exceeded"?this.onError(`Server error: ${r}`,{errorType:n,code:e.error_event.code,debugMessage:e.error_event.debug_message,details:e.error_event.details}):this.endSessionWithDetails({reason:"error",message:r,context:new Event("max_duration_exceeded")})}onError(e,n){console.error(e,n),this.options.onError&&this.options.onError(e,n)}getId(){return this.connection.conversationId}isOpen(){return this.status==="connected"}setMicMuted(e){this.connection.setMicMuted(e)}getInputByteFrequencyData(){return Iw}getOutputByteFrequencyData(){return Iw}getInputVolume(){return 0}getOutputVolume(){return 0}sendFeedback(e){this.canSendFeedback?(this.connection.sendMessage({type:"feedback",score:e?"like":"dislike",event_id:this.currentEventId}),this.lastFeedbackEventId=this.currentEventId,this.updateCanSendFeedback()):console.warn(this.lastFeedbackEventId===0?"Cannot send feedback: the conversation has not started yet.":"Cannot send feedback: feedback has already been sent for the current response.")}sendContextualUpdate(e){this.connection.sendMessage({type:"contextual_update",text:e})}sendUserMessage(e){this.connection.sendMessage({type:"user_message",text:e})}sendUserActivity(){this.connection.sendMessage({type:"user_activity"})}sendMCPToolApprovalResult(e,n){this.connection.sendMessage({type:"mcp_tool_approval_result",tool_call_id:e,is_approved:n})}}let LE=class{constructor(e={}
410){this.queue=[],this.disconnectionDetails=null,this.onDisconnectCallback=null,this.onMessageCallback=null,this.onModeChangeCallback=null,this.onDebug=void 0,this.onDebug=e.onDebug}debug(e){this.onDebug&&this.onDebug(e)}onMessage(e){this.onMessageCallback=e;const n=this.queue;this.queue=[],n.length>0&&queueMicrotask(()=>{n.forEach(e)})}onDisconnect(e){this.onDisconnectCallback=e;const n=this.disconnectionDetails;n&&queueMicrotask(()=>{e(n)})}onModeChange(e){this.onModeChangeCallback=e}updateMode(e){var n;(n=this.onModeChangeCallback)==null||n.call(this,e)}disconnect(e){var n;this.disconnectionDetails||(this.disconnectionDetails=e,(n=this.onDisconnectCallback)==null||n.call(this,e))}handleMessage(e){this.onMessageCallback?this.onMessageCallback(e):this.queue.push(e)}};function Ed(t){const[e,n]=t.split("_");if(!["pcm","ulaw"].includes(e))throw new Error(`Invalid format: ${t}`);const r=Number.parseInt(n);if(Number.isNaN(r))throw new Error(`Invalid sample rate: ${n}`);return{format:e,sampleRate:r}}const UE="0.12.2";function Lp(t){return!!t.type}const FE="conversation_initiation_client_data";function BE(t){var e;const n={type:FE};var r,i,s,o,a,l;return t.overrides&&(n.conversation_config_override={agent:{prompt:(r=t.overrides.agent)==null?void 0:r.prompt,first_message:(i=t.overrides.agent)==null?void 0:i.firstMessage,language:(s=t.overrides.agent)==null?void 0:s.language},tts:{voice_id:(o=t.overrides.tts)==null?void 0:o.voiceId,speed:(a=t.overrides.tts)==null?void 0:a.speed},conversation:{text_only:(l=t.overrides.conversation)==null?void 0:l.textOnly}}),t.customLlmExtraBody&&(n.custom_llm_extra_body=t.customLlmExtraBody),t.dynamicVariables&&(n.dynamic_variables=t.dynamicVariables),t.userId&&(n.user_id=t.userId),(e=t.overrides)!=null&&e.client&&(n.source_info={source:t.overrides.client.source,version:t.overrides.client.version}),n}let Up=class zE extends LE{constructor(e,n,r,i){super(),this.socket=void 0,this.conversationId=void 0,this.inputFormat=void 0,this.outputFormat=void 0,this.socket=e,this.conversationId=n,this.inputFormat=r,this.outputFormat=i,this.socket.addEventListener("error",s=>{setTimeout(()=>this.disconnect({reason:"error",message:"The connection was closed due to a socket error.",context:s}),0)}),this.socket.addEventListener("close",s=>{this.disconnect(s.code===1e3?{reason:"agent",context:s}:{reason:"error",message:s.reason||"The connection was closed by the server.",context:s})}),this.socket.addEventListener("message",s=>{try{const o=JSON.parse(s.data);if(!Lp(o))return void this.debug({type:"invalid_event",message:"Received invalid socket event",data:s.data});this.handleMessage(o)}catch(o){this.debug({type:"parsing_error",message:"Failed to parse socket message",error:o instanceof Error?o.message:String(o),data:s.data})}})}static async create(e){let n=null;try{var r,i,s;const a=(r=e.origin)!=null?r:"wss://api.elevenlabs.io";let l;const c=((i=e.overrides)==null||(i=i.client)==null?void 0:i.version)||UE,u=((s=e.overrides)==null||(s=s.client)==null?void 0:s.source)||"js_sdk";if(e.signedUrl){const y=e.signedUrl.includes("?")?"&":"?";l=`${e.signedUrl}${y}source=${u}&version=${c}`}else l=`${a}/v1/convai/conversation?agent_id=${e.agentId}&source=${u}&version=${c}`;const h=["convai"];e.authorization&&h.push(`bearer.${e.authorization}`),n=new WebSocket(l,h);const f=await new Promise((y,w)=>{n.addEventListener("open",()=>{var k;const S=BE(e);(k=n)==null||k.send(JSON.stringify(S))},{once:!0}),n.addEventListener("error",k=>{setTimeout(()=>w(k),0)}),n.addEventListener("close",w),n.addEventListener("message",k=>{const S=JSON.parse(k.data);Lp(S)&&(S.type==="conversation_initiation_metadata"?y(S.conversation_initiation_metadata_event):console.warn("First received message is not conversation metadata."))},{once:!0})}),{conversation_id:m,agent_output_audio_format:b,user_input_audio_format:p}=f,g=Ed(p??"pcm_16000"),v=Ed(b);return new zE(n,m,g,v)}catch(a){var o;throw(o=n)==null||o.close(),a}}close(){this.socket.close(1e3,"User ended conversation")}sendMessage(e){this.socket.send(JSON.stringify(e))}async setMicMuted(e){console.warn(`WebSocket connection setMicMuted called with ${e}, but this is handled by VoiceConversation`)}};function $E(t){const e=new Uint8Array(t);return window.btoa(String.fromCharCode(...e))}function W4(t){const e=window.atob(t),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.charCodeAt(i);return r.buffer}const Kc=new Map;function VE(t,e){return async(n,r)=>{const i=Kc.get(t);if(i)return n.addModule(i);if(r)try{return await n.addModule(r),void Kc.set(t,r)}catch(a){throw new Error(`Failed to load the ${t} worklet module from path: ${r}. Error: ${a}`)}const s=new Blob([e],{type:"application/javascript"}),o=URL.createObjectURL(s);try{return await n.addModule(o),void Kc.set(t,o)}catch{URL.revokeObjectURL(o)}try{const a=`data:application/javascript;base64,${btoa(e)}`;await n.addModule(a),Kc.set(t,a)}catch{throw new Error(`Failed to load the ${t} worklet module. Make sure the browser supports AudioWorklets. If you are using a strict CSP, you may 
410need to self-host the worklet files.`)}}}const WE=VE("rawAudioProcessor",`/*
411 * ulaw encoding logic taken from the wavefile library
412 * https://github.com/rochars/wavefile/blob/master/lib/codecs/mulaw.js
413 * USED BY @elevenlabs/client
414 */
415
416const BIAS = 0x84;
417const CLIP = 32635;
418const encodeTable = [
419  0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,
420  4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
421  5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
422  5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
423  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
424  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
425  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
426  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
427  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
428  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
429  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
430  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
431  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
432  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
433  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
434  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
435];
436
437function encodeSample(sample) {
438  let sign;
439  let exponent;
440  let mantissa;
441  let muLawSample;
442  sign = (sample >> 8) & 0x80;
443  if (sign !== 0) sample = -sample;
444  sample = sample + BIAS;
445  if (sample > CLIP) sample = CLIP;
446  exponent = encodeTable[(sample>>7) & 0xFF];
447  mantissa = (sample >> (exponent+3)) & 0x0F;
448  muLawSample = ~(sign | (exponent << 4) | mantissa);
449  
450  return muLawSample;
451}
452
453class RawAudioProcessor extends AudioWorkletProcessor {
454  constructor() {
455    super();
456              
457    this.port.onmessage = ({ data }) => {
458      switch (data.type) {
459        case "setFormat":
460          this.isMuted = false;
461          this.buffer = []; // Initialize an empty buffer
462          this.bufferSize = data.sampleRate / 4;
463          this.format = data.format;
464
465          if (globalThis.LibSampleRate && sampleRate !== data.sampleRate) {
466            globalThis.LibSampleRate.create(1, sampleRate, data.sampleRate).then(resampler => {
467              this.resampler = resampler;
468            });
469          }
470          break;
471        case "setMuted":
472          this.isMuted = data.isMuted;
473          break;
474      }
475    };
476  }
477  process(inputs) {
478    if (!this.buffer) {
479      return true;
480    }
481    
482    const input = inputs[0]; // Get the first input node
483    if (input.length > 0) {
484      let channelData = input[0]; // Get the first channel's data
485
486      // Resample the audio if necessary
487      if (this.resampler) {
488        channelData = this.resampler.full(channelData);
489      }
490
491      // Add channel data to the buffer
492      this.buffer.push(...channelData);
493      // Get max volume 
494      let sum = 0.0;
495      for (let i = 0; i < channelData.length; i++) {
496        sum += channelData[i] * channelData[i];
497      }
498      const maxVolume = Math.sqrt(sum / channelData.length);
499      // Check if buffer size has reached or exceeded the threshold
500      if (this.buffer.length >= this.bufferSize) {
501        const float32Array = this.isMuted 
502          ? new Float32Array(this.buffer.length)
503          : new Float32Array(this.buffer);
504
505        let encodedArray = this.format === "ulaw"
506          ? new Uint8Array(float32Array.length)
507          : new Int16Array(float32Array.length);
508
509        // Iterate through the Float32Array and convert each sample to PCM16
510        for (let i = 0; i < float32Array.length; i++) {
511          // Clamp the value to the range [-1, 1]
512          let sample = Math.max(-1, Math.min(1, float32Array[i]));
513
514          // Scale the sample to the range [-32768, 32767]
515          let value = sample < 0 ? sample * 32768 : sample * 32767;
516          if (this.format === "ulaw") {
517            value = encodeSample(Math.round(value));
518          }
519
520          encodedArray[i] = value;
521        }
522
523        // Send the buffered data to the main script
524        this.port.postMessage([encodedArray, maxVolume]);
525
526        // Clear the buffer after sending
527        this.buffer = [];
528      }
529    }
530    return true; // Continue processing
531  }
532}
533registerProcessor("rawAudioProcessor", RawAudioProcessor);
534`);class Mr extends LE{constructor(e,n,r,i,s={}){super(s),this.conversationId=void 0,this.inputFormat=void 0,this.outputFormat=void 0,this.room=void 0,this.isConnected=!1,this.audioEventId=1,this.audioCaptureContext=null,this.audioElements=[],this.outputDeviceId=null,this.outputAnalyser=null,this.outputFrequencyData=null,this.room=e,this.conversationId=n,this.inputFormat=r,this.outputFormat=i,this.setupRoomEventListeners()}static async create(e){let n;if("conversationToken"in e&&e.conversationToken)n=e.conversationToken;else{if(!("agentId"in e)||!e.agentId)throw new Error("Either conversationToken or agentId is required for WebRTC connection");try{var r,i,s;const c=((r=e.overrides)==null||(r=r.client)==null?void 0:r.version)||UE,u=((i=e.overrides)==null||(i=i.client)==null?void 0:i.source)||"js_s
534dk",h=`${o=(s=e.origin)!=null?s:"https://api.elevenlabs.io",o.replace(/^wss:\/\//,"https://")}/v1/convai/conversation/token?agent_id=${e.agentId}&source=${u}&version=${c}`,f=await fetch(h);if(!f.ok)throw new Error(`ElevenLabs API returned ${f.status} ${f.statusText}`);if(n=(await f.json()).token,!n)throw new Error("No conversation token received from API")}catch(c){let u=c instanceof Error?c.message:String(c);throw c instanceof Error&&c.message.includes("401")&&(u="Your agent has authentication enabled, but no signed URL or conversation token was provided."),new Error(`Failed to fetch conversation token for agent ${e.agentId}: ${u}`)}}var o;const a=new wa;try{const c=`room_${Date.now()}`,u=Ed("pcm_48000"),h=Ed("pcm_48000"),f=new Mr(a,c,u,h,e),m=e.livekitUrl||"wss://livekit.rtc.elevenlabs.io";var l;await a.connect(m,n),await new Promise(p=>{if(f.isConnected)p();else{const g=()=>{a.off(U.Connected,g),p()};a.on(U.Connected,g)}}),a.name&&(f.conversationId=((l=a.name.match(/(conv_[a-zA-Z0-9]+)/))==null?void 0:l[0])||a.name),await a.localParticipant.setMicrophoneEnabled(!0);const b=BE(e);return f.debug({type:FE,message:b}),await f.sendMessage(b),f}catch(c){throw await a.disconnect(),c}}setupRoomEventListeners(){var e=this;this.room.on(U.Connected,async function(){e.isConnected=!0,console.info("WebRTC room connected")}),this.room.on(U.Disconnected,n=>{this.isConnected=!1,this.disconnect({reason:"agent",context:new CloseEvent("close",{reason:n==null?void 0:n.toString()})})}),this.room.on(U.ConnectionStateChanged,n=>{n===ke.Disconnected&&(this.isConnected=!1,this.disconnect({reason:"error",message:`LiveKit connection state changed to ${n}`,context:new Event("connection_state_changed")}))}),this.room.on(U.DataReceived,(n,r)=>{try{const i=JSON.parse(new TextDecoder().decode(n));if(i.type==="audio")return;Lp(i)?this.handleMessage(i):console.warn("Invalid socket event received:",i)}catch(i){console.warn("Failed to parse incoming data message:",i),console.warn("Raw payload:",new TextDecoder().decode(n))}}),this.room.on(U.TrackSubscribed,async function(n,r,i){if(n.kind===D.Kind.Audio&&i.identity.includes("agent")){const s=n,o=s.attach();if(o.autoplay=!0,o.controls=!1,e.outputDeviceId&&o.setSinkId)try{await o.setSinkId(e.outputDeviceId)}catch(a){console.warn("Failed to set output device for new audio element:",a)}o.style.display="none",document.body.appendChild(o),e.audioElements.push(o),e.audioElements.length===1&&(e.onDebug==null||e.onDebug({type:"audio_element_ready"})),await e.setupAudioCapture(s)}}),this.room.on(U.ActiveSpeakersChanged,async function(n){e.updateMode(n.length>0&&n[0].identity.startsWith("agent")?"speaking":"listening")}),this.room.on(U.ParticipantDisconnected,n=>{var r;(r=n.identity)!=null&&r.startsWith("agent")&&this.disconnect({reason:"agent",context:new CloseEvent("close",{reason:"agent disconnected"})})})}close(){if(this.isConnected){try{this.room.localParticipant.audioTrackPublications.forEach(e=>{e.track&&e.track.stop()})}catch(e){console.warn("Error stopping local tracks:",e)}this.audioCaptureContext&&(this.audioCaptureContext.close().catch(e=>{console.warn("Error closing audio capture context:",e)}),this.audioCaptureContext=null),this.audioElements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.audioElements=[],this.room.disconnect()}}async sendMessage(e){if(this.isConnected&&this.room.localParticipant){if(!("user_audio_chunk"in e))try{const n=new TextEncoder().encode(JSON.stringify(e));await this.room.localParticipant.publishData(n,{reliable:!0})}catch(n){this.debug({type:"send_message_error",message:{message:e,error:n}}),console.error("Failed to send message via WebRTC:",n)}}else console.warn("Cannot send message: room not connected or no local participant")}getRoom(){return this.room}async setMicMuted(e){if(!this.isConnected||!this.room.localParticipant)return void console.warn("Cannot set microphone muted: room not connected or no local participant");const n=this.room.localParticipant.getTrackPublication(D.Source.Microphone);if(n!=null&&n.track)try{e?await n.track.mute():await n.track.unmute()}catch{await this.room.localParticipant.setMicrophoneEnabled(!e)}else await this.room.localParticipant.setMicrophoneEnabled(!e)}async setupAudioCapture(e){try{const n=new AudioContext;this.audioCaptureContext=n,this.outputAnalyser=n.createAnalyser(),this.outputAnalyser.fftSize=2048,this.outputAnalyser.smoothingTimeConstant=.8;const r=new MediaStream([e.mediaStreamTrack]),i=n.createMediaStreamSource(r);i.connect(this.outputAnalyser),await WE(n.audioWorklet);const s=new AudioWorkletNode(n,"rawAudioProcessor");this.outputAnalyser.connect(s),s.port.postMessage({type:"setFormat",format:this.outputFormat.format,sampleRate:this.outputFormat.sampleRate}),s.port.onmessage=o=>{const[a,l]=o.data;if(l>.01){const c=$E(a.buffer),u=this.audioEventId++;this.handleMessage({type:"audio",audio_event:{audio_base_64:c,event_id:u}})}},i.connect(s)}catch(n){console.warn("Failed to set up audio capture:",n)}}
534setAudioVolume(e){this.audioElements.forEach(n=>{n.volume=e})}async setAudioOutputDevice(e){if(!("setSinkId"in HTMLAudioElement.prototype))throw new Error("setSinkId is not supported in this browser");const n=this.audioElements.map(async function(r){try{await r.setSinkId(e)}catch(i){throw console.error("Failed to set sink ID for audio element:",i),i}});await Promise.all(n),this.outputDeviceId=e}async setAudioInputDevice(e){if(!this.isConnected||!this.room.localParticipant)throw new Error("Cannot change input device: room not connected or no local participant");try{const n=this.room.localParticipant.getTrackPublication(D.Source.Microphone);n!=null&&n.track&&(await n.track.stop(),await this.room.localParticipant.unpublishTrack(n.track));const r={deviceId:{exact:e},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:{ideal:1}},i=await ME(r);await this.room.localParticipant.publishTrack(i,{name:"microphone",source:D.Source.Microphone})}catch(n){console.error("Failed to change input device:",n);try{await this.room.localParticipant.setMicrophoneEnabled(!0)}catch(r){console.error("Failed to recover microphone after device switch error:",r)}throw n}}getOutputByteFrequencyData(){return this.outputAnalyser?(this.outputFrequencyData!=null||(this.outputFrequencyData=new Uint8Array(this.outputAnalyser.frequencyBinCount)),this.outputAnalyser.getByteFrequencyData(this.outputFrequencyData),this.outputFrequencyData):null}}async function qE(t){const e=function(n){return n.connectionType?n.connectionType:"conversationToken"in n&&n.conversationToken?"webrtc":"websocket"}(t);switch(e){case"websocket":return Up.create(t);case"webrtc":return Mr.create(t);default:throw new Error(`Unknown connection type: ${e}`)}}function Fp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}async function HE(t={default:0,android:3e3}){let e=t.default;var n;if(/android/i.test(navigator.userAgent))e=(n=t.android)!=null?n:e;else if(Fp()){var r;e=(r=t.ios)!=null?r:e}e>0&&await new Promise(i=>setTimeout(i,e))}class ry extends Xl{static async startSession(e){const n=Xl.getFullOptions(e);n.onStatusChange&&n.onStatusChange({status:"connecting"}),n.onCanSendFeedbackChange&&n.onCanSendFeedbackChange({canSendFeedback:!1}),n.onModeChange&&n.onModeChange({mode:"listening"}),n.onCanSendFeedbackChange&&n.onCanSendFeedbackChange({canSendFeedback:!1});let r=null;try{return await HE(n.connectionDelay),r=await qE(e),new ry(n,r)}catch(s){var i;throw n.onStatusChange&&n.onStatusChange({status:"disconnected"}),(i=r)==null||i.close(),s}}}const Nw={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:{ideal:1}};class Go{static async create({sampleRate:e,format:n,preferHeadphonesForIosDevices:r,inputDeviceId:i,workletPaths:s,libsampleratePath:o}){let a=null,l=null;try{const h=$r({sampleRate:{ideal:e}},Nw);if(Fp()&&r){const v=(await window.navigator.mediaDevices.enumerateDevices()).find(y=>y.kind==="audioinput"&&["airpod","headphone","earphone"].find(w=>y.label.toLowerCase().includes(w)));v&&(h.deviceId={ideal:v.deviceId})}i&&(h.deviceId=Go.getDeviceIdConstraint(i));const f=navigator.mediaDevices.getSupportedConstraints().sampleRate;a=new window.AudioContext(f?{sampleRate:e}:{});const m=a.createAnalyser();if(!f){const v=o||"https://cdn.jsdelivr.net/npm/@alexanderolsen/[email protected]/dist/libsamplerate.worklet.js";await a.audioWorklet.addModule(v)}await WE(a.audioWorklet,s==null?void 0:s.rawAudioProcessor);const b=$r({voiceIsolation:!0},h);l=await navigator.mediaDevices.getUserMedia({audio:b});const p=a.createMediaStreamSource(l),g=new AudioWorkletNode(a,"rawAudioProcessor");return g.port.postMessage({type:"setFormat",format:n,sampleRate:e}),p.connect(m),m.connect(g),await a.resume(),new Go(a,m,g,l,p)}catch(h){var c,u;throw(c=l)==null||c.getTracks().forEach(f=>{f.stop()}),(u=a)==null||u.close(),h}}static getDeviceIdConstraint(e){if(e)return Fp()?{ideal:e}:{exact:e}}constructor(e,n,r,i,s){this.context=void 0,this.analyser=void 0,this.worklet=void 0,this.inputStream=void 0,this.mediaStreamSource=void 0,this.context=e,this.analyser=n,this.worklet=r,this.inputStream=i,this.mediaStreamSource=s}
534async close(){this.inputStream.getTracks().forEach(e=>{e.stop()}),this.mediaStreamSource.disconnect(),await this.context.close()}setMuted(e){this.worklet.port.postMessage({type:"setMuted",isMuted:e})}async setInputDevice(e){try{const n=$r({},Nw);e&&(n.deviceId=Go.getDeviceIdConstraint(e));const r=$r({voiceIsolation:!0},n),i=await navigator.mediaDevices.getUserMedia({audio:r});this.inputStream.getTracks().forEach(s=>{s.stop()}),this.mediaStreamSource.disconnect(),this.inputStream=i,this.mediaStreamSource=this.context.createMediaStreamSource(i),this.mediaStreamSource.connect(this.analyser)}catch(n){throw console.error("Failed to switch input device:",n),n}}}const q4=VE("audioConcatProcessor",`/*
535 * ulaw decoding logic taken from the wavefile library
536 * https://github.com/rochars/wavefile/blob/master/lib/codecs/mulaw.js
537 * USED BY @elevenlabs/client
538 */
539
540const decodeTable = [0,132,396,924,1980,4092,8316,16764];
541
542function decodeSample(muLawSample) {
543  let sign;
544  let exponent;
545  let mantissa;
546  let sample;
547  muLawSample = ~muLawSample;
548  sign = (muLawSample & 0x80);
549  exponent = (muLawSample >> 4) & 0x07;
550  mantissa = muLawSample & 0x0F;
551  sample = decodeTable[exponent] + (mantissa << (exponent+3));
552  if (sign !== 0) sample = -sample;
553
554  return sample;
555}
556
557class AudioConcatProcessor extends AudioWorkletProcessor {
558  constructor() {
559    super();
560    this.buffers = []; // Initialize an empty buffer
561    this.cursor = 0;
562    this.currentBuffer = null;
563    this.wasInterrupted = false;
564    this.finished = false;
565    
566    this.port.onmessage = ({ data }) => {
567      switch (data.type) {
568        case "setFormat":
569          this.format = data.format;
570          break;
571        case "buffer":
572          this.wasInterrupted = false;
573          this.buffers.push(
574            this.format === "ulaw"
575              ? new Uint8Array(data.buffer)
576              : new Int16Array(data.buffer)
577          );
578          break;
579        case "interrupt":
580          this.wasInterrupted = true;
581          break;
582        case "clearInterrupted":
583          if (this.wasInterrupted) {
584            this.wasInterrupted = false;
585            this.buffers = [];
586            this.currentBuffer = null;
587          }
588      }
589    };
590  }
591  process(_, outputs) {
592    let finished = false;
593    const output = outputs[0][0];
594    for (let i = 0; i < output.length; i++) {
595      if (!this.currentBuffer) {
596        if (this.buffers.length === 0) {
597          finished = true;
598          break;
599        }
600        this.currentBuffer = this.buffers.shift();
601        this.cursor = 0;
602      }
603
604      let value = this.currentBuffer[this.cursor];
605      if (this.format === "ulaw") {
606        value = decodeSample(value);
607      }
608      output[i] = value / 32768;
609      this.cursor++;
610
611      if (this.cursor >= this.currentBuffer.length) {
612        this.currentBuffer = null;
613      }
614    }
615
616    if (this.finished !== finished) {
617      this.finished = finished;
618      this.port.postMessage({ type: "process", finished });
619    }
620
621    return true; // Continue processing
622  }
623}
624
625registerProcessor("audioConcatProcessor", AudioConcatProcessor);
626`);class _d{static async create({sampleRate:e,format:n,outputDeviceId:r,workletPaths:i}){let s=null,o=null;try{s=new AudioContext({sampleRate:e});const c=s.createAnalyser(),u=s.createGain();o=new Audio,o.src="",o.load(),o.autoplay=!0,o.style.display="none",document.body.appendChild(o);const h=s.createMediaStreamDestination();o.srcObject=h.stream,u.connect(c),c.connect(h),await q4(s.audioWorklet,i==null?void 0:i.audioConcatProcessor);const f=new AudioWorkletNode(s,"audioConcatProcessor");return f.port.postMessage({type:"setFormat",format:n}),f.connect(u),await s.resume(),r&&o.setSinkId&&await o.setSinkId(r),new _d(s,c,u,f,o)}catch(c){var a,l;throw(a=o)!=null&&a.parentNode&&o.parentNode.removeChild(o),(l=o)==null||l.pause(),s&&s.state!=="closed"&&await s.close(),c}}constructor(e,n,r,i,s){this.context=void 0,this.analyser=void 0,this.gain=void 0,this.worklet=void 0,this.audioElement=void 0,this.context=e,this.analyser=n,this.gain=r,this.worklet=i,this.audioElement=s}async setOutputDevice(e){if(!("setSinkId"in HTMLAudioElement.prototype))throw new Error("setSinkId is not supported in this browser");await this.audioElement.setSinkId(e||"")}async close(){this.audioElement.parentNode&&this.audioElement.parentNode.removeChild(this.audioElement),this.audioElement.pause(),await this.context.close()}}class iy extends Xl{static async startSession(e){var n;const r=Xl.getFullOptions(e);r.onStatusChange&&r.onStatusChange({status:"connecting"}),r.onCanSendFeedbackChange&&r.onCanSendFeedbackChange({canSendFeedback:!1});let i=null,s=null,o=null,a=null,l=null;if((n=e.useWakeLock)==null||n)try{l=await navigator.wakeLock.request("screen")}catch{}try{var c;return a=await navigator.mediaDevices.getUserMedia({audio:!0}),await HE(r.connectionDelay),s=await qE(e),[i,o]=await Promise.all([Go.create($r({},s.inputFormat,{preferHeadphonesForIosDevices:e.preferHeadphonesForIosDevices,inputDeviceId:e.inputDeviceId,workletPaths:e.workletPaths,libsampleratePath:e.libsampleratePath})),_d.create($r({},s.outputFormat,{outputDeviceId:e.outputDeviceId,workletPaths:e.workletPaths}
626))]),(c=a)==null||c.getTracks().forEach(p=>{p.stop()}),a=null,new iy(r,s,i,o,l)}catch(p){var u,h,f,m;r.onStatusChange&&r.onStatusChange({status:"disconnected"}),(u=a)==null||u.getTracks().forEach(g=>{g.stop()}),(h=s)==null||h.close(),await((f=i)==null?void 0:f.close()),await((m=o)==null?void 0:m.close());try{var b;await((b=l)==null?void 0:b.release()),l=null}catch{}throw p}}constructor(e,n,r,i,s){super(e,n),this.input=void 0,this.output=void 0,this.wakeLock=void 0,this.inputFrequencyData=void 0,this.outputFrequencyData=void 0,this.onInputWorkletMessage=o=>{this.status==="connected"&&this.connection.sendMessage({user_audio_chunk:$E(o.data[0].buffer)})},this.onOutputWorkletMessage=({data:o})=>{o.type==="process"&&this.updateMode(o.finished?"listening":"speaking")},this.addAudioBase64Chunk=o=>{this.output.gain.gain.cancelScheduledValues(this.output.context.currentTime),this.output.gain.gain.value=this.volume,this.output.worklet.port.postMessage({type:"clearInterrupted"}),this.output.worklet.port.postMessage({type:"buffer",buffer:W4(o)})},this.fadeOutAudio=()=>{this.updateMode("listening"),this.output.worklet.port.postMessage({type:"interrupt"}),this.output.gain.gain.exponentialRampToValueAtTime(1e-4,this.output.context.currentTime+2),setTimeout(()=>{this.output.gain.gain.value=this.volume,this.output.worklet.port.postMessage({type:"clearInterrupted"})},2e3)},this.calculateVolume=o=>{if(o.length===0)return 0;let a=0;for(let l=0;l<o.length;l++)a+=o[l]/255;return a/=o.length,a<0?0:a>1?1:a},this.setVolume=({volume:o})=>{const a=Number.isFinite(o)?Math.min(1,Math.max(0,o)):1;this.volume=a,this.connection instanceof Mr?this.connection.setAudioVolume(a):this.output.gain.gain.value=a},this.input=r,this.output=i,this.wakeLock=s,this.input.worklet.port.onmessage=this.onInputWorkletMessage,this.output.worklet.port.onmessage=this.onOutputWorkletMessage}async handleEndSession(){await super.handleEndSession();try{var e;await((e=this.wakeLock)==null?void 0:e.release()),this.wakeLock=null}catch{}await this.input.close(),await this.output.close()}handleInterruption(e){super.handleInterruption(e),this.fadeOutAudio()}handleAudio(e){var n,r;this.lastInterruptTimestamp<=e.audio_event.event_id&&((n=(r=this.options).onAudio)==null||n.call(r,e.audio_event.audio_base_64),this.connection instanceof Mr||this.addAudioBase64Chunk(e.audio_event.audio_base_64),this.currentEventId=e.audio_event.event_id,this.updateCanSendFeedback(),this.updateMode("speaking"))}setMicMuted(e){this.connection instanceof Mr?this.connection.setMicMuted(e):this.input.setMuted(e)}getInputByteFrequencyData(){return this.inputFrequencyData!=null||(this.inputFrequencyData=new Uint8Array(this.input.analyser.frequencyBinCount)),this.input.analyser.getByteFrequencyData(this.inputFrequencyData),this.inputFrequencyData}getOutputByteFrequencyData(){return this.connection instanceof Mr?this.connection.getOutputByteFrequencyData()||new Uint8Array(1024):(this.outputFrequencyData!=null||(this.outputFrequencyData=new Uint8Array(this.output.analyser.frequencyBinCount)),this.output.analyser.getByteFrequencyData(this.outputFrequencyData),this.outputFrequencyData)}getInputVolume(){return this.calculateVolume(this.getInputByteFrequencyData())}getOutputVolume(){return this.calculateVolume(this.getOutputByteFrequencyData())}async changeInputDevice({sampleRate:e,format:n,preferHeadphonesForIosDevices:r,inputDeviceId:i}){try{if(this.connection instanceof Up)try{return await this.input.setInputDevice(i),this.input}catch(o){console.warn("Failed to change device on existing input, recreating:",o)}this.connection instanceof Mr&&await this.connection.setAudioInputDevice(i||""),await this.input.close();const s=await Go.create({sampleRate:e??this.connection.inputFormat.sampleRate,format:n??this.connection.inputFormat.format,preferHeadphonesForIosDevices:r,inputDeviceId:i,workletPaths:this.options.workletPaths,libsampleratePath:this.options.libsampleratePath});return this.input=s,this.input.worklet.port.onmessage=this.onInputWorkletMessage,this.input}catch(s){throw console.error("Error changing input device",s),s}}async changeOutputDevice({sampleRate:e,format:n,outputDeviceId:r}){try{if(this.connection instanceof Up)try{return await this.output.setOutputDevice(r),this.output}catch(s){console.warn("Failed to change device on existing output, recreating:",s)}this.connection instanceof Mr&&await this.connection.setAudioOutputDevice(r||""),await this.output.close();const i=await _d.create({sampleRate:e??this.connection.outputFormat.sampleRate,format:n??this.connection.outputFormat.format,outputDeviceId:r,workletPaths:this.options.workletPaths});return this.output=i,this.output}catch(i){throw console.error("Error changing output device",i),i}}}var Aw;(function(t){t.SESSION_STARTED="session_started",t.PARTIAL_TRANSCRIPT="partial_transcript",t.COMMITTED_TRANSCRIPT="committed_transcript",t.COMMITTED_TRANSCRIPT_WITH_TIMESTAMPS="committed_transcript_with_timestamps",t.AUTH_ERROR="auth_error",t.ERROR="error",t.OPEN="open",t.CLOSE="close",t.QUOTA_EXCEEDED="quota_exceeded",t.COMMIT_THROTTLED="commit_throttled",t.TRANSCRIBER_ERROR="transcriber_error",t.UNACCEPTED_TERMS="unaccepted_terms",t.RATE_LIMITED="rate_limited",t.INPUT_ERROR="input_error",t.QUEUE_OVERFLOW="queue_overflow",t.RESOURCE_EXHAUSTED="resource_exhausted",t.SESSION_TIME_LIMIT_EXCEEDED="session_time_limit_exceeded",t.CHUNK_SIZE_EXCEEDED="chunk_size_exceeded",t.INSUFFICIENT_AU
626DIO_ACTIVITY="insufficient_audio_activity"})(Aw||(Aw={}));var Ow,Mw;(function(t){t.PCM_8000="pcm_8000",t.PCM_16000="pcm_16000",t.PCM_22050="pcm_22050",t.PCM_24000="pcm_24000",t.PCM_44100="pcm_44100",t.PCM_48000="pcm_48000",t.ULAW_8000="ulaw_8000"})(Ow||(Ow={})),function(t){t.MANUAL="manual",t.VAD="vad"}(Mw||(Mw={}));class H4 extends Xl{static startSession(e){return e.textOnly?ry.startSession(e):iy.startSession(e)}}function bl(){return bl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},bl.apply(null,arguments)}const K4=["micMuted","volume","serverLocation"];function G4(t="us"){switch(t){case"eu-residency":case"in-residency":case"us":case"global":return t;default:return console.warn(`[ConversationalAI] Invalid server-location: ${t}. Defaulting to "us"`),"us"}}function J4(t){return{us:"wss://api.elevenlabs.io","eu-residency":"wss://api.eu.residency.elevenlabs.io","in-residency":"wss://api.in.residency.elevenlabs.io",global:"wss://api.elevenlabs.io"}[t]}function Y4(t){return{us:"wss://livekit.rtc.elevenlabs.io","eu-residency":"wss://livekit.rtc.eu.residency.elevenlabs.io","in-residency":"wss://livekit.rtc.in.residency.elevenlabs.io",global:"wss://livekit.rtc.elevenlabs.io"}[t]}function Q4(t={}){const{micMuted:e,volume:n,serverLocation:r}=t,i=function(g,v){if(g==null)return{};var y={};for(var w in g)if({}.hasOwnProperty.call(g,w)){if(v.indexOf(w)!==-1)continue;y[w]=g[w]}return y}(t,K4),s=x.useRef(null),o=x.useRef(null),a=x.useRef(!1),[l,c]=x.useState("disconnected"),[u,h]=x.useState(!1),[f,m]=x.useState("listening"),b=x.useRef(e),p=x.useRef(n);return b.current=e,p.current=n,x.useEffect(()=>{var g;e!==void 0&&(s==null||(g=s.current)==null||g.setMicMuted(e))},[e]),x.useEffect(()=>{var g;n!==void 0&&(s==null||(g=s.current)==null||g.setVolume({volume:n}))},[n]),x.useEffect(()=>()=>{var g;a.current=!0,o.current?o.current.then(v=>v.endSession()):(g=s.current)==null||g.endSession()},[]),{startSession:async g=>{var v;if((v=s.current)!=null&&v.isOpen())return s.current.getId();if(o.current)return(await o.current).getId();a.current=!1;try{var y,w,k,S,T,C,_,P,R,A;const O=G4((g==null?void 0:g.serverLocation)||r),K=J4(O),F=Y4(O);if(o.current=H4.startSession(bl({},i??{},g??{},{origin:K,livekitUrl:(g==null?void 0:g.livekitUrl)||(i==null?void 0:i.livekitUrl)||F,overrides:bl({},(y=i==null?void 0:i.overrides)!=null?y:{},(w=g==null?void 0:g.overrides)!=null?w:{},{client:bl({},(k=i==null||(S=i.overrides)==null?void 0:S.client)!=null?k:{},(T=g==null||(C=g.overrides)==null?void 0:C.client)!=null?T:{},{source:(g==null||(_=g.overrides)==null||(_=_.client)==null?void 0:_.source)||(i==null||(P=i.overrides)==null||(P=P.client)==null?void 0:P.source)||"react_sdk",version:(g==null||(R=g.overrides)==null||(R=R.client)==null?void 0:R.version)||(i==null||(A=i.overrides)==null||(A=A.client)==null?void 0:A.version)||"0.12.3"})}),onConnect:(g==null?void 0:g.onConnect)||(i==null?void 0:i.onConnect),onDisconnect:(g==null?void 0:g.onDisconnect)||(i==null?void 0:i.onDisconnect),onError:(g==null?void 0:g.onError)||(i==null?void 0:i.onError),onMessage:(g==null?void 0:g.onMessage)||(i==null?void 0:i.onMessage),onAudio:(g==null?void 0:g.onAudio)||(i==null?void 0:i.onAudio),onDebug:(g==null?void 0:g.onDebug)||(i==null?void 0:i.onDebug),onUnhandledClientToolCall:(g==null?void 0:g.onUnhandledClientToolCall)||(i==null?void 0:i.onUnhandledClientToolCall),onVadScore:(g==null?void 0:g.onVadScore)||(i==null?void 0:i.onVadScore),onInterruption:(g==null?void 0:g.onInterruption)||(i==null?void 0:i.onInterruption),onAgentToolRequest:(g==null?void 0:g.onAgentToolRequest)||(i==null?void 0:i.onAgentToolRequest),onAgentToolResponse:(g==null?void 0:g.onAgentToolResponse)||(i==null?void 0:i.onAgentToolResponse),onConversationMetadata:(g==null?void 0:g.onConversationMetadata)||(i==null?void 0:i.onConversationMetadata),onMCPToolCall:(g==null?void 0:g.onMCPToolCall)||(i==null?void 0:i.onMCPToolCall),onMCPConnectionStatus:(g==null?void 0:g.onMCPConnectionStatus)||(i==null?void 0:i.onMCP
626ConnectionStatus),onAsrInitiationMetadata:(g==null?void 0:g.onAsrInitiationMetadata)||(i==null?void 0:i.onAsrInitiationMetadata),onAgentChatResponsePart:(g==null?void 0:g.onAgentChatResponsePart)||(i==null?void 0:i.onAgentChatResponsePart),onModeChange:({mode:Y})=>{var V;m(Y),(V=(g==null?void 0:g.onModeChange)||(i==null?void 0:i.onModeChange))==null||V({mode:Y})},onStatusChange:({status:Y})=>{var V;c(Y),(V=(g==null?void 0:g.onStatusChange)||(i==null?void 0:i.onStatusChange))==null||V({status:Y})},onCanSendFeedbackChange:({canSendFeedback:Y})=>{var V;h(Y),(V=(g==null?void 0:g.onCanSendFeedbackChange)||(i==null?void 0:i.onCanSendFeedbackChange))==null||V({canSendFeedback:Y})}})),s.current=await o.current,a.current)throw await s.current.endSession(),s.current=null,o.current=null,new Error("Session cancelled during connection");return b.current!==void 0&&s.current.setMicMuted(b.current),p.current!==void 0&&s.current.setVolume({volume:p.current}),s.current.getId()}finally{o.current=null}},endSession:async()=>{a.current=!0;const g=o.current,v=s.current;s.current=null,g?await(await g).endSession():await(v==null?void 0:v.endSession())},setVolume:({volume:g})=>{var v;(v=s.current)==null||v.setVolume({volume:g})},getInputByteFrequencyData:()=>{var g;return(g=s.current)==null?void 0:g.getInputByteFrequencyData()},getOutputByteFrequencyData:()=>{var g;return(g=s.current)==null?void 0:g.getOutputByteFrequencyData()},getInputVolume:()=>{var g,v;return(g=(v=s.current)==null?void 0:v.getInputVolume())!=null?g:0},getOutputVolume:()=>{var g,v;return(g=(v=s.current)==null?void 0:v.getOutputVolume())!=null?g:0},sendFeedback:g=>{var v;(v=s.current)==null||v.sendFeedback(g)},getId:()=>{var g;return(g=s.current)==null?void 0:g.getId()},sendContextualUpdate:g=>{var v;(v=s.current)==null||v.sendContextualUpdate(g)},sendUserMessage:g=>{var v;(v=s.current)==null||v.sendUserMessage(g)},sendUserActivity:()=>{var g;(g=s.current)==null||g.sendUserActivity()},sendMCPToolApprovalResult:(g,v)=>{var y;(y=s.current)==null||y.sendMCPToolApprovalResult(g,v)},changeInputDevice:async g=>{if(s.current&&"changeInputDevice"in s.current)return await s.current.changeInputDevice(g);throw new Error("Device switching is only available for voice conversations")},changeOutputDevice:async g=>{if(s.current&&"changeOutputDevice"in s.current)return await s.current.changeOutputDevice(g);throw new Error("Device switching is only available for voice conversations")},status:l,canSendFeedback:u,micMuted:e,isSpeaking:f==="speaking"}}const Pd=x.forwardRef(({className:t,type:e,...n},r)=>d.jsx("input",{type:e,className:ce("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Pd.displayName="Input";const yh=({agentId:t,name:e,role:n,description:r,color:i})=>{const[s,o]=x.useState(!1),[a,l]=x.useState(""),[c,u]=x.useState([]),[h,f]=x.useState(!1),m=x.useRef(null),b=x.useRef(null),{t:p}=Ke(),g=Q4({onConnect:()=>{console.log(`Connected to ${e}`),o(!1)},onDisconnect:()=>{console.log(`Disconnected from ${e}`)},onError:P=>{console.error(`Error with ${e}:`,P),o(!1)},onMessage:P=>{var R;if(console.log(`Message from ${e}:`,P),P.type==="agent_response"){const A=(R=P.agent_response_event)==null?void 0:R.agent_response;A&&(u(O=>[...O,{role:"assistant",content:A}]),f(!1))}}});x.useEffect(()=>{b.current&&(b.current.scrollTop=b.current.scrollHeight)},[c]);const v=x.useCallback(async()=>{o(!0);try{await navigator.mediaDevices.getUserMedia({audio:!0}),await g.startSession({agentId:t,connectionType:"webrtc"})}catch(P){console.error("Failed to start conversation:",P),o(!1)}},[g,t]),y=x.useCallback(async()=>{await g.endSession(),u([])},[g]),w=x.useCallback(async()=>{if(!a.trim())return;const P=a.trim();if(u(R=>[...R,{role:"user",content:P}]),l(""),f(!0),g.status!=="connected"){o(!0);try{await navigator.mediaDevices.getUserMedia({audio:!0}),await g.startSession({agentId:t,connectionType:"webrtc"}),setTimeout(()=>{g.sendUserMessage(P)},500)}catch(R){console.error("Failed to start conversation:",R),o(!1),f(!1)}}else try{g.sendUserMessage(P)}catch(R){console.error("Failed to send message:",R),f(!1)}},[g,a,t]),k=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),w())},S=g.status==="connected",T=g.isSpeaking,_={primary:{gradient:"bg-gradient-primary",glow:"shadow-glow-primary",ring:"ring-primary/30",text:"text-gradient-primary",border:"border-primary/20",bgHover:"hover:border-primary/40"},secondary:{gradient:"bg-gradient-accent",glow:"shadow-glow-accent",ring:"ring-secondary/30",text:"text-gradient-accent",border:"border-secondary/20",bgHover:"hover:border-secondary/40"}}[i];return d.jsxs("div",{className:ce("relative p-6 rounded-2xl bg-glass border transition-all duration-500",_.border,_.bgHover,S&&`ring-2 ${_.ring} ${_.glow}`),children:[d.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[d.jsxs("div",{className:"relative",children:[d.jsx("div",{className:ce("w-16 h-16 rounded-2xl flex items-center justify-center text-2xl font-display font-bold",_.gradient,"text-primary-foreground"),children:e.charAt(0)}),S&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:ce("absolute -inset-1 rounded-2xl animate-pulse-ring",_.gradient,"opacity-30")}),d.jsx("div",{className:"absolute -bottom-1 -right-1 w-4 h-4 bg-green-500 rounded-full border-2 border-card"})]})]}),d.jsxs("div",{className:"flex-1",children:[d.jsx("h3",{className:ce("font-display font-bold text-xl",_.text),children:e}),d.jsx("p",{className:"text-sm text-muted-foreground font-medium",children:n})]})]}),d.jsx("p",{className:"text-muted-foreground text-sm mb-6 leading-relaxed",children:r}),S&&d.jsxs("div",{className:"mb-4 p-4 rounded-xl bg-muted/30 border border-border/50",children:[d.jsx("div",{className:"flex items-center justify-center gap-2",children:T?d.jsx("div",{className:"voice-wave",children:[1,2,3,4,5].map(P=>d.jsx("div",{className:ce("voice-wave-bar",i==="secondary"?"bg-secondary":"bg-primary")},P))}):d.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[d.jsx(SA,{className:"w-4 h-4"}),d.jsx("span",{className:"text-sm",children:p("Hört zu...","Listening...")})]})}),d.jsx("p",{className:"text-center text-xs text-muted-foreground mt-2",children:T?p(`${e} spricht...`,`${e} is speaking...`):p("Sprechen Sie jetzt...","Speak now...")})]}),c.length>0&&d.jsxs("div",{ref:b,className:"h-48 overflow-y-auto rounded-xl bg-muted/30 border border-border/50 p-3 mb-4 space-y-3",children:[c.map((P,R)=>d.jsx("div",{className:ce("max-w-[85%] p-3 rounded-xl text-sm",P.role==="user"?"ml-auto bg-primary/20 text-foreground":"mr-auto bg-muted text-foreground"),children:P.content},R)),h&&d.jsx("div",{className:"mr-auto bg-muted p-3 rounded-xl text-sm text-muted-foreground",children:p(`${e} schreibt...`,`${e} is typing...`)}),d.jsx("div",{ref:m})]}),d.jsxs("div",{className:"flex gap-2 mb-4",children:[d.jsx(Pd,{value:a,onChange:P=>l(P.target.value),onKeyPress:k,placeholder:p("E-Mail oder Nachricht eingeben...","Enter email or message..."),className:"flex-1 bg-muted/30 border-border/50"}),d.jsx(De,{onClick:w,disabled:!a.trim()||s,size:"icon",className:ce(i==="primary"?"bg-gradient-primary hover:opacity-90":"bg-gradient-accent hover:opacity-90"),children:d.jsx(cv,{className:"w-4 h-4"})})]}),S?d.jsxs(De,{onClick:y,variant:"destructive",className:"w-full font-semibold",children:[d.jsx(pA,{className:"w-4 h-4 mr-2"}),p("Chat beenden","End chat")]}):d.jsx(De,{onClick:v,disabled:s,className:ce("w-full font-semibold",i==="primary"?"bg-gradient-primary hover:opacity-90 shadow-glow-primary":"bg-gradient-accent hover:opacity-90 shadow-glow-accent"),children:s?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-4 h-4 border-2 border-primary-foreground
626/30 border-t-primary-foreground rounded-full animate-spin mr-2"}),p("Verbinde...","Connecting...")]}):d.jsxs(d.Fragment,{children:[d.jsx(ET,{className:"w-4 h-4 mr-2"}),p("Chat starten","Start chat")]})})]})},X4="/assets/hero-index-m6VbtWmq.jpg",Z4=()=>{const{t}=Ke();return d.jsxs("section",{className:"relative min-h-screen flex items-center justify-center overflow-hidden pt-20",children:[d.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat",style:{backgroundImage:`url(${X4})`}}),d.jsx("div",{className:"absolute inset-0 bg-background/80"}),d.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-primary/20 rounded-full blur-3xl animate-pulse-slow"}),d.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-80 h-80 bg-secondary/20 rounded-full blur-3xl animate-pulse-slow",style:{animationDelay:"2s"}}),d.jsx("div",{className:"absolute inset-0 opacity-5",style:{backgroundImage:`linear-gradient(hsl(var(--foreground)) 1px, transparent 1px),
627                           linear-gradient(90deg, hsl(var(--foreground)) 1px, transparent 1px)`,backgroundSize:"50px 50px"}}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-5xl mx-auto",children:[d.jsxs("div",{className:"text-center mb-12",children:[d.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-glass border border-border/50 mb-8 animate-fade-in",children:[d.jsx(CT,{className:"w-4 h-4 text-primary"}),d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:t("AI Consulting & Produkte aus Deutschland","AI Consulting & Products from Germany")})]}),d.jsxs("h1",{className:"font-display font-bold text-5xl md:text-6xl lg:text-7xl leading-tight mb-6 animate-fade-in-up",style:{animationDelay:"0.1s"},children:[d.jsx("span",{className:"text-foreground",children:t("Wir bringen","We bring")}),d.jsx("br",{}),d.jsx("span",{className:"text-gradient-primary",children:t("KI in Ihre Arbeit","AI into your work")})]}),d.jsx("p",{className:"text-lg md:text-xl text-muted-foreground max-w-2xl mx-auto mb-10 animate-fade-in-up",style:{animationDelay:"0.2s"},children:t("PromptPeak ist Ihr Partner für KI-gestützte Lösungen – von sicherer On-Premise-KI für Rechtswesen über intelligente Office-Automatisierung bis hin zu lebendigen Kulturporträts.","PromptPeak is your partner for AI-powered solutions – from secure on-premise AI for legal to intelligent office automation and vivid cultural portraits.")})]}),d.jsxs("div",{className:"max-w-xl mx-auto mb-12 animate-fade-in-up",style:{animationDelay:"0.3s"},children:[d.jsxs("div",{className:"text-center mb-6",children:[d.jsx(bA,{className:"w-5 h-5 text-primary inline-block mr-2"}),d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:t("Sprechen Sie mit Kerstin über PromptPeak","Talk to Kerstin about PromptPeak")})]}),d.jsx(yh,{agentId:"agent_1501k726mhq1ed1rcj1rzmzzwem3",name:"Kerstin",role:t("PromptPeak Expertin","PromptPeak Expert"),description:t("Erfahren Sie mehr über unsere Produkte und Dienstleistungen. Kerstin erklärt Ihnen, wie PromptPeak Ihr Unternehmen unterstützen kann.","Learn more about our products and services. Kerstin explains how PromptPeak can support your business."),color:"primary"})]}),d.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center animate-fade-in-up",style:{animationDelay:"0.4s"},children:[d.jsx("a",{href:"#produkte",children:d.jsxs(De,{size:"lg",className:"bg-gradient-primary hover:opacity-90 transition-opacity shadow-glow-primary font-semibold text-lg px-8 py-6",children:[t("Unsere Produkte entdecken","Discover our products"),d.jsx(cn,{className:"ml-2 w-5 h-5"})]})}),d.jsx("a",{href:"mailto:[email protected]",children:d.jsx(De,{size:"lg",variant:"outline",className:"border-border/50 bg-glass hover:bg-muted/50 font-semibold text-lg px-8 py-6",children:t("Kontakt aufnehmen","Get in touch")})})]}),d.jsx("div",{className:"grid grid-cols-3 gap-8 mt-20 max-w-2xl mx-auto animate-fade-in-up",style:{animationDelay:"0.5s"},children:[{value:"3",label:t("Produkte","Products")},{value:"24/7",label:t("Verfügbar","Available")},{value:"DE",label:t("DSGVO-konform","GDPR compliant")}].map((e,n)=>d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"font-display font-bold text-3xl md:text-4xl text-gradient-primary mb-2",children:e.value}),d.jsx("div",{className:"text-sm text-muted-foreground",children:e.label})]},n))})]})}),d.jsx("div",{className:"absolute bottom-8 left-1/2 -translate-x-1/2 animate-float",children:d.jsx("div",{className:"w-6 h-10 rounded-full border-2 border-muted-foreground
627/30 flex items-start justify-center p-2",children:d.jsx("div",{className:"w-1.5 h-3 bg-muted-foreground/50 rounded-full animate-pulse"})})})]})},eF={primary:{gradient:"bg-gradient-primary",glow:"shadow-glow-primary",text:"text-gradient-primary",border:"border-primary/20",bgHover:"hover:border-primary/40",iconBg:"bg-primary/10",iconText:"text-primary"},secondary:{gradient:"bg-gradient-accent",glow:"shadow-glow-accent",text:"text-gradient-accent",border:"border-secondary/20",bgHover:"hover:border-secondary/40",iconBg:"bg-secondary/10",iconText:"text-secondary"}},tF=()=>{const{t}=Ke(),e=[{id:"lexvault",name:"LexVault",tagline:t("Vertrauliche KI für vertrauliche Daten","Confidential AI for confidential data"),description:t("Für Organisationen, in denen Sicherheit, Kontrolle und Vertrauen an erster Stelle stehen. Ohne Cloud. Ohne Datenabfluss. Komplett in Ihrem Rechenzentrum.","For organizations where security, control, and trust come first. No cloud. No data leakage. Entirely in your data center."),features:[t("100% On-Premise","100% On-Premise"),t("DSGVO-konform","GDPR compliant"),t("Auditfähig","Audit-ready")],icon:_T,color:"primary",link:"/legal",agent:"Martin"},{id:"officepulse",name:"OfficePulse",tagline:t("Ihr virtueller Mitarbeiter","Your virtual employee"),description:t("OfficePulse liest E-Mails, versteht Inhalte und erledigt Routineaufgaben – damit Ihr Team sich auf das Wesentliche konzentrieren kann.","OfficePulse reads emails, understands content, and handles routine tasks – so your team can focus on what matters."),features:[t("E-Mail-Automatisierung","Email automation"),t("CRM-Integration","CRM integration"),t("Workflow-Automation","Workflow automation")],icon:ov,color:"secondary",link:"/kmu",agent:"Lea"},{id:"douplet",name:"Douplét",tagline:t("Das Porträt des 21. Jahrhunderts","The portrait of the 21st century"),description:t("Douplét verbindet Kunst und Technologie, um lebendige Porträts zu schaffen. Eine digitale Präsenz, die sprechen, reagieren und mit der Zeit weiterwachsen kann.","Douplét connects art and technology to create vivid portraits. A digital presence that can speak, respond, and grow over time."),features:[t("GLAM-Sektor","GLAM sector"),t("Digitale Archive","Digital archives"),t("Lebendige Erinnerung","Living memory")],icon:Km,color:"primary",link:"/culture",agent:"Anna"}];return d.jsxs("section",{className:"relative py-24 overflow-hidden",id:"produkte",children:[d.jsx("div",{className:"absolute inset-0 bg-gradient-dark"}),d.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-border to-transparent"}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[d.jsxs("h2",{className:"font-display font-bold text-4xl md:text-5xl mb-6",children:[d.jsx("span",{className:"text-foreground",children:t("Unsere","Our")})," ",d.jsx("span",{className:"text-gradient-primary",children:t("KI-Produkte","AI Products")})]}),d.jsx("p",{className:"text-muted-foreground text-lg",children:t("Drei spezialisierte Lösungen für unterschiedliche Anforderungen – alle entwickelt mit höchsten Sicherheits- und Qualitätsstandards.","Three specialized solutions for different requirements – all developed with the highest security and quality standards.")})]}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6 max-w-6xl mx-auto",children:e.map((n,r)=>{const i=eF[n.color],s=n.icon;return d.jsxs("div",{className:ce("relative p-6 rounded-2xl bg-glass border transition-all duration-500 group",i.border,i.bgHover,"hover:shadow-lg animate-fade-in-up"),style:{animationDelay:`${r*.1}s`},children:[d.jsx("div",{className:ce("w-14 h-14 rounded-xl flex items-center justify-center mb-6",i.iconBg),children:d.jsx(s,{className:ce("w-7 h-7",i.iconText)})}),d.jsx("h3",{className:ce("font-display font-bold text-2xl mb-2",i.text),children:n.name}),d.jsx("p",{className:"text-foreground font-medium mb-3",children:n.tagline}),d.jsx("p",{className:"text-muted-foreground text-sm mb-6 leading-relaxed",children:n.description}),d.jsx("ul",{className:"space-y-2 mb-6",children:n.features.map((o,a)=>d.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx("div",{className:ce("w-1.5 h-1.5 rounded-full",i.gradient)}),o]},a))}),d.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:t(`Sprechen Sie mit ${n.agent} über ${n.name}`,`Talk to ${n.agent} about ${n.name}`)}),d.jsx(pt,{to:n.link,children:d.jsxs(De,{className:ce("w-full font-semibold group-hover:opacity-90 transition-all",n.color==="primary"?"bg-gradient-primary shadow-glow-primary":"bg-gradient-accent shadow-glow-accent"),children:[t("Mehr erfahren","Learn more"),d.jsx(cn,{className:"w-4 h-4 ml-2 group-hover:translate-x-1 transition-transform"})]})})]},n.id)})})]})]})},nF=()=>{const{t}=Ke(),e=[{icon:iA,title:t("10+ Jahre KI-Expertise","10+ Years AI Expertise"),description:t("Seit über einem Jahrzehnt entwickeln wir KI-Lösungen – lange bevor der aktuelle Hype begann. Diese Erfahrung fließt in jedes unserer Produkte.","We've been developing AI solutions for over a decade – long before the current hype. This experience flows into every product we build.")},{icon:pa,title:t("Beratung auf Augenhöhe","Consulting at Eye Level"),description:t("Wir verstehe
627n Ihre Branche. Von Kanzleien über den Mittelstand bis zum Kultursektor – wir sprechen Ihre Sprache.","We understand your industry. From law firms to SMEs to the cultural sector – we speak your language.")},{icon:D0,title:t("Praxisorientierte Lösungen","Practice-Oriented Solutions"),description:t("Keine Spielereien, sondern Produkte, die echten Mehrwert schaffen. Entwickelt aus der Praxis, für die Praxis.","No gimmicks – just products that create real value. Developed from practice, for practice.")}],n=[{step:"01",title:t("Verstehen","Understand"),description:t("Wir analysieren Ihre Prozesse und identifizieren, wo KI den größten Hebel bietet.","We analyze your processes and identify where AI offers the greatest leverage.")},{step:"02",title:t("Entwickeln","Develop"),description:t("Aus unserer Produktpalette wählen wir die passende Lösung – oder passen sie an Ihre Anforderungen an.","From our product range, we select the right solution – or customize it to your requirements.")},{step:"03",title:t("Begleiten","Support"),description:t("Von der Implementierung bis zur Skalierung stehen wir an Ihrer Seite.","From implementation to scaling, we stand by your side.")}];return d.jsxs("section",{className:"relative py-24 overflow-hidden",id:"warum-promptpeak",children:[d.jsx("div",{className:"absolute inset-0 bg-card"}),d.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-border to-transparent"}),d.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-border to-transparent"}),d.jsx("div",{className:"absolute inset-0 opacity-[0.02]",style:{backgroundImage:"radial-gradient(hsl(var(--foreground)) 1px, transparent 1px)",backgroundSize:"24px 24px"}}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[d.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-glass border border-border/50 mb-6",children:[d.jsx(QN,{className:"w-4 h-4 text-primary"}),d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:t("Seit 2015 im KI-Bereich","In the AI field since 2015")})]}),d.jsxs("h2",{className:"font-display font-bold text-4xl md:text-5xl mb-6",children:[d.jsx("span",{className:"text-foreground",children:t("Warum","Why")})," ",d.jsx("span",{className:"text-gradient-accent",children:"PromptPeak?"})]}),d.jsx("p",{className:"text-muted-foreground text-lg",children:t("Wir sind keine KI-Agentur, die auf den Trend aufgesprungen ist. Wir sind ein Team aus erfahrenen Entwicklern und Branchenexperten, das seit über zehn Jahren an der Schnittstelle von Technologie und Fachexpertise arbeitet.","We're not an AI agency that jumped on the trend. We're a team of experienced developers and industry experts who have been working at the intersection of technology and domain expertise for over a decade.")})]}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6 max-w-5xl mx-auto mb-20",children:e.map((r,i)=>d.jsxs("div",{className:"group p-6 rounded-2xl bg-glass border border-border/50 hover:border-primary/30 transition-all duration-500 animate-fade-in-up",style:{animationDelay:`${i*.1}s`},children:[d.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-primary/10 flex items-center justify-center mb-4 group-hover:scale-110 transition-transform duration-300",children:d.jsx(r.icon,{className:"w-6 h-6 text-primary"})}),d.jsx("h3",{className:"font-display font-semibold text-lg mb-2 text-foreground",children:r.title}),d.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:r.description})]},i))}),d.jsxs("div",{className:"max-w-4xl mx-auto mb-16",children:[d.jsxs("h3",{className:"font-display font-bold text-2xl md:text-3xl text-center mb-10",children:[d.jsx("span",{className:"text-foreground",children:t("Unser Ansatz:","Our Approach:")})," ",d.jsx("span",{className:"text-gradient-primary",children:t("Expertise trifft Produkt","Expertise meets Product")})]}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:n.map((r,i)=>d.jsxs("div",{className:"relative p-6 rounded-2xl bg-muted/30 border border-border/50",children:[d.jsx("div",{className:"text-4xl font-display font-bold text-primary/20 mb-4",children:r.step}),d.jsx("h4",{className:"font-semibold text-foreground text-lg mb-2",children:r.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:r.description}),i<n.length-1&&d.jsx(cn,{className:"hidden md:block absolute top-1/2 -right-3 w-6 h-6 text-muted-foreground
627/50"})]},i))})]}),d.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[d.jsx("p",{className:"text-lg text-muted-foreground mb-8",children:t("Diese Erfahrung haben wir in drei spezialisierte Produkte gegossen – jedes davon eine Antwort auf konkrete Herausforderungen unserer Kunden:","We've channeled this experience into three specialized products – each one an answer to specific challenges our clients face:")}),d.jsxs("div",{className:"flex flex-wrap justify-center gap-4",children:[d.jsx(pt,{to:"/legal",children:d.jsxs(De,{variant:"outline",className:"border-border/50 bg-glass hover:bg-muted/50",children:[d.jsx(ov,{className:"w-4 h-4 mr-2"}),t("LexVault für Compliance","LexVault for Compliance")]})}),d.jsx(pt,{to:"/kmu",children:d.jsxs(De,{variant:"outline",className:"border-border/50 bg-glass hover:bg-muted/50",children:[d.jsx(cA,{className:"w-4 h-4 mr-2"}),t("OfficePulse für KMU","OfficePulse for SMEs")]})}),d.jsx(pt,{to:"/culture",children:d.jsxs(De,{variant:"outline",className:"border-border/50 bg-glass hover:bg-muted/50",children:[d.jsx(D0,{className:"w-4 h-4 mr-2"}),t("Douplét für Kultur","Douplét for Culture")]})})]})]})]})]})};function rF(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})}const iF=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class sy extends Error{constructor(e,n="FunctionsError",r){super(e),this.name=n,this.context=r}}class sF extends sy{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class jw extends sy{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Dw extends sy{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Bp;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Bp||(Bp={}));class oF{constructor(e,{headers:n={},customFetch:r,region:i=Bp.Any}={}){this.url=e,this.headers=n,this.region=i,this.fetch=iF(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return rF(this,arguments,void 0,function*(n,r={}){var i;let s,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=r;let f={},{region:m}=r;m||(m=this.region);const b=new URL(`${this.url}/${n}`);m&&m!=="any"&&(f["x-region"]=m,b.searchParams.set("forceFunctionRegion",m));let p;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",p=c):typeof c=="string"?(f["Content-Type"]="text/plain",p=c):typeof FormData<"u"&&c instanceof FormData?p=c:(f["Content-Type"]="application/json",p=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?p=JSON.stringify(c):p=c;let g=u;h&&(o=new AbortController,s=setTimeout(()=>o.abort(),h),u?(g=o.signal,u.addEventListener("abort",()=>o.abort())):g=o.signal);const v=yield this.fetch(b.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),a),body:p,signal:g}).catch(S=>{throw new sF(S)}),y=v.headers.get("x-relay-error");if(y&&y==="true")throw new jw(v);if(!v.ok)throw new Dw(v);let w=((i=v.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),k;return w==="application/json"?k=yield v.json():w==="application/octet-stream"||w==="application/pdf"?k=yield v.blob():w==="text/event-stream"?k=v:w==="multipart/form-data"?k=yield v.formData():k=yield v.text(),{data:k,error:null,response:v}}catch(a){return{data:null,error:a,response:a instanceof Dw||a instanceof jw?a.context:void 0}}finally{s&&clearTimeout(s)}})}}
627var aF=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}},lF=class{constructor(t){var e,n,r;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(n=t.isMaybeSingle)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(r=t.urlLengthLimit)!==null&&r!==void 0?r:8e3,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var n=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const r=this.fetch;let i=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{let o=null,a=null,l=null,c=s.status,u=s.statusText;if(s.ok){var h,f;if(n.method!=="HEAD"){var m;const v=await s.text();v===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((m=n.headers.get("Accept"))===null||m===void 0)&&m.includes("application/vnd.pgrst.plan+text"))?a=v:a=JSON.parse(v))}const p=(h=n.headers.get("Prefer"))===null||h===void 0?void 0:h.match(/count=(exact|planned|estimated)/),g=(f=s.headers.get("content-range"))===null||f===void 0?void 0:f.split("/");p&&g&&g.length>1&&(l=parseInt(g[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(a)&&(a.length>1?(o={code:"PGRST116",details:`Results contain ${a.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},a=null,l=null,c=406,u="Not Acceptable"):a.length===1?a=a[0]:a=null)}else{var b;const p=await s.text();try{o=JSON.parse(p),Array.isArray(o)&&s.status===404&&(a=[],o=null,c=200,u="OK")}catch{s.status===404&&p===""?(c=204,u="No Content"):o={message:p}}if(o&&n.isMaybeSingle&&(!(o==null||(b=o.details)===null||b===void 0)&&b.includes("0 rows"))&&(o=null,c=200,u="OK"),o&&n.shouldThrowOnError)throw new aF(o)}return{error:o,data:a,count:l,status:c,statusText:u}});return this.shouldThrowOnError||(i=i.catch(s=>{var o;let a="",l="",c="";const u=s==null?void 0:s.cause;if(u){var h,f,m,b;const v=(h=u==null?void 0:u.message)!==null&&h!==void 0?h:"",y=(f=u==null?void 0:u.code)!==null&&f!==void 0?f:"";a=`${(m=s==null?void 0:s.name)!==null&&m!==void 0?m:"FetchError"}: ${s==null?void 0:s.message}`,a+=`
628
629Caused by: ${(b=u==null?void 0:u.name)!==null&&b!==void 0?b:"Error"}: ${v}`,y&&(a+=` (${y})`),u!=null&&u.stack&&(a+=`
630${u.stack}`)}else{var p;a=(p=s==null?void 0:s.stack)!==null&&p!==void 0?p:""}const g=this.url.toString().length;return(s==null?void 0:s.name)==="AbortError"||(s==null?void 0:s.code)==="ABORT_ERR"?(c="",l="Request was aborted (timeout or manual cancellation)",g>this.urlLengthLimit&&(l+=`. Note: Your request URL is ${g} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((u==null?void 0:u.name)==="HeadersOverflowError"||(u==null?void 0:u.code)==="UND_ERR_HEADERS_OVERFLOW")&&(c="",l="HTTP headers exceeded server limits (typically 16KB)",g>this.urlLengthLimit&&(l+=`. Your request URL is ${g} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${(o=s==null?void 0:s.name)!==null&&o!==void 0?o:"FetchError"}: ${s==null?void 0:s.message}`,details:a,hint:l,code:c},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}returns(){return this}overrideTypes(){return this}},cF=class extends lF{select(t){let e=!1;const n=(t??"*").split("").map(r=>/\s/.test(r)&&!e?"":(r==='"'&&(e=!e),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:n,foreignTable:r,referencedTable:i=r}={}){const s=i?`${i}.order`:"order",o=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:n=e}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${t}`),this}range(t,e,{foreignTable:n,referencedTable:r=n}={}){const i=typeof r>"u"?"offset":`${r}.offset`,s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(s,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
630explain({analyze:t=!1,verbose:e=!1,settings:n=!1,buffers:r=!1,wal:i=!1,format:s="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,n?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${l}"; options=${a};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const Lw=new RegExp("[,()]");var fo=class extends cF{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const n=Array.from(new Set(e)).map(r=>typeof r=="string"&&Lw.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`in.(${n})`),this}notIn(t,e){const n=Array.from(new Set(e)).map(r=>typeof r=="string"&&Lw.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`not.in.(${n})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:n,type:r}={}){let i="";r==="plain"?i="pl":r==="phrase"?i="ph":r==="websearch"&&(i="w");const s=n===void 0?"":`(${n})`;return this.url.searchParams.append(t,`${i}fts${s}.${e}`),this}match(t){return Object.entries(t).forEach(([e,n])=>{this.url.searchParams.append(e,`eq.${n}`)}),this}not(t,e,n){return this.url.searchParams.append(t,`not.${e}.${n}`),this}or(t,{foreignTable:e,referencedTable:n=e}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${t})`),this}filter(t,e,n){return this.url.searchParams.append(t,`${e}.${n}`),this}},uF=class{constructor(t,{headers:e={},schema:n,fetch:r,urlLengthLimit:i=8e3}){this.url=t,this.headers=new Headers(e),this.schema=n,this.fetch=r,this.urlLengthLimit=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:n=!1,count:r}=e??{},i=n?"HEAD":"GET";let s=!1;const o=(t??"*").split("").map(c=>/\s/.test(c)&&!s?"":(c==='"'&&(s=!s),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),r&&l.append("Prefer",`count=${r}`),new fo({method:i,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(t,{count:e,defaultToNull:n=!0}={}){var r;const i="POST",{url:s,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),n||o.append("Prefer","missing=default"),Array.isArray(t)){const a=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>
6300){const l=[...new Set(a)].map(c=>`"${c}"`);s.searchParams.set("columns",l.join(","))}}return new fo({method:i,url:s,headers:o,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(t,{onConflict:e,ignoreDuplicates:n=!1,count:r,defaultToNull:i=!0}={}){var s;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),r&&l.append("Prefer",`count=${r}`),i||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new fo({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit})}update(t,{count:e}={}){var n;const r="PATCH",{url:i,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new fo({method:r,url:i,headers:s,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:t}={}){var e;const n="DELETE",{url:r,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new fo({method:n,url:r,headers:i,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit})}};function Zl(t){"@babel/helpers - typeof";return Zl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zl(t)}function dF(t,e){if(Zl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(Zl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hF(t){var e=dF(t,"string");return Zl(e)=="symbol"?e:e+""}function fF(t,e,n){return(e=hF(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Uw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Gc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Uw(Object(n),!0).forEach(function(r){fF(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Uw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var mF=class KE{constructor(e,{headers:n={},schema:r,fetch:i,timeout:s,urlLengthLimit:o=8e3}={}){this.url=e,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=o;const a=i??globalThis.fetch;s!==void 0&&s>0?this.fetch=(l,c)=>{const u=new AbortController,h=setTimeout(()=>u.abort(),s),f=c==null?void 0:c.signal;if(f){if(f.aborted)return clearTimeout(h),a(l,c);const m=()=>{clearTimeout(h),u.abort()};return f.addEventListener("abort",m,{once:!0}),a(l,Gc(Gc({},c),{},{signal:u.signal})).finally(()=>{clearTimeout(h),f.removeEventListener("abort",m)})}return a(l,Gc(Gc({},c),{},{signal:u.signal})).finally(()=>clearTimeout(h))}:this.fetch=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new uF(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(e){return new KE(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(e,n={},{head:r=!1,get:i=!1,count:s}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=m=>m!==null&&typeof m=="object"&&(!Array.isArray(m)||m.some(u)),h=r&&Object.values(n).some(u);h?(a="POST",c=n):r||i?(a=r?"HEAD":"GET",Object.entries(n).filter(([m,b])=>b!==void 0).map(([m,b])=>[m,Array.isArray(b)?`{${b.join(",")}}`:`${b}
630`]).forEach(([m,b])=>{l.searchParams.append(m,b)})):(a="POST",c=n);const f=new Headers(this.headers);return h?f.set("Prefer",s?`count=${s},return=minimal`:"return=minimal"):s&&f.set("Prefer",`count=${s}`),new fo({method:a,url:l,headers:f,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit})}};class pF{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const r=n.versions;if(r&&r.node){const i=r.node,s=parseInt(i.replace(/^v/,"").split(".")[0]);return s>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${s} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${s} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
631import ws from "ws"
632new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=`
633
634Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const r=this.getWebSocketConstructor();return new r(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const gF="2.98.0",vF=`realtime-js/${gF}`,yF="1.0.0",GE="2.0.0",Fw=GE,zp=1e4,bF=1e3,wF=100;var fi;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(fi||(fi={}));var ct;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(ct||(ct={}));var zn;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(zn||(zn={}));var $p;(function(t){t.websocket="websocket"})($p||($p={}));var fs;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(fs||(fs={}));class xF{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,n){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var n;return this._isArrayBuffer((n=e.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var n,r;const i=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,i)}_encodeJsonUserBroadcastPush(e){var n,r;const i=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,n,r){var i,s;const o=e.topic,a=(i=e.ref)!==null&&i!==void 0?i:"",l=(s=e.join_ref)!==null&&s!==void 0?s:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,m=new ArrayBuffer(this.HEADER_LENGTH+f);let b=new DataView(m),p=0;b.setUint8(p++,this.KINDS.userBroadcastPush),b.setUint8(p++,l.length),b.setUint8(p++,a.length),b.setUint8(p++,o.length),b.setUint8(p++,c.length),b.setUint8(p++,h.length),b.setUint8(p++,n),Array.from(l,v=>b.setUint8(p++,v.charCodeAt(0))),Array.from(a,v=>b.setUint8(p++,v.charCodeAt(0))),Array.from(o,v=>b.setUint8(p++,v.charCodeAt(0))),Array.from(c,v=>b.setUint8(p++,v.charCodeAt(0))),Array.from(h,v=>b.setUint8(p++,v.charCodeAt(0)));var g=new Uint8Array(m.byteLength+r.byteLength);return g.set(new Uint8Array(m),0),g.set(new Uint8Array(r),m.byteLength),g.buffer}decode(e,n){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return n(r)}if(typeof e=="string"){const r=JSON.parse(e),[i,s,o,a,l]=r;
634return n({join_ref:i,ref:s,topic:o,event:a,payload:l})}return n({})}_binaryDecode(e){const n=new DataView(e),r=n.getUint8(0),i=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,n,i)}}_decodeUserBroadcast(e,n,r){const i=n.getUint8(1),s=n.getUint8(2),o=n.getUint8(3),a=n.getUint8(4);let l=this.HEADER_LENGTH+4;const c=r.decode(e.slice(l,l+i));l=l+i;const u=r.decode(e.slice(l,l+s));l=l+s;const h=r.decode(e.slice(l,l+o));l=l+o;const f=e.slice(l,e.byteLength),m=a===this.JSON_ENCODING?JSON.parse(r.decode(f)):f,b={type:this.BROADCAST_EVENT,event:u,payload:m};return o>0&&(b.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(e){var n;return e instanceof ArrayBuffer||((n=e==null?void 0:e.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(e,n){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>n.includes(r)))}}class JE{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Me;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Me||(Me={}));const Bw=(t,e,n={})=>{var r;const i=(r=n.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((s,o)=>(s[o]=kF(o,t,e,i),s),{}):{}},kF=(t,e,n,r)=>{const i=e.find(a=>a.name===t),s=i==null?void 0:i.type,o=n[t];return s&&!r.includes(s)?YE(s,o):Vp(o)},YE=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return EF(e,n)}switch(t){case Me.bool:return SF(e);case Me.float4:case Me.float8:case Me.int2:case Me.int4:case Me.int8:case Me.numeric:case Me.oid:return TF(e);case Me.json:case Me.jsonb:return CF(e);case Me.timestamp:return _F(e);case Me.abstime:case Me.date:case Me.daterange:case Me.int4range:case Me.int8range:case Me.money:case Me.reltime:case Me.text:case Me.time:case Me.timestamptz:case Me.timetz:case Me.tsrange:case Me.tstzrange:return Vp(e);default:return Vp(e)}},Vp=t=>t,SF=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},TF=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},CF=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},EF=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,r=t[n];if(t[0]==="{"&&r==="}"){let s;const o=t.slice(1,n);try{s=JSON.parse("["+o+"]")}catch{s=o?o.split(","):[]}return s.map(a=>YE(e,a))}return t},_F=t=>typeof t=="string"?t.replace(" ","T"):t,QE=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class Mf{constructor(e,n,r={},i=zp){this.channel=e,this.event=n,this.payload=r,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var r;return this._hasReceived(e)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHo
634oks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var zw;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(zw||(zw={}));class wl{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},i=>{const{onJoin:s,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=wl.syncState(this.state,i,s,o),this.pendingDiffs.forEach(l=>{this.state=wl.syncDiff(this.state,l,s,o)}),this.pendingDiffs=[],a()}),this.channel._on(r.diff,{},i=>{const{onJoin:s,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=wl.syncDiff(this.state,i,s,o),a())}),this.onJoin((i,s,o)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:o})}),this.onLeave((i,s,o)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,r,i){const s=this.cloneDeep(e),o=this.transformState(n),a={},l={};return this.map(s,(c,u)=>{o[c]||(l[c]=u)}),this.map(o,(c,u)=>{const h=s[c];if(h){const f=u.map(g=>g.presence_ref),m=h.map(g=>g.presence_ref),b=u.filter(g=>m.indexOf(g.presence_ref)<0),p=h.filter(g=>f.indexOf(g.presence_ref)<0);b.length>0&&(a[c]=b),p.length>0&&(l[c]=p)}else a[c]=u}),this.syncDiff(s,{joins:a,leaves:l},r,i)}static syncDiff(e,n,r,i){const{joins:s,leaves:o}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(s,(a,l)=>{var c;const u=(c=e[a])!==null&&c!==void 0?c:[];if(e[a]=this.cloneDeep(l),u.length>0){const h=e[a].map(m=>m.presence_ref),f=u.filter(m=>h.indexOf(m.presence_ref)<0);e[a].unshift(...f)}r(a,u,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;const u=l.map(h=>h.presence_ref);c=c.filter(h=>u.indexOf(h.presence_ref)<0),e[a]=c,i(a,c,l),c.length===0&&delete e[a]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(r=>n(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,r)=>{const i=e[r];return"metas"in i?n[r]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):n[r]=i,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var $w;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})($w||($w={}));var xl;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(xl||(xl={}));var Nr;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Nr||(Nr={}));class No{constructor(e,n={config:{}},r){var i,s;if(this.topic=e,this.params=n,this.socket=r,this.bindings={},this.state=ct.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new Mf(this,zn.join,this.params,this.timeout),this.rejoinTimer=new JE(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ct.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=ct.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=ct.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ct.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=ct.errored,this.rejoinTimer.scheduleTimeout())}),this._on(zn.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new wl(this),this.broadcastEndpointURL=QE(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var r,i,s;if(this.socket.isConnected()||this.socket.connect(),this.state==ct.closed){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(i=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(m=>m.filter))!==null&&i!==void 0?i:[],u=!!this.bindings[xl.PRESENCE]&&this.bindings[xl.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,h={},f={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(m=>e==null?void 0:e(Nr.CHANNEL_ERROR,m)),this._onClose(()=>e==null?void 0:e(Nr.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:m})=>{var b;if(this.socket._isManualToken()||this.socket.setAuth(),m===void 0){e==null||e(Nr.SUBSCRIBED);return}else{const p=this.bindings.postgres_changes,g=(b=p==null?void 0:p.length)!==null&&b!==void 0?b:0,v=[];for(let y=0;y<g;y++){const w=p[y],{filter:{event:k,schema:S,table:T,filter:C}}=w,_=m&&m[y];if(_&&_.event===k&&No.isFilterValueEqual(_.schema,S)&&No.isFilterValueEqual(_.table,T)&&No.isFilterValueEqual(_.filter,C))v.push(Object.assign(Object.assign({},w),{id:_.id}));else{this.unsubscribe(),this.state=ct.errored,e==null||e(Nr.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=v,e&&e(Nr.SUBSCRIBED);return}}).receive("error",m=>{this.state=ct.errored,e==null||e(Nr.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(m).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Nr.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,r){return this.state===ct.joined&&e===xl.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,n,r)}async httpSend(e,n,r={}){var i;if(n==null)return Promise.reject("Payload is required for httpSend()");const s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:s,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(i=r.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;
634try{const c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,n={}){var r,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:o}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var o,a,l;const c=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=ct.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(zn.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(i=>{r=new Mf(this,zn.leave,{},e),r.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r==null||r.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ct.closed,this.bindings={}}async _fetchWithTimeout(e,n,r){const i=new AbortController,s=setTimeout(()=>i.abort(),r),o=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(s),o}_push(e,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new Mf(this,e,n,r);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>wF){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,r){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,r){var i,s;const o=e.toLocaleLowerCase(),{close:a,error:l,leave:c,join:u}=zn;if(r&&[a,l,c,u].indexOf(o)>=0&&r!==this._joinRef())return;let f=this._onMessage(o,n,r);if(n&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(m=>{var b,p,g;return((b=m.filter)===null||b===void 0?void 0:b.event)==="*"||((g=(p=m.filter)===null||p===void 0?void 0:p.event)===null||g===void 0?void 0:g.toLocaleLowerCase())===o}).map(m=>m.callback(f,r)):(s=this.bindings[o])===null||s===void 0||s.filter(m=>{var b,p,g,v,y,w;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in m){const k=m.id,S=(b=m.filter)===null||b===void 0?void 0:b.event;return k&&((p=n.ids)===null||p===void 0?void 0:p.includes(k))&&(S==="*"||(S==null?void 0:S.toLocaleLowerCase())===((g=n.data)===null||g===void 0?void 0:g.type.toLocaleLowerCase()))}else{const k=(y=(v=m==null?void 0:m.filter)===null||v===void 0?void 0:v.event)===null||y===void 0?void 0:y.toLocaleLowerCase();return k==="*"||k===((w=n==null?void 0:n.event)===null||w===void 0?void 0:w.toLocaleLowerCase())}else return m.type.toLocaleLowerCase()===o}).map(m=>{if(typeof f=="object"&&"ids"in f){const b=f.data,{schema:p,table:g,commit_timestamp:v,type:y,errors:w}=b;f=Object.assign(Object.assign({},{schema:p,table:g,commit_timestamp:v,eventType:y,new:{},old:{},errors:w}),this._getPayloadRecords(b))}m.callback(f,r)}
634)}_isClosed(){return this.state===ct.closed}_isJoined(){return this.state===ct.joined}_isJoining(){return this.state===ct.joining}_isLeaving(){return this.state===ct.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,r){const i=e.toLocaleLowerCase(),s={type:i,filter:n,callback:r};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,n){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===r&&No.isEqual(i.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}static isFilterValueEqual(e,n){return(e??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(zn.close,{},e)}_onError(e){this._on(zn.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ct.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Bw(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Bw(e.columns,e.old_record)),n}}const jf=()=>{},Jc={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},PF=[1e3,2e3,5e3,1e4],RF=1e4,IF=`
635  addEventListener("message", (e) => {
636    if (e.data.event === "start") {
637      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
638    }
639  });`;class NF{constructor(e,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=zp,this.transport=null,this.heartbeatIntervalMs=Jc.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=jf,this.ref=0,this.reconnectTimer=null,this.vsn=Fw,this.logger=jf,this.conn=null,this.sendBuffer=[],this.serializer=new xF,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=i=>i?(...s)=>i(...s):(...s)=>fetch(...s),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${$p.websocket}`,this.httpEndpoint=QE(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=pF.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n}
640
641To use Realtime in Node.js, you need to provide a WebSocket implementation:
642
643Option 1: Use Node.js 22+ which has native WebSocket support
644Option 2: Install and provide the "ws" package:
645
646  npm install ws
647
648  import ws from "ws"
649  const client = new RealtimeClient(url, {
650    ...options,
651    transport: ws
652  })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,r){this.logger(e,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case fi.connecting:return fs.Connecting;case fi.open:return fs.Open;case fi.closing:return fs.Closing;default:return fs.Closed}}isConnected(){return this.connectionState()===fs.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}
652channel(e,n={config:{}}){const r=`realtime:${e}`,i=this.getChannels().find(s=>s.topic===r);if(i)return i;{const s=new No(`realtime:${e}`,n,this);return this.channels.push(s),s}}push(e){const{topic:n,event:r,payload:i,ref:s}=e,o=()=>{this.encode(e,a=>{var l;(l=this.conn)===null||l===void 0||l.send(a)})};this.log("push",`${n} ${r} (${s})`,i),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(bF,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},Jc.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply"&&n.ref&&n.ref===this.pendingHeartbeatRef){const c=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error",c)}catch(u){this.log("error","error in heartbeat callback",u)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:r,event:i,payload:s,ref:o}=n,a=o?`(${o})`:"",l=s.status||"";this.log("receive",`${l} ${r} ${i} ${a}`.trim(),s),this.channels.filter(c=>c._isMember(r)).forEach(c=>c._trigger(i,s,o)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===fi.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===fi.open||this.conn.readyState===fi.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.accessTokenValue&&(this.channels.forEach(n=>{n.updateJoinPayload({access_token:this.accessTokenValue})}),this.sendBuffer=[],this.channels.forEach(n=>{n._isJoining()&&(n.joinPush.sent=!1,n.joinPush.send())})),this.flushSendBuffer()}).catch(n=>{this.log("error","error waiting for auth on connect",n),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e);try{this.heartbeatCallback("error")}catch(n){this.log("error","error in heartbeat callback",n)}}
652_triggerChanError(){this.channels.forEach(e=>e._trigger(zn.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const r=e.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${e}${r}${i}`}_workerObjectUrl(e){let n;if(e)n=e;else{const r=new Blob([IF],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n,r=!1;if(e)n=e,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(i=>{const s={access_token:n,version:vF};n&&i.updateJoinPayload(s),i.joinedOnce&&i._isJoined()&&i._push(zn.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(n)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new JE(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Jc.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,r,i,s,o,a,l,c,u,h,f,m;switch(this.transport=(n=e==null?void 0:e.transport)!==null&&n!==void 0?n:null,this.timeout=(r=e==null?void 0:e.timeout)!==null&&r!==void 0?r:zp,this.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:Jc.HEARTBEAT_INTERVAL,this.worker=(s=e==null?void 0:e.worker)!==null&&s!==void 0?s:!1,this.accessToken=(o=e==null?void 0:e.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(a=e==null?void 0:e.heartbeatCallback)!==null&&a!==void 0?a:jf,this.vsn=(l=e==null?void 0:e.vsn)!==null&&l!==void 0?l:Fw,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:b=>PF[b-1]||RF,this.vsn){case yF:this.encode=(u=e==null?void 0:e.encode)!==null&&u!==void 0?u:(b,p)=>p(JSON.stringify(b)),this.decode=(h=e==null?void 0:e.decode)!==null&&h!==void 0?h:(b,p)=>p(JSON.parse(b));break;case GE:this.encode=(f=e==null?void 0:e.encode)!==null&&f!==void 0?f:this.serializer.encode.bind(this.serializer),this.decode=(m=e==null?void 0:e.decode)!==null&&m!==void 0?m:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}var ec=class extends Error{constructor(t,e){var n;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((n=e.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function AF(t,e,n){const r=new URL(e,t);if(n)for(const[i,s]of Object.entries(n))s!==void 0&&r.searchParams.set(i,s);return r.toString()}async function OF(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function MF(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:s,headers:o}){const a=AF(t.baseUrl,r,i),l=await OF(t.auth),c=await e(a,{method:n,headers:{...s?{"Content-Type":"application/json"}:{},...l,...o},body:s?JSON.stringify(s):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),f=h&&u?JSON.parse(u):u;if(!c.ok){const m=h?f:void 0,b=m==null?void 0:m.error;
652throw new ec((b==null?void 0:b.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:b==null?void 0:b.type,icebergCode:b==null?void 0:b.code,details:m})}return{status:c.status,headers:c.headers,data:f}}}}function Yc(t){return t.join("�")}var jF=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Yc(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(t,e){const n={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Yc(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Yc(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Yc(t.namespace)}`}),!0}catch(e){if(e instanceof ec&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(n){if(n instanceof ec&&n.status===409)return;throw n}}};function ro(t){return t.join("�")}var DF=class{constructor(t,e="",n){this.client=t,this.prefix=e,this.accessDelegation=n}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ro(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${ro(t.namespace)}/tables`,body:e,headers:n})).data.metadata}async updateTable(t,e){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${ro(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ro(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ro(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ro(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(n){if(n instanceof ec&&n.status===404)return!1;throw n}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(n){if(n instanceof ec&&n.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw n}}},LF=class{constructor(t){var r;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=MF({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(r=t.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new jF(this.client,e),this.tableOps=new DF(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}
652async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},bh=class extends Error{constructor(t,e="storage",n,r){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}};function wh(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Qc=class extends bh{constructor(t,e,n,r="storage"){super(t,r,e,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},XE=class extends bh{constructor(t,e,n="storage"){super(t,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};const UF=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),FF=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Wp=t=>{if(Array.isArray(t))return t.map(n=>Wp(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,r])=>{const i=n.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=Wp(r)}),e},BF=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function tc(t){"@babel/helpers - typeof";return tc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tc(t)}function zF(t,e){if(tc(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(tc(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $F(t){var e=zF(t,"string");return tc(e)=="symbol"?e:e+""}function VF(t,e,n){return(e=$F(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Vw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ne(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Vw(Object(n),!0).forEach(function(r){VF(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Vw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}const Ww=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},WF=async(t,e,n,r)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(n!=null&&n.noResolveJson)){const i=t,s=i.status||500;if(typeof i.json=="function")i.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||s+"";e(new Qc(Ww(o),s,a,r))}).catch(()=>{if(r==="vectors"){const o=s+"";e(new Qc(i.statusText||`HTTP ${s} error`,s,o,r))}else{const o=s+"";e(new Qc(i.statusText||`HTTP ${s} error`,s,o,r))}});else{const o=s+"";e(new Qc(i.statusText||`HTTP ${s} error`,s,o,r))}}else e(new XE(Ww(t),t,r))},qF=(t,e,n,r)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||t==="HEAD"||!r?ne(ne({},i),n):(FF(r)?(i.headers=ne({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(r)):i.body=r,e!=null&&e.duplex&&(i.duplex=e.duplex),ne(ne({},i),n))};async function Ya(t,e,n,r,i,s,o){return new Promise((a,l)=>{t(n,qF(e,r,i,s)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.noResolveJson)return c;if(o==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>WF(c,l,r,o))})}function ZE(t="storage"){return{get:async(e,n,r,i)=>Ya(e,"GET",n,r,i,void 0,t),post:async(e,n,r,i,s)=>Ya(e,"POST",n,i,s,r,t),put:async(e,n,r,i,s)=>Ya(e,"PUT",n,i,s,r,t),head:async(e,n,r,i)=>Ya(e,"HEAD",n,ne(ne({},r),{},{noResolveJson:!0}),i,void 0,t),remove:async(e,n,r,i,s)=>Ya(e,"DELETE",n,i,s,r,t)}}const HF=ZE("storage"),{get:nc,post:Dn,put:qp,head:KF,remove:oy}=HF,nn=ZE("vectors");var Pa=class{constructor(t,e={},n,r="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.fetch=UF(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=ne(ne({},this.headers),{},{[t]:e}),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(wh(n))return{data:null,error:n};throw n}}},GF=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(wh(e))return{data:null,error:e};throw e}}};let e_;e_=Symbol.toStringTag;var JF=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[e_]="BlobDownloadBuilder",this.promise=null}asStream(){return new GF(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(wh(e))return{data:null,error:e};throw e}}};const YF={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},qw={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var QF=class extends Pa{constructor(t,e={},n,r){super(t,e,r,"storage"),this.bucketId=n}async uploadOrUpdate(t,e,n,r){var i=this;return i.handleOperation(async()=>{let s;const o=ne(ne({},qw),r);let a=ne(ne({},i.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;typeof Blob<"u"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",o.cacheControl),l&&s.append("metadata",i.encodeMetadata(l)),s.append("",n)):typeof FormData<"u"&&n instanceof FormData?(s=n,s.has("cacheControl")||s.append("cacheControl",o.cacheControl),l&&!s.has("metadata")&&s.append("metadata",i.encodeMetadata(l))):(s=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=i.toBase64(i.encodeMetadata(l))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!o.duplex&&(o.duplex="half")),r!=null&&r.headers&&(a=ne(ne({},a),r.headers));const c=i._removeEmptyFolders(e),u=i._getFinalPath(c),h=await(t=="PUT"?qp:Dn)(i.fetch,`${i.url}/object/${u}`,s,ne({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(t,e,n){return this.uploadOrUpdate("POST",t,e,n)}async uploadToSignedUrl(t,e,n,r){var i=this;const s=i._removeEmptyFolders(t),o=i._getFinalPath(s),a=new URL(i.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),i.handleOperation(async()=>{let l;const c=ne({upsert:qw.upsert},r),u=ne(ne({},i.headers),{"x-upsert":String(c.upsert)});return typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.append("cacheControl",c.cacheControl)):(l=n,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType),{path:s,fullPath:(await qp(i.fetch,a.toString(),l,{headers:u})).Key}})}async createSignedUploadUrl(t,e){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(t);const i=ne({},n.headers);e!=null&&e.upsert&&(i["x-upsert"]="true");const s=await Dn(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:i}),o=new URL(n.url+s.url),a=o.searchParams.get("token");if(!a)throw new bh("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}})}async update(t,e,n){return this.uploadOrUpdate("PUT",t,e,n)}async move(t,e,n){var r=this;return r.handleOperation(async()=>await Dn(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}))}async copy(t,e,n){var r=this;return r.handleOperation(async()=>({path:(await Dn(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(t,e,n){var r=this;return r.handleOperation(async()=>{let i=r._getFinalPath(t),s=await Dn(r.fetch,`${r.url}/object/sign/${i}
652`,ne({expiresIn:e},n!=null&&n.transform?{transform:n.transform}:{}),{headers:r.headers});const o=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{signedUrl:encodeURI(`${r.url}${s.signedURL}${o}`)}})}async createSignedUrls(t,e,n){var r=this;return r.handleOperation(async()=>{const i=await Dn(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:t},{headers:r.headers}),s=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return i.map(o=>ne(ne({},o),{},{signedUrl:o.signedURL?encodeURI(`${r.url}${o.signedURL}${s}`):null}))})}download(t,e,n){const r=typeof(e==null?void 0:e.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((e==null?void 0:e.transform)||{}),s=i?`?${i}`:"",o=this._getFinalPath(t),a=()=>nc(this.fetch,`${this.url}/${r}/${o}${s}`,{headers:this.headers,noResolveJson:!0},n);return new JF(a,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);return e.handleOperation(async()=>Wp(await nc(e.fetch,`${e.url}/object/info/${n}`,{headers:e.headers})))}async exists(t){var e=this;const n=e._getFinalPath(t);try{return await KF(e.fetch,`${e.url}/object/${n}`,{headers:e.headers}),{data:!0,error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(wh(r)&&r instanceof XE){const i=r.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:r}}throw r}}getPublicUrl(t,e){const n=this._getFinalPath(t),r=[],i=e!=null&&e.download?`download=${e.download===!0?"":e.download}`:"";i!==""&&r.push(i);const s=typeof(e==null?void 0:e.transform)<"u"?"render/image":"object",o=this.transformOptsToQueryString((e==null?void 0:e.transform)||{});o!==""&&r.push(o);let a=r.join("&");return a!==""&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}${a}`)}}}async remove(t){var e=this;return e.handleOperation(async()=>await oy(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,n){var r=this;return r.handleOperation(async()=>{const i=ne(ne(ne({},YF),e),{},{prefix:t||""});return await Dn(r.fetch,`${r.url}/object/list/${r.bucketId}`,i,{headers:r.headers},n)})}async listV2(t,e){var n=this;return n.handleOperation(async()=>{const r=ne({},t);return await Dn(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const XF="2.98.0",bc={"X-Client-Info":`storage-js/${XF}`};var ZF=class extends Pa{constructor(t,e={},n,r){const i=new URL(t);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase."));const s=i.href.replace(/\/$/,""),o=ne(ne({},bc),e);super(s,o,n,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const n=e.listBucketOptionsToQueryString(t);return await nc(e.fetch,`${e.url}/bucket${n}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await nc(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var n=this;return n.handleOperation(async()=>await Dn(n.fetch,`${n.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}))}async updateBucket(t,e){var n=this;return n.handleOperation(async()=>await qp(n.fetch,`${n.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await Dn(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await oy(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},eB=class extends Pa{constructor(t,e={},n){const r=t.replace(/\/$/,""),i=ne(ne({},bc),e);super(r,i,n,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Dn(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const n=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&n.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&n.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&n.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&n.set("sortOrder",t.sortOrder),t!=null&&t.search&&n.set("search",t.search);const r=n.toString(),i=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return await nc(e.fetch,i,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await oy(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!BF(t))throw new bh("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new LF({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}
652),r=this.shouldThrowOnError;return new Proxy(n,{get(i,s){const o=i[s];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(i,a),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}},tB=class extends Pa{constructor(t,e={},n){const r=t.replace(/\/$/,""),i=ne(ne({},bc),{},{"Content-Type":"application/json"},e);super(r,i,n,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var n=this;return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var n=this;return n.handleOperation(async()=>await nn.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers})||{})}},nB=class extends Pa{constructor(t,e={},n){const r=t.replace(/\/$/,""),i=ne(ne({},bc),{},{"Content-Type":"application/json"},e);super(r,i,n,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},rB=class extends Pa{constructor(t,e={},n){const r=t.replace(/\/$/,""),i=ne(ne({},bc),{},{"Content-Type":"application/json"},e);super(r,i,n,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await nn.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},iB=class extends rB{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new sB(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,n=this;return e().call(n,t)}async getBucket(t){var e=()=>super.getBucket,n=this;return e().call(n,t)}async listBuckets(t={}){var e=()=>super.listBuckets,n=this;return e().call(n,t)}async deleteBucket(t){var e=()=>super.deleteBucket,n=this;return e().call(n,t)}},sB=class extends tB{constructor(t,e,n,r){super(t,e,r),this.vectorBucketName=n}async createIndex(t){var e=()=>super.createIndex,n=this;return e().call(n,ne(ne({},t),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,n=this;return e().call(n,ne(ne({},t),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,n=this;return e().call(n,n.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,n=this;return e().call(n,n.vectorBucketName,t)}index(t){return new oB(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},oB=class extends nB{constructor(t,e,n,r,i){super(t,e,i),this.vectorBucketName=n,this.indexName=r}async putVectors(t){var e=()=>super.putVectors,n=this;return e().call(n,ne(ne({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(t){var e=()=>super.getVectors,n=this;return e().call(n,ne(ne({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,n=this;return e().call(n,ne(ne({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,n=this;return e().call(n,ne(ne({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,n=this;return e().call(n,ne(ne({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},aB=class extends ZF{constructor(t,e={},n,r){super(t,e,n,r)}from(t){return new QF(this.url,this.headers,t,this.fetch)}get vectors(){return new iB(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new eB(this.url+"/iceberg",this.headers,this.fetch)}};function xh(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}const t_="2.98.0",mo=30*1e3,Hp=3,Df=Hp*mo,lB="http://localhost:9999",cB="supabase.auth.token",uB={"X-Client-Info":`gotrue-js/${t_}`},Kp="X-Supabase-Api-Version",n_={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},dB=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,hB=10*60*1e3;
652class rc extends Error{constructor(e,n,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function Z(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class fB extends rc{constructor(e,n,r){super(e,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function mB(t){return Z(t)&&t.name==="AuthApiError"}class ms extends rc{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class Qr extends rc{constructor(e,n,r,i){super(e,r,i),this.name=n,this.status=r}}class Zt extends Qr{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Lf(t){return Z(t)&&t.name==="AuthSessionMissingError"}class io extends Qr{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Xc extends Qr{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Zc extends Qr{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function pB(t){return Z(t)&&t.name==="AuthImplicitGrantRedirectError"}class Hw extends Qr{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class gB extends Qr{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Gp extends Qr{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function Uf(t){return Z(t)&&t.name==="AuthRetryableFetchError"}class Kw extends Qr{constructor(e,n,r){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class Jp extends Qr{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Rd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Gw=` 	
653\r=`.split(""),vB=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Gw.length;e+=1)t[Gw[e].charCodeAt(0)]=-2;for(let e=0;e<Rd.length;e+=1)t[Rd[e].charCodeAt(0)]=e;return t})();function Jw(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Rd[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Rd[r]),e.queuedBits-=6}}function r_(t,e,n){const r=vB[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Yw(t){const e=[],n=o=>{e.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=o=>{wB(o,r,n)};for(let o=0;o<t.length;o+=1)r_(t.charCodeAt(o),i,s);return e.join("")}function yB(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function bB(t,e){for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>55295&&r<=56319){const i=(r-55296)*1024&65535;r=(t.charCodeAt(n+1)-56320&65535|i)+65536,n+=1}yB(r,e)}}function wB(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let r=1;r<6;r+=1)if(!(t>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function Jo(t){const e=[],n={queue:0,queuedBits:0},r=i=>{e.push(i)};for(let i=0;i<t.length;i+=1)r_(t.charCodeAt(i),n,r);return new Uint8Array(e)}function xB(t){const e=[];return bB(t,n=>e.push(n)),new Uint8Array(e)}function ys(t){const e=[],n={queue:0,queuedBits:0},r=i=>{e.push(i)};return t.forEach(i=>
653Jw(i,n,r)),Jw(null,n,r),e.join("")}function kB(t){return Math.round(Date.now()/1e3)+t}function SB(){return Symbol("auth-callback")}const yt=()=>typeof window<"u"&&typeof document<"u",ss={tested:!1,writable:!1},i_=()=>{if(!yt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ss.tested)return ss.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),ss.tested=!0,ss.writable=!0}catch{ss.tested=!0,ss.writable=!1}return ss.writable};function TB(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,s)=>{e[s]=i})}catch{}return n.searchParams.forEach((r,i)=>{e[i]=r}),e}const s_=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),CB=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",po=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},os=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},vt=async(t,e)=>{await t.removeItem(e)};class kh{constructor(){this.promise=new kh.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}kh.promiseConstructor=Promise;function eu(t){const e=t.split(".");if(e.length!==3)throw new Jp("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!dB.test(e[r]))throw new Jp("JWT not in base64url format");return{header:JSON.parse(Yw(e[0])),payload:JSON.parse(Yw(e[1])),signature:Jo(e[2]),raw:{header:e[0],payload:e[1]}}}async function EB(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function _B(t,e){return new Promise((r,i)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await t(s);if(!e(s,null,o)){r(o);return}}catch(o){if(!e(s,o)){i(o);return}}})()})}function PB(t){return("0"+t.toString(16)).substr(-2)}function RB(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let i="";for(let s=0;s<56;s++)i+=n.charAt(Math.floor(Math.random()*r));return i}return crypto.getRandomValues(e),Array.from(e,PB).join("")}async function IB(t){const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(r);return Array.from(i).map(s=>String.fromCharCode(s)).join("")}async function NB(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await IB(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function so(t,e,n=!1){const r=RB();let i=r;n&&(i+="/PASSWORD_RECOVERY"),await po(t,`${e}-code-verifier`,i);const s=await NB(r);return[s,r===s?"plain":"s256"]}const AB=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function OB(t){const e=t.headers.get(Kp);if(!e||!e.match(AB))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function MB(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function jB(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const DB=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function oo(t){if(!DB.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Ff(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function LB(t,e){return new Proxy(t,{get:(n,r,i)=>{if(r==="__isInsecureUserWarningProxy")return!0;
653if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)"||s==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,i)}return!e.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(n,r,i)}})}function Qw(t){return JSON.parse(JSON.stringify(t))}const ds=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),UB=[502,503,504];async function Xw(t){var e;if(!CB(t))throw new Gp(ds(t),0);if(UB.includes(t.status))throw new Gp(ds(t),t.status);let n;try{n=await t.json()}catch(s){throw new ms(ds(s),s)}let r;const i=OB(t);if(i&&i.getTime()>=n_["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new Kw(ds(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new Zt}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((s,o)=>s&&typeof o=="string",!0))throw new Kw(ds(n),t.status,n.weak_password.reasons);throw new fB(ds(n),t.status||500,r)}const FB=(t,e,n,r)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};async function ie(t,e,n,r){var i;const s=Object.assign({},r==null?void 0:r.headers);s[Kp]||(s[Kp]=n_["2024-01-01"].name),r!=null&&r.jwt&&(s.Authorization=`Bearer ${r.jwt}`);const o=(i=r==null?void 0:r.query)!==null&&i!==void 0?i:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await BB(t,e,n+a,{headers:s,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function BB(t,e,n,r,i,s){const o=FB(e,r,i,s);let a;try{a=await t(n,Object.assign({},o))}catch(l){throw console.error(l),new Gp(ds(l),0)}if(a.ok||await Xw(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(l){await Xw(l)}}function An(t){var e;let n=null;VB(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=kB(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:r},error:null}}function Zw(t){const e=An(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function vi(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function zB(t){return{data:t,error:null}}function $B(t){const{action_link:e,email_otp:n,hashed_token:r,redirect_to:i,verification_type:s}=t,o=xh(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:n,hashed_token:r,redirect_to:i,verification_type:s},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function ex(t){return t}function VB(t){return t.access_token&&t.refresh_token&&t.expires_in}const Bf=["global","local","others"];class WB{constructor({url:e="",headers:n={},fetch:r}){this.url=e,this.headers=n,this.fetch=s_(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=Bf[0]){if(Bf.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Bf.join(", ")}`);try{return await ie(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Z(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,n={}){try{return await ie(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:vi})}catch(r){if(Z(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:n}=e,r=xh(e,["options"]),i=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(i.new_email=r==null?void 0:r.newEmail,delete i.newEmail),await ie(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:$B,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Z(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await ie(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:vi})}catch(n){if(Z(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,r,i,s,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await ie(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:ex});if(u.error)throw u.error;const h=await u.json(),f=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return m.length>0&&(m.forEach(b=>{const p=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(b.split(";")[1].split("=")[1]);c[`${g}Page`]=p}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(Z(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){oo(e);try{return await ie(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:vi})}catch(n){if(Z(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){oo(e);try{return await ie(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:vi})}catch(r){if(Z(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,n=!1){oo(e);
653try{return await ie(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:vi})}catch(r){if(Z(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){oo(e.userId);try{const{data:n,error:r}=await ie(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:r}}catch(n){if(Z(n))return{data:null,error:n};throw n}}async _deleteFactor(e){oo(e.userId),oo(e.id);try{return{data:await ie(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(Z(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,r,i,s,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await ie(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:ex});if(u.error)throw u.error;const h=await u.json(),f=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return m.length>0&&(m.forEach(b=>{const p=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),g=JSON.parse(b.split(";")[1].split("=")[1]);c[`${g}Page`]=p}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(Z(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await ie(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Z(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await ie(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Z(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await ie(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Z(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await ie(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Z(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await ie(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Z(n))return{data:null,error:n};throw n}}}function tx(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const _r={debug:!!(globalThis&&i_()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class o_ extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class qB extends o_{}async function HB(t,e,n){_r.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;e>0&&setTimeout(()=>{r.abort(),_r.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async i=>{if(i){_r.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await n()}finally{_r.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw _r.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new qB(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(_r.debug)try{const s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null,"  "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}})}catch(i){if((i==null?void 0:i.name)==="AbortError"&&e>0)return _r.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@
653supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async s=>{if(s){_r.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,s.name);try{return await n()}finally{_r.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,s.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await n()}));throw i}}function KB(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function a_(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function GB(t){return parseInt(t,16)}function JB(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function YB(t){var e;const{chainId:n,domain:r,expirationTime:i,issuedAt:s=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:f}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
654`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const m=a_(t.address),b=u?`${u}://${r}`:r,p=t.statement?`${t.statement}
655`:"",g=`${b} wants you to sign in with your Ethereum account:
656${m}
657
658${p}`;let v=`URI: ${h}
659Version: ${f}
660Chain ID: ${n}${o?`
661Nonce: ${o}`:""}
662Issued At: ${s.toISOString()}`;if(i&&(v+=`
663Expiration Time: ${i.toISOString()}`),a&&(v+=`
664Not Before: ${a.toISOString()}`),l&&(v+=`
665Request ID: ${l}`),c){let y=`
666Resources:`;for(const w of c){if(!w||typeof w!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${w}`);y+=`
667- ${w}`}v+=y}return`${g}
668${v}`}class st extends Error{constructor({message:e,code:n,cause:r,name:i}){var s;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(s=i??(r instanceof Error?r.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=n}}class Id extends st{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function QB({error:t,options:e}){var n,r,i;const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new st({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=s.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new st({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=s.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new st({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new st({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new st({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new st({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new st({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new st({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(l_(o)){if(s.rp.id!==o)return new st({message:`The RP ID "${s.rp.id}
668" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new st({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new st({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new st({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new st({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function XB({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new st({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new st({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(l_(r)){if(n.rpId!==r)return new st({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new st({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new st({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new st({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class ZB{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const e5=new ZB;function t5(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:r}=t,i=xh(t,["challenge","user","excludeCredentials"]),s=Jo(e).buffer,o=Object.assign(Object.assign({},n),{id:Jo(n.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:s,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Jo(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function n5(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,r=xh(t,["challenge","allowCredentials"]),i=Jo(e).buffer,s=Object.assign(Object.assign({},r),{challenge:i});if(n&&n.length>0){s.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const a=n[o];s.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Jo(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return s}function r5(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:ys(new Uint8Array(t.response.attestationObject)),clientDataJSON:ys(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function i5(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,r=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:ys(new Uint8Array(i.authenticatorData)),clientDataJSON:ys(new Uint8Array(i.clientDataJSON)),signature:ys(new Uint8Array(i.signature)),userHandle:i.userHandle?ys(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function l_(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function nx(){var t,e;return!!(yt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function s5(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Id("Browser returned unexpected credential type",e)}:{data:null,error:new Id("Empty credential response",e)}}catch(e){return{data:null,error:QB({error:e,options:t})}}}async function o5(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Id("Browser returned unexpected credential type",e)}:{data:null,error:new Id("Empty credential response",e)}}catch(e){return{data:null,error:XB({error:e,options:t})}}}const a5={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},l5={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Nd(...t){const e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),n=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),r={};for(const i of t)if(i)for(const s in i){const o=i[s];if(o!==void 0)if(Array.isArray(o))r[s]=o;else if(n(o))r[s]=o;else if(e(o)){const a=r[s];e(a)?r[s]=Nd(a,o):r[s]=Nd(o)}else r[s]=o}return r}function c5(t,e){return Nd(a5,t,e||{})}function u5(t,e){return Nd(l5,t,e||{})}class d5{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:r,signal:i},s){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!a)return{data:null,error:l};const c=i??e5.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=r;if(h)u.name=`${u.id}:${h}`;else{const m=(await this.client.getUser()).data.user,b=((o=m==null?void 0:m.user_metadata)===null||o===void 0?void 0:o.name)||(m==null?void 0:m.email)||(m==null?void 0:m.id)||"User";u.name=`${u.id}:${b}`}}u.displayName||(u.displayName=u.name)}
668switch(a.webauthn.type){case"create":{const u=c5(a.webauthn.credential_options.publicKey,s==null?void 0:s.create),{data:h,error:f}=await s5({publicKey:u,signal:c});return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}case"request":{const u=u5(a.webauthn.credential_options.publicKey,s==null?void 0:s.request),{data:h,error:f}=await o5(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}}}catch(a){return Z(a)?{data:null,error:a}:{data:null,error:new ms("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!n)return{data:null,error:new rc("rpId is required for WebAuthn authentication")};try{if(!nx())return{data:null,error:new ms("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:r},signal:i},{request:s});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(o){return Z(o)?{data:null,error:o}:{data:null,error:new ms("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!n)return{data:null,error:new rc("rpId is required for WebAuthn registration")};try{if(!nx())return{data:null,error:new ms("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===e&&f.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:i},{create:s});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return Z(o)?{data:null,error:o}:{data:null,error:new ms("Unexpected error in register",o)}}}}KB();const h5={url:lB,storageKey:cB,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:uB,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1};async function rx(t,e,n){return await n()}const ao={};class ic{get jwks(){var e,n;return(n=(e=ao[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){ao[this.storageKey]=Object.assign(Object.assign({},ao[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=ao[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){ao[this.storageKey]=Object.assign(Object.assign({},ao[this.storageKey]),{cachedAt:e})}constructor(e){var n,r,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const s=Object.assign(Object.assign({},h5),e);if(this.storageKey=s.storageKey,this.instanceID=(n=ic.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,ic.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&yt()){const o=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new WB({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=s_(s.fetch),this.lock=s.lock||rx,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,this.lockAcquireTimeout=s.lockAcquireTimeout,s.lock?this.lock=s.lock:this.persistSession&&yt()&&
668(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=HB:this.lock=rx,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new d5(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:i_()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=tx(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=tx(this.memoryStorage)),yt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(a){this._debug("#broadcastChannel","error",a)}})}s.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${t_}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let n={},r="none";if(yt()&&(n=TB(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),yt()&&this.detectSessionInUrl&&r!=="none"){const{data:i,error:s}=await this._getSessionFromURL(n,r);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),pB(s)){const l=(e=s.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:s}}return{error:s}}const{session:o,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Z(n)?this._returnResult({error:n}):this._returnResult({error:new ms("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,r,i;try{const s=await ie(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:An}),{data:o,error:a}=s;
668if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(Z(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var n,r,i;try{let s;if("email"in e){const{email:u,password:h,options:f}=e;let m=null,b=null;this.flowType==="pkce"&&([m,b]=await so(this.storage,this.storageKey)),s=await ie(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:u,password:h,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:m,code_challenge_method:b},xform:An})}else if("phone"in e){const{phone:u,password:h,options:f}=e;s=await ie(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},channel:(i=f==null?void 0:f.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:An})}else throw new Xc("You must provide either an email or phone number and a password");const{data:o,error:a}=s;
668if(a||!o)return await vt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(await vt(this.storage,`${this.storageKey}-code-verifier`),Z(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let n;if("email"in e){const{email:s,password:o,options:a}=e;n=await ie(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Zw})}else if("phone"in e){const{phone:s,password:o,options:a}=e;n=await ie(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Zw})}else throw new Xc("You must provide either an email or phone number and a password");const{data:r,error:i}=n;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!r||!r.session||!r.user){const s=new io;return this._returnResult({data:{user:null,session:null},error:s})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:i})}catch(n){if(Z(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(e){var n,r,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,r,i,s,o,a,l,c,u,h,f;let m,b;if("message"in e)m=e.message,b=e.signature;else{const{chain:p,wallet:g,statement:v,options:y}=e;let w;if(yt())if(typeof g=="object")w=g;else{const P=window;if("ethereum"in P&&typeof P.ethereum=="object"&&"request"in P.ethereum&&typeof P.ethereum.request=="function")w=P.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof g!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=g}const k=new URL((n=y==null?void 0:y.url)!==null&&n!==void 0?n:window.location.href),S=await w.request({method:"eth_requestAccounts"}).then(P=>P).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!S||S.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const T=a_(S[0]);let C=(r=y==null?void 0:y.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!C){const P=await w.request({method:"eth_chainId"});C=GB(P)}const _={domain:k.host,address:T,statement:v,uri:k.href,version:"1",chainId:C,nonce:(i=y==null?void 0:y.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(o=(s=y==null?void 0:y.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=y==null?void 0:y.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=y==null?void 0:y.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=y==null?void 0:y.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=y==null?void 0:y.signInWithEthereum)===null||u===void 0?void 0:u.resources};m=YB(_),b=await w.request({method:"personal_sign",params:[JB(m),T]})}try{const{data:p,error:g}=await ie(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:m,signature:b}
668,!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:An});if(g)throw g;if(!p||!p.session||!p.user){const v=new io;return this._returnResult({data:{user:null,session:null},error:v})}return p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("SIGNED_IN",p.session)),this._returnResult({data:Object.assign({},p),error:g})}catch(p){if(Z(p))return this._returnResult({data:{user:null,session:null},error:p});throw p}}async signInWithSolana(e){var n,r,i,s,o,a,l,c,u,h,f,m;let b,p;if("message"in e)b=e.message,p=e.signature;else{const{chain:g,wallet:v,statement:y,options:w}=e;let k;if(yt())if(typeof v=="object")k=v;else{const T=window;if("solana"in T&&typeof T.solana=="object"&&("signIn"in T.solana&&typeof T.solana.signIn=="function"||"signMessage"in T.solana&&typeof T.solana.signMessage=="function"))k=T.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof v!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=v}const S=new URL((n=w==null?void 0:w.url)!==null&&n!==void 0?n:window.location.href);
668if("signIn"in k&&k.signIn){const T=await k.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:S.host,uri:S.href}),y?{statement:y}:null));let C;if(Array.isArray(T)&&T[0]&&typeof T[0]=="object")C=T[0];else if(T&&typeof T=="object"&&"signedMessage"in T&&"signature"in T)C=T;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in C&&"signature"in C&&(typeof C.signedMessage=="string"||C.signedMessage instanceof Uint8Array)&&C.signature instanceof Uint8Array)b=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),p=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in k)||typeof k.signMessage!="function"||!("publicKey"in k)||typeof k!="object"||!k.publicKey||!("toBase58"in k.publicKey)||typeof k.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${S.host} wants you to sign in with your Solana account:`,k.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${S.href}`,`Issued At: ${(i=(r=w==null?void 0:w.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=w==null?void 0:w.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((o=w==null?void 0:w.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((a=w==null?void 0:w.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((h=(u=w==null?void 0:w.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...w.signInWithSolana.resources.map(C=>`- ${C}`)]:[]].join(`
669`);const T=await k.signMessage(new TextEncoder().encode(b),"utf8");if(!T||!(T instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=T}}try{const{data:g,error:v}=await ie(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:ys(p)},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(m=e.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:An});if(v)throw v;if(!g||!g.session||!g.user){const y=new io;return this._returnResult({data:{user:null,session:null},error:y})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:v})}catch(g){if(Z(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async _exchangeCodeForSession(e){const n=await os(this.storage,`${this.storageKey}-code-verifier`),[r,i]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new gB;const{data:s,error:o}=await ie(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:An});if(await vt(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!s||!s.session||!s.user){const a=new io;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:o})}catch(s){if(await vt(this.storage,`${this.storageKey}-code-verifier`),Z(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{const{options:n,provider:r,token:i,access_token:s,nonce:o}=e,a=await ie(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:s,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:An}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new io;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(n){if(Z(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(e){var n,r,i,s,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await so(this.storage,this.storageKey));const{error:h}=await ie(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:a,options:l}=e,{data:c,error:u}=await ie(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=l==null?void 0:l.data)!==null&&i!==void 0?i:{},create_user:(s=l==null?void 0:l.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new Xc("You must provide either an email or phone number.")}catch(a){if(await vt(this.storage,`${this.storageKey}-code-verifier`),Z(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var n,r;try{let i,s;"options"in e&&(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo,s=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await ie(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:An});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(Z(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var n,r,i,s,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await so(this.storage,this.storageKey));const c=await ie(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:zB});return!((s=c.data)===null||s===void 0)&&s.url&&yt()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await vt(this.storage,`${this.storageKey}-code-verifier`),Z(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)throw r;if(!n)throw new Zt;const{error:i}=await ie(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if(Z(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:r,type:i,options:s}=e,{error:o}=await ie(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},redirectTo:s==null?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){const{phone:r,type:i,options:s}=e,{data:o,error:a}=await ie(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a})}throw new Xc("You must provide either an email or phone number and a type")}catch(n){if(Z(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await os(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not val
669id"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<Df:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const o=await os(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Ff()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=LB(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(e){try{return e?await ie(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:vi}):await this._useSession(async n=>{var r,i,s;const{data:o,error:a}=n;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Zt}:await ie(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:vi})})}catch(n){if(Z(n))return Lf(n)&&(await this._removeSession(),await vt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async r=>{const{data:i,error:s}=r;if(s)throw s;if(!i.session)throw new Zt;const o=i.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await so(this.storage,this.storageKey));const{data:c,error:u}=await ie(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:vi});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(r){if(await vt(this.storage,`${this.storageKey}-code-verifier`),Z(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Zt;const n=Date.now()/1e3;let r=n,i=!0,s=null;const{payload:o}=eu(e.access_token);if(o.exp&&(r=o.exp,i=r<=n),i){const{data:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};s=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});s={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(n){if(Z(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var r;if(!e){const{data:o,error:a}=n;if(a)throw a;e=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new Zt;const{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(Z(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(e,n){try{if(!yt())throw new Zc("No browser detected.");
669if(e.error||e.error_description||e.error_code)throw new Zc(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Hw("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Zc("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Hw("No code detected.");const{data:y,error:w}=await this._exchangeCodeForSession(e.code);if(w)throw w;const k=new URL(window.location.href);return k.searchParams.delete("code"),window.history.replaceState(window.history.state,"",k.toString()),{data:{session:y.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:s,refresh_token:o,expires_in:a,expires_at:l,token_type:c}=e;if(!s||!a||!o||!c)throw new Zc("No session defined in URL");const u=Math.round(Date.now()/1e3),h=parseInt(a);let f=u+h;l&&(f=parseInt(l));const m=f-u;m*1e3<=mo&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${h}s`);const b=f-h;u-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,f,u):u-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,f,u);const{data:p,error:g}=await this._getUser(s);if(g)throw g;const v={provider_token:r,provider_refresh_token:i,access_token:s,expires_in:h,expires_at:f,refresh_token:o,token_type:c,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:v,redirectType:e.type},error:null})}catch(r){if(Z(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await os(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s&&!Lf(s))return this._returnResult({error:s});const o=(r=i.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(mB(a)&&(a.status===404||a.status===401||a.status===403)||Lf(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await vt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const n=SB(),r={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async n=>{var r,i;try{const{data:{session:s},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,n={}){let r=null,i=null;this.flowType==="pkce"&&([r,i]=await so(this.storage,this.storageKey,!0));try{return await ie(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(s){if(await vt(this.storage,`${this.storageKey}-code-verifier`),Z(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(n){if(Z(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:r,error:i}=await this._useSession(async s=>{var o,a,l,c,u;const{data:h,error:f}=s;if(f)throw f;const m=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await ie(this.fetch,"GET",m,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(i)throw i;return yt()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:e.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(Z(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var r;try{const{error:i,data:{session:s}}=n;
669if(i)throw i;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,h=await ie(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=s==null?void 0:s.access_token)!==null&&r!==void 0?r:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:An}),{data:f,error:m}=h;return m?this._returnResult({data:{user:null,session:null},error:m}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new io}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:m}))}catch(i){if(await vt(this.storage,`${this.storageKey}-code-verifier`),Z(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var r,i;const{data:s,error:o}=n;if(o)throw o;return await ie(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(Z(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await _B(async i=>(i>0&&await EB(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await ie(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:An})),(i,s)=>{const o=200*Math.pow(2,i);return s&&Uf(s)&&Date.now()+o-r<mo})}catch(r){if(this._debug(n,"error",r),Z(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",r),yt()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const i=await os(this.storage,this.storageKey);if(i&&this.userStorage){let o=await os(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await po(this.userStorage,this.storageKey+"-user",o)),i.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Ff()}else if(i&&!i.user&&!i.user){const o=await os(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(i.user=o.user,await vt(this.storage,this.storageKey+"-user"),await po(this.storage,this.storageKey,i)):i.user=Ff()}if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),i!==null&&await this._removeSession();return}const s=((n=i.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<Df;if(this._debug(r,`session has${s?"":" not"} expired with margin of ${Df}s`),s){if(this.autoRefreshToken&&i.refresh_token){const{error:o}=await this._callRefreshToken(i.refresh_token);o&&(console.error(o),Uf(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(i.access_token);!a&&(o!=null&&o.user)?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(r,"error",i),console.error(i);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var n,r;if(!e)throw new Zt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new kh;const{data:s,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!s.session)throw new Zt;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);const a={data:s.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(s){if(this._debug(i,"error",s),Z(s)){const o={data:null,error:s};return Uf(s)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,n,r=!0){const i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:n});const s=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,n)}catch(l){s.push(l)}});if(await Promise.all(o),s.length>0){for(let a=0;a<s.length;a+=1)console.error(s[a]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await vt(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},e),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await po(this.userStorage,this.storageKey+"-user",{user:n.user});const i=Object.assign({},n);delete i.user;const s=Qw(i);await po(this.storage,this.storageKey,s)}else{const i=Qw(n);await po(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await vt(this.storage,this.storageKey),await vt(this.storage,this.storageKey+"-code-verifier"),await vt(this.storage,this.storageKey+"-user"),this.userStorage&&await vt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&yt()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
669catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),mo);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((r.expires_at*1e3-e)/mo);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${mo}ms, refresh threshold is ${Hp} ticks`),i<=Hp&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof o_)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!yt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,r){const i=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&i.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&i.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[s,o]=await so(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(a.toString())}if(r!=null&&r.queryParams){const s=new URLSearchParams(r.queryParams);i.push(s.toString())}return r!=null&&r.skipBrowserRedirect&&i.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;return s?this._returnResult({data:null,error:s}):await ie(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(Z(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(e){try{return await this._useSession(async n=>{var r,i;const{data:s,error:o}=n;
669if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await ie(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((i=l==null?void 0:l.totp)===null||i===void 0)&&i.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(n){if(Z(n))return this._returnResult({data:null,error:n});throw n}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({data:null,error:s});const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?r5(e.webauthn.credential_response):i5(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await ie(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(n){if(Z(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({data:null,error:s});const o=await ie(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:t5(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:n5(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Z(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(e){const{data:n,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const i={all:[],phone:[],totp:[],webauthn:[]};for(const s of(e=n==null?void 0:n.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(e){var n,r,i,s;if(e)try{const{payload:m}=eu(e);let b=null;m.aal&&(b=m.aal);let p=b;const{data:{user:g},error:v}=await this.getUser(e);if(v)return this._returnResult({data:null,error:v});((r=(n=g==null?void 0:g.factors)===null||n===void 0?void 0:n.filter(k=>k.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(p="aal2");const w=m.amr||[];return{data:{currentLevel:b,nextLevel:p,currentAuthenticationMethods:w},error:null}}catch(m){if(Z(m))return this._returnResult({data:null,error:m});throw m}const{data:{session:o},error:a}
669=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=eu(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((s=(i=o.user.factors)===null||i===void 0?void 0:i.filter(m=>m.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(u="aal2");const f=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?await ie(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Zt})})}catch(n){if(Z(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async r=>{const{data:{session:i},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new Zt});const o=await ie(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&yt()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(Z(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,n){try{return await this._useSession(async r=>{const{data:{session:i},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new Zt});const o=await ie(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&yt()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(Z(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;return r?this._returnResult({data:null,error:r}):n?await ie(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Zt})})}catch(e){if(Z(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?(await ie(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Zt})})}catch(n){if(Z(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,n={keys:[]}){let r=n.keys.find(a=>a.kid===e);if(r)return r;const i=Date.now();if(r=this.jwks.keys.find(a=>a.kid===e),r&&this.jwks_cached_at+hB>i)return r;const{data:s,error:o}=await ie(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,r=s.keys.find(a=>a.kid===e),!r)?null:r}async getClaims(e,n={}){try{let r=e;if(!r){const{data:m,error:b}
669=await this.getSession();if(b||!m.session)return this._returnResult({data:null,error:b});r=m.session.access_token}const{header:i,payload:s,signature:o,raw:{header:a,payload:l}}=eu(r);n!=null&&n.allowExpired||MB(s.exp);const c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!c){const{error:m}=await this.getUser(r);if(m)throw m;return{data:{claims:s,header:i,signature:o},error:null}}const u=jB(i.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,xB(`${a}.${l}`)))throw new Jp("Invalid JWT signature");return{data:{claims:s,header:i,signature:o},error:null}}catch(r){if(Z(r))return this._returnResult({data:null,error:r});throw r}}}ic.nextInstanceID={};const f5=ic,m5="2.98.0";let rl="";typeof Deno<"u"?rl="deno":typeof document<"u"?rl="web":typeof navigator<"u"&&navigator.product==="ReactNative"?rl="react-native":rl="node";const p5={"X-Client-Info":`supabase-js-${rl}/${m5}`},g5={headers:p5},v5={schema:"public"},y5={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b5={};function sc(t){"@babel/helpers - typeof";return sc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sc(t)}function w5(t,e){if(sc(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(sc(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function x5(t){var e=w5(t,"string");return sc(e)=="symbol"?e:e+""}function k5(t,e,n){return(e=x5(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ix(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ye(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ix(Object(n),!0).forEach(function(r){k5(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ix(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}const S5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),T5=()=>Headers,C5=(t,e,n)=>{const r=S5(n),i=T5();return async(s,o)=>{var a;const l=(a=await e())!==null&&a!==void 0?a:t;let c=new i(o==null?void 0:o.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(s,Ye(Ye({},o),{},{headers:c}))}};function E5(t){return t.endsWith("/")?t:t+"/"}function _5(t,e){var n,r;const{db:i,auth:s,realtime:o,global:a}=t,{db:l,auth:c,realtime:u,global:h}=e,f={db:Ye(Ye({},l),i),auth:Ye(Ye({},c),s),realtime:Ye(Ye({},u),o),storage:{},global:Ye(Ye(Ye({},h),a),{},{headers:Ye(Ye({},(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?f.accessToken=t.accessToken:delete f.accessToken,f}function P5(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(E5(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var R5=class extends f5{constructor(t){super(t)}},I5=class{constructor(t,e,n){var r,i;this.supabaseUrl=t,this.supabaseKey=e;const s=P5(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);const o=`sb-${s.hostname.split(".")[0]}-auth-token`,a={db:v5,realtime:b5,auth:Ye(Ye({},y5),{},{storageKey:o}),global:g5},l=_5(n??{},a);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(i=l.global.headers)!==null&&i!==void 0?i:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=C5(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Ye({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new mF(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new aB(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new oF(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,n)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,n;if(t.accessToken)return await t.accessToken();const{data:r}=await t.auth.getSession();
669return(e=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:r,userStorage:i,storageKey:s,flowType:o,lock:a,debug:l,throwOnError:c},u,h){const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new R5({url:this.authUrl.href,headers:Ye(Ye({},f),u),storageKey:s,autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:r,userStorage:i,flowType:o,lock:a,debug:l,throwOnError:c,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new NF(this.realtimeUrl.href,Ye(Ye({},t),{},{params:Ye(Ye({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const N5=(t,e,n)=>new I5(t,e,n);function A5(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const n=e.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}A5()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const O5="https://gjrchbnxpfydodwommly.supabase.co",M5="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImdqcmNoYm54cGZ5ZG9kd29tbWx5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzA3ODU4MTYsImV4cCI6MjA4NjM2MTgxNn0.5-ga8DNAxbYWYRfzl3w0KFAAO2puWze_lsHzCGXU_-I",dr=N5(O5,M5,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}});function nr(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function Bs(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const c_=6048e5,j5=864e5;let D5={};function Sh(){return D5}function oc(t,e){var a,l,c,u;const n=Sh(),r=(e==null?void 0:e.weekStartsOn)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??n.weekStartsOn??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,i=nr(t),s=i.getDay(),o=(s<r?7:0)+s-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Ad(t){return oc(t,{weekStartsOn:1})}function u_(t){const e=nr(t),n=e.getFullYear(),r=Bs(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const i=Ad(r),s=Bs(t,0);s.setFullYear(n,0,4),s.setHours(0,0,0,0);const o=Ad(s);return e.getTime()>=i.getTime()?n+1:e.getTime()>=o.getTime()?n:n-1}function sx(t){const e=nr(t);return e.setHours(0,0,0,0),e}function ox(t){const e=nr(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function L5(t,e){const n=sx(t),r=sx(e),i=+n-ox(n),s=+r-ox(r);return Math.round((i-s)/j5)}function U5(t){const e=u_(t),n=Bs(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),Ad(n)}function F5(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function B5(t){if(!F5(t)&&typeof t!="number")return!1;const e=nr(t);return!isNaN(Number(e))}function z5(t){const e=nr(t),n=Bs(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}const $5={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},V5=(t,e,n)=>{let r;const i=$5[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Yo(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const W5={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},q5={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},H5={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},K5={date:Yo({formats:W5,defaultWidth:"full"}),time:Yo({formats:q5,defaultWidth:"full"}),dateTime:Yo({formats:H5,defaultWidth:"full"})},G5={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},J5=(t,e,n,r)=>G5[t];function fr(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,a=n!=null&&n.width?String(n.width):o;i=t.formattingValues[a]||t.formattingValues[o]}else{const o=t.defaultWidth,a=n!=null&&n.width?String(n.width):t.defaultWidth;i=t.values[a]||t.values[o]}const s=t.argumentCallback?t.argumentCallback(e):e;return i[s]}}const Y5={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Q5={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},X5={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Z5={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
669ay","Saturday"]},e6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},t6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},n6=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},r6={ordinalNumber:n6,era:fr({values:Y5,defaultWidth:"wide"}),quarter:fr({values:Q5,defaultWidth:"wide",argumentCallback:t=>t-1}),month:fr({values:X5,defaultWidth:"wide"}),day:fr({values:Z5,defaultWidth:"wide"}),dayPeriod:fr({values:e6,defaultWidth:"wide",formattingValues:t6,defaultFormattingWidth:"wide"})};function mr(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],s=e.match(i);if(!s)return null;const o=s[0],a=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?s6(a,h=>h.test(o)):i6(a,h=>h.test(o));let c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=e.slice(o.length);return{value:c,rest:u}}}function i6(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function s6(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function d_(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],s=e.match(t.parsePattern);if(!s)return null;let o=t.valueCallback?t.valueCallback(s[0]):s[0];o=n.valueCallback?n.valueCallback(o):o;const a=e.slice(i.length);return{value:o,rest:a}}}const o6=/^(\d+)(th|st|nd|rd)?/i,a6=/\d+/i,l6={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},c6={any:[/^b/i,/^(a|c)/i]},u6={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},d6={any:[/1/i,/2/i,/3/i,/4/i]},h6={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},f6={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},m6={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},p6={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},g6={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},v6={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},y6={ordinalNumber:d_({matchPattern:o6,parsePattern:a6,valueCallback:t=>parseInt(t,10)}),era:mr({matchPatterns:l6,defaultMatchWidth:"wide",parsePatterns:c6,defaultParseWidth:"any"}),quarter:mr({matchPatterns:u6,defaultMatchWidth:"wide",parsePatterns:d6,defaultParseWidth:"any",valueCallback:t=>t+1}),month:mr({matchPatterns:h6,defaultMatchWidth:"wide",parsePatterns:f6,defaultParseWidth:"any"}),day:mr({matchPatterns:m6,defaultMatchWidth:"wide",parsePatterns:p6,defaultParseWidth:"any"}),dayPeriod:mr({matchPatterns:g6,defaultMatchWidth:"any",parsePatterns:v6,defaultParseWidth:"any"})},h_={code:"en-US",formatDistance:V5,formatLong:K5,formatRelative:J5,localize:r6,match:y6,options:{weekStartsOn:0,firstWeekContainsDate:1}};function b6(t){const e=nr(t);return L5(e,z5(e))+1}function w6(t){const e=nr(t),n=+Ad(e)-+U5(e);return Math.round(n/c_)+1}function f_(t,e){var u,h,f,m;const n=nr(t),r=n.getFullYear(),i=Sh(),s=(e==null?void 0:e.firstWeekContainsDate)??((h=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??i.firstWeekContainsDate??((m=(f=i.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=Bs(t,0);o.setFullYear(r+1,0,s),o.setHours(0,0,0,0);const a=oc(o,e),l=Bs(t,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const c=oc(l,e);return n.getTime()>=a.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function x6(t,e){var a,l,c,u;const n=Sh(),r=(e==null?void 0:e.firstWeekContainsDate)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??n.firstWeekContainsDate??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,i=f_(t,e),s=Bs(t,0);return s.setFullYear(i,0,r),s.setHours(0,0,0,0),oc(s,e)}function k6(t,e){const n=nr(t),r=+oc(n,e)-+x6(n,e);return Math.round(r/c_)+1}function Ce(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const ai={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Ce(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Ce(n+1,2)},d(t,e){return Ce(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Ce(t.getHours()%12||12,e.length)},H(t,e){return Ce(t.getHours(),e.length)},m(t,e){return Ce(t.getMinutes(),e.length)},s(t,e){return Ce(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return Ce(i,e.length)}},lo={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ax={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return ai.y(t,e)},Y:function(t,e,n,r){const i=f_(t,r),s=i>0?i:1-i;if(e==="YY"){const o=s%100;return Ce(o,2)}return e==="Yo"?n.ordinalNumber(s,{unit:"year"}):Ce(s,e.length)},R:function(t,e){const n=u_(t);return Ce(n,e.length)},u:function(t,e){const n=t.getFullYear();return Ce(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Ce(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Ce(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return ai.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Ce(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=k6(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):Ce(i,e.length)},I:function(t,e,n){const r=w6(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Ce(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):ai.d(t,e)},D:function(t,e,n){const r=b6(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Ce(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return Ce(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return Ce(s,e.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return Ce(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=lo.noon:r===0?i=lo.midnight:i=r/12>
vendor: 4,693 bytes, line 669
669=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=lo.evening:r>=12?i=lo.afternoon:r>=4?i=lo.morning:i=lo.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return ai.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):ai.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Ce(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Ce(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):ai.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):ai.s(t,e)},S:function(t,e){return ai.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return cx(r);case"XXXX":case"XX":return hs(r);case"XXXXX":case"XXX":default:return hs(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return cx(r);case"xxxx":case"xx":return hs(r);case"xxxxx":case"xxx":default:return hs(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+lx(r,":");case"OOOO":default:return"GMT"+hs(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+lx(r,":");case"zzzz":default:return"GMT"+hs(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return Ce(r,e.length)},T:function(t,e,n){const r=t.getTime();return Ce(r,e.length)}};function lx(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),s=r%60;return s===0?n+String(i):n+String(i)+e+Ce(s,2)}function cx(t,e){return t%60===0?(t>0?"-":"+")+Ce(Math.abs(t)/60,2):hs(t,e)}function hs(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Ce(Math.trunc(r/60),2),s=Ce(r%60,2);return n+i+e+s}const ux=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},m_=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},S6=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return ux(t,e);let s;switch(r){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",ux(r,e)).replace("{{time}}",m_(i,e))},T6={p:m_,P:S6},C6=/^D+$/,E6=/^Y+$/,_6=["D","DD","YY","YYYY"];function P6(t){return C6.test(t)}function R6(t){return E6.test(t)}function I6(t,e,n){const r=N6(t,e,n);if(console.warn(r),_6.includes(t))throw new RangeError(r)}function N6(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const A6=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,O6=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,M6=/^'([^]*?)'?$/,j6=/''/g,D6=/[a-zA-Z]/;function ay(t,e,n){var u,h,f,m,b,p,g,v;const r=Sh(),i=(n==null?void 0:n.locale)??r.locale??h_,s=(n==null?void 0:n.firstWeekContainsDate)??((h=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??r.firstWeekContainsDate??((m=(f=r.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((p=(b=n==null?void 0:n.locale)==null?void 0:b.options)==null?void 0:p.weekStartsOn)??r.weekStartsOn??((v=(g=r.locale)==null?void 0:g.options)==null?void 0:v.weekStartsOn)??0,a=nr(t);if(!B5(a))throw new RangeError("Invalid time value");let l=e.match(O6).map(y=>{const w=y[0];if(w==="p"||w==="P"){const k=T6[w];return k(y,i.formatLong)}return y}).join("").match(A6).map(y=>{if(y==="''")return{isToken:!1,value:"'"};const w=y[0];if(w==="'")return{isToken:!1,value:L6(y)};if(ax[w])return{isToken:!0,value:y};
669if(w.match(D6))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return{isToken:!1,value:y}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:s,weekStartsOn:o,locale:i};return l.map(y=>{if(!y.isToken)return y.value;const w=y.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&R6(w)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&P6(w))&&I6(w,e,String(t));const k=ax[w[0]];return k(a,w,i.localize,c)}).join("")}function L6(t){const e=t.match(M6);return e?e[1].replace(j6,"'"):t}const dx={lessThanXSeconds:{standalone:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"},withPreposition:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"}},xSeconds:{standalone:{one:"1 Sekunde",other:"{{count}} Sekunden"},withPreposition:{one:"1 Sekunde",other:"{{count}} Sekunden"}},halfAMinute:{standalone:"eine halbe Minute",withPreposition:"einer halben Minute"},lessThanXMinutes:{standalone:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"},withPreposition:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"}},xMinutes:{standalone:{one:"1 Minute",other:"{{count}} Minuten"},withPreposition:{one:"1 Minute",other:"{{count}} Minuten"}},aboutXHours:{standalone:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"},withPreposition:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"}},xHours:{standalone:{one:"1 Stunde",other:"{{count}} Stunden"},withPreposition:{one:"1 Stunde",other:"{{count}} Stunden"}},xDays:{standalone:{one:"1 Tag",other:"{{count}} Tage"},withPreposition:{one:"1 Tag",other:"{{count}} Tagen"}},aboutXWeeks:{standalone:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"},withPreposition:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"}},xWeeks:{standalone:{one:"1 Woche",other:"{{count}} Wochen"},withPreposition:{one:"1 Woche",other:"{{count}} Wochen"}},aboutXMonths:{standalone:{one:"etwa 1 Monat",other:"etwa {{count}} Monate"},withPreposition:{one:"etwa 1 Monat",other:"etwa {{count}} Monaten"}},xMonths:{standalone:{one:"1 Monat",other:"{{count}} Monate"},withPreposition:{one:"1 Monat",other:"{{count}} Monaten"}},aboutXYears:{standalone:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahre"},withPreposition:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahren"}},xYears:{standalone:{one:"1 Jahr",other:"{{count}} Jahre"},withPreposition:{one:"1 Jahr",other:"{{count}} Jahren"}},overXYears:{standalone:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahre"},withPreposition:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahren"}},almostXYears:{standalone:{one:"fast 1 Jahr",other:"fast {{count}} Jahre"},withPreposition:{one:"fast 1 Jahr",other:"fast {{count}} Jahren"}}},U6=(t,e,n)=>{let r;const i=n!=null&&n.addSuffix?dx[t].withPreposition:dx[t].standalone;return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",String(e)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:"vor "+r:r},F6={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},B6={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},z6={full:"{{date}} 'um' {{time}}",long:"{{date}} 'um' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},$6={date:Yo({formats:F6,defaultWidth:"full"}),time:Yo({formats:B6,defaultWidth:"full"}),dateTime:Yo({formats:z6,defaultWidth:"full"})},V6={lastWeek:"'letzten' eeee 'um' p",yesterday:"'gestern um' p",today:"'heute um' p",tomorrow:"'morgen um' p",nextWeek:"eeee 'um' p",other:"P"},W6=(t,e,n,r)=>V6[t],q6={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},H6={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},Yp={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],wide:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},K6={narrow:Yp.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:Yp.wide},G6={narrow:["S","M","D","M","D","F","S"],short:["So","Mo","Di","Mi","Do","Fr","Sa"],abbreviated:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],wide:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},J6={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nac
669hm.",evening:"Abend",night:"Nacht"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"}},Y6={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachm.",evening:"abends",night:"nachts"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"}},Q6=t=>Number(t)+".",X6={ordinalNumber:Q6,era:fr({values:q6,defaultWidth:"wide"}),quarter:fr({values:H6,defaultWidth:"wide",argumentCallback:t=>t-1}),month:fr({values:Yp,formattingValues:K6,defaultWidth:"wide"}),day:fr({values:G6,defaultWidth:"wide"}),dayPeriod:fr({values:J6,defaultWidth:"wide",formattingValues:Y6,defaultFormattingWidth:"wide"})},Z6=/^(\d+)(\.)?/i,ez=/\d+/i,tz={narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},nz={any:[/^v/i,/^n/i]},rz={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},iz={any:[/1/i,/2/i,/3/i,/4/i]},sz={narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},oz={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},az={narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},lz={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},cz={narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},uz={any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},dz={ordinalNumber:d_({matchPattern:Z6,parsePattern:ez,valueCallback:t=>parseInt(t)}),era:mr({matchPatterns:tz,defaultMatchWidth:"wide",parsePatterns:nz,defaultParseWidth:"any"}),quarter:mr({matchPatterns:rz,defaultMatchWidth:"wide",parsePatterns:iz,defaultParseWidth:"any",valueCallback:t=>t+1}),month:mr({matchPatterns:sz,defaultMatchWidth:"wide",parsePatterns:oz,defaultParseWidth:"any"}),day:mr({matchPatterns:az,defaultMatchWidth:"wide",parsePatterns:lz,defaultParseWidth:"any"}),dayPeriod:mr({matchPatterns:cz,defaultMatchWidth:"wide",parsePatterns:uz,defaultParseWidth:"any"})},ly={code:"de",formatDistance:U6,formatLong:$6,formatRelative:W6,localize:X6,match:dz,options:{weekStartsOn:1,firstWeekContainsDate:4}},hz=()=>{const[t,e]=x.useState([]),{t:n,language:r}=Ke();return x.useEffect(()=>{(async()=>{const{data:s}=await dr.from("blog_posts").select("id, title, slug, excerpt, cover_image_url, published_at, author_name").eq("published",!0).order("published_at",{ascending:!1}).limit(3);s&&e(s)})()},[]),t.length===0?null:d.jsxs("section",{className:"py-24 relative overflow-hidden",children:[d.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent via-muted/30 to-transparent"}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsxs("div",{className:"text-center mb-12",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl mb-3",children:"Insights & News"}),d.jsx("p",{className:"text-muted-foreground max-w-xl mx-auto",children:n("Aktuelle Beiträge rund um KI, Automatisierung und digitale Transformation.","Latest articles on AI, automation, and digital transformation.")})]}),d.jsx("div",{className:"grid md:grid-cols-3 gap-8 mb-10",children:t.map(i=>d.jsxs(pt,{to:`/blog/${i.slug}`,className:"group rounded-xl border border-border/60 bg-card overflow-hidden hover:border-primary/40 transition-all duration-300 hover:shadow-lg",children:[i.cover_image_url&&d.jsx("div",{className:"aspect-video overflow-hidden",children:d.jsx("img",{src:i.cover_image_url,alt:i.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",loading:"lazy"})}),d.jsxs("div",{className:"p-6",children:[i.published_at&&d.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground mb-3",children:[d.jsx(Zd,{className:"w-3.5 h-3.5"}),ay(new Date(i.published_at),"d. MMMM yyyy",{locale:r==="de"?ly:h_})]}),d.jsx("h3",{className:"font-display font-semibold text-lg mb-2 group-hover:text-primary transition-colors",children:i.title}),d.jsx("p",{className:"text-muted-foreground text-sm line-clamp-3",children:i.excerpt})]})]},i.id))}),d.jsx("div",{className:"text-center",children:d.jsxs(pt,{to:"/blog",className:"inline-flex items-center gap-2 text-primary font-medium hover:underline",children:[n("Alle Beiträge ansehen","View all articles")," ",d.jsx(cn,{className:"w-4 h-4"})]})})]})]})},rr=()=>{const{t}=Ke(),e=[{name:"LexVault",href:"/legal"},{name:"OfficePulse",href:"/kmu"},{name:"Douplét",href:"/culture"}];return d.jsxs("footer",{className:"relative py-16 overflow-hidden",children:[d.jsx("div",{className:"absolute inset-0 bg-gradient-dark"}),d.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-border to-transparent"}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsxs("div",{className:"grid md:grid-cols-4 gap-12 mb-12",children:[d.jsxs("div",{className:"md:col-span-2",children:[d.jsx(pt,{to:"/",className:"flex items-center mb-4",children:d.jsx("img",{src:VC,alt:"PromptPeak",className:"h-8"})}),d.jsx("p",{className:"text-muted-foreground max-w-md leading-relaxed",children:t("PromptPeak ist Ihr Partner für KI-gestützte Lösungen aus Deutschland. Von sicherer On-Premise-KI bis hin zu lebendigen digitalen Porträts.","PromptPeak is your partner for AI-powered solutions from Germany. From secure on-premise AI to vivid digital portraits.")})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"font-display font-semibold text-foreground mb-4",children:t("Produkte","Products")}),d.jsx("ul",{className:"space-y-3",children:e.map(n=>d.jsx("li",{children:d.jsx(pt,{to:n.href,className:"text-muted-foreground hover:text-foreground transition-colors",children:n.name})},n.name))})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"font-display font-semibold text-foreground mb-4",children:t("Kontakt","Contact")}),d.jsxs("ul",{className:"space-y-3",children:[d.jsxs("li",{className:"flex items-center gap-3 text-muted-foreground",children:[d.jsx(ma,{className:"w-4 h-4 text-primary"}),d.jsx("a",{href:"mailto:[email protected]",className:"hover:text-foreground transition-colors",children:"[email protected]"})]}),d.jsxs("li",{className:"flex items-center gap-3 text-muted-foreground",children:[d.jsx(CT,{className:"w-4 h-4 text-primary"}),d.jsx("span",{children:t("Deutschland","Germany")})]})]})]})]}),d.jsxs("div",{className:"pt-8 border-t border-border/50 flex flex-col sm:flex-row justify-between items-center gap-4",children:[d.jsxs("p",{className:"text-muted-foreground text-sm",children:["© ",new Date().getFullYear()," PromptPeak. ",t("Alle Rechte vorbehalten.","All rights reserved.")]}),d.jsxs("div",{className:"flex gap-6",children:[d.jsx(pt,{to:"/datenschutz",className:"text-muted-foreground hover:text-foreground text-sm transition-colors",children:t("Datenschutz","Privacy Policy")}),d.jsx(pt,{to:"/impressum",className:"text-muted-foreground hover:text-foreground text-sm transition-colors",children:t("Impressum","Legal Notice")})]})]})]})]})},fz=()=>d.jsxs(d.Fragment,{children:[d.jsxs(er,{children:[d.jsx("title",{children:"PromptPeak – KI Consulting & Produkte aus Deutschland"}),d.jsx("meta",{name:"description",content:"PromptPeak ist Ihr Partner für KI-Lösungen: LexVault für sicheres On-Premise KI, OfficePulse für Office-Automatisierung, Douplét für lebendige Kulturporträts."}),d.jsx("meta",{name:"keywords",content:"KI, AI Consulting, Deutschland, LexVault, OfficePulse, Douplét, DSGVO, On-Premise KI"}),d.jsx("link",{rel:"canonical",href:"https://promptpeak.ai"})]}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsxs("main",{children:[d.jsx(Z4,{}),d.jsx(tF,{}),d.jsx(nF,{}),d.jsx(hz,{})]}),d.jsx(rr,{})]})]}),mz="/assets/hero-legal-DJDA7xG1.jpg",pz=()=>{const{t}=Ke(),e=[{icon:dv,title:t("Volle Datensouveränität","Full Data Sovereignty"),description:t("100 % in Ihrer Infrastruktur – ohne externe Cloud.","100% in your infrastru
669cture – no external cloud.")},{icon:sA,title:t("DSGVO-konform","GDPR Compliant"),description:t("Auditfähig, nachvollziehbar und rechtssicher.","Audit-ready, traceable, and legally compliant.")},{icon:IT,title:t("Sofort produktiv","Instantly Productive"),description:t("Standard-Workflows ab Tag 1 einsatzbereit.","Standard workflows ready from day one.")}],n=[{icon:ET,title:t("Intelligente Chatbots","Intelligent Chatbots"),description:t("Antworten auf interne Anfragen und sensible Kommunikation – sicher und nachvollziehbar.","Answers to internal queries and sensitive communications – secure and traceable.")},{icon:TA,title:t("Automatisierte Workflows","Automated Workflows"),description:t("Dokumente, Protokolle und Prozesse laufen automatisiert in Ihren bestehenden Systemen.","Documents, protocols, and processes run automated in your existing systems.")},{icon:fA,title:t("Vertrauliche Audio-Transkription","Confidential Audio Transcription"),description:t("Besprechungen werden intern transkribiert – ohne externe Dienste.","Meetings are transcribed internally – without external services.")}],r=[{problem:t("Sensible Daten dürfen Ihre Organisation aus rechtlichen oder strategischen Gründen nicht verlassen.","Sensitive data cannot leave your organization for legal or strategic reasons."),solution:t("Alle KI-Funktionen laufen ausschließlich in Ihrer geschützten Umgebung. Keine Cloud, kein Datenabfluss.","All AI features run exclusively in your protected environment. No cloud, no data leakage."),title:t("Vertrauliche Informationen","Confidential Information")},{problem:t("Teams verlieren Zeit beim manuellen Suchen und Sortieren von Wissen.","Teams lose time manually searching and sorting knowledge."),solution:t("LexVault liefert kontextbezogene Antworten – sofort, nachvollziehbar und mit Quellenangabe.","LexVault delivers contextual answers – instantly, traceably, and with source references."),title:t("Zeitaufwändige Informationssuche","Time-Consuming Information Search")},{problem:t("Expert:innen verbringen zu viel Zeit mit administrativen Tätigkeiten.","Experts spend too much time on administrative tasks."),solution:t("Wiederkehrende Prozesse laufen automatisiert, ohne externe Tools oder zusätzliche IT-Aufwände.","Recurring processes run automated, without external tools or additional IT effort."),title:t("Routine bindet Fachkräfte","Routine Tasks Bind Specialists")},{problem:t("Stark regulierte Branchen können externe KI-Dienste kaum einsetzen.","Heavily regulated industries can hardly use external AI services."),solution:t("LexVault ist auditfähig, dokumentierbar und vollständig nachvollziehbar.","LexVault is audit-ready, documentable, and fully traceable."),title:t("Regulatorische Anforderungen","Regulatory Requirements")}],i=[{number:"1",title:t("Bedarfsanalyse","Needs Analysis"),description:t("Gemeinsam identifizieren wir, wo LexVault den größten Nutzen stiftet.","Together, we identify where LexVault creates the greatest value.")},{number:"2",title:t("Einrichtung","Setup"),description:t("Die Plattform wird in Ihrer Umgebung installiert und angebunden.","The platform is installed and connected in your environment.")},{number:"3",title:t("Erweiterung","Expansion"),description:t("Weitere Workflows entstehen in enger Zusammenarbeit – genau so, wie Sie sie brauchen.","Additional workflows are created in close collaboration – exactly as you need them.")}];return d.jsxs(d.Fragment,{children:[d.jsxs(er,{children:[d.jsx("title",{children:t("LexVault – Vertrauliche KI für Recht & Compliance | PromptPeak","LexVault – Confidential AI for Legal & Compliance | PromptPeak")}),d.jsx("meta",{name:"description",content:t("LexVault: Sichere On-Premise KI-Plattform für Kanzleien und Behörden. DSGVO-konform, auditfähig und vollständig unter Ihrer Kontrolle.","LexVault: Secure on-premise AI platform for law firms and public authorities. GDPR-compliant, audit-ready, and fully under your control.")}),d.jsx("link",{rel:"canonical",href:"https://promptpeak.ai/legal"})]}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsxs("main",{children:[d.jsxs("section",{className:"relative pt-32 pb-20 overflow-hidden",children:[d.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat",style:{backgroundImage:`url(${mz})`}}),d.jsx("div",{className:"absolute inset-0 bg-background/80"}),d.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-primary/20 rounded-full blur-3xl animate-pulse-slow"}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsxs("div",{className:"max-w-4xl mx-auto text-center mb-12",children:[d.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-glass border border-border/50 mb-8",children:[d.jsx(av,{className:"w-4 h-4 text-primary"}),d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:t("Vertrauliche K
669I-Plattform","Confidential AI Platform")})]}),d.jsxs("h1",{className:"font-display font-bold text-5xl md:text-6xl leading-tight mb-6",children:[d.jsx("span",{className:"text-gradient-primary",children:"LexVault"}),d.jsx("br",{}),d.jsx("span",{className:"text-foreground text-3xl md:text-4xl",children:t("Vertrauliche KI für vertrauliche Daten","Confidential AI for confidential data")})]}),d.jsxs("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto mb-8",children:[t("Für Organisationen, in denen Sicherheit, Kontrolle und Vertrauen an erster Stelle stehen.","For organizations where security, control, and trust come first."),d.jsx("br",{}),d.jsx("strong",{className:"text-foreground",children:t("Ohne Cloud. Ohne Datenabfluss. Komplett in Ihrem Rechenzentrum.","No cloud. No data leakage. Entirely in your data center.")})]}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6 mb-12",children:e.map((s,o)=>d.jsxs("div",{className:"p-4 rounded-xl bg-glass border border-border/50",children:[d.jsx(s.icon,{className:"w-8 h-8 text-primary mb-3 mx-auto"}),d.jsx("h3",{className:"font-semibold text-foreground mb-1",children:s.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]},o))})]}),d.jsxs("div",{className:"max-w-xl mx-auto",children:[d.jsx("div",{className:"text-center mb-6",children:d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:t("Sprechen Sie mit Martin über LexVault","Talk to Martin about LexVault")})}),d.jsx(yh,{agentId:"agent_2301k5pcce4yfx6b5fsdmn7b7yf4",name:"Martin",role:t("LexVault Experte","LexVault Expert"),description:t("Unser virtueller Experte beantwortet Fragen zu Datenschutz, Infrastruktur und Integration direkt per Stimme – sicher und ohne Ihre Umgebung zu verlassen.","Our virtual expert answers questions about data protection, infrastru
669cture, and integration directly by voice – securely and without leaving your environment."),color:"primary"})]})]})]}),d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-4xl mx-auto",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-4",children:t("Ihre eigene KI-Plattform","Your Own AI Platform")}),d.jsx("p",{className:"text-muted-foreground text-center mb-12 max-w-2xl mx-auto",children:t("Sicher, skalierbar und vollständig unter Ihrer Kontrolle. Alle Komponenten laufen lokal – von der Verarbeitung bis zur Speicherung.","Secure, scalable, and fully under your control. All components run locally – from processing to storage.")}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:n.map((s,o)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50",children:[d.jsx(s.icon,{className:"w-10 h-10 text-primary mb-4"}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:s.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]},o))})]})})]}),d.jsx("section",{className:"py-20 relative",children:d.jsxs("div",{className:"container mx-auto px-6",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-12",children:t("Sicherheit, Vertrauen und Effizienz","Security, Trust, and Efficiency")}),d.jsx("div",{className:"grid md:grid-cols-2 gap-6 max-w-5xl mx-auto",children:r.map((s,o)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50",children:[d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-4",children:s.title}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:t("Problem","Problem")}),d.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.problem})]}),d.jsxs("div",{children:[d.jsx("span",{className:"text-xs font-medium text-primary uppercase tracking-wide",children:t("LexVault-Lösung","LexVault Solution")}),d.jsx("p",{className:"text-sm text-foreground mt-1",children:s.solution})]})]})]},o))})]})}),d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-12",children:t("Von der Idee zur sicheren Implementierung","From Idea to Secure Implementation")}),d.jsx("div",{className:"flex flex-col md:flex-row gap-6 max-w-4xl mx-auto",children:i.map((s,o)=>d.jsxs("div",{className:"flex-1 p-6 rounded-2xl bg-glass border border-border/50 relative",children:[d.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-primary flex items-center justify-center text-primary-foreground font-bold mb-4",children:s.number}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:s.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:s.description}),o<i.length-1&&d.jsx(cn,{className:"hidden md:block absolute top-1/2 -right-3 w-6 h-6 text-muted-foreground"})]},o))})]})]}),d.jsx("section",{className:"py-20 relative",children:d.jsx("div",{className:"container mx-auto px-6",children:d.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl mb-6",children:t("Bereit für vertrauliche KI?","Ready for Confidential AI?")}),d.jsx("p",{className:"text-muted-foreground mb-8",children:t("Sprechen Sie mit Martin oder kontaktieren Sie uns direkt für eine persönliche Beratung.","Talk to Martin or contact us directly for a personal consultation.")}),d.jsx("a",{href:"mailto:[email protected]",children:d.jsxs(De,{size:"lg",className:"bg-gradient-primary hover:opacity-90 transition-opacity shadow-glow-primary font-semibold",children:[t("Demo vereinbaren","Schedule a Demo"),d.jsx(cn,{className:"ml-2 w-5 h-5"})]})})]})})})]}),d.jsx(rr,{})]})]})},gz=()=>{const[t,e]=x.useState(0),{t:n}=Ke(),r=[{name:n("Lead Recherche","Lead Research"),description:n("Findet potenzielle Kunden anhand Ihrer Kriterien","Finds potential customers based on your criteria"),icon:lv},{name:n("Kontakt Recherche","Contact Research"),description:n("Ermittelt Ansprechpartner und Kontaktdaten","Identifies contacts and contact details"),icon:kA},{name:n("Personalisierte Ansprache","Personalized Outreach"),description:n("Erstellt individuelle Nachrichten für jeden Kontakt","Creates individual messages for each contact"),icon:hA},{name:n("Dokumentenanalyse","Document Analysis"),description:n("Extrahiert relevante Informationen aus PDFs und Dateien","Extracts relevant information from PDFs and files"),icon:oA},{name:n("Meeting-Vorbereitung","Meeting Preparation"),description:n("Recherchiert Teilnehmer und erstellt Briefings","Researches participants and creates briefings"),icon:Zd},{name:n("Marktanalyse","Market Analysis"),description:n("Beobachtet Wettbewerber und Markttrends","Monitors competitors and market trends"),icon:PT},{name:n("Qualitätsprüfung","Quality Check"),description:n("Überprüft Daten auf Vollständigkeit und Konsistenz","Checks data for completeness and consistency"),icon:nA}];x.useEffect(()=>{const o=setInterval(()=>{e(a=>(a+1)%r.length)},3e3);return()=>clearInterval(o)},[r.length]);const s=(()=>{const o=[];for(let a=-1;a<=1;a++){const l=(t+a+r.length)%r.length;o.push({...r[l],position:a,originalIndex:l})}return o}
669)();return d.jsxs("section",{className:"py-20 relative overflow-hidden",children:[d.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-background via-muted/30 to-background"}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-5xl mx-auto",children:[d.jsxs("div",{className:"text-center mb-12",children:[d.jsxs("div",{className:"flex items-center justify-center gap-3 mb-6",children:[d.jsx(Hm,{className:"w-6 h-6 text-secondary"}),d.jsx("span",{className:"text-sm font-medium text-secondary uppercase tracking-wider",children:n("Agentenplattform","Agent Platform")})]}),d.jsxs("h2",{className:"font-display font-bold text-2xl md:text-3xl lg:text-4xl mb-6 leading-relaxed",children:[d.jsx("span",{className:"text-foreground",children:n("OfficePulse ist Ihre ","OfficePulse is your ")}),d.jsx("span",{className:"text-gradient-accent",children:n("DSGVO-konforme","GDPR-compliant")}),d.jsx("span",{className:"text-foreground",children:n(" und erweiterbare Agentenplattform,"," and extensible agent platform,")}),d.jsx("br",{className:"hidden md:block"}),d.jsx("span",{className:"text-foreground",children:n(" die sich reibungslos in Ihre Infrastruktur integriert."," that integrates seamlessly into your infrastructure.")})]}),d.jsx("p",{className:"text-muted-foreground text-lg mb-4",children:n("Bauen Sie Agenten ohne Code – nur in natürlicher Sprache. Jeder Agent testet sich automatisch.","Build agents without code – just in natural language. Every agent tests itself automatically.")}),d.jsx("p",{className:"text-muted-foreground text-xl font-medium",children:n("Schon jetzt erledigen unsere Agenten Aufgaben wie:","Our agents already handle tasks like:")})]}),d.jsx("div",{className:"relative h-64 md:h-72 flex items-center justify-center",children:d.jsx("div",{className:"relative w-full max-w-4xl flex items-center justify-center",children:s.map(o=>{const a=o.icon,l=o.position===0,c=o.position===-1,u=o.position===1;return d.jsx("div",{onClick:()=>e(o.originalIndex),className:ce("absolute cursor-pointer transition-all duration-500 ease-out","p-6 rounded-2xl border backdrop-blur-sm",l&&"z-30 scale-100 opacity-100 bg-glass border-secondary/40 shadow-glow-accent",c&&"z-20 -translate-x-[85%] md:-translate-x-[110%] scale-75 opacity-60 bg-glass/50 border-border/30",u&&"z-20 translate-x-[85%] md:translate-x-[110%] scale-75 opacity-60 bg-glass/50 border-border/30"),style:{width:l?"320px":"280px"},children:d.jsxs("div",{className:ce("flex flex-col items-center text-center",l?"gap-4":"gap-3"),children:[d.jsx("div",{className:ce("rounded-2xl flex items-center justify-center transition-all duration-500",l?"w-20 h-20 bg-secondary/20":"w-14 h-14 bg-secondary/10"),children:d.jsx(a,{className:ce("text-secondary transition-all duration-500",l?"w-10 h-10":"w-7 h-7")})}),d.jsx("h3",{className:ce("font-display font-bold transition-all duration-500",l?"text-2xl md:text-3xl text-gradient-accent":"text-lg text-foreground/70"),children:o.name}),d.jsx("p",{className:ce("text-muted-foreground transition-all duration-500 line-clamp-2",l?"text-base":"text-sm opacity-70"),children:o.description})]})},`${o.name}-${o.position}`)})})}),d.jsx("div",{className:"flex justify-center gap-2 mt-8",children:r.map((o,a)=>d.jsx("button",{onClick:()=>e(a),className:ce("h-2 rounded-full transition-all duration-300",a===t?"w-10 bg-secondary":"w-2 bg-muted-foreground/30 hover:bg-muted-foreground/50"),"aria-label":n(`Zeige Agent ${a+1}`,`Show agent ${a+1}`)},a))})]})})]})},vz=()=>{const{t}=Ke(),e=[{icon:lv,title:"Buyer Research",description:t("Identifiziert und bewertet potenzielle Käufer systematisch über mehrere Quellen. Erstellt priorisierte Long Lists mit Scoring.","Systematically identifies and evaluates potential buyers across multiple sources. Creates prioritized long lists with scoring.")},{icon:aA,title:t("Dokumentenerstellung","Document Creation"),description:t("Erstellt Excel-Auswertungen, PowerPoint-Decks und Word-Dokumente aus E-Mail-Aufträgen.","Creates Excel reports, PowerPoint decks, and Word documents from email requests.")},{icon:Hm,title:t("Autonome Aufgaben","Autonomous Tasks"),description:t("Plant 
669komplexe Aufgaben selbstständig, schreibt Fortschritt auf Disk und liefert Ergebnisse per E-Mail zurück.","Plans complex tasks autonomously, writes progress to disk, and delivers results via email.")}];return d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-secondary/5"}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsxs("div",{className:"max-w-4xl mx-auto text-center mb-12",children:[d.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-glass border border-border/50 mb-6",children:[d.jsx(Hm,{className:"w-4 h-4 text-secondary"}),d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"OfficePulse Showcase"})]}),d.jsxs("h2",{className:"font-display font-bold text-3xl md:text-4xl mb-3",children:[t("Lernen Sie ","Meet "),d.jsx("span",{className:"text-gradient-accent",children:"Max"}),t(" kennen","")]}),d.jsx("p",{className:"text-lg text-muted-foreground mb-2",children:t("Ein OfficePulse-Agent in Aktion — Recherche, Analyse & Dokumentation","An OfficePulse agent in action — research, analysis & documentation")}),d.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:t("Max zeigt, was mit der OfficePulse-Plattform möglich ist: Ein autonomer KI-Agent, der Unternehmen recherchiert, Kontakte findet, Märkte analysiert und Ergebnisse als fertige Dokumente liefert — alles per E-Mail gesteuert.","Max shows what's possible with the OfficePulse platform: An autonomous AI agent that researches companies, finds contacts, analyzes markets, and delivers results as finished documents — all controlled via email.")})]}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6 max-w-4xl mx-auto mb-10",children:e.map((n,r)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50",children:[d.jsx(n.icon,{className:"w-10 h-10 text-secondary mb-4"}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:n.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]},r))}),d.jsx("div",{className:"text-center",children:d.jsx(pt,{to:"/max",children:d.jsxs(De,{size:"lg",className:"bg-gradient-accent hover:opacity-90 transition-opacity shadow-glow-accent font-semibold",children:[t("Mehr über Max erfahren","Learn more about Max"),d.jsx(cn,{className:"ml-2 w-5 h-5"})]})})})]})]})},yz="/assets/hero-kmu-52cZ90Wq.jpg",bz=()=>{const{t}=Ke(),e=[{icon:ma,title:t("E-Mail verstehen","Understand Email"),description:t("Liest eingehende Nachrichten, erkennt Kontext und Absicht.","Reads incoming messages, recognizes context and intent.")},{icon:O0,title:t("Wissen nutzen","Use Knowledge"),description:t("Greift auf interne Dokumente, Richtlinien oder CRM-Daten zu.","Accesses internal documents, policies, or CRM data.")},{icon:IT,title:t("Antworten & Aktionen","Replies & Actions"),description:t("Formuliert Vorschläge, erstellt Datensätze und fasst Ergebnisse zusammen.","Drafts suggestions, creates records, and summarizes results.")}],n=[{icon:pa,title:"Customer Service",description:t("OfficePulse liest mit, recherchiert im Unternehmenswissen und sendet Antwortvorschläge. Ihr Team klickt nur noch auf «Senden».","OfficePulse reads along, researches company knowledge, and sends reply suggestions. Your team just clicks 'Send'.")},{icon:O0,title:t("Internes Wissensmanagement","Internal Knowledge Management"),description:t("Aktuelle, geprüfte Informationen aus Ihren Dokumenten – direkt als Antwort auf interne Fragen per E-Mail.","Up-to-date, verified information from your documents – directly as answers to internal email queries.")},{icon:TT,title:t("Projektmanagement","Project Management"),description:t("Dokumentiert Meilensteine und Risiken automatisch, erstellt Frühwarnungen und hält Projektteams auf dem Laufenden.","Automatically documents milestones and risks, creates early warnings, and keeps project teams informed.")},{icon:Gm,title:t("Vertriebsinnendienst","Inside Sales"),description:t("Liest Bestellungen aus PDFs aus, erkennt Positionen und Preise und erstellt Importdatensätze für ERP-Systeme.","Reads orders from PDFs, identifies items and prices, and creates import records for ERP systems.")},{icon:xT,title:t("Vertrieb & CRM","Sales & CRM"),description:t("Automatisiert Follow-ups, aktualisiert CRM-Daten und fasst Termine zusammen, damit Ihr Team verkaufen kann.","Automates follow-ups, updates CRM data, and summarizes appointments so your team can sell.")},{icon:Gm,title:t("Einkauf & Lieferanten","Procurement & Suppliers"),description:t("Erkennt Preisänderungen, Vertragsfristen und neue Angebote. Erstellt ad hoc Zusammenfassungen und Tabellen.","Detects price changes, contract deadlines, and new offers. Creates ad-hoc summaries and tables.")},{icon:pa,title:t("HR & Recruiting","HR & Recruiting"),description:t("Sortiert Bewerbungen, beantwortet Standardanfragen und strukturiert Krankmeldungen oder Urlaubsanträge.","Sorts applications, answers standard inquiries, and structures sick notes or vacation requests.")},{icon:kT,title:t("Management & Reporting","Management & Reporting"),description:t("Fasst Projekt- und Abteilungsupdates automatisch zusammen und liefert Handlungsempfehlungen.","Automatically summarizes project and department updates and provides actionable recommendations.")}],r=["Outlook","Teams","Gmail","SAP","HubSpot","Jira","SharePoint","Slack"],i=[{icon:dv,title:t("Datenschutz","Data Protection"),description:t("DSGVO-konform nach deutschen Standards – Daten bleiben in Ihrer Umgebung.","GDPR-compliant to German standards – data stays in your environment.")},{icon:av,title:t("Sicherheit","Security"),description:t("Verschlüsselte Übertragung und Speicherung aller sensiblen Informationen.","Encrypted transmission and storage of all sensitive information.")},{icon:uv,title:t("Kontrolle","Control"),description:t("Volle Kontrolle über Zugriffe, Berechtigungen und Freigaben.","Full control over access, permissions, and approvals.")}];return d.jsxs(d.Fragment,{children:[d.jsxs(er,{children:[d.jsx("title",{children:t("OfficePulse – KI-Automatisierung für KMU | PromptPeak","OfficePulse – AI Automation for SMEs | PromptPeak")}),d.jsx("meta",{name:"description",content:t("OfficePulse: Ihr virtueller Mitarbeiter für E-Mail-Automatisierung und Workflow-Optimierung.","OfficePulse: Your virtual employee for email automation and workflow optimization.")}),d.jsx("link",{rel:"canonical",href:"https://promptpeak.ai/kmu"})]}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsxs("main",{children:[d.jsxs("section",{className:"relative pt-32 pb-20 overflow-hidden",children:[d.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat",style:{backgroundImage:`url(${yz})`}}),d.jsx("div",{className:"absolute inset-0 bg-background/80"}),d.jsx("div",{className:"absolute top-1/4 right-1/4 w-96 h-96 bg-secondary/20 rounded-full blur-3xl animate-pulse-slow"}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsxs("div",{className:"max-w-4xl mx-auto text-center mb-12",children:[d.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-glass border border-border/50 mb-8",children:[d.jsx(ma,{className:"w-4 h-4 text-secondary"}),d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:t("KI für den Mittelstand","AI for SMEs")})]}),d.jsxs("h1",{className:"font-display font-bold text-5xl md:text-6xl leading-tight mb-6",children:[d.jsx("span",{className:"text-gradient-accent",children:"OfficePulse"}),d.jsx("br",{}),d.jsx("span",{className:"text-foreground text-3xl md:text-4xl",children:t("Ihr virtueller Mitarbeiter – da, wo Arbeit passiert","Your virtual employee – where work happens")})]}),d.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto mb-8",children:t("OfficePulse liest E-Mails, versteht Inhalte und erledigt Routineaufgaben – damit Ihr Team sich auf das Wesentliche konzentrieren kann.","OfficePulse reads emails, understands content, and handles routine tasks – so your team can focus on what matters.")})]}),d.jsxs("div",{className:"max-w-xl mx-auto",children:[d.jsx("div",{className:"text-center mb-6",children:d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:t("Testen Sie OfficePulse mit Lea","Try OfficePulse with Lea")})}),d.jsx(yh,{agentId:"agent_2701k5pcb4haes5t66rxgp88t2f4",name:"Lea",role:t("OfficePulse Expertin","OfficePulse Expert"),description:t("Fragen Sie nach Automatisierungen, Integrationen oder konkreten Use-Cases. Lea führt Sie per Stimme durch typische Abläufe.","Ask about automations, integrations, or specific use cases. Lea guides you through typical workflows by voice."),color:"secondary"})]})]})]}),d.jsx(gz,{}),d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-4xl mx-auto",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-4",children:t("So funktioniert Ihr virtueller Mitarbeiter","How Your Virtual Employee Works")}),d.jsx("p",{className:"text-muted-foreground text-center mb-12 max-w-2xl mx-auto",children:t("OfficePulse integriert sich in Outlook, Teams, SAP, HubSpot oder Slack. Kein Chatbot. Kein Umbau. Einfach ein Kollege, der mitdenkt.","OfficePulse integrates with Outlook, Teams, SAP, HubSpot, or Slack. No chatbot. No rebuild. Simply a colleague who thinks along.")}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:e.map((s,o)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50 text-center",children:[d.jsx("div",{className:"w-14 h-14 roun
669ded-xl bg-secondary/10 flex items-center justify-center mx-auto mb-4",children:d.jsx(s.icon,{className:"w-7 h-7 text-secondary"})}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:s.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]},o))})]})})]}),d.jsx("section",{className:"py-20 relative",children:d.jsxs("div",{className:"container mx-auto px-6",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-4",children:t("Für jede Abteilung der passende Assistent","The Right Assistant for Every Department")}),d.jsx("p",{className:"text-muted-foreground text-center mb-12 max-w-2xl mx-auto",children:t("OfficePulse passt sich Ihren Anforderungen an – vom Kundendienst bis zum Management.","OfficePulse adapts to your requirements – from customer service to management.")}),d.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6 max-w-6xl mx-auto",children:n.map((s,o)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50",children:[d.jsx(s.icon,{className:"w-10 h-10 text-secondary mb-4"}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:s.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]},o))})]})}),d.jsx(vz,{}),d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl mb-4",children:t("Nahtlose Integration","Seamless Integration")}),d.jsx("p",{className:"text-muted-foreground mb-12",children:t("OfficePulse arbeitet dort, wo Kommunikation passiert und übergibt Daten automatisch an Ihre Systeme.","OfficePulse works where communication happens and automatically passes data to your systems.")}),d.jsx("div",{className:"flex flex-wrap justify-center gap-4",children:r.map((s,o)=>d.jsx("div",{className:"px-6 py-3 rounded-full bg-glass border border-border/50 text-foreground font-medium",children:s},o))})]})})]}),d.jsx("section",{className:"py-20 relative",children:d.jsxs("div",{className:"container mx-auto px-6",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-4",children:t("Entwickelt für den Mittelstand. DSGVO-konform.","Built for SMEs. GDPR-compliant.")}),d.jsx("p",{className:"text-muted-foreground text-center mb-12 max-w-2xl mx-auto",children:t("Daten bleiben dort, wo sie sind – in Ihrer Cloud oder on-premise. OfficePulse kann mit deutschen Cloud-Providern oder komplett lokal betrieben werden.","Data stays where it belongs – in your cloud or on-premise. OfficePulse can run with German cloud providers or entirely locally.")}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6 max-w-4xl mx-auto",children:i.map((s,o)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50 text-center",children:[d.jsx(s.icon,{className:"w-10 h-10 text-secondary mx-auto mb-4"}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:s.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]},o))})]})}),d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl mb-6",children:t("Bereit für Ihren virtuellen Mitarbeiter?","Ready for Your Virtual Employee?")}),d.jsx("p",{className:"text-muted-foreground mb-8",children:t("Sprechen Sie mit Lea oder kontaktieren Sie uns für eine persönliche Demo.","Talk to Lea or contact us for a personal demo.")}),d.jsx("a",{href:"mailto:[email protected]",children:d.jsxs(De,{size:"lg",className:"bg-gradient-accent hover:opacity-90 transition-opacity shadow-glow-accent font-semibold",children:[t("Demo vereinbaren","Schedule a Demo"),d.jsx(cn,{className:"ml-2 w-5 h-5"})]})})]})})]})]}),d.jsx(rr,{})]})]})},wz="/assets/hero-max-1PkKO1pa.jpg",xz=()=>{const{t}=Ke();return d.jsxs("section",{className:"relative pt-32 pb-20 overflow-hidden",children:[d.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat",style:{backgroundImage:`url(${wz})`}}),d.jsx("div",{className:"absolute inset-0 bg-background/80"}),d.jsx("div",{className:"absolute top-1/4 right-1/4 w-96 h-96 bg-secondary/20 rounded-full blur-3xl animate-pulse-slow"}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[d.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-glass border border-border/50 mb-8",children:[d.jsx(ma,{className:"w-4 h-4 text-secondary"}),d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"OfficePulse Agent"})]}),d.jsx("h1",{className:"font-display font-bold text-6xl md:text-7xl leading-tight mb-4",children:d.jsx("span",{className:"text-gradient-accent",children:"Max"})}),d.jsx("p",{className:"text-xl md:text-2xl text-foreground font-medium mb-4",children:t("Ein OfficePulse-Agent in Aktion — per E-Mail gesteuert, autonom arbeitend","An OfficePulse agent in action — controlled via email, working autonomously")}),d.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto mb-10",children:t("Max zeigt, was mit OfficePulse möglich ist: Ein autonomer KI-Agent, der recherchiert, analysiert und Dokumente erstellt. Kein Dashboard, kein Login — schreiben Sie eine E-Mail und Max liefert Ergebnisse.","Max shows what's possible with OfficePulse: An autonomous AI agent that researches, analyzes, and creates documents. No dashboard, no login — write an email and Max delivers results.")}),d.jsx("a",{href:"mailto:[email protected]",children:d.jsxs(De,{size:"lg",className:"bg-gradient-accent hover:opacity-90 transition-opacity shadow-glow-accent font-semibold",children:[t("Demo vereinbaren","Schedule a Demo"),d.jsx(cn,{className:"ml-2 w-5 h-5"})]})})]})})]})},kz=()=>{const{t}=Ke(),e=[{icon:ma,number:"01",title:t("E-Mail schreiben","Write an Email"),description:t('Sie schreiben Max eine E-Mail wie einem Kollegen: "Finde mir alle Wirtschaftsprüfer im Umkreis von Celle und gib mir die Ergebnisse als Excel."','You write Max an email like a colleague: "Find all auditors near Celle and give me the results as Excel."')},{icon:ZN,number:"02",title:t("Max plant die Aufgabe","Max Plans the Task"),description:t("Max analysiert den Auftrag, zerlegt ihn in Teilschritte und erstellt einen Arbeitsplan. Bei komplexen Aufgaben fragt Max per E-Mail nach, bevor er loslegt.","Max analyzes the request, breaks it into sub-tasks, and creates a work plan. For complex tasks, Max asks via email before starting.")},{icon:pa,number:"03",title:t("Spezialisten arbeiten","Specialists Work"),description:t("Spezialisierte Subagenten übernehmen die Teilaufgaben: Recherche, Analyse, Dokumentenerstellung. Jeder Agent arbeitet fokussiert mit frischem Kontext.","Specialized sub-agents handle the sub-tasks: research, analysis, document creation. Each agent works focused with fresh context.")},{icon:cv,number:"04",title:t("Ergebnis per E-Mail","Results via Email"),description:t("Max sendet das fertige Ergebnis zurück: Excel-Dateien, Präsentationen, Zusammenfassungen. Mit Kostenübersicht und Quellenangaben.","Max sends the finished result back: Excel files, presentations, summaries. With cost overview and source references.")}];return d.jsx("section",{className:"py-20 relative",children:d.jsx("div",{className:"container mx-auto px-6",children:d.jsxs("div",{className:"max-w-3xl mx-auto",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-4",children:t("So funktioniert Max","How Max Works")}),d.jsx("p",{className:"text-muted-foreground text-center mb-16 max-w-2xl mx-auto",children:t("Von der E-Mail zum fertigen Ergebnis — in vier Schritten.","From email to finished result — in four steps.")}
669),d.jsxs("div",{className:"relative",children:[d.jsx("div",{className:"absolute left-7 top-0 bottom-0 w-px bg-border hidden md:block"}),d.jsx("div",{className:"space-y-12",children:e.map((n,r)=>d.jsxs("div",{className:"flex gap-6 items-start",children:[d.jsx("div",{className:"relative flex-shrink-0",children:d.jsx("div",{className:"w-14 h-14 rounded-xl bg-secondary/10 border border-secondary/20 flex items-center justify-center",children:d.jsx(n.icon,{className:"w-6 h-6 text-secondary"})})}),d.jsxs("div",{className:"pt-1",children:[d.jsx("span",{className:"text-xs font-mono text-secondary mb-1 block",children:n.number}),d.jsx("h3",{className:"font-display font-semibold text-foreground text-lg mb-2",children:n.title}),d.jsx("p",{className:"text-muted-foreground",children:n.description})]})]},r))})]})]})})})},Sz=()=>{const{t}=Ke(),e=[{icon:ov,title:t("Unternehmensrecherche","Company Research"),description:t("Systematische Suche und Bewertung von Unternehmen nach Ihren Kriterien.","Systematic search and evaluation of companies by your criteria."),examples:[t("Finde mir Wirtschaftsprüfer im 3 km Umkreis von Celle","Find auditors within 3 km of Celle"),t("Finde mir potenzielle Käufer für das Unternehmen im angehängten PDF","Find potential buyers for the company in the attached PDF"),t("Liste alle SaaS-Unternehmen in DACH mit 10–50 Mitarbeitern","List all SaaS companies in DACH with 10–50 employees")]},{icon:pa,title:t("Kontaktrecherche","Contact Research"),description:t("Findet Ansprechpartner, Kontaktdaten und Entscheider.","Finds contacts, contact details, and decision-makers."),examples:[t("Finde mir alle Kontakte für Firma XYZ als Excel-Liste","Find all contacts for company XYZ as an Excel list"),t("Ergänze die Kontaktinformationen in der angehängten Excel-Liste","Add contact information to the attached Excel list"),t("Wer ist der Geschäftsführer von Unternehmen ABC?","Who is the CEO of company ABC?")]},{icon:PT,title:t("Marktanalyse","Market Analysis"),description:t("Analysiert Märkte, Trends und Wettbewerber — strukturiert und mit Quellenangaben.","Analyzes markets, trends, and competitors — structured with source references."),examples:[t("Wie groß ist der Markt für Industrial Automation in Deutschland?","How big is the market for Industrial Automation in Germany?"),t("Vergleiche die Top-5-Anbieter im Bereich Legal Tech in DACH","Compare the top 5 providers in Legal Tech in DACH"),t("Fasse die wichtigsten M&A-Transaktionen der letzten 12 Monate zusammen","Summarize the most important M&A transactions of the last 12 months")]},{icon:xT,title:t("Unternehmensprofile","Company Profiles"),description:t("Erstellt strukturierte Profile mit Kennzahlen und Marktposition.","Creates structured profiles with KPIs and market position."),examples:[t("Erstelle ein Unternehmensprofil für Firma XYZ","Create a company profile for company XYZ"),t("Erstelle für 10 Firmennamen je ein Kurzprofil als Excel","Create a brief profile for each of 10 company names as Excel"),t("Was sind die wichtigsten Wettbewerber von Unternehmen ABC?","What are the main competitors of company ABC?")]}];return d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-4",children:t("Was Max kann","What Max Can Do")}),d.jsx("p",{className:"text-muted-foreground text-center mb-12 max-w-2xl mx-auto",children:t("Vier Kernfähigkeiten — jede per E-Mail auslösbar, mit konkreten Beispielen.","Four core capabilities — each triggerable via email, with concrete examples.")}),d.jsx("div",{className:"grid md:grid-cols-2 gap-6 max-w-5xl mx-auto",children:e.map((n,r)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50",children:[d.jsx(n.icon,{className:"w-10 h-10 text-secondary mb-4"}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:n.title}),d.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:n.description}),d.jsx("div",{className:"space-y-2",children:n.examples.map((i,s)=>
669d.jsx("div",{className:"text-sm text-foreground/80 bg-background/50 rounded-lg px-3 py-2 border border-border/30 italic",children:i},s))})]},r))})]})]})},Tz=()=>{const{t}=Ke(),e=[{icon:ma,title:t("E-Mail als Interface","Email as Interface"),description:t("Kein neues Tool, kein Login, keine Schulung. Max lebt dort, wo Ihre Kommunikation stattfindet.","No new tool, no login, no training. Max lives where your communication happens.")},{icon:TT,title:t("Fachwissen statt Code","Expertise, Not Code"),description:t("Sie beschreiben, was Max tun soll — in Ihren Worten. Kein Code, keine IT-Abteilung nötig.","You describe what Max should do — in your words. No code, no IT department needed.")},{icon:gA,title:t("Frischer Kontext, keine Halluzinationen","Fresh Context, No Hallucinations"),description:t("Jeder Subagent startet mit genau dem Kontext, den er braucht. Kein aufgeblähter Speicher, keine veralteten Informationen.","Each sub-agent starts with exactly the context it needs. No bloated memory, no outdated information.")},{icon:yA,title:"Human-in-the-Loop",description:t("Vor kritischen Aktionen fragt Max nach Freigabe. Volle Kontrolle, volle Transparenz.","Before critical actions, Max asks for approval. Full control, full transparency.")},{icon:rA,title:t("Kostentransparenz","Cost Transparency"),description:t("Jede Aufgabe dokumentiert Token-Verbrauch und API-Kosten. Sie wissen immer, was Max kostet.","Every task documents token usage and API costs. You always know what Max costs.")}];return d.jsx("section",{className:"py-20 relative",children:d.jsx("div",{className:"container mx-auto px-6",children:d.jsxs("div",{className:"max-w-5xl mx-auto",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-3",children:t("Warum Max anders arbeitet","Why Max Works Differently")}),d.jsx("p",{className:"text-muted-foreground text-center mb-12 max-w-2xl mx-auto",children:t("Keine Chatbots, keine Workflows — echte autonome Agenten","No chatbots, no workflows — real autonomous agents")}),d.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map((n,r)=>d.jsxs("div",{className:`p-6 rounded-2xl bg-glass border border-border/50 ${r===e.length-1&&e.length%3!==0?"md:col-span-2 lg:col-span-1":""}`,children:[d.jsx(n.icon,{className:"w-10 h-10 text-secondary mb-4"}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:n.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]},r))})]})})})},Cz=()=>{const{t}=Ke(),e=[{icon:_T,title:t("Kanzlei-Assistent","Law Firm Assistant"),description:t("Verträge prüfen, Risiken flaggen, Fristen tracken, NetDocuments-Integration","Review contracts, flag risks, track deadlines, NetDocuments integration")},{icon:kT,title:"Consulting-Analyst",description:t("Market Sizing, Wettbewerbsanalysen, Slide-Erstellung, Interview-Vorbereitung","Market sizing, competitive analysis, slide creation, interview preparation")},{icon:Gm,title:t("Einkaufs-Assistent","Procurement Assistant"),description:t("Bestellungen aus PDFs extrahieren, Preisvergleiche, ERP-Import, Lieferanten-Monitoring","Extract orders from PDFs, price comparisons, ERP import, supplier monitoring")}];return d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsxs("div",{className:"max-w-4xl mx-auto text-center mb-12",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl mb-3",children:t("Ihr Wissen wird zum Agenten","Your Knowledge Becomes an Agent")}),d.jsx("p",{className:"text-lg text-muted-foreground mb-2",children:t("Nicht Ihr Unternehmen passt sich einer Software an — OfficePulse passt sich Ihrem Unternehmen an.","Your business doesn't adapt to software — OfficePulse adapts to your business.")}),d.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:t("Wir nehmen das Expertenwissen Ihrer Mitarbeiter und bauen daraus Ihren Agenten. Ganz ohne Programmierung.","We take your employees' expert knowledge and build your agent from it. No programming required.")})]}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6 max-w-4xl mx-auto mb-10",children:e.map((n,r)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50",children:[d.jsx(n.icon,{className:"w-10 h-10 text-secondary mb-4"}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:n.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]},r))}),d.jsx("div",{className:"text-center",children:d.jsx(pt,{to:"/kmu",children:d.jsxs(De,{size:"lg",variant:"outline",className:"font-semibold border-secondary/30 text-secondary hover:bg-secondary/10",children:[t("Ihr eigener virtueller Mitarbeiter?","Your own virtual employee?"),d.jsx(cn,{className:"ml-2 w-5 h-5"})]})})})]})]})},Ez=()=>{const{t}=Ke(),e=[{icon:lv,number:"1",title:"Discovery",description:t("Wir analysieren Ihre E-Mail-Workflows: Welche E-Mails lösen Arbeit aus? Welche Systeme nutzen Sie?","We analyze your email workflows: Which emails trigger work? What systems do you use?")},{icon:uv,number:"2",title:t("Konfiguration","Configuration"),description:t("Wir definieren Max' Fähigkeiten für Ihren Anwendungsfall. Subagenten, Integrationen und Skills.","We define Max's capabilities for your use case. Sub-agents, integrations, and skills.")},{icon:vA,number:"3",title:"Go Live",description:t("Max bekommt eine E-Mail-Adresse. Ihr Team schreibt ihm wie einem Kollegen. Fertig.","Max gets an email address. Your team writes to him like a colleague. Done.")}];return d.jsx("section",{className:"py-20 relative",children:d.jsxs("div",{className:"container mx-auto px-6",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-4",children:t("So starten Sie","How to Get Started")}),d.jsx("p",{className:"text-muted-foreground text-center mb-12 max-w-2xl mx-auto",children:t("In drei Schritten zum eigenen virtuellen Mitarbeiter.","Three steps to your own virtual employee.")}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6 max-w-4xl mx-auto",children:e.map((n,r)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50 text-center",children:[d.jsx("div",{className:"w-10 h-10 rounded-full bg-secondary/10 border border-secondary/20 flex items-center justify-center mx-auto mb-4",children:d.jsx("span",{className:"text-secondary font-display font-bold text-sm",children:n.number})}),d.jsx(n.icon,{className:"w-8 h-8 text-secondary mx-auto mb-3"}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:n.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]},r))})]})})},_z=["Outlook","Teams","Gmail","SAP","HubSpot","Jira","SharePoint","Slack"],Pz=()=>{const{t}=Ke();return d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl mb-4",children:t("Nahtlose Integration","Seamless Integration")}),d.jsx("p",{className:"text-muted-foreground mb-12",children:t("Max arbeitet dort, wo Kommunikation passiert und übergibt Daten automatisch an Ihre Systeme.","Max works where communication happens and automatically passes data to your systems.")}),d.jsx("div",{className:"flex flex-wrap justify-center gap-4",children:_z.map((e,n)=>d.jsx("div",{className:"px-6 py-3 rounded-full bg-glass border border-border/50 text-foreground font-medium",children:e},n))})]})})]})},Rz=()=>{const{t}=Ke(),e=[{icon:dv,title:t("Datenschutz","Data Protection"),description:t("DSGVO-konform nach deutschen Standards – Daten bleiben in Ihrer Umgebung.","GDPR-compliant to German standards – data stays in your environment.")},{icon:av,title:t("Sicherheit","Security"),description:t("Verschlüsselte Übertragung und Speicherung aller sensiblen Informationen.","Encrypted transmission and storage of all sensitive information.")},{icon:uv,title:t("Kontrolle","Control"),description:t("Volle Kontrolle über Zugriffe, Berechtigungen und Freigaben. On-Premise oder deutsche Cloud-Provider.","Full control over access, permissions, and approvals. On-premise or German cloud providers.")}];return d.jsx("section",{className:"py-20 relative",children:d.jsxs("div",{className:"container mx-auto px-6",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-4",children:t("DSGVO-konform. Made in Germany.","GDPR-compliant. Made in Germany.")}),d.jsx("p",{className:"text-muted-foreground text-center mb-12 max-w-2xl mx-auto",children:t("Daten bleiben dort, wo sie sind — in Ihrer Cloud oder on-premise.","Data stays where it belongs — in your cloud or on-premise.")}),d.jsx("div",{className:"grid md:grid-cols-3 gap-6 max-w-4xl mx-auto",children:e.map((n,r)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50 text-center",children:[d.jsx(n.icon,{className:"w-10 h-10 text-secondary mx-auto mb-4"}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:n.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]},r))})]})})},Iz=()=>{const{t}=Ke();return d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl mb-4",children:t("Bereit für Max?","Ready for Max?")}),d.jsx("p",{className:"text-muted-foreground mb-8",children:t("Vereinbaren Sie eine persönliche Demo und sehen Sie Max in Aktion.","Schedule a personal demo and see Max in action.")}),d.jsx("a",{href:"mailto:[email protected]",children:d.jsxs(De,{size:"lg",className:"bg-gradient-accent hover:opacity-90 transition-opacity shadow-glow-accent font-semibold",children:[t("Demo vereinbaren","Schedule a Demo"),d.jsx(cn,{className:"ml-2 w-5 h-5"})]})}),d.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:[t("Oder schreiben Sie uns: ","Or write to us: "),d.jsx("a",{href:"mailto:[email protected]",className:"text-secondary hover:underline",children:"[email protected]"})]})]})})]})},Nz=()=>d.jsxs(d.Fragment,{children:[d.jsxs(er,{children:[d.jsx("title",{children:"Max – Autonomer KI-Agent | OfficePulse by PromptPeak"}),d.jsx("meta",{name:"description",content:"Max zeigt, was OfficePulse kann: Ein autonomer KI-Agent für Unternehmensrecherche, Kontaktrecherche, Marktanalyse und mehr — per E-Mail gesteuert."}),d.jsx("link",{rel:"canonical",href:"https://promptpeak.ai/max"})]}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsxs("main",{children:[d.jsx(xz,{}),d.jsx(kz,{}),d.jsx(Sz,{}),d.jsx(Tz,{}),d.jsx(Cz,{}),d.jsx(Ez,{}),d.jsx(Pz,{}),d.jsx(Rz,{}),d.jsx(Iz,{})]}),d.jsx(rr,{})]})]}),Az="/assets/hero-culture-BGIVlCBQ.jpg",Oz=()=>{const{t}=Ke(),e=[{icon:Km,title:t("Museen & Galerien","Museums & Galleries"),description:t("Schaffen Sie interaktive Erlebnisse für Besucher:innen und bringen Sie Sammlungen zum Sprechen.","Create interactive experiences for visitors and bring collections to life.")},{icon:XN,title:t("Archive & Bibliotheken","Archives & Libraries"),description:t("Machen Sie historische Bestände zugänglich und lebendig – durch dialogfähige Repräsentationen.","Make historical holdings accessible and vivid – through conversational representations.")},{icon:pa,title:t("Stiftungen & Sammler:innen","Foundations & Collectors"),description:t("Bewahren Sie das Vermächtnis von Persönlichkeiten in einer Form, die weiterlebt und interagiert.","Preserve the legacy of personalities in a form that lives on and interacts.")},{icon:JN,title:t("Nachlassverwalter","Estate Administrators"),description:t("Digitalisieren Sie Erinnerungen und schaffen Sie eine Brücke zwischen Generationen.","Digitize memories and create a bridge between generations.")}],n=[{title:"Input",subtitle:t("Rohmaterial","Raw Material"),items:["Interviews",t("Texte","Texts"),t("Biografien","Biographies"),t("Erinnerungen","Memories")]},{title:t("Verarbeitung","Processing"),subtitle:"Douplét Engine",items:[t("Destilliert die Essenz des Originals","Distills the essence of the original")]},{title:"Douplét",subtitle:t("Essenz & Identität","Essence & Identity"),items:[t("Werte","Values"),t("Wesen","Character"),t("Geschichte","History"),t("Kontext","Context")]},{title:"Output",subtitle:t("Materialisierung","Materialization"),items:["Avatar","Voice","Interview","Narrator"]}];return d.jsxs(d.Fragment,{children:[d.jsxs(er,{children:[d.jsx("title",{children:t("Douplét – Lebendige Porträts für GLAM | PromptPeak","Douplét – Vivid Portraits for GLAM | PromptPeak")}),d.jsx("meta",{name:"description",content:t("Douplét: Das Porträt des 21. Jahrhun
669derts. Digitale Präsenzen für Museen, Archive, Galerien und Bibliotheken.","Douplét: The portrait of the 21st century. Digital presences for museums, archives, galleries, and libraries.")}),d.jsx("link",{rel:"canonical",href:"https://promptpeak.ai/culture"})]}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsxs("main",{children:[d.jsxs("section",{className:"relative pt-32 pb-20 overflow-hidden",children:[d.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat",style:{backgroundImage:`url(${Az})`}}),d.jsx("div",{className:"absolute inset-0 bg-background/80"}),d.jsx("div",{className:"absolute top-1/4 left-1/3 w-96 h-96 bg-primary/20 rounded-full blur-3xl animate-pulse-slow"}),d.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-80 h-80 bg-secondary/20 rounded-full blur-3xl animate-pulse-slow",style:{animationDelay:"2s"}}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsxs("div",{className:"max-w-4xl mx-auto text-center mb-12",children:[d.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-glass border border-border/50 mb-8",children:[d.jsx(Km,{className:"w-4 h-4 text-primary"}),d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:t("GLAM-Sektor: Galleries, Libraries, Archives, Museums","GLAM Sector: Galleries, Libraries, Archives, Museums")})]}),d.jsx("h1",{className:"font-display font-bold text-5xl md:text-6xl leading-tight mb-4",children:d.jsx("span",{className:"text-gradient-primary",children:"Douplét"})}),d.jsx("p",{className:"text-2xl md:text-3xl text-foreground italic mb-6",children:t("die Anwesenheit des Abwesenden neu gedacht","the presence of the absent, reimagined")}),d.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:t("Das Porträt des 21. Jahrhunderts. Eine digitale Präsenz, die sprechen, reagieren und mit der Zeit weiterwachsen kann.","The portrait of the 21st century. A digital presence that can speak, respond, and grow over time.")})]}),d.jsxs("div",{className:"max-w-xl mx-auto",children:[d.jsx("div",{className:"text-center mb-6",children:d.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:t("Lass Anna erzählen, was ein Douplét lebendig macht","Let Anna tell you what makes a Douplét come alive")})}),d.jsx(yh,{agentId:"agent_8901k5pcdh84fswbk2wzreptgnq9",name:"Anna",role:t("Douplét Expertin","Douplét Expert"),description:t("Tauche in Erinnerungen, Geschichten und künstlerische Konzepte ein. Anna reagiert auf deine Stimme und eröffnet neue Blickwinkel.","Dive into memories, stories, and artistic concepts. Anna responds to your voice and opens new perspectives."),color:"primary"})]})]})]}),d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-4xl mx-auto",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-8",children:t("Das Konzept – Ein lebendiges Porträt","The Concept – A Living Portrait")}),d.jsxs("div",{className:"prose prose-invert max-w-none space-y-6",children:[d.jsx("p",{className:"text-lg text-muted-foreground text-center",children:t("Douplét verbindet Kunst und Technologie, um lebendige Porträts zu schaffen. Jedes Douplét bewahrt nicht nur das Äußere, sondern das Wesen eines Menschen, Objekts oder einer Geschichte.","Douplét connects art and technology to create vivid portraits. Each Douplét preserves not just the exterior, but the essence of a person, object, or story.")}),d.jsx("blockquote",{className:"text-2xl font-display text-center text-foreground border-l-0 italic py-8",children:t("„Wo das Ölgemälde schweigt, beginnt das Douplét zu sprechen.“",'"Where the oil painting is silent, the Douplét begins to speak."')}),d.jsx("p",{className:"text-lg text-muted-foreground text-center",children:t("Am Anfang jedes Douplét steht sorgfältig kuratiertes Material – Interviews, Bilder, Tonaufnahmen, Texte. Unsere KI destilliert darau
669s die Essenz des Originals: eine präsente, dialogfähige Spur der Person oder Geschichte, die weiterlebt.","At the beginning of every Douplét is carefully curated material – interviews, images, recordings, texts. Our AI distills the essence of the original: a present, conversational trace of the person or story that lives on.")})]})]})})]}),d.jsx("section",{className:"py-20 relative",children:d.jsx("div",{className:"container mx-auto px-6",children:d.jsxs("div",{className:"max-w-4xl mx-auto",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-8",children:t("Was ist ein Douplét?","What is a Douplét?")}),d.jsxs("div",{className:"bg-glass rounded-2xl border border-border/50 p-8 mb-12",children:[d.jsx("p",{className:"text-lg text-muted-foreground mb-6",children:t("Ein Douplét ist mehr als ein digitales Porträt – es ist eine Erweiterung der Erinnerung. Es entsteht aus Gesprächen, Bildern, Tonaufnahmen, Briefen, Texten – kurz: aus allem, was eine Person, ein Objekt oder eine Geschichte ausmacht.","A Douplét is more than a digital portrait – it's an extension of memory. It emerges from conversations, images, recordings, letters, texts – in short: from everything that makes up a person, object, or story.")}),d.jsx("p",{className:"text-lg text-foreground",children:t("So entsteht etwas Neues: Eine Form digitaler Kontinuität, die das Vergängliche berührt, ohne es zu verfälschen. Ob als künstlerisches Werk, als kulturelles Archiv oder als persönliche Hommage – Douplét macht Erinnerung erlebbar.","Something new emerges: A form of digital continuity that touches the ephemeral without falsifying it. Whether as an artistic work, a cultural archive, or a personal homage – Douplét makes memory tangible.")})]}),d.jsx("blockquote",{className:"text-xl font-display text-center text-primary italic py-4",children:t("„Erinnerung ist kein Zustand – sie ist ein Gespräch.“",`"Memory is not a state – it's a conversation."`)})]})})}),d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsxs("div",{className:"container mx-auto px-6 relative z-10",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-12",children:t("Die Douplét-Architektur","The Douplét Architecture")}),d.jsx("div",{className:"grid md:grid-cols-4 gap-6 max-w-5xl mx-auto",children:n.map((r,i)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50 text-center relative",children:[d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-1",children:r.title}),d.jsx("p",{className:"text-sm text-primary mb-4",children:r.subtitle}),d.jsx("ul",{className:"space-y-1",children:r.items.map((s,o)=>d.jsx("li",{className:"text-sm text-muted-foreground",children:s},o))}),i<n.length-1&&d.jsx(cn,{className:"hidden md:block absolute top-1/2 -right-3 w-6 h-6 text-muted-foreground"})]},i))}),d.jsx("blockquote",{className:"text-xl font-display text-center text-foreground italic py-12 max-w-2xl mx-auto",children:t("„Wenn Technologie lernt zuzuhören, entsteht Nähe.“",'"When technology learns to listen, closeness emerges."')})]})]}),d.jsx("section",{className:"py-20 relative",children:d.jsxs("div",{className:"container mx-auto px-6",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl text-center mb-4",children:t("Für wen ist Douplét gemacht?","Who is Douplét Made For?")}),d.jsx("p",{className:"text-muted-foreground text-center mb-12 max-w-2xl mx-auto",children:t("Überall dort, wo Erinnerung bewahrt, Wissen weitergegeben oder Persönlichkeit spürbar bleiben soll, schafft Douplét eine neue Form der Präsenz.","Wherever memory is preserved, knowledge passed on, or personality should remain tangible, Douplét creates a new form of presence.")}),d.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:e.map((r,i)=>d.jsxs("div",{className:"p-6 rounded-2xl bg-glass border border-border/50 text-center",children:[d.jsx(r.icon,{className:"w-10 h-10 text-primary mx-auto mb-4"}),d.jsx("h3",{className:"font-semibold text-foreground text-lg mb-2",children:r.title}),d.jsx("p",{className:"text-sm text-muted-foreground",children:r.description})]},i))})]})}),d.jsxs("section",{className:"py-20 relative",children:[d.jsx("div",{className:"absolute inset-0 bg-muted/30"}),d.jsx("div",{className:"container mx-auto px-6 relative z-10",children:d.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[d.jsx("h2",{className:"font-display font-bold text-3xl md:text-4xl mb-6",children:t("„Lassen Sie Ihr Archiv sprechen.“",'"Let Your Archive Speak."')}),d.jsx("p",{className:"text-muted-foreground mb-8",children:t("Ob Künstler, Museum oder Stiftung – Douplét bringt Ihre Geschichte ins Gespräch.","Whether artist, museum, or foundation – Douplét brings your story into conversation.")}),d.jsx("a",{href:"mailto:[email protected]",children:d.jsxs(De,{size:"lg",className:"bg-gradient-primary hover:opacity-90 transition-opacity shadow-glow-primary font-semibold",children:[t("Demo vereinbaren","Schedule a Demo"),d.jsx(cn,{className:"ml-2 w-5 h-5"})]})})]})})]})]}),d.jsx(rr,{})]})]})},Mz=()=>d.jsxs(d.Fragment,{children:[d.jsxs(er,{children:[d.jsx("title",{children:"Impressum – PromptPeak"}),d.jsx("meta",{name:"description",content:"Impressum von PromptPeak.ai - Angaben gemäß § 5 DDG"}),d.jsx("link",{rel:"canonical",href:"https://promptpeak.ai/impressum"})]}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsx("main",{className:"pt-32 pb-20",children:d.jsxs("div",{className:"container mx-auto px-6 max-w-4xl",children:[d.jsx("h1",{className:"font-display text-4xl md:text-5xl font-bold mb-12",children:"Impressum"}),d.jsxs("div",{className:"prose prose-lg dark:prose-invert max-w-none space-y-8",children:[d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"Angaben gemäß § 5 DDG"}),d.jsx("p",{className:"text-muted-foreground",children:"PromptPeak.ai"})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"Postanschrift"}),d.jsxs("address",{className:"not-italic text-muted-foreground",children:[d.jsx("p",{children:"Roß'sche Villa"}),d.jsx("p",{children:"Magnusstr. 2"}),d.jsx("p",{children:"29221 Celle"}),d.jsx("p",{children:"Deutschland"})]})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"Kontakt"}),d.jsxs("p",{className:"text-muted-foreground",children:["E-Mail: ",d.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"[email protected]"})]})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"Vertreten durch"}),d.jsx("p",{className:"text-muted-foreground",children:"Heiko Garrelfs und Michel Schneider"})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"Verantwortlich für den Inhalt nach § 18 Abs. 2 MStV"}),d.jsxs("address",{className:"not-italic text-muted-foreground",children:[d.jsx("p",{children:"Michel Schneider"}),d.jsx("p",{children:"Roß'sche Villa"}),d.jsx("p",{children:"Magnusstr. 2"}),d.jsx("p",{children:"29221 Celle"}),d.jsx("p",{children:"Deutschland"})]})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"EU-Streitschlic
669htung"}),d.jsxs("p",{className:"text-muted-foreground",children:["Hinweis: Die EU-Kommission stellt eine Plattform für die außergerichtliche Online-Streitbeilegung (OS-Plattform) bereit, die unter"," ",d.jsx("a",{href:"https://ec.europa.eu/consumers/odr",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://ec.europa.eu/consumers/odr"})," ","aufrufbar ist. Wir sind weder bereit noch verpflichtet, an Streitbeilegungsverfahren vor einer Verbraucherschlichtungsstelle teilzunehmen."]})]})]})]})}),d.jsx(rr,{})]})]}),jz=()=>d.jsxs(d.Fragment,{children:[d.jsxs(er,{children:[d.jsx("title",{children:"Datenschutzerklärung – PromptPeak"}),d.jsx("meta",{name:"description",content:"Datenschutzerklärung von PromptPeak.ai - Informationen zur Verarbeitung personenbezogener Daten"}),d.jsx("link",{rel:"canonical",href:"https://promptpeak.ai/datenschutz"})]}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsx("main",{className:"pt-32 pb-20",children:d.jsxs("div",{className:"container mx-auto px-6 max-w-4xl",children:[d.jsx("h1",{className:"font-display text-4xl md:text-5xl font-bold mb-4",children:"Datenschutzerklärung"}),d.jsx("p",{className:"text-muted-foreground mb-12",children:"Stand: Januar 2025"}),d.jsxs("div",{className:"prose prose-lg dark:prose-invert max-w-none space-y-8",children:[d.jsxs("p",{className:"text-muted-foreground leading-relaxed",children:["Diese Datenschutzerklärung klärt Sie über die Art, den Umfang und Zweck der Verarbeitung von personenbezogenen Daten innerhalb unseres Onlineangebotes ",d.jsx("strong",{children:"PromptPeak.ai"}),' und der mit ihm verbundenen Webseiten, Funktionen und Inhalte auf. Im Hinblick auf die verwendeten Begrifflichkeiten, wie z.B. „personenbezogene Daten" oder deren „Verarbeitung" verweisen wir auf die Definitionen im Art. 4 der Datenschutzgrundverordnung (DSGVO).']}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"Inhalt"}),d.jsxs("ol",{className:"list-decimal list-inside text-muted-foreground space-y-1",children:[d.jsx("li",{children:"Name und Anschrift der Verantwortlichen"}),d.jsx("li",{children:"Informationspflichten"}),d.jsx("li",{children:"Allgemeines zur Datenverarbeitung"}),d.jsx("li",{children:"Bereitstellung der Website und Erstellung von Logfiles"}),d.jsx("li",{children:"Verwendung von Cookies"}),d.jsx("li",{children:"Verwendung von Formularen (HubSpot)"}),d.jsx("li",{children:"Analyse der Webseite (Google Analytics)"}),d.jsx("li",{children:"Social Media-Onlinepräsenzen"}),d.jsx("li",{children:"Einbindung von Diensten/Inhalten Dritter"}),d.jsx("li",{children:"Rechte der betroffenen Person"})]})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"1. Name und Anschrift der Verantwortlichen"}),d.jsx("p",{className:"text-muted-foreground mb-4",children:"Verantwortlich im Sinne der Datenschutz-Grundverordnung und anderer nationaler Datenschutzgesetze sowie sonstiger datenschutzrechtlicher Bestimmungen sind:"}),d.jsxs("div",{className:"text-muted-foreground mb-4",children:[d.jsx("p",{children:d.jsx("strong",{children:"PromptPeak.ai"})}),d.jsx("p",{children:"Heiko Garrelfs und Michel Schneider"}),d.jsx("p",{children:"Roß'sche Villa"}),d.jsx("p",{children:"Magnusstr. 2"}),d.jsx("p",{children:"29221 Celle"}),d.jsx("p",{children:"Deutschland"})]}),d.jsxs("p",{className:"text-muted-foreground mb-4",children:["Website: ",d.jsx("a",{href:"https://promptpeak.ai",className:"text-primary hover:underline",children:"https://promptpeak.ai"})]}),d.jsxs("p",{className:"text-muted-foreground",children:["Ansprechpartner für Datenschutz und Verantwortlicher für die Website:",d.jsx("br",{}),"Michel Schneider",d.jsx("br",{}),"E-Mail: ",d.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"[email protected]"})]})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"2. Informationspflichten"}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"a) Arten der verarbeiteten Daten"}),d.jsx("p",{className:"text-muted-foreground mb-2",children:"Wir verarbeiten auf unserer Website folgende Arten von Daten:"}),d.jsxs("ul",{className:"list-disc list-inside text-muted-foreground mb-4 space-y-1",children:[d.jsx("li",{children:"Bestandsdaten (z.B. Namen)"}),d.jsx("li",{children:"Kontaktdaten (z.B. E-Mail-Adressen)"}),d.jsx("li",{children:"Inhaltsdaten (z.B. Texteingaben in Formularen)"}),d.jsx("li",{children:"Nutzungsdaten (z.B. besuchte Webseiten, Zugriffszeiten)"}),d.jsx("li",{children:"Meta-/Kommunikationsdaten (z.B. IP-Adressen, Geräte-Informationen)"})]}),d.jsx("p",{className:"text-muted-foreground mb-6",children:"Es 
669werden keine besonderen Kategorien von Daten (Art. 9 Abs. 1 DSGVO) verarbeitet."}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"b) Kategorien der von der Verarbeitung betroffenen Personen"}),d.jsx("p",{className:"text-muted-foreground mb-2",children:"Von der Verarbeitung sind folgende Personengruppen betroffen:"}),d.jsxs("ul",{className:"list-disc list-inside text-muted-foreground mb-6 space-y-1",children:[d.jsx("li",{children:"Kunden und Interessenten"}),d.jsx("li",{children:"Besucher und Nutzer unseres Onlineangebots"})]}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"c) Zweck der Verarbeitung"}),d.jsx("p",{className:"text-muted-foreground mb-2",children:"Die Verarbeitung der Daten erfolgt zu folgenden Zwecken:"}),d.jsxs("ul",{className:"list-disc list-inside text-muted-foreground mb-6 space-y-1",children:[d.jsx("li",{children:"Zurverfügungstellung des Online-Angebots, seiner Inhalte und Funktionen"}),d.jsx("li",{children:"Erbringung vertraglicher Leistungen, Service und Kundenpflege"}),d.jsx("li",{children:"Beantwortung von Kontaktanfragen und Kommunikation mit Nutzern"}),d.jsx("li",{children:"Sicherheitsmaßnahmen"}),d.jsx("li",{children:"Marketing, Werbung und Marktforschung zur Optimierung unserer Services"})]}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"d) Änderungen und Aktualisierungen der Datenschutzerklärung"}),d.jsx("p",{className:"text-muted-foreground mb-6",children:"Wir bitten Sie, sich regelmäßig über den Inhalt unserer Datenschutzerklärung zu informieren. Wir passen die Datenschutzerklärung an, sobald die Änderungen der von uns durchgeführten Datenverarbeitungen dies erforderlich machen."}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"e) Sicherheitsmaßnahmen"}),d.jsx("p",{className:"text-muted-foreground mb-6",children:"Wir treffen nach Maßgabe des Art. 32 DSGVO geeignete te
669chnische und organisatorische Maßnahmen, um ein dem Risiko angemessenes Schutzniveau zu gewährleisten. Hierzu gehört insbesondere die verschlüsselte Übertragung von Daten zwischen Ihrem Browser und unserem Server (SSL/TLS)."}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"f) Zusammenarbeit mit Auftragsverarbeitern und Dritten"}),d.jsx("p",{className:"text-muted-foreground mb-6",children:'Sofern wir Daten gegenüber anderen Personen und Unternehmen (Auftragsverarbeitern oder Dritten) offenbaren, erfolgt dies nur auf Grundlage einer gesetzlichen Erlaubnis (z.B. zur Vertragserfüllung gem. Art. 6 Abs. 1 lit. b DSGVO), Ihrer Einwilligung, einer rechtlichen Verpflichtung oder auf Grundlage unserer berechtigten Interessen. Sofern wir Dritte mit der Verarbeitung von Daten auf Grundlage eines „Auftragsverarbeitungsvertrages" beauftragen, geschieht dies auf Grundlage des Art. 28 DSGVO.'}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"g) Übermittlung in Drittländer"}),d.jsx("p",{className:"text-muted-foreground",children:"Sofern wir Daten in einem Drittland (d.h. außerhalb der EU/EWR) verarbeiten (z.B. durch den Einsatz von Diensten wie Google Analytics oder HubSpot), erfolgt dies nur zur Erfüllung unserer (vor-)vertraglichen Pflichten, auf Grundlage Ihrer Einwilligung, einer rechtlichen Verpflichtung oder unserer berechtigten Interessen und nur beim Vorliegen der besonderen Voraussetzungen der Art. 44 ff. DSGVO (z.B. auf Grundlage von Standardvertragsklauseln)."})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"3. Allgemeines zur Datenverarbeitung"}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"a) Rechtsgrundlage für die Verarbeitung personenbezogener Daten"}),d.jsxs("ul",{className:"list-disc list-inside text-muted-foreground mb-6 space-y-1",children:[d.jsxs("li",{children:["Soweit wir eine ",d.jsx("strong",{children:"Einwilligung"})," einholen, ist die Rechtsgrundlage Art. 6 Abs. 1 lit. a DSGVO."]}),d.jsxs("li",{children:["Für die ",d.jsx("strong",{children:"Vertragserfüllung"})," und vorvertragliche Anfragen ist die Rechtsgrundlage Art. 6 Abs. 1 lit. b DSGVO."]}),d.jsxs("li",{children:["Zur Erfüllung ",d.jsx("strong",{children:"rechtlicher Verpflichtungen"})," ist die Rechtsgrundlage Art. 6 Abs. 1 lit. c DSGVO."]}),d.jsxs("li",{children:["Zur Wahrung unserer ",d.jsx("strong",{children:"berechtigten Interessen"})," (z.B. an der Analyse und Optimierung unseres Onlineangebotes) ist die Rechtsgrundlage Art. 6 Abs. 1 lit. f DSGVO."]})]}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"b) Datenlöschung und Speicherdauer"}),d.jsx("p",{className:"text-muted-foreground",children:"Die personenbezogenen Daten werden gelöscht oder gesperrt, sobald der Zweck der Speicherung entfällt, es sei denn, gesetzliche Aufbewahrungspflichten stehen einer Löschung entgegen."})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"4. Bereitstellung der Website und Erstellung von Logfiles"}),d.jsx("p",{className:"text-muted-foreground",children:"Bei jedem Aufruf unserer Website erfasst unser System automatisiert Daten (Logfiles), wie z.B. Browsertyp, Betriebssystem, IP-Adresse sowie Datum und Uhrzeit des Zugriffs. Die Speicherung in Logfiles erfolgt zur Gewährleistung der Funktionsfähigkeit und Sicherheit der Website. Rechtsgrundlage hierfür ist unser berechtigtes Interesse (Art. 6 Abs. 1 lit. f DSGVO). Die Daten werden gelöscht, sobald sie für die Erreichung des Zweckes ihrer Erhebung nicht mehr erforderlich sind."})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"5. Verwendung von Cookies"}),d.jsx("p",{className:"text-muted-foreground mb-4",children:"Unsere Webseite verwendet Cookies. Das sind kleine Textdateien, die Ihr Browser speichert. Wir setzen technisch notwendige Cookies ein, um unsere Website nutzerfreundlich zu gestalten. Darüber hinaus verwenden wir Cookies zu Analyse- und Marketingzwecken, jedoch nur nach Ihrer ausdrücklichen Einwilligung."}),d.jsx("p",{className:"text-muted-foreground",children:"Beim Aufruf unserer Website werden Sie über die Verwendung von Cookies informiert und Ihre Einwilligung zur Verarbeitung der in diesem Zusammenhang verwendeten personenbezogenen Daten eingeholt (z.B. über ein Cookie-Banner). Ihre Einwilligung ist die Rechtsgrundlage für den Einsatz von Analyse- und Marketing-Cookie
669s (Art. 6 Abs. 1 lit. a DSGVO). Sie können Ihre Einwilligung jederzeit widerrufen."})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"6. Verwendung von Formularen (HubSpot)"}),d.jsx("p",{className:"text-muted-foreground mb-4",children:"Wir nutzen für unsere Kontaktformulare und zur Verwaltung von Kundenanfragen den Dienst HubSpot. Dienstanbieter ist das US-Unternehmen HubSpot, Inc. mit seiner europäischen Niederlassung HubSpot, 2nd Floor 30 North Wall Quay, Dublin 1, Irland."}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"a) Beschreibung und Zweck der Datenverarbeitung"}),d.jsx("p",{className:"text-muted-foreground mb-6",children:"Wenn Sie ein Formular auf unserer Website ausfüllen, werden die von Ihnen eingegebenen Daten (z.B. Name, E-Mail-Adresse, Inhalt Ihrer Anfrage) an HubSpot übermittelt und dort in unserem Auftrag verarbeitet. Wir nutzen diese Daten, um Ihre Anfrage zu bearbeiten, mit Ihnen zu kommunizieren und unsere Kundenbeziehungen zu verwalten."}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"b) Rechtsgrundlage und Datenübermittlung in die USA"}),d.jsx("p",{className:"text-muted-foreground mb-4",children:"Rechtsgrundlage für die Verarbeitung der Daten ist bei Vorliegen Ihrer Einwilligung Art. 6 Abs. 1 lit. a DSGVO sowie zur Bearbeitung Ihrer Anfrage Art. 6 Abs. 1 lit. b DSGVO."}),d.jsxs("p",{className:"text-muted-foreground mb-6",children:["Da HubSpot ein US-Unternehmen ist, können Daten in die USA übermittelt werden. Die USA gelten datenschutzrechtlich als unsicheres Drittland. Die Übermittlung stützen wir auf Standardvertragsklauseln der EU-Kommission sowie, falls zutreffend, Ihre ausdrückliche Einwilligung (Art. 49 Abs. 1 lit. a DSGVO). Mehr Informationen finden Sie in der Datenschutzerklärung von HubSpot:"," ",d.jsx("a",{href:"https://legal.hubspot.com/de/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://legal.hubspot.com/de/privacy-policy"})]}),d.jsx("h3",{className:"font-display text-xl font-semibold mb-3 text-foreground",children:"c) Dauer der Speicherung und Widerruf"}),d.jsxs("p",{className:"text-muted-foreground",children:["Die Daten werden gelöscht, sobald sie für den Zweck ihrer Erhebung nicht mehr erforderlich sind. Sie haben jederzeit die Möglichkeit, Ihre Einwilligung zur Verarbeitung der Daten zu widerrufen. Bitte schreiben Sie hierzu eine E-Mail an"," ",d.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"[email protected]"}),"."]})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"7. Analyse der Webseite (Google Analytics)"}),d.jsx("p",{className:"text-muted-foreground mb-4",children:"Wir nutzen auf Grundlage Ihrer Einwilligung (Art. 6 Abs. 1 lit. a DSGVO) Google Analytics, einen Webanalysedienst der Google Ireland Limited, Gordon House, Barrow Street, Dublin 4, Irland."}),d.jsxs("p",{className:"text-muted-foreground mb-4",children:["Google Analytics verwendet Cookies, um eine Analyse der Benutzung unserer Website durch Sie zu ermöglichen. Wir haben auf dieser Website die ",d.jsx("strong",{children:"IP-Anonymisierung"})," aktiviert. Dadurch wird Ihre IP-Adresse von Google innerhalb der EU/EWR vor der Übermittlung in die USA gekürzt."]}),d.jsx("p",{className:"text-muted-foreground mb-4",children:"Die durch das Cookie erzeugten Informationen können an einen Server von Google in den USA übertragen werden. Die Datenübermittlung stützen wir auf Standardvertragsklauseln und Ihre Einwilligung (Art. 49 Abs. 1 lit. a DSGVO)."}),d.jsx("p",{className:"text-muted-foreground mb-4",children:"Die von uns gesendeten und mit Cookies verknüpften Daten werden nach 14 Monaten automatisch gelöscht."}),d.jsxs("p",{className:"text-muted-foreground",children:["Sie können Ihre Einwilligung jederzeit über unsere Cookie-Einstellungen widerrufen. Zudem können Sie die Erfassung der Daten durch Google verhindern, indem Sie das unter dem folgenden Link verfügbare Browser-Plugin herunterladen und installieren:"," ",d.jsx("a",{href:"https://tools.google.com/dlpage/gaoptout?hl=de",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"https://tools.google.com/dlpage/gaoptout?hl=de"})]})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"8. Social Media-Onlinepräsenzen"}),d.jsx("p",{className:"text-muted-foreground mb-4",children:"Wir unterhalten Onlinepräsenzen innerhalb sozialer Netzwerke, um mit den dort aktiven Kunden und Interessenten zu kommunizieren. Wir weisen darauf hin, dass dabei Daten von Nutzern außerhalb der Europäischen Union verarbeitet werden können."}),d.jsx("p",{className:"text-muted-foreground mb-4",children:"Die Verarbeitung der personenbezogenen Daten der Nutzer erfolgt auf Grundlage unserer berechtigten Interessen an einer effektiven Information und Kommunikation mit den Nutzern gem. Art. 6 Abs. 1 lit. f. DSGVO. Falls die Nutzer von den jeweiligen Anbietern um eine Einwilligung in die Datenverarbeitung gebeten werden, ist die Rechtsgrundlage der Verarbeitung Art. 6 Abs. 1 lit. a., Art. 7 DSGVO."}),d.jsx("p",{className:"text-muted-foreground",children:"Für eine detaillierte Darstellung der jeweiligen Verarbeitungen und der Widerspruchsmöglichkeiten (Opt-Out) verweisen wir auf die Datenschutzerklärungen der jeweiligen Anbieter."})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"9. Einbindung von Diensten/Inhalten Dritter"}),d.jsx("p",{className:"text-muted-foreground",children:"Wir setzen innerhalb unseres Onlineangebots auf Grundlage unserer berechtigten Interessen (d.h. Interesse an der Analyse, Optimierung und dem wirtschaftlichen Betrieb unseres Onlineangebotes im Sinne des Art. 6 Abs. 1 lit. f. DSGVO) Inhalts- oder Serviceangebote von Drittanbietern ein. Dies setzt immer voraus, dass die Drittanbieter dieser Inhalte die IP-Adresse der Nutzer wahrnehmen, da sie ohne die IP-Adresse keine Inhalte an deren Browser senden könnten."})]}),d.jsxs("section",{children:[d.jsx("h2",{className:"font-display text-2xl font-semibold mb-4 text-foreground",children:"10. Rechte der betroffenen Person"}),d.jsx("p",{className:"text-muted-foreground mb-4",children:"Sie haben das Recht:"}),d.jsxs("ul",{className:"list-disc list-inside text-muted-foreground space-y-2",children:[d.jsxs("li",{children:["gemäß Art. 15 DSGVO ",d.jsx("strong",{children:"Auskunft"})," über Ihre von uns verarbeiteten personenbezogenen Daten zu verlangen."]}),d.jsxs("li",{children:["gemäß Art. 16 DSGVO unverzüglich die ",d.jsx("strong",{children:"Beric
669htigung"})," unrichtiger oder die Vervollständigung Ihrer bei uns gespeicherten personenbezogenen Daten zu verlangen."]}),d.jsxs("li",{children:["gemäß Art. 17 DSGVO die ",d.jsx("strong",{children:"Löschung"})," Ihrer bei uns gespeicherten personenbezogenen Daten zu verlangen."]}),d.jsxs("li",{children:["gemäß Art. 18 DSGVO die ",d.jsx("strong",{children:"Einschränkung der Verarbeitung"})," Ihrer personenbezogenen Daten zu verlangen."]}),d.jsxs("li",{children:["gemäß Art. 20 DSGVO Ihre personenbezogenen Daten, die Sie uns bereitgestellt haben, in einem strukturierten, gängigen und maschinenlesbaren Format zu erhalten oder die Übermittlung an einen anderen Verantwortlichen zu verlangen (",d.jsx("strong",{children:"Datenübertragbarkeit"}),")."]}),d.jsxs("li",{children:["gemäß Art. 21 DSGVO ",d.jsx("strong",{children:"Widerspruch"})," gegen die Verarbeitung einzulegen, sofern die Verarbeitung aufgrund von Art. 6 Abs. 1 lit. e oder f DSGVO erfolgt."]}),d.jsxs("li",{children:["gemäß Art. 7 Abs. 3 DSGVO Ihre einmal erteilte ",d.jsx("strong",{children:"Einwilligung"})," jederzeit gegenüber uns zu ",d.jsx("strong",{children:"widerrufen"}),"."]}),d.jsxs("li",{children:["gemäß Art. 77 DSGVO sich bei einer ",d.jsx("strong",{children:"Aufsichtsbehörde zu beschweren"}),". In der Regel können Sie sich hierfür an die Aufsichtsbehörde Ihres üblichen Aufenthaltsortes, Ihres Arbeitsplatzes oder unseres Sitzes wenden."]})]})]})]})]})}),d.jsx(rr,{})]})]}),Dz=()=>{const[t,e]=x.useState([]),[n,r]=x.useState(!0);return x.useEffect(()=>{(async()=>{const{data:s}=await dr.from("blog_posts").select("id, title, slug, excerpt, cover_image_url, published_at, author_name").eq("published",!0).order("published_at",{ascending:!1});s&&e(s),r(!1)})()},[]),d.jsxs(d.Fragment,{children:[d.jsxs(er,{children:[d.jsx("title",{children:"Blog – PromptPeak"}),d.jsx("meta",{name:"description",content:"Insights rund um KI, Automatisierung und digitale Transformation von PromptPeak."}),d.jsx("link",{rel:"canonical",href:"https://promptpeak.ai/blog"})]}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsx("main",{className:"pt-32 pb-20",children:d.jsxs("div",{className:"container mx-auto px-6",children:[d.jsxs("div",{className:"max-w-3xl mx-auto text-center mb-16",children:[d.jsx("h1",{className:"font-display font-bold text-4xl md:text-5xl mb-4",children:"Blog"}),d.jsx("p",{className:"text-lg text-muted-foreground",children:"Aktuelle Beiträge rund um KI, Automatisierung und digitale Transformation."})]}),n?d.jsx("div",{className:"grid md:grid-cols-2 gap-8 max-w-4xl mx-auto",children:[1,2].map(i=>d.jsxs("div",{className:"rounded-xl border border-border/60 bg-card animate-pulse",children:[d.jsx("div",{className:"aspect-video bg-muted"}),d.jsxs("div",{className:"p-6 space-y-3",children:[d.jsx("div",{className:"h-3 w-24 bg-muted rounded"}),d.jsx("div",{className:"h-5 w-3/4 bg-muted rounded"}),d.jsx("div",{className:"h-4 w-full bg-muted rounded"})]})]},i))}):t.length===0?d.jsx("p",{className:"text-center text-muted-foreground",children:"Noch keine Beiträge vorhanden."}):d.jsx("div",{className:"grid md:grid-cols-2 gap-8 max-w-4xl mx-auto",children:t.map(i=>d.jsxs(pt,{to:`/blog/${i.slug}`,className:"group rounded-xl border border-border/60 bg-card overflow-hidden hover:border-primary/40 transition-all duration-300 hover:shadow-lg",children:[i.cover_image_url&&d.jsx("div",{className:"aspect-video overflow-hidden",children:d.jsx("img",{src:i.cover_image_url,alt:i.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500",loading:"lazy"})}),d.jsxs("div",{className:"p-6",children:[i.published_at&&d.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground mb-3",children:[d.jsx(Zd,{className:"w-3.5 h-3.5"}),ay(new Date(i.published_at),"d. MMMM yyyy",{locale:ly})]}),d.jsx("h2",{className:"font-display font-semibold text-xl mb-2 group-hover:text-primary transition-colors",children:i.title}),d.jsx("p",{className:"text-muted-foreground text-sm line-clamp-3",children:i.excerpt}),d.jsx("span",{className:"inline-block mt-4 text-sm text-primary font-medium",children:"Weiterlesen →"})]})]},i.id))})]})}),d.jsx(rr,{})]})]})},Lz=()=>{const{slug:t}
669=hD(),[e,n]=x.useState(null),[r,i]=x.useState(!0);return x.useEffect(()=>{(async()=>{if(!t)return;const{data:o}=await dr.from("blog_posts").select("*").eq("slug",t).eq("published",!0).maybeSingle();n(o),i(!1)})()},[t]),d.jsxs(d.Fragment,{children:[d.jsxs(er,{children:[d.jsx("title",{children:e?`${e.title} – PromptPeak Blog`:"Blog – PromptPeak"}),e&&d.jsx("meta",{name:"description",content:e.excerpt}),e&&d.jsx("link",{rel:"canonical",href:`https://promptpeak.ai/blog/${e.slug}`})]}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsx("main",{className:"pt-32 pb-20",children:d.jsxs("div",{className:"container mx-auto px-6",children:[d.jsxs(pt,{to:"/blog",className:"inline-flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors mb-8",children:[d.jsx(YN,{className:"w-4 h-4"})," Zurück zum Blog"]}),r?d.jsxs("div",{className:"max-w-3xl mx-auto animate-pulse space-y-6",children:[d.jsx("div",{className:"h-8 w-3/4 bg-muted rounded"}),d.jsx("div",{className:"h-4 w-1/4 bg-muted rounded"}),d.jsx("div",{className:"aspect-video bg-muted rounded-xl"}),d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"h-4 w-full bg-muted rounded"}),d.jsx("div",{className:"h-4 w-5/6 bg-muted rounded"}),d.jsx("div",{className:"h-4 w-4/6 bg-muted rounded"})]})]}):e?d.jsxs("article",{className:"max-w-3xl mx-auto",children:[d.jsxs("header",{className:"mb-8",children:[d.jsx("h1",{className:"font-display font-bold text-3xl md:text-4xl mb-4",children:e.title}),d.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[d.jsx("span",{children:e.author_name}),e.published_at&&d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(Zd,{className:"w-3.5 h-3.5"}),ay(new Date(e.published_at),"d. MMMM yyyy",{locale:ly})]})]})]}),e.cover_image_url&&d.jsx("img",{src:e.cover_image_url,alt:e.title,className:"w-full rounded-xl mb-8 aspect-video object-cover"}),d.jsx("div",{className:"prose prose-lg dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:e.content}})]}):d.jsxs("div",{className:"text-center py-20",children:[d.jsx("h1",{className:"font-display font-bold text-3xl mb-4",children:"Beitrag nicht gefunden"}),d.jsx("p",{className:"text-muted-foreground mb-6",children:"Der gesuchte Artikel existiert nicht."}),d.jsx(pt,{to:"/blog",className:"text-primary font-medium hover:underline",children:"Zum Blog →"})]})]})}),d.jsx(rr,{})]})]})};var Uz="Label",p_=x.forwardRef((t,e)=>d.jsx(_e.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));p_.displayName=Uz;var g_=p_;const Fz=sv("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Qo=x.forwardRef(({className:t,...e},n)=>d.jsx(g_,{ref:n,className:ce(Fz(),t),...e}));Qo.displayName=g_.displayName;const Bz=()=>{const[t,e]=x.useState(""),[n,r]=x.useState(""),[i,s]=x.useState(!1),o=_v(),{toast:a}=Zg(),l=async c=>{c.preventDefault(),s(!0);try{const{error:u}=await dr.auth.signInWithPassword({email:t,password:n});if(u)throw u;o("/admin")}catch(u){a({title:"Anmeldung fehlgeschlagen",description:u.message,variant:"destructive"})}finally{s(!1)}};return d.jsxs(d.Fragment,{children:[d.jsx(er,{children:d.jsx("title",{children:"Login – PromptPeak"})}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsx("main",{className:"pt-32 pb-20",children:d.jsxs("div",{className:"container mx-auto px-6 max-w-md",children:[d.jsx("h1",{className:"font-display font-bold text-3xl text-center mb-8",children:"Anmelden"}),d.jsxs("form",{onSubmit:l,className:"space-y-4",children:[d.jsxs("div",{children:[d.jsx(Qo,{htmlFor:"email",children:"E-Mail"}),d.jsx(Pd,{id:"email",type:"email",value:t,onChange:c=>e(c.target.value),required:!0})]}),d.jsxs("div",{children:[d.jsx(Qo,{htmlFor:"password",children:"Passwort"}),d.jsx(Pd,{id:"password",type:"password",value:n,onChange:c=>r(c.target.value),required:!0})]}),d.jsx(De,{type:"submit",className:"w-full",disabled:i,children:i?"Wird angemeldet...":"Anmelden"})]})]})}),d.jsx(rr,{})]})]})},Qp=x.forwardRef(({className:t,...e},n)=>d.jsx("textarea",{className:ce("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
669ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));Qp.displayName="Textarea";function hx(t,[e,n]){return Math.min(n,Math.max(e,t))}var zz=x.createContext(void 0);function $z(t){const e=x.useContext(zz);return t||e||"ltr"}var zf=0;function Vz(){x.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??fx()),document.body.insertAdjacentElement("beforeend",t[1]??fx()),zf++,()=>{zf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),zf--}},[])}function fx(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var $f="focusScope.autoFocusOnMount",Vf="focusScope.autoFocusOnUnmount",mx={bubbles:!1,cancelable:!0},Wz="FocusScope",v_=x.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=x.useState(null),c=Qn(i),u=Qn(s),h=x.useRef(null),f=et(e,p=>l(p)),m=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let p=function(w){if(m.paused||!a)return;const k=w.target;a.contains(k)?h.current=k:ui(h.current,{select:!0})},g=function(w){if(m.paused||!a)return;const k=w.relatedTarget;k!==null&&(a.contains(k)||ui(h.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&ui(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",g);const y=new MutationObserver(v);return a&&y.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",g),y.disconnect()}}},[r,a,m.paused]),x.useEffect(()=>{if(a){gx.add(m);const p=document.activeElement;if(!a.contains(p)){const v=new CustomEvent($f,mx);a.addEventListener($f,c),a.dispatchEvent(v),v.defaultPrevented||(qz(Yz(y_(a)),{select:!0}),document.activeElement===p&&ui(a))}return()=>{a.removeEventListener($f,c),setTimeout(()=>{const v=new CustomEvent(Vf,mx);a.addEventListener(Vf,u),a.dispatchEvent(v),v.defaultPrevented||ui(p??document.body,{select:!0}),a.removeEventListener(Vf,u),gx.remove(m)},0)}}},[a,c,u,m]);const b=x.useCallback(p=>{if(!n&&!r||m.paused)return;const g=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,v=document.activeElement;if(g&&v){const y=p.currentTarget,[w,k]=Hz(y);w&&k?!p.shiftKey&&v===k?(p.preventDefault(),n&&ui(w,{select:!0})):p.shiftKey&&v===w&&(p.preventDefault(),n&&ui(k,{select:!0})):v===y&&p.preventDefault()}},[n,r,m.paused]);return d.jsx(_e.div,{tabIndex:-1,...o,ref:f,onKeyDown:b})});v_.displayName=Wz;function qz(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(ui(r,{select:e}),document.activeElement!==n)return}function Hz(t){const e=y_(t),n=px(e,t),r=px(e.reverse(),t);return[n,r]}function y_(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function px(t,e){for(const n of t)if(!Kz(n,{upTo:e}))return n}function Kz(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Gz(t){return t instanceof HTMLInputElement&&"select"in t}function ui(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Gz(t)&&e&&t.select()}}var gx=Jz();function Jz(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=vx(t,e),t.unshift(e)},remove(e){var n;t=vx(t,e),(n=t[0])==null||n.resume()}}}function vx(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Yz(t){return t.filter(e=>e.tagName!=="A")}function Qz(t){const e=x.useRef({value:t,previous:t});return x.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Xz=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body}
vendor: 6,960 bytes, lines 669-684
669,co=new WeakMap,tu=new WeakMap,nu={},Wf=0,b_=function(t){return t&&(t.host||b_(t.parentNode))},Zz=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=b_(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},e$=function(t,e,n,r){var i=Zz(e,Array.isArray(t)?t:[t]);nu[n]||(nu[n]=new WeakMap);var s=nu[n],o=[],a=new Set,l=new Set(i),c=function(h){!h||a.has(h)||(a.add(h),c(h.parentNode))};i.forEach(c);var u=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(f){if(a.has(f))u(f);else try{var m=f.getAttribute(r),b=m!==null&&m!=="false",p=(co.get(f)||0)+1,g=(s.get(f)||0)+1;co.set(f,p),s.set(f,g),o.push(f),p===1&&b&&tu.set(f,!0),g===1&&f.setAttribute(n,"true"),b||f.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",f,v)}})};return u(e),a.clear(),Wf++,function(){o.forEach(function(h){var f=co.get(h)-1,m=s.get(h)-1;co.set(h,f),s.set(h,m),f||(tu.has(h)||h.removeAttribute(r),tu.delete(h)),m||h.removeAttribute(n)}),Wf--,Wf||(co=new WeakMap,co=new WeakMap,tu=new WeakMap,nu={})}},t$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=Xz(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),e$(r,i,n,"aria-hidden")):function(){return null}},pr=function(){return pr=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},pr.apply(this,arguments)};function w_(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function n$(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var ju="right-scroll-bar-position",Du="width-before-scroll-bar",r$="with-scroll-bars-hidden",i$="--removed-body-scroll-bar-size";function qf(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function s$(t,e){var n=x.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var o$=typeof window<"u"?x.useLayoutEffect:x.useEffect,yx=new WeakMap;function a$(t,e){var n=s$(null,function(r){return t.forEach(function(i){return qf(i,r)})});return o$(function(){var r=yx.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||qf(a,null)}),s.forEach(function(a){i.has(a)||qf(a,o)})}yx.set(n,t)},[t]),n}function l$(t){return t}function c$(t,e){e===void 0&&(e=l$);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var o=e(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return i}function u$(t){t===void 0&&(t={});var e=c$(null);return e.options=pr({async:!0,ssr:!1},t),e}var x_=function(t){var e=t.sideCar,n=w_(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,pr({},n))};x_.isSideCarExport=!0;function d$(t,e){return t.useMedium(e),x_}var k_=u$(),Hf=function(){},Th=x.forwardRef(function(t,e){var n=x.useRef(null),r=x.useState({onScrollCapture:Hf,onWheelCapture:Hf,onTouchMoveCapture:Hf}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,h=t.shards,f=t.sideCar,m=t.noRelative,b=t.noIsolation,p=t.inert,g=t.allowPinchZoom,v=t.as,y=v===void 0?"div":v,w=t.gapMode,k=w_(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,T=a$([n,e]),C=pr(pr({},k),i);return x.createElement(x.Fragment,null,u&&x.createElement(S,{sideCar:k_,removeScrollBar:c,shards:h,noRelative:m,noIsolation:b,inert:p,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:w}),o?x.cloneElement(x.Children.only(a),pr(pr({},C),{ref:T})):x.createElement(y,pr({},C,{className:l,ref:T}),a))});Th.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Th.classNames={fullWidth:Du,zeroRight:ju};var h$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function f$(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=h$();return e&&t.setAttribute("nonce",e),t}function m$(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function p$(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var g$=function(){var t=0,e=null;return{add:function(n){t==0&&(e=f$())&&(m$(e,n),p$(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},v$=function(){var t=g$();return function(e,n){x.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},S_=function(){var t=v$(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},y$={left:0,top:0,right:0,gap:0},Kf=function(t){return parseInt(t||"",10)||0},b$=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[Kf(n),Kf(r),Kf(i)]},w$=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return y$;var e=b$(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},x$=S_(),Xo="data-scroll-locked",k$=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
670  .`.concat(r$,` {
671   overflow: hidden `).concat(r,`;
672   padding-right: `).concat(a,"px ").concat(r,`;
673  }
674  body[`).concat(Xo,`] {
675    overflow: hidden `).concat(r,`;
676    overscroll-behavior: contain;
677    `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
678    padding-left: `.concat(i,`px;
679    padding-top: `).concat(s,`px;
680    padding-right: `).concat(o,`px;
681    margin-left:0;
682    margin-top:0;
683    margin-right: `).concat(a,"px ").concat(r,`;
684    `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";
684")].filter(Boolean).join(""),`
685  }
686  
687  .`).concat(ju,` {
688    right: `).concat(a,"px ").concat(r,`;
689  }
690  
691  .`).concat(Du,` {
692    margin-right: `).concat(a,"px ").concat(r,`;
693  }
694  
695  .`).concat(ju," .").concat(ju,` {
696    right: 0 `).concat(r,`;
697  }
698  
699  .`).concat(Du," .").concat(Du,` {
700    margin-right: 0 `).concat(r,`;
701  }
702  
703  body[`).concat(Xo,`] {
704    `).concat(i$,": ").concat(a,`px;
705  }
706`)},bx=function(){var t=parseInt(document.body.getAttribute(Xo)||"0",10);return isFinite(t)?t:0},S$=function(){x.useEffect(function(){return document.body.setAttribute(Xo,(bx()+1).toString()),function(){var t=bx()-1;t<=0?document.body.removeAttribute(Xo):document.body.setAttribute(Xo,t.toString())}},[])},T$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;S$();var s=x.useMemo(function(){return w$(i)},[i]);return x.createElement(x$,{styles:k$(s,!e,i,n?"":"!important")})},Xp=!1;if(typeof window<"u")try{var ru=Object.defineProperty({},"passive",{get:function(){return Xp=!0,!0}});window.addEventListener("test",ru,ru),window.removeEventListener("test",ru,ru)}catch{Xp=!1}var uo=Xp?{passive:!1}:!1,C$=function(t){return t.tagName==="TEXTAREA"},T_=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!C$(t)&&n[e]==="visible")},E$=function(t){return T_(t,"overflowY")},_$=function(t){return T_(t,"overflowX")},wx=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=C_(t,r);if(i){var s=E_(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},P$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},R$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},C_=function(t,e){return t==="v"?E$(e):_$(e)},E_=function(t,e){return t==="v"?P$(e):R$(e)},I$=function(t,e){return t==="h"&&e==="rtl"?-1:1},N$=function(t,e,n,r,i){var s=I$(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,u=o>0,h=0,f=0;do{if(!a)break;var m=E_(t,a),b=m[0],p=m[1],g=m[2],v=p-g-s*b;(b||v)&&C_(t,a)&&(h+=v,f+=b);var y=a.parentNode;a=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&(Math.abs(h)<1||!i)||!u&&(Math.abs(f)<1||!i))&&(c=!0),c},iu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},xx=function(t){return[t.deltaX,t.deltaY]},kx=function(t){return t&&"current"in t?t.current:t},A$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},O$=function(t){return`
707  .block-interactivity-`.concat(t,` {pointer-events: none;}
708  .allow-interactivity-`).concat(t,` {pointer-events: all;}
709`)},M$=0,ho=[];function j$(t){var e=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),i=x.useState(M$++)[0],s=x.useState(S_)[0],o=x.useRef(t);x.useEffect(function(){o.current=t},[t]),x.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var p=n$([t.lockRef.current],(t.shards||[]).map(kx),!0).filter(Boolean);return p.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),p.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=x.useCallback(function(p,g){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var v=iu(p),y=n.current,w="deltaX"in p?p.deltaX:y[0]-v[0],k="deltaY"in p?p.deltaY:y[1]-v[1],S,T=p.target,C=Math.abs(w)>Math.abs(k)?"h":"v";if("touches"in p&&C==="h"&&T.type==="range")return!1;var _=wx(C,T);if(!_)return!0;if(_?S=C:(S=C==="v"?"h":"v",_=wx(C,T)),!_)return!1;if(!r.current&&"changedTouches"in p&&(w||k)&&(r.current=S),!S)return!0;var P=r.current||S;return N$(P,g,p,P==="h"?w:k,!0)},[]),l=x.useCallback(function(p){var g=p;if(!(!ho.length||ho[ho.length-1]!==s)){var v="deltaY"in g?xx(g):iu(g),y=e.current.filter(function(S){return S.name===g.type&&(S.target===g.target||g.target===S.shadowParent)&&A$(S.delta,v)}
vendor: 5,202 bytes, line 709
709)[0];if(y&&y.should){g.cancelable&&g.preventDefault();return}if(!y){var w=(o.current.shards||[]).map(kx).filter(Boolean).filter(function(S){return S.contains(g.target)}),k=w.length>0?a(g,w[0]):!o.current.noIsolation;k&&g.cancelable&&g.preventDefault()}}},[]),c=x.useCallback(function(p,g,v,y){var w={name:p,delta:g,target:v,should:y,shadowParent:D$(v)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(k){return k!==w})},1)},[]),u=x.useCallback(function(p){n.current=iu(p),r.current=void 0},[]),h=x.useCallback(function(p){c(p.type,xx(p),p.target,a(p,t.lockRef.current))},[]),f=x.useCallback(function(p){c(p.type,iu(p),p.target,a(p,t.lockRef.current))},[]);x.useEffect(function(){return ho.push(s),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",l,uo),document.addEventListener("touchmove",l,uo),document.addEventListener("touchstart",u,uo),function(){ho=ho.filter(function(p){return p!==s}),document.removeEventListener("wheel",l,uo),document.removeEventListener("touchmove",l,uo),document.removeEventListener("touchstart",u,uo)}},[]);var m=t.removeScrollBar,b=t.inert;return x.createElement(x.Fragment,null,b?x.createElement(s,{styles:O$(i)}):null,m?x.createElement(T$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function D$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const L$=d$(k_,j$);var __=x.forwardRef(function(t,e){return x.createElement(Th,pr({},t,{ref:e,sideCar:L$}))});__.classNames=Th.classNames;var U$=[" ","Enter","ArrowUp","ArrowDown"],F$=[" ","Enter"],zs="Select",[Ch,Eh,B$]=KS(zs),[Ra,RV]=pc(zs,[B$,rh]),_h=rh(),[z$,Zi]=Ra(zs),[$$,V$]=Ra(zs),P_=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:h,disabled:f,required:m,form:b}=t,p=_h(e),[g,v]=x.useState(null),[y,w]=x.useState(null),[k,S]=x.useState(!1),T=$z(c),[C,_]=$m({prop:r,defaultProp:i??!1,onChange:s,caller:zs}),[P,R]=$m({prop:o,defaultProp:a,onChange:l,caller:zs}),A=x.useRef(null),O=g?b||!!g.closest("form"):!0,[K,F]=x.useState(new Set),Y=Array.from(K).map(V=>V.props.value).join(";");return d.jsx(KM,{...p,children:d.jsxs(z$,{required:m,scope:e,trigger:g,onTriggerChange:v,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:k,onValueNodeHasChildrenChange:S,contentId:fv(),value:P,onValueChange:R,open:C,onOpenChange:_,dir:T,triggerPointerDownPosRef:A,disabled:f,children:[d.jsx(Ch.Provider,{scope:e,children:d.jsx($$,{scope:t.__scopeSelect,onNativeOptionAdd:x.useCallback(V=>{F(Q=>new Set(Q).add(V))},[]),onNativeOptionRemove:x.useCallback(V=>{F(Q=>{const N=new Set(Q);return N.delete(V),N})},[]),children:n})}),O?d.jsxs(X_,{"aria-hidden":!0,required:m,tabIndex:-1,name:u,autoComplete:h,value:P,onChange:V=>R(V.target.value),disabled:f,form:b,children:[P===void 0?d.jsx("option",{value:""}):null,Array.from(K)]},Y):null]})})};P_.displayName=zs;var R_="SelectTrigger",I_=x.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=_h(n),o=Zi(R_,n),a=o.disabled||r,l=et(e,o.onTriggerChange),c=Eh(n),u=x.useRef("touch"),[h,f,m]=eP(p=>{const g=c().filter(w=>!w.disabled),v=g.find(w=>w.value===o.value),y=tP(g,p,v);y!==void 0&&o.onValueChange(y.value)}),b=p=>{a||(o.onOpenChange(!0),m()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(sC,{asChild:!0,...s,children:d.jsx(_e.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Z_(o.value)?"":void 0,...i,ref:l,onClick:ge(i.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&b(p)}),onPointerDown:ge(i.onPointerDown,p=>{u.current=p.pointerType;const g=p.target;g.hasPointerCapture(p.pointerId)&&g.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(b(p),p.preventDefault())}),onKeyDown:ge(i.onKeyDown,p=>{const g=h.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&f(p.key),!(g&&p.key===" ")&&U$.includes(p.key)&&(b(),p.preventDefault())})})})});I_.displayName=R_;var N_="SelectValue",A_=x.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...a}=t,l=Zi(N_,n),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,h=et(e,l.onValueNodeChange);return Tt(()=>{c(u)},[c,u]),d.jsx(_e.span,{...a,ref:h,style:{pointerEvents:"none"},children:Z_(l.value)?d.jsx(d.Fragment,{children:o}):s})});A_.displayName=N_;var W$="SelectIcon",O_=x.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return d.jsx(_e.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});O_.displayName=W$;var q$="SelectPortal",M_=t=>d.jsx(ev,{asChild:!0,...t});M_.displayName=q$;var $s="SelectContent",j_=x.forwardRef((t,e)=>{const n=Zi($s,t.__scopeSelect),[r,i]=x.useState();if(Tt(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?qs.createPortal(d.jsx(D_,{scope:t.__scopeSelect,children:d.jsx(Ch.Slot,{scope:t.__scopeSelect,children:d.jsx("div",{children:t.children})})}),s):null}return d.jsx(L_,{...t,ref:e})});
vendor: 14,632 bytes, line 709
709j_.displayName=$s;var On=10,[D_,es]=Ra($s),H$="SelectContentImpl",K$=Fl("SelectContent.RemoveScroll"),L_=x.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:h,collisionBoundary:f,collisionPadding:m,sticky:b,hideWhenDetached:p,avoidCollisions:g,...v}=t,y=Zi($s,n),[w,k]=x.useState(null),[S,T]=x.useState(null),C=et(e,G=>k(G)),[_,P]=x.useState(null),[R,A]=x.useState(null),O=Eh(n),[K,F]=x.useState(!1),Y=x.useRef(!1);x.useEffect(()=>{if(w)return t$(w)},[w]),Vz();const V=x.useCallback(G=>{const[Te,...Ge]=O().map(we=>we.ref.current),[Se]=Ge.slice(-1),ve=document.activeElement;for(const we of G)if(we===ve||(we==null||we.scrollIntoView({block:"nearest"}),we===Te&&S&&(S.scrollTop=0),we===Se&&S&&(S.scrollTop=S.scrollHeight),we==null||we.focus(),document.activeElement!==ve))return},[O,S]),Q=x.useCallback(()=>V([_,w]),[V,_,w]);x.useEffect(()=>{K&&Q()},[K,Q]);const{onOpenChange:N,triggerPointerDownPosRef:M}=y;x.useEffect(()=>{if(w){let G={x:0,y:0};const Te=Se=>{var ve,we;G={x:Math.abs(Math.round(Se.pageX)-(((ve=M.current)==null?void 0:ve.x)??0)),y:Math.abs(Math.round(Se.pageY)-(((we=M.current)==null?void 0:we.y)??0))}},Ge=Se=>{G.x<=10&&G.y<=10?Se.preventDefault():w.contains(Se.target)||N(!1),document.removeEventListener("pointermove",Te),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",Te),document.addEventListener("pointerup",Ge,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Te),document.removeEventListener("pointerup",Ge,{capture:!0})}}},[w,N,M]),x.useEffect(()=>{const G=()=>N(!1);return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[N]);const[H,te]=eP(G=>{const Te=O().filter(ve=>!ve.disabled),Ge=Te.find(ve=>ve.ref.current===document.activeElement),Se=tP(Te,G,Ge);Se&&setTimeout(()=>Se.ref.current.focus())}),X=x.useCallback((G,Te,Ge)=>{const Se=!Y.current&&!Ge;(y.value!==void 0&&y.value===Te||Se)&&(P(G),Se&&(Y.current=!0))},[y.value]),se=x.useCallback(()=>w==null?void 0:w.focus(),[w]),oe=x.useCallback((G,Te,Ge)=>{const Se=!Y.current&&!Ge;(y.value!==void 0&&y.value===Te||Se)&&A(G)},[y.value]),Pe=r==="popper"?Zp:U_,Oe=Pe===Zp?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:h,collisionBoundary:f,collisionPadding:m,sticky:b,hideWhenDetached:p,avoidCollisions:g}:{};return d.jsx(D_,{scope:n,content:w,viewport:S,onViewportChange:T,itemRefCallback:X,selectedItem:_,onItemLeave:se,itemTextRefCallback:oe,focusSelectedItem:Q,selectedItemText:R,position:r,isPositioned:K,searchRef:H,children:d.jsx(__,{as:K$,allowPinchZoom:!0,children:d.jsx(v_,{asChild:!0,trapped:y.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:ge(i,G=>{var Te;(Te=y.trigger)==null||Te.focus({preventScroll:!0}),G.preventDefault()}),children:d.jsx(Yd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:d.jsx(Pe,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:G=>G.preventDefault(),...v,...Oe,onPlaced:()=>F(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:ge(v.onKeyDown,G=>{const Te=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!Te&&G.key.length===1&&te(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let Se=O().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);if(["ArrowUp","End"].includes(G.key)&&(Se=Se.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const ve=G.target,we=Se.indexOf(ve);Se=Se.slice(we+1)}setTimeout(()=>V(Se)),G.preventDefault()}})})})})})})});L_.displayName=H$;var G$="SelectItemAlignedPosition",U_=x.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=Zi($s,n),o=es($s,n),[a,l]=x.useState(null),[c,u]=x.useState(null),h=et(e,C=>u(C)),f=Eh(n),m=x.useRef(!1),b=x.useRef(!0),{viewport:p,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,w=x.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&p&&g&&v){const C=s.trigger.getBoundingClientRect(),_=c.getBoundingClientRect(),P=s.valueNode.getBoundingClientRect(),R=v.getBoundingClientRect();if(s.dir!=="rtl"){const ve=R.left-_.left,we=P.left-ve,Ct=C.left-we,hn=C.width+Ct,ts=Math.max(hn,_.width),Xr=window.innerWidth-On,ns=hx(we,[On,Math.max(On,Xr-ts)]);a.style.minWidth=hn+"px",a.style.left=ns+"px"}else{const ve=_.right-R.right,we=window.innerWidth-P.right-ve,Ct=window.innerWidth-C.right-we,hn=C.width+Ct,ts=Math.max(hn,_.width),Xr=window.innerWidth-On,ns=hx(we,[On,Math.max(On,Xr-ts)]);a.style.minWidth=hn+"px",a.style.right=ns+"px"}const A=f(),O=window.innerHeight-On*2,K=p.scrollHeight,F=window.getComputedStyle(c),Y=parseInt(F.borderTopWidth,10),V=parseInt(F.paddingTop,10),Q=parseInt(F.borderBottomWidth,10),N=parseInt(F.paddingBottom,10),M=Y+V+K+N+Q,H=Math.min(g.offsetHeight*5,M),te=window.getComputedStyle(p),X=parseInt(te.paddingTop,10),se=parseInt(te.paddingBottom,10),oe=C.top+C.height/2-On,Pe=O-oe,Oe=g.offsetHeight/2,G=g.offsetTop+Oe,Te=Y+V+G,Ge=M-Te;if(Te<=oe){const ve=A.length>0&&g===A[A.length-1].ref.current;a.style.bottom="0px";const we=c.clientHeight-p.offsetTop-p.offsetHeight,Ct=Math.max(Pe,Oe+(ve?se:0)+we+Q),hn=Te+Ct;a.style.height=hn+"px"}else{const ve=A.length>0&&g===A[0].ref.current;a.style.top="0px";const Ct=Math.max(oe,Y+p.offsetTop+(ve?X:0)+Oe)+Ge;a.style.height=Ct+"px",p.scrollTop=Te-oe+p.offsetTop}a.style.margin=`${On}px 0`,a.style.minHeight=H+"px",a.style.maxHeight=O+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[f,s.trigger,s.valueNode,a,c,p,g,v,s.dir,r]);Tt(()=>w(),[w]);const[k,S]=x.useState();Tt(()=>{c&&S(window.getComputedStyle(c).zIndex)},[c]);const T=x.useCallback(C=>{C&&b.current===!0&&(w(),y==null||y(),b.current=!1)},[w,y]);return d.jsx(Y$,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:m,onScrollButtonChange:T,children:d.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:d.jsx(_e.div,{...i,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});U_.displayName=G$;var J$="SelectPopperPosition",Zp=x.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=On,...s}=t,o=_h(n);return d.jsx(oC,{...o,...s,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Zp.displayName=J$;var[Y$,cy]=Ra($s,{}),eg="SelectViewport",F_=x.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=es(eg,n),o=cy(eg,n),a=et(e,s.onViewportChange),l=x.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),d.jsx(Ch.Slot,{scope:n,children:d.jsx(_e.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ge(i.onScroll,c=>{const u=c.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&h){const m=Math.abs(l.current-u.scrollTop);if(m>0){const b=window.innerHeight-On*2,p=parseFloat(h.style.minHeight),g=parseFloat(h.style.height),v=Math.max(p,g);if(v<b){const y=v+m,w=Math.min(b,y),k=y-w;h.style.height=w+"px",h.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,h.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});F_.displayName=eg;var B_="SelectGroup",[Q$,X$]=Ra(B_),Z$=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=fv();return d.jsx(Q$,{scope:n,id:i,children:d.jsx(_e.div,{role:"group","aria-labelledby":i,...r,ref:e})})});Z$.displayName=B_;var z_="SelectLabel",$_=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=X$(z_,n);return d.jsx(_e.div,{id:i.id,...r,ref:e})});$_.displayName=z_;var Od="SelectItem",[eV,V_]=Ra(Od),W_=x.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=t,a=Zi(Od,n),l=es(Od,n),c=a.value===r,[u,h]=x.useState(s??""),[f,m]=x.useState(!1),b=et(e,y=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,y,r,i)}),p=fv(),g=x.useRef("touch"),v=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(eV,{scope:n,value:r,disabled:i,textId:p,isSelected:c,onItemTextChange:x.useCallback(y=>{h(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:d.jsx(Ch.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:d.jsx(_e.div,{role:"option","aria-labelledby":p,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:b,onFocus:ge(o.onFocus,()=>m(!0)),onBlur:ge(o.onBlur,()=>m(!1)),onClick:ge(o.onClick,()=>{g.current!=="mouse"&&v()}),onPointerUp:ge(o.onPointerUp,()=>{g.current==="mouse"&&v()}),onPointerDown:ge(o.onPointerDown,y=>{g.current=y.pointerType}),onPointerMove:ge(o.onPointerMove,y=>{var w;g.current=y.pointerType,i?(w=l.onItemLeave)==null||w.call(l):g.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ge(o.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:ge(o.onKeyDown,y=>{var k;((k=l.searchRef)==null?void 0:k.current)!==""&&y.key===" "||(F$.includes(y.key)&&v(),y.key===" "&&y.preventDefault())})})})})});W_.displayName=Od;var il="SelectItemText",q_=x.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,o=Zi(il,n),a=es(il,n),l=V_(il,n),c=V$(il,n),[u,h]=x.useState(null),f=et(e,v=>h(v),l.onItemTextChange,v=>{var y;return(y=a.itemTextRefCallback)==null?void 0:y.call(a,v,l.value,l.disabled)}),m=u==null?void 0:u.textContent,b=x.useMemo(()=>d.jsx("option",{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:p,onNativeOptionRemove:g}=c;return Tt(()=>(p(b),()=>g(b)),[p,g,b]),d.jsxs(d.Fragment,{children:[d.jsx(_e.span,{id:l.textId,...s,ref:f}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?qs.createPortal(s.children,o.valueNode):null]})});q_.displayName=il;var H_="SelectItemIndicator",K_=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return V_(H_,n).isSelected?d.jsx(_e.span,{"aria-hidden":!0,...r,ref:e}):null});K_.displayName=H_;var tg="SelectScrollUpButton",G_=x.forwardRef((t,e)=>{const n=es(tg,t.__scopeSelect),r=cy(tg,t.__scopeSelect),[i,s]=x.useState(!1),o=et(e,r.onScrollButtonChange);return Tt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?d.jsx(Y_,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});G_.displayName=tg;var ng="SelectScrollDownButton",J_=x.forwardRef((t,e)=>{const n=es(ng,t.__scopeSelect),r=cy(ng,t.__scopeSelect),[i,s]=x.useState(!1),o=et(e,r.onScrollButtonChange);return Tt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?d.jsx(Y_,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});J_.displayName=ng;var Y_=x.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=es("SelectScrollButton",n),o=x.useRef(null),a=Eh(n),l=x.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return x.useEffect(()=>()=>l(),[l]),Tt(()=>{var u;const c=a().find(h=>h.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),d.jsx(_e.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:ge(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:ge(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:ge(i.onPointerLeave,()=>{l()})})}),tV="SelectSeparator",Q_=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return d.jsx(_e.div,{"aria-hidden":!0,...r,ref:e})});Q_.displayName=tV;var rg="SelectArrow",nV=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=_h(n),s=Zi(rg,n),o=es(rg,n);return s.open&&o.position==="popper"?d.jsx(aC,{...i,...r,ref:e}):null});nV.displayName=rg;var rV="SelectBubbleInput",X_=x.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=x.useRef(null),s=et(r,i),o=Qz(e);return x.useEffect(()=>{const a=i.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&u){const h=new Event("change",{bubbles:!0});u.call(a,e),a.dispatchEvent(h)}},[o,e]),d.jsx(_e.select,{...n,style:{...XS,...n.style},ref:s,defaultValue:e})});X_.displayName=rV;function Z_(t){return t===""||t===void 0}function eP(t){const e=Qn(t),n=x.useRef(""),r=x.useRef(0),i=x.useCallback(o=>{const a=n.current+o;e(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[e]),s=x.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function tP(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=iV(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function iV(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var sV=P_,nP=I_,oV=A_,aV=O_,lV=M_,rP=j_,cV=F_,iP=$_,sP=W_,uV=q_,dV=K_,oP=G_,aP=J_,lP=Q_;const hV=sV,fV=oV,cP=x.forwardRef(({className:t,children:e,...n},r)=>d.jsxs(nP,{ref:r,className:ce("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
709ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,d.jsx(aV,{asChild:!0,children:d.jsx(ST,{className:"h-4 w-4 opacity-50"})})]}));cP.displayName=nP.displayName;const uP=x.forwardRef(({className:t,...e},n)=>d.jsx(oP,{ref:n,className:ce("flex cursor-default items-center justify-center py-1",t),...e,children:d.jsx(tA,{className:"h-4 w-4"})}));uP.displayName=oP.displayName;const dP=x.forwardRef(({className:t,...e},n)=>d.jsx(aP,{ref:n,className:ce("flex cursor-default items-center justify-center py-1",t),...e,children:d.jsx(ST,{className:"h-4 w-4"})}));dP.displayName=aP.displayName;const hP=x.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>d.jsx(lV,{children:d.jsxs(rP,{ref:i,className:ce("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[d.jsx(uP,{}),d.jsx(cV,{className:ce("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),d.jsx(dP,{})]})}));hP.displayName=rP.displayName;const mV=x.forwardRef(({className:t,...e},n)=>d.jsx(iP,{ref:n,className:ce("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));mV.displayName=iP.displayName;const fP=x.forwardRef(({className:t,children:e,...n},r)=>d.jsxs(sP,{ref:r,className:ce("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...n,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(dV,{children:d.jsx(eA,{className:"h-4 w-4"})})}),d.jsx(uV,{children:e})]}));fP.displayName=sP.displayName;const pV=x.forwardRef(({className:t,...e},n)=>d.jsx(lP,{ref:n,className:ce("-mx-1 my-1 h-px bg-muted",t),...e}));pV.displayName=lP.displayName;const gV=()=>{const[t,e]=x.useState(null),[n,r]=x.useState(!0),[i,s]=x.useState([]),[o,a]=x.useState(""),[l,c]=x.useState(""),[u,h]=x.useState(""),[f,m]=x.useState(!1),[b,p]=x.useState(null),[g,v]=x.useState(!1),y=_v(),{toast:w}=Zg();x.useEffect(()=>{const{data:{subscription:C}}=dr.auth.onAuthStateChange((_,P)=>{e(P),P||y("/auth"),r(!1)});return dr.auth.getSession().then(({data:{session:_}})=>{e(_),_||y("/auth"),r(!1)}),()=>C.unsubscribe()},[y]),x.useEffect(()=>{t&&dr.from("style_templates").select("*").then(({data:C})=>{C&&s(C)})},[t]);const k=async()=>{const C=i.find(_=>_.id===o);if(!C||!l.trim()){w({title:"Bitte Template und Stichworte angeben",variant:"destructive"});return}m(!0),p(null);try{const _=u.split(`
710`).map(A=>A.trim()).filter(Boolean),{data:P,error:R}=await dr.functions.invoke("generate-blog-post",{body:{keywords:l.trim(),links:_,systemPrompt:C.system_prompt,tone:C.tone,structure:C.structure}});if(R)throw R;if(P!=null&&P.error)throw new Error(P.error);p(P),w({title:"Artikel generiert!"})}catch(_){w({title:"Generierung fehlgeschlagen",description:_.message,variant:"destructive"})}finally{m(!1)}},S=async C=>{var _,P;if(b){v(!0);try{const{error:R}=await dr.from("blog_posts").insert({title:b.title,slug:b.slug,excerpt:b.excerpt,content:b.content,published:!C,published_at:C?null:new Date().toISOString(),author_name:((P=(_=t==null?void 0:t.user)==null?void 0:_.email)==null?void 0:P.split("@")[0])||"PromptPeak Team"});if(R)throw R;w({title:C?"Als Entwurf gespeichert":"Veröffentlicht!",description:C?"Der Artikel wurde als Entwurf gespeichert.":`Der Artikel ist jetzt unter /blog/${b.slug} erreichbar.`}),p(null),c(""),h("")}catch(R){w({title:"Fehler beim Speichern",description:R.message,variant:"destructive"})}finally{v(!1)}}},T=async()=>{await dr.auth.signOut(),y("/")};return n?d.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:d.jsx(j0,{className:"w-8 h-8 animate-spin text-primary"})}):d.jsxs(d.Fragment,{children:[d.jsx(er,{children:d.jsx("title",{children:"Blog Generator – PromptPeak"})}),d.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[d.jsx(tr,{}),d.jsx("main",{className:"pt-32 pb-20",children:d.jsxs("div",{className:"container mx-auto px-6 max-w-4xl",children:[d.jsxs("div",{className:"flex items-center justify-between mb-10",children:[d.jsx("h1",{className:"font-display font-bold text-3xl",children:"Blog Generator"}),d.jsxs(De,{variant:"ghost",size:"sm",onClick:T,children:[d.jsx(uA,{className:"w-4 h-4 mr-2"})," Abmelden"]})]}),d.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx(Qo,{children:"Stil-Template"}),d.jsxs(hV,{value:o,onValueChange:a,children:[d.jsx(cP,{className:"mt-1",children:d.jsx(fV,{placeholder:"Template wählen..."})}),d.jsx(hP,{children:i.map(C=>d.jsx(fP,{value:C.id,children:d.jsxs("div",{children:[d.jsx("span",{className:"font-medium",children:C.name}),C.description&&d.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["— ",C.description]})]})},C.id))})]})]}),d.jsxs("div",{children:[d.jsx(Qo,{htmlFor:"keywords",children:"Stichworte / Thema"}),d.jsx(Qp,{id:"keywords",placeholder:"z.B. KI im Mittelstand, Prozessautomatisierung, OfficePulse Vorteile...",value:l,onCh
710ange:C=>c(C.target.value),className:"mt-1 min-h-[100px]"})]}),d.jsxs("div",{children:[d.jsx(Qo,{htmlFor:"links",children:"Referenz-Links (optional, einer pro Zeile)"}),d.jsx(Qp,{id:"links",placeholder:`https://example.com/article
711https://another-source.com`,value:u,onChange:C=>h(C.target.value),className:"mt-1 min-h-[80px]"})]}),d.jsx(De,{onClick:k,disabled:f||!o||!l.trim(),className:"w-full",children:f?d.jsxs(d.Fragment,{children:[d.jsx(j0,{className:"w-4 h-4 animate-spin mr-2"})," Generiert..."]}):d.jsxs(d.Fragment,{children:[d.jsx(cv,{className:"w-4 h-4 mr-2"})," Artikel generieren"]})})]}),d.jsx("div",{children:b?d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(M0,{className:"w-4 h-4 text-primary"}),d.jsx("span",{className:"font-medium text-sm text-primary",children:"Vorschau"})]}),d.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 space-y-4",children:[d.jsx("h2",{className:"font-display font-bold text-xl",children:b.title}),d.jsx("p",{className:"text-sm text-muted-foreground italic",children:b.excerpt}),d.jsx("div",{className:"border-t border-border pt-4",children:d.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",dangerouslySetInnerHTML:{__html:b.content}})}),d.jsxs("p",{className:"text-xs text-muted-foreground",children:["Slug: /blog/",b.slug]})]}),d.jsxs("div",{className:"flex gap-3",children:[d.jsxs(De,{onClick:()=>S(!1),disabled:g,className:"flex-1",children:[d.jsx(xA,{className:"w-4 h-4 mr-2"})," Veröffentlichen"]}),d.jsx(De,{variant:"outline",onClick:()=>S(!0),disabled:g,className:"flex-1",children:"Als Entwurf speichern"})]})]}):d.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-muted/30 p-12 text-center",children:[d.jsx(M0,{className:"w-8 h-8 text-muted-foreground mx-auto mb-3"}),d.jsx("p",{className:"text-muted-foreground text-sm",children:'Wähle ein Template, gib Stichworte ein und klicke auf "Generieren" — die Vorschau erscheint hier.'})]})})]})]})}),d.jsx(rr,{})]})]})},vV=()=>{const t=Ks(),{t:e}=Ke();return x.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),d.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:d.jsxs("div",{className:"text-center",children:[d.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),d.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:e("Seite nicht gefunden","Page not found")}),d.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:e("Zurück zur Startseite","Return to Home")})]})})},yV=new jj,bV=()=>d.jsx(BC,{children:d.jsx(f2,{defaultTheme:"system",storageKey:"promptpeak-theme",children:d.jsx(p2,{children:d.jsx(Lj,{client:yV,children:d.jsxs(dj,{children:[d.jsx(oO,{}),d.jsx(UO,{}),d.jsxs(MD,{children:[d.jsx(g2,{}),d.jsxs(_D,{children:[d.jsx(Xt,{path:"/",element:d.jsx(fz,{})}),d.jsx(Xt,{path:"/legal",element:d.jsx(pz,{})}),d.jsx(Xt,{path:"/kmu",element:d.jsx(bz,{})}),d.jsx(Xt,{path:"/max",element:d.jsx(Nz,{})}),d.jsx(Xt,{path:"/culture",element:d.jsx(Oz,{})}),d.jsx(Xt,{path:"/impressum",element:d.jsx(Mz,{})}),d.jsx(Xt,{path:"/datenschutz",element:d.jsx(jz,{})}),d.jsx(Xt,{path:"/blog",element:d.jsx(Dz,{})}),d.jsx(Xt,{path:"/blog/:slug",element:d.jsx(Lz,{})}),d.jsx(Xt,{path:"/auth",element:d.jsx(Bz,{})}),d.jsx(Xt,{path:"/admin",element:d.jsx(gV,{})}),d.jsx(Xt,{path:"*",element:d.jsx(vV,{})})]})]})]})})})})});WS(document.getElementById("root")).render(d.jsx(bV,{}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.