@developer.notchatbot/webchat 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(Ce,pe){typeof exports=="object"&&typeof module!="undefined"?pe(exports):typeof define=="function"&&define.amd?define(["exports"],pe):(Ce=typeof globalThis!="undefined"?globalThis:Ce||self,pe(Ce.WebChat={}))})(this,function(Ce){"use strict";var Xg=Object.defineProperty,Zg=Object.defineProperties;var qg=Object.getOwnPropertyDescriptors;var md=Object.getOwnPropertySymbols;var em=Object.prototype.hasOwnProperty,tm=Object.prototype.propertyIsEnumerable;var rl=(Ce,pe,Re)=>pe in Ce?Xg(Ce,pe,{enumerable:!0,configurable:!0,writable:!0,value:Re}):Ce[pe]=Re,fe=(Ce,pe)=>{for(var Re in pe||(pe={}))em.call(pe,Re)&&rl(Ce,Re,pe[Re]);if(md)for(var Re of md(pe))tm.call(pe,Re)&&rl(Ce,Re,pe[Re]);return Ce},Ve=(Ce,pe)=>Zg(Ce,qg(pe));var de=(Ce,pe,Re)=>rl(Ce,typeof pe!="symbol"?pe+"":pe,Re);var ot=(Ce,pe,Re)=>new Promise((ie,Ht)=>{var Ro=Ot=>{try{er(Re.next(Ot))}catch(tr){Ht(tr)}},Eo=Ot=>{try{er(Re.throw(Ot))}catch(tr){Ht(tr)}},er=Ot=>Ot.done?ie(Ot.value):Promise.resolve(Ot.value).then(Ro,Eo);er((Re=Re.apply(Ce,pe)).next())});var el;function pe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re={exports:{}},ie={};/**
1
+ (function(Ce,pe){typeof exports=="object"&&typeof module!="undefined"?pe(exports):typeof define=="function"&&define.amd?define(["exports"],pe):(Ce=typeof globalThis!="undefined"?globalThis:Ce||self,pe(Ce.WebChat={}))})(this,function(Ce){"use strict";var Xg=Object.defineProperty,Zg=Object.defineProperties;var qg=Object.getOwnPropertyDescriptors;var md=Object.getOwnPropertySymbols;var em=Object.prototype.hasOwnProperty,tm=Object.prototype.propertyIsEnumerable;var rl=(Ce,pe,Re)=>pe in Ce?Xg(Ce,pe,{enumerable:!0,configurable:!0,writable:!0,value:Re}):Ce[pe]=Re,fe=(Ce,pe)=>{for(var Re in pe||(pe={}))em.call(pe,Re)&&rl(Ce,Re,pe[Re]);if(md)for(var Re of md(pe))tm.call(pe,Re)&&rl(Ce,Re,pe[Re]);return Ce},Ve=(Ce,pe)=>Zg(Ce,qg(pe));var de=(Ce,pe,Re)=>rl(Ce,typeof pe!="symbol"?pe+"":pe,Re);var it=(Ce,pe,Re)=>new Promise((oe,Ht)=>{var Ri=Ot=>{try{er(Re.next(Ot))}catch(tr){Ht(tr)}},Ei=Ot=>{try{er(Re.throw(Ot))}catch(tr){Ht(tr)}},er=Ot=>Ot.done?oe(Ot.value):Promise.resolve(Ot.value).then(Ri,Ei);er((Re=Re.apply(Ce,pe)).next())});var el;function pe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re={exports:{}},oe={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ht=Symbol.for("react.element"),Ro=Symbol.for("react.portal"),Eo=Symbol.for("react.fragment"),er=Symbol.for("react.strict_mode"),Ot=Symbol.for("react.profiler"),tr=Symbol.for("react.provider"),vd=Symbol.for("react.context"),yd=Symbol.for("react.forward_ref"),wd=Symbol.for("react.suspense"),xd=Symbol.for("react.memo"),Sd=Symbol.for("react.lazy"),al=Symbol.iterator;function bd(e){return e===null||typeof e!="object"?null:(e=al&&e[al]||e["@@iterator"],typeof e=="function"?e:null)}var sl={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ll=Object.assign,ul={};function Rn(e,t,n){this.props=e,this.context=t,this.refs=ul,this.updater=n||sl}Rn.prototype.isReactComponent={},Rn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")},Rn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function cl(){}cl.prototype=Rn.prototype;function Oo(e,t,n){this.props=e,this.context=t,this.refs=ul,this.updater=n||sl}var To=Oo.prototype=new cl;To.constructor=Oo,ll(To,Rn.prototype),To.isPureReactComponent=!0;var fl=Array.isArray,dl=Object.prototype.hasOwnProperty,Ao={current:null},hl={key:!0,ref:!0,__self:!0,__source:!0};function pl(e,t,n){var r,i={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)dl.call(t,r)&&!hl.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){for(var d=Array(l),g=0;g<l;g++)d[g]=arguments[g+2];i.children=d}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:Ht,type:e,key:o,ref:a,props:i,_owner:Ao.current}}function Cd(e,t){return{$$typeof:Ht,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Io(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ht}function kd(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var gl=/\/+/g;function Mo(e,t){return typeof e=="object"&&e!==null&&e.key!=null?kd(""+e.key):t.toString(36)}function Jr(e,t,n,r,i){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Ht:case Ro:a=!0}}if(a)return a=e,i=i(a),e=r===""?"."+Mo(a,0):r,fl(i)?(n="",e!=null&&(n=e.replace(gl,"$&/")+"/"),Jr(i,t,n,"",function(g){return g})):i!=null&&(Io(i)&&(i=Cd(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(gl,"$&/")+"/")+e)),t.push(i)),1;if(a=0,r=r===""?".":r+":",fl(e))for(var l=0;l<e.length;l++){o=e[l];var d=r+Mo(o,l);a+=Jr(o,t,n,d,i)}else if(d=bd(e),typeof d=="function")for(e=d.call(e),l=0;!(o=e.next()).done;)o=o.value,d=r+Mo(o,l++),a+=Jr(o,t,n,d,i);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Yr(e,t,n){if(e==null)return e;var r=[],i=0;return Jr(e,r,"","",function(o){return t.call(n,o,i++)}),r}function Rd(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ze={current:null},Xr={transition:null},Ed={ReactCurrentDispatcher:ze,ReactCurrentBatchConfig:Xr,ReactCurrentOwner:Ao};function ml(){throw Error("act(...) is not supported in production builds of React.")}ie.Children={map:Yr,forEach:function(e,t,n){Yr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Yr(e,function(){t++}),t},toArray:function(e){return Yr(e,function(t){return t})||[]},only:function(e){if(!Io(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},ie.Component=Rn,ie.Fragment=Eo,ie.Profiler=Ot,ie.PureComponent=Oo,ie.StrictMode=er,ie.Suspense=wd,ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ed,ie.act=ml,ie.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=ll({},e.props),i=e.key,o=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,a=Ao.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(d in t)dl.call(t,d)&&!hl.hasOwnProperty(d)&&(r[d]=t[d]===void 0&&l!==void 0?l[d]:t[d])}var d=arguments.length-2;if(d===1)r.children=n;else if(1<d){l=Array(d);for(var g=0;g<d;g++)l[g]=arguments[g+2];r.children=l}return{$$typeof:Ht,type:e.type,key:i,ref:o,props:r,_owner:a}},ie.createContext=function(e){return e={$$typeof:vd,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:tr,_context:e},e.Consumer=e},ie.createElement=pl,ie.createFactory=function(e){var t=pl.bind(null,e);return t.type=e,t},ie.createRef=function(){return{current:null}},ie.forwardRef=function(e){return{$$typeof:yd,render:e}},ie.isValidElement=Io,ie.lazy=function(e){return{$$typeof:Sd,_payload:{_status:-1,_result:e},_init:Rd}},ie.memo=function(e,t){return{$$typeof:xd,type:e,compare:t===void 0?null:t}},ie.startTransition=function(e){var t=Xr.transition;Xr.transition={};try{e()}finally{Xr.transition=t}},ie.unstable_act=ml,ie.useCallback=function(e,t){return ze.current.useCallback(e,t)},ie.useContext=function(e){return ze.current.useContext(e)},ie.useDebugValue=function(){},ie.useDeferredValue=function(e){return ze.current.useDeferredValue(e)},ie.useEffect=function(e,t){return ze.current.useEffect(e,t)},ie.useId=function(){return ze.current.useId()},ie.useImperativeHandle=function(e,t,n){return ze.current.useImperativeHandle(e,t,n)},ie.useInsertionEffect=function(e,t){return ze.current.useInsertionEffect(e,t)},ie.useLayoutEffect=function(e,t){return ze.current.useLayoutEffect(e,t)},ie.useMemo=function(e,t){return ze.current.useMemo(e,t)},ie.useReducer=function(e,t,n){return ze.current.useReducer(e,t,n)},ie.useRef=function(e){return ze.current.useRef(e)},ie.useState=function(e){return ze.current.useState(e)},ie.useSyncExternalStore=function(e,t,n){return ze.current.useSyncExternalStore(e,t,n)},ie.useTransition=function(){return ze.current.useTransition()},ie.version="18.3.1",Re.exports=ie;var te=Re.exports;const Po=pe(te);var vl={exports:{}},qe={},yl={exports:{}},wl={};/**
9
+ */var Ht=Symbol.for("react.element"),Ri=Symbol.for("react.portal"),Ei=Symbol.for("react.fragment"),er=Symbol.for("react.strict_mode"),Ot=Symbol.for("react.profiler"),tr=Symbol.for("react.provider"),vd=Symbol.for("react.context"),yd=Symbol.for("react.forward_ref"),wd=Symbol.for("react.suspense"),xd=Symbol.for("react.memo"),Sd=Symbol.for("react.lazy"),al=Symbol.iterator;function bd(e){return e===null||typeof e!="object"?null:(e=al&&e[al]||e["@@iterator"],typeof e=="function"?e:null)}var sl={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ll=Object.assign,ul={};function Rn(e,t,n){this.props=e,this.context=t,this.refs=ul,this.updater=n||sl}Rn.prototype.isReactComponent={},Rn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")},Rn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function cl(){}cl.prototype=Rn.prototype;function Oi(e,t,n){this.props=e,this.context=t,this.refs=ul,this.updater=n||sl}var Ti=Oi.prototype=new cl;Ti.constructor=Oi,ll(Ti,Rn.prototype),Ti.isPureReactComponent=!0;var fl=Array.isArray,dl=Object.prototype.hasOwnProperty,Ai={current:null},hl={key:!0,ref:!0,__self:!0,__source:!0};function pl(e,t,n){var r,o={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)dl.call(t,r)&&!hl.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1<l){for(var d=Array(l),g=0;g<l;g++)d[g]=arguments[g+2];o.children=d}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)o[r]===void 0&&(o[r]=l[r]);return{$$typeof:Ht,type:e,key:i,ref:a,props:o,_owner:Ai.current}}function Cd(e,t){return{$$typeof:Ht,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Ii(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ht}function kd(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var gl=/\/+/g;function Pi(e,t){return typeof e=="object"&&e!==null&&e.key!=null?kd(""+e.key):t.toString(36)}function Jr(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Ht:case Ri:a=!0}}if(a)return a=e,o=o(a),e=r===""?"."+Pi(a,0):r,fl(o)?(n="",e!=null&&(n=e.replace(gl,"$&/")+"/"),Jr(o,t,n,"",function(g){return g})):o!=null&&(Ii(o)&&(o=Cd(o,n+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(gl,"$&/")+"/")+e)),t.push(o)),1;if(a=0,r=r===""?".":r+":",fl(e))for(var l=0;l<e.length;l++){i=e[l];var d=r+Pi(i,l);a+=Jr(i,t,n,d,o)}else if(d=bd(e),typeof d=="function")for(e=d.call(e),l=0;!(i=e.next()).done;)i=i.value,d=r+Pi(i,l++),a+=Jr(i,t,n,d,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Yr(e,t,n){if(e==null)return e;var r=[],o=0;return Jr(e,r,"","",function(i){return t.call(n,i,o++)}),r}function Rd(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ze={current:null},Xr={transition:null},Ed={ReactCurrentDispatcher:ze,ReactCurrentBatchConfig:Xr,ReactCurrentOwner:Ai};function ml(){throw Error("act(...) is not supported in production builds of React.")}oe.Children={map:Yr,forEach:function(e,t,n){Yr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Yr(e,function(){t++}),t},toArray:function(e){return Yr(e,function(t){return t})||[]},only:function(e){if(!Ii(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},oe.Component=Rn,oe.Fragment=Ei,oe.Profiler=Ot,oe.PureComponent=Oi,oe.StrictMode=er,oe.Suspense=wd,oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ed,oe.act=ml,oe.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=ll({},e.props),o=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Ai.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(d in t)dl.call(t,d)&&!hl.hasOwnProperty(d)&&(r[d]=t[d]===void 0&&l!==void 0?l[d]:t[d])}var d=arguments.length-2;if(d===1)r.children=n;else if(1<d){l=Array(d);for(var g=0;g<d;g++)l[g]=arguments[g+2];r.children=l}return{$$typeof:Ht,type:e.type,key:o,ref:i,props:r,_owner:a}},oe.createContext=function(e){return e={$$typeof:vd,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:tr,_context:e},e.Consumer=e},oe.createElement=pl,oe.createFactory=function(e){var t=pl.bind(null,e);return t.type=e,t},oe.createRef=function(){return{current:null}},oe.forwardRef=function(e){return{$$typeof:yd,render:e}},oe.isValidElement=Ii,oe.lazy=function(e){return{$$typeof:Sd,_payload:{_status:-1,_result:e},_init:Rd}},oe.memo=function(e,t){return{$$typeof:xd,type:e,compare:t===void 0?null:t}},oe.startTransition=function(e){var t=Xr.transition;Xr.transition={};try{e()}finally{Xr.transition=t}},oe.unstable_act=ml,oe.useCallback=function(e,t){return ze.current.useCallback(e,t)},oe.useContext=function(e){return ze.current.useContext(e)},oe.useDebugValue=function(){},oe.useDeferredValue=function(e){return ze.current.useDeferredValue(e)},oe.useEffect=function(e,t){return ze.current.useEffect(e,t)},oe.useId=function(){return ze.current.useId()},oe.useImperativeHandle=function(e,t,n){return ze.current.useImperativeHandle(e,t,n)},oe.useInsertionEffect=function(e,t){return ze.current.useInsertionEffect(e,t)},oe.useLayoutEffect=function(e,t){return ze.current.useLayoutEffect(e,t)},oe.useMemo=function(e,t){return ze.current.useMemo(e,t)},oe.useReducer=function(e,t,n){return ze.current.useReducer(e,t,n)},oe.useRef=function(e){return ze.current.useRef(e)},oe.useState=function(e){return ze.current.useState(e)},oe.useSyncExternalStore=function(e,t,n){return ze.current.useSyncExternalStore(e,t,n)},oe.useTransition=function(){return ze.current.useTransition()},oe.version="18.3.1",Re.exports=oe;var te=Re.exports;const Mi=pe(te);var vl={exports:{}},qe={},yl={exports:{}},wl={};/**
10
10
  * @license React
11
11
  * scheduler.production.min.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */(function(e){function t(j,U){var z=j.length;j.push(U);e:for(;0<z;){var $=z-1>>>1,W=j[$];if(0<i(W,U))j[$]=U,j[z]=W,z=$;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var U=j[0],z=j.pop();if(z!==U){j[0]=z;e:for(var $=0,W=j.length,F=W>>>1;$<F;){var O=2*($+1)-1,D=j[O],B=O+1,_=j[B];if(0>i(D,z))B<W&&0>i(_,D)?(j[$]=_,j[B]=z,$=B):(j[$]=D,j[O]=z,$=O);else if(B<W&&0>i(_,z))j[$]=_,j[B]=z,$=B;else break e}}return U}function i(j,U){var z=j.sortIndex-U.sortIndex;return z!==0?z:j.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var d=[],g=[],S=1,E=null,y=3,R=!1,f=!1,k=!1,T=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(j){for(var U=n(g);U!==null;){if(U.callback===null)r(g);else if(U.startTime<=j)r(g),U.sortIndex=U.expirationTime,t(d,U);else break;U=n(g)}}function b(j){if(k=!1,m(j),!f)if(n(d)!==null)f=!0,M(h);else{var U=n(g);U!==null&&A(b,U.startTime-j)}}function h(j,U){f=!1,k&&(k=!1,x(s),s=-1),R=!0;var z=y;try{for(m(U),E=n(d);E!==null&&(!(E.expirationTime>U)||j&&!C());){var $=E.callback;if(typeof $=="function"){E.callback=null,y=E.priorityLevel;var W=$(E.expirationTime<=U);U=e.unstable_now(),typeof W=="function"?E.callback=W:E===n(d)&&r(d),m(U)}else r(d);E=n(d)}if(E!==null)var F=!0;else{var O=n(g);O!==null&&A(b,O.startTime-U),F=!1}return F}finally{E=null,y=z,R=!1}}var c=!1,u=null,s=-1,w=5,v=-1;function C(){return!(e.unstable_now()-v<w)}function L(){if(u!==null){var j=e.unstable_now();v=j;var U=!0;try{U=u(!0,j)}finally{U?N():(c=!1,u=null)}}else c=!1}var N;if(typeof p=="function")N=function(){p(L)};else if(typeof MessageChannel!="undefined"){var P=new MessageChannel,I=P.port2;P.port1.onmessage=L,N=function(){I.postMessage(null)}}else N=function(){T(L,0)};function M(j){u=j,c||(c=!0,N())}function A(j,U){s=T(function(){j(e.unstable_now())},U)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_continueExecution=function(){f||R||(f=!0,M(h))},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):w=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(j){switch(y){case 1:case 2:case 3:var U=3;break;default:U=y}var z=y;y=U;try{return j()}finally{y=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(j,U){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var z=y;y=j;try{return U()}finally{y=z}},e.unstable_scheduleCallback=function(j,U,z){var $=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?$+z:$):z=$,j){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=z+W,j={id:S++,callback:U,priorityLevel:j,startTime:z,expirationTime:W,sortIndex:-1},z>$?(j.sortIndex=z,t(g,j),n(d)===null&&j===n(g)&&(k?(x(s),s=-1):k=!0,A(b,z-$))):(j.sortIndex=W,t(d,j),f||R||(f=!0,M(h))),j},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(j){var U=y;return function(){var z=y;y=U;try{return j.apply(this,arguments)}finally{y=z}}}})(wl),yl.exports=wl;var Od=yl.exports;/**
17
+ */(function(e){function t(j,U){var z=j.length;j.push(U);e:for(;0<z;){var $=z-1>>>1,W=j[$];if(0<o(W,U))j[$]=U,j[z]=W,z=$;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var U=j[0],z=j.pop();if(z!==U){j[0]=z;e:for(var $=0,W=j.length,F=W>>>1;$<F;){var O=2*($+1)-1,D=j[O],B=O+1,_=j[B];if(0>o(D,z))B<W&&0>o(_,D)?(j[$]=_,j[B]=z,$=B):(j[$]=D,j[O]=z,$=O);else if(B<W&&0>o(_,z))j[$]=_,j[B]=z,$=B;else break e}}return U}function o(j,U){var z=j.sortIndex-U.sortIndex;return z!==0?z:j.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var d=[],g=[],S=1,E=null,y=3,R=!1,f=!1,k=!1,T=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(j){for(var U=n(g);U!==null;){if(U.callback===null)r(g);else if(U.startTime<=j)r(g),U.sortIndex=U.expirationTime,t(d,U);else break;U=n(g)}}function b(j){if(k=!1,m(j),!f)if(n(d)!==null)f=!0,P(h);else{var U=n(g);U!==null&&A(b,U.startTime-j)}}function h(j,U){f=!1,k&&(k=!1,x(s),s=-1),R=!0;var z=y;try{for(m(U),E=n(d);E!==null&&(!(E.expirationTime>U)||j&&!C());){var $=E.callback;if(typeof $=="function"){E.callback=null,y=E.priorityLevel;var W=$(E.expirationTime<=U);U=e.unstable_now(),typeof W=="function"?E.callback=W:E===n(d)&&r(d),m(U)}else r(d);E=n(d)}if(E!==null)var F=!0;else{var O=n(g);O!==null&&A(b,O.startTime-U),F=!1}return F}finally{E=null,y=z,R=!1}}var c=!1,u=null,s=-1,w=5,v=-1;function C(){return!(e.unstable_now()-v<w)}function L(){if(u!==null){var j=e.unstable_now();v=j;var U=!0;try{U=u(!0,j)}finally{U?N():(c=!1,u=null)}}else c=!1}var N;if(typeof p=="function")N=function(){p(L)};else if(typeof MessageChannel!="undefined"){var M=new MessageChannel,I=M.port2;M.port1.onmessage=L,N=function(){I.postMessage(null)}}else N=function(){T(L,0)};function P(j){u=j,c||(c=!0,N())}function A(j,U){s=T(function(){j(e.unstable_now())},U)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_continueExecution=function(){f||R||(f=!0,P(h))},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):w=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(j){switch(y){case 1:case 2:case 3:var U=3;break;default:U=y}var z=y;y=U;try{return j()}finally{y=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(j,U){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var z=y;y=j;try{return U()}finally{y=z}},e.unstable_scheduleCallback=function(j,U,z){var $=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?$+z:$):z=$,j){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=z+W,j={id:S++,callback:U,priorityLevel:j,startTime:z,expirationTime:W,sortIndex:-1},z>$?(j.sortIndex=z,t(g,j),n(d)===null&&j===n(g)&&(k?(x(s),s=-1):k=!0,A(b,z-$))):(j.sortIndex=W,t(d,j),f||R||(f=!0,P(h))),j},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(j){var U=y;return function(){var z=y;y=U;try{return j.apply(this,arguments)}finally{y=z}}}})(wl),yl.exports=wl;var Od=yl.exports;/**
18
18
  * @license React
19
19
  * react-dom.production.min.js
20
20
  *
@@ -22,14 +22,14 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var Td=te,et=Od;function J(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var xl=new Set,nr={};function un(e,t){En(e,t),En(e+"Capture",t)}function En(e,t){for(nr[e]=t,e=0;e<t.length;e++)xl.add(t[e])}var Tt=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),No=Object.prototype.hasOwnProperty,Ad=/^[: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]*$/,Sl={},bl={};function Id(e){return No.call(bl,e)?!0:No.call(Sl,e)?!1:Ad.test(e)?bl[e]=!0:(Sl[e]=!0,!1)}function Md(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Pd(e,t,n,r){if(t===null||typeof t=="undefined"||Md(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function He(e,t,n,r,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var Pe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Pe[e]=new He(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Pe[t]=new He(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){Pe[e]=new He(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Pe[e]=new He(e,2,!1,e,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(e){Pe[e]=new He(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){Pe[e]=new He(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){Pe[e]=new He(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){Pe[e]=new He(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){Pe[e]=new He(e,5,!1,e.toLowerCase(),null,!1,!1)});var Lo=/[\-:]([a-z])/g;function Do(e){return e[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(e){var t=e.replace(Lo,Do);Pe[t]=new He(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Lo,Do);Pe[t]=new He(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Lo,Do);Pe[t]=new He(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){Pe[e]=new He(e,1,!1,e.toLowerCase(),null,!1,!1)}),Pe.xlinkHref=new He("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){Pe[e]=new He(e,1,!1,e.toLowerCase(),null,!0,!0)});function jo(e,t,n,r){var i=Pe.hasOwnProperty(t)?Pe[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Pd(t,n,i,r)&&(n=null),r||i===null?Id(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var At=Td.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Zr=Symbol.for("react.element"),On=Symbol.for("react.portal"),Tn=Symbol.for("react.fragment"),Uo=Symbol.for("react.strict_mode"),Bo=Symbol.for("react.profiler"),Cl=Symbol.for("react.provider"),kl=Symbol.for("react.context"),_o=Symbol.for("react.forward_ref"),zo=Symbol.for("react.suspense"),Ho=Symbol.for("react.suspense_list"),Fo=Symbol.for("react.memo"),Ft=Symbol.for("react.lazy"),Rl=Symbol.for("react.offscreen"),El=Symbol.iterator;function rr(e){return e===null||typeof e!="object"?null:(e=El&&e[El]||e["@@iterator"],typeof e=="function"?e:null)}var we=Object.assign,Go;function ir(e){if(Go===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Go=t&&t[1]||""}return`
26
- `+Go+e}var Wo=!1;function $o(e,t){if(!e||Wo)return"";Wo=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(g){var r=g}Reflect.construct(e,[],t)}else{try{t.call()}catch(g){r=g}e.call(t.prototype)}else{try{throw Error()}catch(g){r=g}e()}}catch(g){if(g&&r&&typeof g.stack=="string"){for(var i=g.stack.split(`
27
- `),o=r.stack.split(`
28
- `),a=i.length-1,l=o.length-1;1<=a&&0<=l&&i[a]!==o[l];)l--;for(;1<=a&&0<=l;a--,l--)if(i[a]!==o[l]){if(a!==1||l!==1)do if(a--,l--,0>l||i[a]!==o[l]){var d=`
29
- `+i[a].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=a&&0<=l);break}}}finally{Wo=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ir(e):""}function Nd(e){switch(e.tag){case 5:return ir(e.type);case 16:return ir("Lazy");case 13:return ir("Suspense");case 19:return ir("SuspenseList");case 0:case 2:case 15:return e=$o(e.type,!1),e;case 11:return e=$o(e.type.render,!1),e;case 1:return e=$o(e.type,!0),e;default:return""}}function Vo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Tn:return"Fragment";case On:return"Portal";case Bo:return"Profiler";case Uo:return"StrictMode";case zo:return"Suspense";case Ho:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case kl:return(e.displayName||"Context")+".Consumer";case Cl:return(e._context.displayName||"Context")+".Provider";case _o:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Fo:return t=e.displayName||null,t!==null?t:Vo(e.type)||"Memo";case Ft:t=e._payload,e=e._init;try{return Vo(e(t))}catch(n){}}return null}function Ld(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Vo(t);case 8:return t===Uo?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Gt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ol(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Dd(e){var t=Ol(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n!="undefined"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qr(e){e._valueTracker||(e._valueTracker=Dd(e))}function Tl(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ol(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ei(e){if(e=e||(typeof document!="undefined"?document:void 0),typeof e=="undefined")return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Qo(e,t){var n=t.checked;return we({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n!=null?n:e._wrapperState.initialChecked})}function Al(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Gt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Il(e,t){t=t.checked,t!=null&&jo(e,"checked",t,!1)}function Ko(e,t){Il(e,t);var n=Gt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Jo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Jo(e,t.type,Gt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ml(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Jo(e,t,n){(t!=="number"||ei(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var or=Array.isArray;function An(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Gt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Yo(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(J(91));return we({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Pl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(J(92));if(or(n)){if(1<n.length)throw Error(J(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Gt(n)}}function Nl(e,t){var n=Gt(t.value),r=Gt(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Ll(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Dl(e){switch(e){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 Xo(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Dl(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ti,jl=function(e){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ti=ti||document.createElement("div"),ti.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ti.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ar(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var sr={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},jd=["Webkit","ms","Moz","O"];Object.keys(sr).forEach(function(e){jd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),sr[t]=sr[e]})});function Ul(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||sr.hasOwnProperty(e)&&sr[e]?(""+t).trim():t+"px"}function Bl(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Ul(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Ud=we({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 Zo(e,t){if(t){if(Ud[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(J(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(J(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(J(61))}if(t.style!=null&&typeof t.style!="object")throw Error(J(62))}}function qo(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 ea=null;function ta(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var na=null,In=null,Mn=null;function _l(e){if(e=Ar(e)){if(typeof na!="function")throw Error(J(280));var t=e.stateNode;t&&(t=ki(t),na(e.stateNode,e.type,t))}}function zl(e){In?Mn?Mn.push(e):Mn=[e]:In=e}function Hl(){if(In){var e=In,t=Mn;if(Mn=In=null,_l(e),t)for(e=0;e<t.length;e++)_l(t[e])}}function Fl(e,t){return e(t)}function Gl(){}var ra=!1;function Wl(e,t,n){if(ra)return e(t,n);ra=!0;try{return Fl(e,t,n)}finally{ra=!1,(In!==null||Mn!==null)&&(Gl(),Hl())}}function lr(e,t){var n=e.stateNode;if(n===null)return null;var r=ki(n);if(r===null)return null;n=r[t];e:switch(t){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)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(J(231,t,typeof n));return n}var ia=!1;if(Tt)try{var ur={};Object.defineProperty(ur,"passive",{get:function(){ia=!0}}),window.addEventListener("test",ur,ur),window.removeEventListener("test",ur,ur)}catch(e){ia=!1}function Bd(e,t,n,r,i,o,a,l,d){var g=Array.prototype.slice.call(arguments,3);try{t.apply(n,g)}catch(S){this.onError(S)}}var cr=!1,ni=null,ri=!1,oa=null,_d={onError:function(e){cr=!0,ni=e}};function zd(e,t,n,r,i,o,a,l,d){cr=!1,ni=null,Bd.apply(_d,arguments)}function Hd(e,t,n,r,i,o,a,l,d){if(zd.apply(this,arguments),cr){if(cr){var g=ni;cr=!1,ni=null}else throw Error(J(198));ri||(ri=!0,oa=g)}}function cn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function $l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Vl(e){if(cn(e)!==e)throw Error(J(188))}function Fd(e){var t=e.alternate;if(!t){if(t=cn(e),t===null)throw Error(J(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Vl(i),e;if(o===r)return Vl(i),t;o=o.sibling}throw Error(J(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,l=i.child;l;){if(l===n){a=!0,n=i,r=o;break}if(l===r){a=!0,r=i,n=o;break}l=l.sibling}if(!a){for(l=o.child;l;){if(l===n){a=!0,n=o,r=i;break}if(l===r){a=!0,r=o,n=i;break}l=l.sibling}if(!a)throw Error(J(189))}}if(n.alternate!==r)throw Error(J(190))}if(n.tag!==3)throw Error(J(188));return n.stateNode.current===n?e:t}function Ql(e){return e=Fd(e),e!==null?Kl(e):null}function Kl(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Kl(e);if(t!==null)return t;e=e.sibling}return null}var Jl=et.unstable_scheduleCallback,Yl=et.unstable_cancelCallback,Gd=et.unstable_shouldYield,Wd=et.unstable_requestPaint,ke=et.unstable_now,$d=et.unstable_getCurrentPriorityLevel,aa=et.unstable_ImmediatePriority,Xl=et.unstable_UserBlockingPriority,ii=et.unstable_NormalPriority,Vd=et.unstable_LowPriority,Zl=et.unstable_IdlePriority,oi=null,St=null;function Qd(e){if(St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(oi,e,void 0,(e.current.flags&128)===128)}catch(t){}}var dt=Math.clz32?Math.clz32:Yd,Kd=Math.log,Jd=Math.LN2;function Yd(e){return e>>>=0,e===0?32:31-(Kd(e)/Jd|0)|0}var ai=64,si=4194304;function fr(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function li(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~i;l!==0?r=fr(l):(o&=a,o!==0&&(r=fr(o)))}else a=n&~i,a!==0?r=fr(a):o!==0&&(r=fr(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-dt(t),i=1<<n,r|=e[n],t&=~i;return r}function Xd(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 Zd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-dt(o),l=1<<a,d=i[a];d===-1?(!(l&n)||l&r)&&(i[a]=Xd(l,t)):d<=t&&(e.expiredLanes|=l),o&=~l}}function sa(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ql(){var e=ai;return ai<<=1,!(ai&4194240)&&(ai=64),e}function la(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function dr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-dt(t),e[t]=n}function qd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-dt(n),o=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~o}}function ua(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-dt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var ue=0;function eu(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var tu,ca,nu,ru,iu,fa=!1,ui=[],Wt=null,$t=null,Vt=null,hr=new Map,pr=new Map,Qt=[],eh="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 ou(e,t){switch(e){case"focusin":case"focusout":Wt=null;break;case"dragenter":case"dragleave":$t=null;break;case"mouseover":case"mouseout":Vt=null;break;case"pointerover":case"pointerout":hr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":pr.delete(t.pointerId)}}function gr(e,t,n,r,i,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},t!==null&&(t=Ar(t),t!==null&&ca(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function th(e,t,n,r,i){switch(t){case"focusin":return Wt=gr(Wt,e,t,n,r,i),!0;case"dragenter":return $t=gr($t,e,t,n,r,i),!0;case"mouseover":return Vt=gr(Vt,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return hr.set(o,gr(hr.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,pr.set(o,gr(pr.get(o)||null,e,t,n,r,i)),!0}return!1}function au(e){var t=fn(e.target);if(t!==null){var n=cn(t);if(n!==null){if(t=n.tag,t===13){if(t=$l(n),t!==null){e.blockedOn=t,iu(e.priority,function(){nu(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ci(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ha(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ea=r,n.target.dispatchEvent(r),ea=null}else return t=Ar(n),t!==null&&ca(t),e.blockedOn=n,!1;t.shift()}return!0}function su(e,t,n){ci(e)&&n.delete(t)}function nh(){fa=!1,Wt!==null&&ci(Wt)&&(Wt=null),$t!==null&&ci($t)&&($t=null),Vt!==null&&ci(Vt)&&(Vt=null),hr.forEach(su),pr.forEach(su)}function mr(e,t){e.blockedOn===t&&(e.blockedOn=null,fa||(fa=!0,et.unstable_scheduleCallback(et.unstable_NormalPriority,nh)))}function vr(e){function t(i){return mr(i,e)}if(0<ui.length){mr(ui[0],e);for(var n=1;n<ui.length;n++){var r=ui[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Wt!==null&&mr(Wt,e),$t!==null&&mr($t,e),Vt!==null&&mr(Vt,e),hr.forEach(t),pr.forEach(t),n=0;n<Qt.length;n++)r=Qt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Qt.length&&(n=Qt[0],n.blockedOn===null);)au(n),n.blockedOn===null&&Qt.shift()}var Pn=At.ReactCurrentBatchConfig,fi=!0;function rh(e,t,n,r){var i=ue,o=Pn.transition;Pn.transition=null;try{ue=1,da(e,t,n,r)}finally{ue=i,Pn.transition=o}}function ih(e,t,n,r){var i=ue,o=Pn.transition;Pn.transition=null;try{ue=4,da(e,t,n,r)}finally{ue=i,Pn.transition=o}}function da(e,t,n,r){if(fi){var i=ha(e,t,n,r);if(i===null)Ia(e,t,r,di,n),ou(e,r);else if(th(i,e,t,n,r))r.stopPropagation();else if(ou(e,r),t&4&&-1<eh.indexOf(e)){for(;i!==null;){var o=Ar(i);if(o!==null&&tu(o),o=ha(e,t,n,r),o===null&&Ia(e,t,r,di,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else Ia(e,t,r,null,n)}}var di=null;function ha(e,t,n,r){if(di=null,e=ta(r),e=fn(e),e!==null)if(t=cn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=$l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return di=e,null}function lu(e){switch(e){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($d()){case aa:return 1;case Xl:return 4;case ii:case Vd:return 16;case Zl:return 536870912;default:return 16}default:return 16}}var Kt=null,pa=null,hi=null;function uu(){if(hi)return hi;var e,t=pa,n=t.length,r,i="value"in Kt?Kt.value:Kt.textContent,o=i.length;for(e=0;e<n&&t[e]===i[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===i[o-r];r++);return hi=i.slice(e,1<r?1-r:void 0)}function pi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function gi(){return!0}function cu(){return!1}function tt(e){function t(n,r,i,o,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=o,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?gi:cu,this.isPropagationStopped=cu,this}return we(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=gi)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=gi)},persist:function(){},isPersistent:gi}),t}var Nn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ga=tt(Nn),yr=we({},Nn,{view:0,detail:0}),oh=tt(yr),ma,va,wr,mi=we({},yr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wa,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==wr&&(wr&&e.type==="mousemove"?(ma=e.screenX-wr.screenX,va=e.screenY-wr.screenY):va=ma=0,wr=e),ma)},movementY:function(e){return"movementY"in e?e.movementY:va}}),fu=tt(mi),ah=we({},mi,{dataTransfer:0}),sh=tt(ah),lh=we({},yr,{relatedTarget:0}),ya=tt(lh),uh=we({},Nn,{animationName:0,elapsedTime:0,pseudoElement:0}),ch=tt(uh),fh=we({},Nn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),dh=tt(fh),hh=we({},Nn,{data:0}),du=tt(hh),ph={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gh={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"},mh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=mh[e])?!!t[e]:!1}function wa(){return vh}var yh=we({},yr,{key:function(e){if(e.key){var t=ph[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=pi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wa,charCode:function(e){return e.type==="keypress"?pi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?pi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),wh=tt(yh),xh=we({},mi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hu=tt(xh),Sh=we({},yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wa}),bh=tt(Sh),Ch=we({},Nn,{propertyName:0,elapsedTime:0,pseudoElement:0}),kh=tt(Ch),Rh=we({},mi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Eh=tt(Rh),Oh=[9,13,27,32],xa=Tt&&"CompositionEvent"in window,xr=null;Tt&&"documentMode"in document&&(xr=document.documentMode);var Th=Tt&&"TextEvent"in window&&!xr,pu=Tt&&(!xa||xr&&8<xr&&11>=xr),gu=" ",mu=!1;function vu(e,t){switch(e){case"keyup":return Oh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ln=!1;function Ah(e,t){switch(e){case"compositionend":return yu(t);case"keypress":return t.which!==32?null:(mu=!0,gu);case"textInput":return e=t.data,e===gu&&mu?null:e;default:return null}}function Ih(e,t){if(Ln)return e==="compositionend"||!xa&&vu(e,t)?(e=uu(),hi=pa=Kt=null,Ln=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return pu&&t.locale!=="ko"?null:t.data;default:return null}}var Mh={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 wu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Mh[e.type]:t==="textarea"}function xu(e,t,n,r){zl(r),t=Si(t,"onChange"),0<t.length&&(n=new ga("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Sr=null,br=null;function Ph(e){Bu(e,0)}function vi(e){var t=_n(e);if(Tl(t))return e}function Nh(e,t){if(e==="change")return t}var Su=!1;if(Tt){var Sa;if(Tt){var ba="oninput"in document;if(!ba){var bu=document.createElement("div");bu.setAttribute("oninput","return;"),ba=typeof bu.oninput=="function"}Sa=ba}else Sa=!1;Su=Sa&&(!document.documentMode||9<document.documentMode)}function Cu(){Sr&&(Sr.detachEvent("onpropertychange",ku),br=Sr=null)}function ku(e){if(e.propertyName==="value"&&vi(br)){var t=[];xu(t,br,e,ta(e)),Wl(Ph,t)}}function Lh(e,t,n){e==="focusin"?(Cu(),Sr=t,br=n,Sr.attachEvent("onpropertychange",ku)):e==="focusout"&&Cu()}function Dh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vi(br)}function jh(e,t){if(e==="click")return vi(t)}function Uh(e,t){if(e==="input"||e==="change")return vi(t)}function Bh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ht=typeof Object.is=="function"?Object.is:Bh;function Cr(e,t){if(ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!No.call(t,i)||!ht(e[i],t[i]))return!1}return!0}function Ru(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Eu(e,t){var n=Ru(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ru(n)}}function Ou(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ou(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tu(){for(var e=window,t=ei();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch(r){n=!1}if(n)e=t.contentWindow;else break;t=ei(e.document)}return t}function Ca(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function _h(e){var t=Tu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ou(n.ownerDocument.documentElement,n)){if(r!==null&&Ca(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=Eu(n,o);var a=Eu(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var zh=Tt&&"documentMode"in document&&11>=document.documentMode,Dn=null,ka=null,kr=null,Ra=!1;function Au(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ra||Dn==null||Dn!==ei(r)||(r=Dn,"selectionStart"in r&&Ca(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kr&&Cr(kr,r)||(kr=r,r=Si(ka,"onSelect"),0<r.length&&(t=new ga("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Dn)))}function yi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var jn={animationend:yi("Animation","AnimationEnd"),animationiteration:yi("Animation","AnimationIteration"),animationstart:yi("Animation","AnimationStart"),transitionend:yi("Transition","TransitionEnd")},Ea={},Iu={};Tt&&(Iu=document.createElement("div").style,"AnimationEvent"in window||(delete jn.animationend.animation,delete jn.animationiteration.animation,delete jn.animationstart.animation),"TransitionEvent"in window||delete jn.transitionend.transition);function wi(e){if(Ea[e])return Ea[e];if(!jn[e])return e;var t=jn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Iu)return Ea[e]=t[n];return e}var Mu=wi("animationend"),Pu=wi("animationiteration"),Nu=wi("animationstart"),Lu=wi("transitionend"),Du=new Map,ju="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 Jt(e,t){Du.set(e,t),un(t,[e])}for(var Oa=0;Oa<ju.length;Oa++){var Ta=ju[Oa],Hh=Ta.toLowerCase(),Fh=Ta[0].toUpperCase()+Ta.slice(1);Jt(Hh,"on"+Fh)}Jt(Mu,"onAnimationEnd"),Jt(Pu,"onAnimationIteration"),Jt(Nu,"onAnimationStart"),Jt("dblclick","onDoubleClick"),Jt("focusin","onFocus"),Jt("focusout","onBlur"),Jt(Lu,"onTransitionEnd"),En("onMouseEnter",["mouseout","mouseover"]),En("onMouseLeave",["mouseout","mouseover"]),En("onPointerEnter",["pointerout","pointerover"]),En("onPointerLeave",["pointerout","pointerover"]),un("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),un("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),un("onBeforeInput",["compositionend","keypress","textInput","paste"]),un("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),un("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),un("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Rr="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(" "),Gh=new Set("cancel close invalid load scroll toggle".split(" ").concat(Rr));function Uu(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Hd(r,t,void 0,e),e.currentTarget=null}function Bu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],d=l.instance,g=l.currentTarget;if(l=l.listener,d!==o&&i.isPropagationStopped())break e;Uu(i,l,g),o=d}else for(a=0;a<r.length;a++){if(l=r[a],d=l.instance,g=l.currentTarget,l=l.listener,d!==o&&i.isPropagationStopped())break e;Uu(i,l,g),o=d}}}if(ri)throw e=oa,ri=!1,oa=null,e}function ge(e,t){var n=t[ja];n===void 0&&(n=t[ja]=new Set);var r=e+"__bubble";n.has(r)||(_u(t,e,2,!1),n.add(r))}function Aa(e,t,n){var r=0;t&&(r|=4),_u(n,e,r,t)}var xi="_reactListening"+Math.random().toString(36).slice(2);function Er(e){if(!e[xi]){e[xi]=!0,xl.forEach(function(n){n!=="selectionchange"&&(Gh.has(n)||Aa(n,!1,e),Aa(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xi]||(t[xi]=!0,Aa("selectionchange",!1,t))}}function _u(e,t,n,r){switch(lu(t)){case 1:var i=rh;break;case 4:i=ih;break;default:i=da}n=i.bind(null,t,n,e),i=void 0,!ia||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Ia(e,t,n,r,i){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var d=a.tag;if((d===3||d===4)&&(d=a.stateNode.containerInfo,d===i||d.nodeType===8&&d.parentNode===i))return;a=a.return}for(;l!==null;){if(a=fn(l),a===null)return;if(d=a.tag,d===5||d===6){r=o=a;continue e}l=l.parentNode}}r=r.return}Wl(function(){var g=o,S=ta(n),E=[];e:{var y=Du.get(e);if(y!==void 0){var R=ga,f=e;switch(e){case"keypress":if(pi(n)===0)break e;case"keydown":case"keyup":R=wh;break;case"focusin":f="focus",R=ya;break;case"focusout":f="blur",R=ya;break;case"beforeblur":case"afterblur":R=ya;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":R=fu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":R=sh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":R=bh;break;case Mu:case Pu:case Nu:R=ch;break;case Lu:R=kh;break;case"scroll":R=oh;break;case"wheel":R=Eh;break;case"copy":case"cut":case"paste":R=dh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":R=hu}var k=(t&4)!==0,T=!k&&e==="scroll",x=k?y!==null?y+"Capture":null:y;k=[];for(var p=g,m;p!==null;){m=p;var b=m.stateNode;if(m.tag===5&&b!==null&&(m=b,x!==null&&(b=lr(p,x),b!=null&&k.push(Or(p,b,m)))),T)break;p=p.return}0<k.length&&(y=new R(y,f,null,n,S),E.push({event:y,listeners:k}))}}if(!(t&7)){e:{if(y=e==="mouseover"||e==="pointerover",R=e==="mouseout"||e==="pointerout",y&&n!==ea&&(f=n.relatedTarget||n.fromElement)&&(fn(f)||f[It]))break e;if((R||y)&&(y=S.window===S?S:(y=S.ownerDocument)?y.defaultView||y.parentWindow:window,R?(f=n.relatedTarget||n.toElement,R=g,f=f?fn(f):null,f!==null&&(T=cn(f),f!==T||f.tag!==5&&f.tag!==6)&&(f=null)):(R=null,f=g),R!==f)){if(k=fu,b="onMouseLeave",x="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(k=hu,b="onPointerLeave",x="onPointerEnter",p="pointer"),T=R==null?y:_n(R),m=f==null?y:_n(f),y=new k(b,p+"leave",R,n,S),y.target=T,y.relatedTarget=m,b=null,fn(S)===g&&(k=new k(x,p+"enter",f,n,S),k.target=m,k.relatedTarget=T,b=k),T=b,R&&f)t:{for(k=R,x=f,p=0,m=k;m;m=Un(m))p++;for(m=0,b=x;b;b=Un(b))m++;for(;0<p-m;)k=Un(k),p--;for(;0<m-p;)x=Un(x),m--;for(;p--;){if(k===x||x!==null&&k===x.alternate)break t;k=Un(k),x=Un(x)}k=null}else k=null;R!==null&&zu(E,y,R,k,!1),f!==null&&T!==null&&zu(E,T,f,k,!0)}}e:{if(y=g?_n(g):window,R=y.nodeName&&y.nodeName.toLowerCase(),R==="select"||R==="input"&&y.type==="file")var h=Nh;else if(wu(y))if(Su)h=Uh;else{h=Dh;var c=Lh}else(R=y.nodeName)&&R.toLowerCase()==="input"&&(y.type==="checkbox"||y.type==="radio")&&(h=jh);if(h&&(h=h(e,g))){xu(E,h,n,S);break e}c&&c(e,y,g),e==="focusout"&&(c=y._wrapperState)&&c.controlled&&y.type==="number"&&Jo(y,"number",y.value)}switch(c=g?_n(g):window,e){case"focusin":(wu(c)||c.contentEditable==="true")&&(Dn=c,ka=g,kr=null);break;case"focusout":kr=ka=Dn=null;break;case"mousedown":Ra=!0;break;case"contextmenu":case"mouseup":case"dragend":Ra=!1,Au(E,n,S);break;case"selectionchange":if(zh)break;case"keydown":case"keyup":Au(E,n,S)}var u;if(xa)e:{switch(e){case"compositionstart":var s="onCompositionStart";break e;case"compositionend":s="onCompositionEnd";break e;case"compositionupdate":s="onCompositionUpdate";break e}s=void 0}else Ln?vu(e,n)&&(s="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(s="onCompositionStart");s&&(pu&&n.locale!=="ko"&&(Ln||s!=="onCompositionStart"?s==="onCompositionEnd"&&Ln&&(u=uu()):(Kt=S,pa="value"in Kt?Kt.value:Kt.textContent,Ln=!0)),c=Si(g,s),0<c.length&&(s=new du(s,e,null,n,S),E.push({event:s,listeners:c}),u?s.data=u:(u=yu(n),u!==null&&(s.data=u)))),(u=Th?Ah(e,n):Ih(e,n))&&(g=Si(g,"onBeforeInput"),0<g.length&&(S=new du("onBeforeInput","beforeinput",null,n,S),E.push({event:S,listeners:g}),S.data=u))}Bu(E,t)})}function Or(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Si(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=lr(e,n),o!=null&&r.unshift(Or(e,o,i)),o=lr(e,t),o!=null&&r.push(Or(e,o,i))),e=e.return}return r}function Un(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function zu(e,t,n,r,i){for(var o=t._reactName,a=[];n!==null&&n!==r;){var l=n,d=l.alternate,g=l.stateNode;if(d!==null&&d===r)break;l.tag===5&&g!==null&&(l=g,i?(d=lr(n,o),d!=null&&a.unshift(Or(n,d,l))):i||(d=lr(n,o),d!=null&&a.push(Or(n,d,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var Wh=/\r\n?/g,$h=/\u0000|\uFFFD/g;function Hu(e){return(typeof e=="string"?e:""+e).replace(Wh,`
30
- `).replace($h,"")}function bi(e,t,n){if(t=Hu(t),Hu(e)!==t&&n)throw Error(J(425))}function Ci(){}var Ma=null,Pa=null;function Na(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var La=typeof setTimeout=="function"?setTimeout:void 0,Vh=typeof clearTimeout=="function"?clearTimeout:void 0,Fu=typeof Promise=="function"?Promise:void 0,Qh=typeof queueMicrotask=="function"?queueMicrotask:typeof Fu!="undefined"?function(e){return Fu.resolve(null).then(e).catch(Kh)}:La;function Kh(e){setTimeout(function(){throw e})}function Da(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),vr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);vr(t)}function Yt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Gu(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Bn=Math.random().toString(36).slice(2),bt="__reactFiber$"+Bn,Tr="__reactProps$"+Bn,It="__reactContainer$"+Bn,ja="__reactEvents$"+Bn,Jh="__reactListeners$"+Bn,Yh="__reactHandles$"+Bn;function fn(e){var t=e[bt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[It]||n[bt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Gu(e);e!==null;){if(n=e[bt])return n;e=Gu(e)}return t}e=n,n=e.parentNode}return null}function Ar(e){return e=e[bt]||e[It],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function _n(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(J(33))}function ki(e){return e[Tr]||null}var Ua=[],zn=-1;function Xt(e){return{current:e}}function me(e){0>zn||(e.current=Ua[zn],Ua[zn]=null,zn--)}function he(e,t){zn++,Ua[zn]=e.current,e.current=t}var Zt={},je=Xt(Zt),Qe=Xt(!1),dn=Zt;function Hn(e,t){var n=e.type.contextTypes;if(!n)return Zt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ke(e){return e=e.childContextTypes,e!=null}function Ri(){me(Qe),me(je)}function Wu(e,t,n){if(je.current!==Zt)throw Error(J(168));he(je,t),he(Qe,n)}function $u(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(J(108,Ld(e)||"Unknown",i));return we({},n,r)}function Ei(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zt,dn=je.current,he(je,e),he(Qe,Qe.current),!0}function Vu(e,t,n){var r=e.stateNode;if(!r)throw Error(J(169));n?(e=$u(e,t,dn),r.__reactInternalMemoizedMergedChildContext=e,me(Qe),me(je),he(je,e)):me(Qe),he(Qe,n)}var Mt=null,Oi=!1,Ba=!1;function Qu(e){Mt===null?Mt=[e]:Mt.push(e)}function Xh(e){Oi=!0,Qu(e)}function qt(){if(!Ba&&Mt!==null){Ba=!0;var e=0,t=ue;try{var n=Mt;for(ue=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Mt=null,Oi=!1}catch(i){throw Mt!==null&&(Mt=Mt.slice(e+1)),Jl(aa,qt),i}finally{ue=t,Ba=!1}}return null}var Fn=[],Gn=0,Ti=null,Ai=0,at=[],st=0,hn=null,Pt=1,Nt="";function pn(e,t){Fn[Gn++]=Ai,Fn[Gn++]=Ti,Ti=e,Ai=t}function Ku(e,t,n){at[st++]=Pt,at[st++]=Nt,at[st++]=hn,hn=e;var r=Pt;e=Nt;var i=32-dt(r)-1;r&=~(1<<i),n+=1;var o=32-dt(t)+i;if(30<o){var a=i-i%5;o=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Pt=1<<32-dt(t)+i|n<<i|r,Nt=o+e}else Pt=1<<o|n<<i|r,Nt=e}function _a(e){e.return!==null&&(pn(e,1),Ku(e,1,0))}function za(e){for(;e===Ti;)Ti=Fn[--Gn],Fn[Gn]=null,Ai=Fn[--Gn],Fn[Gn]=null;for(;e===hn;)hn=at[--st],at[st]=null,Nt=at[--st],at[st]=null,Pt=at[--st],at[st]=null}var nt=null,rt=null,ve=!1,pt=null;function Ju(e,t){var n=ft(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Yu(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,nt=e,rt=Yt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,nt=e,rt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=hn!==null?{id:Pt,overflow:Nt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ft(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,nt=e,rt=null,!0):!1;default:return!1}}function Ha(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Fa(e){if(ve){var t=rt;if(t){var n=t;if(!Yu(e,t)){if(Ha(e))throw Error(J(418));t=Yt(n.nextSibling);var r=nt;t&&Yu(e,t)?Ju(r,n):(e.flags=e.flags&-4097|2,ve=!1,nt=e)}}else{if(Ha(e))throw Error(J(418));e.flags=e.flags&-4097|2,ve=!1,nt=e}}}function Xu(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;nt=e}function Ii(e){if(e!==nt)return!1;if(!ve)return Xu(e),ve=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Na(e.type,e.memoizedProps)),t&&(t=rt)){if(Ha(e))throw Zu(),Error(J(418));for(;t;)Ju(e,t),t=Yt(t.nextSibling)}if(Xu(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(J(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){rt=Yt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}rt=null}}else rt=nt?Yt(e.stateNode.nextSibling):null;return!0}function Zu(){for(var e=rt;e;)e=Yt(e.nextSibling)}function Wn(){rt=nt=null,ve=!1}function Ga(e){pt===null?pt=[e]:pt.push(e)}var Zh=At.ReactCurrentBatchConfig;function Ir(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(J(309));var r=n.stateNode}if(!r)throw Error(J(147,e));var i=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(a){var l=i.refs;a===null?delete l[o]:l[o]=a},t._stringRef=o,t)}if(typeof e!="string")throw Error(J(284));if(!n._owner)throw Error(J(290,e))}return e}function Mi(e,t){throw e=Object.prototype.toString.call(t),Error(J(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function qu(e){var t=e._init;return t(e._payload)}function ec(e){function t(x,p){if(e){var m=x.deletions;m===null?(x.deletions=[p],x.flags|=16):m.push(p)}}function n(x,p){if(!e)return null;for(;p!==null;)t(x,p),p=p.sibling;return null}function r(x,p){for(x=new Map;p!==null;)p.key!==null?x.set(p.key,p):x.set(p.index,p),p=p.sibling;return x}function i(x,p){return x=ln(x,p),x.index=0,x.sibling=null,x}function o(x,p,m){return x.index=m,e?(m=x.alternate,m!==null?(m=m.index,m<p?(x.flags|=2,p):m):(x.flags|=2,p)):(x.flags|=1048576,p)}function a(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,p,m,b){return p===null||p.tag!==6?(p=Ls(m,x.mode,b),p.return=x,p):(p=i(p,m),p.return=x,p)}function d(x,p,m,b){var h=m.type;return h===Tn?S(x,p,m.props.children,b,m.key):p!==null&&(p.elementType===h||typeof h=="object"&&h!==null&&h.$$typeof===Ft&&qu(h)===p.type)?(b=i(p,m.props),b.ref=Ir(x,p,m),b.return=x,b):(b=to(m.type,m.key,m.props,null,x.mode,b),b.ref=Ir(x,p,m),b.return=x,b)}function g(x,p,m,b){return p===null||p.tag!==4||p.stateNode.containerInfo!==m.containerInfo||p.stateNode.implementation!==m.implementation?(p=Ds(m,x.mode,b),p.return=x,p):(p=i(p,m.children||[]),p.return=x,p)}function S(x,p,m,b,h){return p===null||p.tag!==7?(p=bn(m,x.mode,b,h),p.return=x,p):(p=i(p,m),p.return=x,p)}function E(x,p,m){if(typeof p=="string"&&p!==""||typeof p=="number")return p=Ls(""+p,x.mode,m),p.return=x,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Zr:return m=to(p.type,p.key,p.props,null,x.mode,m),m.ref=Ir(x,null,p),m.return=x,m;case On:return p=Ds(p,x.mode,m),p.return=x,p;case Ft:var b=p._init;return E(x,b(p._payload),m)}if(or(p)||rr(p))return p=bn(p,x.mode,m,null),p.return=x,p;Mi(x,p)}return null}function y(x,p,m,b){var h=p!==null?p.key:null;if(typeof m=="string"&&m!==""||typeof m=="number")return h!==null?null:l(x,p,""+m,b);if(typeof m=="object"&&m!==null){switch(m.$$typeof){case Zr:return m.key===h?d(x,p,m,b):null;case On:return m.key===h?g(x,p,m,b):null;case Ft:return h=m._init,y(x,p,h(m._payload),b)}if(or(m)||rr(m))return h!==null?null:S(x,p,m,b,null);Mi(x,m)}return null}function R(x,p,m,b,h){if(typeof b=="string"&&b!==""||typeof b=="number")return x=x.get(m)||null,l(p,x,""+b,h);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Zr:return x=x.get(b.key===null?m:b.key)||null,d(p,x,b,h);case On:return x=x.get(b.key===null?m:b.key)||null,g(p,x,b,h);case Ft:var c=b._init;return R(x,p,m,c(b._payload),h)}if(or(b)||rr(b))return x=x.get(m)||null,S(p,x,b,h,null);Mi(p,b)}return null}function f(x,p,m,b){for(var h=null,c=null,u=p,s=p=0,w=null;u!==null&&s<m.length;s++){u.index>s?(w=u,u=null):w=u.sibling;var v=y(x,u,m[s],b);if(v===null){u===null&&(u=w);break}e&&u&&v.alternate===null&&t(x,u),p=o(v,p,s),c===null?h=v:c.sibling=v,c=v,u=w}if(s===m.length)return n(x,u),ve&&pn(x,s),h;if(u===null){for(;s<m.length;s++)u=E(x,m[s],b),u!==null&&(p=o(u,p,s),c===null?h=u:c.sibling=u,c=u);return ve&&pn(x,s),h}for(u=r(x,u);s<m.length;s++)w=R(u,x,s,m[s],b),w!==null&&(e&&w.alternate!==null&&u.delete(w.key===null?s:w.key),p=o(w,p,s),c===null?h=w:c.sibling=w,c=w);return e&&u.forEach(function(C){return t(x,C)}),ve&&pn(x,s),h}function k(x,p,m,b){var h=rr(m);if(typeof h!="function")throw Error(J(150));if(m=h.call(m),m==null)throw Error(J(151));for(var c=h=null,u=p,s=p=0,w=null,v=m.next();u!==null&&!v.done;s++,v=m.next()){u.index>s?(w=u,u=null):w=u.sibling;var C=y(x,u,v.value,b);if(C===null){u===null&&(u=w);break}e&&u&&C.alternate===null&&t(x,u),p=o(C,p,s),c===null?h=C:c.sibling=C,c=C,u=w}if(v.done)return n(x,u),ve&&pn(x,s),h;if(u===null){for(;!v.done;s++,v=m.next())v=E(x,v.value,b),v!==null&&(p=o(v,p,s),c===null?h=v:c.sibling=v,c=v);return ve&&pn(x,s),h}for(u=r(x,u);!v.done;s++,v=m.next())v=R(u,x,s,v.value,b),v!==null&&(e&&v.alternate!==null&&u.delete(v.key===null?s:v.key),p=o(v,p,s),c===null?h=v:c.sibling=v,c=v);return e&&u.forEach(function(L){return t(x,L)}),ve&&pn(x,s),h}function T(x,p,m,b){if(typeof m=="object"&&m!==null&&m.type===Tn&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Zr:e:{for(var h=m.key,c=p;c!==null;){if(c.key===h){if(h=m.type,h===Tn){if(c.tag===7){n(x,c.sibling),p=i(c,m.props.children),p.return=x,x=p;break e}}else if(c.elementType===h||typeof h=="object"&&h!==null&&h.$$typeof===Ft&&qu(h)===c.type){n(x,c.sibling),p=i(c,m.props),p.ref=Ir(x,c,m),p.return=x,x=p;break e}n(x,c);break}else t(x,c);c=c.sibling}m.type===Tn?(p=bn(m.props.children,x.mode,b,m.key),p.return=x,x=p):(b=to(m.type,m.key,m.props,null,x.mode,b),b.ref=Ir(x,p,m),b.return=x,x=b)}return a(x);case On:e:{for(c=m.key;p!==null;){if(p.key===c)if(p.tag===4&&p.stateNode.containerInfo===m.containerInfo&&p.stateNode.implementation===m.implementation){n(x,p.sibling),p=i(p,m.children||[]),p.return=x,x=p;break e}else{n(x,p);break}else t(x,p);p=p.sibling}p=Ds(m,x.mode,b),p.return=x,x=p}return a(x);case Ft:return c=m._init,T(x,p,c(m._payload),b)}if(or(m))return f(x,p,m,b);if(rr(m))return k(x,p,m,b);Mi(x,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,p!==null&&p.tag===6?(n(x,p.sibling),p=i(p,m),p.return=x,x=p):(n(x,p),p=Ls(m,x.mode,b),p.return=x,x=p),a(x)):n(x,p)}return T}var $n=ec(!0),tc=ec(!1),Pi=Xt(null),Ni=null,Vn=null,Wa=null;function $a(){Wa=Vn=Ni=null}function Va(e){var t=Pi.current;me(Pi),e._currentValue=t}function Qa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Qn(e,t){Ni=e,Wa=Vn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Je=!0),e.firstContext=null)}function lt(e){var t=e._currentValue;if(Wa!==e)if(e={context:e,memoizedValue:t,next:null},Vn===null){if(Ni===null)throw Error(J(308));Vn=e,Ni.dependencies={lanes:0,firstContext:e}}else Vn=Vn.next=e;return t}var gn=null;function Ka(e){gn===null?gn=[e]:gn.push(e)}function nc(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ka(t)):(n.next=i.next,i.next=n),t.interleaved=n,Lt(e,r)}function Lt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var en=!1;function Ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Dt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function tn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ae&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Lt(e,n)}return i=r.interleaved,i===null?(t.next=t,Ka(r)):(t.next=i.next,i.next=t),r.interleaved=t,Lt(e,n)}function Li(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ua(e,n)}}function ic(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=a:o=o.next=a,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Di(e,t,n,r){var i=e.updateQueue;en=!1;var o=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var d=l,g=d.next;d.next=null,a===null?o=g:a.next=g,a=d;var S=e.alternate;S!==null&&(S=S.updateQueue,l=S.lastBaseUpdate,l!==a&&(l===null?S.firstBaseUpdate=g:l.next=g,S.lastBaseUpdate=d))}if(o!==null){var E=i.baseState;a=0,S=g=d=null,l=o;do{var y=l.lane,R=l.eventTime;if((r&y)===y){S!==null&&(S=S.next={eventTime:R,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var f=e,k=l;switch(y=t,R=n,k.tag){case 1:if(f=k.payload,typeof f=="function"){E=f.call(R,E,y);break e}E=f;break e;case 3:f.flags=f.flags&-65537|128;case 0:if(f=k.payload,y=typeof f=="function"?f.call(R,E,y):f,y==null)break e;E=we({},E,y);break e;case 2:en=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,y=i.effects,y===null?i.effects=[l]:y.push(l))}else R={eventTime:R,lane:y,tag:l.tag,payload:l.payload,callback:l.callback,next:null},S===null?(g=S=R,d=E):S=S.next=R,a|=y;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;y=l,l=y.next,y.next=null,i.lastBaseUpdate=y,i.shared.pending=null}}while(!0);if(S===null&&(d=E),i.baseState=d,i.firstBaseUpdate=g,i.lastBaseUpdate=S,t=i.shared.interleaved,t!==null){i=t;do a|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);yn|=a,e.lanes=a,e.memoizedState=E}}function oc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(J(191,i));i.call(r)}}}var Mr={},Ct=Xt(Mr),Pr=Xt(Mr),Nr=Xt(Mr);function mn(e){if(e===Mr)throw Error(J(174));return e}function Ya(e,t){switch(he(Nr,t),he(Pr,e),he(Ct,Mr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Xo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Xo(t,e)}me(Ct),he(Ct,t)}function Kn(){me(Ct),me(Pr),me(Nr)}function ac(e){mn(Nr.current);var t=mn(Ct.current),n=Xo(t,e.type);t!==n&&(he(Pr,e),he(Ct,n))}function Xa(e){Pr.current===e&&(me(Ct),me(Pr))}var xe=Xt(0);function ji(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Za=[];function qa(){for(var e=0;e<Za.length;e++)Za[e]._workInProgressVersionPrimary=null;Za.length=0}var Ui=At.ReactCurrentDispatcher,es=At.ReactCurrentBatchConfig,vn=0,Se=null,Oe=null,Ie=null,Bi=!1,Lr=!1,Dr=0,qh=0;function Ue(){throw Error(J(321))}function ts(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ht(e[n],t[n]))return!1;return!0}function ns(e,t,n,r,i,o){if(vn=o,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ui.current=e===null||e.memoizedState===null?rp:ip,e=n(r,i),Lr){o=0;do{if(Lr=!1,Dr=0,25<=o)throw Error(J(301));o+=1,Ie=Oe=null,t.updateQueue=null,Ui.current=op,e=n(r,i)}while(Lr)}if(Ui.current=Hi,t=Oe!==null&&Oe.next!==null,vn=0,Ie=Oe=Se=null,Bi=!1,t)throw Error(J(300));return e}function rs(){var e=Dr!==0;return Dr=0,e}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ie===null?Se.memoizedState=Ie=e:Ie=Ie.next=e,Ie}function ut(){if(Oe===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Oe.next;var t=Ie===null?Se.memoizedState:Ie.next;if(t!==null)Ie=t,Oe=e;else{if(e===null)throw Error(J(310));Oe=e,e={memoizedState:Oe.memoizedState,baseState:Oe.baseState,baseQueue:Oe.baseQueue,queue:Oe.queue,next:null},Ie===null?Se.memoizedState=Ie=e:Ie=Ie.next=e}return Ie}function jr(e,t){return typeof t=="function"?t(e):t}function is(e){var t=ut(),n=t.queue;if(n===null)throw Error(J(311));n.lastRenderedReducer=e;var r=Oe,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var l=a=null,d=null,g=o;do{var S=g.lane;if((vn&S)===S)d!==null&&(d=d.next={lane:0,action:g.action,hasEagerState:g.hasEagerState,eagerState:g.eagerState,next:null}),r=g.hasEagerState?g.eagerState:e(r,g.action);else{var E={lane:S,action:g.action,hasEagerState:g.hasEagerState,eagerState:g.eagerState,next:null};d===null?(l=d=E,a=r):d=d.next=E,Se.lanes|=S,yn|=S}g=g.next}while(g!==null&&g!==o);d===null?a=r:d.next=l,ht(r,t.memoizedState)||(Je=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=d,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do o=i.lane,Se.lanes|=o,yn|=o,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function os(e){var t=ut(),n=t.queue;if(n===null)throw Error(J(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do o=e(o,a.action),a=a.next;while(a!==i);ht(o,t.memoizedState)||(Je=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function sc(){}function lc(e,t){var n=Se,r=ut(),i=t(),o=!ht(r.memoizedState,i);if(o&&(r.memoizedState=i,Je=!0),r=r.queue,as(fc.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||Ie!==null&&Ie.memoizedState.tag&1){if(n.flags|=2048,Ur(9,cc.bind(null,n,r,i,t),void 0,null),Me===null)throw Error(J(349));vn&30||uc(n,t,i)}return i}function uc(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Se.updateQueue,t===null?(t={lastEffect:null,stores:null},Se.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function cc(e,t,n,r){t.value=n,t.getSnapshot=r,dc(t)&&hc(e)}function fc(e,t,n){return n(function(){dc(t)&&hc(e)})}function dc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ht(e,n)}catch(r){return!0}}function hc(e){var t=Lt(e,1);t!==null&&yt(t,e,1,-1)}function pc(e){var t=kt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:e},t.queue=e,e=e.dispatch=np.bind(null,Se,e),[t.memoizedState,e]}function Ur(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Se.updateQueue,t===null?(t={lastEffect:null,stores:null},Se.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function gc(){return ut().memoizedState}function _i(e,t,n,r){var i=kt();Se.flags|=e,i.memoizedState=Ur(1|t,n,void 0,r===void 0?null:r)}function zi(e,t,n,r){var i=ut();r=r===void 0?null:r;var o=void 0;if(Oe!==null){var a=Oe.memoizedState;if(o=a.destroy,r!==null&&ts(r,a.deps)){i.memoizedState=Ur(t,n,o,r);return}}Se.flags|=e,i.memoizedState=Ur(1|t,n,o,r)}function mc(e,t){return _i(8390656,8,e,t)}function as(e,t){return zi(2048,8,e,t)}function vc(e,t){return zi(4,2,e,t)}function yc(e,t){return zi(4,4,e,t)}function wc(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function xc(e,t,n){return n=n!=null?n.concat([e]):null,zi(4,4,wc.bind(null,t,e),n)}function ss(){}function Sc(e,t){var n=ut();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ts(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bc(e,t){var n=ut();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ts(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Cc(e,t,n){return vn&21?(ht(n,t)||(n=ql(),Se.lanes|=n,yn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Je=!0),e.memoizedState=n)}function ep(e,t){var n=ue;ue=n!==0&&4>n?n:4,e(!0);var r=es.transition;es.transition={};try{e(!1),t()}finally{ue=n,es.transition=r}}function kc(){return ut().memoizedState}function tp(e,t,n){var r=an(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Rc(e))Ec(t,n);else if(n=nc(e,t,n,r),n!==null){var i=Ge();yt(n,e,r,i),Oc(n,t,r)}}function np(e,t,n){var r=an(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rc(e))Ec(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,l=o(a,n);if(i.hasEagerState=!0,i.eagerState=l,ht(l,a)){var d=t.interleaved;d===null?(i.next=i,Ka(t)):(i.next=d.next,d.next=i),t.interleaved=i;return}}catch(g){}finally{}n=nc(e,t,i,r),n!==null&&(i=Ge(),yt(n,e,r,i),Oc(n,t,r))}}function Rc(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Ec(e,t){Lr=Bi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Oc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ua(e,n)}}var Hi={readContext:lt,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useInsertionEffect:Ue,useLayoutEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useMutableSource:Ue,useSyncExternalStore:Ue,useId:Ue,unstable_isNewReconciler:!1},rp={readContext:lt,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:lt,useEffect:mc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,_i(4194308,4,wc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _i(4194308,4,e,t)},useInsertionEffect:function(e,t){return _i(4,2,e,t)},useMemo:function(e,t){var n=kt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=kt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=tp.bind(null,Se,e),[r.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:pc,useDebugValue:ss,useDeferredValue:function(e){return kt().memoizedState=e},useTransition:function(){var e=pc(!1),t=e[0];return e=ep.bind(null,e[1]),kt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Se,i=kt();if(ve){if(n===void 0)throw Error(J(407));n=n()}else{if(n=t(),Me===null)throw Error(J(349));vn&30||uc(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,mc(fc.bind(null,r,o,e),[e]),r.flags|=2048,Ur(9,cc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=kt(),t=Me.identifierPrefix;if(ve){var n=Nt,r=Pt;n=(r&~(1<<32-dt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Dr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=qh++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ip={readContext:lt,useCallback:Sc,useContext:lt,useEffect:as,useImperativeHandle:xc,useInsertionEffect:vc,useLayoutEffect:yc,useMemo:bc,useReducer:is,useRef:gc,useState:function(){return is(jr)},useDebugValue:ss,useDeferredValue:function(e){var t=ut();return Cc(t,Oe.memoizedState,e)},useTransition:function(){var e=is(jr)[0],t=ut().memoizedState;return[e,t]},useMutableSource:sc,useSyncExternalStore:lc,useId:kc,unstable_isNewReconciler:!1},op={readContext:lt,useCallback:Sc,useContext:lt,useEffect:as,useImperativeHandle:xc,useInsertionEffect:vc,useLayoutEffect:yc,useMemo:bc,useReducer:os,useRef:gc,useState:function(){return os(jr)},useDebugValue:ss,useDeferredValue:function(e){var t=ut();return Oe===null?t.memoizedState=e:Cc(t,Oe.memoizedState,e)},useTransition:function(){var e=os(jr)[0],t=ut().memoizedState;return[e,t]},useMutableSource:sc,useSyncExternalStore:lc,useId:kc,unstable_isNewReconciler:!1};function gt(e,t){if(e&&e.defaultProps){t=we({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function ls(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:we({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Fi={isMounted:function(e){return(e=e._reactInternals)?cn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ge(),i=an(e),o=Dt(r,i);o.payload=t,n!=null&&(o.callback=n),t=tn(e,o,i),t!==null&&(yt(t,e,i,r),Li(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ge(),i=an(e),o=Dt(r,i);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=tn(e,o,i),t!==null&&(yt(t,e,i,r),Li(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ge(),r=an(e),i=Dt(n,r);i.tag=2,t!=null&&(i.callback=t),t=tn(e,i,r),t!==null&&(yt(t,e,r,n),Li(t,e,r))}};function Tc(e,t,n,r,i,o,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,a):t.prototype&&t.prototype.isPureReactComponent?!Cr(n,r)||!Cr(i,o):!0}function Ac(e,t,n){var r=!1,i=Zt,o=t.contextType;return typeof o=="object"&&o!==null?o=lt(o):(i=Ke(t)?dn:je.current,r=t.contextTypes,o=(r=r!=null)?Hn(e,i):Zt),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Fi,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function Ic(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Fi.enqueueReplaceState(t,t.state,null)}function us(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Ja(e);var o=t.contextType;typeof o=="object"&&o!==null?i.context=lt(o):(o=Ke(t)?dn:je.current,i.context=Hn(e,o)),i.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(ls(e,t,o,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Fi.enqueueReplaceState(i,i.state,null),Di(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Jn(e,t){try{var n="",r=t;do n+=Nd(r),r=r.return;while(r);var i=n}catch(o){i=`
31
- Error generating stack: `+o.message+`
32
- `+o.stack}return{value:e,source:t,stack:i,digest:null}}function cs(e,t,n){return{value:e,source:null,stack:n!=null?n:null,digest:t!=null?t:null}}function fs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ap=typeof WeakMap=="function"?WeakMap:Map;function Mc(e,t,n){n=Dt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ji||(Ji=!0,Es=r),fs(e,t)},n}function Pc(e,t,n){n=Dt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){fs(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){fs(e,t),typeof r!="function"&&(rn===null?rn=new Set([this]):rn.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Nc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ap;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=xp.bind(null,e,t,n),t.then(e,e))}function Lc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Dc(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Dt(-1,1),t.tag=2,tn(n,t,1))),n.lanes|=1),e)}var sp=At.ReactCurrentOwner,Je=!1;function Fe(e,t,n,r){t.child=e===null?tc(t,null,n,r):$n(t,e.child,n,r)}function jc(e,t,n,r,i){n=n.render;var o=t.ref;return Qn(t,i),r=ns(e,t,n,r,o,i),n=rs(),e!==null&&!Je?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,jt(e,t,i)):(ve&&n&&_a(t),t.flags|=1,Fe(e,t,r,i),t.child)}function Uc(e,t,n,r,i){if(e===null){var o=n.type;return typeof o=="function"&&!Ns(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Bc(e,t,o,r,i)):(e=to(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&i)){var a=o.memoizedProps;if(n=n.compare,n=n!==null?n:Cr,n(a,r)&&e.ref===t.ref)return jt(e,t,i)}return t.flags|=1,e=ln(o,r),e.ref=t.ref,e.return=t,t.child=e}function Bc(e,t,n,r,i){if(e!==null){var o=e.memoizedProps;if(Cr(o,r)&&e.ref===t.ref)if(Je=!1,t.pendingProps=r=o,(e.lanes&i)!==0)e.flags&131072&&(Je=!0);else return t.lanes=e.lanes,jt(e,t,i)}return ds(e,t,n,r,i)}function _c(e,t,n){var r=t.pendingProps,i=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},he(Xn,it),it|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,he(Xn,it),it|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,he(Xn,it),it|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,he(Xn,it),it|=r;return Fe(e,t,i,n),t.child}function zc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ds(e,t,n,r,i){var o=Ke(n)?dn:je.current;return o=Hn(t,o),Qn(t,i),n=ns(e,t,n,r,o,i),r=rs(),e!==null&&!Je?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,jt(e,t,i)):(ve&&r&&_a(t),t.flags|=1,Fe(e,t,n,i),t.child)}function Hc(e,t,n,r,i){if(Ke(n)){var o=!0;Ei(t)}else o=!1;if(Qn(t,i),t.stateNode===null)Wi(e,t),Ac(t,n,r),us(t,n,r,i),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var d=a.context,g=n.contextType;typeof g=="object"&&g!==null?g=lt(g):(g=Ke(n)?dn:je.current,g=Hn(t,g));var S=n.getDerivedStateFromProps,E=typeof S=="function"||typeof a.getSnapshotBeforeUpdate=="function";E||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||d!==g)&&Ic(t,a,r,g),en=!1;var y=t.memoizedState;a.state=y,Di(t,r,a,i),d=t.memoizedState,l!==r||y!==d||Qe.current||en?(typeof S=="function"&&(ls(t,n,S,r),d=t.memoizedState),(l=en||Tc(t,n,l,r,y,d,g))?(E||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=d),a.props=r,a.state=d,a.context=g,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,rc(e,t),l=t.memoizedProps,g=t.type===t.elementType?l:gt(t.type,l),a.props=g,E=t.pendingProps,y=a.context,d=n.contextType,typeof d=="object"&&d!==null?d=lt(d):(d=Ke(n)?dn:je.current,d=Hn(t,d));var R=n.getDerivedStateFromProps;(S=typeof R=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==E||y!==d)&&Ic(t,a,r,d),en=!1,y=t.memoizedState,a.state=y,Di(t,r,a,i);var f=t.memoizedState;l!==E||y!==f||Qe.current||en?(typeof R=="function"&&(ls(t,n,R,r),f=t.memoizedState),(g=en||Tc(t,n,g,r,y,f,d)||!1)?(S||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,f,d),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,f,d)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),a.props=r,a.state=f,a.context=d,r=g):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),r=!1)}return hs(e,t,n,r,o,i)}function hs(e,t,n,r,i,o){zc(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return i&&Vu(t,n,!1),jt(e,t,o);r=t.stateNode,sp.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=$n(t,e.child,null,o),t.child=$n(t,null,l,o)):Fe(e,t,l,o),t.memoizedState=r.state,i&&Vu(t,n,!0),t.child}function Fc(e){var t=e.stateNode;t.pendingContext?Wu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Wu(e,t.context,!1),Ya(e,t.containerInfo)}function Gc(e,t,n,r,i){return Wn(),Ga(i),t.flags|=256,Fe(e,t,n,r),t.child}var ps={dehydrated:null,treeContext:null,retryLane:0};function gs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Wc(e,t,n){var r=t.pendingProps,i=xe.current,o=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),he(xe,i&1),e===null)return Fa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,o?(r=t.mode,o=t.child,a={mode:"hidden",children:a},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=a):o=no(a,r,0,null),e=bn(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=gs(n),t.memoizedState=ps,e):ms(t,a));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return lp(e,t,a,r,l,i,n);if(o){o=r.fallback,a=t.mode,i=e.child,l=i.sibling;var d={mode:"hidden",children:r.children};return!(a&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=d,t.deletions=null):(r=ln(i,d),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?o=ln(l,o):(o=bn(o,a,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,a=e.child.memoizedState,a=a===null?gs(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=ps,r}return o=e.child,e=o.sibling,r=ln(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ms(e,t){return t=no({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Gi(e,t,n,r){return r!==null&&Ga(r),$n(t,e.child,null,n),e=ms(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function lp(e,t,n,r,i,o,a){if(n)return t.flags&256?(t.flags&=-257,r=cs(Error(J(422))),Gi(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,i=t.mode,r=no({mode:"visible",children:r.children},i,0,null),o=bn(o,i,a,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&$n(t,e.child,null,a),t.child.memoizedState=gs(a),t.memoizedState=ps,o);if(!(t.mode&1))return Gi(e,t,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,o=Error(J(419)),r=cs(o,r,void 0),Gi(e,t,a,r)}if(l=(a&e.childLanes)!==0,Je||l){if(r=Me,r!==null){switch(a&-a){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|a)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,Lt(e,i),yt(r,e,i,-1))}return Ps(),r=cs(Error(J(421))),Gi(e,t,a,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Sp.bind(null,e),i._reactRetry=t,null):(e=o.treeContext,rt=Yt(i.nextSibling),nt=t,ve=!0,pt=null,e!==null&&(at[st++]=Pt,at[st++]=Nt,at[st++]=hn,Pt=e.id,Nt=e.overflow,hn=t),t=ms(t,r.children),t.flags|=4096,t)}function $c(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Qa(e.return,t,n)}function vs(e,t,n,r,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function Vc(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Fe(e,t,r.children,n),r=xe.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&$c(e,n,t);else if(e.tag===19)$c(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(he(xe,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ji(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),vs(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ji(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}vs(t,!0,n,null,o);break;case"together":vs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Wi(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function jt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),yn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(J(153));if(t.child!==null){for(e=t.child,n=ln(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ln(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function up(e,t,n){switch(t.tag){case 3:Fc(t),Wn();break;case 5:ac(t);break;case 1:Ke(t.type)&&Ei(t);break;case 4:Ya(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;he(Pi,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(he(xe,xe.current&1),t.flags|=128,null):n&t.child.childLanes?Wc(e,t,n):(he(xe,xe.current&1),e=jt(e,t,n),e!==null?e.sibling:null);he(xe,xe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Vc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),he(xe,xe.current),r)break;return null;case 22:case 23:return t.lanes=0,_c(e,t,n)}return jt(e,t,n)}var Qc,ys,Kc,Jc;Qc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ys=function(){},Kc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,mn(Ct.current);var o=null;switch(n){case"input":i=Qo(e,i),r=Qo(e,r),o=[];break;case"select":i=we({},i,{value:void 0}),r=we({},r,{value:void 0}),o=[];break;case"textarea":i=Yo(e,i),r=Yo(e,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ci)}Zo(n,r);var a;n=null;for(g in i)if(!r.hasOwnProperty(g)&&i.hasOwnProperty(g)&&i[g]!=null)if(g==="style"){var l=i[g];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else g!=="dangerouslySetInnerHTML"&&g!=="children"&&g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(nr.hasOwnProperty(g)?o||(o=[]):(o=o||[]).push(g,null));for(g in r){var d=r[g];if(l=i!=null?i[g]:void 0,r.hasOwnProperty(g)&&d!==l&&(d!=null||l!=null))if(g==="style")if(l){for(a in l)!l.hasOwnProperty(a)||d&&d.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in d)d.hasOwnProperty(a)&&l[a]!==d[a]&&(n||(n={}),n[a]=d[a])}else n||(o||(o=[]),o.push(g,n)),n=d;else g==="dangerouslySetInnerHTML"?(d=d?d.__html:void 0,l=l?l.__html:void 0,d!=null&&l!==d&&(o=o||[]).push(g,d)):g==="children"?typeof d!="string"&&typeof d!="number"||(o=o||[]).push(g,""+d):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&(nr.hasOwnProperty(g)?(d!=null&&g==="onScroll"&&ge("scroll",e),o||l===d||(o=[])):(o=o||[]).push(g,d))}n&&(o=o||[]).push("style",n);var g=o;(t.updateQueue=g)&&(t.flags|=4)}},Jc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Br(e,t){if(!ve)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Be(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function cp(e,t,n){var r=t.pendingProps;switch(za(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Be(t),null;case 1:return Ke(t.type)&&Ri(),Be(t),null;case 3:return r=t.stateNode,Kn(),me(Qe),me(je),qa(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ii(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pt!==null&&(As(pt),pt=null))),ys(e,t),Be(t),null;case 5:Xa(t);var i=mn(Nr.current);if(n=t.type,e!==null&&t.stateNode!=null)Kc(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(J(166));return Be(t),null}if(e=mn(Ct.current),Ii(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[bt]=t,r[Tr]=o,e=(t.mode&1)!==0,n){case"dialog":ge("cancel",r),ge("close",r);break;case"iframe":case"object":case"embed":ge("load",r);break;case"video":case"audio":for(i=0;i<Rr.length;i++)ge(Rr[i],r);break;case"source":ge("error",r);break;case"img":case"image":case"link":ge("error",r),ge("load",r);break;case"details":ge("toggle",r);break;case"input":Al(r,o),ge("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},ge("invalid",r);break;case"textarea":Pl(r,o),ge("invalid",r)}Zo(n,o),i=null;for(var a in o)if(o.hasOwnProperty(a)){var l=o[a];a==="children"?typeof l=="string"?r.textContent!==l&&(o.suppressHydrationWarning!==!0&&bi(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&bi(r.textContent,l,e),i=["children",""+l]):nr.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&ge("scroll",r)}switch(n){case"input":qr(r),Ml(r,o,!0);break;case"textarea":qr(r),Ll(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=Ci)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Dl(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[bt]=t,e[Tr]=r,Qc(e,t,!1,!1),t.stateNode=e;e:{switch(a=qo(n,r),n){case"dialog":ge("cancel",e),ge("close",e),i=r;break;case"iframe":case"object":case"embed":ge("load",e),i=r;break;case"video":case"audio":for(i=0;i<Rr.length;i++)ge(Rr[i],e);i=r;break;case"source":ge("error",e),i=r;break;case"img":case"image":case"link":ge("error",e),ge("load",e),i=r;break;case"details":ge("toggle",e),i=r;break;case"input":Al(e,r),i=Qo(e,r),ge("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=we({},r,{value:void 0}),ge("invalid",e);break;case"textarea":Pl(e,r),i=Yo(e,r),ge("invalid",e);break;default:i=r}Zo(n,i),l=i;for(o in l)if(l.hasOwnProperty(o)){var d=l[o];o==="style"?Bl(e,d):o==="dangerouslySetInnerHTML"?(d=d?d.__html:void 0,d!=null&&jl(e,d)):o==="children"?typeof d=="string"?(n!=="textarea"||d!=="")&&ar(e,d):typeof d=="number"&&ar(e,""+d):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(nr.hasOwnProperty(o)?d!=null&&o==="onScroll"&&ge("scroll",e):d!=null&&jo(e,o,d,a))}switch(n){case"input":qr(e),Ml(e,r,!1);break;case"textarea":qr(e),Ll(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Gt(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?An(e,!!r.multiple,o,!1):r.defaultValue!=null&&An(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Ci)}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&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Be(t),null;case 6:if(e&&t.stateNode!=null)Jc(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(J(166));if(n=mn(Nr.current),mn(Ct.current),Ii(t)){if(r=t.stateNode,n=t.memoizedProps,r[bt]=t,(o=r.nodeValue!==n)&&(e=nt,e!==null))switch(e.tag){case 3:bi(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&bi(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[bt]=t,t.stateNode=r}return Be(t),null;case 13:if(me(xe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ve&&rt!==null&&t.mode&1&&!(t.flags&128))Zu(),Wn(),t.flags|=98560,o=!1;else if(o=Ii(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(J(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(J(317));o[bt]=t}else Wn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Be(t),o=!1}else pt!==null&&(As(pt),pt=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||xe.current&1?Te===0&&(Te=3):Ps())),t.updateQueue!==null&&(t.flags|=4),Be(t),null);case 4:return Kn(),ys(e,t),e===null&&Er(t.stateNode.containerInfo),Be(t),null;case 10:return Va(t.type._context),Be(t),null;case 17:return Ke(t.type)&&Ri(),Be(t),null;case 19:if(me(xe),o=t.memoizedState,o===null)return Be(t),null;if(r=(t.flags&128)!==0,a=o.rendering,a===null)if(r)Br(o,!1);else{if(Te!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=ji(e),a!==null){for(t.flags|=128,Br(o,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,a=o.alternate,a===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,e=a.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return he(xe,xe.current&1|2),t.child}e=e.sibling}o.tail!==null&&ke()>Zn&&(t.flags|=128,r=!0,Br(o,!1),t.lanes=4194304)}else{if(!r)if(e=ji(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Br(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!ve)return Be(t),null}else 2*ke()-o.renderingStartTime>Zn&&n!==1073741824&&(t.flags|=128,r=!0,Br(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ke(),t.sibling=null,n=xe.current,he(xe,r?n&1|2:n&1),t):(Be(t),null);case 22:case 23:return Ms(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?it&1073741824&&(Be(t),t.subtreeFlags&6&&(t.flags|=8192)):Be(t),null;case 24:return null;case 25:return null}throw Error(J(156,t.tag))}function fp(e,t){switch(za(t),t.tag){case 1:return Ke(t.type)&&Ri(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(),me(Qe),me(je),qa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xa(t),null;case 13:if(me(xe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(J(340));Wn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return me(xe),null;case 4:return Kn(),null;case 10:return Va(t.type._context),null;case 22:case 23:return Ms(),null;case 24:return null;default:return null}}var $i=!1,_e=!1,dp=typeof WeakSet=="function"?WeakSet:Set,q=null;function Yn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){be(e,t,r)}else n.current=null}function ws(e,t,n){try{n()}catch(r){be(e,t,r)}}var Yc=!1;function hp(e,t){if(Ma=fi,e=Tu(),Ca(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(b){n=null;break e}var a=0,l=-1,d=-1,g=0,S=0,E=e,y=null;t:for(;;){for(var R;E!==n||i!==0&&E.nodeType!==3||(l=a+i),E!==o||r!==0&&E.nodeType!==3||(d=a+r),E.nodeType===3&&(a+=E.nodeValue.length),(R=E.firstChild)!==null;)y=E,E=R;for(;;){if(E===e)break t;if(y===n&&++g===i&&(l=a),y===o&&++S===r&&(d=a),(R=E.nextSibling)!==null)break;E=y,y=E.parentNode}E=R}n=l===-1||d===-1?null:{start:l,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(Pa={focusedElem:e,selectionRange:n},fi=!1,q=t;q!==null;)if(t=q,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;try{var f=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(f!==null){var k=f.memoizedProps,T=f.memoizedState,x=t.stateNode,p=x.getSnapshotBeforeUpdate(t.elementType===t.type?k:gt(t.type,k),T);x.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(b){be(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return f=Yc,Yc=!1,f}function _r(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&ws(t,n,o)}i=i.next}while(i!==r)}}function Vi(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function xs(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Xc(e){var t=e.alternate;t!==null&&(e.alternate=null,Xc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[bt],delete t[Tr],delete t[ja],delete t[Jh],delete t[Yh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Zc(e){return e.tag===5||e.tag===3||e.tag===4}function qc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ss(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ci));else if(r!==4&&(e=e.child,e!==null))for(Ss(e,t,n),e=e.sibling;e!==null;)Ss(e,t,n),e=e.sibling}function bs(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(bs(e,t,n),e=e.sibling;e!==null;)bs(e,t,n),e=e.sibling}var Ne=null,mt=!1;function nn(e,t,n){for(n=n.child;n!==null;)ef(e,t,n),n=n.sibling}function ef(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(oi,n)}catch(l){}switch(n.tag){case 5:_e||Yn(n,t);case 6:var r=Ne,i=mt;Ne=null,nn(e,t,n),Ne=r,mt=i,Ne!==null&&(mt?(e=Ne,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ne.removeChild(n.stateNode));break;case 18:Ne!==null&&(mt?(e=Ne,n=n.stateNode,e.nodeType===8?Da(e.parentNode,n):e.nodeType===1&&Da(e,n),vr(e)):Da(Ne,n.stateNode));break;case 4:r=Ne,i=mt,Ne=n.stateNode.containerInfo,mt=!0,nn(e,t,n),Ne=r,mt=i;break;case 0:case 11:case 14:case 15:if(!_e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&ws(n,t,a),i=i.next}while(i!==r)}nn(e,t,n);break;case 1:if(!_e&&(Yn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){be(n,t,l)}nn(e,t,n);break;case 21:nn(e,t,n);break;case 22:n.mode&1?(_e=(r=_e)||n.memoizedState!==null,nn(e,t,n),_e=r):nn(e,t,n);break;default:nn(e,t,n)}}function tf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new dp),t.forEach(function(r){var i=bp.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function vt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:Ne=l.stateNode,mt=!1;break e;case 3:Ne=l.stateNode.containerInfo,mt=!0;break e;case 4:Ne=l.stateNode.containerInfo,mt=!0;break e}l=l.return}if(Ne===null)throw Error(J(160));ef(o,a,i),Ne=null,mt=!1;var d=i.alternate;d!==null&&(d.return=null),i.return=null}catch(g){be(i,t,g)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)nf(t,e),t=t.sibling}function nf(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(vt(t,e),Rt(e),r&4){try{_r(3,e,e.return),Vi(3,e)}catch(k){be(e,e.return,k)}try{_r(5,e,e.return)}catch(k){be(e,e.return,k)}}break;case 1:vt(t,e),Rt(e),r&512&&n!==null&&Yn(n,n.return);break;case 5:if(vt(t,e),Rt(e),r&512&&n!==null&&Yn(n,n.return),e.flags&32){var i=e.stateNode;try{ar(i,"")}catch(k){be(e,e.return,k)}}if(r&4&&(i=e.stateNode,i!=null)){var o=e.memoizedProps,a=n!==null?n.memoizedProps:o,l=e.type,d=e.updateQueue;if(e.updateQueue=null,d!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&Il(i,o),qo(l,a);var g=qo(l,o);for(a=0;a<d.length;a+=2){var S=d[a],E=d[a+1];S==="style"?Bl(i,E):S==="dangerouslySetInnerHTML"?jl(i,E):S==="children"?ar(i,E):jo(i,S,E,g)}switch(l){case"input":Ko(i,o);break;case"textarea":Nl(i,o);break;case"select":var y=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var R=o.value;R!=null?An(i,!!o.multiple,R,!1):y!==!!o.multiple&&(o.defaultValue!=null?An(i,!!o.multiple,o.defaultValue,!0):An(i,!!o.multiple,o.multiple?[]:"",!1))}i[Tr]=o}catch(k){be(e,e.return,k)}}break;case 6:if(vt(t,e),Rt(e),r&4){if(e.stateNode===null)throw Error(J(162));i=e.stateNode,o=e.memoizedProps;try{i.nodeValue=o}catch(k){be(e,e.return,k)}}break;case 3:if(vt(t,e),Rt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{vr(t.containerInfo)}catch(k){be(e,e.return,k)}break;case 4:vt(t,e),Rt(e);break;case 13:vt(t,e),Rt(e),i=e.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(Rs=ke())),r&4&&tf(e);break;case 22:if(S=n!==null&&n.memoizedState!==null,e.mode&1?(_e=(g=_e)||S,vt(t,e),_e=g):vt(t,e),Rt(e),r&8192){if(g=e.memoizedState!==null,(e.stateNode.isHidden=g)&&!S&&e.mode&1)for(q=e,S=e.child;S!==null;){for(E=q=S;q!==null;){switch(y=q,R=y.child,y.tag){case 0:case 11:case 14:case 15:_r(4,y,y.return);break;case 1:Yn(y,y.return);var f=y.stateNode;if(typeof f.componentWillUnmount=="function"){r=y,n=y.return;try{t=r,f.props=t.memoizedProps,f.state=t.memoizedState,f.componentWillUnmount()}catch(k){be(r,n,k)}}break;case 5:Yn(y,y.return);break;case 22:if(y.memoizedState!==null){af(E);continue}}R!==null?(R.return=y,q=R):af(E)}S=S.sibling}e:for(S=null,E=e;;){if(E.tag===5){if(S===null){S=E;try{i=E.stateNode,g?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=E.stateNode,d=E.memoizedProps.style,a=d!=null&&d.hasOwnProperty("display")?d.display:null,l.style.display=Ul("display",a))}catch(k){be(e,e.return,k)}}}else if(E.tag===6){if(S===null)try{E.stateNode.nodeValue=g?"":E.memoizedProps}catch(k){be(e,e.return,k)}}else if((E.tag!==22&&E.tag!==23||E.memoizedState===null||E===e)&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===e)break e;for(;E.sibling===null;){if(E.return===null||E.return===e)break e;S===E&&(S=null),E=E.return}S===E&&(S=null),E.sibling.return=E.return,E=E.sibling}}break;case 19:vt(t,e),Rt(e),r&4&&tf(e);break;case 21:break;default:vt(t,e),Rt(e)}}function Rt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Zc(n)){var r=n;break e}n=n.return}throw Error(J(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(ar(i,""),r.flags&=-33);var o=qc(e);bs(e,o,i);break;case 3:case 4:var a=r.stateNode.containerInfo,l=qc(e);Ss(e,l,a);break;default:throw Error(J(161))}}catch(d){be(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pp(e,t,n){q=e,rf(e)}function rf(e,t,n){for(var r=(e.mode&1)!==0;q!==null;){var i=q,o=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||$i;if(!a){var l=i.alternate,d=l!==null&&l.memoizedState!==null||_e;l=$i;var g=_e;if($i=a,(_e=d)&&!g)for(q=i;q!==null;)a=q,d=a.child,a.tag===22&&a.memoizedState!==null?sf(i):d!==null?(d.return=a,q=d):sf(i);for(;o!==null;)q=o,rf(o),o=o.sibling;q=i,$i=l,_e=g}of(e)}else i.subtreeFlags&8772&&o!==null?(o.return=i,q=o):of(e)}}function of(e){for(;q!==null;){var t=q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:_e||Vi(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!_e)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:gt(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&oc(t,o,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}oc(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var d=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":d.autoFocus&&n.focus();break;case"img":d.src&&(n.src=d.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var g=t.alternate;if(g!==null){var S=g.memoizedState;if(S!==null){var E=S.dehydrated;E!==null&&vr(E)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(J(163))}_e||t.flags&512&&xs(t)}catch(y){be(t,t.return,y)}}if(t===e){q=null;break}if(n=t.sibling,n!==null){n.return=t.return,q=n;break}q=t.return}}function af(e){for(;q!==null;){var t=q;if(t===e){q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,q=n;break}q=t.return}}function sf(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Vi(4,t)}catch(d){be(t,n,d)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(d){be(t,i,d)}}var o=t.return;try{xs(t)}catch(d){be(t,o,d)}break;case 5:var a=t.return;try{xs(t)}catch(d){be(t,a,d)}}}catch(d){be(t,t.return,d)}if(t===e){q=null;break}var l=t.sibling;if(l!==null){l.return=t.return,q=l;break}q=t.return}}var gp=Math.ceil,Qi=At.ReactCurrentDispatcher,Cs=At.ReactCurrentOwner,ct=At.ReactCurrentBatchConfig,ae=0,Me=null,Ee=null,Le=0,it=0,Xn=Xt(0),Te=0,zr=null,yn=0,Ki=0,ks=0,Hr=null,Ye=null,Rs=0,Zn=1/0,Ut=null,Ji=!1,Es=null,rn=null,Yi=!1,on=null,Xi=0,Fr=0,Os=null,Zi=-1,qi=0;function Ge(){return ae&6?ke():Zi!==-1?Zi:Zi=ke()}function an(e){return e.mode&1?ae&2&&Le!==0?Le&-Le:Zh.transition!==null?(qi===0&&(qi=ql()),qi):(e=ue,e!==0||(e=window.event,e=e===void 0?16:lu(e.type)),e):1}function yt(e,t,n,r){if(50<Fr)throw Fr=0,Os=null,Error(J(185));dr(e,n,r),(!(ae&2)||e!==Me)&&(e===Me&&(!(ae&2)&&(Ki|=n),Te===4&&sn(e,Le)),Xe(e,r),n===1&&ae===0&&!(t.mode&1)&&(Zn=ke()+500,Oi&&qt()))}function Xe(e,t){var n=e.callbackNode;Zd(e,t);var r=li(e,e===Me?Le:0);if(r===0)n!==null&&Yl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Yl(n),t===1)e.tag===0?Xh(uf.bind(null,e)):Qu(uf.bind(null,e)),Qh(function(){!(ae&6)&&qt()}),n=null;else{switch(eu(r)){case 1:n=aa;break;case 4:n=Xl;break;case 16:n=ii;break;case 536870912:n=Zl;break;default:n=ii}n=vf(n,lf.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function lf(e,t){if(Zi=-1,qi=0,ae&6)throw Error(J(327));var n=e.callbackNode;if(qn()&&e.callbackNode!==n)return null;var r=li(e,e===Me?Le:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=eo(e,r);else{t=r;var i=ae;ae|=2;var o=ff();(Me!==e||Le!==t)&&(Ut=null,Zn=ke()+500,xn(e,t));do try{yp();break}catch(l){cf(e,l)}while(!0);$a(),Qi.current=o,ae=i,Ee!==null?t=0:(Me=null,Le=0,t=Te)}if(t!==0){if(t===2&&(i=sa(e),i!==0&&(r=i,t=Ts(e,i))),t===1)throw n=zr,xn(e,0),sn(e,r),Xe(e,ke()),n;if(t===6)sn(e,r);else{if(i=e.current.alternate,!(r&30)&&!mp(i)&&(t=eo(e,r),t===2&&(o=sa(e),o!==0&&(r=o,t=Ts(e,o))),t===1))throw n=zr,xn(e,0),sn(e,r),Xe(e,ke()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(J(345));case 2:Sn(e,Ye,Ut);break;case 3:if(sn(e,r),(r&130023424)===r&&(t=Rs+500-ke(),10<t)){if(li(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Ge(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=La(Sn.bind(null,e,Ye,Ut),t);break}Sn(e,Ye,Ut);break;case 4:if(sn(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var a=31-dt(r);o=1<<a,a=t[a],a>i&&(i=a),r&=~o}if(r=i,r=ke()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*gp(r/1960))-r,10<r){e.timeoutHandle=La(Sn.bind(null,e,Ye,Ut),r);break}Sn(e,Ye,Ut);break;case 5:Sn(e,Ye,Ut);break;default:throw Error(J(329))}}}return Xe(e,ke()),e.callbackNode===n?lf.bind(null,e):null}function Ts(e,t){var n=Hr;return e.current.memoizedState.isDehydrated&&(xn(e,t).flags|=256),e=eo(e,t),e!==2&&(t=Ye,Ye=n,t!==null&&As(t)),e}function As(e){Ye===null?Ye=e:Ye.push.apply(Ye,e)}function mp(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!ht(o(),i))return!1}catch(a){return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function sn(e,t){for(t&=~ks,t&=~Ki,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-dt(t),r=1<<n;e[n]=-1,t&=~r}}function uf(e){if(ae&6)throw Error(J(327));qn();var t=li(e,0);if(!(t&1))return Xe(e,ke()),null;var n=eo(e,t);if(e.tag!==0&&n===2){var r=sa(e);r!==0&&(t=r,n=Ts(e,r))}if(n===1)throw n=zr,xn(e,0),sn(e,t),Xe(e,ke()),n;if(n===6)throw Error(J(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Sn(e,Ye,Ut),Xe(e,ke()),null}function Is(e,t){var n=ae;ae|=1;try{return e(t)}finally{ae=n,ae===0&&(Zn=ke()+500,Oi&&qt())}}function wn(e){on!==null&&on.tag===0&&!(ae&6)&&qn();var t=ae;ae|=1;var n=ct.transition,r=ue;try{if(ct.transition=null,ue=1,e)return e()}finally{ue=r,ct.transition=n,ae=t,!(ae&6)&&qt()}}function Ms(){it=Xn.current,me(Xn)}function xn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Vh(n)),Ee!==null)for(n=Ee.return;n!==null;){var r=n;switch(za(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ri();break;case 3:Kn(),me(Qe),me(je),qa();break;case 5:Xa(r);break;case 4:Kn();break;case 13:me(xe);break;case 19:me(xe);break;case 10:Va(r.type._context);break;case 22:case 23:Ms()}n=n.return}if(Me=e,Ee=e=ln(e.current,null),Le=it=t,Te=0,zr=null,ks=Ki=yn=0,Ye=Hr=null,gn!==null){for(t=0;t<gn.length;t++)if(n=gn[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,o=n.pending;if(o!==null){var a=o.next;o.next=i,r.next=a}n.pending=r}gn=null}return e}function cf(e,t){do{var n=Ee;try{if($a(),Ui.current=Hi,Bi){for(var r=Se.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Bi=!1}if(vn=0,Ie=Oe=Se=null,Lr=!1,Dr=0,Cs.current=null,n===null||n.return===null){Te=1,zr=t,Ee=null;break}e:{var o=e,a=n.return,l=n,d=t;if(t=Le,l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){var g=d,S=l,E=S.tag;if(!(S.mode&1)&&(E===0||E===11||E===15)){var y=S.alternate;y?(S.updateQueue=y.updateQueue,S.memoizedState=y.memoizedState,S.lanes=y.lanes):(S.updateQueue=null,S.memoizedState=null)}var R=Lc(a);if(R!==null){R.flags&=-257,Dc(R,a,l,o,t),R.mode&1&&Nc(o,g,t),t=R,d=g;var f=t.updateQueue;if(f===null){var k=new Set;k.add(d),t.updateQueue=k}else f.add(d);break e}else{if(!(t&1)){Nc(o,g,t),Ps();break e}d=Error(J(426))}}else if(ve&&l.mode&1){var T=Lc(a);if(T!==null){!(T.flags&65536)&&(T.flags|=256),Dc(T,a,l,o,t),Ga(Jn(d,l));break e}}o=d=Jn(d,l),Te!==4&&(Te=2),Hr===null?Hr=[o]:Hr.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var x=Mc(o,d,t);ic(o,x);break e;case 1:l=d;var p=o.type,m=o.stateNode;if(!(o.flags&128)&&(typeof p.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(rn===null||!rn.has(m)))){o.flags|=65536,t&=-t,o.lanes|=t;var b=Pc(o,l,t);ic(o,b);break e}}o=o.return}while(o!==null)}hf(n)}catch(h){t=h,Ee===n&&n!==null&&(Ee=n=n.return);continue}break}while(!0)}function ff(){var e=Qi.current;return Qi.current=Hi,e===null?Hi:e}function Ps(){(Te===0||Te===3||Te===2)&&(Te=4),Me===null||!(yn&268435455)&&!(Ki&268435455)||sn(Me,Le)}function eo(e,t){var n=ae;ae|=2;var r=ff();(Me!==e||Le!==t)&&(Ut=null,xn(e,t));do try{vp();break}catch(i){cf(e,i)}while(!0);if($a(),ae=n,Qi.current=r,Ee!==null)throw Error(J(261));return Me=null,Le=0,Te}function vp(){for(;Ee!==null;)df(Ee)}function yp(){for(;Ee!==null&&!Gd();)df(Ee)}function df(e){var t=mf(e.alternate,e,it);e.memoizedProps=e.pendingProps,t===null?hf(e):Ee=t,Cs.current=null}function hf(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=fp(n,t),n!==null){n.flags&=32767,Ee=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Te=6,Ee=null;return}}else if(n=cp(n,t,it),n!==null){Ee=n;return}if(t=t.sibling,t!==null){Ee=t;return}Ee=t=e}while(t!==null);Te===0&&(Te=5)}function Sn(e,t,n){var r=ue,i=ct.transition;try{ct.transition=null,ue=1,wp(e,t,n,r)}finally{ct.transition=i,ue=r}return null}function wp(e,t,n,r){do qn();while(on!==null);if(ae&6)throw Error(J(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(J(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(qd(e,o),e===Me&&(Ee=Me=null,Le=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Yi||(Yi=!0,vf(ii,function(){return qn(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=ct.transition,ct.transition=null;var a=ue;ue=1;var l=ae;ae|=4,Cs.current=null,hp(e,n),nf(n,e),_h(Pa),fi=!!Ma,Pa=Ma=null,e.current=n,pp(n),Wd(),ae=l,ue=a,ct.transition=o}else e.current=n;if(Yi&&(Yi=!1,on=e,Xi=i),o=e.pendingLanes,o===0&&(rn=null),Qd(n.stateNode),Xe(e,ke()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ji)throw Ji=!1,e=Es,Es=null,e;return Xi&1&&e.tag!==0&&qn(),o=e.pendingLanes,o&1?e===Os?Fr++:(Fr=0,Os=e):Fr=0,qt(),null}function qn(){if(on!==null){var e=eu(Xi),t=ct.transition,n=ue;try{if(ct.transition=null,ue=16>e?16:e,on===null)var r=!1;else{if(e=on,on=null,Xi=0,ae&6)throw Error(J(331));var i=ae;for(ae|=4,q=e.current;q!==null;){var o=q,a=o.child;if(q.flags&16){var l=o.deletions;if(l!==null){for(var d=0;d<l.length;d++){var g=l[d];for(q=g;q!==null;){var S=q;switch(S.tag){case 0:case 11:case 15:_r(8,S,o)}var E=S.child;if(E!==null)E.return=S,q=E;else for(;q!==null;){S=q;var y=S.sibling,R=S.return;if(Xc(S),S===g){q=null;break}if(y!==null){y.return=R,q=y;break}q=R}}}var f=o.alternate;if(f!==null){var k=f.child;if(k!==null){f.child=null;do{var T=k.sibling;k.sibling=null,k=T}while(k!==null)}}q=o}}if(o.subtreeFlags&2064&&a!==null)a.return=o,q=a;else e:for(;q!==null;){if(o=q,o.flags&2048)switch(o.tag){case 0:case 11:case 15:_r(9,o,o.return)}var x=o.sibling;if(x!==null){x.return=o.return,q=x;break e}q=o.return}}var p=e.current;for(q=p;q!==null;){a=q;var m=a.child;if(a.subtreeFlags&2064&&m!==null)m.return=a,q=m;else e:for(a=p;q!==null;){if(l=q,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Vi(9,l)}}catch(h){be(l,l.return,h)}if(l===a){q=null;break e}var b=l.sibling;if(b!==null){b.return=l.return,q=b;break e}q=l.return}}if(ae=i,qt(),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(oi,e)}catch(h){}r=!0}return r}finally{ue=n,ct.transition=t}}return!1}function pf(e,t,n){t=Jn(n,t),t=Mc(e,t,1),e=tn(e,t,1),t=Ge(),e!==null&&(dr(e,1,t),Xe(e,t))}function be(e,t,n){if(e.tag===3)pf(e,e,n);else for(;t!==null;){if(t.tag===3){pf(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(rn===null||!rn.has(r))){e=Jn(n,e),e=Pc(t,e,1),t=tn(t,e,1),e=Ge(),t!==null&&(dr(t,1,e),Xe(t,e));break}}t=t.return}}function xp(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ge(),e.pingedLanes|=e.suspendedLanes&n,Me===e&&(Le&n)===n&&(Te===4||Te===3&&(Le&130023424)===Le&&500>ke()-Rs?xn(e,0):ks|=n),Xe(e,t)}function gf(e,t){t===0&&(e.mode&1?(t=si,si<<=1,!(si&130023424)&&(si=4194304)):t=1);var n=Ge();e=Lt(e,t),e!==null&&(dr(e,t,n),Xe(e,n))}function Sp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function bp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(J(314))}r!==null&&r.delete(t),gf(e,n)}var mf;mf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qe.current)Je=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Je=!1,up(e,t,n);Je=!!(e.flags&131072)}else Je=!1,ve&&t.flags&1048576&&Ku(t,Ai,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Wi(e,t),e=t.pendingProps;var i=Hn(t,je.current);Qn(t,n),i=ns(null,t,r,e,i,n);var o=rs();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ke(r)?(o=!0,Ei(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ja(t),i.updater=Fi,t.stateNode=i,i._reactInternals=t,us(t,r,e,n),t=hs(null,t,r,!0,o,n)):(t.tag=0,ve&&o&&_a(t),Fe(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Wi(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=kp(r),e=gt(r,e),i){case 0:t=ds(null,t,r,e,n);break e;case 1:t=Hc(null,t,r,e,n);break e;case 11:t=jc(null,t,r,e,n);break e;case 14:t=Uc(null,t,r,gt(r.type,e),n);break e}throw Error(J(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gt(r,i),ds(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gt(r,i),Hc(e,t,r,i,n);case 3:e:{if(Fc(t),e===null)throw Error(J(387));r=t.pendingProps,o=t.memoizedState,i=o.element,rc(e,t),Di(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Jn(Error(J(423)),t),t=Gc(e,t,r,n,i);break e}else if(r!==i){i=Jn(Error(J(424)),t),t=Gc(e,t,r,n,i);break e}else for(rt=Yt(t.stateNode.containerInfo.firstChild),nt=t,ve=!0,pt=null,n=tc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Wn(),r===i){t=jt(e,t,n);break e}Fe(e,t,r,n)}t=t.child}return t;case 5:return ac(t),e===null&&Fa(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,Na(r,i)?a=null:o!==null&&Na(r,o)&&(t.flags|=32),zc(e,t),Fe(e,t,a,n),t.child;case 6:return e===null&&Fa(t),null;case 13:return Wc(e,t,n);case 4:return Ya(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=$n(t,null,r,n):Fe(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gt(r,i),jc(e,t,r,i,n);case 7:return Fe(e,t,t.pendingProps,n),t.child;case 8:return Fe(e,t,t.pendingProps.children,n),t.child;case 12:return Fe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,he(Pi,r._currentValue),r._currentValue=a,o!==null)if(ht(o.value,a)){if(o.children===i.children&&!Qe.current){t=jt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){a=o.child;for(var d=l.firstContext;d!==null;){if(d.context===r){if(o.tag===1){d=Dt(-1,n&-n),d.tag=2;var g=o.updateQueue;if(g!==null){g=g.shared;var S=g.pending;S===null?d.next=d:(d.next=S.next,S.next=d),g.pending=d}}o.lanes|=n,d=o.alternate,d!==null&&(d.lanes|=n),Qa(o.return,n,t),l.lanes|=n;break}d=d.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(J(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Qa(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Fe(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Qn(t,n),i=lt(i),r=r(i),t.flags|=1,Fe(e,t,r,n),t.child;case 14:return r=t.type,i=gt(r,t.pendingProps),i=gt(r.type,i),Uc(e,t,r,i,n);case 15:return Bc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gt(r,i),Wi(e,t),t.tag=1,Ke(r)?(e=!0,Ei(t)):e=!1,Qn(t,n),Ac(t,r,i),us(t,r,i,n),hs(null,t,r,!0,e,n);case 19:return Vc(e,t,n);case 22:return _c(e,t,n)}throw Error(J(156,t.tag))};function vf(e,t){return Jl(e,t)}function Cp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 ft(e,t,n,r){return new Cp(e,t,n,r)}function Ns(e){return e=e.prototype,!(!e||!e.isReactComponent)}function kp(e){if(typeof e=="function")return Ns(e)?1:0;if(e!=null){if(e=e.$$typeof,e===_o)return 11;if(e===Fo)return 14}return 2}function ln(e,t){var n=e.alternate;return n===null?(n=ft(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function to(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")Ns(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Tn:return bn(n.children,i,o,t);case Uo:a=8,i|=8;break;case Bo:return e=ft(12,n,t,i|2),e.elementType=Bo,e.lanes=o,e;case zo:return e=ft(13,n,t,i),e.elementType=zo,e.lanes=o,e;case Ho:return e=ft(19,n,t,i),e.elementType=Ho,e.lanes=o,e;case Rl:return no(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Cl:a=10;break e;case kl:a=9;break e;case _o:a=11;break e;case Fo:a=14;break e;case Ft:a=16,r=null;break e}throw Error(J(130,e==null?e:typeof e,""))}return t=ft(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function bn(e,t,n,r){return e=ft(7,e,r,t),e.lanes=n,e}function no(e,t,n,r){return e=ft(22,e,r,t),e.elementType=Rl,e.lanes=n,e.stateNode={isHidden:!1},e}function Ls(e,t,n){return e=ft(6,e,null,t),e.lanes=n,e}function Ds(e,t,n){return t=ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Rp(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=la(0),this.expirationTimes=la(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=la(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function js(e,t,n,r,i,o,a,l,d){return e=new Rp(e,t,n,l,d),t===1?(t=1,o===!0&&(t|=8)):t=0,o=ft(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ja(o),e}function Ep(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:On,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function yf(e){if(!e)return Zt;e=e._reactInternals;e:{if(cn(e)!==e||e.tag!==1)throw Error(J(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ke(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(J(171))}if(e.tag===1){var n=e.type;if(Ke(n))return $u(e,n,t)}return t}function wf(e,t,n,r,i,o,a,l,d){return e=js(n,r,!0,e,i,o,a,l,d),e.context=yf(null),n=e.current,r=Ge(),i=an(n),o=Dt(r,i),o.callback=t!=null?t:null,tn(n,o,i),e.current.lanes=i,dr(e,i,r),Xe(e,r),e}function ro(e,t,n,r){var i=t.current,o=Ge(),a=an(i);return n=yf(n),t.context===null?t.context=n:t.pendingContext=n,t=Dt(o,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=tn(i,t,a),e!==null&&(yt(e,i,a,o),Li(e,i,a)),a}function io(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function xf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Us(e,t){xf(e,t),(e=e.alternate)&&xf(e,t)}function Op(){return null}var Sf=typeof reportError=="function"?reportError:function(e){console.error(e)};function Bs(e){this._internalRoot=e}oo.prototype.render=Bs.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(J(409));ro(e,t,null,null)},oo.prototype.unmount=Bs.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wn(function(){ro(null,e,null,null)}),t[It]=null}};function oo(e){this._internalRoot=e}oo.prototype.unstable_scheduleHydration=function(e){if(e){var t=ru();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qt.length&&t!==0&&t<Qt[n].priority;n++);Qt.splice(n,0,e),n===0&&au(e)}};function _s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ao(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function bf(){}function Tp(e,t,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var g=io(a);o.call(g)}}var a=wf(t,r,e,0,null,!1,!1,"",bf);return e._reactRootContainer=a,e[It]=a.current,Er(e.nodeType===8?e.parentNode:e),wn(),a}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var g=io(d);l.call(g)}}var d=js(e,0,!1,null,null,!1,!1,"",bf);return e._reactRootContainer=d,e[It]=d.current,Er(e.nodeType===8?e.parentNode:e),wn(function(){ro(t,d,n,r)}),d}function so(e,t,n,r,i){var o=n._reactRootContainer;if(o){var a=o;if(typeof i=="function"){var l=i;i=function(){var d=io(a);l.call(d)}}ro(t,a,e,i)}else a=Tp(n,t,e,i,r);return io(a)}tu=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=fr(t.pendingLanes);n!==0&&(ua(t,n|1),Xe(t,ke()),!(ae&6)&&(Zn=ke()+500,qt()))}break;case 13:wn(function(){var r=Lt(e,1);if(r!==null){var i=Ge();yt(r,e,1,i)}}),Us(e,1)}},ca=function(e){if(e.tag===13){var t=Lt(e,134217728);if(t!==null){var n=Ge();yt(t,e,134217728,n)}Us(e,134217728)}},nu=function(e){if(e.tag===13){var t=an(e),n=Lt(e,t);if(n!==null){var r=Ge();yt(n,e,t,r)}Us(e,t)}},ru=function(){return ue},iu=function(e,t){var n=ue;try{return ue=e,t()}finally{ue=n}},na=function(e,t,n){switch(t){case"input":if(Ko(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=ki(r);if(!i)throw Error(J(90));Tl(r),Ko(r,i)}}}break;case"textarea":Nl(e,n);break;case"select":t=n.value,t!=null&&An(e,!!n.multiple,t,!1)}},Fl=Is,Gl=wn;var Ap={usingClientEntryPoint:!1,Events:[Ar,_n,ki,zl,Hl,Is]},Gr={findFiberByHostInstance:fn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ip={bundleType:Gr.bundleType,version:Gr.version,rendererPackageName:Gr.rendererPackageName,rendererConfig:Gr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:At.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Ql(e),e===null?null:e.stateNode},findFiberByHostInstance:Gr.findFiberByHostInstance||Op,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var lo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lo.isDisabled&&lo.supportsFiber)try{oi=lo.inject(Ip),St=lo}catch(e){}}qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ap,qe.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_s(t))throw Error(J(200));return Ep(e,t,null,n)},qe.createRoot=function(e,t){if(!_s(e))throw Error(J(299));var n=!1,r="",i=Sf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=js(e,1,!1,null,null,n,!1,r,i),e[It]=t.current,Er(e.nodeType===8?e.parentNode:e),new Bs(t)},qe.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(J(188)):(e=Object.keys(e).join(","),Error(J(268,e)));return e=Ql(t),e=e===null?null:e.stateNode,e},qe.flushSync=function(e){return wn(e)},qe.hydrate=function(e,t,n){if(!ao(t))throw Error(J(200));return so(null,e,t,!0,n)},qe.hydrateRoot=function(e,t,n){if(!_s(e))throw Error(J(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",a=Sf;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=wf(t,null,e,1,n!=null?n:null,i,!1,o,a),e[It]=t.current,Er(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new oo(t)},qe.render=function(e,t,n){if(!ao(t))throw Error(J(200));return so(null,e,t,!1,n)},qe.unmountComponentAtNode=function(e){if(!ao(e))throw Error(J(40));return e._reactRootContainer?(wn(function(){so(null,null,e,!1,function(){e._reactRootContainer=null,e[It]=null})}),!0):!1},qe.unstable_batchedUpdates=Is,qe.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ao(n))throw Error(J(200));if(e==null||e._reactInternals===void 0)throw Error(J(38));return so(e,t,n,!1,r)},qe.version="18.3.1-next-f1338f8080-20240426";function Cf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Cf)}catch(e){console.error(e)}}Cf(),vl.exports=qe;var Mp=vl.exports,zs,kf=Mp;zs=kf.createRoot,kf.hydrateRoot;var Rf={exports:{}},uo={};/**
25
+ */var Td=te,et=Od;function J(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var xl=new Set,nr={};function un(e,t){En(e,t),En(e+"Capture",t)}function En(e,t){for(nr[e]=t,e=0;e<t.length;e++)xl.add(t[e])}var Tt=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),Ni=Object.prototype.hasOwnProperty,Ad=/^[: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]*$/,Sl={},bl={};function Id(e){return Ni.call(bl,e)?!0:Ni.call(Sl,e)?!1:Ad.test(e)?bl[e]=!0:(Sl[e]=!0,!1)}function Pd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Md(e,t,n,r){if(t===null||typeof t=="undefined"||Pd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function He(e,t,n,r,o,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var Me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Me[e]=new He(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Me[t]=new He(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){Me[e]=new He(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Me[e]=new He(e,2,!1,e,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(e){Me[e]=new He(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){Me[e]=new He(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){Me[e]=new He(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){Me[e]=new He(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){Me[e]=new He(e,5,!1,e.toLowerCase(),null,!1,!1)});var Li=/[\-:]([a-z])/g;function Di(e){return e[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(e){var t=e.replace(Li,Di);Me[t]=new He(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Li,Di);Me[t]=new He(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Li,Di);Me[t]=new He(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){Me[e]=new He(e,1,!1,e.toLowerCase(),null,!1,!1)}),Me.xlinkHref=new He("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){Me[e]=new He(e,1,!1,e.toLowerCase(),null,!0,!0)});function ji(e,t,n,r){var o=Me.hasOwnProperty(t)?Me[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Md(t,n,o,r)&&(n=null),r||o===null?Id(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var At=Td.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Zr=Symbol.for("react.element"),On=Symbol.for("react.portal"),Tn=Symbol.for("react.fragment"),Ui=Symbol.for("react.strict_mode"),Bi=Symbol.for("react.profiler"),Cl=Symbol.for("react.provider"),kl=Symbol.for("react.context"),_i=Symbol.for("react.forward_ref"),zi=Symbol.for("react.suspense"),Hi=Symbol.for("react.suspense_list"),Fi=Symbol.for("react.memo"),Ft=Symbol.for("react.lazy"),Rl=Symbol.for("react.offscreen"),El=Symbol.iterator;function rr(e){return e===null||typeof e!="object"?null:(e=El&&e[El]||e["@@iterator"],typeof e=="function"?e:null)}var we=Object.assign,Gi;function or(e){if(Gi===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Gi=t&&t[1]||""}return`
26
+ `+Gi+e}var Wi=!1;function $i(e,t){if(!e||Wi)return"";Wi=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(g){var r=g}Reflect.construct(e,[],t)}else{try{t.call()}catch(g){r=g}e.call(t.prototype)}else{try{throw Error()}catch(g){r=g}e()}}catch(g){if(g&&r&&typeof g.stack=="string"){for(var o=g.stack.split(`
27
+ `),i=r.stack.split(`
28
+ `),a=o.length-1,l=i.length-1;1<=a&&0<=l&&o[a]!==i[l];)l--;for(;1<=a&&0<=l;a--,l--)if(o[a]!==i[l]){if(a!==1||l!==1)do if(a--,l--,0>l||o[a]!==i[l]){var d=`
29
+ `+o[a].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=a&&0<=l);break}}}finally{Wi=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?or(e):""}function Nd(e){switch(e.tag){case 5:return or(e.type);case 16:return or("Lazy");case 13:return or("Suspense");case 19:return or("SuspenseList");case 0:case 2:case 15:return e=$i(e.type,!1),e;case 11:return e=$i(e.type.render,!1),e;case 1:return e=$i(e.type,!0),e;default:return""}}function Vi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Tn:return"Fragment";case On:return"Portal";case Bi:return"Profiler";case Ui:return"StrictMode";case zi:return"Suspense";case Hi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case kl:return(e.displayName||"Context")+".Consumer";case Cl:return(e._context.displayName||"Context")+".Provider";case _i:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Fi:return t=e.displayName||null,t!==null?t:Vi(e.type)||"Memo";case Ft:t=e._payload,e=e._init;try{return Vi(e(t))}catch(n){}}return null}function Ld(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Vi(t);case 8:return t===Ui?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Gt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ol(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Dd(e){var t=Ol(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n!="undefined"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qr(e){e._valueTracker||(e._valueTracker=Dd(e))}function Tl(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ol(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function eo(e){if(e=e||(typeof document!="undefined"?document:void 0),typeof e=="undefined")return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Qi(e,t){var n=t.checked;return we({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n!=null?n:e._wrapperState.initialChecked})}function Al(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Gt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Il(e,t){t=t.checked,t!=null&&ji(e,"checked",t,!1)}function Ki(e,t){Il(e,t);var n=Gt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ji(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ji(e,t.type,Gt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pl(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ji(e,t,n){(t!=="number"||eo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ir=Array.isArray;function An(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Gt(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Yi(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(J(91));return we({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ml(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(J(92));if(ir(n)){if(1<n.length)throw Error(J(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Gt(n)}}function Nl(e,t){var n=Gt(t.value),r=Gt(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Ll(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Dl(e){switch(e){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 Xi(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Dl(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var to,jl=function(e){return typeof MSApp!="undefined"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(to=to||document.createElement("div"),to.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=to.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ar(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var sr={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},jd=["Webkit","ms","Moz","O"];Object.keys(sr).forEach(function(e){jd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),sr[t]=sr[e]})});function Ul(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||sr.hasOwnProperty(e)&&sr[e]?(""+t).trim():t+"px"}function Bl(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Ul(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var Ud=we({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 Zi(e,t){if(t){if(Ud[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(J(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(J(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(J(61))}if(t.style!=null&&typeof t.style!="object")throw Error(J(62))}}function qi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 ea=null;function ta(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var na=null,In=null,Pn=null;function _l(e){if(e=Ar(e)){if(typeof na!="function")throw Error(J(280));var t=e.stateNode;t&&(t=Ro(t),na(e.stateNode,e.type,t))}}function zl(e){In?Pn?Pn.push(e):Pn=[e]:In=e}function Hl(){if(In){var e=In,t=Pn;if(Pn=In=null,_l(e),t)for(e=0;e<t.length;e++)_l(t[e])}}function Fl(e,t){return e(t)}function Gl(){}var ra=!1;function Wl(e,t,n){if(ra)return e(t,n);ra=!0;try{return Fl(e,t,n)}finally{ra=!1,(In!==null||Pn!==null)&&(Gl(),Hl())}}function lr(e,t){var n=e.stateNode;if(n===null)return null;var r=Ro(n);if(r===null)return null;n=r[t];e:switch(t){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)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(J(231,t,typeof n));return n}var oa=!1;if(Tt)try{var ur={};Object.defineProperty(ur,"passive",{get:function(){oa=!0}}),window.addEventListener("test",ur,ur),window.removeEventListener("test",ur,ur)}catch(e){oa=!1}function Bd(e,t,n,r,o,i,a,l,d){var g=Array.prototype.slice.call(arguments,3);try{t.apply(n,g)}catch(S){this.onError(S)}}var cr=!1,no=null,ro=!1,ia=null,_d={onError:function(e){cr=!0,no=e}};function zd(e,t,n,r,o,i,a,l,d){cr=!1,no=null,Bd.apply(_d,arguments)}function Hd(e,t,n,r,o,i,a,l,d){if(zd.apply(this,arguments),cr){if(cr){var g=no;cr=!1,no=null}else throw Error(J(198));ro||(ro=!0,ia=g)}}function cn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function $l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Vl(e){if(cn(e)!==e)throw Error(J(188))}function Fd(e){var t=e.alternate;if(!t){if(t=cn(e),t===null)throw Error(J(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return Vl(o),e;if(i===r)return Vl(o),t;i=i.sibling}throw Error(J(188))}if(n.return!==r.return)n=o,r=i;else{for(var a=!1,l=o.child;l;){if(l===n){a=!0,n=o,r=i;break}if(l===r){a=!0,r=o,n=i;break}l=l.sibling}if(!a){for(l=i.child;l;){if(l===n){a=!0,n=i,r=o;break}if(l===r){a=!0,r=i,n=o;break}l=l.sibling}if(!a)throw Error(J(189))}}if(n.alternate!==r)throw Error(J(190))}if(n.tag!==3)throw Error(J(188));return n.stateNode.current===n?e:t}function Ql(e){return e=Fd(e),e!==null?Kl(e):null}function Kl(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Kl(e);if(t!==null)return t;e=e.sibling}return null}var Jl=et.unstable_scheduleCallback,Yl=et.unstable_cancelCallback,Gd=et.unstable_shouldYield,Wd=et.unstable_requestPaint,ke=et.unstable_now,$d=et.unstable_getCurrentPriorityLevel,aa=et.unstable_ImmediatePriority,Xl=et.unstable_UserBlockingPriority,oo=et.unstable_NormalPriority,Vd=et.unstable_LowPriority,Zl=et.unstable_IdlePriority,io=null,St=null;function Qd(e){if(St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(io,e,void 0,(e.current.flags&128)===128)}catch(t){}}var dt=Math.clz32?Math.clz32:Yd,Kd=Math.log,Jd=Math.LN2;function Yd(e){return e>>>=0,e===0?32:31-(Kd(e)/Jd|0)|0}var ao=64,so=4194304;function fr(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function lo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~o;l!==0?r=fr(l):(i&=a,i!==0&&(r=fr(i)))}else a=n&~o,a!==0?r=fr(a):i!==0&&(r=fr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-dt(t),o=1<<n,r|=e[n],t&=~o;return r}function Xd(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 Zd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-dt(i),l=1<<a,d=o[a];d===-1?(!(l&n)||l&r)&&(o[a]=Xd(l,t)):d<=t&&(e.expiredLanes|=l),i&=~l}}function sa(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ql(){var e=ao;return ao<<=1,!(ao&4194240)&&(ao=64),e}function la(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function dr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-dt(t),e[t]=n}function qd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-dt(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function ua(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-dt(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var ue=0;function eu(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var tu,ca,nu,ru,ou,fa=!1,uo=[],Wt=null,$t=null,Vt=null,hr=new Map,pr=new Map,Qt=[],eh="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 iu(e,t){switch(e){case"focusin":case"focusout":Wt=null;break;case"dragenter":case"dragleave":$t=null;break;case"mouseover":case"mouseout":Vt=null;break;case"pointerover":case"pointerout":hr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":pr.delete(t.pointerId)}}function gr(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=Ar(t),t!==null&&ca(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function th(e,t,n,r,o){switch(t){case"focusin":return Wt=gr(Wt,e,t,n,r,o),!0;case"dragenter":return $t=gr($t,e,t,n,r,o),!0;case"mouseover":return Vt=gr(Vt,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return hr.set(i,gr(hr.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,pr.set(i,gr(pr.get(i)||null,e,t,n,r,o)),!0}return!1}function au(e){var t=fn(e.target);if(t!==null){var n=cn(t);if(n!==null){if(t=n.tag,t===13){if(t=$l(n),t!==null){e.blockedOn=t,ou(e.priority,function(){nu(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function co(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ha(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ea=r,n.target.dispatchEvent(r),ea=null}else return t=Ar(n),t!==null&&ca(t),e.blockedOn=n,!1;t.shift()}return!0}function su(e,t,n){co(e)&&n.delete(t)}function nh(){fa=!1,Wt!==null&&co(Wt)&&(Wt=null),$t!==null&&co($t)&&($t=null),Vt!==null&&co(Vt)&&(Vt=null),hr.forEach(su),pr.forEach(su)}function mr(e,t){e.blockedOn===t&&(e.blockedOn=null,fa||(fa=!0,et.unstable_scheduleCallback(et.unstable_NormalPriority,nh)))}function vr(e){function t(o){return mr(o,e)}if(0<uo.length){mr(uo[0],e);for(var n=1;n<uo.length;n++){var r=uo[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Wt!==null&&mr(Wt,e),$t!==null&&mr($t,e),Vt!==null&&mr(Vt,e),hr.forEach(t),pr.forEach(t),n=0;n<Qt.length;n++)r=Qt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Qt.length&&(n=Qt[0],n.blockedOn===null);)au(n),n.blockedOn===null&&Qt.shift()}var Mn=At.ReactCurrentBatchConfig,fo=!0;function rh(e,t,n,r){var o=ue,i=Mn.transition;Mn.transition=null;try{ue=1,da(e,t,n,r)}finally{ue=o,Mn.transition=i}}function oh(e,t,n,r){var o=ue,i=Mn.transition;Mn.transition=null;try{ue=4,da(e,t,n,r)}finally{ue=o,Mn.transition=i}}function da(e,t,n,r){if(fo){var o=ha(e,t,n,r);if(o===null)Ia(e,t,r,ho,n),iu(e,r);else if(th(o,e,t,n,r))r.stopPropagation();else if(iu(e,r),t&4&&-1<eh.indexOf(e)){for(;o!==null;){var i=Ar(o);if(i!==null&&tu(i),i=ha(e,t,n,r),i===null&&Ia(e,t,r,ho,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Ia(e,t,r,null,n)}}var ho=null;function ha(e,t,n,r){if(ho=null,e=ta(r),e=fn(e),e!==null)if(t=cn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=$l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return ho=e,null}function lu(e){switch(e){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($d()){case aa:return 1;case Xl:return 4;case oo:case Vd:return 16;case Zl:return 536870912;default:return 16}default:return 16}}var Kt=null,pa=null,po=null;function uu(){if(po)return po;var e,t=pa,n=t.length,r,o="value"in Kt?Kt.value:Kt.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===o[i-r];r++);return po=o.slice(e,1<r?1-r:void 0)}function go(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function mo(){return!0}function cu(){return!1}function tt(e){function t(n,r,o,i,a){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?mo:cu,this.isPropagationStopped=cu,this}return we(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=mo)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=mo)},persist:function(){},isPersistent:mo}),t}var Nn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ga=tt(Nn),yr=we({},Nn,{view:0,detail:0}),ih=tt(yr),ma,va,wr,vo=we({},yr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wa,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==wr&&(wr&&e.type==="mousemove"?(ma=e.screenX-wr.screenX,va=e.screenY-wr.screenY):va=ma=0,wr=e),ma)},movementY:function(e){return"movementY"in e?e.movementY:va}}),fu=tt(vo),ah=we({},vo,{dataTransfer:0}),sh=tt(ah),lh=we({},yr,{relatedTarget:0}),ya=tt(lh),uh=we({},Nn,{animationName:0,elapsedTime:0,pseudoElement:0}),ch=tt(uh),fh=we({},Nn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),dh=tt(fh),hh=we({},Nn,{data:0}),du=tt(hh),ph={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gh={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"},mh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=mh[e])?!!t[e]:!1}function wa(){return vh}var yh=we({},yr,{key:function(e){if(e.key){var t=ph[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=go(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wa,charCode:function(e){return e.type==="keypress"?go(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?go(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),wh=tt(yh),xh=we({},vo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hu=tt(xh),Sh=we({},yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wa}),bh=tt(Sh),Ch=we({},Nn,{propertyName:0,elapsedTime:0,pseudoElement:0}),kh=tt(Ch),Rh=we({},vo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Eh=tt(Rh),Oh=[9,13,27,32],xa=Tt&&"CompositionEvent"in window,xr=null;Tt&&"documentMode"in document&&(xr=document.documentMode);var Th=Tt&&"TextEvent"in window&&!xr,pu=Tt&&(!xa||xr&&8<xr&&11>=xr),gu=" ",mu=!1;function vu(e,t){switch(e){case"keyup":return Oh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ln=!1;function Ah(e,t){switch(e){case"compositionend":return yu(t);case"keypress":return t.which!==32?null:(mu=!0,gu);case"textInput":return e=t.data,e===gu&&mu?null:e;default:return null}}function Ih(e,t){if(Ln)return e==="compositionend"||!xa&&vu(e,t)?(e=uu(),po=pa=Kt=null,Ln=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return pu&&t.locale!=="ko"?null:t.data;default:return null}}var Ph={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 wu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ph[e.type]:t==="textarea"}function xu(e,t,n,r){zl(r),t=bo(t,"onChange"),0<t.length&&(n=new ga("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Sr=null,br=null;function Mh(e){Bu(e,0)}function yo(e){var t=_n(e);if(Tl(t))return e}function Nh(e,t){if(e==="change")return t}var Su=!1;if(Tt){var Sa;if(Tt){var ba="oninput"in document;if(!ba){var bu=document.createElement("div");bu.setAttribute("oninput","return;"),ba=typeof bu.oninput=="function"}Sa=ba}else Sa=!1;Su=Sa&&(!document.documentMode||9<document.documentMode)}function Cu(){Sr&&(Sr.detachEvent("onpropertychange",ku),br=Sr=null)}function ku(e){if(e.propertyName==="value"&&yo(br)){var t=[];xu(t,br,e,ta(e)),Wl(Mh,t)}}function Lh(e,t,n){e==="focusin"?(Cu(),Sr=t,br=n,Sr.attachEvent("onpropertychange",ku)):e==="focusout"&&Cu()}function Dh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return yo(br)}function jh(e,t){if(e==="click")return yo(t)}function Uh(e,t){if(e==="input"||e==="change")return yo(t)}function Bh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ht=typeof Object.is=="function"?Object.is:Bh;function Cr(e,t){if(ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!Ni.call(t,o)||!ht(e[o],t[o]))return!1}return!0}function Ru(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Eu(e,t){var n=Ru(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ru(n)}}function Ou(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ou(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tu(){for(var e=window,t=eo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch(r){n=!1}if(n)e=t.contentWindow;else break;t=eo(e.document)}return t}function Ca(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function _h(e){var t=Tu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ou(n.ownerDocument.documentElement,n)){if(r!==null&&Ca(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=Eu(n,i);var a=Eu(n,r);o&&a&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var zh=Tt&&"documentMode"in document&&11>=document.documentMode,Dn=null,ka=null,kr=null,Ra=!1;function Au(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ra||Dn==null||Dn!==eo(r)||(r=Dn,"selectionStart"in r&&Ca(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kr&&Cr(kr,r)||(kr=r,r=bo(ka,"onSelect"),0<r.length&&(t=new ga("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Dn)))}function wo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var jn={animationend:wo("Animation","AnimationEnd"),animationiteration:wo("Animation","AnimationIteration"),animationstart:wo("Animation","AnimationStart"),transitionend:wo("Transition","TransitionEnd")},Ea={},Iu={};Tt&&(Iu=document.createElement("div").style,"AnimationEvent"in window||(delete jn.animationend.animation,delete jn.animationiteration.animation,delete jn.animationstart.animation),"TransitionEvent"in window||delete jn.transitionend.transition);function xo(e){if(Ea[e])return Ea[e];if(!jn[e])return e;var t=jn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Iu)return Ea[e]=t[n];return e}var Pu=xo("animationend"),Mu=xo("animationiteration"),Nu=xo("animationstart"),Lu=xo("transitionend"),Du=new Map,ju="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 Jt(e,t){Du.set(e,t),un(t,[e])}for(var Oa=0;Oa<ju.length;Oa++){var Ta=ju[Oa],Hh=Ta.toLowerCase(),Fh=Ta[0].toUpperCase()+Ta.slice(1);Jt(Hh,"on"+Fh)}Jt(Pu,"onAnimationEnd"),Jt(Mu,"onAnimationIteration"),Jt(Nu,"onAnimationStart"),Jt("dblclick","onDoubleClick"),Jt("focusin","onFocus"),Jt("focusout","onBlur"),Jt(Lu,"onTransitionEnd"),En("onMouseEnter",["mouseout","mouseover"]),En("onMouseLeave",["mouseout","mouseover"]),En("onPointerEnter",["pointerout","pointerover"]),En("onPointerLeave",["pointerout","pointerover"]),un("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),un("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),un("onBeforeInput",["compositionend","keypress","textInput","paste"]),un("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),un("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),un("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Rr="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(" "),Gh=new Set("cancel close invalid load scroll toggle".split(" ").concat(Rr));function Uu(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Hd(r,t,void 0,e),e.currentTarget=null}function Bu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],d=l.instance,g=l.currentTarget;if(l=l.listener,d!==i&&o.isPropagationStopped())break e;Uu(o,l,g),i=d}else for(a=0;a<r.length;a++){if(l=r[a],d=l.instance,g=l.currentTarget,l=l.listener,d!==i&&o.isPropagationStopped())break e;Uu(o,l,g),i=d}}}if(ro)throw e=ia,ro=!1,ia=null,e}function ge(e,t){var n=t[ja];n===void 0&&(n=t[ja]=new Set);var r=e+"__bubble";n.has(r)||(_u(t,e,2,!1),n.add(r))}function Aa(e,t,n){var r=0;t&&(r|=4),_u(n,e,r,t)}var So="_reactListening"+Math.random().toString(36).slice(2);function Er(e){if(!e[So]){e[So]=!0,xl.forEach(function(n){n!=="selectionchange"&&(Gh.has(n)||Aa(n,!1,e),Aa(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[So]||(t[So]=!0,Aa("selectionchange",!1,t))}}function _u(e,t,n,r){switch(lu(t)){case 1:var o=rh;break;case 4:o=oh;break;default:o=da}n=o.bind(null,t,n,e),o=void 0,!oa||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Ia(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;if(l===o||l.nodeType===8&&l.parentNode===o)break;if(a===4)for(a=r.return;a!==null;){var d=a.tag;if((d===3||d===4)&&(d=a.stateNode.containerInfo,d===o||d.nodeType===8&&d.parentNode===o))return;a=a.return}for(;l!==null;){if(a=fn(l),a===null)return;if(d=a.tag,d===5||d===6){r=i=a;continue e}l=l.parentNode}}r=r.return}Wl(function(){var g=i,S=ta(n),E=[];e:{var y=Du.get(e);if(y!==void 0){var R=ga,f=e;switch(e){case"keypress":if(go(n)===0)break e;case"keydown":case"keyup":R=wh;break;case"focusin":f="focus",R=ya;break;case"focusout":f="blur",R=ya;break;case"beforeblur":case"afterblur":R=ya;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":R=fu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":R=sh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":R=bh;break;case Pu:case Mu:case Nu:R=ch;break;case Lu:R=kh;break;case"scroll":R=ih;break;case"wheel":R=Eh;break;case"copy":case"cut":case"paste":R=dh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":R=hu}var k=(t&4)!==0,T=!k&&e==="scroll",x=k?y!==null?y+"Capture":null:y;k=[];for(var p=g,m;p!==null;){m=p;var b=m.stateNode;if(m.tag===5&&b!==null&&(m=b,x!==null&&(b=lr(p,x),b!=null&&k.push(Or(p,b,m)))),T)break;p=p.return}0<k.length&&(y=new R(y,f,null,n,S),E.push({event:y,listeners:k}))}}if(!(t&7)){e:{if(y=e==="mouseover"||e==="pointerover",R=e==="mouseout"||e==="pointerout",y&&n!==ea&&(f=n.relatedTarget||n.fromElement)&&(fn(f)||f[It]))break e;if((R||y)&&(y=S.window===S?S:(y=S.ownerDocument)?y.defaultView||y.parentWindow:window,R?(f=n.relatedTarget||n.toElement,R=g,f=f?fn(f):null,f!==null&&(T=cn(f),f!==T||f.tag!==5&&f.tag!==6)&&(f=null)):(R=null,f=g),R!==f)){if(k=fu,b="onMouseLeave",x="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(k=hu,b="onPointerLeave",x="onPointerEnter",p="pointer"),T=R==null?y:_n(R),m=f==null?y:_n(f),y=new k(b,p+"leave",R,n,S),y.target=T,y.relatedTarget=m,b=null,fn(S)===g&&(k=new k(x,p+"enter",f,n,S),k.target=m,k.relatedTarget=T,b=k),T=b,R&&f)t:{for(k=R,x=f,p=0,m=k;m;m=Un(m))p++;for(m=0,b=x;b;b=Un(b))m++;for(;0<p-m;)k=Un(k),p--;for(;0<m-p;)x=Un(x),m--;for(;p--;){if(k===x||x!==null&&k===x.alternate)break t;k=Un(k),x=Un(x)}k=null}else k=null;R!==null&&zu(E,y,R,k,!1),f!==null&&T!==null&&zu(E,T,f,k,!0)}}e:{if(y=g?_n(g):window,R=y.nodeName&&y.nodeName.toLowerCase(),R==="select"||R==="input"&&y.type==="file")var h=Nh;else if(wu(y))if(Su)h=Uh;else{h=Dh;var c=Lh}else(R=y.nodeName)&&R.toLowerCase()==="input"&&(y.type==="checkbox"||y.type==="radio")&&(h=jh);if(h&&(h=h(e,g))){xu(E,h,n,S);break e}c&&c(e,y,g),e==="focusout"&&(c=y._wrapperState)&&c.controlled&&y.type==="number"&&Ji(y,"number",y.value)}switch(c=g?_n(g):window,e){case"focusin":(wu(c)||c.contentEditable==="true")&&(Dn=c,ka=g,kr=null);break;case"focusout":kr=ka=Dn=null;break;case"mousedown":Ra=!0;break;case"contextmenu":case"mouseup":case"dragend":Ra=!1,Au(E,n,S);break;case"selectionchange":if(zh)break;case"keydown":case"keyup":Au(E,n,S)}var u;if(xa)e:{switch(e){case"compositionstart":var s="onCompositionStart";break e;case"compositionend":s="onCompositionEnd";break e;case"compositionupdate":s="onCompositionUpdate";break e}s=void 0}else Ln?vu(e,n)&&(s="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(s="onCompositionStart");s&&(pu&&n.locale!=="ko"&&(Ln||s!=="onCompositionStart"?s==="onCompositionEnd"&&Ln&&(u=uu()):(Kt=S,pa="value"in Kt?Kt.value:Kt.textContent,Ln=!0)),c=bo(g,s),0<c.length&&(s=new du(s,e,null,n,S),E.push({event:s,listeners:c}),u?s.data=u:(u=yu(n),u!==null&&(s.data=u)))),(u=Th?Ah(e,n):Ih(e,n))&&(g=bo(g,"onBeforeInput"),0<g.length&&(S=new du("onBeforeInput","beforeinput",null,n,S),E.push({event:S,listeners:g}),S.data=u))}Bu(E,t)})}function Or(e,t,n){return{instance:e,listener:t,currentTarget:n}}function bo(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=lr(e,n),i!=null&&r.unshift(Or(e,i,o)),i=lr(e,t),i!=null&&r.push(Or(e,i,o))),e=e.return}return r}function Un(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function zu(e,t,n,r,o){for(var i=t._reactName,a=[];n!==null&&n!==r;){var l=n,d=l.alternate,g=l.stateNode;if(d!==null&&d===r)break;l.tag===5&&g!==null&&(l=g,o?(d=lr(n,i),d!=null&&a.unshift(Or(n,d,l))):o||(d=lr(n,i),d!=null&&a.push(Or(n,d,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var Wh=/\r\n?/g,$h=/\u0000|\uFFFD/g;function Hu(e){return(typeof e=="string"?e:""+e).replace(Wh,`
30
+ `).replace($h,"")}function Co(e,t,n){if(t=Hu(t),Hu(e)!==t&&n)throw Error(J(425))}function ko(){}var Pa=null,Ma=null;function Na(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var La=typeof setTimeout=="function"?setTimeout:void 0,Vh=typeof clearTimeout=="function"?clearTimeout:void 0,Fu=typeof Promise=="function"?Promise:void 0,Qh=typeof queueMicrotask=="function"?queueMicrotask:typeof Fu!="undefined"?function(e){return Fu.resolve(null).then(e).catch(Kh)}:La;function Kh(e){setTimeout(function(){throw e})}function Da(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),vr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);vr(t)}function Yt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Gu(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Bn=Math.random().toString(36).slice(2),bt="__reactFiber$"+Bn,Tr="__reactProps$"+Bn,It="__reactContainer$"+Bn,ja="__reactEvents$"+Bn,Jh="__reactListeners$"+Bn,Yh="__reactHandles$"+Bn;function fn(e){var t=e[bt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[It]||n[bt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Gu(e);e!==null;){if(n=e[bt])return n;e=Gu(e)}return t}e=n,n=e.parentNode}return null}function Ar(e){return e=e[bt]||e[It],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function _n(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(J(33))}function Ro(e){return e[Tr]||null}var Ua=[],zn=-1;function Xt(e){return{current:e}}function me(e){0>zn||(e.current=Ua[zn],Ua[zn]=null,zn--)}function he(e,t){zn++,Ua[zn]=e.current,e.current=t}var Zt={},je=Xt(Zt),Qe=Xt(!1),dn=Zt;function Hn(e,t){var n=e.type.contextTypes;if(!n)return Zt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ke(e){return e=e.childContextTypes,e!=null}function Eo(){me(Qe),me(je)}function Wu(e,t,n){if(je.current!==Zt)throw Error(J(168));he(je,t),he(Qe,n)}function $u(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(J(108,Ld(e)||"Unknown",o));return we({},n,r)}function Oo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zt,dn=je.current,he(je,e),he(Qe,Qe.current),!0}function Vu(e,t,n){var r=e.stateNode;if(!r)throw Error(J(169));n?(e=$u(e,t,dn),r.__reactInternalMemoizedMergedChildContext=e,me(Qe),me(je),he(je,e)):me(Qe),he(Qe,n)}var Pt=null,To=!1,Ba=!1;function Qu(e){Pt===null?Pt=[e]:Pt.push(e)}function Xh(e){To=!0,Qu(e)}function qt(){if(!Ba&&Pt!==null){Ba=!0;var e=0,t=ue;try{var n=Pt;for(ue=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Pt=null,To=!1}catch(o){throw Pt!==null&&(Pt=Pt.slice(e+1)),Jl(aa,qt),o}finally{ue=t,Ba=!1}}return null}var Fn=[],Gn=0,Ao=null,Io=0,at=[],st=0,hn=null,Mt=1,Nt="";function pn(e,t){Fn[Gn++]=Io,Fn[Gn++]=Ao,Ao=e,Io=t}function Ku(e,t,n){at[st++]=Mt,at[st++]=Nt,at[st++]=hn,hn=e;var r=Mt;e=Nt;var o=32-dt(r)-1;r&=~(1<<o),n+=1;var i=32-dt(t)+o;if(30<i){var a=o-o%5;i=(r&(1<<a)-1).toString(32),r>>=a,o-=a,Mt=1<<32-dt(t)+o|n<<o|r,Nt=i+e}else Mt=1<<i|n<<o|r,Nt=e}function _a(e){e.return!==null&&(pn(e,1),Ku(e,1,0))}function za(e){for(;e===Ao;)Ao=Fn[--Gn],Fn[Gn]=null,Io=Fn[--Gn],Fn[Gn]=null;for(;e===hn;)hn=at[--st],at[st]=null,Nt=at[--st],at[st]=null,Mt=at[--st],at[st]=null}var nt=null,rt=null,ve=!1,pt=null;function Ju(e,t){var n=ft(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Yu(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,nt=e,rt=Yt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,nt=e,rt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=hn!==null?{id:Mt,overflow:Nt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ft(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,nt=e,rt=null,!0):!1;default:return!1}}function Ha(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Fa(e){if(ve){var t=rt;if(t){var n=t;if(!Yu(e,t)){if(Ha(e))throw Error(J(418));t=Yt(n.nextSibling);var r=nt;t&&Yu(e,t)?Ju(r,n):(e.flags=e.flags&-4097|2,ve=!1,nt=e)}}else{if(Ha(e))throw Error(J(418));e.flags=e.flags&-4097|2,ve=!1,nt=e}}}function Xu(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;nt=e}function Po(e){if(e!==nt)return!1;if(!ve)return Xu(e),ve=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Na(e.type,e.memoizedProps)),t&&(t=rt)){if(Ha(e))throw Zu(),Error(J(418));for(;t;)Ju(e,t),t=Yt(t.nextSibling)}if(Xu(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(J(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){rt=Yt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}rt=null}}else rt=nt?Yt(e.stateNode.nextSibling):null;return!0}function Zu(){for(var e=rt;e;)e=Yt(e.nextSibling)}function Wn(){rt=nt=null,ve=!1}function Ga(e){pt===null?pt=[e]:pt.push(e)}var Zh=At.ReactCurrentBatchConfig;function Ir(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(J(309));var r=n.stateNode}if(!r)throw Error(J(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var l=o.refs;a===null?delete l[i]:l[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(J(284));if(!n._owner)throw Error(J(290,e))}return e}function Mo(e,t){throw e=Object.prototype.toString.call(t),Error(J(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function qu(e){var t=e._init;return t(e._payload)}function ec(e){function t(x,p){if(e){var m=x.deletions;m===null?(x.deletions=[p],x.flags|=16):m.push(p)}}function n(x,p){if(!e)return null;for(;p!==null;)t(x,p),p=p.sibling;return null}function r(x,p){for(x=new Map;p!==null;)p.key!==null?x.set(p.key,p):x.set(p.index,p),p=p.sibling;return x}function o(x,p){return x=ln(x,p),x.index=0,x.sibling=null,x}function i(x,p,m){return x.index=m,e?(m=x.alternate,m!==null?(m=m.index,m<p?(x.flags|=2,p):m):(x.flags|=2,p)):(x.flags|=1048576,p)}function a(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,p,m,b){return p===null||p.tag!==6?(p=Ls(m,x.mode,b),p.return=x,p):(p=o(p,m),p.return=x,p)}function d(x,p,m,b){var h=m.type;return h===Tn?S(x,p,m.props.children,b,m.key):p!==null&&(p.elementType===h||typeof h=="object"&&h!==null&&h.$$typeof===Ft&&qu(h)===p.type)?(b=o(p,m.props),b.ref=Ir(x,p,m),b.return=x,b):(b=ni(m.type,m.key,m.props,null,x.mode,b),b.ref=Ir(x,p,m),b.return=x,b)}function g(x,p,m,b){return p===null||p.tag!==4||p.stateNode.containerInfo!==m.containerInfo||p.stateNode.implementation!==m.implementation?(p=Ds(m,x.mode,b),p.return=x,p):(p=o(p,m.children||[]),p.return=x,p)}function S(x,p,m,b,h){return p===null||p.tag!==7?(p=bn(m,x.mode,b,h),p.return=x,p):(p=o(p,m),p.return=x,p)}function E(x,p,m){if(typeof p=="string"&&p!==""||typeof p=="number")return p=Ls(""+p,x.mode,m),p.return=x,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Zr:return m=ni(p.type,p.key,p.props,null,x.mode,m),m.ref=Ir(x,null,p),m.return=x,m;case On:return p=Ds(p,x.mode,m),p.return=x,p;case Ft:var b=p._init;return E(x,b(p._payload),m)}if(ir(p)||rr(p))return p=bn(p,x.mode,m,null),p.return=x,p;Mo(x,p)}return null}function y(x,p,m,b){var h=p!==null?p.key:null;if(typeof m=="string"&&m!==""||typeof m=="number")return h!==null?null:l(x,p,""+m,b);if(typeof m=="object"&&m!==null){switch(m.$$typeof){case Zr:return m.key===h?d(x,p,m,b):null;case On:return m.key===h?g(x,p,m,b):null;case Ft:return h=m._init,y(x,p,h(m._payload),b)}if(ir(m)||rr(m))return h!==null?null:S(x,p,m,b,null);Mo(x,m)}return null}function R(x,p,m,b,h){if(typeof b=="string"&&b!==""||typeof b=="number")return x=x.get(m)||null,l(p,x,""+b,h);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Zr:return x=x.get(b.key===null?m:b.key)||null,d(p,x,b,h);case On:return x=x.get(b.key===null?m:b.key)||null,g(p,x,b,h);case Ft:var c=b._init;return R(x,p,m,c(b._payload),h)}if(ir(b)||rr(b))return x=x.get(m)||null,S(p,x,b,h,null);Mo(p,b)}return null}function f(x,p,m,b){for(var h=null,c=null,u=p,s=p=0,w=null;u!==null&&s<m.length;s++){u.index>s?(w=u,u=null):w=u.sibling;var v=y(x,u,m[s],b);if(v===null){u===null&&(u=w);break}e&&u&&v.alternate===null&&t(x,u),p=i(v,p,s),c===null?h=v:c.sibling=v,c=v,u=w}if(s===m.length)return n(x,u),ve&&pn(x,s),h;if(u===null){for(;s<m.length;s++)u=E(x,m[s],b),u!==null&&(p=i(u,p,s),c===null?h=u:c.sibling=u,c=u);return ve&&pn(x,s),h}for(u=r(x,u);s<m.length;s++)w=R(u,x,s,m[s],b),w!==null&&(e&&w.alternate!==null&&u.delete(w.key===null?s:w.key),p=i(w,p,s),c===null?h=w:c.sibling=w,c=w);return e&&u.forEach(function(C){return t(x,C)}),ve&&pn(x,s),h}function k(x,p,m,b){var h=rr(m);if(typeof h!="function")throw Error(J(150));if(m=h.call(m),m==null)throw Error(J(151));for(var c=h=null,u=p,s=p=0,w=null,v=m.next();u!==null&&!v.done;s++,v=m.next()){u.index>s?(w=u,u=null):w=u.sibling;var C=y(x,u,v.value,b);if(C===null){u===null&&(u=w);break}e&&u&&C.alternate===null&&t(x,u),p=i(C,p,s),c===null?h=C:c.sibling=C,c=C,u=w}if(v.done)return n(x,u),ve&&pn(x,s),h;if(u===null){for(;!v.done;s++,v=m.next())v=E(x,v.value,b),v!==null&&(p=i(v,p,s),c===null?h=v:c.sibling=v,c=v);return ve&&pn(x,s),h}for(u=r(x,u);!v.done;s++,v=m.next())v=R(u,x,s,v.value,b),v!==null&&(e&&v.alternate!==null&&u.delete(v.key===null?s:v.key),p=i(v,p,s),c===null?h=v:c.sibling=v,c=v);return e&&u.forEach(function(L){return t(x,L)}),ve&&pn(x,s),h}function T(x,p,m,b){if(typeof m=="object"&&m!==null&&m.type===Tn&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Zr:e:{for(var h=m.key,c=p;c!==null;){if(c.key===h){if(h=m.type,h===Tn){if(c.tag===7){n(x,c.sibling),p=o(c,m.props.children),p.return=x,x=p;break e}}else if(c.elementType===h||typeof h=="object"&&h!==null&&h.$$typeof===Ft&&qu(h)===c.type){n(x,c.sibling),p=o(c,m.props),p.ref=Ir(x,c,m),p.return=x,x=p;break e}n(x,c);break}else t(x,c);c=c.sibling}m.type===Tn?(p=bn(m.props.children,x.mode,b,m.key),p.return=x,x=p):(b=ni(m.type,m.key,m.props,null,x.mode,b),b.ref=Ir(x,p,m),b.return=x,x=b)}return a(x);case On:e:{for(c=m.key;p!==null;){if(p.key===c)if(p.tag===4&&p.stateNode.containerInfo===m.containerInfo&&p.stateNode.implementation===m.implementation){n(x,p.sibling),p=o(p,m.children||[]),p.return=x,x=p;break e}else{n(x,p);break}else t(x,p);p=p.sibling}p=Ds(m,x.mode,b),p.return=x,x=p}return a(x);case Ft:return c=m._init,T(x,p,c(m._payload),b)}if(ir(m))return f(x,p,m,b);if(rr(m))return k(x,p,m,b);Mo(x,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,p!==null&&p.tag===6?(n(x,p.sibling),p=o(p,m),p.return=x,x=p):(n(x,p),p=Ls(m,x.mode,b),p.return=x,x=p),a(x)):n(x,p)}return T}var $n=ec(!0),tc=ec(!1),No=Xt(null),Lo=null,Vn=null,Wa=null;function $a(){Wa=Vn=Lo=null}function Va(e){var t=No.current;me(No),e._currentValue=t}function Qa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Qn(e,t){Lo=e,Wa=Vn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Je=!0),e.firstContext=null)}function lt(e){var t=e._currentValue;if(Wa!==e)if(e={context:e,memoizedValue:t,next:null},Vn===null){if(Lo===null)throw Error(J(308));Vn=e,Lo.dependencies={lanes:0,firstContext:e}}else Vn=Vn.next=e;return t}var gn=null;function Ka(e){gn===null?gn=[e]:gn.push(e)}function nc(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Ka(t)):(n.next=o.next,o.next=n),t.interleaved=n,Lt(e,r)}function Lt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var en=!1;function Ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Dt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function tn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ae&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Lt(e,n)}return o=r.interleaved,o===null?(t.next=t,Ka(r)):(t.next=o.next,o.next=t),r.interleaved=t,Lt(e,n)}function Do(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ua(e,n)}}function oc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function jo(e,t,n,r){var o=e.updateQueue;en=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var d=l,g=d.next;d.next=null,a===null?i=g:a.next=g,a=d;var S=e.alternate;S!==null&&(S=S.updateQueue,l=S.lastBaseUpdate,l!==a&&(l===null?S.firstBaseUpdate=g:l.next=g,S.lastBaseUpdate=d))}if(i!==null){var E=o.baseState;a=0,S=g=d=null,l=i;do{var y=l.lane,R=l.eventTime;if((r&y)===y){S!==null&&(S=S.next={eventTime:R,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var f=e,k=l;switch(y=t,R=n,k.tag){case 1:if(f=k.payload,typeof f=="function"){E=f.call(R,E,y);break e}E=f;break e;case 3:f.flags=f.flags&-65537|128;case 0:if(f=k.payload,y=typeof f=="function"?f.call(R,E,y):f,y==null)break e;E=we({},E,y);break e;case 2:en=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,y=o.effects,y===null?o.effects=[l]:y.push(l))}else R={eventTime:R,lane:y,tag:l.tag,payload:l.payload,callback:l.callback,next:null},S===null?(g=S=R,d=E):S=S.next=R,a|=y;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;y=l,l=y.next,y.next=null,o.lastBaseUpdate=y,o.shared.pending=null}}while(!0);if(S===null&&(d=E),o.baseState=d,o.firstBaseUpdate=g,o.lastBaseUpdate=S,t=o.shared.interleaved,t!==null){o=t;do a|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);yn|=a,e.lanes=a,e.memoizedState=E}}function ic(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(J(191,o));o.call(r)}}}var Pr={},Ct=Xt(Pr),Mr=Xt(Pr),Nr=Xt(Pr);function mn(e){if(e===Pr)throw Error(J(174));return e}function Ya(e,t){switch(he(Nr,t),he(Mr,e),he(Ct,Pr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Xi(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Xi(t,e)}me(Ct),he(Ct,t)}function Kn(){me(Ct),me(Mr),me(Nr)}function ac(e){mn(Nr.current);var t=mn(Ct.current),n=Xi(t,e.type);t!==n&&(he(Mr,e),he(Ct,n))}function Xa(e){Mr.current===e&&(me(Ct),me(Mr))}var xe=Xt(0);function Uo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Za=[];function qa(){for(var e=0;e<Za.length;e++)Za[e]._workInProgressVersionPrimary=null;Za.length=0}var Bo=At.ReactCurrentDispatcher,es=At.ReactCurrentBatchConfig,vn=0,Se=null,Oe=null,Ie=null,_o=!1,Lr=!1,Dr=0,qh=0;function Ue(){throw Error(J(321))}function ts(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ht(e[n],t[n]))return!1;return!0}function ns(e,t,n,r,o,i){if(vn=i,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Bo.current=e===null||e.memoizedState===null?rp:op,e=n(r,o),Lr){i=0;do{if(Lr=!1,Dr=0,25<=i)throw Error(J(301));i+=1,Ie=Oe=null,t.updateQueue=null,Bo.current=ip,e=n(r,o)}while(Lr)}if(Bo.current=Fo,t=Oe!==null&&Oe.next!==null,vn=0,Ie=Oe=Se=null,_o=!1,t)throw Error(J(300));return e}function rs(){var e=Dr!==0;return Dr=0,e}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ie===null?Se.memoizedState=Ie=e:Ie=Ie.next=e,Ie}function ut(){if(Oe===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Oe.next;var t=Ie===null?Se.memoizedState:Ie.next;if(t!==null)Ie=t,Oe=e;else{if(e===null)throw Error(J(310));Oe=e,e={memoizedState:Oe.memoizedState,baseState:Oe.baseState,baseQueue:Oe.baseQueue,queue:Oe.queue,next:null},Ie===null?Se.memoizedState=Ie=e:Ie=Ie.next=e}return Ie}function jr(e,t){return typeof t=="function"?t(e):t}function os(e){var t=ut(),n=t.queue;if(n===null)throw Error(J(311));n.lastRenderedReducer=e;var r=Oe,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var a=o.next;o.next=i.next,i.next=a}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var l=a=null,d=null,g=i;do{var S=g.lane;if((vn&S)===S)d!==null&&(d=d.next={lane:0,action:g.action,hasEagerState:g.hasEagerState,eagerState:g.eagerState,next:null}),r=g.hasEagerState?g.eagerState:e(r,g.action);else{var E={lane:S,action:g.action,hasEagerState:g.hasEagerState,eagerState:g.eagerState,next:null};d===null?(l=d=E,a=r):d=d.next=E,Se.lanes|=S,yn|=S}g=g.next}while(g!==null&&g!==i);d===null?a=r:d.next=l,ht(r,t.memoizedState)||(Je=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=d,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,Se.lanes|=i,yn|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function is(e){var t=ut(),n=t.queue;if(n===null)throw Error(J(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var a=o=o.next;do i=e(i,a.action),a=a.next;while(a!==o);ht(i,t.memoizedState)||(Je=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function sc(){}function lc(e,t){var n=Se,r=ut(),o=t(),i=!ht(r.memoizedState,o);if(i&&(r.memoizedState=o,Je=!0),r=r.queue,as(fc.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Ie!==null&&Ie.memoizedState.tag&1){if(n.flags|=2048,Ur(9,cc.bind(null,n,r,o,t),void 0,null),Pe===null)throw Error(J(349));vn&30||uc(n,t,o)}return o}function uc(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Se.updateQueue,t===null?(t={lastEffect:null,stores:null},Se.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function cc(e,t,n,r){t.value=n,t.getSnapshot=r,dc(t)&&hc(e)}function fc(e,t,n){return n(function(){dc(t)&&hc(e)})}function dc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ht(e,n)}catch(r){return!0}}function hc(e){var t=Lt(e,1);t!==null&&yt(t,e,1,-1)}function pc(e){var t=kt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:e},t.queue=e,e=e.dispatch=np.bind(null,Se,e),[t.memoizedState,e]}function Ur(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Se.updateQueue,t===null?(t={lastEffect:null,stores:null},Se.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function gc(){return ut().memoizedState}function zo(e,t,n,r){var o=kt();Se.flags|=e,o.memoizedState=Ur(1|t,n,void 0,r===void 0?null:r)}function Ho(e,t,n,r){var o=ut();r=r===void 0?null:r;var i=void 0;if(Oe!==null){var a=Oe.memoizedState;if(i=a.destroy,r!==null&&ts(r,a.deps)){o.memoizedState=Ur(t,n,i,r);return}}Se.flags|=e,o.memoizedState=Ur(1|t,n,i,r)}function mc(e,t){return zo(8390656,8,e,t)}function as(e,t){return Ho(2048,8,e,t)}function vc(e,t){return Ho(4,2,e,t)}function yc(e,t){return Ho(4,4,e,t)}function wc(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function xc(e,t,n){return n=n!=null?n.concat([e]):null,Ho(4,4,wc.bind(null,t,e),n)}function ss(){}function Sc(e,t){var n=ut();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ts(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bc(e,t){var n=ut();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ts(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Cc(e,t,n){return vn&21?(ht(n,t)||(n=ql(),Se.lanes|=n,yn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Je=!0),e.memoizedState=n)}function ep(e,t){var n=ue;ue=n!==0&&4>n?n:4,e(!0);var r=es.transition;es.transition={};try{e(!1),t()}finally{ue=n,es.transition=r}}function kc(){return ut().memoizedState}function tp(e,t,n){var r=an(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Rc(e))Ec(t,n);else if(n=nc(e,t,n,r),n!==null){var o=Ge();yt(n,e,r,o),Oc(n,t,r)}}function np(e,t,n){var r=an(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rc(e))Ec(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,l=i(a,n);if(o.hasEagerState=!0,o.eagerState=l,ht(l,a)){var d=t.interleaved;d===null?(o.next=o,Ka(t)):(o.next=d.next,d.next=o),t.interleaved=o;return}}catch(g){}finally{}n=nc(e,t,o,r),n!==null&&(o=Ge(),yt(n,e,r,o),Oc(n,t,r))}}function Rc(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Ec(e,t){Lr=_o=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Oc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ua(e,n)}}var Fo={readContext:lt,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useInsertionEffect:Ue,useLayoutEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useMutableSource:Ue,useSyncExternalStore:Ue,useId:Ue,unstable_isNewReconciler:!1},rp={readContext:lt,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:lt,useEffect:mc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,zo(4194308,4,wc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return zo(4194308,4,e,t)},useInsertionEffect:function(e,t){return zo(4,2,e,t)},useMemo:function(e,t){var n=kt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=kt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=tp.bind(null,Se,e),[r.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:pc,useDebugValue:ss,useDeferredValue:function(e){return kt().memoizedState=e},useTransition:function(){var e=pc(!1),t=e[0];return e=ep.bind(null,e[1]),kt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Se,o=kt();if(ve){if(n===void 0)throw Error(J(407));n=n()}else{if(n=t(),Pe===null)throw Error(J(349));vn&30||uc(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,mc(fc.bind(null,r,i,e),[e]),r.flags|=2048,Ur(9,cc.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=kt(),t=Pe.identifierPrefix;if(ve){var n=Nt,r=Mt;n=(r&~(1<<32-dt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Dr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=qh++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},op={readContext:lt,useCallback:Sc,useContext:lt,useEffect:as,useImperativeHandle:xc,useInsertionEffect:vc,useLayoutEffect:yc,useMemo:bc,useReducer:os,useRef:gc,useState:function(){return os(jr)},useDebugValue:ss,useDeferredValue:function(e){var t=ut();return Cc(t,Oe.memoizedState,e)},useTransition:function(){var e=os(jr)[0],t=ut().memoizedState;return[e,t]},useMutableSource:sc,useSyncExternalStore:lc,useId:kc,unstable_isNewReconciler:!1},ip={readContext:lt,useCallback:Sc,useContext:lt,useEffect:as,useImperativeHandle:xc,useInsertionEffect:vc,useLayoutEffect:yc,useMemo:bc,useReducer:is,useRef:gc,useState:function(){return is(jr)},useDebugValue:ss,useDeferredValue:function(e){var t=ut();return Oe===null?t.memoizedState=e:Cc(t,Oe.memoizedState,e)},useTransition:function(){var e=is(jr)[0],t=ut().memoizedState;return[e,t]},useMutableSource:sc,useSyncExternalStore:lc,useId:kc,unstable_isNewReconciler:!1};function gt(e,t){if(e&&e.defaultProps){t=we({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function ls(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:we({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Go={isMounted:function(e){return(e=e._reactInternals)?cn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ge(),o=an(e),i=Dt(r,o);i.payload=t,n!=null&&(i.callback=n),t=tn(e,i,o),t!==null&&(yt(t,e,o,r),Do(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ge(),o=an(e),i=Dt(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=tn(e,i,o),t!==null&&(yt(t,e,o,r),Do(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ge(),r=an(e),o=Dt(n,r);o.tag=2,t!=null&&(o.callback=t),t=tn(e,o,r),t!==null&&(yt(t,e,r,n),Do(t,e,r))}};function Tc(e,t,n,r,o,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!Cr(n,r)||!Cr(o,i):!0}function Ac(e,t,n){var r=!1,o=Zt,i=t.contextType;return typeof i=="object"&&i!==null?i=lt(i):(o=Ke(t)?dn:je.current,r=t.contextTypes,i=(r=r!=null)?Hn(e,o):Zt),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Go,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function Ic(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Go.enqueueReplaceState(t,t.state,null)}function us(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Ja(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=lt(i):(i=Ke(t)?dn:je.current,o.context=Hn(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(ls(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Go.enqueueReplaceState(o,o.state,null),jo(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Jn(e,t){try{var n="",r=t;do n+=Nd(r),r=r.return;while(r);var o=n}catch(i){o=`
31
+ Error generating stack: `+i.message+`
32
+ `+i.stack}return{value:e,source:t,stack:o,digest:null}}function cs(e,t,n){return{value:e,source:null,stack:n!=null?n:null,digest:t!=null?t:null}}function fs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ap=typeof WeakMap=="function"?WeakMap:Map;function Pc(e,t,n){n=Dt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Yo||(Yo=!0,Es=r),fs(e,t)},n}function Mc(e,t,n){n=Dt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){fs(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){fs(e,t),typeof r!="function"&&(rn===null?rn=new Set([this]):rn.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Nc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ap;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=xp.bind(null,e,t,n),t.then(e,e))}function Lc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Dc(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Dt(-1,1),t.tag=2,tn(n,t,1))),n.lanes|=1),e)}var sp=At.ReactCurrentOwner,Je=!1;function Fe(e,t,n,r){t.child=e===null?tc(t,null,n,r):$n(t,e.child,n,r)}function jc(e,t,n,r,o){n=n.render;var i=t.ref;return Qn(t,o),r=ns(e,t,n,r,i,o),n=rs(),e!==null&&!Je?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,jt(e,t,o)):(ve&&n&&_a(t),t.flags|=1,Fe(e,t,r,o),t.child)}function Uc(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!Ns(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Bc(e,t,i,r,o)):(e=ni(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:Cr,n(a,r)&&e.ref===t.ref)return jt(e,t,o)}return t.flags|=1,e=ln(i,r),e.ref=t.ref,e.return=t,t.child=e}function Bc(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Cr(i,r)&&e.ref===t.ref)if(Je=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Je=!0);else return t.lanes=e.lanes,jt(e,t,o)}return ds(e,t,n,r,o)}function _c(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},he(Xn,ot),ot|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,he(Xn,ot),ot|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,he(Xn,ot),ot|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,he(Xn,ot),ot|=r;return Fe(e,t,o,n),t.child}function zc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ds(e,t,n,r,o){var i=Ke(n)?dn:je.current;return i=Hn(t,i),Qn(t,o),n=ns(e,t,n,r,i,o),r=rs(),e!==null&&!Je?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,jt(e,t,o)):(ve&&r&&_a(t),t.flags|=1,Fe(e,t,n,o),t.child)}function Hc(e,t,n,r,o){if(Ke(n)){var i=!0;Oo(t)}else i=!1;if(Qn(t,o),t.stateNode===null)$o(e,t),Ac(t,n,r),us(t,n,r,o),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var d=a.context,g=n.contextType;typeof g=="object"&&g!==null?g=lt(g):(g=Ke(n)?dn:je.current,g=Hn(t,g));var S=n.getDerivedStateFromProps,E=typeof S=="function"||typeof a.getSnapshotBeforeUpdate=="function";E||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||d!==g)&&Ic(t,a,r,g),en=!1;var y=t.memoizedState;a.state=y,jo(t,r,a,o),d=t.memoizedState,l!==r||y!==d||Qe.current||en?(typeof S=="function"&&(ls(t,n,S,r),d=t.memoizedState),(l=en||Tc(t,n,l,r,y,d,g))?(E||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=d),a.props=r,a.state=d,a.context=g,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,rc(e,t),l=t.memoizedProps,g=t.type===t.elementType?l:gt(t.type,l),a.props=g,E=t.pendingProps,y=a.context,d=n.contextType,typeof d=="object"&&d!==null?d=lt(d):(d=Ke(n)?dn:je.current,d=Hn(t,d));var R=n.getDerivedStateFromProps;(S=typeof R=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==E||y!==d)&&Ic(t,a,r,d),en=!1,y=t.memoizedState,a.state=y,jo(t,r,a,o);var f=t.memoizedState;l!==E||y!==f||Qe.current||en?(typeof R=="function"&&(ls(t,n,R,r),f=t.memoizedState),(g=en||Tc(t,n,g,r,y,f,d)||!1)?(S||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,f,d),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,f,d)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),a.props=r,a.state=f,a.context=d,r=g):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),r=!1)}return hs(e,t,n,r,i,o)}function hs(e,t,n,r,o,i){zc(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return o&&Vu(t,n,!1),jt(e,t,i);r=t.stateNode,sp.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=$n(t,e.child,null,i),t.child=$n(t,null,l,i)):Fe(e,t,l,i),t.memoizedState=r.state,o&&Vu(t,n,!0),t.child}function Fc(e){var t=e.stateNode;t.pendingContext?Wu(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Wu(e,t.context,!1),Ya(e,t.containerInfo)}function Gc(e,t,n,r,o){return Wn(),Ga(o),t.flags|=256,Fe(e,t,n,r),t.child}var ps={dehydrated:null,treeContext:null,retryLane:0};function gs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Wc(e,t,n){var r=t.pendingProps,o=xe.current,i=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),he(xe,o&1),e===null)return Fa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=ri(a,r,0,null),e=bn(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=gs(n),t.memoizedState=ps,e):ms(t,a));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return lp(e,t,a,r,l,o,n);if(i){i=r.fallback,a=t.mode,o=e.child,l=o.sibling;var d={mode:"hidden",children:r.children};return!(a&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=d,t.deletions=null):(r=ln(o,d),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?i=ln(l,i):(i=bn(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?gs(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=ps,r}return i=e.child,e=i.sibling,r=ln(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ms(e,t){return t=ri({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Wo(e,t,n,r){return r!==null&&Ga(r),$n(t,e.child,null,n),e=ms(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function lp(e,t,n,r,o,i,a){if(n)return t.flags&256?(t.flags&=-257,r=cs(Error(J(422))),Wo(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=ri({mode:"visible",children:r.children},o,0,null),i=bn(i,o,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&$n(t,e.child,null,a),t.child.memoizedState=gs(a),t.memoizedState=ps,i);if(!(t.mode&1))return Wo(e,t,a,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(J(419)),r=cs(i,r,void 0),Wo(e,t,a,r)}if(l=(a&e.childLanes)!==0,Je||l){if(r=Pe,r!==null){switch(a&-a){case 4:o=2;break;case 16:o=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:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|a)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Lt(e,o),yt(r,e,o,-1))}return Ms(),r=cs(Error(J(421))),Wo(e,t,a,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=Sp.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,rt=Yt(o.nextSibling),nt=t,ve=!0,pt=null,e!==null&&(at[st++]=Mt,at[st++]=Nt,at[st++]=hn,Mt=e.id,Nt=e.overflow,hn=t),t=ms(t,r.children),t.flags|=4096,t)}function $c(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Qa(e.return,t,n)}function vs(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function Vc(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Fe(e,t,r.children,n),r=xe.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&$c(e,n,t);else if(e.tag===19)$c(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(he(xe,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Uo(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),vs(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Uo(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}vs(t,!0,n,null,i);break;case"together":vs(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function $o(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function jt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),yn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(J(153));if(t.child!==null){for(e=t.child,n=ln(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ln(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function up(e,t,n){switch(t.tag){case 3:Fc(t),Wn();break;case 5:ac(t);break;case 1:Ke(t.type)&&Oo(t);break;case 4:Ya(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;he(No,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(he(xe,xe.current&1),t.flags|=128,null):n&t.child.childLanes?Wc(e,t,n):(he(xe,xe.current&1),e=jt(e,t,n),e!==null?e.sibling:null);he(xe,xe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Vc(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),he(xe,xe.current),r)break;return null;case 22:case 23:return t.lanes=0,_c(e,t,n)}return jt(e,t,n)}var Qc,ys,Kc,Jc;Qc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ys=function(){},Kc=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,mn(Ct.current);var i=null;switch(n){case"input":o=Qi(e,o),r=Qi(e,r),i=[];break;case"select":o=we({},o,{value:void 0}),r=we({},r,{value:void 0}),i=[];break;case"textarea":o=Yi(e,o),r=Yi(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ko)}Zi(n,r);var a;n=null;for(g in o)if(!r.hasOwnProperty(g)&&o.hasOwnProperty(g)&&o[g]!=null)if(g==="style"){var l=o[g];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else g!=="dangerouslySetInnerHTML"&&g!=="children"&&g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(nr.hasOwnProperty(g)?i||(i=[]):(i=i||[]).push(g,null));for(g in r){var d=r[g];if(l=o!=null?o[g]:void 0,r.hasOwnProperty(g)&&d!==l&&(d!=null||l!=null))if(g==="style")if(l){for(a in l)!l.hasOwnProperty(a)||d&&d.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in d)d.hasOwnProperty(a)&&l[a]!==d[a]&&(n||(n={}),n[a]=d[a])}else n||(i||(i=[]),i.push(g,n)),n=d;else g==="dangerouslySetInnerHTML"?(d=d?d.__html:void 0,l=l?l.__html:void 0,d!=null&&l!==d&&(i=i||[]).push(g,d)):g==="children"?typeof d!="string"&&typeof d!="number"||(i=i||[]).push(g,""+d):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&(nr.hasOwnProperty(g)?(d!=null&&g==="onScroll"&&ge("scroll",e),i||l===d||(i=[])):(i=i||[]).push(g,d))}n&&(i=i||[]).push("style",n);var g=i;(t.updateQueue=g)&&(t.flags|=4)}},Jc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Br(e,t){if(!ve)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Be(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function cp(e,t,n){var r=t.pendingProps;switch(za(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Be(t),null;case 1:return Ke(t.type)&&Eo(),Be(t),null;case 3:return r=t.stateNode,Kn(),me(Qe),me(je),qa(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Po(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pt!==null&&(As(pt),pt=null))),ys(e,t),Be(t),null;case 5:Xa(t);var o=mn(Nr.current);if(n=t.type,e!==null&&t.stateNode!=null)Kc(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(J(166));return Be(t),null}if(e=mn(Ct.current),Po(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[bt]=t,r[Tr]=i,e=(t.mode&1)!==0,n){case"dialog":ge("cancel",r),ge("close",r);break;case"iframe":case"object":case"embed":ge("load",r);break;case"video":case"audio":for(o=0;o<Rr.length;o++)ge(Rr[o],r);break;case"source":ge("error",r);break;case"img":case"image":case"link":ge("error",r),ge("load",r);break;case"details":ge("toggle",r);break;case"input":Al(r,i),ge("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ge("invalid",r);break;case"textarea":Ml(r,i),ge("invalid",r)}Zi(n,i),o=null;for(var a in i)if(i.hasOwnProperty(a)){var l=i[a];a==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Co(r.textContent,l,e),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Co(r.textContent,l,e),o=["children",""+l]):nr.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&ge("scroll",r)}switch(n){case"input":qr(r),Pl(r,i,!0);break;case"textarea":qr(r),Ll(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=ko)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{a=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Dl(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[bt]=t,e[Tr]=r,Qc(e,t,!1,!1),t.stateNode=e;e:{switch(a=qi(n,r),n){case"dialog":ge("cancel",e),ge("close",e),o=r;break;case"iframe":case"object":case"embed":ge("load",e),o=r;break;case"video":case"audio":for(o=0;o<Rr.length;o++)ge(Rr[o],e);o=r;break;case"source":ge("error",e),o=r;break;case"img":case"image":case"link":ge("error",e),ge("load",e),o=r;break;case"details":ge("toggle",e),o=r;break;case"input":Al(e,r),o=Qi(e,r),ge("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=we({},r,{value:void 0}),ge("invalid",e);break;case"textarea":Ml(e,r),o=Yi(e,r),ge("invalid",e);break;default:o=r}Zi(n,o),l=o;for(i in l)if(l.hasOwnProperty(i)){var d=l[i];i==="style"?Bl(e,d):i==="dangerouslySetInnerHTML"?(d=d?d.__html:void 0,d!=null&&jl(e,d)):i==="children"?typeof d=="string"?(n!=="textarea"||d!=="")&&ar(e,d):typeof d=="number"&&ar(e,""+d):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(nr.hasOwnProperty(i)?d!=null&&i==="onScroll"&&ge("scroll",e):d!=null&&ji(e,i,d,a))}switch(n){case"input":qr(e),Pl(e,r,!1);break;case"textarea":qr(e),Ll(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Gt(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?An(e,!!r.multiple,i,!1):r.defaultValue!=null&&An(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=ko)}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&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Be(t),null;case 6:if(e&&t.stateNode!=null)Jc(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(J(166));if(n=mn(Nr.current),mn(Ct.current),Po(t)){if(r=t.stateNode,n=t.memoizedProps,r[bt]=t,(i=r.nodeValue!==n)&&(e=nt,e!==null))switch(e.tag){case 3:Co(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Co(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[bt]=t,t.stateNode=r}return Be(t),null;case 13:if(me(xe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ve&&rt!==null&&t.mode&1&&!(t.flags&128))Zu(),Wn(),t.flags|=98560,i=!1;else if(i=Po(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(J(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(J(317));i[bt]=t}else Wn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Be(t),i=!1}else pt!==null&&(As(pt),pt=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||xe.current&1?Te===0&&(Te=3):Ms())),t.updateQueue!==null&&(t.flags|=4),Be(t),null);case 4:return Kn(),ys(e,t),e===null&&Er(t.stateNode.containerInfo),Be(t),null;case 10:return Va(t.type._context),Be(t),null;case 17:return Ke(t.type)&&Eo(),Be(t),null;case 19:if(me(xe),i=t.memoizedState,i===null)return Be(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)Br(i,!1);else{if(Te!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Uo(e),a!==null){for(t.flags|=128,Br(i,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return he(xe,xe.current&1|2),t.child}e=e.sibling}i.tail!==null&&ke()>Zn&&(t.flags|=128,r=!0,Br(i,!1),t.lanes=4194304)}else{if(!r)if(e=Uo(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Br(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!ve)return Be(t),null}else 2*ke()-i.renderingStartTime>Zn&&n!==1073741824&&(t.flags|=128,r=!0,Br(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ke(),t.sibling=null,n=xe.current,he(xe,r?n&1|2:n&1),t):(Be(t),null);case 22:case 23:return Ps(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ot&1073741824&&(Be(t),t.subtreeFlags&6&&(t.flags|=8192)):Be(t),null;case 24:return null;case 25:return null}throw Error(J(156,t.tag))}function fp(e,t){switch(za(t),t.tag){case 1:return Ke(t.type)&&Eo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Kn(),me(Qe),me(je),qa(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xa(t),null;case 13:if(me(xe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(J(340));Wn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return me(xe),null;case 4:return Kn(),null;case 10:return Va(t.type._context),null;case 22:case 23:return Ps(),null;case 24:return null;default:return null}}var Vo=!1,_e=!1,dp=typeof WeakSet=="function"?WeakSet:Set,q=null;function Yn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){be(e,t,r)}else n.current=null}function ws(e,t,n){try{n()}catch(r){be(e,t,r)}}var Yc=!1;function hp(e,t){if(Pa=fo,e=Tu(),Ca(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch(b){n=null;break e}var a=0,l=-1,d=-1,g=0,S=0,E=e,y=null;t:for(;;){for(var R;E!==n||o!==0&&E.nodeType!==3||(l=a+o),E!==i||r!==0&&E.nodeType!==3||(d=a+r),E.nodeType===3&&(a+=E.nodeValue.length),(R=E.firstChild)!==null;)y=E,E=R;for(;;){if(E===e)break t;if(y===n&&++g===o&&(l=a),y===i&&++S===r&&(d=a),(R=E.nextSibling)!==null)break;E=y,y=E.parentNode}E=R}n=l===-1||d===-1?null:{start:l,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ma={focusedElem:e,selectionRange:n},fo=!1,q=t;q!==null;)if(t=q,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;try{var f=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(f!==null){var k=f.memoizedProps,T=f.memoizedState,x=t.stateNode,p=x.getSnapshotBeforeUpdate(t.elementType===t.type?k:gt(t.type,k),T);x.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(b){be(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return f=Yc,Yc=!1,f}function _r(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&ws(t,n,i)}o=o.next}while(o!==r)}}function Qo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function xs(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Xc(e){var t=e.alternate;t!==null&&(e.alternate=null,Xc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[bt],delete t[Tr],delete t[ja],delete t[Jh],delete t[Yh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Zc(e){return e.tag===5||e.tag===3||e.tag===4}function qc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ss(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ko));else if(r!==4&&(e=e.child,e!==null))for(Ss(e,t,n),e=e.sibling;e!==null;)Ss(e,t,n),e=e.sibling}function bs(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(bs(e,t,n),e=e.sibling;e!==null;)bs(e,t,n),e=e.sibling}var Ne=null,mt=!1;function nn(e,t,n){for(n=n.child;n!==null;)ef(e,t,n),n=n.sibling}function ef(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(io,n)}catch(l){}switch(n.tag){case 5:_e||Yn(n,t);case 6:var r=Ne,o=mt;Ne=null,nn(e,t,n),Ne=r,mt=o,Ne!==null&&(mt?(e=Ne,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ne.removeChild(n.stateNode));break;case 18:Ne!==null&&(mt?(e=Ne,n=n.stateNode,e.nodeType===8?Da(e.parentNode,n):e.nodeType===1&&Da(e,n),vr(e)):Da(Ne,n.stateNode));break;case 4:r=Ne,o=mt,Ne=n.stateNode.containerInfo,mt=!0,nn(e,t,n),Ne=r,mt=o;break;case 0:case 11:case 14:case 15:if(!_e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&ws(n,t,a),o=o.next}while(o!==r)}nn(e,t,n);break;case 1:if(!_e&&(Yn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){be(n,t,l)}nn(e,t,n);break;case 21:nn(e,t,n);break;case 22:n.mode&1?(_e=(r=_e)||n.memoizedState!==null,nn(e,t,n),_e=r):nn(e,t,n);break;default:nn(e,t,n)}}function tf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new dp),t.forEach(function(r){var o=bp.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function vt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:Ne=l.stateNode,mt=!1;break e;case 3:Ne=l.stateNode.containerInfo,mt=!0;break e;case 4:Ne=l.stateNode.containerInfo,mt=!0;break e}l=l.return}if(Ne===null)throw Error(J(160));ef(i,a,o),Ne=null,mt=!1;var d=o.alternate;d!==null&&(d.return=null),o.return=null}catch(g){be(o,t,g)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)nf(t,e),t=t.sibling}function nf(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(vt(t,e),Rt(e),r&4){try{_r(3,e,e.return),Qo(3,e)}catch(k){be(e,e.return,k)}try{_r(5,e,e.return)}catch(k){be(e,e.return,k)}}break;case 1:vt(t,e),Rt(e),r&512&&n!==null&&Yn(n,n.return);break;case 5:if(vt(t,e),Rt(e),r&512&&n!==null&&Yn(n,n.return),e.flags&32){var o=e.stateNode;try{ar(o,"")}catch(k){be(e,e.return,k)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,l=e.type,d=e.updateQueue;if(e.updateQueue=null,d!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&Il(o,i),qi(l,a);var g=qi(l,i);for(a=0;a<d.length;a+=2){var S=d[a],E=d[a+1];S==="style"?Bl(o,E):S==="dangerouslySetInnerHTML"?jl(o,E):S==="children"?ar(o,E):ji(o,S,E,g)}switch(l){case"input":Ki(o,i);break;case"textarea":Nl(o,i);break;case"select":var y=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var R=i.value;R!=null?An(o,!!i.multiple,R,!1):y!==!!i.multiple&&(i.defaultValue!=null?An(o,!!i.multiple,i.defaultValue,!0):An(o,!!i.multiple,i.multiple?[]:"",!1))}o[Tr]=i}catch(k){be(e,e.return,k)}}break;case 6:if(vt(t,e),Rt(e),r&4){if(e.stateNode===null)throw Error(J(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(k){be(e,e.return,k)}}break;case 3:if(vt(t,e),Rt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{vr(t.containerInfo)}catch(k){be(e,e.return,k)}break;case 4:vt(t,e),Rt(e);break;case 13:vt(t,e),Rt(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(Rs=ke())),r&4&&tf(e);break;case 22:if(S=n!==null&&n.memoizedState!==null,e.mode&1?(_e=(g=_e)||S,vt(t,e),_e=g):vt(t,e),Rt(e),r&8192){if(g=e.memoizedState!==null,(e.stateNode.isHidden=g)&&!S&&e.mode&1)for(q=e,S=e.child;S!==null;){for(E=q=S;q!==null;){switch(y=q,R=y.child,y.tag){case 0:case 11:case 14:case 15:_r(4,y,y.return);break;case 1:Yn(y,y.return);var f=y.stateNode;if(typeof f.componentWillUnmount=="function"){r=y,n=y.return;try{t=r,f.props=t.memoizedProps,f.state=t.memoizedState,f.componentWillUnmount()}catch(k){be(r,n,k)}}break;case 5:Yn(y,y.return);break;case 22:if(y.memoizedState!==null){af(E);continue}}R!==null?(R.return=y,q=R):af(E)}S=S.sibling}e:for(S=null,E=e;;){if(E.tag===5){if(S===null){S=E;try{o=E.stateNode,g?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=E.stateNode,d=E.memoizedProps.style,a=d!=null&&d.hasOwnProperty("display")?d.display:null,l.style.display=Ul("display",a))}catch(k){be(e,e.return,k)}}}else if(E.tag===6){if(S===null)try{E.stateNode.nodeValue=g?"":E.memoizedProps}catch(k){be(e,e.return,k)}}else if((E.tag!==22&&E.tag!==23||E.memoizedState===null||E===e)&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===e)break e;for(;E.sibling===null;){if(E.return===null||E.return===e)break e;S===E&&(S=null),E=E.return}S===E&&(S=null),E.sibling.return=E.return,E=E.sibling}}break;case 19:vt(t,e),Rt(e),r&4&&tf(e);break;case 21:break;default:vt(t,e),Rt(e)}}function Rt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Zc(n)){var r=n;break e}n=n.return}throw Error(J(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(ar(o,""),r.flags&=-33);var i=qc(e);bs(e,i,o);break;case 3:case 4:var a=r.stateNode.containerInfo,l=qc(e);Ss(e,l,a);break;default:throw Error(J(161))}}catch(d){be(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pp(e,t,n){q=e,rf(e)}function rf(e,t,n){for(var r=(e.mode&1)!==0;q!==null;){var o=q,i=o.child;if(o.tag===22&&r){var a=o.memoizedState!==null||Vo;if(!a){var l=o.alternate,d=l!==null&&l.memoizedState!==null||_e;l=Vo;var g=_e;if(Vo=a,(_e=d)&&!g)for(q=o;q!==null;)a=q,d=a.child,a.tag===22&&a.memoizedState!==null?sf(o):d!==null?(d.return=a,q=d):sf(o);for(;i!==null;)q=i,rf(i),i=i.sibling;q=o,Vo=l,_e=g}of(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,q=i):of(e)}}function of(e){for(;q!==null;){var t=q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:_e||Qo(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!_e)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:gt(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&ic(t,i,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ic(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var d=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":d.autoFocus&&n.focus();break;case"img":d.src&&(n.src=d.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var g=t.alternate;if(g!==null){var S=g.memoizedState;if(S!==null){var E=S.dehydrated;E!==null&&vr(E)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(J(163))}_e||t.flags&512&&xs(t)}catch(y){be(t,t.return,y)}}if(t===e){q=null;break}if(n=t.sibling,n!==null){n.return=t.return,q=n;break}q=t.return}}function af(e){for(;q!==null;){var t=q;if(t===e){q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,q=n;break}q=t.return}}function sf(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Qo(4,t)}catch(d){be(t,n,d)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(d){be(t,o,d)}}var i=t.return;try{xs(t)}catch(d){be(t,i,d)}break;case 5:var a=t.return;try{xs(t)}catch(d){be(t,a,d)}}}catch(d){be(t,t.return,d)}if(t===e){q=null;break}var l=t.sibling;if(l!==null){l.return=t.return,q=l;break}q=t.return}}var gp=Math.ceil,Ko=At.ReactCurrentDispatcher,Cs=At.ReactCurrentOwner,ct=At.ReactCurrentBatchConfig,ae=0,Pe=null,Ee=null,Le=0,ot=0,Xn=Xt(0),Te=0,zr=null,yn=0,Jo=0,ks=0,Hr=null,Ye=null,Rs=0,Zn=1/0,Ut=null,Yo=!1,Es=null,rn=null,Xo=!1,on=null,Zo=0,Fr=0,Os=null,qo=-1,ei=0;function Ge(){return ae&6?ke():qo!==-1?qo:qo=ke()}function an(e){return e.mode&1?ae&2&&Le!==0?Le&-Le:Zh.transition!==null?(ei===0&&(ei=ql()),ei):(e=ue,e!==0||(e=window.event,e=e===void 0?16:lu(e.type)),e):1}function yt(e,t,n,r){if(50<Fr)throw Fr=0,Os=null,Error(J(185));dr(e,n,r),(!(ae&2)||e!==Pe)&&(e===Pe&&(!(ae&2)&&(Jo|=n),Te===4&&sn(e,Le)),Xe(e,r),n===1&&ae===0&&!(t.mode&1)&&(Zn=ke()+500,To&&qt()))}function Xe(e,t){var n=e.callbackNode;Zd(e,t);var r=lo(e,e===Pe?Le:0);if(r===0)n!==null&&Yl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Yl(n),t===1)e.tag===0?Xh(uf.bind(null,e)):Qu(uf.bind(null,e)),Qh(function(){!(ae&6)&&qt()}),n=null;else{switch(eu(r)){case 1:n=aa;break;case 4:n=Xl;break;case 16:n=oo;break;case 536870912:n=Zl;break;default:n=oo}n=vf(n,lf.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function lf(e,t){if(qo=-1,ei=0,ae&6)throw Error(J(327));var n=e.callbackNode;if(qn()&&e.callbackNode!==n)return null;var r=lo(e,e===Pe?Le:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ti(e,r);else{t=r;var o=ae;ae|=2;var i=ff();(Pe!==e||Le!==t)&&(Ut=null,Zn=ke()+500,xn(e,t));do try{yp();break}catch(l){cf(e,l)}while(!0);$a(),Ko.current=i,ae=o,Ee!==null?t=0:(Pe=null,Le=0,t=Te)}if(t!==0){if(t===2&&(o=sa(e),o!==0&&(r=o,t=Ts(e,o))),t===1)throw n=zr,xn(e,0),sn(e,r),Xe(e,ke()),n;if(t===6)sn(e,r);else{if(o=e.current.alternate,!(r&30)&&!mp(o)&&(t=ti(e,r),t===2&&(i=sa(e),i!==0&&(r=i,t=Ts(e,i))),t===1))throw n=zr,xn(e,0),sn(e,r),Xe(e,ke()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(J(345));case 2:Sn(e,Ye,Ut);break;case 3:if(sn(e,r),(r&130023424)===r&&(t=Rs+500-ke(),10<t)){if(lo(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Ge(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=La(Sn.bind(null,e,Ye,Ut),t);break}Sn(e,Ye,Ut);break;case 4:if(sn(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var a=31-dt(r);i=1<<a,a=t[a],a>o&&(o=a),r&=~i}if(r=o,r=ke()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*gp(r/1960))-r,10<r){e.timeoutHandle=La(Sn.bind(null,e,Ye,Ut),r);break}Sn(e,Ye,Ut);break;case 5:Sn(e,Ye,Ut);break;default:throw Error(J(329))}}}return Xe(e,ke()),e.callbackNode===n?lf.bind(null,e):null}function Ts(e,t){var n=Hr;return e.current.memoizedState.isDehydrated&&(xn(e,t).flags|=256),e=ti(e,t),e!==2&&(t=Ye,Ye=n,t!==null&&As(t)),e}function As(e){Ye===null?Ye=e:Ye.push.apply(Ye,e)}function mp(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!ht(i(),o))return!1}catch(a){return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function sn(e,t){for(t&=~ks,t&=~Jo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-dt(t),r=1<<n;e[n]=-1,t&=~r}}function uf(e){if(ae&6)throw Error(J(327));qn();var t=lo(e,0);if(!(t&1))return Xe(e,ke()),null;var n=ti(e,t);if(e.tag!==0&&n===2){var r=sa(e);r!==0&&(t=r,n=Ts(e,r))}if(n===1)throw n=zr,xn(e,0),sn(e,t),Xe(e,ke()),n;if(n===6)throw Error(J(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Sn(e,Ye,Ut),Xe(e,ke()),null}function Is(e,t){var n=ae;ae|=1;try{return e(t)}finally{ae=n,ae===0&&(Zn=ke()+500,To&&qt())}}function wn(e){on!==null&&on.tag===0&&!(ae&6)&&qn();var t=ae;ae|=1;var n=ct.transition,r=ue;try{if(ct.transition=null,ue=1,e)return e()}finally{ue=r,ct.transition=n,ae=t,!(ae&6)&&qt()}}function Ps(){ot=Xn.current,me(Xn)}function xn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Vh(n)),Ee!==null)for(n=Ee.return;n!==null;){var r=n;switch(za(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Eo();break;case 3:Kn(),me(Qe),me(je),qa();break;case 5:Xa(r);break;case 4:Kn();break;case 13:me(xe);break;case 19:me(xe);break;case 10:Va(r.type._context);break;case 22:case 23:Ps()}n=n.return}if(Pe=e,Ee=e=ln(e.current,null),Le=ot=t,Te=0,zr=null,ks=Jo=yn=0,Ye=Hr=null,gn!==null){for(t=0;t<gn.length;t++)if(n=gn[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var a=i.next;i.next=o,r.next=a}n.pending=r}gn=null}return e}function cf(e,t){do{var n=Ee;try{if($a(),Bo.current=Fo,_o){for(var r=Se.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}_o=!1}if(vn=0,Ie=Oe=Se=null,Lr=!1,Dr=0,Cs.current=null,n===null||n.return===null){Te=1,zr=t,Ee=null;break}e:{var i=e,a=n.return,l=n,d=t;if(t=Le,l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){var g=d,S=l,E=S.tag;if(!(S.mode&1)&&(E===0||E===11||E===15)){var y=S.alternate;y?(S.updateQueue=y.updateQueue,S.memoizedState=y.memoizedState,S.lanes=y.lanes):(S.updateQueue=null,S.memoizedState=null)}var R=Lc(a);if(R!==null){R.flags&=-257,Dc(R,a,l,i,t),R.mode&1&&Nc(i,g,t),t=R,d=g;var f=t.updateQueue;if(f===null){var k=new Set;k.add(d),t.updateQueue=k}else f.add(d);break e}else{if(!(t&1)){Nc(i,g,t),Ms();break e}d=Error(J(426))}}else if(ve&&l.mode&1){var T=Lc(a);if(T!==null){!(T.flags&65536)&&(T.flags|=256),Dc(T,a,l,i,t),Ga(Jn(d,l));break e}}i=d=Jn(d,l),Te!==4&&(Te=2),Hr===null?Hr=[i]:Hr.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=Pc(i,d,t);oc(i,x);break e;case 1:l=d;var p=i.type,m=i.stateNode;if(!(i.flags&128)&&(typeof p.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(rn===null||!rn.has(m)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=Mc(i,l,t);oc(i,b);break e}}i=i.return}while(i!==null)}hf(n)}catch(h){t=h,Ee===n&&n!==null&&(Ee=n=n.return);continue}break}while(!0)}function ff(){var e=Ko.current;return Ko.current=Fo,e===null?Fo:e}function Ms(){(Te===0||Te===3||Te===2)&&(Te=4),Pe===null||!(yn&268435455)&&!(Jo&268435455)||sn(Pe,Le)}function ti(e,t){var n=ae;ae|=2;var r=ff();(Pe!==e||Le!==t)&&(Ut=null,xn(e,t));do try{vp();break}catch(o){cf(e,o)}while(!0);if($a(),ae=n,Ko.current=r,Ee!==null)throw Error(J(261));return Pe=null,Le=0,Te}function vp(){for(;Ee!==null;)df(Ee)}function yp(){for(;Ee!==null&&!Gd();)df(Ee)}function df(e){var t=mf(e.alternate,e,ot);e.memoizedProps=e.pendingProps,t===null?hf(e):Ee=t,Cs.current=null}function hf(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=fp(n,t),n!==null){n.flags&=32767,Ee=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Te=6,Ee=null;return}}else if(n=cp(n,t,ot),n!==null){Ee=n;return}if(t=t.sibling,t!==null){Ee=t;return}Ee=t=e}while(t!==null);Te===0&&(Te=5)}function Sn(e,t,n){var r=ue,o=ct.transition;try{ct.transition=null,ue=1,wp(e,t,n,r)}finally{ct.transition=o,ue=r}return null}function wp(e,t,n,r){do qn();while(on!==null);if(ae&6)throw Error(J(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(J(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(qd(e,i),e===Pe&&(Ee=Pe=null,Le=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xo||(Xo=!0,vf(oo,function(){return qn(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ct.transition,ct.transition=null;var a=ue;ue=1;var l=ae;ae|=4,Cs.current=null,hp(e,n),nf(n,e),_h(Ma),fo=!!Pa,Ma=Pa=null,e.current=n,pp(n),Wd(),ae=l,ue=a,ct.transition=i}else e.current=n;if(Xo&&(Xo=!1,on=e,Zo=o),i=e.pendingLanes,i===0&&(rn=null),Qd(n.stateNode),Xe(e,ke()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(Yo)throw Yo=!1,e=Es,Es=null,e;return Zo&1&&e.tag!==0&&qn(),i=e.pendingLanes,i&1?e===Os?Fr++:(Fr=0,Os=e):Fr=0,qt(),null}function qn(){if(on!==null){var e=eu(Zo),t=ct.transition,n=ue;try{if(ct.transition=null,ue=16>e?16:e,on===null)var r=!1;else{if(e=on,on=null,Zo=0,ae&6)throw Error(J(331));var o=ae;for(ae|=4,q=e.current;q!==null;){var i=q,a=i.child;if(q.flags&16){var l=i.deletions;if(l!==null){for(var d=0;d<l.length;d++){var g=l[d];for(q=g;q!==null;){var S=q;switch(S.tag){case 0:case 11:case 15:_r(8,S,i)}var E=S.child;if(E!==null)E.return=S,q=E;else for(;q!==null;){S=q;var y=S.sibling,R=S.return;if(Xc(S),S===g){q=null;break}if(y!==null){y.return=R,q=y;break}q=R}}}var f=i.alternate;if(f!==null){var k=f.child;if(k!==null){f.child=null;do{var T=k.sibling;k.sibling=null,k=T}while(k!==null)}}q=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,q=a;else e:for(;q!==null;){if(i=q,i.flags&2048)switch(i.tag){case 0:case 11:case 15:_r(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,q=x;break e}q=i.return}}var p=e.current;for(q=p;q!==null;){a=q;var m=a.child;if(a.subtreeFlags&2064&&m!==null)m.return=a,q=m;else e:for(a=p;q!==null;){if(l=q,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Qo(9,l)}}catch(h){be(l,l.return,h)}if(l===a){q=null;break e}var b=l.sibling;if(b!==null){b.return=l.return,q=b;break e}q=l.return}}if(ae=o,qt(),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(io,e)}catch(h){}r=!0}return r}finally{ue=n,ct.transition=t}}return!1}function pf(e,t,n){t=Jn(n,t),t=Pc(e,t,1),e=tn(e,t,1),t=Ge(),e!==null&&(dr(e,1,t),Xe(e,t))}function be(e,t,n){if(e.tag===3)pf(e,e,n);else for(;t!==null;){if(t.tag===3){pf(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(rn===null||!rn.has(r))){e=Jn(n,e),e=Mc(t,e,1),t=tn(t,e,1),e=Ge(),t!==null&&(dr(t,1,e),Xe(t,e));break}}t=t.return}}function xp(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ge(),e.pingedLanes|=e.suspendedLanes&n,Pe===e&&(Le&n)===n&&(Te===4||Te===3&&(Le&130023424)===Le&&500>ke()-Rs?xn(e,0):ks|=n),Xe(e,t)}function gf(e,t){t===0&&(e.mode&1?(t=so,so<<=1,!(so&130023424)&&(so=4194304)):t=1);var n=Ge();e=Lt(e,t),e!==null&&(dr(e,t,n),Xe(e,n))}function Sp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function bp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(J(314))}r!==null&&r.delete(t),gf(e,n)}var mf;mf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qe.current)Je=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Je=!1,up(e,t,n);Je=!!(e.flags&131072)}else Je=!1,ve&&t.flags&1048576&&Ku(t,Io,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;$o(e,t),e=t.pendingProps;var o=Hn(t,je.current);Qn(t,n),o=ns(null,t,r,e,o,n);var i=rs();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ke(r)?(i=!0,Oo(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Ja(t),o.updater=Go,t.stateNode=o,o._reactInternals=t,us(t,r,e,n),t=hs(null,t,r,!0,i,n)):(t.tag=0,ve&&i&&_a(t),Fe(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch($o(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=kp(r),e=gt(r,e),o){case 0:t=ds(null,t,r,e,n);break e;case 1:t=Hc(null,t,r,e,n);break e;case 11:t=jc(null,t,r,e,n);break e;case 14:t=Uc(null,t,r,gt(r.type,e),n);break e}throw Error(J(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:gt(r,o),ds(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:gt(r,o),Hc(e,t,r,o,n);case 3:e:{if(Fc(t),e===null)throw Error(J(387));r=t.pendingProps,i=t.memoizedState,o=i.element,rc(e,t),jo(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Jn(Error(J(423)),t),t=Gc(e,t,r,n,o);break e}else if(r!==o){o=Jn(Error(J(424)),t),t=Gc(e,t,r,n,o);break e}else for(rt=Yt(t.stateNode.containerInfo.firstChild),nt=t,ve=!0,pt=null,n=tc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Wn(),r===o){t=jt(e,t,n);break e}Fe(e,t,r,n)}t=t.child}return t;case 5:return ac(t),e===null&&Fa(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,a=o.children,Na(r,o)?a=null:i!==null&&Na(r,i)&&(t.flags|=32),zc(e,t),Fe(e,t,a,n),t.child;case 6:return e===null&&Fa(t),null;case 13:return Wc(e,t,n);case 4:return Ya(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=$n(t,null,r,n):Fe(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:gt(r,o),jc(e,t,r,o,n);case 7:return Fe(e,t,t.pendingProps,n),t.child;case 8:return Fe(e,t,t.pendingProps.children,n),t.child;case 12:return Fe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,a=o.value,he(No,r._currentValue),r._currentValue=a,i!==null)if(ht(i.value,a)){if(i.children===o.children&&!Qe.current){t=jt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var d=l.firstContext;d!==null;){if(d.context===r){if(i.tag===1){d=Dt(-1,n&-n),d.tag=2;var g=i.updateQueue;if(g!==null){g=g.shared;var S=g.pending;S===null?d.next=d:(d.next=S.next,S.next=d),g.pending=d}}i.lanes|=n,d=i.alternate,d!==null&&(d.lanes|=n),Qa(i.return,n,t),l.lanes|=n;break}d=d.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(J(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Qa(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Fe(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Qn(t,n),o=lt(o),r=r(o),t.flags|=1,Fe(e,t,r,n),t.child;case 14:return r=t.type,o=gt(r,t.pendingProps),o=gt(r.type,o),Uc(e,t,r,o,n);case 15:return Bc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:gt(r,o),$o(e,t),t.tag=1,Ke(r)?(e=!0,Oo(t)):e=!1,Qn(t,n),Ac(t,r,o),us(t,r,o,n),hs(null,t,r,!0,e,n);case 19:return Vc(e,t,n);case 22:return _c(e,t,n)}throw Error(J(156,t.tag))};function vf(e,t){return Jl(e,t)}function Cp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 ft(e,t,n,r){return new Cp(e,t,n,r)}function Ns(e){return e=e.prototype,!(!e||!e.isReactComponent)}function kp(e){if(typeof e=="function")return Ns(e)?1:0;if(e!=null){if(e=e.$$typeof,e===_i)return 11;if(e===Fi)return 14}return 2}function ln(e,t){var n=e.alternate;return n===null?(n=ft(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ni(e,t,n,r,o,i){var a=2;if(r=e,typeof e=="function")Ns(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Tn:return bn(n.children,o,i,t);case Ui:a=8,o|=8;break;case Bi:return e=ft(12,n,t,o|2),e.elementType=Bi,e.lanes=i,e;case zi:return e=ft(13,n,t,o),e.elementType=zi,e.lanes=i,e;case Hi:return e=ft(19,n,t,o),e.elementType=Hi,e.lanes=i,e;case Rl:return ri(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Cl:a=10;break e;case kl:a=9;break e;case _i:a=11;break e;case Fi:a=14;break e;case Ft:a=16,r=null;break e}throw Error(J(130,e==null?e:typeof e,""))}return t=ft(a,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function bn(e,t,n,r){return e=ft(7,e,r,t),e.lanes=n,e}function ri(e,t,n,r){return e=ft(22,e,r,t),e.elementType=Rl,e.lanes=n,e.stateNode={isHidden:!1},e}function Ls(e,t,n){return e=ft(6,e,null,t),e.lanes=n,e}function Ds(e,t,n){return t=ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Rp(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=la(0),this.expirationTimes=la(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=la(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function js(e,t,n,r,o,i,a,l,d){return e=new Rp(e,t,n,l,d),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ft(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ja(i),e}function Ep(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:On,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function yf(e){if(!e)return Zt;e=e._reactInternals;e:{if(cn(e)!==e||e.tag!==1)throw Error(J(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ke(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(J(171))}if(e.tag===1){var n=e.type;if(Ke(n))return $u(e,n,t)}return t}function wf(e,t,n,r,o,i,a,l,d){return e=js(n,r,!0,e,o,i,a,l,d),e.context=yf(null),n=e.current,r=Ge(),o=an(n),i=Dt(r,o),i.callback=t!=null?t:null,tn(n,i,o),e.current.lanes=o,dr(e,o,r),Xe(e,r),e}function oi(e,t,n,r){var o=t.current,i=Ge(),a=an(o);return n=yf(n),t.context===null?t.context=n:t.pendingContext=n,t=Dt(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=tn(o,t,a),e!==null&&(yt(e,o,a,i),Do(e,o,a)),a}function ii(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function xf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Us(e,t){xf(e,t),(e=e.alternate)&&xf(e,t)}function Op(){return null}var Sf=typeof reportError=="function"?reportError:function(e){console.error(e)};function Bs(e){this._internalRoot=e}ai.prototype.render=Bs.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(J(409));oi(e,t,null,null)},ai.prototype.unmount=Bs.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wn(function(){oi(null,e,null,null)}),t[It]=null}};function ai(e){this._internalRoot=e}ai.prototype.unstable_scheduleHydration=function(e){if(e){var t=ru();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qt.length&&t!==0&&t<Qt[n].priority;n++);Qt.splice(n,0,e),n===0&&au(e)}};function _s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function si(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function bf(){}function Tp(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var g=ii(a);i.call(g)}}var a=wf(t,r,e,0,null,!1,!1,"",bf);return e._reactRootContainer=a,e[It]=a.current,Er(e.nodeType===8?e.parentNode:e),wn(),a}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var l=r;r=function(){var g=ii(d);l.call(g)}}var d=js(e,0,!1,null,null,!1,!1,"",bf);return e._reactRootContainer=d,e[It]=d.current,Er(e.nodeType===8?e.parentNode:e),wn(function(){oi(t,d,n,r)}),d}function li(e,t,n,r,o){var i=n._reactRootContainer;if(i){var a=i;if(typeof o=="function"){var l=o;o=function(){var d=ii(a);l.call(d)}}oi(t,a,e,o)}else a=Tp(n,t,e,o,r);return ii(a)}tu=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=fr(t.pendingLanes);n!==0&&(ua(t,n|1),Xe(t,ke()),!(ae&6)&&(Zn=ke()+500,qt()))}break;case 13:wn(function(){var r=Lt(e,1);if(r!==null){var o=Ge();yt(r,e,1,o)}}),Us(e,1)}},ca=function(e){if(e.tag===13){var t=Lt(e,134217728);if(t!==null){var n=Ge();yt(t,e,134217728,n)}Us(e,134217728)}},nu=function(e){if(e.tag===13){var t=an(e),n=Lt(e,t);if(n!==null){var r=Ge();yt(n,e,t,r)}Us(e,t)}},ru=function(){return ue},ou=function(e,t){var n=ue;try{return ue=e,t()}finally{ue=n}},na=function(e,t,n){switch(t){case"input":if(Ki(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=Ro(r);if(!o)throw Error(J(90));Tl(r),Ki(r,o)}}}break;case"textarea":Nl(e,n);break;case"select":t=n.value,t!=null&&An(e,!!n.multiple,t,!1)}},Fl=Is,Gl=wn;var Ap={usingClientEntryPoint:!1,Events:[Ar,_n,Ro,zl,Hl,Is]},Gr={findFiberByHostInstance:fn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ip={bundleType:Gr.bundleType,version:Gr.version,rendererPackageName:Gr.rendererPackageName,rendererConfig:Gr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:At.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Ql(e),e===null?null:e.stateNode},findFiberByHostInstance:Gr.findFiberByHostInstance||Op,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var ui=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ui.isDisabled&&ui.supportsFiber)try{io=ui.inject(Ip),St=ui}catch(e){}}qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ap,qe.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_s(t))throw Error(J(200));return Ep(e,t,null,n)},qe.createRoot=function(e,t){if(!_s(e))throw Error(J(299));var n=!1,r="",o=Sf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=js(e,1,!1,null,null,n,!1,r,o),e[It]=t.current,Er(e.nodeType===8?e.parentNode:e),new Bs(t)},qe.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(J(188)):(e=Object.keys(e).join(","),Error(J(268,e)));return e=Ql(t),e=e===null?null:e.stateNode,e},qe.flushSync=function(e){return wn(e)},qe.hydrate=function(e,t,n){if(!si(t))throw Error(J(200));return li(null,e,t,!0,n)},qe.hydrateRoot=function(e,t,n){if(!_s(e))throw Error(J(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",a=Sf;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=wf(t,null,e,1,n!=null?n:null,o,!1,i,a),e[It]=t.current,Er(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new ai(t)},qe.render=function(e,t,n){if(!si(t))throw Error(J(200));return li(null,e,t,!1,n)},qe.unmountComponentAtNode=function(e){if(!si(e))throw Error(J(40));return e._reactRootContainer?(wn(function(){li(null,null,e,!1,function(){e._reactRootContainer=null,e[It]=null})}),!0):!1},qe.unstable_batchedUpdates=Is,qe.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!si(n))throw Error(J(200));if(e==null||e._reactInternals===void 0)throw Error(J(38));return li(e,t,n,!1,r)},qe.version="18.3.1-next-f1338f8080-20240426";function Cf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Cf)}catch(e){console.error(e)}}Cf(),vl.exports=qe;var Pp=vl.exports,zs,kf=Pp;zs=kf.createRoot,kf.hydrateRoot;var Rf={exports:{}},ci={};/**
33
33
  * @license React
34
34
  * react-jsx-runtime.production.min.js
35
35
  *
@@ -37,33 +37,33 @@ Error generating stack: `+o.message+`
37
37
  *
38
38
  * This source code is licensed under the MIT license found in the
39
39
  * LICENSE file in the root directory of this source tree.
40
- */var Pp=te,Np=Symbol.for("react.element"),Lp=Symbol.for("react.fragment"),Dp=Object.prototype.hasOwnProperty,jp=Pp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Up={key:!0,ref:!0,__self:!0,__source:!0};function Ef(e,t,n){var r,i={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Dp.call(t,r)&&!Up.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:Np,type:e,key:o,ref:a,props:i,_owner:jp.current}}uo.Fragment=Lp,uo.jsx=Ef,uo.jsxs=Ef,Rf.exports=uo;var G=Rf.exports;const Bp=({isOpen:e,onClick:t,primaryColor:n="#007bff",position:r="bottom-right",marginBottom:i=16,marginSide:o=16,hasNewMessages:a=!1,isMobile:l=!1})=>{const d=()=>{const S={backgroundColor:n,zIndex:2147483647,bottom:`${i}px`};return r==="bottom-left"?Ve(fe({},S),{left:`${o}px`}):Ve(fe({},S),{right:`${o}px`})},g=()=>{const S="nbc-fixed nbc-w-16 nbc-h-16 nbc-rounded-full nbc-text-white nbc-shadow-lg nbc-transition-all nbc-duration-300 nbc-flex nbc-items-center nbc-justify-center nbc-border-0 nbc-cursor-pointer hover:nbc-scale-105";let E="";return l?E=e?"nbc-hidden":"nbc-flex":E="nbc-flex",`${S} ${E} ${e?"nbc-rotate-180":""}`};return G.jsxs("button",{onClick:t,className:g(),style:d(),"aria-label":e?"Close chat":"Open chat",children:[a&&!e&&G.jsxs(G.Fragment,{children:[G.jsx("div",{className:"nbc-absolute nbc-top-0 nbc-right-0 nbc-w-3 nbc-h-3 nbc-bg-green-400 nbc-rounded-full nbc-animate-ping nbc-opacity-75"}),G.jsx("div",{className:"nbc-absolute nbc-top-0 nbc-right-0 nbc-w-4 nbc-h-4 nbc-bg-green-500 nbc-rounded-full nbc-border-2 nbc-border-white nbc-flex nbc-items-center nbc-justify-center nbc-shadow-md nbc-animate-bounce",children:G.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-white nbc-rounded-full"})})]}),e?G.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):G.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z M8 12h.01 M12 12h.01 M16 12h.01"})})]})},_p=({title:e,onClose:t,primaryColor:n="#f59e0b",avatar:r,closeButtonIcon:i="default",closeButtonText:o="×",closeButtonCustomIcon:a})=>{const l=()=>{switch(i){case"text":return G.jsx("span",{className:"nbc-text-sm nbc-font-bold nbc-leading-none",children:o});case"custom":return a?a.startsWith("<svg")?G.jsx("div",{className:"nbc-w-5 nbc-h-5 nbc-flex nbc-items-center nbc-justify-center",dangerouslySetInnerHTML:{__html:a}}):G.jsx("img",{src:a,alt:"Close",className:"nbc-w-5 nbc-h-5"}):G.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});default:return G.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}};return G.jsxs("div",{className:"nbc-p-2 nbc-text-white nbc-flex nbc-justify-between nbc-items-center nbc-font-medium",style:{backgroundColor:n},children:[G.jsxs("div",{className:"nbc-flex nbc-items-center nbc-space-x-3 nbc-text-black",children:[r?G.jsx("img",{src:r,alt:"Avatar",className:"nbc-w-10 nbc-h-10 nbc-rounded-full nbc-object-cover"}):G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[G.jsx("path",{d:"M12 6V2H8"}),G.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),G.jsx("path",{d:"M2 12h2"}),G.jsx("path",{d:"M9 11v2"}),G.jsx("path",{d:"M15 11v2"}),G.jsx("path",{d:"M20 12h2"})]}),G.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]}),G.jsx("button",{onClick:t,className:"nbc-bg-transparent nbc-border-0 nbc-text-white nbc-cursor-pointer nbc-p-1 nbc-rounded-full nbc-flex nbc-items-center nbc-justify-center hover:nbc-bg-black hover:nbc-bg-opacity-20 nbc-transition-colors nbc-duration-200 nbc-w-8 nbc-h-8","aria-label":"Close chat",children:l()})]})};function Hs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Cn=Hs();function Of(e){Cn=e}var Wr={exec:()=>null};function le(e,t=""){let n=typeof e=="string"?e:e.source;const r={replace:(i,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(We.caret,"$1"),n=n.replace(i,a),r},getRegex:()=>new RegExp(n,t)};return r}var We={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},zp=/^(?:[ \t]*(?:\n|$))+/,Hp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fp=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$r=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Gp=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fs=/(?:[*+-]|\d{1,9}[.)])/,Tf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Af=le(Tf).replace(/bull/g,Fs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Wp=le(Tf).replace(/bull/g,Fs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Gs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$p=/^[^\n]+/,Ws=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Vp=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ws).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Qp=le(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Fs).getRegex(),co="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",$s=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Kp=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",$s).replace("tag",co).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),If=le(Gs).replace("hr",$r).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",co).getRegex(),Jp=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",If).getRegex(),Vs={blockquote:Jp,code:Hp,def:Vp,fences:Fp,heading:Gp,hr:$r,html:Kp,lheading:Af,list:Qp,newline:zp,paragraph:If,table:Wr,text:$p},Mf=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",$r).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",co).getRegex(),Yp=Ve(fe({},Vs),{lheading:Wp,table:Mf,paragraph:le(Gs).replace("hr",$r).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Mf).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",co).getRegex()}),Xp=Ve(fe({},Vs),{html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",$s).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Wr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(Gs).replace("hr",$r).replace("heading",` *#{1,6} *[^
41
- ]`).replace("lheading",Af).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Zp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,qp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Pf=/^( {2,}|\\)\n(?!\s*$)/,eg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,fo=/[\p{P}\p{S}]/u,Qs=/[\s\p{P}\p{S}]/u,Nf=/[^\s\p{P}\p{S}]/u,tg=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Qs).getRegex(),Lf=/(?!~)[\p{P}\p{S}]/u,ng=/(?!~)[\s\p{P}\p{S}]/u,rg=/(?:[^\s\p{P}\p{S}]|~)/u,ig=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Df=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,og=le(Df,"u").replace(/punct/g,fo).getRegex(),ag=le(Df,"u").replace(/punct/g,Lf).getRegex(),jf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",sg=le(jf,"gu").replace(/notPunctSpace/g,Nf).replace(/punctSpace/g,Qs).replace(/punct/g,fo).getRegex(),lg=le(jf,"gu").replace(/notPunctSpace/g,rg).replace(/punctSpace/g,ng).replace(/punct/g,Lf).getRegex(),ug=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Nf).replace(/punctSpace/g,Qs).replace(/punct/g,fo).getRegex(),cg=le(/\\(punct)/,"gu").replace(/punct/g,fo).getRegex(),fg=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),dg=le($s).replace("(?:-->|$)","-->").getRegex(),hg=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",dg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ho=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,pg=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ho).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Uf=le(/^!?\[(label)\]\[(ref)\]/).replace("label",ho).replace("ref",Ws).getRegex(),Bf=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ws).getRegex(),gg=le("reflink|nolink(?!\\()","g").replace("reflink",Uf).replace("nolink",Bf).getRegex(),Ks={_backpedal:Wr,anyPunctuation:cg,autolink:fg,blockSkip:ig,br:Pf,code:qp,del:Wr,emStrongLDelim:og,emStrongRDelimAst:sg,emStrongRDelimUnd:ug,escape:Zp,link:pg,nolink:Bf,punctuation:tg,reflink:Uf,reflinkSearch:gg,tag:hg,text:eg,url:Wr},mg=Ve(fe({},Ks),{link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",ho).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ho).getRegex()}),Js=Ve(fe({},Ks),{emStrongRDelimAst:lg,emStrongLDelim:ag,url:le(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),vg=Ve(fe({},Js),{br:le(Pf).replace("{2,}","*").getRegex(),text:le(Js.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),po={normal:Vs,gfm:Yp,pedantic:Xp},Vr={normal:Ks,gfm:Js,breaks:vg,pedantic:mg},yg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},_f=e=>yg[e];function Et(e,t){if(t){if(We.escapeTest.test(e))return e.replace(We.escapeReplace,_f)}else if(We.escapeTestNoEncode.test(e))return e.replace(We.escapeReplaceNoEncode,_f);return e}function zf(e){try{e=encodeURI(e).replace(We.percentDecode,"%")}catch(t){return null}return e}function Hf(e,t){var o;const n=e.replace(We.findPipe,(a,l,d)=>{let g=!1,S=l;for(;--S>=0&&d[S]==="\\";)g=!g;return g?"|":" |"}),r=n.split(We.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!((o=r.at(-1))!=null&&o.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(We.slashPipe,"|");return r}function Qr(e,t,n){const r=e.length;if(r===0)return"";let i=0;for(;i<r&&e.charAt(r-i-1)===t;)i++;return e.slice(0,r-i)}function wg(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ff(e,t,n,r,i){const o=t.href,a=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;const d={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,d}function xg(e,t,n){const r=e.match(n.other.indentCodeCompensation);if(r===null)return t;const i=r[1];return t.split(`
42
- `).map(o=>{const a=o.match(n.other.beginningSpace);if(a===null)return o;const[l]=a;return l.length>=i.length?o.slice(i.length):o}).join(`
43
- `)}var go=class{constructor(e){de(this,"options");de(this,"rules");de(this,"lexer");this.options=e||Cn}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Qr(n,`
40
+ */var Mp=te,Np=Symbol.for("react.element"),Lp=Symbol.for("react.fragment"),Dp=Object.prototype.hasOwnProperty,jp=Mp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Up={key:!0,ref:!0,__self:!0,__source:!0};function Ef(e,t,n){var r,o={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)Dp.call(t,r)&&!Up.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:Np,type:e,key:i,ref:a,props:o,_owner:jp.current}}ci.Fragment=Lp,ci.jsx=Ef,ci.jsxs=Ef,Rf.exports=ci;var G=Rf.exports;const Bp=({isOpen:e,onClick:t,primaryColor:n="#007bff",position:r="bottom-right",marginBottom:o=16,marginSide:i=16,hasNewMessages:a=!1,isMobile:l=!1})=>{const d=()=>{const S={backgroundColor:n,zIndex:2147483647,bottom:`${o}px`};return r==="bottom-left"?Ve(fe({},S),{left:`${i}px`}):Ve(fe({},S),{right:`${i}px`})},g=()=>{const S="nbc-fixed nbc-w-16 nbc-h-16 nbc-rounded-full nbc-text-white nbc-shadow-lg nbc-transition-all nbc-duration-300 nbc-flex nbc-items-center nbc-justify-center nbc-border-0 nbc-cursor-pointer hover:nbc-scale-105";let E="";return l?E=e?"nbc-hidden":"nbc-flex":E="nbc-flex",`${S} ${E} ${e?"nbc-rotate-180":""}`};return G.jsxs("button",{onClick:t,className:g(),style:d(),"aria-label":e?"Close chat":"Open chat",children:[a&&!e&&G.jsxs(G.Fragment,{children:[G.jsx("div",{className:"nbc-absolute nbc-top-0 nbc-right-0 nbc-w-3 nbc-h-3 nbc-bg-green-400 nbc-rounded-full nbc-animate-ping nbc-opacity-75"}),G.jsx("div",{className:"nbc-absolute nbc-top-0 nbc-right-0 nbc-w-4 nbc-h-4 nbc-bg-green-500 nbc-rounded-full nbc-border-2 nbc-border-white nbc-flex nbc-items-center nbc-justify-center nbc-shadow-md nbc-animate-bounce",children:G.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-white nbc-rounded-full"})})]}),e?G.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):G.jsx("svg",{className:"nbc-w-8 nbc-h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z M8 12h.01 M12 12h.01 M16 12h.01"})})]})},_p=({title:e,onClose:t,primaryColor:n="#f59e0b",avatar:r,closeButtonIcon:o="default",closeButtonText:i="×",closeButtonCustomIcon:a})=>{const l=()=>{switch(o){case"text":return G.jsx("span",{className:"nbc-text-sm nbc-font-bold nbc-leading-none",children:i});case"custom":return a?a.startsWith("<svg")?G.jsx("div",{className:"nbc-w-5 nbc-h-5 nbc-flex nbc-items-center nbc-justify-center",dangerouslySetInnerHTML:{__html:a}}):G.jsx("img",{src:a,alt:"Close",className:"nbc-w-5 nbc-h-5"}):G.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});default:return G.jsx("svg",{className:"nbc-w-5 nbc-h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}};return G.jsxs("div",{className:"nbc-p-2 nbc-text-white nbc-flex nbc-justify-between nbc-items-center nbc-font-medium",style:{backgroundColor:n},children:[G.jsxs("div",{className:"nbc-flex nbc-items-center nbc-space-x-3 nbc-text-black",children:[r?G.jsx("img",{src:r,alt:"Avatar",className:"nbc-w-10 nbc-h-10 nbc-rounded-full nbc-object-cover"}):G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[G.jsx("path",{d:"M12 6V2H8"}),G.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),G.jsx("path",{d:"M2 12h2"}),G.jsx("path",{d:"M9 11v2"}),G.jsx("path",{d:"M15 11v2"}),G.jsx("path",{d:"M20 12h2"})]}),G.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]}),G.jsx("button",{onClick:t,className:"nbc-bg-transparent nbc-border-0 nbc-text-white nbc-cursor-pointer nbc-p-1 nbc-rounded-full nbc-flex nbc-items-center nbc-justify-center hover:nbc-bg-black hover:nbc-bg-opacity-20 nbc-transition-colors nbc-duration-200 nbc-w-8 nbc-h-8","aria-label":"Close chat",children:l()})]})};function Hs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Cn=Hs();function Of(e){Cn=e}var Wr={exec:()=>null};function le(e,t=""){let n=typeof e=="string"?e:e.source;const r={replace:(o,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(We.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var We={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},zp=/^(?:[ \t]*(?:\n|$))+/,Hp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fp=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$r=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Gp=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fs=/(?:[*+-]|\d{1,9}[.)])/,Tf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Af=le(Tf).replace(/bull/g,Fs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Wp=le(Tf).replace(/bull/g,Fs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Gs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$p=/^[^\n]+/,Ws=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Vp=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ws).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Qp=le(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Fs).getRegex(),fi="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",$s=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Kp=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",$s).replace("tag",fi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),If=le(Gs).replace("hr",$r).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",fi).getRegex(),Jp=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",If).getRegex(),Vs={blockquote:Jp,code:Hp,def:Vp,fences:Fp,heading:Gp,hr:$r,html:Kp,lheading:Af,list:Qp,newline:zp,paragraph:If,table:Wr,text:$p},Pf=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",$r).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",fi).getRegex(),Yp=Ve(fe({},Vs),{lheading:Wp,table:Pf,paragraph:le(Gs).replace("hr",$r).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Pf).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",fi).getRegex()}),Xp=Ve(fe({},Vs),{html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",$s).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Wr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(Gs).replace("hr",$r).replace("heading",` *#{1,6} *[^
41
+ ]`).replace("lheading",Af).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Zp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,qp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Mf=/^( {2,}|\\)\n(?!\s*$)/,eg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,di=/[\p{P}\p{S}]/u,Qs=/[\s\p{P}\p{S}]/u,Nf=/[^\s\p{P}\p{S}]/u,tg=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Qs).getRegex(),Lf=/(?!~)[\p{P}\p{S}]/u,ng=/(?!~)[\s\p{P}\p{S}]/u,rg=/(?:[^\s\p{P}\p{S}]|~)/u,og=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Df=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ig=le(Df,"u").replace(/punct/g,di).getRegex(),ag=le(Df,"u").replace(/punct/g,Lf).getRegex(),jf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",sg=le(jf,"gu").replace(/notPunctSpace/g,Nf).replace(/punctSpace/g,Qs).replace(/punct/g,di).getRegex(),lg=le(jf,"gu").replace(/notPunctSpace/g,rg).replace(/punctSpace/g,ng).replace(/punct/g,Lf).getRegex(),ug=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Nf).replace(/punctSpace/g,Qs).replace(/punct/g,di).getRegex(),cg=le(/\\(punct)/,"gu").replace(/punct/g,di).getRegex(),fg=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),dg=le($s).replace("(?:-->|$)","-->").getRegex(),hg=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",dg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),hi=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,pg=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",hi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Uf=le(/^!?\[(label)\]\[(ref)\]/).replace("label",hi).replace("ref",Ws).getRegex(),Bf=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ws).getRegex(),gg=le("reflink|nolink(?!\\()","g").replace("reflink",Uf).replace("nolink",Bf).getRegex(),Ks={_backpedal:Wr,anyPunctuation:cg,autolink:fg,blockSkip:og,br:Mf,code:qp,del:Wr,emStrongLDelim:ig,emStrongRDelimAst:sg,emStrongRDelimUnd:ug,escape:Zp,link:pg,nolink:Bf,punctuation:tg,reflink:Uf,reflinkSearch:gg,tag:hg,text:eg,url:Wr},mg=Ve(fe({},Ks),{link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",hi).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",hi).getRegex()}),Js=Ve(fe({},Ks),{emStrongRDelimAst:lg,emStrongLDelim:ag,url:le(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),vg=Ve(fe({},Js),{br:le(Mf).replace("{2,}","*").getRegex(),text:le(Js.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),pi={normal:Vs,gfm:Yp,pedantic:Xp},Vr={normal:Ks,gfm:Js,breaks:vg,pedantic:mg},yg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},_f=e=>yg[e];function Et(e,t){if(t){if(We.escapeTest.test(e))return e.replace(We.escapeReplace,_f)}else if(We.escapeTestNoEncode.test(e))return e.replace(We.escapeReplaceNoEncode,_f);return e}function zf(e){try{e=encodeURI(e).replace(We.percentDecode,"%")}catch(t){return null}return e}function Hf(e,t){var i;const n=e.replace(We.findPipe,(a,l,d)=>{let g=!1,S=l;for(;--S>=0&&d[S]==="\\";)g=!g;return g?"|":" |"}),r=n.split(We.splitPipe);let o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(We.slashPipe,"|");return r}function Qr(e,t,n){const r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function wg(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Ff(e,t,n,r,o){const i=t.href,a=t.title||null,l=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;const d={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,d}function xg(e,t,n){const r=e.match(n.other.indentCodeCompensation);if(r===null)return t;const o=r[1];return t.split(`
42
+ `).map(i=>{const a=i.match(n.other.beginningSpace);if(a===null)return i;const[l]=a;return l.length>=o.length?i.slice(o.length):i}).join(`
43
+ `)}var gi=class{constructor(e){de(this,"options");de(this,"rules");de(this,"lexer");this.options=e||Cn}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Qr(n,`
44
44
  `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],r=xg(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){const r=Qr(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Qr(t[0],`
45
45
  `)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=Qr(t[0],`
46
46
  `).split(`
47
- `),r="",i="";const o=[];for(;n.length>0;){let a=!1;const l=[];let d;for(d=0;d<n.length;d++)if(this.rules.other.blockquoteStart.test(n[d]))l.push(n[d]),a=!0;else if(!a)l.push(n[d]);else break;n=n.slice(d);const g=l.join(`
47
+ `),r="",o="";const i=[];for(;n.length>0;){let a=!1;const l=[];let d;for(d=0;d<n.length;d++)if(this.rules.other.blockquoteStart.test(n[d]))l.push(n[d]),a=!0;else if(!a)l.push(n[d]);else break;n=n.slice(d);const g=l.join(`
48
48
  `),S=g.replace(this.rules.other.blockquoteSetextReplace,`
49
49
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
50
- ${g}`:g,i=i?`${i}
51
- ${S}`:S;const E=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(S,o,!0),this.lexer.state.top=E,n.length===0)break;const y=o.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){const R=y,f=R.raw+`
50
+ ${g}`:g,o=o?`${o}
51
+ ${S}`:S;const E=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(S,i,!0),this.lexer.state.top=E,n.length===0)break;const y=i.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){const R=y,f=R.raw+`
52
52
  `+n.join(`
53
- `),k=this.blockquote(f);o[o.length-1]=k,r=r.substring(0,r.length-R.raw.length)+k.raw,i=i.substring(0,i.length-R.text.length)+k.text;break}else if((y==null?void 0:y.type)==="list"){const R=y,f=R.raw+`
53
+ `),k=this.blockquote(f);i[i.length-1]=k,r=r.substring(0,r.length-R.raw.length)+k.raw,o=o.substring(0,o.length-R.text.length)+k.text;break}else if((y==null?void 0:y.type)==="list"){const R=y,f=R.raw+`
54
54
  `+n.join(`
55
- `),k=this.list(f);o[o.length-1]=k,r=r.substring(0,r.length-y.raw.length)+k.raw,i=i.substring(0,i.length-R.raw.length)+k.raw,n=f.substring(o.at(-1).raw.length).split(`
56
- `);continue}}return{type:"blockquote",raw:r,tokens:o,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const o=this.rules.other.listItemRegex(n);let a=!1;for(;e;){let d=!1,g="",S="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;g=t[0],e=e.substring(g.length);let E=t[2].split(`
55
+ `),k=this.list(f);i[i.length-1]=k,r=r.substring(0,r.length-y.raw.length)+k.raw,o=o.substring(0,o.length-R.raw.length)+k.raw,n=f.substring(i.at(-1).raw.length).split(`
56
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const i=this.rules.other.listItemRegex(n);let a=!1;for(;e;){let d=!1,g="",S="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;g=t[0],e=e.substring(g.length);let E=t[2].split(`
57
57
  `,1)[0].replace(this.rules.other.listReplaceTabs,x=>" ".repeat(3*x.length)),y=e.split(`
58
58
  `,1)[0],R=!E.trim(),f=0;if(this.options.pedantic?(f=2,S=E.trimStart()):R?f=t[1].length+1:(f=t[2].search(this.rules.other.nonSpaceChar),f=f>4?1:f,S=E.slice(f),f+=t[1].length),R&&this.rules.other.blankLine.test(y)&&(g+=y+`
59
59
  `,e=e.substring(y.length+1),d=!0),!d){const x=this.rules.other.nextBulletRegex(f),p=this.rules.other.hrRegex(f),m=this.rules.other.fencesBeginRegex(f),b=this.rules.other.headingBeginRegex(f),h=this.rules.other.htmlBeginRegex(f);for(;e;){const c=e.split(`
60
60
  `,1)[0];let u;if(y=c,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),u=y):u=y.replace(this.rules.other.tabCharGlobal," "),m.test(y)||b.test(y)||h.test(y)||x.test(y)||p.test(y))break;if(u.search(this.rules.other.nonSpaceChar)>=f||!y.trim())S+=`
61
61
  `+u.slice(f);else{if(R||E.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||m.test(E)||b.test(E)||p.test(E))break;S+=`
62
62
  `+y}!R&&!y.trim()&&(R=!0),g+=c+`
63
- `,e=e.substring(c.length+1),E=u.slice(f)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(a=!0));let k=null,T;this.options.gfm&&(k=this.rules.other.listIsTask.exec(S),k&&(T=k[0]!=="[ ] ",S=S.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:g,task:!!k,checked:T,loose:!1,text:S,tokens:[]}),i.raw+=g}const l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let d=0;d<i.items.length;d++)if(this.lexer.state.top=!1,i.items[d].tokens=this.lexer.blockTokens(i.items[d].text,[]),!i.loose){const g=i.items[d].tokens.filter(E=>E.type==="space"),S=g.length>0&&g.some(E=>this.rules.other.anyLine.test(E.raw));i.loose=S}if(i.loose)for(let d=0;d<i.items.length;d++)i.items[d].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:r,title:i}}}table(e){var a;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const n=Hf(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
64
- `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const l of r)this.rules.other.tableAlignRight.test(l)?o.align.push("right"):this.rules.other.tableAlignCenter.test(l)?o.align.push("center"):this.rules.other.tableAlignLeft.test(l)?o.align.push("left"):o.align.push(null);for(let l=0;l<n.length;l++)o.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:o.align[l]});for(const l of i)o.rows.push(Hf(l,o.header.length).map((d,g)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:o.align[g]})));return o}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
65
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const o=Qr(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{const o=wg(t[2],"()");if(o===-2)return;if(o>-1){const l=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){const o=this.rules.other.pedanticHrefTitle.exec(r);o&&(r=o[1],i=o[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Ff(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){const o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return Ff(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const o=[...r[0]].length-1;let a,l,d=o,g=0;const S=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(S.lastIndex=0,t=t.slice(-1*e.length+o);(r=S.exec(t))!=null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(l=[...a].length,r[3]||r[4]){d+=l;continue}else if((r[5]||r[6])&&o%3&&!((o+l)%3)){g+=l;continue}if(d-=l,d>0)continue;l=Math.min(l,l+d+g);const E=[...r[0]][0].length,y=e.slice(0,o+r.index+E+l);if(Math.min(o,l)%2){const f=y.slice(1,-1);return{type:"em",raw:y,text:f,tokens:this.lexer.inlineTokens(f)}}const R=y.slice(2,-2);return{type:"strong",raw:y,text:R,tokens:this.lexer.inlineTokens(R)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let i,o;if(t[2]==="@")i=t[0],o="mailto:"+i;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);i=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:i,href:o,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Bt=class il{constructor(t){de(this,"tokens");de(this,"options");de(this,"state");de(this,"tokenizer");de(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Cn,this.options.tokenizer=this.options.tokenizer||new go,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:We,block:po.normal,inline:Vr.normal};this.options.pedantic?(n.block=po.pedantic,n.inline=Vr.pedantic):this.options.gfm&&(n.block=po.gfm,this.options.breaks?n.inline=Vr.breaks:n.inline=Vr.gfm),this.tokenizer.rules=n}static get rules(){return{block:po,inline:Vr}}static lex(t,n){return new il(n).lex(t)}static lexInline(t,n){return new il(n).inlineTokens(t)}lex(t){t=t.replace(We.carriageReturn,`
66
- `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,o,a;for(this.options.pedantic&&(t=t.replace(We.tabCharGlobal," ").replace(We.spaceLine,""));t;){let l;if((o=(i=this.options.extensions)==null?void 0:i.block)!=null&&o.some(g=>(l=g.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);const g=n.at(-1);l.raw.length===1&&g!==void 0?g.raw+=`
63
+ `,e=e.substring(c.length+1),E=u.slice(f)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(a=!0));let k=null,T;this.options.gfm&&(k=this.rules.other.listIsTask.exec(S),k&&(T=k[0]!=="[ ] ",S=S.replace(this.rules.other.listReplaceTask,""))),o.items.push({type:"list_item",raw:g,task:!!k,checked:T,loose:!1,text:S,tokens:[]}),o.raw+=g}const l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d=0;d<o.items.length;d++)if(this.lexer.state.top=!1,o.items[d].tokens=this.lexer.blockTokens(o.items[d].text,[]),!o.loose){const g=o.items[d].tokens.filter(E=>E.type==="space"),S=g.length>0&&g.some(E=>this.rules.other.anyLine.test(E.raw));o.loose=S}if(o.loose)for(let d=0;d<o.items.length;d++)o.items[d].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:r,title:o}}}table(e){var a;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const n=Hf(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
64
+ `):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const l of r)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<n.length;l++)i.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:i.align[l]});for(const l of o)i.rows.push(Hf(l,i.header.length).map((d,g)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:i.align[g]})));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
65
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const i=Qr(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{const i=wg(t[2],"()");if(i===-2)return;if(i>-1){const l=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Ff(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){const i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Ff(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const i=[...r[0]].length-1;let a,l,d=i,g=0;const S=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(S.lastIndex=0,t=t.slice(-1*e.length+i);(r=S.exec(t))!=null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(l=[...a].length,r[3]||r[4]){d+=l;continue}else if((r[5]||r[6])&&i%3&&!((i+l)%3)){g+=l;continue}if(d-=l,d>0)continue;l=Math.min(l,l+d+g);const E=[...r[0]][0].length,y=e.slice(0,i+r.index+E+l);if(Math.min(i,l)%2){const f=y.slice(1,-1);return{type:"em",raw:y,text:f,tokens:this.lexer.inlineTokens(f)}}const R=y.slice(2,-2);return{type:"strong",raw:y,text:R,tokens:this.lexer.inlineTokens(R)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let o,i;if(t[2]==="@")o=t[0],i="mailto:"+o;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);o=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Bt=class ol{constructor(t){de(this,"tokens");de(this,"options");de(this,"state");de(this,"tokenizer");de(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Cn,this.options.tokenizer=this.options.tokenizer||new gi,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:We,block:pi.normal,inline:Vr.normal};this.options.pedantic?(n.block=pi.pedantic,n.inline=Vr.pedantic):this.options.gfm&&(n.block=pi.gfm,this.options.breaks?n.inline=Vr.breaks:n.inline=Vr.gfm),this.tokenizer.rules=n}static get rules(){return{block:pi,inline:Vr}}static lex(t,n){return new ol(n).lex(t)}static lexInline(t,n){return new ol(n).inlineTokens(t)}lex(t){t=t.replace(We.carriageReturn,`
66
+ `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var o,i,a;for(this.options.pedantic&&(t=t.replace(We.tabCharGlobal," ").replace(We.spaceLine,""));t;){let l;if((i=(o=this.options.extensions)==null?void 0:o.block)!=null&&i.some(g=>(l=g.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);const g=n.at(-1);l.raw.length===1&&g!==void 0?g.raw+=`
67
67
  `:n.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);const g=n.at(-1);(g==null?void 0:g.type)==="paragraph"||(g==null?void 0:g.type)==="text"?(g.raw+=`
68
68
  `+l.raw,g.text+=`
69
69
  `+l.text,this.inlineQueue.at(-1).src=g.text):n.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);const g=n.at(-1);(g==null?void 0:g.type)==="paragraph"||(g==null?void 0:g.type)==="text"?(g.raw+=`
@@ -72,27 +72,27 @@ ${S}`:S;const E=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
72
72
  `+l.raw,g.text+=`
73
73
  `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=g.text):n.push(l),r=d.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);const g=n.at(-1);(g==null?void 0:g.type)==="text"?(g.raw+=`
74
74
  `+l.raw,g.text+=`
75
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=g.text):n.push(l);continue}if(t){const g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var l,d,g;let r=t,i=null;if(this.tokens.links){const S=Object.keys(this.tokens.links);if(S.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)S.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let o=!1,a="";for(;t;){o||(a=""),o=!1;let S;if((d=(l=this.options.extensions)==null?void 0:l.inline)!=null&&d.some(y=>(S=y.call({lexer:this},t,n))?(t=t.substring(S.raw.length),n.push(S),!0):!1))continue;if(S=this.tokenizer.escape(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.tag(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.link(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(S.raw.length);const y=n.at(-1);S.type==="text"&&(y==null?void 0:y.type)==="text"?(y.raw+=S.raw,y.text+=S.text):n.push(S);continue}if(S=this.tokenizer.emStrong(t,r,a)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.codespan(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.br(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.del(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.autolink(t)){t=t.substring(S.raw.length),n.push(S);continue}if(!this.state.inLink&&(S=this.tokenizer.url(t))){t=t.substring(S.raw.length),n.push(S);continue}let E=t;if((g=this.options.extensions)!=null&&g.startInline){let y=1/0;const R=t.slice(1);let f;this.options.extensions.startInline.forEach(k=>{f=k.call({lexer:this},R),typeof f=="number"&&f>=0&&(y=Math.min(y,f))}),y<1/0&&y>=0&&(E=t.substring(0,y+1))}if(S=this.tokenizer.inlineText(E)){t=t.substring(S.raw.length),S.raw.slice(-1)!=="_"&&(a=S.raw.slice(-1)),o=!0;const y=n.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=S.raw,y.text+=S.text):n.push(S);continue}if(t){const y="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return n}},mo=class{constructor(e){de(this,"options");de(this,"parser");this.options=e||Cn}space(e){return""}code({text:e,lang:t,escaped:n}){var o;const r=(o=(t||"").match(We.notSpaceStart))==null?void 0:o[0],i=e.replace(We.endingNewline,"")+`
76
- `;return r?'<pre><code class="language-'+Et(r)+'">'+(n?i:Et(i,!0))+`</code></pre>
77
- `:"<pre><code>"+(n?i:Et(i,!0))+`</code></pre>
75
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=g.text):n.push(l);continue}if(t){const g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var l,d,g;let r=t,o=null;if(this.tokens.links){const S=Object.keys(this.tokens.links);if(S.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)S.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,o.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(o=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,a="";for(;t;){i||(a=""),i=!1;let S;if((d=(l=this.options.extensions)==null?void 0:l.inline)!=null&&d.some(y=>(S=y.call({lexer:this},t,n))?(t=t.substring(S.raw.length),n.push(S),!0):!1))continue;if(S=this.tokenizer.escape(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.tag(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.link(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(S.raw.length);const y=n.at(-1);S.type==="text"&&(y==null?void 0:y.type)==="text"?(y.raw+=S.raw,y.text+=S.text):n.push(S);continue}if(S=this.tokenizer.emStrong(t,r,a)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.codespan(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.br(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.del(t)){t=t.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.autolink(t)){t=t.substring(S.raw.length),n.push(S);continue}if(!this.state.inLink&&(S=this.tokenizer.url(t))){t=t.substring(S.raw.length),n.push(S);continue}let E=t;if((g=this.options.extensions)!=null&&g.startInline){let y=1/0;const R=t.slice(1);let f;this.options.extensions.startInline.forEach(k=>{f=k.call({lexer:this},R),typeof f=="number"&&f>=0&&(y=Math.min(y,f))}),y<1/0&&y>=0&&(E=t.substring(0,y+1))}if(S=this.tokenizer.inlineText(E)){t=t.substring(S.raw.length),S.raw.slice(-1)!=="_"&&(a=S.raw.slice(-1)),i=!0;const y=n.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=S.raw,y.text+=S.text):n.push(S);continue}if(t){const y="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return n}},mi=class{constructor(e){de(this,"options");de(this,"parser");this.options=e||Cn}space(e){return""}code({text:e,lang:t,escaped:n}){var i;const r=(i=(t||"").match(We.notSpaceStart))==null?void 0:i[0],o=e.replace(We.endingNewline,"")+`
76
+ `;return r?'<pre><code class="language-'+Et(r)+'">'+(n?o:Et(o,!0))+`</code></pre>
77
+ `:"<pre><code>"+(n?o:Et(o,!0))+`</code></pre>
78
78
  `}blockquote({tokens:e}){return`<blockquote>
79
79
  ${this.parser.parse(e)}</blockquote>
80
80
  `}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
81
81
  `}hr(e){return`<hr>
82
- `}list(e){const t=e.ordered,n=e.start;let r="";for(let a=0;a<e.items.length;a++){const l=e.items[a];r+=this.listitem(l)}const i=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+i+o+`>
83
- `+r+"</"+i+`>
82
+ `}list(e){const t=e.ordered,n=e.start;let r="";for(let a=0;a<e.items.length;a++){const l=e.items[a];r+=this.listitem(l)}const o=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+o+i+`>
83
+ `+r+"</"+o+`>
84
84
  `}listitem(e){var n;let t="";if(e.task){const r=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+Et(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
85
85
  `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
86
- `}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let r="";for(let i=0;i<e.rows.length;i++){const o=e.rows[i];n="";for(let a=0;a<o.length;a++)n+=this.tablecell(o[a]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
86
+ `}table(e){let t="",n="";for(let o=0;o<e.header.length;o++)n+=this.tablecell(e.header[o]);t+=this.tablerow({text:n});let r="";for(let o=0;o<e.rows.length;o++){const i=e.rows[o];n="";for(let a=0;a<i.length;a++)n+=this.tablecell(i[a]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
87
87
  <thead>
88
88
  `+t+`</thead>
89
89
  `+r+`</table>
90
90
  `}tablerow({text:e}){return`<tr>
91
91
  ${e}</tr>
92
92
  `}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
93
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Et(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const r=this.parser.parseInline(n),i=zf(e);if(i===null)return r;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+Et(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const i=zf(e);if(i===null)return Et(n);e=i;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${Et(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Et(e.text)}},Ys=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},_t=class ol{constructor(t){de(this,"options");de(this,"renderer");de(this,"textRenderer");this.options=t||Cn,this.options.renderer=this.options.renderer||new mo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ys}static parse(t,n){return new ol(n).parse(t)}static parseInline(t,n){return new ol(n).parseInline(t)}parse(t,n=!0){var i,o;let r="";for(let a=0;a<t.length;a++){const l=t[a];if((o=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&o[l.type]){const g=l,S=this.options.extensions.renderers[g.type].call({parser:this},g);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(g.type)){r+=S||"";continue}}const d=l;switch(d.type){case"space":{r+=this.renderer.space(d);continue}case"hr":{r+=this.renderer.hr(d);continue}case"heading":{r+=this.renderer.heading(d);continue}case"code":{r+=this.renderer.code(d);continue}case"table":{r+=this.renderer.table(d);continue}case"blockquote":{r+=this.renderer.blockquote(d);continue}case"list":{r+=this.renderer.list(d);continue}case"html":{r+=this.renderer.html(d);continue}case"paragraph":{r+=this.renderer.paragraph(d);continue}case"text":{let g=d,S=this.renderer.text(g);for(;a+1<t.length&&t[a+1].type==="text";)g=t[++a],S+=`
94
- `+this.renderer.text(g);n?r+=this.renderer.paragraph({type:"paragraph",raw:S,text:S,tokens:[{type:"text",raw:S,text:S,escaped:!0}]}):r+=S;continue}default:{const g='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(g),"";throw new Error(g)}}}return r}parseInline(t,n=this.renderer){var i,o;let r="";for(let a=0;a<t.length;a++){const l=t[a];if((o=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&o[l.type]){const g=this.options.extensions.renderers[l.type].call({parser:this},l);if(g!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=g||"";continue}}const d=l;switch(d.type){case"escape":{r+=n.text(d);break}case"html":{r+=n.html(d);break}case"link":{r+=n.link(d);break}case"image":{r+=n.image(d);break}case"strong":{r+=n.strong(d);break}case"em":{r+=n.em(d);break}case"codespan":{r+=n.codespan(d);break}case"br":{r+=n.br(d);break}case"del":{r+=n.del(d);break}case"text":{r+=n.text(d);break}default:{const g='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(g),"";throw new Error(g)}}}return r}},vo=(el=class{constructor(e){de(this,"options");de(this,"block");this.options=e||Cn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Bt.lex:Bt.lexInline}provideParser(){return this.block?_t.parse:_t.parseInline}},de(el,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),el),Sg=class{constructor(...e){de(this,"defaults",Hs());de(this,"options",this.setOptions);de(this,"parse",this.parseMarkdown(!0));de(this,"parseInline",this.parseMarkdown(!1));de(this,"Parser",_t);de(this,"Renderer",mo);de(this,"TextRenderer",Ys);de(this,"Lexer",Bt);de(this,"Tokenizer",go);de(this,"Hooks",vo);this.use(...e)}walkTokens(e,t){var r,i;let n=[];for(const o of e)switch(n=n.concat(t.call(this,o)),o.type){case"table":{const a=o;for(const l of a.header)n=n.concat(this.walkTokens(l.tokens,t));for(const l of a.rows)for(const d of l)n=n.concat(this.walkTokens(d.tokens,t));break}case"list":{const a=o;n=n.concat(this.walkTokens(a.items,t));break}default:{const a=o;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{const d=a[l].flat(1/0);n=n.concat(this.walkTokens(d,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const r=fe({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const o=t.renderers[i.name];o?t.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const o=t[i.level];o?o.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),n.renderer){const i=this.defaults.renderer||new mo(this.defaults);for(const o in n.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;const a=o,l=n.renderer[a],d=i[a];i[a]=(...g)=>{let S=l.apply(i,g);return S===!1&&(S=d.apply(i,g)),S||""}}r.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new go(this.defaults);for(const o in n.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;const a=o,l=n.tokenizer[a],d=i[a];i[a]=(...g)=>{let S=l.apply(i,g);return S===!1&&(S=d.apply(i,g)),S}}r.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new vo;for(const o in n.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;const a=o,l=n.hooks[a],d=i[a];vo.passThroughHooks.has(o)?i[a]=g=>{if(this.defaults.async)return Promise.resolve(l.call(i,g)).then(E=>d.call(i,E));const S=l.call(i,g);return d.call(i,S)}:i[a]=(...g)=>{let S=l.apply(i,g);return S===!1&&(S=d.apply(i,g)),S}}r.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,o=n.walkTokens;r.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults=fe(fe({},this.defaults),r)}),this}setOptions(e){return this.defaults=fe(fe({},this.defaults),e),this}lexer(e,t){return Bt.lex(e,t!=null?t:this.defaults)}parser(e,t){return _t.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(n,r)=>{const i=fe({},r),o=fe(fe({},this.defaults),i),a=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&i.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n=="undefined"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=e);const l=o.hooks?o.hooks.provideLexer():e?Bt.lex:Bt.lexInline,d=o.hooks?o.hooks.provideParser():e?_t.parse:_t.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(n):n).then(g=>l(g,o)).then(g=>o.hooks?o.hooks.processAllTokens(g):g).then(g=>o.walkTokens?Promise.all(this.walkTokens(g,o.walkTokens)).then(()=>g):g).then(g=>d(g,o)).then(g=>o.hooks?o.hooks.postprocess(g):g).catch(a);try{o.hooks&&(n=o.hooks.preprocess(n));let g=l(n,o);o.hooks&&(g=o.hooks.processAllTokens(g)),o.walkTokens&&this.walkTokens(g,o.walkTokens);let S=d(g,o);return o.hooks&&(S=o.hooks.postprocess(S)),S}catch(g){return a(g)}}}onError(e,t){return n=>{if(n.message+=`
95
- Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+Et(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},kn=new Sg;function se(e,t){return kn.parse(e,t)}se.options=se.setOptions=function(e){return kn.setOptions(e),se.defaults=kn.defaults,Of(se.defaults),se},se.getDefaults=Hs,se.defaults=Cn,se.use=function(...e){return kn.use(...e),se.defaults=kn.defaults,Of(se.defaults),se},se.walkTokens=function(e,t){return kn.walkTokens(e,t)},se.parseInline=kn.parseInline,se.Parser=_t,se.parser=_t.parse,se.Renderer=mo,se.TextRenderer=Ys,se.Lexer=Bt,se.lexer=Bt.lex,se.Tokenizer=go,se.Hooks=vo,se.parse=se,se.options,se.setOptions,se.use,se.walkTokens,se.parseInline,_t.parse,Bt.lex;const bg=e=>{if(e instanceof Date)return e;const t=e.endsWith("Z")?e:`${e}Z`;return new Date(t)};function Gf(e){if(!e)return"";const t=bg(e),n=t.getDate().toString().padStart(2,"0"),r=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getFullYear(),o=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");return`${n}/${r}/${i} ${o}:${a}`}const yo=new se.Renderer;yo.link=({href:e,title:t,text:n})=>`<a href="${e}" title="${t||""}" target="_blank" class="nbc-text-blue-500 nbc-hover:underline">${n}</a>`,yo.heading=({depth:e,text:t})=>`<h${e} class="nbc-text-[${1.5-e*.2}rem] nbc-font-bold nbc-mb-2">${t}</h${e}>`;const Cg=({message:e,avatar:t,textColor:n,bubbleUserColor:r})=>e.sender==="user"?G.jsx("div",{className:"nbc-w-full nbc-flex nbc-justify-end nbc-mb-4",children:G.jsxs("div",{className:"nbc-max-w-[90%] nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-bg-gray-100 nbc-text-gray-900 nbc-rounded-br-md",style:{color:n,backgroundColor:r},children:[G.jsx("div",{className:"nbc-break-words",style:{overflowWrap:"anywhere",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:se(e.text,{renderer:yo})}}),G.jsx("div",{className:"nbc-text-xs nbc-mt-1 nbc-opacity-70 nbc-text-right",children:Gf(String(e.timestamp)).split(" ")[1].substring(0,5)})]})}):G.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:G.jsxs("div",{className:"nbc-w-full nbc-flex nbc-items-start nbc-space-x-3",children:[G.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3 nbc-text-black",children:[t?G.jsx("img",{src:t,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}):G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[G.jsx("path",{d:"M12 6V2H8"}),G.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),G.jsx("path",{d:"M2 12h2"}),G.jsx("path",{d:"M9 11v2"}),G.jsx("path",{d:"M15 11v2"}),G.jsx("path",{d:"M20 12h2"})]}),G.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",style:{color:n},children:Gf(String(e.timestamp)).split(" ")[1].substring(0,5)})]}),G.jsx("div",{className:"nbc-max-w-[90%] nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-text-gray-800 nbc-rounded-bl-md",style:{color:n},children:G.jsx("div",{className:"nbc-break-words",style:{overflowWrap:"anywhere",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:se(e.text,{renderer:yo})}})})]})}),kg=({avatar:e})=>G.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:G.jsxs("div",{className:"nbc-flex nbc-items-start nbc-space-x-3",children:[G.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3 nbc-text-black",children:[e?G.jsx("img",{src:e,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}):G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[G.jsx("path",{d:"M12 6V2H8"}),G.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),G.jsx("path",{d:"M2 12h2"}),G.jsx("path",{d:"M9 11v2"}),G.jsx("path",{d:"M15 11v2"}),G.jsx("path",{d:"M20 12h2"})]}),G.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",children:" "})]}),G.jsx("div",{className:"nbc-bg-white nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-rounded-bl-md nbc-shadow-sm",children:G.jsxs("div",{className:"nbc-flex nbc-space-x-1",children:[G.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"0ms"}}),G.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"150ms"}}),G.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"300ms"}})]})})]})}),Wf=({messages:e,isTyping:t,avatar:n,textColor:r,bubbleUserColor:i})=>{const o=te.useRef(null),a=te.useRef(null),l=()=>{a.current&&requestAnimationFrame(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)})};return te.useEffect(()=>{const d=setTimeout(()=>{l()},50);return()=>clearTimeout(d)},[e,t]),G.jsxs("div",{ref:a,className:"nbc-flex-1 nbc-overflow-y-auto nbc-px-2 nbc-pt-4",style:{scrollbarWidth:"thin",scrollbarColor:"#d1d5db #f9fafb",scrollBehavior:"smooth",overscrollBehavior:"contain",position:"relative"},children:[G.jsx("style",{children:`
93
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Et(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const r=this.parser.parseInline(n),o=zf(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+Et(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const o=zf(e);if(o===null)return Et(n);e=o;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${Et(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Et(e.text)}},Ys=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},_t=class il{constructor(t){de(this,"options");de(this,"renderer");de(this,"textRenderer");this.options=t||Cn,this.options.renderer=this.options.renderer||new mi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ys}static parse(t,n){return new il(n).parse(t)}static parseInline(t,n){return new il(n).parseInline(t)}parse(t,n=!0){var o,i;let r="";for(let a=0;a<t.length;a++){const l=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[l.type]){const g=l,S=this.options.extensions.renderers[g.type].call({parser:this},g);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(g.type)){r+=S||"";continue}}const d=l;switch(d.type){case"space":{r+=this.renderer.space(d);continue}case"hr":{r+=this.renderer.hr(d);continue}case"heading":{r+=this.renderer.heading(d);continue}case"code":{r+=this.renderer.code(d);continue}case"table":{r+=this.renderer.table(d);continue}case"blockquote":{r+=this.renderer.blockquote(d);continue}case"list":{r+=this.renderer.list(d);continue}case"html":{r+=this.renderer.html(d);continue}case"paragraph":{r+=this.renderer.paragraph(d);continue}case"text":{let g=d,S=this.renderer.text(g);for(;a+1<t.length&&t[a+1].type==="text";)g=t[++a],S+=`
94
+ `+this.renderer.text(g);n?r+=this.renderer.paragraph({type:"paragraph",raw:S,text:S,tokens:[{type:"text",raw:S,text:S,escaped:!0}]}):r+=S;continue}default:{const g='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(g),"";throw new Error(g)}}}return r}parseInline(t,n=this.renderer){var o,i;let r="";for(let a=0;a<t.length;a++){const l=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[l.type]){const g=this.options.extensions.renderers[l.type].call({parser:this},l);if(g!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=g||"";continue}}const d=l;switch(d.type){case"escape":{r+=n.text(d);break}case"html":{r+=n.html(d);break}case"link":{r+=n.link(d);break}case"image":{r+=n.image(d);break}case"strong":{r+=n.strong(d);break}case"em":{r+=n.em(d);break}case"codespan":{r+=n.codespan(d);break}case"br":{r+=n.br(d);break}case"del":{r+=n.del(d);break}case"text":{r+=n.text(d);break}default:{const g='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(g),"";throw new Error(g)}}}return r}},vi=(el=class{constructor(e){de(this,"options");de(this,"block");this.options=e||Cn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Bt.lex:Bt.lexInline}provideParser(){return this.block?_t.parse:_t.parseInline}},de(el,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),el),Sg=class{constructor(...e){de(this,"defaults",Hs());de(this,"options",this.setOptions);de(this,"parse",this.parseMarkdown(!0));de(this,"parseInline",this.parseMarkdown(!1));de(this,"Parser",_t);de(this,"Renderer",mi);de(this,"TextRenderer",Ys);de(this,"Lexer",Bt);de(this,"Tokenizer",gi);de(this,"Hooks",vi);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(const i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{const a=i;for(const l of a.header)n=n.concat(this.walkTokens(l.tokens,t));for(const l of a.rows)for(const d of l)n=n.concat(this.walkTokens(d.tokens,t));break}case"list":{const a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{const a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{const d=a[l].flat(1/0);n=n.concat(this.walkTokens(d,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const r=fe({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let l=o.renderer.apply(this,a);return l===!1&&(l=i.apply(this,a)),l}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){const o=this.defaults.renderer||new mi(this.defaults);for(const i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const a=i,l=n.renderer[a],d=o[a];o[a]=(...g)=>{let S=l.apply(o,g);return S===!1&&(S=d.apply(o,g)),S||""}}r.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new gi(this.defaults);for(const i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const a=i,l=n.tokenizer[a],d=o[a];o[a]=(...g)=>{let S=l.apply(o,g);return S===!1&&(S=d.apply(o,g)),S}}r.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new vi;for(const i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const a=i,l=n.hooks[a],d=o[a];vi.passThroughHooks.has(i)?o[a]=g=>{if(this.defaults.async)return Promise.resolve(l.call(o,g)).then(E=>d.call(o,E));const S=l.call(o,g);return d.call(o,S)}:o[a]=(...g)=>{let S=l.apply(o,g);return S===!1&&(S=d.apply(o,g)),S}}r.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let l=[];return l.push(i.call(this,a)),o&&(l=l.concat(o.call(this,a))),l}}this.defaults=fe(fe({},this.defaults),r)}),this}setOptions(e){return this.defaults=fe(fe({},this.defaults),e),this}lexer(e,t){return Bt.lex(e,t!=null?t:this.defaults)}parser(e,t){return _t.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(n,r)=>{const o=fe({},r),i=fe(fe({},this.defaults),o),a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&o.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n=="undefined"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);const l=i.hooks?i.hooks.provideLexer():e?Bt.lex:Bt.lexInline,d=i.hooks?i.hooks.provideParser():e?_t.parse:_t.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then(g=>l(g,i)).then(g=>i.hooks?i.hooks.processAllTokens(g):g).then(g=>i.walkTokens?Promise.all(this.walkTokens(g,i.walkTokens)).then(()=>g):g).then(g=>d(g,i)).then(g=>i.hooks?i.hooks.postprocess(g):g).catch(a);try{i.hooks&&(n=i.hooks.preprocess(n));let g=l(n,i);i.hooks&&(g=i.hooks.processAllTokens(g)),i.walkTokens&&this.walkTokens(g,i.walkTokens);let S=d(g,i);return i.hooks&&(S=i.hooks.postprocess(S)),S}catch(g){return a(g)}}}onError(e,t){return n=>{if(n.message+=`
95
+ Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+Et(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},kn=new Sg;function se(e,t){return kn.parse(e,t)}se.options=se.setOptions=function(e){return kn.setOptions(e),se.defaults=kn.defaults,Of(se.defaults),se},se.getDefaults=Hs,se.defaults=Cn,se.use=function(...e){return kn.use(...e),se.defaults=kn.defaults,Of(se.defaults),se},se.walkTokens=function(e,t){return kn.walkTokens(e,t)},se.parseInline=kn.parseInline,se.Parser=_t,se.parser=_t.parse,se.Renderer=mi,se.TextRenderer=Ys,se.Lexer=Bt,se.lexer=Bt.lex,se.Tokenizer=gi,se.Hooks=vi,se.parse=se,se.options,se.setOptions,se.use,se.walkTokens,se.parseInline,_t.parse,Bt.lex;const bg=e=>{if(e instanceof Date)return e;const t=e.endsWith("Z")?e:`${e}Z`;return new Date(t)};function Gf(e){if(!e)return"";const t=bg(e),n=t.getDate().toString().padStart(2,"0"),r=(t.getMonth()+1).toString().padStart(2,"0"),o=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");return`${n}/${r}/${o} ${i}:${a}`}const yi=new se.Renderer;yi.link=({href:e,title:t,text:n})=>`<a href="${e}" title="${t||""}" target="_blank" class="nbc-text-blue-500 nbc-hover:underline">${n}</a>`,yi.heading=({depth:e,text:t})=>`<h${e} class="nbc-text-[${1.5-e*.2}rem] nbc-font-bold nbc-mb-2">${t}</h${e}>`;const Cg=({message:e,avatar:t,textColor:n,bubbleUserColor:r})=>e.sender==="user"?G.jsx("div",{className:"nbc-w-full nbc-flex nbc-justify-end nbc-mb-4",children:G.jsxs("div",{className:"nbc-max-w-[90%] nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-bg-gray-100 nbc-text-gray-900 nbc-rounded-br-md",style:{color:n,backgroundColor:r},children:[G.jsx("div",{className:"nbc-break-words",style:{overflowWrap:"anywhere",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:se(e.text,{renderer:yi})}}),G.jsx("div",{className:"nbc-text-xs nbc-mt-1 nbc-opacity-70 nbc-text-right",children:Gf(String(e.timestamp)).split(" ")[1].substring(0,5)})]})}):G.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:G.jsxs("div",{className:"nbc-w-full nbc-flex nbc-items-start nbc-space-x-3",children:[G.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3 nbc-text-black",children:[t?G.jsx("img",{src:t,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}):G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[G.jsx("path",{d:"M12 6V2H8"}),G.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),G.jsx("path",{d:"M2 12h2"}),G.jsx("path",{d:"M9 11v2"}),G.jsx("path",{d:"M15 11v2"}),G.jsx("path",{d:"M20 12h2"})]}),G.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",style:{color:n},children:Gf(String(e.timestamp)).split(" ")[1].substring(0,5)})]}),G.jsx("div",{className:"nbc-max-w-[90%] nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-text-gray-800 nbc-rounded-bl-md",style:{color:n},children:G.jsx("div",{className:"nbc-break-words",style:{overflowWrap:"anywhere",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:se(e.text,{renderer:yi})}})})]})}),kg=({avatar:e})=>G.jsx("div",{className:"nbc-flex nbc-justify-start nbc-mb-4",children:G.jsxs("div",{className:"nbc-flex nbc-items-start nbc-space-x-3",children:[G.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3 nbc-text-black",children:[e?G.jsx("img",{src:e,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"}):G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[G.jsx("path",{d:"M12 6V2H8"}),G.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),G.jsx("path",{d:"M2 12h2"}),G.jsx("path",{d:"M9 11v2"}),G.jsx("path",{d:"M15 11v2"}),G.jsx("path",{d:"M20 12h2"})]}),G.jsx("div",{className:"nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap",children:" "})]}),G.jsx("div",{className:"nbc-bg-white nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-rounded-bl-md nbc-shadow-sm",children:G.jsxs("div",{className:"nbc-flex nbc-space-x-1",children:[G.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"0ms"}}),G.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"150ms"}}),G.jsx("div",{className:"nbc-w-2 nbc-h-2 nbc-bg-gray-400 nbc-rounded-full nbc-animate-bounce",style:{animationDelay:"300ms"}})]})})]})}),Wf=({messages:e,isTyping:t,avatar:n,textColor:r,bubbleUserColor:o})=>{const i=te.useRef(null),a=te.useRef(null),l=()=>{a.current&&requestAnimationFrame(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)})};return te.useEffect(()=>{const d=setTimeout(()=>{l()},50);return()=>clearTimeout(d)},[e,t]),G.jsxs("div",{ref:a,className:"nbc-flex-1 nbc-overflow-y-auto nbc-px-2 nbc-pt-4",style:{scrollbarWidth:"thin",scrollbarColor:"#d1d5db #f9fafb",scrollBehavior:"smooth",overscrollBehavior:"contain",position:"relative"},children:[G.jsx("style",{children:`
96
96
  .nbc-flex-1::-webkit-scrollbar {
97
97
  width: 6px;
98
98
  }
@@ -114,14 +114,14 @@ Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An err
114
114
  .nbc-flex-1::-webkit-scrollbar-button:vertical:end:increment {
115
115
  display: none;
116
116
  }
117
- `}),e.map(d=>G.jsx(Cg,{message:d,avatar:n,textColor:r,bubbleUserColor:i},d.id)),t&&G.jsx(kg,{avatar:n}),G.jsx("div",{ref:o})]})},$f=({onSendMessage:e,placeholder:t="Escribe un mensaje...",disabled:n=!1,input:r})=>{const[i,o]=te.useState(""),a=d=>{d.preventDefault(),i.trim()&&!n&&(e(i.trim()),o(""))},l=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),i.trim()&&!n&&(e(i.trim()),o("")))};return G.jsx("form",{id:"notchatbot-embed-chat-body-input-form",onSubmit:a,className:"nbc-bg-white nbc-border-t nbc-border-gray-100",style:{backgroundColor:r==null?void 0:r.backgroundColor,borderTop:r!=null&&r.backgroundColor?"none":""},children:G.jsxs("div",{className:"nbc-relative",children:[G.jsx("input",{id:"notchatbot-embed-chat-body-input-form-input",type:"text",value:i,onChange:d=>o(d.target.value),onKeyUp:l,placeholder:t,className:"nbc-w-full nbc-px-4 nbc-pr-12 nbc-text-base nbc-outline-none nbc-text-gray-900 nbc-bg-white nbc-transition-all nbc-duration-200",style:{height:"48px",border:r==null?void 0:r.inputBorder,borderRadius:r==null?void 0:r.inputBorderRadius}}),G.jsx("button",{type:"submit",disabled:!i.trim()||n,className:"nbc-absolute nbc-right-2 nbc-top-1/2 nbc-transform nbc--translate-y-1/2 nbc-w-8 nbc-h-8 nbc-text-gray-500 hover:nbc-text-gray-700 nbc-rounded-full nbc-text-sm nbc-font-medium nbc-transition-all nbc-duration-200 disabled:nbc-opacity-50 disabled:nbc-cursor-not-allowed nbc-border-0 nbc-cursor-pointer nbc-flex nbc-items-center nbc-justify-center hover:nbc-bg-gray-100",style:{color:r==null?void 0:r.iconColor},children:G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:" 24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-5 nbc-h-5",children:[G.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),G.jsx("path",{d:"M22 2 11 13"})]})})]})})},Vf=({avatar:e})=>{const t=[{type:"bot",lines:3,widths:["w-full","w-3/4","w-1/2"]},{type:"user",lines:1,widths:["w-2/3"]},{type:"bot",lines:2,widths:["w-full","w-5/6"]},{type:"user",lines:2,widths:["w-3/4","w-1/2"]}];return G.jsxs("div",{className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-space-y-4 nbc-p-4",children:[t.map((n,r)=>G.jsx("div",{className:`nbc-flex ${n.type==="user"?"nbc-justify-end":"nbc-justify-start"} nbc-mb-4`,children:n.type==="user"?G.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((i,o)=>G.jsx("div",{className:`nbc-h-4 nbc-bg-gray-100 nbc-rounded nbc-animate-pulse ${i}`},o))}):G.jsxs("div",{className:"nbc-w-full nbc-flex nbc-items-start nbc-space-x-3",children:[G.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[e?G.jsx("img",{src:e,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0 nbc-opacity-50"}):G.jsx("div",{className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-bg-gray-300 nbc-animate-pulse"}),G.jsx("div",{className:"nbc-w-10 nbc-h-3 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse nbc-mt-1"})]}),G.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((i,o)=>G.jsx("div",{className:`nbc-h-4 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse ${i}`},o))})]})},r)),G.jsx("div",{className:"nbc-text-center nbc-text-sm nbc-text-gray-500 nbc-animate-pulse",children:"Cargando conversación..."})]})},Rg=({isOpen:e,onClose:t,config:n,messages:r,onSendMessage:i,isLoading:o=!1,isAiTyping:a=!1,position:l,marginBottom:d,marginSide:g,isMobile:S=!1,apiKeyMissing:E=!1})=>{const[y,R]=te.useState(!1),[f,k]=te.useState(!1),T=c=>{i(c)};if(te.useEffect(()=>{e?(k(!0),setTimeout(()=>R(!0),10)):(R(!1),setTimeout(()=>k(!1),300))},[e]),!f)return null;const x=()=>{const c=l||n.position||"bottom-right",u=d||n.marginBottom||16,s=g||n.marginSide||16,C={width:"400px",height:"580px",zIndex:2147483647,bottom:`${u+64+10}px`};return c==="bottom-left"?Ve(fe({},C),{left:`${s}px`}):Ve(fe({},C),{right:`${s}px`})},p=()=>`nbc-fixed nbc-bg-white nbc-rounded-lg nbc-shadow-2xl nbc-flex nbc-flex-col nbc-overflow-hidden nbc-font-sans nbc-transition-all nbc-duration-300 nbc-ease-out ${S?"nbc-inset-0 nbc-w-full nbc-h-full nbc-rounded-none":"nbc-w-auto nbc-h-auto nbc-rounded-lg nbc-inset-auto"} ${y?"nbc-opacity-100 nbc-scale-100 nbc-translate-y-0":"nbc-opacity-0 nbc-scale-95 nbc-translate-y-2"}`,m=()=>S?{zIndex:2147483647}:x(),h=`https://notchatbot.com?utm_source=${typeof window!="undefined"?encodeURIComponent(window.location.hostname):"unknown"}&utm_medium=widget&utm_campaign=WebChat`;return G.jsxs("div",{className:p(),style:m(),children:[G.jsx(_p,{title:n.title||"Chat",onClose:t,primaryColor:n.primaryColor,avatar:n.avatar,closeButtonIcon:n.closeButtonIcon,closeButtonText:n.closeButtonText,closeButtonCustomIcon:n.closeButtonCustomIcon}),E?G.jsx("div",{className:"nbc-flex-1 nbc-flex nbc-items-center nbc-justify-center nbc-min-h-[220px]",children:G.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-gap-2 nbc-text-black nbc-font-medium nbc-text-[15px] nbc-bg-none nbc-shadow-none nbc-p-0 nbc-rounded-none nbc-text-center",children:[G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",viewBox:"0 0 24 24",stroke:"#ef4444",strokeWidth:"2",style:{marginBottom:4},children:[G.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"none"}),G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4m0 4h.01"})]}),"Falta la API Key"]})}):o?G.jsx(Vf,{avatar:n.avatar}):G.jsx(Wf,{messages:r,isTyping:a,avatar:n.avatar}),G.jsxs("div",{className:"nbc-mb-1 nbc-flex nbc-items-end nbc-justify-center nbc-text-xs nbc-text-black",children:[G.jsx("span",{children:"Powered by"})," ",G.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"nbc-font-bold nbc-text-black",children:"NotChatbot"})]}),G.jsx($f,{onSendMessage:T,placeholder:n.placeholder||"Escribe un mensaje...",disabled:a||E})]})},Eg=({initialMessage:e,avatar:t,position:n,marginBottom:r,marginSide:i,primaryColor:o,isMobile:a,isOpen:l})=>{const[d,g]=te.useState(!1),[S,E]=te.useState(!1),[y,R]=te.useState(!1),[f,k]=te.useState(!1),[T,x]=te.useState(!1);te.useEffect(()=>{(()=>{const u="nbc-popover-shown",s=(()=>{if(typeof window!="undefined"&&window.performance)try{const C=window.performance.getEntriesByType("navigation")[0];if(C&&C.type)return C.type==="navigate"||C.type==="reload"}catch(C){console.warn("WebChat: Navigation API not available, defaulting to show popover")}return!0})(),w=(()=>{if(typeof window!="undefined"&&window.performance)try{const C=window.performance.getEntriesByType("navigation")[0];return C&&C.type==="reload"}catch(C){return!1}return!1})();if(w&&sessionStorage.removeItem(u),sessionStorage.getItem(u)&&!w){x(!1);return}s&&e?(x(!0),sessionStorage.setItem(u,"true")):x(!1)})()},[e]),te.useEffect(()=>{l&&k(!1)},[l]),te.useEffect(()=>{if(!l&&e&&!f&&T){const c=setTimeout(()=>{g(!0),setTimeout(()=>{R(!0)},50)},3e3),u=setTimeout(()=>{E(!0),setTimeout(()=>{g(!1),E(!1),R(!1)},500)},11e3);return()=>{clearTimeout(c),clearTimeout(u)}}},[l,e,f,T]);const p=()=>{k(!0),E(!0),setTimeout(()=>{g(!1),E(!1),R(!1)},500)};if(!d||l||!e||f||!T)return null;const m=()=>{const s={zIndex:2147483646,bottom:`${r+64+16}px`,maxWidth:a?"220px":"250px",width:"auto"};return n==="bottom-left"?Ve(fe({},s),{left:`${i}px`}):Ve(fe({},s),{right:`${i}px`})},b=()=>{const c="nbc-transition-all nbc-duration-500 nbc-ease-out";return S?`${c} nbc-opacity-0 nbc-translate-y-3 nbc-scale-90`:y?`${c} nbc-opacity-100 nbc-translate-y-0 nbc-scale-100`:`${c} nbc-opacity-0 nbc-translate-y-[-10px] nbc-scale-95`},h=(c,u=100)=>c.length>u?c.substring(0,u)+"...":c;return G.jsx("div",{className:`nbc-fixed nbc-pointer-events-none ${b()}`,style:m(),children:G.jsxs("div",{className:"nbc-relative",children:[G.jsx("div",{className:"nbc-absolute",style:{left:"50%",top:"-24px",transform:"translateX(-50%)",zIndex:2147483647},children:G.jsx("div",{className:"nbc-w-12 nbc-h-12 nbc-rounded-full nbc-border-3 nbc-border-white nbc-shadow-lg nbc-flex nbc-items-center nbc-justify-center nbc-overflow-hidden nbc-text-black",style:{backgroundColor:o},children:t?G.jsx("img",{src:t,alt:"Assistant",className:"nbc-w-full nbc-h-full nbc-object-cover"}):G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[G.jsx("path",{d:"M12 6V2H8"}),G.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),G.jsx("path",{d:"M2 12h2"}),G.jsx("path",{d:"M9 11v2"}),G.jsx("path",{d:"M15 11v2"}),G.jsx("path",{d:"M20 12h2"})]})})}),G.jsxs("div",{className:"nbc-relative",children:[G.jsxs("div",{className:"nbc-bg-white nbc-h-24 nbc-rounded-2xl nbc-shadow-xl nbc-p-5 nbc-flex nbc-items-center",children:[G.jsx("button",{onClick:p,className:"nbc-absolute nbc-top-2 nbc-right-2 nbc-w-6 nbc-h-6 nbc-rounded-full nbc-flex nbc-items-center nbc-justify-center nbc-transition-colors nbc-duration-200 nbc-pointer-events-auto nbc-cursor-pointer nbc-border-0","aria-label":"Close message",children:G.jsx("svg",{className:"nbc-w-3 nbc-h-3 nbc-text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),G.jsx("div",{className:"nbc-text-gray-800 nbc-text-sm nbc-leading-relaxed nbc-line-clamp-2",children:h(e||"")})]}),G.jsx("div",{className:"nbc-absolute nbc-top-full nbc-w-0 nbc-h-0",style:{left:n==="bottom-left"?"30px":"auto",right:n==="bottom-right"?"30px":"auto",borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:"12px solid white"}})]})]})})};function wt(){const t=Date.now().toString(16).padStart(12,"0"),n=new Uint8Array(10);crypto.getRandomValues(n);const r=Array.from(n).map(o=>o.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),"7"+r.slice(0,3),(parseInt(r.slice(3,4),16)&3|8).toString(16)+r.slice(4,7),r.slice(7,19)].join("-")}function Qf(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Xs(e,t,n={}){const{expires:r,maxAge:i,domain:o,path:a="/",secure:l=window.location.protocol==="https:",sameSite:d="lax"}=n;let g=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;r&&(g+=`; expires=${r.toUTCString()}`),i!==void 0&&(g+=`; max-age=${i}`),o&&(g+=`; domain=${o}`),g+=`; path=${a}`,l&&(g+="; secure"),g+=`; samesite=${d}`,document.cookie=g}function Kf(e){const t=encodeURIComponent(e),n=document.cookie.split(";");for(let r of n)if(r=r.trim(),r.startsWith(t+"="))return decodeURIComponent(r.substring(t.length+1));return null}function Og(e,t={}){Xs(e,"",Ve(fe({},t),{expires:new Date(0)}))}function Jf(){try{const e="__webchat_test__";Xs(e,"test");const t=Kf(e)==="test";return Og(e),t}catch(e){return!1}}const Yf="notchatbot",Tg=24;function Zs(){if(!Jf())return console.warn("WebChat: Cookies not supported, using session-only data"),{conversationId:wt(),conversationStarted:!1};const e=Kf(Yf);if(e)try{const n=JSON.parse(e);if(n&&typeof n=="object"&&typeof n.conversationId=="string"&&typeof n.conversationStarted=="boolean"&&Qf(n.conversationId))return n}catch(n){console.warn("WebChat: Invalid notchatbot cookie format, creating new one")}const t={conversationId:wt(),conversationStarted:!1};return Xf(t),t}function Xf(e){if(!Jf()){console.warn("WebChat: Cookies not supported, cannot save data");return}if(!e||!Qf(e.conversationId))throw new Error("Invalid cookie data: conversationId must be a valid UUIDv7");if(typeof e.conversationStarted!="boolean")throw new Error("Invalid cookie data: conversationStarted must be a boolean");const t=Tg*60*60;Xs(Yf,JSON.stringify(e),{maxAge:t,secure:window.location.protocol==="https:",sameSite:"lax",path:"/"})}function Ag(e){const t=Zs(),n=Ve(fe({},t),{conversationStarted:e});return Xf(n),n}function Zf(){return Zs().conversationId}function qf(){return Zs().conversationStarted}const Ig=()=>{if(typeof window=="undefined")return!1;const t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=window.innerWidth<=768,r="ontouchstart"in window||navigator.maxTouchPoints>0;return t||n&&r},qs=()=>Ig()?"mobile":"desktop",Mg=e=>{if(typeof window=="undefined")return()=>{};let t=qs();const n=()=>{const r=qs();r!==t&&(t=r,e(r))};return window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},wo=e=>{const t=qs(),n=Ve(fe({},e),{position:e.position||"bottom-right",marginBottom:e.marginBottom||16,marginSide:e.marginSide||16}),r=t==="mobile"?e.mobile:e.desktop;return r&&(r.position!==void 0&&(n.position=r.position),r.marginBottom!==void 0&&(n.marginBottom=r.marginBottom),r.marginSide!==void 0&&(n.marginSide=r.marginSide)),n},Pg=e=>{const t=wo(e);return{position:t.position,marginBottom:t.marginBottom,marginSide:t.marginSide}},ed=()=>ot(this,null,function*(){const e=typeof window!="undefined"?sessionStorage.getItem("webchat-session-id"):null;if(e)return e;const t=`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;return typeof window!="undefined"&&sessionStorage.setItem("webchat-session-id",t),t});function Ng(){return typeof window=="undefined"?!1:window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")}function td(){return Ng()?{baseUrl:"http://localhost:3001",chatEndpoint:"http://localhost:3001/api/webchat",conversationEndpoint:"http://localhost:3001/api/webchat/conversation"}:{baseUrl:"https://next.notchatbot.com",chatEndpoint:"https://next.notchatbot.com/api/webchat",conversationEndpoint:"https://next.notchatbot.com/api/webchat/conversation"}}function Lg(){return td().chatEndpoint}function nd(){return td().conversationEndpoint}const Dg=(e,t)=>ot(this,null,function*(){try{const n=nd(),r=yield fetch(`${n}?conversationId=${e}&chatbotUid=${t}`);return r.ok?yield r.json():(console.warn("WebChat: Failed to fetch conversation history:",r.status,r.statusText),null)}catch(n){return console.error("WebChat: Error fetching conversation history:",n),null}}),jg=e=>e.map((t,n)=>{let r;return t.createdAt?r=t.createdAt.endsWith("Z")?t.createdAt:`${t.createdAt}Z`:r=new Date().toISOString(),{id:t.id||(Date.now()+n).toString(),text:t.content||t.text||"",sender:t.role==="user"?"user":"bot",timestamp:r,type:t.type}}),Ug=(e,t)=>e.map(n=>({id:n.id,content:n.text,role:n.sender==="user"?"user":"assistant",type:n.type,createdAt:n.timestamp instanceof Date?n.timestamp.toISOString():n.timestamp,conversationId:t}));var rd={exports:{}};/*!
117
+ `}),e.map(d=>G.jsx(Cg,{message:d,avatar:n,textColor:r,bubbleUserColor:o},d.id)),t&&G.jsx(kg,{avatar:n}),G.jsx("div",{ref:i})]})},$f=({onSendMessage:e,placeholder:t="Escribe un mensaje...",disabled:n=!1,input:r})=>{const[o,i]=te.useState(""),a=d=>{d.preventDefault(),o.trim()&&!n&&(e(o.trim()),i(""))},l=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),o.trim()&&!n&&(e(o.trim()),i("")))};return G.jsx("form",{id:"notchatbot-embed-chat-body-input-form",onSubmit:a,className:"nbc-bg-white nbc-border-t nbc-border-gray-100",style:{backgroundColor:r==null?void 0:r.backgroundColor,borderTop:r!=null&&r.backgroundColor?"none":""},children:G.jsxs("div",{className:"nbc-relative",children:[G.jsx("input",{id:"notchatbot-embed-chat-body-input-form-input",type:"text",value:o,onChange:d=>i(d.target.value),onKeyUp:l,placeholder:t,className:"nbc-w-full nbc-px-4 nbc-pr-12 nbc-text-base nbc-outline-none nbc-text-gray-900 nbc-bg-white nbc-transition-all nbc-duration-200",style:{height:"48px",border:r==null?void 0:r.inputBorder,borderRadius:r==null?void 0:r.inputBorderRadius}}),G.jsx("button",{type:"submit",disabled:!o.trim()||n,className:"nbc-absolute nbc-right-2 nbc-top-1/2 nbc-transform nbc--translate-y-1/2 nbc-w-8 nbc-h-8 nbc-text-gray-500 hover:nbc-text-gray-700 nbc-rounded-full nbc-text-sm nbc-font-medium nbc-transition-all nbc-duration-200 disabled:nbc-opacity-50 disabled:nbc-cursor-not-allowed nbc-border-0 nbc-cursor-pointer nbc-flex nbc-items-center nbc-justify-center hover:nbc-bg-gray-100",style:{color:r==null?void 0:r.iconColor},children:G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:" 24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-5 nbc-h-5",children:[G.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),G.jsx("path",{d:"M22 2 11 13"})]})})]})})},Vf=({avatar:e})=>{const t=[{type:"bot",lines:3,widths:["w-full","w-3/4","w-1/2"]},{type:"user",lines:1,widths:["w-2/3"]},{type:"bot",lines:2,widths:["w-full","w-5/6"]},{type:"user",lines:2,widths:["w-3/4","w-1/2"]}];return G.jsxs("div",{className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-space-y-4 nbc-p-4",children:[t.map((n,r)=>G.jsx("div",{className:`nbc-flex ${n.type==="user"?"nbc-justify-end":"nbc-justify-start"} nbc-mb-4`,children:n.type==="user"?G.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((o,i)=>G.jsx("div",{className:`nbc-h-4 nbc-bg-gray-100 nbc-rounded nbc-animate-pulse ${o}`},i))}):G.jsxs("div",{className:"nbc-w-full nbc-flex nbc-items-start nbc-space-x-3",children:[G.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-py-3",children:[e?G.jsx("img",{src:e,alt:"AI Assistant",className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0 nbc-opacity-50"}):G.jsx("div",{className:"nbc-w-7 nbc-h-7 nbc-rounded-full nbc-bg-gray-300 nbc-animate-pulse"}),G.jsx("div",{className:"nbc-w-10 nbc-h-3 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse nbc-mt-1"})]}),G.jsx("div",{className:"nbc-w-full nbc-max-w-xs nbc-py-3 nbc-space-y-2",children:n.widths.map((o,i)=>G.jsx("div",{className:`nbc-h-4 nbc-bg-gray-200 nbc-rounded nbc-animate-pulse ${o}`},i))})]})},r)),G.jsx("div",{className:"nbc-text-center nbc-text-sm nbc-text-gray-500 nbc-animate-pulse",children:"Cargando conversación..."})]})},Rg=({isOpen:e,onClose:t,config:n,messages:r,onSendMessage:o,isLoading:i=!1,isAiTyping:a=!1,position:l,marginBottom:d,marginSide:g,isMobile:S=!1,apiKeyMissing:E=!1})=>{const[y,R]=te.useState(!1),[f,k]=te.useState(!1),T=c=>{o(c)};if(te.useEffect(()=>{e?(k(!0),setTimeout(()=>R(!0),10)):(R(!1),setTimeout(()=>k(!1),300))},[e]),!f)return null;const x=()=>{const c=l||n.position||"bottom-right",u=d||n.marginBottom||16,s=g||n.marginSide||16,C={width:"400px",height:"580px",zIndex:2147483647,bottom:`${u+64+10}px`};return c==="bottom-left"?Ve(fe({},C),{left:`${s}px`}):Ve(fe({},C),{right:`${s}px`})},p=()=>`nbc-fixed nbc-bg-white nbc-rounded-lg nbc-shadow-2xl nbc-flex nbc-flex-col nbc-overflow-hidden nbc-font-sans nbc-transition-all nbc-duration-300 nbc-ease-out ${S?"nbc-inset-0 nbc-w-full nbc-h-full nbc-rounded-none":"nbc-w-auto nbc-h-auto nbc-rounded-lg nbc-inset-auto"} ${y?"nbc-opacity-100 nbc-scale-100 nbc-translate-y-0":"nbc-opacity-0 nbc-scale-95 nbc-translate-y-2"}`,m=()=>S?{zIndex:2147483647}:x(),h=`https://notchatbot.com?utm_source=${typeof window!="undefined"?encodeURIComponent(window.location.hostname):"unknown"}&utm_medium=widget&utm_campaign=WebChat`;return G.jsxs("div",{className:p(),style:m(),children:[G.jsx(_p,{title:n.title||"Chat",onClose:t,primaryColor:n.primaryColor,avatar:n.avatar,closeButtonIcon:n.closeButtonIcon,closeButtonText:n.closeButtonText,closeButtonCustomIcon:n.closeButtonCustomIcon}),E?G.jsx("div",{className:"nbc-flex-1 nbc-flex nbc-items-center nbc-justify-center nbc-min-h-[220px]",children:G.jsxs("div",{className:"nbc-flex nbc-flex-col nbc-items-center nbc-gap-2 nbc-text-black nbc-font-medium nbc-text-[15px] nbc-bg-none nbc-shadow-none nbc-p-0 nbc-rounded-none nbc-text-center",children:[G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",viewBox:"0 0 24 24",stroke:"#ef4444",strokeWidth:"2",style:{marginBottom:4},children:[G.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"none"}),G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4m0 4h.01"})]}),"Falta la API Key"]})}):i?G.jsx(Vf,{avatar:n.avatar}):G.jsx(Wf,{messages:r,isTyping:a,avatar:n.avatar}),G.jsxs("div",{className:"nbc-mb-1 nbc-flex nbc-items-end nbc-justify-center nbc-text-xs nbc-text-black",children:[G.jsx("span",{children:"Powered by"})," ",G.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"nbc-font-bold nbc-text-black",children:"NotChatbot"})]}),G.jsx($f,{onSendMessage:T,placeholder:n.placeholder||"Escribe un mensaje...",disabled:a||E})]})},Eg=({initialMessage:e,avatar:t,position:n,marginBottom:r,marginSide:o,primaryColor:i,isMobile:a,isOpen:l})=>{const[d,g]=te.useState(!1),[S,E]=te.useState(!1),[y,R]=te.useState(!1),[f,k]=te.useState(!1),[T,x]=te.useState(!1);te.useEffect(()=>{(()=>{const u="nbc-popover-shown",s=(()=>{if(typeof window!="undefined"&&window.performance)try{const C=window.performance.getEntriesByType("navigation")[0];if(C&&C.type)return C.type==="navigate"||C.type==="reload"}catch(C){console.warn("WebChat: Navigation API not available, defaulting to show popover")}return!0})(),w=(()=>{if(typeof window!="undefined"&&window.performance)try{const C=window.performance.getEntriesByType("navigation")[0];return C&&C.type==="reload"}catch(C){return!1}return!1})();if(w&&sessionStorage.removeItem(u),sessionStorage.getItem(u)&&!w){x(!1);return}s&&e?(x(!0),sessionStorage.setItem(u,"true")):x(!1)})()},[e]),te.useEffect(()=>{l&&k(!1)},[l]),te.useEffect(()=>{if(!l&&e&&!f&&T){const c=setTimeout(()=>{g(!0),setTimeout(()=>{R(!0)},50)},3e3),u=setTimeout(()=>{E(!0),setTimeout(()=>{g(!1),E(!1),R(!1)},500)},11e3);return()=>{clearTimeout(c),clearTimeout(u)}}},[l,e,f,T]);const p=()=>{k(!0),E(!0),setTimeout(()=>{g(!1),E(!1),R(!1)},500)};if(!d||l||!e||f||!T)return null;const m=()=>{const s={zIndex:2147483646,bottom:`${r+64+16}px`,maxWidth:a?"220px":"250px",width:"auto"};return n==="bottom-left"?Ve(fe({},s),{left:`${o}px`}):Ve(fe({},s),{right:`${o}px`})},b=()=>{const c="nbc-transition-all nbc-duration-500 nbc-ease-out";return S?`${c} nbc-opacity-0 nbc-translate-y-3 nbc-scale-90`:y?`${c} nbc-opacity-100 nbc-translate-y-0 nbc-scale-100`:`${c} nbc-opacity-0 nbc-translate-y-[-10px] nbc-scale-95`},h=(c,u=100)=>c.length>u?c.substring(0,u)+"...":c;return G.jsx("div",{className:`nbc-fixed nbc-pointer-events-none ${b()}`,style:m(),children:G.jsxs("div",{className:"nbc-relative",children:[G.jsx("div",{className:"nbc-absolute",style:{left:"50%",top:"-24px",transform:"translateX(-50%)",zIndex:2147483647},children:G.jsx("div",{className:"nbc-w-12 nbc-h-12 nbc-rounded-full nbc-border-3 nbc-border-white nbc-shadow-lg nbc-flex nbc-items-center nbc-justify-center nbc-overflow-hidden nbc-text-black",style:{backgroundColor:i},children:t?G.jsx("img",{src:t,alt:"Assistant",className:"nbc-w-full nbc-h-full nbc-object-cover"}):G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[G.jsx("path",{d:"M12 6V2H8"}),G.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),G.jsx("path",{d:"M2 12h2"}),G.jsx("path",{d:"M9 11v2"}),G.jsx("path",{d:"M15 11v2"}),G.jsx("path",{d:"M20 12h2"})]})})}),G.jsxs("div",{className:"nbc-relative",children:[G.jsxs("div",{className:"nbc-bg-white nbc-h-24 nbc-rounded-2xl nbc-shadow-xl nbc-p-5 nbc-flex nbc-items-center",children:[G.jsx("button",{onClick:p,className:"nbc-absolute nbc-top-2 nbc-right-2 nbc-w-6 nbc-h-6 nbc-rounded-full nbc-flex nbc-items-center nbc-justify-center nbc-transition-colors nbc-duration-200 nbc-pointer-events-auto nbc-cursor-pointer nbc-border-0","aria-label":"Close message",children:G.jsx("svg",{className:"nbc-w-3 nbc-h-3 nbc-text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:G.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),G.jsx("div",{className:"nbc-text-gray-800 nbc-text-sm nbc-leading-relaxed nbc-line-clamp-2",children:h(e||"")})]}),G.jsx("div",{className:"nbc-absolute nbc-top-full nbc-w-0 nbc-h-0",style:{left:n==="bottom-left"?"30px":"auto",right:n==="bottom-right"?"30px":"auto",borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:"12px solid white"}})]})]})})};function wt(){const t=Date.now().toString(16).padStart(12,"0"),n=new Uint8Array(10);crypto.getRandomValues(n);const r=Array.from(n).map(i=>i.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),"7"+r.slice(0,3),(parseInt(r.slice(3,4),16)&3|8).toString(16)+r.slice(4,7),r.slice(7,19)].join("-")}function Qf(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Xs(e,t,n={}){const{expires:r,maxAge:o,domain:i,path:a="/",secure:l=window.location.protocol==="https:",sameSite:d="lax"}=n;let g=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;r&&(g+=`; expires=${r.toUTCString()}`),o!==void 0&&(g+=`; max-age=${o}`),i&&(g+=`; domain=${i}`),g+=`; path=${a}`,l&&(g+="; secure"),g+=`; samesite=${d}`,document.cookie=g}function Kf(e){const t=encodeURIComponent(e),n=document.cookie.split(";");for(let r of n)if(r=r.trim(),r.startsWith(t+"="))return decodeURIComponent(r.substring(t.length+1));return null}function Og(e,t={}){Xs(e,"",Ve(fe({},t),{expires:new Date(0)}))}function Jf(){try{const e="__webchat_test__";Xs(e,"test");const t=Kf(e)==="test";return Og(e),t}catch(e){return!1}}const Yf="notchatbot",Tg=24;function Zs(){if(!Jf())return console.warn("WebChat: Cookies not supported, using session-only data"),{conversationId:wt(),conversationStarted:!1};const e=Kf(Yf);if(e)try{const n=JSON.parse(e);if(n&&typeof n=="object"&&typeof n.conversationId=="string"&&typeof n.conversationStarted=="boolean"&&Qf(n.conversationId))return n}catch(n){console.warn("WebChat: Invalid notchatbot cookie format, creating new one")}const t={conversationId:wt(),conversationStarted:!1};return Xf(t),t}function Xf(e){if(!Jf()){console.warn("WebChat: Cookies not supported, cannot save data");return}if(!e||!Qf(e.conversationId))throw new Error("Invalid cookie data: conversationId must be a valid UUIDv7");if(typeof e.conversationStarted!="boolean")throw new Error("Invalid cookie data: conversationStarted must be a boolean");const t=Tg*60*60;Xs(Yf,JSON.stringify(e),{maxAge:t,secure:window.location.protocol==="https:",sameSite:"lax",path:"/"})}function Ag(e){const t=Zs(),n=Ve(fe({},t),{conversationStarted:e});return Xf(n),n}function Zf(){return Zs().conversationId}function qf(){return Zs().conversationStarted}const Ig=()=>{if(typeof window=="undefined")return!1;const t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=window.innerWidth<=768,r="ontouchstart"in window||navigator.maxTouchPoints>0;return t||n&&r},qs=()=>Ig()?"mobile":"desktop",Pg=e=>{if(typeof window=="undefined")return()=>{};let t=qs();const n=()=>{const r=qs();r!==t&&(t=r,e(r))};return window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},wi=e=>{const t=qs(),n=Ve(fe({},e),{position:e.position||"bottom-right",marginBottom:e.marginBottom||16,marginSide:e.marginSide||16,showPopup:e.showPopup!==void 0?e.showPopup:!0}),r=t==="mobile"?e.mobile:e.desktop;return r&&(r.position!==void 0&&(n.position=r.position),r.marginBottom!==void 0&&(n.marginBottom=r.marginBottom),r.marginSide!==void 0&&(n.marginSide=r.marginSide),r.showPopup!==void 0&&(n.showPopup=r.showPopup)),n},Mg=e=>{const t=wi(e);return{position:t.position,marginBottom:t.marginBottom,marginSide:t.marginSide,showPopup:t.showPopup}},ed=()=>it(this,null,function*(){const e=typeof window!="undefined"?sessionStorage.getItem("webchat-session-id"):null;if(e)return e;const t=`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;return typeof window!="undefined"&&sessionStorage.setItem("webchat-session-id",t),t});function Ng(){return typeof window=="undefined"?!1:window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.includes("localhost")}function td(){return Ng()?{baseUrl:"http://localhost:3001",chatEndpoint:"http://localhost:3001/api/webchat",conversationEndpoint:"http://localhost:3001/api/webchat/conversation"}:{baseUrl:"https://next.notchatbot.com",chatEndpoint:"https://next.notchatbot.com/api/webchat",conversationEndpoint:"https://next.notchatbot.com/api/webchat/conversation"}}function Lg(){return td().chatEndpoint}function nd(){return td().conversationEndpoint}const Dg=(e,t)=>it(this,null,function*(){try{const n=nd(),r=yield fetch(`${n}?conversationId=${e}&chatbotUid=${t}`);return r.ok?yield r.json():(console.warn("WebChat: Failed to fetch conversation history:",r.status,r.statusText),null)}catch(n){return console.error("WebChat: Error fetching conversation history:",n),null}}),jg=e=>e.map((t,n)=>{let r;return t.createdAt?r=t.createdAt.endsWith("Z")?t.createdAt:`${t.createdAt}Z`:r=new Date().toISOString(),{id:t.id||(Date.now()+n).toString(),text:t.content||t.text||"",sender:t.role==="user"?"user":"bot",timestamp:r,type:t.type}}),Ug=(e,t)=>e.map(n=>({id:n.id,content:n.text,role:n.sender==="user"?"user":"assistant",type:n.type,createdAt:n.timestamp instanceof Date?n.timestamp.toISOString():n.timestamp,conversationId:t}));var rd={exports:{}};/*!
118
118
  * @license Copyright 2015-2022 Ably Real-time Ltd (ably.com)
119
119
  *
120
120
  * Ably JavaScript Library v1.2.50
121
121
  * https://github.com/ably/ably-js
122
122
  *
123
123
  * Released under the Apache Licence v2.0
124
- */(function(e,t){(function(r,i){e.exports=i()})(window,function(){return function(n){var r={};function i(o){if(r[o])return r[o].exports;var a=r[o]={i:o,l:!1,exports:{}};return n[o].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return i.m=n,i.c=r,i.d=function(o,a,l){i.o(o,a)||Object.defineProperty(o,a,{enumerable:!0,get:l})},i.r=function(o){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},i.t=function(o,a){if(a&1&&(o=i(o)),a&8||a&4&&typeof o=="object"&&o&&o.__esModule)return o;var l=Object.create(null);if(i.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:o}),a&2&&typeof o!="string")for(var d in o)i.d(l,d,function(g){return o[g]}.bind(null,d));return l},i.n=function(o){var a=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(a,"a",a),a},i.o=function(o,a){return Object.prototype.hasOwnProperty.call(o,a)},i.p="",i(i.s=42)}([function(n,r,i){i.r(r),i.d(r,"__extends",function(){return a}),i.d(r,"__assign",function(){return l}),i.d(r,"__rest",function(){return d}),i.d(r,"__decorate",function(){return g}),i.d(r,"__param",function(){return S}),i.d(r,"__metadata",function(){return E}),i.d(r,"__awaiter",function(){return y}),i.d(r,"__generator",function(){return R}),i.d(r,"__createBinding",function(){return f}),i.d(r,"__exportStar",function(){return k}),i.d(r,"__values",function(){return T}),i.d(r,"__read",function(){return x}),i.d(r,"__spread",function(){return p}),i.d(r,"__spreadArrays",function(){return m}),i.d(r,"__spreadArray",function(){return b}),i.d(r,"__await",function(){return h}),i.d(r,"__asyncGenerator",function(){return c}),i.d(r,"__asyncDelegator",function(){return u}),i.d(r,"__asyncValues",function(){return s}),i.d(r,"__makeTemplateObject",function(){return w}),i.d(r,"__importStar",function(){return C}),i.d(r,"__importDefault",function(){return L}),i.d(r,"__classPrivateFieldGet",function(){return N}),i.d(r,"__classPrivateFieldSet",function(){return P});/*! *****************************************************************************
124
+ */(function(e,t){(function(r,o){e.exports=o()})(window,function(){return function(n){var r={};function o(i){if(r[i])return r[i].exports;var a=r[i]={i,l:!1,exports:{}};return n[i].call(a.exports,a,a.exports,o),a.l=!0,a.exports}return o.m=n,o.c=r,o.d=function(i,a,l){o.o(i,a)||Object.defineProperty(i,a,{enumerable:!0,get:l})},o.r=function(i){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},o.t=function(i,a){if(a&1&&(i=o(i)),a&8||a&4&&typeof i=="object"&&i&&i.__esModule)return i;var l=Object.create(null);if(o.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:i}),a&2&&typeof i!="string")for(var d in i)o.d(l,d,function(g){return i[g]}.bind(null,d));return l},o.n=function(i){var a=i&&i.__esModule?function(){return i.default}:function(){return i};return o.d(a,"a",a),a},o.o=function(i,a){return Object.prototype.hasOwnProperty.call(i,a)},o.p="",o(o.s=42)}([function(n,r,o){o.r(r),o.d(r,"__extends",function(){return a}),o.d(r,"__assign",function(){return l}),o.d(r,"__rest",function(){return d}),o.d(r,"__decorate",function(){return g}),o.d(r,"__param",function(){return S}),o.d(r,"__metadata",function(){return E}),o.d(r,"__awaiter",function(){return y}),o.d(r,"__generator",function(){return R}),o.d(r,"__createBinding",function(){return f}),o.d(r,"__exportStar",function(){return k}),o.d(r,"__values",function(){return T}),o.d(r,"__read",function(){return x}),o.d(r,"__spread",function(){return p}),o.d(r,"__spreadArrays",function(){return m}),o.d(r,"__spreadArray",function(){return b}),o.d(r,"__await",function(){return h}),o.d(r,"__asyncGenerator",function(){return c}),o.d(r,"__asyncDelegator",function(){return u}),o.d(r,"__asyncValues",function(){return s}),o.d(r,"__makeTemplateObject",function(){return w}),o.d(r,"__importStar",function(){return C}),o.d(r,"__importDefault",function(){return L}),o.d(r,"__classPrivateFieldGet",function(){return N}),o.d(r,"__classPrivateFieldSet",function(){return M});/*! *****************************************************************************
125
125
  Copyright (c) Microsoft Corporation.
126
126
 
127
127
  Permission to use, copy, modify, and/or distribute this software for any
@@ -134,16 +134,16 @@ Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An err
134
134
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
135
135
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
136
136
  PERFORMANCE OF THIS SOFTWARE.
137
- ***************************************************************************** */var o=function(I,M){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,j){A.__proto__=j}||function(A,j){for(var U in j)Object.prototype.hasOwnProperty.call(j,U)&&(A[U]=j[U])},o(I,M)};function a(I,M){if(typeof M!="function"&&M!==null)throw new TypeError("Class extends value "+String(M)+" is not a constructor or null");o(I,M);function A(){this.constructor=I}I.prototype=M===null?Object.create(M):(A.prototype=M.prototype,new A)}var l=function(){return l=Object.assign||function(M){for(var A,j=1,U=arguments.length;j<U;j++){A=arguments[j];for(var z in A)Object.prototype.hasOwnProperty.call(A,z)&&(M[z]=A[z])}return M},l.apply(this,arguments)};function d(I,M){var A={};for(var j in I)Object.prototype.hasOwnProperty.call(I,j)&&M.indexOf(j)<0&&(A[j]=I[j]);if(I!=null&&typeof Object.getOwnPropertySymbols=="function")for(var U=0,j=Object.getOwnPropertySymbols(I);U<j.length;U++)M.indexOf(j[U])<0&&Object.prototype.propertyIsEnumerable.call(I,j[U])&&(A[j[U]]=I[j[U]]);return A}function g(I,M,A,j){var U=arguments.length,z=U<3?M:j===null?j=Object.getOwnPropertyDescriptor(M,A):j,$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(I,M,A,j);else for(var W=I.length-1;W>=0;W--)($=I[W])&&(z=(U<3?$(z):U>3?$(M,A,z):$(M,A))||z);return U>3&&z&&Object.defineProperty(M,A,z),z}function S(I,M){return function(A,j){M(A,j,I)}}function E(I,M){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(I,M)}function y(I,M,A,j){function U(z){return z instanceof A?z:new A(function($){$(z)})}return new(A||(A=Promise))(function(z,$){function W(D){try{O(j.next(D))}catch(B){$(B)}}function F(D){try{O(j.throw(D))}catch(B){$(B)}}function O(D){D.done?z(D.value):U(D.value).then(W,F)}O((j=j.apply(I,M||[])).next())})}function R(I,M){var A={label:0,sent:function(){if(z[0]&1)throw z[1];return z[1]},trys:[],ops:[]},j,U,z,$;return $={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&($[Symbol.iterator]=function(){return this}),$;function W(O){return function(D){return F([O,D])}}function F(O){if(j)throw new TypeError("Generator is already executing.");for(;A;)try{if(j=1,U&&(z=O[0]&2?U.return:O[0]?U.throw||((z=U.return)&&z.call(U),0):U.next)&&!(z=z.call(U,O[1])).done)return z;switch(U=0,z&&(O=[O[0]&2,z.value]),O[0]){case 0:case 1:z=O;break;case 4:return A.label++,{value:O[1],done:!1};case 5:A.label++,U=O[1],O=[0];continue;case 7:O=A.ops.pop(),A.trys.pop();continue;default:if(z=A.trys,!(z=z.length>0&&z[z.length-1])&&(O[0]===6||O[0]===2)){A=0;continue}if(O[0]===3&&(!z||O[1]>z[0]&&O[1]<z[3])){A.label=O[1];break}if(O[0]===6&&A.label<z[1]){A.label=z[1],z=O;break}if(z&&A.label<z[2]){A.label=z[2],A.ops.push(O);break}z[2]&&A.ops.pop(),A.trys.pop();continue}O=M.call(I,A)}catch(D){O=[6,D],U=0}finally{j=z=0}if(O[0]&5)throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}}var f=Object.create?function(I,M,A,j){j===void 0&&(j=A),Object.defineProperty(I,j,{enumerable:!0,get:function(){return M[A]}})}:function(I,M,A,j){j===void 0&&(j=A),I[j]=M[A]};function k(I,M){for(var A in I)A!=="default"&&!Object.prototype.hasOwnProperty.call(M,A)&&f(M,I,A)}function T(I){var M=typeof Symbol=="function"&&Symbol.iterator,A=M&&I[M],j=0;if(A)return A.call(I);if(I&&typeof I.length=="number")return{next:function(){return I&&j>=I.length&&(I=void 0),{value:I&&I[j++],done:!I}}};throw new TypeError(M?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(I,M){var A=typeof Symbol=="function"&&I[Symbol.iterator];if(!A)return I;var j=A.call(I),U,z=[],$;try{for(;(M===void 0||M-- >0)&&!(U=j.next()).done;)z.push(U.value)}catch(W){$={error:W}}finally{try{U&&!U.done&&(A=j.return)&&A.call(j)}finally{if($)throw $.error}}return z}function p(){for(var I=[],M=0;M<arguments.length;M++)I=I.concat(x(arguments[M]));return I}function m(){for(var I=0,M=0,A=arguments.length;M<A;M++)I+=arguments[M].length;for(var j=Array(I),U=0,M=0;M<A;M++)for(var z=arguments[M],$=0,W=z.length;$<W;$++,U++)j[U]=z[$];return j}function b(I,M,A){if(A||arguments.length===2)for(var j=0,U=M.length,z;j<U;j++)(z||!(j in M))&&(z||(z=Array.prototype.slice.call(M,0,j)),z[j]=M[j]);return I.concat(z||Array.prototype.slice.call(M))}function h(I){return this instanceof h?(this.v=I,this):new h(I)}function c(I,M,A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var j=A.apply(I,M||[]),U,z=[];return U={},$("next"),$("throw"),$("return"),U[Symbol.asyncIterator]=function(){return this},U;function $(_){j[_]&&(U[_]=function(V){return new Promise(function(Y,X){z.push([_,V,Y,X])>1||W(_,V)})})}function W(_,V){try{F(j[_](V))}catch(Y){B(z[0][3],Y)}}function F(_){_.value instanceof h?Promise.resolve(_.value.v).then(O,D):B(z[0][2],_)}function O(_){W("next",_)}function D(_){W("throw",_)}function B(_,V){_(V),z.shift(),z.length&&W(z[0][0],z[0][1])}}function u(I){var M,A;return M={},j("next"),j("throw",function(U){throw U}),j("return"),M[Symbol.iterator]=function(){return this},M;function j(U,z){M[U]=I[U]?function($){return(A=!A)?{value:h(I[U]($)),done:U==="return"}:z?z($):$}:z}}function s(I){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var M=I[Symbol.asyncIterator],A;return M?M.call(I):(I=typeof T=="function"?T(I):I[Symbol.iterator](),A={},j("next"),j("throw"),j("return"),A[Symbol.asyncIterator]=function(){return this},A);function j(z){A[z]=I[z]&&function($){return new Promise(function(W,F){$=I[z]($),U(W,F,$.done,$.value)})}}function U(z,$,W,F){Promise.resolve(F).then(function(O){z({value:O,done:W})},$)}}function w(I,M){return Object.defineProperty?Object.defineProperty(I,"raw",{value:M}):I.raw=M,I}var v=Object.create?function(I,M){Object.defineProperty(I,"default",{enumerable:!0,value:M})}:function(I,M){I.default=M};function C(I){if(I&&I.__esModule)return I;var M={};if(I!=null)for(var A in I)A!=="default"&&Object.prototype.hasOwnProperty.call(I,A)&&f(M,I,A);return v(M,I),M}function L(I){return I&&I.__esModule?I:{default:I}}function N(I,M,A,j){if(A==="a"&&!j)throw new TypeError("Private accessor was defined without a getter");if(typeof M=="function"?I!==M||!j:!M.has(I))throw new TypeError("Cannot read private member from an object whose class did not declare it");return A==="m"?j:A==="a"?j.call(I):j?j.value:M.get(I)}function P(I,M,A,j,U){if(j==="m")throw new TypeError("Private method is not writable");if(j==="a"&&!U)throw new TypeError("Private accessor was defined without a setter");if(typeof M=="function"?I!==M||!U:!M.has(I))throw new TypeError("Cannot write private member to an object whose class did not declare it");return j==="a"?U.call(I,A):U?U.value=A:M.set(I,A),A}},function(n,r,i){(function(o){Object.defineProperty(r,"__esModule",{value:!0}),r.allToUpperCase=r.allToLowerCase=r.encodeBody=r.decodeBody=r.Format=r.promisify=r.trim=r.arrChooseN=r.randomHexString=r.randomString=r.cheapRandStr=r.dataSizeBytes=r.inspectBody=r.inspectError=r.isErrorInfoOrPartialErrorInfo=r.now=r.parseQueryString=r.toQueryString=r.arrPopRandomElement=r.defaultPostHeaders=r.defaultGetHeaders=r.allSame=r.arrEvery=r.arrFilter=r.arrMap=r.safeArrForEach=r.arrForEach=r.forInOwnNonNullProperties=r.valuesArray=r.keysArray=r.arrWithoutValue=r.arrDeleteValue=r.arrIn=r.arrIndexOf=r.arrSubtract=r.arrIntersectOb=r.arrIntersect=r.intersect=r.containsValue=r.inherits=r.prototypicalClone=r.shallowClone=r.isEmptyArg=r.isOnlyPropIn=r.isEmpty=r.isObject=r.ensureArray=r.isArray=r.copy=r.mixin=void 0,r.arrEquals=r.toBase64=r.matchDerivedChannel=r.shallowEquals=r.getGlobalObject=r.getRetryTime=r.getJitterCoefficient=r.getBackoffCoefficient=void 0;var a=i(0),l=a.__importDefault(i(3)),d=a.__importStar(i(8)),g=a.__importDefault(i(4)),S=i(11),E=i(31);function y(H){return Math.floor(Math.random()*H.length)}function R(H){for(var Q=[],K=1;K<arguments.length;K++)Q[K-1]=arguments[K];for(var ee=0;ee<Q.length;ee++){var oe=Q[ee];if(!oe)break;var Ze=Object.prototype.hasOwnProperty;for(var Kr in oe)(!Ze||Ze.call(oe,Kr))&&(H[Kr]=oe[Kr])}return H}r.mixin=R;function f(H){return R({},H)}r.copy=f,r.isArray=Array.isArray||function(H){return Object.prototype.toString.call(H)=="[object Array]"};function k(H){return m(H)?[]:(0,r.isArray)(H)?H:[H]}r.ensureArray=k;function T(H){return Object.prototype.toString.call(H)=="[object Object]"}r.isObject=T;function x(H){for(var Q in H)return!1;return!0}r.isEmpty=x;function p(H,Q){for(var K in H)if(K!==Q)return!1;return!0}r.isOnlyPropIn=p;function m(H){return H==null}r.isEmptyArg=m;function b(H){var Q=new Object;for(var K in H)Q[K]=H[K];return Q}r.shallowClone=b;function h(H,Q){var K=function(){function oe(){}return oe}();K.prototype=H;var ee=new K;return Q&&R(ee,Q),ee}r.prototypicalClone=h;var c=function(H,Q){if(l.default.Config.inherits){l.default.Config.inherits(H,Q);return}H.super_=Q,H.prototype=h(Q.prototype,{constructor:H})};r.inherits=c;function u(H,Q){for(var K in H)if(H[K]==Q)return!0;return!1}r.containsValue=u;function s(H,Q){return(0,r.isArray)(Q)?w(H,Q):v(H,Q)}r.intersect=s;function w(H,Q){for(var K=[],ee=0;ee<H.length;ee++){var oe=H[ee];(0,r.arrIndexOf)(Q,oe)!=-1&&K.push(oe)}return K}r.arrIntersect=w;function v(H,Q){for(var K=[],ee=0;ee<H.length;ee++){var oe=H[ee];oe in Q&&K.push(oe)}return K}r.arrIntersectOb=v;function C(H,Q){for(var K=[],ee=0;ee<H.length;ee++){var oe=H[ee];(0,r.arrIndexOf)(Q,oe)==-1&&K.push(oe)}return K}r.arrSubtract=C,r.arrIndexOf=Array.prototype.indexOf?function(H,Q,K){return H.indexOf(Q,K)}:function(H,Q,K){K=K||0;for(var ee=H.length;K<ee;K++)if(H[K]===Q)return K;return-1};function L(H,Q){return(0,r.arrIndexOf)(H,Q)!==-1}r.arrIn=L;function N(H,Q){var K=(0,r.arrIndexOf)(H,Q),ee=K!=-1;return ee&&H.splice(K,1),ee}r.arrDeleteValue=N;function P(H,Q){var K=H.slice();return N(K,Q),K}r.arrWithoutValue=P;function I(H,Q){var K=[];for(var ee in H)Q&&!Object.prototype.hasOwnProperty.call(H,ee)||K.push(ee);return K}r.keysArray=I;function M(H,Q){var K=[];for(var ee in H)Q&&!Object.prototype.hasOwnProperty.call(H,ee)||K.push(H[ee]);return K}r.valuesArray=M;function A(H,Q){for(var K in H)Object.prototype.hasOwnProperty.call(H,K)&&H[K]&&Q(K)}r.forInOwnNonNullProperties=A,r.arrForEach=Array.prototype.forEach?function(H,Q){H.forEach(Q)}:function(H,Q){for(var K=H.length,ee=0;ee<K;ee++)Q(H[ee],ee,H)};function j(H,Q){return(0,r.arrForEach)(H.slice(),Q)}r.safeArrForEach=j,r.arrMap=Array.prototype.map?function(H,Q){return H.map(Q)}:function(H,Q){for(var K=[],ee=H.length,oe=0;oe<ee;oe++)K.push(Q(H[oe],oe,H));return K},r.arrFilter=Array.prototype.filter?function(H,Q){return H.filter(Q)}:function(H,Q){for(var K=[],ee=H.length,oe=0;oe<ee;oe++)Q(H[oe])&&K.push(H[oe]);return K},r.arrEvery=Array.prototype.every?function(H,Q){return H.every(Q)}:function(H,Q){for(var K=H.length,ee=0;ee<K;ee++)if(!Q(H[ee],ee,H))return!1;return!0};function U(H,Q){if(H.length===0)return!0;var K=H[0][Q];return(0,r.arrEvery)(H,function(ee){return ee[Q]===K})}r.allSame=U;var z={json:"application/json",jsonp:"application/javascript",xml:"application/xml",html:"text/html",msgpack:"application/x-msgpack"};function $(H,Q){var K=z[Q||ye.json];return{accept:K,"X-Ably-Version":d.default.protocolVersion.toString(),"Ably-Agent":(0,d.getAgentString)(H)}}r.defaultGetHeaders=$;function W(H,Q){var K,ee=K=z[Q||ye.json];return{accept:ee,"content-type":K,"X-Ably-Version":d.default.protocolVersion.toString(),"Ably-Agent":(0,d.getAgentString)(H)}}r.defaultPostHeaders=W;function F(H){return H.splice(y(H),1)[0]}r.arrPopRandomElement=F;function O(H){var Q=[];if(H)for(var K in H)Q.push(encodeURIComponent(K)+"="+encodeURIComponent(H[K]));return Q.length?"?"+Q.join("&"):""}r.toQueryString=O;function D(H){for(var Q,K=/([^?&=]+)=?([^&]*)/g,ee={};Q=K.exec(H);)ee[decodeURIComponent(Q[1])]=decodeURIComponent(Q[2]);return ee}r.parseQueryString=D,r.now=Date.now||function(){return new Date().getTime()};function B(H){return typeof H=="object"&&H!==null&&(H.constructor.name=="ErrorInfo"||H.constructor.name=="PartialErrorInfo")}r.isErrorInfoOrPartialErrorInfo=B;function _(H){var Q,K;return H instanceof Error||((Q=H==null?void 0:H.constructor)===null||Q===void 0?void 0:Q.name)==="ErrorInfo"||((K=H==null?void 0:H.constructor)===null||K===void 0?void 0:K.name)==="PartialErrorInfo"?H.toString():l.default.Config.inspect(H)}r.inspectError=_;function V(H){return l.default.BufferUtils.isBuffer(H)?H.toString():typeof H=="string"?H:l.default.Config.inspect(H)}r.inspectBody=V;function Y(H){if(l.default.BufferUtils.isBuffer(H))return l.default.BufferUtils.byteLength(H);if(typeof H=="string")return l.default.Config.stringByteSize(H);throw new Error("Expected input of Utils.dataSizeBytes to be a buffer or string, but was: "+typeof H)}r.dataSizeBytes=Y;function X(){return String(Math.random()).substr(2)}r.cheapRandStr=X;var ne=function(H){if(l.default.Config.getRandomValues&&typeof Uint8Array!="undefined"){var Q=new Uint8Array(H);return l.default.Config.getRandomValues(Q),l.default.BufferUtils.base64Encode(Q)}for(var K=l.default.BufferUtils.base64CharSet,ee=Math.round(H*4/3),oe="",Ze=0;Ze<ee;Ze++)oe+=K[y(K)];return oe};r.randomString=ne;var re=function(H){if(l.default.Config.getRandomValues&&typeof Uint8Array!="undefined"){var Q=new Uint8Array(H);return l.default.Config.getRandomValues(Q),l.default.BufferUtils.hexEncode(Q)}for(var K=l.default.BufferUtils.hexCharSet,ee=H*2,oe="",Ze=0;Ze<ee;Ze++)oe+=K[y(K)];return oe};r.randomHexString=re;function ce(H,Q){for(var K=Math.min(Q,H.length),ee=H.slice(),oe=[],Ze=0;Ze<K;Ze++)oe.push(F(ee));return oe}r.arrChooseN=ce,r.trim=String.prototype.trim?function(H){return H.trim()}:function(H){return H.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function Z(H,Q,K){return new Promise(function(ee,oe){H[Q].apply(H,a.__spreadArray(a.__spreadArray([],K,!1),[function(Ze,Kr){Ze?oe(Ze):ee(Kr)}],!1))})}r.promisify=Z;var ye;(function(H){H.msgpack="msgpack",H.json="json"})(ye=r.Format||(r.Format={}));function De(H,Q){return Q=="msgpack"?l.default.Config.msgpack.decode(H):JSON.parse(String(H))}r.decodeBody=De;function $e(H,Q){return Q=="msgpack"?l.default.Config.msgpack.encode(H,!0):JSON.stringify(H)}r.encodeBody=$e;function Ae(H){return H.map(function(Q){return Q&&Q.toLowerCase()})}r.allToLowerCase=Ae;function zt(H){return H.map(function(Q){return Q&&Q.toUpperCase()})}r.allToUpperCase=zt;function Co(H){return Math.min((H+2)/3,2)}r.getBackoffCoefficient=Co;function xt(){return 1-Math.random()*.2}r.getJitterCoefficient=xt;function ko(H,Q){return H*Co(Q)*xt()}r.getRetryTime=ko;function tl(){return o||(typeof window!="undefined"?window:self)}r.getGlobalObject=tl;function nl(H,Q){return Object.keys(H).every(function(K){return H[K]===Q[K]})&&Object.keys(Q).every(function(K){return Q[K]===H[K]})}r.shallowEquals=nl;function Kg(H){var Q=/^(\[([^?]*)(?:(.*))\])?(.+)$/,K=H.match(Q);if(!K||!K.length||K.length<5)throw new g.default("regex match failed",400,40010);if(K[2])throw new g.default("cannot use a derived option with a ".concat(K[2]," channel"),400,40010);return{qualifierParam:K[3]||"",channelName:K[4]}}r.matchDerivedChannel=Kg;function Jg(H){return l.default.Config.createHmac?Buffer.from(H,"ascii").toString("base64"):(0,S.stringify)((0,E.parse)(H))}r.toBase64=Jg;function Yg(H,Q){return H.length===Q.length&&(0,r.arrEvery)(H,function(K,ee){return K===Q[ee]})}r.arrEquals=Yg}).call(this,i(13))},function(n,r,i){(function(o){Object.defineProperty(r,"__esModule",{value:!0});var a=i(0),l=a.__importDefault(i(3)),d=o||(typeof window!="undefined"?window:self),g;(function(f){f[f.None=0]="None",f[f.Error=1]="Error",f[f.Major=2]="Major",f[f.Minor=3]="Minor",f[f.Micro=4]="Micro"})(g||(g={}));function S(f,k){return"".concat(f).padStart(k?3:2,"0")}function E(f){return l.default.Config.logTimestamps?function(k){var T=new Date;f(S(T.getHours())+":"+S(T.getMinutes())+":"+S(T.getSeconds())+"."+S(T.getMilliseconds(),1)+" "+k)}:f}var y=function(){var f,k,T,x;return typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"||typeof((k=(f=d==null?void 0:d.console)===null||f===void 0?void 0:f.log)===null||k===void 0?void 0:k.apply)=="function"?(T=function(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];console.log.apply(console,p)},x=console.warn?function(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];console.warn.apply(console,p)}:T):d!=null&&d.console.log?T=x=function(){Function.prototype.apply.call(console.log,console,arguments)}:T=x=function(){},[T,x].map(E)},R=function(){function f(){f.logLevel=f.LOG_DEFAULT}return f.initLogHandlers=function(){var k=y(),T=k[0],x=k[1];this.logHandler=T,this.logErrorHandler=x},f.renamedClientOption=function(k,T){f.deprecationWarning("The `".concat(k,"` client option has been renamed to `").concat(T,"`. Please update your code to use `").concat(T,"` instead. `").concat(k,"` will be removed in a future version."))},f.renamedMethod=function(k,T,x){f.deprecationWarning("`".concat(k,"`’s `").concat(T,"` method has been renamed to `").concat(x,"`. Please update your code to use `").concat(x,"` instead. `").concat(T,"` will be removed in a future version."))},f.deprecationWarning=function(k){f.shouldLog(g.Error)&&f.logErrorHandler("Ably: Deprecation warning - ".concat(k))},f.logLevel=g.Error,f.LOG_NONE=g.None,f.LOG_ERROR=g.Error,f.LOG_MAJOR=g.Major,f.LOG_MINOR=g.Minor,f.LOG_MICRO=g.Micro,f.LOG_DEFAULT=g.Error,f.LOG_DEBUG=g.Micro,f.logAction=function(k,T,x){f.shouldLog(k)&&(k===g.Error?f.logErrorHandler:f.logHandler)("Ably: "+T+": "+x)},f.deprecated=function(k,T){f.deprecationWarning("".concat(k," is deprecated and will be removed in a future version. ").concat(T))},f.shouldLog=function(k){return k<=f.logLevel},f.setLog=function(k,T){k!==void 0&&(f.logLevel=k),T!==void 0&&(f.logHandler=f.logErrorHandler=T)},f}();r.default=R}).call(this,i(13))},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function a(){}return a}();r.default=o},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.PartialErrorInfo=void 0;var o=i(0),a=o.__importDefault(i(3)),l=o.__importStar(i(1));function d(E){var y="["+E.constructor.name;return E.message&&(y+=": "+E.message),E.statusCode&&(y+="; statusCode="+E.statusCode),E.code&&(y+="; code="+E.code),E.cause&&(y+="; cause="+l.inspectError(E.cause)),E.href&&!(E.message&&E.message.indexOf("help.ably.io")>-1)&&(y+="; see "+E.href+" "),y+="]",y}var g=function(E){o.__extends(y,E);function y(R,f,k,T){var x=E.call(this,R)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(x,y.prototype),x.code=f,x.statusCode=k,x.cause=T,x}return y.prototype.toString=function(){return d(this)},y.fromValues=function(R){var f=R,k=f.message,T=f.code,x=f.statusCode;if(typeof k!="string"||typeof T!="number"||typeof x!="number")throw new Error("ErrorInfo.fromValues(): invalid values: "+a.default.Config.inspect(R));var p=Object.assign(new y(k,T,x),R);return p.code&&!p.href&&(p.href="https://help.ably.io/error/"+p.code),p},y}(Error);r.default=g;var S=function(E){o.__extends(y,E);function y(R,f,k,T){var x=E.call(this,R)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(x,y.prototype),x.code=f,x.statusCode=k,x.cause=T,x}return y.prototype.toString=function(){return d(this)},y}(Error);r.PartialErrorInfo=S},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(){if(typeof ArrayBuffer=="function"){var a=o,l=a.lib,d=l.WordArray,g=d.init,S=d.init=function(E){if(E instanceof ArrayBuffer&&(E=new Uint8Array(E)),(E instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&E instanceof Uint8ClampedArray||E instanceof Int16Array||E instanceof Uint16Array||E instanceof Int32Array||E instanceof Uint32Array||E instanceof Float32Array||E instanceof Float64Array)&&(E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength)),E instanceof Uint8Array){for(var y=E.byteLength,R=[],f=0;f<y;f++)R[f>>>2]|=E[f]<<24-f%4*8;g.call(this,R,y)}else g.apply(this,arguments)};S.prototype=d}}(),o.lib.WordArray})},function(n,r,i){(function(o){(function(a,l){n.exports=l()})(this,function(){var a=a||function(l,d){var g;if(typeof window!="undefined"&&window.crypto&&(g=window.crypto),!g&&typeof window!="undefined"&&window.msCrypto&&(g=window.msCrypto),!g&&typeof o!="undefined"&&o.crypto&&(g=o.crypto),!g)try{g=i(44)}catch(c){}var S=function(){if(g){if(typeof g.getRandomValues=="function")try{return g.getRandomValues(new Uint32Array(1))[0]}catch(c){}if(typeof g.randomBytes=="function")try{return g.randomBytes(4).readInt32LE()}catch(c){}}throw new Error("Native crypto module could not be used to get secure random number.")},E=Object.create||function(){function c(){}return function(u){var s;return c.prototype=u,s=new c,c.prototype=null,s}}(),y={},R=y.lib={},f=R.Base=function(){return{extend:function(c){var u=E(this);return c&&u.mixIn(c),(!u.hasOwnProperty("init")||this.init===u.init)&&(u.init=function(){u.$super.init.apply(this,arguments)}),u.init.prototype=u,u.$super=this,u},create:function(){var c=this.extend();return c.init.apply(c,arguments),c},init:function(){},mixIn:function(c){for(var u in c)c.hasOwnProperty(u)&&(this[u]=c[u]);c.hasOwnProperty("toString")&&(this.toString=c.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),k=R.WordArray=f.extend({init:function(c,u){c=this.words=c||[],u!=d?this.sigBytes=u:this.sigBytes=c.length*4},toString:function(c){return(c||x).stringify(this)},concat:function(c){var u=this.words,s=c.words,w=this.sigBytes,v=c.sigBytes;if(this.clamp(),w%4)for(var C=0;C<v;C++){var L=s[C>>>2]>>>24-C%4*8&255;u[w+C>>>2]|=L<<24-(w+C)%4*8}else for(var C=0;C<v;C+=4)u[w+C>>>2]=s[C>>>2];return this.sigBytes+=v,this},clamp:function(){var c=this.words,u=this.sigBytes;c[u>>>2]&=4294967295<<32-u%4*8,c.length=l.ceil(u/4)},clone:function(){var c=f.clone.call(this);return c.words=this.words.slice(0),c},random:function(c){for(var u=[],s=0;s<c;s+=4)u.push(S());return new k.init(u,c)}}),T=y.enc={},x=T.Hex={stringify:function(c){for(var u=c.words,s=c.sigBytes,w=[],v=0;v<s;v++){var C=u[v>>>2]>>>24-v%4*8&255;w.push((C>>>4).toString(16)),w.push((C&15).toString(16))}return w.join("")},parse:function(c){for(var u=c.length,s=[],w=0;w<u;w+=2)s[w>>>3]|=parseInt(c.substr(w,2),16)<<24-w%8*4;return new k.init(s,u/2)}},p=T.Latin1={stringify:function(c){for(var u=c.words,s=c.sigBytes,w=[],v=0;v<s;v++){var C=u[v>>>2]>>>24-v%4*8&255;w.push(String.fromCharCode(C))}return w.join("")},parse:function(c){for(var u=c.length,s=[],w=0;w<u;w++)s[w>>>2]|=(c.charCodeAt(w)&255)<<24-w%4*8;return new k.init(s,u)}},m=T.Utf8={stringify:function(c){try{return decodeURIComponent(escape(p.stringify(c)))}catch(u){throw new Error("Malformed UTF-8 data")}},parse:function(c){return p.parse(unescape(encodeURIComponent(c)))}},b=R.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new k.init,this._nDataBytes=0},_append:function(c){typeof c=="string"&&(c=m.parse(c)),this._data.concat(c),this._nDataBytes+=c.sigBytes},_process:function(c){var u,s=this._data,w=s.words,v=s.sigBytes,C=this.blockSize,L=C*4,N=v/L;c?N=l.ceil(N):N=l.max((N|0)-this._minBufferSize,0);var P=N*C,I=l.min(P*4,v);if(P){for(var M=0;M<P;M+=C)this._doProcessBlock(w,M);u=w.splice(0,P),s.sigBytes-=I}return new k.init(u,I)},clone:function(){var c=f.clone.call(this);return c._data=this._data.clone(),c},_minBufferSize:0});R.Hasher=b.extend({cfg:f.extend(),init:function(c){this.cfg=this.cfg.extend(c),this.reset()},reset:function(){b.reset.call(this),this._doReset()},update:function(c){return this._append(c),this._process(),this},finalize:function(c){c&&this._append(c);var u=this._doFinalize();return u},blockSize:16,_createHelper:function(c){return function(u,s){return new c.init(s).finalize(u)}},_createHmacHelper:function(c){return function(u,s){return new h.HMAC.init(c,s).finalize(u)}}});var h=y.algo={};return y}(Math);return a})}).call(this,i(13))},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(2)),d=o.__importDefault(i(3));function g(y,R,f){try{R.apply(y,f)}catch(k){l.default.logAction(l.default.LOG_ERROR,"EventEmitter.emit()","Unexpected listener exception: "+k+"; stack = "+(k&&k.stack))}}function S(y,R,f){for(var k,T,x,p=0;p<y.length;p++)if(k=y[p],f&&(k=k[f]),a.isArray(k)){for(;(T=a.arrIndexOf(k,R))!==-1;)k.splice(T,1);f&&k.length===0&&delete y[p][f]}else if(a.isObject(k))for(x in k)Object.prototype.hasOwnProperty.call(k,x)&&a.isArray(k[x])&&S([k],R,x)}var E=function(){function y(){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null)}return y.prototype.on=function(){for(var R=this,f=[],k=0;k<arguments.length;k++)f[k]=arguments[k];if(f.length===1){var T=f[0];if(typeof T=="function")this.any.push(T);else throw new Error("EventListener.on(): Invalid arguments: "+d.default.Config.inspect(f))}if(f.length===2){var x=f[0],p=f[1];if(typeof p!="function")throw new Error("EventListener.on(): Invalid arguments: "+d.default.Config.inspect(f));if(a.isEmptyArg(x))this.any.push(p);else if(a.isArray(x))x.forEach(function(b){R.on(b,p)});else{if(typeof x!="string")throw new Error("EventListener.on(): Invalid arguments: "+d.default.Config.inspect(f));var m=this.events[x]||(this.events[x]=[]);m.push(p)}}},y.prototype.off=function(){for(var R,f=this,k=[],T=0;T<arguments.length;T++)k[T]=arguments[T];if(k.length==0||a.isEmptyArg(k[0])&&a.isEmptyArg(k[1])){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null);return}var x=k[0],p=k[1],m=null,b=null;if(k.length===1||!p)typeof x=="function"?m=x:b=x;else{if(typeof p!="function")throw new Error("EventEmitter.off(): invalid arguments:"+d.default.Config.inspect(k));R=[x,p],b=R[0],m=R[1]}if(m&&a.isEmptyArg(b)){S([this.any,this.events,this.anyOnce,this.eventsOnce],m);return}if(a.isArray(b)){b.forEach(function(h){f.off(h,m)});return}if(typeof b!="string")throw new Error("EventEmitter.off(): invalid arguments:"+d.default.Config.inspect(k));m?S([this.events,this.eventsOnce],m,b):(delete this.events[b],delete this.eventsOnce[b])},y.prototype.listeners=function(R){if(R){var f=this.events[R]||[];return this.eventsOnce[R]&&Array.prototype.push.apply(f,this.eventsOnce[R]),f.length?f:null}return this.any.length?this.any:null},y.prototype.emit=function(R){for(var f=[],k=1;k<arguments.length;k++)f[k-1]=arguments[k];var T={event:R},x=[];this.anyOnce.length&&(Array.prototype.push.apply(x,this.anyOnce),this.anyOnce=[]),this.any.length&&Array.prototype.push.apply(x,this.any);var p=this.eventsOnce[R];p&&(Array.prototype.push.apply(x,p),delete this.eventsOnce[R]);var m=this.events[R];m&&Array.prototype.push.apply(x,m),a.arrForEach(x,function(b){g(T,b,f)})},y.prototype.once=function(){for(var R=this,f=[],k=0;k<arguments.length;k++)f[k]=arguments[k];var T=f.length;if((T===0||T===1&&typeof f[0]!="function")&&d.default.Config.Promise){var x=f[0];return new d.default.Config.Promise(function(u){R.once(x,u)})}var p=f[0],m=f[1];if(f.length===1&&typeof p=="function")this.anyOnce.push(p);else if(a.isEmptyArg(p)){if(typeof m!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));this.anyOnce.push(m)}else if(a.isArray(p)){var b=this,h=function(){var u=Array.prototype.slice.call(arguments);if(a.arrForEach(p,function(s){b.off(s,h)}),typeof m!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));m.apply(this,u)};a.arrForEach(p,function(u){b.on(u,h)})}else{if(typeof p!="string")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));var c=this.eventsOnce[p]||(this.eventsOnce[p]=[]);if(m){if(typeof m!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));c.push(m)}}},y.prototype.whenState=function(R,f,k){for(var T=this,x=[],p=3;p<arguments.length;p++)x[p-3]=arguments[p];var m={event:R};if(typeof R!="string"||typeof f!="string")throw"whenState requires a valid event String argument";if(typeof k!="function"&&d.default.Config.Promise)return new d.default.Config.Promise(function(b){y.prototype.whenState.apply(T,[R,f,b].concat(x))});R===f?g(m,k,x):this.once(R,k)},y}();r.default=E},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.getDefaults=r.normaliseOptions=r.objectifyOptions=r.getAgentString=r.getHosts=r.getFallbackHosts=r.environmentFallbackHosts=r.getHttpScheme=r.getPort=r.getHost=void 0;var o=i(0),a=o.__importDefault(i(3)),l=o.__importStar(i(1)),d=o.__importDefault(i(2)),g=o.__importDefault(i(4)),S=i(43),E="ably-js/"+S.version,y={ENVIRONMENT:"",REST_HOST:"rest.ably.io",REALTIME_HOST:"realtime.ably.io",FALLBACK_HOSTS:["A.ably-realtime.com","B.ably-realtime.com","C.ably-realtime.com","D.ably-realtime.com","E.ably-realtime.com"],PORT:80,TLS_PORT:443,TIMEOUTS:{disconnectedRetryTimeout:15e3,suspendedRetryTimeout:3e4,httpRequestTimeout:15e3,channelRetryTimeout:15e3,fallbackRetryTimeout:6e5,connectionStateTtl:12e4,realtimeRequestTimeout:1e4,recvTimeout:9e4,preferenceConnectTimeout:6e3,parallelUpgradeDelay:6e3},httpMaxRetryCount:3,maxMessageSize:65536,version:S.version,protocolVersion:2,agent:E,getHost:R,getPort:f,getHttpScheme:k,environmentFallbackHosts:T,getFallbackHosts:x,getHosts:p,checkHost:m,objectifyOptions:u,normaliseOptions:s};function R(v,C,L){return L?C=C==v.restHost&&v.realtimeHost||C||v.realtimeHost:C=C||v.restHost,C}r.getHost=R;function f(v,C){return C||v.tls?v.tlsPort:v.port}r.getPort=f;function k(v){return v.tls?"https://":"http://"}r.getHttpScheme=k;function T(v){return[v+"-a-fallback.ably-realtime.com",v+"-b-fallback.ably-realtime.com",v+"-c-fallback.ably-realtime.com",v+"-d-fallback.ably-realtime.com",v+"-e-fallback.ably-realtime.com"]}r.environmentFallbackHosts=T;function x(v){var C=v.fallbackHosts,L=typeof v.httpMaxRetryCount!="undefined"?v.httpMaxRetryCount:y.httpMaxRetryCount;return C?l.arrChooseN(C,L):[]}r.getFallbackHosts=x;function p(v){return[v.restHost].concat(x(v))}r.getHosts=p;function m(v){if(typeof v!="string")throw new g.default("host must be a string; was a "+typeof v,4e4,400);if(!v.length)throw new g.default("host must not be zero-length",4e4,400)}function b(v,C,L){return v.realtimeHost?v.realtimeHost:v.restHost?(d.default.logAction(d.default.LOG_MINOR,"Defaults.normaliseOptions",'restHost is set to "'+v.restHost+'" but realtimeHost is not set, so setting realtimeHost to "'+v.restHost+'" too. If this is not what you want, please set realtimeHost explicitly.'),v.restHost):C?y.REALTIME_HOST:L+"-"+y.REALTIME_HOST}function h(v){var C={};for(var L in y.TIMEOUTS)C[L]=v[L]||y.TIMEOUTS[L];return C}function c(v){var C=y.agent;if(v.agents)for(var L in v.agents)C+=" "+L+"/"+v.agents[L];return C}r.getAgentString=c;function u(v){return typeof v=="string"?v.indexOf(":")==-1?{token:v}:{key:v}:v}r.objectifyOptions=u;function s(v){if(v.host&&(d.default.renamedClientOption("host","restHost"),v.restHost=v.host),v.wsHost&&(d.default.renamedClientOption("wsHost","realtimeHost"),v.realtimeHost=v.wsHost),v.queueEvents&&(d.default.renamedClientOption("queueEvents","queueMessages"),v.queueMessages=v.queueEvents),v.headers&&d.default.deprecated("the `headers` client option",""),v.fallbackHostsUseDefault){if(v.fallbackHosts){var C="fallbackHosts and fallbackHostsUseDefault cannot both be set";throw d.default.logAction(d.default.LOG_ERROR,"Defaults.normaliseOptions",C),new g.default(C,4e4,400)}if(v.port||v.tlsPort){var C="fallbackHostsUseDefault cannot be set when port or tlsPort are set";throw d.default.logAction(d.default.LOG_ERROR,"Defaults.normaliseOptions",C),new g.default(C,4e4,400)}v.environment?d.default.deprecated("The `fallbackHostsUseDefault` client option","If you’re using this client option to force the library to make use of fallback hosts even though you’ve set the `environment` client option, then this is no longer necessary: remove your usage of the `fallbackHostsUseDefault` client option and the library will then automatically choose the correct fallback hosts to use for the specified environment."):d.default.deprecated("The `fallbackHostsUseDefault` client option","If you’re using this client option to force the library to make use of fallback hosts even though you’re not using the primary Ably environment, then stop using `fallbackHostsUseDefault`, and update your code to either pass the `environment` client option (in which case the library will automatically choose the correct fallback hosts to use for the specified environment), or to pass the `fallbackHosts` client option to specify a custom list of fallback hosts to use (for example, if you’re using a custom CNAME, in which case Ably will have provided you with an explicit list of fallback hosts)."),v.fallbackHosts=y.FALLBACK_HOSTS}v.recover===!0&&(d.default.deprecated("The ability to use a boolean value for the `recover` client option","If you wish for the connection to always be recovered, replace `{ recover: true }` with a function that always passes `true` to its callback: `{ recover: function(lastConnectionDetails, cb) { cb(true); } }`"),v.recover=function(F,O){O(!0)}),typeof v.recover=="function"&&v.closeOnUnload===!0&&(d.default.logAction(d.default.LOG_ERROR,"Defaults.normaliseOptions","closeOnUnload was true and a session recovery function was set - these are mutually exclusive, so unsetting the latter"),v.recover=void 0),"closeOnUnload"in v||(v.closeOnUnload=!v.recover),v.transports&&l.arrIn(v.transports,"xhr")&&(d.default.deprecationWarning('The "xhr" transport has been renamed to "xhr_streaming". Please update your client options code to use `transports: ["xhr_streaming"]` instead. The ability to use `transports: ["xhr"]` will be removed in a future version.'),l.arrDeleteValue(v.transports,"xhr"),v.transports.push("xhr_streaming")),"queueMessages"in v||(v.queueMessages=!0);var L=v.environment&&String(v.environment).toLowerCase()||y.ENVIRONMENT,N=!L||L==="production";!v.fallbackHosts&&!v.restHost&&!v.realtimeHost&&!v.port&&!v.tlsPort&&(v.fallbackHosts=N?y.FALLBACK_HOSTS:T(L));var P=v.restHost||(N?y.REST_HOST:L+"-"+y.REST_HOST),I=b(v,N,L);l.arrForEach((v.fallbackHosts||[]).concat(P,I),m),v.port=v.port||y.PORT,v.tlsPort=v.tlsPort||y.TLS_PORT,"tls"in v||(v.tls=!0);var M=h(v);if("useBinaryProtocol"in v?v.useBinaryProtocol=a.default.Config.supportsBinary&&v.useBinaryProtocol:v.useBinaryProtocol=a.default.Config.preferBinary,v.clientId){var A=v.headers=v.headers||{};A["X-Ably-ClientId"]=a.default.BufferUtils.base64Encode(a.default.BufferUtils.utf8Encode(v.clientId))}"idempotentRestPublishing"in v||(v.idempotentRestPublishing=!0),v.promises&&!a.default.Config.Promise&&(d.default.logAction(d.default.LOG_ERROR,"Defaults.normaliseOptions","{promises: true} was specified, but no Promise constructor found; disabling promises"),v.promises=!1);var j=null,U=v.connectivityCheckUrl;if(v.connectivityCheckUrl){var z=v.connectivityCheckUrl.split("?"),$=z[0],W=z[1];j=W?l.parseQueryString(W):{},$.indexOf("://")===-1&&($="https://"+$),U=$}return o.__assign(o.__assign({},v),{useBinaryProtocol:"useBinaryProtocol"in v?a.default.Config.supportsBinary&&v.useBinaryProtocol:a.default.Config.preferBinary,realtimeHost:I,restHost:P,maxMessageSize:v.maxMessageSize||y.maxMessageSize,timeouts:M,connectivityCheckParams:j,connectivityCheckUrl:U})}r.normaliseOptions=s,r.default=y;function w(v){return Object.assign(y,v)}r.getDefaults=w},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(3)),l=o.__importDefault(i(2)),d=o.__importDefault(i(4)),g=o.__importStar(i(1));function S(f){return!f||!f.channelOptions?{channelOptions:f,plugins:{},baseEncodedPreviousPayload:void 0}:f}function E(f){if(f&&f.cipher){if(!a.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var k=a.default.Crypto.getCipher(f.cipher);return{cipher:k.cipherParams,channelCipher:k.cipher}}return f!=null?f:{}}function y(f){var k=0;return f.name&&(k+=f.name.length),f.clientId&&(k+=f.clientId.length),f.extras&&(k+=JSON.stringify(f.extras).length),f.data&&(k+=g.dataSizeBytes(f.data)),k}var R=function(){function f(){}return f.prototype.toJSON=function(){var k=this.encoding,T=this.data;return T&&a.default.BufferUtils.isBuffer(T)&&(arguments.length>0?(k=k?k+"/base64":"base64",T=a.default.BufferUtils.base64Encode(T)):T=a.default.BufferUtils.toBuffer(T)),{name:this.name,id:this.id,clientId:this.clientId,connectionId:this.connectionId,connectionKey:this.connectionKey,extras:this.extras,encoding:k,data:T}},f.prototype.toString=function(){var k="[Message";return this.name&&(k+="; name="+this.name),this.id&&(k+="; id="+this.id),this.timestamp&&(k+="; timestamp="+this.timestamp),this.clientId&&(k+="; clientId="+this.clientId),this.connectionId&&(k+="; connectionId="+this.connectionId),this.encoding&&(k+="; encoding="+this.encoding),this.extras&&(k+="; extras ="+JSON.stringify(this.extras)),this.data&&(typeof this.data=="string"?k+="; data="+this.data:a.default.BufferUtils.isBuffer(this.data)?k+="; data (buffer)="+a.default.BufferUtils.base64Encode(this.data):k+="; data (json)="+JSON.stringify(this.data)),this.extras&&(k+="; extras="+JSON.stringify(this.extras)),k+="]",k},f.encrypt=function(k,T,x){var p=k.data,m=k.encoding,b=T.channelCipher;m=m?m+"/":"",a.default.BufferUtils.isBuffer(p)||(p=a.default.BufferUtils.utf8Encode(String(p)),m=m+"utf-8/"),b.encrypt(p,function(h,c){if(h){x(h);return}k.data=c,k.encoding=m+"cipher+"+b.algorithm,x(null,k)})},f.encode=function(k,T,x){var p=k.data,m=typeof p=="string"||a.default.BufferUtils.isBuffer(p)||p===null||p===void 0;if(!m)if(g.isObject(p)||g.isArray(p))k.data=JSON.stringify(p),k.encoding=k.encoding?k.encoding+"/json":"json";else throw new d.default("Data type is unsupported",40013,400);T!=null&&T.cipher?f.encrypt(k,T,x):x(null,k)},f.encodeArray=function(k,T,x){for(var p=0,m=0;m<k.length;m++)f.encode(k[m],T,function(b){if(b){x(b);return}p++,p==k.length&&x(null,k)})},f.decode=function(k,T){var x=S(T),p=k.data,m=k.encoding;if(m){var b=m.split("/"),h=void 0,c=b.length,u=k.data,s="";try{for(;(h=c)>0;){var w=b[--c].match(/([-\w]+)(\+([\w-]+))?/);if(!w)break;switch(s=w[1],s){case"base64":u=a.default.BufferUtils.base64Decode(String(u)),h==b.length&&(p=u);continue;case"utf-8":u=a.default.BufferUtils.utf8Decode(u);continue;case"json":u=JSON.parse(u);continue;case"cipher":if(x.channelOptions!=null&&x.channelOptions.cipher&&x.channelOptions.channelCipher){var v=w[3],C=x.channelOptions.channelCipher;if(v!=C.algorithm)throw new Error("Unable to decrypt message with given cipher; incompatible cipher params");u=C.decrypt(u);continue}else throw new Error("Unable to decrypt message; not an encrypted channel");case"vcdiff":if(!x.plugins||!x.plugins.vcdiff)throw new d.default("Missing Vcdiff decoder (https://github.com/ably-forks/vcdiff-decoder)",40019,400);if(typeof Uint8Array=="undefined")throw new d.default("Delta decoding not supported on this browser (need ArrayBuffer & Uint8Array)",40020,400);try{var L=x.baseEncodedPreviousPayload;typeof L=="string"&&(L=a.default.BufferUtils.utf8Encode(L)),L=a.default.BufferUtils.toBuffer(L),u=a.default.BufferUtils.toBuffer(u),u=a.default.BufferUtils.typedArrayToBuffer(x.plugins.vcdiff.decode(u,L)),p=u}catch(P){throw new d.default("Vcdiff delta decode failed with "+P,40018,400)}continue;default:throw new Error("Unknown encoding")}}}catch(P){var N=P;throw new d.default("Error processing the "+s+" encoding, decoder returned ‘"+N.message+"’",N.code||40013,400)}finally{k.encoding=h<=0?null:b.slice(0,h).join("/"),k.data=u}}x.baseEncodedPreviousPayload=p},f.fromResponseBody=function(k,T,x){x&&(k=g.decodeBody(k,x));for(var p=0;p<k.length;p++){var m=k[p]=f.fromValues(k[p]);try{f.decode(m,T)}catch(b){l.default.logAction(l.default.LOG_ERROR,"Message.fromResponseBody()",b.toString())}}return k},f.fromValues=function(k){return Object.assign(new f,k)},f.fromValuesArray=function(k){for(var T=k.length,x=new Array(T),p=0;p<T;p++)x[p]=f.fromValues(k[p]);return x},f.fromEncoded=function(k,T){var x=f.fromValues(k),p=E(T!=null?T:null);try{f.decode(x,p)}catch(m){l.default.logAction(l.default.LOG_ERROR,"Message.fromEncoded()",m.toString())}return x},f.fromEncodedArray=function(k,T){return k.map(function(x){return f.fromEncoded(x,T)})},f.getMessagesSize=function(k){for(var T,x=0,p=0;p<k.length;p++)T=k[p],x+=T.size||(T.size=y(T));return x},f.serialize=g.encodeBody,f}();r.default=R},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(4)),d=o.__importDefault(i(9)),g=o.__importDefault(i(16)),S={HEARTBEAT:0,ACK:1,NACK:2,CONNECT:3,CONNECTED:4,DISCONNECT:5,DISCONNECTED:6,CLOSE:7,CLOSED:8,ERROR:9,ATTACH:10,ATTACHED:11,DETACH:12,DETACHED:13,PRESENCE:14,MESSAGE:15,SYNC:16,AUTH:17,ACTIVATE:18},E=[];Object.keys(S).forEach(function(x){E[S[x]]=x});var y={HAS_PRESENCE:1,HAS_BACKLOG:2,RESUMED:4,TRANSIENT:16,ATTACH_RESUME:32,PRESENCE:65536,PUBLISH:1<<17,SUBSCRIBE:1<<18,PRESENCE_SUBSCRIBE:1<<19},R=Object.keys(y);y.MODE_ALL=y.PRESENCE|y.PUBLISH|y.SUBSCRIBE|y.PRESENCE_SUBSCRIBE;function f(x){var p=[];if(x)for(var m=0;m<x.length;m++)p.push(x[m].toString());return"[ "+p.join(", ")+" ]"}var k="id channel channelSerial connectionId count msgSerial timestamp".split(" "),T=function(){function x(){var p=this;this.hasFlag=function(m){return(p.flags&y[m])>0}}return x.prototype.setFlag=function(p){return this.flags=this.flags|y[p]},x.prototype.getMode=function(){return this.flags&&this.flags&y.MODE_ALL},x.prototype.encodeModesToFlags=function(p){var m=this;p.forEach(function(b){return m.setFlag(b)})},x.prototype.decodeModesFromFlags=function(){var p=this,m=[];return x.channelModes.forEach(function(b){p.hasFlag(b)&&m.push(b)}),m.length>0?m:void 0},x.fromValues=function(p){return Object.assign(new x,p)},x.Action=S,x.channelModes=["PRESENCE","PUBLISH","SUBSCRIBE","PRESENCE_SUBSCRIBE"],x.ActionName=E,x.serialize=a.encodeBody,x.deserialize=function(p,m){var b=a.decodeBody(p,m);return x.fromDeserialized(b)},x.fromDeserialized=function(p){var m=p.error;m&&(p.error=l.default.fromValues(m));var b=p.messages;if(b)for(var h=0;h<b.length;h++)b[h]=d.default.fromValues(b[h]);var c=p.presence;if(c)for(var h=0;h<c.length;h++)c[h]=g.default.fromValues(c[h],!0);return Object.assign(new x,p)},x.stringify=function(p){var m="[ProtocolMessage";p.action!==void 0&&(m+="; action="+x.ActionName[p.action]||!1);for(var b,h=0;h<k.length;h++)b=k[h],p[b]!==void 0&&(m+="; "+b+"="+p[b]);if(p.messages&&(m+="; messages="+f(d.default.fromValuesArray(p.messages))),p.presence&&(m+="; presence="+f(g.default.fromValuesArray(p.presence))),p.error&&(m+="; error="+l.default.fromValues(p.error).toString()),p.auth&&p.auth.accessToken&&(m+="; token="+p.auth.accessToken),p.flags&&(m+="; flags="+R.filter(p.hasFlag).join(",")),p.params){var c="";a.forInOwnNonNullProperties(p.params,function(u){c.length>0&&(c+="; "),c+=u+"="+p.params[u]}),c.length>0&&(m+="; params=["+c+"]")}return m+="]",m},x}();r.default=T},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(){var a=o,l=a.lib,d=l.WordArray,g=a.enc;g.Base64={stringify:function(E){var y=E.words,R=E.sigBytes,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";E.clamp();for(var k=[],T=0;T<R;T+=3)for(var x=y[T>>>2]>>>24-T%4*8&255,p=y[T+1>>>2]>>>24-(T+1)%4*8&255,m=y[T+2>>>2]>>>24-(T+2)%4*8&255,b=x<<16|p<<8|m,h=0;h<4&&T+h*.75<R;h++)k.push(f.charAt(b>>>6*(3-h)&63));var c=f.charAt(64);if(c)for(;k.length%4;)k.push(c);return k.join("")},parse:function(E){var y=E.length,R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var k=0;k<R.length;k++)f[R.charCodeAt(k)]=k}var T=R.charAt(64);if(T){var x=E.indexOf(T);x!==-1&&(y=x)}return S(E,y,f)}};function S(E,y,R){for(var f=[],k=0,T=0;T<y;T++)if(T%4){var x=R[E.charCodeAt(T-1)]<<T%4*2,p=R[E.charCodeAt(T)]>>>6-T%4*2,m=x|p;f[k>>>2]|=m<<24-k%4*8,k++}return d.create(f,k)}}(),o.enc.Base64})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(10)),d=o.__importDefault(i(26)),g=o.__importDefault(i(2)),S=o.__importDefault(i(8)),E=o.__importDefault(i(21)),y=o.__importDefault(i(18)),R=o.__importDefault(i(4)),f=o.__importDefault(i(22)),k=o.__importDefault(i(3));function T(m){var b=[80015,80017,80030];return m.code?y.default.isTokenErr(m)?!1:a.arrIn(b,m.code)?!0:m.code>=4e4&&m.code<5e4:!1}function x(m){return T(m)?[l.default.fromValues({action:l.default.Action.ERROR,error:m})]:[l.default.fromValues({action:l.default.Action.DISCONNECTED,error:m})]}var p=function(m){o.__extends(b,m);function b(h,c,u){var s=m.call(this,h,c,u,!0)||this;return s.onAuthUpdated=function(w){s.authParams={access_token:w.token}},s.stream="stream"in u?u.stream:!0,s.sendRequest=null,s.recvRequest=null,s.pendingCallback=null,s.pendingItems=null,s}return b.prototype.connect=function(){var h=this;g.default.logAction(g.default.LOG_MINOR,"CometTransport.connect()","starting"),d.default.prototype.connect.call(this);var c=this.params,u=c.options,s=S.default.getHost(u,c.host),w=S.default.getPort(u),v=u.tls?"https://":"http://";this.baseUri=v+s+":"+w+"/comet/";var C=this.baseUri+"connect";g.default.logAction(g.default.LOG_MINOR,"CometTransport.connect()","uri: "+C),this.auth.getAuthParams(function(L,N){if(L){h.disconnect(L);return}if(!h.isDisposed){h.authParams=N;var P=h.params.getConnectParams(N);"stream"in P&&(h.stream=P.stream),g.default.logAction(g.default.LOG_MINOR,"CometTransport.connect()","connectParams:"+a.toQueryString(P));var I=!1,M=h.recvRequest=h.createRequest(C,null,P,null,h.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV);M.on("data",function(A){h.recvRequest&&(I||(I=!0,h.emit("preconnect")),h.onData(A))}),M.on("complete",function(A){if(h.recvRequest||(A=A||new R.default("Request cancelled",80003,400)),h.recvRequest=null,!I&&!A&&(I=!0,h.emit("preconnect")),h.onActivity(),A){A.code?h.onData(x(A)):h.disconnect(A);return}k.default.Config.nextTick(function(){h.recv()})}),M.exec()}})},b.prototype.requestClose=function(){g.default.logAction(g.default.LOG_MINOR,"CometTransport.requestClose()"),this._requestCloseOrDisconnect(!0)},b.prototype.requestDisconnect=function(){g.default.logAction(g.default.LOG_MINOR,"CometTransport.requestDisconnect()"),this._requestCloseOrDisconnect(!1)},b.prototype._requestCloseOrDisconnect=function(h){var c=this,u=h?this.closeUri:this.disconnectUri;if(u){var s=this.createRequest(u,null,this.authParams,null,f.default.REQ_SEND);s.on("complete",function(w){w&&(g.default.logAction(g.default.LOG_ERROR,"CometTransport.request"+(h?"Close()":"Disconnect()"),"request returned err = "+a.inspectError(w)),c.finish("disconnected",w))}),s.exec()}},b.prototype.dispose=function(){var h=this;g.default.logAction(g.default.LOG_MINOR,"CometTransport.dispose()",""),this.isDisposed||(this.isDisposed=!0,this.recvRequest&&(g.default.logAction(g.default.LOG_MINOR,"CometTransport.dispose()","aborting recv request"),this.recvRequest.abort(),this.recvRequest=null),this.finish("disconnected",E.default.disconnected()),k.default.Config.nextTick(function(){h.emit("disposed")}))},b.prototype.onConnect=function(h){var c;if(!this.isDisposed){var u=(c=h.connectionDetails)===null||c===void 0?void 0:c.connectionKey;d.default.prototype.onConnect.call(this,h);var s=this.baseUri+u;g.default.logAction(g.default.LOG_MICRO,"CometTransport.onConnect()","baseUri = "+s),this.sendUri=s+"/send",this.recvUri=s+"/recv",this.closeUri=s+"/close",this.disconnectUri=s+"/disconnect"}},b.prototype.send=function(h){if(this.sendRequest){this.pendingItems=this.pendingItems||[],this.pendingItems.push(h);return}var c=this.pendingItems||[];c.push(h),this.pendingItems=null,this.sendItems(c)},b.prototype.sendAnyPending=function(){var h=this.pendingItems;h&&(this.pendingItems=null,this.sendItems(h))},b.prototype.sendItems=function(h){var c=this,u=this.sendRequest=this.createRequest(this.sendUri,null,this.authParams,this.encodeRequest(h),f.default.REQ_SEND);u.on("complete",function(s,w){if(s&&g.default.logAction(g.default.LOG_ERROR,"CometTransport.sendItems()","on complete: err = "+a.inspectError(s)),c.sendRequest=null,s){s.code?c.onData(x(s)):c.disconnect(s);return}w&&c.onData(w),c.pendingItems&&k.default.Config.nextTick(function(){c.sendRequest||c.sendAnyPending()})}),u.exec()},b.prototype.recv=function(){var h=this;if(!this.recvRequest&&this.isConnected){var c=this.recvRequest=this.createRequest(this.recvUri,null,this.authParams,null,this.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV_POLL);c.on("data",function(u){h.onData(u)}),c.on("complete",function(u){if(h.recvRequest=null,h.onActivity(),u){u.code?h.onData(x(u)):h.disconnect(u);return}k.default.Config.nextTick(function(){h.recv()})}),c.exec()}},b.prototype.onData=function(h){try{var c=this.decodeResponse(h);if(c&&c.length)for(var u=0;u<c.length;u++)this.onProtocolMessage(l.default.fromDeserialized(c[u]))}catch(s){g.default.logAction(g.default.LOG_ERROR,"CometTransport.onData()","Unexpected exception handing channel event: "+s.stack)}},b.prototype.encodeRequest=function(h){return JSON.stringify(h)},b.prototype.decodeResponse=function(h){return typeof h=="string"?JSON.parse(h):h},b}(d.default);r.default=p},function(n,r){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(o){typeof window=="object"&&(i=window)}n.exports=i},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.isSuccessCode=void 0;var o;(function(l){l[l.Success=200]="Success",l[l.NoContent=204]="NoContent",l[l.BadRequest=400]="BadRequest",l[l.Unauthorized=401]="Unauthorized",l[l.Forbidden=403]="Forbidden",l[l.RequestTimeout=408]="RequestTimeout",l[l.InternalServerError=500]="InternalServerError"})(o||(o={}));function a(l){return l>=o.Success&&l<o.BadRequest}r.isSuccessCode=a,r.default=o},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(3)),l=o.__importStar(i(1)),d=o.__importDefault(i(2)),g=o.__importDefault(i(18)),S=o.__importDefault(i(19)),E=i(4),y=o.__importDefault(i(14));function R(m,b,h,c,u){m.http.supportsAuthHeaders?m.auth.getAuthHeaders(function(s,w){s?c(s):u(l.mixin(w,b),h)}):m.auth.getAuthParams(function(s,w){s?c(s):u(b,l.mixin(w,h))})}function f(m,b){return function(h,c,u,s,w){if(h&&!c){m(h);return}if(w===y.default.NoContent){m(h,[],u,!0,w);return}if(!s)try{c=l.decodeBody(c,b)}catch(I){l.isErrorInfoOrPartialErrorInfo(I)?m(I):m(new E.PartialErrorInfo(l.inspectError(I),null));return}if(!c){m(new E.PartialErrorInfo("unenvelope(): Response body is missing",null));return}var v=c,C=v.statusCode,L=v.response,N=v.headers;if(C===void 0){m(h,c,u,!0,w);return}if(C<200||C>=300){var P=L&&L.error||h;P||(P=new Error("Error in unenveloping "+c),P.statusCode=C),m(P,L,N,!0,C);return}m(h,L,N,!0,C)}}function k(m){var b=[];if(m)for(var h in m)b.push(h+"="+m[h]);return b.join("&")}function T(m,b){return m+(b?"?":"")+k(b)}function x(m,b,h,c){return function(u,s,w,v,C){u?d.default.logAction(d.default.LOG_MICRO,"Resource."+b+"()","Received Error; "+T(h,c)+"; Error: "+l.inspectError(u)):d.default.logAction(d.default.LOG_MICRO,"Resource."+b+"()","Received; "+T(h,c)+"; Headers: "+k(w)+"; StatusCode: "+C+"; Body: "+(a.default.BufferUtils.isBuffer(s)?s.toString():s)),m&&m(u,s,w,v,C)}}var p=function(){function m(){}return m.get=function(b,h,c,u,s,w){m.do(S.default.Get,b,h,null,c,u,s,w)},m.delete=function(b,h,c,u,s,w){m.do(S.default.Delete,b,h,null,c,u,s,w)},m.post=function(b,h,c,u,s,w,v){m.do(S.default.Post,b,h,c,u,s,w,v)},m.patch=function(b,h,c,u,s,w,v){m.do(S.default.Patch,b,h,c,u,s,w,v)},m.put=function(b,h,c,u,s,w,v){m.do(S.default.Put,b,h,c,u,s,w,v)},m.do=function(b,h,c,u,s,w,v,C){d.default.shouldLog(d.default.LOG_MICRO)&&(C=x(C,b,c,w)),v&&(C=C&&f(C,v),(w=w||{}).envelope=v);function L(N,P){var I;if(d.default.shouldLog(d.default.LOG_MICRO)&&d.default.logAction(d.default.LOG_MICRO,"Resource."+b+"()","Sending; "+T(c,P)),d.default.shouldLog(d.default.LOG_MICRO)){var M=u;if(((I=N["content-type"])===null||I===void 0?void 0:I.indexOf("msgpack"))>0)try{M=a.default.Config.msgpack.decode(u)}catch(A){d.default.logAction(d.default.LOG_MICRO,"Resource."+b+"()","Sending MsgPack Decoding Error: "+l.inspectError(A))}d.default.logAction(d.default.LOG_MICRO,"Resource."+b+"()","Sending; "+T(c,P)+"; Body: "+M)}h.http.do(b,h,c,N,u,P,function(A,j,U,z,$){if(A&&g.default.isTokenErr(A)){h.auth.authorize(null,null,function(W){if(W){C(W);return}R(h,N,P,C,L)});return}C(A,j,U,z,$)})}R(h,s,w,C,L)},m}();r.default=p},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(2)),l=o.__importDefault(i(3)),d=o.__importDefault(i(9)),g=o.__importStar(i(1));function S(y){return E.Actions.indexOf(y)}var E=function(){function y(){}return y.prototype.isSynthesized=function(){return!this.id||!this.connectionId?!0:this.id.substring(this.connectionId.length,0)!==this.connectionId},y.prototype.parseId=function(){if(!this.id)throw new Error("parseId(): Presence message does not contain an id");var R=this.id.split(":");return{connectionId:R[0],msgSerial:parseInt(R[1],10),index:parseInt(R[2],10)}},y.prototype.toJSON=function(){var R=this.data,f=this.encoding;return R&&l.default.BufferUtils.isBuffer(R)&&(arguments.length>0?(f=f?f+"/base64":"base64",R=l.default.BufferUtils.base64Encode(R)):R=l.default.BufferUtils.toBuffer(R)),{id:this.id,clientId:this.clientId,action:S(this.action),data:R,encoding:f,extras:this.extras}},y.prototype.toString=function(){var R="[PresenceMessage";return R+="; action="+this.action,this.id&&(R+="; id="+this.id),this.timestamp&&(R+="; timestamp="+this.timestamp),this.clientId&&(R+="; clientId="+this.clientId),this.connectionId&&(R+="; connectionId="+this.connectionId),this.encoding&&(R+="; encoding="+this.encoding),this.data&&(typeof this.data=="string"?R+="; data="+this.data:l.default.BufferUtils.isBuffer(this.data)?R+="; data (buffer)="+l.default.BufferUtils.base64Encode(this.data):R+="; data (json)="+JSON.stringify(this.data)),this.extras&&(R+="; extras="+JSON.stringify(this.extras)),R+="]",R},y.fromResponseBody=function(R,f,k){var T=[];k&&(R=g.decodeBody(R,k));for(var x=0;x<R.length;x++){var p=T[x]=y.fromValues(R[x],!0);try{y.decode(p,f)}catch(m){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromResponseBody()",m.toString())}}return T},y.fromValues=function(R,f){return f&&(R.action=y.Actions[R.action]),Object.assign(new y,R)},y.fromValuesArray=function(R){for(var f=R.length,k=new Array(f),T=0;T<f;T++)k[T]=y.fromValues(R[T]);return k},y.fromEncoded=function(R,f){var k=y.fromValues(R,!0);try{y.decode(k,f!=null?f:{})}catch(T){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromEncoded()",T.toString())}return k},y.fromEncodedArray=function(R,f){return R.map(function(k){return y.fromEncoded(k,f)})},y.fromData=function(R){return R instanceof y?R:y.fromValues({data:R})},y.Actions=["absent","present","enter","leave","update"],y.encode=d.default.encode,y.decode=d.default.decode,y.getMessagesSize=d.default.getMessagesSize,y}();r.default=E},function(n,r,i){(function(o){Object.defineProperty(r,"__esModule",{value:!0});var a=i(0),l=a.__importStar(i(1)),d=a.__importDefault(i(7)),g=a.__importStar(i(4)),S=a.__importDefault(i(2)),E=a.__importDefault(i(8)),y=a.__importDefault(i(22)),R=a.__importDefault(i(3));function f(v,C){return l.arrIn(l.allToLowerCase(l.keysArray(C)),"x-ably-errorcode")}function k(v,C){if(f(v,C))return v.error&&g.default.fromValues(v.error)}var T=function(){},x=0,p={},m=typeof o!="undefined"&&o.XDomainRequest;function b(){var v=navigator.userAgent.toString().match(/MSIE\s([\d.]+)/);return v&&Number(v[1])}function h(){var v;return m&&(v=b())&&v===10}function c(v,C){return v.getResponseHeader&&v.getResponseHeader(C)}function u(v){return v.getResponseHeader&&(v.getResponseHeader("transfer-encoding")||!v.getResponseHeader("content-length"))}function s(v){for(var C=l.trim(v.getAllResponseHeaders()).split(`\r
138
- `),L={},N=0;N<C.length;N++){var P=C[N].split(":").map(l.trim);L[P[0].toLowerCase()]=P[1]}return L}var w=function(v){a.__extends(C,v);function C(L,N,P,I,M,A,j){var U=v.call(this)||this;return P=P||{},P.rnd=l.cheapRandStr(),h()&&!P.envelope&&(P.envelope="json"),U.uri=L+l.toQueryString(P),U.headers=N||{},U.body=I,U.method=j?j.toUpperCase():l.isEmptyArg(I)?"GET":"POST",U.requestMode=M,U.timeouts=A,U.timedOut=!1,U.requestComplete=!1,U.id=String(++x),p[U.id]=U,U}return C.createRequest=function(L,N,P,I,M,A,j){var U=A||E.default.TIMEOUTS;return new C(L,N,l.copy(P),I,M,U,j)},C.prototype.complete=function(L,N,P,I,M){this.requestComplete||(this.requestComplete=!0,!L&&N&&this.emit("data",N),this.emit("complete",L,N,P,I,M),this.dispose())},C.prototype.abort=function(){this.dispose()},C.prototype.exec=function(){var L=this,N=this.headers,P=this.requestMode==y.default.REQ_SEND?this.timeouts.httpRequestTimeout:this.timeouts.recvTimeout,I=this.timer=setTimeout(function(){L.timedOut=!0,A.abort()},P),M=this.method,A=this.xhr=new XMLHttpRequest,j=N.accept,U=this.body,z="text";if(j?j.indexOf("application/x-msgpack")===0&&(z="arraybuffer"):N.accept="application/json",U){var $=N["content-type"]||(N["content-type"]="application/json");$.indexOf("application/json")>-1&&typeof U!="string"&&(U=JSON.stringify(U))}A.open(M,this.uri,!0),A.responseType=z,"authorization"in N&&(A.withCredentials=!0);for(var W in N)A.setRequestHeader(W,N[W]);var F=function(Z,ye,De,$e){var Ae,zt=ye+" (event type: "+Z.type+")";!((Ae=L==null?void 0:L.xhr)===null||Ae===void 0)&&Ae.statusText&&(zt+=", current statusText is "+L.xhr.statusText),S.default.logAction(S.default.LOG_ERROR,"Request.on"+Z.type+"()",zt),L.complete(new g.PartialErrorInfo(zt,De,$e))};A.onerror=function(Z){F(Z,"XHR error occurred",null,400)},A.onabort=function(Z){L.timedOut?F(Z,"Request aborted due to request timeout expiring",null,408):F(Z,"Request cancelled",null,400)},A.ontimeout=function(Z){F(Z,"Request timed out",null,408)};var O,D,B,_=0,V=!1,Y=function(){if(clearTimeout(I),B=D<400,D==204){L.complete(null,null,null,null,D);return}O=L.requestMode==y.default.REQ_RECV_STREAM&&B&&u(A)},X=function(){var Z;try{var ye=c(A,"content-type"),De=ye?ye.indexOf("application/json")>=0:A.responseType=="text";if(De){var $e=A.responseType==="arraybuffer"?R.default.BufferUtils.utf8Decode(A.response):String(A.responseText);$e.length?Z=JSON.parse($e):Z=$e,V=!0}else Z=A.response;Z.response!==void 0?(D=Z.statusCode,B=D<400,N=Z.headers,Z=Z.response):N=s(A)}catch(zt){L.complete(new g.PartialErrorInfo("Malformed response body from server: "+zt.message,null,400));return}if(B||l.isArray(Z)){L.complete(null,Z,N,V,D);return}var Ae=k(Z,N);Ae||(Ae=new g.PartialErrorInfo("Error response received from server: "+D+" body was: "+R.default.Config.inspect(Z),null,D)),L.complete(Ae,Z,N,V,D)};function ne(){for(var Z=A.responseText,ye=Z.length-1,De,$e;_<ye&&(De=Z.indexOf(`
139
- `,_))>-1;)$e=Z.slice(_,De),_=De+1,re($e)}var re=function(Z){try{Z=JSON.parse(Z)}catch(ye){L.complete(new g.PartialErrorInfo("Malformed response body from server: "+ye.message,null,400));return}L.emit("data",Z)},ce=function(){ne(),L.streamComplete=!0,R.default.Config.nextTick(function(){L.complete()})};A.onreadystatechange=function(){var Z=A.readyState;Z<3||A.status!==0&&(D===void 0&&(D=A.status,D===1223&&(D=204),Y()),Z==3&&O?ne():Z==4&&(O?ce():X()))},A.send(U)},C.prototype.dispose=function(){var L=this.xhr;if(L){L.onreadystatechange=L.onerror=L.onabort=L.ontimeout=T,this.xhr=null;var N=this.timer;N&&(clearTimeout(N),this.timer=null),this.requestComplete||L.abort()}delete p[this.id]},C}(d.default);r.default=w}).call(this,i(13))},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(2)),l=o.__importStar(i(1)),d=o.__importDefault(i(24)),g=o.__importDefault(i(4)),S=o.__importDefault(i(45)),E=i(11),y=o.__importDefault(i(19)),R=o.__importDefault(i(14)),f=o.__importDefault(i(3)),k=o.__importDefault(i(15)),T=Math.pow(2,17);function x(){}function p(){return("000000"+Math.floor(Math.random()*1e16)).slice(-16)}function m(P){return!!P.connection}function b(P){return l.isErrorInfoOrPartialErrorInfo(P)?(P.code||(P.statusCode===403?P.code=40300:(P.code=40170,P.statusCode=401)),P):new g.default(l.inspectError(P),P.code||40170,P.statusCode||401)}var h=function(P,I){if(f.default.Config.createHmac){var M=f.default.Config.createHmac("SHA256",I);return M.update(P),M.digest("base64")}return(0,E.stringify)((0,S.default)(P,I))};function c(P){if(!P)return"";typeof P=="string"&&(P=JSON.parse(P));var I=Object.create(null),M=l.keysArray(P,!0);if(!M)return"";M.sort();for(var A=0;A<M.length;A++)I[M[A]]=P[M[A]].sort();return JSON.stringify(I)}function u(P){if(P.authCallback)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with authCallback");else if(P.authUrl)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with authUrl");else if(P.key)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with client-side signing");else if(P.tokenDetails)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with supplied token only");else{var I="authOptions must include valid authentication parameters";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",I),new Error(I)}}function s(P){return"useTokenAuth"in P&&!P.useTokenAuth}function w(P){return P.useTokenAuth||!s(P)&&(P.authCallback||P.authUrl||P.token||P.tokenDetails)}function v(P){return!P.key&&!P.authCallback&&!P.authUrl}var C=0;function L(){return C++}var N=function(){function P(I,M){if(this.authOptions={},this.client=I,this.tokenParams=M.defaultTokenParams||{},this.currentTokenRequestId=null,this.waitingForTokenRequest=null,w(M)){if(M.key&&!h){var A="client-side token request signing not supported";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",A),new Error(A)}v(M)&&a.default.logAction(a.default.LOG_ERROR,"Auth()","Warning: library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help"),this._saveTokenOptions(M.defaultTokenParams,M),u(this.authOptions)}else{if(!M.key){var A="No authentication options provided; need one of: key, authUrl, or authCallback (or for testing only, token or tokenDetails)";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",A),new g.default(A,40160,401)}a.default.logAction(a.default.LOG_MINOR,"Auth()","anonymous, using basic auth"),this._saveBasicOptions(M)}}return P.prototype.authorize=function(I,M,A){var j=this,U;if(typeof I=="function"&&!A?(A=I,U=I=null):typeof M=="function"&&!A?(A=M,U=null):U=M,!A&&this.client.options.promises)return l.promisify(this,"authorize",arguments);if(U&&U.key&&this.authOptions.key!==U.key)throw new g.default("Unable to update auth options with incompatible key",40102,401);U&&"force"in U&&(a.default.deprecated("The `force` auth option","If you’re using this option to force `authorize()` to fetch a new token even if the current token has not expired, this is no longer necessary, as `authorize()` now always fetches a new token. Update your code to no longer pass the `force` auth option. Note that, in general, passing an auth options argument to `authorize()` will overwrite the library’s stored auth options, which may not be what you want. The library currently contains a special case behavior where passing an auth options object which only contains `{ force: true }` will _not_ overwrite the stored options. This special case behavior will be removed alongside support for the `force` option, so if you’re currently passing `authorize()` an auth options object which only contains `{ force: true }`, you should stop passing it an auth options object entirely."),l.isOnlyPropIn(U,"force")&&(U=null)),this._forceNewToken(I,U,function(z,$){if(z){j.client.connection&&z.statusCode===R.default.Forbidden&&j.client.connection.connectionManager.actOnErrorFromAuthorize(z),A==null||A(z);return}m(j.client)?j.client.connection.connectionManager.onAuthUpdated($,A||x):A==null||A(null,$)})},P.prototype.authorise=function(I,M,A){a.default.renamedMethod("Auth","authorise","authorize"),this.authorize(I,M,A)},P.prototype._forceNewToken=function(I,M,A){var j=this;this.tokenDetails=null,this._saveTokenOptions(I,M),u(this.authOptions),this._ensureValidAuthCredentials(!0,function(U,z){delete j.tokenParams.timestamp,delete j.authOptions.queryTime,A(U,z)})},P.prototype.requestToken=function(I,M,A){var j=this;if(typeof I=="function"&&!A?(A=I,M=I=null):typeof M=="function"&&!A&&(A=M,M=null),!A&&this.client.options.promises)return l.promisify(this,"requestToken",arguments);M=M||this.authOptions,I=I||l.copy(this.tokenParams);var U=A||x,z,$=this.client;if(M.authCallback)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with authCallback"),z=M.authCallback;else if(M.authUrl)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with authUrl"),z=function(_,V){var Y=l.mixin({accept:"application/json, text/plain"},M.authHeaders),X=M.authMethod&&M.authMethod.toLowerCase()==="post",ne,re=M.authUrl.indexOf("?");re>-1&&(ne=l.parseQueryString(M.authUrl.slice(re)),M.authUrl=M.authUrl.slice(0,re),X||(M.authParams=l.mixin(ne,M.authParams)));var ce=l.mixin({},M.authParams||{},_),Z=function($e,Ae,zt,Co){var xt;if($e?a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Received Error: "+l.inspectError($e)):(xt=zt["content-type"],a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Received; content-type: "+xt+"; body: "+l.inspectBody(Ae))),$e||Co)return V($e,Ae);if(f.default.BufferUtils.isBuffer(Ae)&&(Ae=Ae.toString()),!xt){V(new g.default("authUrl response is missing a content-type header",40170,401));return}var ko=xt.indexOf("application/json")>-1,tl=xt.indexOf("text/plain")>-1||xt.indexOf("application/jwt")>-1;if(!ko&&!tl){V(new g.default("authUrl responded with unacceptable content-type "+xt+", should be either text/plain, application/jwt or application/json",40170,401));return}if(ko){if(Ae.length>T){V(new g.default("authUrl response exceeded max permitted length",40170,401));return}try{Ae=JSON.parse(Ae)}catch(nl){V(new g.default("Unexpected error processing authURL response; err = "+nl.message,40170,401));return}}V(null,Ae,xt)};if(a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Requesting token from "+M.authUrl+"; Params: "+JSON.stringify(ce)+"; method: "+(X?"POST":"GET")),X){var ye=Y||{};ye["content-type"]="application/x-www-form-urlencoded";var De=l.toQueryString(ce).slice(1);j.client.http.doUri(y.default.Post,$,M.authUrl,ye,De,ne,Z)}else j.client.http.doUri(y.default.Get,$,M.authUrl,Y||{},null,ce,Z)};else if(M.key)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with client-side signing"),z=function(_,V){j.createTokenRequest(_,M,V)};else{var W="Need a new token, but authOptions does not include any way to request one (no authUrl, authCallback, or key)";a.default.logAction(a.default.LOG_ERROR,"Auth()","library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help"),U(new g.default(W,40171,403));return}"capability"in I&&(I.capability=c(I.capability));var F=function(_,V){var Y=_.keyName,X="/keys/"+Y+"/requestToken",ne=function(ce){return $.baseUri(ce)+X},re=l.defaultPostHeaders(j.client.options);M.requestHeaders&&l.mixin(re,M.requestHeaders),a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().requestToken","Sending POST to "+X+"; Token params: "+JSON.stringify(_)),j.client.http.do(y.default.Post,$,ne,re,JSON.stringify(_),null,V)},O=!1,D=this.client.options.timeouts.realtimeRequestTimeout,B=setTimeout(function(){O=!0;var _="Token request callback timed out after "+D/1e3+" seconds";a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",_),U(new g.default(_,40170,401))},D);z(I,function(_,V,Y){if(!O){if(clearTimeout(B),_){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request signing call returned error; err = "+l.inspectError(_)),U(b(_));return}if(typeof V=="string"){V.length===0?U(new g.default("Token string is empty",40170,401)):V.length>T?U(new g.default("Token string exceeded max permitted length (was "+V.length+" bytes)",40170,401)):V==="undefined"||V==="null"?U(new g.default("Token string was literal null/undefined",40170,401)):V[0]==="{"&&!(Y&&Y.indexOf("application/jwt")>-1)?U(new g.default("Token was double-encoded; make sure you're not JSON-encoding an already encoded token request or details",40170,401)):U(null,{token:V});return}if(typeof V!="object"){var X="Expected token request callback to call back with a token string or token request/details object, but got a "+typeof V;a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",X),U(new g.default(X,40170,401));return}var ne=JSON.stringify(V).length;if(ne>T&&!M.suppressMaxLengthCheck){U(new g.default("Token request/details object exceeded max permitted stringified size (was "+ne+" bytes)",40170,401));return}if("issued"in V){U(null,V);return}if(!("keyName"in V)){var X="Expected token request callback to call back with a token string, token request object, or token details object";a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",X),U(new g.default(X,40170,401));return}F(V,function(re,ce,Z,ye){if(re){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request API call returned error; err = "+l.inspectError(re)),U(b(re));return}ye||(ce=JSON.parse(ce)),a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","token received"),U(null,ce)})}})},P.prototype.createTokenRequest=function(I,M,A){var j=this;if(typeof I=="function"&&!A?(A=I,M=I=null):typeof M=="function"&&!A&&(A=M,M=null),!A&&this.client.options.promises)return l.promisify(this,"createTokenRequest",arguments);M=M||this.authOptions,I=I||l.copy(this.tokenParams);var U=M.key;if(!U){A(new g.default("No key specified",40101,403));return}var z=U.split(":"),$=z[0],W=z[1];if(!W){A(new g.default("Invalid key specified",40101,403));return}if(I.clientId===""){A(new g.default("clientId can’t be an empty string",40012,400));return}"capability"in I&&(I.capability=c(I.capability));var F=l.mixin({keyName:$},I),O=I.clientId||"",D=I.ttl||"",B=I.capability||"";(function(_){if(F.timestamp){_();return}j.getTimestamp(M&&M.queryTime,function(V,Y){if(V){A(V);return}F.timestamp=Y,_()})})(function(){var _=F.nonce||(F.nonce=p()),V=F.timestamp,Y=F.keyName+`
137
+ ***************************************************************************** */var i=function(I,P){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,j){A.__proto__=j}||function(A,j){for(var U in j)Object.prototype.hasOwnProperty.call(j,U)&&(A[U]=j[U])},i(I,P)};function a(I,P){if(typeof P!="function"&&P!==null)throw new TypeError("Class extends value "+String(P)+" is not a constructor or null");i(I,P);function A(){this.constructor=I}I.prototype=P===null?Object.create(P):(A.prototype=P.prototype,new A)}var l=function(){return l=Object.assign||function(P){for(var A,j=1,U=arguments.length;j<U;j++){A=arguments[j];for(var z in A)Object.prototype.hasOwnProperty.call(A,z)&&(P[z]=A[z])}return P},l.apply(this,arguments)};function d(I,P){var A={};for(var j in I)Object.prototype.hasOwnProperty.call(I,j)&&P.indexOf(j)<0&&(A[j]=I[j]);if(I!=null&&typeof Object.getOwnPropertySymbols=="function")for(var U=0,j=Object.getOwnPropertySymbols(I);U<j.length;U++)P.indexOf(j[U])<0&&Object.prototype.propertyIsEnumerable.call(I,j[U])&&(A[j[U]]=I[j[U]]);return A}function g(I,P,A,j){var U=arguments.length,z=U<3?P:j===null?j=Object.getOwnPropertyDescriptor(P,A):j,$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(I,P,A,j);else for(var W=I.length-1;W>=0;W--)($=I[W])&&(z=(U<3?$(z):U>3?$(P,A,z):$(P,A))||z);return U>3&&z&&Object.defineProperty(P,A,z),z}function S(I,P){return function(A,j){P(A,j,I)}}function E(I,P){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(I,P)}function y(I,P,A,j){function U(z){return z instanceof A?z:new A(function($){$(z)})}return new(A||(A=Promise))(function(z,$){function W(D){try{O(j.next(D))}catch(B){$(B)}}function F(D){try{O(j.throw(D))}catch(B){$(B)}}function O(D){D.done?z(D.value):U(D.value).then(W,F)}O((j=j.apply(I,P||[])).next())})}function R(I,P){var A={label:0,sent:function(){if(z[0]&1)throw z[1];return z[1]},trys:[],ops:[]},j,U,z,$;return $={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&($[Symbol.iterator]=function(){return this}),$;function W(O){return function(D){return F([O,D])}}function F(O){if(j)throw new TypeError("Generator is already executing.");for(;A;)try{if(j=1,U&&(z=O[0]&2?U.return:O[0]?U.throw||((z=U.return)&&z.call(U),0):U.next)&&!(z=z.call(U,O[1])).done)return z;switch(U=0,z&&(O=[O[0]&2,z.value]),O[0]){case 0:case 1:z=O;break;case 4:return A.label++,{value:O[1],done:!1};case 5:A.label++,U=O[1],O=[0];continue;case 7:O=A.ops.pop(),A.trys.pop();continue;default:if(z=A.trys,!(z=z.length>0&&z[z.length-1])&&(O[0]===6||O[0]===2)){A=0;continue}if(O[0]===3&&(!z||O[1]>z[0]&&O[1]<z[3])){A.label=O[1];break}if(O[0]===6&&A.label<z[1]){A.label=z[1],z=O;break}if(z&&A.label<z[2]){A.label=z[2],A.ops.push(O);break}z[2]&&A.ops.pop(),A.trys.pop();continue}O=P.call(I,A)}catch(D){O=[6,D],U=0}finally{j=z=0}if(O[0]&5)throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}}var f=Object.create?function(I,P,A,j){j===void 0&&(j=A),Object.defineProperty(I,j,{enumerable:!0,get:function(){return P[A]}})}:function(I,P,A,j){j===void 0&&(j=A),I[j]=P[A]};function k(I,P){for(var A in I)A!=="default"&&!Object.prototype.hasOwnProperty.call(P,A)&&f(P,I,A)}function T(I){var P=typeof Symbol=="function"&&Symbol.iterator,A=P&&I[P],j=0;if(A)return A.call(I);if(I&&typeof I.length=="number")return{next:function(){return I&&j>=I.length&&(I=void 0),{value:I&&I[j++],done:!I}}};throw new TypeError(P?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(I,P){var A=typeof Symbol=="function"&&I[Symbol.iterator];if(!A)return I;var j=A.call(I),U,z=[],$;try{for(;(P===void 0||P-- >0)&&!(U=j.next()).done;)z.push(U.value)}catch(W){$={error:W}}finally{try{U&&!U.done&&(A=j.return)&&A.call(j)}finally{if($)throw $.error}}return z}function p(){for(var I=[],P=0;P<arguments.length;P++)I=I.concat(x(arguments[P]));return I}function m(){for(var I=0,P=0,A=arguments.length;P<A;P++)I+=arguments[P].length;for(var j=Array(I),U=0,P=0;P<A;P++)for(var z=arguments[P],$=0,W=z.length;$<W;$++,U++)j[U]=z[$];return j}function b(I,P,A){if(A||arguments.length===2)for(var j=0,U=P.length,z;j<U;j++)(z||!(j in P))&&(z||(z=Array.prototype.slice.call(P,0,j)),z[j]=P[j]);return I.concat(z||Array.prototype.slice.call(P))}function h(I){return this instanceof h?(this.v=I,this):new h(I)}function c(I,P,A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var j=A.apply(I,P||[]),U,z=[];return U={},$("next"),$("throw"),$("return"),U[Symbol.asyncIterator]=function(){return this},U;function $(_){j[_]&&(U[_]=function(V){return new Promise(function(Y,X){z.push([_,V,Y,X])>1||W(_,V)})})}function W(_,V){try{F(j[_](V))}catch(Y){B(z[0][3],Y)}}function F(_){_.value instanceof h?Promise.resolve(_.value.v).then(O,D):B(z[0][2],_)}function O(_){W("next",_)}function D(_){W("throw",_)}function B(_,V){_(V),z.shift(),z.length&&W(z[0][0],z[0][1])}}function u(I){var P,A;return P={},j("next"),j("throw",function(U){throw U}),j("return"),P[Symbol.iterator]=function(){return this},P;function j(U,z){P[U]=I[U]?function($){return(A=!A)?{value:h(I[U]($)),done:U==="return"}:z?z($):$}:z}}function s(I){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var P=I[Symbol.asyncIterator],A;return P?P.call(I):(I=typeof T=="function"?T(I):I[Symbol.iterator](),A={},j("next"),j("throw"),j("return"),A[Symbol.asyncIterator]=function(){return this},A);function j(z){A[z]=I[z]&&function($){return new Promise(function(W,F){$=I[z]($),U(W,F,$.done,$.value)})}}function U(z,$,W,F){Promise.resolve(F).then(function(O){z({value:O,done:W})},$)}}function w(I,P){return Object.defineProperty?Object.defineProperty(I,"raw",{value:P}):I.raw=P,I}var v=Object.create?function(I,P){Object.defineProperty(I,"default",{enumerable:!0,value:P})}:function(I,P){I.default=P};function C(I){if(I&&I.__esModule)return I;var P={};if(I!=null)for(var A in I)A!=="default"&&Object.prototype.hasOwnProperty.call(I,A)&&f(P,I,A);return v(P,I),P}function L(I){return I&&I.__esModule?I:{default:I}}function N(I,P,A,j){if(A==="a"&&!j)throw new TypeError("Private accessor was defined without a getter");if(typeof P=="function"?I!==P||!j:!P.has(I))throw new TypeError("Cannot read private member from an object whose class did not declare it");return A==="m"?j:A==="a"?j.call(I):j?j.value:P.get(I)}function M(I,P,A,j,U){if(j==="m")throw new TypeError("Private method is not writable");if(j==="a"&&!U)throw new TypeError("Private accessor was defined without a setter");if(typeof P=="function"?I!==P||!U:!P.has(I))throw new TypeError("Cannot write private member to an object whose class did not declare it");return j==="a"?U.call(I,A):U?U.value=A:P.set(I,A),A}},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0}),r.allToUpperCase=r.allToLowerCase=r.encodeBody=r.decodeBody=r.Format=r.promisify=r.trim=r.arrChooseN=r.randomHexString=r.randomString=r.cheapRandStr=r.dataSizeBytes=r.inspectBody=r.inspectError=r.isErrorInfoOrPartialErrorInfo=r.now=r.parseQueryString=r.toQueryString=r.arrPopRandomElement=r.defaultPostHeaders=r.defaultGetHeaders=r.allSame=r.arrEvery=r.arrFilter=r.arrMap=r.safeArrForEach=r.arrForEach=r.forInOwnNonNullProperties=r.valuesArray=r.keysArray=r.arrWithoutValue=r.arrDeleteValue=r.arrIn=r.arrIndexOf=r.arrSubtract=r.arrIntersectOb=r.arrIntersect=r.intersect=r.containsValue=r.inherits=r.prototypicalClone=r.shallowClone=r.isEmptyArg=r.isOnlyPropIn=r.isEmpty=r.isObject=r.ensureArray=r.isArray=r.copy=r.mixin=void 0,r.arrEquals=r.toBase64=r.matchDerivedChannel=r.shallowEquals=r.getGlobalObject=r.getRetryTime=r.getJitterCoefficient=r.getBackoffCoefficient=void 0;var a=o(0),l=a.__importDefault(o(3)),d=a.__importStar(o(8)),g=a.__importDefault(o(4)),S=o(11),E=o(31);function y(H){return Math.floor(Math.random()*H.length)}function R(H){for(var Q=[],K=1;K<arguments.length;K++)Q[K-1]=arguments[K];for(var ee=0;ee<Q.length;ee++){var ie=Q[ee];if(!ie)break;var Ze=Object.prototype.hasOwnProperty;for(var Kr in ie)(!Ze||Ze.call(ie,Kr))&&(H[Kr]=ie[Kr])}return H}r.mixin=R;function f(H){return R({},H)}r.copy=f,r.isArray=Array.isArray||function(H){return Object.prototype.toString.call(H)=="[object Array]"};function k(H){return m(H)?[]:(0,r.isArray)(H)?H:[H]}r.ensureArray=k;function T(H){return Object.prototype.toString.call(H)=="[object Object]"}r.isObject=T;function x(H){for(var Q in H)return!1;return!0}r.isEmpty=x;function p(H,Q){for(var K in H)if(K!==Q)return!1;return!0}r.isOnlyPropIn=p;function m(H){return H==null}r.isEmptyArg=m;function b(H){var Q=new Object;for(var K in H)Q[K]=H[K];return Q}r.shallowClone=b;function h(H,Q){var K=function(){function ie(){}return ie}();K.prototype=H;var ee=new K;return Q&&R(ee,Q),ee}r.prototypicalClone=h;var c=function(H,Q){if(l.default.Config.inherits){l.default.Config.inherits(H,Q);return}H.super_=Q,H.prototype=h(Q.prototype,{constructor:H})};r.inherits=c;function u(H,Q){for(var K in H)if(H[K]==Q)return!0;return!1}r.containsValue=u;function s(H,Q){return(0,r.isArray)(Q)?w(H,Q):v(H,Q)}r.intersect=s;function w(H,Q){for(var K=[],ee=0;ee<H.length;ee++){var ie=H[ee];(0,r.arrIndexOf)(Q,ie)!=-1&&K.push(ie)}return K}r.arrIntersect=w;function v(H,Q){for(var K=[],ee=0;ee<H.length;ee++){var ie=H[ee];ie in Q&&K.push(ie)}return K}r.arrIntersectOb=v;function C(H,Q){for(var K=[],ee=0;ee<H.length;ee++){var ie=H[ee];(0,r.arrIndexOf)(Q,ie)==-1&&K.push(ie)}return K}r.arrSubtract=C,r.arrIndexOf=Array.prototype.indexOf?function(H,Q,K){return H.indexOf(Q,K)}:function(H,Q,K){K=K||0;for(var ee=H.length;K<ee;K++)if(H[K]===Q)return K;return-1};function L(H,Q){return(0,r.arrIndexOf)(H,Q)!==-1}r.arrIn=L;function N(H,Q){var K=(0,r.arrIndexOf)(H,Q),ee=K!=-1;return ee&&H.splice(K,1),ee}r.arrDeleteValue=N;function M(H,Q){var K=H.slice();return N(K,Q),K}r.arrWithoutValue=M;function I(H,Q){var K=[];for(var ee in H)Q&&!Object.prototype.hasOwnProperty.call(H,ee)||K.push(ee);return K}r.keysArray=I;function P(H,Q){var K=[];for(var ee in H)Q&&!Object.prototype.hasOwnProperty.call(H,ee)||K.push(H[ee]);return K}r.valuesArray=P;function A(H,Q){for(var K in H)Object.prototype.hasOwnProperty.call(H,K)&&H[K]&&Q(K)}r.forInOwnNonNullProperties=A,r.arrForEach=Array.prototype.forEach?function(H,Q){H.forEach(Q)}:function(H,Q){for(var K=H.length,ee=0;ee<K;ee++)Q(H[ee],ee,H)};function j(H,Q){return(0,r.arrForEach)(H.slice(),Q)}r.safeArrForEach=j,r.arrMap=Array.prototype.map?function(H,Q){return H.map(Q)}:function(H,Q){for(var K=[],ee=H.length,ie=0;ie<ee;ie++)K.push(Q(H[ie],ie,H));return K},r.arrFilter=Array.prototype.filter?function(H,Q){return H.filter(Q)}:function(H,Q){for(var K=[],ee=H.length,ie=0;ie<ee;ie++)Q(H[ie])&&K.push(H[ie]);return K},r.arrEvery=Array.prototype.every?function(H,Q){return H.every(Q)}:function(H,Q){for(var K=H.length,ee=0;ee<K;ee++)if(!Q(H[ee],ee,H))return!1;return!0};function U(H,Q){if(H.length===0)return!0;var K=H[0][Q];return(0,r.arrEvery)(H,function(ee){return ee[Q]===K})}r.allSame=U;var z={json:"application/json",jsonp:"application/javascript",xml:"application/xml",html:"text/html",msgpack:"application/x-msgpack"};function $(H,Q){var K=z[Q||ye.json];return{accept:K,"X-Ably-Version":d.default.protocolVersion.toString(),"Ably-Agent":(0,d.getAgentString)(H)}}r.defaultGetHeaders=$;function W(H,Q){var K,ee=K=z[Q||ye.json];return{accept:ee,"content-type":K,"X-Ably-Version":d.default.protocolVersion.toString(),"Ably-Agent":(0,d.getAgentString)(H)}}r.defaultPostHeaders=W;function F(H){return H.splice(y(H),1)[0]}r.arrPopRandomElement=F;function O(H){var Q=[];if(H)for(var K in H)Q.push(encodeURIComponent(K)+"="+encodeURIComponent(H[K]));return Q.length?"?"+Q.join("&"):""}r.toQueryString=O;function D(H){for(var Q,K=/([^?&=]+)=?([^&]*)/g,ee={};Q=K.exec(H);)ee[decodeURIComponent(Q[1])]=decodeURIComponent(Q[2]);return ee}r.parseQueryString=D,r.now=Date.now||function(){return new Date().getTime()};function B(H){return typeof H=="object"&&H!==null&&(H.constructor.name=="ErrorInfo"||H.constructor.name=="PartialErrorInfo")}r.isErrorInfoOrPartialErrorInfo=B;function _(H){var Q,K;return H instanceof Error||((Q=H==null?void 0:H.constructor)===null||Q===void 0?void 0:Q.name)==="ErrorInfo"||((K=H==null?void 0:H.constructor)===null||K===void 0?void 0:K.name)==="PartialErrorInfo"?H.toString():l.default.Config.inspect(H)}r.inspectError=_;function V(H){return l.default.BufferUtils.isBuffer(H)?H.toString():typeof H=="string"?H:l.default.Config.inspect(H)}r.inspectBody=V;function Y(H){if(l.default.BufferUtils.isBuffer(H))return l.default.BufferUtils.byteLength(H);if(typeof H=="string")return l.default.Config.stringByteSize(H);throw new Error("Expected input of Utils.dataSizeBytes to be a buffer or string, but was: "+typeof H)}r.dataSizeBytes=Y;function X(){return String(Math.random()).substr(2)}r.cheapRandStr=X;var ne=function(H){if(l.default.Config.getRandomValues&&typeof Uint8Array!="undefined"){var Q=new Uint8Array(H);return l.default.Config.getRandomValues(Q),l.default.BufferUtils.base64Encode(Q)}for(var K=l.default.BufferUtils.base64CharSet,ee=Math.round(H*4/3),ie="",Ze=0;Ze<ee;Ze++)ie+=K[y(K)];return ie};r.randomString=ne;var re=function(H){if(l.default.Config.getRandomValues&&typeof Uint8Array!="undefined"){var Q=new Uint8Array(H);return l.default.Config.getRandomValues(Q),l.default.BufferUtils.hexEncode(Q)}for(var K=l.default.BufferUtils.hexCharSet,ee=H*2,ie="",Ze=0;Ze<ee;Ze++)ie+=K[y(K)];return ie};r.randomHexString=re;function ce(H,Q){for(var K=Math.min(Q,H.length),ee=H.slice(),ie=[],Ze=0;Ze<K;Ze++)ie.push(F(ee));return ie}r.arrChooseN=ce,r.trim=String.prototype.trim?function(H){return H.trim()}:function(H){return H.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function Z(H,Q,K){return new Promise(function(ee,ie){H[Q].apply(H,a.__spreadArray(a.__spreadArray([],K,!1),[function(Ze,Kr){Ze?ie(Ze):ee(Kr)}],!1))})}r.promisify=Z;var ye;(function(H){H.msgpack="msgpack",H.json="json"})(ye=r.Format||(r.Format={}));function De(H,Q){return Q=="msgpack"?l.default.Config.msgpack.decode(H):JSON.parse(String(H))}r.decodeBody=De;function $e(H,Q){return Q=="msgpack"?l.default.Config.msgpack.encode(H,!0):JSON.stringify(H)}r.encodeBody=$e;function Ae(H){return H.map(function(Q){return Q&&Q.toLowerCase()})}r.allToLowerCase=Ae;function zt(H){return H.map(function(Q){return Q&&Q.toUpperCase()})}r.allToUpperCase=zt;function Ci(H){return Math.min((H+2)/3,2)}r.getBackoffCoefficient=Ci;function xt(){return 1-Math.random()*.2}r.getJitterCoefficient=xt;function ki(H,Q){return H*Ci(Q)*xt()}r.getRetryTime=ki;function tl(){return i||(typeof window!="undefined"?window:self)}r.getGlobalObject=tl;function nl(H,Q){return Object.keys(H).every(function(K){return H[K]===Q[K]})&&Object.keys(Q).every(function(K){return Q[K]===H[K]})}r.shallowEquals=nl;function Kg(H){var Q=/^(\[([^?]*)(?:(.*))\])?(.+)$/,K=H.match(Q);if(!K||!K.length||K.length<5)throw new g.default("regex match failed",400,40010);if(K[2])throw new g.default("cannot use a derived option with a ".concat(K[2]," channel"),400,40010);return{qualifierParam:K[3]||"",channelName:K[4]}}r.matchDerivedChannel=Kg;function Jg(H){return l.default.Config.createHmac?Buffer.from(H,"ascii").toString("base64"):(0,S.stringify)((0,E.parse)(H))}r.toBase64=Jg;function Yg(H,Q){return H.length===Q.length&&(0,r.arrEvery)(H,function(K,ee){return K===Q[ee]})}r.arrEquals=Yg}).call(this,o(13))},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),l=a.__importDefault(o(3)),d=i||(typeof window!="undefined"?window:self),g;(function(f){f[f.None=0]="None",f[f.Error=1]="Error",f[f.Major=2]="Major",f[f.Minor=3]="Minor",f[f.Micro=4]="Micro"})(g||(g={}));function S(f,k){return"".concat(f).padStart(k?3:2,"0")}function E(f){return l.default.Config.logTimestamps?function(k){var T=new Date;f(S(T.getHours())+":"+S(T.getMinutes())+":"+S(T.getSeconds())+"."+S(T.getMilliseconds(),1)+" "+k)}:f}var y=function(){var f,k,T,x;return typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"||typeof((k=(f=d==null?void 0:d.console)===null||f===void 0?void 0:f.log)===null||k===void 0?void 0:k.apply)=="function"?(T=function(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];console.log.apply(console,p)},x=console.warn?function(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];console.warn.apply(console,p)}:T):d!=null&&d.console.log?T=x=function(){Function.prototype.apply.call(console.log,console,arguments)}:T=x=function(){},[T,x].map(E)},R=function(){function f(){f.logLevel=f.LOG_DEFAULT}return f.initLogHandlers=function(){var k=y(),T=k[0],x=k[1];this.logHandler=T,this.logErrorHandler=x},f.renamedClientOption=function(k,T){f.deprecationWarning("The `".concat(k,"` client option has been renamed to `").concat(T,"`. Please update your code to use `").concat(T,"` instead. `").concat(k,"` will be removed in a future version."))},f.renamedMethod=function(k,T,x){f.deprecationWarning("`".concat(k,"`’s `").concat(T,"` method has been renamed to `").concat(x,"`. Please update your code to use `").concat(x,"` instead. `").concat(T,"` will be removed in a future version."))},f.deprecationWarning=function(k){f.shouldLog(g.Error)&&f.logErrorHandler("Ably: Deprecation warning - ".concat(k))},f.logLevel=g.Error,f.LOG_NONE=g.None,f.LOG_ERROR=g.Error,f.LOG_MAJOR=g.Major,f.LOG_MINOR=g.Minor,f.LOG_MICRO=g.Micro,f.LOG_DEFAULT=g.Error,f.LOG_DEBUG=g.Micro,f.logAction=function(k,T,x){f.shouldLog(k)&&(k===g.Error?f.logErrorHandler:f.logHandler)("Ably: "+T+": "+x)},f.deprecated=function(k,T){f.deprecationWarning("".concat(k," is deprecated and will be removed in a future version. ").concat(T))},f.shouldLog=function(k){return k<=f.logLevel},f.setLog=function(k,T){k!==void 0&&(f.logLevel=k),T!==void 0&&(f.logHandler=f.logErrorHandler=T)},f}();r.default=R}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function a(){}return a}();r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.PartialErrorInfo=void 0;var i=o(0),a=i.__importDefault(o(3)),l=i.__importStar(o(1));function d(E){var y="["+E.constructor.name;return E.message&&(y+=": "+E.message),E.statusCode&&(y+="; statusCode="+E.statusCode),E.code&&(y+="; code="+E.code),E.cause&&(y+="; cause="+l.inspectError(E.cause)),E.href&&!(E.message&&E.message.indexOf("help.ably.io")>-1)&&(y+="; see "+E.href+" "),y+="]",y}var g=function(E){i.__extends(y,E);function y(R,f,k,T){var x=E.call(this,R)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(x,y.prototype),x.code=f,x.statusCode=k,x.cause=T,x}return y.prototype.toString=function(){return d(this)},y.fromValues=function(R){var f=R,k=f.message,T=f.code,x=f.statusCode;if(typeof k!="string"||typeof T!="number"||typeof x!="number")throw new Error("ErrorInfo.fromValues(): invalid values: "+a.default.Config.inspect(R));var p=Object.assign(new y(k,T,x),R);return p.code&&!p.href&&(p.href="https://help.ably.io/error/"+p.code),p},y}(Error);r.default=g;var S=function(E){i.__extends(y,E);function y(R,f,k,T){var x=E.call(this,R)||this;return typeof Object.setPrototypeOf!="undefined"&&Object.setPrototypeOf(x,y.prototype),x.code=f,x.statusCode=k,x.cause=T,x}return y.prototype.toString=function(){return d(this)},y}(Error);r.PartialErrorInfo=S},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){if(typeof ArrayBuffer=="function"){var a=i,l=a.lib,d=l.WordArray,g=d.init,S=d.init=function(E){if(E instanceof ArrayBuffer&&(E=new Uint8Array(E)),(E instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&E instanceof Uint8ClampedArray||E instanceof Int16Array||E instanceof Uint16Array||E instanceof Int32Array||E instanceof Uint32Array||E instanceof Float32Array||E instanceof Float64Array)&&(E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength)),E instanceof Uint8Array){for(var y=E.byteLength,R=[],f=0;f<y;f++)R[f>>>2]|=E[f]<<24-f%4*8;g.call(this,R,y)}else g.apply(this,arguments)};S.prototype=d}}(),i.lib.WordArray})},function(n,r,o){(function(i){(function(a,l){n.exports=l()})(this,function(){var a=a||function(l,d){var g;if(typeof window!="undefined"&&window.crypto&&(g=window.crypto),!g&&typeof window!="undefined"&&window.msCrypto&&(g=window.msCrypto),!g&&typeof i!="undefined"&&i.crypto&&(g=i.crypto),!g)try{g=o(44)}catch(c){}var S=function(){if(g){if(typeof g.getRandomValues=="function")try{return g.getRandomValues(new Uint32Array(1))[0]}catch(c){}if(typeof g.randomBytes=="function")try{return g.randomBytes(4).readInt32LE()}catch(c){}}throw new Error("Native crypto module could not be used to get secure random number.")},E=Object.create||function(){function c(){}return function(u){var s;return c.prototype=u,s=new c,c.prototype=null,s}}(),y={},R=y.lib={},f=R.Base=function(){return{extend:function(c){var u=E(this);return c&&u.mixIn(c),(!u.hasOwnProperty("init")||this.init===u.init)&&(u.init=function(){u.$super.init.apply(this,arguments)}),u.init.prototype=u,u.$super=this,u},create:function(){var c=this.extend();return c.init.apply(c,arguments),c},init:function(){},mixIn:function(c){for(var u in c)c.hasOwnProperty(u)&&(this[u]=c[u]);c.hasOwnProperty("toString")&&(this.toString=c.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),k=R.WordArray=f.extend({init:function(c,u){c=this.words=c||[],u!=d?this.sigBytes=u:this.sigBytes=c.length*4},toString:function(c){return(c||x).stringify(this)},concat:function(c){var u=this.words,s=c.words,w=this.sigBytes,v=c.sigBytes;if(this.clamp(),w%4)for(var C=0;C<v;C++){var L=s[C>>>2]>>>24-C%4*8&255;u[w+C>>>2]|=L<<24-(w+C)%4*8}else for(var C=0;C<v;C+=4)u[w+C>>>2]=s[C>>>2];return this.sigBytes+=v,this},clamp:function(){var c=this.words,u=this.sigBytes;c[u>>>2]&=4294967295<<32-u%4*8,c.length=l.ceil(u/4)},clone:function(){var c=f.clone.call(this);return c.words=this.words.slice(0),c},random:function(c){for(var u=[],s=0;s<c;s+=4)u.push(S());return new k.init(u,c)}}),T=y.enc={},x=T.Hex={stringify:function(c){for(var u=c.words,s=c.sigBytes,w=[],v=0;v<s;v++){var C=u[v>>>2]>>>24-v%4*8&255;w.push((C>>>4).toString(16)),w.push((C&15).toString(16))}return w.join("")},parse:function(c){for(var u=c.length,s=[],w=0;w<u;w+=2)s[w>>>3]|=parseInt(c.substr(w,2),16)<<24-w%8*4;return new k.init(s,u/2)}},p=T.Latin1={stringify:function(c){for(var u=c.words,s=c.sigBytes,w=[],v=0;v<s;v++){var C=u[v>>>2]>>>24-v%4*8&255;w.push(String.fromCharCode(C))}return w.join("")},parse:function(c){for(var u=c.length,s=[],w=0;w<u;w++)s[w>>>2]|=(c.charCodeAt(w)&255)<<24-w%4*8;return new k.init(s,u)}},m=T.Utf8={stringify:function(c){try{return decodeURIComponent(escape(p.stringify(c)))}catch(u){throw new Error("Malformed UTF-8 data")}},parse:function(c){return p.parse(unescape(encodeURIComponent(c)))}},b=R.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new k.init,this._nDataBytes=0},_append:function(c){typeof c=="string"&&(c=m.parse(c)),this._data.concat(c),this._nDataBytes+=c.sigBytes},_process:function(c){var u,s=this._data,w=s.words,v=s.sigBytes,C=this.blockSize,L=C*4,N=v/L;c?N=l.ceil(N):N=l.max((N|0)-this._minBufferSize,0);var M=N*C,I=l.min(M*4,v);if(M){for(var P=0;P<M;P+=C)this._doProcessBlock(w,P);u=w.splice(0,M),s.sigBytes-=I}return new k.init(u,I)},clone:function(){var c=f.clone.call(this);return c._data=this._data.clone(),c},_minBufferSize:0});R.Hasher=b.extend({cfg:f.extend(),init:function(c){this.cfg=this.cfg.extend(c),this.reset()},reset:function(){b.reset.call(this),this._doReset()},update:function(c){return this._append(c),this._process(),this},finalize:function(c){c&&this._append(c);var u=this._doFinalize();return u},blockSize:16,_createHelper:function(c){return function(u,s){return new c.init(s).finalize(u)}},_createHmacHelper:function(c){return function(u,s){return new h.HMAC.init(c,s).finalize(u)}}});var h=y.algo={};return y}(Math);return a})}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(2)),d=i.__importDefault(o(3));function g(y,R,f){try{R.apply(y,f)}catch(k){l.default.logAction(l.default.LOG_ERROR,"EventEmitter.emit()","Unexpected listener exception: "+k+"; stack = "+(k&&k.stack))}}function S(y,R,f){for(var k,T,x,p=0;p<y.length;p++)if(k=y[p],f&&(k=k[f]),a.isArray(k)){for(;(T=a.arrIndexOf(k,R))!==-1;)k.splice(T,1);f&&k.length===0&&delete y[p][f]}else if(a.isObject(k))for(x in k)Object.prototype.hasOwnProperty.call(k,x)&&a.isArray(k[x])&&S([k],R,x)}var E=function(){function y(){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null)}return y.prototype.on=function(){for(var R=this,f=[],k=0;k<arguments.length;k++)f[k]=arguments[k];if(f.length===1){var T=f[0];if(typeof T=="function")this.any.push(T);else throw new Error("EventListener.on(): Invalid arguments: "+d.default.Config.inspect(f))}if(f.length===2){var x=f[0],p=f[1];if(typeof p!="function")throw new Error("EventListener.on(): Invalid arguments: "+d.default.Config.inspect(f));if(a.isEmptyArg(x))this.any.push(p);else if(a.isArray(x))x.forEach(function(b){R.on(b,p)});else{if(typeof x!="string")throw new Error("EventListener.on(): Invalid arguments: "+d.default.Config.inspect(f));var m=this.events[x]||(this.events[x]=[]);m.push(p)}}},y.prototype.off=function(){for(var R,f=this,k=[],T=0;T<arguments.length;T++)k[T]=arguments[T];if(k.length==0||a.isEmptyArg(k[0])&&a.isEmptyArg(k[1])){this.any=[],this.events=Object.create(null),this.anyOnce=[],this.eventsOnce=Object.create(null);return}var x=k[0],p=k[1],m=null,b=null;if(k.length===1||!p)typeof x=="function"?m=x:b=x;else{if(typeof p!="function")throw new Error("EventEmitter.off(): invalid arguments:"+d.default.Config.inspect(k));R=[x,p],b=R[0],m=R[1]}if(m&&a.isEmptyArg(b)){S([this.any,this.events,this.anyOnce,this.eventsOnce],m);return}if(a.isArray(b)){b.forEach(function(h){f.off(h,m)});return}if(typeof b!="string")throw new Error("EventEmitter.off(): invalid arguments:"+d.default.Config.inspect(k));m?S([this.events,this.eventsOnce],m,b):(delete this.events[b],delete this.eventsOnce[b])},y.prototype.listeners=function(R){if(R){var f=this.events[R]||[];return this.eventsOnce[R]&&Array.prototype.push.apply(f,this.eventsOnce[R]),f.length?f:null}return this.any.length?this.any:null},y.prototype.emit=function(R){for(var f=[],k=1;k<arguments.length;k++)f[k-1]=arguments[k];var T={event:R},x=[];this.anyOnce.length&&(Array.prototype.push.apply(x,this.anyOnce),this.anyOnce=[]),this.any.length&&Array.prototype.push.apply(x,this.any);var p=this.eventsOnce[R];p&&(Array.prototype.push.apply(x,p),delete this.eventsOnce[R]);var m=this.events[R];m&&Array.prototype.push.apply(x,m),a.arrForEach(x,function(b){g(T,b,f)})},y.prototype.once=function(){for(var R=this,f=[],k=0;k<arguments.length;k++)f[k]=arguments[k];var T=f.length;if((T===0||T===1&&typeof f[0]!="function")&&d.default.Config.Promise){var x=f[0];return new d.default.Config.Promise(function(u){R.once(x,u)})}var p=f[0],m=f[1];if(f.length===1&&typeof p=="function")this.anyOnce.push(p);else if(a.isEmptyArg(p)){if(typeof m!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));this.anyOnce.push(m)}else if(a.isArray(p)){var b=this,h=function(){var u=Array.prototype.slice.call(arguments);if(a.arrForEach(p,function(s){b.off(s,h)}),typeof m!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));m.apply(this,u)};a.arrForEach(p,function(u){b.on(u,h)})}else{if(typeof p!="string")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));var c=this.eventsOnce[p]||(this.eventsOnce[p]=[]);if(m){if(typeof m!="function")throw new Error("EventEmitter.once(): Invalid arguments:"+d.default.Config.inspect(f));c.push(m)}}},y.prototype.whenState=function(R,f,k){for(var T=this,x=[],p=3;p<arguments.length;p++)x[p-3]=arguments[p];var m={event:R};if(typeof R!="string"||typeof f!="string")throw"whenState requires a valid event String argument";if(typeof k!="function"&&d.default.Config.Promise)return new d.default.Config.Promise(function(b){y.prototype.whenState.apply(T,[R,f,b].concat(x))});R===f?g(m,k,x):this.once(R,k)},y}();r.default=E},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.getDefaults=r.normaliseOptions=r.objectifyOptions=r.getAgentString=r.getHosts=r.getFallbackHosts=r.environmentFallbackHosts=r.getHttpScheme=r.getPort=r.getHost=void 0;var i=o(0),a=i.__importDefault(o(3)),l=i.__importStar(o(1)),d=i.__importDefault(o(2)),g=i.__importDefault(o(4)),S=o(43),E="ably-js/"+S.version,y={ENVIRONMENT:"",REST_HOST:"rest.ably.io",REALTIME_HOST:"realtime.ably.io",FALLBACK_HOSTS:["A.ably-realtime.com","B.ably-realtime.com","C.ably-realtime.com","D.ably-realtime.com","E.ably-realtime.com"],PORT:80,TLS_PORT:443,TIMEOUTS:{disconnectedRetryTimeout:15e3,suspendedRetryTimeout:3e4,httpRequestTimeout:15e3,channelRetryTimeout:15e3,fallbackRetryTimeout:6e5,connectionStateTtl:12e4,realtimeRequestTimeout:1e4,recvTimeout:9e4,preferenceConnectTimeout:6e3,parallelUpgradeDelay:6e3},httpMaxRetryCount:3,maxMessageSize:65536,version:S.version,protocolVersion:2,agent:E,getHost:R,getPort:f,getHttpScheme:k,environmentFallbackHosts:T,getFallbackHosts:x,getHosts:p,checkHost:m,objectifyOptions:u,normaliseOptions:s};function R(v,C,L){return L?C=C==v.restHost&&v.realtimeHost||C||v.realtimeHost:C=C||v.restHost,C}r.getHost=R;function f(v,C){return C||v.tls?v.tlsPort:v.port}r.getPort=f;function k(v){return v.tls?"https://":"http://"}r.getHttpScheme=k;function T(v){return[v+"-a-fallback.ably-realtime.com",v+"-b-fallback.ably-realtime.com",v+"-c-fallback.ably-realtime.com",v+"-d-fallback.ably-realtime.com",v+"-e-fallback.ably-realtime.com"]}r.environmentFallbackHosts=T;function x(v){var C=v.fallbackHosts,L=typeof v.httpMaxRetryCount!="undefined"?v.httpMaxRetryCount:y.httpMaxRetryCount;return C?l.arrChooseN(C,L):[]}r.getFallbackHosts=x;function p(v){return[v.restHost].concat(x(v))}r.getHosts=p;function m(v){if(typeof v!="string")throw new g.default("host must be a string; was a "+typeof v,4e4,400);if(!v.length)throw new g.default("host must not be zero-length",4e4,400)}function b(v,C,L){return v.realtimeHost?v.realtimeHost:v.restHost?(d.default.logAction(d.default.LOG_MINOR,"Defaults.normaliseOptions",'restHost is set to "'+v.restHost+'" but realtimeHost is not set, so setting realtimeHost to "'+v.restHost+'" too. If this is not what you want, please set realtimeHost explicitly.'),v.restHost):C?y.REALTIME_HOST:L+"-"+y.REALTIME_HOST}function h(v){var C={};for(var L in y.TIMEOUTS)C[L]=v[L]||y.TIMEOUTS[L];return C}function c(v){var C=y.agent;if(v.agents)for(var L in v.agents)C+=" "+L+"/"+v.agents[L];return C}r.getAgentString=c;function u(v){return typeof v=="string"?v.indexOf(":")==-1?{token:v}:{key:v}:v}r.objectifyOptions=u;function s(v){if(v.host&&(d.default.renamedClientOption("host","restHost"),v.restHost=v.host),v.wsHost&&(d.default.renamedClientOption("wsHost","realtimeHost"),v.realtimeHost=v.wsHost),v.queueEvents&&(d.default.renamedClientOption("queueEvents","queueMessages"),v.queueMessages=v.queueEvents),v.headers&&d.default.deprecated("the `headers` client option",""),v.fallbackHostsUseDefault){if(v.fallbackHosts){var C="fallbackHosts and fallbackHostsUseDefault cannot both be set";throw d.default.logAction(d.default.LOG_ERROR,"Defaults.normaliseOptions",C),new g.default(C,4e4,400)}if(v.port||v.tlsPort){var C="fallbackHostsUseDefault cannot be set when port or tlsPort are set";throw d.default.logAction(d.default.LOG_ERROR,"Defaults.normaliseOptions",C),new g.default(C,4e4,400)}v.environment?d.default.deprecated("The `fallbackHostsUseDefault` client option","If you’re using this client option to force the library to make use of fallback hosts even though you’ve set the `environment` client option, then this is no longer necessary: remove your usage of the `fallbackHostsUseDefault` client option and the library will then automatically choose the correct fallback hosts to use for the specified environment."):d.default.deprecated("The `fallbackHostsUseDefault` client option","If you’re using this client option to force the library to make use of fallback hosts even though you’re not using the primary Ably environment, then stop using `fallbackHostsUseDefault`, and update your code to either pass the `environment` client option (in which case the library will automatically choose the correct fallback hosts to use for the specified environment), or to pass the `fallbackHosts` client option to specify a custom list of fallback hosts to use (for example, if you’re using a custom CNAME, in which case Ably will have provided you with an explicit list of fallback hosts)."),v.fallbackHosts=y.FALLBACK_HOSTS}v.recover===!0&&(d.default.deprecated("The ability to use a boolean value for the `recover` client option","If you wish for the connection to always be recovered, replace `{ recover: true }` with a function that always passes `true` to its callback: `{ recover: function(lastConnectionDetails, cb) { cb(true); } }`"),v.recover=function(F,O){O(!0)}),typeof v.recover=="function"&&v.closeOnUnload===!0&&(d.default.logAction(d.default.LOG_ERROR,"Defaults.normaliseOptions","closeOnUnload was true and a session recovery function was set - these are mutually exclusive, so unsetting the latter"),v.recover=void 0),"closeOnUnload"in v||(v.closeOnUnload=!v.recover),v.transports&&l.arrIn(v.transports,"xhr")&&(d.default.deprecationWarning('The "xhr" transport has been renamed to "xhr_streaming". Please update your client options code to use `transports: ["xhr_streaming"]` instead. The ability to use `transports: ["xhr"]` will be removed in a future version.'),l.arrDeleteValue(v.transports,"xhr"),v.transports.push("xhr_streaming")),"queueMessages"in v||(v.queueMessages=!0);var L=v.environment&&String(v.environment).toLowerCase()||y.ENVIRONMENT,N=!L||L==="production";!v.fallbackHosts&&!v.restHost&&!v.realtimeHost&&!v.port&&!v.tlsPort&&(v.fallbackHosts=N?y.FALLBACK_HOSTS:T(L));var M=v.restHost||(N?y.REST_HOST:L+"-"+y.REST_HOST),I=b(v,N,L);l.arrForEach((v.fallbackHosts||[]).concat(M,I),m),v.port=v.port||y.PORT,v.tlsPort=v.tlsPort||y.TLS_PORT,"tls"in v||(v.tls=!0);var P=h(v);if("useBinaryProtocol"in v?v.useBinaryProtocol=a.default.Config.supportsBinary&&v.useBinaryProtocol:v.useBinaryProtocol=a.default.Config.preferBinary,v.clientId){var A=v.headers=v.headers||{};A["X-Ably-ClientId"]=a.default.BufferUtils.base64Encode(a.default.BufferUtils.utf8Encode(v.clientId))}"idempotentRestPublishing"in v||(v.idempotentRestPublishing=!0),v.promises&&!a.default.Config.Promise&&(d.default.logAction(d.default.LOG_ERROR,"Defaults.normaliseOptions","{promises: true} was specified, but no Promise constructor found; disabling promises"),v.promises=!1);var j=null,U=v.connectivityCheckUrl;if(v.connectivityCheckUrl){var z=v.connectivityCheckUrl.split("?"),$=z[0],W=z[1];j=W?l.parseQueryString(W):{},$.indexOf("://")===-1&&($="https://"+$),U=$}return i.__assign(i.__assign({},v),{useBinaryProtocol:"useBinaryProtocol"in v?a.default.Config.supportsBinary&&v.useBinaryProtocol:a.default.Config.preferBinary,realtimeHost:I,restHost:M,maxMessageSize:v.maxMessageSize||y.maxMessageSize,timeouts:P,connectivityCheckParams:j,connectivityCheckUrl:U})}r.normaliseOptions=s,r.default=y;function w(v){return Object.assign(y,v)}r.getDefaults=w},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(3)),l=i.__importDefault(o(2)),d=i.__importDefault(o(4)),g=i.__importStar(o(1));function S(f){return!f||!f.channelOptions?{channelOptions:f,plugins:{},baseEncodedPreviousPayload:void 0}:f}function E(f){if(f&&f.cipher){if(!a.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var k=a.default.Crypto.getCipher(f.cipher);return{cipher:k.cipherParams,channelCipher:k.cipher}}return f!=null?f:{}}function y(f){var k=0;return f.name&&(k+=f.name.length),f.clientId&&(k+=f.clientId.length),f.extras&&(k+=JSON.stringify(f.extras).length),f.data&&(k+=g.dataSizeBytes(f.data)),k}var R=function(){function f(){}return f.prototype.toJSON=function(){var k=this.encoding,T=this.data;return T&&a.default.BufferUtils.isBuffer(T)&&(arguments.length>0?(k=k?k+"/base64":"base64",T=a.default.BufferUtils.base64Encode(T)):T=a.default.BufferUtils.toBuffer(T)),{name:this.name,id:this.id,clientId:this.clientId,connectionId:this.connectionId,connectionKey:this.connectionKey,extras:this.extras,encoding:k,data:T}},f.prototype.toString=function(){var k="[Message";return this.name&&(k+="; name="+this.name),this.id&&(k+="; id="+this.id),this.timestamp&&(k+="; timestamp="+this.timestamp),this.clientId&&(k+="; clientId="+this.clientId),this.connectionId&&(k+="; connectionId="+this.connectionId),this.encoding&&(k+="; encoding="+this.encoding),this.extras&&(k+="; extras ="+JSON.stringify(this.extras)),this.data&&(typeof this.data=="string"?k+="; data="+this.data:a.default.BufferUtils.isBuffer(this.data)?k+="; data (buffer)="+a.default.BufferUtils.base64Encode(this.data):k+="; data (json)="+JSON.stringify(this.data)),this.extras&&(k+="; extras="+JSON.stringify(this.extras)),k+="]",k},f.encrypt=function(k,T,x){var p=k.data,m=k.encoding,b=T.channelCipher;m=m?m+"/":"",a.default.BufferUtils.isBuffer(p)||(p=a.default.BufferUtils.utf8Encode(String(p)),m=m+"utf-8/"),b.encrypt(p,function(h,c){if(h){x(h);return}k.data=c,k.encoding=m+"cipher+"+b.algorithm,x(null,k)})},f.encode=function(k,T,x){var p=k.data,m=typeof p=="string"||a.default.BufferUtils.isBuffer(p)||p===null||p===void 0;if(!m)if(g.isObject(p)||g.isArray(p))k.data=JSON.stringify(p),k.encoding=k.encoding?k.encoding+"/json":"json";else throw new d.default("Data type is unsupported",40013,400);T!=null&&T.cipher?f.encrypt(k,T,x):x(null,k)},f.encodeArray=function(k,T,x){for(var p=0,m=0;m<k.length;m++)f.encode(k[m],T,function(b){if(b){x(b);return}p++,p==k.length&&x(null,k)})},f.decode=function(k,T){var x=S(T),p=k.data,m=k.encoding;if(m){var b=m.split("/"),h=void 0,c=b.length,u=k.data,s="";try{for(;(h=c)>0;){var w=b[--c].match(/([-\w]+)(\+([\w-]+))?/);if(!w)break;switch(s=w[1],s){case"base64":u=a.default.BufferUtils.base64Decode(String(u)),h==b.length&&(p=u);continue;case"utf-8":u=a.default.BufferUtils.utf8Decode(u);continue;case"json":u=JSON.parse(u);continue;case"cipher":if(x.channelOptions!=null&&x.channelOptions.cipher&&x.channelOptions.channelCipher){var v=w[3],C=x.channelOptions.channelCipher;if(v!=C.algorithm)throw new Error("Unable to decrypt message with given cipher; incompatible cipher params");u=C.decrypt(u);continue}else throw new Error("Unable to decrypt message; not an encrypted channel");case"vcdiff":if(!x.plugins||!x.plugins.vcdiff)throw new d.default("Missing Vcdiff decoder (https://github.com/ably-forks/vcdiff-decoder)",40019,400);if(typeof Uint8Array=="undefined")throw new d.default("Delta decoding not supported on this browser (need ArrayBuffer & Uint8Array)",40020,400);try{var L=x.baseEncodedPreviousPayload;typeof L=="string"&&(L=a.default.BufferUtils.utf8Encode(L)),L=a.default.BufferUtils.toBuffer(L),u=a.default.BufferUtils.toBuffer(u),u=a.default.BufferUtils.typedArrayToBuffer(x.plugins.vcdiff.decode(u,L)),p=u}catch(M){throw new d.default("Vcdiff delta decode failed with "+M,40018,400)}continue;default:throw new Error("Unknown encoding")}}}catch(M){var N=M;throw new d.default("Error processing the "+s+" encoding, decoder returned ‘"+N.message+"’",N.code||40013,400)}finally{k.encoding=h<=0?null:b.slice(0,h).join("/"),k.data=u}}x.baseEncodedPreviousPayload=p},f.fromResponseBody=function(k,T,x){x&&(k=g.decodeBody(k,x));for(var p=0;p<k.length;p++){var m=k[p]=f.fromValues(k[p]);try{f.decode(m,T)}catch(b){l.default.logAction(l.default.LOG_ERROR,"Message.fromResponseBody()",b.toString())}}return k},f.fromValues=function(k){return Object.assign(new f,k)},f.fromValuesArray=function(k){for(var T=k.length,x=new Array(T),p=0;p<T;p++)x[p]=f.fromValues(k[p]);return x},f.fromEncoded=function(k,T){var x=f.fromValues(k),p=E(T!=null?T:null);try{f.decode(x,p)}catch(m){l.default.logAction(l.default.LOG_ERROR,"Message.fromEncoded()",m.toString())}return x},f.fromEncodedArray=function(k,T){return k.map(function(x){return f.fromEncoded(x,T)})},f.getMessagesSize=function(k){for(var T,x=0,p=0;p<k.length;p++)T=k[p],x+=T.size||(T.size=y(T));return x},f.serialize=g.encodeBody,f}();r.default=R},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(4)),d=i.__importDefault(o(9)),g=i.__importDefault(o(16)),S={HEARTBEAT:0,ACK:1,NACK:2,CONNECT:3,CONNECTED:4,DISCONNECT:5,DISCONNECTED:6,CLOSE:7,CLOSED:8,ERROR:9,ATTACH:10,ATTACHED:11,DETACH:12,DETACHED:13,PRESENCE:14,MESSAGE:15,SYNC:16,AUTH:17,ACTIVATE:18},E=[];Object.keys(S).forEach(function(x){E[S[x]]=x});var y={HAS_PRESENCE:1,HAS_BACKLOG:2,RESUMED:4,TRANSIENT:16,ATTACH_RESUME:32,PRESENCE:65536,PUBLISH:1<<17,SUBSCRIBE:1<<18,PRESENCE_SUBSCRIBE:1<<19},R=Object.keys(y);y.MODE_ALL=y.PRESENCE|y.PUBLISH|y.SUBSCRIBE|y.PRESENCE_SUBSCRIBE;function f(x){var p=[];if(x)for(var m=0;m<x.length;m++)p.push(x[m].toString());return"[ "+p.join(", ")+" ]"}var k="id channel channelSerial connectionId count msgSerial timestamp".split(" "),T=function(){function x(){var p=this;this.hasFlag=function(m){return(p.flags&y[m])>0}}return x.prototype.setFlag=function(p){return this.flags=this.flags|y[p]},x.prototype.getMode=function(){return this.flags&&this.flags&y.MODE_ALL},x.prototype.encodeModesToFlags=function(p){var m=this;p.forEach(function(b){return m.setFlag(b)})},x.prototype.decodeModesFromFlags=function(){var p=this,m=[];return x.channelModes.forEach(function(b){p.hasFlag(b)&&m.push(b)}),m.length>0?m:void 0},x.fromValues=function(p){return Object.assign(new x,p)},x.Action=S,x.channelModes=["PRESENCE","PUBLISH","SUBSCRIBE","PRESENCE_SUBSCRIBE"],x.ActionName=E,x.serialize=a.encodeBody,x.deserialize=function(p,m){var b=a.decodeBody(p,m);return x.fromDeserialized(b)},x.fromDeserialized=function(p){var m=p.error;m&&(p.error=l.default.fromValues(m));var b=p.messages;if(b)for(var h=0;h<b.length;h++)b[h]=d.default.fromValues(b[h]);var c=p.presence;if(c)for(var h=0;h<c.length;h++)c[h]=g.default.fromValues(c[h],!0);return Object.assign(new x,p)},x.stringify=function(p){var m="[ProtocolMessage";p.action!==void 0&&(m+="; action="+x.ActionName[p.action]||!1);for(var b,h=0;h<k.length;h++)b=k[h],p[b]!==void 0&&(m+="; "+b+"="+p[b]);if(p.messages&&(m+="; messages="+f(d.default.fromValuesArray(p.messages))),p.presence&&(m+="; presence="+f(g.default.fromValuesArray(p.presence))),p.error&&(m+="; error="+l.default.fromValues(p.error).toString()),p.auth&&p.auth.accessToken&&(m+="; token="+p.auth.accessToken),p.flags&&(m+="; flags="+R.filter(p.hasFlag).join(",")),p.params){var c="";a.forInOwnNonNullProperties(p.params,function(u){c.length>0&&(c+="; "),c+=u+"="+p.params[u]}),c.length>0&&(m+="; params=["+c+"]")}return m+="]",m},x}();r.default=T},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){var a=i,l=a.lib,d=l.WordArray,g=a.enc;g.Base64={stringify:function(E){var y=E.words,R=E.sigBytes,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";E.clamp();for(var k=[],T=0;T<R;T+=3)for(var x=y[T>>>2]>>>24-T%4*8&255,p=y[T+1>>>2]>>>24-(T+1)%4*8&255,m=y[T+2>>>2]>>>24-(T+2)%4*8&255,b=x<<16|p<<8|m,h=0;h<4&&T+h*.75<R;h++)k.push(f.charAt(b>>>6*(3-h)&63));var c=f.charAt(64);if(c)for(;k.length%4;)k.push(c);return k.join("")},parse:function(E){var y=E.length,R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var k=0;k<R.length;k++)f[R.charCodeAt(k)]=k}var T=R.charAt(64);if(T){var x=E.indexOf(T);x!==-1&&(y=x)}return S(E,y,f)}};function S(E,y,R){for(var f=[],k=0,T=0;T<y;T++)if(T%4){var x=R[E.charCodeAt(T-1)]<<T%4*2,p=R[E.charCodeAt(T)]>>>6-T%4*2,m=x|p;f[k>>>2]|=m<<24-k%4*8,k++}return d.create(f,k)}}(),i.enc.Base64})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(10)),d=i.__importDefault(o(26)),g=i.__importDefault(o(2)),S=i.__importDefault(o(8)),E=i.__importDefault(o(21)),y=i.__importDefault(o(18)),R=i.__importDefault(o(4)),f=i.__importDefault(o(22)),k=i.__importDefault(o(3));function T(m){var b=[80015,80017,80030];return m.code?y.default.isTokenErr(m)?!1:a.arrIn(b,m.code)?!0:m.code>=4e4&&m.code<5e4:!1}function x(m){return T(m)?[l.default.fromValues({action:l.default.Action.ERROR,error:m})]:[l.default.fromValues({action:l.default.Action.DISCONNECTED,error:m})]}var p=function(m){i.__extends(b,m);function b(h,c,u){var s=m.call(this,h,c,u,!0)||this;return s.onAuthUpdated=function(w){s.authParams={access_token:w.token}},s.stream="stream"in u?u.stream:!0,s.sendRequest=null,s.recvRequest=null,s.pendingCallback=null,s.pendingItems=null,s}return b.prototype.connect=function(){var h=this;g.default.logAction(g.default.LOG_MINOR,"CometTransport.connect()","starting"),d.default.prototype.connect.call(this);var c=this.params,u=c.options,s=S.default.getHost(u,c.host),w=S.default.getPort(u),v=u.tls?"https://":"http://";this.baseUri=v+s+":"+w+"/comet/";var C=this.baseUri+"connect";g.default.logAction(g.default.LOG_MINOR,"CometTransport.connect()","uri: "+C),this.auth.getAuthParams(function(L,N){if(L){h.disconnect(L);return}if(!h.isDisposed){h.authParams=N;var M=h.params.getConnectParams(N);"stream"in M&&(h.stream=M.stream),g.default.logAction(g.default.LOG_MINOR,"CometTransport.connect()","connectParams:"+a.toQueryString(M));var I=!1,P=h.recvRequest=h.createRequest(C,null,M,null,h.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV);P.on("data",function(A){h.recvRequest&&(I||(I=!0,h.emit("preconnect")),h.onData(A))}),P.on("complete",function(A){if(h.recvRequest||(A=A||new R.default("Request cancelled",80003,400)),h.recvRequest=null,!I&&!A&&(I=!0,h.emit("preconnect")),h.onActivity(),A){A.code?h.onData(x(A)):h.disconnect(A);return}k.default.Config.nextTick(function(){h.recv()})}),P.exec()}})},b.prototype.requestClose=function(){g.default.logAction(g.default.LOG_MINOR,"CometTransport.requestClose()"),this._requestCloseOrDisconnect(!0)},b.prototype.requestDisconnect=function(){g.default.logAction(g.default.LOG_MINOR,"CometTransport.requestDisconnect()"),this._requestCloseOrDisconnect(!1)},b.prototype._requestCloseOrDisconnect=function(h){var c=this,u=h?this.closeUri:this.disconnectUri;if(u){var s=this.createRequest(u,null,this.authParams,null,f.default.REQ_SEND);s.on("complete",function(w){w&&(g.default.logAction(g.default.LOG_ERROR,"CometTransport.request"+(h?"Close()":"Disconnect()"),"request returned err = "+a.inspectError(w)),c.finish("disconnected",w))}),s.exec()}},b.prototype.dispose=function(){var h=this;g.default.logAction(g.default.LOG_MINOR,"CometTransport.dispose()",""),this.isDisposed||(this.isDisposed=!0,this.recvRequest&&(g.default.logAction(g.default.LOG_MINOR,"CometTransport.dispose()","aborting recv request"),this.recvRequest.abort(),this.recvRequest=null),this.finish("disconnected",E.default.disconnected()),k.default.Config.nextTick(function(){h.emit("disposed")}))},b.prototype.onConnect=function(h){var c;if(!this.isDisposed){var u=(c=h.connectionDetails)===null||c===void 0?void 0:c.connectionKey;d.default.prototype.onConnect.call(this,h);var s=this.baseUri+u;g.default.logAction(g.default.LOG_MICRO,"CometTransport.onConnect()","baseUri = "+s),this.sendUri=s+"/send",this.recvUri=s+"/recv",this.closeUri=s+"/close",this.disconnectUri=s+"/disconnect"}},b.prototype.send=function(h){if(this.sendRequest){this.pendingItems=this.pendingItems||[],this.pendingItems.push(h);return}var c=this.pendingItems||[];c.push(h),this.pendingItems=null,this.sendItems(c)},b.prototype.sendAnyPending=function(){var h=this.pendingItems;h&&(this.pendingItems=null,this.sendItems(h))},b.prototype.sendItems=function(h){var c=this,u=this.sendRequest=this.createRequest(this.sendUri,null,this.authParams,this.encodeRequest(h),f.default.REQ_SEND);u.on("complete",function(s,w){if(s&&g.default.logAction(g.default.LOG_ERROR,"CometTransport.sendItems()","on complete: err = "+a.inspectError(s)),c.sendRequest=null,s){s.code?c.onData(x(s)):c.disconnect(s);return}w&&c.onData(w),c.pendingItems&&k.default.Config.nextTick(function(){c.sendRequest||c.sendAnyPending()})}),u.exec()},b.prototype.recv=function(){var h=this;if(!this.recvRequest&&this.isConnected){var c=this.recvRequest=this.createRequest(this.recvUri,null,this.authParams,null,this.stream?f.default.REQ_RECV_STREAM:f.default.REQ_RECV_POLL);c.on("data",function(u){h.onData(u)}),c.on("complete",function(u){if(h.recvRequest=null,h.onActivity(),u){u.code?h.onData(x(u)):h.disconnect(u);return}k.default.Config.nextTick(function(){h.recv()})}),c.exec()}},b.prototype.onData=function(h){try{var c=this.decodeResponse(h);if(c&&c.length)for(var u=0;u<c.length;u++)this.onProtocolMessage(l.default.fromDeserialized(c[u]))}catch(s){g.default.logAction(g.default.LOG_ERROR,"CometTransport.onData()","Unexpected exception handing channel event: "+s.stack)}},b.prototype.encodeRequest=function(h){return JSON.stringify(h)},b.prototype.decodeResponse=function(h){return typeof h=="string"?JSON.parse(h):h},b}(d.default);r.default=p},function(n,r){var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(i){typeof window=="object"&&(o=window)}n.exports=o},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.isSuccessCode=void 0;var i;(function(l){l[l.Success=200]="Success",l[l.NoContent=204]="NoContent",l[l.BadRequest=400]="BadRequest",l[l.Unauthorized=401]="Unauthorized",l[l.Forbidden=403]="Forbidden",l[l.RequestTimeout=408]="RequestTimeout",l[l.InternalServerError=500]="InternalServerError"})(i||(i={}));function a(l){return l>=i.Success&&l<i.BadRequest}r.isSuccessCode=a,r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(3)),l=i.__importStar(o(1)),d=i.__importDefault(o(2)),g=i.__importDefault(o(18)),S=i.__importDefault(o(19)),E=o(4),y=i.__importDefault(o(14));function R(m,b,h,c,u){m.http.supportsAuthHeaders?m.auth.getAuthHeaders(function(s,w){s?c(s):u(l.mixin(w,b),h)}):m.auth.getAuthParams(function(s,w){s?c(s):u(b,l.mixin(w,h))})}function f(m,b){return function(h,c,u,s,w){if(h&&!c){m(h);return}if(w===y.default.NoContent){m(h,[],u,!0,w);return}if(!s)try{c=l.decodeBody(c,b)}catch(I){l.isErrorInfoOrPartialErrorInfo(I)?m(I):m(new E.PartialErrorInfo(l.inspectError(I),null));return}if(!c){m(new E.PartialErrorInfo("unenvelope(): Response body is missing",null));return}var v=c,C=v.statusCode,L=v.response,N=v.headers;if(C===void 0){m(h,c,u,!0,w);return}if(C<200||C>=300){var M=L&&L.error||h;M||(M=new Error("Error in unenveloping "+c),M.statusCode=C),m(M,L,N,!0,C);return}m(h,L,N,!0,C)}}function k(m){var b=[];if(m)for(var h in m)b.push(h+"="+m[h]);return b.join("&")}function T(m,b){return m+(b?"?":"")+k(b)}function x(m,b,h,c){return function(u,s,w,v,C){u?d.default.logAction(d.default.LOG_MICRO,"Resource."+b+"()","Received Error; "+T(h,c)+"; Error: "+l.inspectError(u)):d.default.logAction(d.default.LOG_MICRO,"Resource."+b+"()","Received; "+T(h,c)+"; Headers: "+k(w)+"; StatusCode: "+C+"; Body: "+(a.default.BufferUtils.isBuffer(s)?s.toString():s)),m&&m(u,s,w,v,C)}}var p=function(){function m(){}return m.get=function(b,h,c,u,s,w){m.do(S.default.Get,b,h,null,c,u,s,w)},m.delete=function(b,h,c,u,s,w){m.do(S.default.Delete,b,h,null,c,u,s,w)},m.post=function(b,h,c,u,s,w,v){m.do(S.default.Post,b,h,c,u,s,w,v)},m.patch=function(b,h,c,u,s,w,v){m.do(S.default.Patch,b,h,c,u,s,w,v)},m.put=function(b,h,c,u,s,w,v){m.do(S.default.Put,b,h,c,u,s,w,v)},m.do=function(b,h,c,u,s,w,v,C){d.default.shouldLog(d.default.LOG_MICRO)&&(C=x(C,b,c,w)),v&&(C=C&&f(C,v),(w=w||{}).envelope=v);function L(N,M){var I;if(d.default.shouldLog(d.default.LOG_MICRO)&&d.default.logAction(d.default.LOG_MICRO,"Resource."+b+"()","Sending; "+T(c,M)),d.default.shouldLog(d.default.LOG_MICRO)){var P=u;if(((I=N["content-type"])===null||I===void 0?void 0:I.indexOf("msgpack"))>0)try{P=a.default.Config.msgpack.decode(u)}catch(A){d.default.logAction(d.default.LOG_MICRO,"Resource."+b+"()","Sending MsgPack Decoding Error: "+l.inspectError(A))}d.default.logAction(d.default.LOG_MICRO,"Resource."+b+"()","Sending; "+T(c,M)+"; Body: "+P)}h.http.do(b,h,c,N,u,M,function(A,j,U,z,$){if(A&&g.default.isTokenErr(A)){h.auth.authorize(null,null,function(W){if(W){C(W);return}R(h,N,M,C,L)});return}C(A,j,U,z,$)})}R(h,s,w,C,L)},m}();r.default=p},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(2)),l=i.__importDefault(o(3)),d=i.__importDefault(o(9)),g=i.__importStar(o(1));function S(y){return E.Actions.indexOf(y)}var E=function(){function y(){}return y.prototype.isSynthesized=function(){return!this.id||!this.connectionId?!0:this.id.substring(this.connectionId.length,0)!==this.connectionId},y.prototype.parseId=function(){if(!this.id)throw new Error("parseId(): Presence message does not contain an id");var R=this.id.split(":");return{connectionId:R[0],msgSerial:parseInt(R[1],10),index:parseInt(R[2],10)}},y.prototype.toJSON=function(){var R=this.data,f=this.encoding;return R&&l.default.BufferUtils.isBuffer(R)&&(arguments.length>0?(f=f?f+"/base64":"base64",R=l.default.BufferUtils.base64Encode(R)):R=l.default.BufferUtils.toBuffer(R)),{id:this.id,clientId:this.clientId,action:S(this.action),data:R,encoding:f,extras:this.extras}},y.prototype.toString=function(){var R="[PresenceMessage";return R+="; action="+this.action,this.id&&(R+="; id="+this.id),this.timestamp&&(R+="; timestamp="+this.timestamp),this.clientId&&(R+="; clientId="+this.clientId),this.connectionId&&(R+="; connectionId="+this.connectionId),this.encoding&&(R+="; encoding="+this.encoding),this.data&&(typeof this.data=="string"?R+="; data="+this.data:l.default.BufferUtils.isBuffer(this.data)?R+="; data (buffer)="+l.default.BufferUtils.base64Encode(this.data):R+="; data (json)="+JSON.stringify(this.data)),this.extras&&(R+="; extras="+JSON.stringify(this.extras)),R+="]",R},y.fromResponseBody=function(R,f,k){var T=[];k&&(R=g.decodeBody(R,k));for(var x=0;x<R.length;x++){var p=T[x]=y.fromValues(R[x],!0);try{y.decode(p,f)}catch(m){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromResponseBody()",m.toString())}}return T},y.fromValues=function(R,f){return f&&(R.action=y.Actions[R.action]),Object.assign(new y,R)},y.fromValuesArray=function(R){for(var f=R.length,k=new Array(f),T=0;T<f;T++)k[T]=y.fromValues(R[T]);return k},y.fromEncoded=function(R,f){var k=y.fromValues(R,!0);try{y.decode(k,f!=null?f:{})}catch(T){a.default.logAction(a.default.LOG_ERROR,"PresenceMessage.fromEncoded()",T.toString())}return k},y.fromEncodedArray=function(R,f){return R.map(function(k){return y.fromEncoded(k,f)})},y.fromData=function(R){return R instanceof y?R:y.fromValues({data:R})},y.Actions=["absent","present","enter","leave","update"],y.encode=d.default.encode,y.decode=d.default.decode,y.getMessagesSize=d.default.getMessagesSize,y}();r.default=E},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),l=a.__importStar(o(1)),d=a.__importDefault(o(7)),g=a.__importStar(o(4)),S=a.__importDefault(o(2)),E=a.__importDefault(o(8)),y=a.__importDefault(o(22)),R=a.__importDefault(o(3));function f(v,C){return l.arrIn(l.allToLowerCase(l.keysArray(C)),"x-ably-errorcode")}function k(v,C){if(f(v,C))return v.error&&g.default.fromValues(v.error)}var T=function(){},x=0,p={},m=typeof i!="undefined"&&i.XDomainRequest;function b(){var v=navigator.userAgent.toString().match(/MSIE\s([\d.]+)/);return v&&Number(v[1])}function h(){var v;return m&&(v=b())&&v===10}function c(v,C){return v.getResponseHeader&&v.getResponseHeader(C)}function u(v){return v.getResponseHeader&&(v.getResponseHeader("transfer-encoding")||!v.getResponseHeader("content-length"))}function s(v){for(var C=l.trim(v.getAllResponseHeaders()).split(`\r
138
+ `),L={},N=0;N<C.length;N++){var M=C[N].split(":").map(l.trim);L[M[0].toLowerCase()]=M[1]}return L}var w=function(v){a.__extends(C,v);function C(L,N,M,I,P,A,j){var U=v.call(this)||this;return M=M||{},M.rnd=l.cheapRandStr(),h()&&!M.envelope&&(M.envelope="json"),U.uri=L+l.toQueryString(M),U.headers=N||{},U.body=I,U.method=j?j.toUpperCase():l.isEmptyArg(I)?"GET":"POST",U.requestMode=P,U.timeouts=A,U.timedOut=!1,U.requestComplete=!1,U.id=String(++x),p[U.id]=U,U}return C.createRequest=function(L,N,M,I,P,A,j){var U=A||E.default.TIMEOUTS;return new C(L,N,l.copy(M),I,P,U,j)},C.prototype.complete=function(L,N,M,I,P){this.requestComplete||(this.requestComplete=!0,!L&&N&&this.emit("data",N),this.emit("complete",L,N,M,I,P),this.dispose())},C.prototype.abort=function(){this.dispose()},C.prototype.exec=function(){var L=this,N=this.headers,M=this.requestMode==y.default.REQ_SEND?this.timeouts.httpRequestTimeout:this.timeouts.recvTimeout,I=this.timer=setTimeout(function(){L.timedOut=!0,A.abort()},M),P=this.method,A=this.xhr=new XMLHttpRequest,j=N.accept,U=this.body,z="text";if(j?j.indexOf("application/x-msgpack")===0&&(z="arraybuffer"):N.accept="application/json",U){var $=N["content-type"]||(N["content-type"]="application/json");$.indexOf("application/json")>-1&&typeof U!="string"&&(U=JSON.stringify(U))}A.open(P,this.uri,!0),A.responseType=z,"authorization"in N&&(A.withCredentials=!0);for(var W in N)A.setRequestHeader(W,N[W]);var F=function(Z,ye,De,$e){var Ae,zt=ye+" (event type: "+Z.type+")";!((Ae=L==null?void 0:L.xhr)===null||Ae===void 0)&&Ae.statusText&&(zt+=", current statusText is "+L.xhr.statusText),S.default.logAction(S.default.LOG_ERROR,"Request.on"+Z.type+"()",zt),L.complete(new g.PartialErrorInfo(zt,De,$e))};A.onerror=function(Z){F(Z,"XHR error occurred",null,400)},A.onabort=function(Z){L.timedOut?F(Z,"Request aborted due to request timeout expiring",null,408):F(Z,"Request cancelled",null,400)},A.ontimeout=function(Z){F(Z,"Request timed out",null,408)};var O,D,B,_=0,V=!1,Y=function(){if(clearTimeout(I),B=D<400,D==204){L.complete(null,null,null,null,D);return}O=L.requestMode==y.default.REQ_RECV_STREAM&&B&&u(A)},X=function(){var Z;try{var ye=c(A,"content-type"),De=ye?ye.indexOf("application/json")>=0:A.responseType=="text";if(De){var $e=A.responseType==="arraybuffer"?R.default.BufferUtils.utf8Decode(A.response):String(A.responseText);$e.length?Z=JSON.parse($e):Z=$e,V=!0}else Z=A.response;Z.response!==void 0?(D=Z.statusCode,B=D<400,N=Z.headers,Z=Z.response):N=s(A)}catch(zt){L.complete(new g.PartialErrorInfo("Malformed response body from server: "+zt.message,null,400));return}if(B||l.isArray(Z)){L.complete(null,Z,N,V,D);return}var Ae=k(Z,N);Ae||(Ae=new g.PartialErrorInfo("Error response received from server: "+D+" body was: "+R.default.Config.inspect(Z),null,D)),L.complete(Ae,Z,N,V,D)};function ne(){for(var Z=A.responseText,ye=Z.length-1,De,$e;_<ye&&(De=Z.indexOf(`
139
+ `,_))>-1;)$e=Z.slice(_,De),_=De+1,re($e)}var re=function(Z){try{Z=JSON.parse(Z)}catch(ye){L.complete(new g.PartialErrorInfo("Malformed response body from server: "+ye.message,null,400));return}L.emit("data",Z)},ce=function(){ne(),L.streamComplete=!0,R.default.Config.nextTick(function(){L.complete()})};A.onreadystatechange=function(){var Z=A.readyState;Z<3||A.status!==0&&(D===void 0&&(D=A.status,D===1223&&(D=204),Y()),Z==3&&O?ne():Z==4&&(O?ce():X()))},A.send(U)},C.prototype.dispose=function(){var L=this.xhr;if(L){L.onreadystatechange=L.onerror=L.onabort=L.ontimeout=T,this.xhr=null;var N=this.timer;N&&(clearTimeout(N),this.timer=null),this.requestComplete||L.abort()}delete p[this.id]},C}(d.default);r.default=w}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(2)),l=i.__importStar(o(1)),d=i.__importDefault(o(24)),g=i.__importDefault(o(4)),S=i.__importDefault(o(45)),E=o(11),y=i.__importDefault(o(19)),R=i.__importDefault(o(14)),f=i.__importDefault(o(3)),k=i.__importDefault(o(15)),T=Math.pow(2,17);function x(){}function p(){return("000000"+Math.floor(Math.random()*1e16)).slice(-16)}function m(M){return!!M.connection}function b(M){return l.isErrorInfoOrPartialErrorInfo(M)?(M.code||(M.statusCode===403?M.code=40300:(M.code=40170,M.statusCode=401)),M):new g.default(l.inspectError(M),M.code||40170,M.statusCode||401)}var h=function(M,I){if(f.default.Config.createHmac){var P=f.default.Config.createHmac("SHA256",I);return P.update(M),P.digest("base64")}return(0,E.stringify)((0,S.default)(M,I))};function c(M){if(!M)return"";typeof M=="string"&&(M=JSON.parse(M));var I=Object.create(null),P=l.keysArray(M,!0);if(!P)return"";P.sort();for(var A=0;A<P.length;A++)I[P[A]]=M[P[A]].sort();return JSON.stringify(I)}function u(M){if(M.authCallback)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with authCallback");else if(M.authUrl)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with authUrl");else if(M.key)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with client-side signing");else if(M.tokenDetails)a.default.logAction(a.default.LOG_MINOR,"Auth()","using token auth with supplied token only");else{var I="authOptions must include valid authentication parameters";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",I),new Error(I)}}function s(M){return"useTokenAuth"in M&&!M.useTokenAuth}function w(M){return M.useTokenAuth||!s(M)&&(M.authCallback||M.authUrl||M.token||M.tokenDetails)}function v(M){return!M.key&&!M.authCallback&&!M.authUrl}var C=0;function L(){return C++}var N=function(){function M(I,P){if(this.authOptions={},this.client=I,this.tokenParams=P.defaultTokenParams||{},this.currentTokenRequestId=null,this.waitingForTokenRequest=null,w(P)){if(P.key&&!h){var A="client-side token request signing not supported";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",A),new Error(A)}v(P)&&a.default.logAction(a.default.LOG_ERROR,"Auth()","Warning: library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help"),this._saveTokenOptions(P.defaultTokenParams,P),u(this.authOptions)}else{if(!P.key){var A="No authentication options provided; need one of: key, authUrl, or authCallback (or for testing only, token or tokenDetails)";throw a.default.logAction(a.default.LOG_ERROR,"Auth()",A),new g.default(A,40160,401)}a.default.logAction(a.default.LOG_MINOR,"Auth()","anonymous, using basic auth"),this._saveBasicOptions(P)}}return M.prototype.authorize=function(I,P,A){var j=this,U;if(typeof I=="function"&&!A?(A=I,U=I=null):typeof P=="function"&&!A?(A=P,U=null):U=P,!A&&this.client.options.promises)return l.promisify(this,"authorize",arguments);if(U&&U.key&&this.authOptions.key!==U.key)throw new g.default("Unable to update auth options with incompatible key",40102,401);U&&"force"in U&&(a.default.deprecated("The `force` auth option","If you’re using this option to force `authorize()` to fetch a new token even if the current token has not expired, this is no longer necessary, as `authorize()` now always fetches a new token. Update your code to no longer pass the `force` auth option. Note that, in general, passing an auth options argument to `authorize()` will overwrite the library’s stored auth options, which may not be what you want. The library currently contains a special case behavior where passing an auth options object which only contains `{ force: true }` will _not_ overwrite the stored options. This special case behavior will be removed alongside support for the `force` option, so if you’re currently passing `authorize()` an auth options object which only contains `{ force: true }`, you should stop passing it an auth options object entirely."),l.isOnlyPropIn(U,"force")&&(U=null)),this._forceNewToken(I,U,function(z,$){if(z){j.client.connection&&z.statusCode===R.default.Forbidden&&j.client.connection.connectionManager.actOnErrorFromAuthorize(z),A==null||A(z);return}m(j.client)?j.client.connection.connectionManager.onAuthUpdated($,A||x):A==null||A(null,$)})},M.prototype.authorise=function(I,P,A){a.default.renamedMethod("Auth","authorise","authorize"),this.authorize(I,P,A)},M.prototype._forceNewToken=function(I,P,A){var j=this;this.tokenDetails=null,this._saveTokenOptions(I,P),u(this.authOptions),this._ensureValidAuthCredentials(!0,function(U,z){delete j.tokenParams.timestamp,delete j.authOptions.queryTime,A(U,z)})},M.prototype.requestToken=function(I,P,A){var j=this;if(typeof I=="function"&&!A?(A=I,P=I=null):typeof P=="function"&&!A&&(A=P,P=null),!A&&this.client.options.promises)return l.promisify(this,"requestToken",arguments);P=P||this.authOptions,I=I||l.copy(this.tokenParams);var U=A||x,z,$=this.client;if(P.authCallback)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with authCallback"),z=P.authCallback;else if(P.authUrl)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with authUrl"),z=function(_,V){var Y=l.mixin({accept:"application/json, text/plain"},P.authHeaders),X=P.authMethod&&P.authMethod.toLowerCase()==="post",ne,re=P.authUrl.indexOf("?");re>-1&&(ne=l.parseQueryString(P.authUrl.slice(re)),P.authUrl=P.authUrl.slice(0,re),X||(P.authParams=l.mixin(ne,P.authParams)));var ce=l.mixin({},P.authParams||{},_),Z=function($e,Ae,zt,Ci){var xt;if($e?a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Received Error: "+l.inspectError($e)):(xt=zt["content-type"],a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Received; content-type: "+xt+"; body: "+l.inspectBody(Ae))),$e||Ci)return V($e,Ae);if(f.default.BufferUtils.isBuffer(Ae)&&(Ae=Ae.toString()),!xt){V(new g.default("authUrl response is missing a content-type header",40170,401));return}var ki=xt.indexOf("application/json")>-1,tl=xt.indexOf("text/plain")>-1||xt.indexOf("application/jwt")>-1;if(!ki&&!tl){V(new g.default("authUrl responded with unacceptable content-type "+xt+", should be either text/plain, application/jwt or application/json",40170,401));return}if(ki){if(Ae.length>T){V(new g.default("authUrl response exceeded max permitted length",40170,401));return}try{Ae=JSON.parse(Ae)}catch(nl){V(new g.default("Unexpected error processing authURL response; err = "+nl.message,40170,401));return}}V(null,Ae,xt)};if(a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().tokenRequestCallback","Requesting token from "+P.authUrl+"; Params: "+JSON.stringify(ce)+"; method: "+(X?"POST":"GET")),X){var ye=Y||{};ye["content-type"]="application/x-www-form-urlencoded";var De=l.toQueryString(ce).slice(1);j.client.http.doUri(y.default.Post,$,P.authUrl,ye,De,ne,Z)}else j.client.http.doUri(y.default.Get,$,P.authUrl,Y||{},null,ce,Z)};else if(P.key)a.default.logAction(a.default.LOG_MINOR,"Auth.requestToken()","using token auth with client-side signing"),z=function(_,V){j.createTokenRequest(_,P,V)};else{var W="Need a new token, but authOptions does not include any way to request one (no authUrl, authCallback, or key)";a.default.logAction(a.default.LOG_ERROR,"Auth()","library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help"),U(new g.default(W,40171,403));return}"capability"in I&&(I.capability=c(I.capability));var F=function(_,V){var Y=_.keyName,X="/keys/"+Y+"/requestToken",ne=function(ce){return $.baseUri(ce)+X},re=l.defaultPostHeaders(j.client.options);P.requestHeaders&&l.mixin(re,P.requestHeaders),a.default.logAction(a.default.LOG_MICRO,"Auth.requestToken().requestToken","Sending POST to "+X+"; Token params: "+JSON.stringify(_)),j.client.http.do(y.default.Post,$,ne,re,JSON.stringify(_),null,V)},O=!1,D=this.client.options.timeouts.realtimeRequestTimeout,B=setTimeout(function(){O=!0;var _="Token request callback timed out after "+D/1e3+" seconds";a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",_),U(new g.default(_,40170,401))},D);z(I,function(_,V,Y){if(!O){if(clearTimeout(B),_){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request signing call returned error; err = "+l.inspectError(_)),U(b(_));return}if(typeof V=="string"){V.length===0?U(new g.default("Token string is empty",40170,401)):V.length>T?U(new g.default("Token string exceeded max permitted length (was "+V.length+" bytes)",40170,401)):V==="undefined"||V==="null"?U(new g.default("Token string was literal null/undefined",40170,401)):V[0]==="{"&&!(Y&&Y.indexOf("application/jwt")>-1)?U(new g.default("Token was double-encoded; make sure you're not JSON-encoding an already encoded token request or details",40170,401)):U(null,{token:V});return}if(typeof V!="object"){var X="Expected token request callback to call back with a token string or token request/details object, but got a "+typeof V;a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",X),U(new g.default(X,40170,401));return}var ne=JSON.stringify(V).length;if(ne>T&&!P.suppressMaxLengthCheck){U(new g.default("Token request/details object exceeded max permitted stringified size (was "+ne+" bytes)",40170,401));return}if("issued"in V){U(null,V);return}if(!("keyName"in V)){var X="Expected token request callback to call back with a token string, token request object, or token details object";a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()",X),U(new g.default(X,40170,401));return}F(V,function(re,ce,Z,ye){if(re){a.default.logAction(a.default.LOG_ERROR,"Auth.requestToken()","token request API call returned error; err = "+l.inspectError(re)),U(b(re));return}ye||(ce=JSON.parse(ce)),a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","token received"),U(null,ce)})}})},M.prototype.createTokenRequest=function(I,P,A){var j=this;if(typeof I=="function"&&!A?(A=I,P=I=null):typeof P=="function"&&!A&&(A=P,P=null),!A&&this.client.options.promises)return l.promisify(this,"createTokenRequest",arguments);P=P||this.authOptions,I=I||l.copy(this.tokenParams);var U=P.key;if(!U){A(new g.default("No key specified",40101,403));return}var z=U.split(":"),$=z[0],W=z[1];if(!W){A(new g.default("Invalid key specified",40101,403));return}if(I.clientId===""){A(new g.default("clientId can’t be an empty string",40012,400));return}"capability"in I&&(I.capability=c(I.capability));var F=l.mixin({keyName:$},I),O=I.clientId||"",D=I.ttl||"",B=I.capability||"";(function(_){if(F.timestamp){_();return}j.getTimestamp(P&&P.queryTime,function(V,Y){if(V){A(V);return}F.timestamp=Y,_()})})(function(){var _=F.nonce||(F.nonce=p()),V=F.timestamp,Y=F.keyName+`
140
140
  `+D+`
141
141
  `+B+`
142
142
  `+O+`
143
143
  `+V+`
144
144
  `+_+`
145
- `;F.mac=F.mac||h(Y,W),a.default.logAction(a.default.LOG_MINOR,"Auth.getTokenRequest()","generated signed request"),A(null,F)})},P.prototype.getAuthParams=function(I){this.method=="basic"?I(null,{key:this.key}):this._ensureValidAuthCredentials(!1,function(M,A){if(M){I(M);return}if(!A)throw new Error("Auth.getAuthParams(): _ensureValidAuthCredentials returned no error or tokenDetails");I(null,{access_token:A.token})})},P.prototype.getAuthHeaders=function(I){this.method=="basic"?I(null,{authorization:"Basic "+this.basicKey}):this._ensureValidAuthCredentials(!1,function(M,A){if(M){I(M);return}if(!A)throw new Error("Auth.getAuthParams(): _ensureValidAuthCredentials returned no error or tokenDetails");I(null,{authorization:"Bearer "+l.toBase64(A.token)})})},P.prototype.getTimestamp=function(I,M){!this.isTimeOffsetSet()&&(I||this.authOptions.queryTime)?this.client.time(M):M(null,this.getTimestampUsingOffset())},P.prototype.getTimestampUsingOffset=function(){return l.now()+(this.client.serverTimeOffset||0)},P.prototype.isTimeOffsetSet=function(){return this.client.serverTimeOffset!==null},P.prototype._saveBasicOptions=function(I){this.method="basic",this.key=I.key,this.basicKey=l.toBase64(I.key),this.authOptions=I||{},"clientId"in I&&this._userSetClientId(I.clientId)},P.prototype._saveTokenOptions=function(I,M){this.method="token",I&&(this.tokenParams=I),M&&(M.token&&(M.tokenDetails=typeof M.token=="string"?{token:M.token}:M.token),M.tokenDetails&&(this.tokenDetails=M.tokenDetails),"clientId"in M&&this._userSetClientId(M.clientId),this.authOptions=M)},P.prototype._ensureValidAuthCredentials=function(I,M){var A=this,j=this.tokenDetails;if(j){if(this._tokenClientIdMismatch(j.clientId)){M(new g.default("Mismatch between clientId in token ("+j.clientId+") and current clientId ("+this.clientId+")",40102,403));return}if(!this.isTimeOffsetSet()||!j.expires||j.expires>=this.getTimestampUsingOffset()){a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","using cached token; expires = "+j.expires),M(null,j);return}a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","deleting expired token"),this.tokenDetails=null}if((this.waitingForTokenRequest||(this.waitingForTokenRequest=d.default.create())).push(M),!(this.currentTokenRequestId!==null&&!I)){var U=this.currentTokenRequestId=L();this.requestToken(this.tokenParams,this.authOptions,function(z,$){if(A.currentTokenRequestId>U){a.default.logAction(a.default.LOG_MINOR,"Auth._ensureValidAuthCredentials()","Discarding token request response; overtaken by newer one");return}A.currentTokenRequestId=null;var W=A.waitingForTokenRequest||x;if(A.waitingForTokenRequest=null,z){W(z);return}W(null,A.tokenDetails=$)})}},P.prototype._userSetClientId=function(I){if(typeof I=="string"||I===null){if(I==="*")throw new g.default('Can’t use "*" as a clientId as that string is reserved. (To change the default token request behaviour to use a wildcard clientId, instantiate the library with {defaultTokenParams: {clientId: "*"}}), or if calling authorize(), pass it in as a tokenParam: authorize({clientId: "*"}, authOptions)',40012,400);var M=this._uncheckedSetClientId(I);if(M)throw M}else throw new g.default("clientId must be either a string or null",40012,400)},P.prototype._uncheckedSetClientId=function(I){if(this._tokenClientIdMismatch(I)){var M="Unexpected clientId mismatch: client has "+this.clientId+", requested "+I,A=new g.default(M,40102,401);return a.default.logAction(a.default.LOG_ERROR,"Auth._uncheckedSetClientId()",M),A}else return this.clientId=this.tokenParams.clientId=I,null},P.prototype._tokenClientIdMismatch=function(I){return!!(this.clientId&&this.clientId!=="*"&&I&&I!=="*"&&this.clientId!==I)},P.isTokenErr=function(I){return I.code&&I.code>=40140&&I.code<40150},P.prototype.revokeTokens=function(I,M,A){if(w(this.client.options))throw new g.default("Cannot revoke tokens when using token auth",40162,401);var j=this.client.options.keyName,U;if(typeof M=="function"?(A=M,U={}):U=M!=null?M:{},A===void 0){if(this.client.options.promises)return l.promisify(this,"revokeTokens",[I,U]);A=x}var z=A,$=o.__assign({targets:I.map(function(D){return"".concat(D.type,":").concat(D.value)})},U),W=this.client.options.useBinaryProtocol?l.Format.msgpack:l.Format.json,F=l.defaultPostHeaders(this.client.options,W);this.client.options.headers&&l.mixin(F,this.client.options.headers);var O=l.encodeBody($,W);k.default.post(this.client,"/keys/".concat(j,"/revokeTokens"),O,F,{newBatchResponse:"true"},null,function(D,B,_,V){if(D){z(D);return}var Y=V?B:l.decodeBody(B,W);z(null,Y)})},P}();r.default=N},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o;(function(a){a.Get="get",a.Delete="delete",a.Post="post",a.Put="put",a.Patch="patch"})(o||(o={})),r.default=o},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.HttpPaginatedResponse=r.PaginatedResult=void 0;var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(2)),d=o.__importDefault(i(15)),g=o.__importDefault(i(14));function S(T){var x=T.match(/^\.\/(\w+)\?(.*)$/);return x&&x[2]&&a.parseQueryString(x[2])}function E(T){typeof T=="string"&&(T=T.split(","));for(var x={},p=0;p<T.length;p++){var m=T[p].match(/^\s*<(.+)>;\s*rel="(\w+)"$/);if(m){var b=S(m[1]);b&&(x[m[2]]=b)}}return x}function y(T,x,p){return!(p&&(x||typeof T.code=="number"))}var R=function(){function T(x,p,m,b,h,c){this.rest=x,this.path=p,this.headers=m,this.envelope=b!=null?b:null,this.bodyHandler=h,this.useHttpPaginatedResponse=c||!1}return T.prototype.get=function(x,p){var m=this;d.default.get(this.rest,this.path,this.headers,x,this.envelope,function(b,h,c,u,s){m.handlePage(b,h,c,u,s,p)})},T.prototype.delete=function(x,p){var m=this;d.default.delete(this.rest,this.path,this.headers,x,this.envelope,function(b,h,c,u,s){m.handlePage(b,h,c,u,s,p)})},T.prototype.post=function(x,p,m){var b=this;d.default.post(this.rest,this.path,p,this.headers,x,this.envelope,function(h,c,u,s,w){m&&b.handlePage(h,c,u,s,w,m)})},T.prototype.put=function(x,p,m){var b=this;d.default.put(this.rest,this.path,p,this.headers,x,this.envelope,function(h,c,u,s,w){m&&b.handlePage(h,c,u,s,w,m)})},T.prototype.patch=function(x,p,m){var b=this;d.default.patch(this.rest,this.path,p,this.headers,x,this.envelope,function(h,c,u,s,w){m&&b.handlePage(h,c,u,s,w,m)})},T.prototype.handlePage=function(x,p,m,b,h,c){if(x&&y(x,p,this.useHttpPaginatedResponse)){l.default.logAction(l.default.LOG_ERROR,"PaginatedResource.handlePage()","Unexpected error getting resource: err = "+a.inspectError(x)),c==null||c(x);return}var u,s,w;try{u=h==g.default.NoContent?[]:this.bodyHandler(p,m||{},b)}catch(v){c==null||c(x||v);return}m&&(s=m.Link||m.link)&&(w=E(s)),this.useHttpPaginatedResponse?c(null,new k(this,u,m||{},h,w,x)):c(null,new f(this,u,w))},T}(),f=function(){function T(x,p,m){var b=this;this.resource=x,this.items=p;var h=this;m&&("first"in m&&(this.first=function(c){if(!c&&h.resource.rest.options.promises)return a.promisify(h,"first",[]);h.get(m.first,c)}),"current"in m&&(this.current=function(c){if(!c&&h.resource.rest.options.promises)return a.promisify(h,"current",[]);h.get(m.current,c)}),this.next=function(c){if(!c&&h.resource.rest.options.promises)return a.promisify(h,"next",[]);"next"in m?h.get(m.next,c):c(null,null)},this.hasNext=function(){return"next"in m},this.isLast=function(){var c;return!(!((c=b.hasNext)===null||c===void 0)&&c.call(b))})}return T.prototype.get=function(x,p){var m=this.resource;d.default.get(m.rest,m.path,m.headers,x,m.envelope,function(b,h,c,u,s){m.handlePage(b,h,c,u,s,p)})},T}();r.PaginatedResult=f;var k=function(T){o.__extends(x,T);function x(p,m,b,h,c,u){var s=T.call(this,p,m,c)||this;return s.statusCode=h,s.success=h<300&&h>=200,s.headers=b,s.errorCode=u&&u.code,s.errorMessage=u&&u.message,s}return x.prototype.toJSON=function(){return{items:this.items,statusCode:this.statusCode,success:this.success,headers:this.headers,errorCode:this.errorCode,errorMessage:this.errorMessage}},x}(f);r.HttpPaginatedResponse=k,r.default=R},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.isRetriable=void 0;var o=i(0),a=o.__importDefault(i(4)),l={DISCONNECTED:80003,SUSPENDED:80002,FAILED:8e4,CLOSING:80017,CLOSED:80017,UNKNOWN_CONNECTION_ERR:50002,UNKNOWN_CHANNEL_ERR:50001},d={disconnected:function(){return a.default.fromValues({statusCode:400,code:l.DISCONNECTED,message:"Connection to server temporarily unavailable"})},suspended:function(){return a.default.fromValues({statusCode:400,code:l.SUSPENDED,message:"Connection to server unavailable"})},failed:function(){return a.default.fromValues({statusCode:400,code:l.FAILED,message:"Connection failed or disconnected by server"})},closing:function(){return a.default.fromValues({statusCode:400,code:l.CLOSING,message:"Connection closing"})},closed:function(){return a.default.fromValues({statusCode:400,code:l.CLOSED,message:"Connection closed"})},unknownConnectionErr:function(){return a.default.fromValues({statusCode:500,code:l.UNKNOWN_CONNECTION_ERR,message:"Internal connection error"})},unknownChannelErr:function(){return a.default.fromValues({statusCode:500,code:l.UNKNOWN_CONNECTION_ERR,message:"Internal channel error"})}};function g(S){return!S.statusCode||!S.code||S.statusCode>=500?!0:Object.values(l).includes(S.code)}r.isRetriable=g,r.default=d},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o;(function(a){a[a.REQ_SEND=0]="REQ_SEND",a[a.REQ_RECV=1]="REQ_RECV",a[a.REQ_RECV_POLL=2]="REQ_RECV_POLL",a[a.REQ_RECV_STREAM=3]="REQ_RECV_STREAM"})(o||(o={})),r.default=o},function(n,r,i){(function(o,a){n.exports=a(i(6),i(5),i(58),i(11),i(40),i(32),i(25),i(27),i(28),i(59),i(60))})(this,function(o){return o})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(2)),l=function(){function d(g){this.members=g||[]}return d.prototype.call=function(){for(var g=[],S=0;S<arguments.length;S++)g[S]=arguments[S];for(var E=0,y=this.members;E<y.length;E++){var R=y[E];if(R)try{R.apply(void 0,g)}catch(f){a.default.logAction(a.default.LOG_ERROR,"Multicaster multiple callback handler","Unexpected exception: "+f+"; stack = "+f.stack)}}},d.prototype.push=function(){for(var g,S=[],E=0;E<arguments.length;E++)S[E]=arguments[E];(g=this.members).push.apply(g,S)},d.create=function(g){var S=new d(g);return Object.assign(function(){for(var E=[],y=0;y<arguments.length;y++)E[y]=arguments[y];return S.call.apply(S,E)},{push:function(E){return S.push(E)}})},d}();r.default=l},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){(function(){var a=o,l=a.lib,d=l.Base,g=a.enc,S=g.Utf8,E=a.algo;E.HMAC=d.extend({init:function(y,R){y=this._hasher=new y.init,typeof R=="string"&&(R=S.parse(R));var f=y.blockSize,k=f*4;R.sigBytes>k&&(R=y.finalize(R)),R.clamp();for(var T=this._oKey=R.clone(),x=this._iKey=R.clone(),p=T.words,m=x.words,b=0;b<f;b++)p[b]^=1549556828,m[b]^=909522486;T.sigBytes=x.sigBytes=k,this.reset()},reset:function(){var y=this._hasher;y.reset(),y.update(this._iKey)},update:function(y){return this._hasher.update(y),this},finalize:function(y){var R=this._hasher,f=R.finalize(y);R.reset();var k=R.finalize(this._oKey.clone().concat(f));return k}})})()})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(10)),l=o.__importStar(i(1)),d=o.__importDefault(i(7)),g=o.__importDefault(i(2)),S=o.__importDefault(i(21)),E=o.__importDefault(i(4)),y=o.__importDefault(i(3)),R=a.default.Action,f=a.default.fromValues({action:R.CLOSE}),k=a.default.fromValues({action:R.DISCONNECT}),T=function(x){o.__extends(p,x);function p(m,b,h,c){var u=x.call(this)||this;return c&&(h.format=void 0,h.heartbeats=!0),u.connectionManager=m,m.registerProposedTransport(u),u.auth=b,u.params=h,u.timeouts=h.options.timeouts,u.format=h.format,u.isConnected=!1,u.isFinished=!1,u.isDisposed=!1,u.maxIdleInterval=null,u.idleTimer=null,u.lastActivity=null,u}return p.prototype.connect=function(){},p.prototype.close=function(){this.isConnected&&this.requestClose(),this.finish("closed",S.default.closed())},p.prototype.disconnect=function(m){this.isConnected&&this.requestDisconnect(),this.finish("disconnected",m||S.default.disconnected())},p.prototype.fail=function(m){this.isConnected&&this.requestDisconnect(),this.finish("failed",m||S.default.failed())},p.prototype.finish=function(m,b){var h;this.isFinished||(this.isFinished=!0,this.isConnected=!1,this.maxIdleInterval=null,clearTimeout((h=this.idleTimer)!==null&&h!==void 0?h:void 0),this.idleTimer=null,this.emit(m,b),this.dispose())},p.prototype.onProtocolMessage=function(m){switch(g.default.shouldLog(g.default.LOG_MICRO)&&g.default.logAction(g.default.LOG_MICRO,"Transport.onProtocolMessage()","received on "+this.shortName+": "+a.default.stringify(m)+"; connectionId = "+this.connectionManager.connectionId),this.onActivity(),m.action){case R.HEARTBEAT:g.default.logAction(g.default.LOG_MICRO,"Transport.onProtocolMessage()",this.shortName+" heartbeat; connectionId = "+this.connectionManager.connectionId),this.emit("heartbeat",m.id);break;case R.CONNECTED:this.onConnect(m),this.emit("connected",m.error,m.connectionId,m.connectionDetails,m);break;case R.CLOSED:this.onClose(m);break;case R.DISCONNECTED:this.onDisconnect(m);break;case R.ACK:this.emit("ack",m.msgSerial,m.count);break;case R.NACK:this.emit("nack",m.msgSerial,m.count,m.error);break;case R.SYNC:this.connectionManager.onChannelMessage(m,this);break;case R.ACTIVATE:break;case R.AUTH:this.auth.authorize(function(b){b&&g.default.logAction(g.default.LOG_ERROR,"Transport.onProtocolMessage()","Ably requested re-authentication, but unable to obtain a new token: "+l.inspectError(b))});break;case R.ERROR:if(g.default.logAction(g.default.LOG_MINOR,"Transport.onProtocolMessage()","received error action; connectionId = "+this.connectionManager.connectionId+"; err = "+y.default.Config.inspect(m.error)+(m.channel?", channel: "+m.channel:"")),m.channel===void 0){this.onFatalError(m);break}this.connectionManager.onChannelMessage(m,this);break;default:this.connectionManager.onChannelMessage(m,this)}},p.prototype.onConnect=function(m){if(this.isConnected=!0,!m.connectionDetails)throw new Error("Transport.onConnect(): Connect message recieved without connectionDetails");var b=m.connectionDetails.maxIdleInterval;b&&(this.maxIdleInterval=b+this.timeouts.realtimeRequestTimeout,this.onActivity())},p.prototype.onDisconnect=function(m){var b=m&&m.error;g.default.logAction(g.default.LOG_MINOR,"Transport.onDisconnect()","err = "+l.inspectError(b)),this.finish("disconnected",b)},p.prototype.onFatalError=function(m){var b=m&&m.error;g.default.logAction(g.default.LOG_MINOR,"Transport.onFatalError()","err = "+l.inspectError(b)),this.finish("failed",b)},p.prototype.onClose=function(m){var b=m&&m.error;g.default.logAction(g.default.LOG_MINOR,"Transport.onClose()","err = "+l.inspectError(b)),this.finish("closed",b)},p.prototype.requestClose=function(){g.default.logAction(g.default.LOG_MINOR,"Transport.requestClose()",""),this.send(f)},p.prototype.requestDisconnect=function(){g.default.logAction(g.default.LOG_MINOR,"Transport.requestDisconnect()",""),this.send(k)},p.prototype.ping=function(m){var b={action:a.default.Action.HEARTBEAT};m&&(b.id=m),this.send(a.default.fromValues(b))},p.prototype.dispose=function(){g.default.logAction(g.default.LOG_MINOR,"Transport.dispose()",""),this.isDisposed=!0,this.off()},p.prototype.onActivity=function(){this.maxIdleInterval&&(this.lastActivity=this.connectionManager.lastActivity=l.now(),this.setIdleTimer(this.maxIdleInterval+100))},p.prototype.setIdleTimer=function(m){var b=this;this.idleTimer||(this.idleTimer=setTimeout(function(){b.onIdleTimerExpire()},m))},p.prototype.onIdleTimerExpire=function(){if(!this.lastActivity||!this.maxIdleInterval)throw new Error("Transport.onIdleTimerExpire(): lastActivity/maxIdleInterval not set");this.idleTimer=null;var m=l.now()-this.lastActivity,b=this.maxIdleInterval-m;if(b<=0){var h="No activity seen from realtime in "+m+"ms; assuming connection has dropped";g.default.logAction(g.default.LOG_ERROR,"Transport.onIdleTimerExpire()",h),this.disconnect(new E.default(h,80003,408))}else this.setIdleTimer(b+100)},p.tryConnect=function(m,b,h,c,u){var s=new m(b,h,c),w,v=function(L){clearTimeout(w),u({event:this.event,error:L})},C=b.options.timeouts.realtimeRequestTimeout;w=setTimeout(function(){s.off(["preconnect","disconnected","failed"]),s.dispose(),v.call({event:"disconnected"},new E.default("Timeout waiting for transport to indicate itself viable",5e4,500))},C),s.on(["failed","disconnected"],v),s.on("preconnect",function(){g.default.logAction(g.default.LOG_MINOR,"Transport.tryConnect()","viable transport "+s),clearTimeout(w),s.off(["failed","disconnected"],v),u(null,s)}),s.connect()},p}(d.default);r.default=T},function(n,r,i){(function(o,a){n.exports=a(i(6),i(40),i(25))})(this,function(o){return function(){var a=o,l=a.lib,d=l.Base,g=l.WordArray,S=a.algo,E=S.MD5,y=S.EvpKDF=d.extend({cfg:d.extend({keySize:128/32,hasher:E,iterations:1}),init:function(R){this.cfg=this.cfg.extend(R)},compute:function(R,f){for(var k,T=this.cfg,x=T.hasher.create(),p=g.create(),m=p.words,b=T.keySize,h=T.iterations;m.length<b;){k&&x.update(k),k=x.update(R).finalize(f),x.reset();for(var c=1;c<h;c++)k=x.finalize(k),x.reset();p.concat(k)}return p.sigBytes=b*4,p}});a.EvpKDF=function(R,f,k){return y.create(k).compute(R,f)}}(),o.EvpKDF})},function(n,r,i){(function(o,a){n.exports=a(i(6),i(27))})(this,function(o){o.lib.Cipher||function(a){var l=o,d=l.lib,g=d.Base,S=d.WordArray,E=d.BufferedBlockAlgorithm,y=l.enc;y.Utf8;var R=y.Base64,f=l.algo,k=f.EvpKDF,T=d.Cipher=E.extend({cfg:g.extend(),createEncryptor:function(N,P){return this.create(this._ENC_XFORM_MODE,N,P)},createDecryptor:function(N,P){return this.create(this._DEC_XFORM_MODE,N,P)},init:function(N,P,I){this.cfg=this.cfg.extend(I),this._xformMode=N,this._key=P,this.reset()},reset:function(){E.reset.call(this),this._doReset()},process:function(N){return this._append(N),this._process()},finalize:function(N){N&&this._append(N);var P=this._doFinalize();return P},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(P){return typeof P=="string"?L:w}return function(P){return{encrypt:function(I,M,A){return N(M).encrypt(P,I,M,A)},decrypt:function(I,M,A){return N(M).decrypt(P,I,M,A)}}}}()});d.StreamCipher=T.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1});var x=l.mode={},p=d.BlockCipherMode=g.extend({createEncryptor:function(N,P){return this.Encryptor.create(N,P)},createDecryptor:function(N,P){return this.Decryptor.create(N,P)},init:function(N,P){this._cipher=N,this._iv=P}}),m=x.CBC=function(){var N=p.extend();N.Encryptor=N.extend({processBlock:function(I,M){var A=this._cipher,j=A.blockSize;P.call(this,I,M,j),A.encryptBlock(I,M),this._prevBlock=I.slice(M,M+j)}}),N.Decryptor=N.extend({processBlock:function(I,M){var A=this._cipher,j=A.blockSize,U=I.slice(M,M+j);A.decryptBlock(I,M),P.call(this,I,M,j),this._prevBlock=U}});function P(I,M,A){var j,U=this._iv;U?(j=U,this._iv=a):j=this._prevBlock;for(var z=0;z<A;z++)I[M+z]^=j[z]}return N}(),b=l.pad={},h=b.Pkcs7={pad:function(N,P){for(var I=P*4,M=I-N.sigBytes%I,A=M<<24|M<<16|M<<8|M,j=[],U=0;U<M;U+=4)j.push(A);var z=S.create(j,M);N.concat(z)},unpad:function(N){var P=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=P}};d.BlockCipher=T.extend({cfg:T.cfg.extend({mode:m,padding:h}),reset:function(){var N;T.reset.call(this);var P=this.cfg,I=P.iv,M=P.mode;this._xformMode==this._ENC_XFORM_MODE?N=M.createEncryptor:(N=M.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==N?this._mode.init(this,I&&I.words):(this._mode=N.call(M,this,I&&I.words),this._mode.__creator=N)},_doProcessBlock:function(N,P){this._mode.processBlock(N,P)},_doFinalize:function(){var N,P=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(P.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),P.unpad(N)),N},blockSize:128/32});var c=d.CipherParams=g.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),u=l.format={},s=u.OpenSSL={stringify:function(N){var P,I=N.ciphertext,M=N.salt;return M?P=S.create([1398893684,1701076831]).concat(M).concat(I):P=I,P.toString(R)},parse:function(N){var P,I=R.parse(N),M=I.words;return M[0]==1398893684&&M[1]==1701076831&&(P=S.create(M.slice(2,4)),M.splice(0,4),I.sigBytes-=16),c.create({ciphertext:I,salt:P})}},w=d.SerializableCipher=g.extend({cfg:g.extend({format:s}),encrypt:function(N,P,I,M){M=this.cfg.extend(M);var A=N.createEncryptor(I,M),j=A.finalize(P),U=A.cfg;return c.create({ciphertext:j,key:I,iv:U.iv,algorithm:N,mode:U.mode,padding:U.padding,blockSize:N.blockSize,formatter:M.format})},decrypt:function(N,P,I,M){M=this.cfg.extend(M),P=this._parse(P,M.format);var A=N.createDecryptor(I,M).finalize(P.ciphertext);return A},_parse:function(N,P){return typeof N=="string"?P.parse(N,this):N}}),v=l.kdf={},C=v.OpenSSL={execute:function(N,P,I,M){M||(M=S.random(64/8));var A=k.create({keySize:P+I}).compute(N,M),j=S.create(A.words.slice(P),I*4);return A.sigBytes=P*4,c.create({key:A,iv:j,salt:M})}},L=d.PasswordBasedCipher=w.extend({cfg:w.cfg.extend({kdf:C}),encrypt:function(N,P,I,M){M=this.cfg.extend(M);var A=M.kdf.execute(I,N.keySize,N.ivSize);M.iv=A.iv;var j=w.encrypt.call(this,N,P,A.key,M);return j.mixIn(A),j},decrypt:function(N,P,I,M){M=this.cfg.extend(M),P=this._parse(P,M.format);var A=M.kdf.execute(I,N.keySize,N.ivSize,P.salt);M.iv=A.iv;var j=w.decrypt.call(this,N,P,A.key,M);return j}})}()})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.Request=r.createRequest=void 0;var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(12)),d=o.__importDefault(i(3)),g=o.__importDefault(i(7)),S=i(4),E=o.__importDefault(i(8)),y=o.__importDefault(i(2)),R=o.__importDefault(i(22)),f=a.getGlobalObject(),k=function(){},T=f._ablyjs_jsonp={};T._=function(u){return T["_"+u]||k};var x=1,p="jsonp";function m(u,s,w,v,C,L,N){return L=L||E.default.TIMEOUTS,new h(void 0,u,s,a.copy(w),v,C,L,N)}r.createRequest=m;var b=function(u){o.__extends(s,u);function s(w,v,C){var L=u.call(this,w,v,C)||this;return L.shortName=p,C.stream=!1,L}return s.isAvailable=function(){return d.default.Config.jsonpSupported&&d.default.Config.allowComet},s.prototype.toString=function(){return"JSONPTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},s.prototype.createRequest=function(w,v,C,L,N,P,I){return P=(this===null||this===void 0?void 0:this.timeouts)||P||E.default.TIMEOUTS,m(w,v,C,L,N,P,I)},s}(l.default),h=function(u){o.__extends(s,u);function s(w,v,C,L,N,P,I,M){var A=u.call(this)||this;return w===void 0&&(w=x++),A.id=w,A.uri=v,A.params=L||{},A.params.rnd=a.cheapRandStr(),C&&(C["X-Ably-Version"]&&(A.params.v=C["X-Ably-Version"]),C["X-Ably-Lib"]&&(A.params.lib=C["X-Ably-Lib"])),A.body=N,A.method=M,A.requestMode=P,A.timeouts=I,A.requestComplete=!1,A}return s.prototype.exec=function(){var w=this,v=this.id,C=this.body,L=this.method,N=this.uri,P=this.params;P.callback="_ablyjs_jsonp._("+v+")",P.envelope="jsonp",C&&(P.body=C),L&&L!=="get"&&(P.method=L);var I=this.script=document.createElement("script"),M=N+a.toQueryString(P);I.src=M,I.src.split("/").slice(-1)[0]!==M.split("/").slice(-1)[0]&&y.default.logAction(y.default.LOG_ERROR,"JSONP Request.exec()","Warning: the browser appears to have truncated the script URI. This will likely result in the request failing due to an unparseable body param"),I.async=!0,I.type="text/javascript",I.charset="UTF-8",I.onerror=function(U){w.complete(new S.PartialErrorInfo("JSONP script error (event: "+d.default.Config.inspect(U)+")",null,400))},T["_"+v]=function(U){if(U.statusCode){var z=U.response;if(U.statusCode==204)w.complete(null,null,null,U.statusCode);else if(!z)w.complete(new S.PartialErrorInfo("Invalid server response: no envelope detected",null,500));else if(U.statusCode<400||a.isArray(z))w.complete(null,z,U.headers,U.statusCode);else{var $=z.error||new S.PartialErrorInfo("Error response received from server",null,U.statusCode);w.complete($)}}else w.complete(null,U)};var A=this.requestMode==R.default.REQ_SEND?this.timeouts.httpRequestTimeout:this.timeouts.recvTimeout;this.timer=setTimeout(this.abort.bind(this),A);var j=document.getElementsByTagName("head")[0];j.insertBefore(I,j.firstChild)},s.prototype.complete=function(w,v,C,L){if(C=C||{},!this.requestComplete){this.requestComplete=!0;var N=void 0;v&&(N=typeof v=="string"?"text/plain":"application/json",C["content-type"]=N,this.emit("data",v)),this.emit("complete",w,v,C,!0,L),this.dispose()}},s.prototype.abort=function(){this.dispose()},s.prototype.dispose=function(){var w=this.timer;w&&(clearTimeout(w),this.timer=null);var v=this.script;v.parentNode&&v.parentNode.removeChild(v),delete T[this.id],this.emit("disposed")},s}(g.default);r.Request=h;function c(u){return f.JSONPTransport=b,b.isAvailable()&&(u.supportedTransports[p]=b),b}r.default=c},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(2)),d=o.__importDefault(i(8)),g=o.__importDefault(i(18)),S=o.__importDefault(i(46)),E=o.__importDefault(i(20)),y=o.__importDefault(i(33)),R=o.__importDefault(i(4)),f=o.__importDefault(i(49)),k=o.__importDefault(i(19)),T=o.__importDefault(i(3)),x=o.__importDefault(i(9)),p=o.__importDefault(i(16)),m=o.__importDefault(i(15)),b=function(){},h=function(){function u(s){if(!s){var w="no options provided";throw l.default.logAction(l.default.LOG_ERROR,"Rest()",w),new Error(w)}var v=d.default.objectifyOptions(s);v.log?(l.default.setLog(v.log.level,v.log.handler),l.default.deprecated("The `log` client option","Equivalent functionality is provided by the `logLevel` and `logHandler` client options. Update your client options code of the form `{ log: { level: logLevel, handler: logHandler } }` to instead be `{ logLevel, logHandler }`.")):l.default.setLog(v.logLevel,v.logHandler),l.default.logAction(l.default.LOG_MICRO,"Rest()","initialized with clientOptions "+T.default.Config.inspect(s));var C=this.options=d.default.normaliseOptions(v);if(C.key){var L=C.key.match(/^([^:\s]+):([^:.\s]+)$/);if(!L){var w="invalid key parameter";throw l.default.logAction(l.default.LOG_ERROR,"Rest()",w),new R.default(w,40400,404)}C.keyName=L[1],C.keySecret=L[2]}if("clientId"in C)if(typeof C.clientId=="string"||C.clientId===null){if(C.clientId==="*")throw new R.default('Can’t use "*" as a clientId as that string is reserved. (To change the default token request behaviour to use a wildcard clientId, use {defaultTokenParams: {clientId: "*"}})',40012,400)}else throw new R.default("clientId must be either a string or null",40012,400);l.default.logAction(l.default.LOG_MINOR,"Rest()","started; version = "+d.default.version),this.baseUri=this.authority=function(N){return d.default.getHttpScheme(C)+N+":"+d.default.getPort(C,!1)},this._currentFallback=null,this.serverTimeOffset=null,this.http=new T.default.Http(C),this.auth=new g.default(this,C),this.channels=new c(this),this.push=new S.default(this)}return u.prototype.stats=function(s,w){if(w===void 0)if(typeof s=="function")w=s,s=null;else{if(this.options.promises)return a.promisify(this,"stats",[s]);w=b}var v=a.defaultGetHeaders(this.options),C=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,L=this.http.supportsLinkHeaders?void 0:C;this.options.headers&&a.mixin(v,this.options.headers),new E.default(this,"/stats",v,L,function(N,P,I){for(var M=I?N:JSON.parse(N),A=0;A<M.length;A++)M[A]=f.default.fromValues(M[A]);return M}).get(s,w)},u.prototype.time=function(s,w){var v=this;if(w===void 0){if(typeof s=="function")w=s,s=null;else if(this.options.promises)return a.promisify(this,"time",[s])}var C=w||b,L=a.defaultGetHeaders(this.options);this.options.headers&&a.mixin(L,this.options.headers);var N=function(P){return v.authority(P)+"/time"};this.http.do(k.default.Get,this,N,L,null,s,function(P,I,M,A){if(P){C(P);return}A||(I=JSON.parse(I));var j=I[0];if(!j){C(new R.default("Internal error (unexpected result type from GET /time)",5e4,500));return}v.serverTimeOffset=j-a.now(),C(null,j)})},u.prototype.request=function(s,w,v,C,L,N){var P=this.options.useBinaryProtocol,I=P?T.default.Config.msgpack.encode:JSON.stringify,M=P?T.default.Config.msgpack.decode:JSON.parse,A=P?a.Format.msgpack:a.Format.json,j=this.http.supportsLinkHeaders?void 0:A;v=v||{};var U=s.toLowerCase(),z=U=="get"?a.defaultGetHeaders(this.options,A):a.defaultPostHeaders(this.options,A);if(N===void 0){if(this.options.promises)return a.promisify(this,"request",[s,w,v,C,L]);N=b}typeof C!="string"&&(C=I(C)),this.options.headers&&a.mixin(z,this.options.headers),L&&a.mixin(z,L);var $=new E.default(this,w,z,j,function(W,F,O){return a.ensureArray(O?W:M(W))},!0);if(!a.arrIn(T.default.Http.methods,U))throw new R.default("Unsupported method "+U,40500,405);a.arrIn(T.default.Http.methodsWithBody,U)?$[U](v,C,N):$[U](v,N)},u.prototype.batchPublish=function(s,w){if(w===void 0){if(this.options.promises)return a.promisify(this,"batchPublish",[s]);w=b}var v=w,C,L;a.isArray(s)?(C=s,L=!1):(C=[s],L=!0);var N=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,P=a.defaultPostHeaders(this.options,N);this.options.headers&&a.mixin(P,this.options.headers);var I=a.encodeBody(C,N);m.default.post(this,"/messages",I,P,{newBatchResponse:"true"},null,function(M,A,j,U){if(M){v(M);return}var z=U?A:a.decodeBody(A,N);L?v(null,z[0]):v(null,z)})},u.prototype.batchPresence=function(s,w){if(w===void 0){if(this.options.promises)return a.promisify(this,"batchPresence",[s]);w=b}var v=w,C=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,L=a.defaultPostHeaders(this.options,C);this.options.headers&&a.mixin(L,this.options.headers);var N=s.join(",");m.default.get(this,"/presence",L,{newBatchResponse:"true",channels:N},null,function(P,I,M,A){if(P){v(P);return}var j=A?I:a.decodeBody(I,C);v(null,j)})},u.prototype.setLog=function(s){l.default.setLog(s.level,s.handler)},u.Promise=function(s){return s=d.default.objectifyOptions(s),s.promises=!0,new u(s)},u.Callbacks=u,u.Platform=T.default,u.Message=x.default,u.PresenceMessage=p.default,u}(),c=function(){function u(s){this.rest=s,this.all=Object.create(null)}return u.prototype.get=function(s,w){s=String(s);var v=this.all[s];return v?w&&v.setOptions(w):this.all[s]=v=new y.default(this.rest,s,w),v},u.prototype.release=function(s){delete this.all[String(s)]},u}();r.default=h},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return o.enc.Utf8})},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(a){var l=o,d=l.lib,g=d.WordArray,S=d.Hasher,E=l.algo,y=[],R=[];(function(){function T(b){for(var h=a.sqrt(b),c=2;c<=h;c++)if(!(b%c))return!1;return!0}function x(b){return(b-(b|0))*4294967296|0}for(var p=2,m=0;m<64;)T(p)&&(m<8&&(y[m]=x(a.pow(p,1/2))),R[m]=x(a.pow(p,1/3)),m++),p++})();var f=[],k=E.SHA256=S.extend({_doReset:function(){this._hash=new g.init(y.slice(0))},_doProcessBlock:function(T,x){for(var p=this._hash.words,m=p[0],b=p[1],h=p[2],c=p[3],u=p[4],s=p[5],w=p[6],v=p[7],C=0;C<64;C++){if(C<16)f[C]=T[x+C]|0;else{var L=f[C-15],N=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,P=f[C-2],I=(P<<15|P>>>17)^(P<<13|P>>>19)^P>>>10;f[C]=N+f[C-7]+I+f[C-16]}var M=u&s^~u&w,A=m&b^m&h^b&h,j=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),U=(u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25),z=v+U+M+R[C]+f[C],$=j+A;v=w,w=s,s=u,u=c+z|0,c=h,h=b,b=m,m=z+$|0}p[0]=p[0]+m|0,p[1]=p[1]+b|0,p[2]=p[2]+h|0,p[3]=p[3]+c|0,p[4]=p[4]+u|0,p[5]=p[5]+s|0,p[6]=p[6]+w|0,p[7]=p[7]+v|0},_doFinalize:function(){var T=this._data,x=T.words,p=this._nDataBytes*8,m=T.sigBytes*8;return x[m>>>5]|=128<<24-m%32,x[(m+64>>>9<<4)+14]=a.floor(p/4294967296),x[(m+64>>>9<<4)+15]=p,T.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var T=S.clone.call(this);return T._hash=this._hash.clone(),T}});l.SHA256=S._createHelper(k),l.HmacSHA256=S._createHmacHelper(k)}(Math),o.SHA256})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(7)),d=o.__importDefault(i(2)),g=o.__importDefault(i(34)),S=o.__importDefault(i(9)),E=o.__importDefault(i(4)),y=o.__importDefault(i(20)),R=o.__importDefault(i(15)),f=o.__importDefault(i(3));function k(){}var T=9;function x(b){return a.arrEvery(b,function(h){return!h.id})}function p(b){var h=b||{};if(h.cipher){if(!f.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var c=f.default.Crypto.getCipher(h.cipher);h.cipher=c.cipherParams,h.channelCipher=c.cipher}else"cipher"in h&&(h.cipher=void 0,h.channelCipher=null);return h}var m=function(b){o.__extends(h,b);function h(c,u,s){var w=b.call(this)||this;return d.default.logAction(d.default.LOG_MINOR,"Channel()","started; name = "+u),w.rest=c,w.name=u,w.basePath="/channels/"+encodeURIComponent(u),w.presence=new g.default(w),w.channelOptions=p(s),w}return h.prototype.setOptions=function(c){this.channelOptions=p(c)},h.prototype.history=function(c,u){if(d.default.logAction(d.default.LOG_MICRO,"Channel.history()","channel = "+this.name),u===void 0)if(typeof c=="function")u=c,c=null;else{if(this.rest.options.promises)return a.promisify(this,"history",arguments);u=k}this._history(c,u)},h.prototype._history=function(c,u){var s=this.rest,w=s.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,v=this.rest.http.supportsLinkHeaders?void 0:w,C=a.defaultGetHeaders(s.options,w);s.options.headers&&a.mixin(C,s.options.headers);var L=this.channelOptions;new y.default(s,this.basePath+"/messages",C,v,function(N,P,I){return S.default.fromResponseBody(N,L,I?void 0:w)}).get(c,u)},h.prototype.publish=function(){var c=this,u=arguments.length,s=arguments[0],w=arguments[1],v=arguments[u-1],C,L;if(typeof v!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);v=k}if(typeof s=="string"||s===null)C=[S.default.fromValues({name:s,data:w})],L=arguments[2];else if(a.isObject(s))C=[S.default.fromValues(s)],L=arguments[1];else if(a.isArray(s))C=S.default.fromValuesArray(s),L=arguments[1];else throw new E.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);(typeof L!="object"||!L)&&(L={});var N=this.rest,P=N.options,I=P.useBinaryProtocol?a.Format.msgpack:a.Format.json,M=N.options.idempotentRestPublishing,A=a.defaultPostHeaders(N.options,I);if(P.headers&&a.mixin(A,P.headers),M&&x(C)){var j=a.randomString(T);a.arrForEach(C,function(U,z){U.id=j+":"+z.toString()})}S.default.encodeArray(C,this.channelOptions,function(U){if(U){v(U);return}var z=S.default.getMessagesSize(C),$=P.maxMessageSize;if(z>$){v(new E.default("Maximum size of messages that can be published at once exceeded ( was "+z+" bytes; limit is "+$+" bytes)",40009,400));return}c._publish(S.default.serialize(C,I),A,L,v)})},h.prototype._publish=function(c,u,s,w){R.default.post(this.rest,this.basePath+"/messages",c,u,s,null,w)},h.prototype.status=function(c){if(typeof c!="function"&&this.rest.options.promises)return a.promisify(this,"status",[]);var u=this.rest.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,s=a.defaultPostHeaders(this.rest.options,u);R.default.get(this.rest,this.basePath,s,{},u,c||k)},h}(l.default);r.default=m},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(7)),d=o.__importDefault(i(2)),g=o.__importDefault(i(20)),S=o.__importDefault(i(16));function E(){}var y=function(R){o.__extends(f,R);function f(k){var T=R.call(this)||this;return T.channel=k,T.basePath=k.basePath+"/presence",T}return f.prototype.get=function(k,T){if(d.default.logAction(d.default.LOG_MICRO,"Presence.get()","channel = "+this.channel.name),T===void 0)if(typeof k=="function")T=k,k=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"get",arguments);T=E}var x=this.channel.rest,p=x.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,m=this.channel.rest.http.supportsLinkHeaders?void 0:p,b=a.defaultGetHeaders(x.options,p);x.options.headers&&a.mixin(b,x.options.headers);var h=this.channel.channelOptions;new g.default(x,this.basePath,b,m,function(c,u,s){return S.default.fromResponseBody(c,h,s?void 0:p)}).get(k,T)},f.prototype.history=function(k,T){return d.default.logAction(d.default.LOG_MICRO,"Presence.history()","channel = "+this.channel.name),this._history(k,T)},f.prototype._history=function(k,T){if(T===void 0)if(typeof k=="function")T=k,k=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"_history",[k]);T=E}var x=this.channel.rest,p=x.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,m=this.channel.rest.http.supportsLinkHeaders?void 0:p,b=a.defaultGetHeaders(x.options,p);x.options.headers&&a.mixin(b,x.options.headers);var h=this.channel.channelOptions;new g.default(x,this.basePath+"/history",b,m,function(c,u,s){return S.default.fromResponseBody(c,h,s?void 0:p)}).get(k,T)},f}(l.default);r.default=y},function(n,r,i){(function(o){Object.defineProperty(r,"__esModule",{value:!0}),r.TransportParams=void 0;var a=i(0),l=a.__importDefault(i(10)),d=a.__importStar(i(1)),g=a.__importStar(i(52)),S=a.__importStar(i(8)),E=a.__importDefault(i(3)),y=a.__importDefault(i(7)),R=a.__importDefault(i(36)),f=a.__importDefault(i(2)),k=a.__importDefault(i(37)),T=a.__importStar(i(21)),x=a.__importStar(i(4)),p=a.__importDefault(i(18)),m=a.__importDefault(i(9)),b=a.__importDefault(i(24)),h=a.__importDefault(i(53)),c=a.__importDefault(i(26)),u=a.__importDefault(i(14)),s=function(){var W;return typeof E.default.WebStorage!="undefined"&&((W=E.default.WebStorage)===null||W===void 0?void 0:W.localSupported)},w=function(){var W;return typeof E.default.WebStorage!="undefined"&&((W=E.default.WebStorage)===null||W===void 0?void 0:W.sessionSupported)},v=l.default.Action,C=function(){},L="ably-transport-preference",N="ably-connection-recovery";function P(){var W,F;return w()&&((F=(W=E.default.WebStorage)===null||W===void 0?void 0:W.getSession)===null||F===void 0?void 0:F.call(W,N))}function I(W){var F,O;return w()&&((O=(F=E.default.WebStorage)===null||F===void 0?void 0:F.setSession)===null||O===void 0?void 0:O.call(F,N,W))}function M(){var W,F;return w()&&((F=(W=E.default.WebStorage)===null||W===void 0?void 0:W.removeSession)===null||F===void 0?void 0:F.call(W,N))}function A(W,F){return d.arrIndexOf(E.default.Defaults.transportPreferenceOrder,W.shortName)>d.arrIndexOf(E.default.Defaults.transportPreferenceOrder,F.shortName)}function j(W,F,O){var D;if(W.channel!==F.channel||(D=W.action)!==v.PRESENCE&&D!==v.MESSAGE||D!==F.action)return!1;var B=D===v.PRESENCE?"presence":"messages",_=W[B].concat(F[B]),V=m.default.getMessagesSize(_);return V>O||!d.allSame(_,"clientId")||!d.arrEvery(_,function(Y){return!Y.id})?!1:(W[B]=_,!0)}function U(W){try{return JSON.parse(W)}catch(F){return null}}var z=function(){function W(F,O,D,B){this.options=F,this.host=O,this.mode=D,this.connectionKey=B,this.format=F.useBinaryProtocol?d.Format.msgpack:d.Format.json}return W.prototype.getConnectParams=function(F){var O=F?d.copy(F):{},D=this.options;switch(this.mode){case"upgrade":O.upgrade=this.connectionKey;break;case"resume":O.resume=this.connectionKey;break;case"recover":{var B=U(D.recover);B&&(O.recover=B.connectionKey);break}}return D.clientId!==void 0&&(O.clientId=D.clientId),D.echoMessages===!1&&(O.echo="false"),this.format!==void 0&&(O.format=this.format),this.stream!==void 0&&(O.stream=this.stream),this.heartbeats!==void 0&&(O.heartbeats=this.heartbeats),O.v=S.default.protocolVersion,O.agent=(0,S.getAgentString)(this.options),D.transportParams!==void 0&&d.mixin(O,D.transportParams),O},W.prototype.toString=function(){var F="[mode="+this.mode;return this.host&&(F+=",host="+this.host),this.connectionKey&&(F+=",connectionKey="+this.connectionKey),this.format&&(F+=",format="+this.format),F+="]",F},W}();r.TransportParams=z;var $=function(W){a.__extends(F,W);function F(O,D){var B=W.call(this)||this;B.disconnectedRetryCount=0,F.initTransports(),B.realtime=O,B.options=D;var _=D.timeouts,V=_.preferenceConnectTimeout+_.realtimeRequestTimeout;if(B.states={initialized:{state:"initialized",terminal:!1,queueEvents:!0,sendEvents:!1,failState:"disconnected"},connecting:{state:"connecting",terminal:!1,queueEvents:!0,sendEvents:!1,retryDelay:V,failState:"disconnected"},connected:{state:"connected",terminal:!1,queueEvents:!1,sendEvents:!0,failState:"disconnected"},synchronizing:{state:"connected",terminal:!1,queueEvents:!0,sendEvents:!1,forceQueueEvents:!0,failState:"disconnected"},disconnected:{state:"disconnected",terminal:!1,queueEvents:!0,sendEvents:!1,retryDelay:_.disconnectedRetryTimeout,failState:"disconnected"},suspended:{state:"suspended",terminal:!1,queueEvents:!1,sendEvents:!1,retryDelay:_.suspendedRetryTimeout,failState:"suspended"},closing:{state:"closing",terminal:!1,queueEvents:!1,sendEvents:!1,retryDelay:_.realtimeRequestTimeout,failState:"closed"},closed:{state:"closed",terminal:!0,queueEvents:!1,sendEvents:!1,failState:"closed"},failed:{state:"failed",terminal:!0,queueEvents:!1,sendEvents:!1,failState:"failed"}},B.state=B.states.initialized,B.errorReason=null,B.queuedMessages=new R.default,B.msgSerial=0,B.connectionDetails=void 0,B.connectionId=void 0,B.connectionKey=void 0,B.connectionStateTtl=_.connectionStateTtl,B.maxIdleInterval=null,B.transports=d.intersect(D.transports||S.default.defaultTransports,F.supportedTransports),B.baseTransport=d.intersect(S.default.baseTransportOrder,B.transports)[0],B.upgradeTransports=d.intersect(B.transports,S.default.upgradeTransports),B.transportPreference=null,B.httpHosts=S.default.getHosts(D),B.activeProtocol=null,B.proposedTransports=[],B.pendingTransports=[],B.host=null,B.lastAutoReconnectAttempt=null,B.lastActivity=null,B.forceFallbackHost=!1,B.connectCounter=0,f.default.logAction(f.default.LOG_MINOR,"Realtime.ConnectionManager()","started"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","requested transports = ["+(D.transports||S.default.defaultTransports)+"]"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","available transports = ["+B.transports+"]"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","http hosts = ["+B.httpHosts+"]"),!B.transports.length){var Y="no requested transports available";throw f.default.logAction(f.default.LOG_ERROR,"realtime.ConnectionManager()",Y),new Error(Y)}var X=E.default.Config.addEventListener;return X&&(w()&&typeof D.recover=="function"&&X("beforeunload",B.persistConnection.bind(B)),D.closeOnUnload===!0&&X("beforeunload",function(){f.default.logAction(f.default.LOG_MAJOR,"Realtime.ConnectionManager()","beforeunload event has triggered the connection to close as closeOnUnload is true"),B.requestState({state:"closing"})}),X("online",function(){B.state==B.states.disconnected||B.state==B.states.suspended?(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager caught browser ‘online’ event","reattempting connection"),B.requestState({state:"connecting"})):B.state==B.states.connecting&&(B.pendingTransports.forEach(function(ne){ne.off()}),B.disconnectAllTransports(),B.startConnect())}),X("offline",function(){B.state==B.states.connected&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager caught browser ‘offline’ event","disconnecting active transport"),B.disconnectAllTransports())})),B}return F.initTransports=function(){(0,h.default)(F),d.arrForEach(E.default.Transports,function(O){O(F)})},F.prototype.createTransportParams=function(O,D){return new z(this.options,O,D,this.connectionKey)},F.prototype.getTransportParams=function(O){var D=this,B=function(_){if(D.connectionKey){_("resume");return}if(typeof D.options.recover=="string"){_("recover");return}var V=D.options.recover,Y=P();if(Y&&typeof V=="function"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Calling clientOptions-provided recover function with last session data"),V(Y,function(X){X?(D.options.recover=Y.recoveryKey,_("recover")):_("clean")});return}_("clean")};B(function(_){var V=D.createTransportParams(null,_);if(_==="recover"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport recovery mode = recover; recoveryKey = "+D.options.recover);var Y=U(D.options.recover);Y&&(D.msgSerial=Y.msgSerial)}else f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport params = "+V.toString());O(V)})},F.prototype.tryATransport=function(O,D,B){var _=this;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","trying "+D),c.default.tryConnect(F.supportedTransports[D],this,this.realtime.auth,O,function(V,Y){var X=_.state;if(X==_.states.closing||X==_.states.closed||X==_.states.failed){Y&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","connection "+X.state+" while we were attempting the transport; closing "+Y),Y.close()),B(!0);return}if(V){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","transport "+D+" "+V.event+", err: "+V.error.toString()),p.default.isTokenErr(V.error)&&!(_.errorReason&&p.default.isTokenErr(_.errorReason))?(_.errorReason=V.error,_.realtime.auth._forceNewToken(null,null,function(ne){if(ne){_.actOnErrorFromAuthorize(ne);return}_.tryATransport(O,D,B)})):V.event==="failed"?(_.notifyState({state:"failed",error:V.error}),B(!0)):V.event==="disconnected"&&((0,T.isRetriable)(V.error)?B(!1):(_.notifyState({state:_.states.connecting.failState,error:V.error}),B(!0)));return}f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","viable transport "+D+"; setting pending"),_.setTransportPending(Y,O),B(null,Y)})},F.prototype.setTransportPending=function(O,D){var B=this,_=D.mode;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setTransportPending()","transport = "+O+"; mode = "+_),d.arrDeleteValue(this.proposedTransports,O),this.pendingTransports.push(O);var V=E.default.Defaults.transportPreferenceOrder[E.default.Defaults.transportPreferenceOrder.length-1];O.once("connected",function(X,ne,re){_=="upgrade"&&B.activeProtocol?O.shortName!==V&&d.arrIn(B.getUpgradePossibilities(),V)&&B.activeProtocol?setTimeout(function(){B.scheduleTransportActivation(X,O,ne,re)},B.options.timeouts.parallelUpgradeDelay):B.scheduleTransportActivation(X,O,ne,re):(B.activateTransport(X,O,ne,re),E.default.Config.nextTick(function(){B.connectImpl(D)})),_==="recover"&&B.options.recover&&(B.options.recover=null,B.unpersistConnection())});var Y=this;O.on(["disconnected","closed","failed"],function(X){Y.deactivateTransport(O,this.event,X)}),this.emit("transport.pending",O)},F.prototype.scheduleTransportActivation=function(O,D,B,_){var V=this,Y=this.activeProtocol&&this.activeProtocol.getTransport(),X=function(){D.disconnect(),d.arrDeleteValue(V.pendingTransports,D)};if(this.state!==this.states.connected&&this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Current connection state ("+this.state.state+(this.state===this.states.synchronizing?", but with an upgrade already in progress":"")+") is not valid to upgrade in; abandoning upgrade to "+D.shortName),X();return}if(Y&&!A(D,Y)){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+D.shortName+" is no better than current active transport "+Y.shortName+" - abandoning upgrade"),X();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Scheduling transport upgrade; transport = "+D);var ne=null;if(!D.isConnected){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+D.shortName+"is no longer connected; abandoning upgrade"),X();return}if(this.state===this.states.connected)f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Currently connected, so temporarily pausing events until the upgrade is complete"),this.state=this.states.synchronizing,ne=this.activeProtocol;else if(this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Current connection state ("+this.state.state+(this.state===this.states.synchronizing?", but with an upgrade already in progress":"")+") is not valid to upgrade in; abandoning upgrade to "+D.shortName),X();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Syncing transport; transport = "+D);var re=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Activating transport; transport = "+D),D.send(l.default.fromValues({action:v.ACTIVATE})),V.activateTransport(O,D,B,_),V.state===V.states.synchronizing?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, sending queued messages on upgraded transport; transport = "+D),V.state=V.states.connected):f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, but state is now "+V.state.state+", so leaving unchanged"),V.state.sendEvents&&V.sendQueuedMessages()};ne?ne.onceIdle(re):re()},F.prototype.activateTransport=function(O,D,B,_){var V=this;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","transport = "+D),O&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","error = "+O),B&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.activateTransport()","connectionId = "+B),_&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.activateTransport()","connectionDetails = "+JSON.stringify(_)),this.persistTransportPreference(D);var Y=this.state,X=this.states.connected.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","current state = "+Y.state),Y.state==this.states.closing.state||Y.state==this.states.closed.state||Y.state==this.states.failed.state)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Disconnecting transport and abandoning"),D.disconnect(),!1;if(d.arrDeleteValue(this.pendingTransports,D),!D.isConnected)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Declining to activate transport "+D+" since it appears to no longer be connected"),!1;var ne=this.activeProtocol;this.activeProtocol=new g.default(D),this.host=D.params.host;var re=_.connectionKey;if(re&&this.connectionKey!=re&&this.setConnection(B,_,!!O),this.onConnectionDetailsUpdate(_,D),E.default.Config.nextTick(function(){D.on("connected",function(Z,ye,De){V.onConnectionDetailsUpdate(De,D),V.emit("update",new k.default(X,X,null,Z))})}),Y.state===this.states.connected.state?O&&(this.errorReason=this.realtime.connection.errorReason=O,this.emit("update",new k.default(X,X,null,O))):(this.notifyState({state:"connected",error:O}),this.errorReason=this.realtime.connection.errorReason=O||null),this.emit("transport.active",D),ne)if(ne.messageQueue.count()>0&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Previous active protocol (for transport "+ne.transport.shortName+", new one is "+D.shortName+") finishing with "+ne.messageQueue.count()+" messages still pending"),ne.transport===D){var ce="Assumption violated: activating a transport that was also the transport for the previous active protocol; transport = "+D.shortName+"; stack = "+new Error().stack;f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()",ce)}else ne.finish();return d.safeArrForEach(this.pendingTransports,function(Z){if(Z===D){var ye="Assumption violated: activating a transport that is still marked as a pending transport; transport = "+D.shortName+"; stack = "+new Error().stack;f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()",ye),d.arrDeleteValue(V.pendingTransports,D)}else Z.disconnect()}),d.safeArrForEach(this.proposedTransports,function(Z){Z===D?(f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Assumption violated: activating a transport that is still marked as a proposed transport; transport = "+D.shortName+"; stack = "+new Error().stack),d.arrDeleteValue(V.proposedTransports,D)):Z.dispose()}),!0},F.prototype.deactivateTransport=function(O,D,B){var _=this.activeProtocol,V=_&&_.getTransport()===O,Y=d.arrDeleteValue(this.pendingTransports,O),X=d.arrDeleteValue(this.proposedTransports,O),ne=this.noTransportsScheduledForActivation();if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.deactivateTransport()","transport = "+O),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.deactivateTransport()","state = "+D+(V?"; was active":Y?"; was pending":X?"; was proposed":"")+(ne?"":"; another transport is scheduled for activation")),B&&B.message&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","reason = "+B.message),V&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","Getting, clearing, and requeuing "+this.activeProtocol.messageQueue.count()+" pending messages"),this.queuePendingMessages(_.getPendingMessages()),E.default.Config.nextTick(function(){_.clearPendingMessages()}),this.activeProtocol=this.host=null),this.emit("transport.inactive",O),V&&ne||V&&D==="failed"||D==="closed"||_===null&&Y&&this.pendingTransports.length===0){if(D==="disconnected"&&B&&B.statusCode>500&&this.httpHosts.length>1){this.unpersistTransportPreference(),this.forceFallbackHost=!0,this.notifyState({state:D,error:B,retryImmediately:!0});return}var re=D==="failed"&&p.default.isTokenErr(B)?"disconnected":D;this.notifyState({state:re,error:B});return}V&&D==="disconnected"&&this.state!==this.states.synchronizing&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","wasActive but another transport is connected and scheduled for activation, so going into the connecting state until it activates"),this.startSuspendTimer(),this.startTransitionTimer(this.states.connecting),this.notifyState({state:"connecting",error:B}))},F.prototype.noTransportsScheduledForActivation=function(){return d.isEmpty(this.pendingTransports)||this.pendingTransports.every(function(O){return!O.isConnected})},F.prototype.setConnection=function(O,D,B){var _=this.connectionId,V=_&&_!==O,Y=!_&&B;(V||Y)&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setConnection()","Resetting msgSerial"),this.msgSerial=0,this.queuedMessages.resetSendAttempted()),this.connectionId!==O&&f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setConnection()","New connectionId; reattaching any attached channels"),this.realtime.connection.id=this.connectionId=O,this.realtime.connection.key=this.connectionKey=D.connectionKey},F.prototype.clearConnection=function(){this.realtime.connection.id=this.connectionId=void 0,this.realtime.connection.key=this.connectionKey=void 0,this.msgSerial=0,this.unpersistConnection()},F.prototype.createRecoveryKey=function(){return this.connectionKey?JSON.stringify({connectionKey:this.connectionKey,msgSerial:this.msgSerial,channelSerials:this.realtime.channels.channelSerials()}):null},F.prototype.checkConnectionStateFreshness=function(){if(!(!this.lastActivity||!this.connectionId)){var O=d.now()-this.lastActivity;O>this.connectionStateTtl+this.maxIdleInterval&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.checkConnectionStateFreshness()","Last known activity from realtime was "+O+"ms ago; discarding connection state"),this.clearConnection(),this.states.connecting.failState="suspended")}},F.prototype.persistConnection=function(){if(w()){var O=this.createRecoveryKey();O&&I({recoveryKey:O,disconnectedAt:d.now(),location:o.location,clientId:this.realtime.auth.clientId})}},F.prototype.unpersistConnection=function(){M()},F.prototype.getError=function(){return this.errorReason||this.getStateError()},F.prototype.getStateError=function(){var O,D;return(D=(O=T.default)[this.state.state])===null||D===void 0?void 0:D.call(O)},F.prototype.activeState=function(){return this.state.queueEvents||this.state.sendEvents},F.prototype.enactStateChange=function(O){var D=O.current==="failed"?f.default.LOG_ERROR:f.default.LOG_MAJOR;f.default.logAction(D,"Connection state",O.current+(O.reason?"; reason: "+O.reason:"")),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.enactStateChange","setting new state: "+O.current+"; reason = "+(O.reason&&O.reason.message));var B=this.state=this.states[O.current];O.reason&&(this.errorReason=O.reason,this.realtime.connection.errorReason=O.reason),(B.terminal||B.state==="suspended")&&this.clearConnection(),this.emit("connectionstate",O)},F.prototype.startTransitionTimer=function(O){var D=this;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startTransitionTimer()","transitionState: "+O.state),this.transitionTimer&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startTransitionTimer()","clearing already-running timer"),clearTimeout(this.transitionTimer)),this.transitionTimer=setTimeout(function(){D.transitionTimer&&(D.transitionTimer=null,f.default.logAction(f.default.LOG_MINOR,"ConnectionManager "+O.state+" timer expired","requesting new state: "+O.failState),D.notifyState({state:O.failState}))},O.retryDelay)},F.prototype.cancelTransitionTimer=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.cancelTransitionTimer()",""),this.transitionTimer&&(clearTimeout(this.transitionTimer),this.transitionTimer=null)},F.prototype.startSuspendTimer=function(){var O=this;this.suspendTimer||(this.suspendTimer=setTimeout(function(){O.suspendTimer&&(O.suspendTimer=null,f.default.logAction(f.default.LOG_MINOR,"ConnectionManager suspend timer expired","requesting new state: suspended"),O.states.connecting.failState="suspended",O.notifyState({state:"suspended"}))},this.connectionStateTtl))},F.prototype.checkSuspendTimer=function(O){O!=="disconnected"&&O!=="suspended"&&O!=="connecting"&&this.cancelSuspendTimer()},F.prototype.cancelSuspendTimer=function(){this.states.connecting.failState="disconnected",this.suspendTimer&&(clearTimeout(this.suspendTimer),this.suspendTimer=null)},F.prototype.startRetryTimer=function(O){var D=this;this.retryTimer=setTimeout(function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager retry timer expired","retrying"),D.retryTimer=null,D.requestState({state:"connecting"})},O)},F.prototype.cancelRetryTimer=function(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)},F.prototype.notifyState=function(O){var D=this,B,_,V=O.state,Y=V==="disconnected"&&(this.state===this.states.connected||this.state===this.states.synchronizing||O.retryImmediately||this.state===this.states.connecting&&O.error&&p.default.isTokenErr(O.error)&&!(this.errorReason&&p.default.isTokenErr(this.errorReason)));if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.notifyState()","new state: "+V+(Y?"; will retry connection immediately":"")),V!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(O.state),(V==="suspended"||V==="connected")&&(this.disconnectedRetryCount=0),!this.state.terminal)){var X=this.states[O.state],ne=X.retryDelay;X.state==="disconnected"&&(this.disconnectedRetryCount++,ne=d.getRetryTime(X.retryDelay,this.disconnectedRetryCount));var re=new k.default(this.state.state,X.state,ne,O.error||((_=(B=T.default)[X.state])===null||_===void 0?void 0:_.call(B)));if(Y){var ce=function(){D.state===D.states.disconnected&&(D.lastAutoReconnectAttempt=d.now(),D.requestState({state:"connecting"}))},Z=this.lastAutoReconnectAttempt&&d.now()-this.lastAutoReconnectAttempt+1;Z&&Z<1e3?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.notifyState()","Last reconnect attempt was only "+Z+"ms ago, waiting another "+(1e3-Z)+"ms before trying again"),setTimeout(ce,1e3-Z)):E.default.Config.nextTick(ce)}else(V==="disconnected"||V==="suspended")&&this.startRetryTimer(ne);(V==="disconnected"&&!Y||V==="suspended"||X.terminal)&&E.default.Config.nextTick(function(){D.disconnectAllTransports()}),V=="connected"&&!this.activeProtocol&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.notifyState()","Broken invariant: attempted to go into connected state, but there is no active protocol"),this.enactStateChange(re),this.state.sendEvents?this.sendQueuedMessages():this.state.queueEvents||(this.realtime.channels.propogateConnectionInterruption(V,re.reason),this.failQueuedMessages(re.reason))}},F.prototype.requestState=function(O){var D=this,B,_,V=O.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.requestState()","requested state: "+V+"; current state: "+this.state.state),V!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(V),!(V=="connecting"&&this.state.state=="connected")&&!(V=="closing"&&this.state.state=="closed"))){var Y=this.states[V],X=new k.default(this.state.state,Y.state,null,O.error||((_=(B=T.default)[Y.state])===null||_===void 0?void 0:_.call(B)));this.enactStateChange(X),V=="connecting"&&E.default.Config.nextTick(function(){D.startConnect()}),V=="closing"&&this.closeImpl()}},F.prototype.startConnect=function(){var O=this;if(this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startConnect()","Must be in connecting state to connect, but was "+this.state.state);return}var D=this.realtime.auth,B=++this.connectCounter,_=function(){O.checkConnectionStateFreshness(),O.getTransportParams(function(Y){if(Y.mode==="recover"&&Y.options.recover){var X=U(Y.options.recover);X&&O.realtime.channels.recoverChannels(X.channelSerials)}B===O.connectCounter&&O.connectImpl(Y,B)})};if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startConnect()","starting connection"),this.startSuspendTimer(),this.startTransitionTimer(this.states.connecting),D.method==="basic")_();else{var V=function(Y){B===O.connectCounter&&(Y?O.actOnErrorFromAuthorize(Y):_())};this.errorReason&&p.default.isTokenErr(this.errorReason)?D._forceNewToken(null,null,V):D._ensureValidAuthCredentials(!1,V)}},F.prototype.connectImpl=function(O,D){var B=this.state.state;B!==this.states.connecting.state&&B!==this.states.connected.state?f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectImpl()","Must be in connecting state to connect (or connected to upgrade), but was "+B):this.pendingTransports.length?f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectImpl()","Transports "+this.pendingTransports[0].toString()+" currently pending; taking no action"):B==this.states.connected.state?this.upgradeIfNeeded(O):this.transports.length>1&&this.getTransportPreference()?this.connectPreference(O,D):this.connectBase(O,D)},F.prototype.connectPreference=function(O,D){var B=this,_=this.getTransportPreference(),V=!1;d.arrIn(this.transports,_)||(this.unpersistTransportPreference(),this.connectImpl(O,D)),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectPreference()","Trying to connect with stored transport preference "+_);var Y=setTimeout(function(){V=!0,B.state.state!==B.states.connected.state&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectPreference()","Shortcircuit connection attempt with "+_+" failed; clearing preference and trying from scratch"),B.disconnectAllTransports(),B.unpersistTransportPreference()),B.connectImpl(O,D)},this.options.timeouts.preferenceConnectTimeout);O.host=this.httpHosts[0],this.tryATransport(O,_,function(X,ne){clearTimeout(Y),V&&ne?(ne.off(),ne.disconnect(),d.arrDeleteValue(B.pendingTransports,ne)):!ne&&!X&&(B.unpersistTransportPreference(),B.connectImpl(O,D))})},F.prototype.connectBase=function(O,D){var B=this,_=function(re){B.notifyState({state:B.states.connecting.failState,error:re})},V=this.httpHosts.slice(),Y=function(re,ce){D===B.connectCounter&&!ce&&!re&&ne()};f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectBase()","Trying to connect with base transport "+this.baseTransport);var X=V.shift();if(!X){_(new x.default("Unable to connect (no available host)",80003,404));return}O.host=X;var ne=function(){if(!V.length){_(new x.default("Unable to connect (and no more fallback hosts to try)",80003,404));return}if(!B.realtime.http.checkConnectivity){_(new x.PartialErrorInfo("Internal error: Http.checkConnectivity not set",null,500));return}B.realtime.http.checkConnectivity(function(re,ce){if(D===B.connectCounter){if(re){_(re);return}if(!ce){_(new x.default("Unable to connect (network unreachable)",80003,404));return}O.host=d.arrPopRandomElement(V),B.tryATransport(O,B.baseTransport,Y)}})};if(this.forceFallbackHost&&V.length){this.forceFallbackHost=!1,ne();return}this.tryATransport(O,this.baseTransport,Y)},F.prototype.getUpgradePossibilities=function(){var O=this.activeProtocol.getTransport().shortName,D=d.arrIndexOf(this.upgradeTransports,O);return this.upgradeTransports.slice(D+1)},F.prototype.upgradeIfNeeded=function(O){var D=this,B=this.getUpgradePossibilities();f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.upgradeIfNeeded()","upgrade possibilities: "+E.default.Config.inspect(B)),B.length&&d.arrForEach(B,function(_){var V=D.createTransportParams(O.host,"upgrade");D.tryATransport(V,_,C)})},F.prototype.closeImpl=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.closeImpl()","closing connection"),this.cancelSuspendTimer(),this.startTransitionTimer(this.states.closing),d.safeArrForEach(this.pendingTransports,function(O){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Closing pending transport: "+O),O&&O.close()}),d.safeArrForEach(this.proposedTransports,function(O){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Disposing of proposed transport: "+O),O&&O.dispose()}),this.activeProtocol&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Closing active transport: "+this.activeProtocol.getTransport()),this.activeProtocol.getTransport().close()),this.notifyState({state:"closed"})},F.prototype.onAuthUpdated=function(O,D){var B=this,_;switch(this.state.state){case"connected":{if(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Sending AUTH message on active transport"),(this.pendingTransports.length||this.proposedTransports.length)&&this.state!==this.states.synchronizing){this.disconnectAllTransports(!0);var V=this.activeProtocol.getTransport().params;E.default.Config.nextTick(function(){B.state.state==="connected"&&B.upgradeIfNeeded(V)})}var Y=(_=this.activeProtocol)===null||_===void 0?void 0:_.getTransport();Y&&Y.onAuthUpdated&&Y.onAuthUpdated(O);var X=l.default.fromValues({action:v.AUTH,auth:{accessToken:O.token}});this.send(X);var ne=function(){B.off(re),D(null,O)},re=function(Z){Z.current==="failed"&&(B.off(ne),B.off(re),D(Z.reason||B.getStateError()))};this.once("connectiondetails",ne),this.on("connectionstate",re);break}case"connecting":f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Aborting current connection attempts in order to start again with the new auth details"),this.disconnectAllTransports();default:{f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Connection state is "+this.state.state+"; waiting until either connected or failed");var ce=function(Z){switch(Z.current){case"connected":B.off(ce),D(null,O);break;case"failed":case"closed":case"suspended":B.off(ce),D(Z.reason||B.getStateError());break}};this.on("connectionstate",ce),this.state.state==="connecting"?this.startConnect():this.requestState({state:"connecting"})}}},F.prototype.disconnectAllTransports=function(O){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.disconnectAllTransports()","Disconnecting all transports"+(O?" except the active transport":"")),this.connectCounter++,d.safeArrForEach(this.pendingTransports,function(D){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting pending transport: "+D),D&&D.disconnect()}),this.pendingTransports=[],d.safeArrForEach(this.proposedTransports,function(D){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disposing of proposed transport: "+D),D&&D.dispose()}),this.proposedTransports=[],this.activeProtocol&&!O&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting active transport: "+this.activeProtocol.getTransport()),this.activeProtocol.getTransport().disconnect())},F.prototype.send=function(O,D,B){B=B||C;var _=this.state;if(_.sendEvents){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","sending event"),this.sendImpl(new g.PendingMessage(O,B));return}var V=D&&_.queueEvents||_.forceQueueEvents;if(!V){var Y="rejecting event, queueEvent was "+D+", state was "+_.state;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()",Y),B(this.errorReason||new x.default(Y,9e4,400));return}f.default.shouldLog(f.default.LOG_MICRO)&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","queueing msg; "+l.default.stringify(O)),this.queue(O,B)},F.prototype.sendImpl=function(O){var D=O.message;O.ackRequired&&!O.sendAttempted&&(D.msgSerial=this.msgSerial++);try{this.activeProtocol.send(O)}catch(B){f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.sendImpl()","Unexpected exception in transport.send(): "+B.stack)}},F.prototype.queue=function(O,D){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.queue()","queueing event");var B=this.queuedMessages.last(),_=this.options.maxMessageSize;B&&!B.sendAttempted&&j(B.message,O,_)?(B.merged||(B.callback=b.default.create([B.callback]),B.merged=!0),B.callback.push(D)):this.queuedMessages.push(new g.PendingMessage(O,D))},F.prototype.sendQueuedMessages=function(){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.sendQueuedMessages()","sending "+this.queuedMessages.count()+" queued messages");for(var O;O=this.queuedMessages.shift();)this.sendImpl(O)},F.prototype.queuePendingMessages=function(O){O&&O.length&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.queuePendingMessages()","queueing "+O.length+" pending messages"),this.queuedMessages.prepend(O))},F.prototype.failQueuedMessages=function(O){var D=this.queuedMessages.count();D>0&&(f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.failQueuedMessages()","failing "+D+" queued messages, err = "+d.inspectError(O)),this.queuedMessages.completeAllMessages(O))},F.prototype.onChannelMessage=function(O,D){var B=this.activeProtocol&&D===this.activeProtocol.getTransport(),_=d.arrIn(this.pendingTransports,D)&&this.state==this.states.synchronizing;B||_?this.realtime.channels.onChannelMessage(O):d.arrIndexOf([v.ACK,v.NACK,v.ERROR],O.action)>-1?this.realtime.channels.onChannelMessage(O):f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onChannelMessage()","received message "+JSON.stringify(O)+"on defunct transport; discarding")},F.prototype.ping=function(O,D){var B=this;if(O){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.ping()","transport = "+O);var _=function(){O.off("heartbeat",X),D(new x.default("Timeout waiting for heartbeat response",5e4,500))},V=d.now(),Y=d.cheapRandStr(),X=function(ye){if(ye===Y){O.off("heartbeat",X),clearTimeout(ne);var De=d.now()-V;D(null,De)}},ne=setTimeout(_,this.options.timeouts.realtimeRequestTimeout);O.on("heartbeat",X),O.ping(Y);return}if(this.state.state!=="connected"){D(new x.default("Unable to ping service; not connected",4e4,400));return}var re=!1,ce=function(ye,De){B.off("transport.active",Z),re||(re=!0,D(ye,De))},Z=function(){re||(re=!0,E.default.Config.nextTick(function(){B.ping(null,D)}))};this.on("transport.active",Z),this.ping(this.activeProtocol.getTransport(),ce)},F.prototype.abort=function(O){this.activeProtocol.getTransport().fail(O)},F.prototype.registerProposedTransport=function(O){this.proposedTransports.push(O)},F.prototype.getTransportPreference=function(){var O,D;return this.transportPreference||s()&&((D=(O=E.default.WebStorage)===null||O===void 0?void 0:O.get)===null||D===void 0?void 0:D.call(O,L))},F.prototype.persistTransportPreference=function(O){var D,B;d.arrIn(S.default.upgradeTransports,O.shortName)&&(this.transportPreference=O.shortName,s()&&((B=(D=E.default.WebStorage)===null||D===void 0?void 0:D.set)===null||B===void 0||B.call(D,L,O.shortName)))},F.prototype.unpersistTransportPreference=function(){var O,D;this.transportPreference=null,s()&&((D=(O=E.default.WebStorage)===null||O===void 0?void 0:O.remove)===null||D===void 0||D.call(O,L))},F.prototype.actOnErrorFromAuthorize=function(O){if(O.code===40171)this.notifyState({state:"failed",error:O});else if(O.code===40102)this.notifyState({state:"failed",error:O});else if(O.statusCode===u.default.Forbidden){var D="Client configured authentication provider returned 403; failing the connection";f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.actOnErrorFromAuthorize()",D),this.notifyState({state:"failed",error:new x.default(D,80019,403,O)})}else{var D="Client configured authentication provider request failed";f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.actOnErrorFromAuthorize",D),this.notifyState({state:this.state.failState,error:new x.default(D,80019,401,O)})}},F.prototype.onConnectionDetailsUpdate=function(O,D){if(O){this.connectionDetails=O,O.maxMessageSize&&(this.options.maxMessageSize=O.maxMessageSize);var B=O.clientId;if(B){var _=this.realtime.auth._uncheckedSetClientId(B);if(_){f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.onConnectionDetailsUpdate()",_.message),D.fail(_);return}}var V=O.connectionStateTtl;V&&(this.connectionStateTtl=V),this.maxIdleInterval=O.maxIdleInterval,this.emit("connectiondetails",O)}},F.supportedTransports={},F}(y.default);r.default=$}).call(this,i(13))},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(7)),l=o.__importDefault(i(2)),d=function(g){o.__extends(S,g);function S(){var E=g.call(this)||this;return E.messages=[],E}return S.prototype.count=function(){return this.messages.length},S.prototype.push=function(E){this.messages.push(E)},S.prototype.shift=function(){return this.messages.shift()},S.prototype.last=function(){return this.messages[this.messages.length-1]},S.prototype.copyAll=function(){return this.messages.slice()},S.prototype.append=function(E){this.messages.push.apply(this.messages,E)},S.prototype.prepend=function(E){this.messages.unshift.apply(this.messages,E)},S.prototype.completeMessages=function(E,y,R){l.default.logAction(l.default.LOG_MICRO,"MessageQueue.completeMessages()","serial = "+E+"; count = "+y),R=R||null;var f=this.messages;if(f.length===0)throw new Error("MessageQueue.completeMessages(): completeMessages called on any empty MessageQueue");var k=f[0];if(k){var T=k.message.msgSerial,x=E+y;if(x>T)for(var p=f.splice(0,x-T),m=0,b=p;m<b.length;m++){var h=b[m];h.callback(R)}f.length==0&&this.emit("idle")}},S.prototype.completeAllMessages=function(E){this.completeMessages(0,Number.MAX_SAFE_INTEGER||Number.MAX_VALUE,E)},S.prototype.resetSendAttempted=function(){for(var E=0,y=this.messages;E<y.length;E++){var R=y[E];R.sendAttempted=!1}},S.prototype.clear=function(){l.default.logAction(l.default.LOG_MICRO,"MessageQueue.clear()","clearing "+this.messages.length+" messages"),this.messages=[],this.emit("idle")},S}(a.default);r.default=d},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function a(l,d,g,S){this.previous=l,this.current=d,g&&(this.retryIn=g),S&&(this.reason=S)}return a}();r.default=o},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(10)),l=o.__importDefault(i(7)),d=o.__importStar(i(1)),g=o.__importDefault(i(33)),S=o.__importDefault(i(2)),E=o.__importDefault(i(54)),y=o.__importDefault(i(9)),R=o.__importDefault(i(39)),f=o.__importStar(i(4)),k=o.__importDefault(i(16)),T=o.__importDefault(i(21)),x=a.default.Action,p=function(){};function m(c){if(c&&"params"in c&&!d.isObject(c.params))return new f.default("options.params must be an object",4e4,400);if(c&&"modes"in c){if(!d.isArray(c.modes))return new f.default("options.modes must be an array",4e4,400);for(var u=0;u<c.modes.length;u++){var s=c.modes[u];if(!s||typeof s!="string"||!d.arrIn(a.default.channelModes,String.prototype.toUpperCase.call(s)))return new f.default("Invalid channel mode: "+s,4e4,400)}}}var b=function(c){o.__extends(u,c);function u(s,w,v){var C=c.call(this,s,w,v)||this;return C.retryCount=0,C.history=function(L,N){if(S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.history()","channel = "+this.name),N===void 0)if(typeof L=="function")N=L,L=null;else{if(this.rest.options.promises)return d.promisify(this,"history",arguments);N=p}if(L&&L.untilAttach){if(this.state!=="attached"){N(new f.default("option untilAttach requires the channel to be attached",4e4,400));return}if(!this.properties.attachSerial){N(new f.default("untilAttach was specified and channel is attached, but attachSerial is not defined",4e4,400));return}delete L.untilAttach,L.from_serial=this.properties.attachSerial}g.default.prototype._history.call(this,L,N)},C.whenState=function(L,N){return l.default.prototype.whenState.call(C,L,C.state,N)},S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel()","started; name = "+w),C.realtime=s,C.presence=new E.default(C),C.connectionManager=s.connection.connectionManager,C.state="initialized",C.subscriptions=new l.default,C.syncChannelSerial=void 0,C.properties={attachSerial:void 0,channelSerial:void 0},C.setOptions(v),C.errorReason=null,C._requestedFlags=null,C._mode=null,C._attachResume=!1,C._decodingContext={channelOptions:C.channelOptions,plugins:s.options.plugins||{},baseEncodedPreviousPayload:void 0},C._lastPayload={messageId:null,protocolMessageChannelSerial:null,decodeFailureRecoveryInProgress:null},C._allChannelChanges=new l.default,C}return u.prototype.invalidStateError=function(){return new f.default("Channel operation failed as channel state is "+this.state,90001,400,this.errorReason||void 0)},u.processListenerArgs=function(s){return s=Array.prototype.slice.call(s),typeof s[0]=="function"&&s.unshift(null),s[s.length-1]==null&&s.pop(),s},u.prototype.setOptions=function(s,w){var v=this.channelOptions;if(!w&&this.rest.options.promises)return d.promisify(this,"setOptions",arguments);var C=w||function(N){N&&S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.setOptions()","Set options failed: "+N.toString())},L=m(s);if(L){C(L);return}g.default.prototype.setOptions.call(this,s),this._decodingContext&&(this._decodingContext.channelOptions=this.channelOptions),this._shouldReattachToSetOptions(s,v)?(this.attachImpl(),this._allChannelChanges.once(["attached","update","detached","failed"],function(N){switch(this.event){case"update":case"attached":C==null||C(null);return;default:C==null||C(N.reason);return}})):C()},u.prototype._shouldReattachToSetOptions=function(s,w){if(!(this.state==="attached"||this.state==="attaching"))return!1;if(s!=null&&s.params){var v=h(s.params),C=h(w.params);if(Object.keys(v).length!==Object.keys(C).length||!d.shallowEquals(C,v))return!0}return!!(s!=null&&s.modes&&(!w.modes||!d.arrEquals(s.modes,w.modes)))},u.prototype.publish=function(){for(var s=this,w=[],v=0;v<arguments.length;v++)w[v]=arguments[v];var C=w[0],L=w.length,N=w[L-1];if(typeof N!="function"){if(this.realtime.options.promises)return d.promisify(this,"publish",arguments);N=p,++L}if(!this.connectionManager.activeState()){N(this.connectionManager.getError());return}if(L==2)if(d.isObject(C))C=[y.default.fromValues(C)];else if(d.isArray(C))C=y.default.fromValuesArray(C);else throw new f.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);else C=[y.default.fromValues({name:w[0],data:w[1]})];var P=this.realtime.options.maxMessageSize;y.default.encodeArray(C,this.channelOptions,function(I){if(I){N(I);return}var M=y.default.getMessagesSize(C);if(M>P){N(new f.default("Maximum size of messages that can be published at once exceeded ( was "+M+" bytes; limit is "+P+" bytes)",40009,400));return}s.__publish(C,N)})},u.prototype.__publish=function(s,w){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.publish()","message count = "+s.length);var v=this.state;switch(v){case"failed":case"suspended":w(f.default.fromValues(this.invalidStateError()));break;default:{S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.publish()","sending message; channel state is "+v);var C=new a.default;C.action=x.MESSAGE,C.channel=this.name,C.messages=s,this.sendMessage(C,w);break}}},u.prototype.onEvent=function(s){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.onEvent()","received message");for(var w=this.subscriptions,v=0;v<s.length;v++){var C=s[v];w.emit(C.name,C)}},u.prototype.attach=function(s,w){var v;if(typeof s=="function"?(w=s,v=null):v=s,!w){if(this.realtime.options.promises)return d.promisify(this,"attach",arguments);w=function(C){C&&S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.attach()","Channel attach failed: "+C.toString())}}if(v)S.default.deprecated("The ability to pass an array of channel mode flags as the first argument of `RealtimeChannel.attach()`","To set channel mode flags, populate the `modes` property of the channel options object that you pass to `Channels.get()` or `RealtimeChannel.setOptions()`."),this._requestedFlags=v;else if(this.state==="attached"){w(null,null);return}this._attach(!1,null,w)},u.prototype._attach=function(s,w,v){v||(v=function(L){L&&S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel._attach()","Channel attach failed: "+L.toString())});var C=this.connectionManager;if(!C.activeState()){v(C.getError());return}(this.state!=="attaching"||s)&&this.requestState("attaching",w),this.once(function(L){switch(this.event){case"attached":v==null||v(null,L);break;case"detached":case"suspended":case"failed":v==null||v(L.reason||C.getError()||new f.default("Unable to attach; reason unknown; state = "+this.event,9e4,500));break;case"detaching":v==null||v(new f.default("Attach request superseded by a subsequent detach request",9e4,409));break}})},u.prototype.attachImpl=function(){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.attachImpl()","sending ATTACH message");var s=a.default.fromValues({action:x.ATTACH,channel:this.name,params:this.channelOptions.params,channelSerial:this.properties.channelSerial});this._requestedFlags?s.encodeModesToFlags(this._requestedFlags):this.channelOptions.modes&&s.encodeModesToFlags(d.allToUpperCase(this.channelOptions.modes)),this._attachResume&&s.setFlag("ATTACH_RESUME"),this._lastPayload.decodeFailureRecoveryInProgress&&(s.channelSerial=this._lastPayload.protocolMessageChannelSerial),this.sendMessage(s,p)},u.prototype.detach=function(s){if(!s){if(this.realtime.options.promises)return d.promisify(this,"detach",arguments);s=p}var w=this.connectionManager;if(!w.activeState()){s(w.getError());return}switch(this.state){case"suspended":this.notifyState("detached"),s();break;case"detached":s();break;case"failed":s(new f.default("Unable to detach; channel state = failed",90001,400));break;default:this.requestState("detaching");case"detaching":this.once(function(v){switch(this.event){case"detached":s();break;case"attached":case"suspended":case"failed":s(v.reason||w.getError()||new f.default("Unable to detach; reason unknown; state = "+this.event,9e4,500));break;case"attaching":s(new f.default("Detach request superseded by a subsequent attach request",9e4,409));break}})}},u.prototype.detachImpl=function(s){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.detach()","sending DETACH message");var w=a.default.fromValues({action:x.DETACH,channel:this.name});this.sendMessage(w,s||p)},u.prototype.subscribe=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];var v=u.processListenerArgs(s),C=v[0],L=v[1],N=v[2];if(!N&&this.realtime.options.promises)return d.promisify(this,"subscribe",[C,L]);if(this.state==="failed"){N==null||N(f.default.fromValues(this.invalidStateError()));return}return C&&typeof C=="object"&&!Array.isArray(C)?this._subscribeFilter(C,L):this.subscriptions.on(C,L),this.attach(N||p)},u.prototype._subscribeFilter=function(s,w){var v=function(C){var L,N,P,I,M,A,j={name:C.name,refTimeserial:(N=(L=C.extras)===null||L===void 0?void 0:L.ref)===null||N===void 0?void 0:N.timeserial,refType:(I=(P=C.extras)===null||P===void 0?void 0:P.ref)===null||I===void 0?void 0:I.type,isRef:!!(!((A=(M=C.extras)===null||M===void 0?void 0:M.ref)===null||A===void 0)&&A.timeserial),clientId:C.clientId};Object.entries(s).find(function(U){var z=U[0],$=U[1];return $!==void 0?j[z]!==$:!1})||w(C)};this._addFilteredSubscription(s,w,v),this.subscriptions.on(v)},u.prototype._addFilteredSubscription=function(s,w,v){var C;if(this.filteredSubscriptions||(this.filteredSubscriptions=new Map),this.filteredSubscriptions.has(w)){var L=this.filteredSubscriptions.get(w);L.set(s,((C=L==null?void 0:L.get(s))===null||C===void 0?void 0:C.concat(v))||[v])}else this.filteredSubscriptions.set(w,new Map([[s,[v]]]))},u.prototype._getAndDeleteFilteredSubscriptions=function(s,w){var v=this;if(!this.filteredSubscriptions)return[];if(!w&&s)return Array.from(this.filteredSubscriptions.entries()).map(function(P){var I,M=P[0],A=P[1],j=A.get(s);return A.delete(s),A.size===0&&((I=v.filteredSubscriptions)===null||I===void 0||I.delete(M)),j}).reduce(function(P,I){var M;return I?(M=P).concat.apply(M,I):P},[]);if(!w||!this.filteredSubscriptions.has(w))return[];var C=this.filteredSubscriptions.get(w);if(!s){var L=Array.from(C.values()).reduce(function(P,I){return P.concat.apply(P,I)},[]);return this.filteredSubscriptions.delete(w),L}var N=C.get(s);return C.delete(s),N||[]},u.prototype.unsubscribe=function(){for(var s=this,w,v=[],C=0;C<arguments.length;C++)v[C]=arguments[C];var L=u.processListenerArgs(v),N=L[0],P=L[1];if(typeof N=="object"&&!P||!((w=this.filteredSubscriptions)===null||w===void 0)&&w.has(P)){this._getAndDeleteFilteredSubscriptions(N,P).forEach(function(I){return s.subscriptions.off(I)});return}this.subscriptions.off(N,P)},u.prototype.sync=function(){switch(this.state){case"initialized":case"detaching":case"detached":throw new f.PartialErrorInfo("Unable to sync to channel; not attached",4e4)}var s=this.connectionManager;if(!s.activeState())throw s.getError();var w=a.default.fromValues({action:x.SYNC,channel:this.name});this.syncChannelSerial&&(w.channelSerial=this.syncChannelSerial),s.send(w)},u.prototype.sendMessage=function(s,w){this.connectionManager.send(s,this.realtime.options.queueMessages,w)},u.prototype.sendPresence=function(s,w){var v=a.default.fromValues({action:x.PRESENCE,channel:this.name,presence:d.isArray(s)?k.default.fromValuesArray(s):[k.default.fromValues(s)]});this.sendMessage(v,w)},u.prototype.onMessage=function(s){(s.action===x.ATTACHED||s.action===x.MESSAGE||s.action===x.PRESENCE)&&this.setChannelSerial(s.channelSerial);var w,v=!1;switch(s.action){case x.ATTACHED:{this.properties.attachSerial=s.channelSerial,this._mode=s.getMode(),this.params=s.params||{};var C=s.decodeModesFromFlags();this.modes=C&&d.allToLowerCase(C)||void 0;var L=s.hasFlag("RESUMED"),N=s.hasFlag("HAS_PRESENCE"),P=s.hasFlag("HAS_BACKLOG");if(this.state==="attached"){L||this.presence.onAttached(N);var I=new R.default(this.state,this.state,L,P,s.error);this._allChannelChanges.emit("update",I),(!L||this.channelOptions.updateOnAttached)&&this.emit("update",I)}else this.state==="detaching"?this.checkPendingState():this.notifyState("attached",s.error,L,N,P);break}case x.DETACHED:{var M=s.error?f.default.fromValues(s.error):new f.default("Channel detached",90001,404);this.state==="detaching"?this.notifyState("detached",M):this.state==="attaching"?this.notifyState("suspended",M):this.requestState("attaching",M);break}case x.SYNC:if(v=!0,w=this.syncChannelSerial=s.channelSerial,!s.presence)break;case x.PRESENCE:{for(var A=s.presence,j=s.id,U=s.connectionId,z=s.timestamp,$=this.channelOptions,W=void 0,F=0;F<A.length;F++)try{W=A[F],k.default.decode(W,$),W.connectionId||(W.connectionId=U),W.timestamp||(W.timestamp=z),W.id||(W.id=j+":"+F)}catch(Y){S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()",Y.toString())}this.presence.setPresence(A,v,w);break}case x.MESSAGE:{if(this.state!=="attached"){S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.onMessage()",'Message "'+s.id+'" skipped as this channel "'+this.name+'" state is not "attached" (state is "'+this.state+'").');return}var O=s.messages,D=O[0],B=O[O.length-1],j=s.id,U=s.connectionId,z=s.timestamp;if(D.extras&&D.extras.delta&&D.extras.delta.from!==this._lastPayload.messageId){var _='Delta message decode failure - previous message not available for message "'+s.id+'" on this channel "'+this.name+'".';S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()",_),this._startDecodeFailureRecovery(new f.default(_,40018,400));break}for(var F=0;F<O.length;F++){var _=O[F];try{y.default.decode(_,this._decodingContext)}catch(Z){switch(S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()",Z.toString()),Z.code){case 40018:this._startDecodeFailureRecovery(Z);return;case 40019:case 40021:this.notifyState("failed",Z);return}}_.connectionId||(_.connectionId=U),_.timestamp||(_.timestamp=z),_.id||(_.id=j+":"+F)}this._lastPayload.messageId=B.id,this._lastPayload.protocolMessageChannelSerial=s.channelSerial,this.onEvent(O);break}case x.ERROR:{var V=s.error;V&&V.code==80016?this.checkPendingState():this.notifyState("failed",f.default.fromValues(V));break}default:S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()","Fatal protocol error: unrecognised action ("+s.action+")"),this.connectionManager.abort(T.default.unknownChannelErr())}},u.prototype._startDecodeFailureRecovery=function(s){var w=this;this._lastPayload.decodeFailureRecoveryInProgress||(S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.onMessage()","Starting decode failure recovery process."),this._lastPayload.decodeFailureRecoveryInProgress=!0,this._attach(!0,s,function(){w._lastPayload.decodeFailureRecoveryInProgress=!1}))},u.prototype.onAttached=function(){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.onAttached","activating channel; name = "+this.name)},u.prototype.notifyState=function(s,w,v,C,L){if(S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.notifyState","name = "+this.name+", current state = "+this.state+", notifying state "+s),this.clearStateTimer(),d.arrIn(["detached","suspended","failed"],s)&&(this.properties.channelSerial=null),s!==this.state){this.presence.actOnChannelState(s,C,w),s==="suspended"&&this.connectionManager.state.sendEvents?this.startRetryTimer():this.cancelRetryTimer(),w&&(this.errorReason=w);var N=new R.default(this.state,s,v,L,w),P=s==="failed"?S.default.LOG_ERROR:S.default.LOG_MAJOR;S.default.logAction(P,'Channel state for channel "'+this.name+'"',s+(w?"; reason: "+w:"")),s!=="attaching"&&s!=="suspended"&&(this.retryCount=0),s==="attached"&&this.onAttached(),s==="attached"?this._attachResume=!0:(s==="detaching"||s==="failed")&&(this._attachResume=!1),this.state=s,this._allChannelChanges.emit(s,N),this.emit(s,N)}},u.prototype.requestState=function(s,w){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.requestState","name = "+this.name+", state = "+s),this.notifyState(s,w),this.checkPendingState()},u.prototype.checkPendingState=function(){var s=this.connectionManager.state;if(!(s.sendEvents||s.forceQueueEvents)){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.checkPendingState","sendEvents is false; state is "+this.connectionManager.state.state);return}switch(S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.checkPendingState","name = "+this.name+", state = "+this.state),this.state){case"attaching":this.startStateTimerIfNotRunning(),this.attachImpl();break;case"detaching":this.startStateTimerIfNotRunning(),this.detachImpl();break;case"attached":this.sync();break}},u.prototype.timeoutPendingState=function(){switch(this.state){case"attaching":{var s=new f.default("Channel attach timed out",90007,408);this.notifyState("suspended",s);break}case"detaching":{var s=new f.default("Channel detach timed out",90007,408);this.notifyState("attached",s);break}default:this.checkPendingState();break}},u.prototype.startStateTimerIfNotRunning=function(){var s=this;this.stateTimer||(this.stateTimer=setTimeout(function(){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.startStateTimerIfNotRunning","timer expired"),s.stateTimer=null,s.timeoutPendingState()},this.realtime.options.timeouts.realtimeRequestTimeout))},u.prototype.clearStateTimer=function(){var s=this.stateTimer;s&&(clearTimeout(s),this.stateTimer=null)},u.prototype.startRetryTimer=function(){var s=this;if(!this.retryTimer){this.retryCount++;var w=d.getRetryTime(this.realtime.options.timeouts.channelRetryTimeout,this.retryCount);this.retryTimer=setTimeout(function(){s.state==="suspended"&&s.connectionManager.state.sendEvents&&(s.retryTimer=null,S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel retry timer expired","attempting a new attach"),s.requestState("attaching"))},w)}},u.prototype.cancelRetryTimer=function(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)},u.prototype.getReleaseErr=function(){var s=this.state;return s==="initialized"||s==="detached"||s==="failed"?null:new f.default("Can only release a channel in a state where there is no possibility of further updates from the server being received (initialized, detached, or failed); was "+s,90001,400)},u.prototype.setChannelSerial=function(s){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.setChannelSerial()","Updating channel serial; serial = "+s+"; previous = "+this.properties.channelSerial),s&&(this.properties.channelSerial=s)},u}(g.default);function h(c){var u=c||{};u.agent;var s=o.__rest(u,["agent"]);return s}r.default=b},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function a(l,d,g,S,E){this.previous=l,this.current=d,d==="attached"&&(this.resumed=g,this.hasBacklog=S),E&&(this.reason=E)}return a}();r.default=o},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(){var a=o,l=a.lib,d=l.WordArray,g=l.Hasher,S=a.algo,E=[],y=S.SHA1=g.extend({_doReset:function(){this._hash=new d.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(R,f){for(var k=this._hash.words,T=k[0],x=k[1],p=k[2],m=k[3],b=k[4],h=0;h<80;h++){if(h<16)E[h]=R[f+h]|0;else{var c=E[h-3]^E[h-8]^E[h-14]^E[h-16];E[h]=c<<1|c>>>31}var u=(T<<5|T>>>27)+b+E[h];h<20?u+=(x&p|~x&m)+1518500249:h<40?u+=(x^p^m)+1859775393:h<60?u+=(x&p|x&m|p&m)-1894007588:u+=(x^p^m)-899497514,b=m,m=p,p=x<<30|x>>>2,x=T,T=u}k[0]=k[0]+T|0,k[1]=k[1]+x|0,k[2]=k[2]+p|0,k[3]=k[3]+m|0,k[4]=k[4]+b|0},_doFinalize:function(){var R=this._data,f=R.words,k=this._nDataBytes*8,T=R.sigBytes*8;return f[T>>>5]|=128<<24-T%32,f[(T+64>>>9<<4)+14]=Math.floor(k/4294967296),f[(T+64>>>9<<4)+15]=k,R.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var R=g.clone.call(this);return R._hash=this._hash.clone(),R}});a.SHA1=g._createHelper(y),a.HmacSHA1=g._createHmacHelper(y)}(),o.SHA1})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});function o(h){if(h===void 0)return"undefined";var c,u;if(h instanceof ArrayBuffer?(u="ArrayBuffer",c=new DataView(h)):h instanceof DataView&&(u="DataView",c=h),!c)return JSON.stringify(h);for(var s=[],w=0;w<h.byteLength;w++){if(w>20){s.push("...");break}var v=c.getUint8(w).toString(16);v.length===1&&(v="0"+v),s.push(v)}return"<"+u+" "+s.join(" ")+">"}function a(h,c,u){for(var s=0,w=u.length;s<w;s++){var v=u.charCodeAt(s);if(v<128){h.setUint8(c++,v>>>0&127|0);continue}if(v<2048){h.setUint8(c++,v>>>6&31|192),h.setUint8(c++,v>>>0&63|128);continue}if(v<65536){h.setUint8(c++,v>>>12&15|224),h.setUint8(c++,v>>>6&63|128),h.setUint8(c++,v>>>0&63|128);continue}if(v<1114112){h.setUint8(c++,v>>>18&7|240),h.setUint8(c++,v>>>12&63|128),h.setUint8(c++,v>>>6&63|128),h.setUint8(c++,v>>>0&63|128);continue}throw new Error("bad codepoint "+v)}}function l(h,c,u){for(var s="",w=c,v=c+u;w<v;w++){var C=h.getUint8(w);if(!(C&128)){s+=String.fromCharCode(C);continue}if((C&224)===192){s+=String.fromCharCode((C&15)<<6|h.getUint8(++w)&63);continue}if((C&240)===224){s+=String.fromCharCode((C&15)<<12|(h.getUint8(++w)&63)<<6|(h.getUint8(++w)&63)<<0);continue}if((C&248)===240){s+=String.fromCharCode((C&7)<<18|(h.getUint8(++w)&63)<<12|(h.getUint8(++w)&63)<<6|(h.getUint8(++w)&63)<<0);continue}throw new Error("Invalid byte "+C.toString(16))}return s}function d(h){for(var c=0,u=0,s=h.length;u<s;u++){var w=h.charCodeAt(u);if(w<128){c+=1;continue}if(w<2048){c+=2;continue}if(w<65536){c+=3;continue}if(w<1114112){c+=4;continue}throw new Error("bad codepoint "+w)}return c}function g(h,c){var u=b(h,c);if(u!==0){var s=new ArrayBuffer(u),w=new DataView(s);return m(h,w,0,c),s}}var S=65536*65536,E=1/S;function y(h,c){return c=c||0,h.getInt32(c)*S+h.getUint32(c+4)}function R(h,c){return c=c||0,h.getUint32(c)*S+h.getUint32(c+4)}function f(h,c,u){u<9223372036854776e3?(h.setInt32(c,Math.floor(u*E)),h.setInt32(c+4,u&-1)):(h.setUint32(c,2147483647),h.setUint32(c+4,2147483647))}function k(h,c,u){u<18446744073709552e3?(h.setUint32(c,Math.floor(u*E)),h.setInt32(c+4,u&-1)):(h.setUint32(c,4294967295),h.setUint32(c+4,4294967295))}var T=function(){function h(c,u){var s=this;this.map=function(w){for(var v={},C=0;C<w;C++){var L=s.parse();v[L]=s.parse()}return v},this.bin=function(w){var v=new ArrayBuffer(w);return new Uint8Array(v).set(new Uint8Array(s.view.buffer,s.offset,w),0),s.offset+=w,v},this.buf=this.bin,this.str=function(w){var v=l(s.view,s.offset,w);return s.offset+=w,v},this.array=function(w){for(var v=new Array(w),C=0;C<w;C++)v[C]=s.parse();return v},this.ext=function(w){return s.offset+=w,{type:s.view.getInt8(s.offset),data:s.buf(w)}},this.parse=function(){var w=s.view.getUint8(s.offset),v,C;if(!(w&128))return s.offset++,w;if((w&240)===128)return C=w&15,s.offset++,s.map(C);if((w&240)===144)return C=w&15,s.offset++,s.array(C);if((w&224)===160)return C=w&31,s.offset++,s.str(C);if((w&224)===224)return v=s.view.getInt8(s.offset),s.offset++,v;switch(w){case 192:return s.offset++,null;case 193:s.offset++;return;case 194:return s.offset++,!1;case 195:return s.offset++,!0;case 196:return C=s.view.getUint8(s.offset+1),s.offset+=2,s.bin(C);case 197:return C=s.view.getUint16(s.offset+1),s.offset+=3,s.bin(C);case 198:return C=s.view.getUint32(s.offset+1),s.offset+=5,s.bin(C);case 199:return C=s.view.getUint8(s.offset+1),s.offset+=2,s.ext(C);case 200:return C=s.view.getUint16(s.offset+1),s.offset+=3,s.ext(C);case 201:return C=s.view.getUint32(s.offset+1),s.offset+=5,s.ext(C);case 202:return v=s.view.getFloat32(s.offset+1),s.offset+=5,v;case 203:return v=s.view.getFloat64(s.offset+1),s.offset+=9,v;case 204:return v=s.view.getUint8(s.offset+1),s.offset+=2,v;case 205:return v=s.view.getUint16(s.offset+1),s.offset+=3,v;case 206:return v=s.view.getUint32(s.offset+1),s.offset+=5,v;case 207:return v=R(s.view,s.offset+1),s.offset+=9,v;case 208:return v=s.view.getInt8(s.offset+1),s.offset+=2,v;case 209:return v=s.view.getInt16(s.offset+1),s.offset+=3,v;case 210:return v=s.view.getInt32(s.offset+1),s.offset+=5,v;case 211:return v=y(s.view,s.offset+1),s.offset+=9,v;case 212:return C=1,s.offset++,s.ext(C);case 213:return C=2,s.offset++,s.ext(C);case 214:return C=4,s.offset++,s.ext(C);case 215:return C=8,s.offset++,s.ext(C);case 216:return C=16,s.offset++,s.ext(C);case 217:return C=s.view.getUint8(s.offset+1),s.offset+=2,s.str(C);case 218:return C=s.view.getUint16(s.offset+1),s.offset+=3,s.str(C);case 219:return C=s.view.getUint32(s.offset+1),s.offset+=5,s.str(C);case 220:return C=s.view.getUint16(s.offset+1),s.offset+=3,s.array(C);case 221:return C=s.view.getUint32(s.offset+1),s.offset+=5,s.array(C);case 222:return C=s.view.getUint16(s.offset+1),s.offset+=3,s.map(C);case 223:return C=s.view.getUint32(s.offset+1),s.offset+=5,s.map(C)}throw new Error("Unknown type 0x"+w.toString(16))},this.offset=u||0,this.view=c}return h}();function x(h){var c=new DataView(h),u=new T(c),s=u.parse();if(u.offset!==h.byteLength)throw new Error(h.byteLength-u.offset+" trailing bytes");return s}function p(h,c){return Object.keys(h).filter(function(u){var s=h[u],w=typeof s;return(!c||s!=null)&&(w!=="function"||!!s.toJSON)})}function m(h,c,u,s){var w=typeof h;if(typeof h=="string"){var v=d(h);if(v<32)return c.setUint8(u,v|160),a(c,u+1,h),1+v;if(v<256)return c.setUint8(u,217),c.setUint8(u+1,v),a(c,u+2,h),2+v;if(v<65536)return c.setUint8(u,218),c.setUint16(u+1,v),a(c,u+3,h),3+v;if(v<4294967296)return c.setUint8(u,219),c.setUint32(u+1,v),a(c,u+5,h),5+v}if(ArrayBuffer.isView&&ArrayBuffer.isView(h)&&(h=h.buffer),h instanceof ArrayBuffer){var C=h.byteLength;if(C<256)return c.setUint8(u,196),c.setUint8(u+1,C),new Uint8Array(c.buffer).set(new Uint8Array(h),u+2),2+C;if(C<65536)return c.setUint8(u,197),c.setUint16(u+1,C),new Uint8Array(c.buffer).set(new Uint8Array(h),u+3),3+C;if(C<4294967296)return c.setUint8(u,198),c.setUint32(u+1,C),new Uint8Array(c.buffer).set(new Uint8Array(h),u+5),5+C}if(typeof h=="number"){if(Math.floor(h)!==h)return c.setUint8(u,203),c.setFloat64(u+1,h),9;if(h>=0){if(h<128)return c.setUint8(u,h),1;if(h<256)return c.setUint8(u,204),c.setUint8(u+1,h),2;if(h<65536)return c.setUint8(u,205),c.setUint16(u+1,h),3;if(h<4294967296)return c.setUint8(u,206),c.setUint32(u+1,h),5;if(h<18446744073709552e3)return c.setUint8(u,207),k(c,u+1,h),9;throw new Error("Number too big 0x"+h.toString(16))}if(h>=-32)return c.setInt8(u,h),1;if(h>=-128)return c.setUint8(u,208),c.setInt8(u+1,h),2;if(h>=-32768)return c.setUint8(u,209),c.setInt16(u+1,h),3;if(h>=-2147483648)return c.setUint8(u,210),c.setInt32(u+1,h),5;if(h>=-9223372036854776e3)return c.setUint8(u,211),f(c,u+1,h),9;throw new Error("Number too small -0x"+(-h).toString(16).substr(1))}if(w==="undefined")return s?0:(c.setUint8(u,212),c.setUint8(u+1,0),c.setUint8(u+2,0),3);if(h===null)return s?0:(c.setUint8(u,192),1);if(w==="boolean")return c.setUint8(u,h?195:194),1;if(typeof h.toJSON=="function")return m(h.toJSON(),c,u,s);if(w==="object"){var L,N=0,P=void 0,I=Array.isArray(h);if(I?L=h.length:(P=p(h,s),L=P.length),L<16?(c.setUint8(u,L|(I?144:128)),N=1):L<65536?(c.setUint8(u,I?220:222),c.setUint16(u+1,L),N=3):L<4294967296&&(c.setUint8(u,I?221:223),c.setUint32(u+1,L),N=5),I)for(var M=0;M<L;M++)N+=m(h[M],c,u+N,s);else if(P)for(var M=0;M<L;M++){var A=P[M];N+=m(A,c,u+N),N+=m(h[A],c,u+N,s)}return N}if(w==="function")return 0;throw new Error("Unknown type "+w)}function b(h,c){var u=typeof h;if(u==="string"){var s=d(h);if(s<32)return 1+s;if(s<256)return 2+s;if(s<65536)return 3+s;if(s<4294967296)return 5+s}if(ArrayBuffer.isView&&ArrayBuffer.isView(h)&&(h=h.buffer),h instanceof ArrayBuffer){var w=h.byteLength;if(w<256)return 2+w;if(w<65536)return 3+w;if(w<4294967296)return 5+w}if(typeof h=="number"){if(Math.floor(h)!==h)return 9;if(h>=0){if(h<128)return 1;if(h<256)return 2;if(h<65536)return 3;if(h<4294967296)return 5;if(h<18446744073709552e3)return 9;throw new Error("Number too big 0x"+h.toString(16))}if(h>=-32)return 1;if(h>=-128)return 2;if(h>=-32768)return 3;if(h>=-2147483648)return 5;if(h>=-9223372036854776e3)return 9;throw new Error("Number too small -0x"+h.toString(16).substr(1))}if(u==="boolean")return 1;if(h===null)return c?0:1;if(h===void 0)return c?0:3;if(typeof h.toJSON=="function")return b(h.toJSON(),c);if(u==="object"){var v,C=0;if(Array.isArray(h)){v=h.length;for(var L=0;L<v;L++)C+=b(h[L],c)}else{var N=p(h,c);v=N.length;for(var L=0;L<v;L++){var P=N[L];C+=b(P)+b(h[P],c)}}if(v<16)return 1+C;if(v<65536)return 3+C;if(v<4294967296)return 5+C;throw new Error("Array or object too long 0x"+v.toString(16))}if(u==="function")return 0;throw new Error("Unknown type "+u)}r.default={encode:g,decode:x,inspect:o,utf8Write:a,utf8Read:l,utf8ByteCount:d}},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(30)),l=o.__importDefault(i(50)),d=o.__importDefault(i(3)),g=o.__importDefault(i(4)),S=o.__importDefault(i(55)),E=o.__importDefault(i(57)),y=o.__importDefault(i(62)),R=o.__importDefault(i(64)),f=o.__importDefault(i(68)),k=o.__importDefault(i(2)),T=i(8),x=o.__importDefault(i(65)),p=o.__importDefault(i(66)),m=o.__importDefault(i(41)),b=(0,E.default)(R.default,S.default);d.default.Crypto=b,d.default.BufferUtils=S.default,d.default.Http=y.default,d.default.Config=R.default,d.default.Transports=f.default,d.default.WebStorage=x.default,a.default.Crypto=b,l.default.Crypto=b,k.default.initLogHandlers(),d.default.Defaults=(0,T.getDefaults)(p.default),d.default.Config.agent&&(d.default.Defaults.agent+=" "+d.default.Config.agent),d.default.Config.noUpgrade&&(d.default.Defaults.upgradeTransports=[]),r.default={ErrorInfo:g.default,Rest:a.default,Realtime:l.default,msgpack:m.default}},function(n){n.exports=JSON.parse('{"name":"ably","description":"Realtime client library for Ably, the realtime messaging service","version":"1.2.50","license":"Apache-2.0","bugs":{"url":"https://github.com/ably/ably-js/issues","email":"support@ably.com"},"main":"./build/ably-node.js","typings":"./ably.d.ts","react-native":{"./build/ably-node.js":"./build/ably-reactnative.js"},"browser":{"./build/ably-node.js":"./build/ably-commonjs.js"},"files":["build/**","ably.d.ts","callbacks.d.ts","callbacks.js","promises.d.ts","promises.js","resources/**","src/**","react/**"],"dependencies":{"@ably/msgpack-js":"^0.4.0","got":"^11.8.5","ws":"^8.14.2"},"peerDependencies":{"react":">=16.8.0","react-dom":">=16.8.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}},"devDependencies":{"@ably/vcdiff-decoder":"1.0.4","@arethetypeswrong/cli":"^0.13.1","@babel/preset-env":"^7.23.6","@testing-library/react":"^13.3.0","@types/crypto-js":"^4.0.1","@types/jmespath":"^0.15.2","@types/node":"^15.0.0","@types/request":"^2.48.7","@types/ws":"^8.2.0","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","@vitejs/plugin-react":"^1.3.2","async":"ably-forks/async#requirejs","aws-sdk":"^2.1413.0","babel-loader":"^8.3.0","chai":"^4.2.0","copy-webpack-plugin":"^6.4.1","cors":"^2.8.5","crypto-js":"ably-forks/crypto-js#crypto-lite","eslint":"^7.13.0","eslint-plugin-import":"^2.28.0","eslint-plugin-jsdoc":"^40.0.0","eslint-plugin-react":"^7.32.2","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-security":"^1.4.0","express":"^4.17.1","glob":"~4.4","google-closure-compiler":"^20180610.0.1","grunt":"^1.6.1","grunt-bump":"^0.3.1","grunt-cli":"~1.2.0","grunt-closure-tools":"^1.0.0","grunt-contrib-concat":"~0.5","grunt-shell":"~1.1","grunt-webpack":"^4.0.2","hexy":"~0.2","jmespath":"^0.16.0","jsdom":"^20.0.0","kexec":"ably-forks/node-kexec#update-for-node-12","minimist":"^1.2.5","mocha":"^8.1.3","mocha-junit-reporter":"^2.2.1","null-loader":"^4.0.1","playwright":"^1.39.0","prettier":"^2.5.1","react":">=18.1.0","react-dom":">=18.1.0","requirejs":"~2.1","shelljs":"~0.8","source-map-explorer":"^2.5.2","ts-loader":"^8.2.0","tsconfig-paths-webpack-plugin":"^4.0.1","tslib":"^2.3.1","typedoc":"^0.23.8","typescript":"^4.6.4","vite":"^4.4.9","vitest":"^0.18.0","webpack":"^4.44.2","webpack-cli":"^4.2.0","webpack-node-externals":"^3.0.0"},"engines":{"node":">=5.10.x"},"repository":"ably/ably-js","jspm":{"registry":"npm","directories":{"lib":"build"},"main":"ably"},"scripts":{"start:react":"npx vite serve","grunt":"grunt","test":"grunt test","test:node":"grunt test:node","test:node:skip-build":"grunt mocha","test:webserver":"grunt test:webserver","test:playwright":"node test/support/runPlaywrightTests.js","test:react":"vitest run","concat":"grunt concat","build":"grunt build:all && npm run build:react","build:node":"grunt build:node","build:browser":"grunt build:browser","build:react":"npm run build:react:mjs && npm run build:react:cjs && cp src/platform/react-hooks/res/package.react.json react/package.json","build:react:mjs":"tsc --project src/platform/react-hooks/tsconfig.mjs.json && cp src/platform/react-hooks/res/package.mjs.json react/mjs/package.json","build:react:cjs":"tsc --project src/platform/react-hooks/tsconfig.cjs.json && cp src/platform/react-hooks/res/package.cjs.json react/cjs/package.json","requirejs":"grunt requirejs","lint":"eslint .","lint:fix":"eslint --fix .","check-closure-compiler":"grunt check-closure-compiler","prepare":"npm run build","format":"prettier --write --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/cdn_deploy.js docs/chrome-mv3.md","format:check":"prettier --check --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/cdn_deploy.js","sourcemap":"source-map-explorer build/ably.min.js","sourcemap:noencryption":"source-map-explorer build/ably.noencryption.min.js","docs":"typedoc --entryPoints ably.d.ts --out docs/generated/default --readme docs/landing-pages/default.md && typedoc --entryPoints promises.d.ts --out docs/generated/promises --name \\"ably (Promise-based)\\" --readme docs/landing-pages/promises.md && cp docs/landing-pages/choose-library.html docs/generated/index.html"}}')},function(n,r){},function(n,r,i){(function(o,a){n.exports=a(i(6),i(32),i(25))})(this,function(o){return o.HmacSHA256})},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(47)),d=o.__importDefault(i(15)),g=o.__importDefault(i(20)),S=o.__importDefault(i(4)),E=o.__importDefault(i(48)),y=function(){},R=function(){function x(p){this.rest=p,this.admin=new f(p)}return x}(),f=function(){function x(p){this.rest=p,this.deviceRegistrations=new k(p),this.channelSubscriptions=new T(p)}return x.prototype.publish=function(p,m,b){var h=this.rest,c=h.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(h.options,c),s={},w=a.mixin({recipient:p},m);if(typeof b!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);b=y}h.options.headers&&a.mixin(u,h.options.headers),h.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var v=a.encodeBody(w,c);d.default.post(h,"/push/publish",v,u,s,null,function(C){return b(C)})},x}(),k=function(){function x(p){this.rest=p}return x.prototype.save=function(p,m){var b=this.rest,h=l.default.fromValues(p),c=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(b.options,c),s={};if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);m=y}b.options.headers&&a.mixin(u,b.options.headers),b.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var w=a.encodeBody(h,c);d.default.put(b,"/push/deviceRegistrations/"+encodeURIComponent(p.id),w,u,s,null,function(v,C,L,N){m(v,v?void 0:l.default.fromResponseBody(C,N?void 0:c))})},x.prototype.get=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(b.options,h),u=p.id||p;if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"get",arguments);m=y}if(typeof u!="string"||!u.length){m(new S.default("First argument to DeviceRegistrations#get must be a deviceId string or DeviceDetails",4e4,400));return}b.options.headers&&a.mixin(c,b.options.headers),d.default.get(b,"/push/deviceRegistrations/"+encodeURIComponent(u),c,{},null,function(s,w,v,C){m(s,s?void 0:l.default.fromResponseBody(w,C?void 0:h))})},x.prototype.list=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:h,u=a.defaultGetHeaders(b.options,h);if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);m=y}b.options.headers&&a.mixin(u,b.options.headers),new g.default(b,"/push/deviceRegistrations",u,c,function(s,w,v){return l.default.fromResponseBody(s,v?void 0:h)}).get(p,m)},x.prototype.remove=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(b.options,h),u={},s=p.id||p;if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"remove",arguments);m=y}if(typeof s!="string"||!s.length){m(new S.default("First argument to DeviceRegistrations#remove must be a deviceId string or DeviceDetails",4e4,400));return}b.options.headers&&a.mixin(c,b.options.headers),b.options.pushFullWait&&a.mixin(u,{fullWait:"true"}),d.default.delete(b,"/push/deviceRegistrations/"+encodeURIComponent(s),c,u,null,function(w){return m(w)})},x.prototype.removeWhere=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(b.options,h);if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);m=y}b.options.headers&&a.mixin(c,b.options.headers),b.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),d.default.delete(b,"/push/deviceRegistrations",c,p,null,function(u){return m(u)})},x}(),T=function(){function x(p){this.remove=x.prototype.removeWhere,this.rest=p}return x.prototype.save=function(p,m){var b=this.rest,h=E.default.fromValues(p),c=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(b.options,c),s={};if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);m=y}b.options.headers&&a.mixin(u,b.options.headers),b.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var w=a.encodeBody(h,c);d.default.post(b,"/push/channelSubscriptions",w,u,s,null,function(v,C,L,N){m(v,!v&&E.default.fromResponseBody(C,N?void 0:c))})},x.prototype.list=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:h,u=a.defaultGetHeaders(b.options,h);if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);m=y}b.options.headers&&a.mixin(u,b.options.headers),new g.default(b,"/push/channelSubscriptions",u,c,function(s,w,v){return E.default.fromResponseBody(s,v?void 0:h)}).get(p,m)},x.prototype.removeWhere=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(b.options,h);if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);m=y}b.options.headers&&a.mixin(c,b.options.headers),b.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),d.default.delete(b,"/push/channelSubscriptions",c,p,null,function(u){return m(u)})},x.prototype.listChannels=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:h,u=a.defaultGetHeaders(b.options,h);if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"listChannels",arguments);m=y}b.options.headers&&a.mixin(u,b.options.headers),b.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),new g.default(b,"/push/channels",u,c,function(s,w,v){for(var C=!v&&h?a.decodeBody(s,h):s,L=0;L<C.length;L++)C[L]=String(C[L]);return C}).get(p,m)},x}();r.default=R},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(4)),d;(function(E){E.Phone="phone",E.Tablet="tablet",E.Desktop="desktop",E.TV="tv",E.Watch="watch",E.Car="car",E.Embedded="embedded",E.Other="other"})(d||(d={}));var g;(function(E){E.Android="android",E.IOS="ios",E.Browser="browser"})(g||(g={}));var S=function(){function E(){}return E.prototype.toJSON=function(){var y,R,f;return{id:this.id,deviceSecret:this.deviceSecret,platform:this.platform,formFactor:this.formFactor,clientId:this.clientId,metadata:this.metadata,deviceIdentityToken:this.deviceIdentityToken,push:{recipient:(y=this.push)===null||y===void 0?void 0:y.recipient,state:(R=this.push)===null||R===void 0?void 0:R.state,error:(f=this.push)===null||f===void 0?void 0:f.error}}},E.prototype.toString=function(){var y,R,f,k,T="[DeviceDetails";return this.id&&(T+="; id="+this.id),this.platform&&(T+="; platform="+this.platform),this.formFactor&&(T+="; formFactor="+this.formFactor),this.clientId&&(T+="; clientId="+this.clientId),this.metadata&&(T+="; metadata="+this.metadata),this.deviceIdentityToken&&(T+="; deviceIdentityToken="+JSON.stringify(this.deviceIdentityToken)),!((y=this.push)===null||y===void 0)&&y.recipient&&(T+="; push.recipient="+JSON.stringify(this.push.recipient)),!((R=this.push)===null||R===void 0)&&R.state&&(T+="; push.state="+this.push.state),!((f=this.push)===null||f===void 0)&&f.error&&(T+="; push.error="+JSON.stringify(this.push.error)),!((k=this.push)===null||k===void 0)&&k.metadata&&(T+="; push.metadata="+this.push.metadata),T+="]",T},E.fromResponseBody=function(y,R){return R&&(y=a.decodeBody(y,R)),a.isArray(y)?E.fromValuesArray(y):E.fromValues(y)},E.fromValues=function(y){return y.error=y.error&&l.default.fromValues(y.error),Object.assign(new E,y)},E.fromValuesArray=function(y){for(var R=y.length,f=new Array(R),k=0;k<R;k++)f[k]=E.fromValues(y[k]);return f},E.toRequestBody=a.encodeBody,E}();r.default=S},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=function(){function d(){}return d.prototype.toJSON=function(){return{channel:this.channel,deviceId:this.deviceId,clientId:this.clientId}},d.prototype.toString=function(){var g="[PushChannelSubscription";return this.channel&&(g+="; channel="+this.channel),this.deviceId&&(g+="; deviceId="+this.deviceId),this.clientId&&(g+="; clientId="+this.clientId),g+="]",g},d.fromResponseBody=function(g,S){return S&&(g=a.decodeBody(g,S)),a.isArray(g)?d.fromValuesArray(g):d.fromValues(g)},d.fromValues=function(g){return Object.assign(new d,g)},d.fromValuesArray=function(g){for(var S=g.length,E=new Array(S),y=0;y<S;y++)E[y]=d.fromValues(g[y]);return E},d.toRequestBody=a.encodeBody,d}();r.default=l},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=function(){function b(h){this.count=h&&h.count||0,this.data=h&&h.data||0,this.uncompressedData=h&&h.uncompressedData||0,this.failed=h&&h.failed||0,this.refused=h&&h.refused||0}return b}(),d=function(b){o.__extends(h,b);function h(c){var u=b.call(this,c)||this;return c&&c.category&&(u.category={},a.forInOwnNonNullProperties(c.category,function(s){u.category[s]=new l(c.category[s])})),u}return h}(l),g=function(){function b(h){this.peak=h&&h.peak||0,this.min=h&&h.min||0,this.mean=h&&h.mean||0,this.opened=h&&h.opened||0,this.refused=h&&h.refused||0}return b}(),S=function(){function b(h){this.succeeded=h&&h.succeeded||0,this.failed=h&&h.failed||0,this.refused=h&&h.refused||0}return b}(),E=function(){function b(h){this.plain=new g(h&&h.plain),this.tls=new g(h&&h.tls),this.all=new g(h&&h.all)}return b}(),y=function(){function b(h){this.messages=new d(h&&h.messages),this.presence=new d(h&&h.presence),this.all=new d(h&&h.all)}return b}(),R=function(){function b(h){this.realtime=new y(h&&h.realtime),this.rest=new y(h&&h.rest),this.webhook=new y(h&&h.webhook),this.sharedQueue=new y(h&&h.sharedQueue),this.externalQueue=new y(h&&h.externalQueue),this.httpEvent=new y(h&&h.httpEvent),this.push=new y(h&&h.push),this.all=new y(h&&h.all)}return b}(),f=function(){function b(h){this.all=new y(h&&h.all),this.inbound=new R(h&&h.inbound),this.outbound=new R(h&&h.outbound)}return b}(),k=function(){function b(h){this.all=new y(h&&h.all),this.producerPaid=new f(h&&h.producerPaid),this.consumerPaid=new f(h&&h.consumerPaid)}return b}(),T=function(){function b(h){this.messages=h&&h.messages||0;var c=h&&h.notifications;this.notifications={invalid:c&&c.invalid||0,attempted:c&&c.attempted||0,successful:c&&c.successful||0,failed:c&&c.failed||0},this.directPublishes=h&&h.directPublishes||0}return b}(),x=function(){function b(h){this.succeeded=h&&h.succeeded||0,this.skipped=h&&h.skipped||0,this.failed=h&&h.failed||0}return b}(),p=function(){function b(h){var c=this;this.delta=void 0,h&&h.delta&&(this.delta={},a.forInOwnNonNullProperties(h.delta,function(u){c.delta[u]=new x(h.delta[u])}))}return b}(),m=function(b){o.__extends(h,b);function h(c){var u=b.call(this,c)||this;return u.persisted=new y(c&&c.persisted),u.connections=new E(c&&c.connections),u.channels=new g(c&&c.channels),u.apiRequests=new S(c&&c.apiRequests),u.tokenRequests=new S(c&&c.tokenRequests),u.xchgProducer=new k(c&&c.xchgProducer),u.xchgConsumer=new k(c&&c.xchgConsumer),u.push=new T(c&&c.pushStats),u.processed=new p(c&&c.processed),u.inProgress=c&&c.inProgress||void 0,u.unit=c&&c.unit||void 0,u.intervalId=c&&c.intervalId||void 0,u}return h.fromValues=function(c){return new h(c)},h}(f);r.default=m},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(30)),d=o.__importDefault(i(7)),g=o.__importDefault(i(2)),S=o.__importDefault(i(51)),E=o.__importDefault(i(38)),y=o.__importDefault(i(8)),R=o.__importDefault(i(4)),f=o.__importDefault(i(10)),k=o.__importDefault(i(35)),T=o.__importDefault(i(3)),x=o.__importDefault(i(9)),p=function(b){o.__extends(h,b);function h(c){var u=b.call(this,c)||this;return g.default.logAction(g.default.LOG_MINOR,"Realtime()",""),u.connection=new S.default(u,u.options),u.channels=new m(u),c.autoConnect!==!1&&u.connect(),u}return h.prototype.connect=function(){g.default.logAction(g.default.LOG_MINOR,"Realtime.connect()",""),this.connection.connect()},h.prototype.close=function(){g.default.logAction(g.default.LOG_MINOR,"Realtime.close()",""),this.connection.close()},h.Promise=function(c){return c=y.default.objectifyOptions(c),c.promises=!0,new h(c)},h.Callbacks=h,h.Utils=a,h.ConnectionManager=k.default,h.Platform=T.default,h.ProtocolMessage=f.default,h.Message=x.default,h}(l.default),m=function(b){o.__extends(h,b);function h(c){var u=b.call(this)||this;return u.realtime=c,u.all=Object.create(null),c.connection.connectionManager.on("transport.active",function(){u.onTransportActive()}),u}return h.prototype.channelSerials=function(){for(var c={},u=0,s=a.keysArray(this.all,!0);u<s.length;u++){var w=s[u],v=this.all[w];v.properties.channelSerial&&(c[w]=v.properties.channelSerial)}return c},h.prototype.recoverChannels=function(c){for(var u=0,s=a.keysArray(c,!0);u<s.length;u++){var w=s[u],v=this.get(w);v.properties.channelSerial=c[w]}},h.prototype.onChannelMessage=function(c){var u=c.channel;if(u===void 0){g.default.logAction(g.default.LOG_ERROR,"Channels.onChannelMessage()","received event unspecified channel, action = "+c.action);return}var s=this.all[u];if(!s){g.default.logAction(g.default.LOG_ERROR,"Channels.onChannelMessage()","received event for non-existent channel: "+u);return}s.onMessage(c)},h.prototype.onTransportActive=function(){for(var c in this.all){var u=this.all[c];u.state==="attaching"||u.state==="detaching"?u.checkPendingState():u.state==="suspended"?u._attach(!1,null):u.state==="attached"&&u.requestState("attaching")}},h.prototype.propogateConnectionInterruption=function(c,u){var s={closing:"detached",closed:"detached",failed:"failed",suspended:"suspended"},w=["attaching","attached","detaching","suspended"],v=s[c];for(var C in this.all){var L=this.all[C];a.arrIn(w,L.state)&&L.notifyState(v,u)}},h.prototype.get=function(c,u){c=String(c);var s=this.all[c];if(!s)s=this.all[c]=new E.default(this.realtime,c,u);else if(u){if(s._shouldReattachToSetOptions(u,s.channelOptions))throw new R.default("Channels.get() cannot be used to set channel options that would cause the channel to reattach. Please, use RealtimeChannel.setOptions() instead.",4e4,400);s.setOptions(u)}return s},h.prototype.getDerived=function(c,u,s){if(u.filter){var w=a.toBase64(u.filter),v=a.matchDerivedChannel(c);c="[filter=".concat(w).concat(v.qualifierParam,"]").concat(v.channelName)}return this.get(c,s)},h.prototype.release=function(c){c=String(c);var u=this.all[c];if(u){var s=u.getReleaseErr();if(s)throw s;delete this.all[c]}},h}(d.default);r.default=p},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(7)),d=o.__importDefault(i(35)),g=o.__importDefault(i(2)),S=o.__importDefault(i(37)),E=o.__importDefault(i(3));function y(){}var R=function(f){o.__extends(k,f);function k(T,x){var p=f.call(this)||this;return p.whenState=function(m,b){return l.default.prototype.whenState.call(p,m,p.state,b,new S.default(void 0,m))},p.ably=T,p.connectionManager=new d.default(T,x),p.state=p.connectionManager.state.state,p.key=void 0,p.id=void 0,p.errorReason=null,p.connectionManager.on("connectionstate",function(m){var b=p.state=m.current;E.default.Config.nextTick(function(){p.emit(b,m)})}),p.connectionManager.on("update",function(m){E.default.Config.nextTick(function(){p.emit("update",m)})}),p}return k.prototype.connect=function(){g.default.logAction(g.default.LOG_MINOR,"Connection.connect()",""),this.connectionManager.requestState({state:"connecting"})},k.prototype.ping=function(T){if(g.default.logAction(g.default.LOG_MINOR,"Connection.ping()",""),!T){if(this.ably.options.promises)return a.promisify(this,"ping",arguments);T=y}this.connectionManager.ping(null,T)},k.prototype.close=function(){g.default.logAction(g.default.LOG_MINOR,"Connection.close()","connectionKey = "+this.key),this.connectionManager.requestState({state:"closing"})},Object.defineProperty(k.prototype,"recoveryKey",{get:function(){return this.createRecoveryKey()},enumerable:!1,configurable:!0}),k.prototype.createRecoveryKey=function(){return this.connectionManager.createRecoveryKey()},k}(l.default);r.default=R},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.PendingMessage=void 0;var o=i(0),a=o.__importDefault(i(10)),l=o.__importStar(i(1)),d=o.__importDefault(i(7)),g=o.__importDefault(i(2)),S=o.__importDefault(i(36)),E=o.__importDefault(i(4)),y=a.default.Action,R=function(){function k(T,x){this.message=T,this.callback=x,this.merged=!1;var p=T.action;this.sendAttempted=!1,this.ackRequired=p==y.MESSAGE||p==y.PRESENCE}return k}();r.PendingMessage=R;var f=function(k){o.__extends(T,k);function T(x){var p=k.call(this)||this;return p.transport=x,p.messageQueue=new S.default,x.on("ack",function(m,b){p.onAck(m,b)}),x.on("nack",function(m,b,h){p.onNack(m,b,h)}),p}return T.prototype.onAck=function(x,p){g.default.logAction(g.default.LOG_MICRO,"Protocol.onAck()","serial = "+x+"; count = "+p),this.messageQueue.completeMessages(x,p)},T.prototype.onNack=function(x,p,m){g.default.logAction(g.default.LOG_ERROR,"Protocol.onNack()","serial = "+x+"; count = "+p+"; err = "+l.inspectError(m)),m||(m=new E.default("Unable to send message; channel not responding",50001,500)),this.messageQueue.completeMessages(x,p,m)},T.prototype.onceIdle=function(x){var p=this.messageQueue;if(p.count()===0){x();return}p.once("idle",x)},T.prototype.send=function(x){x.ackRequired&&this.messageQueue.push(x),g.default.shouldLog(g.default.LOG_MICRO)&&g.default.logAction(g.default.LOG_MICRO,"Protocol.send()","sending msg; "+a.default.stringify(x.message)),x.sendAttempted=!0,this.transport.send(x.message)},T.prototype.getTransport=function(){return this.transport},T.prototype.getPendingMessages=function(){return this.messageQueue.copyAll()},T.prototype.clearPendingMessages=function(){return this.messageQueue.clear()},T.prototype.finish=function(){var x=this.transport;this.onceIdle(function(){x.disconnect()})},T}(d.default);r.default=f},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(3)),l=o.__importStar(i(1)),d=o.__importDefault(i(26)),g=o.__importDefault(i(8)),S=o.__importDefault(i(2)),E=o.__importDefault(i(10)),y=o.__importDefault(i(4)),R="web_socket";function f(x){return!!x.on}var k=function(x){o.__extends(p,x);function p(m,b,h){var c=x.call(this,m,b,h)||this;return c.shortName=R,h.heartbeats=a.default.Config.useProtocolHeartbeats,c.wsHost=g.default.getHost(h.options,h.host,!0),c}return p.isAvailable=function(){return!!a.default.Config.WebSocket},p.prototype.createWebSocket=function(m,b){return this.uri=m+l.toQueryString(b),new a.default.Config.WebSocket(this.uri)},p.prototype.toString=function(){return"WebSocketTransport; uri="+this.uri},p.prototype.connect=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","starting"),d.default.prototype.connect.call(this);var m=this,b=this.params,h=b.options,c=h.tls?"wss://":"ws://",u=c+this.wsHost+":"+g.default.getPort(h)+"/";S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","uri: "+u),this.auth.getAuthParams(function(s,w){if(!m.isDisposed){var v="";for(var C in w)v+=" "+C+": "+w[C]+";";if(S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","authParams:"+v+" err: "+s),s){m.disconnect(s);return}var L=b.getConnectParams(w);try{var N=m.wsConnection=m.createWebSocket(u,L);N.binaryType=a.default.Config.binaryType,N.onopen=function(){m.onWsOpen()},N.onclose=function(P){m.onWsClose(P)},N.onmessage=function(P){m.onWsData(P.data)},N.onerror=function(P){m.onWsError(P)},f(N)&&N.on("ping",function(){m.onActivity()})}catch(P){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.connect()","Unexpected exception creating websocket: err = "+(P.stack||P.message)),m.disconnect(P)}}})},p.prototype.send=function(m){var b=this.wsConnection;if(!b){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.send()","No socket connection");return}try{b.send(E.default.serialize(m,this.params.format))}catch(c){var h="Exception from ws connection when trying to send: "+l.inspectError(c);S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.send()",h),this.finish("disconnected",new y.default(h,5e4,500))}},p.prototype.onWsData=function(m){S.default.logAction(S.default.LOG_MICRO,"WebSocketTransport.onWsData()","data received; length = "+m.length+"; type = "+typeof m);try{this.onProtocolMessage(E.default.deserialize(m,this.format))}catch(b){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.onWsData()","Unexpected exception handing channel message: "+b.stack)}},p.prototype.onWsOpen=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsOpen()","opened WebSocket"),this.emit("preconnect")},p.prototype.onWsClose=function(m){var b,h;if(typeof m=="object"?(h=m.code,b=m.wasClean||h===1e3):(h=m,b=h==1e3),delete this.wsConnection,b){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsClose()","Cleanly closed WebSocket");var c=new y.default("Websocket closed",80003,400);this.finish("disconnected",c)}else{var u="Unclean disconnection of WebSocket ; code = "+h,c=new y.default(u,80003,400);S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsClose()",u),this.finish("disconnected",c)}this.emit("disposed")},p.prototype.onWsError=function(m){var b=this;S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onError()","Error from WebSocket: "+m.message),a.default.Config.nextTick(function(){b.disconnect(Error(m.message))})},p.prototype.dispose=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.dispose()",""),this.isDisposed=!0;var m=this.wsConnection;m&&(m.onmessage=function(){},delete this.wsConnection,a.default.Config.nextTick(function(){if(S.default.logAction(S.default.LOG_MICRO,"WebSocketTransport.dispose()","closing websocket"),!m)throw new Error("WebSocketTransport.dispose(): wsConnection is not defined");m.close()}))},p}(d.default);function T(x){return k.isAvailable()&&(x.supportedTransports[R]=k),k}r.default=T},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(1)),l=o.__importDefault(i(34)),d=o.__importDefault(i(7)),g=o.__importDefault(i(2)),S=o.__importDefault(i(16)),E=o.__importStar(i(4)),y=o.__importDefault(i(38)),R=o.__importDefault(i(24)),f=o.__importDefault(i(39)),k=function(){};function T(c){return c.channel.realtime.auth.clientId}function x(c){var u=c.channel.realtime,s=u.auth.clientId;return(!s||s==="*")&&u.connection.state==="connected"}function p(c,u,s){switch(c.state){case"attached":case"suspended":s();break;case"initialized":case"detached":case"detaching":case"attaching":c.attach(function(w){w?u(w):s()});break;default:u(E.default.fromValues(c.invalidStateError()))}}function m(c,u){if(c.isSynthesized()||u.isSynthesized())return c.timestamp>=u.timestamp;var s=c.parseId(),w=u.parseId();return s.msgSerial===w.msgSerial?s.index>w.index:s.msgSerial>w.msgSerial}var b=function(c){o.__extends(u,c);function u(s){var w=c.call(this,s)||this;return w.channel=s,w.syncComplete=!1,w.members=new h(w,function(v){return v.clientId+":"+v.connectionId}),w._myMembers=new h(w,function(v){return v.clientId}),w.subscriptions=new d.default,w.pendingPresence=[],w}return u.prototype.enter=function(s,w){if(x(this))throw new E.default("clientId must be specified to enter a presence channel",40012,400);return this._enterOrUpdateClient(void 0,void 0,s,"enter",w)},u.prototype.update=function(s,w){if(x(this))throw new E.default("clientId must be specified to update presence data",40012,400);return this._enterOrUpdateClient(void 0,void 0,s,"update",w)},u.prototype.enterClient=function(s,w,v){return this._enterOrUpdateClient(void 0,s,w,"enter",v)},u.prototype.updateClient=function(s,w,v){return this._enterOrUpdateClient(void 0,s,w,"update",v)},u.prototype._enterOrUpdateClient=function(s,w,v,C,L){var N=this;if(!L)if(typeof v=="function")L=v,v=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"_enterOrUpdateClient",[s,w,v,C]);L=k}var P=this.channel;if(!P.connectionManager.activeState()){L(P.connectionManager.getError());return}g.default.logAction(g.default.LOG_MICRO,"RealtimePresence."+C+"Client()","channel = "+P.name+", id = "+s+", client = "+(w||"(implicit) "+T(this)));var I=S.default.fromData(v);I.action=C,s&&(I.id=s),w&&(I.clientId=w),S.default.encode(I,P.channelOptions,function(M){if(M){L(M);return}switch(P.state){case"attached":P.sendPresence(I,L);break;case"initialized":case"detached":P.attach();case"attaching":N.pendingPresence.push({presence:I,callback:L});break;default:M=new E.PartialErrorInfo("Unable to "+C+" presence channel while in "+P.state+" state",90001),M.code=90001,L(M)}})},u.prototype.leave=function(s,w){if(x(this))throw new E.default("clientId must have been specified to enter or leave a presence channel",40012,400);return this.leaveClient(void 0,s,w)},u.prototype.leaveClient=function(s,w,v){if(!v)if(typeof w=="function")v=w,w=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"leaveClient",[s,w]);v=k}var C=this.channel;if(!C.connectionManager.activeState()){v==null||v(C.connectionManager.getError());return}g.default.logAction(g.default.LOG_MICRO,"RealtimePresence.leaveClient()","leaving; channel = "+this.channel.name+", client = "+s);var L=S.default.fromData(w);switch(L.action="leave",s&&(L.clientId=s),C.state){case"attached":C.sendPresence(L,v);break;case"attaching":this.pendingPresence.push({presence:L,callback:v});break;case"initialized":case"failed":{var N=new E.PartialErrorInfo("Unable to leave presence channel (incompatible state)",90001);v==null||v(N);break}default:v==null||v(C.invalidStateError())}},u.prototype.get=function(s,w){var v=this,C=Array.prototype.slice.call(arguments);C.length==1&&typeof C[0]=="function"&&C.unshift(null),s=C[0],w=C[1];var L=!s||("waitForSync"in s?s.waitForSync:!0);if(!w){if(this.channel.realtime.options.promises)return a.promisify(this,"get",C);w=k}function N(P){w(null,s?P.list(s):P.values())}if(this.channel.state==="suspended"){L?w(E.default.fromValues({statusCode:400,code:91005,message:"Presence state is out of sync due to channel being in the SUSPENDED state"})):N(this.members);return}p(this.channel,w,function(){var P=v.members;L?P.waitSync(function(){N(P)}):N(P)})},u.prototype.history=function(s,w){if(g.default.logAction(g.default.LOG_MICRO,"RealtimePresence.history()","channel = "+this.name),w===void 0)if(typeof s=="function")w=s,s=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"history",arguments);w=k}s&&s.untilAttach&&(this.channel.state==="attached"?(delete s.untilAttach,s.from_serial=this.channel.properties.attachSerial):w(new E.default("option untilAttach requires the channel to be attached, was: "+this.channel.state,4e4,400))),l.default.prototype._history.call(this,s,w)},u.prototype.setPresence=function(s,w,v){g.default.logAction(g.default.LOG_MICRO,"RealtimePresence.setPresence()","received presence for "+s.length+" participants; syncChannelSerial = "+v);var C,L,N=this.members,P=this._myMembers,I=[],M=this.channel.connectionManager.connectionId;w&&(this.members.startSync(),v&&(L=v.match(/^[\w-]+:(.*)$/))&&(C=L[1]));for(var A=0;A<s.length;A++){var j=S.default.fromValues(s[A]);switch(j.action){case"leave":N.remove(j)&&I.push(j),j.connectionId===M&&!j.isSynthesized()&&P.remove(j);break;case"enter":case"present":case"update":N.put(j)&&I.push(j),j.connectionId===M&&P.put(j);break}}w&&!C&&(N.endSync(),this.channel.syncChannelSerial=null);for(var A=0;A<I.length;A++){var j=I[A];this.subscriptions.emit(j.action,j)}},u.prototype.onAttached=function(s){g.default.logAction(g.default.LOG_MINOR,"RealtimePresence.onAttached()","channel = "+this.channel.name+", hasPresence = "+s),s?this.members.startSync():(this._synthesizeLeaves(this.members.values()),this.members.clear()),this._ensureMyMembersPresent();var w=this.pendingPresence,v=w.length;if(v){this.pendingPresence=[];var C=[],L=R.default.create();g.default.logAction(g.default.LOG_MICRO,"RealtimePresence.onAttached","sending "+v+" queued presence messages");for(var N=0;N<v;N++){var P=w[N];C.push(P.presence),L.push(P.callback)}this.channel.sendPresence(C,L)}},u.prototype.actOnChannelState=function(s,w,v){switch(s){case"attached":this.onAttached(w);break;case"detached":case"failed":this._clearMyMembers(),this.members.clear();case"suspended":this.failPendingPresence(v);break}},u.prototype.failPendingPresence=function(s){if(this.pendingPresence.length){g.default.logAction(g.default.LOG_MINOR,"RealtimeChannel.failPendingPresence","channel; name = "+this.channel.name+", err = "+a.inspectError(s));for(var w=0;w<this.pendingPresence.length;w++)try{this.pendingPresence[w].callback(s)}catch(v){}this.pendingPresence=[]}},u.prototype._clearMyMembers=function(){this._myMembers.clear()},u.prototype._ensureMyMembersPresent=function(){var s=this,w=this._myMembers,v=function(N){if(N){var P="Presence auto-re-enter failed: "+N.toString(),I=new E.default(P,91004,400);g.default.logAction(g.default.LOG_ERROR,"RealtimePresence._ensureMyMembersPresent()",P);var M=new f.default(s.channel.state,s.channel.state,!0,!1,I);s.channel.emit("update",M)}};for(var C in w.map){var L=w.map[C];g.default.logAction(g.default.LOG_MICRO,"RealtimePresence._ensureMyMembersPresent()",'Auto-reentering clientId "'+L.clientId+'" into the presence set'),this._enterOrUpdateClient(L.id,L.clientId,L.data,"enter",v)}},u.prototype._synthesizeLeaves=function(s){var w=this.subscriptions;a.arrForEach(s,function(v){var C=S.default.fromValues({action:"leave",connectionId:v.connectionId,clientId:v.clientId,data:v.data,encoding:v.encoding,timestamp:a.now()});w.emit("leave",C)})},u.prototype.on=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];g.default.renamedMethod("RealtimePresence","on","subscribe"),this.subscribe.apply(this,s)},u.prototype.off=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];g.default.renamedMethod("RealtimePresence","off","unsubscribe"),this.unsubscribe.apply(this,s)},u.prototype.subscribe=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];var v=y.default.processListenerArgs(s),C=v[0],L=v[1],N=v[2],P=this.channel;if(!N){if(this.channel.realtime.options.promises)return a.promisify(this,"subscribe",[C,L]);N=k}if(P.state==="failed"){N(E.default.fromValues(P.invalidStateError()));return}this.subscriptions.on(C,L),P.attach(N)},u.prototype.unsubscribe=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];var v=y.default.processListenerArgs(s),C=v[0],L=v[1];this.subscriptions.off(C,L)},u}(l.default),h=function(c){o.__extends(u,c);function u(s,w){var v=c.call(this)||this;return v.presence=s,v.map=Object.create(null),v.syncInProgress=!1,v.residualMembers=null,v.memberKey=w,v}return u.prototype.get=function(s){return this.map[s]},u.prototype.getClient=function(s){var w=this.map,v=[];for(var C in w){var L=w[C];L.clientId==s&&L.action!="absent"&&v.push(L)}return v},u.prototype.list=function(s){var w=this.map,v=s&&s.clientId,C=s&&s.connectionId,L=[];for(var N in w){var P=w[N];P.action!=="absent"&&(v&&v!=P.clientId||C&&C!=P.connectionId||L.push(P))}return L},u.prototype.put=function(s){(s.action==="enter"||s.action==="update")&&(s=S.default.fromValues(s),s.action="present");var w=this.map,v=this.memberKey(s);this.residualMembers&&delete this.residualMembers[v];var C=w[v];return C&&!m(s,C)?!1:(w[v]=s,!0)},u.prototype.values=function(){var s=this.map,w=[];for(var v in s){var C=s[v];C.action!="absent"&&w.push(C)}return w},u.prototype.remove=function(s){var w=this.map,v=this.memberKey(s),C=w[v];return C&&!m(s,C)?!1:(this.syncInProgress?(s=S.default.fromValues(s),s.action="absent",w[v]=s):delete w[v],!0)},u.prototype.startSync=function(){var s=this.map,w=this.syncInProgress;g.default.logAction(g.default.LOG_MINOR,"PresenceMap.startSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),this.syncInProgress||(this.residualMembers=a.copy(s),this.setInProgress(!0))},u.prototype.endSync=function(){var s=this.map,w=this.syncInProgress;if(g.default.logAction(g.default.LOG_MINOR,"PresenceMap.endSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),w){for(var v in s){var C=s[v];C.action==="absent"&&delete s[v]}this.presence._synthesizeLeaves(a.valuesArray(this.residualMembers));for(var v in this.residualMembers)delete s[v];this.residualMembers=null,this.setInProgress(!1)}this.emit("sync")},u.prototype.waitSync=function(s){var w=this.syncInProgress;if(g.default.logAction(g.default.LOG_MINOR,"PresenceMap.waitSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),!w){s();return}this.once("sync",s)},u.prototype.clear=function(){this.map={},this.setInProgress(!1),this.residualMembers=null},u.prototype.setInProgress=function(s){g.default.logAction(g.default.LOG_MICRO,"PresenceMap.setInProgress()","inProgress = "+s),this.syncInProgress=s,this.presence.syncComplete=!s},u}(d.default);r.default=b},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=i(56),l=i(31),d=i(11),g=o.__importDefault(i(5)),S=o.__importDefault(i(3)),E=function(){function y(){this.base64CharSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",this.hexCharSet="0123456789abcdef"}return y.prototype.isWordArray=function(R){return R!=null&&R.sigBytes!==void 0},y.prototype.isArrayBuffer=function(R){return R!=null&&R.constructor===ArrayBuffer},y.prototype.isTypedArray=function(R){return!!ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(R)},y.prototype.uint8ViewToBase64=function(R){for(var f="",k=this.base64CharSet,T=R.byteLength,x=T%3,p=T-x,m,b,h,c,u,s=0;s<p;s=s+3)u=R[s]<<16|R[s+1]<<8|R[s+2],m=(u&16515072)>>18,b=(u&258048)>>12,h=(u&4032)>>6,c=u&63,f+=k[m]+k[b]+k[h]+k[c];return x==1?(u=R[p],m=(u&252)>>2,b=(u&3)<<4,f+=k[m]+k[b]+"=="):x==2&&(u=R[p]<<8|R[p+1],m=(u&64512)>>10,b=(u&1008)>>4,h=(u&15)<<2,f+=k[m]+k[b]+k[h]+"="),f},y.prototype.base64ToArrayBuffer=function(R){for(var f=atob==null?void 0:atob(R),k=f.length,T=new Uint8Array(k),x=0;x<k;x++){var p=f.charCodeAt(x);T[x]=p}return T.buffer},y.prototype.isBuffer=function(R){return this.isArrayBuffer(R)||this.isWordArray(R)||this.isTypedArray(R)},y.prototype.toBuffer=function(R){if(!ArrayBuffer)throw new Error("Can't convert to Buffer: browser does not support the necessary types");if(this.isArrayBuffer(R))return new Uint8Array(R);if(this.isTypedArray(R))return new Uint8Array(R.buffer);if(this.isWordArray(R)){for(var f=new ArrayBuffer(R.sigBytes),k=new Uint8Array(f),T=0;T<R.sigBytes;T++)k[T]=R.words[T>>>2]>>>24-T%4*8&255;return k}throw new Error("BufferUtils.toBuffer expected an arraybuffer, typed array, or CryptoJS wordarray")},y.prototype.toArrayBuffer=function(R){return this.isArrayBuffer(R)?R:this.toBuffer(R).buffer},y.prototype.toWordArray=function(R){return this.isTypedArray(R)&&(R=R.buffer),this.isWordArray(R)?R:g.default.create(R)},y.prototype.base64Encode=function(R){return this.isWordArray(R)?(0,d.stringify)(R):this.uint8ViewToBase64(this.toBuffer(R))},y.prototype.base64Decode=function(R){return ArrayBuffer&&S.default.Config.atob?this.base64ToArrayBuffer(R):(0,d.parse)(R)},y.prototype.hexEncode=function(R){return(0,a.stringify)(this.toWordArray(R))},y.prototype.hexDecode=function(R){var f=(0,a.parse)(R);return ArrayBuffer?this.toArrayBuffer(f):f},y.prototype.utf8Encode=function(R){return S.default.Config.TextEncoder?new S.default.Config.TextEncoder().encode(R).buffer:(0,l.parse)(R)},y.prototype.utf8Decode=function(R){if(!this.isBuffer(R))throw new Error("Expected input of utf8decode to be an arraybuffer, typed array, or CryptoJS wordarray");return TextDecoder&&!this.isWordArray(R)?new TextDecoder().decode(R):(R=this.toWordArray(R),(0,l.stringify)(R))},y.prototype.bufferCompare=function(R,f){if(!R)return-1;if(!f)return 1;var k=this.toWordArray(R),T=this.toWordArray(f);k.clamp(),T.clamp();var x=k.sigBytes-T.sigBytes;if(x!=0)return x;for(var p=k.words,m=T.words,b=0;b<p.length;b++)if(x=p[b]-m[b],x!=0)return x;return 0},y.prototype.byteLength=function(R){return this.isArrayBuffer(R)||this.isTypedArray(R)?R.byteLength:this.isWordArray(R)?R.sigBytes:-1},y.prototype.typedArrayToBuffer=function(R){return R.buffer},y}();r.default=new E},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return o.enc.Hex})},function(n,r,i){i.r(r);var o=i(5),a=i.n(o),l=i(11),d=i(23),g=i.n(d),S=i(2),E=i.n(S),y=i(4),R=i.n(y),f=function(k,T){var x="aes",p=256,m="cbc",b=16,h=4,c=4294967296,u=2147483648,s;if(k.getRandomWordArray)s=k.getRandomWordArray;else if(typeof Uint32Array!="undefined"&&k.getRandomValues){var w=new Uint32Array(h);s=function(A,j){var U=A/4,z=U==h?w:new Uint32Array(U);k.getRandomValues(z,function($){typeof j!="undefined"&&j($,T.toWordArray(z))})}}else s=function(A,j){E.a.logAction(E.a.LOG_MAJOR,"Ably.Crypto.generateRandom()","Warning: the browser you are using does not support secure cryptographically secure randomness generation; falling back to insecure Math.random()");for(var U=A/4,z=new Array(U),$=0;$<U;$++)z[$]=Math.floor(Math.random()*c)-u;j(null,a.a.create(z))};function v(A){return A+b&-16}function C(A){if(A.algorithm==="aes"&&A.mode==="cbc"){if(A.keyLength===128||A.keyLength===256)return;throw new Error("Unsupported key length "+A.keyLength+" for aes-cbc encryption. Encryption key must be 128 or 256 bits (16 or 32 ASCII characters)")}}function L(A){return A.replace("_","/").replace("-","+")}var N=[a.a.create([269488144,269488144,269488144,269488144],16),a.a.create([16777216],1),a.a.create([33685504],2),a.a.create([50529024],3),a.a.create([67372036],4),a.a.create([84215045,83886080],5),a.a.create([101058054,101056512],6),a.a.create([117901063,117901056],7),a.a.create([134744072,134744072],8),a.a.create([151587081,151587081,150994944],9),a.a.create([168430090,168430090,168427520],10),a.a.create([185273099,185273099,185273088],11),a.a.create([202116108,202116108,202116108],12),a.a.create([218959117,218959117,218959117,218103808],13),a.a.create([235802126,235802126,235802126,235798528],14),a.a.create([252645135,252645135,252645135,252645135],15),a.a.create([269488144,269488144,269488144,269488144],16)];function P(){}function I(){this.algorithm=null,this.keyLength=null,this.mode=null,this.key=null}P.CipherParams=I,P.getDefaultParams=function(A){var j;if(typeof A=="function"||typeof A=="string"){if(E.a.deprecated("The ability to pass a callback to `Crypto.getDefaultParams()`","This method now directly returns its result, instead of returning it asynchronously via a callback. Please update your code so that it uses the return value of this method instead of passing a callback."),typeof A=="function")E.a.deprecated("The ability to call `Crypto.getDefaultParams()` without specifying an encryption key","Please update your code so that it instead passes an object whose `key` property contains an encryption key. That is, replace `Crypto.getDefaultParams()` with `Crypto.getDefaultParams({ key })`, where `key` is an encryption key that you have generated (for example from the `Crypto.generateRandomKey()` method)."),P.generateRandomKey(function(z){A(null,P.getDefaultParams({key:z}))});else if(typeof arguments[1]=="function")E.a.deprecated("The ability to pass the encryption key as the first argument of `Crypto.getDefaultParams()`","Please update your code so that it instead passes an object whose `key` property contains the key. That is, replace `Crypto.getDefaultParams(key)` with `Crypto.getDefaultParams({ key })`."),arguments[1](null,P.getDefaultParams({key:A}));else throw new Error("Invalid arguments for Crypto.getDefaultParams");return}if(!A.key)throw new Error("Crypto.getDefaultParams: a key is required");typeof A.key=="string"?j=Object(l.parse)(L(A.key)):j=T.toWordArray(A.key);var U=new I;if(U.key=j,U.algorithm=A.algorithm||x,U.keyLength=j.words.length*(4*8),U.mode=A.mode||m,A.keyLength&&A.keyLength!==U.keyLength)throw new Error("Crypto.getDefaultParams: a keyLength of "+A.keyLength+" was specified, but the key actually has length "+U.keyLength);return C(U),U},P.generateRandomKey=function(A,j){arguments.length==1&&typeof A=="function"&&(j=A,A=void 0),s((A||p)/8,function(U,z){j!==void 0&&j(U?R.a.fromValues(U):null,z)})},P.getCipher=function(A){var j=A instanceof I?A:P.getDefaultParams(A);return{cipherParams:j,cipher:new M(j,h,A.iv)}};function M(A,j,U){this.algorithm=A.algorithm+"-"+String(A.keyLength)+"-"+A.mode,this.cjsAlgorithm=A.algorithm.toUpperCase().replace(/-\d+$/,""),this.key=T.toWordArray(A.key),U&&(this.iv=T.toWordArray(U).clone()),this.blockLengthWords=j}return M.prototype.encrypt=function(A,j){E.a.logAction(E.a.LOG_MICRO,"CBCCipher.encrypt()",""),A=T.toWordArray(A);var U=A.sigBytes,z=v(U),$=this,W=function(){$.getIv(function(F,O){if(F){j(F);return}var D=$.encryptCipher.process(A.concat(N[z-U])),B=O.concat(D);j(null,B)})};this.encryptCipher?W():this.iv?(this.encryptCipher=g.a.algo[this.cjsAlgorithm].createEncryptor(this.key,{iv:this.iv}),W()):s(b,function(F,O){if(F){j(F);return}$.encryptCipher=g.a.algo[$.cjsAlgorithm].createEncryptor($.key,{iv:O}),$.iv=O,W()})},M.prototype.decrypt=function(A){E.a.logAction(E.a.LOG_MICRO,"CBCCipher.decrypt()",""),A=T.toWordArray(A);var j=this.blockLengthWords,U=A.words,z=a.a.create(U.slice(0,j)),$=a.a.create(U.slice(j)),W=g.a.algo[this.cjsAlgorithm].createDecryptor(this.key,{iv:z}),F=W.process($),O=W.finalize();return W.reset(),O&&O.sigBytes&&F.concat(O),F},M.prototype.getIv=function(A){if(this.iv){var j=this.iv;this.iv=null,A(null,j);return}var U=this;s(b,function(z,$){if(z){A(z);return}A(null,U.encryptCipher.process($))})},P};r.default=f},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(){var a=o,l=a.lib,d=l.WordArray,g=a.enc;g.Utf16=g.Utf16BE={stringify:function(E){for(var y=E.words,R=E.sigBytes,f=[],k=0;k<R;k+=2){var T=y[k>>>2]>>>16-k%4*8&65535;f.push(String.fromCharCode(T))}return f.join("")},parse:function(E){for(var y=E.length,R=[],f=0;f<y;f++)R[f>>>1]|=E.charCodeAt(f)<<16-f%2*16;return d.create(R,y*2)}},g.Utf16LE={stringify:function(E){for(var y=E.words,R=E.sigBytes,f=[],k=0;k<R;k+=2){var T=S(y[k>>>2]>>>16-k%4*8&65535);f.push(String.fromCharCode(T))}return f.join("")},parse:function(E){for(var y=E.length,R=[],f=0;f<y;f++)R[f>>>1]|=S(E.charCodeAt(f)<<16-f%2*16);return d.create(R,y*2)}};function S(E){return E<<8&4278255360|E>>>8&16711935}}(),o.enc.Utf16})},function(n,r,i){(function(o,a){n.exports=a(i(6),i(28))})(this,function(o){return function(a){var l=o,d=l.lib,g=d.CipherParams,S=l.enc,E=S.Hex,y=l.format;y.Hex={stringify:function(R){return R.ciphertext.toString(E)},parse:function(R){var f=E.parse(R);return g.create({ciphertext:f})}}}(),o.format.Hex})},function(n,r,i){(function(o,a){n.exports=a(i(6),i(11),i(61),i(27),i(28))})(this,function(o){return function(){var a=o,l=a.lib,d=l.BlockCipher,g=a.algo,S=[],E=[],y=[],R=[],f=[],k=[],T=[],x=[],p=[],m=[];(function(){for(var c=[],u=0;u<256;u++)u<128?c[u]=u<<1:c[u]=u<<1^283;for(var s=0,w=0,u=0;u<256;u++){var v=w^w<<1^w<<2^w<<3^w<<4;v=v>>>8^v&255^99,S[s]=v,E[v]=s;var C=c[s],L=c[C],N=c[L],P=c[v]*257^v*16843008;y[s]=P<<24|P>>>8,R[s]=P<<16|P>>>16,f[s]=P<<8|P>>>24,k[s]=P;var P=N*16843009^L*65537^C*257^s*16843008;T[v]=P<<24|P>>>8,x[v]=P<<16|P>>>16,p[v]=P<<8|P>>>24,m[v]=P,s?(s=C^c[c[c[N^C]]],w^=c[c[w]]):s=w=1}})();var b=[0,1,2,4,8,16,32,64,128,27,54],h=g.AES=d.extend({_doReset:function(){var c;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var u=this._keyPriorReset=this._key,s=u.words,w=u.sigBytes/4,v=this._nRounds=w+6,C=(v+1)*4,L=this._keySchedule=[],N=0;N<C;N++)N<w?L[N]=s[N]:(c=L[N-1],N%w?w>6&&N%w==4&&(c=S[c>>>24]<<24|S[c>>>16&255]<<16|S[c>>>8&255]<<8|S[c&255]):(c=c<<8|c>>>24,c=S[c>>>24]<<24|S[c>>>16&255]<<16|S[c>>>8&255]<<8|S[c&255],c^=b[N/w|0]<<24),L[N]=L[N-w]^c);for(var P=this._invKeySchedule=[],I=0;I<C;I++){var N=C-I;if(I%4)var c=L[N];else var c=L[N-4];I<4||N<=4?P[I]=c:P[I]=T[S[c>>>24]]^x[S[c>>>16&255]]^p[S[c>>>8&255]]^m[S[c&255]]}}},encryptBlock:function(c,u){this._doCryptBlock(c,u,this._keySchedule,y,R,f,k,S)},decryptBlock:function(c,u){var s=c[u+1];c[u+1]=c[u+3],c[u+3]=s,this._doCryptBlock(c,u,this._invKeySchedule,T,x,p,m,E);var s=c[u+1];c[u+1]=c[u+3],c[u+3]=s},_doCryptBlock:function(c,u,s,w,v,C,L,N){for(var P=this._nRounds,I=c[u]^s[0],M=c[u+1]^s[1],A=c[u+2]^s[2],j=c[u+3]^s[3],U=4,z=1;z<P;z++){var $=w[I>>>24]^v[M>>>16&255]^C[A>>>8&255]^L[j&255]^s[U++],W=w[M>>>24]^v[A>>>16&255]^C[j>>>8&255]^L[I&255]^s[U++],F=w[A>>>24]^v[j>>>16&255]^C[I>>>8&255]^L[M&255]^s[U++],O=w[j>>>24]^v[I>>>16&255]^C[M>>>8&255]^L[A&255]^s[U++];I=$,M=W,A=F,j=O}var $=(N[I>>>24]<<24|N[M>>>16&255]<<16|N[A>>>8&255]<<8|N[j&255])^s[U++],W=(N[M>>>24]<<24|N[A>>>16&255]<<16|N[j>>>8&255]<<8|N[I&255])^s[U++],F=(N[A>>>24]<<24|N[j>>>16&255]<<16|N[I>>>8&255]<<8|N[M&255])^s[U++],O=(N[j>>>24]<<24|N[I>>>16&255]<<16|N[M>>>8&255]<<8|N[A&255])^s[U++];c[u]=$,c[u+1]=W,c[u+2]=F,c[u+3]=O},keySize:256/32});a.AES=d._createHelper(h)}(),o.AES})},function(n,r,i){(function(o,a){n.exports=a(i(6))})(this,function(o){return function(a){var l=o,d=l.lib,g=d.WordArray,S=d.Hasher,E=l.algo,y=[];(function(){for(var p=0;p<64;p++)y[p]=a.abs(a.sin(p+1))*4294967296|0})();var R=E.MD5=S.extend({_doReset:function(){this._hash=new g.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,m){for(var b=0;b<16;b++){var h=m+b,c=p[h];p[h]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360}var u=this._hash.words,s=p[m+0],w=p[m+1],v=p[m+2],C=p[m+3],L=p[m+4],N=p[m+5],P=p[m+6],I=p[m+7],M=p[m+8],A=p[m+9],j=p[m+10],U=p[m+11],z=p[m+12],$=p[m+13],W=p[m+14],F=p[m+15],O=u[0],D=u[1],B=u[2],_=u[3];O=f(O,D,B,_,s,7,y[0]),_=f(_,O,D,B,w,12,y[1]),B=f(B,_,O,D,v,17,y[2]),D=f(D,B,_,O,C,22,y[3]),O=f(O,D,B,_,L,7,y[4]),_=f(_,O,D,B,N,12,y[5]),B=f(B,_,O,D,P,17,y[6]),D=f(D,B,_,O,I,22,y[7]),O=f(O,D,B,_,M,7,y[8]),_=f(_,O,D,B,A,12,y[9]),B=f(B,_,O,D,j,17,y[10]),D=f(D,B,_,O,U,22,y[11]),O=f(O,D,B,_,z,7,y[12]),_=f(_,O,D,B,$,12,y[13]),B=f(B,_,O,D,W,17,y[14]),D=f(D,B,_,O,F,22,y[15]),O=k(O,D,B,_,w,5,y[16]),_=k(_,O,D,B,P,9,y[17]),B=k(B,_,O,D,U,14,y[18]),D=k(D,B,_,O,s,20,y[19]),O=k(O,D,B,_,N,5,y[20]),_=k(_,O,D,B,j,9,y[21]),B=k(B,_,O,D,F,14,y[22]),D=k(D,B,_,O,L,20,y[23]),O=k(O,D,B,_,A,5,y[24]),_=k(_,O,D,B,W,9,y[25]),B=k(B,_,O,D,C,14,y[26]),D=k(D,B,_,O,M,20,y[27]),O=k(O,D,B,_,$,5,y[28]),_=k(_,O,D,B,v,9,y[29]),B=k(B,_,O,D,I,14,y[30]),D=k(D,B,_,O,z,20,y[31]),O=T(O,D,B,_,N,4,y[32]),_=T(_,O,D,B,M,11,y[33]),B=T(B,_,O,D,U,16,y[34]),D=T(D,B,_,O,W,23,y[35]),O=T(O,D,B,_,w,4,y[36]),_=T(_,O,D,B,L,11,y[37]),B=T(B,_,O,D,I,16,y[38]),D=T(D,B,_,O,j,23,y[39]),O=T(O,D,B,_,$,4,y[40]),_=T(_,O,D,B,s,11,y[41]),B=T(B,_,O,D,C,16,y[42]),D=T(D,B,_,O,P,23,y[43]),O=T(O,D,B,_,A,4,y[44]),_=T(_,O,D,B,z,11,y[45]),B=T(B,_,O,D,F,16,y[46]),D=T(D,B,_,O,v,23,y[47]),O=x(O,D,B,_,s,6,y[48]),_=x(_,O,D,B,I,10,y[49]),B=x(B,_,O,D,W,15,y[50]),D=x(D,B,_,O,N,21,y[51]),O=x(O,D,B,_,z,6,y[52]),_=x(_,O,D,B,C,10,y[53]),B=x(B,_,O,D,j,15,y[54]),D=x(D,B,_,O,w,21,y[55]),O=x(O,D,B,_,M,6,y[56]),_=x(_,O,D,B,F,10,y[57]),B=x(B,_,O,D,P,15,y[58]),D=x(D,B,_,O,$,21,y[59]),O=x(O,D,B,_,L,6,y[60]),_=x(_,O,D,B,U,10,y[61]),B=x(B,_,O,D,v,15,y[62]),D=x(D,B,_,O,A,21,y[63]),u[0]=u[0]+O|0,u[1]=u[1]+D|0,u[2]=u[2]+B|0,u[3]=u[3]+_|0},_doFinalize:function(){var p=this._data,m=p.words,b=this._nDataBytes*8,h=p.sigBytes*8;m[h>>>5]|=128<<24-h%32;var c=a.floor(b/4294967296),u=b;m[(h+64>>>9<<4)+15]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,m[(h+64>>>9<<4)+14]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360,p.sigBytes=(m.length+1)*4,this._process();for(var s=this._hash,w=s.words,v=0;v<4;v++){var C=w[v];w[v]=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360}return s},clone:function(){var p=S.clone.call(this);return p._hash=this._hash.clone(),p}});function f(p,m,b,h,c,u,s){var w=p+(m&b|~m&h)+c+s;return(w<<u|w>>>32-u)+m}function k(p,m,b,h,c,u,s){var w=p+(m&h|b&~h)+c+s;return(w<<u|w>>>32-u)+m}function T(p,m,b,h,c,u,s){var w=p+(m^b^h)+c+s;return(w<<u|w>>>32-u)+m}function x(p,m,b,h,c,u,s){var w=p+(b^(m|~h))+c+s;return(w<<u|w>>>32-u)+m}l.MD5=S._createHelper(R),l.HmacMD5=S._createHmacHelper(R)}(Math),o.MD5})},function(n,r,i){var o;Object.defineProperty(r,"__esModule",{value:!0});var a=i(0),l=a.__importDefault(i(3)),d=a.__importStar(i(1)),g=a.__importDefault(i(8)),S=i(4),E=a.__importDefault(i(19)),y=a.__importDefault(i(17)),R=a.__importDefault(i(22)),f=a.__importDefault(i(2)),k=i(29),T=a.__importDefault(i(63)),x=i(14);function p(h){var c=h.statusCode;return c===408&&!h.code||c===400&&!h.code||c>=500&&c<=504}function m(h){var c=h.connection,u=c&&c.connectionManager.host;return u?[u].concat(g.default.getFallbackHosts(h.options)):g.default.getHosts(h.options)}var b=(o=function(){function h(c){this.checksInProgress=null,this.checkConnectivity=void 0,this.supportsAuthHeaders=!1,this.supportsLinkHeaders=!1,this._getHosts=m,this.options=c||{};var u=this.options.connectivityCheckUrl||g.default.connectivityCheckUrl,s=this.options.connectivityCheckParams,w=!this.options.connectivityCheckUrl;l.default.Config.xhrSupported?(this.supportsAuthHeaders=!0,this.Request=function(v,C,L,N,P,I,M){var A=y.default.createRequest(L,N,P,I,R.default.REQ_SEND,C&&C.options.timeouts,v);return A.once("complete",M),A.exec(),A},this.options.disableConnectivityCheck?this.checkConnectivity=function(v){v(null,!0)}:this.checkConnectivity=function(v){f.default.logAction(f.default.LOG_MICRO,"(XHRRequest)Http.checkConnectivity()","Sending; "+u),this.doUri(E.default.Get,null,u,null,null,s,function(C,L,N,P,I){var M=!1;w?M=!C&&(L==null?void 0:L.replace(/\n/,""))=="yes":M=!C&&(0,x.isSuccessCode)(I),f.default.logAction(f.default.LOG_MICRO,"(XHRRequest)Http.checkConnectivity()","Result: "+M),v(null,M)})}):l.default.Config.jsonpSupported?(this.Request=function(v,C,L,N,P,I,M){var A=(0,k.createRequest)(L,N,P,I,R.default.REQ_SEND,C&&C.options.timeouts,v);return A.once("complete",M),l.default.Config.nextTick(function(){A.exec()}),A},this.options.disableConnectivityCheck?this.checkConnectivity=function(v){v(null,!0)}:this.checkConnectivity=function(v){var C=this,L=g.default.jsonpInternetUpUrl;if(this.checksInProgress){this.checksInProgress.push(v);return}this.checksInProgress=[v],f.default.logAction(f.default.LOG_MICRO,"(JSONP)Http.checkConnectivity()","Sending; "+L);var N=new k.Request("isTheInternetUp",L,null,null,null,R.default.REQ_SEND,g.default.TIMEOUTS);N.once("complete",function(P,I){var M=!P&&I;f.default.logAction(f.default.LOG_MICRO,"(JSONP)Http.checkConnectivity()","Result: "+M);for(var A=0;A<C.checksInProgress.length;A++)C.checksInProgress[A](null,M);C.checksInProgress=null}),l.default.Config.nextTick(function(){N.exec()})}):l.default.Config.fetchSupported?(this.supportsAuthHeaders=!0,this.Request=T.default,this.checkConnectivity=function(v){f.default.logAction(f.default.LOG_MICRO,"(Fetch)Http.checkConnectivity()","Sending; "+u),this.doUri(E.default.Get,null,u,null,null,null,function(C,L){var N=!C&&(L==null?void 0:L.replace(/\n/,""))=="yes";f.default.logAction(f.default.LOG_MICRO,"(Fetch)Http.checkConnectivity()","Result: "+N),v(null,N)})}):this.Request=function(v,C,L,N,P,I,M){M(new S.PartialErrorInfo("no supported HTTP transports available",null,400),null)}}return h.prototype.do=function(c,u,s,w,v,C,L){var N=this,P=typeof s=="function"?s:function(j){return u.baseUri(j)+s},I=u._currentFallback;if(I)if(I.validUntil>d.now()){if(!this.Request){L==null||L(new S.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(c,u,P(I.host),w,C,v,function(j){for(var U=[],z=1;z<arguments.length;z++)U[z-1]=arguments[z];if(j&&p(j)){u._currentFallback=null,N.do(c,u,s,w,v,C,L);return}L==null||L.apply(void 0,a.__spreadArray([j],U,!1))});return}else u._currentFallback=null;var M=m(u);if(M.length===1){this.doUri(c,u,P(M[0]),w,v,C,L);return}var A=function(j,U){var z=j.shift();N.doUri(c,u,P(z),w,v,C,function($){for(var W=[],F=1;F<arguments.length;F++)W[F-1]=arguments[F];if($&&p($)&&j.length){A(j,!0);return}U&&(u._currentFallback={host:z,validUntil:d.now()+u.options.timeouts.fallbackRetryTimeout}),L==null||L.apply(void 0,a.__spreadArray([$],W,!1))})};A(M)},h.prototype.doUri=function(c,u,s,w,v,C,L){if(!this.Request){L(new S.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(c,u,s,w,C,v,L)},h}(),o.methods=[E.default.Get,E.default.Delete,E.default.Post,E.default.Put,E.default.Patch],o.methodsWithoutBody=[E.default.Get,E.default.Delete],o.methodsWithBody=[E.default.Post,E.default.Put,E.default.Patch],o);r.default=b},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importStar(i(4)),l=o.__importDefault(i(3)),d=o.__importDefault(i(8)),g=o.__importStar(i(1)),S=i(1);function E(f,k){return!!k.get("x-ably-errorcode")}function y(f,k){if(E(f,k))return f.error&&a.default.fromValues(f.error)}function R(f,k,T,x,p,m,b){var h=new Headers(x||{}),c=f?f.toUpperCase():g.isEmptyArg(m)?"GET":"POST",u=new AbortController,s=setTimeout(function(){u.abort(),b(new a.PartialErrorInfo("Request timed out",null,408))},k?k.options.timeouts.httpRequestTimeout:d.default.TIMEOUTS.httpRequestTimeout),w={method:c,headers:h,body:m};l.default.Config.isWebworker||(w.credentials=h.has("authorization")?"include":"same-origin"),(0,S.getGlobalObject)().fetch(T+"?"+new URLSearchParams(p||{}),w).then(function(v){clearTimeout(s);var C=v.headers.get("Content-Type"),L;C&&C.indexOf("application/x-msgpack")>-1?L=v.arrayBuffer():C&&C.indexOf("application/json")>-1?L=v.json():L=v.text(),L.then(function(N){var P=!!C&&C.indexOf("application/x-msgpack")===-1;if(v.ok)b(null,N,v.headers,P,v.status);else{var I=y(N,v.headers)||new a.PartialErrorInfo("Error response received from server: "+v.status+" body was: "+l.default.Config.inspect(N),null,v.status);b(I,N,v.headers,P,v.status)}})}).catch(function(v){clearTimeout(s),b(v)})}r.default=R},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(41)),l=o.__importStar(i(1)),d=l.getGlobalObject();typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"&&console.log("Warning: this distribution of Ably is intended for browsers. On nodejs, please use the 'ably' package on npm");function g(){var R=d.location;return!d.WebSocket||!R||!R.origin||R.origin.indexOf("http")>-1}var S=d.navigator&&d.navigator.userAgent.toString(),E=d.location&&d.location.href,y={agent:"browser",logTimestamps:!0,userAgent:S,currentUrl:E,noUpgrade:S&&!!S.match(/MSIE\s8\.0/),binaryType:"arraybuffer",WebSocket:d.WebSocket,fetchSupported:!!d.fetch,xhrSupported:d.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,jsonpSupported:typeof document!="undefined",allowComet:g(),streamingSupported:!0,useProtocolHeartbeats:!0,createHmac:null,msgpack:a.default,supportsBinary:!!d.TextDecoder,preferBinary:!1,ArrayBuffer:d.ArrayBuffer,atob:d.atob,nextTick:typeof d.setImmediate!="undefined"?d.setImmediate.bind(d):function(R){setTimeout(R,0)},addEventListener:d.addEventListener,inspect:JSON.stringify,stringByteSize:function(R){return d.TextDecoder&&new d.TextEncoder().encode(R).length||R.length},TextEncoder:d.TextEncoder,TextDecoder:d.TextDecoder,Promise:d.Promise,getRandomValues:function(R){if(R!==void 0)return function(f,k){R.getRandomValues(f),k&&k(null)}}(d.crypto||msCrypto)};r.default=y},function(n,r,i){(function(o){Object.defineProperty(r,"__esModule",{value:!0});var a=i(0),l=a.__importStar(i(1)),d="ablyjs-storage-test",g=function(){function S(){try{o.sessionStorage.setItem(d,d),o.sessionStorage.removeItem(d),this.sessionSupported=!0}catch(E){this.sessionSupported=!1}try{o.localStorage.setItem(d,d),o.localStorage.removeItem(d),this.localSupported=!0}catch(E){this.localSupported=!1}}return S.prototype.get=function(E){return this._get(E,!1)},S.prototype.getSession=function(E){return this._get(E,!0)},S.prototype.remove=function(E){return this._remove(E,!1)},S.prototype.removeSession=function(E){return this._remove(E,!0)},S.prototype.set=function(E,y,R){return this._set(E,y,R,!1)},S.prototype.setSession=function(E,y,R){return this._set(E,y,R,!0)},S.prototype._set=function(E,y,R,f){var k={value:y};return R&&(k.expires=l.now()+R),this.storageInterface(f).setItem(E,JSON.stringify(k))},S.prototype._get=function(E,y){if(y&&!this.sessionSupported)throw new Error("Session Storage not supported");if(!y&&!this.localSupported)throw new Error("Local Storage not supported");var R=this.storageInterface(y).getItem(E);if(!R)return null;var f=JSON.parse(R);return f.expires&&f.expires<l.now()?(this.storageInterface(y).removeItem(E),null):f.value},S.prototype._remove=function(E,y){return this.storageInterface(y).removeItem(E)},S.prototype.storageInterface=function(E){return E?o.sessionStorage:o.localStorage},S}();r.default=new g}).call(this,i(13))},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o=i(0),a=o.__importDefault(i(67)),l={connectivityCheckUrl:"https://internet-up.ably-realtime.com/is-the-internet-up.txt",jsonpInternetUpUrl:"https://internet-up.ably-realtime.com/is-the-internet-up-0-9.js",defaultTransports:[a.default.XhrPolling,a.default.XhrStreaming,a.default.JsonP,a.default.WebSocket],baseTransportOrder:[a.default.XhrPolling,a.default.XhrStreaming,a.default.JsonP,a.default.WebSocket],transportPreferenceOrder:[a.default.JsonP,a.default.XhrPolling,a.default.XhrStreaming,a.default.WebSocket],upgradeTransports:[a.default.XhrStreaming,a.default.WebSocket]};r.default=l},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var o;(function(a){a.WebSocket="web_socket",a.Comet="comet",a.XhrStreaming="xhr_streaming",a.XhrPolling="xhr_polling",a.JsonP="jsonp"})(o||(o={})),r.default=o},function(n,r,i){i.r(r);var o=i(29),a=i.n(o),l=i(1),d=i(3),g=i.n(d),S=i(12),E=i.n(S),y=i(17),R=i.n(y),f=function(p){var m="xhr_polling";function b(h,c,u){u.stream=!1,E.a.call(this,h,c,u),this.shortName=m}return l.inherits(b,E.a),b.isAvailable=function(){return g.a.Config.xhrSupported&&g.a.Config.allowComet},b.prototype.toString=function(){return"XHRPollingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},b.prototype.createRequest=function(h,c,u,s,w){return R.a.createRequest(h,c,u,s,w,this.timeouts)},typeof p!="undefined"&&b.isAvailable()&&(p.supportedTransports[m]=b),b},k=f,T=function(p){var m="xhr_streaming";function b(h,c,u){E.a.call(this,h,c,u),this.shortName=m}return l.inherits(b,E.a),b.isAvailable=function(){return g.a.Config.xhrSupported&&g.a.Config.streamingSupported&&g.a.Config.allowComet},b.prototype.toString=function(){return"XHRStreamingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},b.prototype.createRequest=function(h,c,u,s,w){return R.a.createRequest(h,c,u,s,w,this.timeouts)},typeof p!="undefined"&&b.isAvailable()&&(p.supportedTransports[m]=b),b},x=T;r.default=[a.a,k,x]}]).default})})(rd);var Bg=rd.exports;const _g=pe(Bg),xo=(e,t,n,r,i)=>ot(this,null,function*(){try{const o=new _g.Realtime({token:e.token,clientId:e.clientId});o.connection.on("connected",()=>{i==null||i("connected")}),o.connection.on("failed",d=>{console.error("[❌ ABLY CONNECTION FAILED]",d),i==null||i("failed")}),o.connection.on("disconnected",()=>{i==null||i("disconnected")});const a=`room:${t}:${n}`,l=o.channels.get(a);return l.subscribe("messages",d=>{var g;try{const S=(g=d.data)==null?void 0:g.message;if(S&&S.role==="employee"){const E={id:S.id||wt(),text:S.content||"",sender:"bot",timestamp:S.createdAt?new Date(S.createdAt):new Date,type:S.type};r(E)}}catch(S){console.error("[❌ MESSAGE PARSING ERROR]",S)}}),{client:o,channel:l}}catch(o){throw console.error("[❌ ABLY INITIALIZATION ERROR]",o),o}}),zg=(e,t)=>ot(this,null,function*(){try{const n=nd(),r=yield fetch(`${n}?conversationId=${e}&chatbotUid=${t}`);return r.ok?yield r.json():(console.error("Failed to fetch conversation data:",r.statusText),null)}catch(n){return console.error("[❌ ABLY TOKEN FETCH ERROR]",n),null}}),id=e=>{e&&e.close()},So=()=>({id:wt(),text:"Lo siento, hubo un problema con la conexión. Esta es una respuesta de demostración.",sender:"bot",timestamp:new Date().toISOString(),type:"text"}),od=(e,t,n,r)=>{const i=Ug(t,e),o={id:e,senderId:r||"unknown",createdAt:new Date().toISOString(),chatbotActivated:!0,updatedAt:new Date().toISOString(),source:"IFRAME",website:typeof window!="undefined"?window.location.origin:"",messages:i};return{conversationId:e,conversation:o,chatbotUid:n.apiKey}},ad=e=>ot(this,null,function*(){try{const t=Lg(),n=yield fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return n.ok?yield n.json():(console.error("WebChat: API request failed:",n.status,n.statusText),null)}catch(t){return console.error("WebChat: Error sending message to API:",t),null}}),sd=e=>{if(e&&e.content){let t;return e.createdAt?t=e.createdAt.endsWith("Z")?e.createdAt:`${e.createdAt}Z`:t=new Date().toISOString(),{id:e.id||wt(),text:e.content,sender:"bot",timestamp:t,type:e.type}}return null},Hg=e=>`¡Hola! Soy ${e||"tu asistente"}, ¿En qué te puedo ayudar?
145
+ `;F.mac=F.mac||h(Y,W),a.default.logAction(a.default.LOG_MINOR,"Auth.getTokenRequest()","generated signed request"),A(null,F)})},M.prototype.getAuthParams=function(I){this.method=="basic"?I(null,{key:this.key}):this._ensureValidAuthCredentials(!1,function(P,A){if(P){I(P);return}if(!A)throw new Error("Auth.getAuthParams(): _ensureValidAuthCredentials returned no error or tokenDetails");I(null,{access_token:A.token})})},M.prototype.getAuthHeaders=function(I){this.method=="basic"?I(null,{authorization:"Basic "+this.basicKey}):this._ensureValidAuthCredentials(!1,function(P,A){if(P){I(P);return}if(!A)throw new Error("Auth.getAuthParams(): _ensureValidAuthCredentials returned no error or tokenDetails");I(null,{authorization:"Bearer "+l.toBase64(A.token)})})},M.prototype.getTimestamp=function(I,P){!this.isTimeOffsetSet()&&(I||this.authOptions.queryTime)?this.client.time(P):P(null,this.getTimestampUsingOffset())},M.prototype.getTimestampUsingOffset=function(){return l.now()+(this.client.serverTimeOffset||0)},M.prototype.isTimeOffsetSet=function(){return this.client.serverTimeOffset!==null},M.prototype._saveBasicOptions=function(I){this.method="basic",this.key=I.key,this.basicKey=l.toBase64(I.key),this.authOptions=I||{},"clientId"in I&&this._userSetClientId(I.clientId)},M.prototype._saveTokenOptions=function(I,P){this.method="token",I&&(this.tokenParams=I),P&&(P.token&&(P.tokenDetails=typeof P.token=="string"?{token:P.token}:P.token),P.tokenDetails&&(this.tokenDetails=P.tokenDetails),"clientId"in P&&this._userSetClientId(P.clientId),this.authOptions=P)},M.prototype._ensureValidAuthCredentials=function(I,P){var A=this,j=this.tokenDetails;if(j){if(this._tokenClientIdMismatch(j.clientId)){P(new g.default("Mismatch between clientId in token ("+j.clientId+") and current clientId ("+this.clientId+")",40102,403));return}if(!this.isTimeOffsetSet()||!j.expires||j.expires>=this.getTimestampUsingOffset()){a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","using cached token; expires = "+j.expires),P(null,j);return}a.default.logAction(a.default.LOG_MINOR,"Auth.getToken()","deleting expired token"),this.tokenDetails=null}if((this.waitingForTokenRequest||(this.waitingForTokenRequest=d.default.create())).push(P),!(this.currentTokenRequestId!==null&&!I)){var U=this.currentTokenRequestId=L();this.requestToken(this.tokenParams,this.authOptions,function(z,$){if(A.currentTokenRequestId>U){a.default.logAction(a.default.LOG_MINOR,"Auth._ensureValidAuthCredentials()","Discarding token request response; overtaken by newer one");return}A.currentTokenRequestId=null;var W=A.waitingForTokenRequest||x;if(A.waitingForTokenRequest=null,z){W(z);return}W(null,A.tokenDetails=$)})}},M.prototype._userSetClientId=function(I){if(typeof I=="string"||I===null){if(I==="*")throw new g.default('Can’t use "*" as a clientId as that string is reserved. (To change the default token request behaviour to use a wildcard clientId, instantiate the library with {defaultTokenParams: {clientId: "*"}}), or if calling authorize(), pass it in as a tokenParam: authorize({clientId: "*"}, authOptions)',40012,400);var P=this._uncheckedSetClientId(I);if(P)throw P}else throw new g.default("clientId must be either a string or null",40012,400)},M.prototype._uncheckedSetClientId=function(I){if(this._tokenClientIdMismatch(I)){var P="Unexpected clientId mismatch: client has "+this.clientId+", requested "+I,A=new g.default(P,40102,401);return a.default.logAction(a.default.LOG_ERROR,"Auth._uncheckedSetClientId()",P),A}else return this.clientId=this.tokenParams.clientId=I,null},M.prototype._tokenClientIdMismatch=function(I){return!!(this.clientId&&this.clientId!=="*"&&I&&I!=="*"&&this.clientId!==I)},M.isTokenErr=function(I){return I.code&&I.code>=40140&&I.code<40150},M.prototype.revokeTokens=function(I,P,A){if(w(this.client.options))throw new g.default("Cannot revoke tokens when using token auth",40162,401);var j=this.client.options.keyName,U;if(typeof P=="function"?(A=P,U={}):U=P!=null?P:{},A===void 0){if(this.client.options.promises)return l.promisify(this,"revokeTokens",[I,U]);A=x}var z=A,$=i.__assign({targets:I.map(function(D){return"".concat(D.type,":").concat(D.value)})},U),W=this.client.options.useBinaryProtocol?l.Format.msgpack:l.Format.json,F=l.defaultPostHeaders(this.client.options,W);this.client.options.headers&&l.mixin(F,this.client.options.headers);var O=l.encodeBody($,W);k.default.post(this.client,"/keys/".concat(j,"/revokeTokens"),O,F,{newBatchResponse:"true"},null,function(D,B,_,V){if(D){z(D);return}var Y=V?B:l.decodeBody(B,W);z(null,Y)})},M}();r.default=N},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i;(function(a){a.Get="get",a.Delete="delete",a.Post="post",a.Put="put",a.Patch="patch"})(i||(i={})),r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.HttpPaginatedResponse=r.PaginatedResult=void 0;var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(2)),d=i.__importDefault(o(15)),g=i.__importDefault(o(14));function S(T){var x=T.match(/^\.\/(\w+)\?(.*)$/);return x&&x[2]&&a.parseQueryString(x[2])}function E(T){typeof T=="string"&&(T=T.split(","));for(var x={},p=0;p<T.length;p++){var m=T[p].match(/^\s*<(.+)>;\s*rel="(\w+)"$/);if(m){var b=S(m[1]);b&&(x[m[2]]=b)}}return x}function y(T,x,p){return!(p&&(x||typeof T.code=="number"))}var R=function(){function T(x,p,m,b,h,c){this.rest=x,this.path=p,this.headers=m,this.envelope=b!=null?b:null,this.bodyHandler=h,this.useHttpPaginatedResponse=c||!1}return T.prototype.get=function(x,p){var m=this;d.default.get(this.rest,this.path,this.headers,x,this.envelope,function(b,h,c,u,s){m.handlePage(b,h,c,u,s,p)})},T.prototype.delete=function(x,p){var m=this;d.default.delete(this.rest,this.path,this.headers,x,this.envelope,function(b,h,c,u,s){m.handlePage(b,h,c,u,s,p)})},T.prototype.post=function(x,p,m){var b=this;d.default.post(this.rest,this.path,p,this.headers,x,this.envelope,function(h,c,u,s,w){m&&b.handlePage(h,c,u,s,w,m)})},T.prototype.put=function(x,p,m){var b=this;d.default.put(this.rest,this.path,p,this.headers,x,this.envelope,function(h,c,u,s,w){m&&b.handlePage(h,c,u,s,w,m)})},T.prototype.patch=function(x,p,m){var b=this;d.default.patch(this.rest,this.path,p,this.headers,x,this.envelope,function(h,c,u,s,w){m&&b.handlePage(h,c,u,s,w,m)})},T.prototype.handlePage=function(x,p,m,b,h,c){if(x&&y(x,p,this.useHttpPaginatedResponse)){l.default.logAction(l.default.LOG_ERROR,"PaginatedResource.handlePage()","Unexpected error getting resource: err = "+a.inspectError(x)),c==null||c(x);return}var u,s,w;try{u=h==g.default.NoContent?[]:this.bodyHandler(p,m||{},b)}catch(v){c==null||c(x||v);return}m&&(s=m.Link||m.link)&&(w=E(s)),this.useHttpPaginatedResponse?c(null,new k(this,u,m||{},h,w,x)):c(null,new f(this,u,w))},T}(),f=function(){function T(x,p,m){var b=this;this.resource=x,this.items=p;var h=this;m&&("first"in m&&(this.first=function(c){if(!c&&h.resource.rest.options.promises)return a.promisify(h,"first",[]);h.get(m.first,c)}),"current"in m&&(this.current=function(c){if(!c&&h.resource.rest.options.promises)return a.promisify(h,"current",[]);h.get(m.current,c)}),this.next=function(c){if(!c&&h.resource.rest.options.promises)return a.promisify(h,"next",[]);"next"in m?h.get(m.next,c):c(null,null)},this.hasNext=function(){return"next"in m},this.isLast=function(){var c;return!(!((c=b.hasNext)===null||c===void 0)&&c.call(b))})}return T.prototype.get=function(x,p){var m=this.resource;d.default.get(m.rest,m.path,m.headers,x,m.envelope,function(b,h,c,u,s){m.handlePage(b,h,c,u,s,p)})},T}();r.PaginatedResult=f;var k=function(T){i.__extends(x,T);function x(p,m,b,h,c,u){var s=T.call(this,p,m,c)||this;return s.statusCode=h,s.success=h<300&&h>=200,s.headers=b,s.errorCode=u&&u.code,s.errorMessage=u&&u.message,s}return x.prototype.toJSON=function(){return{items:this.items,statusCode:this.statusCode,success:this.success,headers:this.headers,errorCode:this.errorCode,errorMessage:this.errorMessage}},x}(f);r.HttpPaginatedResponse=k,r.default=R},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.isRetriable=void 0;var i=o(0),a=i.__importDefault(o(4)),l={DISCONNECTED:80003,SUSPENDED:80002,FAILED:8e4,CLOSING:80017,CLOSED:80017,UNKNOWN_CONNECTION_ERR:50002,UNKNOWN_CHANNEL_ERR:50001},d={disconnected:function(){return a.default.fromValues({statusCode:400,code:l.DISCONNECTED,message:"Connection to server temporarily unavailable"})},suspended:function(){return a.default.fromValues({statusCode:400,code:l.SUSPENDED,message:"Connection to server unavailable"})},failed:function(){return a.default.fromValues({statusCode:400,code:l.FAILED,message:"Connection failed or disconnected by server"})},closing:function(){return a.default.fromValues({statusCode:400,code:l.CLOSING,message:"Connection closing"})},closed:function(){return a.default.fromValues({statusCode:400,code:l.CLOSED,message:"Connection closed"})},unknownConnectionErr:function(){return a.default.fromValues({statusCode:500,code:l.UNKNOWN_CONNECTION_ERR,message:"Internal connection error"})},unknownChannelErr:function(){return a.default.fromValues({statusCode:500,code:l.UNKNOWN_CONNECTION_ERR,message:"Internal channel error"})}};function g(S){return!S.statusCode||!S.code||S.statusCode>=500?!0:Object.values(l).includes(S.code)}r.isRetriable=g,r.default=d},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i;(function(a){a[a.REQ_SEND=0]="REQ_SEND",a[a.REQ_RECV=1]="REQ_RECV",a[a.REQ_RECV_POLL=2]="REQ_RECV_POLL",a[a.REQ_RECV_STREAM=3]="REQ_RECV_STREAM"})(i||(i={})),r.default=i},function(n,r,o){(function(i,a){n.exports=a(o(6),o(5),o(58),o(11),o(40),o(32),o(25),o(27),o(28),o(59),o(60))})(this,function(i){return i})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(2)),l=function(){function d(g){this.members=g||[]}return d.prototype.call=function(){for(var g=[],S=0;S<arguments.length;S++)g[S]=arguments[S];for(var E=0,y=this.members;E<y.length;E++){var R=y[E];if(R)try{R.apply(void 0,g)}catch(f){a.default.logAction(a.default.LOG_ERROR,"Multicaster multiple callback handler","Unexpected exception: "+f+"; stack = "+f.stack)}}},d.prototype.push=function(){for(var g,S=[],E=0;E<arguments.length;E++)S[E]=arguments[E];(g=this.members).push.apply(g,S)},d.create=function(g){var S=new d(g);return Object.assign(function(){for(var E=[],y=0;y<arguments.length;y++)E[y]=arguments[y];return S.call.apply(S,E)},{push:function(E){return S.push(E)}})},d}();r.default=l},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){(function(){var a=i,l=a.lib,d=l.Base,g=a.enc,S=g.Utf8,E=a.algo;E.HMAC=d.extend({init:function(y,R){y=this._hasher=new y.init,typeof R=="string"&&(R=S.parse(R));var f=y.blockSize,k=f*4;R.sigBytes>k&&(R=y.finalize(R)),R.clamp();for(var T=this._oKey=R.clone(),x=this._iKey=R.clone(),p=T.words,m=x.words,b=0;b<f;b++)p[b]^=1549556828,m[b]^=909522486;T.sigBytes=x.sigBytes=k,this.reset()},reset:function(){var y=this._hasher;y.reset(),y.update(this._iKey)},update:function(y){return this._hasher.update(y),this},finalize:function(y){var R=this._hasher,f=R.finalize(y);R.reset();var k=R.finalize(this._oKey.clone().concat(f));return k}})})()})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(10)),l=i.__importStar(o(1)),d=i.__importDefault(o(7)),g=i.__importDefault(o(2)),S=i.__importDefault(o(21)),E=i.__importDefault(o(4)),y=i.__importDefault(o(3)),R=a.default.Action,f=a.default.fromValues({action:R.CLOSE}),k=a.default.fromValues({action:R.DISCONNECT}),T=function(x){i.__extends(p,x);function p(m,b,h,c){var u=x.call(this)||this;return c&&(h.format=void 0,h.heartbeats=!0),u.connectionManager=m,m.registerProposedTransport(u),u.auth=b,u.params=h,u.timeouts=h.options.timeouts,u.format=h.format,u.isConnected=!1,u.isFinished=!1,u.isDisposed=!1,u.maxIdleInterval=null,u.idleTimer=null,u.lastActivity=null,u}return p.prototype.connect=function(){},p.prototype.close=function(){this.isConnected&&this.requestClose(),this.finish("closed",S.default.closed())},p.prototype.disconnect=function(m){this.isConnected&&this.requestDisconnect(),this.finish("disconnected",m||S.default.disconnected())},p.prototype.fail=function(m){this.isConnected&&this.requestDisconnect(),this.finish("failed",m||S.default.failed())},p.prototype.finish=function(m,b){var h;this.isFinished||(this.isFinished=!0,this.isConnected=!1,this.maxIdleInterval=null,clearTimeout((h=this.idleTimer)!==null&&h!==void 0?h:void 0),this.idleTimer=null,this.emit(m,b),this.dispose())},p.prototype.onProtocolMessage=function(m){switch(g.default.shouldLog(g.default.LOG_MICRO)&&g.default.logAction(g.default.LOG_MICRO,"Transport.onProtocolMessage()","received on "+this.shortName+": "+a.default.stringify(m)+"; connectionId = "+this.connectionManager.connectionId),this.onActivity(),m.action){case R.HEARTBEAT:g.default.logAction(g.default.LOG_MICRO,"Transport.onProtocolMessage()",this.shortName+" heartbeat; connectionId = "+this.connectionManager.connectionId),this.emit("heartbeat",m.id);break;case R.CONNECTED:this.onConnect(m),this.emit("connected",m.error,m.connectionId,m.connectionDetails,m);break;case R.CLOSED:this.onClose(m);break;case R.DISCONNECTED:this.onDisconnect(m);break;case R.ACK:this.emit("ack",m.msgSerial,m.count);break;case R.NACK:this.emit("nack",m.msgSerial,m.count,m.error);break;case R.SYNC:this.connectionManager.onChannelMessage(m,this);break;case R.ACTIVATE:break;case R.AUTH:this.auth.authorize(function(b){b&&g.default.logAction(g.default.LOG_ERROR,"Transport.onProtocolMessage()","Ably requested re-authentication, but unable to obtain a new token: "+l.inspectError(b))});break;case R.ERROR:if(g.default.logAction(g.default.LOG_MINOR,"Transport.onProtocolMessage()","received error action; connectionId = "+this.connectionManager.connectionId+"; err = "+y.default.Config.inspect(m.error)+(m.channel?", channel: "+m.channel:"")),m.channel===void 0){this.onFatalError(m);break}this.connectionManager.onChannelMessage(m,this);break;default:this.connectionManager.onChannelMessage(m,this)}},p.prototype.onConnect=function(m){if(this.isConnected=!0,!m.connectionDetails)throw new Error("Transport.onConnect(): Connect message recieved without connectionDetails");var b=m.connectionDetails.maxIdleInterval;b&&(this.maxIdleInterval=b+this.timeouts.realtimeRequestTimeout,this.onActivity())},p.prototype.onDisconnect=function(m){var b=m&&m.error;g.default.logAction(g.default.LOG_MINOR,"Transport.onDisconnect()","err = "+l.inspectError(b)),this.finish("disconnected",b)},p.prototype.onFatalError=function(m){var b=m&&m.error;g.default.logAction(g.default.LOG_MINOR,"Transport.onFatalError()","err = "+l.inspectError(b)),this.finish("failed",b)},p.prototype.onClose=function(m){var b=m&&m.error;g.default.logAction(g.default.LOG_MINOR,"Transport.onClose()","err = "+l.inspectError(b)),this.finish("closed",b)},p.prototype.requestClose=function(){g.default.logAction(g.default.LOG_MINOR,"Transport.requestClose()",""),this.send(f)},p.prototype.requestDisconnect=function(){g.default.logAction(g.default.LOG_MINOR,"Transport.requestDisconnect()",""),this.send(k)},p.prototype.ping=function(m){var b={action:a.default.Action.HEARTBEAT};m&&(b.id=m),this.send(a.default.fromValues(b))},p.prototype.dispose=function(){g.default.logAction(g.default.LOG_MINOR,"Transport.dispose()",""),this.isDisposed=!0,this.off()},p.prototype.onActivity=function(){this.maxIdleInterval&&(this.lastActivity=this.connectionManager.lastActivity=l.now(),this.setIdleTimer(this.maxIdleInterval+100))},p.prototype.setIdleTimer=function(m){var b=this;this.idleTimer||(this.idleTimer=setTimeout(function(){b.onIdleTimerExpire()},m))},p.prototype.onIdleTimerExpire=function(){if(!this.lastActivity||!this.maxIdleInterval)throw new Error("Transport.onIdleTimerExpire(): lastActivity/maxIdleInterval not set");this.idleTimer=null;var m=l.now()-this.lastActivity,b=this.maxIdleInterval-m;if(b<=0){var h="No activity seen from realtime in "+m+"ms; assuming connection has dropped";g.default.logAction(g.default.LOG_ERROR,"Transport.onIdleTimerExpire()",h),this.disconnect(new E.default(h,80003,408))}else this.setIdleTimer(b+100)},p.tryConnect=function(m,b,h,c,u){var s=new m(b,h,c),w,v=function(L){clearTimeout(w),u({event:this.event,error:L})},C=b.options.timeouts.realtimeRequestTimeout;w=setTimeout(function(){s.off(["preconnect","disconnected","failed"]),s.dispose(),v.call({event:"disconnected"},new E.default("Timeout waiting for transport to indicate itself viable",5e4,500))},C),s.on(["failed","disconnected"],v),s.on("preconnect",function(){g.default.logAction(g.default.LOG_MINOR,"Transport.tryConnect()","viable transport "+s),clearTimeout(w),s.off(["failed","disconnected"],v),u(null,s)}),s.connect()},p}(d.default);r.default=T},function(n,r,o){(function(i,a){n.exports=a(o(6),o(40),o(25))})(this,function(i){return function(){var a=i,l=a.lib,d=l.Base,g=l.WordArray,S=a.algo,E=S.MD5,y=S.EvpKDF=d.extend({cfg:d.extend({keySize:128/32,hasher:E,iterations:1}),init:function(R){this.cfg=this.cfg.extend(R)},compute:function(R,f){for(var k,T=this.cfg,x=T.hasher.create(),p=g.create(),m=p.words,b=T.keySize,h=T.iterations;m.length<b;){k&&x.update(k),k=x.update(R).finalize(f),x.reset();for(var c=1;c<h;c++)k=x.finalize(k),x.reset();p.concat(k)}return p.sigBytes=b*4,p}});a.EvpKDF=function(R,f,k){return y.create(k).compute(R,f)}}(),i.EvpKDF})},function(n,r,o){(function(i,a){n.exports=a(o(6),o(27))})(this,function(i){i.lib.Cipher||function(a){var l=i,d=l.lib,g=d.Base,S=d.WordArray,E=d.BufferedBlockAlgorithm,y=l.enc;y.Utf8;var R=y.Base64,f=l.algo,k=f.EvpKDF,T=d.Cipher=E.extend({cfg:g.extend(),createEncryptor:function(N,M){return this.create(this._ENC_XFORM_MODE,N,M)},createDecryptor:function(N,M){return this.create(this._DEC_XFORM_MODE,N,M)},init:function(N,M,I){this.cfg=this.cfg.extend(I),this._xformMode=N,this._key=M,this.reset()},reset:function(){E.reset.call(this),this._doReset()},process:function(N){return this._append(N),this._process()},finalize:function(N){N&&this._append(N);var M=this._doFinalize();return M},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(M){return typeof M=="string"?L:w}return function(M){return{encrypt:function(I,P,A){return N(P).encrypt(M,I,P,A)},decrypt:function(I,P,A){return N(P).decrypt(M,I,P,A)}}}}()});d.StreamCipher=T.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1});var x=l.mode={},p=d.BlockCipherMode=g.extend({createEncryptor:function(N,M){return this.Encryptor.create(N,M)},createDecryptor:function(N,M){return this.Decryptor.create(N,M)},init:function(N,M){this._cipher=N,this._iv=M}}),m=x.CBC=function(){var N=p.extend();N.Encryptor=N.extend({processBlock:function(I,P){var A=this._cipher,j=A.blockSize;M.call(this,I,P,j),A.encryptBlock(I,P),this._prevBlock=I.slice(P,P+j)}}),N.Decryptor=N.extend({processBlock:function(I,P){var A=this._cipher,j=A.blockSize,U=I.slice(P,P+j);A.decryptBlock(I,P),M.call(this,I,P,j),this._prevBlock=U}});function M(I,P,A){var j,U=this._iv;U?(j=U,this._iv=a):j=this._prevBlock;for(var z=0;z<A;z++)I[P+z]^=j[z]}return N}(),b=l.pad={},h=b.Pkcs7={pad:function(N,M){for(var I=M*4,P=I-N.sigBytes%I,A=P<<24|P<<16|P<<8|P,j=[],U=0;U<P;U+=4)j.push(A);var z=S.create(j,P);N.concat(z)},unpad:function(N){var M=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=M}};d.BlockCipher=T.extend({cfg:T.cfg.extend({mode:m,padding:h}),reset:function(){var N;T.reset.call(this);var M=this.cfg,I=M.iv,P=M.mode;this._xformMode==this._ENC_XFORM_MODE?N=P.createEncryptor:(N=P.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==N?this._mode.init(this,I&&I.words):(this._mode=N.call(P,this,I&&I.words),this._mode.__creator=N)},_doProcessBlock:function(N,M){this._mode.processBlock(N,M)},_doFinalize:function(){var N,M=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(M.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),M.unpad(N)),N},blockSize:128/32});var c=d.CipherParams=g.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),u=l.format={},s=u.OpenSSL={stringify:function(N){var M,I=N.ciphertext,P=N.salt;return P?M=S.create([1398893684,1701076831]).concat(P).concat(I):M=I,M.toString(R)},parse:function(N){var M,I=R.parse(N),P=I.words;return P[0]==1398893684&&P[1]==1701076831&&(M=S.create(P.slice(2,4)),P.splice(0,4),I.sigBytes-=16),c.create({ciphertext:I,salt:M})}},w=d.SerializableCipher=g.extend({cfg:g.extend({format:s}),encrypt:function(N,M,I,P){P=this.cfg.extend(P);var A=N.createEncryptor(I,P),j=A.finalize(M),U=A.cfg;return c.create({ciphertext:j,key:I,iv:U.iv,algorithm:N,mode:U.mode,padding:U.padding,blockSize:N.blockSize,formatter:P.format})},decrypt:function(N,M,I,P){P=this.cfg.extend(P),M=this._parse(M,P.format);var A=N.createDecryptor(I,P).finalize(M.ciphertext);return A},_parse:function(N,M){return typeof N=="string"?M.parse(N,this):N}}),v=l.kdf={},C=v.OpenSSL={execute:function(N,M,I,P){P||(P=S.random(64/8));var A=k.create({keySize:M+I}).compute(N,P),j=S.create(A.words.slice(M),I*4);return A.sigBytes=M*4,c.create({key:A,iv:j,salt:P})}},L=d.PasswordBasedCipher=w.extend({cfg:w.cfg.extend({kdf:C}),encrypt:function(N,M,I,P){P=this.cfg.extend(P);var A=P.kdf.execute(I,N.keySize,N.ivSize);P.iv=A.iv;var j=w.encrypt.call(this,N,M,A.key,P);return j.mixIn(A),j},decrypt:function(N,M,I,P){P=this.cfg.extend(P),M=this._parse(M,P.format);var A=P.kdf.execute(I,N.keySize,N.ivSize,M.salt);P.iv=A.iv;var j=w.decrypt.call(this,N,M,A.key,P);return j}})}()})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.Request=r.createRequest=void 0;var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(12)),d=i.__importDefault(o(3)),g=i.__importDefault(o(7)),S=o(4),E=i.__importDefault(o(8)),y=i.__importDefault(o(2)),R=i.__importDefault(o(22)),f=a.getGlobalObject(),k=function(){},T=f._ablyjs_jsonp={};T._=function(u){return T["_"+u]||k};var x=1,p="jsonp";function m(u,s,w,v,C,L,N){return L=L||E.default.TIMEOUTS,new h(void 0,u,s,a.copy(w),v,C,L,N)}r.createRequest=m;var b=function(u){i.__extends(s,u);function s(w,v,C){var L=u.call(this,w,v,C)||this;return L.shortName=p,C.stream=!1,L}return s.isAvailable=function(){return d.default.Config.jsonpSupported&&d.default.Config.allowComet},s.prototype.toString=function(){return"JSONPTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},s.prototype.createRequest=function(w,v,C,L,N,M,I){return M=(this===null||this===void 0?void 0:this.timeouts)||M||E.default.TIMEOUTS,m(w,v,C,L,N,M,I)},s}(l.default),h=function(u){i.__extends(s,u);function s(w,v,C,L,N,M,I,P){var A=u.call(this)||this;return w===void 0&&(w=x++),A.id=w,A.uri=v,A.params=L||{},A.params.rnd=a.cheapRandStr(),C&&(C["X-Ably-Version"]&&(A.params.v=C["X-Ably-Version"]),C["X-Ably-Lib"]&&(A.params.lib=C["X-Ably-Lib"])),A.body=N,A.method=P,A.requestMode=M,A.timeouts=I,A.requestComplete=!1,A}return s.prototype.exec=function(){var w=this,v=this.id,C=this.body,L=this.method,N=this.uri,M=this.params;M.callback="_ablyjs_jsonp._("+v+")",M.envelope="jsonp",C&&(M.body=C),L&&L!=="get"&&(M.method=L);var I=this.script=document.createElement("script"),P=N+a.toQueryString(M);I.src=P,I.src.split("/").slice(-1)[0]!==P.split("/").slice(-1)[0]&&y.default.logAction(y.default.LOG_ERROR,"JSONP Request.exec()","Warning: the browser appears to have truncated the script URI. This will likely result in the request failing due to an unparseable body param"),I.async=!0,I.type="text/javascript",I.charset="UTF-8",I.onerror=function(U){w.complete(new S.PartialErrorInfo("JSONP script error (event: "+d.default.Config.inspect(U)+")",null,400))},T["_"+v]=function(U){if(U.statusCode){var z=U.response;if(U.statusCode==204)w.complete(null,null,null,U.statusCode);else if(!z)w.complete(new S.PartialErrorInfo("Invalid server response: no envelope detected",null,500));else if(U.statusCode<400||a.isArray(z))w.complete(null,z,U.headers,U.statusCode);else{var $=z.error||new S.PartialErrorInfo("Error response received from server",null,U.statusCode);w.complete($)}}else w.complete(null,U)};var A=this.requestMode==R.default.REQ_SEND?this.timeouts.httpRequestTimeout:this.timeouts.recvTimeout;this.timer=setTimeout(this.abort.bind(this),A);var j=document.getElementsByTagName("head")[0];j.insertBefore(I,j.firstChild)},s.prototype.complete=function(w,v,C,L){if(C=C||{},!this.requestComplete){this.requestComplete=!0;var N=void 0;v&&(N=typeof v=="string"?"text/plain":"application/json",C["content-type"]=N,this.emit("data",v)),this.emit("complete",w,v,C,!0,L),this.dispose()}},s.prototype.abort=function(){this.dispose()},s.prototype.dispose=function(){var w=this.timer;w&&(clearTimeout(w),this.timer=null);var v=this.script;v.parentNode&&v.parentNode.removeChild(v),delete T[this.id],this.emit("disposed")},s}(g.default);r.Request=h;function c(u){return f.JSONPTransport=b,b.isAvailable()&&(u.supportedTransports[p]=b),b}r.default=c},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(2)),d=i.__importDefault(o(8)),g=i.__importDefault(o(18)),S=i.__importDefault(o(46)),E=i.__importDefault(o(20)),y=i.__importDefault(o(33)),R=i.__importDefault(o(4)),f=i.__importDefault(o(49)),k=i.__importDefault(o(19)),T=i.__importDefault(o(3)),x=i.__importDefault(o(9)),p=i.__importDefault(o(16)),m=i.__importDefault(o(15)),b=function(){},h=function(){function u(s){if(!s){var w="no options provided";throw l.default.logAction(l.default.LOG_ERROR,"Rest()",w),new Error(w)}var v=d.default.objectifyOptions(s);v.log?(l.default.setLog(v.log.level,v.log.handler),l.default.deprecated("The `log` client option","Equivalent functionality is provided by the `logLevel` and `logHandler` client options. Update your client options code of the form `{ log: { level: logLevel, handler: logHandler } }` to instead be `{ logLevel, logHandler }`.")):l.default.setLog(v.logLevel,v.logHandler),l.default.logAction(l.default.LOG_MICRO,"Rest()","initialized with clientOptions "+T.default.Config.inspect(s));var C=this.options=d.default.normaliseOptions(v);if(C.key){var L=C.key.match(/^([^:\s]+):([^:.\s]+)$/);if(!L){var w="invalid key parameter";throw l.default.logAction(l.default.LOG_ERROR,"Rest()",w),new R.default(w,40400,404)}C.keyName=L[1],C.keySecret=L[2]}if("clientId"in C)if(typeof C.clientId=="string"||C.clientId===null){if(C.clientId==="*")throw new R.default('Can’t use "*" as a clientId as that string is reserved. (To change the default token request behaviour to use a wildcard clientId, use {defaultTokenParams: {clientId: "*"}})',40012,400)}else throw new R.default("clientId must be either a string or null",40012,400);l.default.logAction(l.default.LOG_MINOR,"Rest()","started; version = "+d.default.version),this.baseUri=this.authority=function(N){return d.default.getHttpScheme(C)+N+":"+d.default.getPort(C,!1)},this._currentFallback=null,this.serverTimeOffset=null,this.http=new T.default.Http(C),this.auth=new g.default(this,C),this.channels=new c(this),this.push=new S.default(this)}return u.prototype.stats=function(s,w){if(w===void 0)if(typeof s=="function")w=s,s=null;else{if(this.options.promises)return a.promisify(this,"stats",[s]);w=b}var v=a.defaultGetHeaders(this.options),C=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,L=this.http.supportsLinkHeaders?void 0:C;this.options.headers&&a.mixin(v,this.options.headers),new E.default(this,"/stats",v,L,function(N,M,I){for(var P=I?N:JSON.parse(N),A=0;A<P.length;A++)P[A]=f.default.fromValues(P[A]);return P}).get(s,w)},u.prototype.time=function(s,w){var v=this;if(w===void 0){if(typeof s=="function")w=s,s=null;else if(this.options.promises)return a.promisify(this,"time",[s])}var C=w||b,L=a.defaultGetHeaders(this.options);this.options.headers&&a.mixin(L,this.options.headers);var N=function(M){return v.authority(M)+"/time"};this.http.do(k.default.Get,this,N,L,null,s,function(M,I,P,A){if(M){C(M);return}A||(I=JSON.parse(I));var j=I[0];if(!j){C(new R.default("Internal error (unexpected result type from GET /time)",5e4,500));return}v.serverTimeOffset=j-a.now(),C(null,j)})},u.prototype.request=function(s,w,v,C,L,N){var M=this.options.useBinaryProtocol,I=M?T.default.Config.msgpack.encode:JSON.stringify,P=M?T.default.Config.msgpack.decode:JSON.parse,A=M?a.Format.msgpack:a.Format.json,j=this.http.supportsLinkHeaders?void 0:A;v=v||{};var U=s.toLowerCase(),z=U=="get"?a.defaultGetHeaders(this.options,A):a.defaultPostHeaders(this.options,A);if(N===void 0){if(this.options.promises)return a.promisify(this,"request",[s,w,v,C,L]);N=b}typeof C!="string"&&(C=I(C)),this.options.headers&&a.mixin(z,this.options.headers),L&&a.mixin(z,L);var $=new E.default(this,w,z,j,function(W,F,O){return a.ensureArray(O?W:P(W))},!0);if(!a.arrIn(T.default.Http.methods,U))throw new R.default("Unsupported method "+U,40500,405);a.arrIn(T.default.Http.methodsWithBody,U)?$[U](v,C,N):$[U](v,N)},u.prototype.batchPublish=function(s,w){if(w===void 0){if(this.options.promises)return a.promisify(this,"batchPublish",[s]);w=b}var v=w,C,L;a.isArray(s)?(C=s,L=!1):(C=[s],L=!0);var N=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,M=a.defaultPostHeaders(this.options,N);this.options.headers&&a.mixin(M,this.options.headers);var I=a.encodeBody(C,N);m.default.post(this,"/messages",I,M,{newBatchResponse:"true"},null,function(P,A,j,U){if(P){v(P);return}var z=U?A:a.decodeBody(A,N);L?v(null,z[0]):v(null,z)})},u.prototype.batchPresence=function(s,w){if(w===void 0){if(this.options.promises)return a.promisify(this,"batchPresence",[s]);w=b}var v=w,C=this.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,L=a.defaultPostHeaders(this.options,C);this.options.headers&&a.mixin(L,this.options.headers);var N=s.join(",");m.default.get(this,"/presence",L,{newBatchResponse:"true",channels:N},null,function(M,I,P,A){if(M){v(M);return}var j=A?I:a.decodeBody(I,C);v(null,j)})},u.prototype.setLog=function(s){l.default.setLog(s.level,s.handler)},u.Promise=function(s){return s=d.default.objectifyOptions(s),s.promises=!0,new u(s)},u.Callbacks=u,u.Platform=T.default,u.Message=x.default,u.PresenceMessage=p.default,u}(),c=function(){function u(s){this.rest=s,this.all=Object.create(null)}return u.prototype.get=function(s,w){s=String(s);var v=this.all[s];return v?w&&v.setOptions(w):this.all[s]=v=new y.default(this.rest,s,w),v},u.prototype.release=function(s){delete this.all[String(s)]},u}();r.default=h},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return i.enc.Utf8})},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(a){var l=i,d=l.lib,g=d.WordArray,S=d.Hasher,E=l.algo,y=[],R=[];(function(){function T(b){for(var h=a.sqrt(b),c=2;c<=h;c++)if(!(b%c))return!1;return!0}function x(b){return(b-(b|0))*4294967296|0}for(var p=2,m=0;m<64;)T(p)&&(m<8&&(y[m]=x(a.pow(p,1/2))),R[m]=x(a.pow(p,1/3)),m++),p++})();var f=[],k=E.SHA256=S.extend({_doReset:function(){this._hash=new g.init(y.slice(0))},_doProcessBlock:function(T,x){for(var p=this._hash.words,m=p[0],b=p[1],h=p[2],c=p[3],u=p[4],s=p[5],w=p[6],v=p[7],C=0;C<64;C++){if(C<16)f[C]=T[x+C]|0;else{var L=f[C-15],N=(L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3,M=f[C-2],I=(M<<15|M>>>17)^(M<<13|M>>>19)^M>>>10;f[C]=N+f[C-7]+I+f[C-16]}var P=u&s^~u&w,A=m&b^m&h^b&h,j=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),U=(u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25),z=v+U+P+R[C]+f[C],$=j+A;v=w,w=s,s=u,u=c+z|0,c=h,h=b,b=m,m=z+$|0}p[0]=p[0]+m|0,p[1]=p[1]+b|0,p[2]=p[2]+h|0,p[3]=p[3]+c|0,p[4]=p[4]+u|0,p[5]=p[5]+s|0,p[6]=p[6]+w|0,p[7]=p[7]+v|0},_doFinalize:function(){var T=this._data,x=T.words,p=this._nDataBytes*8,m=T.sigBytes*8;return x[m>>>5]|=128<<24-m%32,x[(m+64>>>9<<4)+14]=a.floor(p/4294967296),x[(m+64>>>9<<4)+15]=p,T.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var T=S.clone.call(this);return T._hash=this._hash.clone(),T}});l.SHA256=S._createHelper(k),l.HmacSHA256=S._createHmacHelper(k)}(Math),i.SHA256})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(7)),d=i.__importDefault(o(2)),g=i.__importDefault(o(34)),S=i.__importDefault(o(9)),E=i.__importDefault(o(4)),y=i.__importDefault(o(20)),R=i.__importDefault(o(15)),f=i.__importDefault(o(3));function k(){}var T=9;function x(b){return a.arrEvery(b,function(h){return!h.id})}function p(b){var h=b||{};if(h.cipher){if(!f.default.Crypto)throw new Error("Encryption not enabled; use ably.encryption.js instead");var c=f.default.Crypto.getCipher(h.cipher);h.cipher=c.cipherParams,h.channelCipher=c.cipher}else"cipher"in h&&(h.cipher=void 0,h.channelCipher=null);return h}var m=function(b){i.__extends(h,b);function h(c,u,s){var w=b.call(this)||this;return d.default.logAction(d.default.LOG_MINOR,"Channel()","started; name = "+u),w.rest=c,w.name=u,w.basePath="/channels/"+encodeURIComponent(u),w.presence=new g.default(w),w.channelOptions=p(s),w}return h.prototype.setOptions=function(c){this.channelOptions=p(c)},h.prototype.history=function(c,u){if(d.default.logAction(d.default.LOG_MICRO,"Channel.history()","channel = "+this.name),u===void 0)if(typeof c=="function")u=c,c=null;else{if(this.rest.options.promises)return a.promisify(this,"history",arguments);u=k}this._history(c,u)},h.prototype._history=function(c,u){var s=this.rest,w=s.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,v=this.rest.http.supportsLinkHeaders?void 0:w,C=a.defaultGetHeaders(s.options,w);s.options.headers&&a.mixin(C,s.options.headers);var L=this.channelOptions;new y.default(s,this.basePath+"/messages",C,v,function(N,M,I){return S.default.fromResponseBody(N,L,I?void 0:w)}).get(c,u)},h.prototype.publish=function(){var c=this,u=arguments.length,s=arguments[0],w=arguments[1],v=arguments[u-1],C,L;if(typeof v!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);v=k}if(typeof s=="string"||s===null)C=[S.default.fromValues({name:s,data:w})],L=arguments[2];else if(a.isObject(s))C=[S.default.fromValues(s)],L=arguments[1];else if(a.isArray(s))C=S.default.fromValuesArray(s),L=arguments[1];else throw new E.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);(typeof L!="object"||!L)&&(L={});var N=this.rest,M=N.options,I=M.useBinaryProtocol?a.Format.msgpack:a.Format.json,P=N.options.idempotentRestPublishing,A=a.defaultPostHeaders(N.options,I);if(M.headers&&a.mixin(A,M.headers),P&&x(C)){var j=a.randomString(T);a.arrForEach(C,function(U,z){U.id=j+":"+z.toString()})}S.default.encodeArray(C,this.channelOptions,function(U){if(U){v(U);return}var z=S.default.getMessagesSize(C),$=M.maxMessageSize;if(z>$){v(new E.default("Maximum size of messages that can be published at once exceeded ( was "+z+" bytes; limit is "+$+" bytes)",40009,400));return}c._publish(S.default.serialize(C,I),A,L,v)})},h.prototype._publish=function(c,u,s,w){R.default.post(this.rest,this.basePath+"/messages",c,u,s,null,w)},h.prototype.status=function(c){if(typeof c!="function"&&this.rest.options.promises)return a.promisify(this,"status",[]);var u=this.rest.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,s=a.defaultPostHeaders(this.rest.options,u);R.default.get(this.rest,this.basePath,s,{},u,c||k)},h}(l.default);r.default=m},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(7)),d=i.__importDefault(o(2)),g=i.__importDefault(o(20)),S=i.__importDefault(o(16));function E(){}var y=function(R){i.__extends(f,R);function f(k){var T=R.call(this)||this;return T.channel=k,T.basePath=k.basePath+"/presence",T}return f.prototype.get=function(k,T){if(d.default.logAction(d.default.LOG_MICRO,"Presence.get()","channel = "+this.channel.name),T===void 0)if(typeof k=="function")T=k,k=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"get",arguments);T=E}var x=this.channel.rest,p=x.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,m=this.channel.rest.http.supportsLinkHeaders?void 0:p,b=a.defaultGetHeaders(x.options,p);x.options.headers&&a.mixin(b,x.options.headers);var h=this.channel.channelOptions;new g.default(x,this.basePath,b,m,function(c,u,s){return S.default.fromResponseBody(c,h,s?void 0:p)}).get(k,T)},f.prototype.history=function(k,T){return d.default.logAction(d.default.LOG_MICRO,"Presence.history()","channel = "+this.channel.name),this._history(k,T)},f.prototype._history=function(k,T){if(T===void 0)if(typeof k=="function")T=k,k=null;else{if(this.channel.rest.options.promises)return a.promisify(this,"_history",[k]);T=E}var x=this.channel.rest,p=x.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,m=this.channel.rest.http.supportsLinkHeaders?void 0:p,b=a.defaultGetHeaders(x.options,p);x.options.headers&&a.mixin(b,x.options.headers);var h=this.channel.channelOptions;new g.default(x,this.basePath+"/history",b,m,function(c,u,s){return S.default.fromResponseBody(c,h,s?void 0:p)}).get(k,T)},f}(l.default);r.default=y},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0}),r.TransportParams=void 0;var a=o(0),l=a.__importDefault(o(10)),d=a.__importStar(o(1)),g=a.__importStar(o(52)),S=a.__importStar(o(8)),E=a.__importDefault(o(3)),y=a.__importDefault(o(7)),R=a.__importDefault(o(36)),f=a.__importDefault(o(2)),k=a.__importDefault(o(37)),T=a.__importStar(o(21)),x=a.__importStar(o(4)),p=a.__importDefault(o(18)),m=a.__importDefault(o(9)),b=a.__importDefault(o(24)),h=a.__importDefault(o(53)),c=a.__importDefault(o(26)),u=a.__importDefault(o(14)),s=function(){var W;return typeof E.default.WebStorage!="undefined"&&((W=E.default.WebStorage)===null||W===void 0?void 0:W.localSupported)},w=function(){var W;return typeof E.default.WebStorage!="undefined"&&((W=E.default.WebStorage)===null||W===void 0?void 0:W.sessionSupported)},v=l.default.Action,C=function(){},L="ably-transport-preference",N="ably-connection-recovery";function M(){var W,F;return w()&&((F=(W=E.default.WebStorage)===null||W===void 0?void 0:W.getSession)===null||F===void 0?void 0:F.call(W,N))}function I(W){var F,O;return w()&&((O=(F=E.default.WebStorage)===null||F===void 0?void 0:F.setSession)===null||O===void 0?void 0:O.call(F,N,W))}function P(){var W,F;return w()&&((F=(W=E.default.WebStorage)===null||W===void 0?void 0:W.removeSession)===null||F===void 0?void 0:F.call(W,N))}function A(W,F){return d.arrIndexOf(E.default.Defaults.transportPreferenceOrder,W.shortName)>d.arrIndexOf(E.default.Defaults.transportPreferenceOrder,F.shortName)}function j(W,F,O){var D;if(W.channel!==F.channel||(D=W.action)!==v.PRESENCE&&D!==v.MESSAGE||D!==F.action)return!1;var B=D===v.PRESENCE?"presence":"messages",_=W[B].concat(F[B]),V=m.default.getMessagesSize(_);return V>O||!d.allSame(_,"clientId")||!d.arrEvery(_,function(Y){return!Y.id})?!1:(W[B]=_,!0)}function U(W){try{return JSON.parse(W)}catch(F){return null}}var z=function(){function W(F,O,D,B){this.options=F,this.host=O,this.mode=D,this.connectionKey=B,this.format=F.useBinaryProtocol?d.Format.msgpack:d.Format.json}return W.prototype.getConnectParams=function(F){var O=F?d.copy(F):{},D=this.options;switch(this.mode){case"upgrade":O.upgrade=this.connectionKey;break;case"resume":O.resume=this.connectionKey;break;case"recover":{var B=U(D.recover);B&&(O.recover=B.connectionKey);break}}return D.clientId!==void 0&&(O.clientId=D.clientId),D.echoMessages===!1&&(O.echo="false"),this.format!==void 0&&(O.format=this.format),this.stream!==void 0&&(O.stream=this.stream),this.heartbeats!==void 0&&(O.heartbeats=this.heartbeats),O.v=S.default.protocolVersion,O.agent=(0,S.getAgentString)(this.options),D.transportParams!==void 0&&d.mixin(O,D.transportParams),O},W.prototype.toString=function(){var F="[mode="+this.mode;return this.host&&(F+=",host="+this.host),this.connectionKey&&(F+=",connectionKey="+this.connectionKey),this.format&&(F+=",format="+this.format),F+="]",F},W}();r.TransportParams=z;var $=function(W){a.__extends(F,W);function F(O,D){var B=W.call(this)||this;B.disconnectedRetryCount=0,F.initTransports(),B.realtime=O,B.options=D;var _=D.timeouts,V=_.preferenceConnectTimeout+_.realtimeRequestTimeout;if(B.states={initialized:{state:"initialized",terminal:!1,queueEvents:!0,sendEvents:!1,failState:"disconnected"},connecting:{state:"connecting",terminal:!1,queueEvents:!0,sendEvents:!1,retryDelay:V,failState:"disconnected"},connected:{state:"connected",terminal:!1,queueEvents:!1,sendEvents:!0,failState:"disconnected"},synchronizing:{state:"connected",terminal:!1,queueEvents:!0,sendEvents:!1,forceQueueEvents:!0,failState:"disconnected"},disconnected:{state:"disconnected",terminal:!1,queueEvents:!0,sendEvents:!1,retryDelay:_.disconnectedRetryTimeout,failState:"disconnected"},suspended:{state:"suspended",terminal:!1,queueEvents:!1,sendEvents:!1,retryDelay:_.suspendedRetryTimeout,failState:"suspended"},closing:{state:"closing",terminal:!1,queueEvents:!1,sendEvents:!1,retryDelay:_.realtimeRequestTimeout,failState:"closed"},closed:{state:"closed",terminal:!0,queueEvents:!1,sendEvents:!1,failState:"closed"},failed:{state:"failed",terminal:!0,queueEvents:!1,sendEvents:!1,failState:"failed"}},B.state=B.states.initialized,B.errorReason=null,B.queuedMessages=new R.default,B.msgSerial=0,B.connectionDetails=void 0,B.connectionId=void 0,B.connectionKey=void 0,B.connectionStateTtl=_.connectionStateTtl,B.maxIdleInterval=null,B.transports=d.intersect(D.transports||S.default.defaultTransports,F.supportedTransports),B.baseTransport=d.intersect(S.default.baseTransportOrder,B.transports)[0],B.upgradeTransports=d.intersect(B.transports,S.default.upgradeTransports),B.transportPreference=null,B.httpHosts=S.default.getHosts(D),B.activeProtocol=null,B.proposedTransports=[],B.pendingTransports=[],B.host=null,B.lastAutoReconnectAttempt=null,B.lastActivity=null,B.forceFallbackHost=!1,B.connectCounter=0,f.default.logAction(f.default.LOG_MINOR,"Realtime.ConnectionManager()","started"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","requested transports = ["+(D.transports||S.default.defaultTransports)+"]"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","available transports = ["+B.transports+"]"),f.default.logAction(f.default.LOG_MICRO,"Realtime.ConnectionManager()","http hosts = ["+B.httpHosts+"]"),!B.transports.length){var Y="no requested transports available";throw f.default.logAction(f.default.LOG_ERROR,"realtime.ConnectionManager()",Y),new Error(Y)}var X=E.default.Config.addEventListener;return X&&(w()&&typeof D.recover=="function"&&X("beforeunload",B.persistConnection.bind(B)),D.closeOnUnload===!0&&X("beforeunload",function(){f.default.logAction(f.default.LOG_MAJOR,"Realtime.ConnectionManager()","beforeunload event has triggered the connection to close as closeOnUnload is true"),B.requestState({state:"closing"})}),X("online",function(){B.state==B.states.disconnected||B.state==B.states.suspended?(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager caught browser ‘online’ event","reattempting connection"),B.requestState({state:"connecting"})):B.state==B.states.connecting&&(B.pendingTransports.forEach(function(ne){ne.off()}),B.disconnectAllTransports(),B.startConnect())}),X("offline",function(){B.state==B.states.connected&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager caught browser ‘offline’ event","disconnecting active transport"),B.disconnectAllTransports())})),B}return F.initTransports=function(){(0,h.default)(F),d.arrForEach(E.default.Transports,function(O){O(F)})},F.prototype.createTransportParams=function(O,D){return new z(this.options,O,D,this.connectionKey)},F.prototype.getTransportParams=function(O){var D=this,B=function(_){if(D.connectionKey){_("resume");return}if(typeof D.options.recover=="string"){_("recover");return}var V=D.options.recover,Y=M();if(Y&&typeof V=="function"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Calling clientOptions-provided recover function with last session data"),V(Y,function(X){X?(D.options.recover=Y.recoveryKey,_("recover")):_("clean")});return}_("clean")};B(function(_){var V=D.createTransportParams(null,_);if(_==="recover"){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport recovery mode = recover; recoveryKey = "+D.options.recover);var Y=U(D.options.recover);Y&&(D.msgSerial=Y.msgSerial)}else f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.getTransportParams()","Transport params = "+V.toString());O(V)})},F.prototype.tryATransport=function(O,D,B){var _=this;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","trying "+D),c.default.tryConnect(F.supportedTransports[D],this,this.realtime.auth,O,function(V,Y){var X=_.state;if(X==_.states.closing||X==_.states.closed||X==_.states.failed){Y&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","connection "+X.state+" while we were attempting the transport; closing "+Y),Y.close()),B(!0);return}if(V){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.tryATransport()","transport "+D+" "+V.event+", err: "+V.error.toString()),p.default.isTokenErr(V.error)&&!(_.errorReason&&p.default.isTokenErr(_.errorReason))?(_.errorReason=V.error,_.realtime.auth._forceNewToken(null,null,function(ne){if(ne){_.actOnErrorFromAuthorize(ne);return}_.tryATransport(O,D,B)})):V.event==="failed"?(_.notifyState({state:"failed",error:V.error}),B(!0)):V.event==="disconnected"&&((0,T.isRetriable)(V.error)?B(!1):(_.notifyState({state:_.states.connecting.failState,error:V.error}),B(!0)));return}f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.tryATransport()","viable transport "+D+"; setting pending"),_.setTransportPending(Y,O),B(null,Y)})},F.prototype.setTransportPending=function(O,D){var B=this,_=D.mode;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setTransportPending()","transport = "+O+"; mode = "+_),d.arrDeleteValue(this.proposedTransports,O),this.pendingTransports.push(O);var V=E.default.Defaults.transportPreferenceOrder[E.default.Defaults.transportPreferenceOrder.length-1];O.once("connected",function(X,ne,re){_=="upgrade"&&B.activeProtocol?O.shortName!==V&&d.arrIn(B.getUpgradePossibilities(),V)&&B.activeProtocol?setTimeout(function(){B.scheduleTransportActivation(X,O,ne,re)},B.options.timeouts.parallelUpgradeDelay):B.scheduleTransportActivation(X,O,ne,re):(B.activateTransport(X,O,ne,re),E.default.Config.nextTick(function(){B.connectImpl(D)})),_==="recover"&&B.options.recover&&(B.options.recover=null,B.unpersistConnection())});var Y=this;O.on(["disconnected","closed","failed"],function(X){Y.deactivateTransport(O,this.event,X)}),this.emit("transport.pending",O)},F.prototype.scheduleTransportActivation=function(O,D,B,_){var V=this,Y=this.activeProtocol&&this.activeProtocol.getTransport(),X=function(){D.disconnect(),d.arrDeleteValue(V.pendingTransports,D)};if(this.state!==this.states.connected&&this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Current connection state ("+this.state.state+(this.state===this.states.synchronizing?", but with an upgrade already in progress":"")+") is not valid to upgrade in; abandoning upgrade to "+D.shortName),X();return}if(Y&&!A(D,Y)){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+D.shortName+" is no better than current active transport "+Y.shortName+" - abandoning upgrade"),X();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Scheduling transport upgrade; transport = "+D);var ne=null;if(!D.isConnected){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Proposed transport "+D.shortName+"is no longer connected; abandoning upgrade"),X();return}if(this.state===this.states.connected)f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Currently connected, so temporarily pausing events until the upgrade is complete"),this.state=this.states.synchronizing,ne=this.activeProtocol;else if(this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Current connection state ("+this.state.state+(this.state===this.states.synchronizing?", but with an upgrade already in progress":"")+") is not valid to upgrade in; abandoning upgrade to "+D.shortName),X();return}f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Syncing transport; transport = "+D);var re=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Activating transport; transport = "+D),D.send(l.default.fromValues({action:v.ACTIVATE})),V.activateTransport(O,D,B,_),V.state===V.states.synchronizing?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, sending queued messages on upgraded transport; transport = "+D),V.state=V.states.connected):f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.scheduleTransportActivation()","Pre-upgrade protocol idle, but state is now "+V.state.state+", so leaving unchanged"),V.state.sendEvents&&V.sendQueuedMessages()};ne?ne.onceIdle(re):re()},F.prototype.activateTransport=function(O,D,B,_){var V=this;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","transport = "+D),O&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","error = "+O),B&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.activateTransport()","connectionId = "+B),_&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.activateTransport()","connectionDetails = "+JSON.stringify(_)),this.persistTransportPreference(D);var Y=this.state,X=this.states.connected.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","current state = "+Y.state),Y.state==this.states.closing.state||Y.state==this.states.closed.state||Y.state==this.states.failed.state)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Disconnecting transport and abandoning"),D.disconnect(),!1;if(d.arrDeleteValue(this.pendingTransports,D),!D.isConnected)return f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.activateTransport()","Declining to activate transport "+D+" since it appears to no longer be connected"),!1;var ne=this.activeProtocol;this.activeProtocol=new g.default(D),this.host=D.params.host;var re=_.connectionKey;if(re&&this.connectionKey!=re&&this.setConnection(B,_,!!O),this.onConnectionDetailsUpdate(_,D),E.default.Config.nextTick(function(){D.on("connected",function(Z,ye,De){V.onConnectionDetailsUpdate(De,D),V.emit("update",new k.default(X,X,null,Z))})}),Y.state===this.states.connected.state?O&&(this.errorReason=this.realtime.connection.errorReason=O,this.emit("update",new k.default(X,X,null,O))):(this.notifyState({state:"connected",error:O}),this.errorReason=this.realtime.connection.errorReason=O||null),this.emit("transport.active",D),ne)if(ne.messageQueue.count()>0&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Previous active protocol (for transport "+ne.transport.shortName+", new one is "+D.shortName+") finishing with "+ne.messageQueue.count()+" messages still pending"),ne.transport===D){var ce="Assumption violated: activating a transport that was also the transport for the previous active protocol; transport = "+D.shortName+"; stack = "+new Error().stack;f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()",ce)}else ne.finish();return d.safeArrForEach(this.pendingTransports,function(Z){if(Z===D){var ye="Assumption violated: activating a transport that is still marked as a pending transport; transport = "+D.shortName+"; stack = "+new Error().stack;f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()",ye),d.arrDeleteValue(V.pendingTransports,D)}else Z.disconnect()}),d.safeArrForEach(this.proposedTransports,function(Z){Z===D?(f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.activateTransport()","Assumption violated: activating a transport that is still marked as a proposed transport; transport = "+D.shortName+"; stack = "+new Error().stack),d.arrDeleteValue(V.proposedTransports,D)):Z.dispose()}),!0},F.prototype.deactivateTransport=function(O,D,B){var _=this.activeProtocol,V=_&&_.getTransport()===O,Y=d.arrDeleteValue(this.pendingTransports,O),X=d.arrDeleteValue(this.proposedTransports,O),ne=this.noTransportsScheduledForActivation();if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.deactivateTransport()","transport = "+O),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.deactivateTransport()","state = "+D+(V?"; was active":Y?"; was pending":X?"; was proposed":"")+(ne?"":"; another transport is scheduled for activation")),B&&B.message&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","reason = "+B.message),V&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","Getting, clearing, and requeuing "+this.activeProtocol.messageQueue.count()+" pending messages"),this.queuePendingMessages(_.getPendingMessages()),E.default.Config.nextTick(function(){_.clearPendingMessages()}),this.activeProtocol=this.host=null),this.emit("transport.inactive",O),V&&ne||V&&D==="failed"||D==="closed"||_===null&&Y&&this.pendingTransports.length===0){if(D==="disconnected"&&B&&B.statusCode>500&&this.httpHosts.length>1){this.unpersistTransportPreference(),this.forceFallbackHost=!0,this.notifyState({state:D,error:B,retryImmediately:!0});return}var re=D==="failed"&&p.default.isTokenErr(B)?"disconnected":D;this.notifyState({state:re,error:B});return}V&&D==="disconnected"&&this.state!==this.states.synchronizing&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.deactivateTransport()","wasActive but another transport is connected and scheduled for activation, so going into the connecting state until it activates"),this.startSuspendTimer(),this.startTransitionTimer(this.states.connecting),this.notifyState({state:"connecting",error:B}))},F.prototype.noTransportsScheduledForActivation=function(){return d.isEmpty(this.pendingTransports)||this.pendingTransports.every(function(O){return!O.isConnected})},F.prototype.setConnection=function(O,D,B){var _=this.connectionId,V=_&&_!==O,Y=!_&&B;(V||Y)&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setConnection()","Resetting msgSerial"),this.msgSerial=0,this.queuedMessages.resetSendAttempted()),this.connectionId!==O&&f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.setConnection()","New connectionId; reattaching any attached channels"),this.realtime.connection.id=this.connectionId=O,this.realtime.connection.key=this.connectionKey=D.connectionKey},F.prototype.clearConnection=function(){this.realtime.connection.id=this.connectionId=void 0,this.realtime.connection.key=this.connectionKey=void 0,this.msgSerial=0,this.unpersistConnection()},F.prototype.createRecoveryKey=function(){return this.connectionKey?JSON.stringify({connectionKey:this.connectionKey,msgSerial:this.msgSerial,channelSerials:this.realtime.channels.channelSerials()}):null},F.prototype.checkConnectionStateFreshness=function(){if(!(!this.lastActivity||!this.connectionId)){var O=d.now()-this.lastActivity;O>this.connectionStateTtl+this.maxIdleInterval&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.checkConnectionStateFreshness()","Last known activity from realtime was "+O+"ms ago; discarding connection state"),this.clearConnection(),this.states.connecting.failState="suspended")}},F.prototype.persistConnection=function(){if(w()){var O=this.createRecoveryKey();O&&I({recoveryKey:O,disconnectedAt:d.now(),location:i.location,clientId:this.realtime.auth.clientId})}},F.prototype.unpersistConnection=function(){P()},F.prototype.getError=function(){return this.errorReason||this.getStateError()},F.prototype.getStateError=function(){var O,D;return(D=(O=T.default)[this.state.state])===null||D===void 0?void 0:D.call(O)},F.prototype.activeState=function(){return this.state.queueEvents||this.state.sendEvents},F.prototype.enactStateChange=function(O){var D=O.current==="failed"?f.default.LOG_ERROR:f.default.LOG_MAJOR;f.default.logAction(D,"Connection state",O.current+(O.reason?"; reason: "+O.reason:"")),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.enactStateChange","setting new state: "+O.current+"; reason = "+(O.reason&&O.reason.message));var B=this.state=this.states[O.current];O.reason&&(this.errorReason=O.reason,this.realtime.connection.errorReason=O.reason),(B.terminal||B.state==="suspended")&&this.clearConnection(),this.emit("connectionstate",O)},F.prototype.startTransitionTimer=function(O){var D=this;f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startTransitionTimer()","transitionState: "+O.state),this.transitionTimer&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startTransitionTimer()","clearing already-running timer"),clearTimeout(this.transitionTimer)),this.transitionTimer=setTimeout(function(){D.transitionTimer&&(D.transitionTimer=null,f.default.logAction(f.default.LOG_MINOR,"ConnectionManager "+O.state+" timer expired","requesting new state: "+O.failState),D.notifyState({state:O.failState}))},O.retryDelay)},F.prototype.cancelTransitionTimer=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.cancelTransitionTimer()",""),this.transitionTimer&&(clearTimeout(this.transitionTimer),this.transitionTimer=null)},F.prototype.startSuspendTimer=function(){var O=this;this.suspendTimer||(this.suspendTimer=setTimeout(function(){O.suspendTimer&&(O.suspendTimer=null,f.default.logAction(f.default.LOG_MINOR,"ConnectionManager suspend timer expired","requesting new state: suspended"),O.states.connecting.failState="suspended",O.notifyState({state:"suspended"}))},this.connectionStateTtl))},F.prototype.checkSuspendTimer=function(O){O!=="disconnected"&&O!=="suspended"&&O!=="connecting"&&this.cancelSuspendTimer()},F.prototype.cancelSuspendTimer=function(){this.states.connecting.failState="disconnected",this.suspendTimer&&(clearTimeout(this.suspendTimer),this.suspendTimer=null)},F.prototype.startRetryTimer=function(O){var D=this;this.retryTimer=setTimeout(function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager retry timer expired","retrying"),D.retryTimer=null,D.requestState({state:"connecting"})},O)},F.prototype.cancelRetryTimer=function(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)},F.prototype.notifyState=function(O){var D=this,B,_,V=O.state,Y=V==="disconnected"&&(this.state===this.states.connected||this.state===this.states.synchronizing||O.retryImmediately||this.state===this.states.connecting&&O.error&&p.default.isTokenErr(O.error)&&!(this.errorReason&&p.default.isTokenErr(this.errorReason)));if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.notifyState()","new state: "+V+(Y?"; will retry connection immediately":"")),V!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(O.state),(V==="suspended"||V==="connected")&&(this.disconnectedRetryCount=0),!this.state.terminal)){var X=this.states[O.state],ne=X.retryDelay;X.state==="disconnected"&&(this.disconnectedRetryCount++,ne=d.getRetryTime(X.retryDelay,this.disconnectedRetryCount));var re=new k.default(this.state.state,X.state,ne,O.error||((_=(B=T.default)[X.state])===null||_===void 0?void 0:_.call(B)));if(Y){var ce=function(){D.state===D.states.disconnected&&(D.lastAutoReconnectAttempt=d.now(),D.requestState({state:"connecting"}))},Z=this.lastAutoReconnectAttempt&&d.now()-this.lastAutoReconnectAttempt+1;Z&&Z<1e3?(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.notifyState()","Last reconnect attempt was only "+Z+"ms ago, waiting another "+(1e3-Z)+"ms before trying again"),setTimeout(ce,1e3-Z)):E.default.Config.nextTick(ce)}else(V==="disconnected"||V==="suspended")&&this.startRetryTimer(ne);(V==="disconnected"&&!Y||V==="suspended"||X.terminal)&&E.default.Config.nextTick(function(){D.disconnectAllTransports()}),V=="connected"&&!this.activeProtocol&&f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.notifyState()","Broken invariant: attempted to go into connected state, but there is no active protocol"),this.enactStateChange(re),this.state.sendEvents?this.sendQueuedMessages():this.state.queueEvents||(this.realtime.channels.propogateConnectionInterruption(V,re.reason),this.failQueuedMessages(re.reason))}},F.prototype.requestState=function(O){var D=this,B,_,V=O.state;if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.requestState()","requested state: "+V+"; current state: "+this.state.state),V!=this.state.state&&(this.cancelTransitionTimer(),this.cancelRetryTimer(),this.checkSuspendTimer(V),!(V=="connecting"&&this.state.state=="connected")&&!(V=="closing"&&this.state.state=="closed"))){var Y=this.states[V],X=new k.default(this.state.state,Y.state,null,O.error||((_=(B=T.default)[Y.state])===null||_===void 0?void 0:_.call(B)));this.enactStateChange(X),V=="connecting"&&E.default.Config.nextTick(function(){D.startConnect()}),V=="closing"&&this.closeImpl()}},F.prototype.startConnect=function(){var O=this;if(this.state!==this.states.connecting){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startConnect()","Must be in connecting state to connect, but was "+this.state.state);return}var D=this.realtime.auth,B=++this.connectCounter,_=function(){O.checkConnectionStateFreshness(),O.getTransportParams(function(Y){if(Y.mode==="recover"&&Y.options.recover){var X=U(Y.options.recover);X&&O.realtime.channels.recoverChannels(X.channelSerials)}B===O.connectCounter&&O.connectImpl(Y,B)})};if(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.startConnect()","starting connection"),this.startSuspendTimer(),this.startTransitionTimer(this.states.connecting),D.method==="basic")_();else{var V=function(Y){B===O.connectCounter&&(Y?O.actOnErrorFromAuthorize(Y):_())};this.errorReason&&p.default.isTokenErr(this.errorReason)?D._forceNewToken(null,null,V):D._ensureValidAuthCredentials(!1,V)}},F.prototype.connectImpl=function(O,D){var B=this.state.state;B!==this.states.connecting.state&&B!==this.states.connected.state?f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectImpl()","Must be in connecting state to connect (or connected to upgrade), but was "+B):this.pendingTransports.length?f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectImpl()","Transports "+this.pendingTransports[0].toString()+" currently pending; taking no action"):B==this.states.connected.state?this.upgradeIfNeeded(O):this.transports.length>1&&this.getTransportPreference()?this.connectPreference(O,D):this.connectBase(O,D)},F.prototype.connectPreference=function(O,D){var B=this,_=this.getTransportPreference(),V=!1;d.arrIn(this.transports,_)||(this.unpersistTransportPreference(),this.connectImpl(O,D)),f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectPreference()","Trying to connect with stored transport preference "+_);var Y=setTimeout(function(){V=!0,B.state.state!==B.states.connected.state&&(f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectPreference()","Shortcircuit connection attempt with "+_+" failed; clearing preference and trying from scratch"),B.disconnectAllTransports(),B.unpersistTransportPreference()),B.connectImpl(O,D)},this.options.timeouts.preferenceConnectTimeout);O.host=this.httpHosts[0],this.tryATransport(O,_,function(X,ne){clearTimeout(Y),V&&ne?(ne.off(),ne.disconnect(),d.arrDeleteValue(B.pendingTransports,ne)):!ne&&!X&&(B.unpersistTransportPreference(),B.connectImpl(O,D))})},F.prototype.connectBase=function(O,D){var B=this,_=function(re){B.notifyState({state:B.states.connecting.failState,error:re})},V=this.httpHosts.slice(),Y=function(re,ce){D===B.connectCounter&&!ce&&!re&&ne()};f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.connectBase()","Trying to connect with base transport "+this.baseTransport);var X=V.shift();if(!X){_(new x.default("Unable to connect (no available host)",80003,404));return}O.host=X;var ne=function(){if(!V.length){_(new x.default("Unable to connect (and no more fallback hosts to try)",80003,404));return}if(!B.realtime.http.checkConnectivity){_(new x.PartialErrorInfo("Internal error: Http.checkConnectivity not set",null,500));return}B.realtime.http.checkConnectivity(function(re,ce){if(D===B.connectCounter){if(re){_(re);return}if(!ce){_(new x.default("Unable to connect (network unreachable)",80003,404));return}O.host=d.arrPopRandomElement(V),B.tryATransport(O,B.baseTransport,Y)}})};if(this.forceFallbackHost&&V.length){this.forceFallbackHost=!1,ne();return}this.tryATransport(O,this.baseTransport,Y)},F.prototype.getUpgradePossibilities=function(){var O=this.activeProtocol.getTransport().shortName,D=d.arrIndexOf(this.upgradeTransports,O);return this.upgradeTransports.slice(D+1)},F.prototype.upgradeIfNeeded=function(O){var D=this,B=this.getUpgradePossibilities();f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.upgradeIfNeeded()","upgrade possibilities: "+E.default.Config.inspect(B)),B.length&&d.arrForEach(B,function(_){var V=D.createTransportParams(O.host,"upgrade");D.tryATransport(V,_,C)})},F.prototype.closeImpl=function(){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.closeImpl()","closing connection"),this.cancelSuspendTimer(),this.startTransitionTimer(this.states.closing),d.safeArrForEach(this.pendingTransports,function(O){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Closing pending transport: "+O),O&&O.close()}),d.safeArrForEach(this.proposedTransports,function(O){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Disposing of proposed transport: "+O),O&&O.dispose()}),this.activeProtocol&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.closeImpl()","Closing active transport: "+this.activeProtocol.getTransport()),this.activeProtocol.getTransport().close()),this.notifyState({state:"closed"})},F.prototype.onAuthUpdated=function(O,D){var B=this,_;switch(this.state.state){case"connected":{if(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Sending AUTH message on active transport"),(this.pendingTransports.length||this.proposedTransports.length)&&this.state!==this.states.synchronizing){this.disconnectAllTransports(!0);var V=this.activeProtocol.getTransport().params;E.default.Config.nextTick(function(){B.state.state==="connected"&&B.upgradeIfNeeded(V)})}var Y=(_=this.activeProtocol)===null||_===void 0?void 0:_.getTransport();Y&&Y.onAuthUpdated&&Y.onAuthUpdated(O);var X=l.default.fromValues({action:v.AUTH,auth:{accessToken:O.token}});this.send(X);var ne=function(){B.off(re),D(null,O)},re=function(Z){Z.current==="failed"&&(B.off(ne),B.off(re),D(Z.reason||B.getStateError()))};this.once("connectiondetails",ne),this.on("connectionstate",re);break}case"connecting":f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Aborting current connection attempts in order to start again with the new auth details"),this.disconnectAllTransports();default:{f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onAuthUpdated()","Connection state is "+this.state.state+"; waiting until either connected or failed");var ce=function(Z){switch(Z.current){case"connected":B.off(ce),D(null,O);break;case"failed":case"closed":case"suspended":B.off(ce),D(Z.reason||B.getStateError());break}};this.on("connectionstate",ce),this.state.state==="connecting"?this.startConnect():this.requestState({state:"connecting"})}}},F.prototype.disconnectAllTransports=function(O){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.disconnectAllTransports()","Disconnecting all transports"+(O?" except the active transport":"")),this.connectCounter++,d.safeArrForEach(this.pendingTransports,function(D){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting pending transport: "+D),D&&D.disconnect()}),this.pendingTransports=[],d.safeArrForEach(this.proposedTransports,function(D){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disposing of proposed transport: "+D),D&&D.dispose()}),this.proposedTransports=[],this.activeProtocol&&!O&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.disconnectAllTransports()","Disconnecting active transport: "+this.activeProtocol.getTransport()),this.activeProtocol.getTransport().disconnect())},F.prototype.send=function(O,D,B){B=B||C;var _=this.state;if(_.sendEvents){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","sending event"),this.sendImpl(new g.PendingMessage(O,B));return}var V=D&&_.queueEvents||_.forceQueueEvents;if(!V){var Y="rejecting event, queueEvent was "+D+", state was "+_.state;f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()",Y),B(this.errorReason||new x.default(Y,9e4,400));return}f.default.shouldLog(f.default.LOG_MICRO)&&f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.send()","queueing msg; "+l.default.stringify(O)),this.queue(O,B)},F.prototype.sendImpl=function(O){var D=O.message;O.ackRequired&&!O.sendAttempted&&(D.msgSerial=this.msgSerial++);try{this.activeProtocol.send(O)}catch(B){f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.sendImpl()","Unexpected exception in transport.send(): "+B.stack)}},F.prototype.queue=function(O,D){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.queue()","queueing event");var B=this.queuedMessages.last(),_=this.options.maxMessageSize;B&&!B.sendAttempted&&j(B.message,O,_)?(B.merged||(B.callback=b.default.create([B.callback]),B.merged=!0),B.callback.push(D)):this.queuedMessages.push(new g.PendingMessage(O,D))},F.prototype.sendQueuedMessages=function(){f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.sendQueuedMessages()","sending "+this.queuedMessages.count()+" queued messages");for(var O;O=this.queuedMessages.shift();)this.sendImpl(O)},F.prototype.queuePendingMessages=function(O){O&&O.length&&(f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.queuePendingMessages()","queueing "+O.length+" pending messages"),this.queuedMessages.prepend(O))},F.prototype.failQueuedMessages=function(O){var D=this.queuedMessages.count();D>0&&(f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.failQueuedMessages()","failing "+D+" queued messages, err = "+d.inspectError(O)),this.queuedMessages.completeAllMessages(O))},F.prototype.onChannelMessage=function(O,D){var B=this.activeProtocol&&D===this.activeProtocol.getTransport(),_=d.arrIn(this.pendingTransports,D)&&this.state==this.states.synchronizing;B||_?this.realtime.channels.onChannelMessage(O):d.arrIndexOf([v.ACK,v.NACK,v.ERROR],O.action)>-1?this.realtime.channels.onChannelMessage(O):f.default.logAction(f.default.LOG_MICRO,"ConnectionManager.onChannelMessage()","received message "+JSON.stringify(O)+"on defunct transport; discarding")},F.prototype.ping=function(O,D){var B=this;if(O){f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.ping()","transport = "+O);var _=function(){O.off("heartbeat",X),D(new x.default("Timeout waiting for heartbeat response",5e4,500))},V=d.now(),Y=d.cheapRandStr(),X=function(ye){if(ye===Y){O.off("heartbeat",X),clearTimeout(ne);var De=d.now()-V;D(null,De)}},ne=setTimeout(_,this.options.timeouts.realtimeRequestTimeout);O.on("heartbeat",X),O.ping(Y);return}if(this.state.state!=="connected"){D(new x.default("Unable to ping service; not connected",4e4,400));return}var re=!1,ce=function(ye,De){B.off("transport.active",Z),re||(re=!0,D(ye,De))},Z=function(){re||(re=!0,E.default.Config.nextTick(function(){B.ping(null,D)}))};this.on("transport.active",Z),this.ping(this.activeProtocol.getTransport(),ce)},F.prototype.abort=function(O){this.activeProtocol.getTransport().fail(O)},F.prototype.registerProposedTransport=function(O){this.proposedTransports.push(O)},F.prototype.getTransportPreference=function(){var O,D;return this.transportPreference||s()&&((D=(O=E.default.WebStorage)===null||O===void 0?void 0:O.get)===null||D===void 0?void 0:D.call(O,L))},F.prototype.persistTransportPreference=function(O){var D,B;d.arrIn(S.default.upgradeTransports,O.shortName)&&(this.transportPreference=O.shortName,s()&&((B=(D=E.default.WebStorage)===null||D===void 0?void 0:D.set)===null||B===void 0||B.call(D,L,O.shortName)))},F.prototype.unpersistTransportPreference=function(){var O,D;this.transportPreference=null,s()&&((D=(O=E.default.WebStorage)===null||O===void 0?void 0:O.remove)===null||D===void 0||D.call(O,L))},F.prototype.actOnErrorFromAuthorize=function(O){if(O.code===40171)this.notifyState({state:"failed",error:O});else if(O.code===40102)this.notifyState({state:"failed",error:O});else if(O.statusCode===u.default.Forbidden){var D="Client configured authentication provider returned 403; failing the connection";f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.actOnErrorFromAuthorize()",D),this.notifyState({state:"failed",error:new x.default(D,80019,403,O)})}else{var D="Client configured authentication provider request failed";f.default.logAction(f.default.LOG_MINOR,"ConnectionManager.actOnErrorFromAuthorize",D),this.notifyState({state:this.state.failState,error:new x.default(D,80019,401,O)})}},F.prototype.onConnectionDetailsUpdate=function(O,D){if(O){this.connectionDetails=O,O.maxMessageSize&&(this.options.maxMessageSize=O.maxMessageSize);var B=O.clientId;if(B){var _=this.realtime.auth._uncheckedSetClientId(B);if(_){f.default.logAction(f.default.LOG_ERROR,"ConnectionManager.onConnectionDetailsUpdate()",_.message),D.fail(_);return}}var V=O.connectionStateTtl;V&&(this.connectionStateTtl=V),this.maxIdleInterval=O.maxIdleInterval,this.emit("connectiondetails",O)}},F.supportedTransports={},F}(y.default);r.default=$}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(7)),l=i.__importDefault(o(2)),d=function(g){i.__extends(S,g);function S(){var E=g.call(this)||this;return E.messages=[],E}return S.prototype.count=function(){return this.messages.length},S.prototype.push=function(E){this.messages.push(E)},S.prototype.shift=function(){return this.messages.shift()},S.prototype.last=function(){return this.messages[this.messages.length-1]},S.prototype.copyAll=function(){return this.messages.slice()},S.prototype.append=function(E){this.messages.push.apply(this.messages,E)},S.prototype.prepend=function(E){this.messages.unshift.apply(this.messages,E)},S.prototype.completeMessages=function(E,y,R){l.default.logAction(l.default.LOG_MICRO,"MessageQueue.completeMessages()","serial = "+E+"; count = "+y),R=R||null;var f=this.messages;if(f.length===0)throw new Error("MessageQueue.completeMessages(): completeMessages called on any empty MessageQueue");var k=f[0];if(k){var T=k.message.msgSerial,x=E+y;if(x>T)for(var p=f.splice(0,x-T),m=0,b=p;m<b.length;m++){var h=b[m];h.callback(R)}f.length==0&&this.emit("idle")}},S.prototype.completeAllMessages=function(E){this.completeMessages(0,Number.MAX_SAFE_INTEGER||Number.MAX_VALUE,E)},S.prototype.resetSendAttempted=function(){for(var E=0,y=this.messages;E<y.length;E++){var R=y[E];R.sendAttempted=!1}},S.prototype.clear=function(){l.default.logAction(l.default.LOG_MICRO,"MessageQueue.clear()","clearing "+this.messages.length+" messages"),this.messages=[],this.emit("idle")},S}(a.default);r.default=d},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function a(l,d,g,S){this.previous=l,this.current=d,g&&(this.retryIn=g),S&&(this.reason=S)}return a}();r.default=i},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(10)),l=i.__importDefault(o(7)),d=i.__importStar(o(1)),g=i.__importDefault(o(33)),S=i.__importDefault(o(2)),E=i.__importDefault(o(54)),y=i.__importDefault(o(9)),R=i.__importDefault(o(39)),f=i.__importStar(o(4)),k=i.__importDefault(o(16)),T=i.__importDefault(o(21)),x=a.default.Action,p=function(){};function m(c){if(c&&"params"in c&&!d.isObject(c.params))return new f.default("options.params must be an object",4e4,400);if(c&&"modes"in c){if(!d.isArray(c.modes))return new f.default("options.modes must be an array",4e4,400);for(var u=0;u<c.modes.length;u++){var s=c.modes[u];if(!s||typeof s!="string"||!d.arrIn(a.default.channelModes,String.prototype.toUpperCase.call(s)))return new f.default("Invalid channel mode: "+s,4e4,400)}}}var b=function(c){i.__extends(u,c);function u(s,w,v){var C=c.call(this,s,w,v)||this;return C.retryCount=0,C.history=function(L,N){if(S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.history()","channel = "+this.name),N===void 0)if(typeof L=="function")N=L,L=null;else{if(this.rest.options.promises)return d.promisify(this,"history",arguments);N=p}if(L&&L.untilAttach){if(this.state!=="attached"){N(new f.default("option untilAttach requires the channel to be attached",4e4,400));return}if(!this.properties.attachSerial){N(new f.default("untilAttach was specified and channel is attached, but attachSerial is not defined",4e4,400));return}delete L.untilAttach,L.from_serial=this.properties.attachSerial}g.default.prototype._history.call(this,L,N)},C.whenState=function(L,N){return l.default.prototype.whenState.call(C,L,C.state,N)},S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel()","started; name = "+w),C.realtime=s,C.presence=new E.default(C),C.connectionManager=s.connection.connectionManager,C.state="initialized",C.subscriptions=new l.default,C.syncChannelSerial=void 0,C.properties={attachSerial:void 0,channelSerial:void 0},C.setOptions(v),C.errorReason=null,C._requestedFlags=null,C._mode=null,C._attachResume=!1,C._decodingContext={channelOptions:C.channelOptions,plugins:s.options.plugins||{},baseEncodedPreviousPayload:void 0},C._lastPayload={messageId:null,protocolMessageChannelSerial:null,decodeFailureRecoveryInProgress:null},C._allChannelChanges=new l.default,C}return u.prototype.invalidStateError=function(){return new f.default("Channel operation failed as channel state is "+this.state,90001,400,this.errorReason||void 0)},u.processListenerArgs=function(s){return s=Array.prototype.slice.call(s),typeof s[0]=="function"&&s.unshift(null),s[s.length-1]==null&&s.pop(),s},u.prototype.setOptions=function(s,w){var v=this.channelOptions;if(!w&&this.rest.options.promises)return d.promisify(this,"setOptions",arguments);var C=w||function(N){N&&S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.setOptions()","Set options failed: "+N.toString())},L=m(s);if(L){C(L);return}g.default.prototype.setOptions.call(this,s),this._decodingContext&&(this._decodingContext.channelOptions=this.channelOptions),this._shouldReattachToSetOptions(s,v)?(this.attachImpl(),this._allChannelChanges.once(["attached","update","detached","failed"],function(N){switch(this.event){case"update":case"attached":C==null||C(null);return;default:C==null||C(N.reason);return}})):C()},u.prototype._shouldReattachToSetOptions=function(s,w){if(!(this.state==="attached"||this.state==="attaching"))return!1;if(s!=null&&s.params){var v=h(s.params),C=h(w.params);if(Object.keys(v).length!==Object.keys(C).length||!d.shallowEquals(C,v))return!0}return!!(s!=null&&s.modes&&(!w.modes||!d.arrEquals(s.modes,w.modes)))},u.prototype.publish=function(){for(var s=this,w=[],v=0;v<arguments.length;v++)w[v]=arguments[v];var C=w[0],L=w.length,N=w[L-1];if(typeof N!="function"){if(this.realtime.options.promises)return d.promisify(this,"publish",arguments);N=p,++L}if(!this.connectionManager.activeState()){N(this.connectionManager.getError());return}if(L==2)if(d.isObject(C))C=[y.default.fromValues(C)];else if(d.isArray(C))C=y.default.fromValuesArray(C);else throw new f.default("The single-argument form of publish() expects a message object or an array of message objects",40013,400);else C=[y.default.fromValues({name:w[0],data:w[1]})];var M=this.realtime.options.maxMessageSize;y.default.encodeArray(C,this.channelOptions,function(I){if(I){N(I);return}var P=y.default.getMessagesSize(C);if(P>M){N(new f.default("Maximum size of messages that can be published at once exceeded ( was "+P+" bytes; limit is "+M+" bytes)",40009,400));return}s.__publish(C,N)})},u.prototype.__publish=function(s,w){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.publish()","message count = "+s.length);var v=this.state;switch(v){case"failed":case"suspended":w(f.default.fromValues(this.invalidStateError()));break;default:{S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.publish()","sending message; channel state is "+v);var C=new a.default;C.action=x.MESSAGE,C.channel=this.name,C.messages=s,this.sendMessage(C,w);break}}},u.prototype.onEvent=function(s){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.onEvent()","received message");for(var w=this.subscriptions,v=0;v<s.length;v++){var C=s[v];w.emit(C.name,C)}},u.prototype.attach=function(s,w){var v;if(typeof s=="function"?(w=s,v=null):v=s,!w){if(this.realtime.options.promises)return d.promisify(this,"attach",arguments);w=function(C){C&&S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.attach()","Channel attach failed: "+C.toString())}}if(v)S.default.deprecated("The ability to pass an array of channel mode flags as the first argument of `RealtimeChannel.attach()`","To set channel mode flags, populate the `modes` property of the channel options object that you pass to `Channels.get()` or `RealtimeChannel.setOptions()`."),this._requestedFlags=v;else if(this.state==="attached"){w(null,null);return}this._attach(!1,null,w)},u.prototype._attach=function(s,w,v){v||(v=function(L){L&&S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel._attach()","Channel attach failed: "+L.toString())});var C=this.connectionManager;if(!C.activeState()){v(C.getError());return}(this.state!=="attaching"||s)&&this.requestState("attaching",w),this.once(function(L){switch(this.event){case"attached":v==null||v(null,L);break;case"detached":case"suspended":case"failed":v==null||v(L.reason||C.getError()||new f.default("Unable to attach; reason unknown; state = "+this.event,9e4,500));break;case"detaching":v==null||v(new f.default("Attach request superseded by a subsequent detach request",9e4,409));break}})},u.prototype.attachImpl=function(){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.attachImpl()","sending ATTACH message");var s=a.default.fromValues({action:x.ATTACH,channel:this.name,params:this.channelOptions.params,channelSerial:this.properties.channelSerial});this._requestedFlags?s.encodeModesToFlags(this._requestedFlags):this.channelOptions.modes&&s.encodeModesToFlags(d.allToUpperCase(this.channelOptions.modes)),this._attachResume&&s.setFlag("ATTACH_RESUME"),this._lastPayload.decodeFailureRecoveryInProgress&&(s.channelSerial=this._lastPayload.protocolMessageChannelSerial),this.sendMessage(s,p)},u.prototype.detach=function(s){if(!s){if(this.realtime.options.promises)return d.promisify(this,"detach",arguments);s=p}var w=this.connectionManager;if(!w.activeState()){s(w.getError());return}switch(this.state){case"suspended":this.notifyState("detached"),s();break;case"detached":s();break;case"failed":s(new f.default("Unable to detach; channel state = failed",90001,400));break;default:this.requestState("detaching");case"detaching":this.once(function(v){switch(this.event){case"detached":s();break;case"attached":case"suspended":case"failed":s(v.reason||w.getError()||new f.default("Unable to detach; reason unknown; state = "+this.event,9e4,500));break;case"attaching":s(new f.default("Detach request superseded by a subsequent attach request",9e4,409));break}})}},u.prototype.detachImpl=function(s){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.detach()","sending DETACH message");var w=a.default.fromValues({action:x.DETACH,channel:this.name});this.sendMessage(w,s||p)},u.prototype.subscribe=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];var v=u.processListenerArgs(s),C=v[0],L=v[1],N=v[2];if(!N&&this.realtime.options.promises)return d.promisify(this,"subscribe",[C,L]);if(this.state==="failed"){N==null||N(f.default.fromValues(this.invalidStateError()));return}return C&&typeof C=="object"&&!Array.isArray(C)?this._subscribeFilter(C,L):this.subscriptions.on(C,L),this.attach(N||p)},u.prototype._subscribeFilter=function(s,w){var v=function(C){var L,N,M,I,P,A,j={name:C.name,refTimeserial:(N=(L=C.extras)===null||L===void 0?void 0:L.ref)===null||N===void 0?void 0:N.timeserial,refType:(I=(M=C.extras)===null||M===void 0?void 0:M.ref)===null||I===void 0?void 0:I.type,isRef:!!(!((A=(P=C.extras)===null||P===void 0?void 0:P.ref)===null||A===void 0)&&A.timeserial),clientId:C.clientId};Object.entries(s).find(function(U){var z=U[0],$=U[1];return $!==void 0?j[z]!==$:!1})||w(C)};this._addFilteredSubscription(s,w,v),this.subscriptions.on(v)},u.prototype._addFilteredSubscription=function(s,w,v){var C;if(this.filteredSubscriptions||(this.filteredSubscriptions=new Map),this.filteredSubscriptions.has(w)){var L=this.filteredSubscriptions.get(w);L.set(s,((C=L==null?void 0:L.get(s))===null||C===void 0?void 0:C.concat(v))||[v])}else this.filteredSubscriptions.set(w,new Map([[s,[v]]]))},u.prototype._getAndDeleteFilteredSubscriptions=function(s,w){var v=this;if(!this.filteredSubscriptions)return[];if(!w&&s)return Array.from(this.filteredSubscriptions.entries()).map(function(M){var I,P=M[0],A=M[1],j=A.get(s);return A.delete(s),A.size===0&&((I=v.filteredSubscriptions)===null||I===void 0||I.delete(P)),j}).reduce(function(M,I){var P;return I?(P=M).concat.apply(P,I):M},[]);if(!w||!this.filteredSubscriptions.has(w))return[];var C=this.filteredSubscriptions.get(w);if(!s){var L=Array.from(C.values()).reduce(function(M,I){return M.concat.apply(M,I)},[]);return this.filteredSubscriptions.delete(w),L}var N=C.get(s);return C.delete(s),N||[]},u.prototype.unsubscribe=function(){for(var s=this,w,v=[],C=0;C<arguments.length;C++)v[C]=arguments[C];var L=u.processListenerArgs(v),N=L[0],M=L[1];if(typeof N=="object"&&!M||!((w=this.filteredSubscriptions)===null||w===void 0)&&w.has(M)){this._getAndDeleteFilteredSubscriptions(N,M).forEach(function(I){return s.subscriptions.off(I)});return}this.subscriptions.off(N,M)},u.prototype.sync=function(){switch(this.state){case"initialized":case"detaching":case"detached":throw new f.PartialErrorInfo("Unable to sync to channel; not attached",4e4)}var s=this.connectionManager;if(!s.activeState())throw s.getError();var w=a.default.fromValues({action:x.SYNC,channel:this.name});this.syncChannelSerial&&(w.channelSerial=this.syncChannelSerial),s.send(w)},u.prototype.sendMessage=function(s,w){this.connectionManager.send(s,this.realtime.options.queueMessages,w)},u.prototype.sendPresence=function(s,w){var v=a.default.fromValues({action:x.PRESENCE,channel:this.name,presence:d.isArray(s)?k.default.fromValuesArray(s):[k.default.fromValues(s)]});this.sendMessage(v,w)},u.prototype.onMessage=function(s){(s.action===x.ATTACHED||s.action===x.MESSAGE||s.action===x.PRESENCE)&&this.setChannelSerial(s.channelSerial);var w,v=!1;switch(s.action){case x.ATTACHED:{this.properties.attachSerial=s.channelSerial,this._mode=s.getMode(),this.params=s.params||{};var C=s.decodeModesFromFlags();this.modes=C&&d.allToLowerCase(C)||void 0;var L=s.hasFlag("RESUMED"),N=s.hasFlag("HAS_PRESENCE"),M=s.hasFlag("HAS_BACKLOG");if(this.state==="attached"){L||this.presence.onAttached(N);var I=new R.default(this.state,this.state,L,M,s.error);this._allChannelChanges.emit("update",I),(!L||this.channelOptions.updateOnAttached)&&this.emit("update",I)}else this.state==="detaching"?this.checkPendingState():this.notifyState("attached",s.error,L,N,M);break}case x.DETACHED:{var P=s.error?f.default.fromValues(s.error):new f.default("Channel detached",90001,404);this.state==="detaching"?this.notifyState("detached",P):this.state==="attaching"?this.notifyState("suspended",P):this.requestState("attaching",P);break}case x.SYNC:if(v=!0,w=this.syncChannelSerial=s.channelSerial,!s.presence)break;case x.PRESENCE:{for(var A=s.presence,j=s.id,U=s.connectionId,z=s.timestamp,$=this.channelOptions,W=void 0,F=0;F<A.length;F++)try{W=A[F],k.default.decode(W,$),W.connectionId||(W.connectionId=U),W.timestamp||(W.timestamp=z),W.id||(W.id=j+":"+F)}catch(Y){S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()",Y.toString())}this.presence.setPresence(A,v,w);break}case x.MESSAGE:{if(this.state!=="attached"){S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.onMessage()",'Message "'+s.id+'" skipped as this channel "'+this.name+'" state is not "attached" (state is "'+this.state+'").');return}var O=s.messages,D=O[0],B=O[O.length-1],j=s.id,U=s.connectionId,z=s.timestamp;if(D.extras&&D.extras.delta&&D.extras.delta.from!==this._lastPayload.messageId){var _='Delta message decode failure - previous message not available for message "'+s.id+'" on this channel "'+this.name+'".';S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()",_),this._startDecodeFailureRecovery(new f.default(_,40018,400));break}for(var F=0;F<O.length;F++){var _=O[F];try{y.default.decode(_,this._decodingContext)}catch(Z){switch(S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()",Z.toString()),Z.code){case 40018:this._startDecodeFailureRecovery(Z);return;case 40019:case 40021:this.notifyState("failed",Z);return}}_.connectionId||(_.connectionId=U),_.timestamp||(_.timestamp=z),_.id||(_.id=j+":"+F)}this._lastPayload.messageId=B.id,this._lastPayload.protocolMessageChannelSerial=s.channelSerial,this.onEvent(O);break}case x.ERROR:{var V=s.error;V&&V.code==80016?this.checkPendingState():this.notifyState("failed",f.default.fromValues(V));break}default:S.default.logAction(S.default.LOG_ERROR,"RealtimeChannel.onMessage()","Fatal protocol error: unrecognised action ("+s.action+")"),this.connectionManager.abort(T.default.unknownChannelErr())}},u.prototype._startDecodeFailureRecovery=function(s){var w=this;this._lastPayload.decodeFailureRecoveryInProgress||(S.default.logAction(S.default.LOG_MAJOR,"RealtimeChannel.onMessage()","Starting decode failure recovery process."),this._lastPayload.decodeFailureRecoveryInProgress=!0,this._attach(!0,s,function(){w._lastPayload.decodeFailureRecoveryInProgress=!1}))},u.prototype.onAttached=function(){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.onAttached","activating channel; name = "+this.name)},u.prototype.notifyState=function(s,w,v,C,L){if(S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.notifyState","name = "+this.name+", current state = "+this.state+", notifying state "+s),this.clearStateTimer(),d.arrIn(["detached","suspended","failed"],s)&&(this.properties.channelSerial=null),s!==this.state){this.presence.actOnChannelState(s,C,w),s==="suspended"&&this.connectionManager.state.sendEvents?this.startRetryTimer():this.cancelRetryTimer(),w&&(this.errorReason=w);var N=new R.default(this.state,s,v,L,w),M=s==="failed"?S.default.LOG_ERROR:S.default.LOG_MAJOR;S.default.logAction(M,'Channel state for channel "'+this.name+'"',s+(w?"; reason: "+w:"")),s!=="attaching"&&s!=="suspended"&&(this.retryCount=0),s==="attached"&&this.onAttached(),s==="attached"?this._attachResume=!0:(s==="detaching"||s==="failed")&&(this._attachResume=!1),this.state=s,this._allChannelChanges.emit(s,N),this.emit(s,N)}},u.prototype.requestState=function(s,w){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.requestState","name = "+this.name+", state = "+s),this.notifyState(s,w),this.checkPendingState()},u.prototype.checkPendingState=function(){var s=this.connectionManager.state;if(!(s.sendEvents||s.forceQueueEvents)){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.checkPendingState","sendEvents is false; state is "+this.connectionManager.state.state);return}switch(S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.checkPendingState","name = "+this.name+", state = "+this.state),this.state){case"attaching":this.startStateTimerIfNotRunning(),this.attachImpl();break;case"detaching":this.startStateTimerIfNotRunning(),this.detachImpl();break;case"attached":this.sync();break}},u.prototype.timeoutPendingState=function(){switch(this.state){case"attaching":{var s=new f.default("Channel attach timed out",90007,408);this.notifyState("suspended",s);break}case"detaching":{var s=new f.default("Channel detach timed out",90007,408);this.notifyState("attached",s);break}default:this.checkPendingState();break}},u.prototype.startStateTimerIfNotRunning=function(){var s=this;this.stateTimer||(this.stateTimer=setTimeout(function(){S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel.startStateTimerIfNotRunning","timer expired"),s.stateTimer=null,s.timeoutPendingState()},this.realtime.options.timeouts.realtimeRequestTimeout))},u.prototype.clearStateTimer=function(){var s=this.stateTimer;s&&(clearTimeout(s),this.stateTimer=null)},u.prototype.startRetryTimer=function(){var s=this;if(!this.retryTimer){this.retryCount++;var w=d.getRetryTime(this.realtime.options.timeouts.channelRetryTimeout,this.retryCount);this.retryTimer=setTimeout(function(){s.state==="suspended"&&s.connectionManager.state.sendEvents&&(s.retryTimer=null,S.default.logAction(S.default.LOG_MINOR,"RealtimeChannel retry timer expired","attempting a new attach"),s.requestState("attaching"))},w)}},u.prototype.cancelRetryTimer=function(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)},u.prototype.getReleaseErr=function(){var s=this.state;return s==="initialized"||s==="detached"||s==="failed"?null:new f.default("Can only release a channel in a state where there is no possibility of further updates from the server being received (initialized, detached, or failed); was "+s,90001,400)},u.prototype.setChannelSerial=function(s){S.default.logAction(S.default.LOG_MICRO,"RealtimeChannel.setChannelSerial()","Updating channel serial; serial = "+s+"; previous = "+this.properties.channelSerial),s&&(this.properties.channelSerial=s)},u}(g.default);function h(c){var u=c||{};u.agent;var s=i.__rest(u,["agent"]);return s}r.default=b},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function a(l,d,g,S,E){this.previous=l,this.current=d,d==="attached"&&(this.resumed=g,this.hasBacklog=S),E&&(this.reason=E)}return a}();r.default=i},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){var a=i,l=a.lib,d=l.WordArray,g=l.Hasher,S=a.algo,E=[],y=S.SHA1=g.extend({_doReset:function(){this._hash=new d.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(R,f){for(var k=this._hash.words,T=k[0],x=k[1],p=k[2],m=k[3],b=k[4],h=0;h<80;h++){if(h<16)E[h]=R[f+h]|0;else{var c=E[h-3]^E[h-8]^E[h-14]^E[h-16];E[h]=c<<1|c>>>31}var u=(T<<5|T>>>27)+b+E[h];h<20?u+=(x&p|~x&m)+1518500249:h<40?u+=(x^p^m)+1859775393:h<60?u+=(x&p|x&m|p&m)-1894007588:u+=(x^p^m)-899497514,b=m,m=p,p=x<<30|x>>>2,x=T,T=u}k[0]=k[0]+T|0,k[1]=k[1]+x|0,k[2]=k[2]+p|0,k[3]=k[3]+m|0,k[4]=k[4]+b|0},_doFinalize:function(){var R=this._data,f=R.words,k=this._nDataBytes*8,T=R.sigBytes*8;return f[T>>>5]|=128<<24-T%32,f[(T+64>>>9<<4)+14]=Math.floor(k/4294967296),f[(T+64>>>9<<4)+15]=k,R.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var R=g.clone.call(this);return R._hash=this._hash.clone(),R}});a.SHA1=g._createHelper(y),a.HmacSHA1=g._createHmacHelper(y)}(),i.SHA1})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});function i(h){if(h===void 0)return"undefined";var c,u;if(h instanceof ArrayBuffer?(u="ArrayBuffer",c=new DataView(h)):h instanceof DataView&&(u="DataView",c=h),!c)return JSON.stringify(h);for(var s=[],w=0;w<h.byteLength;w++){if(w>20){s.push("...");break}var v=c.getUint8(w).toString(16);v.length===1&&(v="0"+v),s.push(v)}return"<"+u+" "+s.join(" ")+">"}function a(h,c,u){for(var s=0,w=u.length;s<w;s++){var v=u.charCodeAt(s);if(v<128){h.setUint8(c++,v>>>0&127|0);continue}if(v<2048){h.setUint8(c++,v>>>6&31|192),h.setUint8(c++,v>>>0&63|128);continue}if(v<65536){h.setUint8(c++,v>>>12&15|224),h.setUint8(c++,v>>>6&63|128),h.setUint8(c++,v>>>0&63|128);continue}if(v<1114112){h.setUint8(c++,v>>>18&7|240),h.setUint8(c++,v>>>12&63|128),h.setUint8(c++,v>>>6&63|128),h.setUint8(c++,v>>>0&63|128);continue}throw new Error("bad codepoint "+v)}}function l(h,c,u){for(var s="",w=c,v=c+u;w<v;w++){var C=h.getUint8(w);if(!(C&128)){s+=String.fromCharCode(C);continue}if((C&224)===192){s+=String.fromCharCode((C&15)<<6|h.getUint8(++w)&63);continue}if((C&240)===224){s+=String.fromCharCode((C&15)<<12|(h.getUint8(++w)&63)<<6|(h.getUint8(++w)&63)<<0);continue}if((C&248)===240){s+=String.fromCharCode((C&7)<<18|(h.getUint8(++w)&63)<<12|(h.getUint8(++w)&63)<<6|(h.getUint8(++w)&63)<<0);continue}throw new Error("Invalid byte "+C.toString(16))}return s}function d(h){for(var c=0,u=0,s=h.length;u<s;u++){var w=h.charCodeAt(u);if(w<128){c+=1;continue}if(w<2048){c+=2;continue}if(w<65536){c+=3;continue}if(w<1114112){c+=4;continue}throw new Error("bad codepoint "+w)}return c}function g(h,c){var u=b(h,c);if(u!==0){var s=new ArrayBuffer(u),w=new DataView(s);return m(h,w,0,c),s}}var S=65536*65536,E=1/S;function y(h,c){return c=c||0,h.getInt32(c)*S+h.getUint32(c+4)}function R(h,c){return c=c||0,h.getUint32(c)*S+h.getUint32(c+4)}function f(h,c,u){u<9223372036854776e3?(h.setInt32(c,Math.floor(u*E)),h.setInt32(c+4,u&-1)):(h.setUint32(c,2147483647),h.setUint32(c+4,2147483647))}function k(h,c,u){u<18446744073709552e3?(h.setUint32(c,Math.floor(u*E)),h.setInt32(c+4,u&-1)):(h.setUint32(c,4294967295),h.setUint32(c+4,4294967295))}var T=function(){function h(c,u){var s=this;this.map=function(w){for(var v={},C=0;C<w;C++){var L=s.parse();v[L]=s.parse()}return v},this.bin=function(w){var v=new ArrayBuffer(w);return new Uint8Array(v).set(new Uint8Array(s.view.buffer,s.offset,w),0),s.offset+=w,v},this.buf=this.bin,this.str=function(w){var v=l(s.view,s.offset,w);return s.offset+=w,v},this.array=function(w){for(var v=new Array(w),C=0;C<w;C++)v[C]=s.parse();return v},this.ext=function(w){return s.offset+=w,{type:s.view.getInt8(s.offset),data:s.buf(w)}},this.parse=function(){var w=s.view.getUint8(s.offset),v,C;if(!(w&128))return s.offset++,w;if((w&240)===128)return C=w&15,s.offset++,s.map(C);if((w&240)===144)return C=w&15,s.offset++,s.array(C);if((w&224)===160)return C=w&31,s.offset++,s.str(C);if((w&224)===224)return v=s.view.getInt8(s.offset),s.offset++,v;switch(w){case 192:return s.offset++,null;case 193:s.offset++;return;case 194:return s.offset++,!1;case 195:return s.offset++,!0;case 196:return C=s.view.getUint8(s.offset+1),s.offset+=2,s.bin(C);case 197:return C=s.view.getUint16(s.offset+1),s.offset+=3,s.bin(C);case 198:return C=s.view.getUint32(s.offset+1),s.offset+=5,s.bin(C);case 199:return C=s.view.getUint8(s.offset+1),s.offset+=2,s.ext(C);case 200:return C=s.view.getUint16(s.offset+1),s.offset+=3,s.ext(C);case 201:return C=s.view.getUint32(s.offset+1),s.offset+=5,s.ext(C);case 202:return v=s.view.getFloat32(s.offset+1),s.offset+=5,v;case 203:return v=s.view.getFloat64(s.offset+1),s.offset+=9,v;case 204:return v=s.view.getUint8(s.offset+1),s.offset+=2,v;case 205:return v=s.view.getUint16(s.offset+1),s.offset+=3,v;case 206:return v=s.view.getUint32(s.offset+1),s.offset+=5,v;case 207:return v=R(s.view,s.offset+1),s.offset+=9,v;case 208:return v=s.view.getInt8(s.offset+1),s.offset+=2,v;case 209:return v=s.view.getInt16(s.offset+1),s.offset+=3,v;case 210:return v=s.view.getInt32(s.offset+1),s.offset+=5,v;case 211:return v=y(s.view,s.offset+1),s.offset+=9,v;case 212:return C=1,s.offset++,s.ext(C);case 213:return C=2,s.offset++,s.ext(C);case 214:return C=4,s.offset++,s.ext(C);case 215:return C=8,s.offset++,s.ext(C);case 216:return C=16,s.offset++,s.ext(C);case 217:return C=s.view.getUint8(s.offset+1),s.offset+=2,s.str(C);case 218:return C=s.view.getUint16(s.offset+1),s.offset+=3,s.str(C);case 219:return C=s.view.getUint32(s.offset+1),s.offset+=5,s.str(C);case 220:return C=s.view.getUint16(s.offset+1),s.offset+=3,s.array(C);case 221:return C=s.view.getUint32(s.offset+1),s.offset+=5,s.array(C);case 222:return C=s.view.getUint16(s.offset+1),s.offset+=3,s.map(C);case 223:return C=s.view.getUint32(s.offset+1),s.offset+=5,s.map(C)}throw new Error("Unknown type 0x"+w.toString(16))},this.offset=u||0,this.view=c}return h}();function x(h){var c=new DataView(h),u=new T(c),s=u.parse();if(u.offset!==h.byteLength)throw new Error(h.byteLength-u.offset+" trailing bytes");return s}function p(h,c){return Object.keys(h).filter(function(u){var s=h[u],w=typeof s;return(!c||s!=null)&&(w!=="function"||!!s.toJSON)})}function m(h,c,u,s){var w=typeof h;if(typeof h=="string"){var v=d(h);if(v<32)return c.setUint8(u,v|160),a(c,u+1,h),1+v;if(v<256)return c.setUint8(u,217),c.setUint8(u+1,v),a(c,u+2,h),2+v;if(v<65536)return c.setUint8(u,218),c.setUint16(u+1,v),a(c,u+3,h),3+v;if(v<4294967296)return c.setUint8(u,219),c.setUint32(u+1,v),a(c,u+5,h),5+v}if(ArrayBuffer.isView&&ArrayBuffer.isView(h)&&(h=h.buffer),h instanceof ArrayBuffer){var C=h.byteLength;if(C<256)return c.setUint8(u,196),c.setUint8(u+1,C),new Uint8Array(c.buffer).set(new Uint8Array(h),u+2),2+C;if(C<65536)return c.setUint8(u,197),c.setUint16(u+1,C),new Uint8Array(c.buffer).set(new Uint8Array(h),u+3),3+C;if(C<4294967296)return c.setUint8(u,198),c.setUint32(u+1,C),new Uint8Array(c.buffer).set(new Uint8Array(h),u+5),5+C}if(typeof h=="number"){if(Math.floor(h)!==h)return c.setUint8(u,203),c.setFloat64(u+1,h),9;if(h>=0){if(h<128)return c.setUint8(u,h),1;if(h<256)return c.setUint8(u,204),c.setUint8(u+1,h),2;if(h<65536)return c.setUint8(u,205),c.setUint16(u+1,h),3;if(h<4294967296)return c.setUint8(u,206),c.setUint32(u+1,h),5;if(h<18446744073709552e3)return c.setUint8(u,207),k(c,u+1,h),9;throw new Error("Number too big 0x"+h.toString(16))}if(h>=-32)return c.setInt8(u,h),1;if(h>=-128)return c.setUint8(u,208),c.setInt8(u+1,h),2;if(h>=-32768)return c.setUint8(u,209),c.setInt16(u+1,h),3;if(h>=-2147483648)return c.setUint8(u,210),c.setInt32(u+1,h),5;if(h>=-9223372036854776e3)return c.setUint8(u,211),f(c,u+1,h),9;throw new Error("Number too small -0x"+(-h).toString(16).substr(1))}if(w==="undefined")return s?0:(c.setUint8(u,212),c.setUint8(u+1,0),c.setUint8(u+2,0),3);if(h===null)return s?0:(c.setUint8(u,192),1);if(w==="boolean")return c.setUint8(u,h?195:194),1;if(typeof h.toJSON=="function")return m(h.toJSON(),c,u,s);if(w==="object"){var L,N=0,M=void 0,I=Array.isArray(h);if(I?L=h.length:(M=p(h,s),L=M.length),L<16?(c.setUint8(u,L|(I?144:128)),N=1):L<65536?(c.setUint8(u,I?220:222),c.setUint16(u+1,L),N=3):L<4294967296&&(c.setUint8(u,I?221:223),c.setUint32(u+1,L),N=5),I)for(var P=0;P<L;P++)N+=m(h[P],c,u+N,s);else if(M)for(var P=0;P<L;P++){var A=M[P];N+=m(A,c,u+N),N+=m(h[A],c,u+N,s)}return N}if(w==="function")return 0;throw new Error("Unknown type "+w)}function b(h,c){var u=typeof h;if(u==="string"){var s=d(h);if(s<32)return 1+s;if(s<256)return 2+s;if(s<65536)return 3+s;if(s<4294967296)return 5+s}if(ArrayBuffer.isView&&ArrayBuffer.isView(h)&&(h=h.buffer),h instanceof ArrayBuffer){var w=h.byteLength;if(w<256)return 2+w;if(w<65536)return 3+w;if(w<4294967296)return 5+w}if(typeof h=="number"){if(Math.floor(h)!==h)return 9;if(h>=0){if(h<128)return 1;if(h<256)return 2;if(h<65536)return 3;if(h<4294967296)return 5;if(h<18446744073709552e3)return 9;throw new Error("Number too big 0x"+h.toString(16))}if(h>=-32)return 1;if(h>=-128)return 2;if(h>=-32768)return 3;if(h>=-2147483648)return 5;if(h>=-9223372036854776e3)return 9;throw new Error("Number too small -0x"+h.toString(16).substr(1))}if(u==="boolean")return 1;if(h===null)return c?0:1;if(h===void 0)return c?0:3;if(typeof h.toJSON=="function")return b(h.toJSON(),c);if(u==="object"){var v,C=0;if(Array.isArray(h)){v=h.length;for(var L=0;L<v;L++)C+=b(h[L],c)}else{var N=p(h,c);v=N.length;for(var L=0;L<v;L++){var M=N[L];C+=b(M)+b(h[M],c)}}if(v<16)return 1+C;if(v<65536)return 3+C;if(v<4294967296)return 5+C;throw new Error("Array or object too long 0x"+v.toString(16))}if(u==="function")return 0;throw new Error("Unknown type "+u)}r.default={encode:g,decode:x,inspect:i,utf8Write:a,utf8Read:l,utf8ByteCount:d}},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(30)),l=i.__importDefault(o(50)),d=i.__importDefault(o(3)),g=i.__importDefault(o(4)),S=i.__importDefault(o(55)),E=i.__importDefault(o(57)),y=i.__importDefault(o(62)),R=i.__importDefault(o(64)),f=i.__importDefault(o(68)),k=i.__importDefault(o(2)),T=o(8),x=i.__importDefault(o(65)),p=i.__importDefault(o(66)),m=i.__importDefault(o(41)),b=(0,E.default)(R.default,S.default);d.default.Crypto=b,d.default.BufferUtils=S.default,d.default.Http=y.default,d.default.Config=R.default,d.default.Transports=f.default,d.default.WebStorage=x.default,a.default.Crypto=b,l.default.Crypto=b,k.default.initLogHandlers(),d.default.Defaults=(0,T.getDefaults)(p.default),d.default.Config.agent&&(d.default.Defaults.agent+=" "+d.default.Config.agent),d.default.Config.noUpgrade&&(d.default.Defaults.upgradeTransports=[]),r.default={ErrorInfo:g.default,Rest:a.default,Realtime:l.default,msgpack:m.default}},function(n){n.exports=JSON.parse('{"name":"ably","description":"Realtime client library for Ably, the realtime messaging service","version":"1.2.50","license":"Apache-2.0","bugs":{"url":"https://github.com/ably/ably-js/issues","email":"support@ably.com"},"main":"./build/ably-node.js","typings":"./ably.d.ts","react-native":{"./build/ably-node.js":"./build/ably-reactnative.js"},"browser":{"./build/ably-node.js":"./build/ably-commonjs.js"},"files":["build/**","ably.d.ts","callbacks.d.ts","callbacks.js","promises.d.ts","promises.js","resources/**","src/**","react/**"],"dependencies":{"@ably/msgpack-js":"^0.4.0","got":"^11.8.5","ws":"^8.14.2"},"peerDependencies":{"react":">=16.8.0","react-dom":">=16.8.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}},"devDependencies":{"@ably/vcdiff-decoder":"1.0.4","@arethetypeswrong/cli":"^0.13.1","@babel/preset-env":"^7.23.6","@testing-library/react":"^13.3.0","@types/crypto-js":"^4.0.1","@types/jmespath":"^0.15.2","@types/node":"^15.0.0","@types/request":"^2.48.7","@types/ws":"^8.2.0","@typescript-eslint/eslint-plugin":"^5.14.0","@typescript-eslint/parser":"^5.14.0","@vitejs/plugin-react":"^1.3.2","async":"ably-forks/async#requirejs","aws-sdk":"^2.1413.0","babel-loader":"^8.3.0","chai":"^4.2.0","copy-webpack-plugin":"^6.4.1","cors":"^2.8.5","crypto-js":"ably-forks/crypto-js#crypto-lite","eslint":"^7.13.0","eslint-plugin-import":"^2.28.0","eslint-plugin-jsdoc":"^40.0.0","eslint-plugin-react":"^7.32.2","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-security":"^1.4.0","express":"^4.17.1","glob":"~4.4","google-closure-compiler":"^20180610.0.1","grunt":"^1.6.1","grunt-bump":"^0.3.1","grunt-cli":"~1.2.0","grunt-closure-tools":"^1.0.0","grunt-contrib-concat":"~0.5","grunt-shell":"~1.1","grunt-webpack":"^4.0.2","hexy":"~0.2","jmespath":"^0.16.0","jsdom":"^20.0.0","kexec":"ably-forks/node-kexec#update-for-node-12","minimist":"^1.2.5","mocha":"^8.1.3","mocha-junit-reporter":"^2.2.1","null-loader":"^4.0.1","playwright":"^1.39.0","prettier":"^2.5.1","react":">=18.1.0","react-dom":">=18.1.0","requirejs":"~2.1","shelljs":"~0.8","source-map-explorer":"^2.5.2","ts-loader":"^8.2.0","tsconfig-paths-webpack-plugin":"^4.0.1","tslib":"^2.3.1","typedoc":"^0.23.8","typescript":"^4.6.4","vite":"^4.4.9","vitest":"^0.18.0","webpack":"^4.44.2","webpack-cli":"^4.2.0","webpack-node-externals":"^3.0.0"},"engines":{"node":">=5.10.x"},"repository":"ably/ably-js","jspm":{"registry":"npm","directories":{"lib":"build"},"main":"ably"},"scripts":{"start:react":"npx vite serve","grunt":"grunt","test":"grunt test","test:node":"grunt test:node","test:node:skip-build":"grunt mocha","test:webserver":"grunt test:webserver","test:playwright":"node test/support/runPlaywrightTests.js","test:react":"vitest run","concat":"grunt concat","build":"grunt build:all && npm run build:react","build:node":"grunt build:node","build:browser":"grunt build:browser","build:react":"npm run build:react:mjs && npm run build:react:cjs && cp src/platform/react-hooks/res/package.react.json react/package.json","build:react:mjs":"tsc --project src/platform/react-hooks/tsconfig.mjs.json && cp src/platform/react-hooks/res/package.mjs.json react/mjs/package.json","build:react:cjs":"tsc --project src/platform/react-hooks/tsconfig.cjs.json && cp src/platform/react-hooks/res/package.cjs.json react/cjs/package.json","requirejs":"grunt requirejs","lint":"eslint .","lint:fix":"eslint --fix .","check-closure-compiler":"grunt check-closure-compiler","prepare":"npm run build","format":"prettier --write --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/cdn_deploy.js docs/chrome-mv3.md","format:check":"prettier --check --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/cdn_deploy.js","sourcemap":"source-map-explorer build/ably.min.js","sourcemap:noencryption":"source-map-explorer build/ably.noencryption.min.js","docs":"typedoc --entryPoints ably.d.ts --out docs/generated/default --readme docs/landing-pages/default.md && typedoc --entryPoints promises.d.ts --out docs/generated/promises --name \\"ably (Promise-based)\\" --readme docs/landing-pages/promises.md && cp docs/landing-pages/choose-library.html docs/generated/index.html"}}')},function(n,r){},function(n,r,o){(function(i,a){n.exports=a(o(6),o(32),o(25))})(this,function(i){return i.HmacSHA256})},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(47)),d=i.__importDefault(o(15)),g=i.__importDefault(o(20)),S=i.__importDefault(o(4)),E=i.__importDefault(o(48)),y=function(){},R=function(){function x(p){this.rest=p,this.admin=new f(p)}return x}(),f=function(){function x(p){this.rest=p,this.deviceRegistrations=new k(p),this.channelSubscriptions=new T(p)}return x.prototype.publish=function(p,m,b){var h=this.rest,c=h.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(h.options,c),s={},w=a.mixin({recipient:p},m);if(typeof b!="function"){if(this.rest.options.promises)return a.promisify(this,"publish",arguments);b=y}h.options.headers&&a.mixin(u,h.options.headers),h.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var v=a.encodeBody(w,c);d.default.post(h,"/push/publish",v,u,s,null,function(C){return b(C)})},x}(),k=function(){function x(p){this.rest=p}return x.prototype.save=function(p,m){var b=this.rest,h=l.default.fromValues(p),c=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(b.options,c),s={};if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);m=y}b.options.headers&&a.mixin(u,b.options.headers),b.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var w=a.encodeBody(h,c);d.default.put(b,"/push/deviceRegistrations/"+encodeURIComponent(p.id),w,u,s,null,function(v,C,L,N){m(v,v?void 0:l.default.fromResponseBody(C,N?void 0:c))})},x.prototype.get=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(b.options,h),u=p.id||p;if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"get",arguments);m=y}if(typeof u!="string"||!u.length){m(new S.default("First argument to DeviceRegistrations#get must be a deviceId string or DeviceDetails",4e4,400));return}b.options.headers&&a.mixin(c,b.options.headers),d.default.get(b,"/push/deviceRegistrations/"+encodeURIComponent(u),c,{},null,function(s,w,v,C){m(s,s?void 0:l.default.fromResponseBody(w,C?void 0:h))})},x.prototype.list=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:h,u=a.defaultGetHeaders(b.options,h);if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);m=y}b.options.headers&&a.mixin(u,b.options.headers),new g.default(b,"/push/deviceRegistrations",u,c,function(s,w,v){return l.default.fromResponseBody(s,v?void 0:h)}).get(p,m)},x.prototype.remove=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(b.options,h),u={},s=p.id||p;if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"remove",arguments);m=y}if(typeof s!="string"||!s.length){m(new S.default("First argument to DeviceRegistrations#remove must be a deviceId string or DeviceDetails",4e4,400));return}b.options.headers&&a.mixin(c,b.options.headers),b.options.pushFullWait&&a.mixin(u,{fullWait:"true"}),d.default.delete(b,"/push/deviceRegistrations/"+encodeURIComponent(s),c,u,null,function(w){return m(w)})},x.prototype.removeWhere=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(b.options,h);if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);m=y}b.options.headers&&a.mixin(c,b.options.headers),b.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),d.default.delete(b,"/push/deviceRegistrations",c,p,null,function(u){return m(u)})},x}(),T=function(){function x(p){this.remove=x.prototype.removeWhere,this.rest=p}return x.prototype.save=function(p,m){var b=this.rest,h=E.default.fromValues(p),c=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,u=a.defaultPostHeaders(b.options,c),s={};if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"save",arguments);m=y}b.options.headers&&a.mixin(u,b.options.headers),b.options.pushFullWait&&a.mixin(s,{fullWait:"true"});var w=a.encodeBody(h,c);d.default.post(b,"/push/channelSubscriptions",w,u,s,null,function(v,C,L,N){m(v,!v&&E.default.fromResponseBody(C,N?void 0:c))})},x.prototype.list=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:h,u=a.defaultGetHeaders(b.options,h);if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"list",arguments);m=y}b.options.headers&&a.mixin(u,b.options.headers),new g.default(b,"/push/channelSubscriptions",u,c,function(s,w,v){return E.default.fromResponseBody(s,v?void 0:h)}).get(p,m)},x.prototype.removeWhere=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=a.defaultGetHeaders(b.options,h);if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"removeWhere",arguments);m=y}b.options.headers&&a.mixin(c,b.options.headers),b.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),d.default.delete(b,"/push/channelSubscriptions",c,p,null,function(u){return m(u)})},x.prototype.listChannels=function(p,m){var b=this.rest,h=b.options.useBinaryProtocol?a.Format.msgpack:a.Format.json,c=this.rest.http.supportsLinkHeaders?void 0:h,u=a.defaultGetHeaders(b.options,h);if(typeof m!="function"){if(this.rest.options.promises)return a.promisify(this,"listChannels",arguments);m=y}b.options.headers&&a.mixin(u,b.options.headers),b.options.pushFullWait&&a.mixin(p,{fullWait:"true"}),new g.default(b,"/push/channels",u,c,function(s,w,v){for(var C=!v&&h?a.decodeBody(s,h):s,L=0;L<C.length;L++)C[L]=String(C[L]);return C}).get(p,m)},x}();r.default=R},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(4)),d;(function(E){E.Phone="phone",E.Tablet="tablet",E.Desktop="desktop",E.TV="tv",E.Watch="watch",E.Car="car",E.Embedded="embedded",E.Other="other"})(d||(d={}));var g;(function(E){E.Android="android",E.IOS="ios",E.Browser="browser"})(g||(g={}));var S=function(){function E(){}return E.prototype.toJSON=function(){var y,R,f;return{id:this.id,deviceSecret:this.deviceSecret,platform:this.platform,formFactor:this.formFactor,clientId:this.clientId,metadata:this.metadata,deviceIdentityToken:this.deviceIdentityToken,push:{recipient:(y=this.push)===null||y===void 0?void 0:y.recipient,state:(R=this.push)===null||R===void 0?void 0:R.state,error:(f=this.push)===null||f===void 0?void 0:f.error}}},E.prototype.toString=function(){var y,R,f,k,T="[DeviceDetails";return this.id&&(T+="; id="+this.id),this.platform&&(T+="; platform="+this.platform),this.formFactor&&(T+="; formFactor="+this.formFactor),this.clientId&&(T+="; clientId="+this.clientId),this.metadata&&(T+="; metadata="+this.metadata),this.deviceIdentityToken&&(T+="; deviceIdentityToken="+JSON.stringify(this.deviceIdentityToken)),!((y=this.push)===null||y===void 0)&&y.recipient&&(T+="; push.recipient="+JSON.stringify(this.push.recipient)),!((R=this.push)===null||R===void 0)&&R.state&&(T+="; push.state="+this.push.state),!((f=this.push)===null||f===void 0)&&f.error&&(T+="; push.error="+JSON.stringify(this.push.error)),!((k=this.push)===null||k===void 0)&&k.metadata&&(T+="; push.metadata="+this.push.metadata),T+="]",T},E.fromResponseBody=function(y,R){return R&&(y=a.decodeBody(y,R)),a.isArray(y)?E.fromValuesArray(y):E.fromValues(y)},E.fromValues=function(y){return y.error=y.error&&l.default.fromValues(y.error),Object.assign(new E,y)},E.fromValuesArray=function(y){for(var R=y.length,f=new Array(R),k=0;k<R;k++)f[k]=E.fromValues(y[k]);return f},E.toRequestBody=a.encodeBody,E}();r.default=S},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=function(){function d(){}return d.prototype.toJSON=function(){return{channel:this.channel,deviceId:this.deviceId,clientId:this.clientId}},d.prototype.toString=function(){var g="[PushChannelSubscription";return this.channel&&(g+="; channel="+this.channel),this.deviceId&&(g+="; deviceId="+this.deviceId),this.clientId&&(g+="; clientId="+this.clientId),g+="]",g},d.fromResponseBody=function(g,S){return S&&(g=a.decodeBody(g,S)),a.isArray(g)?d.fromValuesArray(g):d.fromValues(g)},d.fromValues=function(g){return Object.assign(new d,g)},d.fromValuesArray=function(g){for(var S=g.length,E=new Array(S),y=0;y<S;y++)E[y]=d.fromValues(g[y]);return E},d.toRequestBody=a.encodeBody,d}();r.default=l},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=function(){function b(h){this.count=h&&h.count||0,this.data=h&&h.data||0,this.uncompressedData=h&&h.uncompressedData||0,this.failed=h&&h.failed||0,this.refused=h&&h.refused||0}return b}(),d=function(b){i.__extends(h,b);function h(c){var u=b.call(this,c)||this;return c&&c.category&&(u.category={},a.forInOwnNonNullProperties(c.category,function(s){u.category[s]=new l(c.category[s])})),u}return h}(l),g=function(){function b(h){this.peak=h&&h.peak||0,this.min=h&&h.min||0,this.mean=h&&h.mean||0,this.opened=h&&h.opened||0,this.refused=h&&h.refused||0}return b}(),S=function(){function b(h){this.succeeded=h&&h.succeeded||0,this.failed=h&&h.failed||0,this.refused=h&&h.refused||0}return b}(),E=function(){function b(h){this.plain=new g(h&&h.plain),this.tls=new g(h&&h.tls),this.all=new g(h&&h.all)}return b}(),y=function(){function b(h){this.messages=new d(h&&h.messages),this.presence=new d(h&&h.presence),this.all=new d(h&&h.all)}return b}(),R=function(){function b(h){this.realtime=new y(h&&h.realtime),this.rest=new y(h&&h.rest),this.webhook=new y(h&&h.webhook),this.sharedQueue=new y(h&&h.sharedQueue),this.externalQueue=new y(h&&h.externalQueue),this.httpEvent=new y(h&&h.httpEvent),this.push=new y(h&&h.push),this.all=new y(h&&h.all)}return b}(),f=function(){function b(h){this.all=new y(h&&h.all),this.inbound=new R(h&&h.inbound),this.outbound=new R(h&&h.outbound)}return b}(),k=function(){function b(h){this.all=new y(h&&h.all),this.producerPaid=new f(h&&h.producerPaid),this.consumerPaid=new f(h&&h.consumerPaid)}return b}(),T=function(){function b(h){this.messages=h&&h.messages||0;var c=h&&h.notifications;this.notifications={invalid:c&&c.invalid||0,attempted:c&&c.attempted||0,successful:c&&c.successful||0,failed:c&&c.failed||0},this.directPublishes=h&&h.directPublishes||0}return b}(),x=function(){function b(h){this.succeeded=h&&h.succeeded||0,this.skipped=h&&h.skipped||0,this.failed=h&&h.failed||0}return b}(),p=function(){function b(h){var c=this;this.delta=void 0,h&&h.delta&&(this.delta={},a.forInOwnNonNullProperties(h.delta,function(u){c.delta[u]=new x(h.delta[u])}))}return b}(),m=function(b){i.__extends(h,b);function h(c){var u=b.call(this,c)||this;return u.persisted=new y(c&&c.persisted),u.connections=new E(c&&c.connections),u.channels=new g(c&&c.channels),u.apiRequests=new S(c&&c.apiRequests),u.tokenRequests=new S(c&&c.tokenRequests),u.xchgProducer=new k(c&&c.xchgProducer),u.xchgConsumer=new k(c&&c.xchgConsumer),u.push=new T(c&&c.pushStats),u.processed=new p(c&&c.processed),u.inProgress=c&&c.inProgress||void 0,u.unit=c&&c.unit||void 0,u.intervalId=c&&c.intervalId||void 0,u}return h.fromValues=function(c){return new h(c)},h}(f);r.default=m},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(30)),d=i.__importDefault(o(7)),g=i.__importDefault(o(2)),S=i.__importDefault(o(51)),E=i.__importDefault(o(38)),y=i.__importDefault(o(8)),R=i.__importDefault(o(4)),f=i.__importDefault(o(10)),k=i.__importDefault(o(35)),T=i.__importDefault(o(3)),x=i.__importDefault(o(9)),p=function(b){i.__extends(h,b);function h(c){var u=b.call(this,c)||this;return g.default.logAction(g.default.LOG_MINOR,"Realtime()",""),u.connection=new S.default(u,u.options),u.channels=new m(u),c.autoConnect!==!1&&u.connect(),u}return h.prototype.connect=function(){g.default.logAction(g.default.LOG_MINOR,"Realtime.connect()",""),this.connection.connect()},h.prototype.close=function(){g.default.logAction(g.default.LOG_MINOR,"Realtime.close()",""),this.connection.close()},h.Promise=function(c){return c=y.default.objectifyOptions(c),c.promises=!0,new h(c)},h.Callbacks=h,h.Utils=a,h.ConnectionManager=k.default,h.Platform=T.default,h.ProtocolMessage=f.default,h.Message=x.default,h}(l.default),m=function(b){i.__extends(h,b);function h(c){var u=b.call(this)||this;return u.realtime=c,u.all=Object.create(null),c.connection.connectionManager.on("transport.active",function(){u.onTransportActive()}),u}return h.prototype.channelSerials=function(){for(var c={},u=0,s=a.keysArray(this.all,!0);u<s.length;u++){var w=s[u],v=this.all[w];v.properties.channelSerial&&(c[w]=v.properties.channelSerial)}return c},h.prototype.recoverChannels=function(c){for(var u=0,s=a.keysArray(c,!0);u<s.length;u++){var w=s[u],v=this.get(w);v.properties.channelSerial=c[w]}},h.prototype.onChannelMessage=function(c){var u=c.channel;if(u===void 0){g.default.logAction(g.default.LOG_ERROR,"Channels.onChannelMessage()","received event unspecified channel, action = "+c.action);return}var s=this.all[u];if(!s){g.default.logAction(g.default.LOG_ERROR,"Channels.onChannelMessage()","received event for non-existent channel: "+u);return}s.onMessage(c)},h.prototype.onTransportActive=function(){for(var c in this.all){var u=this.all[c];u.state==="attaching"||u.state==="detaching"?u.checkPendingState():u.state==="suspended"?u._attach(!1,null):u.state==="attached"&&u.requestState("attaching")}},h.prototype.propogateConnectionInterruption=function(c,u){var s={closing:"detached",closed:"detached",failed:"failed",suspended:"suspended"},w=["attaching","attached","detaching","suspended"],v=s[c];for(var C in this.all){var L=this.all[C];a.arrIn(w,L.state)&&L.notifyState(v,u)}},h.prototype.get=function(c,u){c=String(c);var s=this.all[c];if(!s)s=this.all[c]=new E.default(this.realtime,c,u);else if(u){if(s._shouldReattachToSetOptions(u,s.channelOptions))throw new R.default("Channels.get() cannot be used to set channel options that would cause the channel to reattach. Please, use RealtimeChannel.setOptions() instead.",4e4,400);s.setOptions(u)}return s},h.prototype.getDerived=function(c,u,s){if(u.filter){var w=a.toBase64(u.filter),v=a.matchDerivedChannel(c);c="[filter=".concat(w).concat(v.qualifierParam,"]").concat(v.channelName)}return this.get(c,s)},h.prototype.release=function(c){c=String(c);var u=this.all[c];if(u){var s=u.getReleaseErr();if(s)throw s;delete this.all[c]}},h}(d.default);r.default=p},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(7)),d=i.__importDefault(o(35)),g=i.__importDefault(o(2)),S=i.__importDefault(o(37)),E=i.__importDefault(o(3));function y(){}var R=function(f){i.__extends(k,f);function k(T,x){var p=f.call(this)||this;return p.whenState=function(m,b){return l.default.prototype.whenState.call(p,m,p.state,b,new S.default(void 0,m))},p.ably=T,p.connectionManager=new d.default(T,x),p.state=p.connectionManager.state.state,p.key=void 0,p.id=void 0,p.errorReason=null,p.connectionManager.on("connectionstate",function(m){var b=p.state=m.current;E.default.Config.nextTick(function(){p.emit(b,m)})}),p.connectionManager.on("update",function(m){E.default.Config.nextTick(function(){p.emit("update",m)})}),p}return k.prototype.connect=function(){g.default.logAction(g.default.LOG_MINOR,"Connection.connect()",""),this.connectionManager.requestState({state:"connecting"})},k.prototype.ping=function(T){if(g.default.logAction(g.default.LOG_MINOR,"Connection.ping()",""),!T){if(this.ably.options.promises)return a.promisify(this,"ping",arguments);T=y}this.connectionManager.ping(null,T)},k.prototype.close=function(){g.default.logAction(g.default.LOG_MINOR,"Connection.close()","connectionKey = "+this.key),this.connectionManager.requestState({state:"closing"})},Object.defineProperty(k.prototype,"recoveryKey",{get:function(){return this.createRecoveryKey()},enumerable:!1,configurable:!0}),k.prototype.createRecoveryKey=function(){return this.connectionManager.createRecoveryKey()},k}(l.default);r.default=R},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0}),r.PendingMessage=void 0;var i=o(0),a=i.__importDefault(o(10)),l=i.__importStar(o(1)),d=i.__importDefault(o(7)),g=i.__importDefault(o(2)),S=i.__importDefault(o(36)),E=i.__importDefault(o(4)),y=a.default.Action,R=function(){function k(T,x){this.message=T,this.callback=x,this.merged=!1;var p=T.action;this.sendAttempted=!1,this.ackRequired=p==y.MESSAGE||p==y.PRESENCE}return k}();r.PendingMessage=R;var f=function(k){i.__extends(T,k);function T(x){var p=k.call(this)||this;return p.transport=x,p.messageQueue=new S.default,x.on("ack",function(m,b){p.onAck(m,b)}),x.on("nack",function(m,b,h){p.onNack(m,b,h)}),p}return T.prototype.onAck=function(x,p){g.default.logAction(g.default.LOG_MICRO,"Protocol.onAck()","serial = "+x+"; count = "+p),this.messageQueue.completeMessages(x,p)},T.prototype.onNack=function(x,p,m){g.default.logAction(g.default.LOG_ERROR,"Protocol.onNack()","serial = "+x+"; count = "+p+"; err = "+l.inspectError(m)),m||(m=new E.default("Unable to send message; channel not responding",50001,500)),this.messageQueue.completeMessages(x,p,m)},T.prototype.onceIdle=function(x){var p=this.messageQueue;if(p.count()===0){x();return}p.once("idle",x)},T.prototype.send=function(x){x.ackRequired&&this.messageQueue.push(x),g.default.shouldLog(g.default.LOG_MICRO)&&g.default.logAction(g.default.LOG_MICRO,"Protocol.send()","sending msg; "+a.default.stringify(x.message)),x.sendAttempted=!0,this.transport.send(x.message)},T.prototype.getTransport=function(){return this.transport},T.prototype.getPendingMessages=function(){return this.messageQueue.copyAll()},T.prototype.clearPendingMessages=function(){return this.messageQueue.clear()},T.prototype.finish=function(){var x=this.transport;this.onceIdle(function(){x.disconnect()})},T}(d.default);r.default=f},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(3)),l=i.__importStar(o(1)),d=i.__importDefault(o(26)),g=i.__importDefault(o(8)),S=i.__importDefault(o(2)),E=i.__importDefault(o(10)),y=i.__importDefault(o(4)),R="web_socket";function f(x){return!!x.on}var k=function(x){i.__extends(p,x);function p(m,b,h){var c=x.call(this,m,b,h)||this;return c.shortName=R,h.heartbeats=a.default.Config.useProtocolHeartbeats,c.wsHost=g.default.getHost(h.options,h.host,!0),c}return p.isAvailable=function(){return!!a.default.Config.WebSocket},p.prototype.createWebSocket=function(m,b){return this.uri=m+l.toQueryString(b),new a.default.Config.WebSocket(this.uri)},p.prototype.toString=function(){return"WebSocketTransport; uri="+this.uri},p.prototype.connect=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","starting"),d.default.prototype.connect.call(this);var m=this,b=this.params,h=b.options,c=h.tls?"wss://":"ws://",u=c+this.wsHost+":"+g.default.getPort(h)+"/";S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","uri: "+u),this.auth.getAuthParams(function(s,w){if(!m.isDisposed){var v="";for(var C in w)v+=" "+C+": "+w[C]+";";if(S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.connect()","authParams:"+v+" err: "+s),s){m.disconnect(s);return}var L=b.getConnectParams(w);try{var N=m.wsConnection=m.createWebSocket(u,L);N.binaryType=a.default.Config.binaryType,N.onopen=function(){m.onWsOpen()},N.onclose=function(M){m.onWsClose(M)},N.onmessage=function(M){m.onWsData(M.data)},N.onerror=function(M){m.onWsError(M)},f(N)&&N.on("ping",function(){m.onActivity()})}catch(M){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.connect()","Unexpected exception creating websocket: err = "+(M.stack||M.message)),m.disconnect(M)}}})},p.prototype.send=function(m){var b=this.wsConnection;if(!b){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.send()","No socket connection");return}try{b.send(E.default.serialize(m,this.params.format))}catch(c){var h="Exception from ws connection when trying to send: "+l.inspectError(c);S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.send()",h),this.finish("disconnected",new y.default(h,5e4,500))}},p.prototype.onWsData=function(m){S.default.logAction(S.default.LOG_MICRO,"WebSocketTransport.onWsData()","data received; length = "+m.length+"; type = "+typeof m);try{this.onProtocolMessage(E.default.deserialize(m,this.format))}catch(b){S.default.logAction(S.default.LOG_ERROR,"WebSocketTransport.onWsData()","Unexpected exception handing channel message: "+b.stack)}},p.prototype.onWsOpen=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsOpen()","opened WebSocket"),this.emit("preconnect")},p.prototype.onWsClose=function(m){var b,h;if(typeof m=="object"?(h=m.code,b=m.wasClean||h===1e3):(h=m,b=h==1e3),delete this.wsConnection,b){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsClose()","Cleanly closed WebSocket");var c=new y.default("Websocket closed",80003,400);this.finish("disconnected",c)}else{var u="Unclean disconnection of WebSocket ; code = "+h,c=new y.default(u,80003,400);S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onWsClose()",u),this.finish("disconnected",c)}this.emit("disposed")},p.prototype.onWsError=function(m){var b=this;S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.onError()","Error from WebSocket: "+m.message),a.default.Config.nextTick(function(){b.disconnect(Error(m.message))})},p.prototype.dispose=function(){S.default.logAction(S.default.LOG_MINOR,"WebSocketTransport.dispose()",""),this.isDisposed=!0;var m=this.wsConnection;m&&(m.onmessage=function(){},delete this.wsConnection,a.default.Config.nextTick(function(){if(S.default.logAction(S.default.LOG_MICRO,"WebSocketTransport.dispose()","closing websocket"),!m)throw new Error("WebSocketTransport.dispose(): wsConnection is not defined");m.close()}))},p}(d.default);function T(x){return k.isAvailable()&&(x.supportedTransports[R]=k),k}r.default=T},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(1)),l=i.__importDefault(o(34)),d=i.__importDefault(o(7)),g=i.__importDefault(o(2)),S=i.__importDefault(o(16)),E=i.__importStar(o(4)),y=i.__importDefault(o(38)),R=i.__importDefault(o(24)),f=i.__importDefault(o(39)),k=function(){};function T(c){return c.channel.realtime.auth.clientId}function x(c){var u=c.channel.realtime,s=u.auth.clientId;return(!s||s==="*")&&u.connection.state==="connected"}function p(c,u,s){switch(c.state){case"attached":case"suspended":s();break;case"initialized":case"detached":case"detaching":case"attaching":c.attach(function(w){w?u(w):s()});break;default:u(E.default.fromValues(c.invalidStateError()))}}function m(c,u){if(c.isSynthesized()||u.isSynthesized())return c.timestamp>=u.timestamp;var s=c.parseId(),w=u.parseId();return s.msgSerial===w.msgSerial?s.index>w.index:s.msgSerial>w.msgSerial}var b=function(c){i.__extends(u,c);function u(s){var w=c.call(this,s)||this;return w.channel=s,w.syncComplete=!1,w.members=new h(w,function(v){return v.clientId+":"+v.connectionId}),w._myMembers=new h(w,function(v){return v.clientId}),w.subscriptions=new d.default,w.pendingPresence=[],w}return u.prototype.enter=function(s,w){if(x(this))throw new E.default("clientId must be specified to enter a presence channel",40012,400);return this._enterOrUpdateClient(void 0,void 0,s,"enter",w)},u.prototype.update=function(s,w){if(x(this))throw new E.default("clientId must be specified to update presence data",40012,400);return this._enterOrUpdateClient(void 0,void 0,s,"update",w)},u.prototype.enterClient=function(s,w,v){return this._enterOrUpdateClient(void 0,s,w,"enter",v)},u.prototype.updateClient=function(s,w,v){return this._enterOrUpdateClient(void 0,s,w,"update",v)},u.prototype._enterOrUpdateClient=function(s,w,v,C,L){var N=this;if(!L)if(typeof v=="function")L=v,v=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"_enterOrUpdateClient",[s,w,v,C]);L=k}var M=this.channel;if(!M.connectionManager.activeState()){L(M.connectionManager.getError());return}g.default.logAction(g.default.LOG_MICRO,"RealtimePresence."+C+"Client()","channel = "+M.name+", id = "+s+", client = "+(w||"(implicit) "+T(this)));var I=S.default.fromData(v);I.action=C,s&&(I.id=s),w&&(I.clientId=w),S.default.encode(I,M.channelOptions,function(P){if(P){L(P);return}switch(M.state){case"attached":M.sendPresence(I,L);break;case"initialized":case"detached":M.attach();case"attaching":N.pendingPresence.push({presence:I,callback:L});break;default:P=new E.PartialErrorInfo("Unable to "+C+" presence channel while in "+M.state+" state",90001),P.code=90001,L(P)}})},u.prototype.leave=function(s,w){if(x(this))throw new E.default("clientId must have been specified to enter or leave a presence channel",40012,400);return this.leaveClient(void 0,s,w)},u.prototype.leaveClient=function(s,w,v){if(!v)if(typeof w=="function")v=w,w=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"leaveClient",[s,w]);v=k}var C=this.channel;if(!C.connectionManager.activeState()){v==null||v(C.connectionManager.getError());return}g.default.logAction(g.default.LOG_MICRO,"RealtimePresence.leaveClient()","leaving; channel = "+this.channel.name+", client = "+s);var L=S.default.fromData(w);switch(L.action="leave",s&&(L.clientId=s),C.state){case"attached":C.sendPresence(L,v);break;case"attaching":this.pendingPresence.push({presence:L,callback:v});break;case"initialized":case"failed":{var N=new E.PartialErrorInfo("Unable to leave presence channel (incompatible state)",90001);v==null||v(N);break}default:v==null||v(C.invalidStateError())}},u.prototype.get=function(s,w){var v=this,C=Array.prototype.slice.call(arguments);C.length==1&&typeof C[0]=="function"&&C.unshift(null),s=C[0],w=C[1];var L=!s||("waitForSync"in s?s.waitForSync:!0);if(!w){if(this.channel.realtime.options.promises)return a.promisify(this,"get",C);w=k}function N(M){w(null,s?M.list(s):M.values())}if(this.channel.state==="suspended"){L?w(E.default.fromValues({statusCode:400,code:91005,message:"Presence state is out of sync due to channel being in the SUSPENDED state"})):N(this.members);return}p(this.channel,w,function(){var M=v.members;L?M.waitSync(function(){N(M)}):N(M)})},u.prototype.history=function(s,w){if(g.default.logAction(g.default.LOG_MICRO,"RealtimePresence.history()","channel = "+this.name),w===void 0)if(typeof s=="function")w=s,s=null;else{if(this.channel.realtime.options.promises)return a.promisify(this,"history",arguments);w=k}s&&s.untilAttach&&(this.channel.state==="attached"?(delete s.untilAttach,s.from_serial=this.channel.properties.attachSerial):w(new E.default("option untilAttach requires the channel to be attached, was: "+this.channel.state,4e4,400))),l.default.prototype._history.call(this,s,w)},u.prototype.setPresence=function(s,w,v){g.default.logAction(g.default.LOG_MICRO,"RealtimePresence.setPresence()","received presence for "+s.length+" participants; syncChannelSerial = "+v);var C,L,N=this.members,M=this._myMembers,I=[],P=this.channel.connectionManager.connectionId;w&&(this.members.startSync(),v&&(L=v.match(/^[\w-]+:(.*)$/))&&(C=L[1]));for(var A=0;A<s.length;A++){var j=S.default.fromValues(s[A]);switch(j.action){case"leave":N.remove(j)&&I.push(j),j.connectionId===P&&!j.isSynthesized()&&M.remove(j);break;case"enter":case"present":case"update":N.put(j)&&I.push(j),j.connectionId===P&&M.put(j);break}}w&&!C&&(N.endSync(),this.channel.syncChannelSerial=null);for(var A=0;A<I.length;A++){var j=I[A];this.subscriptions.emit(j.action,j)}},u.prototype.onAttached=function(s){g.default.logAction(g.default.LOG_MINOR,"RealtimePresence.onAttached()","channel = "+this.channel.name+", hasPresence = "+s),s?this.members.startSync():(this._synthesizeLeaves(this.members.values()),this.members.clear()),this._ensureMyMembersPresent();var w=this.pendingPresence,v=w.length;if(v){this.pendingPresence=[];var C=[],L=R.default.create();g.default.logAction(g.default.LOG_MICRO,"RealtimePresence.onAttached","sending "+v+" queued presence messages");for(var N=0;N<v;N++){var M=w[N];C.push(M.presence),L.push(M.callback)}this.channel.sendPresence(C,L)}},u.prototype.actOnChannelState=function(s,w,v){switch(s){case"attached":this.onAttached(w);break;case"detached":case"failed":this._clearMyMembers(),this.members.clear();case"suspended":this.failPendingPresence(v);break}},u.prototype.failPendingPresence=function(s){if(this.pendingPresence.length){g.default.logAction(g.default.LOG_MINOR,"RealtimeChannel.failPendingPresence","channel; name = "+this.channel.name+", err = "+a.inspectError(s));for(var w=0;w<this.pendingPresence.length;w++)try{this.pendingPresence[w].callback(s)}catch(v){}this.pendingPresence=[]}},u.prototype._clearMyMembers=function(){this._myMembers.clear()},u.prototype._ensureMyMembersPresent=function(){var s=this,w=this._myMembers,v=function(N){if(N){var M="Presence auto-re-enter failed: "+N.toString(),I=new E.default(M,91004,400);g.default.logAction(g.default.LOG_ERROR,"RealtimePresence._ensureMyMembersPresent()",M);var P=new f.default(s.channel.state,s.channel.state,!0,!1,I);s.channel.emit("update",P)}};for(var C in w.map){var L=w.map[C];g.default.logAction(g.default.LOG_MICRO,"RealtimePresence._ensureMyMembersPresent()",'Auto-reentering clientId "'+L.clientId+'" into the presence set'),this._enterOrUpdateClient(L.id,L.clientId,L.data,"enter",v)}},u.prototype._synthesizeLeaves=function(s){var w=this.subscriptions;a.arrForEach(s,function(v){var C=S.default.fromValues({action:"leave",connectionId:v.connectionId,clientId:v.clientId,data:v.data,encoding:v.encoding,timestamp:a.now()});w.emit("leave",C)})},u.prototype.on=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];g.default.renamedMethod("RealtimePresence","on","subscribe"),this.subscribe.apply(this,s)},u.prototype.off=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];g.default.renamedMethod("RealtimePresence","off","unsubscribe"),this.unsubscribe.apply(this,s)},u.prototype.subscribe=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];var v=y.default.processListenerArgs(s),C=v[0],L=v[1],N=v[2],M=this.channel;if(!N){if(this.channel.realtime.options.promises)return a.promisify(this,"subscribe",[C,L]);N=k}if(M.state==="failed"){N(E.default.fromValues(M.invalidStateError()));return}this.subscriptions.on(C,L),M.attach(N)},u.prototype.unsubscribe=function(){for(var s=[],w=0;w<arguments.length;w++)s[w]=arguments[w];var v=y.default.processListenerArgs(s),C=v[0],L=v[1];this.subscriptions.off(C,L)},u}(l.default),h=function(c){i.__extends(u,c);function u(s,w){var v=c.call(this)||this;return v.presence=s,v.map=Object.create(null),v.syncInProgress=!1,v.residualMembers=null,v.memberKey=w,v}return u.prototype.get=function(s){return this.map[s]},u.prototype.getClient=function(s){var w=this.map,v=[];for(var C in w){var L=w[C];L.clientId==s&&L.action!="absent"&&v.push(L)}return v},u.prototype.list=function(s){var w=this.map,v=s&&s.clientId,C=s&&s.connectionId,L=[];for(var N in w){var M=w[N];M.action!=="absent"&&(v&&v!=M.clientId||C&&C!=M.connectionId||L.push(M))}return L},u.prototype.put=function(s){(s.action==="enter"||s.action==="update")&&(s=S.default.fromValues(s),s.action="present");var w=this.map,v=this.memberKey(s);this.residualMembers&&delete this.residualMembers[v];var C=w[v];return C&&!m(s,C)?!1:(w[v]=s,!0)},u.prototype.values=function(){var s=this.map,w=[];for(var v in s){var C=s[v];C.action!="absent"&&w.push(C)}return w},u.prototype.remove=function(s){var w=this.map,v=this.memberKey(s),C=w[v];return C&&!m(s,C)?!1:(this.syncInProgress?(s=S.default.fromValues(s),s.action="absent",w[v]=s):delete w[v],!0)},u.prototype.startSync=function(){var s=this.map,w=this.syncInProgress;g.default.logAction(g.default.LOG_MINOR,"PresenceMap.startSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),this.syncInProgress||(this.residualMembers=a.copy(s),this.setInProgress(!0))},u.prototype.endSync=function(){var s=this.map,w=this.syncInProgress;if(g.default.logAction(g.default.LOG_MINOR,"PresenceMap.endSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),w){for(var v in s){var C=s[v];C.action==="absent"&&delete s[v]}this.presence._synthesizeLeaves(a.valuesArray(this.residualMembers));for(var v in this.residualMembers)delete s[v];this.residualMembers=null,this.setInProgress(!1)}this.emit("sync")},u.prototype.waitSync=function(s){var w=this.syncInProgress;if(g.default.logAction(g.default.LOG_MINOR,"PresenceMap.waitSync()","channel = "+this.presence.channel.name+"; syncInProgress = "+w),!w){s();return}this.once("sync",s)},u.prototype.clear=function(){this.map={},this.setInProgress(!1),this.residualMembers=null},u.prototype.setInProgress=function(s){g.default.logAction(g.default.LOG_MICRO,"PresenceMap.setInProgress()","inProgress = "+s),this.syncInProgress=s,this.presence.syncComplete=!s},u}(d.default);r.default=b},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=o(56),l=o(31),d=o(11),g=i.__importDefault(o(5)),S=i.__importDefault(o(3)),E=function(){function y(){this.base64CharSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",this.hexCharSet="0123456789abcdef"}return y.prototype.isWordArray=function(R){return R!=null&&R.sigBytes!==void 0},y.prototype.isArrayBuffer=function(R){return R!=null&&R.constructor===ArrayBuffer},y.prototype.isTypedArray=function(R){return!!ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(R)},y.prototype.uint8ViewToBase64=function(R){for(var f="",k=this.base64CharSet,T=R.byteLength,x=T%3,p=T-x,m,b,h,c,u,s=0;s<p;s=s+3)u=R[s]<<16|R[s+1]<<8|R[s+2],m=(u&16515072)>>18,b=(u&258048)>>12,h=(u&4032)>>6,c=u&63,f+=k[m]+k[b]+k[h]+k[c];return x==1?(u=R[p],m=(u&252)>>2,b=(u&3)<<4,f+=k[m]+k[b]+"=="):x==2&&(u=R[p]<<8|R[p+1],m=(u&64512)>>10,b=(u&1008)>>4,h=(u&15)<<2,f+=k[m]+k[b]+k[h]+"="),f},y.prototype.base64ToArrayBuffer=function(R){for(var f=atob==null?void 0:atob(R),k=f.length,T=new Uint8Array(k),x=0;x<k;x++){var p=f.charCodeAt(x);T[x]=p}return T.buffer},y.prototype.isBuffer=function(R){return this.isArrayBuffer(R)||this.isWordArray(R)||this.isTypedArray(R)},y.prototype.toBuffer=function(R){if(!ArrayBuffer)throw new Error("Can't convert to Buffer: browser does not support the necessary types");if(this.isArrayBuffer(R))return new Uint8Array(R);if(this.isTypedArray(R))return new Uint8Array(R.buffer);if(this.isWordArray(R)){for(var f=new ArrayBuffer(R.sigBytes),k=new Uint8Array(f),T=0;T<R.sigBytes;T++)k[T]=R.words[T>>>2]>>>24-T%4*8&255;return k}throw new Error("BufferUtils.toBuffer expected an arraybuffer, typed array, or CryptoJS wordarray")},y.prototype.toArrayBuffer=function(R){return this.isArrayBuffer(R)?R:this.toBuffer(R).buffer},y.prototype.toWordArray=function(R){return this.isTypedArray(R)&&(R=R.buffer),this.isWordArray(R)?R:g.default.create(R)},y.prototype.base64Encode=function(R){return this.isWordArray(R)?(0,d.stringify)(R):this.uint8ViewToBase64(this.toBuffer(R))},y.prototype.base64Decode=function(R){return ArrayBuffer&&S.default.Config.atob?this.base64ToArrayBuffer(R):(0,d.parse)(R)},y.prototype.hexEncode=function(R){return(0,a.stringify)(this.toWordArray(R))},y.prototype.hexDecode=function(R){var f=(0,a.parse)(R);return ArrayBuffer?this.toArrayBuffer(f):f},y.prototype.utf8Encode=function(R){return S.default.Config.TextEncoder?new S.default.Config.TextEncoder().encode(R).buffer:(0,l.parse)(R)},y.prototype.utf8Decode=function(R){if(!this.isBuffer(R))throw new Error("Expected input of utf8decode to be an arraybuffer, typed array, or CryptoJS wordarray");return TextDecoder&&!this.isWordArray(R)?new TextDecoder().decode(R):(R=this.toWordArray(R),(0,l.stringify)(R))},y.prototype.bufferCompare=function(R,f){if(!R)return-1;if(!f)return 1;var k=this.toWordArray(R),T=this.toWordArray(f);k.clamp(),T.clamp();var x=k.sigBytes-T.sigBytes;if(x!=0)return x;for(var p=k.words,m=T.words,b=0;b<p.length;b++)if(x=p[b]-m[b],x!=0)return x;return 0},y.prototype.byteLength=function(R){return this.isArrayBuffer(R)||this.isTypedArray(R)?R.byteLength:this.isWordArray(R)?R.sigBytes:-1},y.prototype.typedArrayToBuffer=function(R){return R.buffer},y}();r.default=new E},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return i.enc.Hex})},function(n,r,o){o.r(r);var i=o(5),a=o.n(i),l=o(11),d=o(23),g=o.n(d),S=o(2),E=o.n(S),y=o(4),R=o.n(y),f=function(k,T){var x="aes",p=256,m="cbc",b=16,h=4,c=4294967296,u=2147483648,s;if(k.getRandomWordArray)s=k.getRandomWordArray;else if(typeof Uint32Array!="undefined"&&k.getRandomValues){var w=new Uint32Array(h);s=function(A,j){var U=A/4,z=U==h?w:new Uint32Array(U);k.getRandomValues(z,function($){typeof j!="undefined"&&j($,T.toWordArray(z))})}}else s=function(A,j){E.a.logAction(E.a.LOG_MAJOR,"Ably.Crypto.generateRandom()","Warning: the browser you are using does not support secure cryptographically secure randomness generation; falling back to insecure Math.random()");for(var U=A/4,z=new Array(U),$=0;$<U;$++)z[$]=Math.floor(Math.random()*c)-u;j(null,a.a.create(z))};function v(A){return A+b&-16}function C(A){if(A.algorithm==="aes"&&A.mode==="cbc"){if(A.keyLength===128||A.keyLength===256)return;throw new Error("Unsupported key length "+A.keyLength+" for aes-cbc encryption. Encryption key must be 128 or 256 bits (16 or 32 ASCII characters)")}}function L(A){return A.replace("_","/").replace("-","+")}var N=[a.a.create([269488144,269488144,269488144,269488144],16),a.a.create([16777216],1),a.a.create([33685504],2),a.a.create([50529024],3),a.a.create([67372036],4),a.a.create([84215045,83886080],5),a.a.create([101058054,101056512],6),a.a.create([117901063,117901056],7),a.a.create([134744072,134744072],8),a.a.create([151587081,151587081,150994944],9),a.a.create([168430090,168430090,168427520],10),a.a.create([185273099,185273099,185273088],11),a.a.create([202116108,202116108,202116108],12),a.a.create([218959117,218959117,218959117,218103808],13),a.a.create([235802126,235802126,235802126,235798528],14),a.a.create([252645135,252645135,252645135,252645135],15),a.a.create([269488144,269488144,269488144,269488144],16)];function M(){}function I(){this.algorithm=null,this.keyLength=null,this.mode=null,this.key=null}M.CipherParams=I,M.getDefaultParams=function(A){var j;if(typeof A=="function"||typeof A=="string"){if(E.a.deprecated("The ability to pass a callback to `Crypto.getDefaultParams()`","This method now directly returns its result, instead of returning it asynchronously via a callback. Please update your code so that it uses the return value of this method instead of passing a callback."),typeof A=="function")E.a.deprecated("The ability to call `Crypto.getDefaultParams()` without specifying an encryption key","Please update your code so that it instead passes an object whose `key` property contains an encryption key. That is, replace `Crypto.getDefaultParams()` with `Crypto.getDefaultParams({ key })`, where `key` is an encryption key that you have generated (for example from the `Crypto.generateRandomKey()` method)."),M.generateRandomKey(function(z){A(null,M.getDefaultParams({key:z}))});else if(typeof arguments[1]=="function")E.a.deprecated("The ability to pass the encryption key as the first argument of `Crypto.getDefaultParams()`","Please update your code so that it instead passes an object whose `key` property contains the key. That is, replace `Crypto.getDefaultParams(key)` with `Crypto.getDefaultParams({ key })`."),arguments[1](null,M.getDefaultParams({key:A}));else throw new Error("Invalid arguments for Crypto.getDefaultParams");return}if(!A.key)throw new Error("Crypto.getDefaultParams: a key is required");typeof A.key=="string"?j=Object(l.parse)(L(A.key)):j=T.toWordArray(A.key);var U=new I;if(U.key=j,U.algorithm=A.algorithm||x,U.keyLength=j.words.length*(4*8),U.mode=A.mode||m,A.keyLength&&A.keyLength!==U.keyLength)throw new Error("Crypto.getDefaultParams: a keyLength of "+A.keyLength+" was specified, but the key actually has length "+U.keyLength);return C(U),U},M.generateRandomKey=function(A,j){arguments.length==1&&typeof A=="function"&&(j=A,A=void 0),s((A||p)/8,function(U,z){j!==void 0&&j(U?R.a.fromValues(U):null,z)})},M.getCipher=function(A){var j=A instanceof I?A:M.getDefaultParams(A);return{cipherParams:j,cipher:new P(j,h,A.iv)}};function P(A,j,U){this.algorithm=A.algorithm+"-"+String(A.keyLength)+"-"+A.mode,this.cjsAlgorithm=A.algorithm.toUpperCase().replace(/-\d+$/,""),this.key=T.toWordArray(A.key),U&&(this.iv=T.toWordArray(U).clone()),this.blockLengthWords=j}return P.prototype.encrypt=function(A,j){E.a.logAction(E.a.LOG_MICRO,"CBCCipher.encrypt()",""),A=T.toWordArray(A);var U=A.sigBytes,z=v(U),$=this,W=function(){$.getIv(function(F,O){if(F){j(F);return}var D=$.encryptCipher.process(A.concat(N[z-U])),B=O.concat(D);j(null,B)})};this.encryptCipher?W():this.iv?(this.encryptCipher=g.a.algo[this.cjsAlgorithm].createEncryptor(this.key,{iv:this.iv}),W()):s(b,function(F,O){if(F){j(F);return}$.encryptCipher=g.a.algo[$.cjsAlgorithm].createEncryptor($.key,{iv:O}),$.iv=O,W()})},P.prototype.decrypt=function(A){E.a.logAction(E.a.LOG_MICRO,"CBCCipher.decrypt()",""),A=T.toWordArray(A);var j=this.blockLengthWords,U=A.words,z=a.a.create(U.slice(0,j)),$=a.a.create(U.slice(j)),W=g.a.algo[this.cjsAlgorithm].createDecryptor(this.key,{iv:z}),F=W.process($),O=W.finalize();return W.reset(),O&&O.sigBytes&&F.concat(O),F},P.prototype.getIv=function(A){if(this.iv){var j=this.iv;this.iv=null,A(null,j);return}var U=this;s(b,function(z,$){if(z){A(z);return}A(null,U.encryptCipher.process($))})},M};r.default=f},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(){var a=i,l=a.lib,d=l.WordArray,g=a.enc;g.Utf16=g.Utf16BE={stringify:function(E){for(var y=E.words,R=E.sigBytes,f=[],k=0;k<R;k+=2){var T=y[k>>>2]>>>16-k%4*8&65535;f.push(String.fromCharCode(T))}return f.join("")},parse:function(E){for(var y=E.length,R=[],f=0;f<y;f++)R[f>>>1]|=E.charCodeAt(f)<<16-f%2*16;return d.create(R,y*2)}},g.Utf16LE={stringify:function(E){for(var y=E.words,R=E.sigBytes,f=[],k=0;k<R;k+=2){var T=S(y[k>>>2]>>>16-k%4*8&65535);f.push(String.fromCharCode(T))}return f.join("")},parse:function(E){for(var y=E.length,R=[],f=0;f<y;f++)R[f>>>1]|=S(E.charCodeAt(f)<<16-f%2*16);return d.create(R,y*2)}};function S(E){return E<<8&4278255360|E>>>8&16711935}}(),i.enc.Utf16})},function(n,r,o){(function(i,a){n.exports=a(o(6),o(28))})(this,function(i){return function(a){var l=i,d=l.lib,g=d.CipherParams,S=l.enc,E=S.Hex,y=l.format;y.Hex={stringify:function(R){return R.ciphertext.toString(E)},parse:function(R){var f=E.parse(R);return g.create({ciphertext:f})}}}(),i.format.Hex})},function(n,r,o){(function(i,a){n.exports=a(o(6),o(11),o(61),o(27),o(28))})(this,function(i){return function(){var a=i,l=a.lib,d=l.BlockCipher,g=a.algo,S=[],E=[],y=[],R=[],f=[],k=[],T=[],x=[],p=[],m=[];(function(){for(var c=[],u=0;u<256;u++)u<128?c[u]=u<<1:c[u]=u<<1^283;for(var s=0,w=0,u=0;u<256;u++){var v=w^w<<1^w<<2^w<<3^w<<4;v=v>>>8^v&255^99,S[s]=v,E[v]=s;var C=c[s],L=c[C],N=c[L],M=c[v]*257^v*16843008;y[s]=M<<24|M>>>8,R[s]=M<<16|M>>>16,f[s]=M<<8|M>>>24,k[s]=M;var M=N*16843009^L*65537^C*257^s*16843008;T[v]=M<<24|M>>>8,x[v]=M<<16|M>>>16,p[v]=M<<8|M>>>24,m[v]=M,s?(s=C^c[c[c[N^C]]],w^=c[c[w]]):s=w=1}})();var b=[0,1,2,4,8,16,32,64,128,27,54],h=g.AES=d.extend({_doReset:function(){var c;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var u=this._keyPriorReset=this._key,s=u.words,w=u.sigBytes/4,v=this._nRounds=w+6,C=(v+1)*4,L=this._keySchedule=[],N=0;N<C;N++)N<w?L[N]=s[N]:(c=L[N-1],N%w?w>6&&N%w==4&&(c=S[c>>>24]<<24|S[c>>>16&255]<<16|S[c>>>8&255]<<8|S[c&255]):(c=c<<8|c>>>24,c=S[c>>>24]<<24|S[c>>>16&255]<<16|S[c>>>8&255]<<8|S[c&255],c^=b[N/w|0]<<24),L[N]=L[N-w]^c);for(var M=this._invKeySchedule=[],I=0;I<C;I++){var N=C-I;if(I%4)var c=L[N];else var c=L[N-4];I<4||N<=4?M[I]=c:M[I]=T[S[c>>>24]]^x[S[c>>>16&255]]^p[S[c>>>8&255]]^m[S[c&255]]}}},encryptBlock:function(c,u){this._doCryptBlock(c,u,this._keySchedule,y,R,f,k,S)},decryptBlock:function(c,u){var s=c[u+1];c[u+1]=c[u+3],c[u+3]=s,this._doCryptBlock(c,u,this._invKeySchedule,T,x,p,m,E);var s=c[u+1];c[u+1]=c[u+3],c[u+3]=s},_doCryptBlock:function(c,u,s,w,v,C,L,N){for(var M=this._nRounds,I=c[u]^s[0],P=c[u+1]^s[1],A=c[u+2]^s[2],j=c[u+3]^s[3],U=4,z=1;z<M;z++){var $=w[I>>>24]^v[P>>>16&255]^C[A>>>8&255]^L[j&255]^s[U++],W=w[P>>>24]^v[A>>>16&255]^C[j>>>8&255]^L[I&255]^s[U++],F=w[A>>>24]^v[j>>>16&255]^C[I>>>8&255]^L[P&255]^s[U++],O=w[j>>>24]^v[I>>>16&255]^C[P>>>8&255]^L[A&255]^s[U++];I=$,P=W,A=F,j=O}var $=(N[I>>>24]<<24|N[P>>>16&255]<<16|N[A>>>8&255]<<8|N[j&255])^s[U++],W=(N[P>>>24]<<24|N[A>>>16&255]<<16|N[j>>>8&255]<<8|N[I&255])^s[U++],F=(N[A>>>24]<<24|N[j>>>16&255]<<16|N[I>>>8&255]<<8|N[P&255])^s[U++],O=(N[j>>>24]<<24|N[I>>>16&255]<<16|N[P>>>8&255]<<8|N[A&255])^s[U++];c[u]=$,c[u+1]=W,c[u+2]=F,c[u+3]=O},keySize:256/32});a.AES=d._createHelper(h)}(),i.AES})},function(n,r,o){(function(i,a){n.exports=a(o(6))})(this,function(i){return function(a){var l=i,d=l.lib,g=d.WordArray,S=d.Hasher,E=l.algo,y=[];(function(){for(var p=0;p<64;p++)y[p]=a.abs(a.sin(p+1))*4294967296|0})();var R=E.MD5=S.extend({_doReset:function(){this._hash=new g.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,m){for(var b=0;b<16;b++){var h=m+b,c=p[h];p[h]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360}var u=this._hash.words,s=p[m+0],w=p[m+1],v=p[m+2],C=p[m+3],L=p[m+4],N=p[m+5],M=p[m+6],I=p[m+7],P=p[m+8],A=p[m+9],j=p[m+10],U=p[m+11],z=p[m+12],$=p[m+13],W=p[m+14],F=p[m+15],O=u[0],D=u[1],B=u[2],_=u[3];O=f(O,D,B,_,s,7,y[0]),_=f(_,O,D,B,w,12,y[1]),B=f(B,_,O,D,v,17,y[2]),D=f(D,B,_,O,C,22,y[3]),O=f(O,D,B,_,L,7,y[4]),_=f(_,O,D,B,N,12,y[5]),B=f(B,_,O,D,M,17,y[6]),D=f(D,B,_,O,I,22,y[7]),O=f(O,D,B,_,P,7,y[8]),_=f(_,O,D,B,A,12,y[9]),B=f(B,_,O,D,j,17,y[10]),D=f(D,B,_,O,U,22,y[11]),O=f(O,D,B,_,z,7,y[12]),_=f(_,O,D,B,$,12,y[13]),B=f(B,_,O,D,W,17,y[14]),D=f(D,B,_,O,F,22,y[15]),O=k(O,D,B,_,w,5,y[16]),_=k(_,O,D,B,M,9,y[17]),B=k(B,_,O,D,U,14,y[18]),D=k(D,B,_,O,s,20,y[19]),O=k(O,D,B,_,N,5,y[20]),_=k(_,O,D,B,j,9,y[21]),B=k(B,_,O,D,F,14,y[22]),D=k(D,B,_,O,L,20,y[23]),O=k(O,D,B,_,A,5,y[24]),_=k(_,O,D,B,W,9,y[25]),B=k(B,_,O,D,C,14,y[26]),D=k(D,B,_,O,P,20,y[27]),O=k(O,D,B,_,$,5,y[28]),_=k(_,O,D,B,v,9,y[29]),B=k(B,_,O,D,I,14,y[30]),D=k(D,B,_,O,z,20,y[31]),O=T(O,D,B,_,N,4,y[32]),_=T(_,O,D,B,P,11,y[33]),B=T(B,_,O,D,U,16,y[34]),D=T(D,B,_,O,W,23,y[35]),O=T(O,D,B,_,w,4,y[36]),_=T(_,O,D,B,L,11,y[37]),B=T(B,_,O,D,I,16,y[38]),D=T(D,B,_,O,j,23,y[39]),O=T(O,D,B,_,$,4,y[40]),_=T(_,O,D,B,s,11,y[41]),B=T(B,_,O,D,C,16,y[42]),D=T(D,B,_,O,M,23,y[43]),O=T(O,D,B,_,A,4,y[44]),_=T(_,O,D,B,z,11,y[45]),B=T(B,_,O,D,F,16,y[46]),D=T(D,B,_,O,v,23,y[47]),O=x(O,D,B,_,s,6,y[48]),_=x(_,O,D,B,I,10,y[49]),B=x(B,_,O,D,W,15,y[50]),D=x(D,B,_,O,N,21,y[51]),O=x(O,D,B,_,z,6,y[52]),_=x(_,O,D,B,C,10,y[53]),B=x(B,_,O,D,j,15,y[54]),D=x(D,B,_,O,w,21,y[55]),O=x(O,D,B,_,P,6,y[56]),_=x(_,O,D,B,F,10,y[57]),B=x(B,_,O,D,M,15,y[58]),D=x(D,B,_,O,$,21,y[59]),O=x(O,D,B,_,L,6,y[60]),_=x(_,O,D,B,U,10,y[61]),B=x(B,_,O,D,v,15,y[62]),D=x(D,B,_,O,A,21,y[63]),u[0]=u[0]+O|0,u[1]=u[1]+D|0,u[2]=u[2]+B|0,u[3]=u[3]+_|0},_doFinalize:function(){var p=this._data,m=p.words,b=this._nDataBytes*8,h=p.sigBytes*8;m[h>>>5]|=128<<24-h%32;var c=a.floor(b/4294967296),u=b;m[(h+64>>>9<<4)+15]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,m[(h+64>>>9<<4)+14]=(u<<8|u>>>24)&16711935|(u<<24|u>>>8)&4278255360,p.sigBytes=(m.length+1)*4,this._process();for(var s=this._hash,w=s.words,v=0;v<4;v++){var C=w[v];w[v]=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360}return s},clone:function(){var p=S.clone.call(this);return p._hash=this._hash.clone(),p}});function f(p,m,b,h,c,u,s){var w=p+(m&b|~m&h)+c+s;return(w<<u|w>>>32-u)+m}function k(p,m,b,h,c,u,s){var w=p+(m&h|b&~h)+c+s;return(w<<u|w>>>32-u)+m}function T(p,m,b,h,c,u,s){var w=p+(m^b^h)+c+s;return(w<<u|w>>>32-u)+m}function x(p,m,b,h,c,u,s){var w=p+(b^(m|~h))+c+s;return(w<<u|w>>>32-u)+m}l.MD5=S._createHelper(R),l.HmacMD5=S._createHmacHelper(R)}(Math),i.MD5})},function(n,r,o){var i;Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),l=a.__importDefault(o(3)),d=a.__importStar(o(1)),g=a.__importDefault(o(8)),S=o(4),E=a.__importDefault(o(19)),y=a.__importDefault(o(17)),R=a.__importDefault(o(22)),f=a.__importDefault(o(2)),k=o(29),T=a.__importDefault(o(63)),x=o(14);function p(h){var c=h.statusCode;return c===408&&!h.code||c===400&&!h.code||c>=500&&c<=504}function m(h){var c=h.connection,u=c&&c.connectionManager.host;return u?[u].concat(g.default.getFallbackHosts(h.options)):g.default.getHosts(h.options)}var b=(i=function(){function h(c){this.checksInProgress=null,this.checkConnectivity=void 0,this.supportsAuthHeaders=!1,this.supportsLinkHeaders=!1,this._getHosts=m,this.options=c||{};var u=this.options.connectivityCheckUrl||g.default.connectivityCheckUrl,s=this.options.connectivityCheckParams,w=!this.options.connectivityCheckUrl;l.default.Config.xhrSupported?(this.supportsAuthHeaders=!0,this.Request=function(v,C,L,N,M,I,P){var A=y.default.createRequest(L,N,M,I,R.default.REQ_SEND,C&&C.options.timeouts,v);return A.once("complete",P),A.exec(),A},this.options.disableConnectivityCheck?this.checkConnectivity=function(v){v(null,!0)}:this.checkConnectivity=function(v){f.default.logAction(f.default.LOG_MICRO,"(XHRRequest)Http.checkConnectivity()","Sending; "+u),this.doUri(E.default.Get,null,u,null,null,s,function(C,L,N,M,I){var P=!1;w?P=!C&&(L==null?void 0:L.replace(/\n/,""))=="yes":P=!C&&(0,x.isSuccessCode)(I),f.default.logAction(f.default.LOG_MICRO,"(XHRRequest)Http.checkConnectivity()","Result: "+P),v(null,P)})}):l.default.Config.jsonpSupported?(this.Request=function(v,C,L,N,M,I,P){var A=(0,k.createRequest)(L,N,M,I,R.default.REQ_SEND,C&&C.options.timeouts,v);return A.once("complete",P),l.default.Config.nextTick(function(){A.exec()}),A},this.options.disableConnectivityCheck?this.checkConnectivity=function(v){v(null,!0)}:this.checkConnectivity=function(v){var C=this,L=g.default.jsonpInternetUpUrl;if(this.checksInProgress){this.checksInProgress.push(v);return}this.checksInProgress=[v],f.default.logAction(f.default.LOG_MICRO,"(JSONP)Http.checkConnectivity()","Sending; "+L);var N=new k.Request("isTheInternetUp",L,null,null,null,R.default.REQ_SEND,g.default.TIMEOUTS);N.once("complete",function(M,I){var P=!M&&I;f.default.logAction(f.default.LOG_MICRO,"(JSONP)Http.checkConnectivity()","Result: "+P);for(var A=0;A<C.checksInProgress.length;A++)C.checksInProgress[A](null,P);C.checksInProgress=null}),l.default.Config.nextTick(function(){N.exec()})}):l.default.Config.fetchSupported?(this.supportsAuthHeaders=!0,this.Request=T.default,this.checkConnectivity=function(v){f.default.logAction(f.default.LOG_MICRO,"(Fetch)Http.checkConnectivity()","Sending; "+u),this.doUri(E.default.Get,null,u,null,null,null,function(C,L){var N=!C&&(L==null?void 0:L.replace(/\n/,""))=="yes";f.default.logAction(f.default.LOG_MICRO,"(Fetch)Http.checkConnectivity()","Result: "+N),v(null,N)})}):this.Request=function(v,C,L,N,M,I,P){P(new S.PartialErrorInfo("no supported HTTP transports available",null,400),null)}}return h.prototype.do=function(c,u,s,w,v,C,L){var N=this,M=typeof s=="function"?s:function(j){return u.baseUri(j)+s},I=u._currentFallback;if(I)if(I.validUntil>d.now()){if(!this.Request){L==null||L(new S.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(c,u,M(I.host),w,C,v,function(j){for(var U=[],z=1;z<arguments.length;z++)U[z-1]=arguments[z];if(j&&p(j)){u._currentFallback=null,N.do(c,u,s,w,v,C,L);return}L==null||L.apply(void 0,a.__spreadArray([j],U,!1))});return}else u._currentFallback=null;var P=m(u);if(P.length===1){this.doUri(c,u,M(P[0]),w,v,C,L);return}var A=function(j,U){var z=j.shift();N.doUri(c,u,M(z),w,v,C,function($){for(var W=[],F=1;F<arguments.length;F++)W[F-1]=arguments[F];if($&&p($)&&j.length){A(j,!0);return}U&&(u._currentFallback={host:z,validUntil:d.now()+u.options.timeouts.fallbackRetryTimeout}),L==null||L.apply(void 0,a.__spreadArray([$],W,!1))})};A(P)},h.prototype.doUri=function(c,u,s,w,v,C,L){if(!this.Request){L(new S.PartialErrorInfo("Request invoked before assigned to",null,500));return}this.Request(c,u,s,w,C,v,L)},h}(),i.methods=[E.default.Get,E.default.Delete,E.default.Post,E.default.Put,E.default.Patch],i.methodsWithoutBody=[E.default.Get,E.default.Delete],i.methodsWithBody=[E.default.Post,E.default.Put,E.default.Patch],i);r.default=b},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importStar(o(4)),l=i.__importDefault(o(3)),d=i.__importDefault(o(8)),g=i.__importStar(o(1)),S=o(1);function E(f,k){return!!k.get("x-ably-errorcode")}function y(f,k){if(E(f,k))return f.error&&a.default.fromValues(f.error)}function R(f,k,T,x,p,m,b){var h=new Headers(x||{}),c=f?f.toUpperCase():g.isEmptyArg(m)?"GET":"POST",u=new AbortController,s=setTimeout(function(){u.abort(),b(new a.PartialErrorInfo("Request timed out",null,408))},k?k.options.timeouts.httpRequestTimeout:d.default.TIMEOUTS.httpRequestTimeout),w={method:c,headers:h,body:m};l.default.Config.isWebworker||(w.credentials=h.has("authorization")?"include":"same-origin"),(0,S.getGlobalObject)().fetch(T+"?"+new URLSearchParams(p||{}),w).then(function(v){clearTimeout(s);var C=v.headers.get("Content-Type"),L;C&&C.indexOf("application/x-msgpack")>-1?L=v.arrayBuffer():C&&C.indexOf("application/json")>-1?L=v.json():L=v.text(),L.then(function(N){var M=!!C&&C.indexOf("application/x-msgpack")===-1;if(v.ok)b(null,N,v.headers,M,v.status);else{var I=y(N,v.headers)||new a.PartialErrorInfo("Error response received from server: "+v.status+" body was: "+l.default.Config.inspect(N),null,v.status);b(I,N,v.headers,M,v.status)}})}).catch(function(v){clearTimeout(s),b(v)})}r.default=R},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(41)),l=i.__importStar(o(1)),d=l.getGlobalObject();typeof Window=="undefined"&&typeof WorkerGlobalScope=="undefined"&&console.log("Warning: this distribution of Ably is intended for browsers. On nodejs, please use the 'ably' package on npm");function g(){var R=d.location;return!d.WebSocket||!R||!R.origin||R.origin.indexOf("http")>-1}var S=d.navigator&&d.navigator.userAgent.toString(),E=d.location&&d.location.href,y={agent:"browser",logTimestamps:!0,userAgent:S,currentUrl:E,noUpgrade:S&&!!S.match(/MSIE\s8\.0/),binaryType:"arraybuffer",WebSocket:d.WebSocket,fetchSupported:!!d.fetch,xhrSupported:d.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,jsonpSupported:typeof document!="undefined",allowComet:g(),streamingSupported:!0,useProtocolHeartbeats:!0,createHmac:null,msgpack:a.default,supportsBinary:!!d.TextDecoder,preferBinary:!1,ArrayBuffer:d.ArrayBuffer,atob:d.atob,nextTick:typeof d.setImmediate!="undefined"?d.setImmediate.bind(d):function(R){setTimeout(R,0)},addEventListener:d.addEventListener,inspect:JSON.stringify,stringByteSize:function(R){return d.TextDecoder&&new d.TextEncoder().encode(R).length||R.length},TextEncoder:d.TextEncoder,TextDecoder:d.TextDecoder,Promise:d.Promise,getRandomValues:function(R){if(R!==void 0)return function(f,k){R.getRandomValues(f),k&&k(null)}}(d.crypto||msCrypto)};r.default=y},function(n,r,o){(function(i){Object.defineProperty(r,"__esModule",{value:!0});var a=o(0),l=a.__importStar(o(1)),d="ablyjs-storage-test",g=function(){function S(){try{i.sessionStorage.setItem(d,d),i.sessionStorage.removeItem(d),this.sessionSupported=!0}catch(E){this.sessionSupported=!1}try{i.localStorage.setItem(d,d),i.localStorage.removeItem(d),this.localSupported=!0}catch(E){this.localSupported=!1}}return S.prototype.get=function(E){return this._get(E,!1)},S.prototype.getSession=function(E){return this._get(E,!0)},S.prototype.remove=function(E){return this._remove(E,!1)},S.prototype.removeSession=function(E){return this._remove(E,!0)},S.prototype.set=function(E,y,R){return this._set(E,y,R,!1)},S.prototype.setSession=function(E,y,R){return this._set(E,y,R,!0)},S.prototype._set=function(E,y,R,f){var k={value:y};return R&&(k.expires=l.now()+R),this.storageInterface(f).setItem(E,JSON.stringify(k))},S.prototype._get=function(E,y){if(y&&!this.sessionSupported)throw new Error("Session Storage not supported");if(!y&&!this.localSupported)throw new Error("Local Storage not supported");var R=this.storageInterface(y).getItem(E);if(!R)return null;var f=JSON.parse(R);return f.expires&&f.expires<l.now()?(this.storageInterface(y).removeItem(E),null):f.value},S.prototype._remove=function(E,y){return this.storageInterface(y).removeItem(E)},S.prototype.storageInterface=function(E){return E?i.sessionStorage:i.localStorage},S}();r.default=new g}).call(this,o(13))},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i=o(0),a=i.__importDefault(o(67)),l={connectivityCheckUrl:"https://internet-up.ably-realtime.com/is-the-internet-up.txt",jsonpInternetUpUrl:"https://internet-up.ably-realtime.com/is-the-internet-up-0-9.js",defaultTransports:[a.default.XhrPolling,a.default.XhrStreaming,a.default.JsonP,a.default.WebSocket],baseTransportOrder:[a.default.XhrPolling,a.default.XhrStreaming,a.default.JsonP,a.default.WebSocket],transportPreferenceOrder:[a.default.JsonP,a.default.XhrPolling,a.default.XhrStreaming,a.default.WebSocket],upgradeTransports:[a.default.XhrStreaming,a.default.WebSocket]};r.default=l},function(n,r,o){Object.defineProperty(r,"__esModule",{value:!0});var i;(function(a){a.WebSocket="web_socket",a.Comet="comet",a.XhrStreaming="xhr_streaming",a.XhrPolling="xhr_polling",a.JsonP="jsonp"})(i||(i={})),r.default=i},function(n,r,o){o.r(r);var i=o(29),a=o.n(i),l=o(1),d=o(3),g=o.n(d),S=o(12),E=o.n(S),y=o(17),R=o.n(y),f=function(p){var m="xhr_polling";function b(h,c,u){u.stream=!1,E.a.call(this,h,c,u),this.shortName=m}return l.inherits(b,E.a),b.isAvailable=function(){return g.a.Config.xhrSupported&&g.a.Config.allowComet},b.prototype.toString=function(){return"XHRPollingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},b.prototype.createRequest=function(h,c,u,s,w){return R.a.createRequest(h,c,u,s,w,this.timeouts)},typeof p!="undefined"&&b.isAvailable()&&(p.supportedTransports[m]=b),b},k=f,T=function(p){var m="xhr_streaming";function b(h,c,u){E.a.call(this,h,c,u),this.shortName=m}return l.inherits(b,E.a),b.isAvailable=function(){return g.a.Config.xhrSupported&&g.a.Config.streamingSupported&&g.a.Config.allowComet},b.prototype.toString=function(){return"XHRStreamingTransport; uri="+this.baseUri+"; isConnected="+this.isConnected},b.prototype.createRequest=function(h,c,u,s,w){return R.a.createRequest(h,c,u,s,w,this.timeouts)},typeof p!="undefined"&&b.isAvailable()&&(p.supportedTransports[m]=b),b},x=T;r.default=[a.a,k,x]}]).default})})(rd);var Bg=rd.exports;const _g=pe(Bg),xi=(e,t,n,r,o)=>it(this,null,function*(){try{const i=new _g.Realtime({token:e.token,clientId:e.clientId});i.connection.on("connected",()=>{o==null||o("connected")}),i.connection.on("failed",d=>{console.error("[❌ ABLY CONNECTION FAILED]",d),o==null||o("failed")}),i.connection.on("disconnected",()=>{o==null||o("disconnected")});const a=`room:${t}:${n}`,l=i.channels.get(a);return l.subscribe("messages",d=>{var g;try{const S=(g=d.data)==null?void 0:g.message;if(S&&S.role==="employee"){const E={id:S.id||wt(),text:S.content||"",sender:"bot",timestamp:S.createdAt?new Date(S.createdAt):new Date,type:S.type};r(E)}}catch(S){console.error("[❌ MESSAGE PARSING ERROR]",S)}}),{client:i,channel:l}}catch(i){throw console.error("[❌ ABLY INITIALIZATION ERROR]",i),i}}),zg=(e,t)=>it(this,null,function*(){try{const n=nd(),r=yield fetch(`${n}?conversationId=${e}&chatbotUid=${t}`);return r.ok?yield r.json():(console.error("Failed to fetch conversation data:",r.statusText),null)}catch(n){return console.error("[❌ ABLY TOKEN FETCH ERROR]",n),null}}),od=e=>{e&&e.close()},Si=()=>({id:wt(),text:"Lo siento, hubo un problema con la conexión. Esta es una respuesta de demostración.",sender:"bot",timestamp:new Date().toISOString(),type:"text"}),id=(e,t,n,r)=>{const o=Ug(t,e),i={id:e,senderId:r||"unknown",createdAt:new Date().toISOString(),chatbotActivated:!0,updatedAt:new Date().toISOString(),source:"IFRAME",website:typeof window!="undefined"?window.location.origin:"",messages:o};return{conversationId:e,conversation:i,chatbotUid:n.apiKey}},ad=e=>it(this,null,function*(){try{const t=Lg(),n=yield fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return n.ok?yield n.json():(console.error("WebChat: API request failed:",n.status,n.statusText),null)}catch(t){return console.error("WebChat: Error sending message to API:",t),null}}),sd=e=>{if(e&&e.content){let t;return e.createdAt?t=e.createdAt.endsWith("Z")?e.createdAt:`${e.createdAt}Z`:t=new Date().toISOString(),{id:e.id||wt(),text:e.content,sender:"bot",timestamp:t,type:e.type}}return null},Hg=e=>`¡Hola! Soy ${e||"tu asistente"}, ¿En qué te puedo ayudar?
146
146
 
147
147
  Aunque no lo creas, soy una inteligencia artificial! Puedo resolver todas tus dudas 😊
148
148
 
149
- También puedes pedir hablar con nuestro equipo de los sueños!`,ld=e=>({id:wt(),text:Hg(e),sender:"bot",timestamp:new Date().toISOString(),type:"text"}),ud=()=>typeof window!="undefined"&&window.innerWidth<640,Fg=({config:e})=>{if(!e.apiKey)return null;const[t,n]=te.useState(()=>wo(e)),[r,i]=te.useState(!1),[o,a]=te.useState(()=>ud()),[l,d]=te.useState(""),[g,S]=te.useState(!1),[E,y]=te.useState(!1),[R,f]=te.useState(!1),[k,T]=te.useState(""),[,x]=te.useState(null),p=te.useRef(null),[m,b]=te.useState(!1),[h,c]=te.useState(!1),[u,s]=te.useState(""),[w,v]=te.useState([e.initialMessage?{id:wt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString(),type:"text"}:ld(e.title)]),C=te.useCallback((U,z="bot")=>{v($=>[...$,U]),!r&&(U.sender==="bot"||z==="bot")&&U.id!==u&&b(!0)},[r,u]);te.useEffect(()=>{const U=()=>{const z=ud();a(z)};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),te.useEffect(()=>Mg(()=>{n(wo(e))}),[e]),te.useEffect(()=>{n(wo(e))},[e]),te.useEffect(()=>{ot(this,null,function*(){const z=Zf();d(z);const $=yield ed();T($)})},[]),te.useEffect(()=>{if(w.length>0){const U=w[w.length-1];U.sender==="bot"&&s(U.id)}},[]);const L=te.useCallback(U=>{C(U,"ably")},[C]),N=te.useCallback(U=>ot(this,null,function*(){if(!(h||p.current))try{if(U.tokenDetails){const z=yield xo(U.tokenDetails,e.apiKey||"",l,L);x(z),p.current=z.client,c(!0)}}catch(z){console.error("[❌ ABLY SETUP ERROR from history]",z)}}),[h,l,L]),P=te.useCallback(()=>ot(this,null,function*(){if(!(h||p.current))try{const U=yield zg(l,e.apiKey||"");if(U!=null&&U.tokenDetails){const z=yield xo(U.tokenDetails,e.apiKey||"",l,L);x(z),p.current=z.client,c(!0)}}catch(U){console.error("[❌ ABLY SETUP ERROR from endpoint]",U)}}),[h,l,e.apiKey,L]),I=te.useCallback(()=>ot(this,null,function*(){var z,$;const U=r;if(i(W=>!W),!U){b(!1);const W=w.filter(F=>F.sender==="bot").slice(-1)[0];W&&s(W.id)}if(!U&&!g&&l&&qf()&&!h){y(!0);const W=yield Dg(l,e.apiKey||"");if((($=(z=W==null?void 0:W.conversation)==null?void 0:z.messages)==null?void 0:$.length)>0){const F=jg(W.conversation.messages);v(F);const O=F.filter(D=>D.sender==="bot").slice(-1)[0];O&&s(O.id),yield N(W)}else console.warn("WebChat: No conversation history found, showing initial message");y(!1),S(!0)}else!U&&qf()&&!h?yield P():U||console.warn("WebChat: Chat opened - no existing conversation to fetch")}),[r,l,g,h,e.apiKey,N,P,w]),M=te.useCallback(()=>{i(!1)},[]),A=te.useCallback(U=>ot(this,null,function*(){const z=new Date().toISOString(),$={id:wt(),text:U,sender:"user",timestamp:z,type:"text"};v(F=>[...F,$]),f(!0);const W=[...w,$];try{const F=od(l,W,{apiKey:e.apiKey||""},k),O=yield ad(F);if(O){if(O.response.tokenDetails&&!p.current){const B=yield xo(O.response.tokenDetails,e.apiKey||"",l,L);x(B),p.current=B.client,c(!0)}const D=sd(O.response.message);D&&C(D,"bot")}else{setTimeout(()=>{const D=So();C(D,"bot"),f(!1)},1e3);return}}catch(F){console.error("WebChat: Error in message handling:",F),setTimeout(()=>{const O=So();C(O,"bot"),f(!1)},1e3);return}f(!1),Ag(!0)}),[l,w,e.apiKey,k,L,C]),j=Pg(e);return te.useEffect(()=>()=>{id(p.current),p.current=null},[]),G.jsxs("div",{className:"nbc-font-sans",style:{zIndex:2147483647},children:[G.jsx(Eg,{initialMessage:e.initialMessage,avatar:t.avatar,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,primaryColor:t.primaryColor||"#007bff",isMobile:o,isOpen:r}),G.jsx(Bp,{isOpen:r,onClick:I,primaryColor:t.primaryColor,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,hasNewMessages:m,isMobile:o}),G.jsx(Rg,{isOpen:r,onClose:M,config:t,messages:w,onSendMessage:A,isLoading:E,isAiTyping:R,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,isMobile:o,apiKeyMissing:!e.apiKey})]})},cd='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.nbc-pointer-events-none{pointer-events:none}.nbc-pointer-events-auto{pointer-events:auto}.nbc-fixed{position:fixed}.nbc-absolute{position:absolute}.nbc-relative{position:relative}.nbc-inset-0{inset:0}.nbc-inset-auto{inset:auto}.nbc-right-0{right:0}.nbc-right-2{right:.5rem}.nbc-top-0{top:0}.nbc-top-1\\/2{top:50%}.nbc-top-2{top:.5rem}.nbc-top-full{top:100%}.nbc-m-0{margin:0}.nbc-mb-1{margin-bottom:.25rem}.nbc-mb-2{margin-bottom:.5rem}.nbc-mb-4{margin-bottom:1rem}.nbc-ml-2{margin-left:.5rem}.nbc-mr-3{margin-right:.75rem}.nbc-mt-1{margin-top:.25rem}.nbc-line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.nbc-flex{display:flex}.nbc-hidden{display:none}.nbc-h-0{height:0px}.nbc-h-10{height:2.5rem}.nbc-h-12{height:3rem}.nbc-h-16{height:4rem}.nbc-h-2{height:.5rem}.nbc-h-24{height:6rem}.nbc-h-3{height:.75rem}.nbc-h-4{height:1rem}.nbc-h-5{height:1.25rem}.nbc-h-6{height:1.5rem}.nbc-h-7{height:1.75rem}.nbc-h-8{height:2rem}.nbc-h-auto{height:auto}.nbc-h-full{height:100%}.nbc-min-h-0{min-height:0px}.nbc-min-h-\\[220px\\]{min-height:220px}.nbc-w-0{width:0px}.nbc-w-10{width:2.5rem}.nbc-w-12{width:3rem}.nbc-w-16{width:4rem}.nbc-w-2{width:.5rem}.nbc-w-3{width:.75rem}.nbc-w-4{width:1rem}.nbc-w-5{width:1.25rem}.nbc-w-6{width:1.5rem}.nbc-w-7{width:1.75rem}.nbc-w-8{width:2rem}.nbc-w-auto{width:auto}.nbc-w-full{width:100%}.nbc-max-w-\\[90\\%\\]{max-width:90%}.nbc-max-w-xs{max-width:20rem}.nbc-flex-1{flex:1 1 0%}.nbc-flex-shrink-0{flex-shrink:0}.nbc--translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-3{--tw-translate-y: .75rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-\\[-10px\\]{--tw-translate-y: -10px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes nbc-bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.nbc-animate-bounce{animation:nbc-bounce 1s infinite}@keyframes nbc-ping{75%,to{transform:scale(2);opacity:0}}.nbc-animate-ping{animation:nbc-ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes nbc-pulse{50%{opacity:.5}}.nbc-animate-pulse{animation:nbc-pulse 2s cubic-bezier(.4,0,.6,1) infinite}.nbc-cursor-pointer{cursor:pointer}.nbc-flex-col{flex-direction:column}.nbc-items-start{align-items:flex-start}.nbc-items-end{align-items:flex-end}.nbc-items-center{align-items:center}.nbc-justify-start{justify-content:flex-start}.nbc-justify-end{justify-content:flex-end}.nbc-justify-center{justify-content:center}.nbc-justify-between{justify-content:space-between}.nbc-gap-2{gap:.5rem}.nbc-space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.nbc-space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.nbc-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.nbc-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.nbc-overflow-hidden{overflow:hidden}.nbc-overflow-y-auto{overflow-y:auto}.nbc-whitespace-nowrap{white-space:nowrap}.nbc-break-words{overflow-wrap:break-word}.nbc-rounded{border-radius:.25rem}.nbc-rounded-2xl{border-radius:1rem}.nbc-rounded-full{border-radius:9999px}.nbc-rounded-lg{border-radius:.5rem}.nbc-rounded-none{border-radius:0}.nbc-rounded-bl-md{border-bottom-left-radius:.375rem}.nbc-rounded-br-md{border-bottom-right-radius:.375rem}.nbc-border-0{border-width:0px}.nbc-border-2{border-width:2px}.nbc-border-t{border-top-width:1px}.nbc-border-none{border-style:none}.nbc-border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.nbc-border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.nbc-bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.nbc-bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.nbc-bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.nbc-bg-transparent{background-color:transparent}.nbc-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.nbc-bg-none{background-image:none}.nbc-object-cover{-o-object-fit:cover;object-fit:cover}.nbc-p-0{padding:0}.nbc-p-1{padding:.25rem}.nbc-p-2{padding:.5rem}.nbc-p-4{padding:1rem}.nbc-p-5{padding:1.25rem}.nbc-px-2{padding-left:.5rem;padding-right:.5rem}.nbc-px-4{padding-left:1rem;padding-right:1rem}.nbc-py-2{padding-top:.5rem;padding-bottom:.5rem}.nbc-py-3{padding-top:.75rem;padding-bottom:.75rem}.nbc-pr-12{padding-right:3rem}.nbc-pt-4{padding-top:1rem}.nbc-text-center{text-align:center}.nbc-text-right{text-align:right}.nbc-font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.nbc-text-\\[15px\\]{font-size:15px}.nbc-text-base{font-size:1rem;line-height:1.5rem}.nbc-text-lg{font-size:1.125rem;line-height:1.75rem}.nbc-text-sm{font-size:.875rem;line-height:1.25rem}.nbc-text-xs{font-size:.75rem;line-height:1rem}.nbc-font-bold{font-weight:700}.nbc-font-medium{font-weight:500}.nbc-italic{font-style:italic}.nbc-leading-none{line-height:1}.nbc-leading-relaxed{line-height:1.625}.nbc-text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.nbc-text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.nbc-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.nbc-text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.nbc-text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.nbc-text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.nbc-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.nbc-no-underline{text-decoration-line:none}.nbc-opacity-0{opacity:0}.nbc-opacity-100{opacity:1}.nbc-opacity-50{opacity:.5}.nbc-opacity-70{opacity:.7}.nbc-opacity-75{opacity:.75}.nbc-shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-outline-none{outline:2px solid transparent;outline-offset:2px}.nbc-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.nbc-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.nbc-duration-200{transition-duration:.2s}.nbc-duration-300{transition-duration:.3s}.nbc-duration-500{transition-duration:.5s}.nbc-ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover\\:nbc-scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:nbc-bg-black:hover{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.hover\\:nbc-bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\\:nbc-bg-opacity-20:hover{--tw-bg-opacity: .2}.hover\\:nbc-text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.disabled\\:nbc-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:nbc-opacity-50:disabled{opacity:.5}',Gg={apiKey:"",primaryColor:"#111111",avatar:"",title:"NotChatBot",placeholder:"Escribe tu mensaje...",initialMessage:"¡Hola! ¿En qué puedo ayudarte?",position:"bottom-right",marginBottom:20,marginSide:20,mobile:{position:"bottom-right",marginBottom:15,marginSide:15},desktop:{position:"bottom-right",marginBottom:25,marginSide:25},closeButtonIcon:"default",closeButtonText:"Cerrar",closeButtonCustomIcon:""},Wg=({title:e,primaryColor:t="#3b82f6",avatar:n})=>{const r={backgroundColor:t};return G.jsxs("div",{id:"notchatbot-embed-chat-header",style:r,className:"nbc-flex nbc-items-center nbc-p-4",children:[G.jsx("div",{className:"nbc-flex nbc-items-center nbc-mr-3 nbc-text-black",children:n?G.jsx("img",{src:n,alt:"Avatar",className:"nbc-w-8 nbc-h-8 nbc-rounded-full nbc-object-cover"}):G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[G.jsx("path",{d:"M12 6V2H8"}),G.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),G.jsx("path",{d:"M2 12h2"}),G.jsx("path",{d:"M9 11v2"}),G.jsx("path",{d:"M15 11v2"}),G.jsx("path",{d:"M20 12h2"})]})}),G.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]})},$g=({footerText:e,primaryColor:t,footerColor:n})=>{if(!e)return null;const r=i=>{const o=/(https?:\/\/[^\s]+)/g;return i.split(o).map((l,d)=>o.test(l)?G.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"nbc-font-medium nbc-no-underline",style:{color:t},children:l},d):l)};return G.jsx("div",{id:"notchatbot-embed-chat-footer",className:"nbc-py-3 nbc-px-4 nbc-bg-gray-50 nbc-text-xs nbc-text-gray-600 nbc-text-center nbc-leading-relaxed nbc-italic",style:{backgroundColor:n},children:r(e)})},Vg=({config:e,messages:t,onSendMessage:n,isLoading:r,isAiTyping:i})=>{var l;const o=(d,g="auto")=>d===void 0?g:typeof d=="number"?`${d}px`:d,a={width:o(e.width,"100%"),height:o(e.height,"400px"),maxWidth:o(e.maxWidth,"100%"),maxHeight:o(e.maxHeight,"100vh"),minWidth:o(e.minWidth,"280px"),minHeight:o(e.minHeight,"300px"),display:"flex",flexDirection:"column",backgroundColor:e.chatTransparent?"transparent":e.chatBackground||"#ffffff",borderRadius:o(e.borderRadius,"12px"),border:e.border||"1px solid #e5e7eb",boxShadow:e.boxShadow||"0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",overflow:"hidden",position:"relative"};return G.jsxs("div",{id:"notchatbot-embed-chat",className:"nbc-font-sans",style:a,children:[e.showHeader!==!1&&G.jsx(Wg,{title:e.title||"Chat",primaryColor:e.primaryColor,avatar:e.avatar}),G.jsxs("div",{id:"notchatbot-embed-chat-body",className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-min-h-0",style:{position:"relative",overflow:"hidden"},children:[r?G.jsx("div",{className:"nbc-flex-1 nbc-p-4",children:G.jsx(Vf,{})}):G.jsx(Wf,{messages:t,isTyping:i||!1,avatar:e.avatar,textColor:e.textColor,bubbleUserColor:e.bubbleUserColor}),G.jsx("div",{id:"notchatbot-embed-chat-body-input",className:"nbc-py-2 nbc-bg-gray-50 nbc-border-none",style:{backgroundColor:(l=e.input)==null?void 0:l.backgroundColor},children:G.jsx($f,{onSendMessage:n,placeholder:e.placeholder||"Escribe un mensaje...",primaryColor:e.primaryColor,disabled:r,input:e.input})})]}),e.showFooter!==!1&&e.footerText&&G.jsx($g,{footerText:e.footerText,primaryColor:e.primaryColor,footerColor:e.footerColor})]})},fd=({config:e})=>{if(!e.apiKey)return null;const[t,n]=te.useState(""),[r,i]=te.useState(!1),[o,a]=te.useState(""),[,l]=te.useState(null),d=te.useRef(null),[,g]=te.useState(!1),[S,E]=te.useState([e.initialMessage?{id:wt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString(),type:"text"}:ld(e.title)]),y=te.useCallback(k=>{E(T=>[...T,k])},[]);te.useEffect(()=>{ot(this,null,function*(){const T=yield ed();a(T)})},[]);const R=te.useCallback(k=>{y(k)},[y]),f=te.useCallback(k=>ot(this,null,function*(){if(!k.trim())return;let T=t;T||(T=wt(),n(T));const x={id:wt(),text:k,sender:"user",timestamp:new Date().toISOString(),conversationId:T,type:"text"};y(x),i(!0);const p=[...S,x];try{const m=od(T,p,{apiKey:e.apiKey||""},o),b=yield ad(m);if(b){if(b.response.tokenDetails&&!d.current){const c=yield xo(b.response.tokenDetails,e.apiKey||"",T,R);l(c),d.current=c.client,g(!0)}const h=sd(b.response.message);h&&y(h)}else{setTimeout(()=>{const h=So();y(h),i(!1)},1e3);return}i(!1)}catch(m){console.error("EmbedChat: Error sending message:",m),setTimeout(()=>{const b=So();y(b),i(!1)},1e3);return}}),[t,o,e.apiKey,y,R,S]);return te.useEffect(()=>()=>{d.current&&id(d.current)},[]),G.jsx(Vg,{config:e,messages:S,onSendMessage:f,isLoading:!1,isAiTyping:r})};let dd=!1,bo=null;const hd=e=>{try{e&&(dd=!0),bo&&(bo.destroy(),bo=null);const t=fe(fe({elementId:"webchat-notchatbot"},Gg),e),n=document.getElementById(t.elementId);if(!n)return console.error(`WebChat: Element with id "${t.elementId}" not found`),null;let r;n.shadowRoot?(r=n.shadowRoot,r.innerHTML=""):r=n.attachShadow({mode:"open"});const i=document.createElement("style");i.textContent=cd,r.appendChild(i);const o=document.createElement("div");r.appendChild(o);const a=zs(o);return a.render(Po.createElement(Fg,{config:t})),{root:a,destroy:()=>{a.unmount(),bo=null},getConversationId:()=>Zf()}}catch(t){return console.error("WebChat: Failed to initialize",t),null}},Qg=e=>{try{if(!e.elementId)return console.error("EmbedChat: elementId is required"),null;const t=document.getElementById(e.elementId);if(!t)return console.error(`EmbedChat: Element with id "${e.elementId}" not found`),null;let n;t.shadowRoot?(n=t.shadowRoot,n.innerHTML=""):n=t.attachShadow({mode:"open"});const r=document.createElement("style");if(r.textContent=cd,n.appendChild(r),e.customCSS){const a=document.createElement("style");a.setAttribute("data-custom","true"),a.textContent=e.customCSS,n.appendChild(a)}const i=document.createElement("div");n.appendChild(i);const o=zs(i);return o.render(Po.createElement(fd,{config:e})),{destroy:()=>{o.unmount()},updateConfig:a=>{const l=fe(fe({},e),a);if(a.customCSS!==void 0){const d=n.querySelector("style[data-custom]");if(d&&d.remove(),l.customCSS){const g=document.createElement("style");g.setAttribute("data-custom","true"),g.textContent=l.customCSS,n.appendChild(g)}}o.render(Po.createElement(fd,{config:l}))},injectCSS:a=>{const l=n.querySelector("style[data-custom]");l&&l.remove();const d=document.createElement("style");d.setAttribute("data-custom","true"),d.textContent=a,n.appendChild(d)},removeCustomCSS:()=>{const a=n.querySelector("style[data-custom]");a&&a.remove()}}}catch(t){return console.error("EmbedChat: Failed to initialize",t),null}},pd={initialize:hd},gd={initialize:Qg};if(typeof window!="undefined"){window.WebChat=pd,window.EmbedChat=gd;const e=()=>{if(!dd){let i=document.getElementById("webchat-notchatbot");i||(i=document.createElement("div"),i.id="webchat-notchatbot",document.body.appendChild(i)),hd()}const r=new CustomEvent("WebChatReady");document.dispatchEvent(r)},t=()=>{const r=new CustomEvent("EmbedChatReady");document.dispatchEvent(r)},n=()=>{e(),t()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",n):setTimeout(n,0)}Ce.EmbedChatAPI=gd,Ce.WebChat=pd,Object.defineProperty(Ce,Symbol.toStringTag,{value:"Module"})});
149
+ También puedes pedir hablar con nuestro equipo de los sueños!`,ld=e=>({id:wt(),text:Hg(e),sender:"bot",timestamp:new Date().toISOString(),type:"text"}),ud=()=>typeof window!="undefined"&&window.innerWidth<640,Fg=({config:e})=>{if(!e.apiKey)return null;const[t,n]=te.useState(()=>wi(e)),[r,o]=te.useState(!1),[i,a]=te.useState(()=>ud()),[l,d]=te.useState(""),[g,S]=te.useState(!1),[E,y]=te.useState(!1),[R,f]=te.useState(!1),[k,T]=te.useState(""),[,x]=te.useState(null),p=te.useRef(null),[m,b]=te.useState(!1),[h,c]=te.useState(!1),[u,s]=te.useState(""),[w,v]=te.useState([e.initialMessage?{id:wt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString(),type:"text"}:ld(e.title)]),C=te.useCallback((U,z="bot")=>{v($=>[...$,U]),!r&&(U.sender==="bot"||z==="bot")&&U.id!==u&&b(!0)},[r,u]);te.useEffect(()=>{const U=()=>{const z=ud();a(z)};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),te.useEffect(()=>Pg(()=>{n(wi(e))}),[e]),te.useEffect(()=>{n(wi(e))},[e]),te.useEffect(()=>{it(this,null,function*(){const z=Zf();d(z);const $=yield ed();T($)})},[]),te.useEffect(()=>{if(w.length>0){const U=w[w.length-1];U.sender==="bot"&&s(U.id)}},[]);const L=te.useCallback(U=>{C(U,"ably")},[C]),N=te.useCallback(U=>it(this,null,function*(){if(!(h||p.current))try{if(U.tokenDetails){const z=yield xi(U.tokenDetails,e.apiKey||"",l,L);x(z),p.current=z.client,c(!0)}}catch(z){console.error("[❌ ABLY SETUP ERROR from history]",z)}}),[h,l,L]),M=te.useCallback(()=>it(this,null,function*(){if(!(h||p.current))try{const U=yield zg(l,e.apiKey||"");if(U!=null&&U.tokenDetails){const z=yield xi(U.tokenDetails,e.apiKey||"",l,L);x(z),p.current=z.client,c(!0)}}catch(U){console.error("[❌ ABLY SETUP ERROR from endpoint]",U)}}),[h,l,e.apiKey,L]),I=te.useCallback(()=>it(this,null,function*(){var z,$;const U=r;if(o(W=>!W),!U){b(!1);const W=w.filter(F=>F.sender==="bot").slice(-1)[0];W&&s(W.id)}if(!U&&!g&&l&&qf()&&!h){y(!0);const W=yield Dg(l,e.apiKey||"");if((($=(z=W==null?void 0:W.conversation)==null?void 0:z.messages)==null?void 0:$.length)>0){const F=jg(W.conversation.messages);v(F);const O=F.filter(D=>D.sender==="bot").slice(-1)[0];O&&s(O.id),yield N(W)}else console.warn("WebChat: No conversation history found, showing initial message");y(!1),S(!0)}else!U&&qf()&&!h?yield M():U||console.warn("WebChat: Chat opened - no existing conversation to fetch")}),[r,l,g,h,e.apiKey,N,M,w]),P=te.useCallback(()=>{o(!1)},[]),A=te.useCallback(U=>it(this,null,function*(){const z=new Date().toISOString(),$={id:wt(),text:U,sender:"user",timestamp:z,type:"text"};v(F=>[...F,$]),f(!0);const W=[...w,$];try{const F=id(l,W,{apiKey:e.apiKey||""},k),O=yield ad(F);if(O){if(O.response.tokenDetails&&!p.current){const B=yield xi(O.response.tokenDetails,e.apiKey||"",l,L);x(B),p.current=B.client,c(!0)}const D=sd(O.response.message);D&&C(D,"bot")}else{setTimeout(()=>{const D=Si();C(D,"bot"),f(!1)},1e3);return}}catch(F){console.error("WebChat: Error in message handling:",F),setTimeout(()=>{const O=Si();C(O,"bot"),f(!1)},1e3);return}f(!1),Ag(!0)}),[l,w,e.apiKey,k,L,C]),j=Mg(e);return te.useEffect(()=>()=>{od(p.current),p.current=null},[]),G.jsxs("div",{className:"nbc-font-sans",style:{zIndex:2147483647},children:[j.showPopup!==!1&&G.jsx(Eg,{initialMessage:e.initialMessage,avatar:t.avatar,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,primaryColor:t.primaryColor||"#007bff",isMobile:i,isOpen:r}),G.jsx(Bp,{isOpen:r,onClick:I,primaryColor:t.primaryColor,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,hasNewMessages:m,isMobile:i}),G.jsx(Rg,{isOpen:r,onClose:P,config:t,messages:w,onSendMessage:A,isLoading:E,isAiTyping:R,position:j.position,marginBottom:j.marginBottom,marginSide:j.marginSide,isMobile:i,apiKeyMissing:!e.apiKey})]})},cd='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.nbc-pointer-events-none{pointer-events:none}.nbc-pointer-events-auto{pointer-events:auto}.nbc-fixed{position:fixed}.nbc-absolute{position:absolute}.nbc-relative{position:relative}.nbc-inset-0{inset:0}.nbc-inset-auto{inset:auto}.nbc-right-0{right:0}.nbc-right-2{right:.5rem}.nbc-top-0{top:0}.nbc-top-1\\/2{top:50%}.nbc-top-2{top:.5rem}.nbc-top-full{top:100%}.nbc-m-0{margin:0}.nbc-mb-1{margin-bottom:.25rem}.nbc-mb-2{margin-bottom:.5rem}.nbc-mb-4{margin-bottom:1rem}.nbc-ml-2{margin-left:.5rem}.nbc-mr-3{margin-right:.75rem}.nbc-mt-1{margin-top:.25rem}.nbc-line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.nbc-flex{display:flex}.nbc-hidden{display:none}.nbc-h-0{height:0px}.nbc-h-10{height:2.5rem}.nbc-h-12{height:3rem}.nbc-h-16{height:4rem}.nbc-h-2{height:.5rem}.nbc-h-24{height:6rem}.nbc-h-3{height:.75rem}.nbc-h-4{height:1rem}.nbc-h-5{height:1.25rem}.nbc-h-6{height:1.5rem}.nbc-h-7{height:1.75rem}.nbc-h-8{height:2rem}.nbc-h-auto{height:auto}.nbc-h-full{height:100%}.nbc-min-h-0{min-height:0px}.nbc-min-h-\\[220px\\]{min-height:220px}.nbc-w-0{width:0px}.nbc-w-10{width:2.5rem}.nbc-w-12{width:3rem}.nbc-w-16{width:4rem}.nbc-w-2{width:.5rem}.nbc-w-3{width:.75rem}.nbc-w-4{width:1rem}.nbc-w-5{width:1.25rem}.nbc-w-6{width:1.5rem}.nbc-w-7{width:1.75rem}.nbc-w-8{width:2rem}.nbc-w-auto{width:auto}.nbc-w-full{width:100%}.nbc-max-w-\\[90\\%\\]{max-width:90%}.nbc-max-w-xs{max-width:20rem}.nbc-flex-1{flex:1 1 0%}.nbc-flex-shrink-0{flex-shrink:0}.nbc--translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-3{--tw-translate-y: .75rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-translate-y-\\[-10px\\]{--tw-translate-y: -10px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.nbc-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes nbc-bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.nbc-animate-bounce{animation:nbc-bounce 1s infinite}@keyframes nbc-ping{75%,to{transform:scale(2);opacity:0}}.nbc-animate-ping{animation:nbc-ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes nbc-pulse{50%{opacity:.5}}.nbc-animate-pulse{animation:nbc-pulse 2s cubic-bezier(.4,0,.6,1) infinite}.nbc-cursor-pointer{cursor:pointer}.nbc-flex-col{flex-direction:column}.nbc-items-start{align-items:flex-start}.nbc-items-end{align-items:flex-end}.nbc-items-center{align-items:center}.nbc-justify-start{justify-content:flex-start}.nbc-justify-end{justify-content:flex-end}.nbc-justify-center{justify-content:center}.nbc-justify-between{justify-content:space-between}.nbc-gap-2{gap:.5rem}.nbc-space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.nbc-space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.nbc-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.nbc-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.nbc-overflow-hidden{overflow:hidden}.nbc-overflow-y-auto{overflow-y:auto}.nbc-whitespace-nowrap{white-space:nowrap}.nbc-break-words{overflow-wrap:break-word}.nbc-rounded{border-radius:.25rem}.nbc-rounded-2xl{border-radius:1rem}.nbc-rounded-full{border-radius:9999px}.nbc-rounded-lg{border-radius:.5rem}.nbc-rounded-none{border-radius:0}.nbc-rounded-bl-md{border-bottom-left-radius:.375rem}.nbc-rounded-br-md{border-bottom-right-radius:.375rem}.nbc-border-0{border-width:0px}.nbc-border-2{border-width:2px}.nbc-border-t{border-top-width:1px}.nbc-border-none{border-style:none}.nbc-border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.nbc-border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.nbc-bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.nbc-bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.nbc-bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.nbc-bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.nbc-bg-transparent{background-color:transparent}.nbc-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.nbc-bg-none{background-image:none}.nbc-object-cover{-o-object-fit:cover;object-fit:cover}.nbc-p-0{padding:0}.nbc-p-1{padding:.25rem}.nbc-p-2{padding:.5rem}.nbc-p-4{padding:1rem}.nbc-p-5{padding:1.25rem}.nbc-px-2{padding-left:.5rem;padding-right:.5rem}.nbc-px-4{padding-left:1rem;padding-right:1rem}.nbc-py-2{padding-top:.5rem;padding-bottom:.5rem}.nbc-py-3{padding-top:.75rem;padding-bottom:.75rem}.nbc-pr-12{padding-right:3rem}.nbc-pt-4{padding-top:1rem}.nbc-text-center{text-align:center}.nbc-text-right{text-align:right}.nbc-font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.nbc-text-\\[15px\\]{font-size:15px}.nbc-text-base{font-size:1rem;line-height:1.5rem}.nbc-text-lg{font-size:1.125rem;line-height:1.75rem}.nbc-text-sm{font-size:.875rem;line-height:1.25rem}.nbc-text-xs{font-size:.75rem;line-height:1rem}.nbc-font-bold{font-weight:700}.nbc-font-medium{font-weight:500}.nbc-italic{font-style:italic}.nbc-leading-none{line-height:1}.nbc-leading-relaxed{line-height:1.625}.nbc-text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.nbc-text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.nbc-text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.nbc-text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.nbc-text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.nbc-text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.nbc-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.nbc-no-underline{text-decoration-line:none}.nbc-opacity-0{opacity:0}.nbc-opacity-100{opacity:1}.nbc-opacity-50{opacity:.5}.nbc-opacity-70{opacity:.7}.nbc-opacity-75{opacity:.75}.nbc-shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.nbc-outline-none{outline:2px solid transparent;outline-offset:2px}.nbc-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.nbc-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.nbc-duration-200{transition-duration:.2s}.nbc-duration-300{transition-duration:.3s}.nbc-duration-500{transition-duration:.5s}.nbc-ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover\\:nbc-scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:nbc-bg-black:hover{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.hover\\:nbc-bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\\:nbc-bg-opacity-20:hover{--tw-bg-opacity: .2}.hover\\:nbc-text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.disabled\\:nbc-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:nbc-opacity-50:disabled{opacity:.5}',Gg={apiKey:"",primaryColor:"#111111",avatar:"",title:"NotChatBot",placeholder:"Escribe tu mensaje...",initialMessage:"¡Hola! ¿En qué puedo ayudarte?",position:"bottom-right",marginBottom:20,marginSide:20,showPopup:!0,mobile:{position:"bottom-right",marginBottom:15,marginSide:15,showPopup:!0},desktop:{position:"bottom-right",marginBottom:25,marginSide:25,showPopup:!0},closeButtonIcon:"default",closeButtonText:"Cerrar",closeButtonCustomIcon:""},Wg=({title:e,primaryColor:t="#3b82f6",avatar:n})=>{const r={backgroundColor:t};return G.jsxs("div",{id:"notchatbot-embed-chat-header",style:r,className:"nbc-flex nbc-items-center nbc-p-4",children:[G.jsx("div",{className:"nbc-flex nbc-items-center nbc-mr-3 nbc-text-black",children:n?G.jsx("img",{src:n,alt:"Avatar",className:"nbc-w-8 nbc-h-8 nbc-rounded-full nbc-object-cover"}):G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"nbc-w-8 nbc-h-8 nbc-bg-white nbc-rounded-full nbc-p-1",children:[G.jsx("path",{d:"M12 6V2H8"}),G.jsx("path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z"}),G.jsx("path",{d:"M2 12h2"}),G.jsx("path",{d:"M9 11v2"}),G.jsx("path",{d:"M15 11v2"}),G.jsx("path",{d:"M20 12h2"})]})}),G.jsx("h3",{className:"nbc-m-0 nbc-text-lg nbc-font-bold nbc-text-white",children:e})]})},$g=({footerText:e,primaryColor:t,footerColor:n})=>{if(!e)return null;const r=o=>{const i=/(https?:\/\/[^\s]+)/g;return o.split(i).map((l,d)=>i.test(l)?G.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"nbc-font-medium nbc-no-underline",style:{color:t},children:l},d):l)};return G.jsx("div",{id:"notchatbot-embed-chat-footer",className:"nbc-py-3 nbc-px-4 nbc-bg-gray-50 nbc-text-xs nbc-text-gray-600 nbc-text-center nbc-leading-relaxed nbc-italic",style:{backgroundColor:n},children:r(e)})},Vg=({config:e,messages:t,onSendMessage:n,isLoading:r,isAiTyping:o})=>{var l;const i=(d,g="auto")=>d===void 0?g:typeof d=="number"?`${d}px`:d,a={width:i(e.width,"100%"),height:i(e.height,"400px"),maxWidth:i(e.maxWidth,"100%"),maxHeight:i(e.maxHeight,"100vh"),minWidth:i(e.minWidth,"280px"),minHeight:i(e.minHeight,"300px"),display:"flex",flexDirection:"column",backgroundColor:e.chatTransparent?"transparent":e.chatBackground||"#ffffff",borderRadius:i(e.borderRadius,"12px"),border:e.border||"1px solid #e5e7eb",boxShadow:e.boxShadow||"0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",overflow:"hidden",position:"relative"};return G.jsxs("div",{id:"notchatbot-embed-chat",className:"nbc-font-sans",style:a,children:[e.showHeader!==!1&&G.jsx(Wg,{title:e.title||"Chat",primaryColor:e.primaryColor,avatar:e.avatar}),G.jsxs("div",{id:"notchatbot-embed-chat-body",className:"nbc-flex-1 nbc-flex nbc-flex-col nbc-min-h-0",style:{position:"relative",overflow:"hidden"},children:[r?G.jsx("div",{className:"nbc-flex-1 nbc-p-4",children:G.jsx(Vf,{})}):G.jsx(Wf,{messages:t,isTyping:o||!1,avatar:e.avatar,textColor:e.textColor,bubbleUserColor:e.bubbleUserColor}),G.jsx("div",{id:"notchatbot-embed-chat-body-input",className:"nbc-py-2 nbc-bg-gray-50 nbc-border-none",style:{backgroundColor:(l=e.input)==null?void 0:l.backgroundColor},children:G.jsx($f,{onSendMessage:n,placeholder:e.placeholder||"Escribe un mensaje...",primaryColor:e.primaryColor,disabled:r,input:e.input})})]}),e.showFooter!==!1&&e.footerText&&G.jsx($g,{footerText:e.footerText,primaryColor:e.primaryColor,footerColor:e.footerColor})]})},fd=({config:e})=>{if(!e.apiKey)return null;const[t,n]=te.useState(""),[r,o]=te.useState(!1),[i,a]=te.useState(""),[,l]=te.useState(null),d=te.useRef(null),[,g]=te.useState(!1),[S,E]=te.useState([e.initialMessage?{id:wt(),text:e.initialMessage,sender:"bot",timestamp:new Date().toISOString(),type:"text"}:ld(e.title)]),y=te.useCallback(k=>{E(T=>[...T,k])},[]);te.useEffect(()=>{it(this,null,function*(){const T=yield ed();a(T)})},[]);const R=te.useCallback(k=>{y(k)},[y]),f=te.useCallback(k=>it(this,null,function*(){if(!k.trim())return;let T=t;T||(T=wt(),n(T));const x={id:wt(),text:k,sender:"user",timestamp:new Date().toISOString(),conversationId:T,type:"text"};y(x),o(!0);const p=[...S,x];try{const m=id(T,p,{apiKey:e.apiKey||""},i),b=yield ad(m);if(b){if(b.response.tokenDetails&&!d.current){const c=yield xi(b.response.tokenDetails,e.apiKey||"",T,R);l(c),d.current=c.client,g(!0)}const h=sd(b.response.message);h&&y(h)}else{setTimeout(()=>{const h=Si();y(h),o(!1)},1e3);return}o(!1)}catch(m){console.error("EmbedChat: Error sending message:",m),setTimeout(()=>{const b=Si();y(b),o(!1)},1e3);return}}),[t,i,e.apiKey,y,R,S]);return te.useEffect(()=>()=>{d.current&&od(d.current)},[]),G.jsx(Vg,{config:e,messages:S,onSendMessage:f,isLoading:!1,isAiTyping:r})};let dd=!1,bi=null;const hd=e=>{try{e&&(dd=!0),bi&&(bi.destroy(),bi=null);const t=fe(fe({elementId:"webchat-notchatbot"},Gg),e),n=document.getElementById(t.elementId);if(!n)return console.error(`WebChat: Element with id "${t.elementId}" not found`),null;let r;n.shadowRoot?(r=n.shadowRoot,r.innerHTML=""):r=n.attachShadow({mode:"open"});const o=document.createElement("style");o.textContent=cd,r.appendChild(o);const i=document.createElement("div");r.appendChild(i);const a=zs(i);return a.render(Mi.createElement(Fg,{config:t})),{root:a,destroy:()=>{a.unmount(),bi=null},getConversationId:()=>Zf()}}catch(t){return console.error("WebChat: Failed to initialize",t),null}},Qg=e=>{try{if(!e.elementId)return console.error("EmbedChat: elementId is required"),null;const t=document.getElementById(e.elementId);if(!t)return console.error(`EmbedChat: Element with id "${e.elementId}" not found`),null;let n;t.shadowRoot?(n=t.shadowRoot,n.innerHTML=""):n=t.attachShadow({mode:"open"});const r=document.createElement("style");if(r.textContent=cd,n.appendChild(r),e.customCSS){const a=document.createElement("style");a.setAttribute("data-custom","true"),a.textContent=e.customCSS,n.appendChild(a)}const o=document.createElement("div");n.appendChild(o);const i=zs(o);return i.render(Mi.createElement(fd,{config:e})),{destroy:()=>{i.unmount()},updateConfig:a=>{const l=fe(fe({},e),a);if(a.customCSS!==void 0){const d=n.querySelector("style[data-custom]");if(d&&d.remove(),l.customCSS){const g=document.createElement("style");g.setAttribute("data-custom","true"),g.textContent=l.customCSS,n.appendChild(g)}}i.render(Mi.createElement(fd,{config:l}))},injectCSS:a=>{const l=n.querySelector("style[data-custom]");l&&l.remove();const d=document.createElement("style");d.setAttribute("data-custom","true"),d.textContent=a,n.appendChild(d)},removeCustomCSS:()=>{const a=n.querySelector("style[data-custom]");a&&a.remove()}}}catch(t){return console.error("EmbedChat: Failed to initialize",t),null}},pd={initialize:hd},gd={initialize:Qg};if(typeof window!="undefined"){window.WebChat=pd,window.EmbedChat=gd;const e=()=>{if(!dd){let o=document.getElementById("webchat-notchatbot");o||(o=document.createElement("div"),o.id="webchat-notchatbot",document.body.appendChild(o)),hd()}const r=new CustomEvent("WebChatReady");document.dispatchEvent(r)},t=()=>{const r=new CustomEvent("EmbedChatReady");document.dispatchEvent(r)},n=()=>{e(),t()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",n):setTimeout(n,0)}Ce.EmbedChatAPI=gd,Ce.WebChat=pd,Object.defineProperty(Ce,Symbol.toStringTag,{value:"Module"})});